Added guild chat, guild information window added, added variables in future for sponsor system

This commit is contained in:
Waverunner
2014-05-20 18:34:53 -04:00
parent b9e477ddf0
commit c9b2d1c2a2
4 changed files with 84 additions and 16 deletions
+29 -1
View File
@@ -34,11 +34,14 @@ public class Guild extends Delta implements Serializable, Comparable<Guild> {
private static final long serialVersionUID = 1L;
private int id;
private int chatRoomId;
private String abbreviation;
private String name;
private long leader;
private String leaderName;
private List<Long> members = new ArrayList<Long>();
private List<Long> sponsors = new ArrayList<Long>();
private List<Long> sponsoredPlayers = new ArrayList<Long>();
public Guild(int id, String abbreviation, String name, SWGObject leader) {
this.id = id;
@@ -46,7 +49,8 @@ public class Guild extends Delta implements Serializable, Comparable<Guild> {
this.name = name;
this.leader = leader.getObjectID();
this.leaderName = leader.getCustomName();
this.members.add(leader.getObjectID());
//this.members.add(leader.getObjectID());
//this.sponsors.add(leader.getObjectID());
}
public Guild() {
@@ -65,6 +69,14 @@ public class Guild extends Delta implements Serializable, Comparable<Guild> {
}
}
public int getChatRoomId() {
return chatRoomId;
}
public void setChatRoomId(int chatRoomId) {
this.chatRoomId = chatRoomId;
}
public String getAbbreviation() {
synchronized(objectMutex) {
return abbreviation;
@@ -121,6 +133,22 @@ public class Guild extends Delta implements Serializable, Comparable<Guild> {
}
}
public List<Long> getSponsors() {
return sponsors;
}
public void setSponsors(List<Long> sponsors) {
this.sponsors = sponsors;
}
public List<Long> getSponsoredPlayers() {
return sponsoredPlayers;
}
public void setSponsoredPlayers(List<Long> sponsoredPlayers) {
this.sponsoredPlayers = sponsoredPlayers;
}
public byte[] getBytes() {
synchronized(objectMutex) {
IoBuffer buffer = createBuffer((getString().length() + 2));
+21 -3
View File
@@ -25,7 +25,10 @@ import java.util.Map;
import resources.guild.Guild;
import resources.objects.SWGSet;
import resources.objects.creature.CreatureObject;
import resources.objects.guild.GuildObject;
import resources.objects.player.PlayerObject;
import services.chat.ChatRoom;
import main.NGECore;
import engine.resources.objects.SWGObject;
import engine.resources.service.INetworkDispatch;
@@ -59,11 +62,26 @@ public class GuildService implements INetworkDispatch {
int listSize = object.getGuildList().size();
Guild guild = new Guild((listSize == 0 ? 1 : listSize + 1), abbreviation, name, leader);
object.getGuildList().add(guild);
core.chatService.createChatRoom("", "guild." + guild.getId(), leader.getCustomName(), false, true, false);
ChatRoom guildChat = core.chatService.createChatRoom("", "guild." + guild.getId() + ".GuildChat", leader.getCustomName(), false, true, false);
guild.setChatRoomId(guildChat.getRoomId());
object.getGuildList().add(guild);
return guild;
}
public void joinGuild(Guild guild, CreatureObject joinee) {
PlayerObject ghost = joinee.getPlayerObject();
if (ghost == null)
return;
guild.getMembers().add(joinee.getObjectID());
joinee.setGuildId(guild.getId());
core.chatService.joinChatRoom(joinee.getCustomName(), guild.getChatRoomId());
// TODO: Send new member guild mail
}
public GuildObject getGuildObject() {
return object;
}
@@ -88,7 +106,7 @@ public class GuildService implements INetworkDispatch {
Guild guild = getGuildById(id);
if (guild != null) {
object.getGuildList().add(guild);
object.getGuildList().remove(guild);
return true;
}
@@ -99,7 +117,7 @@ public class GuildService implements INetworkDispatch {
Guild guild = getGuildByAbbreviation(abbreviation);
if (guild != null) {
object.getGuildList().add(guild);
object.getGuildList().remove(guild);
return true;
}