Guild & Alliances Patches
As reported by J0k3r613, patched guild system not recognizing properly the guild leader just after creation. Patched many more issues related to guilds and alliances.
This commit is contained in:
@@ -98,7 +98,7 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
|
||||
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.");
|
||||
victim.getGuild().dropMessage("Your guild has joined the [" + alliance.getName() + "] union.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,8 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
|
||||
String notice = slea.readMapleAsciiString();
|
||||
Server.getInstance().setAllianceNotice(alliance.getId(), notice);
|
||||
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), notice), -1, -1);
|
||||
|
||||
alliance.dropMessage(5, "* Alliance Notice : " + notice);
|
||||
break;
|
||||
default:
|
||||
c.getPlayer().dropMessage("Feature not available");
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.Iterator;
|
||||
import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import net.server.Server;
|
||||
import net.server.guild.MapleAlliance;
|
||||
|
||||
public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
private boolean isGuildNameAcceptable(String name) {
|
||||
@@ -115,21 +116,22 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
c.getPlayer().dropMessage(1, "The Guild name you have chosen is not accepted.");
|
||||
return;
|
||||
}
|
||||
int gid;
|
||||
|
||||
gid = Server.getInstance().createGuild(mc.getId(), guildName);
|
||||
int gid = Server.getInstance().createGuild(mc.getId(), guildName);
|
||||
if (gid == 0) {
|
||||
c.announce(MaplePacketCreator.genericGuildMessage((byte) 0x1c));
|
||||
return;
|
||||
}
|
||||
mc.gainMeso(-MapleGuild.CREATE_GUILD_COST, true, false, true);
|
||||
|
||||
Server.getInstance().getWorld(mc.getWorld()).setGuildAndRank(mc.getId(), gid, 1);
|
||||
Server.getInstance().setGuildMemberOnline(mc, true, mc.getClient().getChannel());
|
||||
mc.getMGC().setGuildId(gid);
|
||||
Server.getInstance().getGuild(mc.getGuildId(), mc.getWorld(), mc); // initialize guild structure
|
||||
Server.getInstance().changeRank(gid, mc.getId(), 1);
|
||||
|
||||
c.announce(MaplePacketCreator.showGuildInfo(mc));
|
||||
|
||||
c.getPlayer().dropMessage(1, "You have successfully created a Guild.");
|
||||
respawnPlayer(mc);
|
||||
break;
|
||||
case 0x05:
|
||||
if (mc.getGuildId() <= 0 || mc.getGuildRank() > 2) {
|
||||
@@ -172,15 +174,14 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
System.out.println("[hax] " + mc.getName() + " is trying to join a guild that never invited him/her (or that the invitation has expired)");
|
||||
return;
|
||||
}
|
||||
mc.setGuildId(gid); // joins the guild
|
||||
mc.setGuildRank(5); // start at lowest rank
|
||||
mc.setAllianceRank(5);
|
||||
int s;
|
||||
mc.getMGC().setGuildId(gid); // joins the guild
|
||||
mc.getMGC().setGuildRank(5); // start at lowest rank
|
||||
mc.getMGC().setAllianceRank(5);
|
||||
|
||||
s = Server.getInstance().addGuildMember(mc.getMGC());
|
||||
int s = Server.getInstance().addGuildMember(mc.getMGC(), mc);
|
||||
if (s == 0) {
|
||||
c.getPlayer().dropMessage(1, "The Guild you are trying to join is already full.");
|
||||
mc.setGuildId(0);
|
||||
mc.getMGC().setGuildId(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
c.announce(MaplePacketCreator.showGuildInfo(null));
|
||||
if(allianceId > 0) Server.getInstance().getAlliance(allianceId).updateAlliancePackets(mc);
|
||||
|
||||
mc.setGuildId(0);
|
||||
mc.getMGC().setGuildId(0);
|
||||
mc.saveGuildStatus();
|
||||
respawnPlayer(mc);
|
||||
break;
|
||||
@@ -262,12 +263,18 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||
short logo = slea.readShort();
|
||||
byte logocolor = slea.readByte();
|
||||
Server.getInstance().setGuildEmblem(mc.getGuildId(), bg, bgcolor, logo, logocolor);
|
||||
|
||||
if (mc.getGuild() != null && mc.getGuild().getAllianceId() > 0) {
|
||||
MapleAlliance alliance = mc.getAlliance();
|
||||
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, c.getWorld()), -1, -1);
|
||||
}
|
||||
|
||||
mc.gainMeso(-MapleGuild.CHANGE_EMBLEM_COST, true, false, true);
|
||||
respawnPlayer(mc);
|
||||
break;
|
||||
case 0x10:
|
||||
if (mc.getGuildId() <= 0 || mc.getGuildRank() > 2) {
|
||||
System.out.println("[hax] " + mc.getName() + " tried to change guild notice while not in a guild.");
|
||||
if(mc.getGuildId() <= 0) System.out.println("[hax] " + mc.getName() + " tried to change guild notice while not in a guild.");
|
||||
return;
|
||||
}
|
||||
String notice = slea.readMapleAsciiString();
|
||||
|
||||
@@ -51,6 +51,7 @@ import client.inventory.MaplePet;
|
||||
import client.inventory.PetDataFactory;
|
||||
import constants.GameConstants;
|
||||
import constants.ServerConstants;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import server.TimerManager;
|
||||
|
||||
@@ -187,12 +188,10 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
MapleGuild playerGuild = server.getGuild(player.getGuildId(), player.getWorld(), player);
|
||||
if (playerGuild == null) {
|
||||
player.deleteGuild(player.getGuildId());
|
||||
player.setMGC(null);
|
||||
player.setGuildId(0);
|
||||
player.getMGC().setGuildId(0);
|
||||
} else {
|
||||
playerGuild.getMGC(player.getId()).setCharacter(player);
|
||||
player.setMGC(playerGuild.getMGC(player.getId()));
|
||||
|
||||
server.setGuildMemberOnline(player, true, c.getChannel());
|
||||
c.announce(MaplePacketCreator.showGuildInfo(player));
|
||||
int allianceId = player.getGuild().getAllianceId();
|
||||
@@ -206,12 +205,13 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
player.getGuild().setAllianceId(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (newAlliance != null) {
|
||||
c.announce(MaplePacketCreator.updateAllianceInfo(newAlliance, c));
|
||||
c.announce(MaplePacketCreator.allianceNotice(newAlliance.getId(), newAlliance.getNotice()));
|
||||
|
||||
server.allianceMessage(allianceId, MaplePacketCreator.allianceMemberOnline(player, true), player.getId(), -1);
|
||||
if (newcomer) {
|
||||
server.allianceMessage(allianceId, MaplePacketCreator.allianceMemberOnline(player, true), player.getId(), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user