Refactor item_type
This commit is contained in:
@@ -219,7 +219,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
|
||||
if (item.containerType == ItemContainerType.INVENTORY && itemManager.isBankOpen())
|
||||
if (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD)) {
|
||||
if (item.template.item_type.equals(engine.Enum.ItemType.GOLD)) {
|
||||
if (!itemManager.moveGoldToBank(item, msg.getNumItems()))
|
||||
return;
|
||||
UpdateGoldMsg goldMes = new UpdateGoldMsg(player);
|
||||
@@ -274,7 +274,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (item.containerType == ItemContainerType.BANK && itemManager.isBankOpen() == false)
|
||||
return;
|
||||
|
||||
if (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD)) {
|
||||
if (item.template.item_type.equals(engine.Enum.ItemType.GOLD)) {
|
||||
|
||||
if (!itemManager.moveGoldToInventory(item, msg.getNumItems()))
|
||||
return;
|
||||
@@ -738,7 +738,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
|
||||
|
||||
if (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD)) {
|
||||
if (item.template.item_type.equals(engine.Enum.ItemType.GOLD)) {
|
||||
// this is done to prevent the temporary goldItem item
|
||||
// (from the mob) from appearing in player's inventory.
|
||||
// It also updates the goldItem quantity display
|
||||
@@ -769,7 +769,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
//TODO send group loot message if player is grouped and visible
|
||||
Group group = GroupManager.getGroup(player);
|
||||
|
||||
if (group != null && group.getSplitGold() && (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD) == false)) {
|
||||
if (group != null && group.getSplitGold() && (item.template.item_type.equals(engine.Enum.ItemType.GOLD) == false)) {
|
||||
String name = item.getName();
|
||||
String text = player.getFirstName() + " has looted " + name + '.';
|
||||
ChatManager.chatGroupInfoCanSee(player, text);
|
||||
@@ -787,7 +787,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD)) {
|
||||
if (item.template.item_type.equals(engine.Enum.ItemType.GOLD)) {
|
||||
// this is done to prevent the temporary goldItem item
|
||||
// (from the mob) from appearing in player's inventory.
|
||||
// It also updates the goldItem quantity display
|
||||
@@ -826,7 +826,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
//TODO send group loot message if player is grouped and visible
|
||||
Group group = GroupManager.getGroup(player);
|
||||
|
||||
if (group != null && group.getSplitGold() && (item.getItemBase().getType().equals(engine.Enum.ItemType.GOLD) == false)) {
|
||||
if (group != null && group.getSplitGold() && (item.template.item_type.equals(engine.Enum.ItemType.GOLD) == false)) {
|
||||
String name = item.getName();
|
||||
String text = player.getFirstName() + " has looted " + name + '.';
|
||||
ChatManager.chatGroupInfoCanSee(player, text);
|
||||
|
||||
@@ -48,9 +48,9 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
// Filter hirelings by slot type
|
||||
|
||||
for (Item hirelings : player.getInventory()) {
|
||||
if (hirelings.getItemBase().getType().equals(ItemType.CONTRACT)) {
|
||||
if (hirelings.template.item_type.equals(ItemType.EMPLOYMENTCONTRACT)) {
|
||||
|
||||
contract = DbManager.ContractQueries.GET_CONTRACT(hirelings.getItemBase().getUUID());
|
||||
contract = DbManager.ContractQueries.GET_CONTRACT(hirelings.templsteID);
|
||||
|
||||
if (contract == null)
|
||||
continue;
|
||||
|
||||
@@ -28,7 +28,6 @@ import engine.net.client.msg.guild.GuildCreationFinalizeMsg;
|
||||
import engine.net.client.msg.guild.GuildInfoMsg;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.util.StringUtils;
|
||||
|
||||
@@ -46,7 +45,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
||||
Enum.GuildCharterType charterType;
|
||||
Guild newGuild;
|
||||
Guild playerGuild;
|
||||
ItemBase itemBase;
|
||||
|
||||
Item charter;
|
||||
Dispatch dispatch;
|
||||
|
||||
@@ -69,16 +68,14 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
itemBase = charter.getItemBase();
|
||||
|
||||
// Item must be a valid charterType (type 10 in db)
|
||||
|
||||
if (itemBase == null || (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)) {
|
||||
if (charter == null || (charter.template.item_type.equals(ItemType.CHARTER) == false)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
charterType = Enum.GuildCharterType.getGuildTypeFromCharter(itemBase);
|
||||
charterType = Enum.GuildCharterType.getGuildTypeFromCharter(charter);
|
||||
|
||||
if (charterType == null) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
if (targetItem == null)
|
||||
return;
|
||||
|
||||
if (targetItem.getItemBase().getType() == ItemType.GOLD)
|
||||
if (targetItem.template.item_type.equals(ItemType.GOLD))
|
||||
return;
|
||||
|
||||
if (!vendor.getCharItemManager().hasRoomInventory(targetItem.template.item_wt)) {
|
||||
@@ -266,7 +266,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
if (targetItem == null)
|
||||
continue;
|
||||
|
||||
if (targetItem.getItemBase().getType() == ItemType.GOLD)
|
||||
if (targetItem.template.item_type.equals(ItemType.GOLD))
|
||||
return;
|
||||
|
||||
if (!vendor.getCharItemManager().doesCharOwnThisItem(targetItem.getObjectUUID()))
|
||||
@@ -281,13 +281,13 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (targetItem.getItemBase().getType()) {
|
||||
case CONTRACT:
|
||||
case GUILDCHARTER:
|
||||
switch (targetItem.template.item_type) {
|
||||
case EMPLOYMENTCONTRACT:
|
||||
case CHARTER:
|
||||
case DEED:
|
||||
case REALMCHARTER:
|
||||
case SCROLL:
|
||||
case TEARS:
|
||||
case POTION:
|
||||
itemValue = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -402,7 +402,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
|
||||
|
||||
if (targetItem.getItemBase().getType() == ItemType.GOLD)
|
||||
if (targetItem.template.item_type.equals(ItemType.GOLD))
|
||||
return;
|
||||
if (vendor.getCharItemManager().inventoryContains(targetItem) == false)
|
||||
return;
|
||||
|
||||
@@ -315,18 +315,13 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (itemMan.doesCharOwnThisItem(item.getObjectUUID())) {
|
||||
|
||||
if (ib.isConsumable() || ib.getType() == ItemType.FARMABLE) {
|
||||
if (ib.isConsumable() || item.template.item_type.equals(ItemType.REAGENT)) {
|
||||
|
||||
int uuid = ib.getUUID();
|
||||
int type = ib.getType().getValue();
|
||||
int uuid = item.templsteID;
|
||||
|
||||
switch (type) {
|
||||
case 27: //Mithril repair
|
||||
break;
|
||||
case 10: //charters
|
||||
//don't think they're handled here?
|
||||
break;
|
||||
case 19: //buildings
|
||||
switch (item.template.item_type) {
|
||||
|
||||
case DEED: //buildings
|
||||
//Call add building screen here, ib.getUseID() get's building ID
|
||||
|
||||
//if inside player city, center loc on tol. otherwise center on player.
|
||||
@@ -352,10 +347,10 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
//itemMan.consume(item); //temporary fix for dupe.. TODO Make Item Unusable after This message is sent.
|
||||
break;
|
||||
case 25: //furniture
|
||||
case FURNITUREDEED: //furniture
|
||||
//Call add furniture screen here. ib.getUseID() get's furniture ID
|
||||
break;
|
||||
case 33:
|
||||
case OFFERING:
|
||||
long shrineCompID = comps.get(1);
|
||||
Building shrineBuilding = BuildingManager.getBuilding((int) shrineCompID);
|
||||
if (shrineBuilding == null) {
|
||||
@@ -381,7 +376,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
break;
|
||||
|
||||
case 35:
|
||||
case REALMCHARTER:
|
||||
int charterType = 0;
|
||||
switch (uuid) {
|
||||
case 910020:
|
||||
@@ -398,7 +393,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
itemMan.consume(item);
|
||||
}
|
||||
break;
|
||||
case 7: //rod of command
|
||||
case WAND: //rod of command
|
||||
long compID = comps.get(1);
|
||||
|
||||
int objectType = AbstractWorldObject.extractTypeID(compID).ordinal();
|
||||
@@ -422,7 +417,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
break;
|
||||
//ANNIVERSERY GIFT
|
||||
case 31:
|
||||
case TREASURE:
|
||||
// *** Disabled for now: Needs bootyset created
|
||||
|
||||
//if (ib.getUUID() == 971012) {
|
||||
@@ -440,13 +435,13 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
// break;
|
||||
//}
|
||||
|
||||
LootManager.peddleFate(player,item);
|
||||
LootManager.peddleFate(player, item);
|
||||
break;
|
||||
|
||||
case 30: //water bucket
|
||||
case 8: //potions, tears of saedron
|
||||
case BUCKET: //water bucket
|
||||
case POTION: //potions, tears of saedron
|
||||
|
||||
case 5: //runes, petition, warrant, scrolls
|
||||
case SCROLL: //runes, petition, warrant, scrolls
|
||||
if (uuid > 3000 && uuid < 3050) { //Discipline Runes
|
||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||
itemMan.consume(item);
|
||||
|
||||
@@ -162,7 +162,7 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
for (Item item : inventory) {
|
||||
if (item.getOwnerID() != ownerID)
|
||||
continue;
|
||||
if (item.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
if (item.template.item_type.equals(ItemType.GOLD)) {
|
||||
if (item.getNumOfItems() == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class UpdateInventoryMsg extends ClientNetMsg {
|
||||
|
||||
|
||||
for (Item item : list) {
|
||||
if (item.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
if (item.template.item_type.equals(ItemType.GOLD)) {
|
||||
if (item.getNumOfItems() == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class UseCharterMsg extends ClientNetMsg {
|
||||
|
||||
if (close) {
|
||||
for (Item i : player.getInventory()) {
|
||||
if (i.getItemBase().getType().equals(ItemType.GUILDCHARTER)) {
|
||||
if (i.template.item_type.equals(ItemType.CHARTER)) {
|
||||
charterUUID = i.getObjectUUID();
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user