Browse Source

NPC buildings dont run out of gold space on buildings

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
7a7559dee5
  1. 4
      src/engine/net/client/ClientMessagePump.java
  2. 4
      src/engine/objects/CharacterItemManager.java

4
src/engine/net/client/ClientMessagePump.java

@ -1519,7 +1519,7 @@ public class ClientMessagePump implements NetMsgHandler {
int buildingDeposit = cost; int buildingDeposit = cost;
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) { if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206); ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
return; return;
} }
@ -1575,7 +1575,7 @@ public class ClientMessagePump implements NetMsgHandler {
b = null; b = null;
int buildingDeposit = cost; int buildingDeposit = cost;
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) { if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206); ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
return; return;
} }

4
src/engine/objects/CharacterItemManager.java

@ -1399,7 +1399,7 @@ public class CharacterItemManager {
if (buildingCity != null) { if (buildingCity != null) {
buildingCity.transactionLock.writeLock().lock(); buildingCity.transactionLock.writeLock().lock();
try { try {
if (!vendorBuilding.transferGold(buildingDeposit, true)) { if (!vendorBuilding.isOwnerIsNPC() && !vendorBuilding.transferGold(buildingDeposit, true)) {
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
@ -1408,7 +1408,7 @@ public class CharacterItemManager {
} finally { } finally {
buildingCity.transactionLock.writeLock().unlock(); buildingCity.transactionLock.writeLock().unlock();
} }
} else if (!vendorBuilding.transferGold(buildingDeposit, true)) { } else if (!vendorBuilding.isOwnerIsNPC() && !vendorBuilding.transferGold(buildingDeposit, true)) {
return false; return false;
} }
return true; return true;

Loading…
Cancel
Save