Compare commits
46 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 | |||
| b2bd3b7a92 | |||
| 461e4e1c3d | |||
| 0d1d00e2d1 | |||
| ec6825d651 | |||
| cb561c3b6b | |||
| cf0f0cf022 | |||
| f85673e661 | |||
| 84347f8290 | |||
| fd2fe92714 | |||
| 955b94eb08 | |||
| a9aa6e9660 | |||
| afc080074f | |||
| 1039fb1d0b |
@@ -58,6 +58,9 @@ public abstract class dbHandlerBase {
|
||||
|
||||
int id = rs.getInt(1);
|
||||
|
||||
if (id == 39052)
|
||||
Logger.info(id);
|
||||
|
||||
if (DbManager.inCache(localObjectType, id)) {
|
||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||
} else {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -462,11 +462,12 @@ public enum CombatManager {
|
||||
|
||||
if (damage > 0) {
|
||||
|
||||
if (AbstractCharacter.IsAbstractCharacter(target))
|
||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||
((AbstractCharacter) target).modifyHealth(-damage, attacker, true);
|
||||
else
|
||||
((AbstractCharacter) target).cancelOnTakeDamage();
|
||||
}else {
|
||||
((Building) target).modifyHealth(-damage, attacker);
|
||||
|
||||
}
|
||||
int attackAnim = getSwingAnimation(null, null, slot);
|
||||
if (attacker.charItemManager.getEquipped().get(slot) != null) {
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
@@ -164,6 +164,15 @@ public enum ConfigManager {
|
||||
Logger.info("Compiling regex");
|
||||
|
||||
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
||||
|
||||
Logger.info("Loading WPAK data");
|
||||
|
||||
// *** Needs powermanager collection
|
||||
// defined before activation.
|
||||
// EffectsParser.parseWpakFile();
|
||||
// PowersParser.parseWpakFile();
|
||||
// PowerActionParser.parseWpakFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,15 @@ public enum ForgeManager implements Runnable {
|
||||
public static final ConcurrentHashMap<NPC, ConcurrentHashMap.KeySetView<WorkOrder, Boolean>> vendorWorkOrderLookup = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentHashMap<Item, WorkOrder> itemWorkOrderLookup = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public static void start() {
|
||||
|
||||
Thread forgeManager;
|
||||
forgeManager = new Thread(FORGE_MANAGER);
|
||||
forgeManager.setName("Forge Manager");
|
||||
forgeManager.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
WorkOrder workOrder;
|
||||
@@ -112,14 +119,6 @@ public enum ForgeManager implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public static void start() {
|
||||
|
||||
Thread forgeManager;
|
||||
forgeManager = new Thread(FORGE_MANAGER);
|
||||
forgeManager.setName("Forge Manager");
|
||||
forgeManager.start();
|
||||
}
|
||||
|
||||
public static int submit(WorkOrder workOrder) {
|
||||
|
||||
// Must have a city to roll anything
|
||||
|
||||
@@ -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.
|
||||
public static void updateAllGuildTags(Guild guild) {
|
||||
|
||||
|
||||
+95
-2
@@ -841,16 +841,28 @@ public class mbEnums {
|
||||
DRAIN;
|
||||
|
||||
public static DamageType getDamageType(String modName) {
|
||||
|
||||
if (modName.isEmpty())
|
||||
return DamageType.NONE;
|
||||
|
||||
if(modName.toLowerCase().equals("blind"))
|
||||
modName = "BLINDNESS";
|
||||
|
||||
if(modName.toLowerCase().equals("powerblock"))
|
||||
modName = "POWERINHIBITOR";
|
||||
|
||||
DamageType damageType;
|
||||
if (modName.isEmpty())
|
||||
//validity check for not looking up damage type that doesn't exist
|
||||
boolean valid = false;
|
||||
for(DamageType type : DamageType.values()){
|
||||
if(type.name().equals(modName))
|
||||
valid = true;
|
||||
}
|
||||
|
||||
if(!valid)
|
||||
return DamageType.NONE;
|
||||
|
||||
DamageType damageType;
|
||||
|
||||
try {
|
||||
damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
|
||||
} catch (Exception e) {
|
||||
@@ -3022,5 +3034,86 @@ public class mbEnums {
|
||||
PREFIX,
|
||||
SUFFIX;
|
||||
}
|
||||
|
||||
public enum PowerType {
|
||||
None,
|
||||
SPELL,
|
||||
SKILL
|
||||
}
|
||||
|
||||
public enum CostType {
|
||||
NONE,
|
||||
HEALTH,
|
||||
MANA,
|
||||
STAMINA
|
||||
}
|
||||
|
||||
public enum AreaType {
|
||||
NONE,
|
||||
SPHERE,
|
||||
POINTBLANK,
|
||||
LINE,
|
||||
CONE,
|
||||
WALL
|
||||
}
|
||||
|
||||
public enum ExcludeType {
|
||||
NONE,
|
||||
CASTER,
|
||||
GROUP,
|
||||
GUILD,
|
||||
NATION,
|
||||
PLAYERS,
|
||||
ALLBUTGROUP,
|
||||
ALLBUTPETS
|
||||
}
|
||||
|
||||
public enum CastingModeType {
|
||||
NONE,
|
||||
COMBAT,
|
||||
NONCOMBAT,
|
||||
BOTH
|
||||
}
|
||||
|
||||
public enum TargetSelectType {
|
||||
NONE,
|
||||
CLICK,
|
||||
GROUP,
|
||||
GUILD,
|
||||
NEARBYMOBS,
|
||||
NAME
|
||||
}
|
||||
|
||||
public enum CategoryToPowerType {
|
||||
None,
|
||||
GreaterThanOrEqualTo,
|
||||
GreaterThan,
|
||||
Always
|
||||
}
|
||||
|
||||
public enum ModificationType {
|
||||
ADD,
|
||||
MULTIPLY
|
||||
}
|
||||
|
||||
public enum ServerConfig {
|
||||
MBDB_108("AERYNTH", "ARAC", "MOURNING", 300000),
|
||||
MBDB_192("DALGOTH", "ARAC", "GOOK", 300001),
|
||||
MBDB_162("VORGINA", "LORE", "SAEDRON", 300002),
|
||||
MBDB_164("VORGINA", "ARAC", "THURIN", 300002);
|
||||
|
||||
public final String mapType;
|
||||
public final String ruleType;
|
||||
public final String serverName;
|
||||
public final int realmMap;
|
||||
|
||||
ServerConfig(String mapType, String ruleType, String serverName, int realmMap) {
|
||||
|
||||
this.mapType = mapType;
|
||||
this.ruleType = ruleType;
|
||||
this.serverName = serverName;
|
||||
this.realmMap = realmMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,113 +49,100 @@ 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());
|
||||
protectorate.guildState = mbEnums.GuildState.Sovereign;
|
||||
break;
|
||||
}
|
||||
|
||||
guild.downgradeGuildState();
|
||||
|
||||
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
|
||||
|
||||
//Update Map.
|
||||
|
||||
final Session s = SessionManager.getSession(player);
|
||||
|
||||
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) {
|
||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broke fealty from " + toBreak.getName() + '!');
|
||||
}
|
||||
|
||||
ArrayList<PlayerCharacter> breakFealtyMembers = SessionManager.getActivePCsInGuildID(toBreak.getObjectUUID());
|
||||
|
||||
for (PlayerCharacter member : breakFealtyMembers) {
|
||||
ChatManager.chatGuildInfo(member, guild.getName() + " has broken fealty from " + toBreak.getName() + '!');
|
||||
}
|
||||
for (PlayerCharacter member : breakFealtyMembers)
|
||||
ChatManager.chatGuildInfo(member, protectorate.getName() + " has broken fealty from " + nation.getName() + '!');
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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(Guild.getErrantNation());
|
||||
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 +154,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
|
||||
|
||||
@@ -99,7 +99,7 @@ public class DisbandGuildHandler extends AbstractClientMsgHandler {
|
||||
player.setGuildLeader(false);
|
||||
player.setInnerCouncil(false);
|
||||
guild.setGuildLeaderUUID(0);
|
||||
guild.setNation(null);
|
||||
guild.setNation(Guild.getErrantNation());
|
||||
|
||||
DbManager.GuildQueries.DELETE_GUILD(guild);
|
||||
|
||||
|
||||
@@ -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,35 +85,43 @@ 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;
|
||||
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:
|
||||
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;
|
||||
case Petitioner:
|
||||
nation.getSubGuildList().remove(toDismiss);
|
||||
toDismiss.downgradeGuildState();
|
||||
break;
|
||||
case Protectorate:
|
||||
nation.getSubGuildList().remove(toDismiss);
|
||||
toDismiss.downgradeGuildState();
|
||||
break;
|
||||
}
|
||||
|
||||
GuildManager.updateAllGuildTags(toDismiss);
|
||||
|
||||
if (nation.getSubGuildList().isEmpty())
|
||||
nation.downgradeGuildState();
|
||||
boolean isNation = false;
|
||||
|
||||
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);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
|
||||
@@ -36,8 +36,8 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||
|
||||
PlayerCharacter source;
|
||||
PlayerCharacter target;
|
||||
Guild sourceGuild;
|
||||
Guild targetGuild;
|
||||
Guild nation;
|
||||
Guild protectorate;
|
||||
InviteToSubMsg msg = (InviteToSubMsg) baseMsg;
|
||||
Dispatch dispatch;
|
||||
|
||||
@@ -58,17 +58,17 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||
if (target.isIgnoringPlayer(source))
|
||||
return true;
|
||||
|
||||
sourceGuild = source.getGuild();
|
||||
targetGuild = target.getGuild();
|
||||
nation = source.getGuild();
|
||||
protectorate = target.getGuild();
|
||||
|
||||
//source must be in guild
|
||||
|
||||
if (sourceGuild == null) {
|
||||
if (nation == null) {
|
||||
sendChat(source, "You must be in a guild to invite to sub.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sourceGuild.isEmptyGuild()) {
|
||||
if (nation.isEmptyGuild()) {
|
||||
sendChat(source, "You must be in a guild to invite to sub.");
|
||||
return true;
|
||||
}
|
||||
@@ -80,15 +80,15 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sourceGuild.getNation().isEmptyGuild())
|
||||
if (nation.getNation().isEmptyGuild())
|
||||
return true;
|
||||
|
||||
//target must be in a guild
|
||||
|
||||
if (targetGuild == null)
|
||||
if (protectorate == null)
|
||||
return true;
|
||||
|
||||
if (sourceGuild.equals(targetGuild))
|
||||
if (nation.equals(protectorate))
|
||||
return true;
|
||||
|
||||
//target must be GL or IC
|
||||
@@ -98,18 +98,21 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
if (!sourceGuild.canSubAGuild(targetGuild)) {
|
||||
if (!nation.canSubAGuild(protectorate)) {
|
||||
sendChat(source, "This Guild can't be subbed.");
|
||||
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 (source.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
|
||||
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.
|
||||
|
||||
if (target.getClientConnection() != null) {
|
||||
msg.setGuildTag(sourceGuild.getGuildTag());
|
||||
msg.setGuildName(sourceGuild.getName());
|
||||
msg.setGuildUUID(sourceGuild.getObjectUUID());
|
||||
msg.setGuildTag(nation.getGuildTag());
|
||||
msg.setGuildName(nation.getName());
|
||||
msg.setGuildUUID(nation.getObjectUUID());
|
||||
msg.setUnknown02(1);
|
||||
|
||||
dispatch = Dispatch.borrow(target, 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,13 +66,14 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
|
||||
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;
|
||||
}
|
||||
|
||||
if (!Guild.canSwearIn(targetGuild)) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, targetGuild.getGuildState().name() + "cannot be sworn in");
|
||||
if (protectorate.guildState.equals(GuildState.Petitioner) == false) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Guild is not a petitioner!");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,29 +82,30 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
|
||||
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;
|
||||
}
|
||||
// update Guild state.
|
||||
// R8 is a province
|
||||
|
||||
//update Guild state.
|
||||
targetGuild.setNation(nation);
|
||||
GuildManager.updateAllGuildTags(targetGuild);
|
||||
targetGuild.upgradeGuildState(false);
|
||||
if (protectorate.getNation().isEmptyGuild())
|
||||
protectorate.guildState = GuildState.Sworn;
|
||||
else
|
||||
protectorate.guildState = (protectorate.getOwnedCity().getTOL().getRank() == 8)
|
||||
? GuildState.Province
|
||||
: GuildState.Protectorate;
|
||||
|
||||
if (nation.getGuildState() == GuildState.Sovereign)
|
||||
nation.upgradeGuildState(true);
|
||||
protectorate.setNation(nation);
|
||||
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);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
@@ -113,15 +115,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,13 +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))
|
||||
siegeResult = SiegeResult.DESTROY;
|
||||
else
|
||||
if (bane.getOwner().getGuild().guildState == GuildState.Sworn)
|
||||
siegeResult = SiegeResult.CAPTURE;
|
||||
else
|
||||
siegeResult = SiegeResult.DESTROY;
|
||||
|
||||
// Remove realm if city had one
|
||||
|
||||
@@ -959,7 +956,7 @@ public class Building extends AbstractWorldObject {
|
||||
// Altitude of this building is derived from the heightmap engine.
|
||||
|
||||
Vector3fImmutable tempLoc = new Vector3fImmutable(this.statLat + this.parentZone.absX, 0, this.statLon + this.parentZone.absZ);
|
||||
tempLoc = new Vector3fImmutable(tempLoc.x, Terrain.getWorldHeight(tempLoc), tempLoc.z);
|
||||
tempLoc = new Vector3fImmutable(tempLoc.x, Terrain.getWorldHeight(tempLoc) + this.statAlt, tempLoc.z);
|
||||
this.setLoc(tempLoc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+16
-128
@@ -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,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) {
|
||||
|
||||
boolean canSub;
|
||||
|
||||
if (this.equals(toSub))
|
||||
return false;
|
||||
switch (this.guildState) {
|
||||
case Nation:
|
||||
case Sovereign:
|
||||
canSub = true;
|
||||
break;
|
||||
default:
|
||||
canSub = false;
|
||||
}
|
||||
|
||||
switch (toSub.guildState) {
|
||||
case Errant:
|
||||
case Sovereign:
|
||||
canSub = true;
|
||||
break;
|
||||
default:
|
||||
canSub = false;
|
||||
}
|
||||
City nationCap = City.getCity(nation.cityUUID);
|
||||
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
||||
canSub = false;
|
||||
}
|
||||
return canSub;
|
||||
boolean validNation = (this.guildState == GuildState.Nation || this.guildState == GuildState.Sovereign);
|
||||
boolean validProtectorate = (toSub.guildState == GuildState.Errant || toSub.guildState == GuildState.Sovereign);
|
||||
|
||||
return validNation && validProtectorate;
|
||||
}
|
||||
|
||||
public int getRealmsOwnedFlag() {
|
||||
@@ -834,18 +739,9 @@ public class Guild extends AbstractWorldObject {
|
||||
Logger.error("FAILED TO LOAD SUB GUILDS FOR UUID " + this.getObjectUUID());
|
||||
}
|
||||
|
||||
if (this.nation == this && subGuildList.size() > 0)
|
||||
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;
|
||||
this.guildState = GuildManager.calcuateGuildState(this);
|
||||
|
||||
if (this.cityUUID == 0)
|
||||
if (this.getOwnedCity() == null)
|
||||
return;
|
||||
|
||||
// Calculate number of realms this guild controls
|
||||
@@ -901,14 +797,6 @@ public class Guild extends AbstractWorldObject {
|
||||
return motto;
|
||||
}
|
||||
|
||||
public GuildState getGuildState() {
|
||||
return guildState;
|
||||
}
|
||||
|
||||
public void setGuildState(GuildState guildState) {
|
||||
this.guildState = guildState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the realmsOwned
|
||||
*/
|
||||
@@ -930,18 +818,18 @@ public class Guild extends AbstractWorldObject {
|
||||
if (!DbManager.GuildQueries.UPDATE_PARENT(subGuild.getObjectUUID(), WorldServer.worldUUID))
|
||||
Logger.debug("Failed to set Nation Guild for Guild with UID " + subGuild.getObjectUUID());
|
||||
|
||||
// Guild without any subs is no longer a nation
|
||||
|
||||
if (subGuild.getOwnedCity() == null) {
|
||||
subGuild.nation = null;
|
||||
} else {
|
||||
switch (subGuild.guildState) {
|
||||
case Sworn:
|
||||
subGuild.guildState = GuildState.Errant;
|
||||
subGuild.nation = Guild.getErrantNation();
|
||||
break;
|
||||
case Protectorate:
|
||||
case Petitioner:
|
||||
subGuild.nation = subGuild;
|
||||
subGuild.guildState = GuildState.Sovereign;
|
||||
break;
|
||||
}
|
||||
|
||||
// Downgrade guild
|
||||
|
||||
subGuild.downgradeGuildState();
|
||||
|
||||
// Remove from collection
|
||||
|
||||
subGuildList.remove(subGuild);
|
||||
|
||||
@@ -512,29 +512,6 @@ public class NPC extends AbstractCharacter {
|
||||
return MinionType.ContractToMinionMap.containsKey(contractID);
|
||||
}
|
||||
|
||||
public static boolean UpdateEquipSetID(NPC npc, int equipSetID) {
|
||||
|
||||
if (!LootManager._bootySetMap.containsKey(equipSetID))
|
||||
return false;
|
||||
|
||||
if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID))
|
||||
return false;
|
||||
|
||||
npc.equipmentSetID = equipSetID;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean UpdateRaceID(NPC npc, int raceID) {
|
||||
|
||||
if (!DbManager.NPCQueries.UPDATE_MOBBASE(npc, raceID))
|
||||
return false;
|
||||
|
||||
npc.loadID = raceID;
|
||||
npc.mobBase = MobBase.getMobBase(npc.loadID);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static NPCProfits GetNPCProfits(NPC npc) {
|
||||
return NPCProfits.ProfitCache.get(npc.currentID);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ public class DestroyCityThread implements Runnable {
|
||||
|
||||
//Successful Update of guild
|
||||
|
||||
formerGuild.setGuildState(mbEnums.GuildState.Errant);
|
||||
formerGuild.setNation(null);
|
||||
formerGuild.guildState = mbEnums.GuildState.Errant;
|
||||
formerGuild.setNation(Guild.getErrantNation());
|
||||
formerGuild.setCityUUID(0);
|
||||
GuildManager.updateAllGuildTags(formerGuild);
|
||||
GuildManager.updateAllGuildBinds(formerGuild, null);
|
||||
|
||||
@@ -50,8 +50,8 @@ public class TransferCityThread implements Runnable {
|
||||
|
||||
if (formerGuild != null)
|
||||
if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) {
|
||||
formerGuild.setGuildState(mbEnums.GuildState.Errant);
|
||||
formerGuild.setNation(null);
|
||||
formerGuild.guildState = mbEnums.GuildState.Errant;
|
||||
formerGuild.setNation(Guild.getErrantNation());
|
||||
formerGuild.setCityUUID(0);
|
||||
GuildManager.updateAllGuildTags(formerGuild);
|
||||
GuildManager.updateAllGuildBinds(formerGuild, null);
|
||||
@@ -63,14 +63,12 @@ public class TransferCityThread implements Runnable {
|
||||
|
||||
subGuildList = new ArrayList<>();
|
||||
|
||||
for (Guild subGuild : formerGuild.getSubGuildList()) {
|
||||
for (Guild subGuild : formerGuild.getSubGuildList())
|
||||
subGuildList.add(subGuild);
|
||||
}
|
||||
|
||||
for (Guild subGuild : subGuildList) {
|
||||
for (Guild subGuild : subGuildList)
|
||||
formerGuild.removeSubGuild(subGuild);
|
||||
}
|
||||
}
|
||||
|
||||
//Reset TOL to rank 1
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import engine.mbEnums;
|
||||
import engine.wpak.data.ConditionEntry;
|
||||
import engine.wpak.data.Effect;
|
||||
import engine.wpak.data.ModifierEntry;
|
||||
import engine.wpakpowers.WpakPowerManager;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -56,7 +55,7 @@ public class EffectsParser {
|
||||
while (matcher.find()) {
|
||||
try {
|
||||
Effect effect = parseEffectEntry(matcher.group());
|
||||
WpakPowerManager._effectsLookup.put(effect.effect_id, effect);
|
||||
// WpakPowerManager._effectsLookup.put(effect.effect_id, effect);
|
||||
} catch (Exception e) {
|
||||
Logger.error("EFFECT PARSE FAILED: " + e);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,10 @@ package engine.wpak;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mbEnums;
|
||||
import engine.util.Hasher;
|
||||
import engine.wpak.data.Effect;
|
||||
import engine.wpak.data.PowerAction;
|
||||
import engine.wpak.data.StatTransfer;
|
||||
import engine.wpak.data.TrackEntry;
|
||||
import engine.wpakpowers.WpakPowerManager;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -54,7 +52,7 @@ public class PowerActionParser {
|
||||
while (matcher.find()) {
|
||||
|
||||
PowerAction powerAction = parsePowerActionEntry(matcher.group().trim());
|
||||
WpakPowerManager._powerActionLookup.put(Hasher.SBStringHash(powerAction.action_id), powerAction);
|
||||
// WpakPowerManager._powerActionLookup.put(Hasher.SBStringHash(powerAction.action_id), powerAction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,7 @@ package engine.wpak;
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.mbEnums;
|
||||
import engine.util.Hasher;
|
||||
import engine.wpak.data.*;
|
||||
import engine.wpakpowers.WpakPowerManager;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -52,7 +50,7 @@ public class PowersParser {
|
||||
while (matcher.find()) {
|
||||
|
||||
Power power = parsePowerEntry(matcher.group().trim());
|
||||
WpakPowerManager._powersLookup.put(Hasher.SBStringHash(power.power_id), power);
|
||||
// @TODO WpakPowerManager._powersLookup.put(Hasher.SBStringHash(power.power_id), power);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user