Fixed Guild Alliances + minor Guild rework

All Guild Alliances system is now functional. Tweaked guilds in order to
sync MapleGuildCharacter objects that were supposed to be the same when
being accessed from both MapleGuild and MapleCharacter classes.
This commit is contained in:
ronancpl
2017-05-26 01:21:54 -03:00
parent a636f63114
commit 702c69897b
16 changed files with 260 additions and 127 deletions
+4
View File
@@ -247,3 +247,7 @@ Consertado quest-evento Dollhouse.
23 - 24 Maio 2017, 23 - 24 Maio 2017,
Revamp na DB referente às Alliances. Revamp na DB referente às Alliances.
Solução parcial ao problema das Guild Alliances. Pode-se criar uma, sair, expulsar e trocar ranks de jogadores. Solução parcial ao problema das Guild Alliances. Pode-se criar uma, sair, expulsar e trocar ranks de jogadores.
25 Maio 2017,
Solução final ao problema das Guild Alliances. Todas as funcionalidades implementadas.
Registros de objetos MapleGuildCharacter agora esta sincronizado entre MapleCharacter's e MapleGuild's.
+11 -13
View File
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="1">
<file>
<url>src/tools/MaplePacketCreator.java</url>
<bookmark id="1">
<name/>
<line>5939</line>
<key/>
</bookmark>
</file>
</editor-bookmarks>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group/>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/channel/handlers/AllianceOperationHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/guild/MapleGuild.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/guild/MapleAlliance.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/guild/MapleGuildCharacter.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/Server.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/world/World.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/scripting/npc/NPCConversationManager.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/MapleCharacter.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/net/server/handlers/login/GuestLoginHandler.java</file>
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/tools/MaplePacketCreator.java</file>
</group>
</open-files> </open-files>
</project-private> </project-private>
+7 -6
View File
@@ -47,11 +47,6 @@ function action(mode, type, selection) {
cm.dispose(); cm.dispose();
return; return;
} }
if(!cm.isLeader()) {
cm.sendNext("Hello there! I'm #bLenario#k. If you want to form a guild, please tell your party leader to talk to me. He/She will be assigned as the Leader of the Guild Union.");
cm.dispose();
return;
}
cm.sendSimple("Hello there! I'm #bLenario#k.\r\n#b#L0#Can you please tell me what Guild Union is all about?#l\r\n#L1#How do I make a Guild Union?#l\r\n#L2#I want to make a Guild Union.#l\r\n#L3#I want to add more guilds for the Guild Union.#l\r\n#L4#I want to break up the Guild Union.#l"); cm.sendSimple("Hello there! I'm #bLenario#k.\r\n#b#L0#Can you please tell me what Guild Union is all about?#l\r\n#L1#How do I make a Guild Union?#l\r\n#L2#I want to make a Guild Union.#l\r\n#L3#I want to add more guilds for the Guild Union.#l\r\n#L4#I want to break up the Guild Union.#l");
} }
@@ -64,6 +59,11 @@ function action(mode, type, selection) {
cm.sendNext("To make a Guild Union, two and only two Guild Masters need to be in a party and both must be present on this room on the same channel. The leader of this party will be assigned as the Guild Union Master."); cm.sendNext("To make a Guild Union, two and only two Guild Masters need to be in a party and both must be present on this room on the same channel. The leader of this party will be assigned as the Guild Union Master.");
cm.dispose(); cm.dispose();
} else if(selection == 2) { } else if(selection == 2) {
if(!cm.isLeader()) {
cm.sendNext("If you want to form a guild union, please tell your party leader to talk to me. He/She will be assigned as the Leader of the Guild Union.");
cm.dispose();
return;
}
if(cm.getPlayer().getGuild().getAllianceId() > 0) { if(cm.getPlayer().getGuild().getAllianceId() > 0) {
cm.sendOk("You can not create a Guild Union while your guild is already registered in another."); cm.sendOk("You can not create a Guild Union while your guild is already registered in another.");
cm.dispose(); cm.dispose();
@@ -111,6 +111,7 @@ function action(mode, type, selection) {
cm.upgradeAlliance(); cm.upgradeAlliance();
cm.gainMeso(-increaseCost); cm.gainMeso(-increaseCost);
cm.sendOk("Your alliance can now accept one more guild."); cm.sendOk("Your alliance can now accept one more guild.");
cm.dispose();
} else if (choice == 4) { } else if (choice == 4) {
if (cm.getPlayer().getGuild() == null || cm.getPlayer().getGuild().getAllianceId() <= 0) { if (cm.getPlayer().getGuild() == null || cm.getPlayer().getGuild().getAllianceId() <= 0) {
cm.sendNext("You cannot disband a non-existant Guild Union."); cm.sendNext("You cannot disband a non-existant Guild Union.");
@@ -131,7 +132,7 @@ function action(mode, type, selection) {
choice = 2; choice = 2;
} else { } else {
if (cm.createAlliance(guildName) == null) if (cm.createAlliance(guildName) == null)
cm.sendOk("Please check if you and the other one guild leader in your party are both here on this room right now. No other guild leaders should be present with you 2 on this process."); cm.sendOk("Please check if you and the other one guild leader in your party are both here on this room right now, and make sure both guilds are currently unregistered on unions. No other guild leaders should be present with you 2 on this process.");
else { else {
cm.gainMeso(-allianceCost); cm.gainMeso(-allianceCost);
cm.sendOk("You have successfully formed a Guild Union."); cm.sendOk("You have successfully formed a Guild Union.");
+7 -1
View File
@@ -50,8 +50,14 @@ CREATE TABLE IF NOT EXISTS `accounts` (
CREATE TABLE IF NOT EXISTS `alliance` ( CREATE TABLE IF NOT EXISTS `alliance` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(13) NOT NULL, `name` varchar(13) NOT NULL,
`notice` varchar(128) NOT NULL DEFAULT '',
`capacity` int(10) unsigned NOT NULL DEFAULT '2', `capacity` int(10) unsigned NOT NULL DEFAULT '2',
`notice` varchar(20) NOT NULL DEFAULT '',
`rank1` varchar(11) NOT NULL DEFAULT '',
`rank2` varchar(11) NOT NULL DEFAULT '',
`rank3` varchar(11) NOT NULL DEFAULT '',
`rank4` varchar(11) NOT NULL DEFAULT '',
`rank5` varchar(11) NOT NULL DEFAULT '',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+16 -9
View File
@@ -1961,7 +1961,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
} }
public int getAllianceRank() { public int getAllianceRank() {
return this.allianceRank; return allianceRank;
} }
public int getAllowWarpToId() { public int getAllowWarpToId() {
@@ -2200,7 +2200,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
public MapleGuild getGuild() { public MapleGuild getGuild() {
try { try {
return Server.getInstance().getGuild(getGuildId(), getWorld(), null); return Server.getInstance().getGuild(getGuildId(), getWorld(), this);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
return null; return null;
@@ -2446,6 +2446,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
return mgc; return mgc;
} }
public void setMGC(MapleGuildCharacter mgc) {
this.mgc = mgc;
}
public MaplePartyCharacter getMPC() { public MaplePartyCharacter getMPC() {
if (mpc == null) { if (mpc == null) {
mpc = new MaplePartyCharacter(this); mpc = new MaplePartyCharacter(this);
@@ -2550,6 +2554,16 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
return list; return list;
} }
public boolean isPartyMember(MapleCharacter chr) {
for(MapleCharacter mpc: getPartyMembers()) {
if(mpc.getId() == chr.getId()) {
return true;
}
}
return false;
}
public MaplePlayerShop getPlayerShop() { public MaplePlayerShop getPlayerShop() {
return playerShop; return playerShop;
} }
@@ -4160,10 +4174,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
} }
} }
public void resetMGC(MapleGuildCharacter mgc) {
this.mgc = mgc;
}
public synchronized void saveCooldowns() { public synchronized void saveCooldowns() {
if (getAllCooldowns().size() > 0) { if (getAllCooldowns().size() > 0) {
try { try {
@@ -4636,9 +4646,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
public void setAllianceRank(int rank) { public void setAllianceRank(int rank) {
allianceRank = rank; allianceRank = rank;
if (mgc != null) {
mgc.setAllianceRank(rank);
}
} }
public void setAllowWarpToId(int id) { public void setAllowWarpToId(int id) {
+1 -1
View File
@@ -821,7 +821,7 @@ public class MapleClient {
} }
if (guild != null) { if (guild != null) {
final Server server = Server.getInstance(); final Server server = Server.getInstance();
server.setGuildMemberOnline(chrg, false, player.getClient().getChannel()); server.setGuildMemberOnline(player, false, player.getClient().getChannel());
player.getClient().announce(MaplePacketCreator.showGuildInfo(player)); player.getClient().announce(MaplePacketCreator.showGuildInfo(player));
} }
if (party != null) { if (party != null) {
+39 -12
View File
@@ -69,12 +69,12 @@ public class Server implements Runnable {
private IoAcceptor acceptor; private IoAcceptor acceptor;
private List<Map<Integer, String>> channels = new LinkedList<>(); private List<Map<Integer, String>> channels = new LinkedList<>();
private List<World> worlds = new ArrayList<>(); private List<World> worlds = new ArrayList<>();
private Properties subnetInfo = new Properties(); private final Properties subnetInfo = new Properties();
private static Server instance = null; private static Server instance = null;
private List<Pair<Integer, String>> worldRecommendedList = new LinkedList<>(); private List<Pair<Integer, String>> worldRecommendedList = new LinkedList<>();
private Map<Integer, MapleGuild> guilds = new LinkedHashMap<>(); private final Map<Integer, MapleGuild> guilds = new LinkedHashMap<>();
private PlayerBuffStorage buffStorage = new PlayerBuffStorage(); private final PlayerBuffStorage buffStorage = new PlayerBuffStorage();
private Map<Integer, MapleAlliance> alliances = new LinkedHashMap<>(); private final Map<Integer, MapleAlliance> alliances = new LinkedHashMap<>();
private boolean online = false; private boolean online = false;
public static long uptime = System.currentTimeMillis(); public static long uptime = System.currentTimeMillis();
@@ -349,6 +349,18 @@ public class Server implements Runnable {
return MapleGuild.createGuild(leaderId, name); return MapleGuild.createGuild(leaderId, name);
} }
public MapleGuild getGuildByName(String name) {
synchronized (guilds) {
for(MapleGuild mg: guilds.values()) {
if(mg.getName().equalsIgnoreCase(name)) {
return mg;
}
}
return null;
}
}
public MapleGuild getGuild(int id) { public MapleGuild getGuild(int id) {
synchronized (guilds) { synchronized (guilds) {
if (guilds.get(id) != null) { if (guilds.get(id) != null) {
@@ -359,7 +371,7 @@ public class Server implements Runnable {
} }
} }
public MapleGuild getGuild(int id, int world, MapleGuildCharacter mgc) { public MapleGuild getGuild(int id, int world, MapleCharacter mc) {
synchronized (guilds) { synchronized (guilds) {
if (guilds.get(id) != null) { if (guilds.get(id) != null) {
return guilds.get(id); return guilds.get(id);
@@ -368,9 +380,15 @@ public class Server implements Runnable {
if (g.getId() == -1) { if (g.getId() == -1) {
return null; return null;
} }
if (mgc != null) {
g.setOnline(mgc.getId(), true, mgc.getChannel()); if(mc != null) {
MapleGuildCharacter mgc = mc.getMGC();
if (mgc != null) {
g.setOnline(mgc.getId(), true, mgc.getChannel());
mc.setMGC(g.getMGC(mc.getId())); // i really REALLY must make player MGC the same as the guild MGC
}
} }
guilds.put(id, g); guilds.put(id, g);
return g; return g;
} }
@@ -384,9 +402,9 @@ public class Server implements Runnable {
//reloadGuildCharacters(); //reloadGuildCharacters();
} }
public void setGuildMemberOnline(MapleGuildCharacter mgc, boolean bOnline, int channel) { public void setGuildMemberOnline(MapleCharacter mc, boolean bOnline, int channel) {
MapleGuild g = getGuild(mgc.getGuildId(), mgc.getWorld(), mgc); MapleGuild g = getGuild(mc.getGuildId(), mc.getWorld(), mc);
g.setOnline(mgc.getId(), bOnline, channel); g.setOnline(mc.getId(), bOnline, channel);
} }
public int addGuildMember(MapleGuildCharacter mgc) { public int addGuildMember(MapleGuildCharacter mgc) {
@@ -504,8 +522,17 @@ public class Server implements Runnable {
return buffStorage; return buffStorage;
} }
public void deleteGuildCharacter(MapleCharacter mc) {
setGuildMemberOnline(mc, false, (byte) -1);
if (mc.getMGC().getGuildRank() > 1) {
leaveGuild(mc.getMGC());
} else {
disbandGuild(mc.getMGC().getGuildId());
}
}
public void deleteGuildCharacter(MapleGuildCharacter mgc) { public void deleteGuildCharacter(MapleGuildCharacter mgc) {
setGuildMemberOnline(mgc, false, (byte) -1); if(mgc.getCharacter() != null) setGuildMemberOnline(mgc.getCharacter(), false, (byte) -1);
if (mgc.getGuildRank() > 1) { if (mgc.getGuildRank() > 1) {
leaveGuild(mgc); leaveGuild(mgc);
} else { } else {
@@ -517,7 +544,7 @@ public class Server implements Runnable {
World worlda = getWorld(world); World worlda = getWorld(world);
for (MapleCharacter mc : worlda.getPlayerStorage().getAllCharacters()) { for (MapleCharacter mc : worlda.getPlayerStorage().getAllCharacters()) {
if (mc.getGuildId() > 0) { if (mc.getGuildId() > 0) {
setGuildMemberOnline(mc.getMGC(), true, worlda.getId()); setGuildMemberOnline(mc, true, worlda.getId());
memberLevelJobUpdate(mc.getMGC()); memberLevelJobUpdate(mc.getMGC());
} }
} }
@@ -26,6 +26,7 @@ import client.MapleClient;
import net.AbstractMaplePacketHandler; import net.AbstractMaplePacketHandler;
import net.SendOpcode; import net.SendOpcode;
import net.server.Server; import net.server.Server;
import net.server.guild.MapleGuild;
import net.server.guild.MapleGuildCharacter; import net.server.guild.MapleGuildCharacter;
import net.server.guild.MapleAlliance; import net.server.guild.MapleAlliance;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
@@ -40,8 +41,6 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
@Override @Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
System.out.print("aop ");
MapleAlliance alliance = null; MapleAlliance alliance = null;
if (c.getPlayer().getGuild() != null && c.getPlayer().getGuild().getAllianceId() > 0) { if (c.getPlayer().getGuild() != null && c.getPlayer().getGuild().getAllianceId() > 0) {
alliance = c.getPlayer().getAlliance(); alliance = c.getPlayer().getAlliance();
@@ -55,14 +54,11 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
} }
byte b = slea.readByte(); byte b = slea.readByte();
System.out.print(b);
switch (b) { switch (b) {
case 0x01: case 0x01:
System.out.print(" case 1");
Server.getInstance().allianceMessage(alliance.getId(), sendShowInfo(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId()), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), sendShowInfo(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId()), -1, -1);
break; break;
case 0x02: { // Leave Alliance case 0x02: { // Leave Alliance
System.out.print(" case 2");
if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuildId() < 1 || c.getPlayer().getGuildRank() != 1) { if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuildId() < 1 || c.getPlayer().getGuildRank() != 1) {
return; return;
} }
@@ -72,35 +68,52 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
Server.getInstance().removeGuildFromAlliance(alliance.getId(), guildid); Server.getInstance().removeGuildFromAlliance(alliance.getId(), guildid);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, c), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), alliance.getNotice()), -1, -1);
Server.getInstance().guildMessage(guildid, MaplePacketCreator.disbandAlliance(alliance.getId())); Server.getInstance().guildMessage(guildid, MaplePacketCreator.disbandAlliance(alliance.getId()));
alliance.dropMessage("[" + c.getPlayer().getGuild().getName() + "] guild has left the union.");
break; break;
} }
case 0x03: // send alliance invite case 0x03: // send alliance invite... or at least it would be this way if i could find the right way to call it!
System.out.print(" case 3 avail is " + slea.available()); String guildName = slea.readMapleAsciiString();
String charName = slea.readMapleAsciiString();
if(alliance.getGuilds().size() == alliance.getCapacity()) { if(alliance.getGuilds().size() == alliance.getCapacity()) {
c.getPlayer().dropMessage("Your alliance can not comport any more guild at the moment."); c.getPlayer().dropMessage("Your alliance can not comport any more guild at the moment.");
} else { } else {
int channel; MapleGuild mg = Server.getInstance().getGuildByName(guildName);
channel = c.getWorldServer().find(charName); if(mg == null) {
if (channel == -1) { c.getPlayer().dropMessage("The entered guild does not exist.");
c.getPlayer().dropMessage("The player is not online."); }
} else { else {
MapleCharacter victim = Server.getInstance().getChannel(c.getWorld(), channel).getPlayerStorage().getCharacterByName(charName); MapleCharacter victim = mg.getMGC(mg.getLeaderId()).getCharacter();
if (victim.getGuildId() == 0) {
c.getPlayer().dropMessage("The person you are trying to invite does not have a guild."); if (victim == null) {
} else if (victim.getGuildRank() != 1) { c.getPlayer().dropMessage("The master of the guild that you offered an invitation is currently not online.");
c.getPlayer().dropMessage("The player is not the leader of his/her guild.");
} else { } else {
Server.getInstance().allianceMessage(alliance.getId(), sendInvitation(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId(), charName), -1, -1); // this doesn't seem to work...
//Server.getInstance().allianceMessage(alliance.getId(), sendInvitation(c.getPlayer().getGuild().getAllianceId(), victim.getId(), guildName), -1, -1);
//victim.getClient().announce(sendInvitation(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId(), guildName));
if(!c.getPlayer().isPartyMember(victim)) {
c.getPlayer().dropMessage("The master of the guild that you offered a invitation must be in the same party as yours.");
}
else {
int guildid = victim.getGuildId();
Server.getInstance().addGuildtoAlliance(alliance.getId(), guildid);
Server.getInstance().resetAllianceGuildPlayersRank(guildid);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.addGuildToAlliance(alliance, guildid, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.updateAllianceInfo(alliance, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), alliance.getNotice()), -1, -1);
victim.getGuild().dropMessage("Your guild has joined in the [" + alliance.getName() + "] union.");
}
} }
} }
} }
break; break;
case 0x04: { case 0x04: {
System.out.print(" case 4");
int guildid = slea.readInt(); int guildid = slea.readInt();
// slea.readMapleAsciiString();//guild name // slea.readMapleAsciiString();//guild name
if (c.getPlayer().getGuild().getAllianceId() != 0 || c.getPlayer().getGuildRank() != 1 || c.getPlayer().getGuildId() < 1) { if (c.getPlayer().getGuild().getAllianceId() != 0 || c.getPlayer().getGuildRank() != 1 || c.getPlayer().getGuildId() < 1) {
@@ -110,7 +123,6 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
break; break;
} }
case 0x06: { // Expel Guild case 0x06: { // Expel Guild
System.out.print(" case 6");
int guildid = slea.readInt(); int guildid = slea.readInt();
int allianceid = slea.readInt(); int allianceid = slea.readInt();
if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuild().getAllianceId() != allianceid) { if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuild().getAllianceId() != allianceid) {
@@ -121,13 +133,13 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
Server.getInstance().removeGuildFromAlliance(alliance.getId(), guildid); Server.getInstance().removeGuildFromAlliance(alliance.getId(), guildid);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, c), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), alliance.getNotice()), -1, -1);
Server.getInstance().guildMessage(guildid, MaplePacketCreator.disbandAlliance(allianceid)); Server.getInstance().guildMessage(guildid, MaplePacketCreator.disbandAlliance(allianceid));
alliance.dropMessage("[" + Server.getInstance().getGuild(guildid).getName() + "] guild has been expelled from the union.");
break; break;
} }
case 0x07: { // Change Alliance Leader case 0x07: { // Change Alliance Leader
System.out.print(" case 7");
if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuildId() < 1) { if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuildId() < 1) {
return; return;
} }
@@ -139,7 +151,6 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
break; break;
} }
case 0x08: case 0x08:
System.out.print(" case 8");
String ranks[] = new String[5]; String ranks[] = new String[5];
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
ranks[i] = slea.readMapleAsciiString(); ranks[i] = slea.readMapleAsciiString();
@@ -148,7 +159,6 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.changeAllianceRankTitle(alliance.getId(), ranks), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.changeAllianceRankTitle(alliance.getId(), ranks), -1, -1);
break; break;
case 0x09: { case 0x09: {
System.out.print(" case 9");
int int1 = slea.readInt(); int int1 = slea.readInt();
byte byte1 = slea.readByte(); byte byte1 = slea.readByte();
@@ -159,7 +169,6 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
break; break;
} }
case 0x0A: case 0x0A:
System.out.print(" case A");
String notice = slea.readMapleAsciiString(); String notice = slea.readMapleAsciiString();
Server.getInstance().setAllianceNotice(alliance.getId(), notice); Server.getInstance().setAllianceNotice(alliance.getId(), notice);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), notice), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), notice), -1, -1);
@@ -167,7 +176,6 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
default: default:
c.getPlayer().dropMessage("Feature not available"); c.getPlayer().dropMessage("Feature not available");
} }
System.out.println("end");
alliance.saveToDB(); alliance.saveToDB();
} }
@@ -175,25 +183,25 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
private void changeLeaderAllianceRank(MapleAlliance alliance, MapleCharacter newLeader) { private void changeLeaderAllianceRank(MapleAlliance alliance, MapleCharacter newLeader) {
MapleGuildCharacter lmgc = alliance.getLeader(); MapleGuildCharacter lmgc = alliance.getLeader();
MapleCharacter leader = Server.getInstance().getWorld(newLeader.getWorld()).getPlayerStorage().getCharacterById(lmgc.getId()); MapleCharacter leader = Server.getInstance().getWorld(newLeader.getWorld()).getPlayerStorage().getCharacterById(lmgc.getId());
leader.setAllianceRank(2); leader.getMGC().setAllianceRank(2);
leader.saveGuildStatus(); leader.saveGuildStatus();
newLeader.setAllianceRank(1); newLeader.getMGC().setAllianceRank(1);
newLeader.saveGuildStatus(); newLeader.saveGuildStatus();
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, newLeader.getClient()), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, newLeader.getClient()), -1, -1);
alliance.dropAllianceMessage("'" + newLeader.getName() + "' has been appointed as the new head of this Alliance."); alliance.dropMessage("'" + newLeader.getName() + "' has been appointed as the new head of this Alliance.");
} }
private void changePlayerAllianceRank(MapleAlliance alliance, MapleCharacter chr, boolean raise) { private void changePlayerAllianceRank(MapleAlliance alliance, MapleCharacter chr, boolean raise) {
int newRank = chr.getAllianceRank() + (raise ? -1 : 1); int newRank = chr.getAllianceRank() + (raise ? -1 : 1);
if(newRank < 2 || newRank > 5) return; if(newRank < 3 || newRank > 5) return;
chr.setAllianceRank(newRank); chr.getMGC().setAllianceRank(newRank);
chr.saveGuildStatus(); chr.saveGuildStatus();
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, chr.getClient()), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, chr.getClient()), -1, -1);
alliance.dropAllianceMessage("'" + chr.getName() + "' has moved ranks to '" + alliance.getRankTitle(newRank) + "' in this Alliance."); alliance.dropMessage("'" + chr.getName() + "' has been reassigned as '" + alliance.getRankTitle(newRank) + "' in this Alliance.");
} }
private static byte[] sendShowInfo(int allianceid, int playerid) { private static byte[] sendShowInfo(int allianceid, int playerid) {
@@ -30,6 +30,7 @@ import java.util.Iterator;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
import client.MapleCharacter; import client.MapleCharacter;
import net.server.Server; import net.server.Server;
import net.server.guild.MapleAlliance;
public final class GuildOperationHandler extends AbstractMaplePacketHandler { public final class GuildOperationHandler extends AbstractMaplePacketHandler {
private boolean isGuildNameAcceptable(String name) { private boolean isGuildNameAcceptable(String name) {
@@ -95,6 +96,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
} }
MapleCharacter mc = c.getPlayer(); MapleCharacter mc = c.getPlayer();
byte type = slea.readByte(); byte type = slea.readByte();
int allianceId = -1;
switch (type) { switch (type) {
case 0x00: case 0x00:
//c.announce(MaplePacketCreator.showGuildInfo(mc)); //c.announce(MaplePacketCreator.showGuildInfo(mc));
@@ -123,8 +125,12 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
mc.gainMeso(-MapleGuild.CREATE_GUILD_COST, true, false, true); mc.gainMeso(-MapleGuild.CREATE_GUILD_COST, true, false, true);
mc.setGuildId(gid); mc.setGuildId(gid);
mc.setGuildRank(1); mc.setGuildRank(1);
mc.saveGuildStatus(); mc.setAllianceRank(5);
MapleGuild guild = Server.getInstance().getGuild(mc.getGuildId(), c.getWorld(), mc); // initialize guild structure
guild.getMGC(guild.getLeaderId()).setCharacter(mc);
c.announce(MaplePacketCreator.showGuildInfo(mc)); c.announce(MaplePacketCreator.showGuildInfo(mc));
c.getPlayer().dropMessage(1, "You have successfully created a Guild."); c.getPlayer().dropMessage(1, "You have successfully created a Guild.");
respawnPlayer(mc); respawnPlayer(mc);
break; break;
@@ -171,6 +177,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
} }
mc.setGuildId(gid); // joins the guild mc.setGuildId(gid); // joins the guild
mc.setGuildRank(5); // start at lowest rank mc.setGuildRank(5); // start at lowest rank
mc.setAllianceRank(5);
int s; int s;
s = Server.getInstance().addGuildMember(mc.getMGC()); s = Server.getInstance().addGuildMember(mc.getMGC());
@@ -179,11 +186,18 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
mc.setGuildId(0); mc.setGuildId(0);
return; return;
} }
c.announce(MaplePacketCreator.showGuildInfo(mc)); c.announce(MaplePacketCreator.showGuildInfo(mc));
allianceId = mc.getGuild().getAllianceId();
if(allianceId > 0) Server.getInstance().getAlliance(allianceId).updateAlliancePackets(mc);
mc.saveGuildStatus(); // update database mc.saveGuildStatus(); // update database
respawnPlayer(mc); respawnPlayer(mc);
break; break;
case 0x07: case 0x07:
allianceId = mc.getGuild().getAllianceId();
cid = slea.readInt(); cid = slea.readInt();
name = slea.readMapleAsciiString(); name = slea.readMapleAsciiString();
if (cid != mc.getId() || !name.equals(mc.getName()) || mc.getGuildId() <= 0) { if (cid != mc.getId() || !name.equals(mc.getName()) || mc.getGuildId() <= 0) {
@@ -192,12 +206,17 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
} }
c.announce(MaplePacketCreator.updateGP(mc.getGuildId(), 0)); c.announce(MaplePacketCreator.updateGP(mc.getGuildId(), 0));
Server.getInstance().leaveGuild(mc.getMGC()); Server.getInstance().leaveGuild(mc.getMGC());
c.announce(MaplePacketCreator.showGuildInfo(null)); c.announce(MaplePacketCreator.showGuildInfo(null));
if(allianceId > 0) Server.getInstance().getAlliance(allianceId).updateAlliancePackets(mc);
mc.setGuildId(0); mc.setGuildId(0);
mc.saveGuildStatus(); mc.saveGuildStatus();
respawnPlayer(mc); respawnPlayer(mc);
break; break;
case 0x08: case 0x08:
allianceId = mc.getGuild().getAllianceId();
cid = slea.readInt(); cid = slea.readInt();
name = slea.readMapleAsciiString(); name = slea.readMapleAsciiString();
if (mc.getGuildRank() > 2 || mc.getGuildId() <= 0) { if (mc.getGuildRank() > 2 || mc.getGuildId() <= 0) {
@@ -206,6 +225,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
} }
Server.getInstance().expelMember(mc.getMGC(), name, cid); Server.getInstance().expelMember(mc.getMGC(), name, cid);
if(allianceId > 0) Server.getInstance().getAlliance(allianceId).updateAlliancePackets(mc);
break; break;
case 0x0d: case 0x0d:
if (mc.getGuildId() <= 0 || mc.getGuildRank() != 1) { if (mc.getGuildId() <= 0 || mc.getGuildRank() != 1) {
@@ -237,7 +257,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
return; return;
} }
if (mc.getMeso() < MapleGuild.CHANGE_EMBLEM_COST) { if (mc.getMeso() < MapleGuild.CHANGE_EMBLEM_COST) {
c.announce(MaplePacketCreator.serverNotice(1, "You do not have enough mesos to create a Guild.")); c.announce(MaplePacketCreator.serverNotice(1, "You do not have enough mesos to change the Guild emblem."));
return; return;
} }
short bg = slea.readShort(); short bg = slea.readShort();
@@ -183,15 +183,15 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.getFamilyInfo(f.getMember(player.getId()))); c.announce(MaplePacketCreator.getFamilyInfo(f.getMember(player.getId())));
} }
if (player.getGuildId() > 0) { if (player.getGuildId() > 0) {
MapleGuild playerGuild = server.getGuild(player.getGuildId(), player.getWorld(), player.getMGC()); MapleGuild playerGuild = server.getGuild(player.getGuildId(), player.getWorld(), player);
if (playerGuild == null) { if (playerGuild == null) {
player.deleteGuild(player.getGuildId()); player.deleteGuild(player.getGuildId());
player.resetMGC(null); player.setMGC(null);
player.setGuildId(0); player.setGuildId(0);
} else { } else {
playerGuild.getMGC(player.getId()).setCharacter(player); playerGuild.getMGC(player.getId()).setCharacter(player);
player.resetMGC(playerGuild.getMGC(player.getId())); player.setMGC(playerGuild.getMGC(player.getId()));
server.setGuildMemberOnline(player.getMGC(), true, c.getChannel()); server.setGuildMemberOnline(player, true, c.getChannel());
c.announce(MaplePacketCreator.showGuildInfo(player)); c.announce(MaplePacketCreator.showGuildInfo(player));
int allianceId = player.getGuild().getAllianceId(); int allianceId = player.getGuild().getAllianceId();
if (allianceId > 0) { if (allianceId > 0) {
@@ -205,8 +205,9 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
} }
} }
if (newAlliance != null) { if (newAlliance != null) {
c.announce(MaplePacketCreator.getAllianceInfo(newAlliance)); c.announce(MaplePacketCreator.updateAllianceInfo(newAlliance, c));
c.announce(MaplePacketCreator.getGuildAlliances(newAlliance, c)); c.announce(MaplePacketCreator.allianceNotice(newAlliance.getId(), newAlliance.getNotice()));
server.allianceMessage(allianceId, MaplePacketCreator.allianceMemberOnline(player, true), player.getId(), -1); server.allianceMessage(allianceId, MaplePacketCreator.allianceMemberOnline(player, true), player.getId(), -1);
} }
} }
+69 -10
View File
@@ -32,8 +32,6 @@ import client.MapleCharacter;
import net.server.Server; import net.server.Server;
import net.server.world.MapleParty; import net.server.world.MapleParty;
import net.server.world.MaplePartyCharacter; import net.server.world.MaplePartyCharacter;
import net.server.guild.MapleGuild;
import net.server.guild.MapleGuildCharacter;
import tools.DatabaseConnection; import tools.DatabaseConnection;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
@@ -122,12 +120,12 @@ public class MapleAlliance {
Server.getInstance().resetAllianceGuildPlayersRank(guilds.get(i)); Server.getInstance().resetAllianceGuildPlayersRank(guilds.get(i));
MapleCharacter chr = guildMasters.get(i); MapleCharacter chr = guildMasters.get(i);
chr.setAllianceRank((i == 0) ? 1 : 2); chr.getMGC().setAllianceRank((i == 0) ? 1 : 2);
chr.saveGuildStatus(); chr.saveGuildStatus();
} }
Server.getInstance().addAlliance(id, alliance); Server.getInstance().addAlliance(id, alliance);
Server.getInstance().allianceMessage(id, MaplePacketCreator.makeNewAlliance(alliance, guildMasters.get(0).getClient()), -1, -1); Server.getInstance().allianceMessage(id, MaplePacketCreator.updateAllianceInfo(alliance, guildMasters.get(0).getClient()), -1, -1);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
@@ -194,6 +192,14 @@ public class MapleAlliance {
alliance.name = rs.getString("name"); alliance.name = rs.getString("name");
alliance.notice = rs.getString("notice"); alliance.notice = rs.getString("notice");
String ranks[] = new String[5];
ranks[0] = rs.getString("rank1");
ranks[1] = rs.getString("rank2");
ranks[2] = rs.getString("rank3");
ranks[3] = rs.getString("rank4");
ranks[4] = rs.getString("rank5");
alliance.rankTitles = ranks;
ps.close(); ps.close();
rs.close(); rs.close();
@@ -218,10 +224,17 @@ public class MapleAlliance {
public void saveToDB() { public void saveToDB() {
try { try {
Connection con = DatabaseConnection.getConnection(); Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE `alliance` SET capacity = ?, notice = ? WHERE id = ?"); PreparedStatement ps = con.prepareStatement("UPDATE `alliance` SET capacity = ?, notice = ?, rank1 = ?, rank2 = ?, rank3 = ?, rank4 = ?, rank5 = ? WHERE id = ?");
ps.setInt(1, this.capacity); ps.setInt(1, this.capacity);
ps.setString(2, this.notice); ps.setString(2, this.notice);
ps.setInt(3, this.allianceId);
ps.setString(3, this.rankTitles[0]);
ps.setString(4, this.rankTitles[1]);
ps.setString(5, this.rankTitles[2]);
ps.setString(6, this.rankTitles[3]);
ps.setString(7, this.rankTitles[4]);
ps.setInt(8, this.allianceId);
ps.executeUpdate(); ps.executeUpdate();
ps.close(); ps.close();
@@ -246,6 +259,48 @@ public class MapleAlliance {
} }
} }
public static void disbandAlliance(int allianceId) {
PreparedStatement ps = null;
Connection con = null;
try {
con = DatabaseConnection.getConnection();
ps = con.prepareStatement("DELETE FROM `alliance` WHERE id = ?");
ps.setInt(1, allianceId);
ps.executeUpdate();
ps.close();
ps = con.prepareStatement("DELETE FROM `allianceguilds` WHERE allianceid = ?");
ps.setInt(1, allianceId);
ps.executeUpdate();
ps.close();
con.close();
Server.getInstance().allianceMessage(allianceId, MaplePacketCreator.disbandAlliance(allianceId), -1, -1);
Server.getInstance().disbandAlliance(allianceId);
} catch (SQLException sqle) {
sqle.printStackTrace();
} finally {
try {
if (ps != null && !ps.isClosed()) {
ps.close();
}
if (con != null && !con.isClosed()) {
con.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
public void updateAlliancePackets(MapleCharacter chr) {
if (allianceId > 0) {
this.broadcastMessage(MaplePacketCreator.updateAllianceInfo(this, chr.getClient()));
this.broadcastMessage(MaplePacketCreator.allianceNotice(this.getId(), this.getNotice()));
}
}
public boolean removeGuild(int gid) { public boolean removeGuild(int gid) {
synchronized (guilds) { synchronized (guilds) {
int index = getGuildIndex(gid); int index = getGuildIndex(gid);
@@ -334,14 +389,18 @@ public class MapleAlliance {
return null; return null;
} }
public void dropAllianceMessage(String message) { public void dropMessage(String message) {
dropAllianceMessage(5, message); dropMessage(5, message);
} }
public void dropAllianceMessage(int type, String message) { public void dropMessage(int type, String message) {
for(Integer gId: guilds) { for(Integer gId: guilds) {
MapleGuild guild = Server.getInstance().getGuild(gId); MapleGuild guild = Server.getInstance().getGuild(gId);
guild.dropGuildMessage(type, message); guild.dropMessage(type, message);
} }
} }
public void broadcastMessage(byte[] packet) {
Server.getInstance().allianceMessage(allianceId, packet, -1, -1);
}
} }
+25 -6
View File
@@ -181,6 +181,10 @@ public class MapleGuild {
return leader; return leader;
} }
public int setLeaderId(int charId) {
return leader = charId;
}
public int getGP() { public int getGP() {
return gp; return gp;
} }
@@ -283,16 +287,21 @@ public class MapleGuild {
} }
} }
public void dropGuildMessage(String message) { public void dropMessage(String message) {
dropGuildMessage(5, message); dropMessage(5, message);
} }
public void dropGuildMessage(int type, String message) { public void dropMessage(int type, String message) {
for (MapleGuildCharacter mgc : members) { for (MapleGuildCharacter mgc : members) {
mgc.getCharacter().dropMessage(type, message); if(mgc.getCharacter() != null)
mgc.getCharacter().dropMessage(type, message);
} }
} }
public void broadcastMessage(byte[] packet) {
Server.getInstance().guildMessage(id, packet);
}
public final void setOnline(int cid, boolean online, int channel) { public final void setOnline(int cid, boolean online, int channel) {
boolean bBroadcast = true; boolean bBroadcast = true;
for (MapleGuildCharacter mgc : members) { for (MapleGuildCharacter mgc : members) {
@@ -332,20 +341,30 @@ public class MapleGuild {
} }
ps.close(); ps.close();
rs.close(); rs.close();
ps = con.prepareStatement("INSERT INTO guilds (`leader`, `name`, `signature`) VALUES (?, ?, ?)"); ps = con.prepareStatement("INSERT INTO guilds (`leader`, `name`, `signature`) VALUES (?, ?, ?)");
ps.setInt(1, leaderId); ps.setInt(1, leaderId);
ps.setString(2, name); ps.setString(2, name);
ps.setInt(3, (int) System.currentTimeMillis()); ps.setInt(3, (int) System.currentTimeMillis());
ps.execute(); ps.execute();
ps.close(); ps.close();
ps = con.prepareStatement("SELECT guildid FROM guilds WHERE leader = ?"); ps = con.prepareStatement("SELECT guildid FROM guilds WHERE leader = ?");
ps.setInt(1, leaderId); ps.setInt(1, leaderId);
rs = ps.executeQuery(); rs = ps.executeQuery();
rs.first(); rs.first();
int guildid = rs.getInt("guildid"); int guildId = rs.getInt("guildid");
rs.close(); rs.close();
ps.close(); ps.close();
return guildid;
ps = con.prepareStatement("UPDATE characters SET guildid = ? WHERE id = ?");
ps.setInt(1, guildId);
ps.setInt(2, leaderId);
ps.executeUpdate();
ps.close();
con.close();
return guildId;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return 0; return 0;
@@ -135,6 +135,7 @@ public class MapleGuildCharacter {
public void setAllianceRank(int rank) { public void setAllianceRank(int rank) {
allianceRank = rank; allianceRank = rank;
if(character != null) character.setAllianceRank(rank);
} }
public int getAllianceRank() { public int getAllianceRank() {
+1 -1
View File
@@ -196,7 +196,7 @@ public class World {
public MapleGuild getGuild(MapleGuildCharacter mgc) { public MapleGuild getGuild(MapleGuildCharacter mgc) {
int gid = mgc.getGuildId(); int gid = mgc.getGuildId();
MapleGuild g; MapleGuild g;
g = Server.getInstance().getGuild(gid, mgc.getWorld(), mgc); g = Server.getInstance().getGuild(gid, mgc.getWorld(), mgc.getCharacter());
if (gsStore.get(gid) == null) { if (gsStore.get(gid) == null) {
gsStore.put(gid, new MapleGuildSummary(g)); gsStore.put(gid, new MapleGuildSummary(g));
} }
+2 -19
View File
@@ -350,28 +350,11 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
public void upgradeAlliance() { public void upgradeAlliance() {
MapleAlliance alliance = Server.getInstance().getAlliance(c.getPlayer().getGuild().getAllianceId()); MapleAlliance alliance = Server.getInstance().getAlliance(c.getPlayer().getGuild().getAllianceId());
alliance.increaseCapacity(1); alliance.increaseCapacity(1);
c.announce(MaplePacketCreator.updateAllianceInfo(alliance, c));
} }
public void disbandAlliance(MapleClient c, int allianceId) { public void disbandAlliance(MapleClient c, int allianceId) {
PreparedStatement ps = null; MapleAlliance.disbandAlliance(allianceId);
try {
ps = DatabaseConnection.getConnection().prepareStatement("DELETE FROM `alliance` WHERE id = ?");
ps.setInt(1, allianceId);
ps.executeUpdate();
ps.close();
Server.getInstance().allianceMessage(c.getPlayer().getGuild().getAllianceId(), MaplePacketCreator.disbandAlliance(allianceId), -1, -1);
Server.getInstance().disbandAlliance(allianceId);
} catch (SQLException sqle) {
sqle.printStackTrace();
} finally {
try {
if (ps != null && !ps.isClosed()) {
ps.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
} }
public boolean canBeUsedAllianceName(String name) { public boolean canBeUsedAllianceName(String name) {
+6 -7
View File
@@ -5891,7 +5891,6 @@ public class MaplePacketCreator {
mplew.writeInt(mgc.isOnline() ? 1 : 0); mplew.writeInt(mgc.isOnline() ? 1 : 0);
mplew.writeInt(guild.getSignature()); mplew.writeInt(guild.getSignature());
mplew.writeInt(mgc.getAllianceRank()); mplew.writeInt(mgc.getAllianceRank());
System.out.println("alliance rank found " + mgc.getAllianceRank());
} }
mplew.writeInt(guild.getCapacity()); mplew.writeInt(guild.getCapacity());
mplew.writeShort(guild.getLogoBG()); mplew.writeShort(guild.getLogoBG());
@@ -5914,7 +5913,7 @@ public class MaplePacketCreator {
mplew.writeMapleAsciiString(alliance.getRankTitle(i)); mplew.writeMapleAsciiString(alliance.getRankTitle(i));
} }
mplew.write(alliance.getGuilds().size()); mplew.write(alliance.getGuilds().size());
mplew.writeInt(2); // probably capacity mplew.writeInt(alliance.getCapacity()); // probably capacity
for (Integer guild : alliance.getGuilds()) { for (Integer guild : alliance.getGuilds()) {
mplew.writeInt(guild); mplew.writeInt(guild);
} }
@@ -5922,7 +5921,7 @@ public class MaplePacketCreator {
return mplew.getPacket(); return mplew.getPacket();
} }
public static byte[] makeNewAlliance(MapleAlliance alliance, MapleClient c) { public static byte[] updateAllianceInfo(MapleAlliance alliance, MapleClient c) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.ALLIANCE_OPERATION.getValue()); mplew.writeShort(SendOpcode.ALLIANCE_OPERATION.getValue());
mplew.write(0x0F); mplew.write(0x0F);
@@ -5935,10 +5934,10 @@ public class MaplePacketCreator {
for (Integer guild : alliance.getGuilds()) { for (Integer guild : alliance.getGuilds()) {
mplew.writeInt(guild); mplew.writeInt(guild);
} }
mplew.writeInt(2); // probably capacity mplew.writeInt(alliance.getCapacity()); // probably capacity
mplew.writeShort(0); mplew.writeShort(0);
for (Integer guildd : alliance.getGuilds()) { for (Integer guildd : alliance.getGuilds()) {
getGuildInfo(mplew, Server.getInstance().getGuild(guildd, c.getWorld(), c.getPlayer().getMGC())); getGuildInfo(mplew, Server.getInstance().getGuild(guildd, c.getWorld(), c.getPlayer()));
} }
return mplew.getPacket(); return mplew.getPacket();
} }
@@ -5967,7 +5966,7 @@ public class MaplePacketCreator {
for (Integer guild : alliance.getGuilds()) { for (Integer guild : alliance.getGuilds()) {
mplew.writeInt(guild); mplew.writeInt(guild);
} }
mplew.writeInt(2); mplew.writeInt(alliance.getCapacity());
mplew.writeMapleAsciiString(alliance.getNotice()); mplew.writeMapleAsciiString(alliance.getNotice());
mplew.writeInt(newGuild); mplew.writeInt(newGuild);
getGuildInfo(mplew, Server.getInstance().getGuild(newGuild, c.getWorld(), null)); getGuildInfo(mplew, Server.getInstance().getGuild(newGuild, c.getWorld(), null));
@@ -6030,7 +6029,7 @@ public class MaplePacketCreator {
for (Integer guild : alliance.getGuilds()) { for (Integer guild : alliance.getGuilds()) {
mplew.writeInt(guild); mplew.writeInt(guild);
} }
mplew.writeInt(2); mplew.writeInt(alliance.getCapacity());
mplew.writeMapleAsciiString(alliance.getNotice()); mplew.writeMapleAsciiString(alliance.getNotice());
mplew.writeInt(expelledGuild); mplew.writeInt(expelledGuild);
getGuildInfo(mplew, Server.getInstance().getGuild(expelledGuild, c.getWorld(), null)); getGuildInfo(mplew, Server.getInstance().getGuild(expelledGuild, c.getWorld(), null));