forked from MagicBane/Server
Warehosue cleanup
This commit is contained in:
@@ -19,6 +19,7 @@ import engine.db.archive.DataWarehouse;
|
||||
import engine.db.archive.MineRecord;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.WarehouseManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
@@ -1429,18 +1430,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()) >= WarehouseManager.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 <= WarehouseManager.getMaxResources().get(ItemBase.getGoldItemBase().getUUID())) {
|
||||
WarehouseManager.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 = WarehouseManager.getMaxResources().get(ItemBase.getGoldItemBase().getUUID()) - this.getCity().getWarehouse().resources.get(ItemBase.getGoldItemBase());
|
||||
WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.withdraw(warehouse, (PlayerCharacter) this.absCharacter, this.getGoldInventory().getItemBase(), amount * -1, true, true)) {
|
||||
|
||||
ErrorPopupMsg.sendErrorPopup((PlayerCharacter) this.absCharacter, 203);
|
||||
return false;
|
||||
|
||||
@@ -875,7 +875,7 @@ public class City extends AbstractWorldObject {
|
||||
if (this.warehouseBuildingID == 0)
|
||||
return null;
|
||||
|
||||
return Warehouse.warehouseByBuildingUUID.get(this.warehouseBuildingID);
|
||||
return WarehouseManager.warehouseByBuildingUUID.get(this.warehouseBuildingID);
|
||||
}
|
||||
|
||||
public Realm getRealm() {
|
||||
@@ -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 (WarehouseManager.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);
|
||||
WarehouseManager.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 && WarehouseManager.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 (!WarehouseManager.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 (WarehouseManager.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 (WarehouseManager.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 && WarehouseManager.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 && WarehouseManager.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 && WarehouseManager.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 (!WarehouseManager.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 (WarehouseManager.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 (!WarehouseManager.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 (WarehouseManager.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 (!WarehouseManager.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 && WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.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 (WarehouseManager.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 (WarehouseManager.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 && WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.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 && WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.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 (!WarehouseManager.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 ");
|
||||
|
||||
|
||||
@@ -11,10 +11,7 @@ package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -483,7 +480,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 WarehouseManager.depositFromMine(this, resourceIB, this.getModifiedProductionAmount(),this.owningGuild.getOwnedCity().getWarehouse());
|
||||
}
|
||||
|
||||
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {
|
||||
|
||||
+31
-1261
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user