Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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) {
|
||||
output += "Name: " + targetPC.getGuild().getName();
|
||||
output += newline;
|
||||
output += "State: " + targetPC.getGuild().getGuildState();
|
||||
output += "State: " + targetPC.getGuild().guildState;
|
||||
output += newline;
|
||||
output += "Realms Owned:" + targetPC.getGuild().getRealmsOwned();
|
||||
output += newline;
|
||||
@@ -320,7 +320,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += newline;
|
||||
output += "Nation Name: " + targetPC.getGuild().getNation().getName();
|
||||
output += newline;
|
||||
output += "Nation State: " + targetPC.getGuild().getNation().getGuildState();
|
||||
output += "Nation State: " + targetPC.getGuild().getNation().guildState;
|
||||
output += newline;
|
||||
output += "Realms Owned:" + targetPC.getGuild().getNation().getRealmsOwned();
|
||||
output += newline;
|
||||
|
||||
@@ -173,7 +173,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
sourceGuild.setCityUUID(0);
|
||||
sourceGuild.setGuildState(GuildState.Errant);
|
||||
sourceGuild.guildState = GuildState.Errant;
|
||||
sourceGuild.setNation(null);
|
||||
|
||||
// Transfer the city assets
|
||||
|
||||
@@ -38,8 +38,8 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
|
||||
AcceptSubInviteMsg msg = (AcceptSubInviteMsg) baseMsg;
|
||||
PlayerCharacter sourcePlayer;
|
||||
Guild sourceGuild;
|
||||
Guild targetGuild;
|
||||
Guild swornGuild;
|
||||
Guild nation;
|
||||
Dispatch dispatch;
|
||||
|
||||
// get PlayerCharacter of person sending sub invite
|
||||
@@ -49,21 +49,21 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
if (sourcePlayer == null)
|
||||
return true;
|
||||
|
||||
sourceGuild = sourcePlayer.getGuild();
|
||||
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, msg.guildUUID());
|
||||
swornGuild = sourcePlayer.getGuild();
|
||||
nation = (Guild) DbManager.getObject(GameObjectType.Guild, msg.guildUUID());
|
||||
|
||||
//must be source guild to sub to
|
||||
|
||||
if (targetGuild == null) {
|
||||
if (nation == null) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
||||
return true;
|
||||
}
|
||||
if (sourceGuild == null) {
|
||||
if (swornGuild == null) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sourceGuild.equals(targetGuild))
|
||||
if (swornGuild.equals(nation))
|
||||
return true;
|
||||
|
||||
if (GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus()) == false) {
|
||||
@@ -74,7 +74,7 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
//source guild is limited to 7 subs
|
||||
//TODO this should be based on TOL rank
|
||||
|
||||
if (!targetGuild.canSubAGuild(sourceGuild)) {
|
||||
if (!nation.canSubAGuild(swornGuild)) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
|
||||
return true;
|
||||
}
|
||||
@@ -82,24 +82,20 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
|
||||
//all tests passed, let's Handle code
|
||||
//Update Target Guild State.
|
||||
|
||||
sourceGuild.upgradeGuildState(false);
|
||||
swornGuild.guildState = GuildState.Petitioner;
|
||||
|
||||
//Add sub so GuildMaster can Swear in.
|
||||
|
||||
ArrayList<Guild> subs = targetGuild.getSubGuildList();
|
||||
subs.add(sourceGuild);
|
||||
|
||||
targetGuild.setGuildState(GuildState.Nation);
|
||||
|
||||
ArrayList<Guild> subGuildList = nation.getSubGuildList();
|
||||
subGuildList.add(swornGuild);
|
||||
|
||||
//Let's send the message back.
|
||||
|
||||
ChatManager.chatGuildInfo(sourcePlayer, "Your guild is now a " + swornGuild.guildState.name() + '.');
|
||||
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);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
ChatManager.chatSystemInfo(sourcePlayer, "Your guild is now a " + sourceGuild.getGuildState().name() + '.');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
BreakFealtyMsg bfm;
|
||||
PlayerCharacter player;
|
||||
Guild toBreak;
|
||||
Guild guild;
|
||||
Guild nation;
|
||||
Guild protectorate;
|
||||
Dispatch dispatch;
|
||||
|
||||
bfm = (BreakFealtyMsg) baseMsg;
|
||||
@@ -49,47 +49,58 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
if (player == null)
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
|
||||
guild = player.getGuild();
|
||||
protectorate = player.getGuild();
|
||||
|
||||
if (guild == null) {
|
||||
if (protectorate == null) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You do not belong to a guild!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (toBreak.isNPCGuild()) {
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
||||
if (nation.isNPCGuild()) {
|
||||
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (guild.getGuildState()) {
|
||||
switch (protectorate.guildState) {
|
||||
case Sworn:
|
||||
guild.setNation(null);
|
||||
GuildManager.updateAllGuildTags(guild);
|
||||
GuildManager.updateAllGuildBinds(guild, null);
|
||||
protectorate.setNation(Guild.getErrantNation());
|
||||
GuildManager.updateAllGuildTags(protectorate);
|
||||
GuildManager.updateAllGuildBinds(protectorate, null);
|
||||
protectorate.guildState = mbEnums.GuildState.Errant;
|
||||
break;
|
||||
case Province:
|
||||
guild.setNation(guild);
|
||||
GuildManager.updateAllGuildTags(guild);
|
||||
GuildManager.updateAllGuildBinds(guild, guild.getOwnedCity());
|
||||
case Protectorate:
|
||||
protectorate.setNation(protectorate);
|
||||
GuildManager.updateAllGuildTags(protectorate);
|
||||
GuildManager.updateAllGuildBinds(protectorate, protectorate.getOwnedCity());
|
||||
|
||||
boolean isNation = false;
|
||||
|
||||
for (Guild subGuild : protectorate.getSubGuildList())
|
||||
if (subGuild.getOwnedCity() != null)
|
||||
isNation = true;
|
||||
|
||||
if (isNation)
|
||||
protectorate.guildState = mbEnums.GuildState.Nation;
|
||||
else
|
||||
protectorate.guildState = mbEnums.GuildState.Sovereign;
|
||||
break;
|
||||
}
|
||||
|
||||
guild.downgradeGuildState();
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
@@ -101,16 +112,16 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
City.lastCityUpdate = System.currentTimeMillis();
|
||||
|
||||
|
||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(guild.getObjectUUID());
|
||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
|
||||
|
||||
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) {
|
||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!');
|
||||
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -118,44 +129,40 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
}
|
||||
|
||||
if (!toBreak.getSubGuildList().contains(guild)) {
|
||||
if (!nation.getSubGuildList().contains(protectorate)) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Failure to break fealty!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
||||
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Only guild leader can break fealty!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Bane.getBaneByAttackerGuild(guild) != null) {
|
||||
if (Bane.getBaneByAttackerGuild(protectorate) != null) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You may break fealty with active bane!");
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (guild.getGuildState()) {
|
||||
switch (protectorate.guildState) {
|
||||
case Sworn:
|
||||
guild.setNation(null);
|
||||
GuildManager.updateAllGuildTags(guild);
|
||||
GuildManager.updateAllGuildBinds(guild, null);
|
||||
protectorate.setNation(null);
|
||||
GuildManager.updateAllGuildTags(protectorate);
|
||||
GuildManager.updateAllGuildBinds(protectorate, null);
|
||||
break;
|
||||
case Province:
|
||||
guild.setNation(guild);
|
||||
GuildManager.updateAllGuildTags(guild);
|
||||
GuildManager.updateAllGuildBinds(guild, guild.getOwnedCity());
|
||||
protectorate.setNation(protectorate);
|
||||
GuildManager.updateAllGuildTags(protectorate);
|
||||
GuildManager.updateAllGuildBinds(protectorate, protectorate.getOwnedCity());
|
||||
break;
|
||||
}
|
||||
|
||||
guild.downgradeGuildState();
|
||||
toBreak.getSubGuildList().remove(guild);
|
||||
|
||||
if (toBreak.getSubGuildList().isEmpty())
|
||||
toBreak.downgradeGuildState();
|
||||
nation.getSubGuildList().remove(protectorate);
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
@@ -167,17 +174,16 @@ public class BreakFealtyHandler extends AbstractClientMsgHandler {
|
||||
|
||||
City.lastCityUpdate = System.currentTimeMillis();
|
||||
|
||||
|
||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(guild.getObjectUUID());
|
||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
|
||||
|
||||
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) {
|
||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!');
|
||||
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
sourceGuild.setCityUUID(0);
|
||||
sourceGuild.setGuildState(GuildState.Errant);
|
||||
sourceGuild.guildState = GuildState.Errant;
|
||||
sourceGuild.setNation(null);
|
||||
|
||||
// Transfer the city assets
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (toDismiss.getGuildState()) {
|
||||
switch (toDismiss.guildState) {
|
||||
case Sworn:
|
||||
|
||||
if (!DbManager.GuildQueries.UPDATE_PARENT(toDismiss.getObjectUUID(), WorldServer.worldUUID)) {
|
||||
@@ -85,8 +85,8 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
nation.getSubGuildList().remove(toDismiss);
|
||||
toDismiss.downgradeGuildState();
|
||||
toDismiss.setNation(null);
|
||||
toDismiss.guildState = mbEnums.GuildState.Errant;
|
||||
toDismiss.setNation(Guild.getErrantNation());
|
||||
GuildManager.updateAllGuildBinds(toDismiss, null);
|
||||
|
||||
break;
|
||||
@@ -96,24 +96,35 @@ public class DismissGuildHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
nation.getSubGuildList().remove(toDismiss);
|
||||
toDismiss.downgradeGuildState();
|
||||
toDismiss.guildState = mbEnums.GuildState.Sovereign;
|
||||
toDismiss.setNation(toDismiss);
|
||||
|
||||
break;
|
||||
case Petitioner:
|
||||
|
||||
nation.getSubGuildList().remove(toDismiss);
|
||||
toDismiss.downgradeGuildState();
|
||||
|
||||
if (toDismiss.getNation().isEmptyGuild())
|
||||
toDismiss.guildState = mbEnums.GuildState.Errant;
|
||||
else
|
||||
toDismiss.guildState = mbEnums.GuildState.Sovereign;
|
||||
|
||||
break;
|
||||
case Protectorate:
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
nation.getSubGuildList().remove(toDismiss);
|
||||
toDismiss.downgradeGuildState();
|
||||
toDismiss.guildState = mbEnums.GuildState.Sovereign;
|
||||
toDismiss.setNation(toDismiss);
|
||||
break;
|
||||
}
|
||||
|
||||
GuildManager.updateAllGuildTags(toDismiss);
|
||||
|
||||
if (nation.getSubGuildList().isEmpty())
|
||||
nation.downgradeGuildState();
|
||||
nation.guildState = mbEnums.GuildState.Sovereign;
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
|
||||
@@ -79,18 +79,14 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GuildManager.updateAllGuildBinds(player.getGuild(), npc.getGuild().getOwnedCity());
|
||||
|
||||
|
||||
//update Guild state.
|
||||
player.getGuild().setNation(npc.getGuild());
|
||||
GuildManager.updateAllGuildTags(player.getGuild());
|
||||
|
||||
//update state twice, errant to petitioner, to sworn.
|
||||
player.getGuild().upgradeGuildState(false);//to petitioner
|
||||
player.getGuild().upgradeGuildState(false);//to sworn
|
||||
|
||||
//update state
|
||||
player.getGuild().guildState = mbEnums.GuildState.Sworn;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
// Validate that the player is the leader of a guild
|
||||
// that is not currently Sovereign *** BUG? Doesn't look right. isGuildLeader()?
|
||||
|
||||
if ((playerCharacter.getGuild().getGuildState() != GuildState.Sworn
|
||||
|| playerCharacter.getGuild().getGuildState() != GuildState.Errant) == false) {
|
||||
if ((playerCharacter.getGuild().guildState != GuildState.Sworn
|
||||
|| playerCharacter.getGuild().guildState != GuildState.Errant) == false) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 17, ""); // Your is not an errant or soverign guild
|
||||
return false;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// 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.");
|
||||
return false;
|
||||
}
|
||||
@@ -774,7 +774,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
playerCharacter.getGuild().setNation(playerCharacter.getGuild());
|
||||
playerNation = playerCharacter.getGuild();
|
||||
playerNation.setGuildState(GuildState.Sovereign);
|
||||
playerNation.guildState = GuildState.Sovereign;
|
||||
|
||||
// Update guild binds and tags
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||
PlayerCharacter player;
|
||||
SwearInGuildMsg swearInMsg;
|
||||
Guild targetGuild;
|
||||
Guild protectorate;
|
||||
Guild nation;
|
||||
Dispatch dispatch;
|
||||
|
||||
@@ -47,9 +47,9 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
||||
if (player == null)
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
@@ -66,44 +66,43 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
|
||||
return true;
|
||||
}
|
||||
if (!nation.getSubGuildList().contains(targetGuild)) {
|
||||
|
||||
if (!nation.getSubGuildList().contains(protectorate)) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Guild.canSwearIn(targetGuild)) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, targetGuild.getGuildState().name() + "cannot be sworn in");
|
||||
if (protectorate.guildState.equals(GuildState.Petitioner) == false)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (targetGuild.getGuildState()) {
|
||||
case Petitioner:
|
||||
GuildManager.updateAllGuildBinds(targetGuild, nation.getOwnedCity());
|
||||
break;
|
||||
case Protectorate:
|
||||
break;
|
||||
default:
|
||||
//shouldn't get here.
|
||||
break;
|
||||
}
|
||||
//shouldn't get here.
|
||||
if (protectorate.guildState.equals(GuildState.Petitioner))
|
||||
GuildManager.updateAllGuildBinds(protectorate, nation.getOwnedCity());
|
||||
|
||||
//update Guild state.
|
||||
targetGuild.setNation(nation);
|
||||
GuildManager.updateAllGuildTags(targetGuild);
|
||||
targetGuild.upgradeGuildState(false);
|
||||
|
||||
if (nation.getGuildState() == GuildState.Sovereign)
|
||||
nation.upgradeGuildState(true);
|
||||
if (protectorate.getNation().isEmptyGuild())
|
||||
protectorate.guildState = GuildState.Sworn;
|
||||
else
|
||||
protectorate.guildState = GuildState.Protectorate;
|
||||
|
||||
protectorate.setNation(nation);
|
||||
GuildManager.updateAllGuildTags(protectorate);
|
||||
|
||||
if (nation.guildState == GuildState.Sovereign) {
|
||||
if (protectorate.guildState.equals(GuildState.Protectorate))
|
||||
nation.guildState = GuildState.Nation;
|
||||
}
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
@@ -113,15 +112,14 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
||||
|
||||
ArrayList<PlayerCharacter> guildMembers = SessionManager.getActivePCsInGuildID(nation.getObjectUUID());
|
||||
|
||||
for (PlayerCharacter member : guildMembers) {
|
||||
ChatManager.chatGuildInfo(member, "Your Guild is now a Nation!");
|
||||
}
|
||||
for (PlayerCharacter member : guildMembers)
|
||||
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) {
|
||||
Logger.error(e.getMessage());
|
||||
return true;
|
||||
|
||||
@@ -437,7 +437,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
else
|
||||
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.
|
||||
else
|
||||
writer.putInt(5);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SendGuildEntryMsg extends ClientNetMsg {
|
||||
if (subsAndSovs.size() > 0) {
|
||||
|
||||
for (Guild guild : subsAndSovs) {
|
||||
int state = guild.getGuildState().getStateID();
|
||||
int state = guild.guildState.getStateID();
|
||||
|
||||
writer.putInt(guild.getObjectType().ordinal());
|
||||
writer.putInt(guild.getObjectUUID());
|
||||
|
||||
@@ -602,10 +602,10 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
this.isDeranking.compareAndSet(false, true);
|
||||
|
||||
if ((bane.getOwner().getGuild().getGuildState() == GuildState.Sovereign) ||
|
||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Protectorate) ||
|
||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Province) ||
|
||||
(bane.getOwner().getGuild().getGuildState() == GuildState.Nation))
|
||||
if ((bane.getOwner().getGuild().guildState == GuildState.Sovereign) ||
|
||||
(bane.getOwner().getGuild().guildState == GuildState.Protectorate) ||
|
||||
(bane.getOwner().getGuild().guildState == GuildState.Province) ||
|
||||
(bane.getOwner().getGuild().guildState == GuildState.Nation))
|
||||
siegeResult = SiegeResult.DESTROY;
|
||||
else
|
||||
siegeResult = SiegeResult.CAPTURE;
|
||||
|
||||
@@ -813,10 +813,10 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
// 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()) {
|
||||
|
||||
if ((sub.getGuildState() == GuildState.Protectorate) || (sub.getGuildState() == GuildState.Province)) {
|
||||
if ((sub.guildState == GuildState.Protectorate) || (sub.guildState == GuildState.Province)) {
|
||||
this.isCapital = 1;
|
||||
break;
|
||||
}
|
||||
@@ -1173,7 +1173,8 @@ public class City extends AbstractWorldObject {
|
||||
sourceNation.getSubGuildList().remove(sourceGuild);
|
||||
|
||||
if (sourceNation.getSubGuildList().isEmpty())
|
||||
sourceNation.downgradeGuildState();
|
||||
sourceNation.guildState = GuildState.Sovereign;
|
||||
|
||||
}
|
||||
|
||||
// Link the mew guild with the tree
|
||||
@@ -1186,7 +1187,7 @@ public class City extends AbstractWorldObject {
|
||||
sourceGuild.setCityUUID(this.getObjectUUID());
|
||||
|
||||
sourceGuild.setNation(sourceGuild);
|
||||
sourceGuild.setGuildState(GuildState.Sovereign);
|
||||
sourceGuild.guildState = GuildState.Sovereign;
|
||||
GuildManager.updateAllGuildTags(sourceGuild);
|
||||
GuildManager.updateAllGuildBinds(sourceGuild, this);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Guild extends AbstractWorldObject {
|
||||
private ArrayList<Guild> recommendList = new ArrayList<>();
|
||||
private ArrayList<Guild> subGuildList;
|
||||
private int nationUUID = 0;
|
||||
private GuildState guildState = GuildState.Errant;
|
||||
public GuildState guildState = GuildState.Errant;
|
||||
private String hash;
|
||||
private boolean ownerIsNPC;
|
||||
|
||||
@@ -206,23 +206,6 @@ public class Guild extends AbstractWorldObject {
|
||||
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) {
|
||||
Guild.serializeForClientMsg(guild, writer, null, false);
|
||||
}
|
||||
@@ -644,65 +627,6 @@ 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) {
|
||||
|
||||
boolean canSub;
|
||||
@@ -726,10 +650,12 @@ public class Guild extends AbstractWorldObject {
|
||||
default:
|
||||
canSub = false;
|
||||
}
|
||||
|
||||
City nationCap = City.getCity(nation.cityUUID);
|
||||
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
||||
|
||||
if (nation.getSubGuildList().size() >= nationCap.getRank())
|
||||
canSub = false;
|
||||
}
|
||||
|
||||
return canSub;
|
||||
}
|
||||
|
||||
@@ -901,14 +827,6 @@ public class Guild extends AbstractWorldObject {
|
||||
return motto;
|
||||
}
|
||||
|
||||
public GuildState getGuildState() {
|
||||
return guildState;
|
||||
}
|
||||
|
||||
public void setGuildState(GuildState guildState) {
|
||||
this.guildState = guildState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the realmsOwned
|
||||
*/
|
||||
@@ -933,15 +851,13 @@ public class Guild extends AbstractWorldObject {
|
||||
// Guild without any subs is no longer a nation
|
||||
|
||||
if (subGuild.getOwnedCity() == null) {
|
||||
subGuild.nation = null;
|
||||
subGuild.guildState = GuildState.Errant;
|
||||
subGuild.nation = Guild.getErrantNation();
|
||||
} else {
|
||||
subGuild.nation = subGuild;
|
||||
subGuild.guildState = GuildState.Errant;
|
||||
}
|
||||
|
||||
// Downgrade guild
|
||||
|
||||
subGuild.downgradeGuildState();
|
||||
|
||||
// Remove from collection
|
||||
|
||||
subGuildList.remove(subGuild);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DestroyCityThread implements Runnable {
|
||||
|
||||
//Successful Update of guild
|
||||
|
||||
formerGuild.setGuildState(mbEnums.GuildState.Errant);
|
||||
formerGuild.guildState = mbEnums.GuildState.Errant;
|
||||
formerGuild.setNation(null);
|
||||
formerGuild.setCityUUID(0);
|
||||
GuildManager.updateAllGuildTags(formerGuild);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TransferCityThread implements Runnable {
|
||||
|
||||
if (formerGuild != null)
|
||||
if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) {
|
||||
formerGuild.setGuildState(mbEnums.GuildState.Errant);
|
||||
formerGuild.guildState = mbEnums.GuildState.Errant;
|
||||
formerGuild.setNation(null);
|
||||
formerGuild.setCityUUID(0);
|
||||
GuildManager.updateAllGuildTags(formerGuild);
|
||||
|
||||
Reference in New Issue
Block a user