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:
@@ -372,13 +372,14 @@ public class MapleGuild {
|
||||
}
|
||||
}
|
||||
|
||||
public int addGuildMember(MapleGuildCharacter mgc) {
|
||||
public int addGuildMember(MapleGuildCharacter mgc, MapleCharacter chr) {
|
||||
synchronized (members) {
|
||||
if (members.size() >= capacity) {
|
||||
return 0;
|
||||
}
|
||||
for (int i = members.size() - 1; i >= 0; i--) {
|
||||
if (members.get(i).getGuildRank() < 5 || members.get(i).getName().compareTo(mgc.getName()) < 0) {
|
||||
mgc.setCharacter(chr);
|
||||
members.add(i + 1, mgc);
|
||||
bDirty = true;
|
||||
break;
|
||||
@@ -439,23 +440,30 @@ public class MapleGuild {
|
||||
public void changeRank(int cid, int newRank) {
|
||||
for (MapleGuildCharacter mgc : members) {
|
||||
if (cid == mgc.getId()) {
|
||||
try {
|
||||
if (mgc.isOnline()) {
|
||||
Server.getInstance().getWorld(mgc.getWorld()).setGuildAndRank(cid, this.id, newRank);
|
||||
} else {
|
||||
Server.getInstance().getWorld(mgc.getWorld()).setOfflineGuildStatus((short) this.id, (byte) newRank, cid);
|
||||
}
|
||||
} catch (Exception re) {
|
||||
re.printStackTrace();
|
||||
return;
|
||||
}
|
||||
mgc.setGuildRank(newRank);
|
||||
this.broadcast(MaplePacketCreator.changeRank(mgc));
|
||||
changeRank(mgc, newRank);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void changeRank(MapleGuildCharacter mgc, int newRank) {
|
||||
try {
|
||||
if (mgc.isOnline()) {
|
||||
Server.getInstance().getWorld(mgc.getWorld()).setGuildAndRank(mgc.getId(), this.id, newRank);
|
||||
mgc.setGuildRank(newRank);
|
||||
} else {
|
||||
Server.getInstance().getWorld(mgc.getWorld()).setOfflineGuildStatus((short) this.id, (byte) newRank, mgc.getId());
|
||||
mgc.setOfflineGuildRank(newRank);
|
||||
}
|
||||
} catch (Exception re) {
|
||||
re.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
this.broadcast(MaplePacketCreator.changeRank(mgc));
|
||||
return;
|
||||
}
|
||||
|
||||
public void setGuildNotice(String notice) {
|
||||
this.notice = notice;
|
||||
writeToDB(false);
|
||||
@@ -594,7 +602,11 @@ public class MapleGuild {
|
||||
|
||||
public void resetAllianceGuildPlayersRank() {
|
||||
try {
|
||||
for(MapleGuildCharacter mgc: members) mgc.setAllianceRank(5);
|
||||
for(MapleGuildCharacter mgc: members) {
|
||||
if(mgc.isOnline()) {
|
||||
mgc.setAllianceRank(5);
|
||||
}
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET allianceRank = ? WHERE guildid = ?")) {
|
||||
ps.setInt(1, 5);
|
||||
|
||||
Reference in New Issue
Block a user