|
|
@ -18,7 +18,6 @@ import engine.job.JobContainer; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.jobs.UpgradeBuildingJob; |
|
|
|
import engine.jobs.UpgradeBuildingJob; |
|
|
|
import engine.math.Bounds; |
|
|
|
import engine.math.Bounds; |
|
|
|
import engine.math.Vector2f; |
|
|
|
|
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.net.client.ClientConnection; |
|
|
|
import engine.net.client.ClientConnection; |
|
|
|
import engine.net.client.msg.ErrorPopupMsg; |
|
|
|
import engine.net.client.msg.ErrorPopupMsg; |
|
|
@ -27,9 +26,7 @@ import engine.net.client.msg.PlaceAssetMsg; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.w3c.dom.css.Rect; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -110,7 +107,6 @@ public enum BuildingManager { |
|
|
|
if (building == null) |
|
|
|
if (building == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.getRank() == -1) |
|
|
|
if (building.getRank() == -1) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
@ -121,22 +117,21 @@ public enum BuildingManager { |
|
|
|
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null) |
|
|
|
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
//Admin's can access stuff
|
|
|
|
//Admins can access stuff
|
|
|
|
|
|
|
|
|
|
|
|
if (player.isCSR()) |
|
|
|
if (player.isCSR()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
//Guild stuff
|
|
|
|
//Guild stuff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends() != null && building.getFriends().get(player.getGuild().getObjectUUID()) != null |
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null |
|
|
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8) |
|
|
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends() != null && building.getFriends().get(player.getGuild().getObjectUUID()) != null |
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null |
|
|
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 |
|
|
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 |
|
|
|
&& GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
&& GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -948,22 +943,20 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
building.isDeranking.compareAndSet(true, false); |
|
|
|
building.isDeranking.compareAndSet(true, false); |
|
|
|
} |
|
|
|
} |
|
|
|
public static Building getBuildingAtLocation(Vector3fImmutable loc){ |
|
|
|
|
|
|
|
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc,64,MBServerStatics.MASK_BUILDING)){ |
|
|
|
public static Building getBuildingAtLocation(Vector3fImmutable loc) { |
|
|
|
Building building = (Building)awo; |
|
|
|
|
|
|
|
if(building == null) |
|
|
|
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(loc, 64, MBServerStatics.MASK_BUILDING)) { |
|
|
|
|
|
|
|
Building building = (Building) awo; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (building == null) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
float minX = building.loc.x - building.getBounds().getHalfExtents().x; |
|
|
|
|
|
|
|
float maxX = building.loc.x + building.getBounds().getHalfExtents().x; |
|
|
|
if (Bounds.collide(loc, building)) |
|
|
|
float minZ = building.loc.z - building.getBounds().getHalfExtents().y; |
|
|
|
|
|
|
|
float maxZ = building.loc.z + building.getBounds().getHalfExtents().y; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean meetsX = loc.x > minX && loc.x < maxX; |
|
|
|
|
|
|
|
boolean meetsY = loc.z > minZ && loc.z < maxZ; |
|
|
|
|
|
|
|
if(meetsX && meetsY) |
|
|
|
|
|
|
|
return building; |
|
|
|
return building; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|