item_wt refactored to template

This commit is contained in:
2024-03-03 15:06:44 -05:00
parent 58652ee32f
commit 4dc0f52295
12 changed files with 101 additions and 120 deletions
+9 -21
View File
@@ -370,7 +370,7 @@ public class ClientMessagePump implements NetMsgHandler {
} else {
if (!itemManager.hasRoomBank(item.getItemBase().getWeight()))
if (!itemManager.hasRoomBank(item.template.item_wt))
return;
if (!itemManager.moveItemToBank(item))
@@ -430,7 +430,7 @@ public class ClientMessagePump implements NetMsgHandler {
// Not gold, process update here
if (!itemManager.hasRoomInventory(item.getItemBase().getWeight()))
if (!itemManager.hasRoomInventory(item.template.item_wt))
return;
if (itemManager.moveItemToInventory(item) == false)
@@ -1224,13 +1224,11 @@ public class ClientMessagePump implements NetMsgHandler {
//get item to sell
ItemBase ib = sell.getItemBase();
if (ib == null)
if (sell.template == null)
return;
if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID != 0)
if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) {
if (!npc.getCharItemManager().hasRoomInventory(sell.template.item_wt)) {
ErrorPopupMsg.sendErrorPopup(player, 21);
return;
@@ -1390,12 +1388,14 @@ public class ClientMessagePump implements NetMsgHandler {
return;
for (MobEquipment me : sellInventory) {
if (me.getObjectUUID() == msg.getItemID()) {
ItemBase ib = me.getItemBase();
if (ib == null)
return;
//test room available for item
if (!itemMan.hasRoomInventory(ib.getWeight()))
if (!itemMan.hasRoomInventory(me.template.item_wt))
return;
int cost = me.getMagicValue();
@@ -1407,10 +1407,8 @@ public class ClientMessagePump implements NetMsgHandler {
if (profit < 1)
profit = 1;
cost *= profit;
if (gold.getNumOfItems() - cost < 0) {
//dont' have enough goldItem exit!
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
@@ -1453,16 +1451,11 @@ public class ClientMessagePump implements NetMsgHandler {
if (buy == null)
return;
ItemBase ib = buy.getItemBase();
if (ib == null)
return;
if (!npcCim.inventoryContains(buy))
return;
//test room available for item
if (!itemMan.hasRoomInventory(ib.getWeight()))
if (!itemMan.hasRoomInventory(buy.template.item_wt))
return;
//TODO test cost and subtract goldItem
@@ -1524,16 +1517,11 @@ public class ClientMessagePump implements NetMsgHandler {
if (buy == null)
return;
ItemBase ib = buy.getItemBase();
if (ib == null)
return;
if (!npcCim.inventoryContains(buy))
return;
//test room available for item
if (!itemMan.hasRoomInventory(ib.getWeight()))
if (!itemMan.hasRoomInventory(buy.template.item_wt))
return;
//TODO test cost and subtract goldItem