diff --git a/changelog.txt b/changelog.txt index 938c58927..800eefa33 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 05/21/2016 == +Uleat: Moved struct Item_Struct into namespace EQEmu along with associated enumerations - enumerations into namespace EQEmu::item (run shared_memory) +Uleat: Fixed a few possible crash points in linux builds associated with augments/ornamentations + == 05/18/2016 == Uleat: Changed client 'constants' files to 'limits' diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 8c5ac6db7..5c4f364a9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -37,6 +37,7 @@ SET(common_sources inventory_version.cpp ipc_mutex.cpp item.cpp + item_struct.cpp light_source.cpp md5.cpp memory_mapped_file.cpp diff --git a/common/client_version.cpp b/common/client_version.cpp index a9cb02a0b..b812e8744 100644 --- a/common/client_version.cpp +++ b/common/client_version.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) diff --git a/common/client_version.h b/common/client_version.h index 86d9ebcab..a04e5c10b 100644 --- a/common/client_version.h +++ b/common/client_version.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) @@ -70,7 +70,9 @@ namespace EQEmu extern uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version); extern ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit); extern uint32 ConvertClientVersionToExpansion(ClientVersion client_version); - } -} + + } /*versions*/ -#endif /* COMMON_CLIENT_VERSION_H */ +} /*EQEmu*/ + +#endif /*COMMON_CLIENT_VERSION_H*/ diff --git a/common/emu_constants.h b/common/emu_constants.h index a012e8534..6c7f3e962 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) diff --git a/common/eq_constants.h b/common/eq_constants.h index a7dcf6d00..54f52620c 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -1,4 +1,5 @@ /* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -13,337 +14,16 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef EQ_CONSTANTS_H -#define EQ_CONSTANTS_H + +#ifndef COMMON_EQ_CONSTANTS_H +#define COMMON_EQ_CONSTANTS_H #include "skills.h" #include "types.h" -/* -** Item attributes -** -** (There are no grepwin hits other than these declarations... Do they have a use?) -*/ -enum ItemAttributes : uint32 -{ - ItemAttrNone = 0x00000000, - ItemAttrLore = 0x00000001, - ItemAttrArtifact = 0x00000002, - ItemAttrSummoned = 0x00000004, - ItemAttrMagic = 0x00000008, - ItemAttrAugment = 0x00000010, - ItemAttrPendingLore = 0x00000020, - ItemAttrUnknown = 0xFFFFFFFF -}; - -/* -** Item class types -** -*/ -enum ItemClassTypes -{ - ItemClassCommon = 0, - ItemClassContainer, - ItemClassBook, - _ItemClassCount -}; - -/* -** Item use types -** -** (ref: database and eqstr_us.txt) -** -** (Looking at a recent database, it's possible that some of the item values may be off [10-27-2013]) -*/ -enum ItemUseTypes : uint8 -{ -/*9138*/ ItemType1HSlash = 0, -/*9141*/ ItemType2HSlash, -/*9140*/ ItemType1HPiercing, -/*9139*/ ItemType1HBlunt, -/*9142*/ ItemType2HBlunt, -/*5504*/ ItemTypeBow, // 5 -/*----*/ ItemTypeUnknown1, -/*----*/ ItemTypeLargeThrowing, -/*5505*/ ItemTypeShield, -/*5506*/ ItemTypeScroll, -/*5507*/ ItemTypeArmor, // 10 -/*5508*/ ItemTypeMisc, // a lot of random crap has this item use. -/*7564*/ ItemTypeLockPick, -/*----*/ ItemTypeUnknown2, -/*5509*/ ItemTypeFood, -/*5510*/ ItemTypeDrink, // 15 -/*5511*/ ItemTypeLight, -/*5512*/ ItemTypeCombinable, // not all stackable items are this use... -/*5513*/ ItemTypeBandage, -/*----*/ ItemTypeSmallThrowing, -/*----*/ ItemTypeSpell, // 20 // spells and tomes -/*5514*/ ItemTypePotion, -/*----*/ ItemTypeUnknown3, -/*0406*/ ItemTypeWindInstrument, -/*0407*/ ItemTypeStringedInstrument, -/*0408*/ ItemTypeBrassInstrument, // 25 -/*0405*/ ItemTypePercussionInstrument, -/*5515*/ ItemTypeArrow, -/*----*/ ItemTypeUnknown4, -/*5521*/ ItemTypeJewelry, -/*----*/ ItemTypeSkull, // 30 -/*5516*/ ItemTypeBook, // skill-up tomes/books? (would probably need a pp flag if true...) -/*5517*/ ItemTypeNote, -/*5518*/ ItemTypeKey, -/*----*/ ItemTypeCoin, -/*5520*/ ItemType2HPiercing, // 35 -/*----*/ ItemTypeFishingPole, -/*----*/ ItemTypeFishingBait, -/*5519*/ ItemTypeAlcohol, -/*----*/ ItemTypeKey2, // keys and satchels?? (questable keys?) -/*----*/ ItemTypeCompass, // 40 -/*----*/ ItemTypeUnknown5, -/*----*/ ItemTypePoison, // might be wrong, but includes poisons -/*----*/ ItemTypeUnknown6, -/*----*/ ItemTypeUnknown7, -/*5522*/ ItemTypeMartial, // 45 -/*----*/ ItemTypeUnknown8, -/*----*/ ItemTypeUnknown9, -/*----*/ ItemTypeUnknown10, -/*----*/ ItemTypeUnknown11, -/*----*/ ItemTypeSinging, // 50 -/*5750*/ ItemTypeAllInstrumentTypes, -/*5776*/ ItemTypeCharm, -/*----*/ ItemTypeDye, -/*----*/ ItemTypeAugmentation, -/*----*/ ItemTypeAugmentationSolvent, // 55 -/*----*/ ItemTypeAugmentationDistiller, -/*----*/ ItemTypeUnknown12, -/*----*/ ItemTypeFellowshipKit, -/*----*/ ItemTypeUnknown13, -/*----*/ ItemTypeRecipe, // 60 -/*----*/ ItemTypeAdvancedRecipe, -/*----*/ ItemTypeJournal, // only one(1) database entry -/*----*/ ItemTypeAltCurrency, // alt-currency (as opposed to coinage) -/*5881*/ ItemTypePerfectedAugmentationDistiller, -/*----*/ _ItemTypeCount - -/* - Unknowns: - - Mounts? - Ornamentations? - GuildBanners? - Collectible? - Placeable? - (others?) -*/ -}; - -/* -** Augmentation use type bitmasks (1-based) -** -** (ref: dbstr_us.txt) -** -*/ -enum AugmentationUseTypeBitmasks : uint32 { - AugUseNone = 0x00000000, - AugUseGeneralSingleStat = 0x00000001, /*1^16^1 (General: Single Stat)^0*/ - AugUseGeneralMultipleStat = 0x00000002, /*2^16^2 (General: Multiple Stat)^0*/ - AugUseGeneralSpellEffect = 0x00000004, /*3^16^3 (General: Spell Effect)^0*/ - AugUseWeaponGeneral = 0x00000008, /*4^16^4 (Weapon: General)^0*/ - AugUseWeaponElemDamage = 0x00000010, /*5^16^5 (Weapon: Elem Damage)^0*/ - AugUseWeaponBaseDamage = 0x00000020, /*6^16^6 (Weapon: Base Damage)^0*/ - AugUseGeneralGroup = 0x00000040, /*7^16^7 (General: Group)^0*/ - AugUseGeneralRaid = 0x00000080, /*8^16^8 (General: Raid)^0*/ - AugUseGeneralDragonsPoints = 0x00000100, /*9^16^9 (General: Dragons Points)^0*/ - AugUseCraftedCommon = 0x00000200, /*10^16^10 (Crafted: Common)^0*/ - AugUseCraftedGroup1 = 0x00000400, /*11^16^11 (Crafted: Group)^0*/ - AugUseCraftedRaid1 = 0x00000800, /*12^16^12 (Crafted: Raid)^0*/ - AugUseEnergeiacGroup = 0x00001000, /*13^16^13 (Energeiac: Group)^0*/ - AugUseEnergeiacRaid = 0x00002000, /*14^16^14 (Energeiac: Raid)^0*/ - AugUseEmblem = 0x00004000, /*15^16^15 (Emblem)^0*/ - AugUseCraftedGroup2 = 0x00008000, /*16^16^16 (Crafted: Group)^0*/ - AugUseCraftedRaid2 = 0x00010000, /*17^16^17 (Crafted: Raid)^0*/ - AugUseUnknown1 = 0x00020000, /*18^16^18^0*/ - AugUseUnknown2 = 0x00040000, /*19^16^19^0*/ - AugUseOrnamentation = 0x00080000, /*20^16^20 (Ornamentation)^0*/ - AugUseSpecialOrnamentation = 0x00100000, /*21^16^21 (Special Ornamentation)^0*/ - AugUseUnknown3 = 0x00200000, /*22^16^22^0*/ - AugUseUnknown4 = 0x00400000, /*23^16^23^0*/ - AugUseUnknown5 = 0x00800000, /*24^16^24^0*/ - AugUseUnknown6 = 0x01000000, /*25^16^25^0*/ - AugUseUnknown7 = 0x02000000, /*26^16^26^0*/ - AugUseUnknown8 = 0x04000000, /*27^16^27^0*/ - AugUseUnknown9 = 0x08000000, /*28^16^28^0*/ - AugUseUnknown10 = 0x10000000, /*29^16^29^0*/ - AugUseEpic25 = 0x20000000, /*30^16^30^0*/ - AugUseTest = 0x40000000, /*31^16^Test^0*/ // listed as 31^16^31^0 in 5-10 client - AugUseAll = 0xFFFFFFFF -}; - -/* -** Augmentation use types (enumerated) -** -*/ -enum AugmentationUseTypes : uint8 { - AugTypeNone = 0, - AugTypeGeneralSingleStat, - AugTypeGeneralMultipleStat, - AugTypeGeneralSpellEffect, - AugTypeWeaponGeneral, - AugTypeWeaponElemDamage, // 5 - AugTypeWeaponBaseDamage, - AugTypeGeneralGroup, - AugTypeGeneralRaid, - AugTypeGeneralDragonsPoints, - AugTypeCraftedCommon, // 10 - AugTypeCraftedGroup1, - AugTypeCraftedRaid1, - AugTypeEnergeiacGroup, - AugTypeEnergeiacRaid, - AugTypeEmblem, // 15 - AugTypeCraftedGroup2, - AugTypeCraftedRaid2, - AugTypeUnknown1, - AugTypeUnknown2, - AugTypeOrnamentation, // 20 - AugTypeSpecialOrnamentation, - AugTypeUnknown3, - AugTypeUnknown4, - AugTypeUnknown5, - AugTypeUnknown6, // 25 - AugTypeUnknown7, - AugTypeUnknown8, - AugTypeUnknown9, - AugTypeUnknown10, - AugTypeEpic25, // 30 - AugTypeTest, - _AugTypeCount, - AugTypeAll = 255 -}; - -/* -** Augmentation restriction types (in-work) -** -** (ref: eqstr_us.txt) -** -*/ -enum AugmentationRestrictionTypes : uint8 { -/*4690*/ AugRestrAny = 0, -/*9134*/ AugRestrArmor, -/*9135*/ AugRestrWeapons, -/*9136*/ AugRestr1HWeapons, -/*9137*/ AugRestr2HWeapons, -/*9138*/ AugRestr1HSlash, // 5 -/*9139*/ AugRestr1HBlunt, -/*9140*/ AugRestrPiercing, -/*9148*/ AugRestrHandToHand, -/*9141*/ AugRestr2HSlash, -/*9142*/ AugRestr2HBlunt, // 10 -/*9143*/ AugRestr2HPierce, -/*9144*/ AugRestrBows, -/*9145*/ AugRestrShields, -/*8052*/ AugRestr1HSlash1HBluntOrHandToHand, -/*9200*/ AugRestr1HBluntOrHandToHand, // 15 // no listed peq entries - -// these three appear to be post-RoF (12-10-2012) and can not be verified until RoF (05-10-2013) is supported -/*????*/ AugRestrUnknown1, -/*????*/ AugRestrUnknown2, -/*????*/ AugRestrUnknown3, // last value in peq entries - _AugRestrCount - -/*4687*/ //AugTypeAllItems, // ?? unknown atm -/*4688*/ //AugTypePrestige, // ?? unknown atm -/*4689*/ //AugTypeNonPrestige, // ?? unknown atm -}; - -/* -** Container use types -** -** This correlates to world 'object.type' (object.h/Object.cpp) as well as Item_Struct.BagType -** -** (ref: database, web forums and eqstr_us.txt) -*/ -enum ContainerUseTypes : uint8 -{ -/*3400*/ BagTypeSmallBag = 0, -/*3401*/ BagTypeLargeBag, -/*3402*/ BagTypeQuiver, -/*3403*/ BagTypeBeltPouch, -/*3404*/ BagTypeWristPouch, -/*3405*/ BagTypeBackPack, // 5 -/*3406*/ BagTypeSmallChest, -/*3407*/ BagTypeLargeChest, -/*----*/ BagTypeBandolier, // <*Database Reference Only> -/*3408*/ BagTypeMedicineBag, -/*3409*/ BagTypeToolBox, // 10 -/*3410*/ BagTypeLexicon, -/*3411*/ BagTypeMortar, -/*3412*/ BagTypeSelfDusting, // Quest container (Auto-clear contents?) -/*3413*/ BagTypeMixingBowl, -/*3414*/ BagTypeOven, // 15 -/*3415*/ BagTypeSewingKit, -/*3416*/ BagTypeForge, -/*3417*/ BagTypeFletchingKit, -/*3418*/ BagTypeBrewBarrel, -/*3419*/ BagTypeJewelersKit, // 20 -/*3420*/ BagTypePotteryWheel, -/*3421*/ BagTypeKiln, -/*3422*/ BagTypeKeymaker, // (no database entries as of peq rev 69) -/*3423*/ BagTypeWizardsLexicon, -/*3424*/ BagTypeMagesLexicon, // 25 -/*3425*/ BagTypeNecromancersLexicon, -/*3426*/ BagTypeEnchantersLexicon, -/*----*/ BagTypeUnknown1, // (a coin pouch/purse?) (no database entries as of peq rev 69) -/*----*/ BagTypeConcordanceofResearch, // <*Database Reference Only> -/*3427*/ BagTypeAlwaysWorks, // 30 // Quest container (Never-fail combines?) -/*3428*/ BagTypeKoadaDalForge, // High Elf -/*3429*/ BagTypeTeirDalForge, // Dark Elf -/*3430*/ BagTypeOggokForge, // Ogre -/*3431*/ BagTypeStormguardForge, // Dwarf -/*3432*/ BagTypeAkanonForge, // 35 // Gnome -/*3433*/ BagTypeNorthmanForge, // Barbarian -/*----*/ BagTypeUnknown2, // (no database entries as of peq rev 69) -/*3434*/ BagTypeCabilisForge, // Iksar -/*3435*/ BagTypeFreeportForge, // Human 1 -/*3436*/ BagTypeRoyalQeynosForge, // 40 // Human 2 -/*3439*/ BagTypeHalflingTailoringKit, -/*3438*/ BagTypeErudTailoringKit, -/*3440*/ BagTypeFierDalTailoringKit, // Wood Elf -/*3441*/ BagTypeFierDalFletchingKit, // Wood Elf -/*3437*/ BagTypeIksarPotteryWheel, // 45 -/*3442*/ BagTypeTackleBox, -/*3443*/ BagTypeTrollForge, -/*3445*/ BagTypeFierDalForge, // Wood Elf -/*3444*/ BagTypeValeForge, // Halfling -/*3446*/ BagTypeErudForge, // 50 -/*----*/ BagTypeTradersSatchel, // <*Database Reference Only> (db: Yellow Trader's Satchel Token?) -/*5785*/ BagTypeGuktaForge, // Froglok (no database entries as of peq rev 69) -/*3359*/ BagTypeAugmentationSealer, -/*----*/ BagTypeIceCreamChurn, // <*Database Reference Only> -/*6325*/ BagTypeTransformationmold, // 55 // Ornamentation -/*6340*/ BagTypeDetransformationmold, // Ornamentation Stripper -/*5400*/ BagTypeUnattuner, -/*7684*/ BagTypeTradeskillBag, -/*7692*/ BagTypeCollectibleBag, -/*----*/ _BagTypeCount -}; - -/* -** Item Effect Types -** -*/ -enum { - ET_CombatProc = 0, - ET_ClickEffect = 1, - ET_WornEffect = 2, - ET_Expendable = 3, - ET_EquipClick = 4, - ET_ClickEffect2 = 5, //name unknown - ET_Focus = 6, - ET_Scroll = 7 -}; - //SpawnAppearance types: (compared two clients for server-originating types: SoF & RoF2) #define AT_Die 0 // this causes the client to keel over and zone to bind point (default action) #define AT_WhoLevel 1 // the level that shows up on /who @@ -848,4 +528,4 @@ static const uint8 SkillDamageTypes[HIGHEST_SKILL + 1] = // change to _SkillServ static const uint32 MAX_SPELL_DB_ID_VAL = 65535; -#endif +#endif /*COMMON_EQ_CONSTANTS_H*/ diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 2e470714b..0075f0cf0 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -2098,7 +2098,7 @@ struct AdventureLeaderboard_Struct /*struct Item_Shop_Struct { uint16 merchantid; uint8 itemtype; - Item_Struct item; + EQEmu::Item_Struct item; uint8 iss_unknown001[6]; };*/ diff --git a/common/inventory_version.cpp b/common/inventory_version.cpp index bc93e1408..13573eb68 100644 --- a/common/inventory_version.cpp +++ b/common/inventory_version.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) diff --git a/common/inventory_version.h b/common/inventory_version.h index 07ad991ff..61762e5bc 100644 --- a/common/inventory_version.h +++ b/common/inventory_version.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) @@ -55,7 +55,9 @@ namespace EQEmu extern const char* InventoryVersionName(InventoryVersion inventory_version); extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version); extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version); - } -} + + } /*versions*/ -#endif /* COMMON_INVENTORY_VERSION_H */ +} /*EQEmu*/ + +#endif /*COMMON_INVENTORY_VERSION_H*/ diff --git a/common/item.cpp b/common/item.cpp index 25bf7d886..c00f137db 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -187,35 +187,35 @@ ItemInst* Inventory::GetItem(int16 slot_id) const else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { // Trade bag slots ItemInst* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { // Shared Bank bag slots ItemInst* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { // Bank bag slots ItemInst* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { // Cursor bag slots ItemInst* inst = m_cursor.peek_front(); - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { // Personal inventory bag slots ItemInst* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } @@ -359,7 +359,7 @@ ItemInst* Inventory::PopItem(int16 slot_id) else { // Is slot inside bag? ItemInst* baginst = GetItem(Inventory::CalcSlotId(slot_id)); - if (baginst != nullptr && baginst->IsType(ItemClassContainer)) { + if (baginst != nullptr && baginst->IsClassBag()) { p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); } } @@ -368,7 +368,7 @@ ItemInst* Inventory::PopItem(int16 slot_id) return p; } -bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { +bool Inventory::HasSpaceForItem(const EQEmu::Item_Struct *ItemToTry, int16 Quantity) { if (ItemToTry->Stackable) { @@ -386,7 +386,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { Quantity -= ChargeSlotsLeft; } - if (InvItem && InvItem->IsType(ItemClassContainer)) { + if (InvItem && InvItem->IsClassBag()) { int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); uint8 BagSize = InvItem->GetItem()->BagSlots; @@ -430,7 +430,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { } } - else if (InvItem->IsType(ItemClassContainer) && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { + else if (InvItem->IsClassBag() && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); @@ -624,9 +624,9 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo if (!for_bag) { for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { const ItemInst* inst = GetItem(i); - if (inst && inst->IsType(ItemClassContainer) && inst->GetItem()->BagSize >= min_size) + if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size) { - if (inst->GetItem()->BagType == BagTypeQuiver && inst->GetItem()->ItemType != ItemTypeArrow) + if (inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver && inst->GetItem()->ItemType != EQEmu::item::ItemTypeArrow) { continue; } @@ -666,7 +666,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { return INVALID_INDEX; // step 1: find room for bags (caller should really ask for slots for bags first to avoid sending them to cursor..and bag item loss) - if (inst->IsType(ItemClassContainer)) { + if (inst->IsClassBag()) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { if (!m_inv[free_slot]) return free_slot; @@ -693,7 +693,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { if (!main_inst) continue; - if (main_inst->IsType(ItemClassContainer)) { // if item-specific containers already have bad items, we won't fix it here... + if (main_inst->IsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { const ItemInst* sub_inst = main_inst->GetItem(free_bag_slot); @@ -708,11 +708,11 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { } // step 3a: find room for container-specific items (ItemClassArrow) - if (inst->GetItem()->ItemType == ItemTypeArrow) { + if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { const ItemInst* main_inst = m_inv[free_slot]; - if (!main_inst || (main_inst->GetItem()->BagType != BagTypeQuiver) || !main_inst->IsType(ItemClassContainer)) + if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeQuiver) || !main_inst->IsClassBag()) continue; for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { @@ -723,11 +723,11 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { } // step 3b: find room for container-specific items (ItemClassSmallThrowing) - if (inst->GetItem()->ItemType == ItemTypeSmallThrowing) { + if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { const ItemInst* main_inst = m_inv[free_slot]; - if (!main_inst || (main_inst->GetItem()->BagType != BagTypeBandolier) || !main_inst->IsType(ItemClassContainer)) + if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeBandolier) || !main_inst->IsClassBag()) continue; for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { @@ -748,8 +748,8 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { const ItemInst* main_inst = m_inv[free_slot]; - if (main_inst && main_inst->IsType(ItemClassContainer)) { - if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == BagTypeBandolier) || (main_inst->GetItem()->BagType == BagTypeQuiver)) + if (main_inst && main_inst->IsClassBag()) { + if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeBandolier) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver)) continue; for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { @@ -901,7 +901,7 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) } } -bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_Struct *Container) { +bool Inventory::CanItemFitInContainer(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container) { if (!ItemToTry || !Container) return false; @@ -909,10 +909,10 @@ bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_S if (ItemToTry->Size > Container->BagSize) return false; - if ((Container->BagType == BagTypeQuiver) && (ItemToTry->ItemType != ItemTypeArrow)) + if ((Container->BagType == EQEmu::item::BagTypeQuiver) && (ItemToTry->ItemType != EQEmu::item::ItemTypeArrow)) return false; - if ((Container->BagType == BagTypeBandolier) && (ItemToTry->ItemType != ItemTypeSmallThrowing)) + if ((Container->BagType == EQEmu::item::BagTypeBandolier) && (ItemToTry->ItemType != EQEmu::item::ItemTypeSmallThrowing)) return false; return true; @@ -1019,7 +1019,7 @@ uint8 Inventory::FindBrightestLightType() auto item = inst->GetItem(); if (item == nullptr) { continue; } - if (item->ItemClass != ItemClassCommon) { continue; } + if (!item->IsClassCommon()) { continue; } if (item->Light < 9 || item->Light > 13) { continue; } if (EQEmu::lightsource::TypeToLevel(item->Light)) @@ -1071,7 +1071,7 @@ int Inventory::GetSlotByItemInstCollection(const std::map &col return iter->first; } - if (t_inst && !t_inst->IsType(ItemClassContainer)) { + if (t_inst && !t_inst->IsClassBag()) { for (auto b_iter = t_inst->_cbegin(); b_iter != t_inst->_cend(); ++b_iter) { if (b_iter->second == inst) { return Inventory::CalcSlotId(iter->first, b_iter->first); @@ -1099,7 +1099,7 @@ void Inventory::dumpItemCollection(const std::map &collection) void Inventory::dumpBagContents(ItemInst *inst, std::map::const_iterator *it) { - if (!inst || !inst->IsType(ItemClassContainer)) + if (!inst || !inst->IsClassBag()) return; // Go through bag, if bag @@ -1177,7 +1177,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) // Slot must be within a bag parentSlot = Inventory::CalcSlotId(slot_id); ItemInst* baginst = GetItem(parentSlot); // Get parent bag - if (baginst && baginst->IsType(ItemClassContainer)) + if (baginst && baginst->IsClassBag()) { baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); result = slot_id; @@ -1212,7 +1212,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, ui return EQEmu::legacy::SLOT_AUGMENT; } - if (!inst->IsType(ItemClassContainer)) { continue; } + if (!inst->IsClassBag()) { continue; } for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { auto bag_inst = bag_iter->second; @@ -1260,7 +1260,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) return EQEmu::legacy::SLOT_AUGMENT; } - if (!inst->IsType(ItemClassContainer)) { continue; } + if (!inst->IsClassBag()) { continue; } for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { auto bag_inst = bag_iter->second; @@ -1294,19 +1294,19 @@ int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, ui auto inst = iter->second; if (inst == nullptr) { continue; } - if (inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { + if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) return iter->first; } - if (!inst->IsType(ItemClassContainer)) { continue; } + if (!inst->IsClassBag()) { continue; } for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { auto bag_inst = bag_iter->second; if (bag_inst == nullptr) { continue; } - if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->ItemType == use) { + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) return Inventory::CalcSlotId(iter->first, bag_iter->first); @@ -1326,19 +1326,19 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) auto inst = *iter; if (inst == nullptr) { continue; } - if (inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { + if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) return EQEmu::legacy::SlotCursor; } - if (!inst->IsType(ItemClassContainer)) { continue; } + if (!inst->IsClassBag()) { continue; } for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { auto bag_inst = bag_iter->second; if (bag_inst == nullptr) { continue; } - if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->ItemType == use) { + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) return Inventory::CalcSlotId(EQEmu::legacy::SlotCursor, bag_iter->first); @@ -1369,13 +1369,13 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 return EQEmu::legacy::SLOT_AUGMENT; } - if (!inst->IsType(ItemClassContainer)) { continue; } + if (!inst->IsClassBag()) { continue; } for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { auto bag_inst = bag_iter->second; if (bag_inst == nullptr) { continue; } - if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->LoreGroup == loregroup) + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(iter->first, bag_iter->first); for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { @@ -1409,13 +1409,13 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) return EQEmu::legacy::SLOT_AUGMENT; } - if (!inst->IsType(ItemClassContainer)) { continue; } + if (!inst->IsClassBag()) { continue; } for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { auto bag_inst = bag_iter->second; if (bag_inst == nullptr) { continue; } - if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->LoreGroup == loregroup) + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(EQEmu::legacy::SlotCursor, bag_iter->first); for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { @@ -1438,10 +1438,10 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) // // class ItemInst // -ItemInst::ItemInst(const Item_Struct* item, int16 charges) { +ItemInst::ItemInst(const EQEmu::Item_Struct* item, int16 charges) { m_use_type = ItemInstNormal; if(item) { - m_item = new Item_Struct(*item); + m_item = new EQEmu::Item_Struct(*item); } else { m_item = nullptr; } @@ -1449,7 +1449,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) { m_price = 0; m_attuned = false; m_merchantslot = 0; - if(m_item &&m_item->ItemClass == ItemClassCommon) + if (m_item && m_item->IsClassCommon()) m_color = m_item->Color; else m_color = 0; @@ -1472,7 +1472,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { m_use_type = ItemInstNormal; m_item = db->GetItem(item_id); if(m_item) { - m_item = new Item_Struct(*m_item); + m_item = new EQEmu::Item_Struct(*m_item); } else { m_item = nullptr; @@ -1482,7 +1482,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { m_price = 0; m_merchantslot = 0; m_attuned=false; - if(m_item && m_item->ItemClass == ItemClassCommon) + if (m_item && m_item->IsClassCommon()) m_color = m_item->Color; else m_color = 0; @@ -1527,7 +1527,7 @@ ItemInst::ItemInst(const ItemInst& copy) { m_use_type=copy.m_use_type; if(copy.m_item) - m_item = new Item_Struct(*copy.m_item); + m_item = new EQEmu::Item_Struct(*copy.m_item); else m_item = nullptr; @@ -1563,7 +1563,7 @@ ItemInst::ItemInst(const ItemInst& copy) m_evolveLvl = copy.m_evolveLvl; m_activated = copy.m_activated; if (copy.m_scaledItem) - m_scaledItem = new Item_Struct(*copy.m_scaledItem); + m_scaledItem = new EQEmu::Item_Struct(*copy.m_scaledItem); else m_scaledItem = nullptr; @@ -1589,12 +1589,12 @@ ItemInst::~ItemInst() } // Query item type -bool ItemInst::IsType(ItemClassTypes item_class) const +bool ItemInst::IsType(EQEmu::item::ItemClass item_class) const { // IsType() does not protect against 'm_item = nullptr' // Check usage type - if ((m_use_type == ItemInstWorldContainer) && (item_class == ItemClassContainer)) + if ((m_use_type == ItemInstWorldContainer) && (item_class == EQEmu::item::ItemClassBag)) return true; if (!m_item) @@ -1603,6 +1603,21 @@ bool ItemInst::IsType(ItemClassTypes item_class) const return (m_item->ItemClass == item_class); } +bool ItemInst::IsClassCommon() +{ + return (m_item && m_item->IsClassCommon()); +} + +bool ItemInst::IsClassBag() +{ + return (m_item && m_item->IsClassBag()); +} + +bool ItemInst::IsClassBook() +{ + return (m_item && m_item->IsClassBook()); +} + // Is item stackable? bool ItemInst::IsStackable() const { @@ -1667,7 +1682,7 @@ bool ItemInst::IsAugmentable() const bool ItemInst::AvailableWearSlot(uint32 aug_wear_slots) const { // TODO: check to see if incoming 'aug_wear_slots' "switches" bit assignments like above... // (if wrong, would only affect MainAmmo and MainPowerSource augments) - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return false; int index = EQEmu::legacy::EQUIPMENT_BEGIN; @@ -1683,7 +1698,7 @@ bool ItemInst::AvailableWearSlot(uint32 aug_wear_slots) const { int8 ItemInst::AvailableAugmentSlot(int32 augtype) const { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return INVALID_INDEX; int index = AUG_INDEX_BEGIN; @@ -1698,7 +1713,7 @@ int8 ItemInst::AvailableAugmentSlot(int32 augtype) const bool ItemInst::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return false; if ((!GetItem(slot) && m_item->AugSlotVisible[slot]) && augtype == -1 || (m_item->AugSlotType[slot] && ((1 << (m_item->AugSlotType[slot] - 1)) & augtype))) { @@ -1783,7 +1798,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) continue; } - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (item == nullptr) { cur = m_contents.erase(cur); continue; @@ -1848,7 +1863,7 @@ uint8 ItemInst::GetTotalItemCount() const { uint8 item_count = 1; - if (m_item && m_item->ItemClass != ItemClassContainer) { return item_count; } + if (m_item && !m_item->IsClassBag()) { return item_count; } for (int index = SUB_INDEX_BEGIN; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } @@ -1857,7 +1872,7 @@ uint8 ItemInst::GetTotalItemCount() const bool ItemInst::IsNoneEmptyContainer() { - if (!m_item || m_item->ItemClass != ItemClassContainer) + if (!m_item || !m_item->IsClassBag()) return false; for (int index = SUB_INDEX_BEGIN; index < m_item->BagSlots; ++index) { @@ -1871,7 +1886,7 @@ bool ItemInst::IsNoneEmptyContainer() // Retrieve augment inside item ItemInst* ItemInst::GetAugment(uint8 slot) const { - if (m_item && m_item->ItemClass == ItemClassCommon) + if (m_item && m_item->IsClassCommon()) return GetItem(slot); return nullptr; @@ -1879,7 +1894,7 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const ItemInst* ItemInst::GetOrnamentationAug(int32 ornamentationAugtype) const { - if (!m_item || m_item->ItemClass != ItemClassCommon) { return nullptr; } + if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (ornamentationAugtype == 0) { return nullptr; } for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) @@ -1916,7 +1931,7 @@ uint32 ItemInst::GetOrnamentHeroModel(int32 material_slot) const { } bool ItemInst::UpdateOrnamentationInfo() { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return false; bool ornamentSet = false; @@ -1924,7 +1939,7 @@ bool ItemInst::UpdateOrnamentationInfo() { int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); if (GetOrnamentationAug(ornamentationAugtype)) { - const Item_Struct* ornamentItem; + const EQEmu::Item_Struct* ornamentItem; ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem(); if (ornamentItem != nullptr) { @@ -1951,10 +1966,10 @@ bool ItemInst::UpdateOrnamentationInfo() { return ornamentSet; } -bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll) { +bool ItemInst::CanTransform(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container, bool AllowAll) { if (!ItemToTry || !Container) return false; - if (ItemToTry->ItemType == ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) + if (ItemToTry->ItemType == EQEmu::item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) return false; if (AllowAll && strncasecmp(Container->CharmFile, "ITEMTRANSFIGSHIELD", 18) && strncasecmp(Container->CharmFile, "ITEMTransfigBow", 15)) { @@ -1999,7 +2014,7 @@ bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Con uint32 ItemInst::GetAugmentItemID(uint8 slot) const { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return NO_ITEM; return GetItemID(slot); @@ -2008,7 +2023,7 @@ uint32 ItemInst::GetAugmentItemID(uint8 slot) const // Add an augment to the item void ItemInst::PutAugment(uint8 slot, const ItemInst& augment) { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return; PutItem(slot, augment); @@ -2029,7 +2044,7 @@ void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) // Remove augment from item and destroy it void ItemInst::DeleteAugment(uint8 index) { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return; DeleteItem(index); @@ -2038,7 +2053,7 @@ void ItemInst::DeleteAugment(uint8 index) // Remove augment from item and return it ItemInst* ItemInst::RemoveAugment(uint8 index) { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return nullptr; return PopItem(index); @@ -2046,7 +2061,7 @@ ItemInst* ItemInst::RemoveAugment(uint8 index) bool ItemInst::IsAugmented() { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return false; for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { @@ -2060,10 +2075,10 @@ bool ItemInst::IsAugmented() // Has attack/delay? bool ItemInst::IsWeapon() const { - if (!m_item || m_item->ItemClass != ItemClassCommon) + if (!m_item || !m_item->IsClassCommon()) return false; - if (m_item->ItemType == ItemTypeArrow && m_item->Damage != 0) + if (m_item->ItemType == EQEmu::item::ItemTypeArrow && m_item->Damage != 0) return true; else return ((m_item->Damage != 0) && (m_item->Delay != 0)); @@ -2074,9 +2089,9 @@ bool ItemInst::IsAmmo() const if (!m_item) return false; - if ((m_item->ItemType == ItemTypeArrow) || - (m_item->ItemType == ItemTypeLargeThrowing) || - (m_item->ItemType == ItemTypeSmallThrowing) + if ((m_item->ItemType == EQEmu::item::ItemTypeArrow) || + (m_item->ItemType == EQEmu::item::ItemTypeLargeThrowing) || + (m_item->ItemType == EQEmu::item::ItemTypeSmallThrowing) ) { return true; } @@ -2085,7 +2100,7 @@ bool ItemInst::IsAmmo() const } -const Item_Struct* ItemInst::GetItem() const +const EQEmu::Item_Struct* ItemInst::GetItem() const { if (!m_item) return nullptr; @@ -2096,7 +2111,7 @@ const Item_Struct* ItemInst::GetItem() const return m_item; } -const Item_Struct* ItemInst::GetUnscaledItem() const +const EQEmu::Item_Struct* ItemInst::GetUnscaledItem() const { // No operator calls and defaults to nullptr return m_item; @@ -2204,10 +2219,10 @@ void ItemInst::ScaleItem() { return; if (m_scaledItem) { - memcpy(m_scaledItem, m_item, sizeof(Item_Struct)); + memcpy(m_scaledItem, m_item, sizeof(EQEmu::Item_Struct)); } else { - m_scaledItem = new Item_Struct(*m_item); + m_scaledItem = new EQEmu::Item_Struct(*m_item); } float Mult = (float)(GetExp()) / 10000; // scaling is determined by exp, with 10,000 being full stats @@ -3051,41 +3066,3 @@ EvolveInfo::EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 EvolveInfo::~EvolveInfo() { } - - -// -// struct Item_Struct -// -bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const -{ - bool IsRace = false; - bool IsClass = false; - - uint32 Classes_ = Classes; - uint32 Races_ = Races; - uint32 Race_ = GetPlayerRaceValue(Race); - - for (int CurrentClass = 1; CurrentClass <= PLAYER_CLASS_COUNT; ++CurrentClass) { - if (Classes_ & 1) { - if (CurrentClass == Class_) { - IsClass = true; - break; - } - } - Classes_ >>= 1; - } - - Race_ = (Race_ == 18 ? 16 : Race_); - - for (unsigned int CurrentRace = 1; CurrentRace <= PLAYER_RACE_COUNT; ++CurrentRace) { - if (Races_ & 1) { - if (CurrentRace == Race_) { - IsRace = true; - break; - } - } - Races_ >>= 1; - } - - return (IsRace && IsClass); -} diff --git a/common/item.h b/common/item.h index 7d60afdac..bc002fa6f 100644 --- a/common/item.h +++ b/common/item.h @@ -1,5 +1,6 @@ /* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) + + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,15 +14,16 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA */ // @merth notes: // These classes could be optimized with database reads/writes by storing // a status flag indicating how object needs to interact with database -#ifndef __ITEM_H -#define __ITEM_H +#ifndef COMMON_ITEM_H +#define COMMON_ITEM_H + class ItemParse; // Parses item packets class EvolveInfo; // Stores information about an evolving item family @@ -173,7 +175,7 @@ public: ItemInst* PopItem(int16 slot_id); // Check whether there is space for the specified number of the specified item. - bool HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity); + bool HasSpaceForItem(const EQEmu::Item_Struct *ItemToTry, int16 Quantity); // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look @@ -198,7 +200,7 @@ public: static int16 CalcSlotFromMaterial(uint8 material); static uint8 CalcMaterialFromSlot(int16 equipslot); - static bool CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_Struct *Container); + static bool CanItemFitInContainer(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container); // Test for valid inventory casting slot bool SupportsClickCasting(int16 slot_id); @@ -275,7 +277,7 @@ public: ///////////////////////// // Constructors/Destructor - ItemInst(const Item_Struct* item = nullptr, int16 charges = 0); + ItemInst(const EQEmu::Item_Struct* item = nullptr, int16 charges = 0); ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0); @@ -286,7 +288,15 @@ public: ~ItemInst(); // Query item type - bool IsType(ItemClassTypes item_class) const; + bool IsType(EQEmu::item::ItemClass item_class) const; + + bool IsClassCommon(); + bool IsClassBag(); + bool IsClassBook(); + + bool IsClassCommon() const { return const_cast(this)->IsClassCommon(); } + bool IsClassBag() const { return const_cast(this)->IsClassBag(); } + bool IsClassBook() const { return const_cast(this)->IsClassBook(); } // Can item be stacked? bool IsStackable() const; @@ -305,7 +315,7 @@ public: bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); } - inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == ET_Expendable ) || (m_item->ItemType == ItemTypePotion)) : false); } + inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); } // // Contents @@ -336,7 +346,7 @@ public: bool IsAugmented(); ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const; bool UpdateOrnamentationInfo(); - static bool CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll = false); + static bool CanTransform(const EQEmu::Item_Struct *ItemToTry, const EQEmu::Item_Struct *Container, bool AllowAll = false); // Has attack/delay? bool IsWeapon() const; @@ -345,8 +355,8 @@ public: // Accessors const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); } const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); } - const Item_Struct* GetItem() const; - const Item_Struct* GetUnscaledItem() const; + const EQEmu::Item_Struct* GetItem() const; + const EQEmu::Item_Struct* GetUnscaledItem() const; int16 GetCharges() const { return m_charges; } void SetCharges(int16 charges) { m_charges = charges; } @@ -414,8 +424,8 @@ public: int8 GetMaxEvolveLvl() const; uint32 GetKillsNeeded(uint8 currentlevel); - std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; } - void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); } + std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; } + void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); } inline int32 GetSerialNumber() const { return m_SerialNumber; } inline void SetSerialNumber(int32 id) { m_SerialNumber = id; } @@ -490,7 +500,7 @@ protected: void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } ItemInstTypes m_use_type; // Usage type for item - const Item_Struct* m_item; // Ptr to item data + const EQEmu::Item_Struct* m_item; // Ptr to item data int16 m_charges; // # of charges for chargeable items uint32 m_price; // Bazaar /trader price uint32 m_color; @@ -502,7 +512,7 @@ protected: uint32 m_exp; int8 m_evolveLvl; bool m_activated; - Item_Struct* m_scaledItem; + EQEmu::Item_Struct* m_scaledItem; EvolveInfo* m_evolveInfo; bool m_scaling; uint32 m_ornamenticon; @@ -531,4 +541,4 @@ public: ~EvolveInfo(); }; -#endif // #define __ITEM_H +#endif /*COMMON_ITEM_H*/ diff --git a/common/item_struct.cpp b/common/item_struct.cpp new file mode 100644 index 000000000..20c0ad1ee --- /dev/null +++ b/common/item_struct.cpp @@ -0,0 +1,209 @@ +/* EQEMu: Everquest Server Emulator + + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "item_struct.h" +#include "classes.h" +#include "races.h" +//#include "deity.h" + + +uint32 EQEmu::item::ConvertAugTypeToAugTypeBit(uint8 aug_type) +{ + switch (aug_type) { + case AugTypeGeneralSingleStat: + return bit_AugTypeGeneralSingleStat; + case AugTypeGeneralMultipleStat: + return bit_AugTypeGeneralMultipleStat; + case AugTypeGeneralSpellEffect: + return bit_AugTypeGeneralSpellEffect; + case AugTypeWeaponGeneral: + return bit_AugTypeWeaponGeneral; + case AugTypeWeaponElemDamage: + return bit_AugTypeWeaponElemDamage; + case AugTypeWeaponBaseDamage: + return bit_AugTypeWeaponBaseDamage; + case AugTypeGeneralGroup: + return bit_AugTypeGeneralGroup; + case AugTypeGeneralRaid: + return bit_AugTypeGeneralRaid; + case AugTypeGeneralDragonsPoints: + return bit_AugTypeGeneralDragonsPoints; + case AugTypeCraftedCommon: + return bit_AugTypeCraftedCommon; + case AugTypeCraftedGroup1: + return bit_AugTypeCraftedGroup1; + case AugTypeCraftedRaid1: + return bit_AugTypeCraftedRaid1; + case AugTypeEnergeiacGroup: + return bit_AugTypeEnergeiacGroup; + case AugTypeEnergeiacRaid: + return bit_AugTypeEnergeiacRaid; + case AugTypeEmblem: + return bit_AugTypeEmblem; + case AugTypeCraftedGroup2: + return bit_AugTypeCraftedGroup2; + case AugTypeCraftedRaid2: + return bit_AugTypeCraftedRaid2; + case AugTypeUnknown1: + return bit_AugTypeUnknown1; + case AugTypeUnknown2: + return bit_AugTypeUnknown2; + case AugTypeOrnamentation: + return bit_AugTypeOrnamentation; + case AugTypeSpecialOrnamentation: + return bit_AugTypeSpecialOrnamentation; + case AugTypeUnknown3: + return bit_AugTypeUnknown3; + case AugTypeUnknown4: + return bit_AugTypeUnknown4; + case AugTypeUnknown5: + return bit_AugTypeUnknown5; + case AugTypeUnknown6: + return bit_AugTypeUnknown6; + case AugTypeUnknown7: + return bit_AugTypeUnknown7; + case AugTypeUnknown8: + return bit_AugTypeUnknown8; + case AugTypeUnknown9: + return bit_AugTypeUnknown9; + case AugTypeUnknown10: + return bit_AugTypeUnknown10; + case AugTypeEpic2_5: + return bit_AugTypeEpic2_5; + case AugTypeTest: + return bit_AugTypeTest; + case AugTypeAll: + return bit_AugTypeAll; + default: + return bit_AugTypeNone; + } +} + +uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit) +{ + switch (aug_type_bit) { + case bit_AugTypeGeneralSingleStat: + return AugTypeGeneralSingleStat; + case bit_AugTypeGeneralMultipleStat: + return AugTypeGeneralMultipleStat; + case bit_AugTypeGeneralSpellEffect: + return AugTypeGeneralSpellEffect; + case bit_AugTypeWeaponGeneral: + return AugTypeWeaponGeneral; + case bit_AugTypeWeaponElemDamage: + return AugTypeWeaponElemDamage; + case bit_AugTypeWeaponBaseDamage: + return AugTypeWeaponBaseDamage; + case bit_AugTypeGeneralGroup: + return AugTypeGeneralGroup; + case bit_AugTypeGeneralRaid: + return AugTypeGeneralRaid; + case bit_AugTypeGeneralDragonsPoints: + return AugTypeGeneralDragonsPoints; + case bit_AugTypeCraftedCommon: + return AugTypeCraftedCommon; + case bit_AugTypeCraftedGroup1: + return AugTypeCraftedGroup1; + case bit_AugTypeCraftedRaid1: + return AugTypeCraftedRaid1; + case bit_AugTypeEnergeiacGroup: + return AugTypeEnergeiacGroup; + case bit_AugTypeEnergeiacRaid: + return AugTypeEnergeiacRaid; + case bit_AugTypeEmblem: + return AugTypeEmblem; + case bit_AugTypeCraftedGroup2: + return AugTypeCraftedGroup2; + case bit_AugTypeCraftedRaid2: + return AugTypeCraftedRaid2; + case bit_AugTypeUnknown1: + return AugTypeUnknown1; + case bit_AugTypeUnknown2: + return AugTypeUnknown2; + case bit_AugTypeOrnamentation: + return AugTypeOrnamentation; + case bit_AugTypeSpecialOrnamentation: + return AugTypeSpecialOrnamentation; + case bit_AugTypeUnknown3: + return AugTypeUnknown3; + case bit_AugTypeUnknown4: + return AugTypeUnknown4; + case bit_AugTypeUnknown5: + return AugTypeUnknown5; + case bit_AugTypeUnknown6: + return AugTypeUnknown6; + case bit_AugTypeUnknown7: + return AugTypeUnknown7; + case bit_AugTypeUnknown8: + return AugTypeUnknown8; + case bit_AugTypeUnknown9: + return AugTypeUnknown9; + case bit_AugTypeUnknown10: + return AugTypeUnknown10; + case bit_AugTypeEpic2_5: + return AugTypeEpic2_5; + case bit_AugTypeTest: + return AugTypeTest; + case bit_AugTypeAll: + return AugTypeAll; + default: + return AugTypeNone; + } +} + +bool EQEmu::Item_Struct::IsEquipable(uint16 race_id, uint16 class_id) +{ + if (!(Races & GetPlayerRaceBit(race_id))) + return false; + + if (!(Classes & GetPlayerClassBit(GetPlayerClassValue(class_id)))) + return false; + + return true; +} + +bool EQEmu::Item_Struct::IsClassCommon() +{ + return (ItemClass == item::ItemClassCommon); +} + +bool EQEmu::Item_Struct::IsClassBag() +{ + return (ItemClass == item::ItemClassBag); +} + +bool EQEmu::Item_Struct::IsClassBook() +{ + return (ItemClass == item::ItemClassBook); +} + +bool EQEmu::Item_Struct::IsType1HWeapon() +{ + return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing)); +} + +bool EQEmu::Item_Struct::IsType2HWeapon() +{ + return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing)); +} + +bool EQEmu::Item_Struct::IsTypeShield() +{ + return (ItemType == item::ItemTypeShield); +} diff --git a/common/item_struct.h b/common/item_struct.h index 226458d70..c56d32a67 100644 --- a/common/item_struct.h +++ b/common/item_struct.h @@ -1,4 +1,5 @@ /* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -13,11 +14,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA */ -#ifndef ITEM_STRUCT_H -#define ITEM_STRUCT_H +#ifndef COMMON_ITEM_STRUCT_H +#define COMMON_ITEM_STRUCT_H + /* * Note: (Doodman) @@ -44,211 +46,520 @@ #include "emu_constants.h" + +namespace EQEmu +{ + namespace item { + enum ItemAttributeBit : uint32 { + bit_ItemAttributeNone = 0x00000000, + bit_ItemAttributeLore = 0x00000001, + bit_ItemAttributeArtifact = 0x00000002, + bit_ItemAttributeSummoned = 0x00000004, + bit_ItemAttributeMagic = 0x00000008, + bit_ItemAttributeAugment = 0x00000010, + bit_ItemAttributePendingLore = 0x00000020, + bit_ItemAttributeUnknown = 0xFFFFFFFF + }; + + enum ItemClass { + ItemClassCommon = 0, + ItemClassBag, + ItemClassBook, + ItemClassCount + }; + + enum ItemType : uint8 { +/*9138*/ ItemType1HSlash = 0, +/*9141*/ ItemType2HSlash, +/*9140*/ ItemType1HPiercing, +/*9139*/ ItemType1HBlunt, +/*9142*/ ItemType2HBlunt, +/*5504*/ ItemTypeBow, // 5 +/*----*/ ItemTypeUnknown1, +/*----*/ ItemTypeLargeThrowing, +/*5505*/ ItemTypeShield, +/*5506*/ ItemTypeScroll, +/*5507*/ ItemTypeArmor, // 10 +/*5508*/ ItemTypeMisc, // a lot of random crap has this item use. +/*7564*/ ItemTypeLockPick, +/*----*/ ItemTypeUnknown2, +/*5509*/ ItemTypeFood, +/*5510*/ ItemTypeDrink, // 15 +/*5511*/ ItemTypeLight, +/*5512*/ ItemTypeCombinable, // not all stackable items are this use... +/*5513*/ ItemTypeBandage, +/*----*/ ItemTypeSmallThrowing, +/*----*/ ItemTypeSpell, // 20 // spells and tomes +/*5514*/ ItemTypePotion, +/*----*/ ItemTypeUnknown3, +/*0406*/ ItemTypeWindInstrument, +/*0407*/ ItemTypeStringedInstrument, +/*0408*/ ItemTypeBrassInstrument, // 25 +/*0405*/ ItemTypePercussionInstrument, +/*5515*/ ItemTypeArrow, +/*----*/ ItemTypeUnknown4, +/*5521*/ ItemTypeJewelry, +/*----*/ ItemTypeSkull, // 30 +/*5516*/ ItemTypeBook, // skill-up tomes/books? (would probably need a pp flag if true...) +/*5517*/ ItemTypeNote, +/*5518*/ ItemTypeKey, +/*----*/ ItemTypeCoin, +/*5520*/ ItemType2HPiercing, // 35 +/*----*/ ItemTypeFishingPole, +/*----*/ ItemTypeFishingBait, +/*5519*/ ItemTypeAlcohol, +/*----*/ ItemTypeKey2, // keys and satchels?? (questable keys?) +/*----*/ ItemTypeCompass, // 40 +/*----*/ ItemTypeUnknown5, +/*----*/ ItemTypePoison, // might be wrong, but includes poisons +/*----*/ ItemTypeUnknown6, +/*----*/ ItemTypeUnknown7, +/*5522*/ ItemTypeMartial, // 45 +/*----*/ ItemTypeUnknown8, +/*----*/ ItemTypeUnknown9, +/*----*/ ItemTypeUnknown10, +/*----*/ ItemTypeUnknown11, +/*----*/ ItemTypeSinging, // 50 +/*5750*/ ItemTypeAllInstrumentTypes, +/*5776*/ ItemTypeCharm, +/*----*/ ItemTypeDye, +/*----*/ ItemTypeAugmentation, +/*----*/ ItemTypeAugmentationSolvent, // 55 +/*----*/ ItemTypeAugmentationDistiller, +/*----*/ ItemTypeUnknown12, +/*----*/ ItemTypeFellowshipKit, +/*----*/ ItemTypeUnknown13, +/*----*/ ItemTypeRecipe, // 60 +/*----*/ ItemTypeAdvancedRecipe, +/*----*/ ItemTypeJournal, // only one(1) database entry +/*----*/ ItemTypeAltCurrency, // alt-currency (as opposed to coinage) +/*5881*/ ItemTypePerfectedAugmentationDistiller, +/*----*/ ItemTypeCount + /* -** Child struct of Item_Struct: -** Effect data: Click, Proc, Focus, Worn, Scroll -** + Unknowns: + + Mounts? + Ornamentations? + GuildBanners? + Collectible? + Placeable? + (others?) */ -struct ItemEffect_Struct { - int32 Effect; - uint8 Type; - uint8 Level; - uint8 Level2; - //MaxCharges - //CastTime - //RecastDelay - //RecastType - //ProcRate -}; + }; -class ItemInst; + enum AugTypeBit : uint32 { + bit_AugTypeNone = 0x00000000, + bit_AugTypeGeneralSingleStat = 0x00000001, /*1^16^1 (General: Single Stat)^0*/ + bit_AugTypeGeneralMultipleStat = 0x00000002, /*2^16^2 (General: Multiple Stat)^0*/ + bit_AugTypeGeneralSpellEffect = 0x00000004, /*3^16^3 (General: Spell Effect)^0*/ + bit_AugTypeWeaponGeneral = 0x00000008, /*4^16^4 (Weapon: General)^0*/ + bit_AugTypeWeaponElemDamage = 0x00000010, /*5^16^5 (Weapon: Elem Damage)^0*/ + bit_AugTypeWeaponBaseDamage = 0x00000020, /*6^16^6 (Weapon: Base Damage)^0*/ + bit_AugTypeGeneralGroup = 0x00000040, /*7^16^7 (General: Group)^0*/ + bit_AugTypeGeneralRaid = 0x00000080, /*8^16^8 (General: Raid)^0*/ + bit_AugTypeGeneralDragonsPoints = 0x00000100, /*9^16^9 (General: Dragons Points)^0*/ + bit_AugTypeCraftedCommon = 0x00000200, /*10^16^10 (Crafted: Common)^0*/ + bit_AugTypeCraftedGroup1 = 0x00000400, /*11^16^11 (Crafted: Group)^0*/ + bit_AugTypeCraftedRaid1 = 0x00000800, /*12^16^12 (Crafted: Raid)^0*/ + bit_AugTypeEnergeiacGroup = 0x00001000, /*13^16^13 (Energeiac: Group)^0*/ + bit_AugTypeEnergeiacRaid = 0x00002000, /*14^16^14 (Energeiac: Raid)^0*/ + bit_AugTypeEmblem = 0x00004000, /*15^16^15 (Emblem)^0*/ + bit_AugTypeCraftedGroup2 = 0x00008000, /*16^16^16 (Crafted: Group)^0*/ + bit_AugTypeCraftedRaid2 = 0x00010000, /*17^16^17 (Crafted: Raid)^0*/ + bit_AugTypeUnknown1 = 0x00020000, /*18^16^18^0*/ + bit_AugTypeUnknown2 = 0x00040000, /*19^16^19^0*/ + bit_AugTypeOrnamentation = 0x00080000, /*20^16^20 (Ornamentation)^0*/ + bit_AugTypeSpecialOrnamentation = 0x00100000, /*21^16^21 (Special Ornamentation)^0*/ + bit_AugTypeUnknown3 = 0x00200000, /*22^16^22^0*/ + bit_AugTypeUnknown4 = 0x00400000, /*23^16^23^0*/ + bit_AugTypeUnknown5 = 0x00800000, /*24^16^24^0*/ + bit_AugTypeUnknown6 = 0x01000000, /*25^16^25^0*/ + bit_AugTypeUnknown7 = 0x02000000, /*26^16^26^0*/ + bit_AugTypeUnknown8 = 0x04000000, /*27^16^27^0*/ + bit_AugTypeUnknown9 = 0x08000000, /*28^16^28^0*/ + bit_AugTypeUnknown10 = 0x10000000, /*29^16^29^0*/ + bit_AugTypeEpic2_5 = 0x20000000, /*30^16^30^0*/ + bit_AugTypeTest = 0x40000000, /*31^16^Test^0*/ // listed as 31^16^31^0 in 5-10 client + bit_AugTypeAll = 0xFFFFFFFF + }; -struct InternalSerializedItem_Struct { - int16 slot_id; - const void * inst; -}; + enum AugType : uint8 { + AugTypeNone = 0, + AugTypeGeneralSingleStat, + AugTypeGeneralMultipleStat, + AugTypeGeneralSpellEffect, + AugTypeWeaponGeneral, + AugTypeWeaponElemDamage, // 5 + AugTypeWeaponBaseDamage, + AugTypeGeneralGroup, + AugTypeGeneralRaid, + AugTypeGeneralDragonsPoints, + AugTypeCraftedCommon, // 10 + AugTypeCraftedGroup1, + AugTypeCraftedRaid1, + AugTypeEnergeiacGroup, + AugTypeEnergeiacRaid, + AugTypeEmblem, // 15 + AugTypeCraftedGroup2, + AugTypeCraftedRaid2, + AugTypeUnknown1, + AugTypeUnknown2, + AugTypeOrnamentation, // 20 + AugTypeSpecialOrnamentation, + AugTypeUnknown3, + AugTypeUnknown4, + AugTypeUnknown5, + AugTypeUnknown6, // 25 + AugTypeUnknown7, + AugTypeUnknown8, + AugTypeUnknown9, + AugTypeUnknown10, + AugTypeEpic2_5, // 30 + AugTypeTest, + AugTypeCount, + AugTypeAll = 255 + }; -// use EmuConstants::ITEM_COMMON_SIZE -//#define MAX_AUGMENT_SLOTS 5 + enum AugRestriction : uint8 { +/*4690*/ AugRestrictionAny = 0, +/*9134*/ AugRestrictionArmor, +/*9135*/ AugRestrictionWeapons, +/*9136*/ AugRestriction1HWeapons, +/*9137*/ AugRestriction2HWeapons, +/*9138*/ AugRestriction1HSlash, // 5 +/*9139*/ AugRestriction1HBlunt, +/*9140*/ AugRestrictionPiercing, +/*9148*/ AugRestrictionHandToHand, +/*9141*/ AugRestriction2HSlash, +/*9142*/ AugRestriction2HBlunt, // 10 +/*9143*/ AugRestriction2HPierce, +/*9144*/ AugRestrictionBows, +/*9145*/ AugRestrictionShields, +/*8052*/ AugRestriction1HSlash1HBluntOrHandToHand, +/*9200*/ AugRestriction1HBluntOrHandToHand, // 15 // no listed peq entries -struct Item_Struct { - bool IsEquipable(uint16 Race, uint16 Class) const; - // Non packet based fields - uint8 MinStatus; + // these three appear to be post-RoF (12-10-2012) and can not be verified until RoF (05-10-2013) is supported +/*????*/ AugRestrictionUnknown1, +/*????*/ AugRestrictionUnknown2, +/*????*/ AugRestrictionUnknown3, // last value in peq entries + AugRestrictionCount - // Packet based fields - uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book - char Name[64]; // Name - char Lore[80]; // Lore Name: *=lore, &=summoned, #=artifact, ~=pending lore - char IDFile[30]; // Visible model - uint32 ID; // Unique ID (also PK for DB) - int32 Weight; // Item weight * 10 - uint8 NoRent; // No Rent: 0=norent, 255=not norent - uint8 NoDrop; // No Drop: 0=nodrop, 255=not nodrop - uint8 Size; // Size: 0=tiny, 1=small, 2=medium, 3=large, 4=giant - uint32 Slots; // Bitfield for which slots this item can be used in - uint32 Price; // Item cost (?) - uint32 Icon; // Icon Number - uint32 LoreGroup; // Later items use LoreGroup instead of LoreFlag. we might want to see about changing this to int32 since it is commonly -1 and is constantly being cast from signed (-1) to unsigned (4294967295) - bool LoreFlag; // This will be true if LoreGroup is non-zero - bool PendingLoreFlag; - bool ArtifactFlag; - bool SummonedFlag; - uint8 FVNoDrop; // Firiona Vie nodrop flag - uint32 Favor; // Individual favor - uint32 GuildFavor; // Guild favor - uint32 PointType; +/*4687*/ //AugTypeAllItems, // ?? unknown atm +/*4688*/ //AugTypePrestige, // ?? unknown atm +/*4689*/ //AugTypeNonPrestige, // ?? unknown atm + }; - //uint32 Unk117; - //uint32 Unk118; - //uint32 Unk121; - //uint32 Unk124; + enum BagType : uint8 { +/*3400*/ BagTypeSmallBag = 0, +/*3401*/ BagTypeLargeBag, +/*3402*/ BagTypeQuiver, +/*3403*/ BagTypeBeltPouch, +/*3404*/ BagTypeWristPouch, +/*3405*/ BagTypeBackPack, // 5 +/*3406*/ BagTypeSmallChest, +/*3407*/ BagTypeLargeChest, +/*----*/ BagTypeBandolier, // <*Database Reference Only> +/*3408*/ BagTypeMedicineBag, +/*3409*/ BagTypeToolBox, // 10 +/*3410*/ BagTypeLexicon, +/*3411*/ BagTypeMortar, +/*3412*/ BagTypeSelfDusting, // Quest container (Auto-clear contents?) +/*3413*/ BagTypeMixingBowl, +/*3414*/ BagTypeOven, // 15 +/*3415*/ BagTypeSewingKit, +/*3416*/ BagTypeForge, +/*3417*/ BagTypeFletchingKit, +/*3418*/ BagTypeBrewBarrel, +/*3419*/ BagTypeJewelersKit, // 20 +/*3420*/ BagTypePotteryWheel, +/*3421*/ BagTypeKiln, +/*3422*/ BagTypeKeymaker, // (no database entries as of peq rev 69) +/*3423*/ BagTypeWizardsLexicon, +/*3424*/ BagTypeMagesLexicon, // 25 +/*3425*/ BagTypeNecromancersLexicon, +/*3426*/ BagTypeEnchantersLexicon, +/*----*/ BagTypeUnknown1, // (a coin pouch/purse?) (no database entries as of peq rev 69) +/*----*/ BagTypeConcordanceofResearch, // <*Database Reference Only> +/*3427*/ BagTypeAlwaysWorks, // 30 // Quest container (Never-fail combines?) +/*3428*/ BagTypeKoadaDalForge, // High Elf +/*3429*/ BagTypeTeirDalForge, // Dark Elf +/*3430*/ BagTypeOggokForge, // Ogre +/*3431*/ BagTypeStormguardForge, // Dwarf +/*3432*/ BagTypeAkanonForge, // 35 // Gnome +/*3433*/ BagTypeNorthmanForge, // Barbarian +/*----*/ BagTypeUnknown2, // (no database entries as of peq rev 69) +/*3434*/ BagTypeCabilisForge, // Iksar +/*3435*/ BagTypeFreeportForge, // Human 1 +/*3436*/ BagTypeRoyalQeynosForge, // 40 // Human 2 +/*3439*/ BagTypeHalflingTailoringKit, +/*3438*/ BagTypeErudTailoringKit, +/*3440*/ BagTypeFierDalTailoringKit, // Wood Elf +/*3441*/ BagTypeFierDalFletchingKit, // Wood Elf +/*3437*/ BagTypeIksarPotteryWheel, // 45 +/*3442*/ BagTypeTackleBox, +/*3443*/ BagTypeTrollForge, +/*3445*/ BagTypeFierDalForge, // Wood Elf +/*3444*/ BagTypeValeForge, // Halfling +/*3446*/ BagTypeErudForge, // 50 +/*----*/ BagTypeTradersSatchel, // <*Database Reference Only> (db: Yellow Trader's Satchel Token?) +/*5785*/ BagTypeGuktaForge, // Froglok (no database entries as of peq rev 69) +/*3359*/ BagTypeAugmentationSealer, +/*----*/ BagTypeIceCreamChurn, // <*Database Reference Only> +/*6325*/ BagTypeTransformationmold, // 55 // Ornamentation +/*6340*/ BagTypeDetransformationmold, // Ornamentation Stripper +/*5400*/ BagTypeUnattuner, +/*7684*/ BagTypeTradeskillBag, +/*7692*/ BagTypeCollectibleBag, +/*----*/ BagTypeCount + }; - uint8 BagType; // 0:Small Bag, 1:Large Bag, 2:Quiver, 3:Belt Pouch ... there are 50 types - uint8 BagSlots; // Number of slots: can only be 2, 4, 6, 8, or 10 - uint8 BagSize; // 0:TINY, 1:SMALL, 2:MEDIUM, 3:LARGE, 4:GIANT - uint8 BagWR; // 0->100 + enum ItemEffect { + ItemEffectCombatProc = 0, + ItemEffectClick, + ItemEffectWorn, + ItemEffectExpendable, + ItemEffectEquipClick, + ItemEffectClick2, //5 //name unknown + ItemEffectFocus, + ItemEffectScroll, + ItemEffectCount + }; - bool BenefitFlag; - bool Tradeskills; // Is this a tradeskill item? - int8 CR; // Save vs Cold - int8 DR; // Save vs Disease - int8 PR; // Save vs Poison - int8 MR; // Save vs Magic - int8 FR; // Save vs Fire - int8 AStr; // Strength - int8 ASta; // Stamina - int8 AAgi; // Agility - int8 ADex; // Dexterity - int8 ACha; // Charisma - int8 AInt; // Intelligence - int8 AWis; // Wisdom - int32 HP; // HP - int32 Mana; // Mana - int32 AC; // AC - uint32 Deity; // Bitmask of Deities that can equip this item - //uint32 Unk033 - int32 SkillModValue; // % Mod to skill specified in SkillModType - int32 SkillModMax; // Max skill point modification - uint32 SkillModType; // Type of skill for SkillModValue to apply to - uint32 BaneDmgRace; // Bane Damage Race - int8 BaneDmgAmt; // Bane Damage Body Amount - uint32 BaneDmgBody; // Bane Damage Body - bool Magic; // True=Magic Item, False=not - int32 CastTime_; - uint8 ReqLevel; // Required Level to use item - uint32 BardType; // Bard Skill Type - int32 BardValue; // Bard Skill Amount - int8 Light; // Light - uint8 Delay; // Delay * 10 - uint8 RecLevel; // Recommended level to use item - uint8 RecSkill; // Recommended skill to use item (refers to primary skill of item) - uint8 ElemDmgType; // Elemental Damage Type (1=magic, 2=fire) - uint8 ElemDmgAmt; // Elemental Damage - uint8 Range; // Range of item - uint32 Damage; // Delay between item usage (in 0.1 sec increments) - uint32 Color; // RR GG BB 00 <-- as it appears in pc - uint32 Classes; // Bitfield of classes that can equip item (1 << class#) - uint32 Races; // Bitfield of races that can equip item (1 << race#) - //uint32 Unk054; - int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item - uint8 ItemType; // Item Type/Skill (itemClass* from above) - uint8 Material; // Item material type - uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?) - float SellRate; // Sell rate - //uint32 Unk059; - union { - uint32 Fulfilment; // Food fulfilment (How long it lasts) - uint32 CastTime; // Cast Time for clicky effects, in milliseconds + enum ItemSize : uint8 { + ItemSizeTiny = 0, + ItemSizeSmall, + ItemSizeMedium, + ItemSizeLarge, + ItemSizeGiant, + ItemSizeCount + }; + + enum ItemDataType : uint8 { + ItemDataTypeBase = 0, + ItemDataTypeScaling, + ItemDataTypeEvolving, + ItemDataTypeCount + }; + + struct ItemEffect_Struct { + int16 Effect; + uint8 Type; + uint8 Level; + uint8 Level2; + //MaxCharges + //CastTime + //RecastDelay + //RecastType + //ProcRate + }; + + extern uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type); + extern uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit); + + } /*item*/ + + struct InternalSerializedItem_Struct { + int16 slot_id; + const void * inst; }; - uint32 EliteMaterial; - int32 ProcRate; - int8 CombatEffects; // PoP: Combat Effects + - int8 Shielding; // PoP: Shielding % - int8 StunResist; // PoP: Stun Resist % - int8 StrikeThrough; // PoP: Strike Through % - uint32 ExtraDmgSkill; - uint32 ExtraDmgAmt; - int8 SpellShield; // PoP: Spell Shield % - int8 Avoidance; // PoP: Avoidance + - int8 Accuracy; // PoP: Accuracy + - uint32 CharmFileID; - int32 FactionMod1; // Faction Mod 1 - int32 FactionMod2; // Faction Mod 2 - int32 FactionMod3; // Faction Mod 3 - int32 FactionMod4; // Faction Mod 4 - int32 FactionAmt1; // Faction Amt 1 - int32 FactionAmt2; // Faction Amt 2 - int32 FactionAmt3; // Faction Amt 3 - int32 FactionAmt4; // Faction Amt 4 - char CharmFile[32]; // ? - uint32 AugType; - uint8 AugSlotType[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Type - uint8 AugSlotVisible[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Visible - uint8 AugSlotUnk2[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related - uint32 LDoNTheme; - uint32 LDoNPrice; - uint32 LDoNSold; - uint32 BaneDmgRaceAmt; - uint32 AugRestrict; - uint32 Endur; - uint32 DotShielding; - uint32 Attack; - uint32 Regen; - uint32 ManaRegen; - uint32 EnduranceRegen; - uint32 Haste; - uint32 DamageShield; - uint32 RecastDelay; - uint32 RecastType; - uint32 AugDistiller; - bool Attuneable; - bool NoPet; - bool PotionBelt; - bool Stackable; - bool NoTransfer; - bool QuestItemFlag; - int16 StackSize; - uint8 PotionBeltSlots; - ItemEffect_Struct Click, Proc, Worn, Focus, Scroll, Bard; - uint8 Book; // 0=Not book, 1=Book - uint32 BookType; - char Filename[33]; // Filename for book data - // Begin SoF Fields - int32 SVCorruption; - uint32 Purity; - uint8 EvolvingItem; - uint32 EvolvingID; - uint8 EvolvingLevel; - uint8 EvolvingMax; - uint32 BackstabDmg; - uint32 DSMitigation; - int32 HeroicStr; - int32 HeroicInt; - int32 HeroicWis; - int32 HeroicAgi; - int32 HeroicDex; - int32 HeroicSta; - int32 HeroicCha; - int32 HeroicMR; - int32 HeroicFR; - int32 HeroicCR; - int32 HeroicDR; - int32 HeroicPR; - int32 HeroicSVCorrup; - int32 HealAmt; - int32 SpellDmg; - uint32 LDoNSellBackRate; - uint32 ScriptFileID; - uint16 ExpendableArrow; - uint32 Clairvoyance; - char ClickName[65]; - char ProcName[65]; - char WornName[65]; - char FocusName[65]; - char ScrollName[65]; + struct Item_Struct { + // Non packet based fields + uint8 MinStatus; + //uint8 ItemDataType; -}; + // Packet based fields + uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book + char Name[64]; // Name + char Lore[80]; // Lore Name: *=lore, &=summoned, #=artifact, ~=pending lore + char IDFile[30]; // Visible model + uint32 ID; // Unique ID (also PK for DB) + int32 Weight; // Item weight * 10 + uint8 NoRent; // No Rent: 0=norent, 255=not norent + uint8 NoDrop; // No Drop: 0=nodrop, 255=not nodrop + uint8 Size; // Size: 0=tiny, 1=small, 2=medium, 3=large, 4=giant + uint32 Slots; // Bitfield for which slots this item can be used in + uint32 Price; // Item cost (?) + uint32 Icon; // Icon Number + uint32 LoreGroup; // Later items use LoreGroup instead of LoreFlag. we might want to see about changing this to int32 since it is commonly -1 and is constantly being cast from signed (-1) to unsigned (4294967295) + bool LoreFlag; // This will be true if LoreGroup is non-zero + bool PendingLoreFlag; + bool ArtifactFlag; + bool SummonedFlag; + uint8 FVNoDrop; // Firiona Vie nodrop flag + uint32 Favor; // Individual favor + uint32 GuildFavor; // Guild favor + uint32 PointType; -#endif + //uint32 Unk117; + //uint32 Unk118; + //uint32 Unk121; + //uint32 Unk124; + + uint8 BagType; // 0:Small Bag, 1:Large Bag, 2:Quiver, 3:Belt Pouch ... there are 50 types + uint8 BagSlots; // Number of slots: can only be 2, 4, 6, 8, or 10 + uint8 BagSize; // 0:TINY, 1:SMALL, 2:MEDIUM, 3:LARGE, 4:GIANT + uint8 BagWR; // 0->100 + + bool BenefitFlag; + bool Tradeskills; // Is this a tradeskill item? + int8 CR; // Save vs Cold + int8 DR; // Save vs Disease + int8 PR; // Save vs Poison + int8 MR; // Save vs Magic + int8 FR; // Save vs Fire + int8 AStr; // Strength + int8 ASta; // Stamina + int8 AAgi; // Agility + int8 ADex; // Dexterity + int8 ACha; // Charisma + int8 AInt; // Intelligence + int8 AWis; // Wisdom + int32 HP; // HP + int32 Mana; // Mana + int32 AC; // AC + uint32 Deity; // Bitmask of Deities that can equip this item + //uint32 Unk033 + int32 SkillModValue; // % Mod to skill specified in SkillModType + int32 SkillModMax; // Max skill point modification + uint32 SkillModType; // Type of skill for SkillModValue to apply to + uint32 BaneDmgRace; // Bane Damage Race + int8 BaneDmgAmt; // Bane Damage Body Amount + uint32 BaneDmgBody; // Bane Damage Body + bool Magic; // True=Magic Item, False=not + int32 CastTime_; + uint8 ReqLevel; // Required Level to use item + uint32 BardType; // Bard Skill Type + int32 BardValue; // Bard Skill Amount + int8 Light; // Light + uint8 Delay; // Delay * 10 + uint8 RecLevel; // Recommended level to use item + uint8 RecSkill; // Recommended skill to use item (refers to primary skill of item) + uint8 ElemDmgType; // Elemental Damage Type (1=magic, 2=fire) + uint8 ElemDmgAmt; // Elemental Damage + uint8 Range; // Range of item + uint32 Damage; // Delay between item usage (in 0.1 sec increments) + uint32 Color; // RR GG BB 00 <-- as it appears in pc + uint32 Classes; // Bitfield of classes that can equip item (1 << class#) + uint32 Races; // Bitfield of races that can equip item (1 << race#) + //uint32 Unk054; + int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item + uint8 ItemType; // Item Type/Skill (itemClass* from above) + uint8 Material; // Item material type + uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?) + float SellRate; // Sell rate + //uint32 Unk059; + union { + uint32 Fulfilment; // Food fulfilment (How long it lasts) + uint32 CastTime; // Cast Time for clicky effects, in milliseconds + }; + uint32 EliteMaterial; + int32 ProcRate; + int8 CombatEffects; // PoP: Combat Effects + + int8 Shielding; // PoP: Shielding % + int8 StunResist; // PoP: Stun Resist % + int8 StrikeThrough; // PoP: Strike Through % + uint32 ExtraDmgSkill; + uint32 ExtraDmgAmt; + int8 SpellShield; // PoP: Spell Shield % + int8 Avoidance; // PoP: Avoidance + + int8 Accuracy; // PoP: Accuracy + + uint32 CharmFileID; + int32 FactionMod1; // Faction Mod 1 + int32 FactionMod2; // Faction Mod 2 + int32 FactionMod3; // Faction Mod 3 + int32 FactionMod4; // Faction Mod 4 + int32 FactionAmt1; // Faction Amt 1 + int32 FactionAmt2; // Faction Amt 2 + int32 FactionAmt3; // Faction Amt 3 + int32 FactionAmt4; // Faction Amt 4 + char CharmFile[32]; // ? + uint32 AugType; + uint8 AugSlotType[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Type + uint8 AugSlotVisible[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Visible + uint8 AugSlotUnk2[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related + uint32 LDoNTheme; + uint32 LDoNPrice; + uint32 LDoNSold; + uint32 BaneDmgRaceAmt; + uint32 AugRestrict; + uint32 Endur; + uint32 DotShielding; + uint32 Attack; + uint32 Regen; + uint32 ManaRegen; + uint32 EnduranceRegen; + uint32 Haste; + uint32 DamageShield; + uint32 RecastDelay; + uint32 RecastType; + uint32 AugDistiller; + bool Attuneable; + bool NoPet; + bool PotionBelt; + bool Stackable; + bool NoTransfer; + bool QuestItemFlag; + int16 StackSize; + uint8 PotionBeltSlots; + item::ItemEffect_Struct Click, Proc, Worn, Focus, Scroll, Bard; + + uint8 Book; // 0=Not book, 1=Book + uint32 BookType; + char Filename[33]; // Filename for book data + // Begin SoF Fields + int32 SVCorruption; + uint32 Purity; + uint8 EvolvingItem; + uint32 EvolvingID; + uint8 EvolvingLevel; + uint8 EvolvingMax; + uint32 BackstabDmg; + uint32 DSMitigation; + int32 HeroicStr; + int32 HeroicInt; + int32 HeroicWis; + int32 HeroicAgi; + int32 HeroicDex; + int32 HeroicSta; + int32 HeroicCha; + int32 HeroicMR; + int32 HeroicFR; + int32 HeroicCR; + int32 HeroicDR; + int32 HeroicPR; + int32 HeroicSVCorrup; + int32 HealAmt; + int32 SpellDmg; + uint32 LDoNSellBackRate; + uint32 ScriptFileID; + uint16 ExpendableArrow; + uint32 Clairvoyance; + char ClickName[65]; + char ProcName[65]; + char WornName[65]; + char FocusName[65]; + char ScrollName[65]; + //BardName + + bool IsEquipable(uint16 Race, uint16 Class); + bool IsClassCommon(); + bool IsClassBag(); + bool IsClassBook(); + bool IsType1HWeapon(); + bool IsType2HWeapon(); + bool IsTypeShield(); + + bool IsEquipable(uint16 Race, uint16 Class) const { return const_cast(this)->IsEquipable(Race, Class); } + bool IsClassCommon() const { return const_cast(this)->IsClassCommon(); } + bool IsClassBag() const { return const_cast(this)->IsClassBag(); } + bool IsClassBook() const { return const_cast(this)->IsClassBook(); } + bool IsType1HWeapon() const { return const_cast(this)->IsType1HWeapon(); } + bool IsType2HWeapon() const { return const_cast(this)->IsType2HWeapon(); } + bool IsTypeShield() const { return const_cast(this)->IsTypeShield(); } + }; + +} /*EQEmu*/ + +#endif /*COMMON_ITEM_STRUCT_H*/ diff --git a/common/light_source.cpp b/common/light_source.cpp index c43395753..730a5bd78 100644 --- a/common/light_source.cpp +++ b/common/light_source.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) @@ -19,24 +19,8 @@ #include "light_source.h" +#include -EQEmu::lightsource::LightSourceProfile::LightSourceProfile() -{ - Clear(); -} - -void EQEmu::lightsource::LightSourceProfile::Clear() -{ - Type.Innate = 0; - Type.Equipment = 0; - Type.Spell = 0; - Type.Active = 0; - - Level.Innate = 0; - Level.Equipment = 0; - Level.Spell = 0; - Level.Active = 0; -} uint8 EQEmu::lightsource::TypeToLevel(uint8 light_type) { @@ -97,3 +81,19 @@ bool EQEmu::lightsource::IsLevelGreater(uint8 left_type, uint8 right_type) return (light_levels[left_type] > light_levels[right_type]); } + +EQEmu::lightsource::Light_Struct::Light_Struct() +{ + Clear(); +} + +void EQEmu::lightsource::Light_Struct::Clear() +{ + memset(&Slot, 0, (sizeof(uint8) * sizeof(Slot))); +} + +void EQEmu::LightSourceProfile::Clear() +{ + Type.Clear(); + Level.Clear(); +} diff --git a/common/light_source.h b/common/light_source.h index db93eaeb3..9c031712b 100644 --- a/common/light_source.h +++ b/common/light_source.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) @@ -26,6 +26,15 @@ namespace EQEmu { namespace lightsource { + enum LightSlot { + LightInnate = 0, // Defined by db field `npc_types`.`light` - where appropriate + LightEquipment, // Item_Struct::light value of worn/carried equipment + LightSpell, // Set value of any light-producing spell (can be modded to mimic equip_light behavior) + LightActive, // Highest value of all light sources + LightCount + }; + + enum LightType { LightTypeNone = 0, LightTypeCandle, @@ -61,47 +70,47 @@ namespace EQEmu LightLevelCount }; - struct LightSourceProfile { - /* - Current criteria (light types): - Equipment: { 0 .. 15 } - General: { 9 .. 13 } + struct Light_Struct { + uint8 Slot[LightCount]; - Notes: - - Initial character load and item movement updates use different light source update behaviors - -- Server procedure matches the item movement behavior since most updates occur post-character load - - MainAmmo is not considered when determining light sources - - No 'Sub' or 'Aug' items are recognized as light sources - - Light types '< 9' and '> 13' are not considered for general (carried) light sources - - If values > 0x0F are valid, then assignment limiters will need to be removed - - MainCursor 'appears' to be a valid light source update slot..but, have not experienced updates during debug sessions - - All clients have a bug regarding stackable items (light and sound updates are not processed when picking up an item) - -- The timer-based update cancels out the invalid light source - */ - LightSourceProfile(); + Light_Struct(); void Clear(); - // Light types (classifications) - struct { - uint8 Innate; // Defined by db field `npc_types`.`light` - where appropriate - uint8 Equipment; // Item_Struct::light value of worn/carried equipment - uint8 Spell; // Set value of any light-producing spell (can be modded to mimic equip_light behavior) - uint8 Active; // Highest value of all light sources - } Type; - - // Light levels (intensities) - used to determine which light source should be active - struct { - uint8 Innate; - uint8 Equipment; - uint8 Spell; - uint8 Active; - } Level; + inline uint8& operator[](LightSlot index) { return Slot[index]; } }; extern uint8 TypeToLevel(uint8 light_type); extern bool IsLevelGreater(uint8 left_type, uint8 right_type); - }; -} + + }; /*lightsource*/ -#endif /* COMMON_LIGHT_SOURCE_H */ + struct LightSourceProfile { + /* + Current criteria (light types): + Equipment: { 0 .. 15 } + General: { 9 .. 13 } + + Notes: + - Initial character load and item movement updates use different light source update behaviors + -- Server procedure matches the item movement behavior since most updates occur post-character load + - MainAmmo is not considered when determining light sources + - No 'Sub' or 'Aug' items are recognized as light sources + - Light types '< 9' and '> 13' are not considered for general (carried) light sources + - If values > 0x0F are valid, then assignment limiters will need to be removed + - MainCursor 'appears' to be a valid light source update slot..but, have not experienced updates during debug sessions + - All clients have a bug regarding stackable items (light and sound updates are not processed when picking up an item) + -- The timer-based update cancels out the invalid light source + */ + + lightsource::Light_Struct Type; // Light types (classifications) + lightsource::Light_Struct Level; // Light levels (intensities) - used to determine which light source should be active + + LightSourceProfile() { } + + void Clear(); + }; + +} /*EQEmu*/ + +#endif /*COMMON_LIGHT_SOURCE_H*/ diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 2cf9751e3..856e311a1 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -568,16 +568,16 @@ namespace RoF //store away the emu struct uchar* __emu_buffer = in->pBuffer; - int item_count = in->size / sizeof(InternalSerializedItem_Struct); - if (!item_count || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { + int item_count = in->size / sizeof(EQEmu::InternalSerializedItem_Struct); + if (!item_count || (in->size % sizeof(EQEmu::InternalSerializedItem_Struct)) != 0) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", - opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQEmu::InternalSerializedItem_Struct)); delete in; return; } - InternalSerializedItem_Struct* eq = (InternalSerializedItem_Struct*)in->pBuffer; + EQEmu::InternalSerializedItem_Struct* eq = (EQEmu::InternalSerializedItem_Struct*)in->pBuffer; EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -1512,7 +1512,7 @@ namespace RoF //store away the emu struct uchar* __emu_buffer = in->pBuffer; - InternalSerializedItem_Struct* int_struct = (InternalSerializedItem_Struct*)(&__emu_buffer[4]); + EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -5195,7 +5195,7 @@ namespace RoF void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) { - const Item_Struct *item = inst->GetUnscaledItem(); + const EQEmu::Item_Struct *item = inst->GetUnscaledItem(); RoF::structs::ItemSerializationHeader hdr; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index bb7b516df..b4576ed44 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -639,16 +639,16 @@ namespace RoF2 //store away the emu struct uchar* __emu_buffer = in->pBuffer; - int item_count = in->size / sizeof(InternalSerializedItem_Struct); - if (!item_count || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { + int item_count = in->size / sizeof(EQEmu::InternalSerializedItem_Struct); + if (!item_count || (in->size % sizeof(EQEmu::InternalSerializedItem_Struct)) != 0) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", - opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQEmu::InternalSerializedItem_Struct)); delete in; return; } - InternalSerializedItem_Struct* eq = (InternalSerializedItem_Struct*)in->pBuffer; + EQEmu::InternalSerializedItem_Struct* eq = (EQEmu::InternalSerializedItem_Struct*)in->pBuffer; EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -1584,7 +1584,7 @@ namespace RoF2 uchar* __emu_buffer = in->pBuffer; ItemPacket_Struct* old_item_pkt = (ItemPacket_Struct*)__emu_buffer; - InternalSerializedItem_Struct* int_struct = (InternalSerializedItem_Struct*)(&__emu_buffer[4]); + EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -5467,7 +5467,7 @@ namespace RoF2 void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type) { - const Item_Struct *item = inst->GetUnscaledItem(); + const EQEmu::Item_Struct *item = inst->GetUnscaledItem(); RoF2::structs::ItemSerializationHeader hdr; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 4434c4c86..1f1edaf79 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -372,16 +372,16 @@ namespace SoD //store away the emu struct uchar* __emu_buffer = in->pBuffer; - int item_count = in->size / sizeof(InternalSerializedItem_Struct); - if (!item_count || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { + int item_count = in->size / sizeof(EQEmu::InternalSerializedItem_Struct); + if (!item_count || (in->size % sizeof(EQEmu::InternalSerializedItem_Struct)) != 0) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", - opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQEmu::InternalSerializedItem_Struct)); delete in; return; } - InternalSerializedItem_Struct* eq = (InternalSerializedItem_Struct*)in->pBuffer; + EQEmu::InternalSerializedItem_Struct* eq = (EQEmu::InternalSerializedItem_Struct*)in->pBuffer; EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -1043,7 +1043,7 @@ namespace SoD //store away the emu struct uchar* __emu_buffer = in->pBuffer; - InternalSerializedItem_Struct* int_struct = (InternalSerializedItem_Struct*)(&__emu_buffer[4]); + EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -3555,7 +3555,7 @@ namespace SoD void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) { - const Item_Struct *item = inst->GetUnscaledItem(); + const EQEmu::Item_Struct *item = inst->GetUnscaledItem(); SoD::structs::ItemSerializationHeader hdr; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index c7996c46c..debf75621 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -354,16 +354,16 @@ namespace SoF //store away the emu struct uchar* __emu_buffer = in->pBuffer; - int item_count = in->size / sizeof(InternalSerializedItem_Struct); - if (!item_count || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { + int item_count = in->size / sizeof(EQEmu::InternalSerializedItem_Struct); + if (!item_count || (in->size % sizeof(EQEmu::InternalSerializedItem_Struct)) != 0) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", - opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQEmu::InternalSerializedItem_Struct)); delete in; return; } - InternalSerializedItem_Struct* eq = (InternalSerializedItem_Struct*)in->pBuffer; + EQEmu::InternalSerializedItem_Struct* eq = (EQEmu::InternalSerializedItem_Struct*)in->pBuffer; EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -843,7 +843,7 @@ namespace SoF //store away the emu struct uchar* __emu_buffer = in->pBuffer; - InternalSerializedItem_Struct* int_struct = (InternalSerializedItem_Struct*)(&__emu_buffer[4]); + EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -2880,7 +2880,7 @@ namespace SoF void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) { - const Item_Struct *item = inst->GetUnscaledItem(); + const EQEmu::Item_Struct *item = inst->GetUnscaledItem(); SoF::structs::ItemSerializationHeader hdr; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index aa9f9b978..6dcca92f5 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -289,14 +289,15 @@ namespace Titanium //store away the emu struct uchar* __emu_buffer = in->pBuffer; - int itemcount = in->size / sizeof(InternalSerializedItem_Struct); - if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + int itemcount = in->size / sizeof(EQEmu::InternalSerializedItem_Struct); + if (itemcount == 0 || (in->size % sizeof(EQEmu::InternalSerializedItem_Struct)) != 0) { + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQEmu::InternalSerializedItem_Struct)); delete in; return; } - InternalSerializedItem_Struct* eq = (InternalSerializedItem_Struct*)in->pBuffer; + EQEmu::InternalSerializedItem_Struct* eq = (EQEmu::InternalSerializedItem_Struct*)in->pBuffer; //do the transform... EQEmu::OutBuffer ob; @@ -742,7 +743,7 @@ namespace Titanium //store away the emu struct uchar* __emu_buffer = in->pBuffer; - InternalSerializedItem_Struct* int_struct = (InternalSerializedItem_Struct*)(&__emu_buffer[4]); + EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -2101,7 +2102,7 @@ namespace Titanium void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) { const char* protection = "\\\\\\\\\\"; - const Item_Struct* item = inst->GetUnscaledItem(); + const EQEmu::Item_Struct* item = inst->GetUnscaledItem(); ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem; @@ -2114,7 +2115,7 @@ namespace Titanium ob << '|' << itoa((inst->IsScaling() ? (inst->GetExp() / 100) : 0)); // inst experience ob << '|' << itoa((!inst->GetMerchantSlot() ? inst->GetSerialNumber() : inst->GetMerchantSlot())); // merchant serial number ob << '|' << itoa(inst->GetRecastTimestamp()); // recast timestamp - ob << '|' << itoa(((inst->IsStackable() ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : inst->GetCharges()))); // charge count + ob << '|' << itoa(((inst->IsStackable() ? ((inst->GetItem()->ItemType == EQEmu::item::ItemTypePotion) ? 1 : 0) : inst->GetCharges()))); // charge count ob << '|' << itoa((inst->IsAttuned() ? 1 : 0)); // inst attuned ob << '|' << itoa(0); // unknown ob << '|'; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 7513c9f60..1baf306c7 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -510,16 +510,16 @@ namespace UF //store away the emu struct uchar* __emu_buffer = in->pBuffer; - int item_count = in->size / sizeof(InternalSerializedItem_Struct); - if (!item_count || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { + int item_count = in->size / sizeof(EQEmu::InternalSerializedItem_Struct); + if (!item_count || (in->size % sizeof(EQEmu::InternalSerializedItem_Struct)) != 0) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", - opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQEmu::InternalSerializedItem_Struct)); delete in; return; } - InternalSerializedItem_Struct* eq = (InternalSerializedItem_Struct*)in->pBuffer; + EQEmu::InternalSerializedItem_Struct* eq = (EQEmu::InternalSerializedItem_Struct*)in->pBuffer; EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -1269,7 +1269,7 @@ namespace UF //store away the emu struct uchar* __emu_buffer = in->pBuffer; - InternalSerializedItem_Struct* int_struct = (InternalSerializedItem_Struct*)(&__emu_buffer[4]); + EQEmu::InternalSerializedItem_Struct* int_struct = (EQEmu::InternalSerializedItem_Struct*)(&__emu_buffer[4]); EQEmu::OutBuffer ob; EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); @@ -3830,7 +3830,7 @@ namespace UF void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) { - const Item_Struct *item = inst->GetUnscaledItem(); + const EQEmu::Item_Struct *item = inst->GetUnscaledItem(); UF::structs::ItemSerializationHeader hdr; @@ -3874,7 +3874,7 @@ namespace UF int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); uint16 ornaIcon = 0; if (inst->GetOrnamentationAug(ornamentationAugtype)) { - const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + const EQEmu::Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); ornaIcon = aug_weap->Icon; ob.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); diff --git a/common/say_link.cpp b/common/say_link.cpp index 1cfe2635a..3cfc46878 100644 --- a/common/say_link.cpp +++ b/common/say_link.cpp @@ -98,7 +98,7 @@ void EQEmu::saylink::SayLinkEngine::generate_body() memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct)); - const Item_Struct* item_data = nullptr; + const EQEmu::Item_Struct* item_data = nullptr; switch (m_LinkType) { case SayLinkBlank: @@ -201,7 +201,7 @@ void EQEmu::saylink::SayLinkEngine::generate_text() return; } - const Item_Struct* item_data = nullptr; + const EQEmu::Item_Struct* item_data = nullptr; switch (m_LinkType) { case SayLinkBlank: @@ -274,4 +274,4 @@ bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkB return false; return true; -} \ No newline at end of file +} diff --git a/common/say_link.h b/common/say_link.h index c422bf7b2..5230f7b15 100644 --- a/common/say_link.h +++ b/common/say_link.h @@ -25,13 +25,14 @@ #include -struct Item_Struct; struct ServerLootItem_Struct; class ItemInst; namespace EQEmu { + struct Item_Struct; + namespace saylink { struct SayLinkBody_Struct; // Current server mask: EQClientRoF2 @@ -73,7 +74,7 @@ public: SayLinkEngine(); void SetLinkType(SayLinkType link_type) { m_LinkType = link_type; } - void SetItemData(const Item_Struct* item_data) { m_ItemData = item_data; } + void SetItemData(const EQEmu::Item_Struct* item_data) { m_ItemData = item_data; } void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_data; } void SetItemInst(const ItemInst* item_inst) { m_ItemInst = item_inst; } @@ -109,7 +110,7 @@ private: void generate_text(); int m_LinkType; - const Item_Struct* m_ItemData; + const EQEmu::Item_Struct* m_ItemData; const ServerLootItem_Struct* m_LootData; const ItemInst* m_ItemInst; @@ -135,4 +136,4 @@ private: bool m_Error; }; -#endif /* COMMON_SAY_LINK_H */ +#endif /*COMMON_SAY_LINK_H*/ diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a83665147..26156a895 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -192,11 +192,11 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer - uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; - if (inst->IsType(ItemClassCommon)) { + uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 }; + if (inst->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { ItemInst *auginst = inst->GetItem(i); - augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; + augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } @@ -221,7 +221,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) + if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { @@ -239,11 +239,11 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer - uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; - if (inst->IsType(ItemClassCommon)) { + uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 }; + if (inst->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { ItemInst *auginst = inst->GetItem(i); - augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; + augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } @@ -267,7 +267,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) { + if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) { // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { @@ -364,7 +364,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { - const Item_Struct* myitem; + const EQEmu::Item_Struct* myitem; std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items " "WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND " @@ -408,13 +408,13 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) "sb.augslot1, sb.augslot2, sb.augslot3, " "sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data " "FROM sharedbank sb INNER JOIN character_data ch " - "ON ch.account_id=sb.acctid WHERE ch.id = %i", + "ON ch.account_id=sb.acctid WHERE ch.id = %i ORDER BY sb.slotid", id); else query = StringFormat("SELECT slotid, itemid, charges, " "augslot1, augslot2, augslot3, " "augslot4, augslot5, augslot6, custom_data " - "FROM sharedbank WHERE acctid=%i", + "FROM sharedbank WHERE acctid=%i ORDER BY slotid", id); auto results = QueryDatabase(query); if (!results.Success()) { @@ -436,7 +436,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) aug[4] = (uint32)atoi(row[7]); aug[5] = (uint32)atoi(row[8]); - const Item_Struct *item = GetItem(item_id); + const EQEmu::Item_Struct *item = GetItem(item_id); if (!item) { Log.Out(Logs::General, Logs::Error, @@ -448,7 +448,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) int16 put_slot_id = INVALID_INDEX; ItemInst *inst = CreateBaseItem(item, charges); - if (inst && item->ItemClass == ItemClassCommon) { + if (inst && item->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); @@ -538,7 +538,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) uint32 ornament_idfile = (uint32)atoul(row[13]); uint32 ornament_hero_model = (uint32)atoul(row[14]); - const Item_Struct *item = GetItem(item_id); + const EQEmu::Item_Struct *item = GetItem(item_id); if (!item) { Log.Out(Logs::General, Logs::Error, @@ -608,7 +608,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) inst->SetRecastTimestamp(0); } - if (item->ItemClass == ItemClassCommon) { + if (item->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); @@ -679,7 +679,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) uint32 ornament_idfile = (uint32)atoul(row[13]); uint32 ornament_hero_model = (uint32)atoul(row[14]); - const Item_Struct *item = GetItem(item_id); + const EQEmu::Item_Struct *item = GetItem(item_id); int16 put_slot_id = INVALID_INDEX; if (!item) continue; @@ -726,7 +726,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) inst->SetCharges(charges); - if (item->ItemClass == ItemClassCommon) { + if (item->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); @@ -815,7 +815,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("items"); items_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name)); - items_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size())); + items_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size())); mutex.Unlock(); } catch(std::exception& ex) { Log.Out(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what()); @@ -827,7 +827,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id) { - EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); + EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); std::string ndbuffer; bool disableNoRent = false; @@ -855,7 +855,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } } - Item_Struct item; + EQEmu::Item_Struct item; const std::string query = "SELECT source," #define F(x) "`"#x"`," @@ -868,7 +868,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } for (auto row = results.begin(); row != results.end(); ++row) { - memset(&item, 0, sizeof(Item_Struct)); + memset(&item, 0, sizeof(EQEmu::Item_Struct)); item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); strcpy(item.Name, row[ItemField::name]); @@ -1085,7 +1085,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } } -const Item_Struct* SharedDatabase::GetItem(uint32 id) { +const EQEmu::Item_Struct* SharedDatabase::GetItem(uint32 id) { if (id == 0) { return nullptr; @@ -1104,7 +1104,7 @@ const Item_Struct* SharedDatabase::GetItem(uint32 id) { return nullptr; } -const Item_Struct* SharedDatabase::IterateItems(uint32* id) { +const EQEmu::Item_Struct* SharedDatabase::IterateItems(uint32* id) { if(!items_hash || !id) { return nullptr; } @@ -1251,7 +1251,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) { // Create appropriate ItemInst class ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; ItemInst* inst = nullptr; item = GetItem(item_id); @@ -1278,7 +1278,7 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, // Create appropriate ItemInst class -ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) +ItemInst* SharedDatabase::CreateItem(const EQEmu::Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { ItemInst* inst = nullptr; if (item) { @@ -1302,7 +1302,7 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin return inst; } -ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) { +ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::Item_Struct* item, int16 charges) { ItemInst* inst = nullptr; if (item) { // if maxcharges is -1 that means it is an unlimited use item. diff --git a/common/shareddb.h b/common/shareddb.h index 45db3e3c0..bf21313b7 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -39,12 +39,12 @@ struct BaseDataStruct; struct InspectMessage_Struct; struct PlayerProfile_Struct; struct SPDat_Spell_Struct; -struct Item_Struct; struct NPCFactionList; struct LootTable_Struct; struct LootDrop_Struct; namespace EQEmu { + struct Item_Struct; class MemoryMappedFile; } @@ -99,8 +99,8 @@ class SharedDatabase : public Database Item Methods */ ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); - ItemInst* CreateItem(const Item_Struct* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); - ItemInst* CreateBaseItem(const Item_Struct* item, int16 charges = 0); + ItemInst* CreateItem(const EQEmu::Item_Struct* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); + ItemInst* CreateBaseItem(const EQEmu::Item_Struct* item, int16 charges = 0); /* Shared Memory crap @@ -110,8 +110,8 @@ class SharedDatabase : public Database void GetItemsCount(int32 &item_count, uint32 &max_id); void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id); bool LoadItems(const std::string &prefix); - const Item_Struct* IterateItems(uint32* id); - const Item_Struct* GetItem(uint32 id); + const EQEmu::Item_Struct* IterateItems(uint32* id); + const EQEmu::Item_Struct* GetItem(uint32 id); const EvolveInfo* GetEvolveInfo(uint32 loregroup); //faction lists @@ -148,7 +148,7 @@ class SharedDatabase : public Database std::unique_ptr skill_caps_mmf; std::unique_ptr items_mmf; - std::unique_ptr> items_hash; + std::unique_ptr> items_hash; std::unique_ptr faction_mmf; std::unique_ptr> faction_hash; std::unique_ptr loot_table_mmf; diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index 4987d6735..886050d13 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -35,7 +35,7 @@ void LoadItems(SharedDatabase *database, const std::string &prefix) { EQ_EXCEPT("Shared Memory", "Unable to get any items from the database."); } - uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); std::string file_name = Config->SharedMemDir + prefix + std::string("items"); EQEmu::MemoryMappedFile mmf(file_name, size); diff --git a/tests/fixed_memory_test.h b/tests/fixed_memory_test.h index fcff0c9e8..e0c74bac9 100644 --- a/tests/fixed_memory_test.h +++ b/tests/fixed_memory_test.h @@ -27,7 +27,7 @@ class FixedMemoryHashTest : public Test::Suite { typedef void(FixedMemoryHashTest::*TestFunction)(void); public: FixedMemoryHashTest() { - size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); + size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); data_ = new uint8[size_]; memset(data_, 0, size_); TEST_ADD(FixedMemoryHashTest::InitTest); @@ -49,7 +49,7 @@ public: private: void InitTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); + EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); TEST_ASSERT(!hash.exists(1001)); TEST_ASSERT(hash.size() == 0); TEST_ASSERT(hash.max_size() == 72000); @@ -57,7 +57,7 @@ public: } void LoadTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(!hash.exists(1001)); TEST_ASSERT(hash.size() == 0); TEST_ASSERT(hash.max_size() == 72000); @@ -65,8 +65,8 @@ public: } void InsertTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::Item_Struct item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Iron Sword"); item.ID = 1001; @@ -79,20 +79,20 @@ public: } void RetrieveTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 1); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - Item_Struct item = hash[1001]; + EQEmu::Item_Struct item = hash[1001]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1001); } void OverwriteTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::Item_Struct item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Steel Sword"); item.ID = 1001; @@ -105,20 +105,20 @@ public: } void OverwriteRetrieveTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 1); TEST_ASSERT((hash.max_size() == 72000)); TEST_ASSERT(!hash.empty()); - Item_Struct item = hash[1001]; + EQEmu::Item_Struct item = hash[1001]; TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); TEST_ASSERT(item.ID == 1001); } void InsertAgainTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::Item_Struct item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Iron Sword"); item.ID = 1000; @@ -132,14 +132,14 @@ public: } void RetrieveAgainTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1000)); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 2); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - Item_Struct item = hash[1000]; + EQEmu::Item_Struct item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); @@ -149,8 +149,8 @@ public: } void InsertBeginTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::Item_Struct item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Bronze Sword"); item.ID = 0; @@ -165,7 +165,7 @@ public: } void RetrieveBeginTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1000)); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.exists(0)); @@ -173,7 +173,7 @@ public: TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - Item_Struct item = hash[1000]; + EQEmu::Item_Struct item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); @@ -187,8 +187,8 @@ public: } void InsertEndTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - Item_Struct item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::Item_Struct item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Jade Sword"); item.ID = 190000; @@ -204,7 +204,7 @@ public: } void RetrieveEndTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1000)); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.exists(0)); @@ -213,7 +213,7 @@ public: TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - Item_Struct item = hash[1000]; + EQEmu::Item_Struct item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 50513af1e..0deb8c052 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -245,7 +245,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou /* Load Inventory */ // If we ensure that the material data is updated appropriately, we can do away with inventory loads if (GetInventory(accountID, cse->Name, &inv)) { - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; const ItemInst* inst = nullptr; int16 invslot = 0; diff --git a/zone/aa.cpp b/zone/aa.cpp index 210e88cd2..58d72af55 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -423,7 +423,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) uint32 sitem = 0; sitem = CorpseToUse->GetWornItem(x); if(sitem){ - const Item_Struct * itm = database.GetItem(sitem); + const EQEmu::Item_Struct * itm = database.GetItem(sitem); npca->AddLootDrop(itm, &npca->itemlist, 1, 1, 127, true, true); } } diff --git a/zone/attack.cpp b/zone/attack.cpp index 712198733..a401c71c5 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -54,110 +54,75 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w { // Determine animation int type = 0; - if (weapon && weapon->IsType(ItemClassCommon)) { - const Item_Struct* item = weapon->GetItem(); + if (weapon && weapon->IsClassCommon()) { + const EQEmu::Item_Struct* item = weapon->GetItem(); Log.Out(Logs::Detail, Logs::Attack, "Weapon skill : %i", item->ItemType); - switch (item->ItemType) - { - case ItemType1HSlash: // 1H Slashing - { - skillinuse = Skill1HSlashing; - type = anim1HWeapon; - break; - } - case ItemType2HSlash: // 2H Slashing - { - skillinuse = Skill2HSlashing; - type = anim2HSlashing; - break; - } - case ItemType1HPiercing: // Piercing - { + switch (item->ItemType) { + case EQEmu::item::ItemType1HSlash: // 1H Slashing + skillinuse = Skill1HSlashing; + type = anim1HWeapon; + break; + case EQEmu::item::ItemType2HSlash: // 2H Slashing + skillinuse = Skill2HSlashing; + type = anim2HSlashing; + break; + case EQEmu::item::ItemType1HPiercing: // Piercing + skillinuse = Skill1HPiercing; + type = anim1HPiercing; + break; + case EQEmu::item::ItemType1HBlunt: // 1H Blunt + skillinuse = Skill1HBlunt; + type = anim1HWeapon; + break; + case EQEmu::item::ItemType2HBlunt: // 2H Blunt + skillinuse = Skill2HBlunt; + type = anim2HSlashing; //anim2HWeapon + break; + case EQEmu::item::ItemType2HPiercing: // 2H Piercing + if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) skillinuse = Skill1HPiercing; - type = anim1HPiercing; - break; - } - case ItemType1HBlunt: // 1H Blunt - { - skillinuse = Skill1HBlunt; - type = anim1HWeapon; - break; - } - case ItemType2HBlunt: // 2H Blunt - { - skillinuse = Skill2HBlunt; - type = anim2HSlashing; //anim2HWeapon - break; - } - case ItemType2HPiercing: // 2H Piercing - { - if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - skillinuse = Skill1HPiercing; - else - skillinuse = Skill2HPiercing; - type = anim2HWeapon; - break; - } - case ItemTypeMartial: - { - skillinuse = SkillHandtoHand; - type = animHand2Hand; - break; - } - default: - { - skillinuse = SkillHandtoHand; - type = animHand2Hand; - break; - } + else + skillinuse = Skill2HPiercing; + type = anim2HWeapon; + break; + case EQEmu::item::ItemTypeMartial: + skillinuse = SkillHandtoHand; + type = animHand2Hand; + break; + default: + skillinuse = SkillHandtoHand; + type = animHand2Hand; + break; }// switch } else if(IsNPC()) { - - switch (skillinuse) - { - case Skill1HSlashing: // 1H Slashing - { - type = anim1HWeapon; - break; - } - case Skill2HSlashing: // 2H Slashing - { - type = anim2HSlashing; - break; - } - case Skill1HPiercing: // Piercing - { - type = anim1HPiercing; - break; - } - case Skill1HBlunt: // 1H Blunt - { - type = anim1HWeapon; - break; - } - case Skill2HBlunt: // 2H Blunt - { - type = anim2HSlashing; //anim2HWeapon - break; - } - case Skill2HPiercing: // 2H Piercing - { - type = anim2HWeapon; - break; - } - case SkillHandtoHand: - { - type = animHand2Hand; - break; - } - default: - { - type = animHand2Hand; - break; - } + switch (skillinuse) { + case Skill1HSlashing: // 1H Slashing + type = anim1HWeapon; + break; + case Skill2HSlashing: // 2H Slashing + type = anim2HSlashing; + break; + case Skill1HPiercing: // Piercing + type = anim1HPiercing; + break; + case Skill1HBlunt: // 1H Blunt + type = anim1HWeapon; + break; + case Skill2HBlunt: // 2H Blunt + type = anim2HSlashing; //anim2HWeapon + break; + case Skill2HPiercing: // 2H Piercing + type = anim2HWeapon; + break; + case SkillHandtoHand: + type = animHand2Hand; + break; + default: + type = animHand2Hand; + break; }// switch } else { @@ -825,7 +790,7 @@ int32 Client::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit, //Else we know we can hit. //GetWeaponDamage(mob*, const Item_Struct*) is intended to be used for mobs or any other situation where we do not have a client inventory item //GetWeaponDamage(mob*, const ItemInst*) is intended to be used for situations where we have a client inventory item -int Mob::GetWeaponDamage(Mob *against, const Item_Struct *weapon_item) { +int Mob::GetWeaponDamage(Mob *against, const EQEmu::Item_Struct *weapon_item) { int dmg = 0; int banedmg = 0; @@ -1151,7 +1116,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b // Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above // who belong to a melee class. If we're here, then all of these conditions apply. - ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const Item_Struct*) nullptr ); + ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const EQEmu::Item_Struct*) nullptr ); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; @@ -1162,7 +1127,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (Hand == EQEmu::legacy::SlotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const Item_Struct*) nullptr, true ); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::Item_Struct*) nullptr, true ); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; @@ -1630,7 +1595,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } //figure out what weapon they are using, if any - const Item_Struct* weapon = nullptr; + const EQEmu::Item_Struct* weapon = nullptr; if (Hand == EQEmu::legacy::SlotPrimary && equipment[EQEmu::legacy::SlotPrimary] > 0) weapon = database.GetItem(equipment[EQEmu::legacy::SlotPrimary]); else if (equipment[EQEmu::legacy::SlotSecondary]) @@ -1641,40 +1606,40 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(weapon) { Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); - if (Hand == EQEmu::legacy::SlotSecondary && weapon->ItemType == ItemTypeShield){ + if (Hand == EQEmu::legacy::SlotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield){ Log.Out(Logs::Detail, Logs::Combat, "Attack with shield canceled."); return false; } - switch(weapon->ItemType){ - case ItemType1HSlash: - skillinuse = Skill1HSlashing; - break; - case ItemType2HSlash: - skillinuse = Skill2HSlashing; - break; - case ItemType1HPiercing: - skillinuse = Skill1HPiercing; - break; - case ItemType2HPiercing: - skillinuse = Skill2HPiercing; - break; - case ItemType1HBlunt: - skillinuse = Skill1HBlunt; - break; - case ItemType2HBlunt: - skillinuse = Skill2HBlunt; - break; - case ItemTypeBow: - skillinuse = SkillArchery; - break; - case ItemTypeLargeThrowing: - case ItemTypeSmallThrowing: - skillinuse = SkillThrowing; - break; - default: - skillinuse = SkillHandtoHand; - break; + switch(weapon->ItemType) { + case EQEmu::item::ItemType1HSlash: + skillinuse = Skill1HSlashing; + break; + case EQEmu::item::ItemType2HSlash: + skillinuse = Skill2HSlashing; + break; + case EQEmu::item::ItemType1HPiercing: + skillinuse = Skill1HPiercing; + break; + case EQEmu::item::ItemType2HPiercing: + skillinuse = Skill2HPiercing; + break; + case EQEmu::item::ItemType1HBlunt: + skillinuse = Skill1HBlunt; + break; + case EQEmu::item::ItemType2HBlunt: + skillinuse = Skill2HBlunt; + break; + case EQEmu::item::ItemTypeBow: + skillinuse = SkillArchery; + break; + case EQEmu::item::ItemTypeLargeThrowing: + case EQEmu::item::ItemTypeSmallThrowing: + skillinuse = SkillThrowing; + break; + default: + skillinuse = SkillHandtoHand; + break; } } @@ -2542,7 +2507,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { } } -uint8 Mob::GetWeaponDamageBonus(const Item_Struct *weapon, bool offhand) +uint8 Mob::GetWeaponDamageBonus(const EQEmu::Item_Struct *weapon, bool offhand) { // dev quote with old and new formulas // https://forums.daybreakgames.com/eq/index.php?threads/test-update-09-17-15.226618/page-5#post-3326194 @@ -2554,8 +2519,7 @@ uint8 Mob::GetWeaponDamageBonus(const Item_Struct *weapon, bool offhand) return 1 + ((level - 28) / 3); // how does weaponless scale? auto delay = weapon->Delay; - if (weapon->ItemType == ItemType1HSlash || weapon->ItemType == ItemType1HBlunt || - weapon->ItemType == ItemTypeMartial || weapon->ItemType == ItemType1HPiercing) { + if (weapon->IsType1HWeapon() || weapon->ItemType == EQEmu::item::ItemTypeMartial) { // we assume sinister strikes is checked before calling here if (!offhand) { if (delay <= 39) @@ -3574,12 +3538,12 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { } if(!weapon_g) { - TrySpellProc(nullptr, (const Item_Struct*)nullptr, on); + TrySpellProc(nullptr, (const EQEmu::Item_Struct*)nullptr, on); return; } - if(!weapon_g->IsType(ItemClassCommon)) { - TrySpellProc(nullptr, (const Item_Struct*)nullptr, on); + if (!weapon_g->IsClassCommon()) { + TrySpellProc(nullptr, (const EQEmu::Item_Struct*)nullptr, on); return; } @@ -3592,7 +3556,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { return; } -void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 hand) +void Mob::TryWeaponProc(const ItemInst *inst, const EQEmu::Item_Struct *weapon, Mob *on, uint16 hand) { if (!weapon) @@ -3611,7 +3575,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on // We can proc once here, either weapon or one aug bool proced = false; // silly bool to prevent augs from going if weapon does skillinuse = GetSkillByItemType(weapon->ItemType); - if (weapon->Proc.Type == ET_CombatProc && IsValidSpell(weapon->Proc.Effect)) { + if (weapon->Proc.Type == EQEmu::item::ItemEffectCombatProc && IsValidSpell(weapon->Proc.Effect)) { float WPC = ProcChance * (100.0f + // Proc chance for this weapon static_cast(weapon->ProcRate)) / 100.0f; if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. @@ -3645,11 +3609,11 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on const ItemInst *aug_i = inst->GetAugment(r); if (!aug_i) // no aug, try next slot! continue; - const Item_Struct *aug = aug_i->GetItem(); + const EQEmu::Item_Struct *aug = aug_i->GetItem(); if (!aug) continue; - if (aug->Proc.Type == ET_CombatProc && IsValidSpell(aug->Proc.Effect)) { + if (aug->Proc.Type == EQEmu::item::ItemEffectCombatProc && IsValidSpell(aug->Proc.Effect)) { float APC = ProcChance * (100.0f + // Proc chance for this aug static_cast(aug->ProcRate)) / 100.0f; if (zone->random.Roll(APC)) { @@ -3675,7 +3639,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on return; } -void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 hand) +void Mob::TrySpellProc(const ItemInst *inst, const EQEmu::Item_Struct *weapon, Mob *on, uint16 hand) { float ProcBonus = static_cast(spellbonuses.SpellProcChance + itembonuses.SpellProcChance + aabonuses.SpellProcChance); @@ -3687,11 +3651,12 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, bool rangedattk = false; if (weapon && hand == EQEmu::legacy::SlotRange) { - if (weapon->ItemType == ItemTypeArrow || - weapon->ItemType == ItemTypeLargeThrowing || - weapon->ItemType == ItemTypeSmallThrowing || - weapon->ItemType == ItemTypeBow) + if (weapon->ItemType == EQEmu::item::ItemTypeArrow || + weapon->ItemType == EQEmu::item::ItemTypeLargeThrowing || + weapon->ItemType == EQEmu::item::ItemTypeSmallThrowing || + weapon->ItemType == EQEmu::item::ItemTypeBow) { rangedattk = true; + } } if (!weapon && hand == EQEmu::legacy::SlotRange && GetSpecialAbility(SPECATK_RANGED_ATK)) @@ -4531,7 +4496,7 @@ void Client::SetAttackTimer() else //invalid slot (hands will always hit this) continue; - const Item_Struct *ItemToUse = nullptr; + const EQEmu::Item_Struct *ItemToUse = nullptr; //find our item ItemInst *ci = GetInv().GetItem(i); @@ -4550,16 +4515,16 @@ void Client::SetAttackTimer() //see if we have a valid weapon if (ItemToUse != nullptr) { //check type and damage/delay - if (ItemToUse->ItemClass != ItemClassCommon - || ItemToUse->Damage == 0 - || ItemToUse->Delay == 0) { + if (!ItemToUse->IsClassCommon() + || ItemToUse->Damage == 0 + || ItemToUse->Delay == 0) { //no weapon ItemToUse = nullptr; } // Check to see if skill is valid - else if ((ItemToUse->ItemType > ItemTypeLargeThrowing) && - (ItemToUse->ItemType != ItemTypeMartial) && - (ItemToUse->ItemType != ItemType2HPiercing)) { + else if ((ItemToUse->ItemType > EQEmu::item::ItemTypeLargeThrowing) && + (ItemToUse->ItemType != EQEmu::item::ItemTypeMartial) && + (ItemToUse->ItemType != EQEmu::item::ItemType2HPiercing)) { //no weapon ItemToUse = nullptr; } @@ -4578,7 +4543,7 @@ void Client::SetAttackTimer() speed = delay / haste_mod; - if (ItemToUse && ItemToUse->ItemType == ItemTypeBow) { + if (ItemToUse && ItemToUse->ItemType == EQEmu::item::ItemTypeBow) { // Live actually had a bug here where they would return the non-modified attack speed // rather than the cap ... speed = std::max(speed - GetQuiverHaste(speed), RuleI(Combat, QuiverHasteCap)); diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 899cee359..c5c1c92d2 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -152,14 +152,14 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { AddItemBonuses(inst, newbon, false, false, 0, (i == EQEmu::legacy::SlotAmmo)); //These are given special flags due to how often they are checked for various spell effects. - const Item_Struct *item = inst->GetItem(); - if (i == EQEmu::legacy::SlotSecondary && (item && item->ItemType == ItemTypeShield)) + const EQEmu::Item_Struct *item = inst->GetItem(); + if (i == EQEmu::legacy::SlotSecondary && (item && item->ItemType == EQEmu::item::ItemTypeShield)) SetShieldEquiped(true); - else if (i == EQEmu::legacy::SlotPrimary && (item && item->ItemType == ItemType2HBlunt)) { + else if (i == EQEmu::legacy::SlotPrimary && (item && item->ItemType == EQEmu::item::ItemType2HBlunt)) { SetTwoHandBluntEquiped(true); SetTwoHanderEquipped(true); } - else if (i == EQEmu::legacy::SlotPrimary && (item && (item->ItemType == ItemType2HSlash || item->ItemType == ItemType2HPiercing))) + else if (i == EQEmu::legacy::SlotPrimary && (item && (item->ItemType == EQEmu::item::ItemType2HSlash || item->ItemType == EQEmu::item::ItemType2HPiercing))) SetTwoHanderEquipped(true); } @@ -180,7 +180,7 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { } //Optional ability to have worn effects calculate as an addititive bonus instead of highest value - if (RuleI(Spells, AdditiveBonusWornType) && RuleI(Spells, AdditiveBonusWornType) != ET_WornEffect){ + if (RuleI(Spells, AdditiveBonusWornType) && RuleI(Spells, AdditiveBonusWornType) != EQEmu::item::ItemEffectWorn){ for (i = EQEmu::legacy::SlotCharm; i < EQEmu::legacy::SlotAmmo; i++) { const ItemInst* inst = m_inv[i]; if(inst == 0) @@ -210,7 +210,7 @@ void Client::ProcessItemCaps() void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAug, bool isTribute, int rec_override, bool ammo_slot_item) { - if (!inst || !inst->IsType(ItemClassCommon)) { + if (!inst || !inst->IsClassCommon()) { return; } @@ -218,10 +218,10 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAu return; } - const Item_Struct *item = inst->GetItem(); + const EQEmu::Item_Struct *item = inst->GetItem(); if (!isTribute && !inst->IsEquipable(GetBaseRace(), GetClass())) { - if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink) + if (item->ItemType != EQEmu::item::ItemTypeFood && item->ItemType != EQEmu::item::ItemTypeDrink) return; } @@ -430,11 +430,11 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAu else newbon->DSMitigation += item->DSMitigation; } - if (item->Worn.Effect > 0 && item->Worn.Type == ET_WornEffect) { // latent effects + if (item->Worn.Effect > 0 && item->Worn.Type == EQEmu::item::ItemEffectWorn) { // latent effects ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, newbon, 0, item->Worn.Type); } - if (item->Focus.Effect > 0 && (item->Focus.Type == ET_Focus)) { // focus effects + if (item->Focus.Effect > 0 && (item->Focus.Type == EQEmu::item::ItemEffectFocus)) { // focus effects ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, newbon, 0); } @@ -544,13 +544,13 @@ void Client::AdditiveWornBonuses(const ItemInst *inst, StatBonuses* newbon, bool which will also stack with regular (worntype 2) effects. [Ie set rule = 3 and item worntype = 3] */ - if(!inst || !inst->IsType(ItemClassCommon)) + if (!inst || !inst->IsClassCommon()) return; if(inst->GetAugmentType()==0 && isAug == true) return; - const Item_Struct *item = inst->GetItem(); + const EQEmu::Item_Struct *item = inst->GetItem(); if(!inst->IsEquipable(GetBaseRace(),GetClass())) return; @@ -581,11 +581,11 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { if (food && drink) break; const ItemInst* inst = GetInv().GetItem(i); - if (inst && inst->GetItem() && inst->IsType(ItemClassCommon)) { - const Item_Struct *item=inst->GetItem(); - if (item->ItemType == ItemTypeFood && !food) + if (inst && inst->GetItem() && inst->IsClassCommon()) { + const EQEmu::Item_Struct *item=inst->GetItem(); + if (item->ItemType == EQEmu::item::ItemTypeFood && !food) food = true; - else if (item->ItemType == ItemTypeDrink && !drink) + else if (item->ItemType == EQEmu::item::ItemTypeDrink && !drink) drink = true; else continue; @@ -597,11 +597,11 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { if (food && drink) break; const ItemInst* inst = GetInv().GetItem(i); - if (inst && inst->GetItem() && inst->IsType(ItemClassCommon)) { - const Item_Struct *item=inst->GetItem(); - if (item->ItemType == ItemTypeFood && !food) + if (inst && inst->GetItem() && inst->IsClassCommon()) { + const EQEmu::Item_Struct *item=inst->GetItem(); + if (item->ItemType == EQEmu::item::ItemTypeFood && !food) food = true; - else if (item->ItemType == ItemTypeDrink && !drink) + else if (item->ItemType == EQEmu::item::ItemTypeDrink && !drink) drink = true; else continue; @@ -911,19 +911,19 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) break; case SE_AddSingingMod: switch (base2) { - case ItemTypeWindInstrument: + case EQEmu::item::ItemTypeWindInstrument: newbon->windMod += base1; break; - case ItemTypeStringedInstrument: + case EQEmu::item::ItemTypeStringedInstrument: newbon->stringedMod += base1; break; - case ItemTypeBrassInstrument: + case EQEmu::item::ItemTypeBrassInstrument: newbon->brassMod += base1; break; - case ItemTypePercussionInstrument: + case EQEmu::item::ItemTypePercussionInstrument: newbon->percussionMod += base1; break; - case ItemTypeSinging: + case EQEmu::item::ItemTypeSinging: newbon->singingMod += base1; break; } @@ -2753,23 +2753,24 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne break; case SE_AddSingingMod: - switch (base2) - { - case ItemTypeWindInstrument: - new_bonus->windMod += effect_value; - break; - case ItemTypeStringedInstrument: - new_bonus->stringedMod += effect_value; - break; - case ItemTypeBrassInstrument: - new_bonus->brassMod += effect_value; - break; - case ItemTypePercussionInstrument: - new_bonus->percussionMod += effect_value; - break; - case ItemTypeSinging: - new_bonus->singingMod += effect_value; - break; + switch (base2) { + case EQEmu::item::ItemTypeWindInstrument: + new_bonus->windMod += effect_value; + break; + case EQEmu::item::ItemTypeStringedInstrument: + new_bonus->stringedMod += effect_value; + break; + case EQEmu::item::ItemTypeBrassInstrument: + new_bonus->brassMod += effect_value; + break; + case EQEmu::item::ItemTypePercussionInstrument: + new_bonus->percussionMod += effect_value; + break; + case EQEmu::item::ItemTypeSinging: + new_bonus->singingMod += effect_value; + break; + default: + break; } break; @@ -3202,7 +3203,7 @@ void NPC::CalcItemBonuses(StatBonuses *newbon) if(newbon){ for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++){ - const Item_Struct *cur = database.GetItem(equipment[i]); + const EQEmu::Item_Struct *cur = database.GetItem(equipment[i]); if(cur){ //basic stats newbon->AC += cur->AC; @@ -3257,12 +3258,12 @@ void NPC::CalcItemBonuses(StatBonuses *newbon) if(cur->CombatEffects > 0) { newbon->ProcChance += cur->CombatEffects; } - if (cur->Worn.Effect>0 && (cur->Worn.Type == ET_WornEffect)) { // latent effects + if (cur->Worn.Effect>0 && (cur->Worn.Type == EQEmu::item::ItemEffectWorn)) { // latent effects ApplySpellsBonuses(cur->Worn.Effect, cur->Worn.Level, newbon, 0, cur->Worn.Type); } if (RuleB(Spells, NPC_UseFocusFromItems)){ - if (cur->Focus.Effect>0 && (cur->Focus.Type == ET_Focus)){ // focus effects + if (cur->Focus.Effect>0 && (cur->Focus.Type == EQEmu::item::ItemEffectFocus)){ // focus effects ApplySpellsBonuses(cur->Focus.Effect, cur->Focus.Level, newbon); } } diff --git a/zone/bot.cpp b/zone/bot.cpp index 862054037..0cb75e8a5 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -93,7 +93,6 @@ Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm timers[i] = 0; strcpy(this->name, this->GetCleanName()); - memset(&m_Light, 0, sizeof(EQEmu::lightsource::LightSourceProfile)); memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct)); } @@ -234,9 +233,9 @@ uint32 Bot::GetBotArcheryRange() { if (!range_inst || !ammo_inst) return 0; - const Item_Struct *range_item = range_inst->GetItem(); - const Item_Struct *ammo_item = ammo_inst->GetItem(); - if (!range_item || !ammo_item || range_item->ItemType != ItemTypeBow || ammo_item->ItemType != ItemTypeArrow) + const EQEmu::Item_Struct *range_item = range_inst->GetItem(); + const EQEmu::Item_Struct *ammo_item = ammo_inst->GetItem(); + if (!range_item || !ammo_item || range_item->ItemType != EQEmu::item::ItemTypeBow || ammo_item->ItemType != EQEmu::item::ItemTypeArrow) return 0; // everything is good! @@ -1181,38 +1180,30 @@ uint16 Bot::GetPrimarySkillValue() { else { uint8 type = m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType; //is this the best way to do this? switch(type) { - case ItemType1HSlash: { - skill = Skill1HSlashing; - break; - } - case ItemType2HSlash: { - skill = Skill2HSlashing; - break; - } - case ItemType1HPiercing: { - skill = Skill1HPiercing; - break; - } - case ItemType1HBlunt: { - skill = Skill1HBlunt; - break; - } - case ItemType2HBlunt: { - skill = Skill2HBlunt; - break; - } - case ItemType2HPiercing: { - skill = Skill2HPiercing; - break; - } - case ItemTypeMartial: { - skill = SkillHandtoHand; - break; - } - default: { - skill = SkillHandtoHand; - break; - } + case EQEmu::item::ItemType1HSlash: + skill = Skill1HSlashing; + break; + case EQEmu::item::ItemType2HSlash: + skill = Skill2HSlashing; + break; + case EQEmu::item::ItemType1HPiercing: + skill = Skill1HPiercing; + break; + case EQEmu::item::ItemType1HBlunt: + skill = Skill1HBlunt; + break; + case EQEmu::item::ItemType2HBlunt: + skill = Skill2HBlunt; + break; + case EQEmu::item::ItemType2HPiercing: + skill = Skill2HPiercing; + break; + case EQEmu::item::ItemTypeMartial: + skill = SkillHandtoHand; + break; + default: + skill = SkillHandtoHand; + break; } } @@ -1907,12 +1898,12 @@ void Bot::BotRangedAttack(Mob* other) { } ItemInst* rangedItem = GetBotItem(EQEmu::legacy::SlotRange); - const Item_Struct* RangeWeapon = 0; + const EQEmu::Item_Struct* RangeWeapon = 0; if(rangedItem) RangeWeapon = rangedItem->GetItem(); ItemInst* ammoItem = GetBotItem(EQEmu::legacy::SlotAmmo); - const Item_Struct* Ammo = 0; + const EQEmu::Item_Struct* Ammo = 0; if(ammoItem) Ammo = ammoItem->GetItem(); @@ -2021,7 +2012,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes int32 min_hit = 1; int32 max_hit = ((2 * weapon_damage * GetDamageTable(skillinuse)) / 100); if(GetLevel() >= 28 && IsWarriorClass()) { - int ucDamageBonus = GetWeaponDamageBonus((const Item_Struct*) nullptr); + int ucDamageBonus = GetWeaponDamageBonus((const EQEmu::Item_Struct*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -2063,12 +2054,12 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if(skillinuse == SkillBash){ const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); - const Item_Struct* botweapon = 0; + const EQEmu::Item_Struct* botweapon = 0; if(inst) botweapon = inst->GetItem(); if(botweapon) { - if(botweapon->ItemType == ItemTypeShield) + if (botweapon->ItemType == EQEmu::item::ItemTypeShield) hate += botweapon->AC; hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100); @@ -2123,7 +2114,7 @@ void Bot::ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg) if (item_slot >= EQEmu::legacy::EQUIPMENT_BEGIN){ const ItemInst* inst = GetBotItem(item_slot); - const Item_Struct* botweapon = 0; + const EQEmu::Item_Struct* botweapon = 0; if(inst) botweapon = inst->GetItem(); @@ -2488,7 +2479,7 @@ void Bot::AI_Process() { if (GetTarget() && ExtraAttackChanceBonus) { ItemInst *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); if(wpn) { - if(wpn->GetItem()->ItemType == ItemType2HSlash || wpn->GetItem()->ItemType == ItemType2HBlunt || wpn->GetItem()->ItemType == ItemType2HPiercing) { + if (wpn->GetItem()->IsType2HWeapon()) { if(zone->random.Int(0, 100) < ExtraAttackChanceBonus) Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); } @@ -2511,7 +2502,7 @@ void Bot::AI_Process() { //now off hand if(GetTarget() && attack_dw_timer.Check() && CanThisClassDualWield()) { const ItemInst* instweapon = GetBotItem(EQEmu::legacy::SlotSecondary); - const Item_Struct* weapon = 0; + const EQEmu::Item_Struct* weapon = 0; //can only dual wield without a weapon if you're a monk if(instweapon || (botClass == MONK)) { if(instweapon) @@ -2524,7 +2515,7 @@ void Bot::AI_Process() { bIsFist = false; } - if(bIsFist || ((weapontype != ItemType2HSlash) && (weapontype != ItemType2HPiercing) && (weapontype != ItemType2HBlunt))) { + if (bIsFist || !weapon->IsType2HWeapon()) { float DualWieldProbability = 0.0f; int32 Ambidexterity = (aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity); DualWieldProbability = ((GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f); // 78.0 max @@ -2955,10 +2946,10 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.size = 0; ns->spawn.NPC = 0; // 0=player,1=npc,2=pc corpse,3=npc corpse UpdateActiveLight(); - ns->spawn.light = m_Light.Type.Active; + ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive]; ns->spawn.helm = helmtexture; //(GetShowHelm() ? helmtexture : 0); //0xFF; ns->spawn.equip_chest2 = texture; //0xFF; - const Item_Struct* item = 0; + const EQEmu::Item_Struct* item = 0; const ItemInst* inst = 0; uint32 spawnedbotid = 0; spawnedbotid = this->GetBotID(); @@ -3401,7 +3392,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli //EQoffline: will give the items to the bots and change the bot stats if(inst && (GetBotOwner() == client->CastToMob()) && !IsEngaged()) { std::string TempErrorMessage; - const Item_Struct* mWeaponItem = inst->GetItem(); + const EQEmu::Item_Struct* mWeaponItem = inst->GetItem(); bool failedLoreCheck = false; for (int m = AUG_INDEX_BEGIN; m < EQEmu::legacy::ITEM_COMMON_SIZE; ++m) { ItemInst *itm = inst->GetAugment(m); @@ -3436,9 +3427,9 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli how_many_slots++; if(!GetBotItem(j)) { if (j == EQEmu::legacy::SlotPrimary) { - if((mWeaponItem->ItemType == ItemType2HSlash) || (mWeaponItem->ItemType == ItemType2HBlunt) || (mWeaponItem->ItemType == ItemType2HPiercing)) { + if (mWeaponItem->IsType2HWeapon()) { if (GetBotItem(EQEmu::legacy::SlotSecondary)) { - if(mWeaponItem && (mWeaponItem->ItemType == ItemType2HSlash) || (mWeaponItem->ItemType == ItemType2HBlunt) || (mWeaponItem->ItemType == ItemType2HPiercing)) { + if (mWeaponItem && mWeaponItem->IsType2HWeapon()) { if (client->CheckLoreConflict(GetBotItem(EQEmu::legacy::SlotSecondary)->GetItem())) { failedLoreCheck = true; } @@ -3473,7 +3464,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli if(success) { if (GetBotItem(EQEmu::legacy::SlotPrimary)) { ItemInst* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); - if((remove_item->GetItem()->ItemType == ItemType2HSlash) || (remove_item->GetItem()->ItemType == ItemType2HBlunt) || (remove_item->GetItem()->ItemType == ItemType2HPiercing)) { + if (remove_item->GetItem()->IsType2HWeapon()) { BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } @@ -3510,7 +3501,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } if(!failedLoreCheck) { if (j == EQEmu::legacy::SlotPrimary) { - if((mWeaponItem->ItemType == ItemType2HSlash) || (mWeaponItem->ItemType == ItemType2HBlunt) || (mWeaponItem->ItemType == ItemType2HPiercing)) { + if (mWeaponItem->IsType2HWeapon()) { if (GetBotItem(EQEmu::legacy::SlotSecondary)) { if (client->CheckLoreConflict(GetBotItem(EQEmu::legacy::SlotSecondary)->GetItem())) { failedLoreCheck = true; @@ -3544,7 +3535,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } if (success && GetBotItem(EQEmu::legacy::SlotPrimary)) { ItemInst* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); - if((remove_item->GetItem()->ItemType == ItemType2HSlash) || (remove_item->GetItem()->ItemType == ItemType2HBlunt) || (remove_item->GetItem()->ItemType == ItemType2HPiercing)) { + if (remove_item->GetItem()->IsType2HWeapon()) { BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } @@ -3580,7 +3571,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } } - const Item_Struct* item2 = 0; + const EQEmu::Item_Struct* item2 = 0; for(int y = beginSlotID; y <= endSlotID; ++y) { item2 = database.GetItem(items[y]); if(item2) { @@ -3819,7 +3810,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) { // Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above // who belong to a melee class. If we're here, then all of these conditions apply. - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const Item_Struct*) nullptr); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::Item_Struct*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -3828,7 +3819,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon. if (Hand == EQEmu::legacy::SlotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const Item_Struct*) nullptr); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::Item_Struct*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -4286,8 +4277,8 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[bottype]) { - const Item_Struct* TempItem = 0; - const Item_Struct* UsedItem = 0; + const EQEmu::Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* UsedItem = 0; const ItemInst* TempInst = 0; uint16 UsedFocusID = 0; int32 Total = 0; @@ -4323,7 +4314,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { ItemInst *aug = nullptr; aug = ins->GetAugment(y); if(aug) { - const Item_Struct* TempItemAug = aug->GetItem(); + const EQEmu::Item_Struct* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && TempItemAug->Focus.Effect != SPELL_UNKNOWN) { if(rand_effectiveness) { focus_max = CalcBotFocusEffect(bottype, TempItemAug->Focus.Effect, spell_id, true); @@ -4871,12 +4862,12 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if(skill == SkillBash) { const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); - const Item_Struct* botweapon = 0; + const EQEmu::Item_Struct* botweapon = 0; if(inst) botweapon = inst->GetItem(); if(botweapon) { - if(botweapon->ItemType == ItemTypeShield) + if (botweapon->ItemType == EQEmu::item::ItemTypeShield) hate += botweapon->AC; hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100); @@ -4936,11 +4927,11 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { bool bIsBehind = false; bool bCanFrontalBS = false; const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotPrimary); - const Item_Struct* botpiercer = nullptr; + const EQEmu::Item_Struct* botpiercer = nullptr; if(inst) botpiercer = inst->GetItem(); - if(!botpiercer || (botpiercer->ItemType != ItemType1HPiercing)) { + if (!botpiercer || (botpiercer->ItemType != EQEmu::item::ItemType1HPiercing)) { BotGroupSay(this, "I can't backstab with this weapon!"); return; } @@ -5109,7 +5100,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { case WARRIOR: if(level >= RuleI(Combat, NPCBashKickLevel)){ bool canBash = false; - if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && (m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType == ItemType2HSlash || m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType == ItemType2HBlunt || m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType == ItemType2HPiercing) && GetAA(aa2HandBash) >= 1)) + if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) canBash = true; if(!canBash || zone->random.Int(0, 100) > 25) @@ -5128,7 +5119,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { case SHADOWKNIGHT: case PALADIN: if(level >= RuleI(Combat, NPCBashKickLevel)){ - if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && (m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType == ItemType2HSlash || m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType == ItemType2HBlunt || m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType == ItemType2HPiercing) && GetAA(aa2HandBash) >= 1)) + if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) skill_to_use = SkillBash; } break; @@ -5373,7 +5364,7 @@ bool Bot::IsBotAttackAllowed(Mob* attacker, Mob* target, bool& hasRuleDefined) { void Bot::EquipBot(std::string* errorMessage) { GetBotItems(m_inv, errorMessage); const ItemInst* inst = 0; - const Item_Struct* item = 0; + const EQEmu::Item_Struct* item = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { inst = GetBotItem(i); if(inst) { @@ -5500,7 +5491,7 @@ void Bot::SetAttackTimer() { float haste_mod = (GetHaste() * 0.01f); attack_timer.SetAtTrigger(4000, true); Timer* TimerToUse = nullptr; - const Item_Struct* PrimaryWeapon = nullptr; + const EQEmu::Item_Struct* PrimaryWeapon = nullptr; for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) { if (i == EQEmu::legacy::SlotPrimary) TimerToUse = &attack_timer; @@ -5511,14 +5502,14 @@ void Bot::SetAttackTimer() { else continue; - const Item_Struct* ItemToUse = nullptr; + const EQEmu::Item_Struct* ItemToUse = nullptr; ItemInst* ci = GetBotItem(i); if (ci) ItemToUse = ci->GetItem(); if (i == EQEmu::legacy::SlotSecondary) { if (PrimaryWeapon != nullptr) { - if (PrimaryWeapon->ItemClass == ItemClassCommon && (PrimaryWeapon->ItemType == ItemType2HSlash || PrimaryWeapon->ItemType == ItemType2HBlunt || PrimaryWeapon->ItemType == ItemType2HPiercing)) { + if (PrimaryWeapon->IsClassCommon() && PrimaryWeapon->IsType2HWeapon()) { attack_dw_timer.Disable(); continue; } @@ -5531,7 +5522,7 @@ void Bot::SetAttackTimer() { } if (ItemToUse != nullptr) { - if (ItemToUse->ItemClass != ItemClassCommon || ItemToUse->Damage == 0 || ItemToUse->Delay == 0 || ((ItemToUse->ItemType > ItemTypeLargeThrowing) && (ItemToUse->ItemType != ItemTypeMartial) && (ItemToUse->ItemType != ItemType2HPiercing))) + if (!ItemToUse->IsClassCommon() || ItemToUse->Damage == 0 || ItemToUse->Delay == 0 || ((ItemToUse->ItemType > EQEmu::item::ItemTypeLargeThrowing) && (ItemToUse->ItemType != EQEmu::item::ItemTypeMartial) && (ItemToUse->ItemType != EQEmu::item::ItemType2HPiercing))) ItemToUse = nullptr; } @@ -7186,7 +7177,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { insr->TargetID = inspectedBot->GetNPCTypeID(); insr->playerid = inspectedBot->GetID(); - const Item_Struct* item = 0; + const EQEmu::Item_Struct* item = 0; const ItemInst* inst = 0; // Modded to display power source items (will only show up on SoF+ client inspect windows though.) @@ -7238,7 +7229,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { void Bot::CalcItemBonuses(StatBonuses* newbon) { - const Item_Struct* itemtmp = 0; + const EQEmu::Item_Struct* itemtmp = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { const ItemInst* item = GetBotItem((i == 22 ? 9999 : i)); @@ -7259,7 +7250,7 @@ void Bot::CalcItemBonuses(StatBonuses* newbon) } void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, bool isTribute, int rec_override) { - if(!inst || !inst->IsType(ItemClassCommon)) + if (!inst || !inst->IsClassCommon()) { return; } @@ -7269,11 +7260,11 @@ void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, return; } - const Item_Struct *item = inst->GetItem(); + const EQEmu::Item_Struct *item = inst->GetItem(); if(!isTribute && !inst->IsEquipable(GetBaseRace(),GetClass())) { - if(item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink) + if (item->ItemType != EQEmu::item::ItemTypeFood && item->ItemType != EQEmu::item::ItemTypeDrink) return; } @@ -7480,11 +7471,11 @@ void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, else newbon->DSMitigation += item->DSMitigation; } - if (item->Worn.Effect > 0 && item->Worn.Type == ET_WornEffect) {// latent effects + if (item->Worn.Effect > 0 && item->Worn.Type == EQEmu::item::ItemEffectWorn) {// latent effects ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, newbon, 0, item->Worn.Type); } - if (item->Focus.Effect>0 && (item->Focus.Type == ET_Focus)) { // focus effects + if (item->Focus.Effect>0 && (item->Focus.Type == EQEmu::item::ItemEffectFocus)) { // focus effects ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, newbon, 0); } @@ -7636,7 +7627,7 @@ void Bot::CalcBotStats(bool showtext) { } } -bool Bot::CheckLoreConflict(const Item_Struct* item) { +bool Bot::CheckLoreConflict(const EQEmu::Item_Struct* item) { if (!item || !(item->LoreFlag)) return false; @@ -8044,7 +8035,7 @@ int Bot::GetRawACNoShield(int &shield_ac) { shield_ac = 0; ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); if(inst) { - if(inst->GetItem()->ItemType == ItemTypeShield) { + if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; shield_ac = inst->GetItem()->AC; for (uint8 i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { @@ -8059,7 +8050,7 @@ int Bot::GetRawACNoShield(int &shield_ac) { } uint32 Bot::CalcCurrentWeight() { - const Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* TempItem = 0; ItemInst* inst; uint32 Total = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { diff --git a/zone/bot.h b/zone/bot.h index 9cb0b4766..b04481bd1 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -385,8 +385,8 @@ public: void BotTradeSwapItem(Client* client, int16 lootSlot, const ItemInst* inst, const ItemInst* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap = true); void BotTradeAddItem(uint32 id, const ItemInst* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb = true); void EquipBot(std::string* errorMessage); - bool CheckLoreConflict(const Item_Struct* item); - virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = m_inv.FindBrightestLightType(); m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); } + bool CheckLoreConflict(const EQEmu::Item_Struct* item); + virtual void UpdateEquipmentLight() { m_Light.Type[EQEmu::lightsource::LightEquipment] = m_inv.FindBrightestLightType(); m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } // Static Class Methods //static void DestroyBotRaidObjects(Client* client); // Can be removed after bot raids are dumped diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 2fa020635..92fd8cf44 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -7062,7 +7062,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep) } const ItemInst* inst = nullptr; - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; bool is2Hweapon = false; std::string item_link; @@ -7081,7 +7081,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep) } item = inst->GetItem(); - if ((i == EQEmu::legacy::SlotPrimary) && ((item->ItemType == ItemType2HSlash) || (item->ItemType == ItemType2HBlunt) || (item->ItemType == ItemType2HPiercing))) { + if ((i == EQEmu::legacy::SlotPrimary) && item->IsType2HWeapon()) { is2Hweapon = true; } @@ -7131,7 +7131,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) return; } - const Item_Struct* itm = nullptr; + const EQEmu::Item_Struct* itm = nullptr; const ItemInst* itminst = my_bot->GetBotItem(slotId); if (itminst) itm = itminst->GetItem(); @@ -7234,7 +7234,7 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep) //linker.SetLinkType(linker.linkItemInst); for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; const ItemInst* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::legacy::SlotPowerSource : i); if (inst) item = inst->GetItem(); diff --git a/zone/client.cpp b/zone/client.cpp index 6f7e6981b..7940cf266 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1902,7 +1902,7 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) UpdateEquipmentLight(); UpdateActiveLight(); - ns->spawn.light = m_Light.Type.Active; + ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive]; } bool Client::GMHideMe(Client* client) { @@ -2539,7 +2539,7 @@ void Client::SetFeigned(bool in_feigned) { feigned=in_feigned; } -void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying) +void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::Item_Struct* item, bool buying) { if(!player || !merchant || !item) return; @@ -2577,7 +2577,7 @@ bool Client::BindWound(Mob *bindmob, bool start, bool fail) // Start bind if (!bindwound_timer.Enabled()) { // make sure we actually have a bandage... and consume it. - int16 bslot = m_inv.HasItemByUse(ItemTypeBandage, 1, invWhereWorn | invWherePersonal); + int16 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeBandage, 1, invWhereWorn | invWherePersonal); if (bslot == INVALID_INDEX) { bind_out->type = 3; QueuePacket(outapp); @@ -2725,8 +2725,8 @@ bool Client::BindWound(Mob *bindmob, bool start, bool fail) } void Client::SetMaterial(int16 in_slot, uint32 item_id) { - const Item_Struct* item = database.GetItem(item_id); - if (item && (item->ItemClass==ItemClassCommon)) + const EQEmu::Item_Struct* item = database.GetItem(item_id); + if (item && item->IsClassCommon()) { uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); if (matslot != EQEmu::legacy::MaterialInvalid) @@ -3768,7 +3768,7 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { return; } -void Client::SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item){ +void Client::SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::Item_Struct* item){ EQApplicationPacket* outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); sPickPocket_Struct* pick_out = (sPickPocket_Struct*) outapp->pBuffer; pick_out->coin = amt; @@ -3945,7 +3945,7 @@ bool Client::KeyRingCheck(uint32 item_id) void Client::KeyRingList() { Message(4,"Keys on Keyring:"); - const Item_Struct *item = 0; + const EQEmu::Item_Struct *item = 0; for(std::list::iterator iter = keyring.begin(); iter != keyring.end(); ++iter) @@ -4212,51 +4212,34 @@ uint16 Client::GetPrimarySkillValue() uint8 type = m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType; //is this the best way to do this? - switch (type) - { - case ItemType1HSlash: // 1H Slashing - { - skill = Skill1HSlashing; - break; - } - case ItemType2HSlash: // 2H Slashing - { - skill = Skill2HSlashing; - break; - } - case ItemType1HPiercing: // Piercing - { + switch (type) { + case EQEmu::item::ItemType1HSlash: // 1H Slashing + skill = Skill1HSlashing; + break; + case EQEmu::item::ItemType2HSlash: // 2H Slashing + skill = Skill2HSlashing; + break; + case EQEmu::item::ItemType1HPiercing: // Piercing + skill = Skill1HPiercing; + break; + case EQEmu::item::ItemType1HBlunt: // 1H Blunt + skill = Skill1HBlunt; + break; + case EQEmu::item::ItemType2HBlunt: // 2H Blunt + skill = Skill2HBlunt; + break; + case EQEmu::item::ItemType2HPiercing: // 2H Piercing + if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) skill = Skill1HPiercing; - break; - } - case ItemType1HBlunt: // 1H Blunt - { - skill = Skill1HBlunt; - break; - } - case ItemType2HBlunt: // 2H Blunt - { - skill = Skill2HBlunt; - break; - } - case ItemType2HPiercing: // 2H Piercing - { - if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - skill = Skill1HPiercing; - else - skill = Skill2HPiercing; - break; - } - case ItemTypeMartial: // Hand to Hand - { - skill = SkillHandtoHand; - break; - } - default: // All other types default to Hand to Hand - { - skill = SkillHandtoHand; - break; - } + else + skill = Skill2HPiercing; + break; + case EQEmu::item::ItemTypeMartial: // Hand to Hand + skill = SkillHandtoHand; + break; + default: // All other types default to Hand to Hand + skill = SkillHandtoHand; + break; } } @@ -5708,7 +5691,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { insr->TargetID = requester->GetID(); insr->playerid = requestee->GetID(); - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; const ItemInst* inst = nullptr; int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for(int16 L = 0; L <= 20; L++) { @@ -5720,7 +5703,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { strcpy(insr->itemnames[L], item->Name); if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - const Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + const EQEmu::Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); insr->itemicons[L] = aug_item->Icon; } else if (inst && inst->GetOrnamentationIcon()) @@ -6902,7 +6885,7 @@ void Client::SendAltCurrencies() { uint32 i = 0; std::list::iterator iter = zone->AlternateCurrencies.begin(); while(iter != zone->AlternateCurrencies.end()) { - const Item_Struct* item = database.GetItem((*iter).item_id); + const EQEmu::Item_Struct* item = database.GetItem((*iter).item_id); altc->entries[i].currency_number = (*iter).id; altc->entries[i].unknown00 = 1; altc->entries[i].currency_number2 = (*iter).id; @@ -7555,7 +7538,7 @@ void Client::DuplicateLoreMessage(uint32 ItemID) return; } - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item) return; @@ -8272,7 +8255,7 @@ void Client::SetConsumption(int32 in_hunger, int32 in_thirst) safe_delete(outapp); } -void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_consume) +void Client::Consume(const EQEmu::Item_Struct *item, uint8 type, int16 slot, bool auto_consume) { if(!item) { return; } @@ -8285,7 +8268,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ else cons_mod = cons_mod * RuleI(Character, ConsumptionMultiplier) / 100; - if(type == ItemTypeFood) + if (type == EQEmu::item::ItemTypeFood) { int hchange = item->CastTime * cons_mod; hchange = mod_food_value(item, hchange); @@ -8390,7 +8373,7 @@ int Client::GetQuiverHaste(int delay) const ItemInst *pi = nullptr; for (int r = EQEmu::legacy::GENERAL_BEGIN; r <= EQEmu::legacy::GENERAL_END; r++) { pi = GetInv().GetItem(r); - if (pi && pi->IsType(ItemClassContainer) && pi->GetItem()->BagType == BagTypeQuiver && + if (pi && pi->IsClassBag() && pi->GetItem()->BagType == EQEmu::item::BagTypeQuiver && pi->GetItem()->BagWR > 0) break; if (r == EQEmu::legacy::GENERAL_END) diff --git a/zone/client.h b/zone/client.h index 79413da98..28da7ee72 100644 --- a/zone/client.h +++ b/zone/client.h @@ -27,7 +27,11 @@ class Object; class Raid; class Seperator; class ServerPacket; -struct Item_Struct; + +namespace EQEmu +{ + struct Item_Struct; +} #include "../common/timer.h" #include "../common/ptimer.h" @@ -290,7 +294,7 @@ public: void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); virtual bool Process(); - void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); + void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::Item_Struct* item, bool buying); void SendPacketQueue(bool Block = true); void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); @@ -398,7 +402,7 @@ public: inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } - void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); + void SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::Item_Struct* item = nullptr); inline const char* GetLastName() const { return lastname; } @@ -594,7 +598,7 @@ public: void AssignToInstance(uint16 instance_id); void RemoveFromInstance(uint16 instance_id); void WhoAll(); - bool CheckLoreConflict(const Item_Struct* item); + bool CheckLoreConflict(const EQEmu::Item_Struct* item); void ChangeLastName(const char* in_lastname); void GetGroupAAs(GroupLeadershipAA_Struct *into) const; void GetRaidAAs(RaidLeadershipAA_Struct *into) const; @@ -737,7 +741,7 @@ public: #endif uint32 GetEquipment(uint8 material_slot) const; // returns item id uint32 GetEquipmentColor(uint8 material_slot) const; - virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = m_inv.FindBrightestLightType(); m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); } + virtual void UpdateEquipmentLight() { m_Light.Type[EQEmu::lightsource::LightEquipment] = m_inv.FindBrightestLightType(); m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } inline bool AutoSplitEnabled() { return m_pp.autosplit != 0; } @@ -1173,7 +1177,7 @@ public: void LoadAccountFlags(); void SetAccountFlag(std::string flag, std::string val); std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); - void Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_consume); + void Consume(const EQEmu::Item_Struct *item, uint8 type, int16 slot, bool auto_consume); void PlayMP3(const char* fname); void ExpeditionSay(const char *str, int ExpID); int mod_client_damage(int damage, SkillUseTypes skillinuse, int hand, const ItemInst* weapon, Mob* other); @@ -1195,9 +1199,9 @@ public: int32 mod_client_xp(int32 in_exp, NPC *npc); uint32 mod_client_xp_for_level(uint32 xp, uint16 check_level); int mod_client_haste_cap(int cap); - int mod_consume(Item_Struct *item, ItemUseTypes type, int change); - int mod_food_value(const Item_Struct *item, int change); - int mod_drink_value(const Item_Struct *item, int change); + int mod_consume(EQEmu::Item_Struct *item, EQEmu::item::ItemType type, int change); + int mod_food_value(const EQEmu::Item_Struct *item, int change); + int mod_drink_value(const EQEmu::Item_Struct *item, int change); void SetEngagedRaidTarget(bool value) { EngagedRaidTarget = value; } bool GetEngagedRaidTarget() const { return EngagedRaidTarget; } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 6e22cc514..c6860a52f 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -487,7 +487,7 @@ int32 Client::GetRawItemAC() // this skips MainAmmo..add an '=' conditional if that slot is required (original behavior) for (int16 slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id < EQEmu::legacy::EQUIPMENT_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; - if (inst && inst->IsType(ItemClassCommon)) { + if (inst && inst->IsClassCommon()) { Total += inst->GetItem()->AC; } } @@ -1070,7 +1070,7 @@ int32 Client::CalcAC() bool equiped = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary); if (equiped) { uint8 shield = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType; - if (shield == ItemTypeShield) { + if (shield == EQEmu::item::ItemTypeShield) { displayed += itembonuses.HeroicSTR / 2; } } @@ -1099,7 +1099,7 @@ int32 Client::GetACMit() bool equiped = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary); if (equiped) { uint8 shield = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType; - if (shield == ItemTypeShield) { + if (shield == EQEmu::item::ItemTypeShield) { mitigation += itembonuses.HeroicSTR / 2; } } @@ -1302,7 +1302,7 @@ int32 Client::CalcManaRegenCap() uint32 Client::CalcCurrentWeight() { - const Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* TempItem = 0; ItemInst* ins; uint32 Total = 0; int x; @@ -1337,7 +1337,7 @@ uint32 Client::CalcCurrentWeight() } } ItemInst* baginst = GetInv().GetItem(bagslot); - if (baginst && baginst->GetItem() && baginst->IsType(ItemClassContainer)) { + if (baginst && baginst->GetItem() && baginst->IsClassBag()) { reduction = baginst->GetItem()->BagWR; } if (reduction > 0) { @@ -2207,7 +2207,7 @@ int Client::GetRawACNoShield(int &shield_ac) const shield_ac = 0; const ItemInst *inst = m_inv.GetItem(EQEmu::legacy::SlotSecondary); if (inst) { - if (inst->GetItem()->ItemType == ItemTypeShield) { + if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; shield_ac = inst->GetItem()->AC; for (uint8 i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 5222ca96c..de35ccf2b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1881,7 +1881,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) merchantid = tmp->CastToNPC()->MerchantType; - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; bool found = false; std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; @@ -2057,7 +2057,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) merchantid = tmp->CastToNPC()->MerchantType; tmp->CastToNPC()->FaceTarget(this->CastToMob()); - const Item_Struct *item = 0; + const EQEmu::Item_Struct *item = 0; std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; for (itr = merlist.begin(); itr != merlist.end() && count<255; ++itr){ @@ -2156,7 +2156,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) return; } - const Item_Struct* item = database.GetItem(itemid); + const EQEmu::Item_Struct* item = database.GetItem(itemid); ItemInst* inst = GetInv().GetItem(ams_in->slot); if (!item || !inst){ Message(13, "You seemed to have misplaced that item..."); @@ -2431,7 +2431,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app ss << alt_cur_id << "|1|" << alt_cur_id; uint32 count = 0; uint32 merchant_id = tar->MerchantType; - const Item_Struct *item = nullptr; + const EQEmu::Item_Struct *item = nullptr; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; @@ -2491,7 +2491,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) return; } - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; @@ -2640,7 +2640,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) return; } - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; @@ -2733,7 +2733,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) return; } - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; @@ -2815,7 +2815,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) const ItemInst* SecondaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary); const ItemInst* PoisonItemInstance = GetInv()[ApplyPoisonData->inventorySlot]; - bool IsPoison = PoisonItemInstance && (PoisonItemInstance->GetItem()->ItemType == ItemTypePoison); + bool IsPoison = PoisonItemInstance && (PoisonItemInstance->GetItem()->ItemType == EQEmu::item::ItemTypePoison); if (!IsPoison) { @@ -2826,8 +2826,8 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) } else if (GetClass() == ROGUE) { - if ((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == ItemType1HPiercing) || - (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == ItemType1HPiercing)) { + if ((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing) || + (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing)) { float SuccessChance = (GetSkill(SkillApplyPoison) + GetLevel()) / 400.0f; double ChanceRoll = zone->random.Real(0, 1); @@ -2907,7 +2907,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) } AugmentInfo_Struct* AugInfo = (AugmentInfo_Struct*)app->pBuffer; - const Item_Struct * item = database.GetItem(AugInfo->itemid); + const EQEmu::Item_Struct * item = database.GetItem(AugInfo->itemid); if (item) { strn0cpy(AugInfo->augment_info, item->Name, 64); @@ -2965,7 +2965,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) Message(13, "Error: Missing an augmentation distiller for safely removing this augment."); return; } - else if (solvent->GetItem()->ItemType == ItemUseTypes::ItemTypeAugmentationDistiller) + else if (solvent->GetItem()->ItemType == EQEmu::item::ItemTypeAugmentationDistiller) { old_aug = tobe_auged->GetAugment(in_augment->augment_index); @@ -2982,7 +2982,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) return; } } - else if (solvent->GetItem()->ItemType != ItemUseTypes::ItemTypePerfectedAugmentationDistiller) + else if (solvent->GetItem()->ItemType != EQEmu::item::ItemTypePerfectedAugmentationDistiller) { Log.Out(Logs::General, Logs::Error, "Player tried to safely remove an augment with a non-distiller item."); Message(13, "Error: Invalid augmentation distiller for safely removing this augment."); @@ -3489,7 +3489,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) { BarterItemSearchLinkRequest_Struct* bislr = (BarterItemSearchLinkRequest_Struct*)app->pBuffer; - const Item_Struct* item = database.GetItem(bislr->ItemID); + const EQEmu::Item_Struct* item = database.GetItem(bislr->ItemID); if (!item) Message(13, "Error: This item does not exist!"); @@ -3522,7 +3522,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) { BuyerItemSearchLinkRequest_Struct* bislr = (BuyerItemSearchLinkRequest_Struct*)app->pBuffer; - const Item_Struct* item = database.GetItem(bislr->ItemID); + const EQEmu::Item_Struct* item = database.GetItem(bislr->ItemID); if (!item) Message(13, "Error: This item does not exist!"); @@ -3561,7 +3561,7 @@ void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) BazaarInspect_Struct* bis = (BazaarInspect_Struct*)app->pBuffer; - const Item_Struct* item = database.GetItem(bis->ItemID); + const EQEmu::Item_Struct* item = database.GetItem(bis->ItemID); if (!item) { Message(13, "Error: This item does not exist!"); @@ -4011,9 +4011,9 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) // packet field types will be reviewed as packet transistions occur const ItemInst* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field //bool cancast = true; - if (inst && inst->IsType(ItemClassCommon)) + if (inst && inst->IsClassCommon()) { - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (item->Click.Effect != (uint32)castspell->spell_id) { database.SetMQDetectionFlag(account_name, name, "OP_CastSpell with item, tried to cast a different spell.", zone->GetShortName()); @@ -4021,7 +4021,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) return; } - if ((item->Click.Type == ET_ClickEffect) || (item->Click.Type == ET_Expendable) || (item->Click.Type == ET_EquipClick) || (item->Click.Type == ET_ClickEffect2)) + if ((item->Click.Type == EQEmu::item::ItemEffectClick) || (item->Click.Type == EQEmu::item::ItemEffectExpendable) || (item->Click.Type == EQEmu::item::ItemEffectEquipClick) || (item->Click.Type == EQEmu::item::ItemEffectClick2)) { if (item->Click.Level2 > 0) { @@ -4861,12 +4861,12 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) return; } - const Item_Struct* eat_item = myitem->GetItem(); + const EQEmu::Item_Struct* eat_item = myitem->GetItem(); if (pcs->type == 0x01) { - Consume(eat_item, ItemTypeFood, pcs->slot, (pcs->auto_consumed == 0xffffffff)); + Consume(eat_item, EQEmu::item::ItemTypeFood, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else if (pcs->type == 0x02) { - Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); + Consume(eat_item, EQEmu::item::ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { Log.Out(Logs::General, Logs::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); @@ -5134,7 +5134,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app) DeleteItem_Struct* alc = (DeleteItem_Struct*)app->pBuffer; const ItemInst *inst = GetInv().GetItem(alc->from_slot); - if (inst && inst->GetItem()->ItemType == ItemTypeAlcohol) { + if (inst && inst->GetItem()->ItemType == EQEmu::item::ItemTypeAlcohol) { entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), inst->GetItem()->Name); CheckIncreaseSkill(SkillAlcoholTolerance, nullptr, 25); @@ -6918,7 +6918,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) return; } - const Item_Struct* CursorItem = CursorItemInst->GetItem(); + const EQEmu::Item_Struct* CursorItem = CursorItemInst->GetItem(); if (!CursorItem->NoDrop || CursorItemInst->IsAttuned()) { @@ -7991,7 +7991,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) EQApplicationPacket* outapp = app->Copy(); InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer; Mob* tmp = entity_list.GetMob(insr->TargetID); - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::legacy::SlotWaist; L++) { @@ -8001,7 +8001,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) if (item) { strcpy(insr->itemnames[L], item->Name); if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - const Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + const EQEmu::Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); insr->itemicons[L] = aug_item->Icon; } else if (inst->GetOrnamentationIcon()) { @@ -8101,7 +8101,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) // todo: verify ivrs->link_hash based on a rule, in case we don't care about people being able to sniff data // from the item DB - const Item_Struct *item = database.GetItem(ivrs->item_id); + const EQEmu::Item_Struct *item = database.GetItem(ivrs->item_id); if (!item) { if (ivrs->item_id != SAYLINK_ITEM_ID) { Message(13, "Error: The item for the link you have clicked on does not exist!"); @@ -8192,7 +8192,7 @@ void Client::Handle_OP_ItemName(const EQApplicationPacket *app) return; } ItemNamePacket_Struct *p = (ItemNamePacket_Struct*)app->pBuffer; - const Item_Struct *item = 0; + const EQEmu::Item_Struct *item = 0; if ((item = database.GetItem(p->item_id)) != nullptr) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemName, sizeof(ItemNamePacket_Struct)); p = (ItemNamePacket_Struct*)outapp->pBuffer; @@ -8208,7 +8208,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) VERIFY_PACKET_LENGTH(OP_ItemPreview, app, ItemPreview_Struct); ItemPreview_Struct *ips = (ItemPreview_Struct *)app->pBuffer; - const Item_Struct* item = database.GetItem(ips->itemid); + const EQEmu::Item_Struct* item = database.GetItem(ips->itemid); if (item) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemPreview, strlen(item->Name) + strlen(item->Lore) + strlen(item->IDFile) + 898); @@ -8424,7 +8424,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (!item) { Message(0, "Error: item not found in inventory slot #%i", slot_id); DeleteItemInInventory(slot_id, 0, true); @@ -8458,7 +8458,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) Log.Out(Logs::General, Logs::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); - if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check + if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == EQEmu::item::ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { ItemInst* p_inst = (ItemInst*)inst; @@ -8472,42 +8472,42 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) int r; bool tryaug = false; ItemInst* clickaug = 0; - Item_Struct* augitem = 0; + EQEmu::Item_Struct* augitem = 0; for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { const ItemInst* aug_i = inst->GetAugment(r); if (!aug_i) continue; - const Item_Struct* aug = aug_i->GetItem(); + const EQEmu::Item_Struct* aug = aug_i->GetItem(); if (!aug) continue; - if ((aug->Click.Type == ET_ClickEffect) || (aug->Click.Type == ET_Expendable) || (aug->Click.Type == ET_EquipClick) || (aug->Click.Type == ET_ClickEffect2)) + if ((aug->Click.Type == EQEmu::item::ItemEffectClick) || (aug->Click.Type == EQEmu::item::ItemEffectExpendable) || (aug->Click.Type == EQEmu::item::ItemEffectEquipClick) || (aug->Click.Type == EQEmu::item::ItemEffectClick2)) { tryaug = true; clickaug = (ItemInst*)aug_i; - augitem = (Item_Struct*)aug; + augitem = (EQEmu::Item_Struct*)aug; spell_id = aug->Click.Effect; break; } } - if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) + if ((spell_id <= 0) && (item->ItemType != EQEmu::item::ItemTypeFood && item->ItemType != EQEmu::item::ItemTypeDrink && item->ItemType != EQEmu::item::ItemTypeAlcohol && item->ItemType != EQEmu::item::ItemTypeSpell)) { Log.Out(Logs::General, Logs::None, "Item with no effect right clicked by %s", GetName()); } - else if (inst->IsType(ItemClassCommon)) + else if (inst->IsClassCommon()) { - if (item->ItemType == ItemTypeSpell && (strstr((const char*)item->Name, "Tome of ") || strstr((const char*)item->Name, "Skill: "))) + if (item->ItemType == EQEmu::item::ItemTypeSpell && (strstr((const char*)item->Name, "Tome of ") || strstr((const char*)item->Name, "Skill: "))) { DeleteItemInInventory(slot_id, 1, true); TrainDiscipline(item->ID); } - else if (item->ItemType == ItemTypeSpell) + else if (item->ItemType == EQEmu::item::ItemTypeSpell) { return; } - else if ((item->Click.Type == ET_ClickEffect) || (item->Click.Type == ET_Expendable) || (item->Click.Type == ET_EquipClick) || (item->Click.Type == ET_ClickEffect2)) + else if ((item->Click.Type == EQEmu::item::ItemEffectClick) || (item->Click.Type == EQEmu::item::ItemEffectExpendable) || (item->Click.Type == EQEmu::item::ItemEffectEquipClick) || (item->Click.Type == EQEmu::item::ItemEffectClick2)) { if (inst->GetCharges() == 0) { @@ -8565,22 +8565,22 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (ClientVersion() >= EQEmu::versions::ClientVersion::SoD && !inst->IsEquipable(GetBaseRace(), GetClass())) { - if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) + if (item->ItemType != EQEmu::item::ItemTypeFood && item->ItemType != EQEmu::item::ItemTypeDrink && item->ItemType != EQEmu::item::ItemTypeAlcohol) { Log.Out(Logs::General, Logs::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { //This is food/drink - consume it - if (item->ItemType == ItemTypeFood && m_pp.hunger_level < 5000) + if (item->ItemType == EQEmu::item::ItemTypeFood && m_pp.hunger_level < 5000) { Consume(item, item->ItemType, slot_id, false); } - else if (item->ItemType == ItemTypeDrink && m_pp.thirst_level < 5000) + else if (item->ItemType == EQEmu::item::ItemTypeDrink && m_pp.thirst_level < 5000) { Consume(item, item->ItemType, slot_id, false); } - else if (item->ItemType == ItemTypeAlcohol) + else if (item->ItemType == EQEmu::item::ItemTypeAlcohol) { #if EQDEBUG >= 1 Log.Out(Logs::General, Logs::None, "Drinking Alcohol from slot:%i", slot_id); @@ -9701,7 +9701,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) else { int16 from_parent = m_inv.CalcSlotId(mi->from_slot); if (!m_inv[from_parent]) { mi_hack = true; } - else if (!m_inv[from_parent]->IsType(ItemClassContainer)) { mi_hack = true; } + else if (!m_inv[from_parent]->IsClassBag()) { mi_hack = true; } else if (m_inv.CalcBagIdx(mi->from_slot) >= m_inv[from_parent]->GetItem()->BagSlots) { mi_hack = true; } } } @@ -9711,7 +9711,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) else { int16 to_parent = m_inv.CalcSlotId(mi->to_slot); if (!m_inv[to_parent]) { mi_hack = true; } - else if (!m_inv[to_parent]->IsType(ItemClassContainer)) { mi_hack = true; } + else if (!m_inv[to_parent]->IsClassBag()) { mi_hack = true; } else if (m_inv.CalcBagIdx(mi->to_slot) >= m_inv[to_parent]->GetItem()->BagSlots) { mi_hack = true; } } } @@ -10545,7 +10545,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) } if (mptbs->Action == 0) { - const Item_Struct *BaseItem = database.GetItem(mptbs->ItemID); + const EQEmu::Item_Struct *BaseItem = database.GetItem(mptbs->ItemID); if (BaseItem) { m_pp.potionbelt.Items[mptbs->SlotNumber].ID = BaseItem->ID; m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = BaseItem->Icon; @@ -12028,8 +12028,8 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app) return; if (inst) { - const Item_Struct* shield = inst->GetItem(); - if (shield && shield->ItemType == ItemTypeShield) + const EQEmu::Item_Struct* shield = inst->GetItem(); + if (shield && shield->ItemType == EQEmu::item::ItemTypeShield) { for (int x = 0; x < 2; x++) { @@ -12136,7 +12136,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) break; } } - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; uint32 prevcharges = 0; if (item_id == 0) { //check to see if its on the temporary table std::list tmp_merlist = zone->tmpmerchanttable[tmp->GetNPCTypeID()]; @@ -12382,7 +12382,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) uint32 itemid = GetItemIDAt(mp->itemslot); if (itemid == 0) return; - const Item_Struct* item = database.GetItem(itemid); + const EQEmu::Item_Struct* item = database.GetItem(itemid); ItemInst* inst = GetInv().GetItem(mp->itemslot); if (!item || !inst){ Message(13, "You seemed to have misplaced that item.."); @@ -13479,7 +13479,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) TradeItemsValid = false; break; } - const Item_Struct *Item = database.GetItem(gis->Items[i]); + const EQEmu::Item_Struct *Item = database.GetItem(gis->Items[i]); if (!Item) { Message(13, "Unexpected error. Unable to start trader mode"); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 6dcca861e..72dd478c8 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -299,7 +299,7 @@ bool Client::Process() { ItemInst *ranged = GetInv().GetItem(EQEmu::legacy::SlotRange); if(ranged) { - if(ranged->GetItem() && ranged->GetItem()->ItemType == ItemTypeBow){ + if (ranged->GetItem() && ranged->GetItem()->ItemType == EQEmu::item::ItemTypeBow){ if(ranged_timer.Check(false)){ if(GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient())){ if(GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())){ @@ -319,7 +319,7 @@ bool Client::Process() { ranged_timer.Start(); } } - else if(ranged->GetItem() && (ranged->GetItem()->ItemType == ItemTypeLargeThrowing || ranged->GetItem()->ItemType == ItemTypeSmallThrowing)){ + else if (ranged->GetItem() && (ranged->GetItem()->ItemType == EQEmu::item::ItemTypeLargeThrowing || ranged->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing)){ if(ranged_timer.Check(false)){ if(GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient())){ if(GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())){ @@ -740,8 +740,8 @@ void Client::BulkSendInventoryItems() for (int16 slot_id = EQEmu::legacy::TRADE_BEGIN; slot_id <= EQEmu::legacy::TRADE_END; slot_id++) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { - bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; - int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); + bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; + int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow); Log.Out(Logs::Detail, Logs::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, false); database.SaveInventory(character_id, nullptr, slot_id); @@ -825,12 +825,12 @@ void Client::BulkSendInventoryItems() } void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { - const Item_Struct* handyitem = nullptr; + const EQEmu::Item_Struct* handyitem = nullptr; uint32 numItemSlots = 80; //The max number of items passed in the transaction. if (m_ClientVersionBit & EQEmu::versions::bit_RoFAndLater) { // RoF+ can send 200 items numItemSlots = 200; } - const Item_Struct *item; + const EQEmu::Item_Struct *item; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; Mob* merch = entity_list.GetMobByNpcTypeID(npcid); @@ -869,7 +869,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { else handychance--; int charges = 1; - if (item->ItemClass == ItemClassCommon) + if (item->IsClassCommon()) charges = item->MaxCharges; ItemInst* inst = database.CreateItem(item, charges); if (inst) { @@ -1086,9 +1086,9 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) case memSpellScribing: { // scribing spell to book const ItemInst* inst = m_inv[EQEmu::legacy::SlotCursor]; - if(inst && inst->IsType(ItemClassCommon)) + if (inst && inst->IsClassCommon()) { - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (RuleB(Character, RestrictSpellScribing) && !item->IsEquipable(GetRace(), GetClass())) { Message_StringID(13, CANNOT_USE_ITEM); diff --git a/zone/command.cpp b/zone/command.cpp index 46f157015..2d341ef7d 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2543,7 +2543,7 @@ void command_peekinv(Client *c, const Seperator *sep) Client* targetClient = c->GetTarget()->CastToClient(); const ItemInst* inst_main = nullptr; const ItemInst* inst_sub = nullptr; - const Item_Struct* item_data = nullptr; + const EQEmu::Item_Struct* item_data = nullptr; std::string item_link; EQEmu::saylink::SayLinkEngine linker; linker.SetLinkType(linker.SayLinkItemInst); @@ -2584,7 +2584,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "InvSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2618,7 +2618,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", EQEmu::legacy::SlotCursor, cursorDepth, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; (cursorDepth == 0) && inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = SUB_INDEX_BEGIN; (cursorDepth == 0) && inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2655,7 +2655,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "BankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2677,7 +2677,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2700,7 +2700,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "TradeSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2732,7 +2732,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "WorldSlot: %i, Item: %i (%s), Charges: %i", (EQEmu::legacy::WORLD_BEGIN + indexMain), ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(EQEmu::item::ItemClassBag) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -3146,7 +3146,7 @@ void command_equipitem(Client *c, const Seperator *sep) bool partialmove = false; int16 movecount; - if (from_inst && from_inst->IsType(ItemClassCommon)) { + if (from_inst && from_inst->IsClassCommon()) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mi = (MoveItem_Struct*)outapp->pBuffer; mi->from_slot = EQEmu::legacy::SlotCursor; @@ -4357,10 +4357,10 @@ void command_iteminfo(Client *c, const Seperator *sep) c->Message(0, ">> NoDrop: %u, NoRent: %u, NoPet: %u, NoTransfer: %u, FVNoDrop: %u", item->NoDrop, item->NoRent, (uint8)item->NoPet, (uint8)item->NoTransfer, item->FVNoDrop); - if (item->ItemClass == ItemClassBook) { + if (item->IsClassBook()) { c->Message(0, "*** This item is a Book (filename:'%s') ***", item->Filename); } - else if (item->ItemClass == ItemClassContainer) { + else if (item->IsClassBag()) { c->Message(0, "*** This item is a Container (%u slots) ***", item->BagSlots); } else { @@ -5510,7 +5510,7 @@ void command_summonitem(Client *c, const Seperator *sep) } int16 item_status = 0; - const Item_Struct* item = database.GetItem(itemid); + const EQEmu::Item_Struct* item = database.GetItem(itemid); if (item) { item_status = static_cast(item->MinStatus); } @@ -5549,7 +5549,7 @@ void command_giveitem(Client *c, const Seperator *sep) Client *t = c->GetTarget()->CastToClient(); uint32 itemid = atoi(sep->arg[1]); int16 item_status = 0; - const Item_Struct* item = database.GetItem(itemid); + const EQEmu::Item_Struct* item = database.GetItem(itemid); if(item) { item_status = static_cast(item->MinStatus); } @@ -5602,7 +5602,7 @@ void command_itemsearch(Client *c, const Seperator *sep) { const char *search_criteria=sep->argplus[1]; - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; std::string item_link; EQEmu::saylink::SayLinkEngine linker; linker.SetLinkType(linker.SayLinkItemData); @@ -10225,7 +10225,7 @@ void command_zopp(Client *c, const Seperator *sep) uint32 itemid = atoi(sep->arg[3]); int16 charges = sep->argnum == 4 ? atoi(sep->arg[4]) : 1; // defaults to 1 charge if not specified - const Item_Struct* FakeItem = database.GetItem(itemid); + const EQEmu::Item_Struct* FakeItem = database.GetItem(itemid); if (!FakeItem) { c->Message(13, "Error: Item [%u] is not a valid item id.", itemid); @@ -10233,7 +10233,7 @@ void command_zopp(Client *c, const Seperator *sep) } int16 item_status = 0; - const Item_Struct* item = database.GetItem(itemid); + const EQEmu::Item_Struct* item = database.GetItem(itemid); if(item) { item_status = static_cast(item->MinStatus); } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 6338cc412..ff8243003 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -139,10 +139,8 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std: pc->IsRezzed(rezzed); pc->become_npc = false; - pc->m_Light.Level.Innate = pc->m_Light.Type.Innate = 0; pc->UpdateEquipmentLight(); // itemlist populated above..need to determine actual values - pc->m_Light.Level.Spell = pc->m_Light.Type.Spell = 0; - + safe_delete_array(pcs); return pc; @@ -409,7 +407,7 @@ void Corpse::MoveItemToCorpse(Client *client, ItemInst *inst, int16 equipSlot, s removedList.push_back(equipSlot); while (true) { - if (!inst->IsType(ItemClassContainer)) { break; } + if (!inst->IsClassBag()) { break; } if (equipSlot < EQEmu::legacy::GENERAL_BEGIN || equipSlot > EQEmu::legacy::SlotCursor) { break; } for (auto sub_index = SUB_INDEX_BEGIN; sub_index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++sub_index) { @@ -531,7 +529,6 @@ in_helmtexture, SetPlayerKillItemID(0); UpdateEquipmentLight(); - m_Light.Level.Spell = m_Light.Type.Spell = 0; UpdateActiveLight(); } @@ -980,7 +977,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a safe_delete(outapp); if(Loot_Request_Type == 5) { int pkitem = GetPlayerKillItem(); - const Item_Struct* item = database.GetItem(pkitem); + const EQEmu::Item_Struct* item = database.GetItem(pkitem); ItemInst* inst = database.CreateItem(item, item->MaxCharges); if(inst) { if (item->RecastDelay) @@ -995,7 +992,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } int i = 0; - const Item_Struct* item = 0; + const EQEmu::Item_Struct* item = 0; ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); @@ -1110,7 +1107,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { being_looted_by = 0xFFFFFFFF; return; } - const Item_Struct* item = 0; + const EQEmu::Item_Struct* item = 0; ItemInst *inst = 0; ServerLootItem_Struct* item_data = nullptr, *bag_item_data[10]; @@ -1209,7 +1206,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } /* Remove Bag Contents */ - if (item->ItemClass == ItemClassContainer && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) { + if (item->IsClassBag() && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) { for (int i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { if (bag_item_data[i]) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ @@ -1283,7 +1280,7 @@ void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.NPC = 2; UpdateActiveLight(); - ns->spawn.light = m_Light.Type.Active; + ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive]; } void Corpse::QueryLoot(Client* to) { @@ -1305,7 +1302,7 @@ void Corpse::QueryLoot(Client* to) { else x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; - const Item_Struct* item = database.GetItem(sitem->item_id); + const EQEmu::Item_Struct* item = database.GetItem(sitem->item_id); if (item) to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast(sitem->lootslot), sitem->equip_slot, item->Name, item->ID, sitem->charges); @@ -1319,7 +1316,7 @@ void Corpse::QueryLoot(Client* to) { } else { sitem->lootslot=y; - const Item_Struct* item = database.GetItem(sitem->item_id); + const EQEmu::Item_Struct* item = database.GetItem(sitem->item_id); if (item) to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges); @@ -1414,7 +1411,7 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const { } uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { - const Item_Struct *item; + const EQEmu::Item_Struct *item; if (material_slot > EQEmu::legacy::MATERIAL_END) { return 0; @@ -1432,8 +1429,8 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { void Corpse::UpdateEquipmentLight() { - m_Light.Type.Equipment = 0; - m_Light.Level.Equipment = 0; + m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; + m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { if (((*iter)->equip_slot < EQEmu::legacy::EQUIPMENT_BEGIN || (*iter)->equip_slot > EQEmu::legacy::EQUIPMENT_END) && (*iter)->equip_slot != EQEmu::legacy::SlotPowerSource) { continue; } @@ -1442,8 +1439,8 @@ void Corpse::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type.Equipment)) - m_Light.Type.Equipment = item->Light; + if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type[EQEmu::lightsource::LightEquipment])) + m_Light.Type[EQEmu::lightsource::LightEquipment] = item->Light; } uint8 general_light_type = 0; @@ -1453,17 +1450,17 @@ void Corpse::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - if (item->ItemClass != ItemClassCommon) { continue; } + if (!item->IsClassCommon()) { continue; } if (item->Light < 9 || item->Light > 13) { continue; } if (EQEmu::lightsource::TypeToLevel(item->Light)) general_light_type = item->Light; } - if (EQEmu::lightsource::IsLevelGreater(general_light_type, m_Light.Type.Equipment)) - m_Light.Type.Equipment = general_light_type; + if (EQEmu::lightsource::IsLevelGreater(general_light_type, m_Light.Type[EQEmu::lightsource::LightEquipment])) + m_Light.Type[EQEmu::lightsource::LightEquipment] = general_light_type; - m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); + m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } void Corpse::AddLooter(Mob* who) { diff --git a/zone/doors.cpp b/zone/doors.cpp index 76bdbdb20..b70da219e 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -285,7 +285,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) { if(sender->GetSkill(SkillPickLock)) { - if(lockpicks->GetItem()->ItemType == ItemTypeLockPick) + if(lockpicks->GetItem()->ItemType == EQEmu::item::ItemTypeLockPick) { float modskill=sender->GetSkill(SkillPickLock); sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); diff --git a/zone/effects.cpp b/zone/effects.cpp index 52b148fc9..69b5c0819 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -481,14 +481,14 @@ int32 Client::GetActSpellCasttime(uint16 spell_id, int32 casttime) bool Client::TrainDiscipline(uint32 itemid) { //get the item info - const Item_Struct *item = database.GetItem(itemid); + const EQEmu::Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); Log.Out(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } - if(item->ItemClass != ItemClassCommon || item->ItemType != ItemTypeSpell) { + if (!item->IsClassCommon() || item->ItemType != EQEmu::item::ItemTypeSpell) { Message(13, "Invalid item type, you cannot learn from this item."); //summon them the item back... SummonItem(itemid); diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 037649366..3607bbe05 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -882,7 +882,7 @@ void PerlembParser::GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlaye } else if(isItemQuest) { // need a valid ItemInst pointer check here..unsure how to cancel this process - const Item_Struct* item = iteminst->GetItem(); + const EQEmu::Item_Struct* item = iteminst->GetItem(); package_name = "qst_item_"; package_name += itoa(item->ID); } diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 8a1bde544..a24f3f070 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -33,7 +33,7 @@ const char *getItemName(unsigned itemid) { - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; item = database.GetItem(itemid); if (item) diff --git a/zone/entity.cpp b/zone/entity.cpp index ccc546ad1..4d6ca1459 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1955,7 +1955,7 @@ void EntityList::QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struc memcpy(outgbius, gbius, sizeof(GuildBankItemUpdate_Struct)); - const Item_Struct *Item = database.GetItem(gbius->ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(gbius->ItemID); auto it = client_list.begin(); while (it != client_list.end()) { @@ -3821,7 +3821,7 @@ void EntityList::GroupMessage(uint32 gid, const char *from, const char *message) uint16 EntityList::CreateGroundObject(uint32 itemid, const glm::vec4& position, uint32 decay_time) { - const Item_Struct *is = database.GetItem(itemid); + const EQEmu::Item_Struct *is = database.GetItem(itemid); if (!is) return 0; diff --git a/zone/forage.cpp b/zone/forage.cpp index 0a9f81e77..991947f8d 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -154,20 +154,20 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, bool Client::CanFish() { //make sure we still have a fishing pole on: const ItemInst* Pole = m_inv[EQEmu::legacy::SlotPrimary]; - int32 bslot = m_inv.HasItemByUse(ItemTypeFishingBait, 1, invWhereWorn|invWherePersonal); + int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); const ItemInst* Bait = nullptr; if (bslot != INVALID_INDEX) Bait = m_inv.GetItem(bslot); - if(!Pole || !Pole->IsType(ItemClassCommon) || Pole->GetItem()->ItemType != ItemTypeFishingPole) { - if (m_inv.HasItemByUse(ItemTypeFishingPole, 1, invWhereWorn|invWherePersonal|invWhereBank|invWhereSharedBank|invWhereTrading|invWhereCursor)) //We have a fishing pole somewhere, just not equipped + if (!Pole || !Pole->IsClassCommon() || Pole->GetItem()->ItemType != EQEmu::item::ItemTypeFishingPole) { + if (m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingPole, 1, invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)) //We have a fishing pole somewhere, just not equipped Message_StringID(MT_Skills, FISHING_EQUIP_POLE); //You need to put your fishing pole in your primary hand. else //We don't have a fishing pole anywhere Message_StringID(MT_Skills, FISHING_NO_POLE); //You can't fish without a fishing pole, go buy one. return false; } - if (!Bait || !Bait->IsType(ItemClassCommon) || Bait->GetItem()->ItemType != ItemTypeFishingBait) { + if (!Bait || !Bait->IsClassCommon() || Bait->GetItem()->ItemType != EQEmu::item::ItemTypeFishingBait) { Message_StringID(MT_Skills, FISHING_NO_BAIT); //You can't fish without fishing bait, go buy some. return false; } @@ -252,7 +252,7 @@ void Client::GoFish() int fishing_skill = GetSkill(SkillFishing); //will take into account skill bonuses on pole & bait //make sure we still have a fishing pole on: - int32 bslot = m_inv.HasItemByUse(ItemTypeFishingBait, 1, invWhereWorn|invWherePersonal); + int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); const ItemInst* Bait = nullptr; if (bslot != INVALID_INDEX) Bait = m_inv.GetItem(bslot); @@ -304,7 +304,7 @@ void Client::GoFish() food_id = common_fish_ids[index]; } - const Item_Struct* food_item = database.GetItem(food_id); + const EQEmu::Item_Struct* food_item = database.GetItem(food_id); Message_StringID(MT_Skills, FISHING_SUCCESS); ItemInst* inst = database.CreateItem(food_item, 1); @@ -396,7 +396,7 @@ void Client::ForageItem(bool guarantee) { foragedfood = common_food_ids[index]; } - const Item_Struct* food_item = database.GetItem(foragedfood); + const EQEmu::Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { Log.Out(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem"); @@ -407,20 +407,18 @@ void Client::ForageItem(bool guarantee) { stringid = FORAGE_GRUBS; else switch(food_item->ItemType) { - - case ItemTypeFood: - stringid = FORAGE_FOOD; - break; - - case ItemTypeDrink: - if(strstr(food_item->Name, "ater")) - stringid = FORAGE_WATER; - else - stringid = FORAGE_DRINK; - break; - default: - break; - } + case EQEmu::item::ItemTypeFood: + stringid = FORAGE_FOOD; + break; + case EQEmu::item::ItemTypeDrink: + if(strstr(food_item->Name, "ater")) + stringid = FORAGE_WATER; + else + stringid = FORAGE_DRINK; + break; + default: + break; + } Message_StringID(MT_Skills, stringid); ItemInst* inst = database.CreateItem(food_item, 1); diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index f7a7a2cc3..a801dc895 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -694,7 +694,7 @@ void GuildBankManager::SendGuildBank(Client *c) if (c->ClientVersionBit() & EQEmu::versions::bit_RoFAndLater) { auto outapp = new EQApplicationPacket(OP_GuildBankItemList, sizeof(GuildBankItemListEntry_Struct) * 240); for (int i = 0; i < GUILD_BANK_DEPOSIT_AREA_SIZE; ++i) { - const Item_Struct *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); if (Item) { outapp->WriteUInt8(1); outapp->WriteUInt32(guild_bank->Items.DepositArea[i].Permissions); @@ -718,7 +718,7 @@ void GuildBankManager::SendGuildBank(Client *c) outapp->SetWritePosition(outapp->GetWritePosition() + 20); // newer clients have 40 deposit slots, keep them 0 for now for (int i = 0; i < GUILD_BANK_MAIN_AREA_SIZE; ++i) { - const Item_Struct *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); if (Item) { outapp->WriteUInt8(1); outapp->WriteUInt32(guild_bank->Items.MainArea[i].Permissions); @@ -749,7 +749,7 @@ void GuildBankManager::SendGuildBank(Client *c) { if(guild_bank->Items.DepositArea[i].ItemID > 0) { - const Item_Struct *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); if(!Item) continue; @@ -785,7 +785,7 @@ void GuildBankManager::SendGuildBank(Client *c) { if(guild_bank->Items.MainArea[i].ItemID > 0) { - const Item_Struct *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); if(!Item) continue; @@ -916,7 +916,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 return false; } - const Item_Struct *Item = database.GetItem(ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(ItemID); GuildBankItemUpdate_Struct gbius; @@ -982,7 +982,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) (*iter)->Items.DepositArea[slotID].ItemID = 0; - const Item_Struct *Item = database.GetItem((*iter)->Items.MainArea[mainSlot].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem((*iter)->Items.MainArea[mainSlot].ItemID); GuildBankItemUpdate_Struct gbius; @@ -1038,7 +1038,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm else (*iter)->Items.MainArea[slotID].WhoFor[0] = '\0'; - const Item_Struct *Item = database.GetItem((*iter)->Items.MainArea[slotID].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem((*iter)->Items.MainArea[slotID].ItemID); GuildBankItemUpdate_Struct gbius; @@ -1169,7 +1169,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui bool deleted = true; - const Item_Struct *Item = database.GetItem(BankArea[slotID].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(BankArea[slotID].ItemID); if(!Item->Stackable || (quantity >= BankArea[slotID].Quantity)) { std::string query = StringFormat("DELETE FROM `guild_bank` WHERE `guildid` = %i " @@ -1230,7 +1230,7 @@ bool GuildBankManager::MergeStacks(uint32 GuildID, uint16 SlotID) if(BankArea[SlotID].ItemID == 0) return false; - const Item_Struct *Item = database.GetItem(BankArea[SlotID].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(BankArea[SlotID].ItemID); if(!Item->Stackable) return false; @@ -1328,7 +1328,7 @@ bool GuildBankManager::SplitStack(uint32 GuildID, uint16 SlotID, uint32 Quantity if(BankArea[SlotID].Quantity <= Quantity || Quantity == 0) return false; - const Item_Struct *Item = database.GetItem(BankArea[SlotID].ItemID); + const EQEmu::Item_Struct *Item = database.GetItem(BankArea[SlotID].ItemID); if(!Item->Stackable) return false; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 9d7c72f14..0ca5cc96e 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -177,7 +177,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } -bool Client::CheckLoreConflict(const Item_Struct* item) +bool Client::CheckLoreConflict(const EQEmu::Item_Struct* item) { if (!item) { return false; } if (!item->LoreFlag) { return false; } @@ -195,7 +195,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // TODO: update calling methods and script apis to handle a failure return - const Item_Struct* item = database.GetItem(item_id); + const EQEmu::Item_Struct* item = database.GetItem(item_id); // make sure the item exists if(item == nullptr) { @@ -213,7 +213,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, return false; } // check to make sure we are augmenting an augmentable item - else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { + else if (((!item->IsClassCommon()) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); @@ -247,7 +247,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, bool enforceusable = RuleB(Inventory, EnforceAugmentUsability); for (int iter = AUG_INDEX_BEGIN; iter < EQEmu::legacy::ITEM_COMMON_SIZE; ++iter) { - const Item_Struct* augtest = database.GetItem(augments[iter]); + const EQEmu::Item_Struct* augtest = database.GetItem(augments[iter]); if(augtest == nullptr) { if(augments[iter]) { @@ -290,7 +290,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for augment type allowance if(enforcewear) { - if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { + if ((item->AugSlotType[iter] == EQEmu::item::AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); @@ -313,153 +313,153 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint8 it = item->ItemType; switch(augtest->AugRestrict) { - case AugRestrAny: + case EQEmu::item::AugRestrictionAny: break; - case AugRestrArmor: + case EQEmu::item::AugRestrictionArmor: switch(it) { - case ItemTypeArmor: + case EQEmu::item::ItemTypeArmor: break; default: restrictfail = true; break; } break; - case AugRestrWeapons: + case EQEmu::item::AugRestrictionWeapons: switch(it) { - case ItemType1HSlash: - case ItemType1HBlunt: - case ItemType1HPiercing: - case ItemTypeMartial: - case ItemType2HSlash: - case ItemType2HBlunt: - case ItemType2HPiercing: - case ItemTypeBow: + case EQEmu::item::ItemType1HSlash: + case EQEmu::item::ItemType1HBlunt: + case EQEmu::item::ItemType1HPiercing: + case EQEmu::item::ItemTypeMartial: + case EQEmu::item::ItemType2HSlash: + case EQEmu::item::ItemType2HBlunt: + case EQEmu::item::ItemType2HPiercing: + case EQEmu::item::ItemTypeBow: break; default: restrictfail = true; break; } break; - case AugRestr1HWeapons: + case EQEmu::item::AugRestriction1HWeapons: switch(it) { - case ItemType1HSlash: - case ItemType1HBlunt: - case ItemType1HPiercing: - case ItemTypeMartial: + case EQEmu::item::ItemType1HSlash: + case EQEmu::item::ItemType1HBlunt: + case EQEmu::item::ItemType1HPiercing: + case EQEmu::item::ItemTypeMartial: break; default: restrictfail = true; break; } break; - case AugRestr2HWeapons: + case EQEmu::item::AugRestriction2HWeapons: switch(it) { - case ItemType2HSlash: - case ItemType2HBlunt: - case ItemType2HPiercing: - case ItemTypeBow: + case EQEmu::item::ItemType2HSlash: + case EQEmu::item::ItemType2HBlunt: + case EQEmu::item::ItemType2HPiercing: + case EQEmu::item::ItemTypeBow: break; default: restrictfail = true; break; } break; - case AugRestr1HSlash: + case EQEmu::item::AugRestriction1HSlash: switch(it) { - case ItemType1HSlash: + case EQEmu::item::ItemType1HSlash: break; default: restrictfail = true; break; } break; - case AugRestr1HBlunt: + case EQEmu::item::AugRestriction1HBlunt: switch(it) { - case ItemType1HBlunt: + case EQEmu::item::ItemType1HBlunt: break; default: restrictfail = true; break; } break; - case AugRestrPiercing: + case EQEmu::item::AugRestrictionPiercing: switch(it) { - case ItemType1HPiercing: + case EQEmu::item::ItemType1HPiercing: break; default: restrictfail = true; break; } break; - case AugRestrHandToHand: + case EQEmu::item::AugRestrictionHandToHand: switch(it) { - case ItemTypeMartial: + case EQEmu::item::ItemTypeMartial: break; default: restrictfail = true; break; } break; - case AugRestr2HSlash: + case EQEmu::item::AugRestriction2HSlash: switch(it) { - case ItemType2HSlash: + case EQEmu::item::ItemType2HSlash: break; default: restrictfail = true; break; } break; - case AugRestr2HBlunt: + case EQEmu::item::AugRestriction2HBlunt: switch(it) { - case ItemType2HBlunt: + case EQEmu::item::ItemType2HBlunt: break; default: restrictfail = true; break; } break; - case AugRestr2HPierce: + case EQEmu::item::AugRestriction2HPierce: switch(it) { - case ItemType2HPiercing: + case EQEmu::item::ItemType2HPiercing: break; default: restrictfail = true; break; } break; - case AugRestrBows: + case EQEmu::item::AugRestrictionBows: switch(it) { - case ItemTypeBow: + case EQEmu::item::ItemTypeBow: break; default: restrictfail = true; break; } break; - case AugRestrShields: + case EQEmu::item::AugRestrictionShields: switch(it) { - case ItemTypeShield: + case EQEmu::item::ItemTypeShield: break; default: restrictfail = true; break; } break; - case AugRestr1HSlash1HBluntOrHandToHand: + case EQEmu::item::AugRestriction1HSlash1HBluntOrHandToHand: switch(it) { - case ItemType1HSlash: - case ItemType1HBlunt: - case ItemTypeMartial: + case EQEmu::item::ItemType1HSlash: + case EQEmu::item::ItemType1HBlunt: + case EQEmu::item::ItemTypeMartial: break; default: restrictfail = true; break; } break; - case AugRestr1HBluntOrHandToHand: + case EQEmu::item::AugRestriction1HBluntOrHandToHand: switch(it) { - case ItemType1HBlunt: - case ItemTypeMartial: + case EQEmu::item::ItemType1HBlunt: + case EQEmu::item::ItemTypeMartial: break; default: restrictfail = true; @@ -467,9 +467,9 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, } break; // These 3 are in-work - case AugRestrUnknown1: - case AugRestrUnknown2: - case AugRestrUnknown3: + case EQEmu::item::AugRestrictionUnknown1: + case EQEmu::item::AugRestrictionUnknown2: + case EQEmu::item::AugRestrictionUnknown3: default: restrictfail = true; break; @@ -760,7 +760,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd qsaudit->items[parent_offset].aug_4 = m_inv[slot_id]->GetAugmentItemID(4); qsaudit->items[parent_offset].aug_5 = m_inv[slot_id]->GetAugmentItemID(5); - if(m_inv[slot_id]->IsType(ItemClassContainer)) { + if (m_inv[slot_id]->IsClassBag()) { for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) { ItemInst* bagitem = m_inv[slot_id]->GetItem(bag_idx); @@ -986,7 +986,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_cursor, ServerLootItem_Struct** bag_item_data) { // #1: Try to auto equip - if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel<=level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != ItemTypeAugmentation) { + if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel <= level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != EQEmu::item::ItemTypeAugmentation) { // too messy as-is... for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i < EQEmu::legacy::SlotPowerSource; i++) { // originally (i < 22) if (i == EQEmu::legacy::GENERAL_BEGIN) { @@ -999,15 +999,14 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs if (!m_inv[i]) { if (i == EQEmu::legacy::SlotPrimary && inst.IsWeapon()) { // If item is primary slot weapon - if ((inst.GetItem()->ItemType == ItemType2HSlash) || (inst.GetItem()->ItemType == ItemType2HBlunt) || (inst.GetItem()->ItemType == ItemType2HPiercing)) { // and uses 2hs \ 2hb \ 2hp + if (inst.GetItem()->IsType2HWeapon()) { // and uses 2hs \ 2hb \ 2hp if (m_inv[EQEmu::legacy::SlotSecondary]) { // and if secondary slot is not empty continue; // Can't auto-equip } } } if (i == EQEmu::legacy::SlotSecondary && m_inv[EQEmu::legacy::SlotPrimary]) { // check to see if primary slot is a two hander - uint8 use = m_inv[EQEmu::legacy::SlotPrimary]->GetItem()->ItemType; - if (use == ItemType2HSlash || use == ItemType2HBlunt || use == ItemType2HPiercing) + if (m_inv[EQEmu::legacy::SlotPrimary]->GetItem()->IsType2HWeapon()) continue; } if (i == EQEmu::legacy::SlotSecondary && inst.IsWeapon() && !CanThisClassDualWield()) { @@ -1036,8 +1035,8 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs } // #3: put it in inventory - bool is_arrow = (inst.GetItem()->ItemType == ItemTypeArrow) ? true : false; - int16 slot_id = m_inv.FindFreeSlot(inst.IsType(ItemClassContainer), try_cursor, inst.GetItem()->Size, is_arrow); + bool is_arrow = (inst.GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; + int16 slot_id = m_inv.FindFreeSlot(inst.IsClassBag(), try_cursor, inst.GetItem()->Size, is_arrow); if (slot_id != INVALID_INDEX) { PutLootInInventory(slot_id, inst, bag_item_data); return true; @@ -1188,7 +1187,7 @@ int Client::GetItemLinkHash(const ItemInst* inst) { if (!inst) //have to have an item to make the hash return 0; - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); char* hash_str = 0; /*register */int hash = 0; @@ -1282,7 +1281,7 @@ packet with the item number in it, but I cant seem to find it right now if (!inst) return; - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); const char* name2 = &item->Name[0]; EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(name2)+68); char buffer2[135] = {0}; @@ -1514,7 +1513,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { DeleteItemInInventory(dst_slot_id,0,true); return(false); } - if (src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_END && src_inst->IsType(ItemClassContainer)){ + if (src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_END && src_inst->IsClassBag()){ for (uint8 idx = SUB_INDEX_BEGIN; idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = src_inst->GetItem(idx); if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){ @@ -1529,7 +1528,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { DeleteItemInInventory(src_slot_id,0,true); return(false); } - if (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_END && dst_inst->IsType(ItemClassContainer)){ + if (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_END && dst_inst->IsClassBag()){ for (uint8 idx = SUB_INDEX_BEGIN; idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = dst_inst->GetItem(idx); if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){ @@ -1596,8 +1595,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { m_inv.DeleteItem(src_slot_id); } else { - const Item_Struct* world_item = world_inst->GetItem(); - const Item_Struct* src_item = src_inst->GetItem(); + const EQEmu::Item_Struct* world_item = world_inst->GetItem(); + const EQEmu::Item_Struct* src_item = src_inst->GetItem(); if (world_item && src_item) { // Case 2: Same item on cursor, stacks, transfer of charges needed if ((world_item->ID == src_item->ID) && src_inst->IsStackable()) { @@ -1837,7 +1836,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { // This prevents the client from crashing when closing any 'phantom' bags - const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' + const EQEmu::Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' ItemInst* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); @@ -1862,7 +1861,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { - const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' + const EQEmu::Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' ItemInst* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); @@ -1879,7 +1878,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::legacy::SlotPowerSource) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { - const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' + const EQEmu::Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' ItemInst* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); @@ -1904,7 +1903,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { - const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' + const EQEmu::Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' ItemInst* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); @@ -1956,7 +1955,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { qsaudit->items[move_count].aug_4 = from_inst->GetAugmentItemID(4); qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5); - if(from_inst->IsType(ItemClassContainer)) { + if (from_inst->IsType(EQEmu::item::ItemClassBag)) { for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { const ItemInst* from_baginst = from_inst->GetItem(bag_idx); @@ -1989,7 +1988,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { qsaudit->items[move_count].aug_4 = to_inst->GetAugmentItemID(4); qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5); - if(to_inst->IsType(ItemClassContainer)) { + if (to_inst->IsType(EQEmu::item::ItemClassBag)) { for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { const ItemInst* to_baginst = to_inst->GetItem(bag_idx); @@ -2107,7 +2106,7 @@ bool Client::DecreaseByItemType(uint32 type, uint8 amt) { #endif bool Client::DecreaseByID(uint32 type, uint8 amt) { - const Item_Struct* TempItem = nullptr; + const EQEmu::Item_Struct* TempItem = nullptr; ItemInst* ins = nullptr; int x; int num = 0; @@ -2231,7 +2230,7 @@ void Client::DisenchantSummonedBags(bool client_update) auto inst = m_inv[slot_id]; if (!inst) { continue; } if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } + if (!inst->GetItem()->IsClassBag()) { continue; } if (inst->GetTotalItemCount() == 1) { continue; } auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); @@ -2252,7 +2251,7 @@ void Client::DisenchantSummonedBags(bool client_update) auto inst = m_inv[slot_id]; if (!inst) { continue; } if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } + if (!inst->GetItem()->IsClassBag()) { continue; } if (inst->GetTotalItemCount() == 1) { continue; } auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); @@ -2273,7 +2272,7 @@ void Client::DisenchantSummonedBags(bool client_update) auto inst = m_inv[slot_id]; if (!inst) { continue; } if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } + if (!inst->GetItem()->IsClassBag()) { continue; } if (inst->GetTotalItemCount() == 1) { continue; } auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); @@ -2294,7 +2293,7 @@ void Client::DisenchantSummonedBags(bool client_update) auto inst = m_inv[EQEmu::legacy::SlotCursor]; if (!inst) { break; } if (!IsSummonedBagID(inst->GetItem()->ID)) { break; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { break; } + if (!inst->GetItem()->IsClassBag()) { break; } if (inst->GetTotalItemCount() == 1) { break; } auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); @@ -2562,8 +2561,8 @@ void Client::MoveSlotNotAllowed(bool client_update) for (auto slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id <= EQEmu::legacy::EQUIPMENT_END; ++slot_id) { if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) { auto inst = m_inv.PopItem(slot_id); - bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; - int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); + bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; + int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow); Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, client_update); database.SaveInventory(character_id, nullptr, slot_id); @@ -2573,8 +2572,8 @@ void Client::MoveSlotNotAllowed(bool client_update) if (m_inv[EQEmu::legacy::SlotPowerSource] && !m_inv[EQEmu::legacy::SlotPowerSource]->IsSlotAllowed(EQEmu::legacy::SlotPowerSource)) { auto inst = m_inv.PopItem(EQEmu::legacy::SlotPowerSource); - bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; - int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); + bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; + int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow); Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::legacy::SlotPowerSource, free_slot_id); PutItemInInventory(free_slot_id, *inst, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); database.SaveInventory(character_id, nullptr, EQEmu::legacy::SlotPowerSource); @@ -2632,7 +2631,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const if (material_slot > EQEmu::legacy::MATERIAL_END) return 0; - const Item_Struct *item = database.GetItem(GetEquipment(material_slot)); + const EQEmu::Item_Struct *item = database.GetItem(GetEquipment(material_slot)); if(item != nullptr) return ((m_pp.item_tint[material_slot].RGB.UseTint) ? m_pp.item_tint[material_slot].Color : item->Color); @@ -2716,7 +2715,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name); const ItemInst* InvItem = nullptr; - const Item_Struct *BaseItem = nullptr; + const EQEmu::Item_Struct *BaseItem = nullptr; int16 WeaponSlot = 0; for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) { @@ -2950,7 +2949,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { } // If there is a bag in this slot, look inside it. // - if (InvItem && InvItem->IsType(ItemClassContainer)) { + if (InvItem && InvItem->IsClassBag()) { int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); @@ -3002,7 +3001,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { return true; } - if(InvItem->IsType(ItemClassContainer) && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { + if (InvItem->IsClassBag() && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); @@ -3208,7 +3207,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* case 1: // requirement: parent is common and inst is augment if ((!parent) || (!inst)) return true; - if (!parent->IsType(ItemClassCommon)) + if (!parent->IsType(EQEmu::item::ItemClassCommon)) return true; if (index >= EQEmu::legacy::ITEM_COMMON_SIZE) return true; @@ -3232,11 +3231,11 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* case 1: // requirement: parent is common and inst is augment ..or.. parent is container and inst is extant if ((!parent) || (!inst)) return true; - if (parent->IsType(ItemClassContainer)) + if (parent->IsType(EQEmu::item::ItemClassBag)) break; - if (parent->IsType(ItemClassBook)) + if (parent->IsClassBook()) return true; - if (parent->IsType(ItemClassCommon)) { + if (parent->IsClassCommon()) { if (!(inst->GetItem()->AugType > 0)) return true; if (index >= EQEmu::legacy::ITEM_COMMON_SIZE) @@ -3246,11 +3245,11 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* case 2: // requirement: parent is common and inst is augment if ((!parent) || (!inst)) return true; - if (parent->IsType(ItemClassContainer)) + if (parent->IsType(EQEmu::item::ItemClassBag)) return true; - if (parent->IsType(ItemClassBook)) + if (parent->IsClassBook()) return true; - if (parent->IsType(ItemClassCommon)) { + if (parent->IsClassCommon()) { if (!(inst->GetItem()->AugType > 0)) return true; if (index >= EQEmu::legacy::ITEM_COMMON_SIZE) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 86969ccca..1aab9eb51 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -119,7 +119,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml int charges = lds->Entries[i].multiplier; for(int j = 0; j < charges; ++j) { if(zone->random.Real(0.0, 100.0) <= lds->Entries[i].chance) { - const Item_Struct* dbitem = GetItem(lds->Entries[i].item_id); + const EQEmu::Item_Struct* dbitem = GetItem(lds->Entries[i].item_id); npc->AddLootDrop(dbitem, itemlist, lds->Entries[i].item_charges, lds->Entries[i].minlevel, lds->Entries[i].maxlevel, lds->Entries[i].equip_item > 0 ? true : false, false); } @@ -140,7 +140,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml float roll_t_min = 0.0f; bool active_item_list = false; for(uint32 i = 0; i < lds->NumEntries; ++i) { - const Item_Struct* db_item = GetItem(lds->Entries[i].item_id); + const EQEmu::Item_Struct* db_item = GetItem(lds->Entries[i].item_id); if(db_item) { roll_t += lds->Entries[i].chance; active_item_list = true; @@ -157,7 +157,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml for(int i = 0; i < mindrop; ++i) { float roll = (float)zone->random.Real(0.0, roll_t_min); for(uint32 j = 0; j < lds->NumEntries; ++j) { - const Item_Struct* db_item = GetItem(lds->Entries[j].item_id); + const EQEmu::Item_Struct* db_item = GetItem(lds->Entries[j].item_id); if(db_item) { if(roll < lds->Entries[j].chance) { npc->AddLootDrop(db_item, itemlist, lds->Entries[j].item_charges, lds->Entries[j].minlevel, @@ -187,7 +187,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml for(int i = mindrop; i < droplimit; ++i) { float roll = (float)zone->random.Real(0.0, roll_t); for(uint32 j = 0; j < lds->NumEntries; ++j) { - const Item_Struct* db_item = GetItem(lds->Entries[j].item_id); + const EQEmu::Item_Struct* db_item = GetItem(lds->Entries[j].item_id); if(db_item) { if(roll < lds->Entries[j].chance) { npc->AddLootDrop(db_item, itemlist, lds->Entries[j].item_charges, lds->Entries[j].minlevel, @@ -221,7 +221,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml } //if itemlist is null, just send wear changes -void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) { +void NPC::AddLootDrop(const EQEmu::Item_Struct *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) { if(item2 == nullptr) return; @@ -258,7 +258,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge if (equipit) { uint8 eslot = 0xFF; char newid[20]; - const Item_Struct* compitem = nullptr; + const EQEmu::Item_Struct* compitem = nullptr; bool found = false; // track if we found an empty slot we fit into int32 foundslot = -1; // for multi-slot items @@ -334,13 +334,12 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge eslot = EQEmu::legacy::MaterialPrimary; if (item2->Damage > 0) SendAddPlayerState(PlayerState::PrimaryWeaponEquipped); - if (item2->ItemType == ItemType2HBlunt || item2->ItemType == ItemType2HSlash || item2->ItemType == ItemType2HPiercing) + if (item2->IsType2HWeapon()) SetTwoHanderEquipped(true); } else if (foundslot == EQEmu::legacy::SlotSecondary && (GetOwner() != nullptr || (CanThisClassDualWield() && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) && - (item2->ItemType == ItemType1HSlash || item2->ItemType == ItemType1HBlunt || item2->ItemType == ItemTypeShield || - item2->ItemType == ItemType1HPiercing)) + (item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield)) { if (item2->Proc.Effect!=0) CastToMob()->AddProcToWeapon(item2->Proc.Effect, true); @@ -416,14 +415,14 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge SendAppearancePacket(AT_Light, GetActiveLightType()); } -void NPC::AddItem(const Item_Struct* item, uint16 charges, bool equipitem) { +void NPC::AddItem(const EQEmu::Item_Struct* item, uint16 charges, bool equipitem) { //slot isnt needed, its determined from the item. AddLootDrop(item, &itemlist, charges, 1, 127, equipitem, equipitem); } void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem) { //slot isnt needed, its determined from the item. - const Item_Struct * i = database.GetItem(itemid); + const EQEmu::Item_Struct * i = database.GetItem(itemid); if(i == nullptr) return; AddLootDrop(i, &itemlist, charges, 1, 127, equipitem, equipitem); diff --git a/zone/lua_item.cpp b/zone/lua_item.cpp index 16254c52e..429e140dc 100644 --- a/zone/lua_item.cpp +++ b/zone/lua_item.cpp @@ -7,7 +7,7 @@ #include "lua_item.h" Lua_Item::Lua_Item(uint32 item_id) { - const Item_Struct *t = database.GetItem(item_id); + const EQEmu::Item_Struct *t = database.GetItem(item_id); SetLuaPtrData(t); } diff --git a/zone/lua_item.h b/zone/lua_item.h index 961da1333..5e3e021c9 100644 --- a/zone/lua_item.h +++ b/zone/lua_item.h @@ -4,7 +4,10 @@ #include "lua_ptr.h" -struct Item_Struct; +namespace EQEmu +{ + struct Item_Struct; +} namespace luabind { struct scope; @@ -12,17 +15,17 @@ namespace luabind { luabind::scope lua_register_item(); -class Lua_Item : public Lua_Ptr +class Lua_Item : public Lua_Ptr { - typedef const Item_Struct NativeType; + typedef const EQEmu::Item_Struct NativeType; public: Lua_Item(uint32 item_id); Lua_Item() : Lua_Ptr(nullptr) { } - Lua_Item(const Item_Struct *d) : Lua_Ptr(d) { } + Lua_Item(const EQEmu::Item_Struct *d) : Lua_Ptr(d) { } virtual ~Lua_Item() { } - operator const Item_Struct*() { - return reinterpret_cast(GetLuaPtrData()); + operator const EQEmu::Item_Struct*() { + return reinterpret_cast(GetLuaPtrData()); } int GetMinStatus(); diff --git a/zone/lua_iteminst.cpp b/zone/lua_iteminst.cpp index 4ebc6908f..0b6981358 100644 --- a/zone/lua_iteminst.cpp +++ b/zone/lua_iteminst.cpp @@ -41,7 +41,7 @@ Lua_ItemInst::Lua_ItemInst(const Lua_ItemInst& o) { bool Lua_ItemInst::IsType(int item_class) { Lua_Safe_Call_Bool(); - return self->IsType(static_cast(item_class)); + return self->IsType(static_cast(item_class)); } bool Lua_ItemInst::IsStackable() { diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index 840bcb40d..88a117277 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -298,7 +298,7 @@ void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, st void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { - const Item_Struct *item = database.GetItem(extra_data); + const EQEmu::Item_Struct *item = database.GetItem(extra_data); if(item) { Lua_Item l_item(item); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); diff --git a/zone/merc.cpp b/zone/merc.cpp index 606ce8a35..840c8ac38 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -217,7 +217,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { for (i = 0; i < EQEmu::legacy::SlotAmmo; i++) { if(equipment[i] == 0) continue; - const Item_Struct * itm = database.GetItem(equipment[i]); + const EQEmu::Item_Struct * itm = database.GetItem(equipment[i]); if(itm) AddItemBonuses(itm, newbon); } @@ -243,7 +243,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { SetAttackTimer(); } -void Merc::AddItemBonuses(const Item_Struct *item, StatBonuses* newbon) { +void Merc::AddItemBonuses(const EQEmu::Item_Struct *item, StatBonuses* newbon) { if(GetLevel() < item->ReqLevel) { @@ -456,11 +456,11 @@ void Merc::AddItemBonuses(const Item_Struct *item, StatBonuses* newbon) { else newbon->DSMitigation += item->DSMitigation; } - if (item->Worn.Effect>0 && (item->Worn.Type == ET_WornEffect)) { // latent effects + if (item->Worn.Effect>0 && (item->Worn.Type == EQEmu::item::ItemEffectWorn)) { // latent effects ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, newbon, 0, item->Worn.Type); } - if (item->Focus.Effect>0 && (item->Focus.Type == ET_Focus)) { // focus effects + if (item->Focus.Effect>0 && (item->Focus.Type == EQEmu::item::ItemEffectFocus)) { // focus effects ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, newbon, 0); } @@ -1210,7 +1210,7 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.IsMercenary = 1; UpdateActiveLight(); - ns->spawn.light = m_Light.Type.Active; + ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive]; /* // Wear Slots are not setup for Mercs yet @@ -1621,7 +1621,8 @@ void Merc::AI_Process() { int weapontype = 0; // No weapon type bool bIsFist = true; - if(bIsFist || ((weapontype != ItemType2HSlash) && (weapontype != ItemType2HPiercing) && (weapontype != ItemType2HBlunt))) + // why are we checking 'weapontype' when we know it's set to '0' above? + if (bIsFist || ((weapontype != EQEmu::item::ItemType2HSlash) && (weapontype != EQEmu::item::ItemType2HPiercing) && (weapontype != EQEmu::item::ItemType2HBlunt))) { float DualWieldProbability = 0.0f; @@ -2544,8 +2545,8 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[type]){ - const Item_Struct* TempItem = 0; - const Item_Struct* UsedItem = 0; + const EQEmu::Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* UsedItem = 0; uint16 UsedFocusID = 0; int16 Total = 0; int16 focus_max = 0; @@ -4407,7 +4408,7 @@ void Merc::DoClassAttacks(Mob *target) { DoAnim(animKick); int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(target, (const EQEmu::Item_Struct*)nullptr) <= 0){ dmg = -5; } else{ @@ -4429,7 +4430,7 @@ void Merc::DoClassAttacks(Mob *target) { DoAnim(animTailRake); int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(target, (const EQEmu::Item_Struct*)nullptr) <= 0){ dmg = -5; } else{ @@ -5041,8 +5042,8 @@ void Merc::UpdateMercAppearance() { void Merc::UpdateEquipmentLight() { - m_Light.Type.Equipment = 0; - m_Light.Level.Equipment = 0; + m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; + m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; for (int index = SLOT_BEGIN; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { if (index == EQEmu::legacy::SlotAmmo) { continue; } @@ -5050,9 +5051,9 @@ void Merc::UpdateEquipmentLight() auto item = database.GetItem(equipment[index]); if (item == nullptr) { continue; } - if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type.Equipment)) { - m_Light.Type.Equipment = item->Light; - m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); + if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type[EQEmu::lightsource::LightEquipment])) { + m_Light.Type[EQEmu::lightsource::LightEquipment] = item->Light; + m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } } @@ -5061,17 +5062,17 @@ void Merc::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - if (item->ItemClass != ItemClassCommon) { continue; } + if (!item->IsClassCommon()) { continue; } if (item->Light < 9 || item->Light > 13) { continue; } if (EQEmu::lightsource::TypeToLevel(item->Light)) general_light_type = item->Light; } - if (EQEmu::lightsource::IsLevelGreater(general_light_type, m_Light.Type.Equipment)) - m_Light.Type.Equipment = general_light_type; + if (EQEmu::lightsource::IsLevelGreater(general_light_type, m_Light.Type[EQEmu::lightsource::LightEquipment])) + m_Light.Type[EQEmu::lightsource::LightEquipment] = general_light_type; - m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); + m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } void Merc::AddItem(uint8 slot, uint32 item_id) { diff --git a/zone/merc.h b/zone/merc.h index b981e28b5..e9f993063 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -8,11 +8,15 @@ class Corpse; class Group; class Mob; class Raid; -struct Item_Struct; struct MercTemplate; struct NPCType; struct NewSpawn_Struct; +namespace EQEmu +{ + struct Item_Struct; +} + #define MAXMERCS 1 #define TANK 1 #define HEALER 2 @@ -279,7 +283,7 @@ public: protected: void CalcItemBonuses(StatBonuses* newbon); - void AddItemBonuses(const Item_Struct *item, StatBonuses* newbon); + void AddItemBonuses(const EQEmu::Item_Struct *item, StatBonuses* newbon); int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); int16 GetFocusEffect(focusType type, uint16 spell_id); diff --git a/zone/mob.cpp b/zone/mob.cpp index 05b6b828a..5b1e132a9 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -178,12 +178,10 @@ Mob::Mob(const char* in_name, if (runspeed < 0 || runspeed > 20) runspeed = 1.25f; - m_Light.Type.Innate = in_light; - m_Light.Level.Innate = EQEmu::lightsource::TypeToLevel(m_Light.Type.Innate); - m_Light.Level.Equipment = m_Light.Type.Equipment = 0; - m_Light.Level.Spell = m_Light.Type.Spell = 0; - m_Light.Type.Active = m_Light.Type.Innate; - m_Light.Level.Active = m_Light.Level.Innate; + m_Light.Type[EQEmu::lightsource::LightInnate] = in_light; + m_Light.Level[EQEmu::lightsource::LightInnate] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightInnate]); + m_Light.Type[EQEmu::lightsource::LightActive] = m_Light.Type[EQEmu::lightsource::LightInnate]; + m_Light.Level[EQEmu::lightsource::LightActive] = m_Light.Level[EQEmu::lightsource::LightInnate]; texture = in_texture; helmtexture = in_helmtexture; @@ -1100,7 +1098,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.findable = findable?1:0; UpdateActiveLight(); - ns->spawn.light = m_Light.Type.Active; + ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive]; ns->spawn.showhelm = (helmtexture && helmtexture != 0xFF) ? 1 : 0; @@ -2227,18 +2225,18 @@ void Mob::SetAppearance(EmuAppearance app, bool iIgnoreSelf) { bool Mob::UpdateActiveLight() { - uint8 old_light_level = m_Light.Level.Active; + uint8 old_light_level = m_Light.Level[EQEmu::lightsource::LightActive]; - m_Light.Type.Active = 0; - m_Light.Level.Active = 0; + m_Light.Type[EQEmu::lightsource::LightActive] = 0; + m_Light.Level[EQEmu::lightsource::LightActive] = 0; - if (EQEmu::lightsource::IsLevelGreater((m_Light.Type.Innate & 0x0F), m_Light.Type.Active)) { m_Light.Type.Active = m_Light.Type.Innate; } - if (m_Light.Level.Equipment > m_Light.Level.Active) { m_Light.Type.Active = m_Light.Type.Equipment; } // limiter in property handler - if (m_Light.Level.Spell > m_Light.Level.Active) { m_Light.Type.Active = m_Light.Type.Spell; } // limiter in property handler + if (EQEmu::lightsource::IsLevelGreater((m_Light.Type[EQEmu::lightsource::LightInnate] & 0x0F), m_Light.Type[EQEmu::lightsource::LightActive])) { m_Light.Type[EQEmu::lightsource::LightActive] = m_Light.Type[EQEmu::lightsource::LightInnate]; } + if (m_Light.Level[EQEmu::lightsource::LightEquipment] > m_Light.Level[EQEmu::lightsource::LightActive]) { m_Light.Type[EQEmu::lightsource::LightActive] = m_Light.Type[EQEmu::lightsource::LightEquipment]; } // limiter in property handler + if (m_Light.Level[EQEmu::lightsource::LightSpell] > m_Light.Level[EQEmu::lightsource::LightActive]) { m_Light.Type[EQEmu::lightsource::LightActive] = m_Light.Type[EQEmu::lightsource::LightSpell]; } // limiter in property handler - m_Light.Level.Active = EQEmu::lightsource::TypeToLevel(m_Light.Type.Active); + m_Light.Level[EQEmu::lightsource::LightActive] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightActive]); - return (m_Light.Level.Active != old_light_level); + return (m_Light.Level[EQEmu::lightsource::LightActive] != old_light_level); } void Mob::ChangeSize(float in_size = 0, bool bNoRestriction) { @@ -2384,9 +2382,9 @@ bool Mob::CanThisClassDualWield(void) const { // 2HS, 2HB, or 2HP if(pinst && pinst->IsWeapon()) { - const Item_Struct* item = pinst->GetItem(); + const EQEmu::Item_Struct* item = pinst->GetItem(); - if((item->ItemType == ItemType2HBlunt) || (item->ItemType == ItemType2HSlash) || (item->ItemType == ItemType2HPiercing)) + if (item->IsType2HWeapon()) return false; } @@ -2756,7 +2754,7 @@ void Mob::SendArmorAppearance(Client *one_client) { if (!IsClient()) { - const Item_Struct *item; + const EQEmu::Item_Struct *item; for (int i = 0; i < 7; ++i) { item = database.GetItem(GetEquipment(i)); @@ -2859,7 +2857,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { uint32 equipmaterial = 0; int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - const Item_Struct *item; + const EQEmu::Item_Struct *item; item = database.GetItem(GetEquipment(material_slot)); if (item != 0) @@ -2912,7 +2910,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const if (material_slot >= 0 && material_slot < EQEmu::legacy::MaterialPrimary) { uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - const Item_Struct *item; + const EQEmu::Item_Struct *item; item = database.GetItem(GetEquipment(material_slot)); int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); @@ -2966,7 +2964,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const uint32 Mob::GetEquipmentColor(uint8 material_slot) const { - const Item_Struct *item; + const EQEmu::Item_Struct *item; if (armor_tint[material_slot]) { @@ -2982,7 +2980,7 @@ uint32 Mob::GetEquipmentColor(uint8 material_slot) const uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const { - const Item_Struct *item; + const EQEmu::Item_Struct *item; item = database.GetItem(GetEquipment(material_slot)); if(item != 0) @@ -3898,7 +3896,7 @@ int32 Mob::GetItemStat(uint32 itemid, const char *identifier) if (!inst) return 0; - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (!item) return 0; @@ -5021,62 +5019,58 @@ void Mob::SlowMitigation(Mob* caster) uint16 Mob::GetSkillByItemType(int ItemType) { - switch (ItemType) - { - case ItemType1HSlash: - return Skill1HSlashing; - case ItemType2HSlash: - return Skill2HSlashing; - case ItemType1HPiercing: + switch (ItemType) { + case EQEmu::item::ItemType1HSlash: + return Skill1HSlashing; + case EQEmu::item::ItemType2HSlash: + return Skill2HSlashing; + case EQEmu::item::ItemType1HPiercing: + return Skill1HPiercing; + case EQEmu::item::ItemType1HBlunt: + return Skill1HBlunt; + case EQEmu::item::ItemType2HBlunt: + return Skill2HBlunt; + case EQEmu::item::ItemType2HPiercing: + if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) return Skill1HPiercing; - case ItemType1HBlunt: - return Skill1HBlunt; - case ItemType2HBlunt: - return Skill2HBlunt; - case ItemType2HPiercing: - if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - return Skill1HPiercing; - else - return Skill2HPiercing; - case ItemTypeBow: - return SkillArchery; - case ItemTypeLargeThrowing: - case ItemTypeSmallThrowing: - return SkillThrowing; - case ItemTypeMartial: - return SkillHandtoHand; - default: - return SkillHandtoHand; + else + return Skill2HPiercing; + case EQEmu::item::ItemTypeBow: + return SkillArchery; + case EQEmu::item::ItemTypeLargeThrowing: + case EQEmu::item::ItemTypeSmallThrowing: + return SkillThrowing; + case EQEmu::item::ItemTypeMartial: + return SkillHandtoHand; + default: + return SkillHandtoHand; } - return SkillHandtoHand; } uint8 Mob::GetItemTypeBySkill(SkillUseTypes skill) { - switch (skill) - { - case SkillThrowing: - return ItemTypeSmallThrowing; - case SkillArchery: - return ItemTypeArrow; - case Skill1HSlashing: - return ItemType1HSlash; - case Skill2HSlashing: - return ItemType2HSlash; - case Skill1HPiercing: - return ItemType1HPiercing; - case Skill2HPiercing: // watch for undesired client behavior - return ItemType2HPiercing; - case Skill1HBlunt: - return ItemType1HBlunt; - case Skill2HBlunt: - return ItemType2HBlunt; - case SkillHandtoHand: - return ItemTypeMartial; - default: - return ItemTypeMartial; + switch (skill) { + case SkillThrowing: + return EQEmu::item::ItemTypeSmallThrowing; + case SkillArchery: + return EQEmu::item::ItemTypeArrow; + case Skill1HSlashing: + return EQEmu::item::ItemType1HSlash; + case Skill2HSlashing: + return EQEmu::item::ItemType2HSlash; + case Skill1HPiercing: + return EQEmu::item::ItemType1HPiercing; + case Skill2HPiercing: // watch for undesired client behavior + return EQEmu::item::ItemType2HPiercing; + case Skill1HBlunt: + return EQEmu::item::ItemType1HBlunt; + case Skill2HBlunt: + return EQEmu::item::ItemType2HBlunt; + case SkillHandtoHand: + return EQEmu::item::ItemTypeMartial; + default: + return EQEmu::item::ItemTypeMartial; } - return ItemTypeMartial; } @@ -5633,7 +5627,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) bool Mob::CanClassEquipItem(uint32 item_id) { - const Item_Struct* itm = nullptr; + const EQEmu::Item_Struct* itm = nullptr; itm = database.GetItem(item_id); if (!itm) diff --git a/zone/mob.h b/zone/mob.h index 7724dfaa8..18c46cb61 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -44,10 +44,14 @@ class Group; class ItemInst; class NPC; class Raid; -struct Item_Struct; struct NewSpawn_Struct; struct PlayerPositionUpdateServer_Struct; +namespace EQEmu +{ + struct Item_Struct; +} + class Mob : public Entity { public: enum CLIENT_CONN_STATUS { CLIENT_CONNECTING, CLIENT_CONNECTED, CLIENT_LINKDEAD, @@ -703,17 +707,17 @@ public: bool IsDestructibleObject() { return destructibleobject; } void SetDestructibleObject(bool in) { destructibleobject = in; } - inline uint8 GetInnateLightType() { return m_Light.Type.Innate; } - inline uint8 GetEquipmentLightType() { return m_Light.Type.Equipment; } - inline uint8 GetSpellLightType() { return m_Light.Type.Spell; } + inline uint8 GetInnateLightType() { return m_Light.Type[EQEmu::lightsource::LightInnate]; } + inline uint8 GetEquipmentLightType() { return m_Light.Type[EQEmu::lightsource::LightEquipment]; } + inline uint8 GetSpellLightType() { return m_Light.Type[EQEmu::lightsource::LightSpell]; } - virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = 0; m_Light.Level.Equipment = 0; } - inline void SetSpellLightType(uint8 light_type) { m_Light.Type.Spell = (light_type & 0x0F); m_Light.Level.Spell = EQEmu::lightsource::TypeToLevel(m_Light.Type.Spell); } + virtual void UpdateEquipmentLight() { m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; } + inline void SetSpellLightType(uint8 light_type) { m_Light.Type[EQEmu::lightsource::LightSpell] = (light_type & 0x0F); m_Light.Level[EQEmu::lightsource::LightSpell] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightSpell]); } - inline uint8 GetActiveLightType() { return m_Light.Type.Active; } + inline uint8 GetActiveLightType() { return m_Light.Type[EQEmu::lightsource::LightActive]; } bool UpdateActiveLight(); // returns true if change, false if no change - EQEmu::lightsource::LightSourceProfile* GetLightProfile() { return &m_Light; } + EQEmu::LightSourceProfile* GetLightProfile() { return &m_Light; } Mob* GetPet(); void SetPet(Mob* newpet); @@ -763,7 +767,7 @@ public: virtual int GetHaste(); int32 GetMeleeMitigation(); - uint8 GetWeaponDamageBonus(const Item_Struct* weapon, bool offhand = false); + uint8 GetWeaponDamageBonus(const EQEmu::Item_Struct* weapon, bool offhand = false); uint16 GetDamageTable(SkillUseTypes skillinuse); virtual int GetHandToHandDamage(void); @@ -788,10 +792,10 @@ public: int32 ReduceAllDamage(int32 damage); virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool CheckHitChance=false, bool CanAvoid=true); - virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* AmmoItem=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 range_id=0, int AmmoSlot=0, float speed = 4.0f); + virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const EQEmu::Item_Struct* AmmoItem=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 range_id=0, int AmmoSlot=0, float speed = 4.0f); virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); - virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr, int AmmoSlot=0, float speed= 4.0f); - bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed); + virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const EQEmu::Item_Struct *AmmoItem=nullptr, int AmmoSlot=0, float speed= 4.0f); + bool TryProjectileAttack(Mob* other, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed); void ProjectileAttack(); inline bool HasProjectileAttack() const { return ActiveProjectileATK; } inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } @@ -909,7 +913,7 @@ public: // HP Event inline int GetNextHPEvent() const { return nexthpevent; } void SetNextHPEvent( int hpevent ); - void SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse, float velocity= 4.0); + void SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, float velocity= 4.0); inline int& GetNextIncHPEvent() { return nextinchpevent; } void SetNextIncHPEvent( int inchpevent ); @@ -1147,8 +1151,8 @@ protected: bool PassLimitToSkill(uint16 spell_id, uint16 skill); bool PassLimitClass(uint32 Classes_, uint16 Class_); void TryDefensiveProc(Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TryWeaponProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TrySpellProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); + void TryWeaponProc(const ItemInst* inst, const EQEmu::Item_Struct* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); + void TrySpellProc(const ItemInst* inst, const EQEmu::Item_Struct* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); void ExecWeaponProc(const ItemInst* weapon, uint16 spell_id, Mob *on, int level_override = -1); virtual float GetProcChances(float ProcBonus, uint16 hand = EQEmu::legacy::SlotPrimary); @@ -1157,7 +1161,7 @@ protected: virtual float GetAssassinateProcChances(uint16 ReuseTime); virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm? uint16 GetWeaponSpeedbyHand(uint16 hand); - int GetWeaponDamage(Mob *against, const Item_Struct *weapon_item); + int GetWeaponDamage(Mob *against, const EQEmu::Item_Struct *weapon_item); int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr); int GetKickDamage(); int GetBashDamage(); @@ -1185,7 +1189,7 @@ protected: glm::vec4 m_Delta; - EQEmu::lightsource::LightSourceProfile m_Light; + EQEmu::LightSourceProfile m_Light; float fixedZ; EmuAppearance _appearance; diff --git a/zone/mod_functions.cpp b/zone/mod_functions.cpp index 5c98541c0..e58945732 100644 --- a/zone/mod_functions.cpp +++ b/zone/mod_functions.cpp @@ -9,7 +9,10 @@ class ItemInst; class Spawn2; struct Consider_Struct; struct DBTradeskillRecipe_Struct; -struct Item_Struct; + +namespace { + struct Item_Struct; +} extern EntityList entity_list; extern Zone* zone; @@ -26,7 +29,7 @@ void Zone::mod_repop() { return; } void NPC::mod_prespawn(Spawn2 *sp) { return; } //Base damage from NPC::Attack -int NPC::mod_npc_damage(int damage, SkillUseTypes skillinuse, int hand, const Item_Struct* weapon, Mob* other) { return(damage); } +int NPC::mod_npc_damage(int damage, SkillUseTypes skillinuse, int hand, const EQEmu::Item_Struct* weapon, Mob* other) { return(damage); } //Mob c has been given credit for a kill. This is called after the regular EVENT_KILLED_MERIT event. void NPC::mod_npc_killed_merit(Mob* c) { return; } @@ -104,8 +107,8 @@ int32 Client::mod_client_xp(int32 in_xp, NPC *npc) { return(in_xp); } uint32 Client::mod_client_xp_for_level(uint32 xp, uint16 check_level) { return(xp); } //Food and drink values as computed by consume requests. Return < 0 to abort the request. -int Client::mod_food_value(const Item_Struct *item, int change) { return(change); } -int Client::mod_drink_value(const Item_Struct *item, int change) { return(change); } +int Client::mod_food_value(const EQEmu::Item_Struct *item, int change) { return(change); } +int Client::mod_drink_value(const EQEmu::Item_Struct *item, int change) { return(change); } //effect_vallue - Spell effect value as calculated by default formulas. You will want to ignore effects that don't lend themselves to scaling - pet ID's, gate coords, etc. int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster, uint16 caster_id) { return(effect_value); } diff --git a/zone/npc.cpp b/zone/npc.cpp index dca6c2bcc..8b09f448c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -523,7 +523,7 @@ void NPC::QueryLoot(Client* to) int x = 0; for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { - const Item_Struct* item = database.GetItem((*cur)->item_id); + const EQEmu::Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { Log.Out(Logs::General, Logs::Error, "Database error, invalid item"); continue; @@ -745,8 +745,8 @@ uint32 NPC::CountLoot() { void NPC::UpdateEquipmentLight() { - m_Light.Type.Equipment = 0; - m_Light.Level.Equipment = 0; + m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; + m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; for (int index = SLOT_BEGIN; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { if (index == EQEmu::legacy::SlotAmmo) { continue; } @@ -754,9 +754,9 @@ void NPC::UpdateEquipmentLight() auto item = database.GetItem(equipment[index]); if (item == nullptr) { continue; } - if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type.Equipment)) { - m_Light.Type.Equipment = item->Light; - m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); + if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type[EQEmu::lightsource::LightEquipment])) { + m_Light.Type[EQEmu::lightsource::LightEquipment] = item->Light; + m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } } @@ -765,17 +765,17 @@ void NPC::UpdateEquipmentLight() auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - if (item->ItemClass != ItemClassCommon) { continue; } + if (!item->IsClassCommon()) { continue; } if (item->Light < 9 || item->Light > 13) { continue; } if (EQEmu::lightsource::TypeToLevel(item->Light)) general_light_type = item->Light; } - if (EQEmu::lightsource::IsLevelGreater(general_light_type, m_Light.Type.Equipment)) - m_Light.Type.Equipment = general_light_type; + if (EQEmu::lightsource::IsLevelGreater(general_light_type, m_Light.Type[EQEmu::lightsource::LightEquipment])) + m_Light.Type[EQEmu::lightsource::LightEquipment] = general_light_type; - m_Light.Level.Equipment = EQEmu::lightsource::TypeToLevel(m_Light.Type.Equipment); + m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } void NPC::Depop(bool StartSpawnTimer) { @@ -1456,13 +1456,13 @@ void NPC::PickPocket(Client* thief) // still needs to have FindFreeSlot vs PutItemInInventory issue worked out while (steal_item) { - std::vector> loot_selection; // + std::vector> loot_selection; // for (auto item_iter : itemlist) { if (!item_iter || !item_iter->item_id) continue; auto item_test = database.GetItem(item_iter->item_id); - if (item_test->Magic || !item_test->NoDrop || item_test->ItemType == ItemClassContainer || thief->CheckLoreConflict(item_test)) + if (item_test->Magic || !item_test->NoDrop || item_test->IsClassBag() || thief->CheckLoreConflict(item_test)) continue; loot_selection.push_back(std::make_pair(item_test, ((item_test->Stackable) ? (1) : (item_iter->charges)))); @@ -1473,7 +1473,7 @@ void NPC::PickPocket(Client* thief) } int random = zone->random.Int(0, (loot_selection.size() - 1)); - uint16 slot_id = thief->GetInv().FindFreeSlot(false, true, (loot_selection[random].first->Size), (loot_selection[random].first->ItemType == ItemTypeArrow)); + uint16 slot_id = thief->GetInv().FindFreeSlot(false, true, (loot_selection[random].first->Size), (loot_selection[random].first->ItemType == EQEmu::item::ItemTypeArrow)); if (slot_id == INVALID_INDEX) { steal_item = false; break; diff --git a/zone/npc.h b/zone/npc.h index 834211198..0456ca211 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -90,7 +90,11 @@ class Client; class Group; class Raid; class Spawn2; -struct Item_Struct; + +namespace EQEmu +{ + struct Item_Struct; +} class NPC : public Mob { @@ -174,7 +178,7 @@ public: virtual void SpellProcess(); virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); - void AddItem(const Item_Struct* item, uint16 charges, bool equipitem = true); + void AddItem(const EQEmu::Item_Struct* item, uint16 charges, bool equipitem = true); void AddItem(uint32 itemid, uint16 charges, bool equipitem = true); void AddLootTable(); void AddLootTable(uint32 ldid); @@ -266,7 +270,7 @@ public: bool IsTaunting() const { return taunting; } void PickPocket(Client* thief); void StartSwarmTimer(uint32 duration) { swarm_timer.Start(duration); } - void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); + void AddLootDrop(const EQEmu::Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); virtual void DoClassAttacks(Mob *target); void CheckSignal(); inline bool IsNotTargetableWithHotkey() const { return no_target_hotkey; } @@ -399,7 +403,7 @@ public: void SetMerchantProbability(uint8 amt) { probability = amt; } uint8 GetMerchantProbability() { return probability; } void mod_prespawn(Spawn2 *sp); - int mod_npc_damage(int damage, SkillUseTypes skillinuse, int hand, const Item_Struct* weapon, Mob* other); + int mod_npc_damage(int damage, SkillUseTypes skillinuse, int hand, const EQEmu::Item_Struct* weapon, Mob* other); void mod_npc_killed_merit(Mob* c); void mod_npc_killed(Mob* oos); void AISpellsList(Client *c); diff --git a/zone/object.cpp b/zone/object.cpp index 122db47ed..f6330d872 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -138,7 +138,7 @@ Object::Object(Client* client, const ItemInst* inst) // Set object name if (inst) { - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (item && item->IDFile) { if (strlen(item->IDFile) == 0) { strcpy(m_data.object_name, DEFAULT_OBJECT_NAME); @@ -194,7 +194,7 @@ Object::Object(const ItemInst *inst, float x, float y, float z, float heading, u // Set object name if (inst) { - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if (item && item->IDFile) { if (strlen(item->IDFile) == 0) { strcpy(m_data.object_name, DEFAULT_OBJECT_NAME); @@ -339,7 +339,7 @@ void Object::PutItem(uint8 index, const ItemInst* inst) return; } - if (m_inst && m_inst->IsType(ItemClassContainer)) { + if (m_inst && m_inst->IsType(EQEmu::item::ItemClassBag)) { if (inst) { m_inst->PutItem(index, *inst); } @@ -380,7 +380,7 @@ void Object::Close() { // Remove item from container void Object::DeleteItem(uint8 index) { - if (m_inst && m_inst->IsType(ItemClassContainer)) { + if (m_inst && m_inst->IsType(EQEmu::item::ItemClassBag)) { m_inst->DeleteItem(index); // This is _highly_ inefficient, but for now it will work: Save entire object to database @@ -393,7 +393,7 @@ ItemInst* Object::PopItem(uint8 index) { ItemInst* inst = nullptr; - if (m_inst && m_inst->IsType(ItemClassContainer)) { + if (m_inst && m_inst->IsType(EQEmu::item::ItemClassBag)) { inst = m_inst->PopItem(index); // This is _highly_ inefficient, but for now it will work: Save entire object to database @@ -574,7 +574,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) // Send items inside of container - if (m_inst && m_inst->IsType(ItemClassContainer)) { + if (m_inst && m_inst->IsType(EQEmu::item::ItemClassBag)) { //Clear out no-drop and no-rent items first if different player opens it if(user != last_user) @@ -628,7 +628,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob } // Save container contents, if container - if (inst && inst->IsType(ItemClassContainer)) + if (inst && inst->IsType(EQEmu::item::ItemClassBag)) SaveWorldContainer(object.zone_id, database_id, inst); return database_id; @@ -665,7 +665,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec } // Save container contents, if container - if (inst && inst->IsType(ItemClassContainer)) + if (inst && inst->IsType(EQEmu::item::ItemClassBag)) SaveWorldContainer(object.zone_id, id, inst); } @@ -881,7 +881,7 @@ uint32 Object::GetItemID() return 0; } - const Item_Struct* item = this->m_inst->GetItem(); + const EQEmu::Item_Struct* item = this->m_inst->GetItem(); if (item == 0) { diff --git a/zone/object.h b/zone/object.h index 9e8fae05d..c39ee61c9 100644 --- a/zone/object.h +++ b/zone/object.h @@ -69,7 +69,7 @@ IT10714_ACTORDEF=Augmentation Sealer IT10725_ACTORDEF=Shuriken */ -#define OT_DROPPEDITEM BagTypeLargeBag +#define OT_DROPPEDITEM EQEmu::item::BagTypeLargeBag // Icon values: //0x0453 a pie diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 8c7413a40..c9c24b955 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -8131,7 +8131,7 @@ XS(XS_Mob_DoThrowingAttackDmg) Mob * THIS; Mob* target; ItemInst* RangeWeapon = nullptr; - Item_Struct* item = nullptr; + EQEmu::Item_Struct* item = nullptr; uint16 weapon_damage = (uint16)SvIV(ST(4)); int16 chance_mod = (int16)SvIV(ST(5)); int16 focus = (int16)SvIV(ST(6)); diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index 158ee64a4..fa186a9b5 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -134,7 +134,7 @@ XS(XS_QuestItem_IsType) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->IsType((ItemClassTypes)type); + RETVAL = THIS->IsType((EQEmu::item::ItemClass)type); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); } diff --git a/zone/pets.cpp b/zone/pets.cpp index 00ffebc58..96c053e73 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -420,7 +420,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, // like the special back items some focused pets may receive. uint32 petinv[EQEmu::legacy::EQUIPMENT_SIZE]; memset(petinv, 0, sizeof(petinv)); - const Item_Struct *item = 0; + const EQEmu::Item_Struct *item = 0; if (database.GetBasePetItems(record.equipmentset, petinv)) { for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++) @@ -665,7 +665,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) { if(items[i] == 0) continue; - const Item_Struct* item2 = database.GetItem(items[i]); + const EQEmu::Item_Struct* item2 = database.GetItem(items[i]); if (item2 && item2->NoDrop != 0) { //dont bother saving item charges for now, NPCs never use them //and nobody should be able to get them off the corpse..? diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 806f995e7..4a1980489 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -812,12 +812,12 @@ void QuestManager::traindisc(int discipline_tome_item_id) { } bool QuestManager::isdisctome(int item_id) { - const Item_Struct *item = database.GetItem(item_id); + const EQEmu::Item_Struct *item = database.GetItem(item_id); if(item == nullptr) { return(false); } - if(item->ItemClass != ItemClassCommon || item->ItemType != ItemTypeSpell) { + if (!item->IsClassCommon() || item->ItemType != EQEmu::item::ItemTypeSpell) { return(false); } @@ -1303,7 +1303,7 @@ void QuestManager::settime(uint8 new_hour, uint8 new_min, bool update_world /*= void QuestManager::itemlink(int item_id) { QuestManagerCurrentQuestVars(); if (initiator) { - const Item_Struct* item = database.GetItem(item_id); + const EQEmu::Item_Struct* item = database.GetItem(item_id); if (item == nullptr) return; @@ -2495,7 +2495,7 @@ void QuestManager::MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity) if (merchant == 0 || !merchant->IsNPC() || (merchant->GetClass() != MERCHANT)) return; // don't do anything if NPCid isn't a merchant - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; item = database.GetItem(itemid); if (!item) return; // if the item id doesn't correspond to a real item, do nothing @@ -2508,7 +2508,7 @@ uint32 QuestManager::MerchantCountItem(uint32 NPCid, uint32 itemid) { if (merchant == 0 || !merchant->IsNPC() || (merchant->GetClass() != MERCHANT)) return 0; // if it isn't a merchant, it doesn't have any items - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; item = database.GetItem(itemid); if (!item) return 0; // if it isn't a valid item, the merchant doesn't have any @@ -2531,7 +2531,7 @@ uint32 QuestManager::MerchantCountItem(uint32 NPCid, uint32 itemid) { // Item Link for use in Variables - "my $example_link = quest::varlink(item_id);" const char* QuestManager::varlink(char* perltext, int item_id) { QuestManagerCurrentQuestVars(); - const Item_Struct* item = database.GetItem(item_id); + const EQEmu::Item_Struct* item = database.GetItem(item_id); if (!item) return "INVALID ITEM ID IN VARLINK"; diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 7d9bbc0d3..c54737475 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -118,11 +118,11 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, ItemInst *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); if(item) { - if(item->GetItem()->ItemType == ItemTypeShield) + if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; } - const Item_Struct *itm = item->GetItem(); + const EQEmu::Item_Struct *itm = item->GetItem(); auto fbash = GetFuriousBash(itm->Focus.Effect); hate = hate * (100 + fbash) / 100; if (fbash) @@ -477,7 +477,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) } } else{ - if(GetWeaponDamage(other, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(other, (const EQEmu::Item_Struct*)nullptr) <= 0){ ndamage = -5; } } @@ -513,7 +513,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { //make sure we have a proper weapon if we are a client. if(IsClient()) { const ItemInst *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); - if(!wpn || (wpn->GetItem()->ItemType != ItemType1HPiercing)){ + if (!wpn || (wpn->GetItem()->ItemType != EQEmu::item::ItemType1HPiercing)){ Message_StringID(13, BACKSTAB_WEAPON); return; } @@ -697,28 +697,28 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { int ammo_slot = EQEmu::legacy::SlotAmmo; const ItemInst* Ammo = m_inv[EQEmu::legacy::SlotAmmo]; - if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { + if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotRange), EQEmu::legacy::SlotRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::legacy::SlotRange)); return; } - if (!Ammo || !Ammo->IsType(ItemClassCommon)) { + if (!Ammo || !Ammo->IsClassCommon()) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotAmmo), EQEmu::legacy::SlotAmmo); Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::legacy::SlotAmmo)); return; } - const Item_Struct* RangeItem = RangeWeapon->GetItem(); - const Item_Struct* AmmoItem = Ammo->GetItem(); + const EQEmu::Item_Struct* RangeItem = RangeWeapon->GetItem(); + const EQEmu::Item_Struct* AmmoItem = Ammo->GetItem(); - if(RangeItem->ItemType != ItemTypeBow) { + if (RangeItem->ItemType != EQEmu::item::ItemTypeBow) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID()); return; } - if(AmmoItem->ItemType != ItemTypeArrow) { + if (AmmoItem->ItemType != EQEmu::item::ItemTypeArrow) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); - Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, ItemTypeArrow); + Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, EQEmu::item::ItemTypeArrow); return; } @@ -731,10 +731,10 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { bool found = false; for (r = EQEmu::legacy::GENERAL_BEGIN; r <= EQEmu::legacy::GENERAL_END; r++) { const ItemInst *pi = m_inv[r]; - if(pi == nullptr || !pi->IsType(ItemClassContainer)) + if (pi == nullptr || !pi->IsClassBag()) continue; - const Item_Struct* bagitem = pi->GetItem(); - if(!bagitem || bagitem->BagType != BagTypeQuiver) + const EQEmu::Item_Struct* bagitem = pi->GetItem(); + if (!bagitem || bagitem->BagType != EQEmu::item::BagTypeQuiver) continue; //we found a quiver, look for the ammo in it @@ -812,7 +812,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const ItemInst* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, - uint32 range_id, uint32 ammo_id, const Item_Struct *AmmoItem, int AmmoSlot, float speed) { + uint32 range_id, uint32 ammo_id, const EQEmu::Item_Struct *AmmoItem, int AmmoSlot, float speed) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -827,7 +827,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite const ItemInst* _RangeWeapon = nullptr; const ItemInst* _Ammo = nullptr; - const Item_Struct* ammo_lost = nullptr; + const EQEmu::Item_Struct* ammo_lost = nullptr; /* If LaunchProjectile is false this function will do archery damage on target, @@ -1023,7 +1023,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } -bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed){ +bool Mob::TryProjectileAttack(Mob* other, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed){ if (!other) return false; @@ -1327,7 +1327,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha //try proc on hits and misses if(other && !other->HasDied()) - TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, EQEmu::legacy::SlotRange); + TrySpellProc(nullptr, (const EQEmu::Item_Struct*)nullptr, other, EQEmu::legacy::SlotRange); if (HasSkillProcs() && other && !other->HasDied()) TrySkillProc(other, skillInUse, 0, false, EQEmu::legacy::SlotRange); @@ -1375,14 +1375,14 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 int ammo_slot = EQEmu::legacy::SlotRange; const ItemInst* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; - if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { + if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotRange), EQEmu::legacy::SlotRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::legacy::SlotRange)); return; } - const Item_Struct* item = RangeWeapon->GetItem(); - if(item->ItemType != ItemTypeLargeThrowing && item->ItemType != ItemTypeSmallThrowing) { + const EQEmu::Item_Struct* item = RangeWeapon->GetItem(); + if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::legacy::SlotRange)); return; @@ -1442,7 +1442,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 CommonBreakInvisibleFromCombat(); } -void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* AmmoItem, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot, float speed) +void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQEmu::Item_Struct* AmmoItem, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot, float speed) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -1456,7 +1456,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } const ItemInst* _RangeWeapon = nullptr; - const Item_Struct* ammo_lost = nullptr; + const EQEmu::Item_Struct* ammo_lost = nullptr; /* If LaunchProjectile is false this function will do archery damage on target, @@ -1580,7 +1580,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } -void Mob::SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse, float velocity) { +void Mob::SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, float velocity) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); Arrow_Struct *as = (Arrow_Struct *) outapp->pBuffer; as->type = 1; @@ -1630,7 +1630,7 @@ void Mob::ProjectileAnimation(Mob* to, int item_id, bool IsArrow, float speed, f if (!to) return; - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; uint8 item_type = 0; if(!item_id) { @@ -1771,7 +1771,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animKick); int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(target, (const EQEmu::Item_Struct*)nullptr) <= 0){ dmg = -5; } else{ @@ -1792,7 +1792,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animTailRake); int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(target, (const EQEmu::Item_Struct*)nullptr) <= 0){ dmg = -5; } else{ @@ -1845,7 +1845,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animKick); int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(target, (const EQEmu::Item_Struct*)nullptr) <= 0){ dmg = -5; } else{ @@ -1870,7 +1870,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animTailRake); int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + if(GetWeaponDamage(target, (const EQEmu::Item_Struct*)nullptr) <= 0){ dmg = -5; } else{ @@ -2382,7 +2382,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes int32 max_hit = (2 * weapon_damage*GetDamageTable(skillinuse)) / 100; if(GetLevel() >= 28 && IsWarriorClass() ) { - int ucDamageBonus = GetWeaponDamageBonus((const Item_Struct*) nullptr ); + int ucDamageBonus = GetWeaponDamageBonus((const EQEmu::Item_Struct*) nullptr ); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -2392,10 +2392,10 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if(IsClient()){ ItemInst *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); if(item){ - if(item->GetItem()->ItemType == ItemTypeShield) { + if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; } - const Item_Struct *itm = item->GetItem(); + const EQEmu::Item_Struct *itm = item->GetItem(); hate = hate * (100 + GetFuriousBash(itm->Focus.Effect)) / 100; } } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index ab20371fa..79dda2125 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -617,7 +617,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove #endif if(IsClient()){ ItemInst* transI = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotCursor); - if(transI && transI->IsType(ItemClassCommon) && transI->IsStackable()){ + if (transI && transI->IsClassCommon() && transI->IsStackable()){ uint32 fcharges = transI->GetCharges(); //Does it sound like meat... maybe should check if it looks like meat too... if(strstr(transI->GetItem()->Name, "meat") || @@ -1132,7 +1132,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove case SE_SummonItem: { - const Item_Struct *item = database.GetItem(spell.base[i]); + const EQEmu::Item_Struct *item = database.GetItem(spell.base[i]); #ifdef SPELL_EFFECT_SPAM const char *itemname = item ? item->Name : "*Unknown Item*"; snprintf(effect_desc, _EDLEN, "Summon Item: %s (id %d)", itemname, spell.base[i]); @@ -1168,14 +1168,14 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove } case SE_SummonItemIntoBag: { - const Item_Struct *item = database.GetItem(spell.base[i]); + const EQEmu::Item_Struct *item = database.GetItem(spell.base[i]); #ifdef SPELL_EFFECT_SPAM const char *itemname = item ? item->Name : "*Unknown Item*"; snprintf(effect_desc, _EDLEN, "Summon Item In Bag: %s (id %d)", itemname, spell.base[i]); #endif uint8 slot; - if (!SummonedItem || !SummonedItem->IsType(ItemClassContainer)) { + if (!SummonedItem || !SummonedItem->IsClassBag()) { if (caster) caster->Message(13, "SE_SummonItemIntoBag but no bag has been summoned!"); } else if ((slot = SummonedItem->FirstOpenSlot()) == 0xff) { @@ -5124,7 +5124,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { //item focus if (itembonuses.FocusEffects[type]){ - const Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* TempItem = 0; for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) { @@ -5155,7 +5155,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { aug = ins->GetAugment(y); if(aug) { - const Item_Struct* TempItemAug = aug->GetItem(); + const EQEmu::Item_Struct* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && IsValidSpell(TempItemAug->Focus.Effect)) { proc_spellid = CalcFocusEffect(type, TempItemAug->Focus.Effect, spell_id); if (IsValidSpell(proc_spellid)){ @@ -5253,8 +5253,8 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[type]){ - const Item_Struct* TempItem = 0; - const Item_Struct* UsedItem = 0; + const EQEmu::Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* UsedItem = 0; uint16 UsedFocusID = 0; int16 Total = 0; int16 focus_max = 0; @@ -5301,7 +5301,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) aug = ins->GetAugment(y); if(aug) { - const Item_Struct* TempItemAug = aug->GetItem(); + const EQEmu::Item_Struct* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && TempItemAug->Focus.Effect != SPELL_UNKNOWN) { if(rand_effectiveness) { focus_max = CalcFocusEffect(type, TempItemAug->Focus.Effect, spell_id, true); @@ -5525,8 +5525,8 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { if (RuleB(Spells, NPC_UseFocusFromItems) && itembonuses.FocusEffects[type]){ - const Item_Struct* TempItem = 0; - const Item_Struct* UsedItem = 0; + const EQEmu::Item_Struct* TempItem = 0; + const EQEmu::Item_Struct* UsedItem = 0; uint16 UsedFocusID = 0; int16 Total = 0; int16 focus_max = 0; @@ -5534,7 +5534,7 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { //item focus for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++){ - const Item_Struct *cur = database.GetItem(equipment[i]); + const EQEmu::Item_Struct *cur = database.GetItem(equipment[i]); if(!cur) continue; diff --git a/zone/spells.cpp b/zone/spells.cpp index f0bc6e85a..dbf89a5cc 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int bitmask = 1; bitmask = bitmask << (CastToClient()->GetClass() - 1); if( itm && itm->GetItem()->Classes != 65535 ) { - if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { + if ((itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } return(false); } - if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { + if ((itm->GetItem()->Click.Type == EQEmu::item::ItemEffectClick2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, return(false); } } - if (itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= EQEmu::legacy::SlotAmmo || item_slot == EQEmu::legacy::SlotPowerSource)){ + if (itm && (itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(item_slot <= EQEmu::legacy::SlotAmmo || item_slot == EQEmu::legacy::SlotPowerSource)){ if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are attempting to cast a must equip clicky without having it equipped Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); @@ -1136,7 +1136,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, missingreags=true; } - const Item_Struct *item = database.GetItem(component); + const EQEmu::Item_Struct *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); @@ -1198,7 +1198,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { bool fromaug = false; const ItemInst* inst = CastToClient()->GetInv()[inventory_slot]; - Item_Struct* augitem = 0; + EQEmu::Item_Struct* augitem = 0; uint32 recastdelay = 0; uint32 recasttype = 0; @@ -1211,7 +1211,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if (!aug_i) continue; - const Item_Struct* aug = aug_i->GetItem(); + const EQEmu::Item_Struct* aug = aug_i->GetItem(); if (!aug) continue; @@ -1245,7 +1245,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - if (inst && inst->IsType(ItemClassCommon) && (inst->GetItem()->Click.Effect == spell_id) && inst->GetCharges() || fromaug) + if (inst && inst->IsClassCommon() && (inst->GetItem()->Click.Effect == spell_id) && inst->GetCharges() || fromaug) { //const Item_Struct* item = inst->GetItem(); int16 charges = inst->GetItem()->MaxCharges; diff --git a/zone/tasks.cpp b/zone/tasks.cpp index fc51c5810..2c2a1c1b0 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1884,7 +1884,7 @@ void ClientTaskState::RewardTask(Client *c, TaskInformation *Task) { if(!Task || !c) return; - const Item_Struct* Item; + const EQEmu::Item_Struct* Item; std::vector RewardList; switch(Task->RewardMethod) { @@ -2777,7 +2777,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN } if(ItemID) { - const Item_Struct* reward_item = database.GetItem(ItemID); + const EQEmu::Item_Struct* reward_item = database.GetItem(ItemID); EQEmu::saylink::SayLinkEngine linker; linker.SetLinkType(linker.SayLinkItemData); diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 863a0603c..a5e931e62 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -61,8 +61,8 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme inst = user_inv.GetItem(in_augment->container_slot); if (inst) { - const Item_Struct* item = inst->GetItem(); - if (item && inst->IsType(ItemClassContainer) && item->BagType == 53) + const EQEmu::Item_Struct* item = inst->GetItem(); + if (item && inst->IsType(EQEmu::item::ItemClassBag) && item->BagType == 53) { // We have found an appropriate inventory augmentation sealer container = inst; @@ -166,8 +166,8 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme else { ItemInst *old_aug = nullptr; - bool isSolvent = auged_with->GetItem()->ItemType == ItemUseTypes::ItemTypeAugmentationSolvent; - if (!isSolvent && auged_with->GetItem()->ItemType != ItemUseTypes::ItemTypeAugmentationDistiller) + bool isSolvent = auged_with->GetItem()->ItemType == EQEmu::item::ItemTypeAugmentationSolvent; + if (!isSolvent && auged_with->GetItem()->ItemType != EQEmu::item::ItemTypeAugmentationDistiller) { Log.Out(Logs::General, Logs::Error, "Player tried to remove an augment without a solvent or distiller."); user->Message(13, "Error: Missing an augmentation solvent or distiller for removing this augment."); @@ -276,25 +276,25 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob else { inst = user_inv.GetItem(in_combine->container_slot); if (inst) { - const Item_Struct* item = inst->GetItem(); - if (item && inst->IsType(ItemClassContainer)) { + const EQEmu::Item_Struct* item = inst->GetItem(); + if (item && inst->IsType(EQEmu::item::ItemClassBag)) { c_type = item->BagType; some_id = item->ID; } } } - if (!inst || !inst->IsType(ItemClassContainer)) { + if (!inst || !inst->IsType(EQEmu::item::ItemClassBag)) { user->Message(13, "Error: Server does not recognize specified tradeskill container"); return; } container = inst; - if (container->GetItem() && container->GetItem()->BagType == BagTypeTransformationmold) { + if (container->GetItem() && container->GetItem()->BagType == EQEmu::item::BagTypeTransformationmold) { const ItemInst* inst = container->GetItem(0); bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { - const Item_Struct* new_weapon = inst->GetItem(); + const EQEmu::Item_Struct* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::legacy::SlotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); @@ -311,10 +311,10 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob return; } - if (container->GetItem() && container->GetItem()->BagType == BagTypeDetransformationmold) { + if (container->GetItem() && container->GetItem()->BagType == EQEmu::item::BagTypeDetransformationmold) { const ItemInst* inst = container->GetItem(0); if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) { - const Item_Struct* new_weapon = inst->GetItem(); + const EQEmu::Item_Struct* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::legacy::SlotCursor, 0, 0); @@ -538,7 +538,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac for(std::list::iterator it = MissingItems.begin(); it != MissingItems.end(); ++it) { - const Item_Struct* item = database.GetItem(*it); + const EQEmu::Item_Struct* item = database.GetItem(*it); if(item) user->Message_StringID(MT_Skills, TRADESKILL_MISSING_ITEM, item->Name); @@ -607,77 +607,87 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac SkillUseTypes Object::TypeToSkill(uint32 type) { - switch(type) // grouped and ordered by SkillUseTypes name - new types need to be verified for proper SkillUseTypes and use - { + switch(type) { // grouped and ordered by SkillUseTypes name - new types need to be verified for proper SkillUseTypes and use /*SkillAlchemy*/ - case BagTypeMedicineBag: { return SkillAlchemy; } + case EQEmu::item::BagTypeMedicineBag: + return SkillAlchemy; /*SkillBaking*/ - // case BagTypeMixingBowl: // No idea... - case BagTypeOven: { return SkillBaking; } + //case EQEmu::item::BagTypeMixingBowl: // No idea... + case EQEmu::item::BagTypeOven: + return SkillBaking; /*SkillBlacksmithing*/ - case BagTypeForge: - // case BagTypeKoadaDalForge: - case BagTypeTeirDalForge: - case BagTypeOggokForge: - case BagTypeStormguardForge: - // case BagTypeAkanonForge: - // case BagTypeNorthmanForge: - // case BagTypeCabilisForge: - // case BagTypeFreeportForge: - // case BagTypeRoyalQeynosForge: - // case BagTypeTrollForge: - case BagTypeFierDalForge: - case BagTypeValeForge: { return SkillBlacksmithing; } // Delete return if BagTypeGuktaForge enabled - // case BagTypeErudForge: - // case BagTypeGuktaForge: { return SkillBlacksmithing; } + case EQEmu::item::BagTypeForge: + //case EQEmu::item::BagTypeKoadaDalForge: + case EQEmu::item::BagTypeTeirDalForge: + case EQEmu::item::BagTypeOggokForge: + case EQEmu::item::BagTypeStormguardForge: + //case EQEmu::item::BagTypeAkanonForge: + //case EQEmu::item::BagTypeNorthmanForge: + //case EQEmu::item::BagTypeCabilisForge: + //case EQEmu::item::BagTypeFreeportForge: + //case EQEmu::item::BagTypeRoyalQeynosForge: + //case EQEmu::item::BagTypeTrollForge: + case EQEmu::item::BagTypeFierDalForge: + case EQEmu::item::BagTypeValeForge: + //case EQEmu::item::BagTypeErudForge: + //case EQEmu::item::BagTypeGuktaForge: + return SkillBlacksmithing; /*SkillBrewing*/ - // case BagTypeIceCreamChurn: // No idea... - case BagTypeBrewBarrel: { return SkillBrewing; } + //case EQEmu::item::BagTypeIceCreamChurn: // No idea... + case EQEmu::item::BagTypeBrewBarrel: + return SkillBrewing; /*SkillFishing*/ - case BagTypeTackleBox: { return SkillFishing; } + case EQEmu::item::BagTypeTackleBox: + return SkillFishing; /*SkillFletching*/ - case BagTypeFletchingKit: { return SkillFletching; } // Delete return if BagTypeFierDalFletchingKit enabled - // case BagTypeFierDalFletchingKit: { return SkillFletching; } + case EQEmu::item::BagTypeFletchingKit: + //case EQEmu::item::BagTypeFierDalFletchingKit: + return SkillFletching; /*SkillJewelryMaking*/ - case BagTypeJewelersKit: { return SkillJewelryMaking; } + case EQEmu::item::BagTypeJewelersKit: + return SkillJewelryMaking; /*SkillMakePoison*/ - // This is a guess and needs to be verified... (Could be SkillAlchemy) - // case BagTypeMortar: { return SkillMakePoison; } + // This is a guess and needs to be verified... (Could be SkillAlchemy) + //case EQEmu::item::BagTypeMortar: + // return SkillMakePoison; /*SkillPottery*/ - case BagTypePotteryWheel: - case BagTypeKiln: { return SkillPottery; } // Delete return if BagTypeIksarPotteryWheel enabled - // case BagTypeIksarPotteryWheel: { return SkillPottery; } + case EQEmu::item::BagTypePotteryWheel: + case EQEmu::item::BagTypeKiln: + //case EQEmu::item::BagTypeIksarPotteryWheel: + return SkillPottery; /*SkillResearch*/ - // case BagTypeLexicon: - case BagTypeWizardsLexicon: - case BagTypeMagesLexicon: - case BagTypeNecromancersLexicon: - case BagTypeEnchantersLexicon: { return SkillResearch; } // Delete return if BagTypeConcordanceofResearch enabled - // case BagTypeConcordanceofResearch: { return SkillResearch; } + //case EQEmu::item::BagTypeLexicon: + case EQEmu::item::BagTypeWizardsLexicon: + case EQEmu::item::BagTypeMagesLexicon: + case EQEmu::item::BagTypeNecromancersLexicon: + case EQEmu::item::BagTypeEnchantersLexicon: + //case EQEmu::item::BagTypeConcordanceofResearch: + return SkillResearch; /*SkillTailoring*/ - case BagTypeSewingKit: { return SkillTailoring; } // Delete return if BagTypeFierDalTailoringKit enabled - // case BagTypeHalflingTailoringKit: - // case BagTypeErudTailoringKit: - // case BagTypeFierDalTailoringKit: { return SkillTailoring; } + case EQEmu::item::BagTypeSewingKit: + //case EQEmu::item::BagTypeHalflingTailoringKit: + //case EQEmu::item::BagTypeErudTailoringKit: + //case EQEmu::item::BagTypeFierDalTailoringKit: + return SkillTailoring; /*SkillTinkering*/ - case BagTypeToolBox: { return SkillTinkering; } + case EQEmu::item::BagTypeToolBox: + return SkillTinkering; /*Undefined*/ - default: { break; } + default: + return TradeskillUnknown; } - - return TradeskillUnknown; } void Client::TradeskillSearchResults(const std::string &query, unsigned long objtype, unsigned long someid) { @@ -952,7 +962,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { aa_chance = spellbonuses.ReduceTradeskillFail[spec->tradeskill] + itembonuses.ReduceTradeskillFail[spec->tradeskill] + aabonuses.ReduceTradeskillFail[spec->tradeskill]; - const Item_Struct* item = nullptr; + const EQEmu::Item_Struct* item = nullptr; chance = mod_tradeskill_chance(chance, spec); @@ -1103,7 +1113,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 if (!inst) continue; - const Item_Struct* item = GetItem(inst->GetItem()->ID); + const EQEmu::Item_Struct* item = GetItem(inst->GetItem()->ID); if (!item) continue; @@ -1232,7 +1242,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 if(!inst) continue; - const Item_Struct* item = GetItem(inst->GetItem()->ID); + const EQEmu::Item_Struct* item = GetItem(inst->GetItem()->ID); if (!item) continue; diff --git a/zone/trading.cpp b/zone/trading.cpp index fe83e4e67..e746e2122 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -266,7 +266,7 @@ void Trade::LogTrade() sprintf(item_num, "%i", inst->GetItem()->ID); strcat(logtext, item_num); - if (inst->IsType(ItemClassContainer)) { + if (inst->IsClassBag()) { for (uint8 j = SUB_INDEX_BEGIN; j < EQEmu::legacy::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { @@ -309,9 +309,9 @@ void Trade::DumpTrade() if (inst) { Log.Out(Logs::Detail, Logs::Trading, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), - i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); + i, ((inst->IsClassBag()) ? "True" : "False")); - if (inst->IsType(ItemClassContainer)) { + if (inst->IsClassBag()) { for (uint8 j = SUB_INDEX_BEGIN; j < EQEmu::legacy::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { @@ -335,7 +335,7 @@ void Client::ResetTrade() { for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { const ItemInst* inst = m_inv[trade_slot]; - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { int16 free_slot = m_inv.FindFreeSlotForTradeItem(inst); if (free_slot != INVALID_INDEX) { @@ -490,7 +490,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { const ItemInst* inst = m_inv[trade_slot]; - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsClassBag()) { Log.Out(Logs::Detail, Logs::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... @@ -840,7 +840,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st event_details->push_back(detail); qs_audit->char_count += detail->charges; - if(trade_inst->IsType(ItemClassContainer)) { + if (trade_inst->IsClassBag()) { for (uint8 sub_slot = SUB_INDEX_BEGIN; sub_slot < trade_inst->GetItem()->BagSlots; ++sub_slot) { const ItemInst* trade_baginst = trade_inst->GetItem(sub_slot); @@ -885,16 +885,16 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st continue; } - const Item_Struct* item = inst->GetItem(); + const EQEmu::Item_Struct* item = inst->GetItem(); if(item && quest_npc == false) { // if it was not a NO DROP or Attuned item (or if a GM is trading), let the NPC have it if(GetGM() || (item->NoDrop != 0 && inst->IsAttuned() == false)) { // pets need to look inside bags and try to equip items found there - if(item->ItemClass == ItemClassContainer && item->BagSlots > 0) { + if (item->IsClassBag() && item->BagSlots > 0) { for (int16 bslot = SUB_INDEX_BEGIN; bslot < item->BagSlots; bslot++) { const ItemInst* baginst = inst->GetItem(bslot); if (baginst) { - const Item_Struct* bagitem = baginst->GetItem(); + const EQEmu::Item_Struct* bagitem = baginst->GetItem(); if (bagitem && (GetGM() || (bagitem->NoDrop != 0 && baginst->IsAttuned() == false))) { tradingWith->CastToNPC()->AddLootDrop(bagitem, &tradingWith->CastToNPC()->itemlist, baginst->GetCharges(), 1, 127, true, true); @@ -1158,7 +1158,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { std::string Packet; int16 FreeSlotID=0; - const Item_Struct* item = database.GetItem(ItemID); + const EQEmu::Item_Struct* item = database.GetItem(ItemID); if(!item){ Log.Out(Logs::Detail, Logs::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); @@ -1169,7 +1169,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { if (inst) { - bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; + bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; FreeSlotID = m_inv.FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow); PutItemInInventory(FreeSlotID, *inst); @@ -1192,7 +1192,7 @@ void Client::SendSingleTraderItem(uint32 CharID, int SerialNumber) { } void Client::BulkSendTraderInventory(uint32 char_id) { - const Item_Struct *item; + const EQEmu::Item_Struct *item; TraderCharges_Struct* TraderItems = database.LoadTraderItemWithCharges(char_id); @@ -2030,7 +2030,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(!Customer) return; - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item) return; @@ -2074,7 +2074,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(!Customer) return; - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item) return; @@ -2233,7 +2233,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { } - const Item_Struct *item = 0; + const EQEmu::Item_Struct *item = 0; if(IDOfItemToAdd) item = database.GetItem(IDOfItemToAdd); @@ -2399,7 +2399,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { char *buf = (char *)outapp->pBuffer; - const Item_Struct* item = database.GetItem(itemID); + const EQEmu::Item_Struct* item = database.GetItem(itemID); if(!item) { safe_delete(outapp); @@ -2495,7 +2495,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { char *Buf = (char *)outapp->pBuffer; - const Item_Struct* item = database.GetItem(ItemID); + const EQEmu::Item_Struct* item = database.GetItem(ItemID); if(!item) { safe_delete(outapp); @@ -2539,7 +2539,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { /*uint32 BuyerID2 =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused /*uint32 Unknown3 =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item || !Quantity || !Price || !QtyBuyerWants) return; @@ -2930,7 +2930,7 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { /*uint32 UnknownZ =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused uint32 ItemCount = VARSTRUCT_DECODE_TYPE(uint32, Buf); - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item) return; @@ -2994,7 +2994,7 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) { BuyerItemSearchResults_Struct* bisr = (BuyerItemSearchResults_Struct*)outapp->pBuffer; - const Item_Struct* item = 0; + const EQEmu::Item_Struct* item = 0; int Count=0; diff --git a/zone/tune.cpp b/zone/tune.cpp index bcaa69d4a..a6b55f02e 100644 --- a/zone/tune.cpp +++ b/zone/tune.cpp @@ -630,7 +630,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) { - ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const Item_Struct*) nullptr ); + ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const EQEmu::Item_Struct*) nullptr ); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; diff --git a/zone/zone.cpp b/zone/zone.cpp index 55ec64110..5523f1e85 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -266,7 +266,7 @@ bool Zone::LoadZoneObjects() { } // Load child objects if container - if (inst && inst->IsType(ItemClassContainer)) { + if (inst && inst->IsType(EQEmu::item::ItemClassBag)) { database.LoadWorldContainer(id, inst); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 5b66b691d..e2ea36fca 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -496,7 +496,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) aug[5] = (uint32)atoi(row[8]); ItemInst* inst = database.CreateItem(item_id, charges); - if (inst && inst->GetItem()->ItemClass == ItemClassCommon) { + if (inst && inst->GetItem()->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) if (aug[i]) inst->PutAugment(&database, i, aug[i]); @@ -529,7 +529,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It uint32 item_id = inst->GetItem()->ID; uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; - if (inst->IsType(ItemClassCommon)) { + if (inst->IsType(EQEmu::item::ItemClassCommon)) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { ItemInst *auginst=inst->GetAugment(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; @@ -629,7 +629,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { int Charges = atoi(row[3]); int Cost = atoi(row[4]); - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item) { Log.Out(Logs::Detail, Logs::Trading, "Unable to create item\n"); @@ -684,7 +684,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg Log.Out(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); - const Item_Struct *item = database.GetItem(ItemID); + const EQEmu::Item_Struct *item = database.GetItem(ItemID); if(!item) return; @@ -1197,7 +1197,7 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str i = atoi(row[r]); /* Bandolier ID */ r++; si = atoi(row[r]); /* Bandolier Slot */ r++; - const Item_Struct* item_data = database.GetItem(atoi(row[r])); + const EQEmu::Item_Struct* item_data = database.GetItem(atoi(row[r])); if (item_data) { pp->bandoliers[i].Items[si].ID = item_data->ID; r++; pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; // Must use db value in case an Ornamentation is assigned @@ -1249,7 +1249,7 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); - const Item_Struct *item_data = database.GetItem(atoi(row[1])); + const EQEmu::Item_Struct *item_data = database.GetItem(atoi(row[1])); if (!item_data) continue; pp->potionbelt.Items[i].ID = item_data->ID;