|
|
@ -116,7 +116,7 @@ public class ItemFactory { |
|
|
|
city.transactionLock.writeLock().lock(); |
|
|
|
city.transactionLock.writeLock().lock(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
Warehouse cityWarehouse = city.getWarehouse(); |
|
|
|
Warehouse cityWarehouse = city.warehouse; |
|
|
|
|
|
|
|
|
|
|
|
if (cityWarehouse != null && forge.assetIsProtected()) |
|
|
|
if (cityWarehouse != null && forge.assetIsProtected()) |
|
|
|
useWarehouse = true; |
|
|
|
useWarehouse = true; |
|
|
@ -163,7 +163,7 @@ public class ItemFactory { |
|
|
|
|
|
|
|
|
|
|
|
if (overdraft > 0) |
|
|
|
if (overdraft > 0) |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + template.item_base_name); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + " Failed to Create Item." + template.item_base_name); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -431,8 +431,7 @@ public class ItemFactory { |
|
|
|
|
|
|
|
|
|
|
|
if (overdraft > 0 && useWarehouse) |
|
|
|
if (overdraft > 0 && useWarehouse) |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + " Failed to Create Item." + template.item_base_name); |
|
|
|
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + template.item_base_name); |
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -460,7 +459,7 @@ public class ItemFactory { |
|
|
|
|
|
|
|
|
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) { |
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + template.item_base_name); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + " Failed to Create Item." + template.item_base_name); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -484,7 +483,7 @@ public class ItemFactory { |
|
|
|
|
|
|
|
|
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, ibResources, amount, true)) { |
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + template.item_base_name); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + " Failed to Create Item." + template.item_base_name); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -538,7 +537,7 @@ public class ItemFactory { |
|
|
|
if (overdraft > 0) |
|
|
|
if (overdraft > 0) |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
//ChatManager.chatGuildError(pc, "Failed to create Item");
|
|
|
|
Logger.error("Warehouse With UID of " + cityWarehouse.UID + " Failed to Create Item." + template.item_base_name); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + " Failed to Create Item." + template.item_base_name); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -547,7 +546,7 @@ public class ItemFactory { |
|
|
|
if (galvorAmount > 0) { |
|
|
|
if (galvorAmount > 0) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GALVOR, galvorAmount, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GALVOR, galvorAmount, true)) { |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + template.item_base_name); |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + template.item_base_name); |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -555,7 +554,7 @@ public class ItemFactory { |
|
|
|
if (wormwoodAmount > 0) { |
|
|
|
if (wormwoodAmount > 0) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.WORMWOOD, wormwoodAmount, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.WORMWOOD, wormwoodAmount, true)) { |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse!" + template.item_base_name); |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse!" + template.item_base_name); |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -790,7 +789,7 @@ public class ItemFactory { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Warehouse cityWarehouse = city.getWarehouse(); |
|
|
|
Warehouse cityWarehouse = city.warehouse; |
|
|
|
|
|
|
|
|
|
|
|
if (cityWarehouse != null && forge.assetIsProtected()) |
|
|
|
if (cityWarehouse != null && forge.assetIsProtected()) |
|
|
|
useWarehouse = true; |
|
|
|
useWarehouse = true; |
|
|
@ -916,12 +915,12 @@ public class ItemFactory { |
|
|
|
if (overdraft > 0) { |
|
|
|
if (overdraft > 0) { |
|
|
|
if (pc != null) { |
|
|
|
if (pc != null) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, pc, Enum.ResourceType.GOLD, overdraft, false, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, pc, Enum.ResourceType.GOLD, overdraft, false, true)) { |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -967,12 +966,12 @@ public class ItemFactory { |
|
|
|
|
|
|
|
|
|
|
|
if (pc != null) { |
|
|
|
if (pc != null) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, pc, Enum.ResourceType.GOLD, overdraft, false, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, pc, Enum.ResourceType.GOLD, overdraft, false, true)) { |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GOLD, overdraft, true)) { |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -983,7 +982,7 @@ public class ItemFactory { |
|
|
|
//ChatManager.chatGuildInfo(pc, "Withdrawing " + galvorAmount + " galvor from warehouse");
|
|
|
|
//ChatManager.chatGuildInfo(pc, "Withdrawing " + galvorAmount + " galvor from warehouse");
|
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GALVOR, galvorAmount, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.GALVOR, galvorAmount, true)) { |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + template.item_base_name); |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Galvor from warehouse!" + template.item_base_name); |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -992,7 +991,7 @@ public class ItemFactory { |
|
|
|
//ChatManager.chatGuildInfo(pc, "Withdrawing " + wormwoodAmount + " wormwood from warehouse");
|
|
|
|
//ChatManager.chatGuildInfo(pc, "Withdrawing " + wormwoodAmount + " wormwood from warehouse");
|
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.WORMWOOD, wormwoodAmount, true)) { |
|
|
|
if (!Warehouse.withdraw(cityWarehouse, npc, Enum.ResourceType.WORMWOOD, wormwoodAmount, true)) { |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse for " + template.item_base_name); |
|
|
|
ErrorPopupMsg.sendErrorMsg(pc, "Failed to withdraw Wormwood from warehouse for " + template.item_base_name); |
|
|
|
Logger.error("Warehouse with UID of" + cityWarehouse.getObjectUUID() + "Failed to Withdrawl "); |
|
|
|
Logger.error("Warehouse for city " + cityWarehouse.city.getName() + "Failed to Withdrawl "); |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|