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 { @@ -1519,7 +1519,7 @@ public class ClientMessagePump implements NetMsgHandler {
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);
return;
}
@ -1575,7 +1575,7 @@ public class ClientMessagePump implements NetMsgHandler { @@ -1575,7 +1575,7 @@ public class ClientMessagePump implements NetMsgHandler {
b = null;
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);
return;
}

4
src/engine/objects/CharacterItemManager.java

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

Loading…
Cancel
Save