|
|
@ -104,67 +104,67 @@ public enum BuildingManager { |
|
|
|
if (building == null) |
|
|
|
if (building == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//cannot access destroyed buildings
|
|
|
|
if (building.getRank() == -1) |
|
|
|
if (building.getRank() == -1) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (IsOwner(building, player)) |
|
|
|
//admin characters can always access buildings
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//individual friend.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Admins can access stuff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player.isCSR()) |
|
|
|
if (player.isCSR()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
//Guild stuff
|
|
|
|
//owner can always access their own building
|
|
|
|
|
|
|
|
if (IsOwner(building, player)) |
|
|
|
if (building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8) |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
//check for default IC access if building belongs to same guild
|
|
|
|
|
|
|
|
if(player.guild.equals(building.getGuild())) { |
|
|
|
|
|
|
|
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null) { |
|
|
|
|
|
|
|
switch (building.getBlueprint().getBuildingGroup()) { |
|
|
|
|
|
|
|
case TOL: |
|
|
|
|
|
|
|
case BARRACK: |
|
|
|
|
|
|
|
case SPIRE: |
|
|
|
|
|
|
|
case SHRINE: |
|
|
|
|
|
|
|
case BANESTONE: |
|
|
|
|
|
|
|
case MINE: |
|
|
|
|
|
|
|
case WAREHOUSE: |
|
|
|
|
|
|
|
case BULWARK: |
|
|
|
|
|
|
|
case SIEGETENT: |
|
|
|
|
|
|
|
if (GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus())) |
|
|
|
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
break; |
|
|
|
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//TODO test friends list once added
|
|
|
|
|
|
|
|
//does not meet above criteria. Cannot access.
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean playerCanManageNotFriends(PlayerCharacter player, Building building) { |
|
|
|
//check against friends list entries if any present
|
|
|
|
|
|
|
|
if (building.getFriends() != null) { |
|
|
|
//Player Can only Control Building if player is in Same Guild as Building and is higher rank than IC.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player == null) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building == null) |
|
|
|
//check individuals
|
|
|
|
return false; |
|
|
|
if (building.getFriends().get(player.getObjectUUID()) != null) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (building.getRank() == -1) |
|
|
|
if (building.getFriends().get(player.guild.objectUUID) != null) { |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IsOwner(building, player)) |
|
|
|
//check friend type for guild related access
|
|
|
|
|
|
|
|
switch (building.getFriends().get(player.guild.objectUUID).friendType) { |
|
|
|
|
|
|
|
case 8: //full member
|
|
|
|
|
|
|
|
if (GuildStatusController.isFullMember(player.getGuildStatus())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
break; |
|
|
|
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
|
|
|
case 9: //Inner Council
|
|
|
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
if (GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus())) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//did not meet access grant criteria, deny access
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) { |
|
|
|
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) { |
|
|
|