Refactor warehouse part two.
This commit is contained in:
@@ -1317,7 +1317,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
Blueprint blueprint;
|
||||
Building newMesh = null;
|
||||
ArrayList<AbstractGameObject> warehouseObjects;
|
||||
Building warehouseBuilding;
|
||||
|
||||
blueprint = Blueprint.getBlueprint(buildingInfo.getBlueprintUUID());
|
||||
|
||||
@@ -1331,38 +1331,30 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
float buildingRotation = buildingInfo.getRot().y;
|
||||
float vendorRotation = buildingInfo.getW();
|
||||
|
||||
warehouseObjects = DbManager.WarehouseQueries.CREATE_WAREHOUSE(
|
||||
City city = City.getCity(currentZone.playerCityUUID);
|
||||
|
||||
warehouseBuilding = DbManager.BuildingQueries.CREATE_BUILDING(
|
||||
currentZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getMeshForRank(0),
|
||||
localLoc, 1.0f, blueprint.getMaxHealth(0), ProtectionState.NONE, 0, 0,
|
||||
DateTime.now().plusHours(blueprint.getRankTime(1)), blueprint.getMeshForRank(0), vendorRotation, buildingRotation);
|
||||
|
||||
if (warehouseObjects == null) {
|
||||
if (warehouseBuilding == null) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load the building into the simulation
|
||||
|
||||
for (AbstractGameObject ago : warehouseObjects) {
|
||||
warehouseBuilding.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
MaintenanceManager.setMaintDateTime(warehouseBuilding, LocalDateTime.now().plusDays(7));
|
||||
warehouseBuilding.setLoc(warehouseBuilding.getLoc());
|
||||
InterestManager.setObjectDirty(warehouseBuilding);
|
||||
warehouseBuilding.runAfterLoad();
|
||||
|
||||
if (ago.getObjectType() == GameObjectType.Building) {
|
||||
newMesh = (Building) ago;
|
||||
newMesh.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
MaintenanceManager.setMaintDateTime(newMesh, LocalDateTime.now().plusDays(7));
|
||||
newMesh.setLoc(newMesh.getLoc());
|
||||
InterestManager.setObjectDirty(newMesh);
|
||||
newMesh.runAfterLoad();
|
||||
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
||||
Warehouse warehouse = (Warehouse) ago;
|
||||
City city = City.getCity(currentZone.playerCityUUID);
|
||||
if (city == null)
|
||||
return true;
|
||||
|
||||
if (city == null)
|
||||
return true;
|
||||
|
||||
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
||||
Warehouse.warehouseByBuildingUUID.put(newMesh.getObjectUUID(), warehouse);
|
||||
}
|
||||
}
|
||||
city.setWarehouseBuildingID(newMesh.getObjectUUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user