|
|
|
@ -17,9 +17,8 @@ import engine.mbEnums.BuildingGroup; |
|
|
|
import engine.net.client.ClientConnection; |
|
|
|
import engine.net.client.ClientConnection; |
|
|
|
import engine.net.client.msg.ClaimAssetMsg; |
|
|
|
import engine.net.client.msg.ClaimAssetMsg; |
|
|
|
import engine.net.client.msg.ClientNetMsg; |
|
|
|
import engine.net.client.msg.ClientNetMsg; |
|
|
|
import engine.objects.Blueprint; |
|
|
|
import engine.net.client.msg.ErrorPopupMsg; |
|
|
|
import engine.objects.Building; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.PlayerCharacter; |
|
|
|
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock; |
|
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock; |
|
|
|
@ -111,9 +110,9 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler { |
|
|
|
// Can't claim a tree if your guild already owns one
|
|
|
|
// Can't claim a tree if your guild already owns one
|
|
|
|
// *** Refactor : Send error to player here
|
|
|
|
// *** Refactor : Send error to player here
|
|
|
|
|
|
|
|
|
|
|
|
if ((sourcePlayer.getGuild().isNation()) && |
|
|
|
if(blueprint.getBuildingGroup() == BuildingGroup.TOL && !validateTreeClaim(sourcePlayer)){ |
|
|
|
(blueprint.getBuildingGroup() == BuildingGroup.TOL)) |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Process the transfer of the building(s)
|
|
|
|
// Process the transfer of the building(s)
|
|
|
|
|
|
|
|
|
|
|
|
@ -135,4 +134,24 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean validateTreeClaim(PlayerCharacter sourcePlayer) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(sourcePlayer.guild.equals(Guild.getErrantGuild())) { |
|
|
|
|
|
|
|
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Errant Players Cannot Claim Cities!"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(sourcePlayer.guild.getOwnedCity() != null) { |
|
|
|
|
|
|
|
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Your Guild Already Owns A City!"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus())) { |
|
|
|
|
|
|
|
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Only A Guild Leader Can Claim A Tree Of Life!"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |