diff --git a/src/engine/net/client/handlers/ObjectActionMsgHandler.java b/src/engine/net/client/handlers/ObjectActionMsgHandler.java index d6ef538e..4cb8542c 100644 --- a/src/engine/net/client/handlers/ObjectActionMsgHandler.java +++ b/src/engine/net/client/handlers/ObjectActionMsgHandler.java @@ -123,6 +123,11 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { if (resourceValue < 15) hasResources = false; + resourceValue = warehouse.getResources().get(Warehouse.mithrilIB); + + if (resourceValue < 1) + hasResources = false; + if (hasResources == false) { ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital return false; @@ -180,6 +185,16 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { return false; } + resourceValue = warehouse.getResources().get(Warehouse.mithrilIB); + + if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 1) == true) { + warehouse.getResources().put(Warehouse.mithrilIB, resourceValue - 1); + warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.MITHRIL, 1); + } else { + Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID()); + return false; + } + realm.claimRealmForCity(city, charterUUID); tol.setRank(8);