Browse Source

Should not be sending messages to players here.

master
MagicBot 2 years ago
parent
commit
af38dd8fb9
  1. 66
      src/engine/objects/Mine.java

66
src/engine/objects/Mine.java

@ -384,75 +384,57 @@ try{
Logger.info(this.zoneName + "'s Mine is now Active!"); Logger.info(this.zoneName + "'s Mine is now Active!");
} }
public static boolean validClaimer(PlayerCharacter pc) { public static boolean validClaimer(PlayerCharacter playerCharacter) {
Guild playerGuild;
//verify the player exists //verify the player exists
if (pc == null)
if (playerCharacter == null)
return false; return false;
//verify the player is in valid guild //verify the player is in valid guild
Guild g = pc.getGuild();
if (g == null) {
ChatManager.chatSystemError(pc, "Mine can only be claimed by a guild.");
return false;
} else if (g.isErrant()) {
ChatManager.chatSystemError(pc, "Guild cannot be Errant to claim..");
return false;
}
//verify the player is in nation playerGuild = playerCharacter.getGuild();
Guild n = g.getNation();
if (n.isErrant()) { if (playerGuild.isErrant())
ChatManager.chatSystemError(pc, "Must have a Nation");
return false; return false;
}
if (SessionManager.getPlayerCharacterByID(playerCharacter.getObjectUUID()) == null)
if (SessionManager.getPlayerCharacterByID(pc.getObjectUUID()) == null){
return false; return false;
}
//Get a count of nation mines, can't go over capital tol rank. //Get a count of nation mines, can't go over capital tol rank.
City capital = n.getOwnedCity(); City capital = playerGuild.getOwnedCity();
City guildCity = g.getOwnedCity(); City guildCity = playerGuild.getOwnedCity();
if (guildCity == null){
ChatManager.chatSystemError(pc, "Guild must own city to claim."); if (guildCity == null)
return false; return false;
}
if (capital == null) { if (capital == null)
ChatManager.chatSystemError(pc, "Guild must own city to claim.");
return false; return false;
}
if (guildCity.getWarehouse() == null){ if (guildCity.getWarehouse() == null)
ChatManager.chatSystemError(pc, "City must own warehouse for to claim.");
return false; return false;
}
Building tol = capital.getTOL(); Building tol = capital.getTOL();
if (tol == null) { if (tol == null)
ChatManager.chatSystemError(pc, "Tree of life not found for city.");
return false; return false;
}
int rank = tol.getRank(); int rank = tol.getRank();
if (rank < 1) { if (rank < 1)
ChatManager.chatSystemError(pc, "Tree of life is not yet sprouted.");
return false; return false;
}
int mineCnt = 0; int mineCnt = 0;
mineCnt += Mine.getMinesForGuild(n.getObjectUUID()).size(); mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size();
for (Guild guild: n.getSubGuildList()){
mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
}
for (Guild guild: playerGuild.getSubGuildList())
mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
if (mineCnt > rank) { if (mineCnt > rank)
ChatManager.chatSystemError(pc, "Your Nation can only hold " + tol.getRank() + " mines. Your Nation already has" + mineCnt);
return false; return false;
}
return true; return true;
} }

Loading…
Cancel
Save