mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-12 22:45:31 -04:00
Added some guild functions
This commit is contained in:
@@ -21,44 +21,89 @@
|
||||
******************************************************************************/
|
||||
package resources.objects;
|
||||
|
||||
public class Guild {
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.objects.SWGObject;
|
||||
|
||||
public class Guild extends ListObject {
|
||||
|
||||
private int id;
|
||||
private String abbreviation;
|
||||
private String name;
|
||||
private SWGObject leader;
|
||||
private List<SWGObject> members;
|
||||
|
||||
public Guild(int id, String abbreviation, String name) {
|
||||
public Guild(int id, String abbreviation, String name, SWGObject leader) {
|
||||
this.id = id;
|
||||
this.abbreviation = abbreviation;
|
||||
this.name = name;
|
||||
this.leader = leader;
|
||||
this.members.add(leader);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
synchronized(objectMutex) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
synchronized(objectMutex) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
synchronized(objectMutex) {
|
||||
return abbreviation;
|
||||
}
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
synchronized(objectMutex) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
synchronized(objectMutex) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
synchronized(objectMutex) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return (Integer.toString(id) + ":" + abbreviation);
|
||||
synchronized(objectMutex) {
|
||||
return (Integer.toString(id) + ":" + abbreviation);
|
||||
}
|
||||
}
|
||||
|
||||
public SWGObject getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void setLeader(SWGObject leader) {
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
public List<SWGObject> getMembers() {
|
||||
return members;
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
synchronized(objectMutex) {
|
||||
IoBuffer buffer = bufferPool.allocate((getString().length() + 2), false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.put(getAsciiString(getString()));
|
||||
return buffer.array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
******************************************************************************/
|
||||
package services.guild;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
@@ -29,11 +28,13 @@ import org.apache.mina.core.session.IoSession;
|
||||
|
||||
import resources.common.Opcodes;
|
||||
import resources.objects.Guild;
|
||||
import resources.objects.SWGList;
|
||||
import resources.objects.guild.GuildObject;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
@@ -48,24 +49,20 @@ public class GuildService implements INetworkDispatch {
|
||||
object = (GuildObject) this.core.objectService.createObject("object/guild/shared_guild_object.iff", core.terrainService.getPlanetList().get(0));
|
||||
}
|
||||
|
||||
public Guild createGuild(String abbreviation, String name) {
|
||||
public Guild createGuild(String abbreviation, String name, SWGObject leader) {
|
||||
int id = ((object.getGuildList().get(object.getGuildList().size()).getId()) + 1);
|
||||
Guild guild = new Guild(id, abbreviation, name);
|
||||
Guild guild = new Guild(id, abbreviation, name, leader);
|
||||
|
||||
object.getGuildList().add(guild);
|
||||
|
||||
return guild;
|
||||
}
|
||||
|
||||
public void addGuild(Guild guild) {
|
||||
object.getGuildList().add(guild);
|
||||
}
|
||||
|
||||
public GuildObject getGuildObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public List<Guild> getGuildList() {
|
||||
public SWGList<Guild> getGuildList() {
|
||||
return object.getGuildList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user