Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 012303ac54 | |||
| a057fac68c | |||
| 3aca40dc78 | |||
| 5f67c043c2 | |||
| 258bef5cb3 | |||
| 3f91ef7409 | |||
| 57ab356a3a | |||
| f7249ba656 | |||
| 24eb9608c3 | |||
| e4096bebbd | |||
| 547060b7a6 | |||
| ba6738d27a | |||
| 06c6468013 | |||
| 548796994f | |||
| 580452d68b | |||
| a570d127be | |||
| a949a08e30 | |||
| 412f7f956f | |||
| aea6869ca0 | |||
| 950523ddcc | |||
| 631989e626 | |||
| 12f6d7574d | |||
| 85dcad1c2a | |||
| defa0d8bb8 | |||
| 85872b66da | |||
| 09c9dfbc06 | |||
| d014aafe45 | |||
| d331093acd | |||
| 75ea9de4e5 | |||
| 13207c16f6 | |||
| b625ea2707 | |||
| 6f752935ab | |||
| 49005c6647 |
@@ -312,7 +312,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
if (targetPC.getGuild() != null) {
|
if (targetPC.getGuild() != null) {
|
||||||
output += "Name: " + targetPC.getGuild().getName();
|
output += "Name: " + targetPC.getGuild().getName();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "State: " + targetPC.getGuild().getGuildState();
|
output += "State: " + targetPC.getGuild().guildState;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Realms Owned:" + targetPC.getGuild().getRealmsOwned();
|
output += "Realms Owned:" + targetPC.getGuild().getRealmsOwned();
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -320,7 +320,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "Nation Name: " + targetPC.getGuild().getNation().getName();
|
output += "Nation Name: " + targetPC.getGuild().getNation().getName();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Nation State: " + targetPC.getGuild().getNation().getGuildState();
|
output += "Nation State: " + targetPC.getGuild().getNation().guildState;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Realms Owned:" + targetPC.getGuild().getNation().getRealmsOwned();
|
output += "Realms Owned:" + targetPC.getGuild().getNation().getRealmsOwned();
|
||||||
output += newline;
|
output += newline;
|
||||||
|
|||||||
@@ -181,6 +181,19 @@ public enum GuildManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static mbEnums.GuildState calcuateGuildState(Guild guild) {
|
||||||
|
|
||||||
|
if (guild.getNation() == guild)
|
||||||
|
return guild.getSubGuildList().isEmpty() ? mbEnums.GuildState.Sovereign : mbEnums.GuildState.Nation;
|
||||||
|
|
||||||
|
if (guild.getOwnedCity() == null)
|
||||||
|
return guild.getNation().isEmptyGuild() ? mbEnums.GuildState.Errant : mbEnums.GuildState.Sworn;
|
||||||
|
|
||||||
|
return (guild.getOwnedCity().getTOL().getRank() == 8)
|
||||||
|
? mbEnums.GuildState.Province
|
||||||
|
: mbEnums.GuildState.Protectorate;
|
||||||
|
}
|
||||||
|
|
||||||
//This updates tags for all online players in a guild.
|
//This updates tags for all online players in a guild.
|
||||||
public static void updateAllGuildTags(Guild guild) {
|
public static void updateAllGuildTags(Guild guild) {
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceGuild.setCityUUID(0);
|
sourceGuild.setCityUUID(0);
|
||||||
sourceGuild.setGuildState(GuildState.Errant);
|
sourceGuild.guildState = GuildState.Errant;
|
||||||
sourceGuild.setNation(null);
|
sourceGuild.setNation(null);
|
||||||
|
|
||||||
// Transfer the city assets
|
// Transfer the city assets
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg;
|
AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg;
|
||||||
PlayerCharacter sourcePlayer;
|
PlayerCharacter sourcePlayer;
|
||||||
Guild sourceGuild;
|
Guild swornGuild;
|
||||||
Guild targetGuild;
|
Guild nation;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
// get PlayerCharacter of person sending sub invite
|
// get PlayerCharacter of person sending sub invite
|
||||||
@@ -49,21 +49,21 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
|||||||
if (sourcePlayer == null)
|
if (sourcePlayer == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
sourceGuild = sourcePlayer.getGuild();
|
swornGuild = sourcePlayer.getGuild();
|
||||||
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, msg.guildUUID());
|
nation = (Guild) DbManager.getObject(GameObjectType.Guild, msg.guildUUID());
|
||||||
|
|
||||||
//must be source guild to sub to
|
//must be source guild to sub to
|
||||||
|
|
||||||
if (targetGuild == null) {
|
if (nation == null) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sourceGuild == null) {
|
if (swornGuild == null) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceGuild.equals(targetGuild))
|
if (swornGuild.equals(nation))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus()) == false) {
|
if (GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus()) == false) {
|
||||||
@@ -74,7 +74,7 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
|||||||
//source guild is limited to 7 subs
|
//source guild is limited to 7 subs
|
||||||
//TODO this should be based on TOL rank
|
//TODO this should be based on TOL rank
|
||||||
|
|
||||||
if (!targetGuild.canSubAGuild(sourceGuild)) {
|
if (!nation.canSubAGuild(swornGuild)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -82,24 +82,20 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
|||||||
//all tests passed, let's Handle code
|
//all tests passed, let's Handle code
|
||||||
//Update Target Guild State.
|
//Update Target Guild State.
|
||||||
|
|
||||||
sourceGuild.upgradeGuildState(false);
|
swornGuild.guildState = GuildState.Petitioner;
|
||||||
|
|
||||||
//Add sub so GuildMaster can Swear in.
|
//Add sub so GuildMaster can Swear in.
|
||||||
|
|
||||||
ArrayList<Guild> subs = targetGuild.getSubGuildList();
|
ArrayList<Guild> subGuildList = nation.getSubGuildList();
|
||||||
subs.add(sourceGuild);
|
subGuildList.add(swornGuild);
|
||||||
|
|
||||||
targetGuild.setGuildState(GuildState.Nation);
|
|
||||||
|
|
||||||
|
|
||||||
//Let's send the message back.
|
//Let's send the message back.
|
||||||
|
|
||||||
|
ChatManager.chatGuildInfo(sourcePlayer, "Your guild is now a " + swornGuild.guildState.name() + '.');
|
||||||
msg.setUnknown02(1);
|
msg.setUnknown02(1);
|
||||||
msg.setResponse("Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
msg.setResponse("Your guild is now a " + swornGuild.guildState.name() + '.');
|
||||||
dispatch = Dispatch.borrow(sourcePlayer, msg);
|
dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
ChatManager.chatSystemInfo(sourcePlayer, "Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
BreakFealtyMsg bfm;
|
BreakFealtyMsg bfm;
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
Guild toBreak;
|
Guild nation;
|
||||||
Guild guild;
|
Guild protectorate;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
bfm = (BreakFealtyMsg) baseMsg;
|
bfm = (BreakFealtyMsg) baseMsg;
|
||||||
@@ -49,113 +49,100 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
toBreak = (Guild) DbManager.getObject(GameObjectType.Guild, bfm.getGuildUUID());
|
nation = (Guild) DbManager.getObject(GameObjectType.Guild, bfm.getGuildUUID());
|
||||||
|
|
||||||
if (toBreak == null) {
|
if (nation == null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
guild = player.getGuild();
|
protectorate = player.getGuild();
|
||||||
|
|
||||||
if (guild == null) {
|
if (protectorate == null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "You do not belong to a guild!");
|
ErrorPopupMsg.sendErrorMsg(player, "You do not belong to a guild!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toBreak.isNPCGuild()) {
|
if (nation.isNPCGuild()) {
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
|
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(), WorldServer.worldUUID)) {
|
if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), WorldServer.worldUUID)) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (guild.getGuildState()) {
|
switch (protectorate.guildState) {
|
||||||
case Sworn:
|
case Sworn:
|
||||||
guild.setNation(null);
|
protectorate.setNation(Guild.getErrantNation());
|
||||||
GuildManager.updateAllGuildTags(guild);
|
GuildManager.updateAllGuildTags(protectorate);
|
||||||
GuildManager.updateAllGuildBinds(guild, null);
|
GuildManager.updateAllGuildBinds(protectorate, null);
|
||||||
|
protectorate.guildState = mbEnums.GuildState.Errant;
|
||||||
break;
|
break;
|
||||||
case Province:
|
case Province:
|
||||||
guild.setNation(guild);
|
case Protectorate:
|
||||||
GuildManager.updateAllGuildTags(guild);
|
protectorate.setNation(protectorate);
|
||||||
GuildManager.updateAllGuildBinds(guild, guild.getOwnedCity());
|
GuildManager.updateAllGuildTags(protectorate);
|
||||||
|
GuildManager.updateAllGuildBinds(protectorate, protectorate.getOwnedCity());
|
||||||
|
protectorate.guildState = mbEnums.GuildState.Sovereign;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
guild.downgradeGuildState();
|
|
||||||
|
|
||||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||||
|
|
||||||
//Update Map.
|
|
||||||
|
|
||||||
final Session s = SessionManager.getSession(player);
|
|
||||||
|
|
||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
|
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
|
||||||
|
|
||||||
|
for (PlayerCharacter member : guildMembers)
|
||||||
|
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broke fealty from " + nation.getName() + '!');
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(guild.getObjectUUID());
|
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
|
||||||
|
|
||||||
for (PlayerCharacter member : guildMembers) {
|
for (PlayerCharacter member : breakFealtyMembers)
|
||||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broke fealty from " + toBreak.getName() + '!');
|
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(toBreak.getObjectUUID());
|
|
||||||
|
|
||||||
for (PlayerCharacter member : breakFealtyMembers) {
|
|
||||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!');
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!toBreak.getSubGuildList().contains(guild)) {
|
if (!nation.getSubGuildList().contains(protectorate)) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Failure to break fealty!");
|
ErrorPopupMsg.sendErrorMsg(player, "Failure to break fealty!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
|
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Bane.getBaneByAttackerGuild(guild) != null) {
|
if (Bane.getBaneByAttackerGuild(protectorate) != null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "You may break fealty with active bane!");
|
ErrorPopupMsg.sendErrorMsg(player, "You may break fealty with active bane!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DbManager.GuildQueries.UPDATE_PARENT(guild.getObjectUUID(), WorldServer.worldUUID)) {
|
if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), WorldServer.worldUUID)) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (guild.getGuildState()) {
|
switch (protectorate.guildState) {
|
||||||
case Sworn:
|
case Sworn:
|
||||||
guild.setNation(null);
|
protectorate.setNation(Guild.getErrantNation());
|
||||||
GuildManager.updateAllGuildTags(guild);
|
GuildManager.updateAllGuildTags(protectorate);
|
||||||
GuildManager.updateAllGuildBinds(guild, null);
|
GuildManager.updateAllGuildBinds(protectorate, null);
|
||||||
break;
|
break;
|
||||||
case Province:
|
case Province:
|
||||||
guild.setNation(guild);
|
protectorate.setNation(protectorate);
|
||||||
GuildManager.updateAllGuildTags(guild);
|
GuildManager.updateAllGuildTags(protectorate);
|
||||||
GuildManager.updateAllGuildBinds(guild, guild.getOwnedCity());
|
GuildManager.updateAllGuildBinds(protectorate, protectorate.getOwnedCity());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
guild.downgradeGuildState();
|
nation.getSubGuildList().remove(protectorate);
|
||||||
toBreak.getSubGuildList().remove(guild);
|
|
||||||
|
|
||||||
if (toBreak.getSubGuildList().isEmpty())
|
|
||||||
toBreak.downgradeGuildState();
|
|
||||||
|
|
||||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
@@ -167,17 +154,16 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
|
|
||||||
|
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
|
||||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(guild.getObjectUUID());
|
|
||||||
|
|
||||||
for (PlayerCharacter member : guildMembers) {
|
for (PlayerCharacter member : guildMembers) {
|
||||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broke fealty from " + toBreak.getName() + '!');
|
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broke fealty from " + nation.getName() + '!');
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(toBreak.getObjectUUID());
|
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
|
||||||
|
|
||||||
for (PlayerCharacter member : breakFealtyMembers) {
|
for (PlayerCharacter member : breakFealtyMembers) {
|
||||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!');
|
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceGuild.setCityUUID(0);
|
sourceGuild.setCityUUID(0);
|
||||||
sourceGuild.setGuildState(GuildState.Errant);
|
sourceGuild.guildState = GuildState.Errant;
|
||||||
sourceGuild.setNation(null);
|
sourceGuild.setNation(null);
|
||||||
|
|
||||||
// Transfer the city assets
|
// Transfer the city assets
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class DisbandGuildHandler extends AbstractClientMsgHandler {
|
|||||||
player.setGuildLeader(false);
|
player.setGuildLeader(false);
|
||||||
player.setInnerCouncil(false);
|
player.setInnerCouncil(false);
|
||||||
guild.setGuildLeaderUUID(0);
|
guild.setGuildLeaderUUID(0);
|
||||||
guild.setNation(null);
|
guild.setNation(Guild.getErrantNation());
|
||||||
|
|
||||||
DbManager.GuildQueries.DELETE_GUILD(guild);
|
DbManager.GuildQueries.DELETE_GUILD(guild);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (toDismiss.getGuildState()) {
|
switch (toDismiss.guildState) {
|
||||||
case Sworn:
|
case Sworn:
|
||||||
|
|
||||||
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
|
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
|
||||||
@@ -85,35 +85,43 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
nation.getSubGuildList().remove(toDismiss);
|
nation.getSubGuildList().remove(toDismiss);
|
||||||
toDismiss.downgradeGuildState();
|
toDismiss.guildState = mbEnums.GuildState.Errant;
|
||||||
toDismiss.setNation(null);
|
toDismiss.setNation(Guild.getErrantNation());
|
||||||
GuildManager.updateAllGuildBinds(toDismiss, null);
|
GuildManager.updateAllGuildBinds(toDismiss, null);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case Petitioner:
|
||||||
|
|
||||||
|
nation.getSubGuildList().remove(toDismiss);
|
||||||
|
|
||||||
|
if (toDismiss.getNation().isEmptyGuild())
|
||||||
|
toDismiss.guildState = mbEnums.GuildState.Errant;
|
||||||
|
else
|
||||||
|
toDismiss.guildState = mbEnums.GuildState.Sovereign;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Protectorate:
|
||||||
case Province:
|
case Province:
|
||||||
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
|
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
nation.getSubGuildList().remove(toDismiss);
|
nation.getSubGuildList().remove(toDismiss);
|
||||||
toDismiss.downgradeGuildState();
|
toDismiss.guildState = mbEnums.GuildState.Sovereign;
|
||||||
toDismiss.setNation(toDismiss);
|
toDismiss.setNation(toDismiss);
|
||||||
|
|
||||||
break;
|
|
||||||
case Petitioner:
|
|
||||||
nation.getSubGuildList().remove(toDismiss);
|
|
||||||
toDismiss.downgradeGuildState();
|
|
||||||
break;
|
|
||||||
case Protectorate:
|
|
||||||
nation.getSubGuildList().remove(toDismiss);
|
|
||||||
toDismiss.downgradeGuildState();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuildManager.updateAllGuildTags(toDismiss);
|
GuildManager.updateAllGuildTags(toDismiss);
|
||||||
|
|
||||||
if (nation.getSubGuildList().isEmpty())
|
boolean isNation = false;
|
||||||
nation.downgradeGuildState();
|
|
||||||
|
if (!nation.getSubGuildList().isEmpty())
|
||||||
|
for (Guild guild : nation.getSubGuildList())
|
||||||
|
if (guild.getOwnedCity() != null)
|
||||||
|
isNation = true;
|
||||||
|
|
||||||
|
nation.guildState = isNation ? mbEnums.GuildState.Nation : mbEnums.GuildState.Sovereign;
|
||||||
|
|
||||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
PlayerCharacter source;
|
PlayerCharacter source;
|
||||||
PlayerCharacter target;
|
PlayerCharacter target;
|
||||||
Guild sourceGuild;
|
Guild nation;
|
||||||
Guild targetGuild;
|
Guild protectorate;
|
||||||
InviteToSubMsg msg = (InviteToSubMsg) baseMsg;
|
InviteToSubMsg msg = (InviteToSubMsg) baseMsg;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
@@ -58,17 +58,17 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
if (target.isIgnoringPlayer(source))
|
if (target.isIgnoringPlayer(source))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
sourceGuild = source.getGuild();
|
nation = source.getGuild();
|
||||||
targetGuild = target.getGuild();
|
protectorate = target.getGuild();
|
||||||
|
|
||||||
//source must be in guild
|
//source must be in guild
|
||||||
|
|
||||||
if (sourceGuild == null) {
|
if (nation == null) {
|
||||||
sendChat(source, "You must be in a guild to invite to sub.");
|
sendChat(source, "You must be in a guild to invite to sub.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceGuild.isEmptyGuild()) {
|
if (nation.isEmptyGuild()) {
|
||||||
sendChat(source, "You must be in a guild to invite to sub.");
|
sendChat(source, "You must be in a guild to invite to sub.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -80,15 +80,15 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceGuild.getNation().isEmptyGuild())
|
if (nation.getNation().isEmptyGuild())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//target must be in a guild
|
//target must be in a guild
|
||||||
|
|
||||||
if (targetGuild == null)
|
if (protectorate == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (sourceGuild.equals(targetGuild))
|
if (nation.equals(protectorate))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//target must be GL or IC
|
//target must be GL or IC
|
||||||
@@ -98,18 +98,21 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Can't already be same nation or errant
|
|
||||||
//source guild is limited to 7 subs
|
|
||||||
//TODO this should be based on TOL rank
|
|
||||||
|
|
||||||
//cannot be subbed into a nation if you already have your own sub guilds
|
//cannot be subbed into a nation if you already have your own sub guilds
|
||||||
if(targetGuild.getSubGuildList() != null && targetGuild.getSubGuildList().size() > 0)
|
if (protectorate.getSubGuildList() != null && protectorate.getSubGuildList().size() > 0) {
|
||||||
|
sendChat(source, "This Guild is already a nation!");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sourceGuild.canSubAGuild(targetGuild)) {
|
if (!nation.canSubAGuild(protectorate)) {
|
||||||
sendChat(source, "This Guild can't be subbed.");
|
sendChat(source, "This Guild can't be subbed.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nation.getSubGuildList().size() >= nation.getOwnedCity().getRank()) {
|
||||||
|
sendChat(source, "Your TOL cannot support another subguild!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||||
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
|
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
|
||||||
sendChat(source, "You Must Be The Same Charter To Form A Nation.");
|
sendChat(source, "You Must Be The Same Charter To Form A Nation.");
|
||||||
@@ -119,9 +122,9 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
//all tests passed, let's send invite.
|
//all tests passed, let's send invite.
|
||||||
|
|
||||||
if (target.getClientConnection() != null) {
|
if (target.getClientConnection() != null) {
|
||||||
msg.setGuildTag(sourceGuild.getGuildTag());
|
msg.setGuildTag(nation.getGuildTag());
|
||||||
msg.setGuildName(sourceGuild.getName());
|
msg.setGuildName(nation.getName());
|
||||||
msg.setGuildUUID(sourceGuild.getObjectUUID());
|
msg.setGuildUUID(nation.getObjectUUID());
|
||||||
msg.setUnknown02(1);
|
msg.setUnknown02(1);
|
||||||
|
|
||||||
dispatch = Dispatch.borrow(target, msg);
|
dispatch = Dispatch.borrow(target, msg);
|
||||||
|
|||||||
@@ -79,18 +79,14 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GuildManager.updateAllGuildBinds(player.getGuild(), npc.getGuild().getOwnedCity());
|
GuildManager.updateAllGuildBinds(player.getGuild(), npc.getGuild().getOwnedCity());
|
||||||
|
|
||||||
|
|
||||||
//update Guild state.
|
//update Guild state.
|
||||||
player.getGuild().setNation(npc.getGuild());
|
player.getGuild().setNation(npc.getGuild());
|
||||||
GuildManager.updateAllGuildTags(player.getGuild());
|
GuildManager.updateAllGuildTags(player.getGuild());
|
||||||
|
|
||||||
//update state twice, errant to petitioner, to sworn.
|
//update state
|
||||||
player.getGuild().upgradeGuildState(false);//to petitioner
|
player.getGuild().guildState = mbEnums.GuildState.Sworn;
|
||||||
player.getGuild().upgradeGuildState(false);//to sworn
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
// Validate that the player is the leader of a guild
|
// Validate that the player is the leader of a guild
|
||||||
// that is not currently Sovereign *** BUG? Doesn't look right. isGuildLeader()?
|
// that is not currently Sovereign *** BUG? Doesn't look right. isGuildLeader()?
|
||||||
|
|
||||||
if ((playerCharacter.getGuild().getGuildState() != GuildState.Sworn
|
if ((playerCharacter.getGuild().guildState != GuildState.Sworn
|
||||||
|| playerCharacter.getGuild().getGuildState() != GuildState.Errant) == false) {
|
|| playerCharacter.getGuild().guildState != GuildState.Errant) == false) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 17, ""); // Your is not an errant or soverign guild
|
PlaceAssetMsg.sendPlaceAssetError(origin, 17, ""); // Your is not an errant or soverign guild
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Errant guilds cannot place assets
|
// Errant guilds cannot place assets
|
||||||
|
|
||||||
if (player.getGuild().getGuildState() == GuildState.Errant) {
|
if (player.getGuild().guildState == GuildState.Errant) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Only sovereign or sworn guilds may place assets.");
|
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Only sovereign or sworn guilds may place assets.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -774,7 +774,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
playerCharacter.getGuild().setNation(playerCharacter.getGuild());
|
playerCharacter.getGuild().setNation(playerCharacter.getGuild());
|
||||||
playerNation = playerCharacter.getGuild();
|
playerNation = playerCharacter.getGuild();
|
||||||
playerNation.setGuildState(GuildState.Sovereign);
|
playerNation.guildState = GuildState.Sovereign;
|
||||||
|
|
||||||
// Update guild binds and tags
|
// Update guild binds and tags
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
SwearInGuildMsg swearInMsg;
|
SwearInGuildMsg swearInMsg;
|
||||||
Guild targetGuild;
|
Guild protectorate;
|
||||||
Guild nation;
|
Guild nation;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, swearInMsg.getGuildUUID());
|
protectorate = (Guild) DbManager.getObject(GameObjectType.Guild, swearInMsg.getGuildUUID());
|
||||||
|
|
||||||
if (targetGuild == null) {
|
if (protectorate == null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -66,13 +66,14 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
|
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!nation.getSubGuildList().contains(targetGuild)) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
|
if (!nation.getSubGuildList().contains(protectorate)) {
|
||||||
|
ErrorPopupMsg.sendErrorMsg(player, "Guild is not a petitioner!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Guild.canSwearIn(targetGuild)) {
|
if (protectorate.guildState.equals(GuildState.Petitioner) == false) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, targetGuild.getGuildState().name() + "cannot be sworn in");
|
ErrorPopupMsg.sendErrorMsg(player, "Guild is not a petitioner!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,29 +82,30 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DbManager.GuildQueries.UPDATE_PARENT(targetGuild.getObjectUUID(), nation.getObjectUUID())) {
|
if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), nation.getObjectUUID())) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (targetGuild.getGuildState()) {
|
// update Guild state.
|
||||||
case Petitioner:
|
// R8 is a province
|
||||||
GuildManager.updateAllGuildBinds(targetGuild, nation.getOwnedCity());
|
|
||||||
break;
|
|
||||||
case Protectorate:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//shouldn't get here.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//update Guild state.
|
if (protectorate.getNation().isEmptyGuild())
|
||||||
targetGuild.setNation(nation);
|
protectorate.guildState = GuildState.Sworn;
|
||||||
GuildManager.updateAllGuildTags(targetGuild);
|
else
|
||||||
targetGuild.upgradeGuildState(false);
|
protectorate.guildState = (protectorate.getOwnedCity().getTOL().getRank() == 8)
|
||||||
|
? GuildState.Province
|
||||||
|
: GuildState.Protectorate;
|
||||||
|
|
||||||
if (nation.getGuildState() == GuildState.Sovereign)
|
protectorate.setNation(nation);
|
||||||
nation.upgradeGuildState(true);
|
GuildManager.updateAllGuildTags(protectorate);
|
||||||
|
|
||||||
|
// Upgrade to a nation if new sub is a landed guild
|
||||||
|
|
||||||
|
if (nation.guildState == GuildState.Sovereign)
|
||||||
|
if (protectorate.guildState.equals(GuildState.Protectorate) ||
|
||||||
|
protectorate.guildState.equals(GuildState.Province))
|
||||||
|
nation.guildState = GuildState.Nation;
|
||||||
|
|
||||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
@@ -113,15 +115,14 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
|
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
|
||||||
|
|
||||||
for (PlayerCharacter member : guildMembers) {
|
for (PlayerCharacter member : guildMembers)
|
||||||
ChatManager.chatGuildInfo(member, "Your Guild is now a Nation!");
|
ChatManager.chatGuildInfo(member, protectorate.getName() + " has sworn fealty to you.");
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> swornMembers = SessionManager.getActivePCsInGuildID(targetGuild.getObjectUUID());
|
ArrayList<PlayerCharacter> swornMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
|
||||||
|
|
||||||
|
for (PlayerCharacter member : swornMembers)
|
||||||
|
ChatManager.chatGuildInfo(member, "Your Guild has sworn fealty to " + nation.getName() + '.');
|
||||||
|
|
||||||
for (PlayerCharacter member : swornMembers) {
|
|
||||||
ChatManager.chatGuildInfo(member, "Your Guild has sword fealty to " + nation.getName() + '.');
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
else
|
else
|
||||||
writer.putInt((int) timeLeft / 1000); // Time remaing until bane/Seconds
|
writer.putInt((int) timeLeft / 1000); // Time remaing until bane/Seconds
|
||||||
|
|
||||||
if (attackerGuild.getGuildState() == GuildState.Sworn)
|
if (attackerGuild.guildState == GuildState.Sworn)
|
||||||
writer.putInt(4); //3 capture/errant,4 capture/sworn, 5 destroy/soveirgn.
|
writer.putInt(4); //3 capture/errant,4 capture/sworn, 5 destroy/soveirgn.
|
||||||
else
|
else
|
||||||
writer.putInt(5);
|
writer.putInt(5);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class SendGuildEntryMsg extends ClientNetMsg {
|
|||||||
if (subsAndSovs.size() > 0) {
|
if (subsAndSovs.size() > 0) {
|
||||||
|
|
||||||
for (Guild guild : subsAndSovs) {
|
for (Guild guild : subsAndSovs) {
|
||||||
int state = guild.getGuildState().getStateID();
|
int state = guild.guildState.getStateID();
|
||||||
|
|
||||||
writer.putInt(guild.getObjectType().ordinal());
|
writer.putInt(guild.getObjectType().ordinal());
|
||||||
writer.putInt(guild.getObjectUUID());
|
writer.putInt(guild.getObjectUUID());
|
||||||
|
|||||||
@@ -602,13 +602,10 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
this.isDeranking.compareAndSet(false, true);
|
this.isDeranking.compareAndSet(false, true);
|
||||||
|
|
||||||
if ((bane.getOwner().getGuild().getGuildState() == GuildState.Sovereign) ||
|
if (bane.getOwner().getGuild().guildState == GuildState.Sworn)
|
||||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Protectorate) ||
|
|
||||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Province) ||
|
|
||||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Nation))
|
|
||||||
siegeResult = SiegeResult.DESTROY;
|
|
||||||
else
|
|
||||||
siegeResult = SiegeResult.CAPTURE;
|
siegeResult = SiegeResult.CAPTURE;
|
||||||
|
else
|
||||||
|
siegeResult = SiegeResult.DESTROY;
|
||||||
|
|
||||||
// Remove realm if city had one
|
// Remove realm if city had one
|
||||||
|
|
||||||
|
|||||||
@@ -813,10 +813,10 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
// Determine if this city is a nation capitol
|
// Determine if this city is a nation capitol
|
||||||
|
|
||||||
if (this.getGuild().getGuildState() == GuildState.Nation)
|
if (this.getGuild().guildState == GuildState.Nation)
|
||||||
for (Guild sub : this.getGuild().getSubGuildList()) {
|
for (Guild sub : this.getGuild().getSubGuildList()) {
|
||||||
|
|
||||||
if ((sub.getGuildState() == GuildState.Protectorate) || (sub.getGuildState() == GuildState.Province)) {
|
if ((sub.guildState == GuildState.Protectorate) || (sub.guildState == GuildState.Province)) {
|
||||||
this.isCapital = 1;
|
this.isCapital = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1173,7 +1173,8 @@ public class City extends AbstractWorldObject {
|
|||||||
sourceNation.getSubGuildList().remove(sourceGuild);
|
sourceNation.getSubGuildList().remove(sourceGuild);
|
||||||
|
|
||||||
if (sourceNation.getSubGuildList().isEmpty())
|
if (sourceNation.getSubGuildList().isEmpty())
|
||||||
sourceNation.downgradeGuildState();
|
sourceNation.guildState = GuildState.Sovereign;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link the mew guild with the tree
|
// Link the mew guild with the tree
|
||||||
@@ -1186,7 +1187,7 @@ public class City extends AbstractWorldObject {
|
|||||||
sourceGuild.setCityUUID(this.getObjectUUID());
|
sourceGuild.setCityUUID(this.getObjectUUID());
|
||||||
|
|
||||||
sourceGuild.setNation(sourceGuild);
|
sourceGuild.setNation(sourceGuild);
|
||||||
sourceGuild.setGuildState(GuildState.Sovereign);
|
sourceGuild.guildState = GuildState.Sovereign;
|
||||||
GuildManager.updateAllGuildTags(sourceGuild);
|
GuildManager.updateAllGuildTags(sourceGuild);
|
||||||
GuildManager.updateAllGuildBinds(sourceGuild, this);
|
GuildManager.updateAllGuildBinds(sourceGuild, this);
|
||||||
|
|
||||||
|
|||||||
+17
-129
@@ -63,7 +63,7 @@ public class Guild extends AbstractWorldObject {
|
|||||||
private ArrayList<Guild> recommendList = new ArrayList<>();
|
private ArrayList<Guild> recommendList = new ArrayList<>();
|
||||||
private ArrayList<Guild> subGuildList;
|
private ArrayList<Guild> subGuildList;
|
||||||
private int nationUUID = 0;
|
private int nationUUID = 0;
|
||||||
private GuildState guildState = GuildState.Errant;
|
public GuildState guildState = GuildState.Errant;
|
||||||
private String hash;
|
private String hash;
|
||||||
private boolean ownerIsNPC;
|
private boolean ownerIsNPC;
|
||||||
|
|
||||||
@@ -206,23 +206,6 @@ public class Guild extends AbstractWorldObject {
|
|||||||
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild();
|
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSwearIn(Guild toSub) {
|
|
||||||
|
|
||||||
boolean canSwear = false;
|
|
||||||
|
|
||||||
switch (toSub.guildState) {
|
|
||||||
|
|
||||||
case Protectorate:
|
|
||||||
case Petitioner:
|
|
||||||
canSwear = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
canSwear = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return canSwear;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void _serializeForClientMsg(Guild guild, ByteBufferWriter writer) {
|
public static void _serializeForClientMsg(Guild guild, ByteBufferWriter writer) {
|
||||||
Guild.serializeForClientMsg(guild, writer, null, false);
|
Guild.serializeForClientMsg(guild, writer, null, false);
|
||||||
}
|
}
|
||||||
@@ -644,93 +627,15 @@ public class Guild extends AbstractWorldObject {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upgradeGuildState(boolean nation) {
|
|
||||||
if (nation) {
|
|
||||||
this.guildState = GuildState.Nation;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (this.guildState) {
|
|
||||||
|
|
||||||
case Errant:
|
|
||||||
this.guildState = GuildState.Petitioner;
|
|
||||||
break;
|
|
||||||
case Sworn:
|
|
||||||
//Can't upgrade
|
|
||||||
break;
|
|
||||||
case Protectorate:
|
|
||||||
this.guildState = GuildState.Province;
|
|
||||||
break;
|
|
||||||
case Petitioner:
|
|
||||||
this.guildState = GuildState.Sworn;
|
|
||||||
break;
|
|
||||||
case Province:
|
|
||||||
//Can't upgrade
|
|
||||||
break;
|
|
||||||
case Nation:
|
|
||||||
//Can't upgrade
|
|
||||||
break;
|
|
||||||
case Sovereign:
|
|
||||||
this.guildState = GuildState.Protectorate;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void downgradeGuildState() {
|
|
||||||
|
|
||||||
switch (this.guildState) {
|
|
||||||
case Errant:
|
|
||||||
break;
|
|
||||||
case Sworn:
|
|
||||||
this.guildState = GuildState.Errant;
|
|
||||||
break;
|
|
||||||
case Protectorate:
|
|
||||||
this.guildState = GuildState.Sovereign;
|
|
||||||
break;
|
|
||||||
case Petitioner:
|
|
||||||
this.guildState = GuildState.Errant;
|
|
||||||
break;
|
|
||||||
case Province:
|
|
||||||
this.guildState = GuildState.Sovereign;
|
|
||||||
break;
|
|
||||||
case Nation:
|
|
||||||
this.guildState = GuildState.Sovereign;
|
|
||||||
break;
|
|
||||||
case Sovereign:
|
|
||||||
this.guildState = GuildState.Errant;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSubAGuild(Guild toSub) {
|
public boolean canSubAGuild(Guild toSub) {
|
||||||
|
|
||||||
boolean canSub;
|
|
||||||
|
|
||||||
if (this.equals(toSub))
|
if (this.equals(toSub))
|
||||||
return false;
|
return false;
|
||||||
switch (this.guildState) {
|
|
||||||
case Nation:
|
|
||||||
case Sovereign:
|
|
||||||
canSub = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
canSub = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (toSub.guildState) {
|
boolean validNation = (this.guildState == GuildState.Nation || this.guildState == GuildState.Sovereign);
|
||||||
case Errant:
|
boolean validProtectorate = (toSub.guildState == GuildState.Errant || toSub.guildState == GuildState.Sovereign);
|
||||||
case Sovereign:
|
|
||||||
canSub = true;
|
return validNation && validProtectorate;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
canSub = false;
|
|
||||||
}
|
|
||||||
City nationCap = City.getCity(nation.cityUUID);
|
|
||||||
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
|
||||||
canSub = false;
|
|
||||||
}
|
|
||||||
return canSub;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRealmsOwnedFlag() {
|
public int getRealmsOwnedFlag() {
|
||||||
@@ -834,18 +739,9 @@ public class Guild extends AbstractWorldObject {
|
|||||||
Logger.error("FAILED TO LOAD SUB GUILDS FOR UUID " + this.getObjectUUID());
|
Logger.error("FAILED TO LOAD SUB GUILDS FOR UUID " + this.getObjectUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.nation == this && subGuildList.size() > 0)
|
this.guildState = GuildManager.calcuateGuildState(this);
|
||||||
this.guildState = GuildState.Nation;
|
|
||||||
else if (this.nation.equals(this))
|
|
||||||
this.guildState = GuildState.Sovereign;
|
|
||||||
else if (!this.nation.isEmptyGuild() && this.cityUUID != 0)
|
|
||||||
this.guildState = GuildState.Province;
|
|
||||||
else if (!this.nation.isEmptyGuild())
|
|
||||||
this.guildState = GuildState.Sworn;
|
|
||||||
else
|
|
||||||
this.guildState = GuildState.Errant;
|
|
||||||
|
|
||||||
if (this.cityUUID == 0)
|
if (this.getOwnedCity() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate number of realms this guild controls
|
// Calculate number of realms this guild controls
|
||||||
@@ -901,14 +797,6 @@ public class Guild extends AbstractWorldObject {
|
|||||||
return motto;
|
return motto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuildState getGuildState() {
|
|
||||||
return guildState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGuildState(GuildState guildState) {
|
|
||||||
this.guildState = guildState;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the realmsOwned
|
* @return the realmsOwned
|
||||||
*/
|
*/
|
||||||
@@ -930,18 +818,18 @@ public class Guild extends AbstractWorldObject {
|
|||||||
if (!DbManager.GuildQueries.UPDATE_PARENT(subGuild.getObjectUUID(), WorldServer.worldUUID))
|
if (!DbManager.GuildQueries.UPDATE_PARENT(subGuild.getObjectUUID(), WorldServer.worldUUID))
|
||||||
Logger.debug("Failed to set Nation Guild for Guild with UID " + subGuild.getObjectUUID());
|
Logger.debug("Failed to set Nation Guild for Guild with UID " + subGuild.getObjectUUID());
|
||||||
|
|
||||||
// Guild without any subs is no longer a nation
|
switch (subGuild.guildState) {
|
||||||
|
case Sworn:
|
||||||
if (subGuild.getOwnedCity() == null) {
|
subGuild.guildState = GuildState.Errant;
|
||||||
subGuild.nation = null;
|
subGuild.nation = Guild.getErrantNation();
|
||||||
} else {
|
break;
|
||||||
subGuild.nation = subGuild;
|
case Protectorate:
|
||||||
|
case Petitioner:
|
||||||
|
subGuild.nation = subGuild;
|
||||||
|
subGuild.guildState = GuildState.Sovereign;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Downgrade guild
|
|
||||||
|
|
||||||
subGuild.downgradeGuildState();
|
|
||||||
|
|
||||||
// Remove from collection
|
// Remove from collection
|
||||||
|
|
||||||
subGuildList.remove(subGuild);
|
subGuildList.remove(subGuild);
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ public class DestroyCityThread implements Runnable {
|
|||||||
|
|
||||||
//Successful Update of guild
|
//Successful Update of guild
|
||||||
|
|
||||||
formerGuild.setGuildState(mbEnums.GuildState.Errant);
|
formerGuild.guildState = mbEnums.GuildState.Errant;
|
||||||
formerGuild.setNation(null);
|
formerGuild.setNation(Guild.getErrantNation());
|
||||||
formerGuild.setCityUUID(0);
|
formerGuild.setCityUUID(0);
|
||||||
GuildManager.updateAllGuildTags(formerGuild);
|
GuildManager.updateAllGuildTags(formerGuild);
|
||||||
GuildManager.updateAllGuildBinds(formerGuild, null);
|
GuildManager.updateAllGuildBinds(formerGuild, null);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public class TransferCityThread implements Runnable {
|
|||||||
|
|
||||||
if (formerGuild != null)
|
if (formerGuild != null)
|
||||||
if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) {
|
if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) {
|
||||||
formerGuild.setGuildState(mbEnums.GuildState.Errant);
|
formerGuild.guildState = mbEnums.GuildState.Errant;
|
||||||
formerGuild.setNation(null);
|
formerGuild.setNation(Guild.getErrantNation());
|
||||||
formerGuild.setCityUUID(0);
|
formerGuild.setCityUUID(0);
|
||||||
GuildManager.updateAllGuildTags(formerGuild);
|
GuildManager.updateAllGuildTags(formerGuild);
|
||||||
GuildManager.updateAllGuildBinds(formerGuild, null);
|
GuildManager.updateAllGuildBinds(formerGuild, null);
|
||||||
@@ -63,13 +63,11 @@ public class TransferCityThread implements Runnable {
|
|||||||
|
|
||||||
subGuildList = new ArrayList<>();
|
subGuildList = new ArrayList<>();
|
||||||
|
|
||||||
for (Guild subGuild : formerGuild.getSubGuildList()) {
|
for (Guild subGuild : formerGuild.getSubGuildList())
|
||||||
subGuildList.add(subGuild);
|
subGuildList.add(subGuild);
|
||||||
}
|
|
||||||
|
|
||||||
for (Guild subGuild : subGuildList) {
|
for (Guild subGuild : subGuildList)
|
||||||
formerGuild.removeSubGuild(subGuild);
|
formerGuild.removeSubGuild(subGuild);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset TOL to rank 1
|
//Reset TOL to rank 1
|
||||||
|
|||||||
Reference in New Issue
Block a user