forked from MagicBane/Server
Resource Merchant
This commit is contained in:
@@ -1347,8 +1347,10 @@ public class CharacterItemManager {
|
||||
|
||||
Item gold = this.getGoldInventory();
|
||||
|
||||
if (cost <= 0 || (gold.getNumOfItems() - cost) < 0)
|
||||
if (cost <= 0 || (gold.getNumOfItems() - cost) < 0){
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Not Enough Gold");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (this.getOwner() != null && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
@@ -1362,7 +1364,7 @@ public class CharacterItemManager {
|
||||
// if the NPC is not slotted.
|
||||
|
||||
if (vendorBuilding == null) {
|
||||
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Failed To Modify Gold");
|
||||
return this.modifyInventoryGold(-cost);
|
||||
}
|
||||
|
||||
@@ -1374,31 +1376,36 @@ public class CharacterItemManager {
|
||||
if (pc.getClientConnection() != null)
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 206);
|
||||
}
|
||||
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Strongbox Full");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Update strongbox and inventory gold
|
||||
if (!this.modifyInventoryGold(-cost))
|
||||
if (!this.modifyInventoryGold(-cost)) {
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Modify Gold Fail 2");
|
||||
return false;
|
||||
|
||||
}
|
||||
City buildingCity = vendorBuilding.getCity();
|
||||
|
||||
if (buildingCity != null) {
|
||||
buildingCity.transactionLock.writeLock().lock();
|
||||
try {
|
||||
if (!vendorBuilding.transferGold(buildingDeposit, true))
|
||||
if (!vendorBuilding.transferGold(buildingDeposit, true)) {
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Failed Transfer Gold");
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Catch Fail");
|
||||
return false;
|
||||
} finally {
|
||||
buildingCity.transactionLock.writeLock().unlock();
|
||||
}
|
||||
} else if (!vendorBuilding.transferGold(buildingDeposit, true))
|
||||
} else if (!vendorBuilding.transferGold(buildingDeposit, true)) {
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Vendor Building Transfer Gold");
|
||||
return false;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user