From b4a43239067c330df4195ce1734b88ff7e26cc23 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 13 Sep 2023 09:24:40 -0400 Subject: [PATCH] Minor formatting cleanup. --- .../client/handlers/PlaceAssetMsgHandler.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index e38d44b3..a3f2b30c 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -768,7 +768,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { treeObject = (Building) cityObjectMap.get(GameObjectType.Building); treeObject.runAfterLoad(); - ; + cityObject = (City) cityObjectMap.get(GameObjectType.City); zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone); @@ -819,7 +819,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { City.lastCityUpdate = System.currentTimeMillis(); treeObject.setLoc(treeObject.getLoc()); InterestManager.setObjectDirty(treeObject); -// WorldGrid.addObject(treeObject, playerCharacter); serverRealm.addCity(cityObject.getObjectUUID()); playerNation.setCityUUID(cityObject.getObjectUUID()); @@ -917,6 +916,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Early exit if something went horribly wrong // with locating the current realm and/or zone + if (serverZone == null) return false; @@ -979,7 +979,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { City cityObject; PlacementInfo buildingList; - // Setup working variables we'll need + // Setup working variables + buildingList = msg.getFirstPlacementInfo(); serverZone = ZoneManager.findSmallestZone(buildingList.getLoc()); @@ -1092,7 +1093,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { placementCost = 0; // reset placement cost for fix bug with wall pieces somethings not taking gold out if forced an error. - // Overlap check and wall deed verifications for (PlacementInfo wall : walls) { @@ -1111,7 +1111,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { for (Building building : serverZone.zoneBuildingSet) { - //TODO Clean up collision with placementInfo. don't need to create the same placementinfo bounds for collision checks on each building. if ((building.getBlueprintUUID() != 0) && (Bounds.collide(wall, building) == true)) { @@ -1131,12 +1130,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { return false; } } + placementCost = PlaceAssetMsg.getWallCost(wall.getBlueprintUUID()); if (!itemMan.modifyInventoryGold(-placementCost)) { ChatManager.chatSystemInfo(player, player.getFirstName() + " can't has free moneys! no for real.. Thor.. seriously... I didnt fix it because you getting laid isnt important enough for me."); return false; } + // Attempt to place wall piece wallPiece = createStructure(player, wall, serverZone); @@ -1147,14 +1148,12 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { } // walls are auto protected + wallPiece.setProtectionState(ProtectionState.PROTECTED); PlaceAssetMsg.sendPlaceAssetConfirmWall(origin, serverZone); } - // Deduct gold from character's inventory - - return true; } @@ -1174,6 +1173,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { } // All siege buildings build in 15 minutes + if ((blueprint.getBuildingGroup().equals(BuildingGroup.SIEGETENT)) || (blueprint.getBuildingGroup().equals(BuildingGroup.BULWARK))) completionDate = DateTime.now().plusMinutes(15); @@ -1193,6 +1193,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { completionDate, blueprint.getMeshForRank(0), vendorRotation, buildingRotation); // Make sure we have a valid mesh + if (newMesh == null) { Logger.error("CreateStructure: DB returned null object."); return null; @@ -1364,15 +1365,16 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { newMesh = (Building) ago; newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING); MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7)); - // WorldGrid.addObject(newMesh, player); newMesh.setLoc(newMesh.getLoc()); InterestManager.setObjectDirty(newMesh); newMesh.runAfterLoad(); } else if (ago.getObjectType() == GameObjectType.Warehouse) { Warehouse warehouse = (Warehouse) ago; City city = City.getCity(currentZone.getPlayerCityUUID()); + if (city == null) return true; + city.setWarehouseBuildingID(newMesh.getObjectUUID()); Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse); }