|
|
@ -1408,7 +1408,7 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
} |
|
|
|
} |
|
|
|
int cost = me.getMagicValue(); |
|
|
|
int cost = me.getMagicValue(); |
|
|
|
int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID()); |
|
|
|
int resourceCost = Warehouse.getCostForResource(me.getItemBase().getUUID()); |
|
|
|
if(resourceCost != 0) |
|
|
|
if (resourceCost != 0) |
|
|
|
cost = resourceCost; |
|
|
|
cost = resourceCost; |
|
|
|
|
|
|
|
|
|
|
|
float bargain = sourcePlayer.getBargain(); |
|
|
|
float bargain = sourcePlayer.getBargain(); |
|
|
@ -1440,29 +1440,14 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) { |
|
|
|
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) { |
|
|
|
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
|
|
|
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
|
|
|
ChatManager.chatSystemError(sourcePlayer,"Failed To Buy Item"); |
|
|
|
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
buy = Item.createItemForPlayer(sourcePlayer, ib); |
|
|
|
if(ib.getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) { |
|
|
|
if (buy != null) { |
|
|
|
int count = 1; |
|
|
|
me.transferEnchants(buy); |
|
|
|
for(Item item : itemMan.getInventory()){ |
|
|
|
itemMan.addItemToInventory(buy); |
|
|
|
if(item.getItemBaseID() == ib.getUUID()){ |
|
|
|
//itemMan.updateInventory();
|
|
|
|
if(item.getNumOfItems() + count <= Warehouse.getMaxResources().get(ib.getUUID())){ |
|
|
|
|
|
|
|
count += item.getNumOfItems(); |
|
|
|
|
|
|
|
itemMan.delete(item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Item resource = new MobLoot(sourcePlayer,ib,count,false).promoteToItem(sourcePlayer); |
|
|
|
|
|
|
|
itemMan.addItemToInventory(resource); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
buy = Item.createItemForPlayer(sourcePlayer, ib); |
|
|
|
|
|
|
|
if (buy != null) { |
|
|
|
|
|
|
|
me.transferEnchants(buy); |
|
|
|
|
|
|
|
itemMan.addItemToInventory(buy); |
|
|
|
|
|
|
|
//itemMan.updateInventory();
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|