Resource Merchant
This commit is contained in:
@@ -1407,6 +1407,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int cost = me.getMagicValue();
|
int cost = me.getMagicValue();
|
||||||
|
int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID());
|
||||||
|
if(resourceCost != 0)
|
||||||
|
cost = resourceCost;
|
||||||
|
|
||||||
float bargain = sourcePlayer.getBargain();
|
float bargain = sourcePlayer.getBargain();
|
||||||
|
|
||||||
|
|||||||
@@ -1348,7 +1348,7 @@ public class CharacterItemManager {
|
|||||||
Item gold = this.getGoldInventory();
|
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");
|
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Not Enough Gold: " + "COST: " + cost);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1364,7 +1364,6 @@ public class CharacterItemManager {
|
|||||||
// if the NPC is not slotted.
|
// if the NPC is not slotted.
|
||||||
|
|
||||||
if (vendorBuilding == null) {
|
if (vendorBuilding == null) {
|
||||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Failed To Modify Gold");
|
|
||||||
return this.modifyInventoryGold(-cost);
|
return this.modifyInventoryGold(-cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1376,14 +1375,12 @@ public class CharacterItemManager {
|
|||||||
if (pc.getClientConnection() != null)
|
if (pc.getClientConnection() != null)
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 206);
|
ErrorPopupMsg.sendErrorPopup(pc, 206);
|
||||||
}
|
}
|
||||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Strongbox Full");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update strongbox and inventory gold
|
// Update strongbox and inventory gold
|
||||||
if (!this.modifyInventoryGold(-cost)) {
|
if (!this.modifyInventoryGold(-cost)) {
|
||||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Modify Gold Fail 2");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
City buildingCity = vendorBuilding.getCity();
|
City buildingCity = vendorBuilding.getCity();
|
||||||
@@ -1392,18 +1389,15 @@ public class CharacterItemManager {
|
|||||||
buildingCity.transactionLock.writeLock().lock();
|
buildingCity.transactionLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
if (!vendorBuilding.transferGold(buildingDeposit, true)) {
|
if (!vendorBuilding.transferGold(buildingDeposit, true)) {
|
||||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Failed Transfer Gold");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Catch Fail");
|
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
buildingCity.transactionLock.writeLock().unlock();
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user