forked from MagicBane/Server
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c5facaefc | |||
| ce8dc09a95 | |||
| dce3822d43 | |||
| f4ceab41dd | |||
| bd370097ab | |||
| cbb3fd0b24 | |||
| 944269b78e | |||
| 530747ed75 | |||
| 6d8866f019 | |||
| d52bef8252 | |||
| 3cf6bba0f4 | |||
| acc253aa4d | |||
| fea1c2f06a | |||
| 250e3407fa | |||
| fcd37cbae2 | |||
| 70e76d9a1a | |||
| 6a3bd89095 | |||
| 4ccf03dfd3 | |||
| f845c0ad80 | |||
| 165752f6d6 | |||
| c0ee8b82f8 | |||
| cc1e0d8986 | |||
| 7f6fbd2bff | |||
| 92d8ed9e3f | |||
| 45b2443982 | |||
| 3775fb336b | |||
| f7a8ca33fc | |||
| c45265b085 | |||
| 79400b6b0e | |||
| 2bff826a10 | |||
| d5fc87c233 | |||
| 78a0416b19 |
@@ -34,16 +34,19 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
case "zone":
|
||||
Zone zone = new Zone(rs);
|
||||
DbManager.addToCache(zone);
|
||||
zone.runAfterLoad();
|
||||
list.add(zone);
|
||||
break;
|
||||
case "building":
|
||||
Building building = new Building(rs);
|
||||
DbManager.addToCache(building);
|
||||
building.runAfterLoad();
|
||||
list.add(building);
|
||||
break;
|
||||
case "city":
|
||||
City city = new City(rs);
|
||||
DbManager.addToCache(city);
|
||||
city.runAfterLoad();
|
||||
list.add(city);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setLong(1, locks);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -125,7 +125,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -189,7 +189,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -205,7 +205,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -221,7 +221,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -237,7 +237,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -253,7 +253,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -269,7 +269,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -285,7 +285,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -301,7 +301,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -317,7 +317,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -333,7 +333,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -349,7 +349,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -365,7 +365,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -381,7 +381,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -397,7 +397,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -413,7 +413,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -429,7 +429,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -445,7 +445,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -461,7 +461,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -477,7 +477,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, amount);
|
||||
preparedStatement.setInt(2, wh.getUID());
|
||||
preparedStatement.setInt(2, wh.UID);
|
||||
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
|
||||
@@ -545,7 +545,7 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
||||
while (rs.next()) {
|
||||
warehouse = new Warehouse(rs);
|
||||
warehouse.runAfterLoad();
|
||||
warehouse.loadAllTransactions();
|
||||
Warehouse.loadAllTransactions(warehouse);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -10,18 +10,15 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Zone;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class AddMobCmd extends AbstractDevCmd {
|
||||
|
||||
public AddMobCmd() {
|
||||
@@ -38,27 +35,8 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
if (words[0].equals("all")) {
|
||||
|
||||
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
|
||||
MobBase mb = (MobBase) mobbaseAGO;
|
||||
int loadID = mb.getObjectUUID();
|
||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
this.setResult(String.valueOf(mob.getDBID()));
|
||||
} else {
|
||||
throwbackError(pc, "Failed to create mob of type " + loadID);
|
||||
Logger.error("Failed to create mob of type "
|
||||
+ loadID);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int loadID;
|
||||
|
||||
try {
|
||||
loadID = Integer.parseInt(words[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -72,7 +50,6 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
return; // NaN
|
||||
}
|
||||
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pc, "Failed to find zone to place mob in.");
|
||||
return;
|
||||
@@ -83,9 +60,9 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
ChatManager.chatSayInfo(pc,
|
||||
|
||||
@@ -220,16 +220,16 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
|
||||
// List hirelings
|
||||
|
||||
if (targetBuilding.getHirelings().isEmpty() == false) {
|
||||
if (targetBuilding.hirelings.isEmpty() == false) {
|
||||
|
||||
output += newline;
|
||||
output += "Hirelings List: name / slot / floor";
|
||||
|
||||
for (AbstractCharacter npc : targetBuilding.getHirelings().keySet()) {
|
||||
for (AbstractCharacter npc : targetBuilding.hirelings) {
|
||||
|
||||
if (npc.getObjectType() != GameObjectType.NPC)
|
||||
continue;
|
||||
output += newline + npc.getName() + " slot " + targetBuilding.getHirelings().get(npc);
|
||||
output += newline + npc.getName() + " slot " + targetBuilding.hirelings.indexOf(npc);
|
||||
output += newline + "location " + npc.getLoc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
for (Building building : zone.zoneBuildingSet) {
|
||||
if (!BuildingManager.IsWallPiece(building))
|
||||
continue;
|
||||
for (AbstractCharacter ac : building.getHirelings().keySet()) {
|
||||
for (AbstractCharacter ac : building.hirelings) {
|
||||
NPC npc = null;
|
||||
Mob mobA = null;
|
||||
|
||||
@@ -143,7 +143,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE))
|
||||
building.disableSpire(false);
|
||||
|
||||
for (AbstractCharacter ac : building.getHirelings().keySet()) {
|
||||
for (AbstractCharacter ac : building.hirelings) {
|
||||
NPC npc = null;
|
||||
Mob mobA = null;
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
|
||||
// Remove hirelings for this building
|
||||
|
||||
for (AbstractCharacter abstractCharacter : building.getHirelings().keySet())
|
||||
for (AbstractCharacter abstractCharacter : building.hirelings)
|
||||
BuildingManager.removeHireling(building, abstractCharacter);
|
||||
|
||||
Zone zone = building.getParentZone();
|
||||
@@ -173,7 +173,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
// Remove npc from hirelings list.
|
||||
|
||||
if (npc.building != null)
|
||||
npc.building.getHirelings().remove(npc);
|
||||
npc.building.hirelings.remove(npc);
|
||||
|
||||
for (Integer minionUUID : npc.minions) {
|
||||
Mob minionMob = Mob.getMob(minionUUID);
|
||||
@@ -210,7 +210,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
// Remove npc from hirelings list.
|
||||
|
||||
if (mob.building != null)
|
||||
mob.building.getHirelings().remove(mob);
|
||||
mob.building.hirelings.remove(mob);
|
||||
|
||||
mob.setLoc(Vector3fImmutable.ZERO); //Move it off the plane..
|
||||
mob.setBindLoc(Vector3fImmutable.ZERO); //Reset the bind loc..
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SlotTestCmd extends AbstractDevCmd {
|
||||
|
||||
int slot = Integer.parseInt(args[0]);
|
||||
Vector3fImmutable slotLocation;
|
||||
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot - 1);
|
||||
BuildingLocation buildingLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
|
||||
slotLocation = building.getLoc().add(buildingLocation.getLocation());
|
||||
slotLocation = Vector3fImmutable.rotateAroundPoint(building.getLoc(), slotLocation, building.getBounds().getQuaternion().angleY);
|
||||
playerCharacter.teleport(slotLocation);
|
||||
@@ -61,17 +61,17 @@ public class SlotTestCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
for (BuildingLocation buildingLocation : BuildingManager._slotLocations.get(building.meshUUID))
|
||||
outString += buildingLocation.getSlot() + buildingLocation.getLocation().toString() + "\r\n";
|
||||
outString += buildingLocation.getSlot() - 1 + buildingLocation.getLocation().toString() + "\r\n";
|
||||
|
||||
outString += "\r\nNext Available Slot: " + BuildingManager.getAvailableSlot(building);
|
||||
|
||||
if (building.getHirelings().isEmpty() == false) {
|
||||
if (building.hirelings.isEmpty() == false) {
|
||||
|
||||
outString += "\r\n\r\n";
|
||||
outString += "Hirelings List:";
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
||||
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
|
||||
for (AbstractCharacter hireling : building.hirelings)
|
||||
outString += "\r\n" + hireling.getName() + " slot : " + building.hirelings.indexOf(hireling);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,7 @@ import engine.job.JobScheduler;
|
||||
import engine.jobs.UpgradeBuildingJob;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.ManageCityAssetsMsg;
|
||||
import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -56,12 +53,14 @@ public enum BuildingManager {
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
|
||||
for (int i = 1; i <= numOfSlots; i++) {
|
||||
if (building.hirelings.isEmpty())
|
||||
return 0;
|
||||
|
||||
if (building.hirelings.size() == numOfSlots)
|
||||
return -1;
|
||||
|
||||
return building.hirelings.size();
|
||||
|
||||
if (!building.getHirelings().containsValue(i))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getLastAvailableSlot(Building building) {
|
||||
@@ -76,12 +75,13 @@ public enum BuildingManager {
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
|
||||
for (int i = numOfSlots; i > 0; i--) {
|
||||
if (building.hirelings.isEmpty())
|
||||
return numOfSlots - 1;
|
||||
|
||||
if (!building.getHirelings().containsValue(i))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
if (building.hirelings.size() == numOfSlots)
|
||||
return -1;
|
||||
|
||||
return numOfSlots - 1;
|
||||
}
|
||||
|
||||
public static BuildingLocation getSlotLocation(Building building, int slot) {
|
||||
@@ -91,7 +91,7 @@ public enum BuildingManager {
|
||||
if (slot == -1)
|
||||
return buildingLocation;
|
||||
|
||||
buildingLocation = _slotLocations.get(building.meshUUID).get(slot - 1); // array index
|
||||
buildingLocation = _slotLocations.get(building.meshUUID).get(slot); // array index
|
||||
|
||||
if (buildingLocation == null) {
|
||||
Logger.error("Invalid slot for building: " + building.getObjectUUID());
|
||||
@@ -100,6 +100,20 @@ public enum BuildingManager {
|
||||
return buildingLocation;
|
||||
}
|
||||
|
||||
public static void updateHirelingSlots(Building building) {
|
||||
|
||||
// Method updates all hirelings with the slot locations
|
||||
// for the current mesh. The position and region can change
|
||||
// such as when upgrading a TOL to R8.
|
||||
|
||||
for (AbstractCharacter hireling : building.hirelings) {
|
||||
|
||||
hireling.setLoc(getSlotLocation(building, building.hirelings.indexOf(hireling)).getLocation());
|
||||
InterestManager.setObjectDirty(hireling);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean playerCanManage(PlayerCharacter player, Building building) {
|
||||
|
||||
if (player == null)
|
||||
@@ -234,15 +248,15 @@ public enum BuildingManager {
|
||||
ChatManager.chatSystemInfo(player, "You can not carry any more of that item.");
|
||||
return false;
|
||||
}
|
||||
if (warehouse.getResources().get(resourceBase) == null)
|
||||
if (warehouse.resources.get(resourceBase) == null)
|
||||
continue;
|
||||
|
||||
int resourceAmount = warehouse.getResources().get(resourceBase);
|
||||
int resourceAmount = warehouse.resources.get(resourceBase);
|
||||
|
||||
if (resourceAmount <= 0)
|
||||
continue;
|
||||
|
||||
if (warehouse.loot(player, resourceBase, resourceAmount, true))
|
||||
if (Warehouse.loot(warehouse, player, resourceBase, resourceAmount, true))
|
||||
ChatManager.chatInfoInfo(player, "You have looted " + resourceAmount + ' ' + resourceBase.getName());
|
||||
}
|
||||
break;
|
||||
@@ -291,7 +305,7 @@ public enum BuildingManager {
|
||||
|
||||
// Method transfers ownership of all hirelings in a building
|
||||
|
||||
public static void refreshHirelings(Building building) {
|
||||
public static void updateHirelingGuilds(Building building) {
|
||||
|
||||
if (building == null)
|
||||
return;
|
||||
@@ -303,7 +317,7 @@ public enum BuildingManager {
|
||||
else
|
||||
newGuild = building.getOwner().getGuild();
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||
for (AbstractCharacter hireling : building.hirelings) {
|
||||
hireling.setGuild(newGuild);
|
||||
WorldGrid.updateObject(hireling);
|
||||
}
|
||||
@@ -336,7 +350,7 @@ public enum BuildingManager {
|
||||
|
||||
// Remove hireling from building
|
||||
|
||||
building.getHirelings().remove(hireling);
|
||||
building.hirelings.remove(hireling);
|
||||
|
||||
// Remove from zone mob set
|
||||
|
||||
@@ -388,7 +402,7 @@ public enum BuildingManager {
|
||||
|
||||
if (building.getRank() < 1) {
|
||||
|
||||
for (AbstractCharacter slottedNPC : building.getHirelings().keySet())
|
||||
for (AbstractCharacter slottedNPC : building.hirelings)
|
||||
BuildingManager.removeHireling(building, slottedNPC);
|
||||
|
||||
return;
|
||||
@@ -396,14 +410,17 @@ public enum BuildingManager {
|
||||
|
||||
// Delete hireling if building has deranked.
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet()) {
|
||||
for (AbstractCharacter hireling : building.hirelings) {
|
||||
|
||||
if (building.getHirelings().get(hireling) > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||
if (building.hirelings.indexOf(hireling) + 1 > building.getBlueprint().getSlotsForRank(building.getRank()))
|
||||
BuildingManager.removeHireling(building, hireling);
|
||||
|
||||
}
|
||||
|
||||
refreshHirelings(building);
|
||||
// Update hireling guilds and locations
|
||||
|
||||
updateHirelingGuilds(building);
|
||||
updateHirelingSlots(building);
|
||||
}
|
||||
|
||||
public static Building getBuilding(int id) {
|
||||
@@ -545,7 +562,7 @@ public enum BuildingManager {
|
||||
|
||||
NPC npc = null;
|
||||
|
||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, null, zone, (short) rank, building);
|
||||
npc = NPC.createNPC(pirateName, NpcID.getObjectUUID(), NpcLoc, building.getGuild(), zone, (short) rank, building);
|
||||
|
||||
if (npc == null)
|
||||
return false;
|
||||
@@ -564,7 +581,7 @@ public enum BuildingManager {
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
if (building.getBlueprint().getMaxSlots() == building.hirelings.size())
|
||||
return false;
|
||||
|
||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
@@ -777,83 +794,6 @@ public enum BuildingManager {
|
||||
|
||||
}
|
||||
|
||||
public static void processRedeedNPC(NPC npc, Building building, ClientConnection origin) {
|
||||
|
||||
// Member variable declaration
|
||||
PlayerCharacter player;
|
||||
Contract contract;
|
||||
CharacterItemManager itemMan;
|
||||
ItemBase itemBase;
|
||||
Item item;
|
||||
|
||||
npc.lock.writeLock().lock();
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if (building == null)
|
||||
return;
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
itemMan = player.getCharItemManager();
|
||||
|
||||
contract = npc.getContract();
|
||||
|
||||
if (!player.getCharItemManager().hasRoomInventory((short) 1)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!building.getHirelings().containsKey(npc))
|
||||
return;
|
||||
|
||||
if (!npc.remove()) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
return;
|
||||
}
|
||||
|
||||
building.getHirelings().remove(npc);
|
||||
|
||||
itemBase = ItemBase.getItemBase(contract.getContractID());
|
||||
|
||||
if (itemBase == null) {
|
||||
Logger.error("Could not find Contract for npc: " + npc.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
boolean itemWorked = false;
|
||||
|
||||
item = new Item(itemBase, player.getObjectUUID(), Enum.OwnerType.PlayerCharacter, (byte) ((byte) npc.getRank() - 1), (byte) ((byte) npc.getRank() - 1),
|
||||
(short) 1, (short) 1, true, false, Enum.ItemContainerType.INVENTORY, (byte) 0,
|
||||
new ArrayList<>(), "");
|
||||
item.setNumOfItems(1);
|
||||
item.containerType = Enum.ItemContainerType.INVENTORY;
|
||||
|
||||
try {
|
||||
item = DbManager.ItemQueries.ADD_ITEM(item);
|
||||
itemWorked = true;
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
if (itemWorked) {
|
||||
itemMan.addItemToInventory(item);
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg();
|
||||
mca.actionType = NPC.SVR_CLOSE_WINDOW;
|
||||
mca.setTargetType(building.getObjectType().ordinal());
|
||||
mca.setTargetID(building.getObjectUUID());
|
||||
origin.sendMsg(mca);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
} finally {
|
||||
npc.lock.writeLock().unlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void rebuildMine(Building mineBuilding) {
|
||||
setRank(mineBuilding, 1);
|
||||
mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(mineBuilding.rank);
|
||||
@@ -871,7 +811,7 @@ public enum BuildingManager {
|
||||
boolean success;
|
||||
|
||||
|
||||
// If this building has no blueprint then set rank and exit immediatly.
|
||||
// If this building has no blueprint then set rank and exit immediately.
|
||||
|
||||
if (building.blueprintUUID == 0 || building.getBlueprint() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)) {
|
||||
building.rank = rank;
|
||||
@@ -889,7 +829,7 @@ public enum BuildingManager {
|
||||
Logger.error("failed to cancel existing upgrade job.");
|
||||
}
|
||||
|
||||
// Attempt write to database, or delete the building
|
||||
// Attempt to write to database, or delete the building
|
||||
// if we are destroying it.
|
||||
|
||||
if (rank == -1)
|
||||
|
||||
@@ -45,22 +45,27 @@ public enum MaintenanceManager {
|
||||
// Deduct upkeep and build list of buildings
|
||||
// which did not have funds available
|
||||
|
||||
for (Building building : maintList) {
|
||||
|
||||
if (chargeUpkeep(building) == false)
|
||||
derankList.add(building);
|
||||
try {
|
||||
for (Building building : maintList)
|
||||
if (chargeUpkeep(building) == false)
|
||||
derankList.add(building);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
// Reset maintenance dates for these buildings
|
||||
|
||||
for (Building building : maintList) {
|
||||
for (Building building : maintList)
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||
|
||||
}
|
||||
// Derak or destroy buildings that did not
|
||||
// have funds available.
|
||||
|
||||
for (Building building : derankList)
|
||||
building.destroyOrDerank(null);
|
||||
try {
|
||||
for (Building building : derankList)
|
||||
building.destroyOrDerank(null);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
||||
}
|
||||
@@ -179,7 +184,7 @@ public enum MaintenanceManager {
|
||||
if ((overDraft > 0))
|
||||
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
|
||||
(warehouse != null) && building.assetIsProtected() == true &&
|
||||
(warehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
|
||||
(warehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
|
||||
hasFunds = true;
|
||||
}
|
||||
|
||||
@@ -194,22 +199,22 @@ public enum MaintenanceManager {
|
||||
hasResources = false;
|
||||
else {
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
||||
|
||||
if (resourceValue < 1500)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
||||
|
||||
if (resourceValue < 1500)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
||||
|
||||
if (resourceValue < 5)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
||||
|
||||
if (resourceValue < 5)
|
||||
hasResources = false;
|
||||
@@ -242,11 +247,11 @@ public enum MaintenanceManager {
|
||||
|
||||
if (overDraft > 0) {
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
|
||||
warehouse.getResources().put(Warehouse.goldIB, resourceValue - overDraft);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
|
||||
warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - overDraft);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
|
||||
} else {
|
||||
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
@@ -262,11 +267,11 @@ public enum MaintenanceManager {
|
||||
|
||||
// Withdraw Stone
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
||||
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 1500);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
||||
} else {
|
||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
@@ -274,11 +279,11 @@ public enum MaintenanceManager {
|
||||
|
||||
// Withdraw Lumber
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
||||
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 1500);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
||||
} else {
|
||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
@@ -286,21 +291,21 @@ public enum MaintenanceManager {
|
||||
|
||||
// Withdraw Galvor
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
||||
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 5);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
||||
} else {
|
||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
||||
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 5);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
||||
} else {
|
||||
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
}
|
||||
|
||||
@@ -5,17 +5,14 @@ import engine.InterestManagement.WorldGrid;
|
||||
import engine.math.Quaternion;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PetMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.powers.RuneSkillAdjustEntry;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import javax.smartcardio.ATR;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -200,7 +197,7 @@ public enum NPCManager {
|
||||
|
||||
// Pets are regular mobiles not hirelings (Siege engines)
|
||||
if (abstractCharacter.contract != null)
|
||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||
abstractCharacter.building.hirelings.addIfAbsent(abstractCharacter);
|
||||
|
||||
// Override bind and location for this npc derived
|
||||
// from BuildingManager slot location data.
|
||||
|
||||
@@ -939,16 +939,16 @@ public class MobAI {
|
||||
|
||||
//dont scan self.
|
||||
|
||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) == true)
|
||||
if (mob.equals(awoMob))
|
||||
continue;
|
||||
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
|
||||
//don't attack other guards
|
||||
|
||||
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)))
|
||||
if (aggroMob.isGuard() == true)
|
||||
continue;
|
||||
|
||||
//don't attack pets
|
||||
if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
if (building.getBlueprint().getMaxSlots() == building.hirelings.size())
|
||||
return false;
|
||||
|
||||
Item contractItem = Item.getFromCache(msg.getContractItem());
|
||||
|
||||
@@ -171,7 +171,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
if (warehouse == null)
|
||||
return true;
|
||||
|
||||
if (warehouse.isEmpty()) {
|
||||
if (Warehouse.isEmpty(warehouse)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -437,13 +437,13 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
break;
|
||||
case 17:
|
||||
Warehouse.warehouseWithdraw(msg, player, npc, origin);
|
||||
Warehouse.warehouseWithdraw(msg, player, npc);
|
||||
break;
|
||||
case 18:
|
||||
Warehouse.warehouseDeposit(msg, player, npc, origin);
|
||||
Warehouse.warehouseDeposit(msg, player, npc);
|
||||
break;
|
||||
case 19:
|
||||
Warehouse.warehouseLock(msg, player, npc, origin);
|
||||
Warehouse.warehouseLock(msg, player, npc);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,27 +98,27 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
|
||||
|
||||
if (resourceValue < 5000000)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
||||
|
||||
if (resourceValue < 8000)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
||||
|
||||
if (resourceValue < 8000)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
||||
|
||||
if (resourceValue < 15)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
||||
|
||||
if (resourceValue < 15)
|
||||
hasResources = false;
|
||||
@@ -130,51 +130,51 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Remove resources from warehouse before claiming realm
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(7));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - 5000000) == true) {
|
||||
warehouse.getResources().put(Warehouse.goldIB, resourceValue - 5000000);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, 5000000);
|
||||
warehouse.resources.put(ItemBase.getItemBase(7), resourceValue - 5000000);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, 5000000);
|
||||
} else {
|
||||
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580000));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 8000) == true) {
|
||||
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 8000);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 8000);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580000), resourceValue - 8000);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 8000);
|
||||
} else {
|
||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580004));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 8000) == true) {
|
||||
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 8000);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 8000);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580004), resourceValue - 8000);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 8000);
|
||||
} else {
|
||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580017));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 15) == true) {
|
||||
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 15);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 15);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580017), resourceValue - 15);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 15);
|
||||
} else {
|
||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
resourceValue = warehouse.resources.get(ItemBase.getItemBase(1580018));
|
||||
|
||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 15) == true) {
|
||||
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 15);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 15);
|
||||
warehouse.resources.put(ItemBase.getItemBase(1580018), resourceValue - 15);
|
||||
Warehouse.AddTransactionToWarehouse(warehouse, engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 15);
|
||||
} else {
|
||||
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!building.getHirelings().containsKey(hireling))
|
||||
if (!building.hirelings.contains(hireling))
|
||||
return;
|
||||
|
||||
BuildingManager.removeHireling(building, hireling);
|
||||
@@ -402,7 +402,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (building == null)
|
||||
return true;
|
||||
|
||||
if (building.getHirelings().containsKey(npc) == false)
|
||||
if (building.hirelings.contains(npc) == false)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building) == false)
|
||||
return true;
|
||||
|
||||
if (building.getHirelings().containsKey(npc) == false)
|
||||
if (building.hirelings.contains(npc) == false)
|
||||
return true;
|
||||
|
||||
if (npc.remove() == false) {
|
||||
@@ -515,7 +515,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (building == null)
|
||||
return true;
|
||||
|
||||
if (!building.getHirelings().containsKey(mob))
|
||||
if (!building.hirelings.contains(mob))
|
||||
return true;
|
||||
|
||||
if (player.getCharItemManager().getTradingWith() != null) {
|
||||
@@ -531,7 +531,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
if (BuildingManager.playerCanManage(player, building) == false)
|
||||
return true;
|
||||
|
||||
if (building.getHirelings().containsKey(mob) == false)
|
||||
if (building.hirelings.contains(mob) == false)
|
||||
return true;
|
||||
|
||||
BuildingManager.removeHireling(building, mob);
|
||||
|
||||
@@ -766,8 +766,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
cityObjectMap.put(gameObject.getObjectType(), gameObject);
|
||||
|
||||
treeObject = (Building) cityObjectMap.get(GameObjectType.Building);
|
||||
treeObject.runAfterLoad();
|
||||
|
||||
cityObject = (City) cityObjectMap.get(GameObjectType.City);
|
||||
zoneObject = (Zone) cityObjectMap.get(GameObjectType.Zone);
|
||||
|
||||
@@ -799,6 +797,10 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
City.lastCityUpdate = System.currentTimeMillis();
|
||||
treeObject.setLoc(treeObject.getLoc());
|
||||
|
||||
// As this is a new static object set it's dirtyFlag
|
||||
// so players already near it will have the object loaded.
|
||||
|
||||
InterestManager.setObjectDirty(treeObject);
|
||||
|
||||
serverRealm.addCity(cityObject.getObjectUUID());
|
||||
|
||||
@@ -111,7 +111,7 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
ViewResourcesMessage vrm = new ViewResourcesMessage(player);
|
||||
vrm.setGuild(building.getGuild());
|
||||
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().getBuildingUID()));
|
||||
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().buildingUID));
|
||||
vrm.configure();
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
@@ -61,13 +61,13 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
||||
|
||||
public void configure() {
|
||||
|
||||
warehouseBuilding = BuildingManager.getBuilding(this.warehouse.getBuildingUID());
|
||||
warehouseBuilding = BuildingManager.getBuilding(this.warehouse.buildingUID);
|
||||
transactions = new ArrayList<>(50);
|
||||
|
||||
if (this.warehouse.getTransactions().size() > 150) {
|
||||
transactions.addAll(this.warehouse.getTransactions().subList(this.warehouse.getTransactions().size() - 150, this.warehouse.getTransactions().size()));
|
||||
if (this.warehouse.transactions.size() > 150) {
|
||||
transactions.addAll(this.warehouse.transactions.subList(this.warehouse.transactions.size() - 150, this.warehouse.transactions.size()));
|
||||
} else
|
||||
transactions = this.warehouse.getTransactions();
|
||||
transactions = this.warehouse.transactions;
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(this.transactionID);
|
||||
writer.putInt(this.warehouse.getBuildingUID());
|
||||
writer.putInt(this.warehouse.buildingUID);
|
||||
writer.putInt(transactions.size()); //list Size
|
||||
|
||||
for (Transaction transaction : transactions) {
|
||||
@@ -124,7 +124,7 @@ public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
||||
writer.putInt(transaction.getTargetUUID()); //ID
|
||||
writer.putString(name); //Name of depositer/withdrawler or mine name
|
||||
writer.putInt(GameObjectType.Building.ordinal()); //Type
|
||||
writer.putInt(warehouse.getBuildingUID()); //ID
|
||||
writer.putInt(warehouse.buildingUID); //ID
|
||||
writer.putString(warehouseBuilding.getName()); //warehouse
|
||||
writer.putInt(transaction.getTransactionType().getID()); //79,80 withdrew, 81 mine produced, 82 deposit
|
||||
writer.putInt(transaction.getAmount()); //amount
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.joda.time.Period;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Open manage city asset window
|
||||
@@ -229,8 +228,8 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
writer.putInt(asset.getObjectUUID());
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(asset.getHirelings().size());
|
||||
for (AbstractCharacter hireling : asset.getHirelings().keySet()) {
|
||||
writer.putInt(asset.hirelings.size());
|
||||
for (AbstractCharacter hireling : asset.hirelings) {
|
||||
if (!hireling.getObjectType().equals(GameObjectType.NPC))
|
||||
writer.putString(hireling.getName());
|
||||
else {
|
||||
@@ -262,9 +261,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
for (int a = 0; a < 5; a++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(asset.getHirelings().size());
|
||||
writer.putInt(asset.hirelings.size());
|
||||
|
||||
for (AbstractCharacter npcHire : asset.getHirelings().keySet()) {
|
||||
for (AbstractCharacter npcHire : asset.hirelings) {
|
||||
writer.putInt(npcHire.getObjectType().ordinal());
|
||||
writer.putInt(npcHire.getObjectUUID());
|
||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
@@ -668,11 +667,11 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
writer.putInt(1);
|
||||
}
|
||||
|
||||
writer.putInt(building.hirelings.size());
|
||||
|
||||
ConcurrentHashMap<AbstractCharacter, Integer> npcList = building.getHirelings();
|
||||
writer.putInt(npcList.size());
|
||||
if (npcList.size() > 0) {
|
||||
for (AbstractCharacter npcHire : npcList.keySet()) {
|
||||
if (building.hirelings.size() > 0) {
|
||||
|
||||
for (AbstractCharacter npcHire : building.hirelings) {
|
||||
writer.putInt(npcHire.getObjectType().ordinal());
|
||||
if (npcHire.getObjectType() == GameObjectType.Mob)
|
||||
writer.putInt(((Mob) npcHire).getDBID());
|
||||
|
||||
@@ -89,23 +89,23 @@ public class ViewResourcesMessage extends ClientNetMsg {
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
writer.putInt(warehouseObject.getResources().size());
|
||||
writer.putInt(warehouseObject.resources.size());
|
||||
|
||||
for (ItemBase ib : (warehouseObject.getResources().keySet())) {
|
||||
for (ItemBase ib : (warehouseObject.resources.keySet())) {
|
||||
|
||||
writer.putInt(ib.getHashID());
|
||||
writer.putInt((warehouseObject.getResources().get(ib)));
|
||||
writer.putInt((warehouseObject.resources.get(ib)));
|
||||
|
||||
|
||||
if (warehouseObject.isResourceLocked(ib) == true)
|
||||
if (Warehouse.isResourceLocked(warehouseObject, ib) == true)
|
||||
writer.put((byte) 1);
|
||||
else
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
|
||||
writer.putInt(warehouseObject.getResources().size());
|
||||
writer.putInt(warehouseObject.resources.size());
|
||||
|
||||
for (ItemBase ib : warehouseObject.getResources().keySet()) {
|
||||
for (ItemBase ib : warehouseObject.resources.keySet()) {
|
||||
writer.putInt(ib.getHashID());
|
||||
writer.putInt(0); //available?
|
||||
writer.putInt(Warehouse.getMaxResources().get(ib.getUUID())); //max?
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
@@ -51,7 +52,7 @@ public class Building extends AbstractWorldObject {
|
||||
// Used for thread safety
|
||||
|
||||
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
private final ConcurrentHashMap<AbstractCharacter, Integer> hirelings = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
public CopyOnWriteArrayList<AbstractCharacter> hirelings = new CopyOnWriteArrayList<>();
|
||||
private final HashMap<Integer, DoorCloseJob> doorJobs = new HashMap<>();
|
||||
public int meshUUID;
|
||||
public Zone parentZone;
|
||||
@@ -647,12 +648,11 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
// Add costs associated with hirelings
|
||||
|
||||
for (AbstractCharacter npc : this.hirelings.keySet()) {
|
||||
for (AbstractCharacter npc : this.hirelings) {
|
||||
|
||||
if (npc.getObjectType() != GameObjectType.NPC)
|
||||
continue;
|
||||
|
||||
|
||||
maintCost += Blueprint.getNpcMaintCost(npc.getRank());
|
||||
}
|
||||
|
||||
@@ -1031,7 +1031,7 @@ public class Building extends AbstractWorldObject {
|
||||
// Set new guild for hirelings and refresh all clients
|
||||
|
||||
this.refreshGuild();
|
||||
BuildingManager.refreshHirelings(this);
|
||||
BuildingManager.updateHirelingGuilds(this);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error("Error updating owner! UUID: " + this.getObjectUUID());
|
||||
@@ -1213,10 +1213,6 @@ public class Building extends AbstractWorldObject {
|
||||
this.updateEffects();
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<AbstractCharacter, Integer> getHirelings() {
|
||||
return hirelings;
|
||||
}
|
||||
|
||||
public final boolean isSpireIsActive() {
|
||||
return spireIsActive;
|
||||
}
|
||||
@@ -1429,18 +1425,18 @@ public class Building extends AbstractWorldObject {
|
||||
if (this.getCity().getWarehouse() == null)
|
||||
return amount;
|
||||
|
||||
if (this.getCity().getWarehouse().getResources().get(ItemBase.getGoldItemBase()) >= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()))
|
||||
if (this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase()) >= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()))
|
||||
return amount;
|
||||
|
||||
int profitAmount = (int) (amount * (taxAmount * .01f));
|
||||
|
||||
if (this.getCity().getWarehouse().getResources().get(ItemBase.getGoldItemBase()) + profitAmount <= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID())) {
|
||||
this.getCity().getWarehouse().depositProfitTax(ItemBase.getGoldItemBase(), profitAmount, this);
|
||||
if (this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase()) + profitAmount <= Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID())) {
|
||||
Warehouse.depositProfitTax(ItemBase.getGoldItemBase(), profitAmount, this,this.getCity().getWarehouse());
|
||||
return amount - profitAmount;
|
||||
}
|
||||
//overDrafting
|
||||
int warehouseDeposit = Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()) - this.getCity().getWarehouse().getResources().get(ItemBase.getGoldItemBase());
|
||||
this.getCity().getWarehouse().depositProfitTax(ItemBase.getGoldItemBase(), warehouseDeposit, this);
|
||||
int warehouseDeposit = Warehouse.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()) - this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase());
|
||||
Warehouse.depositProfitTax(ItemBase.getGoldItemBase(), warehouseDeposit, this,this.getCity().getWarehouse());
|
||||
return amount - warehouseDeposit;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,7 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
@@ -345,13 +342,13 @@ public class CharacterItemManager {
|
||||
Warehouse warehouse = (Warehouse) object;
|
||||
|
||||
if (amount < 0) {
|
||||
if (!warehouse.deposit((PlayerCharacter) this.absCharacter, this.getGoldInventory(), amount * -1, true, true)) {
|
||||
if (!Warehouse.deposit((PlayerCharacter) this.absCharacter, this.getGoldInventory(), amount * -1, true, true,warehouse)) {
|
||||
|
||||
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!warehouse.withdraw((PlayerCharacter) this.absCharacter, this.getGoldInventory().getItemBase(), amount * -1, true, true)) {
|
||||
if (!Warehouse.withdraw(warehouse, (PlayerCharacter) this.absCharacter, this.getGoldInventory().getItemBase(), amount * -1, true, true)) {
|
||||
|
||||
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203);
|
||||
return false;
|
||||
|
||||
@@ -656,7 +656,7 @@ public class City extends AbstractWorldObject {
|
||||
if (this.getTOL() == null)
|
||||
return outNPC;
|
||||
|
||||
for (AbstractCharacter npc : getTOL().getHirelings().keySet()) {
|
||||
for (AbstractCharacter npc : getTOL().hirelings) {
|
||||
if (npc.getObjectType() == GameObjectType.NPC)
|
||||
if (((NPC) npc).getContract().isRuneMaster() == true)
|
||||
outNPC = (NPC) npc;
|
||||
@@ -1358,7 +1358,7 @@ public class City extends AbstractWorldObject {
|
||||
ItemBase ib = ItemBase.getItemBase(itemBaseID);
|
||||
if (ib == null)
|
||||
continue;
|
||||
if (ruledWarehouse.isAboveCap(ib, (int) (city.getWarehouse().getResources().get(ib) * taxPercent))) {
|
||||
if (Warehouse.isAboveCap(ruledWarehouse, ib, (int) (city.getWarehouse().resources.get(ib) * taxPercent))) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You're warehouse has enough " + ib.getName() + " already!");
|
||||
return true;
|
||||
}
|
||||
@@ -1371,7 +1371,7 @@ public class City extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
try {
|
||||
city.getWarehouse().transferResources(player, msg, resources, taxPercent, ruledWarehouse);
|
||||
Warehouse.transferResources(city.getWarehouse(), player, msg, resources, taxPercent);
|
||||
} catch (Exception e) {
|
||||
Logger.info(e.getMessage());
|
||||
}
|
||||
@@ -1380,7 +1380,7 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
ViewResourcesMessage vrm = new ViewResourcesMessage(player);
|
||||
vrm.setGuild(building.getGuild());
|
||||
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().getBuildingUID()));
|
||||
vrm.setWarehouseBuilding(BuildingManager.getBuildingFromCache(building.getCity().getWarehouse().buildingUID));
|
||||
vrm.configure();
|
||||
Dispatch dispatch = Dispatch.borrow(player, vrm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class ItemFactory {
|
||||
// ROLL BANE SCROLL.
|
||||
|
||||
if (ib.getUUID() > 910010 && ib.getUUID() < 910019) {
|
||||
ConcurrentHashMap<ItemBase, Integer> resources = cityWarehouse.getResources();
|
||||
ConcurrentHashMap<ItemBase, Integer> resources = cityWarehouse.resources;
|
||||
|
||||
|
||||
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, ib.getBaseValue());
|
||||
@@ -131,7 +131,7 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + " " + ib.getName());
|
||||
return null;
|
||||
@@ -167,9 +167,9 @@ public class ItemFactory {
|
||||
}
|
||||
|
||||
if (overdraft > 0)
|
||||
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
|
||||
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName());
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -263,13 +263,13 @@ public class ItemFactory {
|
||||
}
|
||||
|
||||
if (galvorAmount > 0) {
|
||||
if (cityWarehouse.isResourceLocked(galvor)) {
|
||||
if (Warehouse.isResourceLocked(cityWarehouse, galvor)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cityWarehouse.getResources().get(galvor) < galvorAmount) {
|
||||
if (cityWarehouse.resources.get(galvor) < galvorAmount) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName());
|
||||
return null;
|
||||
@@ -277,13 +277,13 @@ public class ItemFactory {
|
||||
}
|
||||
|
||||
if (wormwoodAmount > 0) {
|
||||
if (cityWarehouse.isResourceLocked(wormwood)) {
|
||||
if (Warehouse.isResourceLocked(cityWarehouse, wormwood)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Wormwood is locked." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cityWarehouse.getResources().get(wormwood) < wormwoodAmount) {
|
||||
if (cityWarehouse.resources.get(wormwood) < wormwoodAmount) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Wormwood in warehouse to roll this item." + ib.getName());
|
||||
return null;
|
||||
@@ -320,20 +320,20 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
prefixResourceCosts = prefix.getResourcesForEffect();
|
||||
for (ItemBase ibResources : prefixResourceCosts.keySet()) {
|
||||
int warehouseAmount = cityWarehouse.getResources().get(ibResources);
|
||||
int warehouseAmount = cityWarehouse.resources.get(ibResources);
|
||||
int creationAmount = prefixResourceCosts.get(ibResources);
|
||||
//ChatManager.chatInfoError(pc, "Prefix : " + ibResources.getName() + " / " + creationAmount);
|
||||
if (warehouseAmount < creationAmount) {
|
||||
@@ -374,13 +374,13 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
|
||||
return null;
|
||||
@@ -388,7 +388,7 @@ public class ItemFactory {
|
||||
|
||||
|
||||
for (ItemBase ibResources : suffixResourceCosts.keySet()) {
|
||||
int warehouseAmount = cityWarehouse.getResources().get(ibResources);
|
||||
int warehouseAmount = cityWarehouse.resources.get(ibResources);
|
||||
int creationAmount = suffixResourceCosts.get(ibResources);
|
||||
if (warehouseAmount < creationAmount) {
|
||||
// if (pc != null)
|
||||
@@ -414,13 +414,13 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > 0 && useWarehouse && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > 0 && useWarehouse && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (useWarehouse && overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (useWarehouse && overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
|
||||
return null;
|
||||
@@ -440,7 +440,7 @@ public class ItemFactory {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + ib.getName());
|
||||
return null;
|
||||
} else {
|
||||
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
@@ -448,9 +448,9 @@ public class ItemFactory {
|
||||
}
|
||||
|
||||
if (overdraft > 0 && useWarehouse)
|
||||
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
|
||||
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName());
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -467,18 +467,18 @@ public class ItemFactory {
|
||||
|
||||
int creationAmount = prefixResourceCosts.get(ibResources);
|
||||
|
||||
if (cityWarehouse.isResourceLocked(ibResources) == true)
|
||||
if (Warehouse.isResourceLocked(cityWarehouse, ibResources) == true)
|
||||
return null;
|
||||
|
||||
int oldAmount = cityWarehouse.getResources().get(ibResources);
|
||||
int oldAmount = cityWarehouse.resources.get(ibResources);
|
||||
int amount = creationAmount;
|
||||
|
||||
if (oldAmount < amount)
|
||||
amount = oldAmount;
|
||||
|
||||
if (!cityWarehouse.withdraw(npc, ibResources, amount, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) {
|
||||
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName());
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -489,18 +489,18 @@ public class ItemFactory {
|
||||
for (ItemBase ibResources : suffixResourceCosts.keySet()) {
|
||||
int creationAmount = suffixResourceCosts.get(ibResources);
|
||||
|
||||
if (cityWarehouse.isResourceLocked(ibResources) == true) {
|
||||
if (Warehouse.isResourceLocked(cityWarehouse, ibResources) == true) {
|
||||
ChatManager.chatSystemError(pc, ibResources.getName() + " is locked!" + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
int oldAmount = cityWarehouse.getResources().get(ibResources);
|
||||
int oldAmount = cityWarehouse.resources.get(ibResources);
|
||||
int amount = creationAmount;
|
||||
if (oldAmount < amount)
|
||||
amount = oldAmount;
|
||||
if (!cityWarehouse.withdraw(npc, ibResources, amount, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) {
|
||||
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName());
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -522,14 +522,14 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (useWarehouse && overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (useWarehouse && overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + ib.getName());
|
||||
@@ -544,7 +544,7 @@ public class ItemFactory {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + ib.getName());
|
||||
return null;
|
||||
} else {
|
||||
if (overdraft > cityWarehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
@@ -552,16 +552,16 @@ public class ItemFactory {
|
||||
}
|
||||
|
||||
if (overdraft > 0)
|
||||
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
|
||||
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.getUID() + " Failed to Create Item." + ib.getName());
|
||||
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
// ChatManager.chatGuildInfo(pc, "Gold Cost = " + total);
|
||||
|
||||
if (galvorAmount > 0) {
|
||||
if (!cityWarehouse.withdraw(npc, galvor, galvorAmount, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, galvor, galvorAmount, true)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + ib.getName());
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
@@ -569,7 +569,7 @@ public class ItemFactory {
|
||||
}
|
||||
|
||||
if (wormwoodAmount > 0) {
|
||||
if (!cityWarehouse.withdraw(npc, wormwood, wormwoodAmount, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, wormwood, wormwoodAmount, true)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse!" + ib.getName());
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
@@ -815,7 +815,7 @@ public class ItemFactory {
|
||||
ConcurrentHashMap<ItemBase, Integer> resources = null;
|
||||
|
||||
if (useWarehouse)
|
||||
resources = cityWarehouse.getResources();
|
||||
resources = cityWarehouse.resources;
|
||||
|
||||
int galvorAmount = 0;
|
||||
int wormwoodAmount = 0;
|
||||
@@ -852,24 +852,24 @@ public class ItemFactory {
|
||||
return null;
|
||||
|
||||
if (galvorAmount > 0) {
|
||||
if (cityWarehouse.isResourceLocked(galvor)) {
|
||||
if (Warehouse.isResourceLocked(cityWarehouse, galvor)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cityWarehouse.getResources().get(galvor) < galvorAmount) {
|
||||
if (cityWarehouse.resources.get(galvor) < galvorAmount) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (wormwoodAmount > 0) {
|
||||
if (cityWarehouse.isResourceLocked(wormwood)) {
|
||||
if (Warehouse.isResourceLocked(cityWarehouse, wormwood)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Galvor is locked." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cityWarehouse.getResources().get(wormwood) < wormwoodAmount) {
|
||||
if (cityWarehouse.resources.get(wormwood) < wormwoodAmount) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Galvor in warehouse to roll this item." + ib.getName());
|
||||
return null;
|
||||
}
|
||||
@@ -908,7 +908,7 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (useWarehouse && overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (useWarehouse && overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
|
||||
return null;
|
||||
@@ -936,12 +936,12 @@ public class ItemFactory {
|
||||
// there was an overdraft, withdraw the rest from warehouse.
|
||||
if (overdraft > 0) {
|
||||
if (pc != null) {
|
||||
if (!cityWarehouse.withdraw(pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
}
|
||||
@@ -959,7 +959,7 @@ public class ItemFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (useWarehouse && overdraft > 0 && cityWarehouse.isResourceLocked(ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (useWarehouse && overdraft > 0 && Warehouse.isResourceLocked(cityWarehouse, ItemBase.GOLD_ITEM_BASE)) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Warehouse gold is barred! Overdraft cannot be withdrawn from warehouse." + ib.getName());
|
||||
return null;
|
||||
@@ -987,12 +987,12 @@ public class ItemFactory {
|
||||
if (overdraft > 0 && useWarehouse) {
|
||||
|
||||
if (pc != null) {
|
||||
if (!cityWarehouse.withdraw(pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, pc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (!cityWarehouse.withdraw(npc, ItemBase.GOLD_ITEM_BASE, overdraft, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, ItemBase.GOLD_ITEM_BASE, overdraft, true)) {
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ public class ItemFactory {
|
||||
|
||||
if (galvorAmount > 0 && useWarehouse) {
|
||||
//ChatManager.chatGuildInfo(pc, "Withdrawing " + galvorAmount + " galvor from warehouse");
|
||||
if (!cityWarehouse.withdraw(npc, galvor, galvorAmount, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, galvor, galvorAmount, true)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + ib.getName());
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
return null;
|
||||
@@ -1011,7 +1011,7 @@ public class ItemFactory {
|
||||
|
||||
if (wormwoodAmount > 0 && useWarehouse) {
|
||||
//ChatManager.chatGuildInfo(pc, "Withdrawing " + wormwoodAmount + " wormwood from warehouse");
|
||||
if (!cityWarehouse.withdraw(npc, wormwood, wormwoodAmount, false, true)) {
|
||||
if (!Warehouse.withdraw(cityWarehouse, npc, wormwood, wormwoodAmount, true)) {
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse for " + ib.getName());
|
||||
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl ");
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ public class Mine extends AbstractGameObject {
|
||||
return false;
|
||||
|
||||
ItemBase resourceIB = ItemBase.getItemBase(this.production.UUID);
|
||||
return this.owningGuild.getOwnedCity().getWarehouse().depositFromMine(this, resourceIB, this.getModifiedProductionAmount());
|
||||
return Warehouse.depositFromMine(this, resourceIB, this.getModifiedProductionAmount(),this.owningGuild.getOwnedCity().getWarehouse());
|
||||
}
|
||||
|
||||
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
|
||||
@@ -550,7 +550,7 @@ public class Mine extends AbstractGameObject {
|
||||
Building mineBuilding = BuildingManager.getBuilding(this.buildingID);
|
||||
if (mineBuilding == null)
|
||||
return this.production.baseProduction;
|
||||
for (AbstractCharacter harvester : mineBuilding.getHirelings().keySet()) {
|
||||
for (AbstractCharacter harvester : mineBuilding.hirelings) {
|
||||
totalModded += baseModValue;
|
||||
totalModded += rankModValue * harvester.getRank();
|
||||
}
|
||||
|
||||
@@ -406,7 +406,6 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
|
||||
|
||||
Mob mobile = new Mob();
|
||||
mobile.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
||||
//mobile.agentType = AIAgentType.MOBILE; this method is only called to make guard captains and wall archers
|
||||
mobile.agentType = mobType;
|
||||
mobile.behaviourType = MobBehaviourType.None;
|
||||
mobile.loadID = loadID;
|
||||
@@ -418,12 +417,17 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
|
||||
mobile.guildUUID = guild.getObjectUUID();
|
||||
|
||||
mobile.parentZoneUUID = parent.getObjectUUID();
|
||||
mobile.buildingUUID = building.getObjectUUID();
|
||||
|
||||
if (building == null)
|
||||
mobile.buildingUUID = 0;
|
||||
else
|
||||
mobile.buildingUUID = building.getObjectUUID();
|
||||
|
||||
if (mobile.buildingUUID != 0)
|
||||
mobile.bindLoc = Vector3fImmutable.ZERO;
|
||||
else
|
||||
mobile.bindLoc = spawn;
|
||||
mobile.bindLoc = ZoneManager.worldToLocal(spawn, parent);
|
||||
;
|
||||
|
||||
mobile.firstName = pirateName;
|
||||
|
||||
@@ -1889,6 +1893,19 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean isGuard(){
|
||||
|
||||
switch(this.behaviourType){
|
||||
case GuardMinion:
|
||||
case GuardCaptain:
|
||||
case GuardWallArcher:
|
||||
case HamletGuard:
|
||||
case SimpleStandingGuard:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDelay(@NotNull TimeUnit unit) {
|
||||
long timeRemaining = this.respawnTime - System.currentTimeMillis();
|
||||
|
||||
+26
-27
@@ -461,16 +461,20 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
NPC newNPC = new NPC();
|
||||
|
||||
newNPC.parentZoneUUID = parent.getObjectUUID();
|
||||
|
||||
newNPC.name = name;
|
||||
newNPC.contractUUID = contractID;
|
||||
|
||||
if (building == null)
|
||||
newNPC.bindLoc = spawn;
|
||||
newNPC.bindLoc = ZoneManager.worldToLocal(spawn, parent);
|
||||
else
|
||||
newNPC.bindLoc = Vector3fImmutable.ZERO;
|
||||
|
||||
newNPC.parentZoneUUID = parent.getObjectUUID();
|
||||
newNPC.guildUUID = guild.getObjectUUID();
|
||||
if (guild == null)
|
||||
newNPC.guildUUID = 0;
|
||||
else
|
||||
newNPC.guildUUID = guild.getObjectUUID();
|
||||
|
||||
if (building == null)
|
||||
newNPC.buildingUUID = 0;
|
||||
@@ -842,7 +846,6 @@ public class NPC extends AbstractCharacter {
|
||||
else
|
||||
this.guild = Guild.getGuild(this.guildUUID);
|
||||
|
||||
|
||||
if (this.guild == null)
|
||||
this.guild = Guild.getErrantGuild();
|
||||
|
||||
@@ -872,27 +875,23 @@ public class NPC extends AbstractCharacter {
|
||||
if (this.building != null)
|
||||
NPCManager.slotCharacterInBuilding(this);
|
||||
|
||||
if (this.contract != null) {
|
||||
this.symbol = this.contract.getIconID();
|
||||
this.modTypeTable = this.contract.getNPCModTypeTable();
|
||||
this.modSuffixTable = this.contract.getNpcModSuffixTable();
|
||||
this.itemModTable = this.contract.getItemModTable();
|
||||
int VID = this.contract.getVendorID();
|
||||
this.symbol = this.contract.getIconID();
|
||||
this.modTypeTable = this.contract.getNPCModTypeTable();
|
||||
this.modSuffixTable = this.contract.getNpcModSuffixTable();
|
||||
this.itemModTable = this.contract.getItemModTable();
|
||||
int VID = this.contract.getVendorID();
|
||||
|
||||
if (VID != 0)
|
||||
this.vendorID = VID;
|
||||
else
|
||||
this.vendorID = 1; //no vendor items
|
||||
}
|
||||
if (VID != 0)
|
||||
this.vendorID = VID;
|
||||
else
|
||||
this.vendorID = 1; //no vendor items
|
||||
|
||||
if (this.mobBase != null) {
|
||||
this.healthMax = this.mobBase.getHealthMax();
|
||||
this.manaMax = 0;
|
||||
this.staminaMax = 0;
|
||||
this.setHealth(this.healthMax);
|
||||
this.mana.set(this.manaMax);
|
||||
this.stamina.set(this.staminaMax);
|
||||
}
|
||||
this.healthMax = this.mobBase.getHealthMax();
|
||||
this.manaMax = 0;
|
||||
this.staminaMax = 0;
|
||||
this.setHealth(this.healthMax);
|
||||
this.mana.set(this.manaMax);
|
||||
this.stamina.set(this.staminaMax);
|
||||
|
||||
if (this.parentZone.guild_zone)
|
||||
if (NPC.GetNPCProfits(this) == null)
|
||||
@@ -911,10 +910,10 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
this.charItemManager.load();
|
||||
|
||||
this.equip = loadEquipmentSet(this.equipmentSetID);
|
||||
if (equipmentSetID != 0 && LootManager._bootySetMap.get(equipmentSetID) == null)
|
||||
Logger.error("Invalid equipSet: " + equipmentSetID + " contract: " + this.contractUUID + " npc: " + this.getObjectUUID());
|
||||
|
||||
if (this.equip == null)
|
||||
this.equip = new HashMap<>();
|
||||
this.equip = loadEquipmentSet(this.equipmentSetID);
|
||||
|
||||
try {
|
||||
|
||||
@@ -1120,7 +1119,7 @@ public class NPC extends AbstractCharacter {
|
||||
building = this.building;
|
||||
|
||||
if (building != null) {
|
||||
building.getHirelings().remove(this);
|
||||
building.hirelings.remove(this);
|
||||
this.removeMinions();
|
||||
}
|
||||
|
||||
|
||||
+327
-743
File diff suppressed because it is too large
Load Diff
@@ -37,8 +37,8 @@ public class Zone extends AbstractWorldObject {
|
||||
|
||||
public final int playerCityUUID;
|
||||
public final String zoneName;
|
||||
public final float major_radius;
|
||||
public final float minor_radius;
|
||||
public float major_radius;
|
||||
public float minor_radius;
|
||||
public final float xOffset;
|
||||
public final float zOffset;
|
||||
public final float yOffset;
|
||||
@@ -76,9 +76,6 @@ public class Zone extends AbstractWorldObject {
|
||||
this.templateID = rs.getInt("template");
|
||||
this.zoneName = rs.getString("zone_name");
|
||||
this.peace_zone = rs.getByte("peace_zone");
|
||||
|
||||
this.major_radius = rs.getFloat("major_radius");
|
||||
this.minor_radius = rs.getFloat("minor_radius");
|
||||
this.xOffset = rs.getFloat("xOffset");
|
||||
this.zOffset = rs.getFloat("zOffset");
|
||||
this.yOffset = rs.getFloat("yOffset");
|
||||
@@ -163,6 +160,18 @@ public class Zone extends AbstractWorldObject {
|
||||
if (ZoneManager.seaFloor == null)
|
||||
ZoneManager.seaFloor = this;
|
||||
|
||||
// Guild zones use the enum CityBoundsType to adjust
|
||||
// city size. All other zones derive from the JSON
|
||||
// stored within its template.
|
||||
|
||||
if (this.template == null) {
|
||||
this.minor_radius = Enum.CityBoundsType.ZONE.halfExtents;
|
||||
this.major_radius = Enum.CityBoundsType.ZONE.halfExtents;
|
||||
} else {
|
||||
this.minor_radius = this.template.minor_radius;
|
||||
this.major_radius = this.template.major_radius;
|
||||
}
|
||||
|
||||
this.setParent();
|
||||
this.setBounds();
|
||||
|
||||
@@ -192,7 +201,7 @@ public class Zone extends AbstractWorldObject {
|
||||
// Set initial bounds object
|
||||
|
||||
this.bounds = Bounds.borrow();
|
||||
this.bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(this.template.major_radius, this.template.minor_radius), 0.0f);
|
||||
this.bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(this.major_radius, this.minor_radius), 0.0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user