diff --git a/changelog.txt b/changelog.txt index 2af05c184..ec97647c4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 07/05/2018 == +Uleat: Reintegration of inventory-based EQDictionary references + - Standardized 'CONSTANT_DECLARATION' and 'enumerationValue' tokens for most of the affected references + - Added 'BEGIN' and 'END' constants to many inventory-based ranges to help eliminate '< SIZE'-type comparisons + - Eliminated multiple, duplicated reference points of the same value context (bye, bye namespace legacy!) + - Most server values are now linked to the implementation client directly through a 'using ##' directive + == 05/28/2018 == Akkadius: Fixed an issue where size 0 NPC's hop in and out of the ground at idle Akkadius: NPC's now open doors within proximity given the door doesn't have locked requirements diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 8a9d2c673..a00d775ff 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -14,7 +14,6 @@ SET(common_sources dbcore.cpp deity.cpp emu_constants.cpp - emu_legacy.cpp emu_limits.cpp emu_opcodes.cpp emu_versions.cpp @@ -124,7 +123,6 @@ SET(common_headers dbcore.h deity.h emu_constants.h - emu_legacy.h emu_limits.h emu_opcodes.h emu_oplist.h diff --git a/common/database.cpp b/common/database.cpp index 62a8453d1..94a6a2a32 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -708,7 +708,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu /* Insert starting inventory... */ std::string invquery; - for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) { + for (int16 i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invbag::BANK_BAGS_END;) { const EQEmu::ItemInstance* newinv = inv->GetItem(i); if (newinv) { invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)", @@ -717,16 +717,16 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu auto results = QueryDatabase(invquery); } - if (i == EQEmu::inventory::slotCursor) { - i = EQEmu::legacy::GENERAL_BAGS_BEGIN; + if (i == EQEmu::invslot::slotCursor) { + i = EQEmu::invbag::GENERAL_BAGS_BEGIN; continue; } - else if (i == EQEmu::legacy::CURSOR_BAG_END) { - i = EQEmu::legacy::BANK_BEGIN; + else if (i == EQEmu::invbag::CURSOR_BAG_END) { + i = EQEmu::invslot::BANK_BEGIN; continue; } - else if (i == EQEmu::legacy::BANK_END) { - i = EQEmu::legacy::BANK_BAGS_BEGIN; + else if (i == EQEmu::invslot::BANK_END) { + i = EQEmu::invbag::BANK_BAGS_BEGIN; continue; } i++; diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index f04e9a93b..0e6c40a6f 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -41,6 +41,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #pragma pack(1) +// all const/macro reference values should really be converted to a magic number for this +// process to ensure that the struct sizes and offsets match up to the corresponding blob + /* Conversion Structs */ namespace Convert { @@ -330,7 +333,7 @@ namespace Convert { /*7212*/ uint32 tribute_points; /*7216*/ uint32 unknown7252; /*7220*/ uint32 tribute_active; //1=active - /*7224*/ Convert::Tribute_Struct tributes[EQEmu::legacy::TRIBUTE_SIZE]; + /*7224*/ Convert::Tribute_Struct tributes[5]; /*7264*/ Convert::Disciplines_Struct disciplines; /*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use) /*7744*/ char unknown7780[160]; @@ -1405,7 +1408,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Tribute Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < EQEmu::legacy::TRIBUTE_SIZE; i++){ + for (i = 0; i < 5; i++){ if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != 4294967295){ if (first_entry != 1){ rquery = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); diff --git a/common/emu_constants.cpp b/common/emu_constants.cpp index e5e9ae841..e229b7d6d 100644 --- a/common/emu_constants.cpp +++ b/common/emu_constants.cpp @@ -20,6 +20,41 @@ #include "emu_constants.h" +int16 EQEmu::invtype::GetInvTypeSize(int16 inv_type) { + static const int16 local_array[] = { + POSSESSIONS_SIZE, + BANK_SIZE, + SHARED_BANK_SIZE, + TRADE_SIZE, + WORLD_SIZE, + LIMBO_SIZE, + TRIBUTE_SIZE, + TROPHY_TRIBUTE_SIZE, + GUILD_TRIBUTE_SIZE, + MERCHANT_SIZE, + DELETED_SIZE, + CORPSE_SIZE, + BAZAAR_SIZE, + INSPECT_SIZE, + REAL_ESTATE_SIZE, + VIEW_MOD_PC_SIZE, + VIEW_MOD_BANK_SIZE, + VIEW_MOD_SHARED_BANK_SIZE, + VIEW_MOD_LIMBO_SIZE, + ALT_STORAGE_SIZE, + ARCHIVED_SIZE, + MAIL_SIZE, + GUILD_TROPHY_TRIBUTE_SIZE, + KRONO_SIZE, + OTHER_SIZE, + }; + + if (inv_type < TYPE_BEGIN || inv_type > TYPE_END) + return INULL; + + return local_array[inv_type]; +} + const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) { switch (category_id) { case catVideo: diff --git a/common/emu_constants.h b/common/emu_constants.h index 32968458c..fcddeac09 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -21,104 +21,173 @@ #define COMMON_EMU_CONSTANTS_H #include "eq_limits.h" -#include "emu_legacy.h" #include "emu_versions.h" #include +// local definitions are the result of using hybrid-client or server-only values and methods namespace EQEmu { + using RoF2::IINVALID; + using RoF2::INULL; + namespace inventory { - //using namespace RoF2::invtype; - //using namespace RoF2::invslot; - //using namespace RoF2::invbag; - //using namespace RoF2::invaug; - - enum : int16 { typeInvalid = -1, slotInvalid = -1, containerInvalid = -1, socketInvalid = -1 }; // temporary - enum : int16 { typeBegin = 0, slotBegin = 0, containerBegin = 0, socketBegin = 0 }; // temporary - - enum PossessionsSlots : int16 { // temporary - slotCharm = 0, - slotEar1, - slotHead, - slotFace, - slotEar2, - slotNeck, // 5 - slotShoulders, - slotArms, - slotBack, - slotWrist1, - slotWrist2, // 10 - slotRange, - slotHands, - slotPrimary, - slotSecondary, - slotFinger1, // 15 - slotFinger2, - slotChest, - slotLegs, - slotFeet, - slotWaist, // 20 - slotPowerSource = 9999, - slotAmmo = 21, - slotGeneral1, - slotGeneral2, - slotGeneral3, - slotGeneral4, // 25 - slotGeneral5, - slotGeneral6, - slotGeneral7, - slotGeneral8, - slotCursor, // 30 - slotCount - }; - - enum InventoryTypes : int16 { // temporary - typePossessions = 0, - typeBank, - typeSharedBank, - typeTrade, - typeWorld, - typeLimbo, // 5 - typeTribute, - typeTrophyTribute, - typeGuildTribute, - typeMerchant, - typeDeleted, // 10 - typeCorpse, - typeBazaar, - typeInspect, - typeRealEstate, - typeViewMODPC, // 15 - typeViewMODBank, - typeViewMODSharedBank, - typeViewMODLimbo, - typeAltStorage, - typeArchived, // 20 - typeMail, - typeGuildTrophyTribute, - typeKrono, - typeOther, - typeCount - }; - - static int16 SlotCount(int16 type_index) { return 0; } // temporary - - const int16 ContainerCount = 10; // temporary - const int16 SocketCount = 6; // temporary - + } /*inventory*/ - namespace constants { - const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2; - const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit; + namespace invtype { + using namespace RoF2::invtype::enum_; - const size_t SayLinkOpenerSize = 1; - const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize; - const size_t SayLinkTextSize = 256; // this may be varied until it breaks something (tested:374) - the others are constant - const size_t SayLinkCloserSize = 1; - const size_t SayLinkMaximumSize = (SayLinkOpenerSize + SayLinkBodySize + SayLinkTextSize + SayLinkCloserSize); + using RoF2::invtype::POSSESSIONS_SIZE; + using RoF2::invtype::BANK_SIZE; + using RoF2::invtype::SHARED_BANK_SIZE; + using RoF2::invtype::TRADE_SIZE; + using RoF2::invtype::WORLD_SIZE; + using RoF2::invtype::LIMBO_SIZE; + using RoF2::invtype::TRIBUTE_SIZE; + using RoF2::invtype::TROPHY_TRIBUTE_SIZE; + using RoF2::invtype::GUILD_TRIBUTE_SIZE; + using RoF2::invtype::MERCHANT_SIZE; + using RoF2::invtype::DELETED_SIZE; + using RoF2::invtype::CORPSE_SIZE; + using RoF2::invtype::BAZAAR_SIZE; + using RoF2::invtype::INSPECT_SIZE; + using RoF2::invtype::REAL_ESTATE_SIZE; + using RoF2::invtype::VIEW_MOD_PC_SIZE; + using RoF2::invtype::VIEW_MOD_BANK_SIZE; + using RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE; + using RoF2::invtype::VIEW_MOD_LIMBO_SIZE; + using RoF2::invtype::ALT_STORAGE_SIZE; + using RoF2::invtype::ARCHIVED_SIZE; + using RoF2::invtype::MAIL_SIZE; + using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE; + using RoF2::invtype::KRONO_SIZE; + using RoF2::invtype::OTHER_SIZE; + + using Titanium::invtype::TRADE_NPC_SIZE; + + using RoF2::invtype::TYPE_INVALID; + using RoF2::invtype::TYPE_BEGIN; + using RoF2::invtype::TYPE_END; + using RoF2::invtype::TYPE_COUNT; + + int16 GetInvTypeSize(int16 inv_type); + using RoF2::invtype::GetInvTypeName; + + } // namespace invtype + + namespace invslot { + using namespace Titanium::invslot::enum_; + + const int16 SLOT_POWER_SOURCE = 9999; + + using RoF2::invslot::SLOT_INVALID; + using RoF2::invslot::SLOT_BEGIN; + + using Titanium::invslot::POSSESSIONS_BEGIN; + using Titanium::invslot::POSSESSIONS_END; + using SoF::invslot::POSSESSIONS_COUNT; + + using Titanium::invslot::EQUIPMENT_BEGIN; + using Titanium::invslot::EQUIPMENT_END; + using Titanium::invslot::EQUIPMENT_COUNT; + + using Titanium::invslot::GENERAL_BEGIN; + using Titanium::invslot::GENERAL_END; + using Titanium::invslot::GENERAL_COUNT; + + using Titanium::invslot::BONUS_BEGIN; + using Titanium::invslot::BONUS_STAT_END; + using Titanium::invslot::BONUS_SKILL_END; + + using Titanium::invslot::BANK_BEGIN; + using SoF::invslot::BANK_END; + + using Titanium::invslot::SHARED_BANK_BEGIN; + using Titanium::invslot::SHARED_BANK_END; + + using Titanium::invslot::TRADE_BEGIN; + using Titanium::invslot::TRADE_END; + + using Titanium::invslot::TRADE_NPC_END; + + using Titanium::invslot::WORLD_BEGIN; + using Titanium::invslot::WORLD_END; + + using Titanium::invslot::TRIBUTE_BEGIN; + using Titanium::invslot::TRIBUTE_END; + + using Titanium::invslot::GUILD_TRIBUTE_BEGIN; + using Titanium::invslot::GUILD_TRIBUTE_END; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = CORPSE_BEGIN + invslot::slotCursor; + + using RoF2::invslot::POSSESSIONS_BITMASK; + using RoF2::invslot::CORPSE_BITMASK; + + using RoF2::invslot::GetInvPossessionsSlotName; + using RoF2::invslot::GetInvSlotName; + + } // namespace invslot + + namespace invbag { + using Titanium::invbag::SLOT_INVALID; + using Titanium::invbag::SLOT_BEGIN; + using Titanium::invbag::SLOT_END; + using Titanium::invbag::SLOT_COUNT; + + using Titanium::invbag::GENERAL_BAGS_BEGIN; + const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT; + const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1; + + const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT; + const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1; + + const int16 CURSOR_BAG_BEGIN = 331; + const int16 CURSOR_BAG_COUNT = SLOT_COUNT; + const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1; + + using Titanium::invbag::BANK_BAGS_BEGIN; + const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT); + const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1; + + const int16 BANK_BAGS_16_COUNT = 16 * SLOT_COUNT; + const int16 BANK_BAGS_16_END = (BANK_BAGS_BEGIN + BANK_BAGS_16_COUNT) - 1; + + using Titanium::invbag::SHARED_BANK_BAGS_BEGIN; + const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT; + const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1; + + using Titanium::invbag::TRADE_BAGS_BEGIN; + const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT; + const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1; + + using Titanium::invbag::GetInvBagIndexName; + + } // namespace invbag + + namespace invaug { + using RoF2::invaug::SOCKET_INVALID; + using RoF2::invaug::SOCKET_BEGIN; + using RoF2::invaug::SOCKET_END; + using RoF2::invaug::SOCKET_COUNT; + + using RoF2::invaug::GetInvAugIndexName; + + } // namespace invaug + + namespace constants { + const EQEmu::versions::ClientVersion CHARACTER_CREATION_CLIENT = EQEmu::versions::ClientVersion::Titanium; + + using RoF2::constants::CHARACTER_CREATION_LIMIT; + + const size_t SAY_LINK_OPENER_SIZE = 1; + using RoF2::constants::SAY_LINK_BODY_SIZE; + const size_t SAY_LINK_TEXT_SIZE = 256; // this may be varied until it breaks something (tested:374) - the others are constant + const size_t SAY_LINK_CLOSER_SIZE = 1; + const size_t SAY_LINK_MAXIMUM_SIZE = (SAY_LINK_OPENER_SIZE + SAY_LINK_BODY_SIZE + SAY_LINK_TEXT_SIZE + SAY_LINK_CLOSER_SIZE); const int LongBuffs = RoF2::constants::LongBuffs; const int ShortBuffs = RoF2::constants::ShortBuffs; @@ -130,6 +199,21 @@ namespace EQEmu } /*constants*/ + namespace profile { + using RoF2::profile::BANDOLIERS_SIZE; + using RoF2::profile::BANDOLIER_ITEM_COUNT; + + using RoF2::profile::POTION_BELT_SIZE; + + using RoF2::profile::SKILL_ARRAY_SIZE; + + } // namespace profile + + namespace behavior { + using RoF2::behavior::CoinHasWeight; + + } // namespace behavior + namespace bug { enum CategoryID : uint32 { catOther = 0, diff --git a/common/emu_legacy.cpp b/common/emu_legacy.cpp deleted file mode 100644 index 36cb21c36..000000000 --- a/common/emu_legacy.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* 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 "emu_legacy.h" diff --git a/common/emu_legacy.h b/common/emu_legacy.h deleted file mode 100644 index 812a33ca1..000000000 --- a/common/emu_legacy.h +++ /dev/null @@ -1,182 +0,0 @@ -/* 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 -*/ - -#ifndef COMMON_EMU_LEGACY_H -#define COMMON_EMU_LEGACY_H - -#include "types.h" - -#include - - -namespace EQEmu -{ - // this is for perl and other legacy systems - namespace legacy { - enum InventorySlot { - SLOT_CHARM = 0, - SLOT_EAR01 = 1, - SLOT_HEAD = 2, - SLOT_FACE = 3, - SLOT_EAR02 = 4, - SLOT_NECK = 5, - SLOT_SHOULDER = 6, - SLOT_ARMS = 7, - SLOT_BACK = 8, - SLOT_BRACER01 = 9, - SLOT_BRACER02 = 10, - SLOT_RANGE = 11, - SLOT_HANDS = 12, - SLOT_PRIMARY = 13, - SLOT_SECONDARY = 14, - SLOT_RING01 = 15, - SLOT_RING02 = 16, - SLOT_CHEST = 17, - SLOT_LEGS = 18, - SLOT_FEET = 19, - SLOT_WAIST = 20, - SLOT_POWER_SOURCE = 9999, - SLOT_AMMO = 21, - SLOT_GENERAL_1 = 22, - SLOT_GENERAL_2 = 23, - SLOT_GENERAL_3 = 24, - SLOT_GENERAL_4 = 25, - SLOT_GENERAL_5 = 26, - SLOT_GENERAL_6 = 27, - SLOT_GENERAL_7 = 28, - SLOT_GENERAL_8 = 29, - SLOT_CURSOR = 30, - SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this... - SLOT_TRADESKILL = 1000, - SLOT_AUGMENT = 1001, - SLOT_INVALID = (int16)0xFFFF, - SLOT_POSSESSIONS_BEGIN = 0, - SLOT_POSSESSIONS_END = 30, - SLOT_EQUIPMENT_BEGIN = 0, - SLOT_EQUIPMENT_END = 21, - SLOT_PERSONAL_BEGIN = 22, - SLOT_PERSONAL_END = 29, - SLOT_PERSONAL_BAGS_BEGIN = 251, - SLOT_PERSONAL_BAGS_END = 330, - SLOT_CURSOR_BAG_BEGIN = 331, - SLOT_CURSOR_BAG_END = 340, - SLOT_TRIBUTE_BEGIN = 400, - SLOT_TRIBUTE_END = 404, - SLOT_GUILD_TRIBUTE_BEGIN = 450, - SLOT_GUILD_TRIBUTE_END = 451, - SLOT_BANK_BEGIN = 2000, - SLOT_BANK_END = 2023, - SLOT_BANK_BAGS_BEGIN = 2031, - SLOT_BANK_BAGS_END = 2270, - SLOT_SHARED_BANK_BEGIN = 2500, - SLOT_SHARED_BANK_END = 2501, - SLOT_SHARED_BANK_BAGS_BEGIN = 2531, - SLOT_SHARED_BANK_BAGS_END = 2550, - SLOT_TRADE_BEGIN = 3000, - SLOT_TRADE_END = 3007, - SLOT_TRADE_BAGS_BEGIN = 3031, - SLOT_TRADE_BAGS_END = 3110, - SLOT_WORLD_BEGIN = 4000, - SLOT_WORLD_END = 4009 - }; - - // these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready - static const uint16 TYPE_POSSESSIONS_SIZE = 31; - static const uint16 TYPE_BANK_SIZE = 24; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 5; // (need client values) - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = 31; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, (m_mob_version), static_cast(inventory_version)); + return false; + } +} + void EQEmu::InventoryProfile::CleanDirty() { auto iter = dirty_inst.begin(); while (iter != dirty_inst.end()) { @@ -140,63 +155,63 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const ItemInstance* result = nullptr; // Cursor - if (slot_id == inventory::slotCursor) { + if (slot_id == invslot::slotCursor) { // Cursor slot result = m_cursor.peek_front(); } // Non bag slots - else if (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) { + else if (slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END) { result = _GetItem(m_trade, slot_id); } - else if (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) { + else if (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) { // Shared Bank slots result = _GetItem(m_shbank, slot_id); } - else if (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) { + else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) { // Bank slots result = _GetItem(m_bank, slot_id); } - else if ((slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END)) { + else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) { // Personal inventory slots result = _GetItem(m_inv, slot_id); } - else if ((slot_id >= legacy::EQUIPMENT_BEGIN && slot_id <= legacy::EQUIPMENT_END) || - (slot_id >= legacy::TRIBUTE_BEGIN && slot_id <= legacy::TRIBUTE_END) || (slot_id == inventory::slotPowerSource)) { + else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || + (slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) { // Equippable slots (on body) result = _GetItem(m_worn, slot_id); } // Inner bag slots - else if (slot_id >= legacy::TRADE_BAGS_BEGIN && slot_id <= legacy::TRADE_BAGS_END) { + else if (slot_id >= invbag::TRADE_BAGS_BEGIN && slot_id <= invbag::TRADE_BAGS_END) { // Trade bag slots ItemInstance* inst = _GetItem(m_trade, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= legacy::SHARED_BANK_BAGS_END) { + else if (slot_id >= invbag::SHARED_BANK_BAGS_BEGIN && slot_id <= invbag::SHARED_BANK_BAGS_END) { // Shared Bank bag slots ItemInstance* inst = _GetItem(m_shbank, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= legacy::BANK_BAGS_BEGIN && slot_id <= legacy::BANK_BAGS_END) { + else if (slot_id >= invbag::BANK_BAGS_BEGIN && slot_id <= invbag::BANK_BAGS_END) { // Bank bag slots ItemInstance* inst = _GetItem(m_bank, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= legacy::CURSOR_BAG_BEGIN && slot_id <= legacy::CURSOR_BAG_END) { + else if (slot_id >= invbag::CURSOR_BAG_BEGIN && slot_id <= invbag::CURSOR_BAG_END) { // Cursor bag slots ItemInstance* inst = m_cursor.peek_front(); if (inst && inst->IsClassBag()) { result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { + else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) { // Personal inventory bag slots ItemInstance* inst = _GetItem(m_inv, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { @@ -232,7 +247,7 @@ int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst) int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance& inst) { m_cursor.push(inst.Clone()); - return inventory::slotCursor; + return invslot::slotCursor; } EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() @@ -254,7 +269,7 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS fail_state = swapNotAllowed; return false; } - if ((slot_b >= legacy::EQUIPMENT_BEGIN && slot_b <= legacy::EQUIPMENT_END) || slot_b == inventory::slotPowerSource) { + if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END) || slot_b == invslot::SLOT_POWER_SOURCE) { auto item_a = inst_a->GetItem(); if (!item_a) { fail_state = swapNullData; @@ -280,7 +295,7 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS fail_state = swapNotAllowed; return false; } - if ((slot_a >= legacy::EQUIPMENT_BEGIN && slot_a <= legacy::EQUIPMENT_END) || slot_a == inventory::slotPowerSource) { + if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END) || slot_a == invslot::SLOT_POWER_SOURCE) { auto item_b = inst_b->GetItem(); if (!item_b) { fail_state = swapNullData; @@ -361,30 +376,30 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id) { ItemInstance* p = nullptr; - if (slot_id == inventory::slotCursor) { + if (slot_id == invslot::slotCursor) { p = m_cursor.pop(); } - else if ((slot_id >= legacy::EQUIPMENT_BEGIN && slot_id <= legacy::EQUIPMENT_END) || (slot_id == inventory::slotPowerSource)) { + else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) { p = m_worn[slot_id]; m_worn.erase(slot_id); } - else if ((slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END)) { + else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) { p = m_inv[slot_id]; m_inv.erase(slot_id); } - else if (slot_id >= legacy::TRIBUTE_BEGIN && slot_id <= legacy::TRIBUTE_END) { + else if (slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) { p = m_worn[slot_id]; m_worn.erase(slot_id); } - else if (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) { + else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) { p = m_bank[slot_id]; m_bank.erase(slot_id); } - else if (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) { + else if (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) { p = m_shbank[slot_id]; m_shbank.erase(slot_id); } - else if (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) { + else if (slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END) { p = m_trade[slot_id]; m_trade.erase(slot_id); } @@ -404,7 +419,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q if (ItemToTry->Stackable) { - for (int16 i = legacy::GENERAL_BEGIN; i <= legacy::GENERAL_END; i++) { + for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) { ItemInstance* InvItem = GetItem(i); @@ -420,9 +435,9 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q } if (InvItem && InvItem->IsClassBag()) { - int16 BaseSlotID = InventoryProfile::CalcSlotId(i, inventory::containerBegin); + int16 BaseSlotID = InventoryProfile::CalcSlotId(i, invbag::SLOT_BEGIN); uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = inventory::containerBegin; BagSlot < BagSize; BagSlot++) { + for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot < BagSize; BagSlot++) { InvItem = GetItem(BaseSlotID + BagSlot); @@ -441,7 +456,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q } } - for (int16 i = legacy::GENERAL_BEGIN; i <= legacy::GENERAL_END; i++) { + for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) { ItemInstance* InvItem = GetItem(i); @@ -464,11 +479,11 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q } else if (InvItem->IsClassBag() && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { - int16 BaseSlotID = InventoryProfile::CalcSlotId(i, inventory::containerBegin); + int16 BaseSlotID = InventoryProfile::CalcSlotId(i, invbag::SLOT_BEGIN); uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = inventory::containerBegin; BagSlotIsClassBag() && inst->GetItem()->BagSize >= min_size) { @@ -663,11 +678,11 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8 continue; } - int16 base_slot_id = InventoryProfile::CalcSlotId(i, inventory::containerBegin); + int16 base_slot_id = InventoryProfile::CalcSlotId(i, invbag::SLOT_BEGIN); uint8 slots = inst->GetItem()->BagSlots; uint8 j; - for (j = inventory::containerBegin; j legacy::GENERAL_END)) + if ((general_start < invslot::GENERAL_BEGIN) || (general_start > invslot::GENERAL_END)) return INVALID_INDEX; - if (bag_start >= inventory::ContainerCount) + if (bag_start > invbag::SLOT_END) return INVALID_INDEX; if (!inst || !inst->GetID()) @@ -704,17 +719,17 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst // 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->IsClassBag()) { - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { if (!m_inv[free_slot]) return free_slot; } - return inventory::slotCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) + return invslot::slotCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) } // step 2: find partial room for stackables if (inst->IsStackable()) { - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) @@ -724,15 +739,15 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst return free_slot; } - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) continue; if (main_inst->IsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... - uint8 _bag_start = (free_slot > general_start) ? inventory::containerBegin : bag_start; - for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { + uint8 _bag_start = (free_slot > general_start) ? invbag::SLOT_BEGIN : bag_start; + for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot <= invbag::SLOT_END); ++free_bag_slot) { const ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); if (!sub_inst) @@ -747,14 +762,14 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst // step 3a: find room for container-specific items (ItemClassArrow) if (inst->GetItem()->ItemType == item::ItemTypeArrow) { - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeQuiver) || !main_inst->IsClassBag()) continue; - uint8 _bag_start = (free_slot > general_start) ? inventory::containerBegin : bag_start; - for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { + uint8 _bag_start = (free_slot > general_start) ? invbag::SLOT_BEGIN : bag_start; + for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot <= invbag::SLOT_END); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } @@ -763,14 +778,14 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst // step 3b: find room for container-specific items (ItemClassSmallThrowing) if (inst->GetItem()->ItemType == item::ItemTypeSmallThrowing) { - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeBandolier) || !main_inst->IsClassBag()) continue; - uint8 _bag_start = (free_slot > general_start) ? inventory::containerBegin : bag_start; - for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { + uint8 _bag_start = (free_slot > general_start) ? invbag::SLOT_BEGIN : bag_start; + for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot <= invbag::SLOT_END); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } @@ -778,22 +793,22 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst } // step 4: just find an empty slot - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) return free_slot; } - for (int16 free_slot = general_start; free_slot <= legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) { const ItemInstance* main_inst = m_inv[free_slot]; if (main_inst && main_inst->IsClassBag()) { if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == item::BagTypeBandolier) || (main_inst->GetItem()->BagType == item::BagTypeQuiver)) continue; - uint8 _bag_start = (free_slot > general_start) ? inventory::containerBegin : bag_start; - for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { + uint8 _bag_start = (free_slot > general_start) ? invbag::SLOT_BEGIN : bag_start; + for (uint8 free_bag_slot = _bag_start; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot <= invbag::SLOT_END); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } @@ -801,7 +816,7 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst } //return INVALID_INDEX; // everything else pushes to the cursor - return inventory::slotCursor; + return invslot::slotCursor; } // Opposite of below: Get parent bag slot_id from a slot inside of bag @@ -813,20 +828,20 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) { // parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; //else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range) - if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { - parent_slot_id = legacy::GENERAL_BEGIN + (slot_id - legacy::GENERAL_BAGS_BEGIN) / inventory::ContainerCount; + if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) { + parent_slot_id = invslot::GENERAL_BEGIN + (slot_id - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT; } - else if (slot_id >= legacy::CURSOR_BAG_BEGIN && slot_id <= legacy::CURSOR_BAG_END) { - parent_slot_id = inventory::slotCursor; + else if (slot_id >= invbag::CURSOR_BAG_BEGIN && slot_id <= invbag::CURSOR_BAG_END) { + parent_slot_id = invslot::slotCursor; } - else if (slot_id >= legacy::BANK_BAGS_BEGIN && slot_id <= legacy::BANK_BAGS_END) { - parent_slot_id = legacy::BANK_BEGIN + (slot_id - legacy::BANK_BAGS_BEGIN) / inventory::ContainerCount; + else if (slot_id >= invbag::BANK_BAGS_BEGIN && slot_id <= invbag::BANK_BAGS_END) { + parent_slot_id = invslot::BANK_BEGIN + (slot_id - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT; } - else if (slot_id >= legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= legacy::SHARED_BANK_BAGS_END) { - parent_slot_id = legacy::SHARED_BANK_BEGIN + (slot_id - legacy::SHARED_BANK_BAGS_BEGIN) / inventory::ContainerCount; + else if (slot_id >= invbag::SHARED_BANK_BAGS_BEGIN && slot_id <= invbag::SHARED_BANK_BAGS_END) { + parent_slot_id = invslot::SHARED_BANK_BEGIN + (slot_id - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT; } - else if (slot_id >= legacy::TRADE_BAGS_BEGIN && slot_id <= legacy::TRADE_BAGS_END) { - parent_slot_id = legacy::TRADE_BEGIN + (slot_id - legacy::TRADE_BAGS_BEGIN) / inventory::ContainerCount; + else if (slot_id >= invbag::TRADE_BAGS_BEGIN && slot_id <= invbag::TRADE_BAGS_END) { + parent_slot_id = invslot::TRADE_BEGIN + (slot_id - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT; } return parent_slot_id; @@ -839,20 +854,20 @@ int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) { int16 slot_id = INVALID_INDEX; - if (bagslot_id == inventory::slotCursor || bagslot_id == 8000) { - slot_id = legacy::CURSOR_BAG_BEGIN + bagidx; + if (bagslot_id == invslot::slotCursor || bagslot_id == 8000) { + slot_id = invbag::CURSOR_BAG_BEGIN + bagidx; } - else if (bagslot_id >= legacy::GENERAL_BEGIN && bagslot_id <= legacy::GENERAL_END) { - slot_id = legacy::GENERAL_BAGS_BEGIN + (bagslot_id - legacy::GENERAL_BEGIN) * inventory::ContainerCount + bagidx; + else if (bagslot_id >= invslot::GENERAL_BEGIN && bagslot_id <= invslot::GENERAL_END) { + slot_id = invbag::GENERAL_BAGS_BEGIN + (bagslot_id - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT + bagidx; } - else if (bagslot_id >= legacy::BANK_BEGIN && bagslot_id <= legacy::BANK_END) { - slot_id = legacy::BANK_BAGS_BEGIN + (bagslot_id - legacy::BANK_BEGIN) * inventory::ContainerCount + bagidx; + else if (bagslot_id >= invslot::BANK_BEGIN && bagslot_id <= invslot::BANK_END) { + slot_id = invbag::BANK_BAGS_BEGIN + (bagslot_id - invslot::BANK_BEGIN) * invbag::SLOT_COUNT + bagidx; } - else if (bagslot_id >= legacy::SHARED_BANK_BEGIN && bagslot_id <= legacy::SHARED_BANK_END) { - slot_id = legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - legacy::SHARED_BANK_BEGIN) * inventory::ContainerCount + bagidx; + else if (bagslot_id >= invslot::SHARED_BANK_BEGIN && bagslot_id <= invslot::SHARED_BANK_END) { + slot_id = invbag::SHARED_BANK_BAGS_BEGIN + (bagslot_id - invslot::SHARED_BANK_BEGIN) * invbag::SLOT_COUNT + bagidx; } - else if (bagslot_id >= legacy::TRADE_BEGIN && bagslot_id <= legacy::TRADE_END) { - slot_id = legacy::TRADE_BAGS_BEGIN + (bagslot_id - legacy::TRADE_BEGIN) * inventory::ContainerCount + bagidx; + else if (bagslot_id >= invslot::TRADE_BEGIN && bagslot_id <= invslot::TRADE_END) { + slot_id = invbag::TRADE_BAGS_BEGIN + (bagslot_id - invslot::TRADE_BEGIN) * invbag::SLOT_COUNT + bagidx; } return slot_id; @@ -865,23 +880,23 @@ uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) { //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) // index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { - index = (slot_id - legacy::GENERAL_BAGS_BEGIN) % inventory::ContainerCount; + if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) { + index = (slot_id - invbag::GENERAL_BAGS_BEGIN) % invbag::SLOT_COUNT; } - else if (slot_id >= legacy::CURSOR_BAG_BEGIN && slot_id <= legacy::CURSOR_BAG_END) { - index = (slot_id - legacy::CURSOR_BAG_BEGIN); // % inventory::ContainerCount; - not needed since range is 10 slots + else if (slot_id >= invbag::CURSOR_BAG_BEGIN && slot_id <= invbag::CURSOR_BAG_END) { + index = (slot_id - invbag::CURSOR_BAG_BEGIN); // % invbag::SLOT_COUNT; - not needed since range is 10 slots } - else if (slot_id >= legacy::BANK_BAGS_BEGIN && slot_id <= legacy::BANK_BAGS_END) { - index = (slot_id - legacy::BANK_BAGS_BEGIN) % inventory::ContainerCount; + else if (slot_id >= invbag::BANK_BAGS_BEGIN && slot_id <= invbag::BANK_BAGS_END) { + index = (slot_id - invbag::BANK_BAGS_BEGIN) % invbag::SLOT_COUNT; } - else if (slot_id >= legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= legacy::SHARED_BANK_BAGS_END) { - index = (slot_id - legacy::SHARED_BANK_BAGS_BEGIN) % inventory::ContainerCount; + else if (slot_id >= invbag::SHARED_BANK_BAGS_BEGIN && slot_id <= invbag::SHARED_BANK_BAGS_END) { + index = (slot_id - invbag::SHARED_BANK_BAGS_BEGIN) % invbag::SLOT_COUNT; } - else if (slot_id >= legacy::TRADE_BAGS_BEGIN && slot_id <= legacy::TRADE_BAGS_END) { - index = (slot_id - legacy::TRADE_BAGS_BEGIN) % inventory::ContainerCount; + else if (slot_id >= invbag::TRADE_BAGS_BEGIN && slot_id <= invbag::TRADE_BAGS_END) { + index = (slot_id - invbag::TRADE_BAGS_BEGIN) % invbag::SLOT_COUNT; } - else if (slot_id >= legacy::WORLD_BEGIN && slot_id <= legacy::WORLD_END) { - index = (slot_id - legacy::WORLD_BEGIN); // % inventory::ContainerCount; - not needed since range is 10 slots + else if (slot_id >= invslot::WORLD_BEGIN && slot_id <= invslot::WORLD_END) { + index = (slot_id - invslot::WORLD_BEGIN); // % invbag::SLOT_COUNT; - not needed since range is 10 slots } return index; @@ -892,23 +907,23 @@ int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material) switch (material) { case textures::armorHead: - return inventory::slotHead; + return invslot::slotHead; case textures::armorChest: - return inventory::slotChest; + return invslot::slotChest; case textures::armorArms: - return inventory::slotArms; + return invslot::slotArms; case textures::armorWrist: - return inventory::slotWrist1; // there's 2 bracers, only one bracer material + return invslot::slotWrist1; // there's 2 bracers, only one bracer material case textures::armorHands: - return inventory::slotHands; + return invslot::slotHands; case textures::armorLegs: - return inventory::slotLegs; + return invslot::slotLegs; case textures::armorFeet: - return inventory::slotFeet; + return invslot::slotFeet; case textures::weaponPrimary: - return inventory::slotPrimary; + return invslot::slotPrimary; case textures::weaponSecondary: - return inventory::slotSecondary; + return invslot::slotSecondary; default: return INVALID_INDEX; } @@ -918,24 +933,24 @@ uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot) { switch (equipslot) { - case inventory::slotHead: + case invslot::slotHead: return textures::armorHead; - case inventory::slotChest: + case invslot::slotChest: return textures::armorChest; - case inventory::slotArms: + case invslot::slotArms: return textures::armorArms; - case inventory::slotWrist1: + case invslot::slotWrist1: //case SLOT_BRACER02: // non-live behavior return textures::armorWrist; - case inventory::slotHands: + case invslot::slotHands: return textures::armorHands; - case inventory::slotLegs: + case invslot::slotLegs: return textures::armorLegs; - case inventory::slotFeet: + case invslot::slotFeet: return textures::armorFeet; - case inventory::slotPrimary: + case invslot::slotPrimary: return textures::weaponPrimary; - case inventory::slotSecondary: + case invslot::slotSecondary: return textures::weaponSecondary; default: return textures::materialInvalid; @@ -962,11 +977,11 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id) { // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range - if ((uint16)slot_id <= legacy::GENERAL_END || slot_id == inventory::slotPowerSource) + if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE) { return true; } - else if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) + else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) { if (inventory::Lookup(m_mob_version)->AllowClickCastFromBag) return true; @@ -977,7 +992,7 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id) bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id) { - if ((uint16)slot_id <= legacy::GENERAL_END || slot_id == inventory::slotPowerSource || (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END)) + if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE || (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END)) return true; return false; @@ -986,11 +1001,11 @@ bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id) // Test whether a given slot can support a container item bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id) { - if ((slot_id == inventory::slotCursor) || - (slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END) || - (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) || - (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) || - (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) + if ((slot_id == invslot::slotCursor) || + (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) || + (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) || + (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) || + (slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END) ) { return true; } @@ -1028,7 +1043,7 @@ int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) { } if (m_cursor.peek_front() == inst) { - return inventory::slotCursor; + return invslot::slotCursor; } return INVALID_INDEX; @@ -1039,8 +1054,8 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType() uint8 brightest_light_type = 0; for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { - if ((iter->first < legacy::EQUIPMENT_BEGIN || iter->first > legacy::EQUIPMENT_END) && iter->first != inventory::slotPowerSource) { continue; } - if (iter->first == inventory::slotAmmo) { continue; } + if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END) && iter->first != invslot::SLOT_POWER_SOURCE) { continue; } + if (iter->first == invslot::slotAmmo) { continue; } auto inst = iter->second; if (inst == nullptr) { continue; } @@ -1053,7 +1068,7 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType() uint8 general_light_type = 0; for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { - if (iter->first < legacy::GENERAL_BEGIN || iter->first > legacy::GENERAL_END) { continue; } + if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END) { continue; } auto inst = iter->second; if (inst == nullptr) { continue; } @@ -1184,33 +1199,33 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst) int16 result = INVALID_INDEX; int16 parentSlot = INVALID_INDEX; - if (slot_id == inventory::slotCursor) { + if (slot_id == invslot::slotCursor) { // Replace current item on cursor, if exists m_cursor.pop(); // no memory delete, clients of this function know what they are doing m_cursor.push_front(inst); result = slot_id; } - else if ((slot_id >= legacy::EQUIPMENT_BEGIN && slot_id <= legacy::EQUIPMENT_END) || (slot_id == inventory::slotPowerSource)) { + else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) { m_worn[slot_id] = inst; result = slot_id; } - else if ((slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END)) { + else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) { m_inv[slot_id] = inst; result = slot_id; } - else if (slot_id >= legacy::TRIBUTE_BEGIN && slot_id <= legacy::TRIBUTE_END) { + else if (slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) { m_worn[slot_id] = inst; result = slot_id; } - else if (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) { + else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) { m_bank[slot_id] = inst; result = slot_id; } - else if (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) { + else if (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) { m_shbank[slot_id] = inst; result = slot_id; } - else if (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) { + else if (slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END) { m_trade[slot_id] = inst; result = slot_id; } @@ -1248,7 +1263,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map& bucket, return iter->first; } - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) return legacy::SLOT_AUGMENT; } @@ -1265,7 +1280,7 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map& bucket, return InventoryProfile::CalcSlotId(iter->first, bag_iter->first); } - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) return legacy::SLOT_AUGMENT; } @@ -1293,10 +1308,10 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u if (inst->GetID() == item_id) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return inventory::slotCursor; + return invslot::slotCursor; } - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) return legacy::SLOT_AUGMENT; } @@ -1310,10 +1325,10 @@ int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, u if (bag_inst->GetID() == item_id) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return InventoryProfile::CalcSlotId(inventory::slotCursor, bag_iter->first); + return InventoryProfile::CalcSlotId(invslot::slotCursor, bag_iter->first); } - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) return legacy::SLOT_AUGMENT; } @@ -1370,7 +1385,7 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return inventory::slotCursor; + return invslot::slotCursor; } if (!inst->IsClassBag()) { continue; } @@ -1382,7 +1397,7 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return InventoryProfile::CalcSlotId(inventory::slotCursor, bag_iter->first); + return InventoryProfile::CalcSlotId(invslot::slotCursor, bag_iter->first); } } @@ -1402,7 +1417,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::mapGetItem()->LoreGroup == loregroup) return iter->first; - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { auto aug_inst = inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1419,7 +1434,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::mapIsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) return InventoryProfile::CalcSlotId(iter->first, bag_iter->first); - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { auto aug_inst = bag_inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1440,9 +1455,9 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 if (inst == nullptr) { continue; } if (inst->GetItem()->LoreGroup == loregroup) - return inventory::slotCursor; + return invslot::slotCursor; - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { auto aug_inst = inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1457,9 +1472,9 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 if (bag_inst == nullptr) { continue; } if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) - return InventoryProfile::CalcSlotId(inventory::slotCursor, bag_iter->first); + return InventoryProfile::CalcSlotId(invslot::slotCursor, bag_iter->first); - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { auto aug_inst = bag_inst->GetAugment(index); if (aug_inst == nullptr) { continue; } diff --git a/common/inventory_profile.h b/common/inventory_profile.h index 5be7ed8d3..1f28b00f9 100644 --- a/common/inventory_profile.h +++ b/common/inventory_profile.h @@ -92,22 +92,13 @@ namespace EQEmu } ~InventoryProfile(); - bool SetInventoryVersion(versions::MobVersion inventory_version) { - if (!m_mob_version_set) { - m_mob_version = versions::ValidateMobVersion(inventory_version); - m_lookup = inventory::Lookup(m_mob_version); - m_mob_version_set = true; - return true; - } - else { - m_lookup = inventory::Lookup(versions::MobVersion::Unknown); - return false; - } - } + bool SetInventoryVersion(versions::MobVersion inventory_version); bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToMobVersion(client_version)); } versions::MobVersion InventoryVersion() { return m_mob_version; } + const inventory::LookupEntry* GetLookup() const { return m_lookup; } + static void CleanDirty(); static void MarkDirty(ItemInstance *inst); @@ -163,7 +154,7 @@ namespace EQEmu // Locate an available inventory slot int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); - int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = legacy::GENERAL_BEGIN, uint8 bag_start = inventory::containerBegin); + int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN); // Calculate slot_id for an item within a bag static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id diff --git a/common/inventory_slot.cpp b/common/inventory_slot.cpp index 8158e0bbf..ac4aaa412 100644 --- a/common/inventory_slot.cpp +++ b/common/inventory_slot.cpp @@ -25,23 +25,23 @@ int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index) { switch (slot_index) { - case slotHead: + case invslot::slotHead: return textures::armorHead; - case slotChest: + case invslot::slotChest: return textures::armorChest; - case slotArms: + case invslot::slotArms: return textures::armorArms; - case slotWrist1: + case invslot::slotWrist1: return textures::armorWrist; - case slotHands: + case invslot::slotHands: return textures::armorHands; - case slotLegs: + case invslot::slotLegs: return textures::armorLegs; - case slotFeet: + case invslot::slotFeet: return textures::armorFeet; - case slotPrimary: + case invslot::slotPrimary: return textures::weaponPrimary; - case slotSecondary: + case invslot::slotSecondary: return textures::weaponSecondary; default: return textures::textureInvalid; @@ -50,7 +50,7 @@ int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index) int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot) { - if ((!inventory_slot.Typeless() && !inventory_slot.IsTypeIndex(typePossessions)) || !inventory_slot.IsContainerIndex(containerInvalid) || !inventory_slot.IsSocketIndex(socketInvalid)) + if ((!inventory_slot.Typeless() && !inventory_slot.IsTypeIndex(invtype::typePossessions)) || !inventory_slot.IsContainerIndex(invbag::SLOT_INVALID) || !inventory_slot.IsSocketIndex(invaug::SOCKET_INVALID)) return textures::textureInvalid; return ConvertEquipmentIndexToTextureIndex(inventory_slot.SlotIndex()); @@ -60,25 +60,25 @@ int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index) { switch (texture_index) { case textures::armorHead: - return slotHead; + return invslot::slotHead; case textures::armorChest: - return slotChest; + return invslot::slotChest; case textures::armorArms: - return slotArms; + return invslot::slotArms; case textures::armorWrist: - return slotWrist1; + return invslot::slotWrist1; case textures::armorHands: - return slotHands; + return invslot::slotHands; case textures::armorLegs: - return slotLegs; + return invslot::slotLegs; case textures::armorFeet: - return slotFeet; + return invslot::slotFeet; case textures::weaponPrimary: - return slotPrimary; + return invslot::slotPrimary; case textures::weaponSecondary: - return slotSecondary; + return invslot::slotSecondary; default: - return slotInvalid; + return invslot::SLOT_INVALID; } } @@ -87,14 +87,14 @@ bool EQEmu::InventorySlot::IsValidSlot() const if (_typeless) return false; - int16 slot_count = inventory::SlotCount(_type_index); - if (!slot_count || _slot_index < inventory::slotBegin || _slot_index >= slot_count) + int16 slot_count = invtype::GetInvTypeSize(_type_index); + if (!slot_count || _slot_index < invslot::SLOT_BEGIN || _slot_index >= slot_count) return false; - if (_container_index < inventory::containerInvalid || _container_index >= inventory::ContainerCount) + if (_container_index < invbag::SLOT_INVALID || _container_index >= invbag::SLOT_COUNT) return false; - if (_socket_index < inventory::socketInvalid || _socket_index >= inventory::SocketCount) + if (_socket_index < invaug::SOCKET_INVALID || _socket_index >= invaug::SOCKET_COUNT) return false; return true; @@ -103,16 +103,16 @@ bool EQEmu::InventorySlot::IsValidSlot() const bool EQEmu::InventorySlot::IsDeleteSlot() const { if (_typeless) - return (_slot_index == inventory::slotInvalid && _container_index == inventory::containerInvalid && _socket_index == inventory::socketInvalid); + return (_slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID); else - return (_type_index == inventory::typeInvalid && _slot_index == inventory::slotInvalid && _container_index == inventory::containerInvalid && _socket_index == inventory::socketInvalid); + return (_type_index == invtype::TYPE_INVALID && _slot_index == invslot::SLOT_INVALID && _container_index == invbag::SLOT_INVALID && _socket_index == invaug::SOCKET_INVALID); } bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index) { /*if (slot_index < inventory::EquipmentBegin || slot_index > inventory::EquipmentEnd) return false;*/ - if ((slot_index < legacy::EQUIPMENT_BEGIN || slot_index > legacy::EQUIPMENT_END) && slot_index != legacy::SLOT_POWER_SOURCE) + if ((slot_index < invslot::EQUIPMENT_BEGIN || slot_index > invslot::EQUIPMENT_END) && slot_index != invslot::SLOT_POWER_SOURCE) return false; return true; @@ -122,7 +122,7 @@ bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index) { /*if (slot_index < inventory::GeneralBegin || slot_index > inventory::GeneralEnd) return false;*/ - if (slot_index < legacy::GENERAL_BEGIN || slot_index > legacy::GENERAL_END) + if (slot_index < invslot::GENERAL_BEGIN || slot_index > invslot::GENERAL_END) return false; return true; @@ -132,7 +132,7 @@ bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index) { /*if (slot_index != inventory::slotCursor) return false;*/ - if (slot_index != legacy::SLOT_CURSOR) + if (slot_index != invslot::slotCursor) return false; return true; @@ -142,7 +142,7 @@ bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index) { /*if ((slot_index != inventory::slotRange) && (slot_index != inventory::slotPrimary) && (slot_index != inventory::slotSecondary)) return false;*/ - if ((slot_index != legacy::SLOT_RANGE) && (slot_index != legacy::SLOT_PRIMARY) && (slot_index != legacy::SLOT_SECONDARY)) + if ((slot_index != invslot::slotRange) && (slot_index != invslot::slotPrimary) && (slot_index != invslot::slotSecondary)) return false; return true; @@ -151,15 +151,15 @@ bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index) bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index) { switch (slot_index) { - case inventory::slotHead: - case inventory::slotChest: - case inventory::slotArms: - case inventory::slotWrist1: - case inventory::slotHands: - case inventory::slotLegs: - case inventory::slotFeet: - case inventory::slotPrimary: - case inventory::slotSecondary: + case invslot::slotHead: + case invslot::slotChest: + case invslot::slotArms: + case invslot::slotWrist1: + case invslot::slotHands: + case invslot::slotLegs: + case invslot::slotFeet: + case invslot::slotPrimary: + case invslot::slotSecondary: return true; default: return false; @@ -169,13 +169,13 @@ bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index) bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index) { switch (slot_index) { - case inventory::slotHead: - case inventory::slotChest: - case inventory::slotArms: - case inventory::slotWrist1: - case inventory::slotHands: - case inventory::slotLegs: - case inventory::slotFeet: + case invslot::slotHead: + case invslot::slotChest: + case invslot::slotArms: + case invslot::slotWrist1: + case invslot::slotHands: + case invslot::slotLegs: + case invslot::slotFeet: return true; default: return false; @@ -184,10 +184,10 @@ bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index) bool EQEmu::InventorySlot::IsEquipmentSlot() const { - if (!_typeless && (_type_index != inventory::typePossessions)) + if (!_typeless && (_type_index != invtype::typePossessions)) return false; - if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + if ((_container_index != invbag::SLOT_INVALID) || (_socket_index != invaug::SOCKET_INVALID)) return false; return IsEquipmentIndex(_slot_index); @@ -195,10 +195,10 @@ bool EQEmu::InventorySlot::IsEquipmentSlot() const bool EQEmu::InventorySlot::IsGeneralSlot() const { - if (!_typeless && (_type_index != inventory::typePossessions)) + if (!_typeless && (_type_index != invtype::typePossessions)) return false; - if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + if ((_container_index != invbag::SLOT_INVALID) || (_socket_index != invaug::SOCKET_INVALID)) return false; return IsGeneralIndex(_socket_index); @@ -206,10 +206,10 @@ bool EQEmu::InventorySlot::IsGeneralSlot() const bool EQEmu::InventorySlot::IsCursorSlot() const { - if (!_typeless && (_type_index != inventory::typePossessions)) + if (!_typeless && (_type_index != invtype::typePossessions)) return false; - if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + if ((_container_index != invbag::SLOT_INVALID) || (_socket_index != invaug::SOCKET_INVALID)) return false; return IsCursorIndex(_slot_index); @@ -217,10 +217,10 @@ bool EQEmu::InventorySlot::IsCursorSlot() const bool EQEmu::InventorySlot::IsWeaponSlot() const { - if (!_typeless && (_type_index != inventory::typePossessions)) + if (!_typeless && (_type_index != invtype::typePossessions)) return false; - if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + if ((_container_index != invbag::SLOT_INVALID) || (_socket_index != invaug::SOCKET_INVALID)) return false; return IsWeaponIndex(_slot_index); @@ -228,10 +228,10 @@ bool EQEmu::InventorySlot::IsWeaponSlot() const bool EQEmu::InventorySlot::IsTextureSlot() const { - if (!_typeless && (_type_index != inventory::typePossessions)) + if (!_typeless && (_type_index != invtype::typePossessions)) return false; - if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + if ((_container_index != invbag::SLOT_INVALID) || (_socket_index != invaug::SOCKET_INVALID)) return false; return IsTextureIndex(_slot_index); @@ -239,10 +239,10 @@ bool EQEmu::InventorySlot::IsTextureSlot() const bool EQEmu::InventorySlot::IsTintableSlot() const { - if (!_typeless && (_type_index != inventory::typePossessions)) + if (!_typeless && (_type_index != invtype::typePossessions)) return false; - if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + if ((_container_index != invbag::SLOT_INVALID) || (_socket_index != invaug::SOCKET_INVALID)) return false; return IsTintableIndex(_slot_index); @@ -250,13 +250,13 @@ bool EQEmu::InventorySlot::IsTintableSlot() const bool EQEmu::InventorySlot::IsSlot() const { - if (!_typeless && (_type_index == inventory::typeInvalid)) + if (!_typeless && (_type_index == invtype::TYPE_INVALID)) return false; - if (_slot_index == inventory::slotInvalid) + if (_slot_index == invslot::SLOT_INVALID) return false; - if (_container_index != inventory::containerInvalid) + if (_container_index != invbag::SLOT_INVALID) return false; - if (_socket_index != inventory::socketInvalid) + if (_socket_index != invaug::SOCKET_INVALID) return false; return true; @@ -264,13 +264,13 @@ bool EQEmu::InventorySlot::IsSlot() const bool EQEmu::InventorySlot::IsSlotSocket() const { - if (!_typeless && (_type_index == inventory::typeInvalid)) + if (!_typeless && (_type_index == invtype::TYPE_INVALID)) return false; - if (_slot_index == inventory::slotInvalid) + if (_slot_index == invslot::SLOT_INVALID) return false; - if (_container_index != inventory::containerInvalid) + if (_container_index != invbag::SLOT_INVALID) return false; - if (_socket_index == inventory::socketInvalid) + if (_socket_index == invaug::SOCKET_INVALID) return false; return true; @@ -278,13 +278,13 @@ bool EQEmu::InventorySlot::IsSlotSocket() const bool EQEmu::InventorySlot::IsContainer() const { - if (!_typeless && (_type_index == inventory::typeInvalid)) + if (!_typeless && (_type_index == invtype::TYPE_INVALID)) return false; - if (_slot_index == inventory::slotInvalid) + if (_slot_index == invslot::SLOT_INVALID) return false; - if (_container_index == inventory::containerInvalid) + if (_container_index == invbag::SLOT_INVALID) return false; - if (_socket_index != inventory::socketInvalid) + if (_socket_index != invaug::SOCKET_INVALID) return false; return true; @@ -292,13 +292,13 @@ bool EQEmu::InventorySlot::IsContainer() const bool EQEmu::InventorySlot::IsContainerSocket() const { - if (!_typeless && (_type_index == inventory::typeInvalid)) + if (!_typeless && (_type_index == invtype::TYPE_INVALID)) return false; - if (_slot_index == inventory::slotInvalid) + if (_slot_index == invslot::SLOT_INVALID) return false; - if (_container_index == inventory::containerInvalid) + if (_container_index == invbag::SLOT_INVALID) return false; - if (_socket_index == inventory::socketInvalid) + if (_socket_index == invaug::SOCKET_INVALID) return false; return true; @@ -332,10 +332,10 @@ const std::string EQEmu::InventorySlot::ToName() const void EQEmu::InventorySlot::SetInvalidSlot() { - _type_index = inventory::typeInvalid; - _slot_index = inventory::slotInvalid; - _container_index = inventory::containerInvalid; - _socket_index = inventory::socketInvalid; + _type_index = invtype::TYPE_INVALID; + _slot_index = invslot::SLOT_INVALID; + _container_index = invbag::SLOT_INVALID; + _socket_index = invaug::SOCKET_INVALID; } //bool EQEmu::InventorySlot::IsBonusIndex(int16 slot_index) diff --git a/common/inventory_slot.h b/common/inventory_slot.h index 695282e34..967673f99 100644 --- a/common/inventory_slot.h +++ b/common/inventory_slot.h @@ -35,10 +35,10 @@ namespace EQEmu class InventorySlot { public: - InventorySlot() : _type_index(inventory::typeInvalid), _slot_index(inventory::slotInvalid), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { } - InventorySlot(int16 type_index) : _type_index(type_index), _slot_index(inventory::slotInvalid), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { } - InventorySlot(int16 type_index, int16 parent_index) : _type_index(type_index), _slot_index(parent_index), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { } - InventorySlot(int16 type_index, int16 parent_index, int16 bag_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(inventory::socketInvalid), _typeless(false) { } + InventorySlot() : _type_index(invtype::TYPE_INVALID), _slot_index(invslot::SLOT_INVALID), _container_index(invbag::SLOT_INVALID), _socket_index(invaug::SOCKET_INVALID), _typeless(false) { } + InventorySlot(int16 type_index) : _type_index(type_index), _slot_index(invslot::SLOT_INVALID), _container_index(invbag::SLOT_INVALID), _socket_index(invaug::SOCKET_INVALID), _typeless(false) { } + InventorySlot(int16 type_index, int16 parent_index) : _type_index(type_index), _slot_index(parent_index), _container_index(invbag::SLOT_INVALID), _socket_index(invaug::SOCKET_INVALID), _typeless(false) { } + InventorySlot(int16 type_index, int16 parent_index, int16 bag_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(invaug::SOCKET_INVALID), _typeless(false) { } InventorySlot(int16 type_index, int16 parent_index, int16 bag_index, int16 aug_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(aug_index), _typeless(false) { } InventorySlot(const InventorySlot& r) : _type_index(r._type_index), _slot_index(r._slot_index), _container_index(r._container_index), _socket_index(r._socket_index), _typeless(r._typeless) { } InventorySlot(int16 type_index, const InventorySlot& r) : _type_index(type_index), _slot_index(r._slot_index), _container_index(r._container_index), _socket_index(r._socket_index), _typeless(false) { } @@ -90,15 +90,15 @@ namespace EQEmu void SetInvalidSlot(); - void SetTypeInvalid() { _type_index = inventory::typeInvalid; } - void SetSlotInvalid() { _slot_index = inventory::slotInvalid; } - void SetContainerInvalid() { _container_index = inventory::containerInvalid; } - void SetSocketInvalid() { _socket_index = inventory::socketInvalid; } + void SetTypeInvalid() { _type_index = invtype::TYPE_INVALID; } + void SetSlotInvalid() { _slot_index = invslot::SLOT_INVALID; } + void SetContainerInvalid() { _container_index = invbag::SLOT_INVALID; } + void SetSocketInvalid() { _socket_index = invaug::SOCKET_INVALID; } - void SetTypeBegin() { _type_index = inventory::typeBegin; } - void SetSlotBegin() { _slot_index = inventory::slotBegin; } - void SetContainerBegin() { _container_index = inventory::containerBegin; } - void SetSocketBegin() { _socket_index = inventory::socketBegin; } + void SetTypeBegin() { _type_index = invtype::TYPE_BEGIN; } + void SetSlotBegin() { _slot_index = invslot::SLOT_BEGIN; } + void SetContainerBegin() { _container_index = invbag::SLOT_BEGIN; } + void SetSocketBegin() { _socket_index = invaug::SOCKET_BEGIN; } void IncrementType() { ++_type_index; } void IncrementSlot() { ++_slot_index; } diff --git a/common/item_data.h b/common/item_data.h index ae7e3bbdb..45ca8e9e0 100644 --- a/common/item_data.h +++ b/common/item_data.h @@ -464,9 +464,9 @@ namespace EQEmu int32 FactionAmt4; // Faction Amt 4 char CharmFile[32]; // ? uint32 AugType; - uint8 AugSlotType[inventory::SocketCount]; // RoF: Augment Slot 1-6 Type - uint8 AugSlotVisible[inventory::SocketCount]; // RoF: Augment Slot 1-6 Visible - uint8 AugSlotUnk2[inventory::SocketCount]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related + uint8 AugSlotType[invaug::SOCKET_COUNT]; // RoF: Augment Slot 1-6 Type + uint8 AugSlotVisible[invaug::SOCKET_COUNT]; // RoF: Augment Slot 1-6 Visible + uint8 AugSlotUnk2[invaug::SOCKET_COUNT]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related uint32 LDoNTheme; uint32 LDoNPrice; uint32 LDoNSold; diff --git a/common/item_instance.cpp b/common/item_instance.cpp index a2860f3e5..922d0e032 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -273,8 +273,8 @@ bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const // another "shouldn't do" fix..will be fixed in future updates (requires code and database work) int16 use_slot = INVALID_INDEX; - if (slot_id == inventory::slotPowerSource) { use_slot = inventory::slotGeneral1; } - if ((uint16)slot_id <= legacy::EQUIPMENT_END) { use_slot = slot_id; } + if (slot_id == invslot::SLOT_POWER_SOURCE) { use_slot = invslot::slotGeneral1; } + if ((uint16)slot_id <= invslot::EQUIPMENT_END) { use_slot = slot_id; } if (use_slot != INVALID_INDEX) { if (m_item->Slots & (1 << use_slot)) @@ -289,7 +289,7 @@ bool EQEmu::ItemInstance::IsAugmentable() const if (!m_item) return false; - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { if (m_item->AugSlotType[index] != 0) return true; } @@ -303,8 +303,8 @@ bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const { if (!m_item || !m_item->IsClassCommon()) return false; - int index = legacy::EQUIPMENT_BEGIN; - for (; index <= inventory::slotGeneral1; ++index) { // MainGeneral1 should be legacy::EQUIPMENT_END + int index = invslot::EQUIPMENT_BEGIN; + for (; index <= invslot::slotGeneral1; ++index) { // MainGeneral1 should be legacy::EQUIPMENT_END if (m_item->Slots & (1 << index)) { if (aug_wear_slots & (1 << index)) break; @@ -319,14 +319,14 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const if (!m_item || !m_item->IsClassCommon()) return INVALID_INDEX; - int index = inventory::socketBegin; - for (; index < inventory::SocketCount; ++index) { + int index = invaug::SOCKET_BEGIN; + for (; index <= invaug::SOCKET_END; ++index) { if (GetItem(index)) { continue; } if (augtype == -1 || (m_item->AugSlotType[index] && ((1 << (m_item->AugSlotType[index] - 1)) & augtype))) break; } - return (index < inventory::SocketCount) ? index : INVALID_INDEX; + return (index <= invaug::SOCKET_END) ? index : INVALID_INDEX; } bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const @@ -469,7 +469,7 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const return INVALID_INDEX; uint8 slots = m_item->BagSlots, i; - for (i = inventory::containerBegin; i < slots; i++) { + for (i = invbag::SLOT_BEGIN; i < slots; i++) { if (!GetItem(i)) break; } @@ -486,7 +486,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const if (m_item && !m_item->IsClassBag()) { return item_count; } - for (int index = inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } + for (int index = invbag::SLOT_BEGIN; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } return item_count; } @@ -496,7 +496,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer() if (!m_item || !m_item->IsClassBag()) return false; - for (int index = inventory::containerBegin; index < m_item->BagSlots; ++index) { + for (int index = invbag::SLOT_BEGIN; index < m_item->BagSlots; ++index) { if (GetItem(index)) return true; } @@ -518,7 +518,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (ornamentationAugtype == 0) { return nullptr; } - for (int i = inventory::socketBegin; i < inventory::SocketCount; i++) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; i++) { if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) { @@ -686,7 +686,7 @@ bool EQEmu::ItemInstance::IsAugmented() if (!m_item || !m_item->IsClassCommon()) return false; - for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { if (GetAugmentItemID(index)) return true; } @@ -814,8 +814,8 @@ bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const { if (!m_item) { return false; } else if (InventoryProfile::SupportsContainers(slot_id)) { return true; } else if (m_item->Slots & (1 << slot_id)) { return true; } - else if (slot_id == inventory::slotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... - else if (slot_id != inventory::slotPowerSource && slot_id > legacy::EQUIPMENT_END) { return true; } + else if (slot_id == invslot::SLOT_POWER_SOURCE && (m_item->Slots & (1 << 22))) { return true; } // got lazy... + else if (slot_id != invslot::SLOT_POWER_SOURCE && slot_id > invslot::EQUIPMENT_END) { return true; } else { return false; } } @@ -993,7 +993,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const if (item) { ac = item->AC; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) ac += GetAugment(i)->GetItemArmorClass(); } @@ -1035,7 +1035,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold } if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) GetAugment(i)->GetItemElementalDamage(magic, fire, cold, poison, disease, chromatic, prismatic, physical, corruption); } @@ -1052,7 +1052,7 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const return flag; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) { if (GetAugment(i)) flag = GetAugment(i)->GetItemElementalFlag(); if (flag) @@ -1073,7 +1073,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const return damage; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) { if (GetAugment(i)) damage = GetAugment(i)->GetItemElementalDamage(); if (damage) @@ -1092,7 +1092,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const level = item->RecLevel; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) { int temp = 0; if (GetAugment(i)) { temp = GetAugment(i)->GetItemRecommendedLevel(); @@ -1114,7 +1114,7 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const level = item->ReqLevel; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) { int temp = 0; if (GetAugment(i)) { temp = GetAugment(i)->GetItemRequiredLevel(); @@ -1136,7 +1136,7 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const damage = item->Damage; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemWeaponDamage(); } @@ -1152,7 +1152,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const damage = item->BackstabDmg; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBackstabDamage(); } @@ -1170,7 +1170,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const return body; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) { body = GetAugment(i)->GetItemBaneDamageBody(); if (body) @@ -1191,7 +1191,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const return race; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) { race = GetAugment(i)->GetItemBaneDamageRace(); if (race) @@ -1211,7 +1211,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) damage += item->BaneDmgAmt; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBaneDamageBody(against); } @@ -1228,7 +1228,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co damage += item->BaneDmgRaceAmt; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBaneDamageRace(against); } @@ -1244,7 +1244,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const return 1; if (augments) { - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i) && GetAugment(i)->GetItemMagical()) return 1; } @@ -1259,7 +1259,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const if (item) { hp = item->HP; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) hp += GetAugment(i)->GetItemHP(); } @@ -1273,7 +1273,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const if (item) { mana = item->Mana; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) mana += GetAugment(i)->GetItemMana(); } @@ -1287,7 +1287,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const if (item) { endur = item->Endur; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) endur += GetAugment(i)->GetItemEndur(); } @@ -1301,7 +1301,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const if (item) { atk = item->Attack; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) atk += GetAugment(i)->GetItemAttack(); } @@ -1315,7 +1315,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const if (item) { str = item->AStr; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) str += GetAugment(i)->GetItemStr(); } @@ -1329,7 +1329,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const if (item) { sta = item->ASta; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) sta += GetAugment(i)->GetItemSta(); } @@ -1343,7 +1343,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const if (item) { total = item->ADex; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemDex(); } @@ -1357,7 +1357,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const if (item) { total = item->AAgi; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemAgi(); } @@ -1371,7 +1371,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const if (item) { total = item->AInt; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemInt(); } @@ -1385,7 +1385,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const if (item) { total = item->AWis; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemWis(); } @@ -1399,7 +1399,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const if (item) { total = item->ACha; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCha(); } @@ -1413,7 +1413,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const if (item) { total = item->MR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemMR(); } @@ -1427,7 +1427,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const if (item) { total = item->FR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemFR(); } @@ -1441,7 +1441,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const if (item) { total = item->CR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCR(); } @@ -1455,7 +1455,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const if (item) { total = item->PR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemPR(); } @@ -1469,7 +1469,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const if (item) { total = item->DR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemDR(); } @@ -1483,7 +1483,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const if (item) { total = item->SVCorruption; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCorrup(); } @@ -1497,7 +1497,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const if (item) { total = item->HeroicStr; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicStr(); } @@ -1511,7 +1511,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const if (item) { total = item->HeroicSta; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicSta(); } @@ -1525,7 +1525,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const if (item) { total = item->HeroicDex; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicDex(); } @@ -1539,7 +1539,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const if (item) { total = item->HeroicAgi; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicAgi(); } @@ -1553,7 +1553,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const if (item) { total = item->HeroicInt; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicInt(); } @@ -1567,7 +1567,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const if (item) { total = item->HeroicWis; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicWis(); } @@ -1581,7 +1581,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const if (item) { total = item->HeroicCha; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCha(); } @@ -1595,7 +1595,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const if (item) { total = item->HeroicMR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicMR(); } @@ -1609,7 +1609,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const if (item) { total = item->HeroicFR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicFR(); } @@ -1623,7 +1623,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const if (item) { total = item->HeroicCR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCR(); } @@ -1637,7 +1637,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const if (item) { total = item->HeroicPR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicPR(); } @@ -1651,7 +1651,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const if (item) { total = item->HeroicDR; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicDR(); } @@ -1665,7 +1665,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const if (item) { total = item->HeroicSVCorrup; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCorrup(); } @@ -1679,7 +1679,7 @@ int EQEmu::ItemInstance::GetItemHaste(bool augments) const if (item) { total = item->Haste; if (augments) - for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) + for (int i = invaug::SOCKET_BEGIN; i <= invaug::SOCKET_END; ++i) if (GetAugment(i)) { int temp = GetAugment(i)->GetItemHaste(); if (temp > total) diff --git a/common/misc_functions.cpp b/common/misc_functions.cpp index e31da211f..a85ca9c2b 100644 --- a/common/misc_functions.cpp +++ b/common/misc_functions.cpp @@ -275,7 +275,7 @@ float EQHtoFloat(int d) } // returns a swapped-bit value for use in client translator and inventory functions -uint32 SwapBits21and22(uint32 mask) +uint32 SwapBits21And22(uint32 mask) { static const uint32 BIT21 = 1 << 21; static const uint32 BIT22 = 1 << 22; diff --git a/common/misc_functions.h b/common/misc_functions.h index 8214c7df0..2ead697e7 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -69,7 +69,7 @@ int FloatToEQSpeedRun(float d); // brings heading back into EQ angles range float FixHeading(float in); -uint32 SwapBits21and22(uint32 mask); +uint32 SwapBits21And22(uint32 mask); uint32 Catch22(uint32 mask); // macro to catch fp errors (provided by noudness) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 62ef6751a..4573b0cc7 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2338,12 +2338,12 @@ namespace RoF outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(profile::BandoliersSize); + outapp->WriteUInt32(profile::BANDOLIERS_SIZE); // Copy bandoliers where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { + for (uint32 r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); if (emu->bandoliers[r].Items[j].Icon) { @@ -2356,19 +2356,19 @@ namespace RoF } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { + for (uint32 r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) { outapp->WriteString(""); - for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); } } - outapp->WriteUInt32(profile::PotionBeltSize); + outapp->WriteUInt32(profile::POTION_BELT_SIZE); // Copy potion belt where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { + for (uint32 r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); if (emu->potionbelt.Items[r].Icon) { @@ -2380,7 +2380,7 @@ namespace RoF } } // Nullify potion belt where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { + for (uint32 r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) { outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); @@ -2501,9 +2501,9 @@ namespace RoF outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(EQEmu::legacy::TRIBUTE_SIZE); + outapp->WriteUInt32(EQEmu::invtype::TRIBUTE_SIZE); - for (uint32 r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) + for (uint32 r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { outapp->WriteUInt32(emu->tributes[r].tribute); outapp->WriteUInt32(emu->tributes[r].tier); @@ -2994,7 +2994,7 @@ namespace RoF size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < constants::SayLinkBodySize; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CHARACTER_CREATION_LIMIT; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -4811,7 +4811,7 @@ namespace RoF IN(item_id); int r; - for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { + for (r = EQEmu::invaug::SOCKET_BEGIN; r <= EQEmu::invaug::SOCKET_END; r++) { IN(augments[r]); } IN(link_hash); @@ -5205,7 +5205,7 @@ namespace RoF structs::InventorySlot_Struct slot_id = ServerToRoFSlot(slot_id_in); - hdr.slot_type = (inst->GetMerchantSlot() ? invtype::InvTypeMerchant : slot_id.Type); + hdr.slot_type = (inst->GetMerchantSlot() ? invtype::typeMerchant : slot_id.Type); hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot); hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex); hdr.aug_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.AugIndex); @@ -5299,7 +5299,7 @@ namespace RoF ibs.nodrop = item->NoDrop; ibs.attune = item->Attuneable; ibs.size = item->Size; - ibs.slots = SwapBits21and22(item->Slots); + ibs.slots = SwapBits21And22(item->Slots); ibs.price = item->Price; ibs.icon = item->Icon; ibs.unknown1 = 1; @@ -5393,7 +5393,7 @@ namespace RoF isbs.augdistiller = 65535; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < invaug::ItemAugSize; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -5603,18 +5603,18 @@ namespace RoF ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { + for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; - if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); - else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); - else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END) + SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1); + else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index); + else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -5640,17 +5640,17 @@ namespace RoF uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // Main Inventory and Cursor - RoFSlot.Type = invtype::InvTypePossessions; + if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // Main Inventory and Cursor + RoFSlot.Type = invtype::typePossessions; RoFSlot.Slot = serverSlot; - if (serverSlot == EQEmu::inventory::slotPowerSource) - RoFSlot.Slot = invslot::PossessionsPowerSource; + if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + RoFSlot.Slot = invslot::slotPowerSource; - else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::invslot::slotCursor) // Cursor and Extended Corpse Inventory RoFSlot.Slot += 3; - else if (serverSlot >= EQEmu::inventory::slotAmmo) // (> 20) + else if (serverSlot >= EQEmu::invslot::slotAmmo) // (> 20) RoFSlot.Slot += 1; } @@ -5659,51 +5659,51 @@ namespace RoF RoFSlot.MainSlot = ServerSlot - 31; }*/ - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341) - RoFSlot.Type = invtype::InvTypePossessions; + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) { // (> 250 && < 341) + RoFSlot.Type = invtype::typePossessions; TempSlot = serverSlot - 1; - RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::inventory::ContainerCount); + RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::invbag::SLOT_COUNT); - if (RoFSlot.Slot >= invslot::PossessionsGeneral9) // (> 30) - RoFSlot.Slot = invslot::PossessionsCursor; + if (RoFSlot.Slot >= invslot::slotGeneral9) // (> 30) + RoFSlot.Slot = invslot::slotCursor; } - else if (serverSlot >= EQEmu::legacy::TRIBUTE_BEGIN && serverSlot <= EQEmu::legacy::TRIBUTE_END) { // Tribute - RoFSlot.Type = invtype::InvTypeTribute; - RoFSlot.Slot = serverSlot - EQEmu::legacy::TRIBUTE_BEGIN; + else if (serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN && serverSlot <= EQEmu::invslot::TRIBUTE_END) { // Tribute + RoFSlot.Type = invtype::typeTribute; + RoFSlot.Slot = serverSlot - EQEmu::invslot::TRIBUTE_BEGIN; } - else if (serverSlot >= EQEmu::legacy::BANK_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) { - RoFSlot.Type = invtype::InvTypeBank; - TempSlot = serverSlot - EQEmu::legacy::BANK_BEGIN; + else if (serverSlot >= EQEmu::invslot::BANK_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) { + RoFSlot.Type = invtype::typeBank; + TempSlot = serverSlot - EQEmu::invslot::BANK_BEGIN; RoFSlot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount); + RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT); } } - else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - RoFSlot.Type = invtype::InvTypeSharedBank; - TempSlot = serverSlot - EQEmu::legacy::SHARED_BANK_BEGIN; + else if (serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) { + RoFSlot.Type = invtype::typeSharedBank; + TempSlot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN; RoFSlot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount); + RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT); } } - else if (serverSlot >= EQEmu::legacy::TRADE_BEGIN && serverSlot <= EQEmu::legacy::TRADE_BAGS_END) { - RoFSlot.Type = invtype::InvTypeTrade; - TempSlot = serverSlot - EQEmu::legacy::TRADE_BEGIN; + else if (serverSlot >= EQEmu::invslot::TRADE_BEGIN && serverSlot <= EQEmu::invbag::TRADE_BAGS_END) { + RoFSlot.Type = invtype::typeTrade; + TempSlot = serverSlot - EQEmu::invslot::TRADE_BEGIN; RoFSlot.Slot = TempSlot; if (TempSlot > 30) { - RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount); + RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT); } /* @@ -5720,9 +5720,9 @@ namespace RoF */ } - else if (serverSlot >= EQEmu::legacy::WORLD_BEGIN && serverSlot <= EQEmu::legacy::WORLD_END) { - RoFSlot.Type = invtype::InvTypeWorld; - TempSlot = serverSlot - EQEmu::legacy::WORLD_BEGIN; + else if (serverSlot >= EQEmu::invslot::WORLD_BEGIN && serverSlot <= EQEmu::invslot::WORLD_END) { + RoFSlot.Type = invtype::typeWorld; + TempSlot = serverSlot - EQEmu::invslot::WORLD_BEGIN; RoFSlot.Slot = TempSlot; } @@ -5741,16 +5741,16 @@ namespace RoF uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // (< 52) + if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // (< 52) RoFSlot.Slot = serverSlot; - if (serverSlot == EQEmu::inventory::slotPowerSource) - RoFSlot.Slot = invslot::PossessionsPowerSource; + if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + RoFSlot.Slot = invslot::slotPowerSource; - else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::invslot::slotCursor) // Cursor and Extended Corpse Inventory RoFSlot.Slot += 3; - else if (serverSlot >= EQEmu::inventory::slotAmmo) // Ammo and Personl Inventory + else if (serverSlot >= EQEmu::invslot::slotAmmo) // Ammo and Personl Inventory RoFSlot.Slot += 1; /*else if (ServerSlot >= MainCursor) { // Cursor @@ -5761,10 +5761,10 @@ namespace RoF }*/ } - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) { TempSlot = serverSlot - 1; - RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::inventory::ContainerCount); + RoFSlot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::invbag::SLOT_COUNT); } Log(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown01); @@ -5782,11 +5782,11 @@ namespace RoF uint32 ServerSlot = INVALID_INDEX; uint32 TempSlot = 0; - if (rofSlot.Type == invtype::InvTypePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) - if (rofSlot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::inventory::slotPowerSource; + if (rofSlot.Type == invtype::typePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) + if (rofSlot.Slot == invslot::slotPowerSource) + TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE; - else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory + else if (rofSlot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory TempSlot = rofSlot.Slot - 3; /*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory/corpse slots @@ -5800,23 +5800,23 @@ namespace RoF // For now, it's probably best to leave as-is and let this work itself out in the inventory rework. }*/ - else if (rofSlot.Slot >= invslot::PossessionsAmmo) // Ammo and Main Inventory + else if (rofSlot.Slot >= invslot::slotAmmo) // Ammo and Main Inventory TempSlot = rofSlot.Slot - 1; else // Worn Slots TempSlot = rofSlot.Slot; - if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1; ServerSlot = TempSlot; } - else if (rofSlot.Type == invtype::InvTypeBank) { - TempSlot = EQEmu::legacy::BANK_BEGIN; + else if (rofSlot.Type == invtype::typeBank) { + TempSlot = EQEmu::invslot::BANK_BEGIN; - if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) - TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) + TempSlot += ((rofSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1; else TempSlot += rofSlot.Slot; @@ -5824,11 +5824,11 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == invtype::InvTypeSharedBank) { - TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN; + else if (rofSlot.Type == invtype::typeSharedBank) { + TempSlot = EQEmu::invslot::SHARED_BANK_BEGIN; - if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) - TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) + TempSlot += ((rofSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1; else TempSlot += rofSlot.Slot; @@ -5836,11 +5836,11 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == invtype::InvTypeTrade) { - TempSlot = EQEmu::legacy::TRADE_BEGIN; + else if (rofSlot.Type == invtype::typeTrade) { + TempSlot = EQEmu::invslot::TRADE_BEGIN; - if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) - TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) + TempSlot += ((rofSlot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1; // OLD CODE: //TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::inventory::ContainerCount) + RoFSlot.SubSlot; @@ -5850,10 +5850,10 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == invtype::InvTypeWorld) { - TempSlot = EQEmu::legacy::WORLD_BEGIN; + else if (rofSlot.Type == invtype::typeWorld) { + TempSlot = EQEmu::invslot::WORLD_BEGIN; - if (rofSlot.Slot >= EQEmu::inventory::containerBegin) + if (rofSlot.Slot >= EQEmu::invbag::SLOT_BEGIN) TempSlot += rofSlot.Slot; ServerSlot = TempSlot; @@ -5868,7 +5868,7 @@ namespace RoF ServerSlot = TempSlot; }*/ - else if (rofSlot.Type == invtype::InvTypeGuildTribute) { + else if (rofSlot.Type == invtype::typeGuildTribute) { ServerSlot = INVALID_INDEX; } @@ -5883,10 +5883,10 @@ namespace RoF uint32 TempSlot = 0; if (rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33) - if (rofSlot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::inventory::slotPowerSource; + if (rofSlot.Slot == invslot::slotPowerSource) + TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE; - else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory + else if (rofSlot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory TempSlot = rofSlot.Slot - 3; /*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory slots @@ -5895,14 +5895,14 @@ namespace RoF // Same as above }*/ - else if (rofSlot.Slot >= invslot::PossessionsAmmo) // Main Inventory and Ammo Slots + else if (rofSlot.Slot >= invslot::slotAmmo) // Main Inventory and Ammo Slots TempSlot = rofSlot.Slot - 1; else TempSlot = rofSlot.Slot; - if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rofSlot.SubIndex + 1; ServerSlot = TempSlot; } @@ -5919,7 +5919,7 @@ namespace RoF static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink) { - if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) { + if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { rofSayLink = serverSayLink; return; } @@ -5928,7 +5928,7 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { rofSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -5958,7 +5958,7 @@ namespace RoF static inline void RoFToServerSayLink(std::string& serverSayLink, const std::string& rofSayLink) { - if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (rofSayLink.find('\x12') == std::string::npos)) { + if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (rofSayLink.find('\x12') == std::string::npos)) { serverSayLink = rofSayLink; return; } @@ -5967,7 +5967,7 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { serverSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 5a30c1695..5b7016d52 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2415,12 +2415,12 @@ namespace RoF2 outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(profile::BandoliersSize); + outapp->WriteUInt32(profile::BANDOLIERS_SIZE); // Copy bandoliers where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { + for (uint32 r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); if (emu->bandoliers[r].Items[j].Icon) { @@ -2433,19 +2433,19 @@ namespace RoF2 } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { + for (uint32 r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) { outapp->WriteString(""); - for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); } } - outapp->WriteUInt32(profile::PotionBeltSize); + outapp->WriteUInt32(profile::POTION_BELT_SIZE); // Copy potion belt where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { + for (uint32 r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); if (emu->potionbelt.Items[r].Icon) { @@ -2457,7 +2457,7 @@ namespace RoF2 } } // Nullify potion belt where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { + for (uint32 r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) { outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); @@ -2574,9 +2574,9 @@ namespace RoF2 outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(EQEmu::legacy::TRIBUTE_SIZE); + outapp->WriteUInt32(EQEmu::invtype::TRIBUTE_SIZE); - for (uint32 r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) + for (uint32 r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { outapp->WriteUInt32(emu->tributes[r].tribute); outapp->WriteUInt32(emu->tributes[r].tier); @@ -3081,7 +3081,7 @@ namespace RoF2 size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CHARACTER_CREATION_LIMIT; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -5051,7 +5051,7 @@ namespace RoF2 IN(item_id); int r; - for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { + for (r = EQEmu::invaug::SOCKET_BEGIN; r <= EQEmu::invaug::SOCKET_END; r++) { IN(augments[r]); } IN(link_hash); @@ -5500,7 +5500,7 @@ namespace RoF2 structs::InventorySlot_Struct slot_id = ServerToRoF2Slot(slot_id_in, packet_type); - hdr.slot_type = (inst->GetMerchantSlot() ? invtype::InvTypeMerchant : slot_id.Type); + hdr.slot_type = (inst->GetMerchantSlot() ? invtype::typeMerchant : slot_id.Type); hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot); hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex); hdr.aug_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.AugIndex); @@ -5594,7 +5594,7 @@ namespace RoF2 ibs.nodrop = item->NoDrop; ibs.attune = item->Attuneable; ibs.size = item->Size; - ibs.slots = SwapBits21and22(item->Slots); + ibs.slots = SwapBits21And22(item->Slots); ibs.price = item->Price; ibs.icon = item->Icon; ibs.unknown1 = 1; @@ -5688,7 +5688,7 @@ namespace RoF2 isbs.augrestrict2 = -1; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < invaug::ItemAugSize; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -5908,18 +5908,18 @@ namespace RoF2 ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { + for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; - if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); - else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); - else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END) + SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1); + else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index); + else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -5945,25 +5945,25 @@ namespace RoF2 uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // Main Inventory and Cursor + if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // Main Inventory and Cursor if (PacketType == ItemPacketLoot) { - RoF2Slot.Type = invtype::InvTypeCorpse; - RoF2Slot.Slot = serverSlot - EQEmu::legacy::CORPSE_BEGIN; + RoF2Slot.Type = invtype::typeCorpse; + RoF2Slot.Slot = serverSlot - EQEmu::invslot::CORPSE_BEGIN; } else { - RoF2Slot.Type = invtype::InvTypePossessions; + RoF2Slot.Type = invtype::typePossessions; RoF2Slot.Slot = serverSlot; } - if (serverSlot == EQEmu::inventory::slotPowerSource) - RoF2Slot.Slot = invslot::PossessionsPowerSource; + if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + RoF2Slot.Slot = invslot::slotPowerSource; - else if (serverSlot >= EQEmu::inventory::slotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::invslot::slotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory RoF2Slot.Slot += 3; - else if (serverSlot >= EQEmu::inventory::slotAmmo) // (> 20) + else if (serverSlot >= EQEmu::invslot::slotAmmo) // (> 20) RoF2Slot.Slot += 1; } @@ -5972,51 +5972,51 @@ namespace RoF2 RoF2Slot.MainSlot = ServerSlot - 31; }*/ - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341) - RoF2Slot.Type = invtype::InvTypePossessions; + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) { // (> 250 && < 341) + RoF2Slot.Type = invtype::typePossessions; TempSlot = serverSlot - 1; - RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::inventory::ContainerCount); + RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::invbag::SLOT_COUNT); - if (RoF2Slot.Slot >= invslot::PossessionsGeneral9) // (> 30) - RoF2Slot.Slot = invslot::PossessionsCursor; + if (RoF2Slot.Slot >= invslot::slotGeneral9) // (> 30) + RoF2Slot.Slot = invslot::slotCursor; } - else if (serverSlot >= EQEmu::legacy::TRIBUTE_BEGIN && serverSlot <= EQEmu::legacy::TRIBUTE_END) { // Tribute - RoF2Slot.Type = invtype::InvTypeTribute; - RoF2Slot.Slot = serverSlot - EQEmu::legacy::TRIBUTE_BEGIN; + else if (serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN && serverSlot <= EQEmu::invslot::TRIBUTE_END) { // Tribute + RoF2Slot.Type = invtype::typeTribute; + RoF2Slot.Slot = serverSlot - EQEmu::invslot::TRIBUTE_BEGIN; } - else if (serverSlot >= EQEmu::legacy::BANK_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) { - RoF2Slot.Type = invtype::InvTypeBank; - TempSlot = serverSlot - EQEmu::legacy::BANK_BEGIN; + else if (serverSlot >= EQEmu::invslot::BANK_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) { + RoF2Slot.Type = invtype::typeBank; + TempSlot = serverSlot - EQEmu::invslot::BANK_BEGIN; RoF2Slot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount); + RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT); } } - else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - RoF2Slot.Type = invtype::InvTypeSharedBank; - TempSlot = serverSlot - EQEmu::legacy::SHARED_BANK_BEGIN; + else if (serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) { + RoF2Slot.Type = invtype::typeSharedBank; + TempSlot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN; RoF2Slot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount); + RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT); } } - else if (serverSlot >= EQEmu::legacy::TRADE_BEGIN && serverSlot <= EQEmu::legacy::TRADE_BAGS_END) { - RoF2Slot.Type = invtype::InvTypeTrade; - TempSlot = serverSlot - EQEmu::legacy::TRADE_BEGIN; + else if (serverSlot >= EQEmu::invslot::TRADE_BEGIN && serverSlot <= EQEmu::invbag::TRADE_BAGS_END) { + RoF2Slot.Type = invtype::typeTrade; + TempSlot = serverSlot - EQEmu::invslot::TRADE_BEGIN; RoF2Slot.Slot = TempSlot; if (TempSlot > 30) { - RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount); + RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 3; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT); } /* @@ -6033,9 +6033,9 @@ namespace RoF2 */ } - else if (serverSlot >= EQEmu::legacy::WORLD_BEGIN && serverSlot <= EQEmu::legacy::WORLD_END) { - RoF2Slot.Type = invtype::InvTypeWorld; - TempSlot = serverSlot - EQEmu::legacy::WORLD_BEGIN; + else if (serverSlot >= EQEmu::invslot::WORLD_BEGIN && serverSlot <= EQEmu::invslot::WORLD_END) { + RoF2Slot.Type = invtype::typeWorld; + TempSlot = serverSlot - EQEmu::invslot::WORLD_BEGIN; RoF2Slot.Slot = TempSlot; } @@ -6054,16 +6054,16 @@ namespace RoF2 uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // (< 52) + if (serverSlot < 56 || serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) { // (< 52) RoF2Slot.Slot = serverSlot; - if (serverSlot == EQEmu::inventory::slotPowerSource) - RoF2Slot.Slot = invslot::PossessionsPowerSource; + if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + RoF2Slot.Slot = invslot::slotPowerSource; - else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::invslot::slotCursor) // Cursor and Extended Corpse Inventory RoF2Slot.Slot += 3; - else if (serverSlot >= EQEmu::inventory::slotAmmo) // Ammo and Personl Inventory + else if (serverSlot >= EQEmu::invslot::slotAmmo) // Ammo and Personl Inventory RoF2Slot.Slot += 1; /*else if (ServerSlot >= MainCursor) { // Cursor @@ -6074,10 +6074,10 @@ namespace RoF2 }*/ } - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) { TempSlot = serverSlot - 1; - RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::inventory::ContainerCount); + RoF2Slot.Slot = int(TempSlot / EQEmu::invbag::SLOT_COUNT) - 2; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::invbag::SLOT_COUNT); } Log(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown01); @@ -6087,7 +6087,7 @@ namespace RoF2 static inline uint32 ServerToRoF2CorpseSlot(uint32 serverCorpseSlot) { - return (serverCorpseSlot - EQEmu::legacy::CORPSE_BEGIN + 1); + return (serverCorpseSlot - EQEmu::invslot::CORPSE_BEGIN + 1); } static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot, ItemPacketType PacketType) @@ -6095,11 +6095,11 @@ namespace RoF2 uint32 ServerSlot = INVALID_INDEX; uint32 TempSlot = 0; - if (rof2Slot.Type == invtype::InvTypePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) - if (rof2Slot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::inventory::slotPowerSource; + if (rof2Slot.Type == invtype::typePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) + if (rof2Slot.Slot == invslot::slotPowerSource) + TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE; - else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory + else if (rof2Slot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory TempSlot = rof2Slot.Slot - 3; /*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory/corpse slots @@ -6113,23 +6113,23 @@ namespace RoF2 // For now, it's probably best to leave as-is and let this work itself out in the inventory rework. }*/ - else if (rof2Slot.Slot >= invslot::PossessionsAmmo) // Ammo and Main Inventory + else if (rof2Slot.Slot >= invslot::slotAmmo) // Ammo and Main Inventory TempSlot = rof2Slot.Slot - 1; else // Worn Slots TempSlot = rof2Slot.Slot; - if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1; ServerSlot = TempSlot; } - else if (rof2Slot.Type == invtype::InvTypeBank) { - TempSlot = EQEmu::legacy::BANK_BEGIN; + else if (rof2Slot.Type == invtype::typeBank) { + TempSlot = EQEmu::invslot::BANK_BEGIN; - if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) - TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) + TempSlot += ((rof2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1; else TempSlot += rof2Slot.Slot; @@ -6137,11 +6137,11 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == invtype::InvTypeSharedBank) { - TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN; + else if (rof2Slot.Type == invtype::typeSharedBank) { + TempSlot = EQEmu::invslot::SHARED_BANK_BEGIN; - if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) - TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) + TempSlot += ((rof2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1; else TempSlot += rof2Slot.Slot; @@ -6149,11 +6149,11 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == invtype::InvTypeTrade) { - TempSlot = EQEmu::legacy::TRADE_BEGIN; + else if (rof2Slot.Type == invtype::typeTrade) { + TempSlot = EQEmu::invslot::TRADE_BEGIN; - if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) - TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) + TempSlot += ((rof2Slot.Slot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1; // OLD CODE: //TempSlot += 100 + (RoF2Slot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot; @@ -6163,10 +6163,10 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == invtype::InvTypeWorld) { - TempSlot = EQEmu::legacy::WORLD_BEGIN; + else if (rof2Slot.Type == invtype::typeWorld) { + TempSlot = EQEmu::invslot::WORLD_BEGIN; - if (rof2Slot.Slot >= EQEmu::inventory::containerBegin) + if (rof2Slot.Slot >= EQEmu::invbag::SLOT_BEGIN) TempSlot += rof2Slot.Slot; ServerSlot = TempSlot; @@ -6181,12 +6181,12 @@ namespace RoF2 ServerSlot = TempSlot; }*/ - else if (rof2Slot.Type == invtype::InvTypeGuildTribute) { + else if (rof2Slot.Type == invtype::typeGuildTribute) { ServerSlot = INVALID_INDEX; } - else if (rof2Slot.Type == invtype::InvTypeCorpse) { - ServerSlot = rof2Slot.Slot + EQEmu::legacy::CORPSE_BEGIN; + else if (rof2Slot.Type == invtype::typeCorpse) { + ServerSlot = rof2Slot.Slot + EQEmu::invslot::CORPSE_BEGIN; } Log(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rof2Slot.Type, rof2Slot.Unknown02, rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown01, ServerSlot); @@ -6200,10 +6200,10 @@ namespace RoF2 uint32 TempSlot = 0; if (rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33) - if (rof2Slot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::inventory::slotPowerSource; + if (rof2Slot.Slot == invslot::slotPowerSource) + TempSlot = EQEmu::invslot::SLOT_POWER_SOURCE; - else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory + else if (rof2Slot.Slot >= invslot::slotCursor) // Cursor and Extended Corpse Inventory TempSlot = rof2Slot.Slot - 3; /*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory slots @@ -6212,14 +6212,14 @@ namespace RoF2 // Same as above }*/ - else if (rof2Slot.Slot >= invslot::PossessionsAmmo) // Main Inventory and Ammo Slots + else if (rof2Slot.Slot >= invslot::slotAmmo) // Main Inventory and Ammo Slots TempSlot = rof2Slot.Slot - 1; else TempSlot = rof2Slot.Slot; - if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::invbag::SLOT_BEGIN) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::invbag::SLOT_COUNT) + rof2Slot.SubIndex + 1; ServerSlot = TempSlot; } @@ -6231,12 +6231,12 @@ namespace RoF2 static inline uint32 RoF2ToServerCorpseSlot(uint32 rof2CorpseSlot) { - return (rof2CorpseSlot + EQEmu::legacy::CORPSE_BEGIN - 1); + return (rof2CorpseSlot + EQEmu::invslot::CORPSE_BEGIN - 1); } static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink) { - if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) { + if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { rof2SayLink = serverSayLink; return; } @@ -6245,7 +6245,7 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { rof2SayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -6268,7 +6268,7 @@ namespace RoF2 static inline void RoF2ToServerSayLink(std::string& serverSayLink, const std::string& rof2SayLink) { - if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (rof2SayLink.find('\x12') == std::string::npos)) { + if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (rof2SayLink.find('\x12') == std::string::npos)) { serverSayLink = rof2SayLink; return; } @@ -6277,7 +6277,7 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { serverSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/rof2_limits.cpp b/common/patches/rof2_limits.cpp index 85e15e21d..c67ccf3ad 100644 --- a/common/patches/rof2_limits.cpp +++ b/common/patches/rof2_limits.cpp @@ -22,231 +22,231 @@ #include "../string_util.h" -size_t RoF2::invtype::GetInvTypeSize(int inv_type) +int16 RoF2::invtype::GetInvTypeSize(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - return invtype::InvTypePossessionsSize; - case invtype::InvTypeBank: - return invtype::InvTypeBankSize; - case invtype::InvTypeSharedBank: - return invtype::InvTypeSharedBankSize; - case invtype::InvTypeTrade: - return invtype::InvTypeTradeSize; - case invtype::InvTypeWorld: - return invtype::InvTypeWorldSize; - case invtype::InvTypeLimbo: - return invtype::InvTypeLimboSize; - case invtype::InvTypeTribute: - return invtype::InvTypeTributeSize; - case invtype::InvTypeTrophyTribute: - return invtype::InvTypeTrophyTributeSize; - case invtype::InvTypeGuildTribute: - return invtype::InvTypeGuildTributeSize; - case invtype::InvTypeMerchant: - return invtype::InvTypeMerchantSize; - case invtype::InvTypeDeleted: - return invtype::InvTypeDeletedSize; - case invtype::InvTypeCorpse: - return invtype::InvTypeCorpseSize; - case invtype::InvTypeBazaar: - return invtype::InvTypeBazaarSize; - case invtype::InvTypeInspect: - return invtype::InvTypeInspectSize; - case invtype::InvTypeRealEstate: - return invtype::InvTypeRealEstateSize; - case invtype::InvTypeViewMODPC: - return invtype::InvTypeViewMODPCSize; - case invtype::InvTypeViewMODBank: - return invtype::InvTypeViewMODBankSize; - case invtype::InvTypeViewMODSharedBank: - return invtype::InvTypeViewMODSharedBankSize; - case invtype::InvTypeViewMODLimbo: - return invtype::InvTypeViewMODLimboSize; - case invtype::InvTypeAltStorage: - return invtype::InvTypeAltStorageSize; - case invtype::InvTypeArchived: - return invtype::InvTypeArchivedSize; - case invtype::InvTypeMail: - return invtype::InvTypeMailSize; - case invtype::InvTypeGuildTrophyTribute: - return invtype::InvTypeGuildTrophyTributeSize; - case invtype::InvTypeKrono: - return invtype::InvTypeKronoSize; - case invtype::InvTypeOther: - return invtype::InvTypeOtherSize; + case invtype::typePossessions: + return invtype::POSSESSIONS_SIZE; + case invtype::typeBank: + return invtype::BANK_SIZE; + case invtype::typeSharedBank: + return invtype::SHARED_BANK_SIZE; + case invtype::typeTrade: + return invtype::TRADE_SIZE; + case invtype::typeWorld: + return invtype::WORLD_SIZE; + case invtype::typeLimbo: + return invtype::LIMBO_SIZE; + case invtype::typeTribute: + return invtype::TRIBUTE_SIZE; + case invtype::typeTrophyTribute: + return invtype::TROPHY_TRIBUTE_SIZE; + case invtype::typeGuildTribute: + return invtype::GUILD_TRIBUTE_SIZE; + case invtype::typeMerchant: + return invtype::MERCHANT_SIZE; + case invtype::typeDeleted: + return invtype::DELETED_SIZE; + case invtype::typeCorpse: + return invtype::CORPSE_SIZE; + case invtype::typeBazaar: + return invtype::BAZAAR_SIZE; + case invtype::typeInspect: + return invtype::INSPECT_SIZE; + case invtype::typeRealEstate: + return invtype::REAL_ESTATE_SIZE; + case invtype::typeViewMODPC: + return invtype::VIEW_MOD_PC_SIZE; + case invtype::typeViewMODBank: + return invtype::VIEW_MOD_BANK_SIZE; + case invtype::typeViewMODSharedBank: + return invtype::VIEW_MOD_SHARED_BANK_SIZE; + case invtype::typeViewMODLimbo: + return invtype::VIEW_MOD_LIMBO_SIZE; + case invtype::typeAltStorage: + return invtype::ALT_STORAGE_SIZE; + case invtype::typeArchived: + return invtype::ARCHIVED_SIZE; + case invtype::typeMail: + return invtype::MAIL_SIZE; + case invtype::typeGuildTrophyTribute: + return invtype::GUILD_TROPHY_TRIBUTE_SIZE; + case invtype::typeKrono: + return invtype::KRONO_SIZE; + case invtype::typeOther: + return invtype::OTHER_SIZE; default: - return 0; + return INULL; } } -const char* RoF2::invtype::GetInvTypeName(int inv_type) +const char* RoF2::invtype::GetInvTypeName(int16 inv_type) { switch (inv_type) { - case invtype::InvTypeInvalid: + case invtype::TYPE_INVALID: return "Invalid Type"; - case invtype::InvTypePossessions: + case invtype::typePossessions: return "Possessions"; - case invtype::InvTypeBank: + case invtype::typeBank: return "Bank"; - case invtype::InvTypeSharedBank: + case invtype::typeSharedBank: return "Shared Bank"; - case invtype::InvTypeTrade: + case invtype::typeTrade: return "Trade"; - case invtype::InvTypeWorld: + case invtype::typeWorld: return "World"; - case invtype::InvTypeLimbo: + case invtype::typeLimbo: return "Limbo"; - case invtype::InvTypeTribute: + case invtype::typeTribute: return "Tribute"; - case invtype::InvTypeTrophyTribute: + case invtype::typeTrophyTribute: return "Trophy Tribute"; - case invtype::InvTypeGuildTribute: + case invtype::typeGuildTribute: return "Guild Tribute"; - case invtype::InvTypeMerchant: + case invtype::typeMerchant: return "Merchant"; - case invtype::InvTypeDeleted: + case invtype::typeDeleted: return "Deleted"; - case invtype::InvTypeCorpse: + case invtype::typeCorpse: return "Corpse"; - case invtype::InvTypeBazaar: + case invtype::typeBazaar: return "Bazaar"; - case invtype::InvTypeInspect: + case invtype::typeInspect: return "Inspect"; - case invtype::InvTypeRealEstate: + case invtype::typeRealEstate: return "Real Estate"; - case invtype::InvTypeViewMODPC: + case invtype::typeViewMODPC: return "View MOD PC"; - case invtype::InvTypeViewMODBank: + case invtype::typeViewMODBank: return "View MOD Bank"; - case invtype::InvTypeViewMODSharedBank: + case invtype::typeViewMODSharedBank: return "View MOD Shared Bank"; - case invtype::InvTypeViewMODLimbo: + case invtype::typeViewMODLimbo: return "View MOD Limbo"; - case invtype::InvTypeAltStorage: + case invtype::typeAltStorage: return "Alt Storage"; - case invtype::InvTypeArchived: + case invtype::typeArchived: return "Archived"; - case invtype::InvTypeMail: + case invtype::typeMail: return "Mail"; - case invtype::InvTypeGuildTrophyTribute: + case invtype::typeGuildTrophyTribute: return "Guild Trophy Tribute"; - case invtype::InvTypeKrono: + case invtype::typeKrono: return "Krono"; - case invtype::InvTypeOther: + case invtype::typeOther: return "Other"; default: return "Unknown Type"; } } -bool RoF2::invtype::IsInvTypePersistent(int inv_type) +bool RoF2::invtype::IsInvTypePersistent(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - case invtype::InvTypeBank: - case invtype::InvTypeSharedBank: - case invtype::InvTypeTrade: - case invtype::InvTypeWorld: - case invtype::InvTypeLimbo: - case invtype::InvTypeTribute: - case invtype::InvTypeTrophyTribute: - case invtype::InvTypeGuildTribute: + case invtype::typePossessions: + case invtype::typeBank: + case invtype::typeSharedBank: + case invtype::typeTrade: + case invtype::typeWorld: + case invtype::typeLimbo: + case invtype::typeTribute: + case invtype::typeTrophyTribute: + case invtype::typeGuildTribute: return true; default: return false; } } -const char* RoF2::invslot::GetInvPossessionsSlotName(int inv_slot) +const char* RoF2::invslot::GetInvPossessionsSlotName(int16 inv_slot) { switch (inv_slot) { - case invslot::InvSlotInvalid: + case invslot::SLOT_INVALID: return "Invalid Slot"; - case invslot::PossessionsCharm: + case invslot::slotCharm: return "Charm"; - case invslot::PossessionsEar1: + case invslot::slotEar1: return "Ear 1"; - case invslot::PossessionsHead: + case invslot::slotHead: return "Head"; - case invslot::PossessionsFace: + case invslot::slotFace: return "Face"; - case invslot::PossessionsEar2: + case invslot::slotEar2: return "Ear 2"; - case invslot::PossessionsNeck: + case invslot::slotNeck: return "Neck"; - case invslot::PossessionsShoulders: + case invslot::slotShoulders: return "Shoulders"; - case invslot::PossessionsArms: + case invslot::slotArms: return "Arms"; - case invslot::PossessionsBack: + case invslot::slotBack: return "Back"; - case invslot::PossessionsWrist1: + case invslot::slotWrist1: return "Wrist 1"; - case invslot::PossessionsWrist2: + case invslot::slotWrist2: return "Wrist 2"; - case invslot::PossessionsRange: + case invslot::slotRange: return "Range"; - case invslot::PossessionsHands: + case invslot::slotHands: return "Hands"; - case invslot::PossessionsPrimary: + case invslot::slotPrimary: return "Primary"; - case invslot::PossessionsSecondary: + case invslot::slotSecondary: return "Secondary"; - case invslot::PossessionsFinger1: + case invslot::slotFinger1: return "Finger 1"; - case invslot::PossessionsFinger2: + case invslot::slotFinger2: return "Finger 2"; - case invslot::PossessionsChest: + case invslot::slotChest: return "Chest"; - case invslot::PossessionsLegs: + case invslot::slotLegs: return "Legs"; - case invslot::PossessionsFeet: + case invslot::slotFeet: return "Feet"; - case invslot::PossessionsWaist: + case invslot::slotWaist: return "Waist"; - case invslot::PossessionsPowerSource: + case invslot::slotPowerSource: return "Power Source"; - case invslot::PossessionsAmmo: + case invslot::slotAmmo: return "Ammo"; - case invslot::PossessionsGeneral1: + case invslot::slotGeneral1: return "General 1"; - case invslot::PossessionsGeneral2: + case invslot::slotGeneral2: return "General 2"; - case invslot::PossessionsGeneral3: + case invslot::slotGeneral3: return "General 3"; - case invslot::PossessionsGeneral4: + case invslot::slotGeneral4: return "General 4"; - case invslot::PossessionsGeneral5: + case invslot::slotGeneral5: return "General 5"; - case invslot::PossessionsGeneral6: + case invslot::slotGeneral6: return "General 6"; - case invslot::PossessionsGeneral7: + case invslot::slotGeneral7: return "General 7"; - case invslot::PossessionsGeneral8: + case invslot::slotGeneral8: return "General 8"; - case invslot::PossessionsGeneral9: + case invslot::slotGeneral9: return "General 9"; - case invslot::PossessionsGeneral10: + case invslot::slotGeneral10: return "General 10"; - case invslot::PossessionsCursor: + case invslot::slotCursor: return "Cursor"; default: return "Unknown Slot"; } } -const char* RoF2::invslot::GetInvSlotName(int inv_type, int inv_slot) +const char* RoF2::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot) { - if (inv_type == invtype::InvTypePossessions) + if (inv_type == invtype::typePossessions) return invslot::GetInvPossessionsSlotName(inv_slot); - size_t type_size = invtype::GetInvTypeSize(inv_type); + int16 type_size = invtype::GetInvTypeSize(inv_type); - if (!type_size || inv_slot == invslot::InvSlotInvalid) + if (!type_size || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; - if ((size_t)(inv_slot + 1) >= type_size) + if ((inv_slot + 1) >= type_size) return "Unknown Slot"; static std::string ret_str; @@ -255,12 +255,12 @@ const char* RoF2::invslot::GetInvSlotName(int inv_type, int inv_slot) return ret_str.c_str(); } -const char* RoF2::invbag::GetInvBagIndexName(int bag_index) +const char* RoF2::invbag::GetInvBagIndexName(int16 bag_index) { - if (bag_index == invbag::InvBagInvalid) + if (bag_index == invbag::SLOT_INVALID) return "Invalid Bag"; - if ((size_t)bag_index >= invbag::ItemBagSize) + if (bag_index >= invbag::SLOT_COUNT) return "Unknown Bag"; static std::string ret_str; @@ -269,12 +269,12 @@ const char* RoF2::invbag::GetInvBagIndexName(int bag_index) return ret_str.c_str(); } -const char* RoF2::invaug::GetInvAugIndexName(int aug_index) +const char* RoF2::invaug::GetInvAugIndexName(int16 aug_index) { - if (aug_index == invaug::InvAugInvalid) + if (aug_index == invaug::SOCKET_INVALID) return "Invalid Augment"; - if ((size_t)aug_index >= invaug::ItemAugSize) + if (aug_index >= invaug::SOCKET_COUNT) return "Unknown Augment"; static std::string ret_str; diff --git a/common/patches/rof2_limits.h b/common/patches/rof2_limits.h index 0dd7067a9..96c231cf4 100644 --- a/common/patches/rof2_limits.h +++ b/common/patches/rof2_limits.h @@ -27,116 +27,191 @@ namespace RoF2 { - enum : int { Invalid = -1, Null, Safety }; + const int16 IINVALID = -1; + const int16 INULL = 0; - enum : bool { False = false, True = true }; - - // pre-declarations namespace inventory { inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::RoF2; } + const bool ConcatenateInvTypeLimbo = false; + + const bool AllowOverLevelEquipment = true; + + const bool AllowEmptyBagInBag = true; + const bool AllowClickCastFromBag = true; + } /*inventory*/ namespace invtype { inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::RoF2; } - enum : int { InvTypeInvalid = -1, InvTypeBegin }; + namespace enum_ { + enum InventoryTypes : int16 { + typePossessions = INULL, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, + typeTribute, + typeTrophyTribute, + typeGuildTribute, + typeMerchant, + typeDeleted, + typeCorpse, + typeBazaar, + typeInspect, + typeRealEstate, + typeViewMODPC, + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, + typeMail, + typeGuildTrophyTribute, + typeKrono, + typeOther + }; - enum InventoryType : int { - InvTypePossessions = InvTypeBegin, - InvTypeBank, - InvTypeSharedBank, - InvTypeTrade, - InvTypeWorld, - InvTypeLimbo, - InvTypeTribute, - InvTypeTrophyTribute, - InvTypeGuildTribute, - InvTypeMerchant, - InvTypeDeleted, - InvTypeCorpse, - InvTypeBazaar, - InvTypeInspect, - InvTypeRealEstate, - InvTypeViewMODPC, - InvTypeViewMODBank, - InvTypeViewMODSharedBank, - InvTypeViewMODLimbo, - InvTypeAltStorage, - InvTypeArchived, - InvTypeMail, - InvTypeGuildTrophyTribute, - InvTypeKrono, - InvTypeOther, - InvTypeCount - }; + } // namespace enum_ + using namespace enum_; + + const int16 POSSESSIONS_SIZE = 34; + const int16 BANK_SIZE = 24; + const int16 SHARED_BANK_SIZE = 2; + const int16 TRADE_SIZE = 8; + const int16 WORLD_SIZE = 10; + const int16 LIMBO_SIZE = 36; + const int16 TRIBUTE_SIZE = 5; + const int16 TROPHY_TRIBUTE_SIZE = 0;//unknown + const int16 GUILD_TRIBUTE_SIZE = 2;//unverified + const int16 MERCHANT_SIZE = 200; + const int16 DELETED_SIZE = 0;//unknown - "Recovery Tab" + const int16 CORPSE_SIZE = POSSESSIONS_SIZE; + const int16 BAZAAR_SIZE = 200; + const int16 INSPECT_SIZE = 23; + const int16 REAL_ESTATE_SIZE = 0;//unknown + const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE; + const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE; + const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE; + const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE; + const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank" + const int16 ARCHIVED_SIZE = 0;//unknown + const int16 MAIL_SIZE = 0;//unknown + const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown + const int16 KRONO_SIZE = 0;//unknown + const int16 OTHER_SIZE = 0;//unknown + + const int16 TRADE_NPC_SIZE = 4; // defined by implication + + const int16 TYPE_INVALID = IINVALID; + const int16 TYPE_BEGIN = typePossessions; + const int16 TYPE_END = typeOther; + const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1; + + int16 GetInvTypeSize(int16 inv_type); + const char* GetInvTypeName(int16 inv_type); + + bool IsInvTypePersistent(int16 inv_type); } /*invtype*/ namespace invslot { inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::RoF2; } - enum : int { InvSlotInvalid = -1, InvSlotBegin }; + namespace enum_ { + enum InventorySlots : int16 { + slotCharm = INULL, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, + slotPowerSource, + slotAmmo, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotGeneral9, + slotGeneral10, + slotCursor + }; - enum PossessionsSlot : int { - PossessionsCharm = InvSlotBegin, - PossessionsEar1, - PossessionsHead, - PossessionsFace, - PossessionsEar2, - PossessionsNeck, - PossessionsShoulders, - PossessionsArms, - PossessionsBack, - PossessionsWrist1, - PossessionsWrist2, - PossessionsRange, - PossessionsHands, - PossessionsPrimary, - PossessionsSecondary, - PossessionsFinger1, - PossessionsFinger2, - PossessionsChest, - PossessionsLegs, - PossessionsFeet, - PossessionsWaist, - PossessionsPowerSource, - PossessionsAmmo, - PossessionsGeneral1, - PossessionsGeneral2, - PossessionsGeneral3, - PossessionsGeneral4, - PossessionsGeneral5, - PossessionsGeneral6, - PossessionsGeneral7, - PossessionsGeneral8, - PossessionsGeneral9, - PossessionsGeneral10, - PossessionsCursor, - PossessionsCount - }; + } // namespace enum_ + using namespace enum_; - const int EquipmentBegin = PossessionsCharm; - const int EquipmentEnd = PossessionsAmmo; - const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; - const int GeneralBegin = PossessionsGeneral1; - const int GeneralEnd = PossessionsGeneral10; - const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + const int16 POSSESSIONS_BEGIN = slotCharm; + const int16 POSSESSIONS_END = slotCursor; + const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1; + + const int16 EQUIPMENT_BEGIN = slotCharm; + const int16 EQUIPMENT_END = slotAmmo; + const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN) + 1; + + const int16 GENERAL_BEGIN = slotGeneral1; + const int16 GENERAL_END = slotGeneral10; + const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN) + 1; + + const int16 BONUS_BEGIN = invslot::slotCharm; + const int16 BONUS_STAT_END = invslot::slotPowerSource; + const int16 BONUS_SKILL_END = invslot::slotAmmo; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor; + + const uint64 POSSESSIONS_BITMASK = 0x00000003FFFFFFFF; // based on 34-slot count (RoF+) + const uint64 CORPSE_BITMASK = 0x01FFFFFFFF800000; // based on 34-slot count (RoF+) + + const char* GetInvPossessionsSlotName(int16 inv_slot); + const char* GetInvSlotName(int16 inv_type, int16 inv_slot); } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::RoF2; } - enum : int { InvBagInvalid = -1, InvBagBegin }; + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; + const int16 SLOT_END = 9; //254; + const int16 SLOT_COUNT = 10; //255; // server Size will be 255..unsure what actual client is (test) + + const char* GetInvBagIndexName(int16 bag_index); } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::RoF2; } - enum : int { InvAugInvalid = -1, InvAugBegin }; + const int16 SOCKET_INVALID = IINVALID; + const int16 SOCKET_BEGIN = INULL; + const int16 SOCKET_END = 5; + const int16 SOCKET_COUNT = 6; + + const char* GetInvAugIndexName(int16 aug_index); } /*invaug*/ @@ -172,110 +247,21 @@ namespace RoF2 namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::RoF2; } + const int16 BANDOLIERS_SIZE = 20; // number of bandolier instances + const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + const int16 POTION_BELT_SIZE = 5; + + const int16 SKILL_ARRAY_SIZE = 100; + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::RoF2; } - } /*constants*/ + const size_t CHARACTER_CREATION_LIMIT = 12; - namespace behavior { - inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::RoF2; } - - } /*behavior*/ - - namespace skills { - inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF2; } - - } /*skills*/ - - - // declarations - namespace inventory { - const bool ConcatenateInvTypeLimbo = false; - - const bool AllowOverLevelEquipment = true; - - const bool AllowEmptyBagInBag = true; - const bool AllowClickCastFromBag = true; - - } /*inventory*/ - - namespace invtype { - const size_t InvTypePossessionsSize = invslot::PossessionsCount; - const size_t InvTypeBankSize = 24; - const size_t InvTypeSharedBankSize = 2; - const size_t InvTypeTradeSize = 8; - const size_t InvTypeWorldSize = 10; - const size_t InvTypeLimboSize = 36; - const size_t InvTypeTributeSize = 5; - const size_t InvTypeTrophyTributeSize = 0;//unknown - const size_t InvTypeGuildTributeSize = 2;//unverified - const size_t InvTypeMerchantSize = 200; - const size_t InvTypeDeletedSize = 0;//unknown - "Recovery Tab" - const size_t InvTypeCorpseSize = InvTypePossessionsSize; - const size_t InvTypeBazaarSize = 200; - const size_t InvTypeInspectSize = invslot::EquipmentCount; - const size_t InvTypeRealEstateSize = 0;//unknown - const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; - const size_t InvTypeViewMODBankSize = InvTypeBankSize; - const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; - const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; - const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" - const size_t InvTypeArchivedSize = 0;//unknown - const size_t InvTypeMailSize = 0;//unknown - const size_t InvTypeGuildTrophyTributeSize = 0;//unknown - const size_t InvTypeKronoSize = 0;//unknown - const size_t InvTypeOtherSize = 0;//unknown - - extern size_t GetInvTypeSize(int inv_type); - extern const char* GetInvTypeName(int inv_type); - - extern bool IsInvTypePersistent(int inv_type); - - } /*invtype*/ - - namespace invslot { - extern const char* GetInvPossessionsSlotName(int inv_slot); - extern const char* GetInvSlotName(int inv_type, int inv_slot); - - } /*invslot*/ - - namespace invbag { - const size_t ItemBagSize = 255; // server Size will be 255..unsure what actual client is (test) - - extern const char* GetInvBagIndexName(int bag_index); - - } /*invbag*/ - - namespace invaug { - const size_t ItemAugSize = 6; - - extern const char* GetInvAugIndexName(int aug_index); - - } /*invaug*/ - - namespace item { - - } /*item*/ - - namespace profile { - const size_t TributeSize = invtype::InvTypeTributeSize; - const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize; - - const size_t BandoliersSize = 20; // number of bandolier instances - const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance - - const size_t PotionBeltSize = 5; - - const size_t SkillArraySize = 100; - - } /*profile*/ - - namespace constants { - const size_t CharacterCreationLimit = 12; - - const size_t SayLinkBodySize = 56; + const size_t SAY_LINK_BODY_SIZE = 56; const int LongBuffs = 42; const int ShortBuffs = 20; @@ -288,11 +274,15 @@ namespace RoF2 } /*constants*/ namespace behavior { + inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::RoF2; } + const bool CoinHasWeight = false; } /*behavior*/ namespace skills { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF2; } + const size_t LastUsableSkill = EQEmu::skills::Skill2HPiercing; } /*skills*/ diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 13ce49f6e..f53675f83 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -957,13 +957,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; struct PotionBeltItem_Struct @@ -983,12 +983,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[profile::PotionBeltSize]; + PotionBeltItem_Struct Items[profile::POTION_BELT_SIZE]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[profile::PotionBeltSize]; + PotionBeltItem_Struct_Old Items[profile::POTION_BELT_SIZE]; }; struct GroupLeadershipAA_Struct { @@ -1198,7 +1198,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 -/*12959*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*12959*/ Bandolier_Struct bandoliers[profile::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/rof_limits.cpp b/common/patches/rof_limits.cpp index c78ffc59d..6c30b85f7 100644 --- a/common/patches/rof_limits.cpp +++ b/common/patches/rof_limits.cpp @@ -22,227 +22,227 @@ #include "../string_util.h" -size_t RoF::invtype::GetInvTypeSize(int inv_type) +int16 RoF::invtype::GetInvTypeSize(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - return invtype::InvTypePossessionsSize; - case invtype::InvTypeBank: - return invtype::InvTypeBankSize; - case invtype::InvTypeSharedBank: - return invtype::InvTypeSharedBankSize; - case invtype::InvTypeTrade: - return invtype::InvTypeTradeSize; - case invtype::InvTypeWorld: - return invtype::InvTypeWorldSize; - case invtype::InvTypeLimbo: - return invtype::InvTypeLimboSize; - case invtype::InvTypeTribute: - return invtype::InvTypeTributeSize; - case invtype::InvTypeTrophyTribute: - return invtype::InvTypeTrophyTributeSize; - case invtype::InvTypeGuildTribute: - return invtype::InvTypeGuildTributeSize; - case invtype::InvTypeMerchant: - return invtype::InvTypeMerchantSize; - case invtype::InvTypeDeleted: - return invtype::InvTypeDeletedSize; - case invtype::InvTypeCorpse: - return invtype::InvTypeCorpseSize; - case invtype::InvTypeBazaar: - return invtype::InvTypeBazaarSize; - case invtype::InvTypeInspect: - return invtype::InvTypeInspectSize; - case invtype::InvTypeRealEstate: - return invtype::InvTypeRealEstateSize; - case invtype::InvTypeViewMODPC: - return invtype::InvTypeViewMODPCSize; - case invtype::InvTypeViewMODBank: - return invtype::InvTypeViewMODBankSize; - case invtype::InvTypeViewMODSharedBank: - return invtype::InvTypeViewMODSharedBankSize; - case invtype::InvTypeViewMODLimbo: - return invtype::InvTypeViewMODLimboSize; - case invtype::InvTypeAltStorage: - return invtype::InvTypeAltStorageSize; - case invtype::InvTypeArchived: - return invtype::InvTypeArchivedSize; - case invtype::InvTypeMail: - return invtype::InvTypeMailSize; - case invtype::InvTypeGuildTrophyTribute: - return invtype::InvTypeGuildTrophyTributeSize; - case invtype::InvTypeOther: - return invtype::InvTypeOtherSize; + case invtype::typePossessions: + return invtype::POSSESSIONS_SIZE; + case invtype::typeBank: + return invtype::BANK_SIZE; + case invtype::typeSharedBank: + return invtype::SHARED_BANK_SIZE; + case invtype::typeTrade: + return invtype::TRADE_SIZE; + case invtype::typeWorld: + return invtype::WORLD_SIZE; + case invtype::typeLimbo: + return invtype::LIMBO_SIZE; + case invtype::typeTribute: + return invtype::TRIBUTE_SIZE; + case invtype::typeTrophyTribute: + return invtype::TROPHY_TRIBUTE_SIZE; + case invtype::typeGuildTribute: + return invtype::GUILD_TRIBUTE_SIZE; + case invtype::typeMerchant: + return invtype::MERCHANT_SIZE; + case invtype::typeDeleted: + return invtype::DELETED_SIZE; + case invtype::typeCorpse: + return invtype::CORPSE_SIZE; + case invtype::typeBazaar: + return invtype::BAZAAR_SIZE; + case invtype::typeInspect: + return invtype::INSPECT_SIZE; + case invtype::typeRealEstate: + return invtype::REAL_ESTATE_SIZE; + case invtype::typeViewMODPC: + return invtype::VIEW_MOD_PC_SIZE; + case invtype::typeViewMODBank: + return invtype::VIEW_MOD_BANK_SIZE; + case invtype::typeViewMODSharedBank: + return invtype::VIEW_MOD_SHARED_BANK_SIZE; + case invtype::typeViewMODLimbo: + return invtype::VIEW_MOD_LIMBO_SIZE; + case invtype::typeAltStorage: + return invtype::ALT_STORAGE_SIZE; + case invtype::typeArchived: + return invtype::ARCHIVED_SIZE; + case invtype::typeMail: + return invtype::MAIL_SIZE; + case invtype::typeGuildTrophyTribute: + return invtype::GUILD_TROPHY_TRIBUTE_SIZE; + case invtype::typeOther: + return invtype::OTHER_SIZE; default: - return 0; + return INULL; } } -const char* RoF::invtype::GetInvTypeName(int inv_type) +const char* RoF::invtype::GetInvTypeName(int16 inv_type) { switch (inv_type) { - case invtype::InvTypeInvalid: + case invtype::TYPE_INVALID: return "Invalid Type"; - case invtype::InvTypePossessions: + case invtype::typePossessions: return "Possessions"; - case invtype::InvTypeBank: + case invtype::typeBank: return "Bank"; - case invtype::InvTypeSharedBank: + case invtype::typeSharedBank: return "Shared Bank"; - case invtype::InvTypeTrade: + case invtype::typeTrade: return "Trade"; - case invtype::InvTypeWorld: + case invtype::typeWorld: return "World"; - case invtype::InvTypeLimbo: + case invtype::typeLimbo: return "Limbo"; - case invtype::InvTypeTribute: + case invtype::typeTribute: return "Tribute"; - case invtype::InvTypeTrophyTribute: + case invtype::typeTrophyTribute: return "Trophy Tribute"; - case invtype::InvTypeGuildTribute: + case invtype::typeGuildTribute: return "Guild Tribute"; - case invtype::InvTypeMerchant: + case invtype::typeMerchant: return "Merchant"; - case invtype::InvTypeDeleted: + case invtype::typeDeleted: return "Deleted"; - case invtype::InvTypeCorpse: + case invtype::typeCorpse: return "Corpse"; - case invtype::InvTypeBazaar: + case invtype::typeBazaar: return "Bazaar"; - case invtype::InvTypeInspect: + case invtype::typeInspect: return "Inspect"; - case invtype::InvTypeRealEstate: + case invtype::typeRealEstate: return "Real Estate"; - case invtype::InvTypeViewMODPC: + case invtype::typeViewMODPC: return "View MOD PC"; - case invtype::InvTypeViewMODBank: + case invtype::typeViewMODBank: return "View MOD Bank"; - case invtype::InvTypeViewMODSharedBank: + case invtype::typeViewMODSharedBank: return "View MOD Shared Bank"; - case invtype::InvTypeViewMODLimbo: + case invtype::typeViewMODLimbo: return "View MOD Limbo"; - case invtype::InvTypeAltStorage: + case invtype::typeAltStorage: return "Alt Storage"; - case invtype::InvTypeArchived: + case invtype::typeArchived: return "Archived"; - case invtype::InvTypeMail: + case invtype::typeMail: return "Mail"; - case invtype::InvTypeGuildTrophyTribute: + case invtype::typeGuildTrophyTribute: return "Guild Trophy Tribute"; - case invtype::InvTypeOther: + case invtype::typeOther: return "Other"; default: return "Unknown Type"; } } -bool RoF::invtype::IsInvTypePersistent(int inv_type) +bool RoF::invtype::IsInvTypePersistent(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - case invtype::InvTypeBank: - case invtype::InvTypeSharedBank: - case invtype::InvTypeTrade: - case invtype::InvTypeWorld: - case invtype::InvTypeLimbo: - case invtype::InvTypeTribute: - case invtype::InvTypeTrophyTribute: - case invtype::InvTypeGuildTribute: + case invtype::typePossessions: + case invtype::typeBank: + case invtype::typeSharedBank: + case invtype::typeTrade: + case invtype::typeWorld: + case invtype::typeLimbo: + case invtype::typeTribute: + case invtype::typeTrophyTribute: + case invtype::typeGuildTribute: return true; default: return false; } } -const char* RoF::invslot::GetInvPossessionsSlotName(int inv_slot) +const char* RoF::invslot::GetInvPossessionsSlotName(int16 inv_slot) { switch (inv_slot) { - case invslot::InvSlotInvalid: + case invslot::SLOT_INVALID: return "Invalid Slot"; - case invslot::PossessionsCharm: + case invslot::slotCharm: return "Charm"; - case invslot::PossessionsEar1: + case invslot::slotEar1: return "Ear 1"; - case invslot::PossessionsHead: + case invslot::slotHead: return "Head"; - case invslot::PossessionsFace: + case invslot::slotFace: return "Face"; - case invslot::PossessionsEar2: + case invslot::slotEar2: return "Ear 2"; - case invslot::PossessionsNeck: + case invslot::slotNeck: return "Neck"; - case invslot::PossessionsShoulders: + case invslot::slotShoulders: return "Shoulders"; - case invslot::PossessionsArms: + case invslot::slotArms: return "Arms"; - case invslot::PossessionsBack: + case invslot::slotBack: return "Back"; - case invslot::PossessionsWrist1: + case invslot::slotWrist1: return "Wrist 1"; - case invslot::PossessionsWrist2: + case invslot::slotWrist2: return "Wrist 2"; - case invslot::PossessionsRange: + case invslot::slotRange: return "Range"; - case invslot::PossessionsHands: + case invslot::slotHands: return "Hands"; - case invslot::PossessionsPrimary: + case invslot::slotPrimary: return "Primary"; - case invslot::PossessionsSecondary: + case invslot::slotSecondary: return "Secondary"; - case invslot::PossessionsFinger1: + case invslot::slotFinger1: return "Finger 1"; - case invslot::PossessionsFinger2: + case invslot::slotFinger2: return "Finger 2"; - case invslot::PossessionsChest: + case invslot::slotChest: return "Chest"; - case invslot::PossessionsLegs: + case invslot::slotLegs: return "Legs"; - case invslot::PossessionsFeet: + case invslot::slotFeet: return "Feet"; - case invslot::PossessionsWaist: + case invslot::slotWaist: return "Waist"; - case invslot::PossessionsPowerSource: + case invslot::slotPowerSource: return "Power Source"; - case invslot::PossessionsAmmo: + case invslot::slotAmmo: return "Ammo"; - case invslot::PossessionsGeneral1: + case invslot::slotGeneral1: return "General 1"; - case invslot::PossessionsGeneral2: + case invslot::slotGeneral2: return "General 2"; - case invslot::PossessionsGeneral3: + case invslot::slotGeneral3: return "General 3"; - case invslot::PossessionsGeneral4: + case invslot::slotGeneral4: return "General 4"; - case invslot::PossessionsGeneral5: + case invslot::slotGeneral5: return "General 5"; - case invslot::PossessionsGeneral6: + case invslot::slotGeneral6: return "General 6"; - case invslot::PossessionsGeneral7: + case invslot::slotGeneral7: return "General 7"; - case invslot::PossessionsGeneral8: + case invslot::slotGeneral8: return "General 8"; - case invslot::PossessionsGeneral9: + case invslot::slotGeneral9: return "General 9"; - case invslot::PossessionsGeneral10: + case invslot::slotGeneral10: return "General 10"; - case invslot::PossessionsCursor: + case invslot::slotCursor: return "Cursor"; default: return "Unknown Slot"; } } -const char* RoF::invslot::GetInvSlotName(int inv_type, int inv_slot) +const char* RoF::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot) { - if (inv_type == invtype::InvTypePossessions) + if (inv_type == invtype::typePossessions) return invslot::GetInvPossessionsSlotName(inv_slot); - size_t type_size = invtype::GetInvTypeSize(inv_type); + int16 type_size = invtype::GetInvTypeSize(inv_type); - if (!type_size || inv_slot == invslot::InvSlotInvalid) + if (!type_size || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; - if ((size_t)(inv_slot + 1) >= type_size) + if ((inv_slot + 1) >= type_size) return "Unknown Slot"; static std::string ret_str; @@ -251,12 +251,12 @@ const char* RoF::invslot::GetInvSlotName(int inv_type, int inv_slot) return ret_str.c_str(); } -const char* RoF::invbag::GetInvBagIndexName(int bag_index) +const char* RoF::invbag::GetInvBagIndexName(int16 bag_index) { - if (bag_index == invbag::InvBagInvalid) + if (bag_index == invbag::SLOT_INVALID) return "Invalid Bag"; - if ((size_t)bag_index >= invbag::ItemBagSize) + if (bag_index >= invbag::SLOT_COUNT) return "Unknown Bag"; static std::string ret_str; @@ -265,12 +265,12 @@ const char* RoF::invbag::GetInvBagIndexName(int bag_index) return ret_str.c_str(); } -const char* RoF::invaug::GetInvAugIndexName(int aug_index) +const char* RoF::invaug::GetInvAugIndexName(int16 aug_index) { - if (aug_index == invaug::InvAugInvalid) + if (aug_index == invaug::SOCKET_INVALID) return "Invalid Augment"; - if ((size_t)aug_index >= invaug::ItemAugSize) + if (aug_index >= invaug::SOCKET_COUNT) return "Unknown Augment"; static std::string ret_str; diff --git a/common/patches/rof_limits.h b/common/patches/rof_limits.h index 952d14b20..69db29f8f 100644 --- a/common/patches/rof_limits.h +++ b/common/patches/rof_limits.h @@ -27,115 +27,189 @@ namespace RoF { - enum : int { Invalid = -1, Null, Safety }; + const int16 IINVALID = -1; + const int16 INULL = 0; - enum : bool { False = false, True = true }; - - // pre-declarations namespace inventory { inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::RoF; } + const bool ConcatenateInvTypeLimbo = false; + + const bool AllowOverLevelEquipment = true; + + const bool AllowEmptyBagInBag = true; + const bool AllowClickCastFromBag = true; + } /*inventory*/ namespace invtype { inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::RoF; } - enum : int { InvTypeInvalid = -1, InvTypeBegin }; + namespace enum_ { + enum InventoryTypes : int16 { + typePossessions = INULL, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, + typeTribute, + typeTrophyTribute, + typeGuildTribute, + typeMerchant, + typeDeleted, + typeCorpse, + typeBazaar, + typeInspect, + typeRealEstate, + typeViewMODPC, + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, + typeMail, + typeGuildTrophyTribute, + typeOther + }; - enum InventoryType : int { - InvTypePossessions = InvTypeBegin, - InvTypeBank, - InvTypeSharedBank, - InvTypeTrade, - InvTypeWorld, - InvTypeLimbo, - InvTypeTribute, - InvTypeTrophyTribute, - InvTypeGuildTribute, - InvTypeMerchant, - InvTypeDeleted, - InvTypeCorpse, - InvTypeBazaar, - InvTypeInspect, - InvTypeRealEstate, - InvTypeViewMODPC, - InvTypeViewMODBank, - InvTypeViewMODSharedBank, - InvTypeViewMODLimbo, - InvTypeAltStorage, - InvTypeArchived, - InvTypeMail, - InvTypeGuildTrophyTribute, - InvTypeOther, - InvTypeCount - }; + } // namespace enum_ + using namespace enum_; + + const int16 POSSESSIONS_SIZE = 34; + const int16 BANK_SIZE = 24; + const int16 SHARED_BANK_SIZE = 2; + const int16 TRADE_SIZE = 8; + const int16 WORLD_SIZE = 10; + const int16 LIMBO_SIZE = 36; + const int16 TRIBUTE_SIZE = 5; + const int16 TROPHY_TRIBUTE_SIZE = 0;//unknown + const int16 GUILD_TRIBUTE_SIZE = 2;//unverified + const int16 MERCHANT_SIZE = 200; + const int16 DELETED_SIZE = 0;//unknown - "Recovery Tab" + const int16 CORPSE_SIZE = POSSESSIONS_SIZE; + const int16 BAZAAR_SIZE = 200; + const int16 INSPECT_SIZE = 23; + const int16 REAL_ESTATE_SIZE = 0;//unknown + const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE; + const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE; + const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE; + const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE; + const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank" + const int16 ARCHIVED_SIZE = 0;//unknown + const int16 MAIL_SIZE = 0;//unknown + const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown + const int16 OTHER_SIZE = 0;//unknown + + const int16 TRADE_NPC_SIZE = 4; // defined by implication + + const int16 TYPE_INVALID = IINVALID; + const int16 TYPE_BEGIN = typePossessions; + const int16 TYPE_END = typeOther; + const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1; + + int16 GetInvTypeSize(int16 inv_type); + const char* GetInvTypeName(int16 inv_type); + + bool IsInvTypePersistent(int16 inv_type); } /*invtype*/ namespace invslot { inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::RoF; } - enum : int { InvSlotInvalid = -1, InvSlotBegin }; + namespace enum_ { + enum InventorySlots : int16 { + slotCharm = INULL, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, + slotPowerSource, + slotAmmo, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotGeneral9, + slotGeneral10, + slotCursor + }; - enum PossessionsSlot : int { - PossessionsCharm = InvSlotBegin, - PossessionsEar1, - PossessionsHead, - PossessionsFace, - PossessionsEar2, - PossessionsNeck, - PossessionsShoulders, - PossessionsArms, - PossessionsBack, - PossessionsWrist1, - PossessionsWrist2, - PossessionsRange, - PossessionsHands, - PossessionsPrimary, - PossessionsSecondary, - PossessionsFinger1, - PossessionsFinger2, - PossessionsChest, - PossessionsLegs, - PossessionsFeet, - PossessionsWaist, - PossessionsPowerSource, - PossessionsAmmo, - PossessionsGeneral1, - PossessionsGeneral2, - PossessionsGeneral3, - PossessionsGeneral4, - PossessionsGeneral5, - PossessionsGeneral6, - PossessionsGeneral7, - PossessionsGeneral8, - PossessionsGeneral9, - PossessionsGeneral10, - PossessionsCursor, - PossessionsCount - }; + } // namespace enum_ + using namespace enum_; - const int EquipmentBegin = PossessionsCharm; - const int EquipmentEnd = PossessionsAmmo; - const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; - const int GeneralBegin = PossessionsGeneral1; - const int GeneralEnd = PossessionsGeneral10; - const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + const int16 POSSESSIONS_BEGIN = slotCharm; + const int16 POSSESSIONS_END = slotCursor; + const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1; + + const int16 EQUIPMENT_BEGIN = slotCharm; + const int16 EQUIPMENT_END = slotAmmo; + const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN + 1); + + const int16 GENERAL_BEGIN = slotGeneral1; + const int16 GENERAL_END = slotGeneral10; + const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN + 1); + + const int16 BONUS_BEGIN = invslot::slotCharm; + const int16 BONUS_STAT_END = invslot::slotPowerSource; + const int16 BONUS_SKILL_END = invslot::slotAmmo; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor; + + const uint64 POSSESSIONS_BITMASK = 0x00000003FFFFFFFF; // based on 34-slot count (RoF+) + const uint64 CORPSE_BITMASK = 0x01FFFFFFFF800000; // based on 34-slot count (RoF+) + + const char* GetInvPossessionsSlotName(int16 inv_slot); + const char* GetInvSlotName(int16 inv_type, int16 inv_slot); } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::RoF; } - enum : int { InvBagInvalid = -1, InvBagBegin }; + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; + const int16 SLOT_END = 9; //254; + const int16 SLOT_COUNT = 10; //255; // server Size will be 255..unsure what actual client is (test) + + const char* GetInvBagIndexName(int16 bag_index); } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::RoF; } - enum : int { InvAugInvalid = -1, InvAugBegin }; + const int16 SOCKET_INVALID = IINVALID; + const int16 SOCKET_BEGIN = INULL; + const int16 SOCKET_END = 5; + const int16 SOCKET_COUNT = 6; + + const char* GetInvAugIndexName(int16 aug_index); } /*invaug*/ @@ -164,109 +238,21 @@ namespace RoF namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::RoF; } + const int16 BANDOLIERS_SIZE = 20; // number of bandolier instances + const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + const int16 POTION_BELT_SIZE = 5; + + const int16 SKILL_ARRAY_SIZE = 100; + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::RoF; } - } /*constants*/ + const size_t CHARACTER_CREATION_LIMIT = 12; - namespace behavior { - inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::RoF; } - - } /*behavior*/ - - namespace skills { - inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF; } - - } /*skills*/ - - - // declarations - namespace inventory { - const bool ConcatenateInvTypeLimbo = false; - - const bool AllowOverLevelEquipment = true; - - const bool AllowEmptyBagInBag = true; - const bool AllowClickCastFromBag = true; - - } /*inventory*/ - - namespace invtype { - const size_t InvTypePossessionsSize = invslot::PossessionsCount; - const size_t InvTypeBankSize = 24; - const size_t InvTypeSharedBankSize = 2; - const size_t InvTypeTradeSize = 8; - const size_t InvTypeWorldSize = 10; - const size_t InvTypeLimboSize = 36; - const size_t InvTypeTributeSize = 5; - const size_t InvTypeTrophyTributeSize = 0;//unknown - const size_t InvTypeGuildTributeSize = 2;//unverified - const size_t InvTypeMerchantSize = 200; - const size_t InvTypeDeletedSize = 0;//unknown - "Recovery Tab" - const size_t InvTypeCorpseSize = InvTypePossessionsSize; - const size_t InvTypeBazaarSize = 200; - const size_t InvTypeInspectSize = invslot::EquipmentCount; - const size_t InvTypeRealEstateSize = 0;//unknown - const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; - const size_t InvTypeViewMODBankSize = InvTypeBankSize; - const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; - const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; - const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" - const size_t InvTypeArchivedSize = 0;//unknown - const size_t InvTypeMailSize = 0;//unknown - const size_t InvTypeGuildTrophyTributeSize = 0;//unknown - const size_t InvTypeOtherSize = 0;//unknown - - extern size_t GetInvTypeSize(int inv_type); - extern const char* GetInvTypeName(int inv_type); - - extern bool IsInvTypePersistent(int inv_type); - - } /*invtype*/ - - namespace invslot { - extern const char* GetInvPossessionsSlotName(int inv_slot); - extern const char* GetInvSlotName(int inv_type, int inv_slot); - - } /*invslot*/ - - namespace invbag { - const size_t ItemBagSize = 255; // server Size will be 255..unsure what actual client is (test) - - extern const char* GetInvBagIndexName(int bag_index); - - } /*invbag*/ - - namespace invaug { - const size_t ItemAugSize = 6; - - extern const char* GetInvAugIndexName(int aug_index); - - } /*invaug*/ - - namespace item { - - } /*item*/ - - namespace profile { - const size_t TributeSize = invtype::InvTypeTributeSize; - const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize; - - const size_t BandoliersSize = 20; // number of bandolier instances - const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance - - const size_t PotionBeltSize = 5; - - const size_t SkillArraySize = 100; - - } /*profile*/ - - namespace constants { - const size_t CharacterCreationLimit = 12; - - const size_t SayLinkBodySize = 55; + const size_t SAY_LINK_BODY_SIZE = 55; const int LongBuffs = 42; const int ShortBuffs = 20; @@ -279,11 +265,15 @@ namespace RoF } /*constants*/ namespace behavior { + inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::RoF; } + const bool CoinHasWeight = false; } /*behavior*/ namespace skills { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::RoF; } + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; } /*skills*/ diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 08e3647be..dcc5e4ccc 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -898,13 +898,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; struct PotionBeltItem_Struct @@ -924,12 +924,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[profile::PotionBeltSize]; + PotionBeltItem_Struct Items[profile::POTION_BELT_SIZE]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[profile::PotionBeltSize]; + PotionBeltItem_Struct_Old Items[profile::POTION_BELT_SIZE]; }; struct GroupLeadershipAA_Struct { @@ -1139,7 +1139,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 -/*12959*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*12959*/ Bandolier_Struct bandoliers[profile::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 560151bfa..e208d2778 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1632,18 +1632,18 @@ namespace SoD // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { + for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { + for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1653,13 +1653,13 @@ namespace SoD // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { + for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { + for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -1947,8 +1947,8 @@ namespace SoD eq->CharCount = emu->CharCount; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > constants::CharacterCreationLimit) - eq->TotalChars = constants::CharacterCreationLimit; + if (eq->TotalChars > constants::CHARACTER_CREATION_LIMIT) + eq->TotalChars = constants::CHARACTER_CREATION_LIMIT; FINISH_ENCODE(); return; @@ -1960,7 +1960,7 @@ namespace SoD size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CHARACTER_CREATION_LIMIT; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -1976,8 +1976,8 @@ namespace SoD eq->CharCount = character_count; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > constants::CharacterCreationLimit) - eq->TotalChars = constants::CharacterCreationLimit; + if (eq->TotalChars > constants::CHARACTER_CREATION_LIMIT) + eq->TotalChars = constants::CHARACTER_CREATION_LIMIT; emu_ptr = __emu_buffer; emu_ptr += sizeof(CharacterSelect_Struct); @@ -3578,7 +3578,7 @@ namespace SoD ibs.nodrop = item->NoDrop; ibs.attune = item->Attuneable; ibs.size = item->Size; - ibs.slots = SwapBits21and22(item->Slots); + ibs.slots = SwapBits21And22(item->Slots); ibs.price = item->Price; ibs.icon = item->Icon; ibs.unknown1 = 1; @@ -3668,7 +3668,7 @@ namespace SoD isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < invaug::ItemAugSize; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -3841,18 +3841,18 @@ namespace SoD ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { + for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; - if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); - else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); - else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END) + SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1); + else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index); + else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -3870,16 +3870,16 @@ namespace SoD { uint32 SoDSlot = 0; - if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots SoDSlot = serverSlot + 1; - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) SoDSlot = serverSlot + 11; - else if (serverSlot >= EQEmu::legacy::BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) + else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) SoDSlot = serverSlot + 1; - else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) + else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) SoDSlot = serverSlot + 1; - else if (serverSlot == EQEmu::inventory::slotPowerSource) - SoDSlot = invslot::PossessionsPowerSource; + else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + SoDSlot = invslot::slotPowerSource; else SoDSlot = serverSlot; return SoDSlot; @@ -3895,16 +3895,16 @@ namespace SoD { uint32 ServerSlot = 0; - if (sodSlot >= invslot::PossessionsAmmo && sodSlot <= invslot::CorpseEnd) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (sodSlot >= invslot::slotAmmo && sodSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots ServerSlot = sodSlot - 1; - else if (sodSlot >= invbag::GeneralBagsBegin && sodSlot <= invbag::CursorBagEnd) + else if (sodSlot >= invbag::GENERAL_BAGS_BEGIN && sodSlot <= invbag::CURSOR_BAG_END) ServerSlot = sodSlot - 11; - else if (sodSlot >= invbag::BankBagsBegin && sodSlot <= invbag::BankBagsEnd) + else if (sodSlot >= invbag::BANK_BAGS_BEGIN && sodSlot <= invbag::BANK_BAGS_END) ServerSlot = sodSlot - 1; - else if (sodSlot >= invbag::SharedBankBagsBegin && sodSlot <= invbag::SharedBankBagsEnd) + else if (sodSlot >= invbag::SHARED_BANK_BAGS_BEGIN && sodSlot <= invbag::SHARED_BANK_BAGS_END) ServerSlot = sodSlot - 1; - else if (sodSlot == invslot::PossessionsPowerSource) - ServerSlot = EQEmu::inventory::slotPowerSource; + else if (sodSlot == invslot::slotPowerSource) + ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE; else ServerSlot = sodSlot; return ServerSlot; @@ -3918,7 +3918,7 @@ namespace SoD static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink) { - if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) { + if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { sodSayLink = serverSayLink; return; } @@ -3927,7 +3927,7 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { sodSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -3958,7 +3958,7 @@ namespace SoD static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink) { - if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (sodSayLink.find('\x12') == std::string::npos)) { + if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sodSayLink.find('\x12') == std::string::npos)) { serverSayLink = sodSayLink; return; } @@ -3967,7 +3967,7 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { serverSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/sod_limits.cpp b/common/patches/sod_limits.cpp index 8ff257665..dc1676d5a 100644 --- a/common/patches/sod_limits.cpp +++ b/common/patches/sod_limits.cpp @@ -22,198 +22,198 @@ #include "../string_util.h" -size_t SoD::invtype::GetInvTypeSize(int inv_type) +int16 SoD::invtype::GetInvTypeSize(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - return invtype::InvTypePossessionsSize; - case invtype::InvTypeBank: - return invtype::InvTypeBankSize; - case invtype::InvTypeSharedBank: - return invtype::InvTypeSharedBankSize; - case invtype::InvTypeTrade: - return invtype::InvTypeTradeSize; - case invtype::InvTypeWorld: - return invtype::InvTypeWorldSize; - case invtype::InvTypeLimbo: - return invtype::InvTypeLimboSize; - case invtype::InvTypeTribute: - return invtype::InvTypeTributeSize; - case invtype::InvTypeGuildTribute: - return invtype::InvTypeGuildTributeSize; - case invtype::InvTypeMerchant: - return invtype::InvTypeMerchantSize; - case invtype::InvTypeCorpse: - return invtype::InvTypeCorpseSize; - case invtype::InvTypeBazaar: - return invtype::InvTypeBazaarSize; - case invtype::InvTypeInspect: - return invtype::InvTypeInspectSize; - case invtype::InvTypeViewMODPC: - return invtype::InvTypeViewMODPCSize; - case invtype::InvTypeViewMODBank: - return invtype::InvTypeViewMODBankSize; - case invtype::InvTypeViewMODSharedBank: - return invtype::InvTypeViewMODSharedBankSize; - case invtype::InvTypeViewMODLimbo: - return invtype::InvTypeViewMODLimboSize; - case invtype::InvTypeAltStorage: - return invtype::InvTypeAltStorageSize; - case invtype::InvTypeArchived: - return invtype::InvTypeArchivedSize; - case invtype::InvTypeOther: - return invtype::InvTypeOtherSize; + case invtype::typePossessions: + return invtype::POSSESSIONS_SIZE; + case invtype::typeBank: + return invtype::BANK_SIZE; + case invtype::typeSharedBank: + return invtype::SHARED_BANK_SIZE; + case invtype::typeTrade: + return invtype::TRADE_SIZE; + case invtype::typeWorld: + return invtype::WORLD_SIZE; + case invtype::typeLimbo: + return invtype::LIMBO_SIZE; + case invtype::typeTribute: + return invtype::TRIBUTE_SIZE; + case invtype::typeGuildTribute: + return invtype::GUILD_TRIBUTE_SIZE; + case invtype::typeMerchant: + return invtype::MERCHANT_SIZE; + case invtype::typeCorpse: + return invtype::CORPSE_SIZE; + case invtype::typeBazaar: + return invtype::BAZAAR_SIZE; + case invtype::typeInspect: + return invtype::INSPECT_SIZE; + case invtype::typeViewMODPC: + return invtype::VIEW_MOD_PC_SIZE; + case invtype::typeViewMODBank: + return invtype::VIEW_MOD_BANK_SIZE; + case invtype::typeViewMODSharedBank: + return invtype::VIEW_MOD_SHARED_BANK_SIZE; + case invtype::typeViewMODLimbo: + return invtype::VIEW_MOD_LIMBO_SIZE; + case invtype::typeAltStorage: + return invtype::ALT_STORAGE_SIZE; + case invtype::typeArchived: + return invtype::ARCHIVED_SIZE; + case invtype::typeOther: + return invtype::OTHER_SIZE; default: - return 0; + return INULL; } } -const char* SoD::invtype::GetInvTypeName(int inv_type) +const char* SoD::invtype::GetInvTypeName(int16 inv_type) { switch (inv_type) { - case invtype::InvTypeInvalid: + case invtype::TYPE_INVALID: return "Invalid Type"; - case invtype::InvTypePossessions: + case invtype::typePossessions: return "Possessions"; - case invtype::InvTypeBank: + case invtype::typeBank: return "Bank"; - case invtype::InvTypeSharedBank: + case invtype::typeSharedBank: return "Shared Bank"; - case invtype::InvTypeTrade: + case invtype::typeTrade: return "Trade"; - case invtype::InvTypeWorld: + case invtype::typeWorld: return "World"; - case invtype::InvTypeLimbo: + case invtype::typeLimbo: return "Limbo"; - case invtype::InvTypeTribute: + case invtype::typeTribute: return "Tribute"; - case invtype::InvTypeGuildTribute: + case invtype::typeGuildTribute: return "Guild Tribute"; - case invtype::InvTypeMerchant: + case invtype::typeMerchant: return "Merchant"; - case invtype::InvTypeCorpse: + case invtype::typeCorpse: return "Corpse"; - case invtype::InvTypeBazaar: + case invtype::typeBazaar: return "Bazaar"; - case invtype::InvTypeInspect: + case invtype::typeInspect: return "Inspect"; - case invtype::InvTypeViewMODPC: + case invtype::typeViewMODPC: return "View MOD PC"; - case invtype::InvTypeViewMODBank: + case invtype::typeViewMODBank: return "View MOD Bank"; - case invtype::InvTypeViewMODSharedBank: + case invtype::typeViewMODSharedBank: return "View MOD Shared Bank"; - case invtype::InvTypeViewMODLimbo: + case invtype::typeViewMODLimbo: return "View MOD Limbo"; - case invtype::InvTypeAltStorage: + case invtype::typeAltStorage: return "Alt Storage"; - case invtype::InvTypeArchived: + case invtype::typeArchived: return "Archived"; - case invtype::InvTypeOther: + case invtype::typeOther: return "Other"; default: return "Unknown Type"; } } -bool SoD::invtype::IsInvTypePersistent(int inv_type) +bool SoD::invtype::IsInvTypePersistent(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - case invtype::InvTypeBank: - case invtype::InvTypeSharedBank: - case invtype::InvTypeTrade: - case invtype::InvTypeWorld: - case invtype::InvTypeLimbo: - case invtype::InvTypeTribute: - case invtype::InvTypeGuildTribute: + case invtype::typePossessions: + case invtype::typeBank: + case invtype::typeSharedBank: + case invtype::typeTrade: + case invtype::typeWorld: + case invtype::typeLimbo: + case invtype::typeTribute: + case invtype::typeGuildTribute: return true; default: return false; } } -const char* SoD::invslot::GetInvPossessionsSlotName(int inv_slot) +const char* SoD::invslot::GetInvPossessionsSlotName(int16 inv_slot) { switch (inv_slot) { - case invslot::InvSlotInvalid: + case invslot::SLOT_INVALID: return "Invalid Slot"; - case invslot::PossessionsCharm: + case invslot::slotCharm: return "Charm"; - case invslot::PossessionsEar1: + case invslot::slotEar1: return "Ear 1"; - case invslot::PossessionsHead: + case invslot::slotHead: return "Head"; - case invslot::PossessionsFace: + case invslot::slotFace: return "Face"; - case invslot::PossessionsEar2: + case invslot::slotEar2: return "Ear 2"; - case invslot::PossessionsNeck: + case invslot::slotNeck: return "Neck"; - case invslot::PossessionsShoulders: + case invslot::slotShoulders: return "Shoulders"; - case invslot::PossessionsArms: + case invslot::slotArms: return "Arms"; - case invslot::PossessionsBack: + case invslot::slotBack: return "Back"; - case invslot::PossessionsWrist1: + case invslot::slotWrist1: return "Wrist 1"; - case invslot::PossessionsWrist2: + case invslot::slotWrist2: return "Wrist 2"; - case invslot::PossessionsRange: + case invslot::slotRange: return "Range"; - case invslot::PossessionsHands: + case invslot::slotHands: return "Hands"; - case invslot::PossessionsPrimary: + case invslot::slotPrimary: return "Primary"; - case invslot::PossessionsSecondary: + case invslot::slotSecondary: return "Secondary"; - case invslot::PossessionsFinger1: + case invslot::slotFinger1: return "Finger 1"; - case invslot::PossessionsFinger2: + case invslot::slotFinger2: return "Finger 2"; - case invslot::PossessionsChest: + case invslot::slotChest: return "Chest"; - case invslot::PossessionsLegs: + case invslot::slotLegs: return "Legs"; - case invslot::PossessionsFeet: + case invslot::slotFeet: return "Feet"; - case invslot::PossessionsWaist: + case invslot::slotWaist: return "Waist"; - case invslot::PossessionsPowerSource: + case invslot::slotPowerSource: return "Power Source"; - case invslot::PossessionsAmmo: + case invslot::slotAmmo: return "Ammo"; - case invslot::PossessionsGeneral1: + case invslot::slotGeneral1: return "General 1"; - case invslot::PossessionsGeneral2: + case invslot::slotGeneral2: return "General 2"; - case invslot::PossessionsGeneral3: + case invslot::slotGeneral3: return "General 3"; - case invslot::PossessionsGeneral4: + case invslot::slotGeneral4: return "General 4"; - case invslot::PossessionsGeneral5: + case invslot::slotGeneral5: return "General 5"; - case invslot::PossessionsGeneral6: + case invslot::slotGeneral6: return "General 6"; - case invslot::PossessionsGeneral7: + case invslot::slotGeneral7: return "General 7"; - case invslot::PossessionsGeneral8: + case invslot::slotGeneral8: return "General 8"; - case invslot::PossessionsCursor: + case invslot::slotCursor: return "Cursor"; default: return "Unknown Slot"; } } -const char* SoD::invslot::GetInvCorpseSlotName(int inv_slot) +const char* SoD::invslot::GetInvCorpseSlotName(int16 inv_slot) { - if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + if (!invtype::GetInvTypeSize(invtype::typeCorpse) || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; // needs work - if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + if ((inv_slot + 1) < invslot::CORPSE_BEGIN || (inv_slot + 1) >= invslot::CORPSE_END) return "Unknown Slot"; static std::string ret_str; @@ -222,19 +222,19 @@ const char* SoD::invslot::GetInvCorpseSlotName(int inv_slot) return ret_str.c_str(); } -const char* SoD::invslot::GetInvSlotName(int inv_type, int inv_slot) +const char* SoD::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot) { - if (inv_type == invtype::InvTypePossessions) + if (inv_type == invtype::typePossessions) return invslot::GetInvPossessionsSlotName(inv_slot); - else if (inv_type == invtype::InvTypeCorpse) + else if (inv_type == invtype::typeCorpse) return invslot::GetInvCorpseSlotName(inv_slot); - size_t type_size = invtype::GetInvTypeSize(inv_type); + int16 type_size = invtype::GetInvTypeSize(inv_type); - if (!type_size || inv_slot == invslot::InvSlotInvalid) + if (!type_size || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; - if ((size_t)(inv_slot + 1) >= type_size) + if ((inv_slot + 1) >= type_size) return "Unknown Slot"; static std::string ret_str; @@ -243,12 +243,12 @@ const char* SoD::invslot::GetInvSlotName(int inv_type, int inv_slot) return ret_str.c_str(); } -const char* SoD::invbag::GetInvBagIndexName(int bag_index) +const char* SoD::invbag::GetInvBagIndexName(int16 bag_index) { - if (bag_index == invbag::InvBagInvalid) + if (bag_index == invbag::SLOT_INVALID) return "Invalid Bag"; - if ((size_t)bag_index >= invbag::ItemBagSize) + if (bag_index >= invbag::SLOT_COUNT) return "Unknown Bag"; static std::string ret_str; @@ -257,12 +257,12 @@ const char* SoD::invbag::GetInvBagIndexName(int bag_index) return ret_str.c_str(); } -const char* SoD::invaug::GetInvAugIndexName(int aug_index) +const char* SoD::invaug::GetInvAugIndexName(int16 aug_index) { - if (aug_index == invaug::InvAugInvalid) + if (aug_index == invaug::SOCKET_INVALID) return "Invalid Augment"; - if ((size_t)aug_index >= invaug::ItemAugSize) + if (aug_index >= invaug::SOCKET_COUNT) return "Unknown Augment"; static std::string ret_str; diff --git a/common/patches/sod_limits.h b/common/patches/sod_limits.h index 8f8031a3d..555425cc1 100644 --- a/common/patches/sod_limits.h +++ b/common/patches/sod_limits.h @@ -27,108 +27,218 @@ namespace SoD { - enum : int { Invalid = -1, Null, Safety }; + const int16 IINVALID = -1; + const int16 INULL = 0; - enum : bool { False = false, True = true }; - - // pre-declarations namespace inventory { inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::SoD; } + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = false; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + } /*inventory*/ namespace invtype { inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::SoD; } - enum : int { InvTypeInvalid = -1, InvTypeBegin }; + namespace enum_ { + enum InventoryTypes : int16 { + typePossessions = INULL, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, + typeTribute, + typeGuildTribute, + typeMerchant, + typeCorpse, + typeBazaar, + typeInspect, + typeViewMODPC, + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, + typeOther + }; - enum InventoryType : int { - InvTypePossessions = InvTypeBegin, - InvTypeBank, - InvTypeSharedBank, - InvTypeTrade, - InvTypeWorld, - InvTypeLimbo, - InvTypeTribute, - InvTypeGuildTribute, - InvTypeMerchant, - InvTypeCorpse, - InvTypeBazaar, - InvTypeInspect, - InvTypeViewMODPC, - InvTypeViewMODBank, - InvTypeViewMODSharedBank, - InvTypeViewMODLimbo, - InvTypeAltStorage, - InvTypeArchived, - InvTypeOther, - InvTypeCount - }; + } // namespace enum_ + using namespace enum_; + + const int16 POSSESSIONS_SIZE = 32; + const int16 BANK_SIZE = 24; + const int16 SHARED_BANK_SIZE = 2; + const int16 TRADE_SIZE = 8; + const int16 WORLD_SIZE = 10; + const int16 LIMBO_SIZE = 36; + const int16 TRIBUTE_SIZE = 5; + const int16 GUILD_TRIBUTE_SIZE = 2; + const int16 MERCHANT_SIZE = 80; + const int16 CORPSE_SIZE = POSSESSIONS_SIZE; + const int16 BAZAAR_SIZE = 80; + const int16 INSPECT_SIZE = 23; + const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE; + const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE; + const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE; + const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE; + const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank" + const int16 ARCHIVED_SIZE = 0;//unknown + const int16 OTHER_SIZE = 0;//unknown + + const int16 TRADE_NPC_SIZE = 4; // defined by implication + + const int16 TYPE_INVALID = IINVALID; + const int16 TYPE_BEGIN = typePossessions; + const int16 TYPE_END = typeOther; + const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1; + + int16 GetInvTypeSize(int16 inv_type); + const char* GetInvTypeName(int16 inv_type); + + bool IsInvTypePersistent(int16 inv_type); } /*invtype*/ namespace invslot { inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::SoD; } - enum : int { InvSlotInvalid = -1, InvSlotBegin }; + namespace enum_ { + enum InventorySlots : int16 { + slotCharm = INULL, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, + slotPowerSource, + slotAmmo, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotCursor + }; - enum PossessionsSlot : int { - PossessionsCharm = InvSlotBegin, - PossessionsEar1, - PossessionsHead, - PossessionsFace, - PossessionsEar2, - PossessionsNeck, - PossessionsShoulders, - PossessionsArms, - PossessionsBack, - PossessionsWrist1, - PossessionsWrist2, - PossessionsRange, - PossessionsHands, - PossessionsPrimary, - PossessionsSecondary, - PossessionsFinger1, - PossessionsFinger2, - PossessionsChest, - PossessionsLegs, - PossessionsFeet, - PossessionsWaist, - PossessionsPowerSource, - PossessionsAmmo, - PossessionsGeneral1, - PossessionsGeneral2, - PossessionsGeneral3, - PossessionsGeneral4, - PossessionsGeneral5, - PossessionsGeneral6, - PossessionsGeneral7, - PossessionsGeneral8, - PossessionsCursor, - PossessionsCount - }; + } // namespace enum_ + using namespace enum_; - const int EquipmentBegin = PossessionsCharm; - const int EquipmentEnd = PossessionsAmmo; - const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; - const int GeneralBegin = PossessionsGeneral1; - const int GeneralEnd = PossessionsGeneral8; - const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + const int16 POSSESSIONS_BEGIN = slotCharm; + const int16 POSSESSIONS_END = slotCursor; + const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1; + + const int16 EQUIPMENT_BEGIN = slotCharm; + const int16 EQUIPMENT_END = slotAmmo; + const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN + 1); + + const int16 GENERAL_BEGIN = slotGeneral1; + const int16 GENERAL_END = slotGeneral8; + const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN + 1); + + const int16 BONUS_BEGIN = invslot::slotCharm; + const int16 BONUS_STAT_END = invslot::slotPowerSource; + const int16 BONUS_SKILL_END = invslot::slotAmmo; + + const int16 BANK_BEGIN = 2000; + const int16 BANK_END = (BANK_BEGIN + invtype::BANK_SIZE) - 1; + + const int16 SHARED_BANK_BEGIN = 2500; + const int16 SHARED_BANK_END = (SHARED_BANK_BEGIN + invtype::SHARED_BANK_SIZE) - 1; + + const int16 TRADE_BEGIN = 3000; + const int16 TRADE_END = (TRADE_BEGIN + invtype::TRADE_SIZE) - 1; + + const int16 TRADE_NPC_END = (TRADE_BEGIN + invtype::TRADE_NPC_SIZE) - 1; // defined by implication + + const int16 WORLD_BEGIN = 4000; + const int16 WORLD_END = (WORLD_BEGIN + invtype::WORLD_SIZE) - 1; + + const int16 TRIBUTE_BEGIN = 400; + const int16 TRIBUTE_END = (TRIBUTE_BEGIN + invtype::TRIBUTE_SIZE) - 1; + + const int16 GUILD_TRIBUTE_BEGIN = 450; + const int16 GUILD_TRIBUTE_END = (GUILD_TRIBUTE_BEGIN + invtype::GUILD_TRIBUTE_SIZE) - 1; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor; + + const uint64 POSSESSIONS_BITMASK = 0x000000027FFFFFFF; // based on 34-slot count (RoF+) + const uint64 CORPSE_BITMASK = 0x01FFFFFE7F800000; // based on 34-slot count (RoF+) + + const char* GetInvPossessionsSlotName(int16 inv_slot); + const char* GetInvCorpseSlotName(int16 inv_slot); + const char* GetInvSlotName(int16 inv_type, int16 inv_slot); } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::SoD; } - enum : int { InvBagInvalid = -1, InvBagBegin }; + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; + const int16 SLOT_END = 9; + const int16 SLOT_COUNT = 10; + + const int16 GENERAL_BAGS_BEGIN = 262; + const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT; + const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1; + + const int16 CURSOR_BAG_BEGIN = 342; + const int16 CURSOR_BAG_COUNT = SLOT_COUNT; + const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1; + + const int16 BANK_BAGS_BEGIN = 2032; + const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT); + const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1; + + const int16 SHARED_BANK_BAGS_BEGIN = 2532; + const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT; + const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1; + + const int16 TRADE_BAGS_BEGIN = 3031; + const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT; + const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1; + + const char* GetInvBagIndexName(int16 bag_index); } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::SoD; } - enum : int { InvAugInvalid = -1, InvAugBegin }; + const int16 SOCKET_INVALID = IINVALID; + const int16 SOCKET_BEGIN = INULL; + const int16 SOCKET_END = 4; + const int16 SOCKET_COUNT = 5; + + const char* GetInvAugIndexName(int16 aug_index); } /*invaug*/ @@ -153,147 +263,21 @@ namespace SoD namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::SoD; } + const int16 BANDOLIERS_SIZE = 20; // number of bandolier instances + const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + const int16 POTION_BELT_SIZE = 5; + + const int16 SKILL_ARRAY_SIZE = 100; + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::SoD; } - } /*constants*/ + const size_t CHARACTER_CREATION_LIMIT = 12; - namespace behavior { - inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::SoD; } - - } /*behavior*/ - - namespace skills { - inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoD; } - - } /*skills*/ - - - // declarations - namespace inventory { - const bool ConcatenateInvTypeLimbo = true; - - const bool AllowOverLevelEquipment = false; - - const bool AllowEmptyBagInBag = false; - const bool AllowClickCastFromBag = false; - - } /*inventory*/ - - namespace invtype { - const size_t InvTypePossessionsSize = invslot::PossessionsCount; - const size_t InvTypeBankSize = 24; - const size_t InvTypeSharedBankSize = 2; - const size_t InvTypeTradeSize = 8; - const size_t InvTypeWorldSize = 10; - const size_t InvTypeLimboSize = 36; - const size_t InvTypeTributeSize = 5; - const size_t InvTypeGuildTributeSize = 2; - const size_t InvTypeMerchantSize = 80; - const size_t InvTypeCorpseSize = InvTypePossessionsSize; - const size_t InvTypeBazaarSize = 80; - const size_t InvTypeInspectSize = invslot::EquipmentCount; - const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; - const size_t InvTypeViewMODBankSize = InvTypeBankSize; - const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; - const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; - const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" - const size_t InvTypeArchivedSize = 0;//unknown - const size_t InvTypeOtherSize = 0;//unknown - - extern size_t GetInvTypeSize(int inv_type); - extern const char* GetInvTypeName(int inv_type); - - extern bool IsInvTypePersistent(int inv_type); - - } /*invtype*/ - - namespace invslot { - const int BankBegin = 2000; - const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; - - const int SharedBankBegin = 2500; - const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; - - const int TradeBegin = 3000; - const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; - const int TradeNPCEnd = 3003; - - const int WorldBegin = 4000; - const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; - - const int TributeBegin = 400; - const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1; - - const int GuildTributeBegin = 450; - const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1; - - const int CorpseBegin = invslot::PossessionsGeneral1; - const int CorpseEnd = invslot::PossessionsGeneral1 + invslot::PossessionsCursor; - - extern const char* GetInvPossessionsSlotName(int inv_slot); - extern const char* GetInvCorpseSlotName(int inv_slot); - extern const char* GetInvSlotName(int inv_type, int inv_slot); - - } /*invslot*/ - - namespace invbag { - const size_t ItemBagSize = 10; - - const int GeneralBagsBegin = 262; - const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; - const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; - - const int CursorBagBegin = 342; - const int CursorBagSize = ItemBagSize; - const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; - - const int BankBagsBegin = 2032; - const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); - const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; - - const int SharedBankBagsBegin = 2532; - const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; - const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; - - const int TradeBagsBegin = 3031; - const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; - const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; - - extern const char* GetInvBagIndexName(int bag_index); - - } /*invbag*/ - - namespace invaug { - const size_t ItemAugSize = 5; - - extern const char* GetInvAugIndexName(int aug_index); - - } /*invaug*/ - - namespace item { - - } /*item*/ - - namespace profile { - const size_t TributeSize = invtype::InvTypeTributeSize; - const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize; - - const size_t BandoliersSize = 20; // number of bandolier instances - const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance - - const size_t PotionBeltSize = 5; - - const size_t SkillArraySize = 100; - - } /*profile*/ - - namespace constants { - const size_t CharacterCreationLimit = 12; - - const size_t SayLinkBodySize = 50; + const size_t SAY_LINK_BODY_SIZE = 50; const int LongBuffs = 25; const int ShortBuffs = 15; @@ -306,11 +290,15 @@ namespace SoD } /*constants*/ namespace behavior { + inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::SoD; } + const bool CoinHasWeight = false; } /*behavior*/ namespace skills { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoD; } + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; } /*skills*/ diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 6b5c2f72c..80d0faae9 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -716,7 +716,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -730,7 +730,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[profile::PotionBeltSize]; + PotionBeltItem_Struct Items[profile::POTION_BELT_SIZE]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -937,7 +937,7 @@ struct PlayerProfile_Struct /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[profile::BANDOLIERS_SIZE]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index c16bed086..ee087e669 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1303,18 +1303,18 @@ namespace SoF // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { + for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { + for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1324,13 +1324,13 @@ namespace SoF // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { + for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { + for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -1618,8 +1618,8 @@ namespace SoF eq->CharCount = emu->CharCount; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > constants::CharacterCreationLimit) - eq->TotalChars = constants::CharacterCreationLimit; + if (eq->TotalChars > constants::CHARACTER_CREATION_LIMIT) + eq->TotalChars = constants::CHARACTER_CREATION_LIMIT; FINISH_ENCODE(); return; @@ -1631,7 +1631,7 @@ namespace SoF size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CHARACTER_CREATION_LIMIT; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -1647,8 +1647,8 @@ namespace SoF eq->CharCount = character_count; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > constants::CharacterCreationLimit) - eq->TotalChars = constants::CharacterCreationLimit; + if (eq->TotalChars > constants::CHARACTER_CREATION_LIMIT) + eq->TotalChars = constants::CHARACTER_CREATION_LIMIT; emu_ptr = __emu_buffer; emu_ptr += sizeof(CharacterSelect_Struct); @@ -2976,7 +2976,7 @@ namespace SoF ibs.nodrop = item->NoDrop; ibs.attune = item->Attuneable; ibs.size = item->Size; - ibs.slots = SwapBits21and22(item->Slots); + ibs.slots = SwapBits21And22(item->Slots); ibs.price = item->Price; ibs.icon = item->Icon; ibs.unknown1 = 1; @@ -3066,7 +3066,7 @@ namespace SoF isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < invaug::ItemAugSize; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -3238,18 +3238,18 @@ namespace SoF ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { + for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; - if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); - else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); - else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END) + SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1); + else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index); + else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -3267,16 +3267,16 @@ namespace SoF { uint32 SoFSlot = 0; - if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots SoFSlot = serverSlot + 1; - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) SoFSlot = serverSlot + 11; - else if (serverSlot >= EQEmu::legacy::BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) + else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) SoFSlot = serverSlot + 1; - else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) + else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) SoFSlot = serverSlot + 1; - else if (serverSlot == EQEmu::inventory::slotPowerSource) - SoFSlot = invslot::PossessionsPowerSource; + else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + SoFSlot = invslot::slotPowerSource; else SoFSlot = serverSlot; @@ -3293,16 +3293,16 @@ namespace SoF { uint32 ServerSlot = 0; - if (sofSlot >= invslot::PossessionsAmmo && sofSlot <= invslot::CorpseEnd) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (sofSlot >= invslot::slotAmmo && sofSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots ServerSlot = sofSlot - 1; - else if (sofSlot >= invbag::GeneralBagsBegin && sofSlot <= invbag::CursorBagEnd) + else if (sofSlot >= invbag::GENERAL_BAGS_BEGIN && sofSlot <= invbag::CURSOR_BAG_END) ServerSlot = sofSlot - 11; - else if (sofSlot >= invbag::BankBagsBegin && sofSlot <= invbag::BankBagsEnd) + else if (sofSlot >= invbag::BANK_BAGS_BEGIN && sofSlot <= invbag::BANK_BAGS_END) ServerSlot = sofSlot - 1; - else if (sofSlot >= invbag::SharedBankBagsBegin && sofSlot <= invbag::SharedBankBagsEnd) + else if (sofSlot >= invbag::SHARED_BANK_BAGS_BEGIN && sofSlot <= invbag::SHARED_BANK_BAGS_END) ServerSlot = sofSlot - 1; - else if (sofSlot == invslot::PossessionsPowerSource) - ServerSlot = EQEmu::inventory::slotPowerSource; + else if (sofSlot == invslot::slotPowerSource) + ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE; else ServerSlot = sofSlot; @@ -3317,7 +3317,7 @@ namespace SoF static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink) { - if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) { + if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { sofSayLink = serverSayLink; return; } @@ -3326,7 +3326,7 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { sofSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -3357,7 +3357,7 @@ namespace SoF static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink) { - if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (sofSayLink.find('\x12') == std::string::npos)) { + if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sofSayLink.find('\x12') == std::string::npos)) { serverSayLink = sofSayLink; return; } @@ -3366,7 +3366,7 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { serverSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/sof_limits.cpp b/common/patches/sof_limits.cpp index b33943905..aa42320c8 100644 --- a/common/patches/sof_limits.cpp +++ b/common/patches/sof_limits.cpp @@ -22,198 +22,198 @@ #include "../string_util.h" -size_t SoF::invtype::GetInvTypeSize(int inv_type) +int16 SoF::invtype::GetInvTypeSize(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - return invtype::InvTypePossessionsSize; - case invtype::InvTypeBank: - return invtype::InvTypeBankSize; - case invtype::InvTypeSharedBank: - return invtype::InvTypeSharedBankSize; - case invtype::InvTypeTrade: - return invtype::InvTypeTradeSize; - case invtype::InvTypeWorld: - return invtype::InvTypeWorldSize; - case invtype::InvTypeLimbo: - return invtype::InvTypeLimboSize; - case invtype::InvTypeTribute: - return invtype::InvTypeTributeSize; - case invtype::InvTypeGuildTribute: - return invtype::InvTypeGuildTributeSize; - case invtype::InvTypeMerchant: - return invtype::InvTypeMerchantSize; - case invtype::InvTypeCorpse: - return invtype::InvTypeCorpseSize; - case invtype::InvTypeBazaar: - return invtype::InvTypeBazaarSize; - case invtype::InvTypeInspect: - return invtype::InvTypeInspectSize; - case invtype::InvTypeViewMODPC: - return invtype::InvTypeViewMODPCSize; - case invtype::InvTypeViewMODBank: - return invtype::InvTypeViewMODBankSize; - case invtype::InvTypeViewMODSharedBank: - return invtype::InvTypeViewMODSharedBankSize; - case invtype::InvTypeViewMODLimbo: - return invtype::InvTypeViewMODLimboSize; - case invtype::InvTypeAltStorage: - return invtype::InvTypeAltStorageSize; - case invtype::InvTypeArchived: - return invtype::InvTypeArchivedSize; - case invtype::InvTypeOther: - return invtype::InvTypeOtherSize; + case invtype::typePossessions: + return invtype::POSSESSIONS_SIZE; + case invtype::typeBank: + return invtype::BANK_SIZE; + case invtype::typeSharedBank: + return invtype::SHARED_BANK_SIZE; + case invtype::typeTrade: + return invtype::TRADE_SIZE; + case invtype::typeWorld: + return invtype::WORLD_SIZE; + case invtype::typeLimbo: + return invtype::LIMBO_SIZE; + case invtype::typeTribute: + return invtype::TRIBUTE_SIZE; + case invtype::typeGuildTribute: + return invtype::GUILD_TRIBUTE_SIZE; + case invtype::typeMerchant: + return invtype::MERCHANT_SIZE; + case invtype::typeCorpse: + return invtype::CORPSE_SIZE; + case invtype::typeBazaar: + return invtype::BAZAAR_SIZE; + case invtype::typeInspect: + return invtype::INSPECT_SIZE; + case invtype::typeViewMODPC: + return invtype::VIEW_MOD_PC_SIZE; + case invtype::typeViewMODBank: + return invtype::VIEW_MOD_BANK_SIZE; + case invtype::typeViewMODSharedBank: + return invtype::VIEW_MOD_SHARED_BANK_SIZE; + case invtype::typeViewMODLimbo: + return invtype::VIEW_MOD_LIMBO_SIZE; + case invtype::typeAltStorage: + return invtype::ALT_STORAGE_SIZE; + case invtype::typeArchived: + return invtype::ARCHIVED_SIZE; + case invtype::typeOther: + return invtype::OTHER_SIZE; default: - return 0; + return INULL; } } -const char* SoF::invtype::GetInvTypeName(int inv_type) +const char* SoF::invtype::GetInvTypeName(int16 inv_type) { switch (inv_type) { - case invtype::InvTypeInvalid: + case invtype::TYPE_INVALID: return "Invalid Type"; - case invtype::InvTypePossessions: + case invtype::typePossessions: return "Possessions"; - case invtype::InvTypeBank: + case invtype::typeBank: return "Bank"; - case invtype::InvTypeSharedBank: + case invtype::typeSharedBank: return "Shared Bank"; - case invtype::InvTypeTrade: + case invtype::typeTrade: return "Trade"; - case invtype::InvTypeWorld: + case invtype::typeWorld: return "World"; - case invtype::InvTypeLimbo: + case invtype::typeLimbo: return "Limbo"; - case invtype::InvTypeTribute: + case invtype::typeTribute: return "Tribute"; - case invtype::InvTypeGuildTribute: + case invtype::typeGuildTribute: return "Guild Tribute"; - case invtype::InvTypeMerchant: + case invtype::typeMerchant: return "Merchant"; - case invtype::InvTypeCorpse: + case invtype::typeCorpse: return "Corpse"; - case invtype::InvTypeBazaar: + case invtype::typeBazaar: return "Bazaar"; - case invtype::InvTypeInspect: + case invtype::typeInspect: return "Inspect"; - case invtype::InvTypeViewMODPC: + case invtype::typeViewMODPC: return "View MOD PC"; - case invtype::InvTypeViewMODBank: + case invtype::typeViewMODBank: return "View MOD Bank"; - case invtype::InvTypeViewMODSharedBank: + case invtype::typeViewMODSharedBank: return "View MOD Shared Bank"; - case invtype::InvTypeViewMODLimbo: + case invtype::typeViewMODLimbo: return "View MOD Limbo"; - case invtype::InvTypeAltStorage: + case invtype::typeAltStorage: return "Alt Storage"; - case invtype::InvTypeArchived: + case invtype::typeArchived: return "Archived"; - case invtype::InvTypeOther: + case invtype::typeOther: return "Other"; default: return "Unknown Type"; } } -bool SoF::invtype::IsInvTypePersistent(int inv_type) +bool SoF::invtype::IsInvTypePersistent(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - case invtype::InvTypeBank: - case invtype::InvTypeSharedBank: - case invtype::InvTypeTrade: - case invtype::InvTypeWorld: - case invtype::InvTypeLimbo: - case invtype::InvTypeTribute: - case invtype::InvTypeGuildTribute: + case invtype::typePossessions: + case invtype::typeBank: + case invtype::typeSharedBank: + case invtype::typeTrade: + case invtype::typeWorld: + case invtype::typeLimbo: + case invtype::typeTribute: + case invtype::typeGuildTribute: return true; default: return false; } } -const char* SoF::invslot::GetInvPossessionsSlotName(int inv_slot) +const char* SoF::invslot::GetInvPossessionsSlotName(int16 inv_slot) { switch (inv_slot) { - case invslot::InvSlotInvalid: + case invslot::SLOT_INVALID: return "Invalid Slot"; - case invslot::PossessionsCharm: + case invslot::slotCharm: return "Charm"; - case invslot::PossessionsEar1: + case invslot::slotEar1: return "Ear 1"; - case invslot::PossessionsHead: + case invslot::slotHead: return "Head"; - case invslot::PossessionsFace: + case invslot::slotFace: return "Face"; - case invslot::PossessionsEar2: + case invslot::slotEar2: return "Ear 2"; - case invslot::PossessionsNeck: + case invslot::slotNeck: return "Neck"; - case invslot::PossessionsShoulders: + case invslot::slotShoulders: return "Shoulders"; - case invslot::PossessionsArms: + case invslot::slotArms: return "Arms"; - case invslot::PossessionsBack: + case invslot::slotBack: return "Back"; - case invslot::PossessionsWrist1: + case invslot::slotWrist1: return "Wrist 1"; - case invslot::PossessionsWrist2: + case invslot::slotWrist2: return "Wrist 2"; - case invslot::PossessionsRange: + case invslot::slotRange: return "Range"; - case invslot::PossessionsHands: + case invslot::slotHands: return "Hands"; - case invslot::PossessionsPrimary: + case invslot::slotPrimary: return "Primary"; - case invslot::PossessionsSecondary: + case invslot::slotSecondary: return "Secondary"; - case invslot::PossessionsFinger1: + case invslot::slotFinger1: return "Finger 1"; - case invslot::PossessionsFinger2: + case invslot::slotFinger2: return "Finger 2"; - case invslot::PossessionsChest: + case invslot::slotChest: return "Chest"; - case invslot::PossessionsLegs: + case invslot::slotLegs: return "Legs"; - case invslot::PossessionsFeet: + case invslot::slotFeet: return "Feet"; - case invslot::PossessionsWaist: + case invslot::slotWaist: return "Waist"; - case invslot::PossessionsPowerSource: + case invslot::slotPowerSource: return "Power Source"; - case invslot::PossessionsAmmo: + case invslot::slotAmmo: return "Ammo"; - case invslot::PossessionsGeneral1: + case invslot::slotGeneral1: return "General 1"; - case invslot::PossessionsGeneral2: + case invslot::slotGeneral2: return "General 2"; - case invslot::PossessionsGeneral3: + case invslot::slotGeneral3: return "General 3"; - case invslot::PossessionsGeneral4: + case invslot::slotGeneral4: return "General 4"; - case invslot::PossessionsGeneral5: + case invslot::slotGeneral5: return "General 5"; - case invslot::PossessionsGeneral6: + case invslot::slotGeneral6: return "General 6"; - case invslot::PossessionsGeneral7: + case invslot::slotGeneral7: return "General 7"; - case invslot::PossessionsGeneral8: + case invslot::slotGeneral8: return "General 8"; - case invslot::PossessionsCursor: + case invslot::slotCursor: return "Cursor"; default: return "Unknown Slot"; } } -const char* SoF::invslot::GetInvCorpseSlotName(int inv_slot) +const char* SoF::invslot::GetInvCorpseSlotName(int16 inv_slot) { - if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + if (!invtype::GetInvTypeSize(invtype::typeCorpse) || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; // needs work - if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + if ((inv_slot + 1) < invslot::CORPSE_BEGIN || (inv_slot + 1) >= invslot::CORPSE_END) return "Unknown Slot"; static std::string ret_str; @@ -222,19 +222,19 @@ const char* SoF::invslot::GetInvCorpseSlotName(int inv_slot) return ret_str.c_str(); } -const char* SoF::invslot::GetInvSlotName(int inv_type, int inv_slot) +const char* SoF::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot) { - if (inv_type == invtype::InvTypePossessions) + if (inv_type == invtype::typePossessions) return invslot::GetInvPossessionsSlotName(inv_slot); - else if (inv_type == invtype::InvTypeCorpse) + else if (inv_type == invtype::typeCorpse) return invslot::GetInvCorpseSlotName(inv_slot); - size_t type_size = invtype::GetInvTypeSize(inv_type); + int16 type_size = invtype::GetInvTypeSize(inv_type); - if (!type_size || inv_slot == invslot::InvSlotInvalid) + if (!type_size || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; - if ((size_t)(inv_slot + 1) >= type_size) + if ((inv_slot + 1) >= type_size) return "Unknown Slot"; static std::string ret_str; @@ -243,12 +243,12 @@ const char* SoF::invslot::GetInvSlotName(int inv_type, int inv_slot) return ret_str.c_str(); } -const char* SoF::invbag::GetInvBagIndexName(int bag_index) +const char* SoF::invbag::GetInvBagIndexName(int16 bag_index) { - if (bag_index == invbag::InvBagInvalid) + if (bag_index == invbag::SLOT_INVALID) return "Invalid Bag"; - if ((size_t)bag_index >= invbag::ItemBagSize) + if (bag_index >= invbag::SLOT_COUNT) return "Unknown Bag"; static std::string ret_str; @@ -257,12 +257,12 @@ const char* SoF::invbag::GetInvBagIndexName(int bag_index) return ret_str.c_str(); } -const char* SoF::invaug::GetInvAugIndexName(int aug_index) +const char* SoF::invaug::GetInvAugIndexName(int16 aug_index) { - if (aug_index == invaug::InvAugInvalid) + if (aug_index == invaug::SOCKET_INVALID) return "Invalid Augment"; - if ((size_t)aug_index >= invaug::ItemAugSize) + if (aug_index >= invaug::SOCKET_COUNT) return "Unknown Augment"; static std::string ret_str; diff --git a/common/patches/sof_limits.h b/common/patches/sof_limits.h index d34197a90..fdc688370 100644 --- a/common/patches/sof_limits.h +++ b/common/patches/sof_limits.h @@ -27,108 +27,218 @@ namespace SoF { - enum : int { Invalid = -1, Null, Safety }; + const int16 IINVALID = -1; + const int16 INULL = 0; - enum : bool { False = false, True = true }; - - // pre-declarations namespace inventory { inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::SoF; } + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = false; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + } /*inventory*/ namespace invtype { inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::SoF; } - enum : int { InvTypeInvalid = -1, InvTypeBegin }; + namespace enum_ { + enum InventoryTypes : int16 { + typePossessions = INULL, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, + typeTribute, + typeGuildTribute, + typeMerchant, + typeCorpse, + typeBazaar, + typeInspect, + typeViewMODPC, + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, + typeOther + }; - enum InventoryType : int { - InvTypePossessions = InvTypeBegin, - InvTypeBank, - InvTypeSharedBank, - InvTypeTrade, - InvTypeWorld, - InvTypeLimbo, - InvTypeTribute, - InvTypeGuildTribute, - InvTypeMerchant, - InvTypeCorpse, - InvTypeBazaar, - InvTypeInspect, - InvTypeViewMODPC, - InvTypeViewMODBank, - InvTypeViewMODSharedBank, - InvTypeViewMODLimbo, - InvTypeAltStorage, - InvTypeArchived, - InvTypeOther, - InvTypeCount - }; + } // namespace enum_ + using namespace enum_; + + const int16 POSSESSIONS_SIZE = 32; + const int16 BANK_SIZE = 24; + const int16 SHARED_BANK_SIZE = 2; + const int16 TRADE_SIZE = 8; + const int16 WORLD_SIZE = 10; + const int16 LIMBO_SIZE = 36; + const int16 TRIBUTE_SIZE = 5; + const int16 GUILD_TRIBUTE_SIZE = 2; + const int16 MERCHANT_SIZE = 80; + const int16 CORPSE_SIZE = POSSESSIONS_SIZE; + const int16 BAZAAR_SIZE = 80; + const int16 INSPECT_SIZE = 23; + const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE; + const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE; + const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE; + const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE; + const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank" + const int16 ARCHIVED_SIZE = 0;//unknown + const int16 OTHER_SIZE = 0;//unknown + + const int16 TRADE_NPC_SIZE = 4; // defined by implication + + const int16 TYPE_INVALID = IINVALID; + const int16 TYPE_BEGIN = typePossessions; + const int16 TYPE_END = typeOther; + const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1; + + int16 GetInvTypeSize(int16 inv_type); + const char* GetInvTypeName(int16 inv_type); + + bool IsInvTypePersistent(int16 inv_type); } /*invtype*/ namespace invslot { inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::SoF; } - enum : int { InvSlotInvalid = -1, InvSlotBegin }; + namespace enum_ { + enum InventorySlots : int16 { + slotCharm = INULL, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, + slotPowerSource, + slotAmmo, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotCursor + }; - enum PossessionsSlot : int { - PossessionsCharm = InvSlotBegin, - PossessionsEar1, - PossessionsHead, - PossessionsFace, - PossessionsEar2, - PossessionsNeck, - PossessionsShoulders, - PossessionsArms, - PossessionsBack, - PossessionsWrist1, - PossessionsWrist2, - PossessionsRange, - PossessionsHands, - PossessionsPrimary, - PossessionsSecondary, - PossessionsFinger1, - PossessionsFinger2, - PossessionsChest, - PossessionsLegs, - PossessionsFeet, - PossessionsWaist, - PossessionsPowerSource, - PossessionsAmmo, - PossessionsGeneral1, - PossessionsGeneral2, - PossessionsGeneral3, - PossessionsGeneral4, - PossessionsGeneral5, - PossessionsGeneral6, - PossessionsGeneral7, - PossessionsGeneral8, - PossessionsCursor, - PossessionsCount - }; + } // namespace enum_ + using namespace enum_; - const int EquipmentBegin = PossessionsCharm; - const int EquipmentEnd = PossessionsAmmo; - const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; - const int GeneralBegin = PossessionsGeneral1; - const int GeneralEnd = PossessionsGeneral8; - const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + const int16 POSSESSIONS_BEGIN = slotCharm; + const int16 POSSESSIONS_END = slotCursor; + const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1; + + const int16 EQUIPMENT_BEGIN = slotCharm; + const int16 EQUIPMENT_END = slotAmmo; + const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN + 1); + + const int16 GENERAL_BEGIN = slotGeneral1; + const int16 GENERAL_END = slotGeneral8; + const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN + 1); + + const int16 BONUS_BEGIN = invslot::slotCharm; + const int16 BONUS_STAT_END = invslot::slotPowerSource; + const int16 BONUS_SKILL_END = invslot::slotAmmo; + + const int16 BANK_BEGIN = 2000; + const int16 BANK_END = (BANK_BEGIN + invtype::BANK_SIZE) - 1; + + const int16 SHARED_BANK_BEGIN = 2500; + const int16 SHARED_BANK_END = (SHARED_BANK_BEGIN + invtype::SHARED_BANK_SIZE) - 1; + + const int16 TRADE_BEGIN = 3000; + const int16 TRADE_END = (TRADE_BEGIN + invtype::TRADE_SIZE) - 1; + + const int16 TRADE_NPC_END = (TRADE_BEGIN + invtype::TRADE_NPC_SIZE) - 1; // defined by implication + + const int16 WORLD_BEGIN = 4000; + const int16 WORLD_END = (WORLD_BEGIN + invtype::WORLD_SIZE) - 1; + + const int16 TRIBUTE_BEGIN = 400; + const int16 TRIBUTE_END = (TRIBUTE_BEGIN + invtype::TRIBUTE_SIZE) - 1; + + const int16 GUILD_TRIBUTE_BEGIN = 450; + const int16 GUILD_TRIBUTE_END = (GUILD_TRIBUTE_BEGIN + invtype::GUILD_TRIBUTE_SIZE) - 1; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor; + + const uint64 POSSESSIONS_BITMASK = 0x000000027FFFFFFF; // based on 34-slot count (RoF+) + const uint64 CORPSE_BITMASK = 0x01FFFFFE7F800000; // based on 34-slot count (RoF+) + + const char* GetInvPossessionsSlotName(int16 inv_slot); + const char* GetInvCorpseSlotName(int16 inv_slot); + const char* GetInvSlotName(int16 inv_type, int16 inv_slot); } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::SoF; } - enum : int { InvBagInvalid = -1, InvBagBegin }; + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; + const int16 SLOT_END = 9; + const int16 SLOT_COUNT = 10; + + const int16 GENERAL_BAGS_BEGIN = 262; + const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT; + const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1; + + const int16 CURSOR_BAG_BEGIN = 342; + const int16 CURSOR_BAG_COUNT = SLOT_COUNT; + const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1; + + const int16 BANK_BAGS_BEGIN = 2032; + const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT); + const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1; + + const int16 SHARED_BANK_BAGS_BEGIN = 2532; + const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT; + const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1; + + const int16 TRADE_BAGS_BEGIN = 3031; + const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT; + const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1; + + const char* GetInvBagIndexName(int16 bag_index); } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::SoF; } - enum : int { InvAugInvalid = -1, InvAugBegin }; + const int16 SOCKET_INVALID = IINVALID; + const int16 SOCKET_BEGIN = INULL; + const int16 SOCKET_END = 4; + const int16 SOCKET_COUNT = 5; + + const char* GetInvAugIndexName(int16 aug_index); } /*invaug*/ @@ -153,147 +263,21 @@ namespace SoF namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::SoF; } + const int16 BANDOLIERS_SIZE = 20; // number of bandolier instances + const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + const int16 POTION_BELT_SIZE = 5; + + const int16 SKILL_ARRAY_SIZE = 100; + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::SoF; } - } /*constants*/ + const size_t CHARACTER_CREATION_LIMIT = 12; - namespace behavior { - inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::SoF; } - - } /*behavior*/ - - namespace skills { - inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoF; } - - } /*skills*/ - - - // declarations - namespace inventory { - const bool ConcatenateInvTypeLimbo = true; - - const bool AllowOverLevelEquipment = false; - - const bool AllowEmptyBagInBag = false; - const bool AllowClickCastFromBag = false; - - } /*inventory*/ - - namespace invtype { - const size_t InvTypePossessionsSize = invslot::PossessionsCount; - const size_t InvTypeBankSize = 24; - const size_t InvTypeSharedBankSize = 2; - const size_t InvTypeTradeSize = 8; - const size_t InvTypeWorldSize = 10; - const size_t InvTypeLimboSize = 36; - const size_t InvTypeTributeSize = 5; - const size_t InvTypeGuildTributeSize = 2; - const size_t InvTypeMerchantSize = 80; - const size_t InvTypeCorpseSize = InvTypePossessionsSize; - const size_t InvTypeBazaarSize = 80; - const size_t InvTypeInspectSize = invslot::EquipmentCount; - const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; - const size_t InvTypeViewMODBankSize = InvTypeBankSize; - const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; - const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; - const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" - const size_t InvTypeArchivedSize = 0;//unknown - const size_t InvTypeOtherSize = 0;//unknown - - extern size_t GetInvTypeSize(int inv_type); - extern const char* GetInvTypeName(int inv_type); - - extern bool IsInvTypePersistent(int inv_type); - - } /*invtype*/ - - namespace invslot { - const int BankBegin = 2000; - const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; - - const int SharedBankBegin = 2500; - const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; - - const int TradeBegin = 3000; - const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; - const int TradeNPCEnd = 3003; - - const int WorldBegin = 4000; - const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; - - const int TributeBegin = 400; - const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1; - - const int GuildTributeBegin = 450; - const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1; - - const int CorpseBegin = PossessionsGeneral1; - const int CorpseEnd = PossessionsGeneral1 + PossessionsCursor; - - extern const char* GetInvPossessionsSlotName(int inv_slot); - extern const char* GetInvCorpseSlotName(int inv_slot); - extern const char* GetInvSlotName(int inv_type, int inv_slot); - - } /*invslot*/ - - namespace invbag { - const size_t ItemBagSize = 10; - - const int GeneralBagsBegin = 262; - const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; - const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; - - const int CursorBagBegin = 342; - const int CursorBagSize = ItemBagSize; - const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; - - const int BankBagsBegin = 2032; - const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); - const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; - - const int SharedBankBagsBegin = 2532; - const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; - const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; - - const int TradeBagsBegin = 3031; - const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; - const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; - - extern const char* GetInvBagIndexName(int bag_index); - - } /*invbag*/ - - namespace invaug { - const size_t ItemAugSize = 5; - - extern const char* GetInvAugIndexName(int aug_index); - - } /*invaug*/ - - namespace item { - - } /*item*/ - - namespace profile { - const size_t TributeSize = invtype::InvTypeTributeSize; - const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize; - - const size_t BandoliersSize = 20; // number of bandolier instances - const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance - - const size_t PotionBeltSize = 5; - - const size_t SkillArraySize = 100; - - } /*profile*/ - - namespace constants { - const size_t CharacterCreationLimit = 12; - - const size_t SayLinkBodySize = 50; + const size_t SAY_LINK_BODY_SIZE = 50; const int LongBuffs = 25; const int ShortBuffs = 15; @@ -306,11 +290,15 @@ namespace SoF } /*constants*/ namespace behavior { + inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::SoF; } + const bool CoinHasWeight = true; } /*behavior*/ namespace skills { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::SoF; } + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; } /*skills*/ diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 29272a7a6..a312b48a8 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -717,7 +717,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -731,7 +731,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[profile::PotionBeltSize]; + PotionBeltItem_Struct Items[profile::POTION_BELT_SIZE]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -937,7 +937,7 @@ struct PlayerProfile_Struct //23576 Octets /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[profile::BANDOLIERS_SIZE]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index bf3c3d359..6d0e0dcaa 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1051,18 +1051,18 @@ namespace Titanium // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { + for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { + for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1072,13 +1072,13 @@ namespace Titanium // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { + for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { + for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -2442,7 +2442,7 @@ namespace Titanium ob << StringFormat("%.*s\"", depth, protection); // Quotes (and protection, if needed) around static data // Sub data - for (int index = EQEmu::inventory::containerBegin; index < invbag::ItemBagSize; ++index) { + for (int index = EQEmu::invbag::SLOT_BEGIN; index <= invbag::SLOT_END; ++index) { ob << '|'; EQEmu::ItemInstance* sub = inst->GetItem(index); @@ -2490,7 +2490,7 @@ namespace Titanium static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink) { - if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) { + if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { titaniumSayLink = serverSayLink; return; } @@ -2499,7 +2499,7 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { titaniumSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -2530,7 +2530,7 @@ namespace Titanium static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink) { - if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (titaniumSayLink.find('\x12') == std::string::npos)) { + if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (titaniumSayLink.find('\x12') == std::string::npos)) { serverSayLink = titaniumSayLink; return; } @@ -2539,7 +2539,7 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { serverSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/titanium_limits.cpp b/common/patches/titanium_limits.cpp index 3976e8217..2cab723f0 100644 --- a/common/patches/titanium_limits.cpp +++ b/common/patches/titanium_limits.cpp @@ -22,196 +22,196 @@ #include "../string_util.h" -size_t Titanium::invtype::GetInvTypeSize(int inv_type) +int16 Titanium::invtype::GetInvTypeSize(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - return invtype::InvTypePossessionsSize; - case invtype::InvTypeBank: - return invtype::InvTypeBankSize; - case invtype::InvTypeSharedBank: - return invtype::InvTypeSharedBankSize; - case invtype::InvTypeTrade: - return invtype::InvTypeTradeSize; - case invtype::InvTypeWorld: - return invtype::InvTypeWorldSize; - case invtype::InvTypeLimbo: - return invtype::InvTypeLimboSize; - case invtype::InvTypeTribute: - return invtype::InvTypeTributeSize; - case invtype::InvTypeGuildTribute: - return invtype::InvTypeGuildTributeSize; - case invtype::InvTypeMerchant: - return invtype::InvTypeMerchantSize; - case invtype::InvTypeCorpse: - return invtype::InvTypeCorpseSize; - case invtype::InvTypeBazaar: - return invtype::InvTypeBazaarSize; - case invtype::InvTypeInspect: - return invtype::InvTypeInspectSize; - case invtype::InvTypeViewMODPC: - return invtype::InvTypeViewMODPCSize; - case invtype::InvTypeViewMODBank: - return invtype::InvTypeViewMODBankSize; - case invtype::InvTypeViewMODSharedBank: - return invtype::InvTypeViewMODSharedBankSize; - case invtype::InvTypeViewMODLimbo: - return invtype::InvTypeViewMODLimboSize; - case invtype::InvTypeAltStorage: - return invtype::InvTypeAltStorageSize; - case invtype::InvTypeArchived: - return invtype::InvTypeArchivedSize; - case invtype::InvTypeOther: - return invtype::InvTypeOtherSize; + case invtype::typePossessions: + return invtype::POSSESSIONS_SIZE; + case invtype::typeBank: + return invtype::BANK_SIZE; + case invtype::typeSharedBank: + return invtype::SHARED_BANK_SIZE; + case invtype::typeTrade: + return invtype::TRADE_SIZE; + case invtype::typeWorld: + return invtype::WORLD_SIZE; + case invtype::typeLimbo: + return invtype::LIMBO_SIZE; + case invtype::typeTribute: + return invtype::TRIBUTE_SIZE; + case invtype::typeGuildTribute: + return invtype::GUILD_TRIBUTE_SIZE; + case invtype::typeMerchant: + return invtype::MERCHANT_SIZE; + case invtype::typeCorpse: + return invtype::CORPSE_SIZE; + case invtype::typeBazaar: + return invtype::BAZAAR_SIZE; + case invtype::typeInspect: + return invtype::INSPECT_SIZE; + case invtype::typeViewMODPC: + return invtype::VIEW_MOD_PC_SIZE; + case invtype::typeViewMODBank: + return invtype::VIEW_MOD_BANK_SIZE; + case invtype::typeViewMODSharedBank: + return invtype::VIEW_MOD_SHARED_BANK_SIZE; + case invtype::typeViewMODLimbo: + return invtype::VIEW_MOD_LIMBO_SIZE; + case invtype::typeAltStorage: + return invtype::ALT_STORAGE_SIZE; + case invtype::typeArchived: + return invtype::ARCHIVED_SIZE; + case invtype::typeOther: + return invtype::OTHER_SIZE; default: - return 0; + return INULL; } } -const char* Titanium::invtype::GetInvTypeName(int inv_type) +const char* Titanium::invtype::GetInvTypeName(int16 inv_type) { switch (inv_type) { - case invtype::InvTypeInvalid: + case invtype::TYPE_INVALID: return "Invalid Type"; - case invtype::InvTypePossessions: + case invtype::typePossessions: return "Possessions"; - case invtype::InvTypeBank: + case invtype::typeBank: return "Bank"; - case invtype::InvTypeSharedBank: + case invtype::typeSharedBank: return "Shared Bank"; - case invtype::InvTypeTrade: + case invtype::typeTrade: return "Trade"; - case invtype::InvTypeWorld: + case invtype::typeWorld: return "World"; - case invtype::InvTypeLimbo: + case invtype::typeLimbo: return "Limbo"; - case invtype::InvTypeTribute: + case invtype::typeTribute: return "Tribute"; - case invtype::InvTypeGuildTribute: + case invtype::typeGuildTribute: return "Guild Tribute"; - case invtype::InvTypeMerchant: + case invtype::typeMerchant: return "Merchant"; - case invtype::InvTypeCorpse: + case invtype::typeCorpse: return "Corpse"; - case invtype::InvTypeBazaar: + case invtype::typeBazaar: return "Bazaar"; - case invtype::InvTypeInspect: + case invtype::typeInspect: return "Inspect"; - case invtype::InvTypeViewMODPC: + case invtype::typeViewMODPC: return "View MOD PC"; - case invtype::InvTypeViewMODBank: + case invtype::typeViewMODBank: return "View MOD Bank"; - case invtype::InvTypeViewMODSharedBank: + case invtype::typeViewMODSharedBank: return "View MOD Shared Bank"; - case invtype::InvTypeViewMODLimbo: + case invtype::typeViewMODLimbo: return "View MOD Limbo"; - case invtype::InvTypeAltStorage: + case invtype::typeAltStorage: return "Alt Storage"; - case invtype::InvTypeArchived: + case invtype::typeArchived: return "Archived"; - case invtype::InvTypeOther: + case invtype::typeOther: return "Other"; default: return "Unknown Type"; } } -bool Titanium::invtype::IsInvTypePersistent(int inv_type) +bool Titanium::invtype::IsInvTypePersistent(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - case invtype::InvTypeBank: - case invtype::InvTypeSharedBank: - case invtype::InvTypeTrade: - case invtype::InvTypeWorld: - case invtype::InvTypeLimbo: - case invtype::InvTypeTribute: - case invtype::InvTypeGuildTribute: + case invtype::typePossessions: + case invtype::typeBank: + case invtype::typeSharedBank: + case invtype::typeTrade: + case invtype::typeWorld: + case invtype::typeLimbo: + case invtype::typeTribute: + case invtype::typeGuildTribute: return true; default: return false; } } -const char* Titanium::invslot::GetInvPossessionsSlotName(int inv_slot) +const char* Titanium::invslot::GetInvPossessionsSlotName(int16 inv_slot) { switch (inv_slot) { - case invslot::InvSlotInvalid: + case invslot::SLOT_INVALID: return "Invalid Slot"; - case invslot::PossessionsCharm: + case invslot::slotCharm: return "Charm"; - case invslot::PossessionsEar1: + case invslot::slotEar1: return "Ear 1"; - case invslot::PossessionsHead: + case invslot::slotHead: return "Head"; - case invslot::PossessionsFace: + case invslot::slotFace: return "Face"; - case invslot::PossessionsEar2: + case invslot::slotEar2: return "Ear 2"; - case invslot::PossessionsNeck: + case invslot::slotNeck: return "Neck"; - case invslot::PossessionsShoulders: + case invslot::slotShoulders: return "Shoulders"; - case invslot::PossessionsArms: + case invslot::slotArms: return "Arms"; - case invslot::PossessionsBack: + case invslot::slotBack: return "Back"; - case invslot::PossessionsWrist1: + case invslot::slotWrist1: return "Wrist 1"; - case invslot::PossessionsWrist2: + case invslot::slotWrist2: return "Wrist 2"; - case invslot::PossessionsRange: + case invslot::slotRange: return "Range"; - case invslot::PossessionsHands: + case invslot::slotHands: return "Hands"; - case invslot::PossessionsPrimary: + case invslot::slotPrimary: return "Primary"; - case invslot::PossessionsSecondary: + case invslot::slotSecondary: return "Secondary"; - case invslot::PossessionsFinger1: + case invslot::slotFinger1: return "Finger 1"; - case invslot::PossessionsFinger2: + case invslot::slotFinger2: return "Finger 2"; - case invslot::PossessionsChest: + case invslot::slotChest: return "Chest"; - case invslot::PossessionsLegs: + case invslot::slotLegs: return "Legs"; - case invslot::PossessionsFeet: + case invslot::slotFeet: return "Feet"; - case invslot::PossessionsWaist: + case invslot::slotWaist: return "Waist"; - case invslot::PossessionsAmmo: + case invslot::slotAmmo: return "Ammo"; - case invslot::PossessionsGeneral1: + case invslot::slotGeneral1: return "General 1"; - case invslot::PossessionsGeneral2: + case invslot::slotGeneral2: return "General 2"; - case invslot::PossessionsGeneral3: + case invslot::slotGeneral3: return "General 3"; - case invslot::PossessionsGeneral4: + case invslot::slotGeneral4: return "General 4"; - case invslot::PossessionsGeneral5: + case invslot::slotGeneral5: return "General 5"; - case invslot::PossessionsGeneral6: + case invslot::slotGeneral6: return "General 6"; - case invslot::PossessionsGeneral7: + case invslot::slotGeneral7: return "General 7"; - case invslot::PossessionsGeneral8: + case invslot::slotGeneral8: return "General 8"; - case invslot::PossessionsCursor: + case invslot::slotCursor: return "Cursor"; default: return "Unknown Slot"; } } -const char* Titanium::invslot::GetInvCorpseSlotName(int inv_slot) +const char* Titanium::invslot::GetInvCorpseSlotName(int16 inv_slot) { - if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + if (!invtype::GetInvTypeSize(invtype::typeCorpse) || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; // needs work - if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + if ((inv_slot + 1) < invslot::CORPSE_BEGIN || (inv_slot + 1) >= invslot::CORPSE_END) return "Unknown Slot"; static std::string ret_str; @@ -220,19 +220,19 @@ const char* Titanium::invslot::GetInvCorpseSlotName(int inv_slot) return ret_str.c_str(); } -const char* Titanium::invslot::GetInvSlotName(int inv_type, int inv_slot) +const char* Titanium::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot) { - if (inv_type == invtype::InvTypePossessions) + if (inv_type == invtype::typePossessions) return invslot::GetInvPossessionsSlotName(inv_slot); - else if (inv_type == invtype::InvTypeCorpse) + else if (inv_type == invtype::typeCorpse) return invslot::GetInvCorpseSlotName(inv_slot); - size_t type_size = invtype::GetInvTypeSize(inv_type); + int16 type_size = invtype::GetInvTypeSize(inv_type); - if (!type_size || inv_slot == invslot::InvSlotInvalid) + if (!type_size || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; - if ((size_t)(inv_slot + 1) >= type_size) + if ((inv_slot + 1) >= type_size) return "Unknown Slot"; static std::string ret_str; @@ -241,12 +241,12 @@ const char* Titanium::invslot::GetInvSlotName(int inv_type, int inv_slot) return ret_str.c_str(); } -const char* Titanium::invbag::GetInvBagIndexName(int bag_index) +const char* Titanium::invbag::GetInvBagIndexName(int16 bag_index) { - if (bag_index == invbag::InvBagInvalid) + if (bag_index == invbag::SLOT_INVALID) return "Invalid Bag"; - if ((size_t)bag_index >= invbag::ItemBagSize) + if (bag_index >= invbag::SLOT_COUNT) return "Unknown Bag"; static std::string ret_str; @@ -255,12 +255,12 @@ const char* Titanium::invbag::GetInvBagIndexName(int bag_index) return ret_str.c_str(); } -const char* Titanium::invaug::GetInvAugIndexName(int aug_index) +const char* Titanium::invaug::GetInvAugIndexName(int16 aug_index) { - if (aug_index == invaug::InvAugInvalid) + if (aug_index == invaug::SOCKET_INVALID) return "Invalid Augment"; - if ((size_t)aug_index >= invaug::ItemAugSize) + if (aug_index >= invaug::SOCKET_COUNT) return "Unknown Augment"; static std::string ret_str; diff --git a/common/patches/titanium_limits.h b/common/patches/titanium_limits.h index 3266ade6f..cd69c21e1 100644 --- a/common/patches/titanium_limits.h +++ b/common/patches/titanium_limits.h @@ -27,107 +27,217 @@ namespace Titanium { - enum : int { Invalid = -1, Null, Safety }; + const int16 IINVALID = -1; + const int16 INULL = 0; - enum : bool { False = false, True = true }; - - // pre-declarations namespace inventory { inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::Titanium; } + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = false; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + } /*inventory*/ namespace invtype { inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::Titanium; } - enum : int { InvTypeInvalid = -1, InvTypeBegin }; + namespace enum_ { + enum InventoryTypes : int16 { + typePossessions = INULL, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, + typeTribute, + typeGuildTribute, + typeMerchant, + typeCorpse, + typeBazaar, + typeInspect, + typeViewMODPC, + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, + typeOther + }; - enum InventoryType : int { - InvTypePossessions = InvTypeBegin, - InvTypeBank, - InvTypeSharedBank, - InvTypeTrade, - InvTypeWorld, - InvTypeLimbo, - InvTypeTribute, - InvTypeGuildTribute, - InvTypeMerchant, - InvTypeCorpse, - InvTypeBazaar, - InvTypeInspect, - InvTypeViewMODPC, - InvTypeViewMODBank, - InvTypeViewMODSharedBank, - InvTypeViewMODLimbo, - InvTypeAltStorage, - InvTypeArchived, - InvTypeOther, - InvTypeCount - }; + } // namespace enum_ + using namespace enum_; + + const int16 POSSESSIONS_SIZE = 31; + const int16 BANK_SIZE = 16; + const int16 SHARED_BANK_SIZE = 2; + const int16 TRADE_SIZE = 8; + const int16 WORLD_SIZE = 10; + const int16 LIMBO_SIZE = 36; + const int16 TRIBUTE_SIZE = 5; + const int16 GUILD_TRIBUTE_SIZE = 2; + const int16 MERCHANT_SIZE = 80; + const int16 CORPSE_SIZE = POSSESSIONS_SIZE; + const int16 BAZAAR_SIZE = 80; + const int16 INSPECT_SIZE = 22; + const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE; + const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE; + const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE; + const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE; + const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank" + const int16 ARCHIVED_SIZE = 0;//unknown + const int16 OTHER_SIZE = 0;//unknown + + const int16 TRADE_NPC_SIZE = 4; // defined by implication + + const int16 TYPE_INVALID = IINVALID; + const int16 TYPE_BEGIN = typePossessions; + const int16 TYPE_END = typeOther; + const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1; + + int16 GetInvTypeSize(int16 inv_type); + const char* GetInvTypeName(int16 inv_type); + + bool IsInvTypePersistent(int16 inv_type); } /*invtype*/ namespace invslot { inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::Titanium; } - enum : int { InvSlotInvalid = -1, InvSlotBegin }; + namespace enum_ { + enum InventorySlots : int16 { + slotCharm = INULL, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, + slotAmmo, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotCursor + }; - enum PossessionsSlot : int { - PossessionsCharm = InvSlotBegin, - PossessionsEar1, - PossessionsHead, - PossessionsFace, - PossessionsEar2, - PossessionsNeck, - PossessionsShoulders, - PossessionsArms, - PossessionsBack, - PossessionsWrist1, - PossessionsWrist2, - PossessionsRange, - PossessionsHands, - PossessionsPrimary, - PossessionsSecondary, - PossessionsFinger1, - PossessionsFinger2, - PossessionsChest, - PossessionsLegs, - PossessionsFeet, - PossessionsWaist, - PossessionsAmmo, - PossessionsGeneral1, - PossessionsGeneral2, - PossessionsGeneral3, - PossessionsGeneral4, - PossessionsGeneral5, - PossessionsGeneral6, - PossessionsGeneral7, - PossessionsGeneral8, - PossessionsCursor, - PossessionsCount - }; + } // namespace enum_ + using namespace enum_; - const int EquipmentBegin = PossessionsCharm; - const int EquipmentEnd = PossessionsAmmo; - const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; - const int GeneralBegin = PossessionsGeneral1; - const int GeneralEnd = PossessionsGeneral8; - const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + const int16 POSSESSIONS_BEGIN = slotCharm; + const int16 POSSESSIONS_END = slotCursor; + const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1; + + const int16 EQUIPMENT_BEGIN = slotCharm; + const int16 EQUIPMENT_END = slotAmmo; + const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN + 1); + + const int16 GENERAL_BEGIN = slotGeneral1; + const int16 GENERAL_END = slotGeneral8; + const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN + 1); + + const int16 BONUS_BEGIN = invslot::slotCharm; + const int16 BONUS_STAT_END = invslot::slotWaist; + const int16 BONUS_SKILL_END = invslot::slotAmmo; + + const int16 BANK_BEGIN = 2000; + const int16 BANK_END = (BANK_BEGIN + invtype::BANK_SIZE) - 1; + + const int16 SHARED_BANK_BEGIN = 2500; + const int16 SHARED_BANK_END = (SHARED_BANK_BEGIN + invtype::SHARED_BANK_SIZE) - 1; + + const int16 TRADE_BEGIN = 3000; + const int16 TRADE_END = (TRADE_BEGIN + invtype::TRADE_SIZE) - 1; + + const int16 TRADE_NPC_END = (TRADE_BEGIN + invtype::TRADE_NPC_SIZE) - 1; // defined by implication + + const int16 WORLD_BEGIN = 4000; + const int16 WORLD_END = (WORLD_BEGIN + invtype::WORLD_SIZE) - 1; + + const int16 TRIBUTE_BEGIN = 400; + const int16 TRIBUTE_END = (TRIBUTE_BEGIN + invtype::TRIBUTE_SIZE) - 1; + + const int16 GUILD_TRIBUTE_BEGIN = 450; + const int16 GUILD_TRIBUTE_END = (GUILD_TRIBUTE_BEGIN + invtype::GUILD_TRIBUTE_SIZE) - 1; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor; + + const uint64 POSSESSIONS_BITMASK = 0x000000027FDFFFFF; // based on 34-slot count (RoF+) + const uint64 CORPSE_BITMASK = 0x017FFFFE7F800000; // based on 34-slot count (RoF+) + + const char* GetInvPossessionsSlotName(int16 inv_slot); + const char* GetInvCorpseSlotName(int16 inv_slot); + const char* GetInvSlotName(int16 inv_type, int16 inv_slot); } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::Titanium; } - enum : int { InvBagInvalid = -1, InvBagBegin }; + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; + const int16 SLOT_END = 9; + const int16 SLOT_COUNT = 10; + + const int16 GENERAL_BAGS_BEGIN = 251; + const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT; + const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1; + + const int16 CURSOR_BAG_BEGIN = 331; + const int16 CURSOR_BAG_COUNT = SLOT_COUNT; + const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1; + + const int16 BANK_BAGS_BEGIN = 2031; + const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT); + const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1; + + const int16 SHARED_BANK_BAGS_BEGIN = 2531; + const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT; + const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1; + + const int16 TRADE_BAGS_BEGIN = 3031; + const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT; + const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1; + + const char* GetInvBagIndexName(int16 bag_index); } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::Titanium; } - enum : int { InvAugInvalid = -1, InvAugBegin }; + const int16 SOCKET_INVALID = IINVALID; + const int16 SOCKET_BEGIN = INULL; + const int16 SOCKET_END = 4; + const int16 SOCKET_COUNT = 5; + + const char* GetInvAugIndexName(int16 aug_index); } /*invaug*/ @@ -152,147 +262,21 @@ namespace Titanium namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::Titanium; } + const int16 BANDOLIERS_SIZE = 4; // number of bandolier instances + const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + const int16 POTION_BELT_SIZE = 4; + + const int16 SKILL_ARRAY_SIZE = 100; + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::Titanium; } - } /*constants*/ + const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER - namespace behavior { - inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::Titanium; } - - } /*behavior*/ - - namespace skills { - inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::Titanium; } - - } /*skills*/ - - - // declarations - namespace inventory { - const bool ConcatenateInvTypeLimbo = true; - - const bool AllowOverLevelEquipment = false; - - const bool AllowEmptyBagInBag = false; - const bool AllowClickCastFromBag = false; - - } /*inventory*/ - - namespace invtype { - const size_t InvTypePossessionsSize = invslot::PossessionsCount; - const size_t InvTypeBankSize = 16; - const size_t InvTypeSharedBankSize = 2; - const size_t InvTypeTradeSize = 8; - const size_t InvTypeWorldSize = 10; - const size_t InvTypeLimboSize = 36; - const size_t InvTypeTributeSize = 5; - const size_t InvTypeGuildTributeSize = 2; - const size_t InvTypeMerchantSize = 80; - const size_t InvTypeCorpseSize = InvTypePossessionsSize; - const size_t InvTypeBazaarSize = 80; - const size_t InvTypeInspectSize = invslot::EquipmentCount; - const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; - const size_t InvTypeViewMODBankSize = InvTypeBankSize; - const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; - const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; - const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" - const size_t InvTypeArchivedSize = 0;//unknown - const size_t InvTypeOtherSize = 0;//unknown - - extern size_t GetInvTypeSize(int inv_type); - extern const char* GetInvTypeName(int inv_type); - - extern bool IsInvTypePersistent(int inv_type); - - } /*invtype*/ - - namespace invslot { - const int BankBegin = 2000; - const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; - - const int SharedBankBegin = 2500; - const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; - - const int TradeBegin = 3000; - const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; - const int TradeNPCEnd = 3003; - - const int WorldBegin = 4000; - const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; - - const int TributeBegin = 400; - const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1; - - const int GuildTributeBegin = 450; - const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1; - - const int CorpseBegin = PossessionsGeneral1; - const int CorpseEnd = PossessionsGeneral1 + PossessionsCursor; - - extern const char* GetInvPossessionsSlotName(int inv_slot); - extern const char* GetInvCorpseSlotName(int inv_slot); - extern const char* GetInvSlotName(int inv_type, int inv_slot); - - } /*invslot*/ - - namespace invbag { - const size_t ItemBagSize = 10; - - const int GeneralBagsBegin = 251; - const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; - const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; - - const int CursorBagBegin = 331; - const int CursorBagSize = ItemBagSize; - const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; - - const int BankBagsBegin = 2031; - const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); - const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; - - const int SharedBankBagsBegin = 2531; - const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; - const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; - - const int TradeBagsBegin = 3031; - const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; - const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; - - extern const char* GetInvBagIndexName(int bag_index); - - } /*invbag*/ - - namespace invaug { - const size_t ItemAugSize = 5; - - extern const char* GetInvAugIndexName(int aug_index); - - } /*invaug*/ - - namespace item { - - } /*item*/ - - namespace profile { - const size_t TributeSize = invtype::InvTypeTributeSize; - const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize; - - const size_t BandoliersSize = 4; // number of bandolier instances - const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance - - const size_t PotionBeltSize = 4; - - const size_t SkillArraySize = 100; - - } /*profile*/ - - namespace constants { - const size_t CharacterCreationLimit = 8; // Hard-coded in client - DO NOT ALTER - - const size_t SayLinkBodySize = 45; + const size_t SAY_LINK_BODY_SIZE = 45; const int LongBuffs = 25; const int ShortBuffs = 12; @@ -305,11 +289,15 @@ namespace Titanium } /*constants*/ namespace behavior { + inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::Titanium; } + const bool CoinHasWeight = true; } /*behavior*/ namespace skills { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::Titanium; } + const size_t LastUsableSkill = EQEmu::skills::SkillFrenzy; } /*skills*/ diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 9f2d9423d..8cf202e31 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -655,7 +655,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -669,7 +669,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[profile::PotionBeltSize]; + PotionBeltItem_Struct Items[profile::POTION_BELT_SIZE]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -875,7 +875,7 @@ struct PlayerProfile_Struct /*06152*/ uint32 aapoints_spent; // Number of spent AA points /*06156*/ uint32 aapoints; // Unspent AA points /*06160*/ uint8 unknown06160[4]; -/*06164*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // bandolier contents +/*06164*/ Bandolier_Struct bandoliers[profile::BANDOLIERS_SIZE]; // bandolier contents /*07444*/ uint8 unknown07444[5120]; /*12564*/ PotionBelt_Struct potionbelt; // potion belt /*12852*/ uint8 unknown12852[8]; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 79fdca333..a947c65ff 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1881,18 +1881,18 @@ namespace UF // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { + for (r = 0; r < EQEmu::profile::BANDOLIERS_SIZE && r < profile::BANDOLIERS_SIZE; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { + for (r = EQEmu::profile::BANDOLIERS_SIZE; r < profile::BANDOLIERS_SIZE; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1902,13 +1902,13 @@ namespace UF // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { + for (r = 0; r < EQEmu::profile::POTION_BELT_SIZE && r < profile::POTION_BELT_SIZE; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { + for (r = EQEmu::profile::POTION_BELT_SIZE; r < profile::POTION_BELT_SIZE; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -2217,8 +2217,8 @@ namespace UF eq->CharCount = emu->CharCount; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > constants::CharacterCreationLimit) - eq->TotalChars = constants::CharacterCreationLimit; + if (eq->TotalChars > constants::CHARACTER_CREATION_LIMIT) + eq->TotalChars = constants::CHARACTER_CREATION_LIMIT; // Special Underfoot adjustment - field should really be 'AdditionalChars' or 'BonusChars' uint32 adjusted_total = eq->TotalChars - 8; // Yes, it rolls under for '< 8' - probably an int32 field @@ -2234,7 +2234,7 @@ namespace UF size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CHARACTER_CREATION_LIMIT; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -2250,8 +2250,8 @@ namespace UF eq->CharCount = character_count; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > constants::CharacterCreationLimit) - eq->TotalChars = constants::CharacterCreationLimit; + if (eq->TotalChars > constants::CHARACTER_CREATION_LIMIT) + eq->TotalChars = constants::CHARACTER_CREATION_LIMIT; // Special Underfoot adjustment - field should really be 'AdditionalChars' or 'BonusChars' in this client uint32 adjusted_total = eq->TotalChars - 8; // Yes, it rolls under for '< 8' - probably an int32 field @@ -3918,7 +3918,7 @@ namespace UF ibs.nodrop = item->NoDrop; ibs.attune = item->Attuneable; ibs.size = item->Size; - ibs.slots = SwapBits21and22(item->Slots); + ibs.slots = SwapBits21And22(item->Slots); ibs.price = item->Price; ibs.icon = item->Icon; ibs.unknown1 = 1; @@ -4008,7 +4008,7 @@ namespace UF isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < invaug::ItemAugSize; ++index) { + for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -4204,18 +4204,18 @@ namespace UF ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { + for (uint32 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; - if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); - else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); - else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + if (slot_id_in >= EQEmu::invslot::GENERAL_BEGIN && slot_id_in <= EQEmu::invslot::GENERAL_END) + SubSlotNumber = (((slot_id_in + 3) * EQEmu::invbag::SLOT_COUNT) + index + 1); + else if (slot_id_in >= EQEmu::invslot::BANK_BEGIN && slot_id_in <= EQEmu::invslot::BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::BANK_BAGS_BEGIN + index); + else if (slot_id_in >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::invslot::SHARED_BANK_END) + SubSlotNumber = (((slot_id_in - EQEmu::invslot::SHARED_BANK_BEGIN) * EQEmu::invbag::SLOT_COUNT) + EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -4233,16 +4233,16 @@ namespace UF { uint32 UnderfootSlot = 0; - if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (serverSlot >= EQEmu::invslot::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots UnderfootSlot = serverSlot + 1; - else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) + else if (serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::invbag::CURSOR_BAG_END) UnderfootSlot = serverSlot + 11; - else if (serverSlot >= EQEmu::legacy::BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) + else if (serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::BANK_BAGS_END) UnderfootSlot = serverSlot + 1; - else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) + else if (serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END) UnderfootSlot = serverSlot + 1; - else if (serverSlot == EQEmu::inventory::slotPowerSource) - UnderfootSlot = invslot::PossessionsPowerSource; + else if (serverSlot == EQEmu::invslot::SLOT_POWER_SOURCE) + UnderfootSlot = invslot::slotPowerSource; else UnderfootSlot = serverSlot; @@ -4259,16 +4259,16 @@ namespace UF { uint32 ServerSlot = 0; - if (ufSlot >= invslot::PossessionsAmmo && ufSlot <= invslot::CorpseEnd) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (ufSlot >= invslot::slotAmmo && ufSlot <= invslot::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots ServerSlot = ufSlot - 1; - else if (ufSlot >= invbag::GeneralBagsBegin && ufSlot <= invbag::CursorBagEnd) + else if (ufSlot >= invbag::GENERAL_BAGS_BEGIN && ufSlot <= invbag::CURSOR_BAG_END) ServerSlot = ufSlot - 11; - else if (ufSlot >= invbag::BankBagsBegin && ufSlot <= invbag::BankBagsEnd) + else if (ufSlot >= invbag::BANK_BAGS_BEGIN && ufSlot <= invbag::BANK_BAGS_END) ServerSlot = ufSlot - 1; - else if (ufSlot >= invbag::SharedBankBagsBegin && ufSlot <= invbag::SharedBankBagsEnd) + else if (ufSlot >= invbag::SHARED_BANK_BAGS_BEGIN && ufSlot <= invbag::SHARED_BANK_BAGS_END) ServerSlot = ufSlot - 1; - else if (ufSlot == invslot::PossessionsPowerSource) - ServerSlot = EQEmu::inventory::slotPowerSource; + else if (ufSlot == invslot::slotPowerSource) + ServerSlot = EQEmu::invslot::SLOT_POWER_SOURCE; else ServerSlot = ufSlot; @@ -4283,7 +4283,7 @@ namespace UF static inline void ServerToUFSayLink(std::string& ufSayLink, const std::string& serverSayLink) { - if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) { + if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { ufSayLink = serverSayLink; return; } @@ -4292,7 +4292,7 @@ namespace UF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { ufSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -4323,7 +4323,7 @@ namespace UF static inline void UFToServerSayLink(std::string& serverSayLink, const std::string& ufSayLink) { - if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (ufSayLink.find('\x12') == std::string::npos)) { + if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (ufSayLink.find('\x12') == std::string::npos)) { serverSayLink = ufSayLink; return; } @@ -4332,7 +4332,7 @@ namespace UF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= constants::SayLinkBodySize) { + if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { serverSayLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/uf_limits.cpp b/common/patches/uf_limits.cpp index ae415ddd8..7cf5ec63e 100644 --- a/common/patches/uf_limits.cpp +++ b/common/patches/uf_limits.cpp @@ -22,198 +22,198 @@ #include "../string_util.h" -size_t UF::invtype::GetInvTypeSize(int inv_type) +int16 UF::invtype::GetInvTypeSize(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - return invtype::InvTypePossessionsSize; - case invtype::InvTypeBank: - return invtype::InvTypeBankSize; - case invtype::InvTypeSharedBank: - return invtype::InvTypeSharedBankSize; - case invtype::InvTypeTrade: - return invtype::InvTypeTradeSize; - case invtype::InvTypeWorld: - return invtype::InvTypeWorldSize; - case invtype::InvTypeLimbo: - return invtype::InvTypeLimboSize; - case invtype::InvTypeTribute: - return invtype::InvTypeTributeSize; - case invtype::InvTypeGuildTribute: - return invtype::InvTypeGuildTributeSize; - case invtype::InvTypeMerchant: - return invtype::InvTypeMerchantSize; - case invtype::InvTypeCorpse: - return invtype::InvTypeCorpseSize; - case invtype::InvTypeBazaar: - return invtype::InvTypeBazaarSize; - case invtype::InvTypeInspect: - return invtype::InvTypeInspectSize; - case invtype::InvTypeViewMODPC: - return invtype::InvTypeViewMODPCSize; - case invtype::InvTypeViewMODBank: - return invtype::InvTypeViewMODBankSize; - case invtype::InvTypeViewMODSharedBank: - return invtype::InvTypeViewMODSharedBankSize; - case invtype::InvTypeViewMODLimbo: - return invtype::InvTypeViewMODLimboSize; - case invtype::InvTypeAltStorage: - return invtype::InvTypeAltStorageSize; - case invtype::InvTypeArchived: - return invtype::InvTypeArchivedSize; - case invtype::InvTypeOther: - return invtype::InvTypeOtherSize; + case invtype::typePossessions: + return invtype::POSSESSIONS_SIZE; + case invtype::typeBank: + return invtype::BANK_SIZE; + case invtype::typeSharedBank: + return invtype::SHARED_BANK_SIZE; + case invtype::typeTrade: + return invtype::TRADE_SIZE; + case invtype::typeWorld: + return invtype::WORLD_SIZE; + case invtype::typeLimbo: + return invtype::LIMBO_SIZE; + case invtype::typeTribute: + return invtype::TRIBUTE_SIZE; + case invtype::typeGuildTribute: + return invtype::GUILD_TRIBUTE_SIZE; + case invtype::typeMerchant: + return invtype::MERCHANT_SIZE; + case invtype::typeCorpse: + return invtype::CORPSE_SIZE; + case invtype::typeBazaar: + return invtype::BAZAAR_SIZE; + case invtype::typeInspect: + return invtype::INSPECT_SIZE; + case invtype::typeViewMODPC: + return invtype::VIEW_MOD_PC_SIZE; + case invtype::typeViewMODBank: + return invtype::VIEW_MOD_BANK_SIZE; + case invtype::typeViewMODSharedBank: + return invtype::VIEW_MOD_SHARED_BANK_SIZE; + case invtype::typeViewMODLimbo: + return invtype::VIEW_MOD_LIMBO_SIZE; + case invtype::typeAltStorage: + return invtype::ALT_STORAGE_SIZE; + case invtype::typeArchived: + return invtype::ARCHIVED_SIZE; + case invtype::typeOther: + return invtype::OTHER_SIZE; default: - return 0; + return INULL; } } -const char* UF::invtype::GetInvTypeName(int inv_type) +const char* UF::invtype::GetInvTypeName(int16 inv_type) { switch (inv_type) { - case invtype::InvTypeInvalid: + case invtype::TYPE_INVALID: return "Invalid Type"; - case invtype::InvTypePossessions: + case invtype::typePossessions: return "Possessions"; - case invtype::InvTypeBank: + case invtype::typeBank: return "Bank"; - case invtype::InvTypeSharedBank: + case invtype::typeSharedBank: return "Shared Bank"; - case invtype::InvTypeTrade: + case invtype::typeTrade: return "Trade"; - case invtype::InvTypeWorld: + case invtype::typeWorld: return "World"; - case invtype::InvTypeLimbo: + case invtype::typeLimbo: return "Limbo"; - case invtype::InvTypeTribute: + case invtype::typeTribute: return "Tribute"; - case invtype::InvTypeGuildTribute: + case invtype::typeGuildTribute: return "Guild Tribute"; - case invtype::InvTypeMerchant: + case invtype::typeMerchant: return "Merchant"; - case invtype::InvTypeCorpse: + case invtype::typeCorpse: return "Corpse"; - case invtype::InvTypeBazaar: + case invtype::typeBazaar: return "Bazaar"; - case invtype::InvTypeInspect: + case invtype::typeInspect: return "Inspect"; - case invtype::InvTypeViewMODPC: + case invtype::typeViewMODPC: return "View MOD PC"; - case invtype::InvTypeViewMODBank: + case invtype::typeViewMODBank: return "View MOD Bank"; - case invtype::InvTypeViewMODSharedBank: + case invtype::typeViewMODSharedBank: return "View MOD Shared Bank"; - case invtype::InvTypeViewMODLimbo: + case invtype::typeViewMODLimbo: return "View MOD Limbo"; - case invtype::InvTypeAltStorage: + case invtype::typeAltStorage: return "Alt Storage"; - case invtype::InvTypeArchived: + case invtype::typeArchived: return "Archived"; - case invtype::InvTypeOther: + case invtype::typeOther: return "Other"; default: return "Unknown Type"; } } -bool UF::invtype::IsInvTypePersistent(int inv_type) +bool UF::invtype::IsInvTypePersistent(int16 inv_type) { switch (inv_type) { - case invtype::InvTypePossessions: - case invtype::InvTypeBank: - case invtype::InvTypeSharedBank: - case invtype::InvTypeTrade: - case invtype::InvTypeWorld: - case invtype::InvTypeLimbo: - case invtype::InvTypeTribute: - case invtype::InvTypeGuildTribute: + case invtype::typePossessions: + case invtype::typeBank: + case invtype::typeSharedBank: + case invtype::typeTrade: + case invtype::typeWorld: + case invtype::typeLimbo: + case invtype::typeTribute: + case invtype::typeGuildTribute: return true; default: return false; } } -const char* UF::invslot::GetInvPossessionsSlotName(int inv_slot) +const char* UF::invslot::GetInvPossessionsSlotName(int16 inv_slot) { switch (inv_slot) { - case invslot::InvSlotInvalid: + case invslot::SLOT_INVALID: return "Invalid Slot"; - case invslot::PossessionsCharm: + case invslot::slotCharm: return "Charm"; - case invslot::PossessionsEar1: + case invslot::slotEar1: return "Ear 1"; - case invslot::PossessionsHead: + case invslot::slotHead: return "Head"; - case invslot::PossessionsFace: + case invslot::slotFace: return "Face"; - case invslot::PossessionsEar2: + case invslot::slotEar2: return "Ear 2"; - case invslot::PossessionsNeck: + case invslot::slotNeck: return "Neck"; - case invslot::PossessionsShoulders: + case invslot::slotShoulders: return "Shoulders"; - case invslot::PossessionsArms: + case invslot::slotArms: return "Arms"; - case invslot::PossessionsBack: + case invslot::slotBack: return "Back"; - case invslot::PossessionsWrist1: + case invslot::slotWrist1: return "Wrist 1"; - case invslot::PossessionsWrist2: + case invslot::slotWrist2: return "Wrist 2"; - case invslot::PossessionsRange: + case invslot::slotRange: return "Range"; - case invslot::PossessionsHands: + case invslot::slotHands: return "Hands"; - case invslot::PossessionsPrimary: + case invslot::slotPrimary: return "Primary"; - case invslot::PossessionsSecondary: + case invslot::slotSecondary: return "Secondary"; - case invslot::PossessionsFinger1: + case invslot::slotFinger1: return "Finger 1"; - case invslot::PossessionsFinger2: + case invslot::slotFinger2: return "Finger 2"; - case invslot::PossessionsChest: + case invslot::slotChest: return "Chest"; - case invslot::PossessionsLegs: + case invslot::slotLegs: return "Legs"; - case invslot::PossessionsFeet: + case invslot::slotFeet: return "Feet"; - case invslot::PossessionsWaist: + case invslot::slotWaist: return "Waist"; - case invslot::PossessionsPowerSource: + case invslot::slotPowerSource: return "Power Source"; - case invslot::PossessionsAmmo: + case invslot::slotAmmo: return "Ammo"; - case invslot::PossessionsGeneral1: + case invslot::slotGeneral1: return "General 1"; - case invslot::PossessionsGeneral2: + case invslot::slotGeneral2: return "General 2"; - case invslot::PossessionsGeneral3: + case invslot::slotGeneral3: return "General 3"; - case invslot::PossessionsGeneral4: + case invslot::slotGeneral4: return "General 4"; - case invslot::PossessionsGeneral5: + case invslot::slotGeneral5: return "General 5"; - case invslot::PossessionsGeneral6: + case invslot::slotGeneral6: return "General 6"; - case invslot::PossessionsGeneral7: + case invslot::slotGeneral7: return "General 7"; - case invslot::PossessionsGeneral8: + case invslot::slotGeneral8: return "General 8"; - case invslot::PossessionsCursor: + case invslot::slotCursor: return "Cursor"; default: return "Unknown Slot"; } } -const char* UF::invslot::GetInvCorpseSlotName(int inv_slot) +const char* UF::invslot::GetInvCorpseSlotName(int16 inv_slot) { - if (!invtype::GetInvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + if (!invtype::GetInvTypeSize(invtype::typeCorpse) || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; // needs work - if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + if ((inv_slot + 1) < invslot::CORPSE_BEGIN || (inv_slot + 1) >= invslot::CORPSE_END) return "Unknown Slot"; static std::string ret_str; @@ -222,19 +222,19 @@ const char* UF::invslot::GetInvCorpseSlotName(int inv_slot) return ret_str.c_str(); } -const char* UF::invslot::GetInvSlotName(int inv_type, int inv_slot) +const char* UF::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot) { - if (inv_type == invtype::InvTypePossessions) + if (inv_type == invtype::typePossessions) return invslot::GetInvPossessionsSlotName(inv_slot); - else if (inv_type == invtype::InvTypeCorpse) + else if (inv_type == invtype::typeCorpse) return invslot::GetInvCorpseSlotName(inv_slot); - size_t type_size = invtype::GetInvTypeSize(inv_type); + int16 type_size = invtype::GetInvTypeSize(inv_type); - if (!type_size || inv_slot == invslot::InvSlotInvalid) + if (!type_size || inv_slot == invslot::SLOT_INVALID) return "Invalid Slot"; - if ((size_t)(inv_slot + 1) >= type_size) + if ((inv_slot + 1) >= type_size) return "Unknown Slot"; static std::string ret_str; @@ -243,12 +243,12 @@ const char* UF::invslot::GetInvSlotName(int inv_type, int inv_slot) return ret_str.c_str(); } -const char* UF::invbag::GetInvBagIndexName(int bag_index) +const char* UF::invbag::GetInvBagIndexName(int16 bag_index) { - if (bag_index == invbag::InvBagInvalid) + if (bag_index == invbag::SLOT_INVALID) return "Invalid Bag"; - if ((size_t)bag_index >= invbag::ItemBagSize) + if (bag_index >= invbag::SLOT_COUNT) return "Unknown Bag"; static std::string ret_str; @@ -257,12 +257,12 @@ const char* UF::invbag::GetInvBagIndexName(int bag_index) return ret_str.c_str(); } -const char* UF::invaug::GetInvAugIndexName(int aug_index) +const char* UF::invaug::GetInvAugIndexName(int16 aug_index) { - if (aug_index == invaug::InvAugInvalid) + if (aug_index == invaug::SOCKET_INVALID) return "Invalid Augment"; - if ((size_t)aug_index >= invaug::ItemAugSize) + if (aug_index >= invaug::SOCKET_COUNT) return "Unknown Augment"; static std::string ret_str; diff --git a/common/patches/uf_limits.h b/common/patches/uf_limits.h index 719fcc394..52924f94d 100644 --- a/common/patches/uf_limits.h +++ b/common/patches/uf_limits.h @@ -27,109 +27,219 @@ namespace UF { - enum : int { Invalid = -1, Null, Safety }; + const int16 IINVALID = -1; + const int16 INULL = 0; - enum : bool { False = false, True = true }; - - // pre-declarations namespace inventory { inline EQEmu::versions::ClientVersion GetInventoryRef() { return EQEmu::versions::ClientVersion::UF; } + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = true; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + } /*inventory*/ namespace invtype { inline EQEmu::versions::ClientVersion GetInvTypeRef() { return EQEmu::versions::ClientVersion::UF; } - enum : int { InvTypeInvalid = -1, InvTypeBegin }; + namespace enum_ { + enum InventoryTypes : int16 { + typePossessions = INULL, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, + typeTribute, + typeGuildTribute, + typeMerchant, + typeCorpse, + typeBazaar, + typeInspect, + typeViewMODPC, + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, + typeOther + }; - enum InventoryType : int { - InvTypePossessions = InvTypeBegin, - InvTypeBank, - InvTypeSharedBank, - InvTypeTrade, - InvTypeWorld, - InvTypeLimbo, - InvTypeTribute, - InvTypeGuildTribute, - InvTypeMerchant, - InvTypeCorpse, - InvTypeBazaar, - InvTypeInspect, - InvTypeViewMODPC, - InvTypeViewMODBank, - InvTypeViewMODSharedBank, - InvTypeViewMODLimbo, - InvTypeAltStorage, - InvTypeArchived, - InvTypeOther, - InvTypeCount - }; + } // namespace enum_ + using namespace enum_; + + const int16 POSSESSIONS_SIZE = 32; + const int16 BANK_SIZE = 24; + const int16 SHARED_BANK_SIZE = 2; + const int16 TRADE_SIZE = 8; + const int16 WORLD_SIZE = 10; + const int16 LIMBO_SIZE = 36; + const int16 TRIBUTE_SIZE = 5; + const int16 GUILD_TRIBUTE_SIZE = 2; + const int16 MERCHANT_SIZE = 80; + const int16 CORPSE_SIZE = POSSESSIONS_SIZE; + const int16 BAZAAR_SIZE = 80; + const int16 INSPECT_SIZE = 23; + const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE; + const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE; + const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE; + const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE; + const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank" + const int16 ARCHIVED_SIZE = 0;//unknown + const int16 OTHER_SIZE = 0;//unknown + + const int16 TRADE_NPC_SIZE = 4; // defined by implication + + const int16 TYPE_INVALID = IINVALID; + const int16 TYPE_BEGIN = typePossessions; + const int16 TYPE_END = typeOther; + const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1; + + int16 GetInvTypeSize(int16 inv_type); + const char* GetInvTypeName(int16 inv_type); + + bool IsInvTypePersistent(int16 inv_type); } /*invtype*/ namespace invslot { inline EQEmu::versions::ClientVersion GetInvSlotRef() { return EQEmu::versions::ClientVersion::UF; } - enum : int { InvSlotInvalid = -1, InvSlotBegin }; + namespace enum_ { + enum InventorySlots : int16 { + slotCharm = INULL, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, + slotPowerSource, + slotAmmo, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotCursor + }; - enum PossessionsSlot : int { - PossessionsCharm = InvSlotBegin, - PossessionsEar1, - PossessionsHead, - PossessionsFace, - PossessionsEar2, - PossessionsNeck, - PossessionsShoulders, - PossessionsArms, - PossessionsBack, - PossessionsWrist1, - PossessionsWrist2, - PossessionsRange, - PossessionsHands, - PossessionsPrimary, - PossessionsSecondary, - PossessionsFinger1, - PossessionsFinger2, - PossessionsChest, - PossessionsLegs, - PossessionsFeet, - PossessionsWaist, - PossessionsPowerSource, - PossessionsAmmo, - PossessionsGeneral1, - PossessionsGeneral2, - PossessionsGeneral3, - PossessionsGeneral4, - PossessionsGeneral5, - PossessionsGeneral6, - PossessionsGeneral7, - PossessionsGeneral8, - PossessionsCursor, - PossessionsCount - }; + } // namespace enum_ + using namespace enum_; - const int EquipmentBegin = PossessionsCharm; - const int EquipmentEnd = PossessionsAmmo; - const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; - const int GeneralBegin = PossessionsGeneral1; - const int GeneralEnd = PossessionsGeneral8; - const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + const int16 POSSESSIONS_BEGIN = slotCharm; + const int16 POSSESSIONS_END = slotCursor; + const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1; + + const int16 EQUIPMENT_BEGIN = slotCharm; + const int16 EQUIPMENT_END = slotAmmo; + const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN + 1); + + const int16 GENERAL_BEGIN = slotGeneral1; + const int16 GENERAL_END = slotGeneral8; + const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN + 1); + + const int16 BONUS_BEGIN = invslot::slotCharm; + const int16 BONUS_STAT_END = invslot::slotPowerSource; + const int16 BONUS_SKILL_END = invslot::slotAmmo; + + const int16 BANK_BEGIN = 2000; + const int16 BANK_END = (BANK_BEGIN + invtype::BANK_SIZE) - 1; + + const int16 SHARED_BANK_BEGIN = 2500; + const int16 SHARED_BANK_END = (SHARED_BANK_BEGIN + invtype::SHARED_BANK_SIZE) - 1; + + const int16 TRADE_BEGIN = 3000; + const int16 TRADE_END = (TRADE_BEGIN + invtype::TRADE_SIZE) - 1; + + const int16 TRADE_NPC_END = (TRADE_BEGIN + invtype::TRADE_NPC_SIZE) - 1; // defined by implication + + const int16 WORLD_BEGIN = 4000; + const int16 WORLD_END = (WORLD_BEGIN + invtype::WORLD_SIZE) - 1; + + const int16 TRIBUTE_BEGIN = 400; + const int16 TRIBUTE_END = (TRIBUTE_BEGIN + invtype::TRIBUTE_SIZE) - 1; + + const int16 GUILD_TRIBUTE_BEGIN = 450; + const int16 GUILD_TRIBUTE_END = (GUILD_TRIBUTE_BEGIN + invtype::GUILD_TRIBUTE_SIZE) - 1; + + const int16 CORPSE_BEGIN = invslot::slotGeneral1; + const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor; + + const uint64 POSSESSIONS_BITMASK = 0x000000027FFFFFFF; // based on 34-slot count (RoF+) + const uint64 CORPSE_BITMASK = 0x01FFFFFE7F800000; // based on 34-slot count (RoF+) + + const char* GetInvPossessionsSlotName(int16 inv_slot); + const char* GetInvCorpseSlotName(int16 inv_slot); + const char* GetInvSlotName(int16 inv_type, int16 inv_slot); } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::UF; } - enum : int { InvBagInvalid = -1, InvBagBegin }; + const int16 SLOT_INVALID = IINVALID; + const int16 SLOT_BEGIN = INULL; + const int16 SLOT_END = 9; + const int16 SLOT_COUNT = 10; + + const int16 GENERAL_BAGS_BEGIN = 262; + const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT; + const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1; + + const int16 CURSOR_BAG_BEGIN = 342; + const int16 CURSOR_BAG_COUNT = SLOT_COUNT; + const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1; + + const int16 BANK_BAGS_BEGIN = 2032; + const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT); + const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1; + + const int16 SHARED_BANK_BAGS_BEGIN = 2532; + const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT; + const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1; + + const int16 TRADE_BAGS_BEGIN = 3031; + const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT; + const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1; + + const char* GetInvBagIndexName(int16 bag_index); } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::UF; } - enum : int { InvAugInvalid = -1, InvAugBegin }; + const int16 SOCKET_INVALID = IINVALID; + const int16 SOCKET_BEGIN = INULL; + const int16 SOCKET_END = 4; + const int16 SOCKET_COUNT = 5; + const char* GetInvAugIndexName(int16 aug_index); + } /*invaug*/ namespace item { @@ -154,147 +264,21 @@ namespace UF namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::UF; } + const int16 BANDOLIERS_SIZE = 20; // number of bandolier instances + const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + + const int16 POTION_BELT_SIZE = 5; + + const int16 SKILL_ARRAY_SIZE = 100; + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::UF; } - } /*constants*/ + const size_t CHARACTER_CREATION_LIMIT = 12; - namespace behavior { - inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::UF; } - - } /*behavior*/ - - namespace skills { - inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::UF; } - - } /*skills*/ - - - // declarations - namespace inventory { - const bool ConcatenateInvTypeLimbo = true; - - const bool AllowOverLevelEquipment = true; - - const bool AllowEmptyBagInBag = false; - const bool AllowClickCastFromBag = false; - - } /*inventory*/ - - namespace invtype { - const size_t InvTypePossessionsSize = invslot::PossessionsCount; - const size_t InvTypeBankSize = 24; - const size_t InvTypeSharedBankSize = 2; - const size_t InvTypeTradeSize = 8; - const size_t InvTypeWorldSize = 10; - const size_t InvTypeLimboSize = 36; - const size_t InvTypeTributeSize = 5; - const size_t InvTypeGuildTributeSize = 2; - const size_t InvTypeMerchantSize = 80; - const size_t InvTypeCorpseSize = InvTypePossessionsSize; - const size_t InvTypeBazaarSize = 80; - const size_t InvTypeInspectSize = invslot::EquipmentCount; - const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; - const size_t InvTypeViewMODBankSize = InvTypeBankSize; - const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; - const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; - const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" - const size_t InvTypeArchivedSize = 0;//unknown - const size_t InvTypeOtherSize = 0;//unknown - - extern size_t GetInvTypeSize(int inv_type); - extern const char* GetInvTypeName(int inv_type); - - extern bool IsInvTypePersistent(int inv_type); - - } /*invtype*/ - - namespace invslot { - const int BankBegin = 2000; - const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; - - const int SharedBankBegin = 2500; - const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; - - const int TradeBegin = 3000; - const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; - const int TradeNPCEnd = 3003; - - const int WorldBegin = 4000; - const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; - - const int TributeBegin = 400; - const int TributeEnd = (TributeBegin + invtype::InvTypeTributeSize) - 1; - - const int GuildTributeBegin = 450; - const int GuildTributeEnd = (GuildTributeBegin + invtype::InvTypeGuildTributeSize) - 1; - - const int CorpseBegin = invslot::PossessionsGeneral1; - const int CorpseEnd = invslot::PossessionsGeneral1 + invslot::PossessionsCursor; - - extern const char* GetInvPossessionsSlotName(int inv_slot); - extern const char* GetInvCorpseSlotName(int inv_slot); - extern const char* GetInvSlotName(int inv_type, int inv_slot); - - } /*invslot*/ - - namespace invbag { - const size_t ItemBagSize = 10; - - const int GeneralBagsBegin = 262; - const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; - const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; - - const int CursorBagBegin = 342; - const int CursorBagSize = ItemBagSize; - const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; - - const int BankBagsBegin = 2032; - const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); - const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; - - const int SharedBankBagsBegin = 2532; - const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; - const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; - - const int TradeBagsBegin = 3031; - const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; - const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; - - extern const char* GetInvBagIndexName(int bag_index); - - } /*invbag*/ - - namespace invaug { - const size_t ItemAugSize = 5; - - extern const char* GetInvAugIndexName(int aug_index); - - } /*invaug*/ - - namespace item { - - } /*item*/ - - namespace profile { - const size_t TributeSize = invtype::InvTypeTributeSize; - const size_t GuildTributeSize = invtype::InvTypeGuildTributeSize; - - const size_t BandoliersSize = 20; // number of bandolier instances - const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance - - const size_t PotionBeltSize = 5; - - const size_t SkillArraySize = 100; - - } /*profile*/ - - namespace constants { - const size_t CharacterCreationLimit = 12; - - const size_t SayLinkBodySize = 50; + const size_t SAY_LINK_BODY_SIZE = 50; const int LongBuffs = 30; const int ShortBuffs = 20; @@ -307,11 +291,15 @@ namespace UF } /*constants*/ namespace behavior { + inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::UF; } + const bool CoinHasWeight = false; } /*behavior*/ namespace skills { + inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::UF; } + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; } /*skills*/ diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index dc66afd43..02361cf1f 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -746,7 +746,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[profile::BandolierItemCount]; + BandolierItem_Struct Items[profile::BANDOLIER_ITEM_COUNT]; }; //len = 72 @@ -760,7 +760,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[profile::PotionBeltSize]; + PotionBeltItem_Struct Items[profile::POTION_BELT_SIZE]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -969,7 +969,7 @@ struct PlayerProfile_Struct /*11236*/ uint32 aapoints_spent; // Number of spent AA points /*11240*/ uint32 aapoints; // Unspent AA points /*11244*/ uint8 unknown11244[4]; -/*11248*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [6400] bandolier contents +/*11248*/ Bandolier_Struct bandoliers[profile::BANDOLIERS_SIZE]; // [6400] bandolier contents /*17648*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*18008*/ uint8 unknown18008[8]; /*18016*/ uint32 available_slots; diff --git a/common/say_link.cpp b/common/say_link.cpp index e2b43c107..a215bdc46 100644 --- a/common/say_link.cpp +++ b/common/say_link.cpp @@ -29,7 +29,7 @@ bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body) { memset(&say_link_body_struct, 0, sizeof(say_link_body_struct)); - if (say_link_body.length() != EQEmu::constants::SayLinkBodySize) + if (say_link_body.length() != EQEmu::constants::SAY_LINK_BODY_SIZE) return false; say_link_body_struct.action_id = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16); @@ -68,7 +68,7 @@ bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkB (0xFFFFFFFF & say_link_body_struct.hash) ); - if (say_link_body.length() != EQEmu::constants::SayLinkBodySize) + if (say_link_body.length() != EQEmu::constants::SAY_LINK_BODY_SIZE) return false; return true; @@ -88,25 +88,25 @@ const std::string& EQEmu::SayLinkEngine::GenerateLink() generate_body(); generate_text(); - if ((m_LinkBody.length() == EQEmu::constants::SayLinkBodySize) && (m_LinkText.length() > 0)) { + if ((m_LinkBody.length() == EQEmu::constants::SAY_LINK_BODY_SIZE) && (m_LinkText.length() > 0)) { m_Link.push_back(0x12); m_Link.append(m_LinkBody); m_Link.append(m_LinkText); m_Link.push_back(0x12); } - if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SayLinkMaximumSize))) { + if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SAY_LINK_MAXIMUM_SIZE))) { m_Error = true; m_Link = ""; Log(Logs::General, Logs::Error, "SayLinkEngine::GenerateLink() failed to generate a useable say link"); Log(Logs::General, Logs::Error, ">> LinkType: %i, Lengths: {link: %u(%u), body: %u(%u), text: %u(%u)}", m_LinkType, m_Link.length(), - EQEmu::constants::SayLinkMaximumSize, + EQEmu::constants::SAY_LINK_MAXIMUM_SIZE, m_LinkBody.length(), - EQEmu::constants::SayLinkBodySize, + EQEmu::constants::SAY_LINK_BODY_SIZE, m_LinkText.length(), - EQEmu::constants::SayLinkTextSize + EQEmu::constants::SAY_LINK_TEXT_SIZE ); Log(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str()); Log(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str()); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a4c6e54d1..00fdaea96 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -151,8 +151,8 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list: std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i " "AND ((slotid >= 8000 AND slotid <= 8999) " "OR slotid = %i OR (slotid >= %i AND slotid <= %i) )", - char_id, EQEmu::inventory::slotCursor, - EQEmu::legacy::CURSOR_BAG_BEGIN, EQEmu::legacy::CURSOR_BAG_END); + char_id, EQEmu::invslot::slotCursor, + EQEmu::invbag::CURSOR_BAG_BEGIN, EQEmu::invbag::CURSOR_BAG_END); auto results = QueryDatabase(query); if (!results.Success()) { std::cout << "Clearing cursor failed: " << results.ErrorMessage() << std::endl; @@ -163,7 +163,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list: for(auto it = start; it != end; ++it, i++) { if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high EQEmu::ItemInstance *inst = *it; - int16 use_slot = (i == 8000) ? EQEmu::inventory::slotCursor : i; + int16 use_slot = (i == 8000) ? EQEmu::invslot::slotCursor : i; if (!SaveInventory(char_id, inst, use_slot)) { return false; } @@ -208,10 +208,12 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const EQE bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { //never save tribute slots: - if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) + if (slot_id >= EQEmu::invslot::TRIBUTE_BEGIN && slot_id <= EQEmu::invslot::TRIBUTE_END) + return true; + if (slot_id >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN && slot_id <= EQEmu::invslot::GUILD_TRIBUTE_END) return true; - if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + if (slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) { // Shared bank inventory if (!inst) { return DeleteSharedBankSlot(char_id, slot_id); @@ -238,9 +240,9 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* in bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer - uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; + uint32 augslot[EQEmu::invaug::SOCKET_COUNT] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsClassCommon()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { EQEmu::ItemInstance *auginst = inst->GetItem(i); augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } @@ -270,7 +272,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstan if (inst->IsClassBag() && EQEmu::InventoryProfile::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 = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) { + for (uint8 idx = EQEmu::invbag::SLOT_BEGIN; idx < inst->GetItem()->BagSlots && idx <= EQEmu::invbag::SLOT_END; idx++) { const EQEmu::ItemInstance* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx)); } @@ -285,9 +287,9 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstan bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer - uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; + uint32 augslot[EQEmu::invaug::SOCKET_COUNT] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsClassCommon()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { EQEmu::ItemInstance *auginst = inst->GetItem(i); augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } @@ -316,7 +318,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInsta if (inst->IsClassBag() && EQEmu::InventoryProfile::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 = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) { + for (uint8 idx = EQEmu::invbag::SLOT_BEGIN; idx < inst->GetItem()->BagSlots && idx <= EQEmu::invbag::SLOT_END; idx++) { const EQEmu::ItemInstance* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx)); } @@ -342,7 +344,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { if (!EQEmu::InventoryProfile::SupportsContainers(slot_id)) return true; - int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); + int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::invbag::SLOT_BEGIN); query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i", char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); @@ -368,7 +370,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { if (!EQEmu::InventoryProfile::SupportsContainers(slot_id)) return true; - int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); + int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::invbag::SLOT_BEGIN); query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i " "AND slotid >= %i AND slotid < %i", account_id, base_slot_id, (base_slot_id+10)); @@ -474,7 +476,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool uint32 item_id = (uint32)atoi(row[1]); int8 charges = (int8)atoi(row[2]); - uint32 aug[EQEmu::inventory::SocketCount]; + uint32 aug[EQEmu::invaug::SOCKET_COUNT]; aug[0] = (uint32)atoi(row[3]); aug[1] = (uint32)atoi(row[4]); aug[2] = (uint32)atoi(row[5]); @@ -495,7 +497,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool EQEmu::ItemInstance *inst = CreateBaseItem(item, charges); if (inst && item->IsClassCommon()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); } @@ -570,7 +572,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) uint16 charges = atoi(row[2]); uint32 color = atoul(row[3]); - uint32 aug[EQEmu::inventory::SocketCount]; + uint32 aug[EQEmu::invaug::SOCKET_COUNT]; aug[0] = (uint32)atoul(row[4]); aug[1] = (uint32)atoul(row[5]); @@ -632,8 +634,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) inst->SetOrnamentHeroModel(item->HerosForgeModel); if (instnodrop || - (((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || - slot_id == EQEmu::inventory::slotPowerSource) && + (((slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN && slot_id <= EQEmu::invslot::EQUIPMENT_END) || + slot_id == EQEmu::invslot::SLOT_POWER_SOURCE) && inst->GetItem()->Attuneable)) inst->SetAttuned(true); @@ -655,7 +657,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) } if (item->IsClassCommon()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); } @@ -712,7 +714,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::Inventor int8 charges = atoi(row[2]); uint32 color = atoul(row[3]); - uint32 aug[EQEmu::inventory::SocketCount]; + uint32 aug[EQEmu::invaug::SOCKET_COUNT]; aug[0] = (uint32)atoi(row[4]); aug[1] = (uint32)atoi(row[5]); aug[2] = (uint32)atoi(row[6]); @@ -773,7 +775,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::Inventor inst->SetCharges(charges); if (item->IsClassCommon()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); } diff --git a/world/client.cpp b/world/client.cpp index d3b74ae3f..f8b4fe3f4 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -212,8 +212,8 @@ void Client::SendMaxCharCreate() { MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer; mc->max_chars = EQEmu::constants::Lookup(m_ClientVersion)->CharacterCreationLimit; - if (mc->max_chars > EQEmu::constants::CharacterCreationMax) - mc->max_chars = EQEmu::constants::CharacterCreationMax; + if (mc->max_chars > EQEmu::constants::CHARACTER_CREATION_LIMIT) + mc->max_chars = EQEmu::constants::CHARACTER_CREATION_LIMIT; QueuePacket(outapp); safe_delete(outapp); @@ -766,8 +766,8 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { // (This is a literal translation of the original process..I don't see why it can't be changed to a single-target query over account iteration) if (!is_player_zoning) { size_t character_limit = EQEmu::constants::Lookup(eqs->ClientVersion())->CharacterCreationLimit; - if (character_limit > EQEmu::constants::CharacterCreationMax) { character_limit = EQEmu::constants::CharacterCreationMax; } - if (eqs->ClientVersion() == EQEmu::versions::ClientVersion::Titanium) { character_limit = 8; } + if (character_limit > EQEmu::constants::CHARACTER_CREATION_LIMIT) { character_limit = EQEmu::constants::CHARACTER_CREATION_LIMIT; } + if (eqs->ClientVersion() == EQEmu::versions::ClientVersion::Titanium) { character_limit = Titanium::constants::CHARACTER_CREATION_LIMIT; } std::string tgh_query = StringFormat( "SELECT " diff --git a/world/worlddb.cpp b/world/worlddb.cpp index cbf901cf7..67b0eab38 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -39,8 +39,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou size_t character_limit = EQEmu::constants::Lookup(client_version)->CharacterCreationLimit; // Validate against absolute server max - if (character_limit > EQEmu::constants::CharacterCreationMax) - character_limit = EQEmu::constants::CharacterCreationMax; + if (character_limit > EQEmu::constants::CHARACTER_CREATION_LIMIT) + character_limit = EQEmu::constants::CHARACTER_CREATION_LIMIT; // Force Titanium clients to use '8' if (client_version == EQEmu::versions::ClientVersion::Titanium) diff --git a/zone/aa.cpp b/zone/aa.cpp index 38d477fb8..9fa76a9d4 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -435,7 +435,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) //gear stuff, need to make sure there's //no situation where this stuff can be duped - for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) // (< 21) added MainAmmo + for (int x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invslot::EQUIPMENT_END; x++) { uint32 sitem = 0; sitem = CorpseToUse->GetWornItem(x); diff --git a/zone/attack.cpp b/zone/attack.cpp index 817a8e359..a48d68934 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -136,7 +136,7 @@ EQEmu::skills::SkillType Mob::AttackAnimation(int Hand, const EQEmu::ItemInstanc } // If we're attacking with the secondary hand, play the dual wield anim - if (Hand == EQEmu::inventory::slotSecondary) // DW anim + if (Hand == EQEmu::invslot::slotSecondary) // DW anim type = animDualWield; DoAnim(type, 0, false); @@ -386,7 +386,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit) // riposte -- it may seem crazy, but if the attacker has SPA 173 on them, they are immune to Ripo bool ImmuneRipo = attacker->aabonuses.RiposteChance || attacker->spellbonuses.RiposteChance || attacker->itembonuses.RiposteChance || attacker->IsEnraged(); // Need to check if we have something in MainHand to actually attack with (or fists) - if (hit.hand != EQEmu::inventory::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) { + if (hit.hand != EQEmu::invslot::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) { if (IsEnraged()) { hit.damage_done = DMG_RIPOSTED; Log(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack."); @@ -408,7 +408,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit) chance -= chance * counter; } // AA Slippery Attacks - if (hit.hand == EQEmu::inventory::slotSecondary) { + if (hit.hand == EQEmu::invslot::slotSecondary) { int slip = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail; chance += chance * slip / 100; } @@ -453,7 +453,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit) } // parry - if (CanThisClassParry() && InFront && hit.hand != EQEmu::inventory::slotRange) { + if (CanThisClassParry() && InFront && hit.hand != EQEmu::invslot::slotRange) { if (IsClient()) CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillParry, other, -10); // check auto discs ... I guess aa/items too :P @@ -783,7 +783,7 @@ int Mob::ACSum() int shield_ac = 0; if (HasShieldEquiped() && IsClient()) { auto client = CastToClient(); - auto inst = client->GetInv().GetItem(EQEmu::inventory::slotSecondary); + auto inst = client->GetInv().GetItem(EQEmu::invslot::slotSecondary); if (inst) { if (inst->GetItemRecommendedLevel(true) <= GetLevel()) shield_ac = inst->GetItemArmorClass(true); @@ -1111,7 +1111,7 @@ int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, u else { bool MagicGloves = false; if (IsClient()) { - const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotHands); + const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotHands); if (gloves) MagicGloves = gloves->GetItemMagical(true); } @@ -1397,12 +1397,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code. EQEmu::ItemInstance* weapon = nullptr; - if (Hand == EQEmu::inventory::slotSecondary) { // Kaiyodo - Pick weapon from the attacking hand - weapon = GetInv().GetItem(EQEmu::inventory::slotSecondary); + if (Hand == EQEmu::invslot::slotSecondary) { // Kaiyodo - Pick weapon from the attacking hand + weapon = GetInv().GetItem(EQEmu::invslot::slotSecondary); OffHandAtk(true); } else { - weapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); + weapon = GetInv().GetItem(EQEmu::invslot::slotPrimary); OffHandAtk(false); } @@ -1440,10 +1440,10 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (my_hit.base_damage > 0) { // if we revamp this function be more general, we will have to make sure this isn't // executed for anything BUT normal melee damage weapons from auto attack - if (Hand == EQEmu::inventory::slotPrimary || Hand == EQEmu::inventory::slotSecondary) + if (Hand == EQEmu::invslot::slotPrimary || Hand == EQEmu::invslot::slotSecondary) my_hit.base_damage = DoDamageCaps(my_hit.base_damage); auto shield_inc = spellbonuses.ShieldEquipDmgMod + itembonuses.ShieldEquipDmgMod + aabonuses.ShieldEquipDmgMod; - if (shield_inc > 0 && HasShieldEquiped() && Hand == EQEmu::inventory::slotPrimary) { + if (shield_inc > 0 && HasShieldEquiped() && Hand == EQEmu::invslot::slotPrimary) { my_hit.base_damage = my_hit.base_damage * (100 + shield_inc) / 100; hate = hate * (100 + shield_inc) / 100; } @@ -1465,7 +1465,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b int ucDamageBonus = 0; - if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) + if (Hand == EQEmu::invslot::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. @@ -1477,7 +1477,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b } #endif //Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon. - if (Hand == EQEmu::inventory::slotSecondary) { + if (Hand == EQEmu::invslot::slotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc) { ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr, true); @@ -1927,28 +1927,28 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool my_hit.skill = EQEmu::skills::SkillHandtoHand; my_hit.hand = Hand; my_hit.damage_done = 1; - if (Hand == EQEmu::inventory::slotPrimary) { + if (Hand == EQEmu::invslot::slotPrimary) { my_hit.skill = static_cast(GetPrimSkill()); OffHandAtk(false); } - if (Hand == EQEmu::inventory::slotSecondary) { + if (Hand == EQEmu::invslot::slotSecondary) { my_hit.skill = static_cast(GetSecSkill()); OffHandAtk(true); } //figure out what weapon they are using, if any const EQEmu::ItemData* weapon = nullptr; - if (Hand == EQEmu::inventory::slotPrimary && equipment[EQEmu::inventory::slotPrimary] > 0) - weapon = database.GetItem(equipment[EQEmu::inventory::slotPrimary]); - else if (equipment[EQEmu::inventory::slotSecondary]) - weapon = database.GetItem(equipment[EQEmu::inventory::slotSecondary]); + if (Hand == EQEmu::invslot::slotPrimary && equipment[EQEmu::invslot::slotPrimary] > 0) + weapon = database.GetItem(equipment[EQEmu::invslot::slotPrimary]); + else if (equipment[EQEmu::invslot::slotSecondary]) + weapon = database.GetItem(equipment[EQEmu::invslot::slotSecondary]); //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if (weapon) { Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); - if (Hand == EQEmu::inventory::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield) { + if (Hand == EQEmu::invslot::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield) { Log(Logs::Detail, Logs::Combat, "Attack with shield canceled."); return false; } @@ -3896,7 +3896,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) { float ProcChance, ProcBonus; on->GetDefensiveProcChances(ProcBonus, ProcChance, hand, this); - if (hand != EQEmu::inventory::slotPrimary) + if (hand != EQEmu::invslot::slotPrimary) ProcChance /= 2; int level_penalty = 0; @@ -3969,7 +3969,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData * ProcBonus += static_cast(itembonuses.ProcChance) / 10.0f; // Combat Effects float ProcChance = GetProcChances(ProcBonus, hand); - if (hand != EQEmu::inventory::slotPrimary) //Is Archery intened to proc at 50% rate? + if (hand != EQEmu::invslot::slotPrimary) //Is Archery intened to proc at 50% rate? ProcChance /= 2; // Try innate proc on weapon @@ -4008,7 +4008,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData * proced = false; if (!proced && inst) { - for (int r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { + for (int r = EQEmu::invaug::SOCKET_BEGIN; r <= EQEmu::invaug::SOCKET_END; r++) { const EQEmu::ItemInstance *aug_i = inst->GetAugment(r); if (!aug_i) // no aug, try next slot! continue; @@ -4051,11 +4051,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w float ProcChance = 0.0f; ProcChance = GetProcChances(ProcBonus, hand); - if (hand != EQEmu::inventory::slotPrimary) //Is Archery intened to proc at 50% rate? + if (hand != EQEmu::invslot::slotPrimary) //Is Archery intened to proc at 50% rate? ProcChance /= 2; bool rangedattk = false; - if (weapon && hand == EQEmu::inventory::slotRange) { + if (weapon && hand == EQEmu::invslot::slotRange) { if (weapon->ItemType == EQEmu::item::ItemTypeArrow || weapon->ItemType == EQEmu::item::ItemTypeLargeThrowing || weapon->ItemType == EQEmu::item::ItemTypeSmallThrowing || @@ -4064,11 +4064,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w } } - if (!weapon && hand == EQEmu::inventory::slotRange && GetSpecialAbility(SPECATK_RANGED_ATK)) + if (!weapon && hand == EQEmu::invslot::slotRange && GetSpecialAbility(SPECATK_RANGED_ATK)) rangedattk = true; for (uint32 i = 0; i < MAX_PROCS; i++) { - if (IsPet() && hand != EQEmu::inventory::slotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets) + if (IsPet() && hand != EQEmu::invslot::slotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets) continue; // If pets ever can proc from off hand, this will need to change // Not ranged @@ -4128,7 +4128,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w } } - if (HasSkillProcs() && hand != EQEmu::inventory::slotRange) { //We check ranged skill procs within the attack functions. + if (HasSkillProcs() && hand != EQEmu::invslot::slotRange) { //We check ranged skill procs within the attack functions. uint16 skillinuse = 28; if (weapon) skillinuse = GetSkillByItemType(weapon->ItemType); @@ -4451,7 +4451,7 @@ void Mob::DoRiposte(Mob *defender) return; } - defender->Attack(this, EQEmu::inventory::slotPrimary, true); + defender->Attack(this, EQEmu::invslot::slotPrimary, true); if (HasDied()) return; @@ -4462,7 +4462,7 @@ void Mob::DoRiposte(Mob *defender) if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) { Log(Logs::Detail, Logs::Combat, "Preforming a double riposted from SE_DoubleRiposte (%d percent chance)", DoubleRipChance); - defender->Attack(this, EQEmu::inventory::slotPrimary, true); + defender->Attack(this, EQEmu::invslot::slotPrimary, true); if (HasDied()) return; } @@ -4475,7 +4475,7 @@ void Mob::DoRiposte(Mob *defender) Log(Logs::Detail, Logs::Combat, "Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 (%d percent chance)", DoubleRipChance); - defender->Attack(this, EQEmu::inventory::slotPrimary, true); + defender->Attack(this, EQEmu::invslot::slotPrimary, true); if (HasDied()) return; } @@ -4888,7 +4888,7 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) { if (!ReuseTime && hand) { weapon_speed = GetWeaponSpeedbyHand(hand); ProcChance = static_cast(weapon_speed) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f); - if (hand != EQEmu::inventory::slotPrimary) + if (hand != EQEmu::invslot::slotPrimary) ProcChance /= 2; } @@ -5182,13 +5182,13 @@ void Client::SetAttackTimer() Timer *TimerToUse = nullptr; - for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) { + for (int i = EQEmu::invslot::slotRange; i <= EQEmu::invslot::slotSecondary; i++) { //pick a timer - if (i == EQEmu::inventory::slotPrimary) + if (i == EQEmu::invslot::slotPrimary) TimerToUse = &attack_timer; - else if (i == EQEmu::inventory::slotRange) + else if (i == EQEmu::invslot::slotRange) TimerToUse = &ranged_timer; - else if (i == EQEmu::inventory::slotSecondary) + else if (i == EQEmu::invslot::slotSecondary) TimerToUse = &attack_dw_timer; else //invalid slot (hands will always hit this) continue; @@ -5201,7 +5201,7 @@ void Client::SetAttackTimer() ItemToUse = ci->GetItem(); //special offhand stuff - if (i == EQEmu::inventory::slotSecondary) { + if (i == EQEmu::invslot::slotSecondary) { //if we cant dual wield, skip it if (!CanThisClassDualWield() || HasTwoHanderEquipped()) { attack_dw_timer.Disable(); @@ -5276,19 +5276,19 @@ void NPC::SetAttackTimer() else speed = static_cast((attack_delay / haste_mod) + ((hhe / 100.0f) * attack_delay)); - for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) { + for (int i = EQEmu::invslot::slotRange; i <= EQEmu::invslot::slotSecondary; i++) { //pick a timer - if (i == EQEmu::inventory::slotPrimary) + if (i == EQEmu::invslot::slotPrimary) TimerToUse = &attack_timer; - else if (i == EQEmu::inventory::slotRange) + else if (i == EQEmu::invslot::slotRange) TimerToUse = &ranged_timer; - else if (i == EQEmu::inventory::slotSecondary) + else if (i == EQEmu::invslot::slotSecondary) TimerToUse = &attack_dw_timer; else //invalid slot (hands will always hit this) continue; //special offhand stuff - if (i == EQEmu::inventory::slotSecondary) { + if (i == EQEmu::invslot::slotSecondary) { // SPECATK_QUAD is uncheesable if (!CanThisClassDualWield() || (HasTwoHanderEquipped() && !GetSpecialAbility(SPECATK_QUAD))) { attack_dw_timer.Disable(); @@ -5310,7 +5310,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) bool candouble = CanThisClassDoubleAttack(); // extra off hand non-sense, can only double with skill of 150 or above // or you have any amount of GiveDoubleAttack - if (candouble && hand == EQEmu::inventory::slotSecondary) + if (candouble && hand == EQEmu::invslot::slotSecondary) candouble = GetSkill(EQEmu::skills::SkillDoubleAttack) > 149 || (aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack) > 0; @@ -5321,7 +5321,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) Attack(target, hand, false, false, IsFromSpell); // Modern AA description: Increases your chance of ... performing one additional hit with a 2-handed weapon when double attacking by 2%. - if (hand == EQEmu::inventory::slotPrimary) { + if (hand == EQEmu::invslot::slotPrimary) { auto extraattackchance = aabonuses.ExtraAttackChance + spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance; if (extraattackchance && HasTwoHanderEquipped() && zone->random.Roll(extraattackchance)) @@ -5329,7 +5329,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) } // you can only triple from the main hand - if (hand == EQEmu::inventory::slotPrimary && CanThisClassTripleAttack()) { + if (hand == EQEmu::invslot::slotPrimary && CanThisClassTripleAttack()) { CheckIncreaseSkill(EQEmu::skills::SkillTripleAttack, target, -10); if (CheckTripleAttack()) { Attack(target, hand, false, false, IsFromSpell); @@ -5383,9 +5383,9 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts) if (RuleB(Combat, UseLiveCombatRounds)) { // A "quad" on live really is just a successful dual wield where both double attack // The mobs that could triple lost the ability to when the triple attack skill was added in - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); if (CanThisClassDoubleAttack() && CheckDoubleAttack()) { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) { int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry; if (chance && zone->random.Roll(chance)) @@ -5398,16 +5398,16 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts) if (IsNPC()) { int16 n_atk = CastToNPC()->GetNumberOfAttacks(); if (n_atk <= 1) { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); } else { for (int i = 0; i < n_atk; ++i) { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); } } } else { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); } // we use this random value in three comparisons with different @@ -5418,15 +5418,15 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts) // check double attack, this is NOT the same rules that clients use... && RandRoll < (GetLevel() + NPCDualAttackModifier)) { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); // lets see if we can do a triple attack with the main hand // pets are excluded from triple and quads... if ((GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) && !IsPet() && RandRoll < (GetLevel() + NPCTripleAttackModifier)) { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); // now lets check the quad attack if (GetSpecialAbility(SPECATK_QUAD) && RandRoll < (GetLevel() + NPCQuadAttackModifier)) { - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); } } } @@ -5442,9 +5442,9 @@ void Mob::DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts) (RuleB(Combat, UseLiveCombatRounds) && GetSpecialAbility(SPECATK_QUAD))) || GetEquipment(EQEmu::textures::weaponSecondary) != 0) { if (CheckDualWield()) { - Attack(target, EQEmu::inventory::slotSecondary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotSecondary, false, false, false, opts); if (CanThisClassDoubleAttack() && GetLevel() > 35 && CheckDoubleAttack()) { - Attack(target, EQEmu::inventory::slotSecondary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotSecondary, false, false, false, opts); if ((IsPet() || IsTempPet()) && IsPetOwnerClient()) { int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry; diff --git a/zone/beacon.h b/zone/beacon.h index c22189dfd..3e8f6edcc 100644 --- a/zone/beacon.h +++ b/zone/beacon.h @@ -36,7 +36,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None) { return; } - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index c444ff9dd..b6de679d1 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -161,35 +161,35 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { unsigned int i; // Update: MainAmmo should only calc skill mods (TODO: Check for other cases) - for (i = EQEmu::inventory::slotCharm; i <= EQEmu::inventory::slotAmmo; i++) { + for (i = EQEmu::invslot::BONUS_BEGIN; i <= EQEmu::invslot::BONUS_SKILL_END; i++) { const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; - AddItemBonuses(inst, newbon, false, false, 0, (i == EQEmu::inventory::slotAmmo)); + AddItemBonuses(inst, newbon, false, false, 0, (i == EQEmu::invslot::slotAmmo)); //These are given special flags due to how often they are checked for various spell effects. const EQEmu::ItemData *item = inst->GetItem(); - if (i == EQEmu::inventory::slotSecondary && (item && item->ItemType == EQEmu::item::ItemTypeShield)) + if (i == EQEmu::invslot::slotSecondary && (item && item->ItemType == EQEmu::item::ItemTypeShield)) SetShieldEquiped(true); - else if (i == EQEmu::inventory::slotPrimary && (item && item->ItemType == EQEmu::item::ItemType2HBlunt)) { + else if (i == EQEmu::invslot::slotPrimary && (item && item->ItemType == EQEmu::item::ItemType2HBlunt)) { SetTwoHandBluntEquiped(true); SetTwoHanderEquipped(true); } - else if (i == EQEmu::inventory::slotPrimary && (item && (item->ItemType == EQEmu::item::ItemType2HSlash || item->ItemType == EQEmu::item::ItemType2HPiercing))) + else if (i == EQEmu::invslot::slotPrimary && (item && (item->ItemType == EQEmu::item::ItemType2HSlash || item->ItemType == EQEmu::item::ItemType2HPiercing))) SetTwoHanderEquipped(true); } //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const EQEmu::ItemInstance* inst = m_inv[EQEmu::inventory::slotPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]; if(inst) AddItemBonuses(inst, newbon); } //tribute items - for (i = 0; i < EQEmu::legacy::TRIBUTE_SIZE; i++) { - const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::TRIBUTE_BEGIN + i]; + for (i = EQEmu::invslot::TRIBUTE_BEGIN; i <= EQEmu::invslot::TRIBUTE_END; i++) { + const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; AddItemBonuses(inst, newbon, false, true); @@ -197,7 +197,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) != EQEmu::item::ItemEffectWorn){ - for (i = EQEmu::inventory::slotCharm; i < EQEmu::inventory::slotAmmo; i++) { + for (i = EQEmu::invslot::BONUS_BEGIN; i <= EQEmu::invslot::BONUS_STAT_END; i++) { const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; @@ -543,7 +543,7 @@ void Client::AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses *newbon } if (!isAug) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) AddItemBonuses(inst->GetAugment(i), newbon, true, false, rec_level, ammo_slot_item); } } @@ -581,7 +581,7 @@ void Client::AdditiveWornBonuses(const EQEmu::ItemInstance *inst, StatBonuses* n if (!isAug) { int i; - for (i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { AdditiveWornBonuses(inst->GetAugment(i),newbon,true); } } @@ -592,32 +592,32 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { bool food = false; bool drink = false; - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_BAGS_BEGIN; i++) + for (i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { if (food && drink) break; const EQEmu::ItemInstance* inst = GetInv().GetItem(i); if (inst && inst->GetItem() && inst->IsClassCommon()) { const EQEmu::ItemData *item = inst->GetItem(); - if (item->ItemType == EQEmu::item::ItemTypeFood && !food) + if (!food && item->ItemType == EQEmu::item::ItemTypeFood) food = true; - else if (item->ItemType == EQEmu::item::ItemTypeDrink && !drink) + else if (!drink && item->ItemType == EQEmu::item::ItemTypeDrink) drink = true; else continue; AddItemBonuses(inst, newbon); } } - for (i = EQEmu::legacy::GENERAL_BAGS_BEGIN; i <= EQEmu::legacy::GENERAL_BAGS_END; i++) + for (i = EQEmu::invbag::GENERAL_BAGS_BEGIN; i <= EQEmu::invbag::GENERAL_BAGS_END; i++) { if (food && drink) break; const EQEmu::ItemInstance* inst = GetInv().GetItem(i); if (inst && inst->GetItem() && inst->IsClassCommon()) { const EQEmu::ItemData *item = inst->GetItem(); - if (item->ItemType == EQEmu::item::ItemTypeFood && !food) + if (!food && item->ItemType == EQEmu::item::ItemTypeFood) food = true; - else if (item->ItemType == EQEmu::item::ItemTypeDrink && !drink) + else if (!drink && item->ItemType == EQEmu::item::ItemTypeDrink) drink = true; else continue; @@ -3261,7 +3261,7 @@ void NPC::CalcItemBonuses(StatBonuses *newbon) { if(newbon){ - for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++){ + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++){ const EQEmu::ItemData *cur = database.GetItem(equipment[i]); if(cur){ //basic stats @@ -3339,24 +3339,24 @@ void Client::CalcItemScale() { bool changed = false; // MainAmmo excluded in helper function below - if (CalcItemScale(EQEmu::legacy::EQUIPMENT_BEGIN, EQEmu::legacy::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21) + if (CalcItemScale(EQEmu::invslot::EQUIPMENT_BEGIN, EQEmu::invslot::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21) changed = true; - if (CalcItemScale(EQEmu::legacy::GENERAL_BEGIN, EQEmu::legacy::GENERAL_END)) // original coding excluded MainCursor (< 30) + if (CalcItemScale(EQEmu::invslot::GENERAL_BEGIN, EQEmu::invslot::GENERAL_END)) // original coding excluded MainCursor (< 30) changed = true; // I excluded cursor bag slots here because cursor was excluded above..if this is incorrect, change 'slot_y' here to CURSOR_BAG_END // and 'slot_y' above to CURSOR from GENERAL_END above - or however it is supposed to be... - if (CalcItemScale(EQEmu::legacy::GENERAL_BAGS_BEGIN, EQEmu::legacy::GENERAL_BAGS_END)) // (< 341) + if (CalcItemScale(EQEmu::invbag::GENERAL_BAGS_BEGIN, EQEmu::invbag::GENERAL_BAGS_END)) // (< 341) changed = true; - if (CalcItemScale(EQEmu::legacy::TRIBUTE_BEGIN, EQEmu::legacy::TRIBUTE_END)) // (< 405) + if (CalcItemScale(EQEmu::invslot::TRIBUTE_BEGIN, EQEmu::invslot::TRIBUTE_END)) // (< 405) changed = true; //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - if (CalcItemScale(EQEmu::inventory::slotPowerSource, EQEmu::inventory::slotPowerSource)) + if (CalcItemScale(EQEmu::invslot::SLOT_POWER_SOURCE, EQEmu::invslot::SLOT_POWER_SOURCE)) changed = true; } @@ -3371,7 +3371,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { bool changed = false; uint32 i; for (i = slot_x; i <= slot_y; i++) { - if (i == EQEmu::inventory::slotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot + if (i == EQEmu::invslot::slotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; EQEmu::ItemInstance* inst = m_inv.GetItem(i); @@ -3381,7 +3381,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) - if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) { + if (i >= EQEmu::invbag::GENERAL_BAGS_BEGIN && i <= EQEmu::invbag::GENERAL_BAGS_END) { EQEmu::ItemInstance* parent_item = m_inv.GetItem(EQEmu::InventoryProfile::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; @@ -3401,7 +3401,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { } //iterate all augments - for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) + for (int x = EQEmu::invaug::SOCKET_BEGIN; x <= EQEmu::invaug::SOCKET_END; ++x) { EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) @@ -3433,24 +3433,24 @@ void Client::DoItemEnterZone() { bool changed = false; // MainAmmo excluded in helper function below - if (DoItemEnterZone(EQEmu::legacy::EQUIPMENT_BEGIN, EQEmu::legacy::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21) + if (DoItemEnterZone(EQEmu::invslot::EQUIPMENT_BEGIN, EQEmu::invslot::EQUIPMENT_END)) // original coding excluded MainAmmo (< 21) changed = true; - if (DoItemEnterZone(EQEmu::legacy::GENERAL_BEGIN, EQEmu::legacy::GENERAL_END)) // original coding excluded MainCursor (< 30) + if (DoItemEnterZone(EQEmu::invslot::GENERAL_BEGIN, EQEmu::invslot::GENERAL_END)) // original coding excluded MainCursor (< 30) changed = true; // I excluded cursor bag slots here because cursor was excluded above..if this is incorrect, change 'slot_y' here to CURSOR_BAG_END // and 'slot_y' above to CURSOR from GENERAL_END above - or however it is supposed to be... - if (DoItemEnterZone(EQEmu::legacy::GENERAL_BAGS_BEGIN, EQEmu::legacy::GENERAL_BAGS_END)) // (< 341) + if (DoItemEnterZone(EQEmu::invbag::GENERAL_BAGS_BEGIN, EQEmu::invbag::GENERAL_BAGS_END)) // (< 341) changed = true; - if (DoItemEnterZone(EQEmu::legacy::TRIBUTE_BEGIN, EQEmu::legacy::TRIBUTE_END)) // (< 405) + if (DoItemEnterZone(EQEmu::invslot::TRIBUTE_BEGIN, EQEmu::invslot::TRIBUTE_END)) // (< 405) changed = true; //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - if (DoItemEnterZone(EQEmu::inventory::slotPowerSource, EQEmu::inventory::slotPowerSource)) + if (DoItemEnterZone(EQEmu::invslot::SLOT_POWER_SOURCE, EQEmu::invslot::SLOT_POWER_SOURCE)) changed = true; } @@ -3464,7 +3464,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1 bool changed = false; for(uint32 i = slot_x; i <= slot_y; i++) { - if (i == EQEmu::inventory::slotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot + if (i == EQEmu::invslot::slotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; EQEmu::ItemInstance* inst = m_inv.GetItem(i); @@ -3474,7 +3474,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) - if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) { + if (i >= EQEmu::invbag::GENERAL_BAGS_BEGIN && i <= EQEmu::invbag::GENERAL_BAGS_END) { EQEmu::ItemInstance* parent_item = m_inv.GetItem(EQEmu::InventoryProfile::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; @@ -3486,7 +3486,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { uint16 oldexp = inst->GetExp(); parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0); - if (i <= EQEmu::inventory::slotAmmo || i == EQEmu::inventory::slotPowerSource) { + if (i <= EQEmu::invslot::slotAmmo || i == EQEmu::invslot::SLOT_POWER_SOURCE) { parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i); } @@ -3496,7 +3496,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { update_slot = true; } } else { - if (i <= EQEmu::inventory::slotAmmo || i == EQEmu::inventory::slotPowerSource) { + if (i <= EQEmu::invslot::slotAmmo || i == EQEmu::invslot::SLOT_POWER_SOURCE) { parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i); } @@ -3504,7 +3504,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { } //iterate all augments - for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) + for (int x = EQEmu::invaug::SOCKET_BEGIN; x <= EQEmu::invaug::SOCKET_END; ++x) { EQEmu::ItemInstance *a_inst = inst->GetAugment(x); if(!a_inst) diff --git a/zone/bot.cpp b/zone/bot.cpp index 24a0a49d9..30918138d 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -243,8 +243,8 @@ void Bot::SetBotSpellID(uint32 newSpellID) { } uint32 Bot::GetBotArcheryRange() { - const EQEmu::ItemInstance *range_inst = GetBotItem(EQEmu::inventory::slotRange); - const EQEmu::ItemInstance *ammo_inst = GetBotItem(EQEmu::inventory::slotAmmo); + const EQEmu::ItemInstance *range_inst = GetBotItem(EQEmu::invslot::slotRange); + const EQEmu::ItemInstance *ammo_inst = GetBotItem(EQEmu::invslot::slotAmmo); if (!range_inst || !ammo_inst) return 0; @@ -260,15 +260,15 @@ uint32 Bot::GetBotArcheryRange() { void Bot::ChangeBotArcherWeapons(bool isArcher) { if((GetClass()==WARRIOR) || (GetClass()==PALADIN) || (GetClass()==RANGER) || (GetClass()==SHADOWKNIGHT) || (GetClass()==ROGUE)) { if(!isArcher) { - BotAddEquipItem(EQEmu::inventory::slotPrimary, GetBotItemBySlot(EQEmu::inventory::slotPrimary)); - BotAddEquipItem(EQEmu::inventory::slotSecondary, GetBotItemBySlot(EQEmu::inventory::slotSecondary)); + BotAddEquipItem(EQEmu::invslot::slotPrimary, GetBotItemBySlot(EQEmu::invslot::slotPrimary)); + BotAddEquipItem(EQEmu::invslot::slotSecondary, GetBotItemBySlot(EQEmu::invslot::slotSecondary)); SetAttackTimer(); BotGroupSay(this, "My blade is ready"); } else { - BotRemoveEquipItem(EQEmu::inventory::slotPrimary); - BotRemoveEquipItem(EQEmu::inventory::slotSecondary); - BotAddEquipItem(EQEmu::inventory::slotAmmo, GetBotItemBySlot(EQEmu::inventory::slotAmmo)); - BotAddEquipItem(EQEmu::inventory::slotSecondary, GetBotItemBySlot(EQEmu::inventory::slotRange)); + BotRemoveEquipItem(EQEmu::invslot::slotPrimary); + BotRemoveEquipItem(EQEmu::invslot::slotSecondary); + BotAddEquipItem(EQEmu::invslot::slotAmmo, GetBotItemBySlot(EQEmu::invslot::slotAmmo)); + BotAddEquipItem(EQEmu::invslot::slotSecondary, GetBotItemBySlot(EQEmu::invslot::slotRange)); SetAttackTimer(); BotGroupSay(this, "My bow is true and ready"); } @@ -1166,11 +1166,11 @@ int32 Bot::acmod() { uint16 Bot::GetPrimarySkillValue() { EQEmu::skills::SkillType skill = EQEmu::skills::HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill - bool equiped = m_inv.GetItem(EQEmu::inventory::slotPrimary); + bool equiped = m_inv.GetItem(EQEmu::invslot::slotPrimary); if(!equiped) skill = EQEmu::skills::SkillHandtoHand; else { - uint8 type = m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(EQEmu::invslot::slotPrimary)->GetItem()->ItemType; //is this the best way to do this? switch(type) { case EQEmu::item::ItemType1HSlash: skill = EQEmu::skills::Skill1HSlashing; @@ -1718,8 +1718,8 @@ bool Bot::LoadPet() if (!botdb.LoadPetBuffs(GetBotID(), pet_buffs)) bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetBuffs(), GetCleanName()); - uint32 pet_items[EQEmu::legacy::EQUIPMENT_SIZE]; - memset(pet_items, 0, (sizeof(uint32) * EQEmu::legacy::EQUIPMENT_SIZE)); + uint32 pet_items[EQEmu::invslot::EQUIPMENT_COUNT]; + memset(pet_items, 0, (sizeof(uint32) * EQEmu::invslot::EQUIPMENT_COUNT)); if (!botdb.LoadPetItems(GetBotID(), pet_items)) bot_owner->Message(13, "%s for %s's pet", BotDatabase::fail::LoadPetItems(), GetCleanName()); @@ -1746,11 +1746,11 @@ bool Bot::SavePet() char* pet_name = new char[64]; SpellBuff_Struct pet_buffs[PET_BUFF_COUNT]; - uint32 pet_items[EQEmu::legacy::EQUIPMENT_SIZE]; + uint32 pet_items[EQEmu::invslot::EQUIPMENT_COUNT]; memset(pet_name, 0, 64); memset(pet_buffs, 0, (sizeof(SpellBuff_Struct) * PET_BUFF_COUNT)); - memset(pet_items, 0, (sizeof(uint32) * EQEmu::legacy::EQUIPMENT_SIZE)); + memset(pet_items, 0, (sizeof(uint32) * EQEmu::invslot::EQUIPMENT_COUNT)); pet_inst->GetPetState(pet_buffs, pet_items, pet_name); @@ -1904,12 +1904,12 @@ void Bot::BotRangedAttack(Mob* other) { return; } - EQEmu::ItemInstance* rangedItem = GetBotItem(EQEmu::inventory::slotRange); + EQEmu::ItemInstance* rangedItem = GetBotItem(EQEmu::invslot::slotRange); const EQEmu::ItemData* RangeWeapon = nullptr; if(rangedItem) RangeWeapon = rangedItem->GetItem(); - EQEmu::ItemInstance* ammoItem = GetBotItem(EQEmu::inventory::slotAmmo); + EQEmu::ItemInstance* ammoItem = GetBotItem(EQEmu::invslot::slotAmmo); const EQEmu::ItemData* Ammo = nullptr; if(ammoItem) Ammo = ammoItem->GetItem(); @@ -2003,19 +2003,19 @@ void Bot::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int3 case EQEmu::skills::SkillFlyingKick: case EQEmu::skills::SkillRoundKick: case EQEmu::skills::SkillKick: - item_slot = EQEmu::inventory::slotFeet; + item_slot = EQEmu::invslot::slotFeet; break; case EQEmu::skills::SkillBash: - item_slot = EQEmu::inventory::slotSecondary; + item_slot = EQEmu::invslot::slotSecondary; break; case EQEmu::skills::SkillDragonPunch: case EQEmu::skills::SkillEagleStrike: case EQEmu::skills::SkillTigerClaw: - item_slot = EQEmu::inventory::slotHands; + item_slot = EQEmu::invslot::slotHands; break; } - if (item_slot >= EQEmu::legacy::EQUIPMENT_BEGIN){ + if (item_slot >= EQEmu::invslot::EQUIPMENT_BEGIN){ const EQEmu::ItemInstance* inst = GetBotItem(item_slot); const EQEmu::ItemData* botweapon = nullptr; if(inst) @@ -2312,8 +2312,8 @@ void Bot::AI_Process() { bool atCombatRange = false; - const auto* p_item = GetBotItem(EQEmu::inventory::slotPrimary); - const auto* s_item = GetBotItem(EQEmu::inventory::slotSecondary); + const auto* p_item = GetBotItem(EQEmu::invslot::slotPrimary); + const auto* s_item = GetBotItem(EQEmu::invslot::slotSecondary); bool behind_mob = false; bool backstab_weapon = false; @@ -2589,31 +2589,31 @@ void Bot::AI_Process() { TEST_TARGET(); if (attack_timer.Check()) { // Process primary weapon attacks - Attack(tar, EQEmu::inventory::slotPrimary); + Attack(tar, EQEmu::invslot::slotPrimary); TEST_TARGET(); - TriggerDefensiveProcs(tar, EQEmu::inventory::slotPrimary, false); + TriggerDefensiveProcs(tar, EQEmu::invslot::slotPrimary, false); TEST_TARGET(); - TryWeaponProc(p_item, tar, EQEmu::inventory::slotPrimary); + TryWeaponProc(p_item, tar, EQEmu::invslot::slotPrimary); //bool tripleSuccess = false; TEST_TARGET(); if (CanThisClassDoubleAttack()) { if (CheckBotDoubleAttack()) - Attack(tar, EQEmu::inventory::slotPrimary, true); + Attack(tar, EQEmu::invslot::slotPrimary, true); TEST_TARGET(); if (GetSpecialAbility(SPECATK_TRIPLE) && CheckBotDoubleAttack(true)) { //tripleSuccess = true; - Attack(tar, EQEmu::inventory::slotPrimary, true); + Attack(tar, EQEmu::invslot::slotPrimary, true); } TEST_TARGET(); //quad attack, does this belong here?? if (GetSpecialAbility(SPECATK_QUAD) && CheckBotDoubleAttack(true)) - Attack(tar, EQEmu::inventory::slotPrimary, true); + Attack(tar, EQEmu::invslot::slotPrimary, true); } TEST_TARGET(); @@ -2622,10 +2622,10 @@ void Bot::AI_Process() { if (flurrychance) { if (zone->random.Int(0, 100) < flurrychance) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); - Attack(tar, EQEmu::inventory::slotPrimary, false); + Attack(tar, EQEmu::invslot::slotPrimary, false); TEST_TARGET(); - Attack(tar, EQEmu::inventory::slotPrimary, false); + Attack(tar, EQEmu::invslot::slotPrimary, false); } } @@ -2634,7 +2634,7 @@ void Bot::AI_Process() { if (ExtraAttackChanceBonus) { if (p_item && p_item->GetItem()->IsType2HWeapon()) { if (zone->random.Int(0, 100) < ExtraAttackChanceBonus) - Attack(tar, EQEmu::inventory::slotPrimary, false); + Attack(tar, EQEmu::invslot::slotPrimary, false); } } } @@ -2666,15 +2666,15 @@ void Bot::AI_Process() { float random = zone->random.Real(0, 1); if (random < DualWieldProbability){ // Max 78% of DW - Attack(tar, EQEmu::inventory::slotSecondary); // Single attack with offhand + Attack(tar, EQEmu::invslot::slotSecondary); // Single attack with offhand TEST_TARGET(); - TryWeaponProc(s_item, tar, EQEmu::inventory::slotSecondary); + TryWeaponProc(s_item, tar, EQEmu::invslot::slotSecondary); TEST_TARGET(); if (CanThisClassDoubleAttack() && CheckBotDoubleAttack()) { if (tar->GetHP() > -10) - Attack(tar, EQEmu::inventory::slotSecondary); // Single attack with offhand + Attack(tar, EQEmu::invslot::slotSecondary); // Single attack with offhand } } } @@ -2945,12 +2945,12 @@ void Bot::PetAIProcess() { if(!botPet->BehindMob(botPet->GetTarget(), botPet->GetX(), botPet->GetY()) && botPet->GetTarget()->IsEnraged()) return; - if (botPet->Attack(GetTarget(), EQEmu::inventory::slotPrimary)) // try the main hand + if (botPet->Attack(GetTarget(), EQEmu::invslot::slotPrimary)) // try the main hand if (botPet->GetTarget()) { // We're a pet so we re able to dual attack int32 RandRoll = zone->random.Int(0, 99); if (botPet->CanThisClassDoubleAttack() && (RandRoll < (botPet->GetLevel() + NPCDualAttackModifier))) { - if (botPet->Attack(botPet->GetTarget(), EQEmu::inventory::slotPrimary)) {} + if (botPet->Attack(botPet->GetTarget(), EQEmu::invslot::slotPrimary)) {} } } @@ -2988,11 +2988,11 @@ void Bot::PetAIProcess() { float DualWieldProbability = ((botPet->GetSkill(EQEmu::skills::SkillDualWield) + botPet->GetLevel()) / 400.0f); DualWieldProbability -= zone->random.Real(0, 1); if(DualWieldProbability < 0) { - botPet->Attack(botPet->GetTarget(), EQEmu::inventory::slotSecondary); + botPet->Attack(botPet->GetTarget(), EQEmu::invslot::slotSecondary); if (botPet->CanThisClassDoubleAttack()) { int32 RandRoll = zone->random.Int(0, 99); if (RandRoll < (botPet->GetLevel() + 20)) - botPet->Attack(botPet->GetTarget(), EQEmu::inventory::slotSecondary); + botPet->Attack(botPet->GetTarget(), EQEmu::invslot::slotSecondary); } } } @@ -3117,7 +3117,7 @@ bool Bot::Spawn(Client* botCharacterOwner) { // I re-enabled this until I can sort it out uint32 itemID = 0; uint8 materialFromSlot = 0xFF; - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; ++i) { itemID = GetBotItemBySlot(i); if(itemID != 0) { materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(i); @@ -3225,7 +3225,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { } } - inst = GetBotItem(EQEmu::inventory::slotPrimary); + inst = GetBotItem(EQEmu::invslot::slotPrimary); if(inst) { item = inst->GetItem(); if(item) { @@ -3236,7 +3236,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { } } - inst = GetBotItem(EQEmu::inventory::slotSecondary); + inst = GetBotItem(EQEmu::invslot::slotSecondary); if(inst) { item = inst->GetItem(); if(item) { @@ -3617,12 +3617,12 @@ void Bot::FinishTrade(Client* client, BotTradeType tradeType) if (tradeType == BotTradeClientNormal) { // Items being traded are found in the normal trade window used to trade between a Client and a Client or NPC // Items in this mode are found in slot ids 3000 thru 3003 - thought bots used the full 8-slot window..? - PerformTradeWithClient(EQEmu::legacy::TRADE_BEGIN, EQEmu::legacy::TRADE_END, client); // {3000..3007} + PerformTradeWithClient(EQEmu::invslot::TRADE_BEGIN, EQEmu::invslot::TRADE_END, client); // {3000..3007} } else if (tradeType == BotTradeClientNoDropNoTrade) { // Items being traded are found on the Client's cursor slot, slot id 30. This item can be either a single item or it can be a bag. // If it is a bag, then we have to search for items in slots 331 thru 340 - PerformTradeWithClient(EQEmu::inventory::slotCursor, EQEmu::inventory::slotCursor, client); + PerformTradeWithClient(EQEmu::invslot::slotCursor, EQEmu::invslot::slotCursor, client); // TODO: Add logic here to test if the item in SLOT_CURSOR is a container type, if it is then we need to call the following: // PerformTradeWithClient(331, 340, client); @@ -3641,7 +3641,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli int adjustStackSize; std::string acceptedItemName; - ClientTrade(const ItemInstance* item, int16 from, const char* name = "") : tradeItemInstance(item), fromClientSlot(from), toBotSlot(legacy::SLOT_INVALID), adjustStackSize(0), acceptedItemName(name) { } + ClientTrade(const ItemInstance* item, int16 from, const char* name = "") : tradeItemInstance(item), fromClientSlot(from), toBotSlot(invslot::SLOT_INVALID), adjustStackSize(0), acceptedItemName(name) { } }; struct ClientReturn { @@ -3651,18 +3651,18 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli int adjustStackSize; std::string failedItemName; - ClientReturn(const ItemInstance* item, int16 from, const char* name = "") : returnItemInstance(item), fromBotSlot(from), toClientSlot(legacy::SLOT_INVALID), adjustStackSize(0), failedItemName(name) { } + ClientReturn(const ItemInstance* item, int16 from, const char* name = "") : returnItemInstance(item), fromBotSlot(from), toClientSlot(invslot::SLOT_INVALID), adjustStackSize(0), failedItemName(name) { } }; static const int16 proxyPowerSource = 22; - static const int16 bot_equip_order[(legacy::EQUIPMENT_SIZE + 1)] = { - inventory::slotCharm, inventory::slotEar1, inventory::slotHead, inventory::slotFace, - inventory::slotEar2, inventory::slotNeck, inventory::slotShoulders, inventory::slotArms, - inventory::slotBack, inventory::slotWrist1, inventory::slotWrist2, inventory::slotRange, - inventory::slotHands, inventory::slotPrimary, inventory::slotSecondary, inventory::slotFinger1, - inventory::slotFinger2, inventory::slotChest, inventory::slotLegs, inventory::slotFeet, - inventory::slotWaist, inventory::slotAmmo, proxyPowerSource // inventory::slotPowerSource + static const int16 bot_equip_order[(invslot::CORPSE_BEGIN + 1)] = { + invslot::slotCharm, invslot::slotEar1, invslot::slotHead, invslot::slotFace, + invslot::slotEar2, invslot::slotNeck, invslot::slotShoulders, invslot::slotArms, + invslot::slotBack, invslot::slotWrist1, invslot::slotWrist2, invslot::slotRange, + invslot::slotHands, invslot::slotPrimary, invslot::slotSecondary, invslot::slotFinger1, + invslot::slotFinger2, invslot::slotChest, invslot::slotLegs, invslot::slotFeet, + invslot::slotWaist, invslot::slotAmmo, proxyPowerSource // invslot::SLOT_POWER_SOURCE }; enum { stageStackable = 0, stageEmpty, stageReplaceable }; @@ -3677,17 +3677,17 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli client->ResetTrade(); return; } - if ((beginSlotID != legacy::TRADE_BEGIN) && (beginSlotID != inventory::slotCursor)) { + if ((beginSlotID != invslot::TRADE_BEGIN) && (beginSlotID != invslot::slotCursor)) { client->Message(CC_Red, "Trade request processing from illegal 'begin' slot - Trade Canceled."); client->ResetTrade(); return; } - if ((endSlotID != legacy::TRADE_END) && (endSlotID != inventory::slotCursor)) { + if ((endSlotID != invslot::TRADE_END) && (endSlotID != invslot::slotCursor)) { client->Message(CC_Red, "Trade request processing from illegal 'end' slot - Trade Canceled."); client->ResetTrade(); return; } - if (((beginSlotID == inventory::slotCursor) && (endSlotID != inventory::slotCursor)) || ((beginSlotID != inventory::slotCursor) && (endSlotID == inventory::slotCursor))) { + if (((beginSlotID == invslot::slotCursor) && (endSlotID != invslot::slotCursor)) || ((beginSlotID != invslot::slotCursor) && (endSlotID == invslot::slotCursor))) { client->Message(CC_Red, "Trade request processing illegal slot range - Trade Canceled."); client->ResetTrade(); return; @@ -3718,7 +3718,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli client->ResetTrade(); return; } - if ((trade_index != inventory::slotCursor) && !trade_instance->IsDroppable()) { + if ((trade_index != invslot::slotCursor) && !trade_instance->IsDroppable()) { // TODO: add logging client->Message(CC_Red, "Trade hack detected - Trade Canceled."); client->ResetTrade(); @@ -3781,7 +3781,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli //for (unsigned stage_loop = stageStackable; stage_loop <= stageReplaceable; ++stage_loop) { // awaiting implementation for (unsigned stage_loop = stageEmpty; stage_loop <= stageReplaceable; ++stage_loop) { for (auto& trade_iterator : client_trade) { - if (trade_iterator.toBotSlot != legacy::SLOT_INVALID) + if (trade_iterator.toBotSlot != invslot::SLOT_INVALID) continue; auto trade_instance = trade_iterator.tradeItemInstance; @@ -3798,7 +3798,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli //} if (stage_loop != stageReplaceable) { - if ((index == proxyPowerSource) && m_inv[inventory::slotPowerSource]) + if ((index == proxyPowerSource) && m_inv[invslot::SLOT_POWER_SOURCE]) continue; else if (m_inv[index]) continue; @@ -3817,28 +3817,28 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli if (slot_taken) continue; - if (index == inventory::slotPrimary) { + if (index == invslot::slotPrimary) { if (trade_instance->GetItem()->IsType2HWeapon()) { if (!melee_secondary) { melee_2h_weapon = true; - auto equipped_secondary_weapon = m_inv[inventory::slotSecondary]; + auto equipped_secondary_weapon = m_inv[invslot::slotSecondary]; if (equipped_secondary_weapon) - client_return.push_back(ClientReturn(equipped_secondary_weapon, inventory::slotSecondary)); + client_return.push_back(ClientReturn(equipped_secondary_weapon, invslot::slotSecondary)); } else { continue; } } } - if (index == inventory::slotSecondary) { + if (index == invslot::slotSecondary) { if (!melee_2h_weapon) { if ((can_dual_wield && trade_instance->GetItem()->IsType1HWeapon()) || trade_instance->GetItem()->IsTypeShield() || !trade_instance->IsWeapon()) { melee_secondary = true; - auto equipped_primary_weapon = m_inv[inventory::slotPrimary]; + auto equipped_primary_weapon = m_inv[invslot::slotPrimary]; if (equipped_primary_weapon && equipped_primary_weapon->GetItem()->IsType2HWeapon()) - client_return.push_back(ClientReturn(equipped_primary_weapon, inventory::slotPrimary)); + client_return.push_back(ClientReturn(equipped_primary_weapon, invslot::slotPrimary)); } else { continue; @@ -3850,10 +3850,10 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } if (index == proxyPowerSource) { - trade_iterator.toBotSlot = inventory::slotPowerSource; + trade_iterator.toBotSlot = invslot::SLOT_POWER_SOURCE; - if (m_inv[inventory::slotPowerSource]) - client_return.push_back(ClientReturn(m_inv[inventory::slotPowerSource], inventory::slotPowerSource)); + if (m_inv[invslot::SLOT_POWER_SOURCE]) + client_return.push_back(ClientReturn(m_inv[invslot::SLOT_POWER_SOURCE], invslot::SLOT_POWER_SOURCE)); } else { trade_iterator.toBotSlot = index; @@ -3869,7 +3869,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli // move unassignable items from trade list to return list for (std::list::iterator trade_iterator = client_trade.begin(); trade_iterator != client_trade.end();) { - if (trade_iterator->toBotSlot == legacy::SLOT_INVALID) { + if (trade_iterator->toBotSlot == invslot::SLOT_INVALID) { client_return.push_back(ClientReturn(trade_iterator->tradeItemInstance, trade_iterator->fromClientSlot, trade_iterator->tradeItemInstance->GetItem()->Name)); trade_iterator = client_trade.erase(trade_iterator); continue; @@ -3895,17 +3895,17 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli return; } - if (return_iterator.fromBotSlot == inventory::slotCursor) { - return_iterator.toClientSlot = inventory::slotCursor; + if (return_iterator.fromBotSlot == invslot::slotCursor) { + return_iterator.toClientSlot = invslot::slotCursor; } else { - int16 client_search_general = legacy::GENERAL_BEGIN; - uint8 client_search_bag = inventory::containerBegin; + int16 client_search_general = invslot::GENERAL_BEGIN; + uint8 client_search_bag = invbag::SLOT_BEGIN; bool run_search = true; while (run_search) { int16 client_test_slot = client->GetInv().FindFreeSlotForTradeItem(return_instance, client_search_general, client_search_bag); - if (client_test_slot == legacy::SLOT_INVALID) { + if (client_test_slot == invslot::SLOT_INVALID) { run_search = false; continue; } @@ -3915,26 +3915,26 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli if (check_iterator.fromBotSlot == return_iterator.fromBotSlot) continue; - if ((check_iterator.toClientSlot == client_test_slot) && (client_test_slot != inventory::slotCursor)) { + if ((check_iterator.toClientSlot == client_test_slot) && (client_test_slot != invslot::slotCursor)) { slot_taken = true; break; } } if (slot_taken) { - if ((client_test_slot >= legacy::GENERAL_BEGIN) && (client_test_slot <= legacy::GENERAL_END)) { + if ((client_test_slot >= invslot::GENERAL_BEGIN) && (client_test_slot <= invslot::GENERAL_END)) { ++client_search_general; - client_search_bag = inventory::containerBegin; + client_search_bag = invbag::SLOT_BEGIN; } else { client_search_general = InventoryProfile::CalcSlotId(client_test_slot); client_search_bag = InventoryProfile::CalcBagIdx(client_test_slot); ++client_search_bag; - if (client_search_bag >= inventory::ContainerCount) { + if (client_search_bag >= invbag::SLOT_COUNT) { // incrementing this past legacy::GENERAL_END triggers the (client_test_slot == legacy::SLOT_INVALID) at the beginning of the search loop // ideally, this will never occur because we always start fresh with each loop iteration and should receive SLOT_CURSOR as a return value ++client_search_general; - client_search_bag = inventory::containerBegin; + client_search_bag = invbag::SLOT_BEGIN; } } @@ -3946,7 +3946,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } } - if (return_iterator.toClientSlot == legacy::SLOT_INVALID) { + if (return_iterator.toClientSlot == invslot::SLOT_INVALID) { client->Message(CC_Yellow, "You do not have room to complete this trade - Trade Canceled!"); client->ResetTrade(); return; @@ -3958,10 +3958,10 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli for (auto& return_iterator : client_return) { // TODO: code for stackables - if (return_iterator.fromBotSlot == inventory::slotCursor) { // failed trade return + if (return_iterator.fromBotSlot == invslot::slotCursor) { // failed trade return // no movement action required } - else if ((return_iterator.fromBotSlot >= legacy::TRADE_BEGIN) && (return_iterator.fromBotSlot <= legacy::TRADE_END)) { // failed trade returns + else if ((return_iterator.fromBotSlot >= invslot::TRADE_BEGIN) && (return_iterator.fromBotSlot <= invslot::TRADE_END)) { // failed trade returns client->PutItemInInventory(return_iterator.toClientSlot, *return_iterator.returnItemInstance); client->SendItemPacket(return_iterator.toClientSlot, return_iterator.returnItemInstance, ItemPacketTrade); client->DeleteItemInInventory(return_iterator.fromBotSlot); @@ -4174,13 +4174,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b FaceTarget(GetTarget()); EQEmu::ItemInstance* weapon = nullptr; - if (Hand == EQEmu::inventory::slotPrimary) { - weapon = GetBotItem(EQEmu::inventory::slotPrimary); + if (Hand == EQEmu::invslot::slotPrimary) { + weapon = GetBotItem(EQEmu::invslot::slotPrimary); OffHandAtk(false); } - if (Hand == EQEmu::inventory::slotSecondary) { - weapon = GetBotItem(EQEmu::inventory::slotSecondary); + if (Hand == EQEmu::invslot::slotSecondary) { + weapon = GetBotItem(EQEmu::invslot::slotSecondary); OffHandAtk(true); } @@ -4229,7 +4229,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b // This is not recommended for normal usage, as the damage bonus represents a non-trivial component of the DPS output // of weapons wielded by higher-level melee characters (especially for two-handed weapons). int ucDamageBonus = 0; - if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) { + if (Hand == EQEmu::invslot::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 EQEmu::ItemData*) nullptr); @@ -4238,7 +4238,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b } #endif //Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon. - if (Hand == EQEmu::inventory::slotSecondary) { + if (Hand == EQEmu::invslot::slotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); my_hit.min_damage = ucDamageBonus; @@ -4645,7 +4645,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { int32 focus_max = 0; int32 focus_max_real = 0; //item focus - for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) { + for (int x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invslot::EQUIPMENT_END; x++) { TempItem = nullptr; EQEmu::ItemInstance* ins = GetBotItem(x); if (!ins) @@ -4670,7 +4670,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { } } - for (int y = EQEmu::inventory::socketBegin; y < EQEmu::inventory::SocketCount; ++y) { + for (int y = EQEmu::invaug::SOCKET_BEGIN; y <= EQEmu::invaug::SOCKET_END; ++y) { EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); if(aug) { @@ -5106,13 +5106,13 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { float ProcChance = 0.0f; uint32 weapon_speed = 0; switch (hand) { - case EQEmu::inventory::slotPrimary: + case EQEmu::invslot::slotPrimary: weapon_speed = attack_timer.GetDuration(); break; - case EQEmu::inventory::slotSecondary: + case EQEmu::invslot::slotSecondary: weapon_speed = attack_dw_timer.GetDuration(); break; - case EQEmu::inventory::slotRange: + case EQEmu::invslot::slotRange: weapon_speed = ranged_timer.GetDuration(); break; } @@ -5202,11 +5202,11 @@ void Bot::DoRiposte(Mob* defender) { if (!defender) return; - defender->Attack(this, EQEmu::inventory::slotPrimary, true); + defender->Attack(this, EQEmu::invslot::slotPrimary, true); int32 DoubleRipChance = (defender->GetAABonuses().GiveDoubleRiposte[0] + defender->GetSpellBonuses().GiveDoubleRiposte[0] + defender->GetItemBonuses().GiveDoubleRiposte[0]); if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { Log(Logs::Detail, Logs::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); - defender->Attack(this, EQEmu::inventory::slotPrimary, true); + defender->Attack(this, EQEmu::invslot::slotPrimary, true); } DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[1]; @@ -5236,7 +5236,7 @@ int Bot::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) base++; return base; case EQEmu::skills::SkillFrenzy: - if (GetBotItem(EQEmu::inventory::slotPrimary)) { + if (GetBotItem(EQEmu::invslot::slotPrimary)) { if (GetLevel() > 15) base += GetLevel() - 15; if (base > 23) @@ -5252,7 +5252,7 @@ int Bot::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) case EQEmu::skills::SkillFlyingKick: { float skill_bonus = skill_level / 9.0f; float ac_bonus = 0.0f; - auto inst = GetBotItem(EQEmu::inventory::slotFeet); + auto inst = GetBotItem(EQEmu::invslot::slotFeet); if (inst) ac_bonus = inst->GetItemArmorClass(true) / 25.0f; if (ac_bonus > skill_bonus) @@ -5262,7 +5262,7 @@ int Bot::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) case EQEmu::skills::SkillKick: { float skill_bonus = skill_level / 10.0f; float ac_bonus = 0.0f; - auto inst = GetBotItem(EQEmu::inventory::slotFeet); + auto inst = GetBotItem(EQEmu::invslot::slotFeet); if (inst) ac_bonus = inst->GetItemArmorClass(true) / 25.0f; if (ac_bonus > skill_bonus) @@ -5274,9 +5274,9 @@ int Bot::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) float ac_bonus = 0.0f; const EQEmu::ItemInstance *inst = nullptr; if (HasShieldEquiped()) - inst = GetBotItem(EQEmu::inventory::slotSecondary); + inst = GetBotItem(EQEmu::invslot::slotSecondary); else if (HasTwoHanderEquipped()) - inst = GetBotItem(EQEmu::inventory::slotPrimary); + inst = GetBotItem(EQEmu::invslot::slotPrimary); if (inst) ac_bonus = inst->GetItemArmorClass(true) / 25.0f; if (ac_bonus > skill_bonus) @@ -5285,7 +5285,7 @@ int Bot::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) } case EQEmu::skills::SkillBackstab: { float skill_bonus = static_cast(skill_level) * 0.02f; - auto inst = GetBotItem(EQEmu::inventory::slotPrimary); + auto inst = GetBotItem(EQEmu::invslot::slotPrimary); if (inst && inst->GetItem() && inst->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing) { base = inst->GetItemBackstabDamage(true); if (!inst->GetItemBackstabDamage()) @@ -5310,7 +5310,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 hate = hate_override; if (skill == EQEmu::skills::SkillBash) { - const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotSecondary); + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::invslot::slotSecondary); const EQEmu::ItemData* botweapon = nullptr; if(inst) botweapon = inst->GetItem(); @@ -5331,10 +5331,10 @@ void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 my_hit.skill = skill; my_hit.offense = offense(my_hit.skill); my_hit.tohit = GetTotalToHit(my_hit.skill, 0); - my_hit.hand = EQEmu::inventory::slotPrimary; + my_hit.hand = EQEmu::invslot::slotPrimary; if (skill == EQEmu::skills::SkillThrowing || skill == EQEmu::skills::SkillArchery) - my_hit.hand = EQEmu::inventory::slotRange; + my_hit.hand = EQEmu::invslot::slotRange; DoAttack(who, my_hit); @@ -5371,7 +5371,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { bool bIsBehind = false; bool bCanFrontalBS = false; - const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotPrimary); + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::invslot::slotPrimary); const EQEmu::ItemData* botpiercer = nullptr; if(inst) botpiercer = inst->GetItem(); @@ -5414,7 +5414,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { m_specialattacks = eSpecialAttacks::None; } else - Attack(other, EQEmu::inventory::slotPrimary); + Attack(other, EQEmu::invslot::slotPrimary); } void Bot::RogueBackstab(Mob *other, bool min_damage, int ReuseTime) @@ -5422,7 +5422,7 @@ void Bot::RogueBackstab(Mob *other, bool min_damage, int ReuseTime) if (!other) return; - EQEmu::ItemInstance *botweaponInst = GetBotItem(EQEmu::inventory::slotPrimary); + EQEmu::ItemInstance *botweaponInst = GetBotItem(EQEmu::invslot::slotPrimary); if (botweaponInst) { if (!GetWeaponDamage(other, botweaponInst)) return; @@ -5440,7 +5440,7 @@ void Bot::RogueBackstab(Mob *other, bool min_damage, int ReuseTime) } void Bot::RogueAssassinate(Mob* other) { - EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::inventory::slotPrimary); + EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::invslot::slotPrimary); if(botweaponInst) { if(GetWeaponDamage(other, botweaponInst)) other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); @@ -5505,7 +5505,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::inventory::slotSecondary) && m_inv.GetItem(EQEmu::inventory::slotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::inventory::slotPrimary) && m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) + if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::invslot::slotSecondary) && m_inv.GetItem(EQEmu::invslot::slotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::invslot::slotPrimary) && m_inv.GetItem(EQEmu::invslot::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) canBash = true; if(!canBash || zone->random.Int(0, 100) > 25) @@ -5524,7 +5524,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::inventory::slotSecondary) && m_inv.GetItem(EQEmu::inventory::slotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::inventory::slotPrimary) && m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) + if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::invslot::slotSecondary) && m_inv.GetItem(EQEmu::invslot::slotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::invslot::slotPrimary) && m_inv.GetItem(EQEmu::invslot::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) skill_to_use = EQEmu::skills::SkillBash; } break; @@ -5555,7 +5555,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if (skill_to_use == EQEmu::skills::SkillBash) { if (target != this) { DoAnim(animTailRake); - if (GetWeaponDamage(target, GetBotItem(EQEmu::inventory::slotSecondary)) <= 0 && GetWeaponDamage(target, GetBotItem(EQEmu::inventory::slotShoulders)) <= 0) + if (GetWeaponDamage(target, GetBotItem(EQEmu::invslot::slotSecondary)) <= 0 && GetWeaponDamage(target, GetBotItem(EQEmu::invslot::slotShoulders)) <= 0) dmg = DMG_INVULNERABLE; reuse = (BashReuseTime * 1000); @@ -5582,7 +5582,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if (skill_to_use == EQEmu::skills::SkillKick) { if(target != this) { DoAnim(animKick); - if (GetWeaponDamage(target, GetBotItem(EQEmu::inventory::slotFeet)) <= 0) + if (GetWeaponDamage(target, GetBotItem(EQEmu::invslot::slotFeet)) <= 0) dmg = DMG_INVULNERABLE; reuse = (KickReuseTime * 1000); @@ -5720,7 +5720,7 @@ void Bot::EquipBot(std::string* errorMessage) { GetBotItems(m_inv, errorMessage); const EQEmu::ItemInstance* inst = nullptr; const EQEmu::ItemData* item = nullptr; - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; ++i) { inst = GetBotItem(i); if(inst) { item = inst->GetItem(); @@ -5847,12 +5847,12 @@ void Bot::SetAttackTimer() { attack_timer.SetAtTrigger(4000, true); Timer* TimerToUse = nullptr; const EQEmu::ItemData* PrimaryWeapon = nullptr; - for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) { - if (i == EQEmu::inventory::slotPrimary) + for (int i = EQEmu::invslot::slotRange; i <= EQEmu::invslot::slotSecondary; i++) { + if (i == EQEmu::invslot::slotPrimary) TimerToUse = &attack_timer; - else if (i == EQEmu::inventory::slotRange) + else if (i == EQEmu::invslot::slotRange) TimerToUse = &ranged_timer; - else if (i == EQEmu::inventory::slotSecondary) + else if (i == EQEmu::invslot::slotSecondary) TimerToUse = &attack_dw_timer; else continue; @@ -5862,7 +5862,7 @@ void Bot::SetAttackTimer() { if (ci) ItemToUse = ci->GetItem(); - if (i == EQEmu::inventory::slotSecondary) { + if (i == EQEmu::invslot::slotSecondary) { if (PrimaryWeapon != nullptr) { if (PrimaryWeapon->IsClassCommon() && PrimaryWeapon->IsType2HWeapon()) { attack_dw_timer.Disable(); @@ -5893,7 +5893,7 @@ void Bot::SetAttackTimer() { speed = (RuleB(Spells, Jun182014HundredHandsRevamp) ? static_cast(((delay / haste_mod) + ((hhe / 1000.0f) * (delay / haste_mod))) * 100) : static_cast(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100)); TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true, true); - if (i == EQEmu::inventory::slotPrimary) + if (i == EQEmu::invslot::slotPrimary) PrimaryWeapon = ItemToUse; } } @@ -7603,7 +7603,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { // Modded to display power source items (will only show up on SoF+ client inspect windows though.) // I don't think bots are currently coded to use them..but, you'll have to use '#bot inventory list' // to see them on a Titanium client when/if they are activated. - for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::inventory::slotWaist; L++) { + for (int16 L = EQEmu::invslot::EQUIPMENT_BEGIN; L <= EQEmu::invslot::slotWaist; L++) { inst = inspectedBot->GetBotItem(L); if(inst) { @@ -7617,28 +7617,28 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { } } - inst = inspectedBot->GetBotItem(EQEmu::inventory::slotPowerSource); + inst = inspectedBot->GetBotItem(EQEmu::invslot::SLOT_POWER_SOURCE); if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[SoF::invslot::PossessionsPowerSource], item->Name); - insr->itemicons[SoF::invslot::PossessionsPowerSource] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::slotPowerSource], item->Name); + insr->itemicons[SoF::invslot::slotPowerSource] = item->Icon; } else - insr->itemicons[SoF::invslot::PossessionsPowerSource] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::slotPowerSource] = 0xFFFFFFFF; } - inst = inspectedBot->GetBotItem(EQEmu::inventory::slotAmmo); + inst = inspectedBot->GetBotItem(EQEmu::invslot::slotAmmo); if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[SoF::invslot::PossessionsAmmo], item->Name); - insr->itemicons[SoF::invslot::PossessionsAmmo] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::slotAmmo], item->Name); + insr->itemicons[SoF::invslot::slotAmmo] = item->Icon; } else - insr->itemicons[SoF::invslot::PossessionsAmmo] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::slotAmmo] = 0xFFFFFFFF; } strcpy(insr->text, inspectedBot->GetInspectMessage().text); @@ -7651,7 +7651,7 @@ void Bot::CalcItemBonuses(StatBonuses* newbon) { const EQEmu::ItemData* itemtmp = nullptr; - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= (EQEmu::invslot::EQUIPMENT_END + 1); ++i) { const EQEmu::ItemInstance* item = GetBotItem((i == 22 ? 9999 : i)); if(item) { AddItemBonuses(item, newbon); @@ -7964,7 +7964,7 @@ void Bot::AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, b if (!isAug) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) AddItemBonuses(inst->GetAugment(i),newbon,true, false, rec_level); } @@ -8473,12 +8473,12 @@ uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) { int Bot::GetRawACNoShield(int &shield_ac) { int ac = itembonuses.AC + spellbonuses.AC; shield_ac = 0; - EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotSecondary); + EQEmu::ItemInstance* inst = GetBotItem(EQEmu::invslot::slotSecondary); if(inst) { if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; shield_ac = inst->GetItem()->AC; - for (uint8 i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (uint8 i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { if(inst->GetAugment(i)) { ac -= inst->GetAugment(i)->GetItem()->AC; shield_ac += inst->GetAugment(i)->GetItem()->AC; @@ -8493,7 +8493,7 @@ uint32 Bot::CalcCurrentWeight() { const EQEmu::ItemData* TempItem = nullptr; EQEmu::ItemInstance* inst = nullptr; uint32 Total = 0; - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; ++i) { inst = GetBotItem(i); if(inst) { TempItem = inst->GetItem(); diff --git a/zone/bot.h b/zone/bot.h index c72e83f5c..0c48b6483 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -80,9 +80,9 @@ static const std::string bot_stance_name[BOT_STANCE_COUNT] = { static const char* GetBotStanceName(int stance_id) { return bot_stance_name[VALIDBOTSTANCE(stance_id)].c_str(); } -#define VALIDBOTEQUIPSLOT(x) ((x >= EQEmu::legacy::EQUIPMENT_BEGIN && x <= EQEmu::legacy::EQUIPMENT_END) ? (x) : ((x == EQEmu::inventory::slotPowerSource) ? (22) : (23))) +#define VALIDBOTEQUIPSLOT(x) ((x >= EQEmu::invslot::EQUIPMENT_BEGIN && x <= EQEmu::invslot::EQUIPMENT_END) ? (x) : ((x == EQEmu::invslot::SLOT_POWER_SOURCE) ? (22) : (23))) -static std::string bot_equip_slot_name[EQEmu::legacy::EQUIPMENT_SIZE + 2] = +static std::string bot_equip_slot_name[EQEmu::invslot::EQUIPMENT_COUNT + 2] = { "Charm", // MainCharm "Left Ear", // MainEar1 @@ -256,7 +256,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None); - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 7f5aa1a94..3344fd0fb 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -2403,7 +2403,7 @@ namespace ActionableBots continue; mod_skill_value = base_skill_value; - for (int16 index = EQEmu::legacy::EQUIPMENT_BEGIN; index <= EQEmu::legacy::EQUIPMENT_END; ++index) { + for (int16 index = EQEmu::invslot::EQUIPMENT_BEGIN; index <= EQEmu::invslot::EQUIPMENT_END; ++index) { const EQEmu::ItemInstance* indexed_item = bot_iter->GetBotItem(index); if (indexed_item && indexed_item->GetItem()->SkillModType == skill_type) mod_skill_value += (base_skill_value * (((float)indexed_item->GetItem()->SkillModValue) / 100.0f)); @@ -7137,23 +7137,23 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep) linker.SetLinkType(EQEmu::saylink::SayLinkItemInst); uint32 inventory_count = 0; - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { - if ((i == EQEmu::inventory::slotSecondary) && is2Hweapon) + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= (EQEmu::invslot::EQUIPMENT_END + 1); ++i) { + if ((i == EQEmu::invslot::slotSecondary) && is2Hweapon) continue; - inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::inventory::slotPowerSource : i); + inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::invslot::SLOT_POWER_SOURCE : i); if (!inst || !inst->GetItem()) { - c->Message(m_message, "I need something for my %s (slot %i)", GetBotEquipSlotName(i), (i == 22 ? EQEmu::inventory::slotPowerSource : i)); + c->Message(m_message, "I need something for my %s (slot %i)", GetBotEquipSlotName(i), (i == 22 ? EQEmu::invslot::SLOT_POWER_SOURCE : i)); continue; } item = inst->GetItem(); - if ((i == EQEmu::inventory::slotPrimary) && item->IsType2HWeapon()) { + if ((i == EQEmu::invslot::slotPrimary) && item->IsType2HWeapon()) { is2Hweapon = true; } linker.SetItemInst(inst); - c->Message(m_message, "Using %s in my %s (slot %i)", linker.GenerateLink().c_str(), GetBotEquipSlotName(i), (i == 22 ? EQEmu::inventory::slotPowerSource : i)); + c->Message(m_message, "Using %s in my %s (slot %i)", linker.GenerateLink().c_str(), GetBotEquipSlotName(i), (i == 22 ? EQEmu::invslot::SLOT_POWER_SOURCE : i)); ++inventory_count; } @@ -7192,7 +7192,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) } int slotId = atoi(sep->arg[1]); - if (!sep->IsNumber(1) || ((slotId > EQEmu::legacy::EQUIPMENT_END || slotId < EQEmu::legacy::EQUIPMENT_BEGIN) && slotId != EQEmu::inventory::slotPowerSource)) { + if (!sep->IsNumber(1) || ((slotId > EQEmu::invslot::EQUIPMENT_END || slotId < EQEmu::invslot::EQUIPMENT_BEGIN) && slotId != EQEmu::invslot::SLOT_POWER_SOURCE)) { c->Message(m_fail, "Valid slots are 0-21 or 9999"); return; } @@ -7207,7 +7207,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) return; } - for (int m = EQEmu::inventory::socketBegin; m < EQEmu::inventory::SocketCount; ++m) { + for (int m = EQEmu::invaug::SOCKET_BEGIN; m <= EQEmu::invaug::SOCKET_END; ++m) { if (!itminst) break; @@ -7224,7 +7224,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) std::string error_message; if (itm) { c->PushItemOnCursor(*itminst, true); - if ((slotId == EQEmu::inventory::slotRange) || (slotId == EQEmu::inventory::slotAmmo) || (slotId == EQEmu::inventory::slotPrimary) || (slotId == EQEmu::inventory::slotSecondary)) + if ((slotId == EQEmu::invslot::slotRange) || (slotId == EQEmu::invslot::slotAmmo) || (slotId == EQEmu::invslot::slotPrimary) || (slotId == EQEmu::invslot::slotSecondary)) my_bot->SetBotArcher(false); my_bot->RemoveBotItemBySlot(slotId, &error_message); @@ -7238,31 +7238,31 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) } switch (slotId) { - case EQEmu::inventory::slotCharm: - case EQEmu::inventory::slotEar1: - case EQEmu::inventory::slotHead: - case EQEmu::inventory::slotFace: - case EQEmu::inventory::slotEar2: - case EQEmu::inventory::slotNeck: - case EQEmu::inventory::slotBack: - case EQEmu::inventory::slotWrist1: - case EQEmu::inventory::slotWrist2: - case EQEmu::inventory::slotRange: - case EQEmu::inventory::slotPrimary: - case EQEmu::inventory::slotSecondary: - case EQEmu::inventory::slotFinger1: - case EQEmu::inventory::slotFinger2: - case EQEmu::inventory::slotChest: - case EQEmu::inventory::slotWaist: - case EQEmu::inventory::slotPowerSource: - case EQEmu::inventory::slotAmmo: + case EQEmu::invslot::slotCharm: + case EQEmu::invslot::slotEar1: + case EQEmu::invslot::slotHead: + case EQEmu::invslot::slotFace: + case EQEmu::invslot::slotEar2: + case EQEmu::invslot::slotNeck: + case EQEmu::invslot::slotBack: + case EQEmu::invslot::slotWrist1: + case EQEmu::invslot::slotWrist2: + case EQEmu::invslot::slotRange: + case EQEmu::invslot::slotPrimary: + case EQEmu::invslot::slotSecondary: + case EQEmu::invslot::slotFinger1: + case EQEmu::invslot::slotFinger2: + case EQEmu::invslot::slotChest: + case EQEmu::invslot::slotWaist: + case EQEmu::invslot::SLOT_POWER_SOURCE: + case EQEmu::invslot::slotAmmo: c->Message(m_message, "My %s is %s unequipped", GetBotEquipSlotName(slotId), ((itm) ? ("now") : ("already"))); break; - case EQEmu::inventory::slotShoulders: - case EQEmu::inventory::slotArms: - case EQEmu::inventory::slotHands: - case EQEmu::inventory::slotLegs: - case EQEmu::inventory::slotFeet: + case EQEmu::invslot::slotShoulders: + case EQEmu::invslot::slotArms: + case EQEmu::invslot::slotHands: + case EQEmu::invslot::slotLegs: + case EQEmu::invslot::slotFeet: c->Message(m_message, "My %s are %s unequipped", GetBotEquipSlotName(slotId), ((itm) ? ("now") : ("already"))); break; default: @@ -7299,14 +7299,14 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep) //EQEmu::SayLinkEngine linker; //linker.SetLinkType(EQEmu::saylink::SayLinkItemInst); - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= (EQEmu::invslot::EQUIPMENT_END + 1); ++i) { const EQEmu::ItemData* item = nullptr; - const EQEmu::ItemInstance* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::inventory::slotPowerSource : i); + const EQEmu::ItemInstance* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::invslot::SLOT_POWER_SOURCE : i); if (inst) item = inst->GetItem(); window_text.append(""); - window_text.append(GetBotEquipSlotName(i == 22 ? EQEmu::inventory::slotPowerSource : i)); + window_text.append(GetBotEquipSlotName(i == 22 ? EQEmu::invslot::SLOT_POWER_SOURCE : i)); window_text.append(": "); if (item) { //window_text.append(""); diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 10449ab7a..a5e50fdec 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1138,7 +1138,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent for (auto row = results.begin(); row != results.end(); ++row) { int16 slot_id = atoi(row[0]); - if ((slot_id < EQEmu::legacy::EQUIPMENT_BEGIN || slot_id > EQEmu::legacy::EQUIPMENT_END) && slot_id != EQEmu::inventory::slotPowerSource) + if ((slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END) && slot_id != EQEmu::invslot::SLOT_POWER_SOURCE) continue; uint32 item_id = atoi(row[1]); @@ -1173,7 +1173,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent if (item_inst->GetItem()->Attuneable) { if (atoi(row[4])) item_inst->SetAttuned(true); - else if (((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || slot_id == EQEmu::inventory::slotPowerSource)) + else if (((slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::invslot::EQUIPMENT_END) || slot_id == EQEmu::invslot::SLOT_POWER_SOURCE)) item_inst->SetAttuned(true); } @@ -1241,7 +1241,7 @@ bool BotDatabase::LoadItemBySlot(Bot* bot_inst) bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint32& item_id) { - if (!bot_id || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::inventory::slotPowerSource)) + if (!bot_id || (slot_id > EQEmu::invslot::EQUIPMENT_END && slot_id != EQEmu::invslot::SLOT_POWER_SOURCE)) return false; query = StringFormat("SELECT `item_id` FROM `bot_inventories` WHERE `bot_id` = '%i' AND `slot_id` = '%i' LIMIT 1", bot_id, slot_id); @@ -1259,7 +1259,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEmu::ItemInstance* item_inst) { - if (!bot_inst || !bot_inst->GetBotID() || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::inventory::slotPowerSource)) + if (!bot_inst || !bot_inst->GetBotID() || (slot_id > EQEmu::invslot::EQUIPMENT_END && slot_id != EQEmu::invslot::SLOT_POWER_SOURCE)) return false; if (!DeleteItemBySlot(bot_inst->GetBotID(), slot_id)) @@ -1268,8 +1268,8 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEm if (!item_inst || !item_inst->GetID()) return true; - uint32 augment_id[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; - for (int augment_iter = EQEmu::inventory::socketBegin; augment_iter < EQEmu::inventory::SocketCount; ++augment_iter) + uint32 augment_id[EQEmu::invaug::SOCKET_COUNT] = { 0, 0, 0, 0, 0, 0 }; + for (int augment_iter = EQEmu::invaug::SOCKET_BEGIN; augment_iter <= EQEmu::invaug::SOCKET_END; ++augment_iter) augment_id[augment_iter] = item_inst->GetAugmentItemID(augment_iter); uint16 item_charges = 0; @@ -1343,7 +1343,7 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEm bool BotDatabase::DeleteItemBySlot(const uint32 bot_id, const uint32 slot_id) { - if (!bot_id || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::inventory::slotPowerSource)) + if (!bot_id || (slot_id > EQEmu::invslot::EQUIPMENT_END && slot_id != EQEmu::invslot::SLOT_POWER_SOURCE)) return false; query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u'", bot_id, slot_id); @@ -1382,12 +1382,12 @@ bool BotDatabase::SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, c return false; bool all_flag = (slot_id == -2); - if ((slot_id < EQEmu::legacy::EQUIPMENT_BEGIN || slot_id > EQEmu::legacy::EQUIPMENT_END) && slot_id != EQEmu::inventory::slotPowerSource && !all_flag) + if ((slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END) && slot_id != EQEmu::invslot::SLOT_POWER_SOURCE && !all_flag) return false; std::string where_clause; if (all_flag) - where_clause = StringFormat(" AND `slot_id` IN ('%u', '%u', '%u', '%u', '%u', '%u', '%u')", EQEmu::inventory::slotHead, EQEmu::inventory::slotArms, EQEmu::inventory::slotWrist1, EQEmu::inventory::slotHands, EQEmu::inventory::slotChest, EQEmu::inventory::slotLegs, EQEmu::inventory::slotFeet); + where_clause = StringFormat(" AND `slot_id` IN ('%u', '%u', '%u', '%u', '%u', '%u', '%u')", EQEmu::invslot::slotHead, EQEmu::invslot::slotArms, EQEmu::invslot::slotWrist1, EQEmu::invslot::slotHands, EQEmu::invslot::slotChest, EQEmu::invslot::slotLegs, EQEmu::invslot::slotFeet); else where_clause = StringFormat(" AND `slot_id` = '%u'", slot_id); @@ -1658,8 +1658,8 @@ bool BotDatabase::LoadPetItems(const uint32 bot_id, uint32* pet_items) if (!results.RowCount()) return true; - int item_index = 0; - for (auto row = results.begin(); row != results.end() && item_index < EQEmu::legacy::EQUIPMENT_SIZE; ++row) { + int item_index = EQEmu::invslot::EQUIPMENT_BEGIN; + for (auto row = results.begin(); row != results.end() && item_index <= EQEmu::invslot::EQUIPMENT_END; ++row) { pet_items[item_index] = atoi(row[0]); ++item_index; } @@ -1683,7 +1683,7 @@ bool BotDatabase::SavePetItems(const uint32 bot_id, const uint32* pet_items, boo if (!saved_pet_index) return true; - for (int item_index = 0; item_index < EQEmu::legacy::EQUIPMENT_SIZE; ++item_index) { + for (int item_index = EQEmu::invslot::SLOT_BEGIN; item_index <= EQEmu::invslot::EQUIPMENT_END; ++item_index) { if (!pet_items[item_index]) continue; @@ -1832,7 +1832,7 @@ bool BotDatabase::SaveAllArmorColorBySlot(const uint32 owner_id, const int16 slo " AND bi.`slot_id` = '%i'", owner_id, rgb_value, - EQEmu::inventory::slotHead, EQEmu::inventory::slotChest, EQEmu::inventory::slotArms, EQEmu::inventory::slotWrist1, EQEmu::inventory::slotWrist2, EQEmu::inventory::slotHands, EQEmu::inventory::slotLegs, EQEmu::inventory::slotFeet, + EQEmu::invslot::slotHead, EQEmu::invslot::slotChest, EQEmu::invslot::slotArms, EQEmu::invslot::slotWrist1, EQEmu::invslot::slotWrist2, EQEmu::invslot::slotHands, EQEmu::invslot::slotLegs, EQEmu::invslot::slotFeet, slot_id ); auto results = QueryDatabase(query); @@ -1856,7 +1856,7 @@ bool BotDatabase::SaveAllArmorColors(const uint32 owner_id, const uint32 rgb_val " AND bi.`slot_id` IN ('%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", owner_id, rgb_value, - EQEmu::inventory::slotHead, EQEmu::inventory::slotChest, EQEmu::inventory::slotArms, EQEmu::inventory::slotWrist1, EQEmu::inventory::slotWrist2, EQEmu::inventory::slotHands, EQEmu::inventory::slotLegs, EQEmu::inventory::slotFeet + EQEmu::invslot::slotHead, EQEmu::invslot::slotChest, EQEmu::invslot::slotArms, EQEmu::invslot::slotWrist1, EQEmu::invslot::slotWrist2, EQEmu::invslot::slotHands, EQEmu::invslot::slotLegs, EQEmu::invslot::slotFeet ); auto results = QueryDatabase(query); if (!results.Success()) diff --git a/zone/client.cpp b/zone/client.cpp index 16157c807..bbe2c2512 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -33,7 +33,6 @@ extern volatile bool RunLoops; #include "../common/eqemu_logsys.h" #include "../common/features.h" -#include "../common/emu_legacy.h" #include "../common/spdat.h" #include "../common/guilds.h" #include "../common/rulesys.h" @@ -2108,7 +2107,7 @@ void Client::ReadBook(BookRequest_Struct *book) { const EQEmu::ItemInstance *inst = nullptr; - if (read_from_slot <= EQEmu::legacy::SLOT_PERSONAL_BAGS_END) + if (read_from_slot <= EQEmu::invbag::GENERAL_BAGS_END) { inst = m_inv[read_from_slot]; } @@ -3322,28 +3321,28 @@ void Client::LinkDead() uint8 Client::SlotConvert(uint8 slot,bool bracer){ uint8 slot2 = 0; // why are we returning MainCharm instead of INVALID_INDEX? (must be a pre-charm segment...) if(bracer) - return EQEmu::inventory::slotWrist2; + return EQEmu::invslot::slotWrist2; switch(slot) { case EQEmu::textures::armorHead: - slot2 = EQEmu::inventory::slotHead; + slot2 = EQEmu::invslot::slotHead; break; case EQEmu::textures::armorChest: - slot2 = EQEmu::inventory::slotChest; + slot2 = EQEmu::invslot::slotChest; break; case EQEmu::textures::armorArms: - slot2 = EQEmu::inventory::slotArms; + slot2 = EQEmu::invslot::slotArms; break; case EQEmu::textures::armorWrist: - slot2 = EQEmu::inventory::slotWrist1; + slot2 = EQEmu::invslot::slotWrist1; break; case EQEmu::textures::armorHands: - slot2 = EQEmu::inventory::slotHands; + slot2 = EQEmu::invslot::slotHands; break; case EQEmu::textures::armorLegs: - slot2 = EQEmu::inventory::slotLegs; + slot2 = EQEmu::invslot::slotLegs; break; case EQEmu::textures::armorFeet: - slot2 = EQEmu::inventory::slotFeet; + slot2 = EQEmu::invslot::slotFeet; break; } return slot2; @@ -3352,25 +3351,25 @@ uint8 Client::SlotConvert(uint8 slot,bool bracer){ uint8 Client::SlotConvert2(uint8 slot){ uint8 slot2 = 0; // same as above... switch(slot){ - case EQEmu::inventory::slotHead: + case EQEmu::invslot::slotHead: slot2 = EQEmu::textures::armorHead; break; - case EQEmu::inventory::slotChest: + case EQEmu::invslot::slotChest: slot2 = EQEmu::textures::armorChest; break; - case EQEmu::inventory::slotArms: + case EQEmu::invslot::slotArms: slot2 = EQEmu::textures::armorArms; break; - case EQEmu::inventory::slotWrist1: + case EQEmu::invslot::slotWrist1: slot2 = EQEmu::textures::armorWrist; break; - case EQEmu::inventory::slotHands: + case EQEmu::invslot::slotHands: slot2 = EQEmu::textures::armorHands; break; - case EQEmu::inventory::slotLegs: + case EQEmu::invslot::slotLegs: slot2 = EQEmu::textures::armorLegs; break; - case EQEmu::inventory::slotFeet: + case EQEmu::invslot::slotFeet: slot2 = EQEmu::textures::armorFeet; break; } @@ -4425,14 +4424,14 @@ bool Client::GroupFollow(Client* inviter) { uint16 Client::GetPrimarySkillValue() { EQEmu::skills::SkillType skill = EQEmu::skills::HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill - bool equiped = m_inv.GetItem(EQEmu::inventory::slotPrimary); + bool equiped = m_inv.GetItem(EQEmu::invslot::slotPrimary); if (!equiped) skill = EQEmu::skills::SkillHandtoHand; else { - uint8 type = m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(EQEmu::invslot::slotPrimary)->GetItem()->ItemType; //is this the best way to do this? switch (type) { case EQEmu::item::ItemType1HSlash: // 1H Slashing @@ -5596,7 +5595,7 @@ bool Client::TryReward(uint32 claim_id) // save uint32 free_slot = 0xFFFFFFFF; - for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; ++i) { + for (int i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; ++i) { EQEmu::ItemInstance *item = GetInv().GetItem(i); if (!item) { free_slot = i; @@ -5956,30 +5955,30 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { } } - inst = requestee->GetInv().GetItem(EQEmu::inventory::slotPowerSource); + inst = requestee->GetInv().GetItem(EQEmu::invslot::SLOT_POWER_SOURCE); if(inst) { item = inst->GetItem(); if(item) { // we shouldn't do this..but, that's the way it's coded atm... // (this type of action should be handled exclusively in the client translator) - strcpy(insr->itemnames[SoF::invslot::PossessionsPowerSource], item->Name); - insr->itemicons[SoF::invslot::PossessionsPowerSource] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::slotPowerSource], item->Name); + insr->itemicons[SoF::invslot::slotPowerSource] = item->Icon; } else - insr->itemicons[SoF::invslot::PossessionsPowerSource] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::slotPowerSource] = 0xFFFFFFFF; } - inst = requestee->GetInv().GetItem(EQEmu::inventory::slotAmmo); + inst = requestee->GetInv().GetItem(EQEmu::invslot::slotAmmo); if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[SoF::invslot::PossessionsAmmo], item->Name); - insr->itemicons[SoF::invslot::PossessionsAmmo] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::slotAmmo], item->Name); + insr->itemicons[SoF::invslot::slotAmmo] = item->Icon; } else - insr->itemicons[SoF::invslot::PossessionsAmmo] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::slotAmmo] = 0xFFFFFFFF; } strcpy(insr->text, requestee->GetInspectMessage().text); @@ -7035,7 +7034,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) } EQEmu::skills::SkillType skill = EQEmu::skills::SkillHandtoHand; - auto *inst = GetInv().GetItem(EQEmu::inventory::slotPrimary); + auto *inst = GetInv().GetItem(EQEmu::invslot::slotPrimary); if (inst && inst->IsClassCommon()) { switch (inst->GetItem()->ItemType) { case EQEmu::item::ItemType1HSlash: @@ -7908,7 +7907,7 @@ void Client::GarbleMessage(char *message, uint8 variance) for (size_t i = 0; i < strlen(message); i++) { // Client expects hex values inside of a text link body if (message[i] == delimiter) { - if (!(delimiter_count & 1)) { i += EQEmu::constants::SayLinkBodySize; } + if (!(delimiter_count & 1)) { i += EQEmu::constants::SAY_LINK_BODY_SIZE; } ++delimiter_count; continue; } @@ -8333,17 +8332,17 @@ void Client::TickItemCheck() if(zone->tick_items.empty()) { return; } //Scan equip slots for items - for (i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; i++) + for (i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++) { TryItemTick(i); } //Scan main inventory + cursor - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) + for (i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::slotCursor; i++) { TryItemTick(i); } //Scan bags - for (i = EQEmu::legacy::GENERAL_BAGS_BEGIN; i <= EQEmu::legacy::CURSOR_BAG_END; i++) + for (i = EQEmu::invbag::GENERAL_BAGS_BEGIN; i <= EQEmu::invbag::CURSOR_BAG_END; i++) { TryItemTick(i); } @@ -8359,7 +8358,7 @@ void Client::TryItemTick(int slot) if(zone->tick_items.count(iid) > 0) { - if (GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EQEmu::legacy::EQUIPMENT_END)) + if (GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EQEmu::invslot::EQUIPMENT_END)) { EQEmu::ItemInstance* e_inst = (EQEmu::ItemInstance*)inst; parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot); @@ -8367,9 +8366,9 @@ void Client::TryItemTick(int slot) } //Only look at augs in main inventory - if (slot > EQEmu::legacy::EQUIPMENT_END) { return; } + if (slot > EQEmu::invslot::EQUIPMENT_END) { return; } - for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) + for (int x = EQEmu::invaug::SOCKET_BEGIN; x <= EQEmu::invaug::SOCKET_END; ++x) { EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) { continue; } @@ -8390,17 +8389,17 @@ void Client::TryItemTick(int slot) void Client::ItemTimerCheck() { int i; - for (i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; i++) + for (i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++) { TryItemTimer(i); } - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) + for (i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::slotCursor; i++) { TryItemTimer(i); } - for (i = EQEmu::legacy::GENERAL_BAGS_BEGIN; i <= EQEmu::legacy::CURSOR_BAG_END; i++) + for (i = EQEmu::invbag::GENERAL_BAGS_BEGIN; i <= EQEmu::invbag::CURSOR_BAG_END; i++) { TryItemTimer(i); } @@ -8422,11 +8421,11 @@ void Client::TryItemTimer(int slot) ++it_iter; } - if (slot > EQEmu::legacy::EQUIPMENT_END) { + if (slot > EQEmu::invslot::EQUIPMENT_END) { return; } - for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) + for (int x = EQEmu::invaug::SOCKET_BEGIN; x <= EQEmu::invaug::SOCKET_END; ++x) { EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) { @@ -8715,12 +8714,12 @@ void Client::ShowNumHits() int Client::GetQuiverHaste(int delay) { const EQEmu::ItemInstance *pi = nullptr; - for (int r = EQEmu::legacy::GENERAL_BEGIN; r <= EQEmu::legacy::GENERAL_END; r++) { + for (int r = EQEmu::invslot::GENERAL_BEGIN; r <= EQEmu::invslot::GENERAL_END; r++) { pi = GetInv().GetItem(r); if (pi && pi->IsClassBag() && pi->GetItem()->BagType == EQEmu::item::BagTypeQuiver && pi->GetItem()->BagWR > 0) break; - if (r == EQEmu::legacy::GENERAL_END) + if (r == EQEmu::invslot::GENERAL_END) // we will get here if we don't find a valid quiver return 0; } @@ -8760,7 +8759,7 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, AddMoneyToPP(copper, silver, gold, platinum, false); if (itemid > 0) - SummonItem(itemid, 0, 0, 0, 0, 0, 0, false, EQEmu::inventory::slotPowerSource); + SummonItem(itemid, 0, 0, 0, 0, 0, 0, false, EQEmu::invslot::slotCursor); if (faction) { diff --git a/zone/client.h b/zone/client.h index b216a0e38..ac998fb4c 100644 --- a/zone/client.h +++ b/zone/client.h @@ -249,7 +249,7 @@ public: //abstract virtual function implementations required by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None); - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } @@ -871,7 +871,7 @@ public: void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); void PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, ServerLootItem_Struct** bag_item_data = 0); bool AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::inventory::slotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::invslot::slotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id, bool recurse = true); diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 696214113..f342fff9f 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -552,7 +552,7 @@ int32 Client::GetRawItemAC() { int32 Total = 0; // 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++) { + for (int16 slot_id = EQEmu::invslot::BONUS_BEGIN; slot_id <= EQEmu::invslot::BONUS_STAT_END; slot_id++) { const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (inst && inst->IsClassCommon()) { Total += inst->GetItem()->AC; @@ -1319,7 +1319,7 @@ uint32 Client::CalcCurrentWeight() EQEmu::ItemInstance* ins = nullptr; uint32 Total = 0; int x; - for (x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::inventory::slotCursor; x++) { // include cursor or not? + for (x = EQEmu::invslot::POSSESSIONS_BEGIN; x <= EQEmu::invslot::POSSESSIONS_END; x++) { TempItem = 0; ins = GetInv().GetItem(x); if (ins) { @@ -1329,7 +1329,7 @@ uint32 Client::CalcCurrentWeight() Total += TempItem->Weight; } } - for (x = EQEmu::legacy::GENERAL_BAGS_BEGIN; x <= EQEmu::legacy::GENERAL_BAGS_END; x++) { // include cursor bags or not? + for (x = EQEmu::invbag::GENERAL_BAGS_BEGIN; x <= EQEmu::invbag::CURSOR_BAG_END; x++) { int TmpWeight = 0; TempItem = 0; ins = GetInv().GetItem(x); @@ -1342,9 +1342,9 @@ uint32 Client::CalcCurrentWeight() if (TmpWeight > 0) { // this code indicates that weight redux bags can only be in the first general inventory slot to be effective... // is this correct? or can we scan for the highest weight redux and use that? (need client verifications) - int bagslot = EQEmu::inventory::slotGeneral1; + int bagslot = EQEmu::invslot::slotGeneral1; int reduction = 0; - for (int m = EQEmu::legacy::GENERAL_BAGS_BEGIN + 10; m <= EQEmu::legacy::GENERAL_BAGS_END; m += 10) { // include cursor bags or not? + for (int m = EQEmu::invbag::GENERAL_BAGS_BEGIN + EQEmu::invbag::SLOT_COUNT; m <= EQEmu::invbag::CURSOR_BAG_END; m += EQEmu::invbag::SLOT_COUNT) { if (x >= m) { bagslot += 1; } @@ -2293,12 +2293,12 @@ int Client::GetRawACNoShield(int &shield_ac) const { int ac = itembonuses.AC + spellbonuses.AC + aabonuses.AC; shield_ac = 0; - const EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::inventory::slotSecondary); + const EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::invslot::slotSecondary); if (inst) { if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; shield_ac = inst->GetItem()->AC; - for (uint8 i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (uint8 i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { if (inst->GetAugment(i)) { ac -= inst->GetAugment(i)->GetItem()->AC; shield_ac += inst->GetAugment(i)->GetItem()->AC; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e318fe274..558bdca86 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1731,7 +1731,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (iter == m_inv.cursor_cbegin()) continue; const EQEmu::ItemInstance *inst = *iter; - SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketLimbo); } } @@ -2069,7 +2069,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) EQEmu::ItemInstance *inst = database.CreateItem(item, charges); if (!AutoPutLootInInventory(*inst, true, true)) { - PutLootInInventory(EQEmu::inventory::slotCursor, *inst); + PutLootInInventory(EQEmu::invslot::slotCursor, *inst); } Save(1); } @@ -2603,7 +2603,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) EQEmu::ItemInstance *inst = database.CreateItem(item, charges); if (!AutoPutLootInInventory(*inst, true, true)) { - PutLootInInventory(EQEmu::inventory::slotCursor, *inst); + PutLootInInventory(EQEmu::invslot::slotCursor, *inst); } Save(1); @@ -2653,7 +2653,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) SetAlternateCurrencyValue(reclaim->currency_id, 0); } else { - SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, 0, false, EQEmu::inventory::slotCursor); + SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, 0, false, EQEmu::invslot::slotCursor); AddAlternateCurrencyValue(reclaim->currency_id, -((int32)reclaim->count)); } /* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */ @@ -2866,8 +2866,8 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) uint32 ApplyPoisonSuccessResult = 0; ApplyPoison_Struct* ApplyPoisonData = (ApplyPoison_Struct*)app->pBuffer; - const EQEmu::ItemInstance* PrimaryWeapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); - const EQEmu::ItemInstance* SecondaryWeapon = GetInv().GetItem(EQEmu::inventory::slotSecondary); + const EQEmu::ItemInstance* PrimaryWeapon = GetInv().GetItem(EQEmu::invslot::slotPrimary); + const EQEmu::ItemInstance* SecondaryWeapon = GetInv().GetItem(EQEmu::invslot::slotSecondary); const EQEmu::ItemInstance* PoisonItemInstance = GetInv()[ApplyPoisonData->inventorySlot]; const EQEmu::ItemData* poison=PoisonItemInstance->GetItem(); const EQEmu::ItemData* primary=nullptr; @@ -3001,14 +3001,14 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) bool deleteItems = false; if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) { - if ((in_augment->container_slot < 0 || in_augment->container_slot >= EQEmu::legacy::SLOT_CURSOR) && - in_augment->container_slot != EQEmu::legacy::SLOT_POWER_SOURCE && - (in_augment->container_slot < EQEmu::legacy::SLOT_PERSONAL_BAGS_BEGIN || in_augment->container_slot > EQEmu::legacy::SLOT_PERSONAL_BAGS_END)) + if ((in_augment->container_slot < 0 || in_augment->container_slot >= EQEmu::invslot::slotCursor) && + in_augment->container_slot != EQEmu::invslot::SLOT_POWER_SOURCE && + (in_augment->container_slot < EQEmu::invbag::GENERAL_BAGS_BEGIN || in_augment->container_slot > EQEmu::invbag::GENERAL_BAGS_END)) { Message(13, "The server does not allow augmentation actions from this slot."); - auto cursor_item = m_inv[EQEmu::legacy::SLOT_CURSOR]; + auto cursor_item = m_inv[EQEmu::invslot::slotCursor]; auto augmented_item = m_inv[in_augment->container_slot]; - SendItemPacket(EQEmu::legacy::SLOT_CURSOR, cursor_item, ItemPacketCharInventory); + SendItemPacket(EQEmu::invslot::slotCursor, cursor_item, ItemPacketCharInventory); // this may crash clients on certain slots SendItemPacket(in_augment->container_slot, augmented_item, ItemPacketCharInventory); return; @@ -3083,7 +3083,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { case 0: // Adding an augment case 2: // Swapping augment - new_aug = user_inv.GetItem(EQEmu::inventory::slotCursor); + new_aug = user_inv.GetItem(EQEmu::invslot::slotCursor); if (!new_aug) // Shouldn't get the OP code without the augment on the user's cursor, but maybe it's h4x. { @@ -3141,7 +3141,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (itemOneToPush) { DeleteItemInInventory(item_slot, 0, true); - DeleteItemInInventory(EQEmu::inventory::slotCursor, new_aug->IsStackable() ? 1 : 0, true); + DeleteItemInInventory(EQEmu::invslot::slotCursor, new_aug->IsStackable() ? 1 : 0, true); if (solvent) { @@ -3152,7 +3152,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (itemTwoToPush) { // This is a swap. Return the old aug to the player's cursor. - if (!PutItemInInventory(EQEmu::inventory::slotCursor, *itemTwoToPush, true)) + if (!PutItemInInventory(EQEmu::invslot::slotCursor, *itemTwoToPush, true)) { Log(Logs::General, Logs::Error, "Problem returning old augment to player's cursor after augmentation swap."); Message(15, "Error: Failed to retrieve old augment after augmentation swap!"); @@ -3237,7 +3237,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) } // Drop the removed augment on the player's cursor - if (!PutItemInInventory(EQEmu::inventory::slotCursor, *itemTwoToPush, true)) + if (!PutItemInInventory(EQEmu::invslot::slotCursor, *itemTwoToPush, true)) { Log(Logs::General, Logs::Error, "Problem returning augment to player's cursor after safe removal."); Message(15, "Error: Failed to return augment after removal from item!"); @@ -4175,7 +4175,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) } else { - Message(0, "Error: castspell->inventoryslot >= %i (0x%04x)", EQEmu::inventory::slotCursor, castspell->inventoryslot); + Message(0, "Error: castspell->inventoryslot >= %i (0x%04x)", EQEmu::invslot::slotCursor, castspell->inventoryslot); InterruptSpell(castspell->spell_id); } } @@ -5123,7 +5123,7 @@ void Client::Handle_OP_CreateObject(const EQApplicationPacket *app) if (LogSys.log_settings[Logs::Inventory].is_category_enabled) Log(Logs::Detail, Logs::Inventory, "Handle_OP_CreateObject() [psize: %u] %s", app->size, DumpPacketToString(app).c_str()); - DropItem(EQEmu::inventory::slotCursor); + DropItem(EQEmu::invslot::slotCursor); return; } @@ -7049,7 +7049,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) return; } - EQEmu::ItemInstance *CursorItemInst = GetInv().GetItem(EQEmu::inventory::slotCursor); + EQEmu::ItemInstance *CursorItemInst = GetInv().GetItem(EQEmu::invslot::slotCursor); bool Allowed = true; @@ -7097,7 +7097,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { GuildBankDepositAck(false, sentAction); - DeleteItemInInventory(EQEmu::inventory::slotCursor, 0, false); + DeleteItemInInventory(EQEmu::invslot::slotCursor, 0, false); } break; @@ -7118,7 +7118,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) case GuildBankWithdraw: { - if (GetInv()[EQEmu::inventory::slotCursor]) + if (GetInv()[EQEmu::invslot::slotCursor]) { Message_StringID(13, GUILD_BANK_EMPTY_HANDS); @@ -7164,7 +7164,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketLimbo); GuildBanks->DeleteItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity); } @@ -8147,7 +8147,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) const EQEmu::ItemData* item = nullptr; int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::inventory::slotWaist; L++) { + for (int16 L = EQEmu::invslot::EQUIPMENT_BEGIN; L <= EQEmu::invslot::slotWaist; L++) { const EQEmu::ItemInstance* inst = GetInv().GetItem(L); item = inst ? inst->GetItem() : nullptr; @@ -8167,15 +8167,15 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) else { insr->itemicons[L] = 0xFFFFFFFF; } } - const EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::inventory::slotAmmo); + const EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::invslot::slotAmmo); item = inst ? inst->GetItem() : nullptr; if (item) { // another one..I did these, didn't I!!? - strcpy(insr->itemnames[SoF::invslot::PossessionsAmmo], item->Name); - insr->itemicons[SoF::invslot::PossessionsAmmo] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::slotAmmo], item->Name); + insr->itemicons[SoF::invslot::slotAmmo] = item->Icon; } - else { insr->itemicons[SoF::invslot::PossessionsAmmo] = 0xFFFFFFFF; } + else { insr->itemicons[SoF::invslot::slotAmmo] = 0xFFFFFFFF; } InspectMessage_Struct* newmessage = (InspectMessage_Struct*)insr->text; InspectMessage_Struct& playermessage = this->GetInspectMessage(); @@ -8637,7 +8637,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) EQEmu::ItemInstance* clickaug = nullptr; EQEmu::ItemData* augitem = nullptr; - for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { + for (r = EQEmu::invaug::SOCKET_BEGIN; r <= EQEmu::invaug::SOCKET_END; r++) { const EQEmu::ItemInstance* aug_i = inst->GetAugment(r); if (!aug_i) continue; @@ -9817,7 +9817,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) MoveItem_Struct* mi = (MoveItem_Struct*)app->pBuffer; if (spellend_timer.Enabled() && casting_spell_id && !IsBardSong(casting_spell_id)) { - if (mi->from_slot != mi->to_slot && (mi->from_slot <= EQEmu::legacy::GENERAL_END || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) + if (mi->from_slot != mi->to_slot && (mi->from_slot <= EQEmu::invslot::GENERAL_END || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) { char *detect = nullptr; const EQEmu::ItemInstance *itm_from = GetInv().GetItem(mi->from_slot); @@ -9838,8 +9838,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) // Illegal bagslot usage checks. Currently, user only receives a message if this check is triggered. bool mi_hack = false; - if (mi->from_slot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && mi->from_slot <= EQEmu::legacy::CURSOR_BAG_END) { - if (mi->from_slot >= EQEmu::legacy::CURSOR_BAG_BEGIN) { mi_hack = true; } + if (mi->from_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && mi->from_slot <= EQEmu::invbag::CURSOR_BAG_END) { + if (mi->from_slot >= EQEmu::invbag::CURSOR_BAG_BEGIN) { mi_hack = true; } else { int16 from_parent = m_inv.CalcSlotId(mi->from_slot); if (!m_inv[from_parent]) { mi_hack = true; } @@ -9848,8 +9848,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } } - if (mi->to_slot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && mi->to_slot <= EQEmu::legacy::CURSOR_BAG_END) { - if (mi->to_slot >= EQEmu::legacy::CURSOR_BAG_BEGIN) { mi_hack = true; } + if (mi->to_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && mi->to_slot <= EQEmu::invbag::CURSOR_BAG_END) { + if (mi->to_slot >= EQEmu::invbag::CURSOR_BAG_BEGIN) { mi_hack = true; } else { int16 to_parent = m_inv.CalcSlotId(mi->to_slot); if (!m_inv[to_parent]) { mi_hack = true; } @@ -12475,7 +12475,7 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app) Shielding_Struct* shield = (Shielding_Struct*)app->pBuffer; shield_target = entity_list.GetMob(shield->target_id); bool ack = false; - EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::inventory::slotSecondary); + EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::invslot::slotSecondary); if (!shield_target) return; if (inst) @@ -12687,8 +12687,8 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) // shouldn't we be reimbursing if these two fail? //make sure we are not completely full... - if (freeslotid == EQEmu::inventory::slotCursor) { - if (m_inv.GetItem(EQEmu::inventory::slotCursor) != nullptr) { + if (freeslotid == EQEmu::invslot::slotCursor) { + if (m_inv.GetItem(EQEmu::invslot::slotCursor) != nullptr) { Message(13, "You do not have room for any more items."); safe_delete(outapp); safe_delete(inst); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index f8e077e74..ce5e6d5c9 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -310,7 +310,7 @@ bool Client::Process() { } if (AutoFireEnabled()) { - EQEmu::ItemInstance *ranged = GetInv().GetItem(EQEmu::inventory::slotRange); + EQEmu::ItemInstance *ranged = GetInv().GetItem(EQEmu::invslot::slotRange); if (ranged) { if (ranged->GetItem() && ranged->GetItem()->ItemType == EQEmu::item::ItemTypeBow) { @@ -405,11 +405,11 @@ bool Client::Process() { } else if (auto_attack_target->GetHP() > -10) // -10 so we can watch people bleed in PvP { - EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::inventory::slotPrimary); - TryWeaponProc(wpn, auto_attack_target, EQEmu::inventory::slotPrimary); - TriggerDefensiveProcs(auto_attack_target, EQEmu::inventory::slotPrimary, false); + EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::invslot::slotPrimary); + TryWeaponProc(wpn, auto_attack_target, EQEmu::invslot::slotPrimary); + TriggerDefensiveProcs(auto_attack_target, EQEmu::invslot::slotPrimary, false); - DoAttackRounds(auto_attack_target, EQEmu::inventory::slotPrimary); + DoAttackRounds(auto_attack_target, EQEmu::invslot::slotPrimary); if (CheckAATimer(aaTimerRampage)) entity_list.AEAttack(this, 30); } @@ -445,10 +445,10 @@ bool Client::Process() { else if (auto_attack_target->GetHP() > -10) { CheckIncreaseSkill(EQEmu::skills::SkillDualWield, auto_attack_target, -10); if (CheckDualWield()) { - EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::inventory::slotSecondary); - TryWeaponProc(wpn, auto_attack_target, EQEmu::inventory::slotSecondary); + EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::invslot::slotSecondary); + TryWeaponProc(wpn, auto_attack_target, EQEmu::invslot::slotSecondary); - DoAttackRounds(auto_attack_target, EQEmu::inventory::slotSecondary); + DoAttackRounds(auto_attack_target, EQEmu::invslot::slotSecondary); } } } @@ -776,7 +776,7 @@ void Client::BulkSendInventoryItems() { // LINKDEAD TRADE ITEMS // Move trade slot items back into normal inventory..need them there now for the proceeding validity checks - for (int16 slot_id = EQEmu::legacy::TRADE_BEGIN; slot_id <= EQEmu::legacy::TRADE_END; slot_id++) { + for (int16 slot_id = EQEmu::invslot::TRADE_BEGIN; slot_id <= EQEmu::invslot::TRADE_END; slot_id++) { EQEmu::ItemInstance* inst = m_inv.PopItem(slot_id); if(inst) { bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; @@ -802,7 +802,7 @@ void Client::BulkSendInventoryItems() EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); // Possessions items - for (int16 slot_id = EQEmu::inventory::slotBegin; slot_id < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; slot_id++) { + for (int16 slot_id = EQEmu::invslot::POSSESSIONS_BEGIN; slot_id <= EQEmu::invslot::POSSESSIONS_END; slot_id++) { const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -817,19 +817,19 @@ void Client::BulkSendInventoryItems() // PowerSource item if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const EQEmu::ItemInstance* inst = m_inv[EQEmu::inventory::slotPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]; if (inst) { - inst->Serialize(ob, EQEmu::inventory::slotPowerSource); + inst->Serialize(ob, EQEmu::invslot::SLOT_POWER_SOURCE); if (ob.tellp() == last_pos) - Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", EQEmu::inventory::slotPowerSource); + Log(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", EQEmu::invslot::SLOT_POWER_SOURCE); last_pos = ob.tellp(); } } // Bank items - for (int16 slot_id = EQEmu::legacy::BANK_BEGIN; slot_id <= EQEmu::legacy::BANK_END; slot_id++) { + for (int16 slot_id = EQEmu::invslot::BANK_BEGIN; slot_id <= EQEmu::invslot::BANK_END; slot_id++) { const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -843,7 +843,7 @@ void Client::BulkSendInventoryItems() } // SharedBank items - for (int16 slot_id = EQEmu::legacy::SHARED_BANK_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_END; slot_id++) { + for (int16 slot_id = EQEmu::invslot::SHARED_BANK_BEGIN; slot_id <= EQEmu::invslot::SHARED_BANK_END; slot_id++) { const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -1133,7 +1133,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) switch(memspell->scribing) { case memSpellScribing: { // scribing spell to book - const EQEmu::ItemInstance* inst = m_inv[EQEmu::inventory::slotCursor]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::invslot::slotCursor]; if (inst && inst->IsClassCommon()) { @@ -1147,7 +1147,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) if(item && item->Scroll.Effect == (int32)(memspell->spell_id)) { ScribeSpell(memspell->spell_id, memspell->slot); - DeleteItemInInventory(EQEmu::inventory::slotCursor, 1, true); + DeleteItemInInventory(EQEmu::invslot::slotCursor, 1, true); } else Message(0,"Scribing spell: inst exists but item does not or spell ids do not match."); diff --git a/zone/command.cpp b/zone/command.cpp index 62a83c866..4bae60820 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2537,15 +2537,15 @@ void command_peekinv(Client *c, const Seperator *sep) static char* scope_prefix[] = { "Equip", "Gen", "Cursor", "Limbo", "Trib", "Bank", "ShBank", "Trade", "World" }; static int16 scope_range[][2] = { - { EQEmu::legacy::EQUIPMENT_BEGIN, EQEmu::legacy::EQUIPMENT_END }, - { EQEmu::legacy::GENERAL_BEGIN, EQEmu::legacy::GENERAL_END }, - { EQEmu::legacy::SLOT_CURSOR, EQEmu::legacy::SLOT_CURSOR }, - { EQEmu::legacy::SLOT_INVALID, EQEmu::legacy::SLOT_INVALID }, - { EQEmu::legacy::TRIBUTE_BEGIN, EQEmu::legacy::TRIBUTE_END }, - { EQEmu::legacy::BANK_BEGIN, EQEmu::legacy::BANK_END }, - { EQEmu::legacy::SHARED_BANK_BEGIN, EQEmu::legacy::SHARED_BANK_END }, - { EQEmu::legacy::TRADE_BEGIN, EQEmu::legacy::TRADE_END }, - { EQEmu::inventory::slotBegin, (EQEmu::legacy::WORLD_SIZE - 1) } + { EQEmu::invslot::EQUIPMENT_BEGIN, EQEmu::invslot::EQUIPMENT_END }, + { EQEmu::invslot::GENERAL_BEGIN, EQEmu::invslot::GENERAL_END }, + { EQEmu::invslot::slotCursor, EQEmu::invslot::slotCursor }, + { EQEmu::invslot::SLOT_INVALID, EQEmu::invslot::SLOT_INVALID }, + { EQEmu::invslot::TRIBUTE_BEGIN, EQEmu::invslot::TRIBUTE_END }, + { EQEmu::invslot::BANK_BEGIN, EQEmu::invslot::BANK_END }, + { EQEmu::invslot::SHARED_BANK_BEGIN, EQEmu::invslot::SHARED_BANK_END }, + { EQEmu::invslot::TRADE_BEGIN, EQEmu::invslot::TRADE_END }, + { EQEmu::invslot::SLOT_BEGIN, (EQEmu::invtype::WORLD_SIZE - 1) } }; static bool scope_bag[] = { false, true, true, true, false, true, true, true, true }; @@ -2614,7 +2614,7 @@ void command_peekinv(Client *c, const Seperator *sep) } for (int16 indexMain = scope_range[scopeIndex][0]; indexMain <= scope_range[scopeIndex][1]; ++indexMain) { - if (indexMain == EQEmu::legacy::SLOT_INVALID) + if (indexMain == EQEmu::invslot::SLOT_INVALID) continue; inst_main = ((scopeBit & peekWorld) ? objectTradeskill->GetItem(indexMain) : targetClient->GetInv().GetItem(indexMain)); @@ -2632,14 +2632,14 @@ void command_peekinv(Client *c, const Seperator *sep) (item_data == nullptr), "%sSlot: %i, Item: %i (%s), Charges: %i", scope_prefix[scopeIndex], - ((scopeBit & peekWorld) ? (EQEmu::legacy::WORLD_BEGIN + indexMain) : indexMain), + ((scopeBit & peekWorld) ? (EQEmu::invslot::WORLD_BEGIN + indexMain) : indexMain), ((item_data == nullptr) ? 0 : item_data->ID), linker.GenerateLink().c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges()) ); if (inst_main && inst_main->IsClassCommon()) { - for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) { + for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) { inst_aug = inst_main->GetItem(indexAug); if (!inst_aug) // extant only continue; @@ -2652,7 +2652,7 @@ void command_peekinv(Client *c, const Seperator *sep) ".%sAugSlot: %i (Slot #%i, Aug idx #%i), Item: %i (%s), Charges: %i", scope_prefix[scopeIndex], INVALID_INDEX, - ((scopeBit & peekWorld) ? (EQEmu::legacy::WORLD_BEGIN + indexMain) : indexMain), + ((scopeBit & peekWorld) ? (EQEmu::invslot::WORLD_BEGIN + indexMain) : indexMain), indexAug, ((item_data == nullptr) ? 0 : item_data->ID), linker.GenerateLink().c_str(), @@ -2664,7 +2664,7 @@ void command_peekinv(Client *c, const Seperator *sep) if (!scope_bag[scopeIndex] || !(inst_main && inst_main->IsClassBag())) continue; - for (uint8 indexSub = EQEmu::inventory::containerBegin; indexSub < EQEmu::inventory::ContainerCount; ++indexSub) { + for (uint8 indexSub = EQEmu::invbag::SLOT_BEGIN; indexSub <= EQEmu::invbag::SLOT_END; ++indexSub) { inst_sub = inst_main->GetItem(indexSub); if (!inst_sub) // extant only continue; @@ -2677,7 +2677,7 @@ void command_peekinv(Client *c, const Seperator *sep) "..%sBagSlot: %i (Slot #%i, Bag idx #%i), Item: %i (%s), Charges: %i", scope_prefix[scopeIndex], ((scopeBit & peekWorld) ? INVALID_INDEX : EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub)), - ((scopeBit & peekWorld) ? (EQEmu::legacy::WORLD_BEGIN + indexMain) : indexMain), + ((scopeBit & peekWorld) ? (EQEmu::invslot::WORLD_BEGIN + indexMain) : indexMain), indexSub, ((item_data == nullptr) ? 0 : item_data->ID), linker.GenerateLink().c_str(), @@ -2685,7 +2685,7 @@ void command_peekinv(Client *c, const Seperator *sep) ); if (inst_sub->IsClassCommon()) { - for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) { + for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) { inst_aug = inst_sub->GetItem(indexAug); if (!inst_aug) // extant only continue; @@ -2711,7 +2711,7 @@ void command_peekinv(Client *c, const Seperator *sep) } if ((scopeBit & peekEquip) && (targetClient->ClientVersion() >= EQEmu::versions::ClientVersion::SoF)) { - inst_main = targetClient->GetInv().GetItem(EQEmu::inventory::slotPowerSource); + inst_main = targetClient->GetInv().GetItem(EQEmu::invslot::SLOT_POWER_SOURCE); if (inst_main) { itemsFound = true; item_data = inst_main->GetItem(); @@ -2726,14 +2726,14 @@ void command_peekinv(Client *c, const Seperator *sep) (item_data == nullptr), "%sSlot: %i, Item: %i (%s), Charges: %i", scope_prefix[scopeIndex], - EQEmu::inventory::slotPowerSource, + EQEmu::invslot::SLOT_POWER_SOURCE, ((item_data == nullptr) ? 0 : item_data->ID), linker.GenerateLink().c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges()) ); if (inst_main && inst_main->IsClassCommon()) { - for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) { + for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) { inst_aug = inst_main->GetItem(indexAug); if (!inst_aug) // extant only continue; @@ -2746,7 +2746,7 @@ void command_peekinv(Client *c, const Seperator *sep) ".%sAugSlot: %i (Slot #%i, Aug idx #%i), Item: %i (%s), Charges: %i", scope_prefix[scopeIndex], INVALID_INDEX, - EQEmu::inventory::slotPowerSource, + EQEmu::invslot::SLOT_POWER_SOURCE, indexAug, ((item_data == nullptr) ? 0 : item_data->ID), linker.GenerateLink().c_str(), @@ -2784,7 +2784,7 @@ void command_peekinv(Client *c, const Seperator *sep) ); if (inst_main && inst_main->IsClassCommon()) { - for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) { + for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) { inst_aug = inst_main->GetItem(indexAug); if (!inst_aug) // extant only continue; @@ -2809,7 +2809,7 @@ void command_peekinv(Client *c, const Seperator *sep) if (!scope_bag[scopeIndex] || !(inst_main && inst_main->IsClassBag())) continue; - for (uint8 indexSub = EQEmu::inventory::containerBegin; indexSub < EQEmu::inventory::ContainerCount; ++indexSub) { + for (uint8 indexSub = EQEmu::invbag::SLOT_BEGIN; indexSub <= EQEmu::invbag::SLOT_END; ++indexSub) { inst_sub = inst_main->GetItem(indexSub); if (!inst_sub) continue; @@ -2831,7 +2831,7 @@ void command_peekinv(Client *c, const Seperator *sep) ); if (inst_sub->IsClassCommon()) { - for (uint8 indexAug = EQEmu::inventory::socketBegin; indexAug < EQEmu::inventory::SocketCount; ++indexAug) { + for (uint8 indexAug = EQEmu::invaug::SOCKET_BEGIN; indexAug <= EQEmu::invaug::SOCKET_END; ++indexAug) { inst_aug = inst_sub->GetItem(indexAug); if (!inst_aug) // extant only continue; @@ -3266,8 +3266,8 @@ void command_listpetition(Client *c, const Seperator *sep) void command_equipitem(Client *c, const Seperator *sep) { uint32 slot_id = atoi(sep->arg[1]); - if (sep->IsNumber(1) && ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource))) { - const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::inventory::slotCursor); + if (sep->IsNumber(1) && ((slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::invslot::EQUIPMENT_END) || (slot_id == EQEmu::invslot::SLOT_POWER_SOURCE))) { + const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::invslot::slotCursor); const EQEmu::ItemInstance* to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack) bool partialmove = false; int16 movecount; @@ -3275,7 +3275,7 @@ void command_equipitem(Client *c, const Seperator *sep) if (from_inst && from_inst->IsClassCommon()) { auto outapp = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mi = (MoveItem_Struct*)outapp->pBuffer; - mi->from_slot = EQEmu::inventory::slotCursor; + mi->from_slot = EQEmu::invslot::slotCursor; mi->to_slot = slot_id; // mi->number_in_stack = from_inst->GetCharges(); // replaced with con check for stacking @@ -4521,7 +4521,7 @@ void command_goto(Client *c, const Seperator *sep) void command_iteminfo(Client *c, const Seperator *sep) { - auto inst = c->GetInv()[EQEmu::inventory::slotCursor]; + auto inst = c->GetInv()[EQEmu::invslot::slotCursor]; if (!inst) { c->Message(13, "Error: You need an item on your cursor for this command"); return; @@ -5681,9 +5681,9 @@ void command_summonitem(Client *c, const Seperator *sep) std::string cmd_msg = sep->msg; size_t link_open = cmd_msg.find('\x12'); size_t link_close = cmd_msg.find_last_of('\x12'); - if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::constants::SayLinkBodySize) { + if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::constants::SAY_LINK_BODY_SIZE) { EQEmu::SayLinkBody_Struct link_body; - EQEmu::saylink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::constants::SayLinkBodySize)); + EQEmu::saylink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::constants::SAY_LINK_BODY_SIZE)); itemid = link_body.item_id; } else if (!sep->IsNumber(1)) { diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 63031ec45..586789f0f 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -322,12 +322,12 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( // to go into the regular slots on the player, out of bags std::list removed_list; - for (i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++i) { - if (i == EQEmu::inventory::slotAmmo && client->ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - item = client->GetInv().GetItem(EQEmu::inventory::slotPowerSource); + for (i = EQEmu::invslot::POSSESSIONS_BEGIN; i <= EQEmu::invslot::POSSESSIONS_END; ++i) { + if (i == EQEmu::invslot::slotAmmo && client->ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { + item = client->GetInv().GetItem(EQEmu::invslot::SLOT_POWER_SOURCE); if (item != nullptr) { if (!client->IsBecomeNPC() || (client->IsBecomeNPC() && !item->GetItem()->NoRent)) - MoveItemToCorpse(client, item, EQEmu::inventory::slotPowerSource, removed_list); + MoveItemToCorpse(client, item, EQEmu::invslot::SLOT_POWER_SOURCE, removed_list); } } @@ -404,9 +404,9 @@ void Corpse::MoveItemToCorpse(Client *client, EQEmu::ItemInstance *inst, int16 e while (true) { if (!inst->IsClassBag()) { break; } - if (equipSlot < EQEmu::legacy::GENERAL_BEGIN || equipSlot > EQEmu::inventory::slotCursor) { break; } + if (equipSlot < EQEmu::invslot::GENERAL_BEGIN || equipSlot > EQEmu::invslot::slotCursor) { break; } - for (int16 sub_index = EQEmu::inventory::containerBegin; sub_index < EQEmu::inventory::ContainerCount; ++sub_index) { + for (int16 sub_index = EQEmu::invbag::SLOT_BEGIN; sub_index <= EQEmu::invbag::SLOT_END; ++sub_index) { int16 real_bag_slot = EQEmu::InventoryProfile::CalcSlotId(equipSlot, sub_index); auto bag_inst = client->GetInv().GetItem(real_bag_slot); if (bag_inst == nullptr) { continue; } @@ -684,7 +684,7 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } if (sitem && bag_item_data && EQEmu::InventoryProfile::SupportsContainers(sitem->equip_slot)) { - int16 bagstart = EQEmu::InventoryProfile::CalcSlotId(sitem->equip_slot, EQEmu::inventory::containerBegin); + int16 bagstart = EQEmu::InventoryProfile::CalcSlotId(sitem->equip_slot, EQEmu::invbag::SLOT_BEGIN); cur = itemlist.begin(); end = itemlist.end(); @@ -983,7 +983,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(inst) { if (item->RecastDelay) inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0); - client->SendItemPacket(EQEmu::legacy::CORPSE_BEGIN, inst, ItemPacketLoot); + client->SendItemPacket(EQEmu::invslot::CORPSE_BEGIN, inst, ItemPacketLoot); safe_delete(inst); } else { client->Message(13, "Could not find item number %i to send!!", GetPlayerKillItem()); } @@ -998,7 +998,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(client->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; + int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(client->ClientVersion()))->InventoryTypeSize[EQEmu::invtype::typeCorpse]; for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; @@ -1007,7 +1007,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a // Dont display the item if it's in a bag // Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse. - if (!IsPlayerCorpse() || item_data->equip_slot <= EQEmu::inventory::slotCursor || item_data->equip_slot == EQEmu::inventory::slotPowerSource || Loot_Request_Type >= 3 || + if (!IsPlayerCorpse() || item_data->equip_slot <= EQEmu::invslot::slotCursor || item_data->equip_slot == EQEmu::invslot::SLOT_POWER_SOURCE || Loot_Request_Type >= 3 || (item_data->equip_slot >= 8000 && item_data->equip_slot <= 8999)) { if(i < corpselootlimit) { item = database.GetItem(item_data->item_id); @@ -1017,7 +1017,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if (item->RecastDelay) inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0); // SlotGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = SlotGeneral1 + SlotCursor - client->SendItemPacket(i + EQEmu::legacy::CORPSE_BEGIN, inst, ItemPacketLoot); + client->SendItemPacket(i + EQEmu::invslot::CORPSE_BEGIN, inst, ItemPacketLoot); safe_delete(inst); } @@ -1126,9 +1126,9 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app) } else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1) { item_data = GetItem(lootitem->slot_id - - EQEmu::legacy::CORPSE_BEGIN); // dont allow them to loot entire bags of items as pvp reward + EQEmu::invslot::CORPSE_BEGIN); // dont allow them to loot entire bags of items as pvp reward } else { - item_data = GetItem(lootitem->slot_id - EQEmu::legacy::CORPSE_BEGIN, bag_item_data); + item_data = GetItem(lootitem->slot_id - EQEmu::invslot::CORPSE_BEGIN, bag_item_data); } if (GetPlayerKillItem() <= 1 && item_data != 0) { @@ -1156,7 +1156,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app) } if (inst->IsAugmented()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { EQEmu::ItemInstance *itm = inst->GetAugment(i); if (itm) { if (client->CheckLoreConflict(itm->GetItem())) { @@ -1210,9 +1210,9 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app) /* First add it to the looter - this will do the bag contents too */ if (lootitem->auto_loot > 0) { if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data)) - client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data); + client->PutLootInInventory(EQEmu::invslot::slotCursor, *inst, bag_item_data); } else { - client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data); + client->PutLootInInventory(EQEmu::invslot::slotCursor, *inst, bag_item_data); } /* Update any tasks that have an activity to loot this item */ @@ -1231,7 +1231,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app) /* Remove Bag Contents */ if (item->IsClassBag() && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) { - for (int i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { + for (int i = EQEmu::invbag::SLOT_BEGIN; i <= EQEmu::invbag::SLOT_END; i++) { if (bag_item_data[i]) { /* Delete needs to be before RemoveItem because its deletes the pointer for * item_data/bag_item_data */ @@ -1317,13 +1317,13 @@ void Corpse::QueryLoot(Client* to) { cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(to->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; + int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(to->ClientVersion()))->InventoryTypeSize[EQEmu::invtype::typeCorpse]; for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; if (IsPlayerCorpse()) { - if (sitem->equip_slot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && sitem->equip_slot <= EQEmu::legacy::CURSOR_BAG_END) + if (sitem->equip_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && sitem->equip_slot <= EQEmu::invbag::CURSOR_BAG_END) sitem->lootslot = 0xFFFF; else x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; @@ -1457,8 +1457,8 @@ void Corpse::UpdateEquipmentLight() 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::inventory::slotPowerSource) { continue; } - if ((*iter)->equip_slot == EQEmu::inventory::slotAmmo) { continue; } + if (((*iter)->equip_slot < EQEmu::invslot::EQUIPMENT_BEGIN || (*iter)->equip_slot > EQEmu::invslot::EQUIPMENT_END) && (*iter)->equip_slot != EQEmu::invslot::SLOT_POWER_SOURCE) { continue; } + if ((*iter)->equip_slot == EQEmu::invslot::slotAmmo) { continue; } auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } @@ -1469,7 +1469,7 @@ void Corpse::UpdateEquipmentLight() uint8 general_light_type = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { - if ((*iter)->equip_slot < EQEmu::legacy::GENERAL_BEGIN || (*iter)->equip_slot > EQEmu::legacy::GENERAL_END) { continue; } + if ((*iter)->equip_slot < EQEmu::invslot::GENERAL_BEGIN || (*iter)->equip_slot > EQEmu::invslot::GENERAL_END) { continue; } auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } diff --git a/zone/corpse.h b/zone/corpse.h index e601f2aa3..84bce15fa 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -53,7 +53,7 @@ class Corpse : public Mob { /* Corpse: General */ virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None) { return; } - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } virtual Raid* GetRaid() { return 0; } diff --git a/zone/doors.cpp b/zone/doors.cpp index b4cff6679..9561757df 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -210,7 +210,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) { uint32 player_has_key = 0; uint32 player_key = 0; - const EQEmu::ItemInstance *lock_pick_item = sender->GetInv().GetItem(EQEmu::inventory::slotCursor); + const EQEmu::ItemInstance *lock_pick_item = sender->GetInv().GetItem(EQEmu::invslot::slotCursor); player_has_key = static_cast(sender->GetInv().HasItem(required_key_item, 1)); if (player_has_key != INVALID_INDEX) { diff --git a/zone/encounter.h b/zone/encounter.h index e0d8dbcb0..eeeba8e0f 100644 --- a/zone/encounter.h +++ b/zone/encounter.h @@ -36,7 +36,7 @@ public: //abstract virtual function implementations required by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None) { return; } - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } diff --git a/zone/entity.h b/zone/entity.h index c56cbbb05..ce3215ac5 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -357,7 +357,7 @@ public: void QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app); void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true); - void AEAttack(Mob *attacker, float dist, int Hand = EQEmu::inventory::slotPrimary, int count = 0, bool IsFromSpell = false); + void AEAttack(Mob *attacker, float dist, int Hand = EQEmu::invslot::slotPrimary, int count = 0, bool IsFromSpell = false); void AETaunt(Client *caster, float range=0, int32 bonus_hate=0); void AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true, int16 resist_adjust = 0, int *max_targets = nullptr); void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); diff --git a/zone/forage.cpp b/zone/forage.cpp index 7adb245ee..e5248cf01 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -153,7 +153,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, //we need this function to immediately determine, after we receive OP_Fishing, if we can even try to fish, otherwise we have to wait a while to get the failure bool Client::CanFish() { //make sure we still have a fishing pole on: - const EQEmu::ItemInstance* Pole = m_inv[EQEmu::inventory::slotPrimary]; + const EQEmu::ItemInstance* Pole = m_inv[EQEmu::invslot::slotPrimary]; int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); const EQEmu::ItemInstance* Bait = nullptr; if (bslot != INVALID_INDEX) @@ -258,7 +258,7 @@ void Client::GoFish() Bait = m_inv.GetItem(bslot); //if the bait isnt equipped, need to add its skill bonus - if (bslot >= EQEmu::legacy::GENERAL_BEGIN && Bait != nullptr && Bait->GetItem()->SkillModType == EQEmu::skills::SkillFishing) { + if (bslot >= EQEmu::invslot::GENERAL_BEGIN && Bait != nullptr && Bait->GetItem()->SkillModType == EQEmu::skills::SkillFishing) { fishing_skill += Bait->GetItem()->SkillModValue; } @@ -331,12 +331,12 @@ void Client::GoFish() else { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketLimbo); if(RuleB(TaskSystem, EnableTaskSystem)) UpdateTasksForItem(ActivityFish, food_id); safe_delete(inst); - inst = m_inv.GetItem(EQEmu::inventory::slotCursor); + inst = m_inv.GetItem(EQEmu::invslot::slotCursor); } if(inst) { @@ -368,7 +368,7 @@ void Client::GoFish() //and then swap out items in primary slot... too lazy to fix right now if (zone->random.Int(0, 49) == 1) { Message_StringID(MT_Skills, FISHING_POLE_BROKE); //Your fishing pole broke! - DeleteItemInInventory(EQEmu::inventory::slotPrimary, 0, true); + DeleteItemInInventory(EQEmu::invslot::slotPrimary, 0, true); } if (CheckIncreaseSkill(EQEmu::skills::SkillFishing, nullptr, 5)) @@ -445,12 +445,12 @@ void Client::ForageItem(bool guarantee) { } else { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketLimbo); if(RuleB(TaskSystem, EnableTaskSystem)) UpdateTasksForItem(ActivityForage, foragedfood); safe_delete(inst); - inst = m_inv.GetItem(EQEmu::inventory::slotCursor); + inst = m_inv.GetItem(EQEmu::invslot::slotCursor); } if(inst) { diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 17cfc1aa1..d375d94b6 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -35,7 +35,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { int i; if(where_to_check & invWhereWorn) { - for (i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; i++) { + for (i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -48,8 +48,8 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - if (GetItemIDAt(EQEmu::inventory::slotPowerSource) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::inventory::slotPowerSource) != INVALID_ID)) { - cur = m_inv.GetItem(EQEmu::inventory::slotPowerSource); + if (GetItemIDAt(EQEmu::invslot::SLOT_POWER_SOURCE) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::invslot::SLOT_POWER_SOURCE) != INVALID_ID)) { + cur = m_inv.GetItem(EQEmu::invslot::SLOT_POWER_SOURCE); if(cur && cur->GetItem()->Stackable) { x += cur->GetCharges(); } else { @@ -57,25 +57,25 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) - DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, true); + DeleteItemInInventory(EQEmu::invslot::SLOT_POWER_SOURCE, 0, true); else - DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, false); // Prevents Titanium crash + DeleteItemInInventory(EQEmu::invslot::SLOT_POWER_SOURCE, 0, false); // Prevents Titanium crash } } if(where_to_check & invWhereCursor) { - if (GetItemIDAt(EQEmu::inventory::slotCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::inventory::slotCursor) != INVALID_ID)) { - cur = m_inv.GetItem(EQEmu::inventory::slotCursor); + if (GetItemIDAt(EQEmu::invslot::slotCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::invslot::slotCursor) != INVALID_ID)) { + cur = m_inv.GetItem(EQEmu::invslot::slotCursor); if(cur && cur->GetItem()->Stackable) { x += cur->GetCharges(); } else { x++; } - DeleteItemInInventory(EQEmu::inventory::slotCursor, 0, true); + DeleteItemInInventory(EQEmu::invslot::slotCursor, 0, true); } - for (i = EQEmu::legacy::CURSOR_BAG_BEGIN; i <= EQEmu::legacy::CURSOR_BAG_END; i++) { + for (i = EQEmu::invbag::CURSOR_BAG_BEGIN; i <= EQEmu::invbag::CURSOR_BAG_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -90,7 +90,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if(where_to_check & invWherePersonal) { - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + for (i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -103,7 +103,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - for (i = EQEmu::legacy::GENERAL_BAGS_BEGIN; i <= EQEmu::legacy::GENERAL_BAGS_END; i++) { + for (i = EQEmu::invbag::GENERAL_BAGS_BEGIN; i <= EQEmu::invbag::GENERAL_BAGS_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -118,7 +118,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if(where_to_check & invWhereBank) { - for (i = EQEmu::legacy::BANK_BEGIN; i <= EQEmu::legacy::BANK_END; i++) { + for (i = EQEmu::invslot::BANK_BEGIN; i <= EQEmu::invslot::BANK_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -131,7 +131,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - for (i = EQEmu::legacy::BANK_BAGS_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END; i++) { + for (i = EQEmu::invbag::BANK_BAGS_BEGIN; i <= EQEmu::invbag::BANK_BAGS_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -146,7 +146,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if(where_to_check & invWhereSharedBank) { - for (i = EQEmu::legacy::SHARED_BANK_BEGIN; i <= EQEmu::legacy::SHARED_BANK_END; i++) { + for (i = EQEmu::invslot::SHARED_BANK_BEGIN; i <= EQEmu::invslot::SHARED_BANK_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -159,7 +159,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - for (i = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN; i <= EQEmu::legacy::SHARED_BANK_BAGS_END; i++) { + for (i = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN; i <= EQEmu::invbag::SHARED_BANK_BAGS_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -236,7 +236,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, } */ - uint32 augments[EQEmu::inventory::SocketCount] = { aug1, aug2, aug3, aug4, aug5, aug6 }; + uint32 augments[EQEmu::invaug::SOCKET_COUNT] = { aug1, aug2, aug3, aug4, aug5, aug6 }; uint32 classes = item->Classes; uint32 races = item->Races; @@ -246,7 +246,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, bool enforcerestr = RuleB(Inventory, EnforceAugmentRestriction); bool enforceusable = RuleB(Inventory, EnforceAugmentUsability); - for (int iter = EQEmu::inventory::socketBegin; iter < EQEmu::inventory::SocketCount; ++iter) { + for (int iter = EQEmu::invaug::SOCKET_BEGIN; iter <= EQEmu::invaug::SOCKET_END; ++iter) { const EQEmu::ItemData* augtest = database.GetItem(augments[iter]); if(augtest == nullptr) { @@ -540,7 +540,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, } // add any validated augments - for (int iter = EQEmu::inventory::socketBegin; iter < EQEmu::inventory::SocketCount; ++iter) { + for (int iter = EQEmu::invaug::SOCKET_BEGIN; iter <= EQEmu::invaug::SOCKET_END; ++iter) { if(augments[iter]) inst->PutAugment(&database, iter, augments[iter]); } @@ -554,22 +554,22 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, inst->SetOrnamentHeroModel(ornament_hero_model); // check to see if item is usable in requested slot - if (enforceusable && (((to_slot >= EQEmu::inventory::slotCharm) && (to_slot <= EQEmu::inventory::slotAmmo)) || (to_slot == EQEmu::inventory::slotPowerSource))) { - uint32 slottest = (to_slot == EQEmu::inventory::slotPowerSource) ? 22 : to_slot; // can't change '22' just yet... + if (enforceusable && (((to_slot >= EQEmu::invslot::slotCharm) && (to_slot <= EQEmu::invslot::slotAmmo)) || (to_slot == EQEmu::invslot::SLOT_POWER_SOURCE))) { + uint32 slottest = (to_slot == EQEmu::invslot::SLOT_POWER_SOURCE) ? 22 : to_slot; // can't change '22' just yet... if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); Log(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); - to_slot = EQEmu::inventory::slotCursor; + to_slot = EQEmu::invslot::slotCursor; } } // put item into inventory - if (to_slot == EQEmu::inventory::slotCursor) { + if (to_slot == EQEmu::invslot::slotCursor) { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketLimbo); } else { PutItemInInventory(to_slot, *inst, true); @@ -671,7 +671,7 @@ void Client::DropItem(int16 slot_id, bool recurse) } // Save client inventory change to database - if (slot_id == EQEmu::inventory::slotCursor) { + if (slot_id == EQEmu::invslot::slotCursor) { SendCursorBuffer(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(CharacterID(), s, e); @@ -762,11 +762,11 @@ void Client::SendCursorBuffer() GetName(), test_item->Name, test_item->ID); Message_StringID(MT_LootMessages, 290); parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0); - DeleteItemInInventory(EQEmu::inventory::slotCursor); + DeleteItemInInventory(EQEmu::invslot::slotCursor); SendCursorBuffer(); } else { - SendItemPacket(EQEmu::inventory::slotCursor, test_inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, test_inst, ItemPacketLimbo); } } @@ -819,7 +819,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd qsaudit->items[parent_offset].aug_5 = m_inv[slot_id]->GetAugmentItemID(5); if (m_inv[slot_id]->IsClassBag()) { - for (uint8 bag_idx = EQEmu::inventory::containerBegin; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) { + for (uint8 bag_idx = EQEmu::invbag::SLOT_BEGIN; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) { EQEmu::ItemInstance* bagitem = m_inv[slot_id]->GetItem(bag_idx); if(bagitem) { @@ -845,7 +845,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool isDeleted = m_inv.DeleteItem(slot_id, quantity); const EQEmu::ItemInstance* inst = nullptr; - if (slot_id == EQEmu::inventory::slotCursor) { + if (slot_id == EQEmu::invslot::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); if(update_db) database.SaveCursor(character_id, s, e); @@ -897,7 +897,7 @@ bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_updat m_inv.PushCursor(inst); if (client_update) { - SendItemPacket(EQEmu::inventory::slotCursor, &inst, ItemPacketLimbo); + SendItemPacket(EQEmu::invslot::slotCursor, &inst, ItemPacketLimbo); } auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); @@ -911,7 +911,7 @@ bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_updat bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, bool client_update) { Log(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); - if (slot_id == EQEmu::inventory::slotCursor) { // don't trust macros before conditional statements... + if (slot_id == EQEmu::invslot::slotCursor) { // don't trust macros before conditional statements... return PushItemOnCursor(inst, client_update); } else { @@ -920,11 +920,11 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, if (client_update) { - SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::inventory::slotCursor) ? ItemPacketLimbo : ItemPacketTrade)); + SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::invslot::slotCursor) ? ItemPacketLimbo : ItemPacketTrade)); //SendWearChange(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id)); } - if (slot_id == EQEmu::inventory::slotCursor) { + if (slot_id == EQEmu::invslot::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); return database.SaveCursor(this->CharacterID(), s, e); } @@ -942,7 +942,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, bool cursor_empty = m_inv.CursorEmpty(); - if (slot_id == EQEmu::inventory::slotCursor) { + if (slot_id == EQEmu::invslot::slotCursor) { m_inv.PushCursor(inst); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(this->CharacterID(), s, e); @@ -953,7 +953,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, } // Subordinate items in cursor buffer must be sent via ItemPacketSummonItem or we just overwrite the visible cursor and desync the client - if (slot_id == EQEmu::inventory::slotCursor && !cursor_empty) { + if (slot_id == EQEmu::invslot::slotCursor && !cursor_empty) { // RoF+ currently has a specialized cursor handler if (ClientVersion() < EQEmu::versions::ClientVersion::RoF) SendItemPacket(slot_id, &inst, ItemPacketLimbo); @@ -963,7 +963,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, } if (bag_item_data) { - for (int index = 0; index < EQEmu::inventory::ContainerCount; ++index) { + for (int index = 0; index < EQEmu::invbag::SLOT_COUNT; ++index) { if (bag_item_data[index] == nullptr) continue; @@ -981,12 +981,12 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, // Dump bag contents to cursor in the event that owning bag is not the first cursor item // (This assumes that the data passed is correctly associated..no safety checks are implemented) - if (slot_id == EQEmu::inventory::slotCursor && !cursor_empty) { + if (slot_id == EQEmu::invslot::slotCursor && !cursor_empty) { Log(Logs::Detail, Logs::Inventory, "Putting bag loot item %s (%d) into slot %d (non-empty cursor override)", - inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::inventory::slotCursor); + inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::invslot::slotCursor); - PutLootInInventory(EQEmu::inventory::slotCursor, *bagitem); + PutLootInInventory(EQEmu::invslot::slotCursor, *bagitem); } else { auto bag_slot = EQEmu::InventoryProfile::CalcSlotId(slot_id, index); @@ -1008,7 +1008,7 @@ bool Client::TryStacking(EQEmu::ItemInstance* item, uint8 type, bool try_worn, b return false; int16 i; uint32 item_id = item->GetItem()->ID; - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + for (i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(i); if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize){ MoveItemCharges(*item, i, type); @@ -1019,8 +1019,8 @@ bool Client::TryStacking(EQEmu::ItemInstance* item, uint8 type, bool try_worn, b return true; } } - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { + for (i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { + for (uint8 j = EQEmu::invbag::SLOT_BEGIN; j <= EQEmu::invbag::SLOT_END; j++) { uint16 slotid = EQEmu::InventoryProfile::CalcSlotId(i, j); EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(slotid); @@ -1045,28 +1045,28 @@ bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bo // #1: Try to auto equip 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::inventory::slotPowerSource; i++) { // originally (i < 22) - if (i == EQEmu::legacy::GENERAL_BEGIN) { + for (int16 i = EQEmu::invslot::EQUIPMENT_BEGIN; i < EQEmu::invslot::SLOT_POWER_SOURCE; i++) { // originally (i < 22) + if (i == EQEmu::invslot::GENERAL_BEGIN) { // added power source check for SoF+ clients if (this->ClientVersion() >= EQEmu::versions::ClientVersion::SoF) - i = EQEmu::inventory::slotPowerSource; + i = EQEmu::invslot::SLOT_POWER_SOURCE; else break; } if (!m_inv[i]) { - if (i == EQEmu::inventory::slotPrimary && inst.IsWeapon()) { // If item is primary slot weapon + if (i == EQEmu::invslot::slotPrimary && inst.IsWeapon()) { // If item is primary slot weapon if (inst.GetItem()->IsType2HWeapon()) { // and uses 2hs \ 2hb \ 2hp - if (m_inv[EQEmu::inventory::slotSecondary]) { // and if secondary slot is not empty + if (m_inv[EQEmu::invslot::slotSecondary]) { // and if secondary slot is not empty continue; // Can't auto-equip } } } - if (i == EQEmu::inventory::slotSecondary && m_inv[EQEmu::inventory::slotPrimary]) { // check to see if primary slot is a two hander - if (m_inv[EQEmu::inventory::slotPrimary]->GetItem()->IsType2HWeapon()) + if (i == EQEmu::invslot::slotSecondary && m_inv[EQEmu::invslot::slotPrimary]) { // check to see if primary slot is a two hander + if (m_inv[EQEmu::invslot::slotPrimary]->GetItem()->IsType2HWeapon()) continue; } - if (i == EQEmu::inventory::slotSecondary && inst.IsWeapon() && !CanThisClassDualWield()) { + if (i == EQEmu::invslot::slotSecondary && inst.IsWeapon() && !CanThisClassDualWield()) { continue; } @@ -1117,7 +1117,7 @@ void Client::MoveItemCharges(EQEmu::ItemInstance &from, int16 to_slot, uint8 typ tmp_inst->SetCharges(tmp_inst->GetCharges() + charges_to_move); from.SetCharges(from.GetCharges() - charges_to_move); SendLootItemInPacket(tmp_inst, to_slot); - if (to_slot == EQEmu::inventory::slotCursor) { + if (to_slot == EQEmu::invslot::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(this->CharacterID(), s, e); } @@ -1374,16 +1374,16 @@ void Client::SendLootItemInPacket(const EQEmu::ItemInstance* inst, int16 slot_id bool Client::IsValidSlot(uint32 slot) { if ((slot == (uint32)INVALID_INDEX) || - (slot >= EQEmu::inventory::slotBegin && slot < EQEmu::legacy::TYPE_POSSESSIONS_SIZE) || - (slot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot <= EQEmu::legacy::CURSOR_BAG_END) || - (slot >= EQEmu::legacy::TRIBUTE_BEGIN && slot <= EQEmu::legacy::TRIBUTE_END) || - (slot >= EQEmu::legacy::BANK_BEGIN && slot <= EQEmu::legacy::BANK_END) || - (slot >= EQEmu::legacy::BANK_BAGS_BEGIN && slot <= EQEmu::legacy::BANK_BAGS_END) || - (slot >= EQEmu::legacy::SHARED_BANK_BEGIN && slot <= EQEmu::legacy::SHARED_BANK_END) || - (slot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot <= EQEmu::legacy::SHARED_BANK_BAGS_END) || - (slot >= EQEmu::legacy::TRADE_BEGIN && slot <= EQEmu::legacy::TRADE_END) || - (slot >= EQEmu::legacy::WORLD_BEGIN && slot <= EQEmu::legacy::WORLD_END) || - (slot == EQEmu::inventory::slotPowerSource) + (slot >= EQEmu::invslot::POSSESSIONS_BEGIN && slot <= EQEmu::invslot::POSSESSIONS_END) || + (slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN && slot <= EQEmu::invbag::CURSOR_BAG_END) || + (slot >= EQEmu::invslot::TRIBUTE_BEGIN && slot <= EQEmu::invslot::TRIBUTE_END) || + (slot >= EQEmu::invslot::BANK_BEGIN && slot <= EQEmu::invslot::BANK_END) || + (slot >= EQEmu::invbag::BANK_BAGS_BEGIN && slot <= EQEmu::invbag::BANK_BAGS_END) || + (slot >= EQEmu::invslot::SHARED_BANK_BEGIN && slot <= EQEmu::invslot::SHARED_BANK_END) || + (slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && slot <= EQEmu::invbag::SHARED_BANK_BAGS_END) || + (slot >= EQEmu::invslot::TRADE_BEGIN && slot <= EQEmu::invslot::TRADE_END) || + (slot >= EQEmu::invslot::WORLD_BEGIN && slot <= EQEmu::invslot::WORLD_END) || + (slot == EQEmu::invslot::SLOT_POWER_SOURCE) ) { return true; } @@ -1394,10 +1394,10 @@ bool Client::IsValidSlot(uint32 slot) { bool Client::IsBankSlot(uint32 slot) { - if ((slot >= EQEmu::legacy::BANK_BEGIN && slot <= EQEmu::legacy::BANK_END) || - (slot >= EQEmu::legacy::BANK_BAGS_BEGIN && slot <= EQEmu::legacy::BANK_BAGS_END) || - (slot >= EQEmu::legacy::SHARED_BANK_BEGIN && slot <= EQEmu::legacy::SHARED_BANK_END) || - (slot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot <= EQEmu::legacy::SHARED_BANK_BAGS_END)) + if ((slot >= EQEmu::invslot::BANK_BEGIN && slot <= EQEmu::invslot::BANK_END) || + (slot >= EQEmu::invbag::BANK_BAGS_BEGIN && slot <= EQEmu::invbag::BANK_BAGS_END) || + (slot >= EQEmu::invslot::SHARED_BANK_BEGIN && slot <= EQEmu::invslot::SHARED_BANK_END) || + (slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN && slot <= EQEmu::invbag::SHARED_BANK_BAGS_END)) { return true; } @@ -1433,8 +1433,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) { return true; } // Can't do RoF+ - if (move_in->to_slot == EQEmu::inventory::slotCursor) { - auto test_inst = m_inv.GetItem(EQEmu::inventory::slotCursor); + if (move_in->to_slot == EQEmu::invslot::slotCursor) { + auto test_inst = m_inv.GetItem(EQEmu::invslot::slotCursor); if (test_inst == nullptr) { return true; } auto test_item = test_inst->GetItem(); if (test_item == nullptr) { return true; } @@ -1453,18 +1453,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { GetName(), test_item->Name, test_item->ID); Message_StringID(MT_LootMessages, 290); parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0); - DeleteItemInInventory(EQEmu::inventory::slotCursor, 0, true); + DeleteItemInInventory(EQEmu::invslot::slotCursor, 0, true); } } return true; } if (move_in->to_slot == (uint32)INVALID_INDEX) { - if (move_in->from_slot == (uint32)EQEmu::inventory::slotCursor) { + if (move_in->from_slot == (uint32)EQEmu::invslot::slotCursor) { Log(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit - EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::inventory::slotCursor); + EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::invslot::slotCursor); if(inst) { parse->EventItem(EVENT_DESTROY_ITEM, this, inst, nullptr, "", 0); } @@ -1481,9 +1481,9 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item deletion } } - if (auto_attack && (move_in->from_slot == EQEmu::inventory::slotPrimary || move_in->from_slot == EQEmu::inventory::slotSecondary || move_in->from_slot == EQEmu::inventory::slotRange)) + if (auto_attack && (move_in->from_slot == EQEmu::invslot::slotPrimary || move_in->from_slot == EQEmu::invslot::slotSecondary || move_in->from_slot == EQEmu::invslot::slotRange)) SetAttackTimer(); - else if (auto_attack && (move_in->to_slot == EQEmu::inventory::slotPrimary || move_in->to_slot == EQEmu::inventory::slotSecondary || move_in->to_slot == EQEmu::inventory::slotRange)) + else if (auto_attack && (move_in->to_slot == EQEmu::invslot::slotPrimary || move_in->to_slot == EQEmu::invslot::slotSecondary || move_in->to_slot == EQEmu::invslot::slotRange)) SetAttackTimer(); // Step 1: Variables int16 src_slot_id = (int16)move_in->from_slot; @@ -1531,13 +1531,13 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { uint32 dstbagid = 0; //if (src_slot_id >= 250 && src_slot_id < 330) { - if (src_slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && src_slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { + if (src_slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN && src_slot_id <= EQEmu::invbag::GENERAL_BAGS_END) { srcbag = m_inv.GetItem(((int)(src_slot_id / 10)) - 3); if (srcbag) srcbagid = srcbag->GetItem()->ID; } //if (dst_slot_id >= 250 && dst_slot_id < 330) { - if (dst_slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && dst_slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { + if (dst_slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN && dst_slot_id <= EQEmu::invbag::GENERAL_BAGS_END) { dstbag = m_inv.GetItem(((int)(dst_slot_id / 10)) - 3); if (dstbag) dstbagid = dstbag->GetItem()->ID; @@ -1550,7 +1550,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Step 2: Validate item in from_slot // After this, we can assume src_inst is a valid ptr - if (!src_inst && (src_slot_id < EQEmu::legacy::WORLD_BEGIN || src_slot_id > EQEmu::legacy::WORLD_END)) { + if (!src_inst && (src_slot_id < EQEmu::invslot::WORLD_BEGIN || src_slot_id > EQEmu::invslot::WORLD_END)) { if (dst_inst) { // If there is no source item, but there is a destination item, // move the slots around before deleting the invalid source slot item, @@ -1564,14 +1564,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return false; } //verify shared bank transactions in the database - if (src_inst && src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + if (src_inst && src_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { Log(Logs::General, Logs::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); 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->IsClassBag()){ - for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) { + if (src_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::invslot::SHARED_BANK_END && src_inst->IsClassBag()){ + for (uint8 idx = EQEmu::invbag::SLOT_BEGIN; idx <= EQEmu::invbag::SLOT_END; idx++) { const EQEmu::ItemInstance* baginst = src_inst->GetItem(idx); if (baginst && !database.VerifyInventory(account_id, EQEmu::InventoryProfile::CalcSlotId(src_slot_id, idx), baginst)){ DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(src_slot_id, idx), 0, false); @@ -1579,14 +1579,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } } - if (dst_inst && dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + if (dst_inst && dst_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { Log(Logs::General, Logs::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); 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->IsClassBag()){ - for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) { + if (dst_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::invslot::SHARED_BANK_END && dst_inst->IsClassBag()){ + for (uint8 idx = EQEmu::invbag::SLOT_BEGIN; idx <= EQEmu::invbag::SLOT_END; idx++) { const EQEmu::ItemInstance* baginst = dst_inst->GetItem(idx); if (baginst && !database.VerifyInventory(account_id, EQEmu::InventoryProfile::CalcSlotId(dst_slot_id, idx), baginst)){ DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(dst_slot_id, idx), 0, false); @@ -1598,8 +1598,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Check for No Drop Hacks Mob* with = trade->With(); - if (((with && with->IsClient() && dst_slot_id >= EQEmu::legacy::TRADE_BEGIN && dst_slot_id <= EQEmu::legacy::TRADE_END) || - (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END)) + if (((with && with->IsClient() && dst_slot_id >= EQEmu::invslot::TRADE_BEGIN && dst_slot_id <= EQEmu::invslot::TRADE_END) || + (dst_slot_id >= EQEmu::invslot::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END)) && GetInv().CheckNoDrop(src_slot_id) && RuleI(World, FVNoDropFlag) == 0 || RuleI(Character, MinStatusForNoDropExemptions) < Admin() && RuleI(World, FVNoDropFlag) == 2) { auto ndh_inst = m_inv[src_slot_id]; @@ -1629,7 +1629,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Step 3: Check for interaction with World Container (tradeskills) if(m_tradeskill_object != nullptr) { - if (src_slot_id >= EQEmu::legacy::WORLD_BEGIN && src_slot_id <= EQEmu::legacy::WORLD_END) { + if (src_slot_id >= EQEmu::invslot::WORLD_BEGIN && src_slot_id <= EQEmu::invslot::WORLD_END) { // Picking up item from world container EQEmu::ItemInstance* inst = m_tradeskill_object->PopItem(EQEmu::InventoryProfile::CalcBagIdx(src_slot_id)); if (inst) { @@ -1641,7 +1641,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; } - else if (dst_slot_id >= EQEmu::legacy::WORLD_BEGIN && dst_slot_id <= EQEmu::legacy::WORLD_END) { + else if (dst_slot_id >= EQEmu::invslot::WORLD_BEGIN && dst_slot_id <= EQEmu::invslot::WORLD_END) { // Putting item into world container, which may swap (or pile onto) with existing item uint8 world_idx = EQEmu::InventoryProfile::CalcBagIdx(dst_slot_id); EQEmu::ItemInstance* world_inst = m_tradeskill_object->PopItem(world_idx); @@ -1693,7 +1693,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } safe_delete(world_inst); - if (src_slot_id == EQEmu::inventory::slotCursor) + if (src_slot_id == EQEmu::invslot::slotCursor) { if (dstitemid == 0) { @@ -1714,15 +1714,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } // Step 4: Check for entity trade - if (dst_slot_id >= EQEmu::legacy::TRADE_BEGIN && dst_slot_id <= EQEmu::legacy::TRADE_END) { - if (src_slot_id != EQEmu::inventory::slotCursor) { + if (dst_slot_id >= EQEmu::invslot::TRADE_BEGIN && dst_slot_id <= EQEmu::invslot::TRADE_END) { + if (src_slot_id != EQEmu::invslot::slotCursor) { Kick(); return false; } if (with) { Log(Logs::Detail, Logs::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor - if (!m_inv[EQEmu::inventory::slotCursor]) { + if (!m_inv[EQEmu::invslot::slotCursor]) { Message(13, "Error: Cursor item not located on server!"); return false; } @@ -1742,7 +1742,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit SummonItem(src_inst->GetID(), src_inst->GetCharges()); - DeleteItemInInventory(EQEmu::inventory::slotCursor); + DeleteItemInInventory(EQEmu::invslot::slotCursor); return true; } @@ -1808,12 +1808,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } else { // Not dealing with charges - just do direct swap - if (src_inst && (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END || dst_slot_id == EQEmu::inventory::slotPowerSource) && dst_slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) { + if (src_inst && (dst_slot_id <= EQEmu::invslot::EQUIPMENT_END || dst_slot_id == EQEmu::invslot::SLOT_POWER_SOURCE) && dst_slot_id >= EQEmu::invslot::EQUIPMENT_BEGIN) { if (src_inst->GetItem()->Attuneable) { src_inst->SetAttuned(true); } if (src_inst->IsAugmented()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { if (src_inst->GetAugment(i)) { if (src_inst->GetAugment(i)->GetItem()->Attuneable) { src_inst->GetAugment(i)->SetAttuned(true); @@ -1840,7 +1840,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { Log(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); - if (src_slot_id <= EQEmu::legacy::EQUIPMENT_END || src_slot_id == EQEmu::inventory::slotPowerSource) { + if (src_slot_id <= EQEmu::invslot::EQUIPMENT_END || src_slot_id == EQEmu::invslot::SLOT_POWER_SOURCE) { if(src_inst) { parse->EventItem(EVENT_UNEQUIP_ITEM, this, src_inst, nullptr, "", src_slot_id); } @@ -1850,7 +1850,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } - if (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END || dst_slot_id == EQEmu::inventory::slotPowerSource) { + if (dst_slot_id <= EQEmu::invslot::EQUIPMENT_END || dst_slot_id == EQEmu::invslot::SLOT_POWER_SOURCE) { if(dst_inst) { parse->EventItem(EVENT_UNEQUIP_ITEM, this, dst_inst, nullptr, "", dst_slot_id); } @@ -1862,12 +1862,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } int matslot = SlotConvert2(dst_slot_id); - if (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END && matslot != EQEmu::textures::armorHead) { // think this is to allow the client to update with /showhelm + if (dst_slot_id <= EQEmu::invslot::EQUIPMENT_END && matslot != EQEmu::textures::armorHead) { // think this is to allow the client to update with /showhelm SendWearChange(matslot); } // Step 7: Save change to the database - if (src_slot_id == EQEmu::inventory::slotCursor) { + if (src_slot_id == EQEmu::invslot::slotCursor) { // If not swapping another item to cursor and stacking items were depleted if (dstitemid == 0 || all_to_stack == true) { @@ -1880,7 +1880,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id); } - if (dst_slot_id == EQEmu::inventory::slotCursor) { + if (dst_slot_id == EQEmu::invslot::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(character_id, s, e); } @@ -1904,7 +1904,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { Log(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); - if ((move_slots->from_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::inventory::slotPowerSource) { + if ((move_slots->from_slot >= EQEmu::invslot::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::invbag::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::invslot::SLOT_POWER_SOURCE) { int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { // This prevents the client from crashing when closing any 'phantom' bags @@ -1947,7 +1947,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); } } - if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::inventory::slotPowerSource) { + if ((move_slots->to_slot >= EQEmu::invslot::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::invbag::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::invslot::SLOT_POWER_SOURCE) { int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -2029,7 +2029,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5); if (from_inst->IsType(EQEmu::item::ItemClassBag)) { - for (uint8 bag_idx = EQEmu::inventory::containerBegin; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { + for (uint8 bag_idx = EQEmu::invbag::SLOT_BEGIN; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { const EQEmu::ItemInstance* from_baginst = from_inst->GetItem(bag_idx); if(from_baginst) { @@ -2062,7 +2062,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5); if (to_inst->IsType(EQEmu::item::ItemClassBag)) { - for (uint8 bag_idx = EQEmu::inventory::containerBegin; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { + for (uint8 bag_idx = EQEmu::invbag::SLOT_BEGIN; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { const EQEmu::ItemInstance* to_baginst = to_inst->GetItem(bag_idx); if(to_baginst) { @@ -2182,10 +2182,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { EQEmu::ItemInstance* ins = nullptr; int x; int num = 0; - for(x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::GENERAL_BAGS_END; x++) + for(x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invbag::GENERAL_BAGS_END; x++) { - if (x == EQEmu::inventory::slotCursor + 1) - x = EQEmu::legacy::GENERAL_BAGS_BEGIN; + if (x == EQEmu::invslot::slotCursor + 1) + x = EQEmu::invbag::GENERAL_BAGS_BEGIN; TempItem = nullptr; ins = GetInv().GetItem(x); if (ins) @@ -2199,10 +2199,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { } if (num < amt) return false; - for(x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::GENERAL_BAGS_END; x++) // should this be CURSOR_BAG_END? + for(x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invbag::GENERAL_BAGS_END; x++) // should this be CURSOR_BAG_END? { - if (x == EQEmu::inventory::slotCursor + 1) - x = EQEmu::legacy::GENERAL_BAGS_BEGIN; + if (x == EQEmu::invslot::slotCursor + 1) + x = EQEmu::invbag::GENERAL_BAGS_BEGIN; TempItem = nullptr; ins = GetInv().GetItem(x); if (ins) @@ -2298,7 +2298,7 @@ static bool CopyBagContents(EQEmu::ItemInstance* new_bag, const EQEmu::ItemInsta void Client::DisenchantSummonedBags(bool client_update) { - for (auto slot_id = EQEmu::legacy::GENERAL_BEGIN; slot_id <= EQEmu::legacy::GENERAL_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::GENERAL_BEGIN; slot_id <= EQEmu::invslot::GENERAL_END; ++slot_id) { auto inst = m_inv[slot_id]; if (!inst) { continue; } if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } @@ -2319,7 +2319,7 @@ void Client::DisenchantSummonedBags(bool client_update) safe_delete(new_inst); } - for (auto slot_id = EQEmu::legacy::BANK_BEGIN; slot_id <= EQEmu::legacy::BANK_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::BANK_BEGIN; slot_id <= EQEmu::invslot::BANK_END; ++slot_id) { auto inst = m_inv[slot_id]; if (!inst) { continue; } if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } @@ -2340,7 +2340,7 @@ void Client::DisenchantSummonedBags(bool client_update) safe_delete(new_inst); } - for (auto slot_id = EQEmu::legacy::SHARED_BANK_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::SHARED_BANK_BEGIN; slot_id <= EQEmu::invslot::SHARED_BANK_END; ++slot_id) { auto inst = m_inv[slot_id]; if (!inst) { continue; } if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } @@ -2362,7 +2362,7 @@ void Client::DisenchantSummonedBags(bool client_update) } while (!m_inv.CursorEmpty()) { - auto inst = m_inv[EQEmu::inventory::slotCursor]; + auto inst = m_inv[EQEmu::invslot::slotCursor]; if (!inst) { break; } if (!IsSummonedBagID(inst->GetItem()->ID)) { break; } if (!inst->GetItem()->IsClassBag()) { break; } @@ -2376,14 +2376,14 @@ void Client::DisenchantSummonedBags(bool client_update) if (!new_inst) { break; } if (CopyBagContents(new_inst, inst)) { - Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::inventory::slotCursor); + Log(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::invslot::slotCursor); std::list local; local.push_front(new_inst); - m_inv.PopItem(EQEmu::inventory::slotCursor); + m_inv.PopItem(EQEmu::invslot::slotCursor); safe_delete(inst); while (!m_inv.CursorEmpty()) { - auto limbo_inst = m_inv.PopItem(EQEmu::inventory::slotCursor); + auto limbo_inst = m_inv.PopItem(EQEmu::invslot::slotCursor); if (limbo_inst == nullptr) { continue; } local.push_back(limbo_inst); } @@ -2409,7 +2409,7 @@ void Client::DisenchantSummonedBags(bool client_update) void Client::RemoveNoRent(bool client_update) { - for (auto slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id <= EQEmu::legacy::EQUIPMENT_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::EQUIPMENT_BEGIN; slot_id <= EQEmu::invslot::EQUIPMENT_END; ++slot_id) { auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2417,7 +2417,7 @@ void Client::RemoveNoRent(bool client_update) } } - for (auto slot_id = EQEmu::legacy::GENERAL_BEGIN; slot_id <= EQEmu::legacy::GENERAL_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::GENERAL_BEGIN; slot_id <= EQEmu::invslot::GENERAL_END; ++slot_id) { auto inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2425,15 +2425,15 @@ void Client::RemoveNoRent(bool client_update) } } - if (m_inv[EQEmu::inventory::slotPowerSource]) { - auto inst = m_inv[EQEmu::inventory::slotPowerSource]; + if (m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]) { + auto inst = m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]; if (inst && !inst->GetItem()->NoRent) { - Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource); - DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); // Ti slot non-existent + Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::invslot::SLOT_POWER_SOURCE); + DeleteItemInInventory(EQEmu::invslot::SLOT_POWER_SOURCE, 0, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); // Ti slot non-existent } } - for (auto slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::legacy::CURSOR_BAG_END; ++slot_id) { + for (auto slot_id = EQEmu::invbag::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::invbag::CURSOR_BAG_END; ++slot_id) { auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2441,7 +2441,7 @@ void Client::RemoveNoRent(bool client_update) } } - for (auto slot_id = EQEmu::legacy::BANK_BEGIN; slot_id <= EQEmu::legacy::BANK_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::BANK_BEGIN; slot_id <= EQEmu::invslot::BANK_END; ++slot_id) { auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2449,7 +2449,7 @@ void Client::RemoveNoRent(bool client_update) } } - for (auto slot_id = EQEmu::legacy::BANK_BAGS_BEGIN; slot_id <= EQEmu::legacy::BANK_BAGS_END; ++slot_id) { + for (auto slot_id = EQEmu::invbag::BANK_BAGS_BEGIN; slot_id <= EQEmu::invbag::BANK_BAGS_END; ++slot_id) { auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2457,7 +2457,7 @@ void Client::RemoveNoRent(bool client_update) } } - for (auto slot_id = EQEmu::legacy::SHARED_BANK_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::SHARED_BANK_BEGIN; slot_id <= EQEmu::invslot::SHARED_BANK_END; ++slot_id) { auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2465,7 +2465,7 @@ void Client::RemoveNoRent(bool client_update) } } - for (auto slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END; ++slot_id) { + for (auto slot_id = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN; slot_id <= EQEmu::invbag::SHARED_BANK_BAGS_END; ++slot_id) { auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { Log(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2477,7 +2477,7 @@ void Client::RemoveNoRent(bool client_update) std::list local; while (!m_inv.CursorEmpty()) { - auto inst = m_inv.PopItem(EQEmu::inventory::slotCursor); + auto inst = m_inv.PopItem(EQEmu::invslot::slotCursor); if (inst == nullptr) { continue; } local.push_back(inst); } @@ -2503,7 +2503,7 @@ void Client::RemoveNoRent(bool client_update) // Two new methods to alleviate perpetual login desyncs void Client::RemoveDuplicateLore(bool client_update) { - for (auto slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id <= EQEmu::legacy::EQUIPMENT_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::EQUIPMENT_BEGIN; slot_id <= EQEmu::invslot::EQUIPMENT_END; ++slot_id) { auto inst = m_inv.PopItem(slot_id); if (inst == nullptr) { continue; } if(CheckLoreConflict(inst->GetItem())) { @@ -2516,7 +2516,7 @@ void Client::RemoveDuplicateLore(bool client_update) safe_delete(inst); } - for (auto slot_id = EQEmu::legacy::GENERAL_BEGIN; slot_id <= EQEmu::legacy::GENERAL_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::GENERAL_BEGIN; slot_id <= EQEmu::invslot::GENERAL_END; ++slot_id) { auto inst = m_inv.PopItem(slot_id); if (inst == nullptr) { continue; } if (CheckLoreConflict(inst->GetItem())) { @@ -2529,21 +2529,21 @@ void Client::RemoveDuplicateLore(bool client_update) safe_delete(inst); } - if (m_inv[EQEmu::inventory::slotPowerSource]) { - auto inst = m_inv.PopItem(EQEmu::inventory::slotPowerSource); + if (m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]) { + auto inst = m_inv.PopItem(EQEmu::invslot::SLOT_POWER_SOURCE); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource); - database.SaveInventory(character_id, nullptr, EQEmu::inventory::slotPowerSource); + Log(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::invslot::SLOT_POWER_SOURCE); + database.SaveInventory(character_id, nullptr, EQEmu::invslot::SLOT_POWER_SOURCE); } else { - m_inv.PutItem(EQEmu::inventory::slotPowerSource, *inst); + m_inv.PutItem(EQEmu::invslot::SLOT_POWER_SOURCE, *inst); } safe_delete(inst); } } - for (auto slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::legacy::CURSOR_BAG_END; ++slot_id) { + for (auto slot_id = EQEmu::invbag::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::invbag::CURSOR_BAG_END; ++slot_id) { auto inst = m_inv.PopItem(slot_id); if (inst == nullptr) { continue; } if(CheckLoreConflict(inst->GetItem())) { @@ -2556,7 +2556,7 @@ void Client::RemoveDuplicateLore(bool client_update) safe_delete(inst); } - for (auto slot_id = EQEmu::legacy::BANK_BEGIN; slot_id <= EQEmu::legacy::BANK_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::BANK_BEGIN; slot_id <= EQEmu::invslot::BANK_END; ++slot_id) { auto inst = m_inv.PopItem(slot_id); if (inst == nullptr) { continue; } if(CheckLoreConflict(inst->GetItem())) { @@ -2569,7 +2569,7 @@ void Client::RemoveDuplicateLore(bool client_update) safe_delete(inst); } - for (auto slot_id = EQEmu::legacy::BANK_BAGS_BEGIN; slot_id <= EQEmu::legacy::BANK_BAGS_END; ++slot_id) { + for (auto slot_id = EQEmu::invbag::BANK_BAGS_BEGIN; slot_id <= EQEmu::invbag::BANK_BAGS_END; ++slot_id) { auto inst = m_inv.PopItem(slot_id); if (inst == nullptr) { continue; } if(CheckLoreConflict(inst->GetItem())) { @@ -2589,7 +2589,7 @@ void Client::RemoveDuplicateLore(bool client_update) std::list local_2; while (!m_inv.CursorEmpty()) { - auto inst = m_inv.PopItem(EQEmu::inventory::slotCursor); + auto inst = m_inv.PopItem(EQEmu::invslot::slotCursor); if (inst == nullptr) { continue; } local_1.push_back(inst); } @@ -2630,7 +2630,7 @@ void Client::RemoveDuplicateLore(bool client_update) void Client::MoveSlotNotAllowed(bool client_update) { - for (auto slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id <= EQEmu::legacy::EQUIPMENT_END; ++slot_id) { + for (auto slot_id = EQEmu::invslot::EQUIPMENT_BEGIN; slot_id <= EQEmu::invslot::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 == EQEmu::item::ItemTypeArrow) ? true : false; @@ -2642,13 +2642,13 @@ void Client::MoveSlotNotAllowed(bool client_update) } } - if (m_inv[EQEmu::inventory::slotPowerSource] && !m_inv[EQEmu::inventory::slotPowerSource]->IsSlotAllowed(EQEmu::inventory::slotPowerSource)) { - auto inst = m_inv.PopItem(EQEmu::inventory::slotPowerSource); + if (m_inv[EQEmu::invslot::SLOT_POWER_SOURCE] && !m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]->IsSlotAllowed(EQEmu::invslot::SLOT_POWER_SOURCE)) { + auto inst = m_inv.PopItem(EQEmu::invslot::SLOT_POWER_SOURCE); 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(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource, free_slot_id); + Log(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::invslot::SLOT_POWER_SOURCE, free_slot_id); PutItemInInventory(free_slot_id, *inst, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); - database.SaveInventory(character_id, nullptr, EQEmu::inventory::slotPowerSource); + database.SaveInventory(character_id, nullptr, EQEmu::invslot::SLOT_POWER_SOURCE); safe_delete(inst); } @@ -2766,13 +2766,13 @@ static int16 BandolierSlotToWeaponSlot(int BandolierSlot) switch (BandolierSlot) { case bandolierPrimary: - return EQEmu::inventory::slotPrimary; + return EQEmu::invslot::slotPrimary; case bandolierSecondary: - return EQEmu::inventory::slotSecondary; + return EQEmu::invslot::slotSecondary; case bandolierRange: - return EQEmu::inventory::slotRange; + return EQEmu::invslot::slotRange; default: - return EQEmu::inventory::slotAmmo; + return EQEmu::invslot::slotAmmo; } } @@ -2847,13 +2847,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) // removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here if (slot == INVALID_INDEX) { - if (m_inv.GetItem(EQEmu::inventory::slotCursor)) { - if (m_inv.GetItem(EQEmu::inventory::slotCursor)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && - m_inv.GetItem(EQEmu::inventory::slotCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check - slot = EQEmu::inventory::slotCursor; + if (m_inv.GetItem(EQEmu::invslot::slotCursor)) { + if (m_inv.GetItem(EQEmu::invslot::slotCursor)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && + m_inv.GetItem(EQEmu::invslot::slotCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check + slot = EQEmu::invslot::slotCursor; } - else if (m_inv.GetItem(EQEmu::inventory::slotCursor)->GetItem()->ItemClass == 1) { - for(int16 CursorBagSlot = EQEmu::legacy::CURSOR_BAG_BEGIN; CursorBagSlot <= EQEmu::legacy::CURSOR_BAG_END; CursorBagSlot++) { + else if (m_inv.GetItem(EQEmu::invslot::slotCursor)->GetItem()->ItemClass == 1) { + for(int16 CursorBagSlot = EQEmu::invbag::CURSOR_BAG_BEGIN; CursorBagSlot <= EQEmu::invbag::CURSOR_BAG_END; CursorBagSlot++) { if (m_inv.GetItem(CursorBagSlot)) { if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && m_inv.GetItem(CursorBagSlot)->GetCharges() >= 1) { // ditto @@ -2999,7 +2999,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // if(ItemToReturn->IsStackable()) { - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving. + for (int16 i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::slotCursor; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving. EQEmu::ItemInstance* InvItem = m_inv.GetItem(i); @@ -3025,12 +3025,12 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // if (InvItem && InvItem->IsClassBag()) { - int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::invbag::SLOT_BEGIN); uint8 BagSize=InvItem->GetItem()->BagSlots; uint8 BagSlot; - for (BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { + for (BagSlot = EQEmu::invbag::SLOT_BEGIN; BagSlot < BagSize; BagSlot++) { InvItem = m_inv.GetItem(BaseSlotID + BagSlot); if (InvItem && (InvItem->GetItem()->ID == ItemID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { @@ -3058,7 +3058,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // We have tried stacking items, now just try and find an empty slot. - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor. + for (int16 i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::slotCursor; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor. EQEmu::ItemInstance* InvItem = m_inv.GetItem(i); @@ -3077,11 +3077,11 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC } if (InvItem->IsClassBag() && EQEmu::InventoryProfile::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { - int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::invbag::SLOT_BEGIN); uint8 BagSize=InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { + for (uint8 BagSlot = EQEmu::invbag::SLOT_BEGIN; BagSlot < BagSize; BagSlot++) { InvItem = m_inv.GetItem(BaseSlotID + BagSlot); @@ -3119,27 +3119,27 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool std::map instmap; // build reference map - for (int16 index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++index) { + for (int16 index = EQEmu::invslot::EQUIPMENT_BEGIN; index <= EQEmu::invslot::POSSESSIONS_END; ++index) { auto inst = m_inv[index]; if (inst == nullptr) { continue; } instmap[index] = inst; } - for (int16 index = EQEmu::legacy::TRIBUTE_BEGIN; index <= EQEmu::legacy::TRIBUTE_END; ++index) { + for (int16 index = EQEmu::invslot::TRIBUTE_BEGIN; index <= EQEmu::invslot::TRIBUTE_END; ++index) { auto inst = m_inv[index]; if (inst == nullptr) { continue; } instmap[index] = inst; } - for (int16 index = EQEmu::legacy::BANK_BEGIN; index <= EQEmu::legacy::BANK_END; ++index) { + for (int16 index = EQEmu::invslot::BANK_BEGIN; index <= EQEmu::invslot::BANK_END; ++index) { auto inst = m_inv[index]; if (inst == nullptr) { continue; } instmap[index] = inst; } - for (int16 index = EQEmu::legacy::SHARED_BANK_BEGIN; index <= EQEmu::legacy::SHARED_BANK_END; ++index) { + for (int16 index = EQEmu::invslot::SHARED_BANK_BEGIN; index <= EQEmu::invslot::SHARED_BANK_END; ++index) { auto inst = m_inv[index]; if (inst == nullptr) { continue; } instmap[index] = inst; } - for (int16 index = EQEmu::legacy::TRADE_BEGIN; index <= EQEmu::legacy::TRADE_END; ++index) { + for (int16 index = EQEmu::invslot::TRADE_BEGIN; index <= EQEmu::invslot::TRADE_END; ++index) { auto inst = m_inv[index]; if (inst == nullptr) { continue; } instmap[index] = inst; @@ -3147,10 +3147,10 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool auto tsobject = GetTradeskillObject(); if (tsobject != nullptr) { - for (int16 index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::TYPE_WORLD_SIZE; ++index) { + for (int16 index = EQEmu::invslot::SLOT_BEGIN; index < EQEmu::invtype::WORLD_SIZE; ++index) { auto inst = tsobject->GetItem(index); if (inst == nullptr) { continue; } - instmap[EQEmu::legacy::WORLD_BEGIN + index] = inst; + instmap[EQEmu::invslot::WORLD_BEGIN + index] = inst; } } @@ -3163,8 +3163,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool instmap[8000 + limbo] = *cursor_itr; } - if (m_inv[EQEmu::inventory::slotPowerSource]) - instmap[EQEmu::inventory::slotPowerSource] = m_inv[EQEmu::inventory::slotPowerSource]; + if (m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]) + instmap[EQEmu::invslot::SLOT_POWER_SOURCE] = m_inv[EQEmu::invslot::SLOT_POWER_SOURCE]; // call InterrogateInventory_ for error check for (auto instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) { @@ -3222,7 +3222,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea } else { if (inst) { - for (int16 sub = EQEmu::inventory::containerBegin; (sub < EQEmu::inventory::ContainerCount) && (!error); ++sub) { // treat any EQEmu::ItemInstance as having the max internal slots available + for (int16 sub = EQEmu::invbag::SLOT_BEGIN; (sub <= EQEmu::invbag::SLOT_END) && (!error); ++sub) { // treat any EQEmu::ItemInstance as having the max internal slots available if (inst->GetItem(sub)) InterrogateInventory_(true, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); } @@ -3252,7 +3252,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea } if (inst) { - for (int16 sub = EQEmu::inventory::containerBegin; (sub < EQEmu::inventory::ContainerCount); ++sub) { + for (int16 sub = EQEmu::invbag::SLOT_BEGIN; (sub <= EQEmu::invbag::SLOT_END); ++sub) { if (inst->GetItem(sub)) InterrogateInventory_(false, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); } @@ -3267,11 +3267,11 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It // very basic error checking - can be elaborated upon if more in-depth testing is needed... if ( - (head >= EQEmu::legacy::EQUIPMENT_BEGIN && head <= EQEmu::legacy::EQUIPMENT_END) || - (head >= EQEmu::legacy::TRIBUTE_BEGIN && head <= EQEmu::legacy::TRIBUTE_END) || - (head >= EQEmu::legacy::WORLD_BEGIN && head <= EQEmu::legacy::WORLD_END) || + (head >= EQEmu::invslot::EQUIPMENT_BEGIN && head <= EQEmu::invslot::EQUIPMENT_END) || + (head >= EQEmu::invslot::TRIBUTE_BEGIN && head <= EQEmu::invslot::TRIBUTE_END) || + (head >= EQEmu::invslot::WORLD_BEGIN && head <= EQEmu::invslot::WORLD_END) || (head >= 8000 && head <= 8101) || - (head == EQEmu::inventory::slotPowerSource)) { + (head == EQEmu::invslot::SLOT_POWER_SOURCE)) { switch (depth) { case 0: // requirement: inst is extant @@ -3283,7 +3283,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It return true; if (!parent->IsType(EQEmu::item::ItemClassCommon)) return true; - if (index >= EQEmu::inventory::SocketCount) + if (index > EQEmu::invaug::SOCKET_END) return true; break; default: // requirement: none (something bad happened...) @@ -3291,11 +3291,11 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It } } else if ( - (head >= EQEmu::legacy::GENERAL_BEGIN && head <= EQEmu::legacy::GENERAL_END) || - (head == EQEmu::inventory::slotCursor) || - (head >= EQEmu::legacy::BANK_BEGIN && head <= EQEmu::legacy::BANK_END) || - (head >= EQEmu::legacy::SHARED_BANK_BEGIN && head <= EQEmu::legacy::SHARED_BANK_END) || - (head >= EQEmu::legacy::TRADE_BEGIN && head <= EQEmu::legacy::TRADE_END)) { + (head >= EQEmu::invslot::GENERAL_BEGIN && head <= EQEmu::invslot::GENERAL_END) || + (head == EQEmu::invslot::slotCursor) || + (head >= EQEmu::invslot::BANK_BEGIN && head <= EQEmu::invslot::BANK_END) || + (head >= EQEmu::invslot::SHARED_BANK_BEGIN && head <= EQEmu::invslot::SHARED_BANK_END) || + (head >= EQEmu::invslot::TRADE_BEGIN && head <= EQEmu::invslot::TRADE_END)) { switch (depth) { case 0: // requirement: inst is extant @@ -3312,7 +3312,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It if (parent->IsClassCommon()) { if (!(inst->GetItem()->AugType > 0)) return true; - if (index >= EQEmu::inventory::SocketCount) + if (index > EQEmu::invaug::SOCKET_END) return true; } break; @@ -3326,7 +3326,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It if (parent->IsClassCommon()) { if (!(inst->GetItem()->AugType > 0)) return true; - if (index >= EQEmu::inventory::SocketCount) + if (index > EQEmu::invaug::SOCKET_END) return true; } break; diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 961d66781..70a7e2bc4 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -263,7 +263,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch item->attuned = 0; item->min_level = minlevel; item->max_level = maxlevel; - item->equip_slot = EQEmu::inventory::slotInvalid; + item->equip_slot = EQEmu::invslot::SLOT_INVALID; if (equipit) { uint8 eslot = 0xFF; @@ -282,7 +282,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch // it is an improvement. if (!item2->NoPet) { - for (int i = 0; !found && i < EQEmu::legacy::EQUIPMENT_SIZE; i++) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; !found && i <= EQEmu::invslot::EQUIPMENT_END; i++) { uint32 slots = (1 << i); if (item2->Slots & slots) { if(equipment[i]) @@ -323,7 +323,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch // @merth: IDFile size has been increased, this needs to change uint16 emat; if(item2->Material <= 0 - || item2->Slots & (1 << EQEmu::inventory::slotPrimary | 1 << EQEmu::inventory::slotSecondary)) { + || item2->Slots & (1 << EQEmu::invslot::slotPrimary | 1 << EQEmu::invslot::slotSecondary)) { memset(newid, 0, sizeof(newid)); for(int i=0;i<7;i++){ if (!isalpha(item2->IDFile[i])){ @@ -337,7 +337,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch emat = item2->Material; } - if (foundslot == EQEmu::inventory::slotPrimary) { + if (foundslot == EQEmu::invslot::slotPrimary) { if (item2->Proc.Effect != 0) CastToMob()->AddProcToWeapon(item2->Proc.Effect, true); @@ -350,7 +350,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch if (item2->IsType2HWeapon()) SetTwoHanderEquipped(true); } - else if (foundslot == EQEmu::inventory::slotSecondary + else if (foundslot == EQEmu::invslot::slotSecondary && (GetOwner() != nullptr || (CanThisClassDualWield() && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) && (item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield)) { @@ -361,25 +361,25 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch if (item2->Damage > 0) SendAddPlayerState(PlayerState::SecondaryWeaponEquipped); } - else if (foundslot == EQEmu::inventory::slotHead) { + else if (foundslot == EQEmu::invslot::slotHead) { eslot = EQEmu::textures::armorHead; } - else if (foundslot == EQEmu::inventory::slotChest) { + else if (foundslot == EQEmu::invslot::slotChest) { eslot = EQEmu::textures::armorChest; } - else if (foundslot == EQEmu::inventory::slotArms) { + else if (foundslot == EQEmu::invslot::slotArms) { eslot = EQEmu::textures::armorArms; } - else if (foundslot == EQEmu::inventory::slotWrist1 || foundslot == EQEmu::inventory::slotWrist2) { + else if (foundslot == EQEmu::invslot::slotWrist1 || foundslot == EQEmu::invslot::slotWrist2) { eslot = EQEmu::textures::armorWrist; } - else if (foundslot == EQEmu::inventory::slotHands) { + else if (foundslot == EQEmu::invslot::slotHands) { eslot = EQEmu::textures::armorHands; } - else if (foundslot == EQEmu::inventory::slotLegs) { + else if (foundslot == EQEmu::invslot::slotLegs) { eslot = EQEmu::textures::armorLegs; } - else if (foundslot == EQEmu::inventory::slotFeet) { + else if (foundslot == EQEmu::invslot::slotFeet) { eslot = EQEmu::textures::armorFeet; } diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 3d309c542..7f59bc918 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1841,47 +1841,47 @@ luabind::scope lua_register_slot() { return luabind::class_("Slot") .enum_("constants") [ - luabind::value("Charm", static_cast(EQEmu::inventory::slotCharm)), - luabind::value("Ear1", static_cast(EQEmu::inventory::slotEar1)), - luabind::value("Head", static_cast(EQEmu::inventory::slotHead)), - luabind::value("Face", static_cast(EQEmu::inventory::slotFace)), - luabind::value("Ear2", static_cast(EQEmu::inventory::slotEar2)), - luabind::value("Neck", static_cast(EQEmu::inventory::slotNeck)), - luabind::value("Shoulder", static_cast(EQEmu::inventory::slotShoulders)), // deprecated - luabind::value("Shoulders", static_cast(EQEmu::inventory::slotShoulders)), - luabind::value("Arms", static_cast(EQEmu::inventory::slotArms)), - luabind::value("Back", static_cast(EQEmu::inventory::slotBack)), - luabind::value("Bracer1", static_cast(EQEmu::inventory::slotWrist1)), // deprecated - luabind::value("Wrist1", static_cast(EQEmu::inventory::slotWrist1)), - luabind::value("Bracer2", static_cast(EQEmu::inventory::slotWrist2)), // deprecated - luabind::value("Wrist2", static_cast(EQEmu::inventory::slotWrist2)), - luabind::value("Range", static_cast(EQEmu::inventory::slotRange)), - luabind::value("Hands", static_cast(EQEmu::inventory::slotHands)), - luabind::value("Primary", static_cast(EQEmu::inventory::slotPrimary)), - luabind::value("Secondary", static_cast(EQEmu::inventory::slotSecondary)), - luabind::value("Ring1", static_cast(EQEmu::inventory::slotFinger1)), // deprecated - luabind::value("Finger1", static_cast(EQEmu::inventory::slotFinger1)), - luabind::value("Ring2", static_cast(EQEmu::inventory::slotFinger2)), // deprecated - luabind::value("Finger2", static_cast(EQEmu::inventory::slotFinger2)), - luabind::value("Chest", static_cast(EQEmu::inventory::slotChest)), - luabind::value("Legs", static_cast(EQEmu::inventory::slotLegs)), - luabind::value("Feet", static_cast(EQEmu::inventory::slotFeet)), - luabind::value("Waist", static_cast(EQEmu::inventory::slotWaist)), - luabind::value("PowerSource", static_cast(EQEmu::inventory::slotPowerSource)), - luabind::value("Ammo", static_cast(EQEmu::inventory::slotAmmo)), - luabind::value("General1", static_cast(EQEmu::inventory::slotGeneral1)), - luabind::value("General2", static_cast(EQEmu::inventory::slotGeneral2)), - luabind::value("General3", static_cast(EQEmu::inventory::slotGeneral3)), - luabind::value("General4", static_cast(EQEmu::inventory::slotGeneral4)), - luabind::value("General5", static_cast(EQEmu::inventory::slotGeneral5)), - luabind::value("General6", static_cast(EQEmu::inventory::slotGeneral6)), - luabind::value("General7", static_cast(EQEmu::inventory::slotGeneral7)), - luabind::value("General8", static_cast(EQEmu::inventory::slotGeneral8)), - luabind::value("Cursor", static_cast(EQEmu::inventory::slotCursor)), - luabind::value("PersonalBegin", static_cast(EQEmu::legacy::GENERAL_BEGIN)), // deprecated - luabind::value("GeneralBegin", static_cast(EQEmu::legacy::GENERAL_BEGIN)), - luabind::value("PersonalEnd", static_cast(EQEmu::legacy::GENERAL_END)), // deprecated - luabind::value("GeneralEnd", static_cast(EQEmu::legacy::GENERAL_END)), + luabind::value("Charm", static_cast(EQEmu::invslot::slotCharm)), + luabind::value("Ear1", static_cast(EQEmu::invslot::slotEar1)), + luabind::value("Head", static_cast(EQEmu::invslot::slotHead)), + luabind::value("Face", static_cast(EQEmu::invslot::slotFace)), + luabind::value("Ear2", static_cast(EQEmu::invslot::slotEar2)), + luabind::value("Neck", static_cast(EQEmu::invslot::slotNeck)), + luabind::value("Shoulder", static_cast(EQEmu::invslot::slotShoulders)), // deprecated + luabind::value("Shoulders", static_cast(EQEmu::invslot::slotShoulders)), + luabind::value("Arms", static_cast(EQEmu::invslot::slotArms)), + luabind::value("Back", static_cast(EQEmu::invslot::slotBack)), + luabind::value("Bracer1", static_cast(EQEmu::invslot::slotWrist1)), // deprecated + luabind::value("Wrist1", static_cast(EQEmu::invslot::slotWrist1)), + luabind::value("Bracer2", static_cast(EQEmu::invslot::slotWrist2)), // deprecated + luabind::value("Wrist2", static_cast(EQEmu::invslot::slotWrist2)), + luabind::value("Range", static_cast(EQEmu::invslot::slotRange)), + luabind::value("Hands", static_cast(EQEmu::invslot::slotHands)), + luabind::value("Primary", static_cast(EQEmu::invslot::slotPrimary)), + luabind::value("Secondary", static_cast(EQEmu::invslot::slotSecondary)), + luabind::value("Ring1", static_cast(EQEmu::invslot::slotFinger1)), // deprecated + luabind::value("Finger1", static_cast(EQEmu::invslot::slotFinger1)), + luabind::value("Ring2", static_cast(EQEmu::invslot::slotFinger2)), // deprecated + luabind::value("Finger2", static_cast(EQEmu::invslot::slotFinger2)), + luabind::value("Chest", static_cast(EQEmu::invslot::slotChest)), + luabind::value("Legs", static_cast(EQEmu::invslot::slotLegs)), + luabind::value("Feet", static_cast(EQEmu::invslot::slotFeet)), + luabind::value("Waist", static_cast(EQEmu::invslot::slotWaist)), + luabind::value("PowerSource", static_cast(EQEmu::invslot::SLOT_POWER_SOURCE)), + luabind::value("Ammo", static_cast(EQEmu::invslot::slotAmmo)), + luabind::value("General1", static_cast(EQEmu::invslot::slotGeneral1)), + luabind::value("General2", static_cast(EQEmu::invslot::slotGeneral2)), + luabind::value("General3", static_cast(EQEmu::invslot::slotGeneral3)), + luabind::value("General4", static_cast(EQEmu::invslot::slotGeneral4)), + luabind::value("General5", static_cast(EQEmu::invslot::slotGeneral5)), + luabind::value("General6", static_cast(EQEmu::invslot::slotGeneral6)), + luabind::value("General7", static_cast(EQEmu::invslot::slotGeneral7)), + luabind::value("General8", static_cast(EQEmu::invslot::slotGeneral8)), + luabind::value("Cursor", static_cast(EQEmu::invslot::slotCursor)), + luabind::value("PersonalBegin", static_cast(EQEmu::invslot::GENERAL_BEGIN)), // deprecated + luabind::value("GeneralBegin", static_cast(EQEmu::invslot::GENERAL_BEGIN)), + luabind::value("PersonalEnd", static_cast(EQEmu::invslot::GENERAL_END)), // deprecated + luabind::value("GeneralEnd", static_cast(EQEmu::invslot::GENERAL_END)), luabind::value("CursorEnd", 0xFFFE), // deprecated luabind::value("Tradeskill", static_cast(EQEmu::legacy::SLOT_TRADESKILL)), // deprecated luabind::value("Augment", static_cast(EQEmu::legacy::SLOT_AUGMENT)), // deprecated diff --git a/zone/merc.cpp b/zone/merc.cpp index 9d0ed2b9f..a32fab994 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -217,7 +217,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { unsigned int i; //should not include 21 (SLOT_AMMO) - for (i = 0; i < EQEmu::inventory::slotAmmo; i++) { + for (i = 0; i < EQEmu::invslot::slotAmmo; i++) { if(equipment[i] == 0) continue; const EQEmu::ItemData * itm = database.GetItem(equipment[i]); @@ -1610,24 +1610,24 @@ void Merc::AI_Process() { //try main hand first if(attack_timer.Check()) { - Attack(GetTarget(), EQEmu::inventory::slotPrimary); + Attack(GetTarget(), EQEmu::invslot::slotPrimary); bool tripleSuccess = false; if(GetOwner() && GetTarget() && CanThisClassDoubleAttack()) { if(GetOwner()) { - Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); + Attack(GetTarget(), EQEmu::invslot::slotPrimary, true); } if(GetOwner() && GetTarget() && GetSpecialAbility(SPECATK_TRIPLE)) { tripleSuccess = true; - Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); + Attack(GetTarget(), EQEmu::invslot::slotPrimary, true); } //quad attack, does this belong here?? if(GetOwner() && GetTarget() && GetSpecialAbility(SPECATK_QUAD)) { - Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); + Attack(GetTarget(), EQEmu::invslot::slotPrimary, true); } } @@ -1639,8 +1639,8 @@ void Merc::AI_Process() { if(zone->random.Roll(flurrychance)) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); - Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); - Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); + Attack(GetTarget(), EQEmu::invslot::slotPrimary, false); + Attack(GetTarget(), EQEmu::invslot::slotPrimary, false); } } @@ -1649,7 +1649,7 @@ void Merc::AI_Process() { if (GetTarget() && ExtraAttackChanceBonus) { if(zone->random.Roll(ExtraAttackChanceBonus)) { - Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); + Attack(GetTarget(), EQEmu::invslot::slotPrimary, false); } } } @@ -1685,11 +1685,11 @@ void Merc::AI_Process() { // Max 78% of DW if (zone->random.Roll(DualWieldProbability)) { - Attack(GetTarget(), EQEmu::inventory::slotSecondary); // Single attack with offhand + Attack(GetTarget(), EQEmu::invslot::slotSecondary); // Single attack with offhand if(CanThisClassDoubleAttack()) { if(GetTarget() && GetTarget()->GetHP() > -10) - Attack(GetTarget(), EQEmu::inventory::slotSecondary); // Single attack with offhand + Attack(GetTarget(), EQEmu::invslot::slotSecondary); // Single attack with offhand } } } @@ -2614,7 +2614,7 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { int16 focus_max_real = 0; //item focus - for (int x = 0; x < EQEmu::legacy::EQUIPMENT_SIZE; ++x) + for (int x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invslot::EQUIPMENT_END; ++x) { TempItem = nullptr; if (equipment[x] == 0) @@ -5093,7 +5093,7 @@ void Merc::UpdateMercAppearance() { // Copied from Bot Code: uint32 itemID = 0; uint8 materialFromSlot = EQEmu::textures::materialInvalid; - for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; ++i) { itemID = equipment[i]; if(itemID != 0) { materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(i); @@ -5111,8 +5111,8 @@ void Merc::UpdateEquipmentLight() m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; - for (int index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { - if (index == EQEmu::inventory::slotAmmo) { continue; } + for (int index = EQEmu::invslot::EQUIPMENT_BEGIN; index <= EQEmu::invslot::EQUIPMENT_END; ++index) { + if (index == EQEmu::invslot::slotAmmo) { continue; } auto item = database.GetItem(equipment[index]); if (item == nullptr) { continue; } diff --git a/zone/merc.h b/zone/merc.h index abd7e65d6..cf6a14009 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -66,7 +66,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None); - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return false; } virtual bool HasGroup() { return (GetGroup() ? true : false); } @@ -293,7 +293,7 @@ protected: Timer evade_timer; // can be moved to pTimers at some point uint16 skills[EQEmu::skills::HIGHEST_SKILL + 1]; - uint32 equipment[EQEmu::legacy::EQUIPMENT_SIZE]; //this is an array of item IDs + uint32 equipment[EQEmu::invslot::EQUIPMENT_COUNT]; //this is an array of item IDs uint16 d_melee_texture1; //this is an item Material value uint16 d_melee_texture2; //this is an item Material value (offhand) uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation diff --git a/zone/mob.cpp b/zone/mob.cpp index ee86e457b..5f998347d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2486,8 +2486,8 @@ bool Mob::CanThisClassDualWield(void) const { return(GetSkill(EQEmu::skills::SkillDualWield) > 0); } else if (CastToClient()->HasSkill(EQEmu::skills::SkillDualWield)) { - const EQEmu::ItemInstance* pinst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); - const EQEmu::ItemInstance* sinst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); + const EQEmu::ItemInstance* pinst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); + const EQEmu::ItemInstance* sinst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotSecondary); // 2HS, 2HB, or 2HP if(pinst && pinst->IsWeapon()) { diff --git a/zone/mob.h b/zone/mob.h index e0e818e3f..5561ef0da 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -184,7 +184,7 @@ public: virtual void RangedAttack(Mob* other) { } virtual void ThrowingAttack(Mob* other) { } // 13 = Primary (default), 14 = secondary - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) = 0; void DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts = nullptr); int MonkSpecialAttack(Mob* other, uint8 skill_used); @@ -675,7 +675,7 @@ public: inline AuraMgr &GetAuraMgr() { return aura_mgr; } // mainly used for zone db loading/saving //Procs - void TriggerDefensiveProcs(Mob *on, uint16 hand = EQEmu::inventory::slotPrimary, bool FromSkillProc = false, int damage = 0); + void TriggerDefensiveProcs(Mob *on, uint16 hand = EQEmu::invslot::slotPrimary, bool FromSkillProc = false, int damage = 0); bool AddRangedProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); bool RemoveRangedProc(uint16 spell_id, bool bAll = false); bool HasRangedProcs() const; @@ -1286,13 +1286,13 @@ protected: void TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success = false, uint16 hand = 0, bool IsDefensive = false); // hand = SlotCharm? bool PassLimitToSkill(uint16 spell_id, uint16 skill); bool PassLimitClass(uint32 Classes_, uint16 Class_); - void TryDefensiveProc(Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); - void TryWeaponProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); - void TrySpellProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); - void TryWeaponProc(const EQEmu::ItemInstance* weapon, Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); + void TryDefensiveProc(Mob *on, uint16 hand = EQEmu::invslot::slotPrimary); + void TryWeaponProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::invslot::slotPrimary); + void TrySpellProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::invslot::slotPrimary); + void TryWeaponProc(const EQEmu::ItemInstance* weapon, Mob *on, uint16 hand = EQEmu::invslot::slotPrimary); void ExecWeaponProc(const EQEmu::ItemInstance* weapon, uint16 spell_id, Mob *on, int level_override = -1); - virtual float GetProcChances(float ProcBonus, uint16 hand = EQEmu::inventory::slotPrimary); - virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQEmu::inventory::slotPrimary, Mob *on = nullptr); + virtual float GetProcChances(float ProcBonus, uint16 hand = EQEmu::invslot::slotPrimary); + virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQEmu::invslot::slotPrimary, Mob *on = nullptr); virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm? uint16 GetWeaponSpeedbyHand(uint16 hand); #ifdef BOTS diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 415b67c3b..2a2023599 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -861,7 +861,7 @@ void Client::AI_Process() if (GetTarget() && !IsStunned() && !IsMezzed() && !GetFeigned()) { if (attack_timer.Check()) { // Should charmed clients not be procing? - DoAttackRounds(GetTarget(), EQEmu::inventory::slotPrimary); + DoAttackRounds(GetTarget(), EQEmu::invslot::slotPrimary); } } @@ -869,7 +869,7 @@ void Client::AI_Process() if (attack_dw_timer.Check()) { if (CheckDualWield()) { // Should charmed clients not be procing? - DoAttackRounds(GetTarget(), EQEmu::inventory::slotSecondary); + DoAttackRounds(GetTarget(), EQEmu::invslot::slotSecondary); } } } @@ -1275,7 +1275,7 @@ void Mob::AI_Process() { //try main hand first if (attack_timer.Check()) { DoMainHandAttackRounds(target); - TriggerDefensiveProcs(target, EQEmu::inventory::slotPrimary, false); + TriggerDefensiveProcs(target, EQEmu::invslot::slotPrimary, false); bool specialed = false; // NPCs can only do one of these a round if (GetSpecialAbility(SPECATK_FLURRY)) { @@ -2154,7 +2154,7 @@ bool Mob::Flurry(ExtraAttackOptions *opts) int num_attacks = GetSpecialAbilityParam(SPECATK_FLURRY, 1); num_attacks = num_attacks > 0 ? num_attacks : RuleI(Combat, MaxFlurryHits); for (int i = 0; i < num_attacks; i++) - Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); + Attack(target, EQEmu::invslot::slotPrimary, false, false, false, opts); } return true; } diff --git a/zone/npc.cpp b/zone/npc.cpp index ae4dae217..29e2f20ef 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -837,8 +837,8 @@ void NPC::UpdateEquipmentLight() m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; - for (int index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { - if (index == EQEmu::inventory::slotAmmo) { continue; } + for (int index = EQEmu::invslot::EQUIPMENT_BEGIN; index <= EQEmu::invslot::EQUIPMENT_END; ++index) { + if (index == EQEmu::invslot::slotAmmo) { continue; } auto item = database.GetItem(equipment[index]); if (item == nullptr) { continue; } diff --git a/zone/npc.h b/zone/npc.h index 2e264ce24..a2cad8b95 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -113,7 +113,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, eSpecialAttacks special = eSpecialAttacks::None); - virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::invslot::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } @@ -534,7 +534,7 @@ protected: uint16 skills[EQEmu::skills::HIGHEST_SKILL + 1]; - uint32 equipment[EQEmu::legacy::EQUIPMENT_SIZE]; //this is an array of item IDs + uint32 equipment[EQEmu::invslot::EQUIPMENT_COUNT]; //this is an array of item IDs uint32 herosforgemodel; //this is the Hero Forge Armor Model (i.e 63 or 84 or 203) uint16 d_melee_texture1; //this is an item Material value diff --git a/zone/object.cpp b/zone/object.cpp index 0ba5f9fa3..3ad4a6a9c 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -328,7 +328,7 @@ void Object::Delete(bool reset_state) } const EQEmu::ItemInstance* Object::GetItem(uint8 index) { - if (index < EQEmu::legacy::TYPE_WORLD_SIZE) { + if (index < EQEmu::invtype::WORLD_SIZE) { return m_inst->GetItem(index); } @@ -366,7 +366,7 @@ void Object::Close() { EQEmu::ItemInstance* container = this->m_inst; if(container != nullptr) { - for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) + for (uint8 i = EQEmu::invbag::SLOT_BEGIN; i <= EQEmu::invbag::SLOT_END; i++) { EQEmu::ItemInstance* inst = container->PopItem(i); if(inst != nullptr) @@ -522,11 +522,11 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) // Transfer item to client - sender->PutItemInInventory(EQEmu::inventory::slotCursor, *m_inst, false); - sender->SendItemPacket(EQEmu::inventory::slotCursor, m_inst, ItemPacketTrade); + sender->PutItemInInventory(EQEmu::invslot::slotCursor, *m_inst, false); + sender->SendItemPacket(EQEmu::invslot::slotCursor, m_inst, ItemPacketTrade); if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet - sender->DeleteItemInInventory(EQEmu::inventory::slotCursor); + sender->DeleteItemInInventory(EQEmu::invslot::slotCursor); if(!m_ground_spawn) safe_delete(m_inst); @@ -603,7 +603,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) auto outapp = new EQApplicationPacket(OP_ClientReady, 0); sender->QueuePacket(outapp); safe_delete(outapp); - for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { + for (uint8 i = EQEmu::invbag::SLOT_BEGIN; i <= EQEmu::invbag::SLOT_END; i++) { const EQEmu::ItemInstance* inst = m_inst->GetItem(i); if (inst) { //sender->GetInv().PutItem(i+4000,inst); diff --git a/zone/pets.cpp b/zone/pets.cpp index be17a3293..e4f7c417b 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -385,12 +385,12 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, // the base items for the pet. These are always loaded // so that a rank 1 suspend minion does not kill things // like the special back items some focused pets may receive. - uint32 petinv[EQEmu::legacy::EQUIPMENT_SIZE]; + uint32 petinv[EQEmu::invslot::EQUIPMENT_COUNT]; memset(petinv, 0, sizeof(petinv)); const EQEmu::ItemData *item = nullptr; if (database.GetBasePetItems(record.equipmentset, petinv)) { - for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++) + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++) if (petinv[i]) { item = database.GetItem(petinv[i]); npc->AddLootDrop(item, &npc->itemlist, 0, 1, 127, true, true); @@ -524,7 +524,7 @@ void NPC::GetPetState(SpellBuff_Struct *pet_buffs, uint32 *items, char *name) { strn0cpy(name, GetName(), 64); //save their items, we only care about what they are actually wearing - memcpy(items, equipment, sizeof(uint32) * EQEmu::legacy::EQUIPMENT_SIZE); + memcpy(items, equipment, sizeof(uint32) * EQEmu::invslot::EQUIPMENT_COUNT); //save their buffs. for (int i=0; i < GetPetMaxTotalSlots(); i++) { @@ -612,7 +612,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) { } //restore their equipment... - for (i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++) { + for (i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++) { if(items[i] == 0) continue; @@ -679,7 +679,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { { slot = atoi(row[0]); - if (slot >= EQEmu::legacy::EQUIPMENT_SIZE) + if (slot > EQEmu::invslot::EQUIPMENT_END) continue; if (items[slot] == 0) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 490d3b1f8..6fe4e547b 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2478,12 +2478,12 @@ int QuestManager::collectitems(uint32 item_id, bool remove) int quantity = 0; int slot_id; - for (slot_id = EQEmu::legacy::GENERAL_BEGIN; slot_id <= EQEmu::legacy::GENERAL_END; ++slot_id) + for (slot_id = EQEmu::invslot::GENERAL_BEGIN; slot_id <= EQEmu::invslot::GENERAL_END; ++slot_id) { quantity += collectitems_processSlot(slot_id, item_id, remove); } - for (slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::legacy::GENERAL_BAGS_END; ++slot_id) + for (slot_id = EQEmu::invbag::GENERAL_BAGS_BEGIN; slot_id <= EQEmu::invbag::GENERAL_BAGS_END; ++slot_id) { quantity += collectitems_processSlot(slot_id, item_id, remove); } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 7c91c97a7..e8fd76c97 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -48,7 +48,7 @@ int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) base++; return base; case EQEmu::skills::SkillFrenzy: - if (IsClient() && CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary)) { + if (IsClient() && CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary)) { if (GetLevel() > 15) base += GetLevel() - 15; if (base > 23) @@ -65,7 +65,7 @@ int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) float skill_bonus = skill_level / 9.0f; float ac_bonus = 0.0f; if (IsClient()) { - auto inst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotFeet); + auto inst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotFeet); if (inst) ac_bonus = inst->GetItemArmorClass(true) / 25.0f; } @@ -78,7 +78,7 @@ int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) float skill_bonus = skill_level / 10.0f; float ac_bonus = 0.0f; if (IsClient()) { - auto inst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotFeet); + auto inst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotFeet); if (inst) ac_bonus = inst->GetItemArmorClass(true) / 25.0f; } @@ -92,9 +92,9 @@ int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) const EQEmu::ItemInstance *inst = nullptr; if (IsClient()) { if (HasShieldEquiped()) - inst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); + inst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotSecondary); else if (HasTwoHanderEquipped()) - inst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + inst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); } if (inst) ac_bonus = inst->GetItemArmorClass(true) / 25.0f; @@ -109,7 +109,7 @@ int Mob::GetBaseSkillDamage(EQEmu::skills::SkillType skill, Mob *target) base = 3; // There seems to be a base 3 for NPCs or some how BS w/o weapon? // until we get a better inv system for NPCs they get nerfed! if (IsClient()) { - auto *inst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + auto *inst = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); if (inst && inst->GetItem() && inst->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing) { base = inst->GetItemBackstabDamage(true); if (!inst->GetItemBackstabDamage()) @@ -168,7 +168,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 if (skill == EQEmu::skills::SkillBash) { if (IsClient()) { - EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); + EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotSecondary); if (item) { if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; @@ -185,10 +185,10 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 my_hit.offense = offense(my_hit.skill); my_hit.tohit = GetTotalToHit(my_hit.skill, 0); - my_hit.hand = EQEmu::inventory::slotPrimary; // Avoid checks hand for throwing/archery exclusion, primary should + my_hit.hand = EQEmu::invslot::slotPrimary; // Avoid checks hand for throwing/archery exclusion, primary should // work for most if (skill == EQEmu::skills::SkillThrowing || skill == EQEmu::skills::SkillArchery) - my_hit.hand = EQEmu::inventory::slotRange; + my_hit.hand = EQEmu::invslot::slotRange; DoAttack(who, my_hit); @@ -259,7 +259,7 @@ void Client::OPCombatAbility(const CombatAbility_Struct *ca_atk) // These two are not subject to the combat ability timer, as they // allready do their checking in conjunction with the attack timer // throwing weapons - if (ca_atk->m_atk == EQEmu::inventory::slotRange) { + if (ca_atk->m_atk == EQEmu::invslot::slotRange) { if (ca_atk->m_skill == EQEmu::skills::SkillThrowing) { SetAttackTimer(); ThrowingAttack(GetTarget()); @@ -309,8 +309,8 @@ void Client::OPCombatAbility(const CombatAbility_Struct *ca_atk) DoAnim(animTailRake, 0, false); int32 ht = 0; - if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::inventory::slotSecondary)) <= 0 && - GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::inventory::slotShoulders)) <= 0) + if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::invslot::slotSecondary)) <= 0 && + GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::invslot::slotShoulders)) <= 0) dmg = -5; else ht = dmg = GetBaseSkillDamage(EQEmu::skills::SkillBash, GetTarget()); @@ -366,7 +366,7 @@ void Client::OPCombatAbility(const CombatAbility_Struct *ca_atk) DoAnim(animKick, 0, false); int32 ht = 0; - if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::inventory::slotFeet)) <= 0) + if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::invslot::slotFeet)) <= 0) dmg = -5; else ht = dmg = GetBaseSkillDamage(EQEmu::skills::SkillKick, GetTarget()); @@ -445,7 +445,7 @@ int Mob::MonkSpecialAttack(Mob *other, uint8 unchecked_type) int32 min_dmg = 0; int reuse = 0; EQEmu::skills::SkillType skill_type; // to avoid casting... even though it "would work" - uint8 itemslot = EQEmu::inventory::slotFeet; + uint8 itemslot = EQEmu::invslot::slotFeet; if (IsNPC()) { auto *npc = CastToNPC(); min_dmg = npc->GetMinDamage(); @@ -462,21 +462,21 @@ int Mob::MonkSpecialAttack(Mob *other, uint8 unchecked_type) case EQEmu::skills::SkillDragonPunch: skill_type = EQEmu::skills::SkillDragonPunch; max_dmg = GetBaseSkillDamage(skill_type); - itemslot = EQEmu::inventory::slotHands; + itemslot = EQEmu::invslot::slotHands; DoAnim(animTailRake, 0, false); reuse = TailRakeReuseTime; break; case EQEmu::skills::SkillEagleStrike: skill_type = EQEmu::skills::SkillEagleStrike; max_dmg = GetBaseSkillDamage(skill_type); - itemslot = EQEmu::inventory::slotHands; + itemslot = EQEmu::invslot::slotHands; DoAnim(animEagleStrike, 0, false); reuse = EagleStrikeReuseTime; break; case EQEmu::skills::SkillTigerClaw: skill_type = EQEmu::skills::SkillTigerClaw; max_dmg = GetBaseSkillDamage(skill_type); - itemslot = EQEmu::inventory::slotHands; + itemslot = EQEmu::invslot::slotHands; DoAnim(animTigerClaw, 0, false); reuse = TigerClawReuseTime; break; @@ -528,7 +528,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { //make sure we have a proper weapon if we are a client. if(IsClient()) { - const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); if (!wpn || (wpn->GetItem()->ItemType != EQEmu::item::ItemType1HPiercing)){ Message_StringID(13, BACKSTAB_WEAPON); return; @@ -583,7 +583,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { m_specialattacks = eSpecialAttacks::None; } else { //We do a single regular attack if we attack from the front without chaotic stab - Attack(other, EQEmu::inventory::slotPrimary); + Attack(other, EQEmu::invslot::slotPrimary); } } @@ -597,7 +597,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) // make sure we can hit (bane, magical, etc) if (IsClient()) { - const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); if (!GetWeaponDamage(other, wpn)) return; } else if (!GetWeaponDamage(other, (const EQEmu::ItemData*)nullptr)){ @@ -616,7 +616,7 @@ void Mob::RogueAssassinate(Mob* other) { //can you dodge, parry, etc.. an assassinate?? //if so, use DoSpecialAttackDamage(other, BACKSTAB, 32000); instead - if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary) : (const EQEmu::ItemInstance*)nullptr) > 0){ + if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary) : (const EQEmu::ItemInstance*)nullptr) > 0){ other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); }else{ other->Damage(this, -5, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); @@ -636,20 +636,20 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } - const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::inventory::slotRange]; + const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::invslot::slotRange]; //locate ammo - int ammo_slot = EQEmu::inventory::slotAmmo; - const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::inventory::slotAmmo]; + int ammo_slot = EQEmu::invslot::slotAmmo; + const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::invslot::slotAmmo]; if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { - Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange); - Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::inventory::slotRange)); + Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange); + Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::invslot::slotRange)); return; } if (!Ammo || !Ammo->IsClassCommon()) { - Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotAmmo), EQEmu::inventory::slotAmmo); - Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::inventory::slotAmmo)); + Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotAmmo), EQEmu::invslot::slotAmmo); + Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::invslot::slotAmmo)); return; } @@ -674,7 +674,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //first look for quivers int r; bool found = false; - for (r = EQEmu::legacy::GENERAL_BEGIN; r <= EQEmu::legacy::GENERAL_END; r++) { + for (r = EQEmu::invslot::GENERAL_BEGIN; r <= EQEmu::invslot::GENERAL_END; r++) { const EQEmu::ItemInstance *pi = m_inv[r]; if (pi == nullptr || !pi->IsClassBag()) continue; @@ -791,7 +791,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon, if (!RangeWeapon && !Ammo && range_id && ammo_id) { if (IsClient()) { - _RangeWeapon = CastToClient()->m_inv[EQEmu::inventory::slotRange]; + _RangeWeapon = CastToClient()->m_inv[EQEmu::invslot::slotRange]; if (_RangeWeapon && _RangeWeapon->GetItem() && _RangeWeapon->GetItem()->ID == range_id) RangeWeapon = _RangeWeapon; @@ -859,7 +859,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon, my_hit.skill = EQEmu::skills::SkillArchery; my_hit.offense = offense(my_hit.skill); my_hit.tohit = GetTotalToHit(my_hit.skill, chance_mod); - my_hit.hand = EQEmu::inventory::slotRange; + my_hit.hand = EQEmu::invslot::slotRange; DoAttack(other, my_hit); TotalDmg = my_hit.damage_done; @@ -877,7 +877,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon, if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillArchery, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillArchery, 0, true, EQEmu::inventory::slotRange); + TrySkillProc(other, EQEmu::skills::SkillArchery, 0, true, EQEmu::invslot::slotRange); } // end of old fuck @@ -886,20 +886,20 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon, // Weapon Proc if (RangeWeapon && other && !other->HasDied()) - TryWeaponProc(RangeWeapon, other, EQEmu::inventory::slotRange); + TryWeaponProc(RangeWeapon, other, EQEmu::invslot::slotRange); // Ammo Proc if (ammo_lost) - TryWeaponProc(nullptr, ammo_lost, other, EQEmu::inventory::slotRange); + TryWeaponProc(nullptr, ammo_lost, other, EQEmu::invslot::slotRange); else if (Ammo && other && !other->HasDied()) - TryWeaponProc(Ammo, other, EQEmu::inventory::slotRange); + TryWeaponProc(Ammo, other, EQEmu::invslot::slotRange); // Skill Proc if (HasSkillProcs() && other && !other->HasDied()) { if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillArchery, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillArchery, 0, false, EQEmu::inventory::slotRange); + TrySkillProc(other, EQEmu::skills::SkillArchery, 0, false, EQEmu::invslot::slotRange); } } @@ -1190,7 +1190,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha my_hit.skill = skill; my_hit.offense = offense(my_hit.skill); my_hit.tohit = GetTotalToHit(my_hit.skill, chance_mod); - my_hit.hand = EQEmu::inventory::slotRange; + my_hit.hand = EQEmu::invslot::slotRange; DoAttack(other, my_hit); @@ -1206,14 +1206,14 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha other->Damage(this, TotalDmg, SPELL_UNKNOWN, skillInUse); if (TotalDmg > 0 && HasSkillProcSuccess() && !other->HasDied()) - TrySkillProc(other, skillInUse, 0, true, EQEmu::inventory::slotRange); + TrySkillProc(other, skillInUse, 0, true, EQEmu::invslot::slotRange); //try proc on hits and misses if(other && !other->HasDied()) - TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, other, EQEmu::inventory::slotRange); + TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, other, EQEmu::invslot::slotRange); if (HasSkillProcs() && other && !other->HasDied()) - TrySkillProc(other, skillInUse, 0, false, EQEmu::inventory::slotRange); + TrySkillProc(other, skillInUse, 0, false, EQEmu::invslot::slotRange); } void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 @@ -1229,19 +1229,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 return; } - int ammo_slot = EQEmu::inventory::slotRange; - const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::inventory::slotRange]; + int ammo_slot = EQEmu::invslot::slotRange; + const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::invslot::slotRange]; if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { - Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange); - Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::inventory::slotRange)); + Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange); + Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::invslot::slotRange)); return; } const EQEmu::ItemData* item = RangeWeapon->GetItem(); if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) { Log(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::inventory::slotRange)); + Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::invslot::slotRange)); return; } @@ -1249,11 +1249,11 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 if(RangeWeapon->GetCharges() == 1) { //first check ammo - const EQEmu::ItemInstance* AmmoItem = m_inv[EQEmu::inventory::slotAmmo]; + const EQEmu::ItemInstance* AmmoItem = m_inv[EQEmu::invslot::slotAmmo]; if(AmmoItem != nullptr && AmmoItem->GetID() == RangeWeapon->GetID()) { //more in the ammo slot, use it RangeWeapon = AmmoItem; - ammo_slot = EQEmu::inventory::slotAmmo; + ammo_slot = EQEmu::invslot::slotAmmo; Log(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more @@ -1371,7 +1371,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon my_hit.skill = EQEmu::skills::SkillThrowing; my_hit.offense = offense(my_hit.skill); my_hit.tohit = GetTotalToHit(my_hit.skill, chance_mod); - my_hit.hand = EQEmu::inventory::slotRange; + my_hit.hand = EQEmu::invslot::slotRange; DoAttack(other, my_hit); TotalDmg = my_hit.damage_done; @@ -1390,7 +1390,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillThrowing, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, true, EQEmu::inventory::slotRange); + TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, true, EQEmu::invslot::slotRange); } // end old shit @@ -1399,15 +1399,15 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon // Throwing item Proc if (ammo_lost) - TryWeaponProc(nullptr, ammo_lost, other, EQEmu::inventory::slotRange); + TryWeaponProc(nullptr, ammo_lost, other, EQEmu::invslot::slotRange); else if (RangeWeapon && other && !other->HasDied()) - TryWeaponProc(RangeWeapon, other, EQEmu::inventory::slotRange); + TryWeaponProc(RangeWeapon, other, EQEmu::invslot::slotRange); if (HasSkillProcs() && other && !other->HasDied()) { if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillThrowing, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, false, EQEmu::inventory::slotRange); + TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, false, EQEmu::invslot::slotRange); } } @@ -1766,7 +1766,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if (ca_target!=this) { DoAnim(animTailRake, 0, false); - if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::inventory::slotSecondary)) <= 0 && GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::inventory::slotShoulders)) <= 0) + if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::invslot::slotSecondary)) <= 0 && GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::invslot::slotShoulders)) <= 0) dmg = DMG_INVULNERABLE; ReuseTime = (BashReuseTime - 1) / HasteMod; @@ -1812,7 +1812,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if(ca_target!=this){ DoAnim(animKick, 0, false); - if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::inventory::slotFeet)) <= 0) + if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::invslot::slotFeet)) <= 0) dmg = DMG_INVULNERABLE; ReuseTime = KickReuseTime-1; @@ -2111,7 +2111,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob *other, uint16 weapon_damage, EQEmu::skills: if (skillinuse == EQEmu::skills::SkillBash) { if (IsClient()) { EQEmu::ItemInstance *item = - CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); + CastToClient()->GetInv().GetItem(EQEmu::invslot::slotSecondary); if (item) { if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; @@ -2131,7 +2131,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob *other, uint16 weapon_damage, EQEmu::skills: my_hit.offense = offense(my_hit.skill); my_hit.tohit = GetTotalToHit(my_hit.skill, chance_mod); // slot range exclude ripe etc ... - my_hit.hand = CanRiposte ? EQEmu::inventory::slotRange : EQEmu::inventory::slotPrimary; + my_hit.hand = CanRiposte ? EQEmu::invslot::slotRange : EQEmu::invslot::slotPrimary; if (IsNPC()) my_hit.min_damage = CastToNPC()->GetMinDamage(); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 1cb376e98..ee71a627b 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -624,7 +624,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove snprintf(effect_desc, _EDLEN, "Flesh To Bone"); #endif if(IsClient()){ - EQEmu::ItemInstance* transI = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotCursor); + EQEmu::ItemInstance* transI = CastToClient()->GetInv().GetItem(EQEmu::invslot::slotCursor); if (transI && transI->IsClassCommon() && transI->IsStackable()){ uint32 fcharges = transI->GetCharges(); //Does it sound like meat... maybe should check if it looks like meat too... @@ -634,7 +634,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove strstr(transI->GetItem()->Name, "Flesh") || strstr(transI->GetItem()->Name, "parts") || strstr(transI->GetItem()->Name, "Parts")){ - CastToClient()->DeleteItemInInventory(EQEmu::inventory::slotCursor, fcharges, true); + CastToClient()->DeleteItemInInventory(EQEmu::invslot::slotCursor, fcharges, true); CastToClient()->SummonItem(13073, fcharges); } else{ @@ -1176,7 +1176,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (SummonedItem) { c->PushItemOnCursor(*SummonedItem); - c->SendItemPacket(EQEmu::inventory::slotCursor, SummonedItem, ItemPacketLimbo); + c->SendItemPacket(EQEmu::invslot::slotCursor, SummonedItem, ItemPacketLimbo); safe_delete(SummonedItem); } SummonedItem = database.CreateItem(spell.base[i], charges); @@ -2213,7 +2213,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove snprintf(effect_desc, _EDLEN, "Rampage"); #endif if(caster) - entity_list.AEAttack(caster, 30, EQEmu::inventory::slotPrimary, 0, true); // on live wars dont get a duration ramp, its a one shot deal + entity_list.AEAttack(caster, 30, EQEmu::invslot::slotPrimary, 0, true); // on live wars dont get a duration ramp, its a one shot deal break; } @@ -3015,7 +3015,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (SummonedItem) { Client *c=CastToClient(); c->PushItemOnCursor(*SummonedItem); - c->SendItemPacket(EQEmu::inventory::slotCursor, SummonedItem, ItemPacketLimbo); + c->SendItemPacket(EQEmu::invslot::slotCursor, SummonedItem, ItemPacketLimbo); safe_delete(SummonedItem); } @@ -5169,7 +5169,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { const EQEmu::ItemData* TempItem = nullptr; - for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) + for (int x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invslot::EQUIPMENT_END; x++) { if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS) continue; @@ -5189,7 +5189,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { } } - for (int y = EQEmu::inventory::socketBegin; y < EQEmu::inventory::SocketCount; ++y) + for (int y = EQEmu::invaug::SOCKET_BEGIN; y <= EQEmu::invaug::SOCKET_END; ++y) { if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS) continue; @@ -5304,7 +5304,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) int16 focus_max_real = 0; //item focus - for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) + for (int x = EQEmu::invslot::EQUIPMENT_BEGIN; x <= EQEmu::invslot::EQUIPMENT_END; x++) { TempItem = nullptr; EQEmu::ItemInstance* ins = GetInv().GetItem(x); @@ -5338,7 +5338,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) } } - for (int y = EQEmu::inventory::socketBegin; y < EQEmu::inventory::SocketCount; ++y) + for (int y = EQEmu::invaug::SOCKET_BEGIN; y <= EQEmu::invaug::SOCKET_END; ++y) { EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); @@ -5376,7 +5376,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) } //Tribute Focus - for (int x = EQEmu::legacy::TRIBUTE_BEGIN; x <= EQEmu::legacy::TRIBUTE_END; ++x) + for (int x = EQEmu::invslot::TRIBUTE_BEGIN; x <= EQEmu::invslot::TRIBUTE_END; ++x) { TempItem = nullptr; EQEmu::ItemInstance* ins = GetInv().GetItem(x); @@ -5576,7 +5576,7 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { int16 focus_max_real = 0; //item focus - for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++){ + for (int i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invslot::EQUIPMENT_END; i++){ const EQEmu::ItemData *cur = database.GetItem(equipment[i]); if(!cur) diff --git a/zone/spells.cpp b/zone/spells.cpp index 1c17e80f4..537e7358e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -281,7 +281,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, return(false); } } - if (itm && (itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(item_slot <= EQEmu::inventory::slotAmmo || item_slot == EQEmu::inventory::slotPowerSource)){ + if (itm && (itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(item_slot <= EQEmu::invslot::slotAmmo || item_slot == EQEmu::invslot::SLOT_POWER_SOURCE)){ if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are attempting to cast a must equip clicky without having it equipped Log(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); @@ -1294,7 +1294,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if (inst == nullptr) break; - for (int r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { + for (int r = EQEmu::invaug::SOCKET_BEGIN; r <= EQEmu::invaug::SOCKET_END; r++) { const EQEmu::ItemInstance* aug_i = inst->GetAugment(r); if (!aug_i) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 262f46234..a6e0dbd34 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -69,7 +69,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme // Verify that no more than two items are in container to guarantee no inadvertant wipes. uint8 itemsFound = 0; - for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) + for (uint8 i = EQEmu::invbag::SLOT_BEGIN; i < EQEmu::invtype::WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) @@ -222,7 +222,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme else { // Delete items in our inventory container... - for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) + for (uint8 i = EQEmu::invbag::SLOT_BEGIN; i < EQEmu::invtype::WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) @@ -303,7 +303,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const EQEmu::ItemData* new_weapon = inst->GetItem(); user->DeleteItemInInventory(EQEmu::InventoryProfile::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::inventory::slotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); + 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::invslot::slotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); if (RuleB(Inventory, DeleteTransformationMold)) user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -323,7 +323,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const EQEmu::ItemData* new_weapon = inst->GetItem(); user->DeleteItemInInventory(EQEmu::InventoryProfile::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::inventory::slotCursor, 0, 0); + 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::invslot::slotCursor, 0, 0); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); } else if (inst) { @@ -407,7 +407,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob safe_delete(outapp); database.DeleteWorldContainer(worldo->m_id, zone->GetZoneID()); } else{ - for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { + for (uint8 i = EQEmu::invbag::SLOT_BEGIN; i < EQEmu::invtype::WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_combine->container_slot, i), 0, true); @@ -1243,7 +1243,7 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_ for (auto row = results.begin(); row != results.end(); ++row) { int ccnt = 0; - for (int x = EQEmu::inventory::slotBegin; x < EQEmu::legacy::TYPE_WORLD_SIZE; x++) { + for (int x = EQEmu::invbag::SLOT_BEGIN; x < EQEmu::invtype::WORLD_SIZE; x++) { const EQEmu::ItemInstance* inst = container->GetItem(x); if(!inst) continue; diff --git a/zone/trading.cpp b/zone/trading.cpp index 70d5c85c1..d3456fbf2 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -99,7 +99,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { // Item always goes into trade bucket from cursor Client* client = owner->CastToClient(); - EQEmu::ItemInstance* inst = client->GetInv().GetItem(EQEmu::inventory::slotCursor); + EQEmu::ItemInstance* inst = client->GetInv().GetItem(EQEmu::invslot::slotCursor); if (!inst) { client->Message(13, "Error: Could not find item on your cursor!"); @@ -132,7 +132,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (_stack_size > 0) inst->SetCharges(_stack_size); else - client->DeleteItemInInventory(EQEmu::inventory::slotCursor); + client->DeleteItemInInventory(EQEmu::invslot::slotCursor); SendItemData(inst2, trade_slot_id); } @@ -147,7 +147,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { Log(Logs::Detail, Logs::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); - client->DeleteItemInInventory(EQEmu::inventory::slotCursor); + client->DeleteItemInInventory(EQEmu::invslot::slotCursor); } } @@ -172,13 +172,13 @@ void Trade::SendItemData(const EQEmu::ItemInstance* inst, int16 dest_slot_id) Client* with = mob->CastToClient(); Client* trader = owner->CastToClient(); if (with && with->IsClient()) { - with->SendItemPacket(dest_slot_id - EQEmu::legacy::TRADE_BEGIN, inst, ItemPacketTradeView); + with->SendItemPacket(dest_slot_id - EQEmu::invslot::TRADE_BEGIN, inst, ItemPacketTradeView); if (inst->GetItem()->ItemClass == 1) { - for (uint16 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { + for (uint16 i = EQEmu::invbag::SLOT_BEGIN; i <= EQEmu::invbag::SLOT_END; i++) { uint16 bagslot_id = EQEmu::InventoryProfile::CalcSlotId(dest_slot_id, i); const EQEmu::ItemInstance* bagitem = trader->GetInv().GetItem(bagslot_id); if (bagitem) { - with->SendItemPacket(bagslot_id - EQEmu::legacy::TRADE_BEGIN, bagitem, ItemPacketTradeView); + with->SendItemPacket(bagslot_id - EQEmu::invslot::TRADE_BEGIN, bagitem, ItemPacketTradeView); } } } @@ -200,7 +200,7 @@ void Trade::LogTrade() uint8 item_count = 0; if (zone->tradevar != 0) { - for (uint16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++) { + for (uint16 i = EQEmu::invslot::TRADE_BEGIN; i <= EQEmu::invslot::TRADE_END; i++) { if (trader->GetInv().GetItem(i)) item_count++; } @@ -252,7 +252,7 @@ void Trade::LogTrade() if (item_count > 0) { strcat(logtext, "items {"); - for (uint16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++) { + for (uint16 i = EQEmu::invslot::TRADE_BEGIN; i <= EQEmu::invslot::TRADE_END; i++) { const EQEmu::ItemInstance* inst = trader->GetInv().GetItem(i); if (!comma) @@ -268,7 +268,7 @@ void Trade::LogTrade() strcat(logtext, item_num); if (inst->IsClassBag()) { - for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { + for (uint8 j = EQEmu::invbag::SLOT_BEGIN; j <= EQEmu::invbag::SLOT_END; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { strcat(logtext, ","); @@ -304,7 +304,7 @@ void Trade::DumpTrade() return; Client* trader = owner->CastToClient(); - for (uint16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++) { + for (uint16 i = EQEmu::invslot::TRADE_BEGIN; i <= EQEmu::invslot::TRADE_END; i++) { const EQEmu::ItemInstance* inst = trader->GetInv().GetItem(i); if (inst) { @@ -313,7 +313,7 @@ void Trade::DumpTrade() i, ((inst->IsClassBag()) ? "True" : "False")); if (inst->IsClassBag()) { - for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { + for (uint8 j = EQEmu::invbag::SLOT_BEGIN; j <= EQEmu::invbag::SLOT_END; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { Log(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)", @@ -333,7 +333,7 @@ void Client::ResetTrade() { AddMoneyToPP(trade->cp, trade->sp, trade->gp, trade->pp, true); // step 1: process bags - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_END; ++trade_slot) { const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst && inst->IsClassBag()) { @@ -352,7 +352,7 @@ void Client::ResetTrade() { } // step 2a: process stackables - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_END; ++trade_slot) { EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { @@ -360,7 +360,7 @@ void Client::ResetTrade() { // there's no built-in safety check against an infinite loop..but, it should break on one of the conditional checks int16 free_slot = m_inv.FindFreeSlotForTradeItem(inst); - if ((free_slot == EQEmu::inventory::slotCursor) || (free_slot == INVALID_INDEX)) + if ((free_slot == EQEmu::invslot::slotCursor) || (free_slot == INVALID_INDEX)) break; EQEmu::ItemInstance* partial_inst = GetInv().GetItem(free_slot); @@ -399,11 +399,11 @@ void Client::ResetTrade() { // step 2b: adjust trade stack bias // (if any partial stacks exist before the final stack, FindFreeSlotForTradeItem() will return that slot in step 3 and an overwrite will occur) - for (int16 trade_slot = EQEmu::legacy::TRADE_END; trade_slot >= EQEmu::legacy::TRADE_BEGIN; --trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_END; trade_slot >= EQEmu::invslot::TRADE_BEGIN; --trade_slot) { EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { - for (int16 bias_slot = EQEmu::legacy::TRADE_BEGIN; bias_slot <= EQEmu::legacy::TRADE_END; ++bias_slot) { + for (int16 bias_slot = EQEmu::invslot::TRADE_BEGIN; bias_slot <= EQEmu::invslot::TRADE_END; ++bias_slot) { if (bias_slot >= trade_slot) break; @@ -433,7 +433,7 @@ void Client::ResetTrade() { } // step 3: process everything else - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_END; ++trade_slot) { const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst) { @@ -488,7 +488,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } // step 1: process bags - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_END; ++trade_slot) { const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst && inst->IsClassBag()) { @@ -523,7 +523,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st else qs_audit->char1_count += detail->charges; - for (uint8 sub_slot = EQEmu::inventory::containerBegin; (sub_slot < EQEmu::inventory::ContainerCount); ++sub_slot) { // this is to catch ALL items + for (uint8 sub_slot = EQEmu::invbag::SLOT_BEGIN; (sub_slot <= EQEmu::invbag::SLOT_END); ++sub_slot) { // this is to catch ALL items const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot); if (bag_inst) { @@ -571,7 +571,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } // step 2a: process stackables - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_END; ++trade_slot) { EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { @@ -579,7 +579,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // there's no built-in safety check against an infinite loop..but, it should break on one of the conditional checks int16 partial_slot = other->GetInv().FindFreeSlotForTradeItem(inst); - if ((partial_slot == EQEmu::inventory::slotCursor) || (partial_slot == INVALID_INDEX)) + if ((partial_slot == EQEmu::invslot::slotCursor) || (partial_slot == INVALID_INDEX)) break; EQEmu::ItemInstance* partial_inst = other->GetInv().GetItem(partial_slot); @@ -653,11 +653,11 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // step 2b: adjust trade stack bias // (if any partial stacks exist before the final stack, FindFreeSlotForTradeItem() will return that slot in step 3 and an overwrite will occur) - for (int16 trade_slot = EQEmu::legacy::TRADE_END; trade_slot >= EQEmu::legacy::TRADE_BEGIN; --trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_END; trade_slot >= EQEmu::invslot::TRADE_BEGIN; --trade_slot) { EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { - for (int16 bias_slot = EQEmu::legacy::TRADE_BEGIN; bias_slot <= EQEmu::legacy::TRADE_END; ++bias_slot) { + for (int16 bias_slot = EQEmu::invslot::TRADE_BEGIN; bias_slot <= EQEmu::invslot::TRADE_END; ++bias_slot) { if (bias_slot >= trade_slot) break; @@ -706,7 +706,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } // step 3: process everything else - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_END; ++trade_slot) { const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst) { @@ -742,7 +742,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st qs_audit->char1_count += detail->charges; // 'step 3' should never really see containers..but, just in case... - for (uint8 sub_slot = EQEmu::inventory::containerBegin; (sub_slot < EQEmu::inventory::ContainerCount); ++sub_slot) { // this is to catch ALL items + for (uint8 sub_slot = EQEmu::invbag::SLOT_BEGIN; (sub_slot <= EQEmu::invbag::SLOT_END); ++sub_slot) { // this is to catch ALL items const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot); if (bag_inst) { @@ -819,7 +819,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } if(qs_log) { // This can be incorporated below when revisions are made - for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_NPC_END; ++trade_slot) { + for (int16 trade_slot = EQEmu::invslot::TRADE_BEGIN; trade_slot <= EQEmu::invslot::TRADE_NPC_END; ++trade_slot) { const EQEmu::ItemInstance* trade_inst = m_inv[trade_slot]; if(trade_inst) { @@ -840,7 +840,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st qs_audit->char_count += detail->charges; if (trade_inst->IsClassBag()) { - for (uint8 sub_slot = EQEmu::inventory::containerBegin; sub_slot < trade_inst->GetItem()->BagSlots; ++sub_slot) { + for (uint8 sub_slot = EQEmu::invbag::SLOT_BEGIN; sub_slot < trade_inst->GetItem()->BagSlots; ++sub_slot) { const EQEmu::ItemInstance* trade_baginst = trade_inst->GetItem(sub_slot); if(trade_baginst) { @@ -874,7 +874,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st std::vector item_list; std::list items; - for (int i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_NPC_END; ++i) { + for (int i = EQEmu::invslot::TRADE_BEGIN; i <= EQEmu::invslot::TRADE_NPC_END; ++i) { EQEmu::ItemInstance *inst = m_inv.GetItem(i); if(inst) { items.push_back(inst); @@ -894,7 +894,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st (item->NoDrop != 0 || isPetAndCanHaveNoDrop))) { // pets need to look inside bags and try to equip items found there if (item->IsClassBag() && item->BagSlots > 0) { - for (int16 bslot = EQEmu::inventory::containerBegin; bslot < item->BagSlots; bslot++) { + for (int16 bslot = EQEmu::invbag::SLOT_BEGIN; bslot < item->BagSlots; bslot++) { const EQEmu::ItemInstance* baginst = inst->GetItem(bslot); if (baginst) { const EQEmu::ItemData* bagitem = baginst->GetItem(); @@ -951,8 +951,8 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } EQEmu::ItemInstance *insts[4] = { 0 }; - for (int i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_NPC_END; ++i) { - insts[i - EQEmu::legacy::TRADE_BEGIN] = m_inv.PopItem(i); + for (int i = EQEmu::invslot::TRADE_BEGIN; i <= EQEmu::invslot::TRADE_NPC_END; ++i) { + insts[i - EQEmu::invslot::TRADE_BEGIN] = m_inv.PopItem(i); database.SaveInventory(CharacterID(), nullptr, i); } @@ -971,7 +971,7 @@ bool Client::CheckTradeLoreConflict(Client* other) if (!other) return true; - for (int16 index = EQEmu::legacy::TRADE_BEGIN; index <= EQEmu::legacy::TRADE_END; ++index) { + for (int16 index = EQEmu::invslot::TRADE_BEGIN; index <= EQEmu::invslot::TRADE_END; ++index) { const EQEmu::ItemInstance* inst = m_inv[index]; if (!inst || !inst->GetItem()) continue; @@ -980,7 +980,7 @@ bool Client::CheckTradeLoreConflict(Client* other) return true; } - for (int16 index = EQEmu::legacy::TRADE_BAGS_BEGIN; index <= EQEmu::legacy::TRADE_BAGS_END; ++index) { + for (int16 index = EQEmu::invbag::TRADE_BAGS_BEGIN; index <= EQEmu::invbag::TRADE_BAGS_END; ++index) { const EQEmu::ItemInstance* inst = m_inv[index]; if (!inst || !inst->GetItem()) continue; @@ -994,7 +994,7 @@ bool Client::CheckTradeLoreConflict(Client* other) bool Client::CheckTradeNonDroppable() { - for (int16 index = EQEmu::legacy::TRADE_BEGIN; index <= EQEmu::legacy::TRADE_END; ++index){ + for (int16 index = EQEmu::invslot::TRADE_BEGIN; index <= EQEmu::invslot::TRADE_END; ++index){ const EQEmu::ItemInstance* inst = m_inv[index]; if (!inst) continue; @@ -1213,7 +1213,7 @@ void Client::BulkSendTraderInventory(uint32 char_id) { TraderCharges_Struct* TraderItems = database.LoadTraderItemWithCharges(char_id); - for (uint8 i = 0;i < 80; i++) { + for (uint8 i = 0;i < 80; i++) { // need to transition away from 'magic number' if((TraderItems->ItemID[i] == 0) || (TraderItems->ItemCost[i] <= 0)) { continue; } @@ -1249,10 +1249,10 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) { EQEmu::ItemInstance* item = nullptr; uint16 SlotID = 0; - for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++){ + for (int i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++){ item = this->GetInv().GetItem(i); if (item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { + for (int x = EQEmu::invbag::SLOT_BEGIN; x <= EQEmu::invbag::SLOT_END; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1272,10 +1272,10 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ EQEmu::ItemInstance* item = nullptr; uint16 SlotID = 0; - for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++){ + for (int i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++){ item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { + for (int x = EQEmu::invbag::SLOT_BEGIN; x <= EQEmu::invbag::SLOT_END; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1303,10 +1303,10 @@ GetItems_Struct* Client::GetTraderItems(){ uint8 ndx = 0; - for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + for (int i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { + for (int x = EQEmu::invbag::SLOT_BEGIN; x <= EQEmu::invbag::SLOT_END; x++) { SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1327,10 +1327,10 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ const EQEmu::ItemInstance* item= nullptr; uint16 SlotID = 0; - for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + for (int i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++){ + for (int x = EQEmu::invbag::SLOT_BEGIN; x <= EQEmu::invbag::SLOT_END; x++){ SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 641549cda..ce1eb5f6d 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -66,7 +66,7 @@ void Client::ToggleTribute(bool enabled) { int r; uint32 cost = 0; uint32 level = GetLevel(); - for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) { + for (r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { uint32 tid = m_pp.tributes[r].tribute; if(tid == TRIBUTE_NONE) continue; @@ -119,7 +119,7 @@ void Client::DoTributeUpdate() { tis->tribute_master_id = tribute_master_id; //Dont know what this is for int r; - for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) { + for (r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { if(m_pp.tributes[r].tribute != TRIBUTE_NONE) { tis->tributes[r] = m_pp.tributes[r].tribute; tis->tiers[r] = m_pp.tributes[r].tier; @@ -134,24 +134,24 @@ void Client::DoTributeUpdate() { if(m_pp.tribute_active) { //send and equip tribute items... - for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) { + for (r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { uint32 tid = m_pp.tributes[r].tribute; if(tid == TRIBUTE_NONE) { - if (m_inv[EQEmu::legacy::TRIBUTE_BEGIN + r]) - DeleteItemInInventory(EQEmu::legacy::TRIBUTE_BEGIN + r, 0, false); + if (m_inv[EQEmu::invslot::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EQEmu::invslot::TRIBUTE_BEGIN + r, 0, false); continue; } if(tribute_list.count(tid) != 1) { - if (m_inv[EQEmu::legacy::TRIBUTE_BEGIN + r]) - DeleteItemInInventory(EQEmu::legacy::TRIBUTE_BEGIN + r, 0, false); + if (m_inv[EQEmu::invslot::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EQEmu::invslot::TRIBUTE_BEGIN + r, 0, false); continue; } //sanity check if(m_pp.tributes[r].tier >= MAX_TRIBUTE_TIERS) { - if (m_inv[EQEmu::legacy::TRIBUTE_BEGIN + r]) - DeleteItemInInventory(EQEmu::legacy::TRIBUTE_BEGIN + r, 0, false); + if (m_inv[EQEmu::invslot::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EQEmu::invslot::TRIBUTE_BEGIN + r, 0, false); m_pp.tributes[r].tier = 0; continue; } @@ -165,15 +165,15 @@ void Client::DoTributeUpdate() { if(inst == nullptr) continue; - PutItemInInventory(EQEmu::legacy::TRIBUTE_BEGIN + r, *inst, false); - SendItemPacket(EQEmu::legacy::TRIBUTE_BEGIN + r, inst, ItemPacketTributeItem); + PutItemInInventory(EQEmu::invslot::TRIBUTE_BEGIN + r, *inst, false); + SendItemPacket(EQEmu::invslot::TRIBUTE_BEGIN + r, inst, ItemPacketTributeItem); safe_delete(inst); } } else { //unequip tribute items... - for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) { - if (m_inv[EQEmu::legacy::TRIBUTE_BEGIN + r]) - DeleteItemInInventory(EQEmu::legacy::TRIBUTE_BEGIN + r, 0, false); + for (r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { + if (m_inv[EQEmu::invslot::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EQEmu::invslot::TRIBUTE_BEGIN + r, 0, false); } } CalcBonuses(); @@ -192,7 +192,7 @@ void Client::SendTributeTimer() { void Client::ChangeTributeSettings(TributeInfo_Struct *t) { int r; - for (r = 0; r < EQEmu::legacy::TRIBUTE_SIZE; r++) { + for (r = 0; r < EQEmu::invtype::TRIBUTE_SIZE; r++) { m_pp.tributes[r].tribute = TRIBUTE_NONE; diff --git a/zone/tune.cpp b/zone/tune.cpp index 36be51905..c0510f94a 100644 --- a/zone/tune.cpp +++ b/zone/tune.cpp @@ -582,13 +582,13 @@ int32 Client::Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 mi int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) { - int Hand = EQEmu::inventory::slotPrimary; + int Hand = EQEmu::invslot::slotPrimary; if (!other) return 0; EQEmu::ItemInstance* weapon; - weapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); + weapon = GetInv().GetItem(EQEmu::invslot::slotPrimary); if(weapon != nullptr) { if (!weapon->IsWeapon()) { @@ -627,7 +627,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) int ucDamageBonus = 0; - if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) + if (Hand == EQEmu::invslot::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) { ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); @@ -661,24 +661,24 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch if (attacker->IsClient()) {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. EQEmu::ItemInstance* weapon; - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); if(weapon && weapon->IsWeapon()){ - skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotPrimary, weapon); + skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::invslot::slotPrimary, weapon); } else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::invslot::slotSecondary); if (weapon && weapon->IsWeapon()) - skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotSecondary, weapon); + skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::invslot::slotSecondary, weapon); else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotRange); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::invslot::slotRange); if (weapon && weapon->IsWeapon()) - skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotRange, weapon); + skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::invslot::slotRange, weapon); } } } - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, 0, 0, avoid_override); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::invslot::slotPrimary, 0, 0, 0, avoid_override); Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); @@ -690,7 +690,7 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch for (int j=0; j < max_loop; j++) { - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, false, 0, avoid_override, add_acc); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::invslot::slotPrimary, 0, false, 0, avoid_override, add_acc); if (Msg >= 3) Message(15, "#Tune - Processing... [%i] [ACCURACY %i] Hit Chance %.2f ",j,add_acc,tmp_hit_chance); @@ -705,7 +705,7 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch if (end){ - Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, Msg, 0, avoid_override);//Display Stat Report + Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::invslot::slotPrimary, 0, Msg, 0, avoid_override);//Display Stat Report Message(0, " "); @@ -741,24 +741,24 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ if (attacker->IsClient()) {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. EQEmu::ItemInstance* weapon; - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::invslot::slotPrimary); if(weapon && weapon->IsWeapon()){ - skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotPrimary, weapon); + skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::invslot::slotPrimary, weapon); } else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::invslot::slotSecondary); if (weapon && weapon->IsWeapon()) - skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotSecondary, weapon); + skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::invslot::slotSecondary, weapon); else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotRange); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::invslot::slotRange); if (weapon && weapon->IsWeapon()) - skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::inventory::slotRange, weapon); + skillinuse = attacker->CastToClient()->AttackAnimation(EQEmu::invslot::slotRange, weapon); } } } - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, 0, acc_override, 0); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::invslot::slotPrimary, 0, 0, acc_override, 0); Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); Message(0, "#Tune - Processing... Find Avoidance for hit chance on defender of (%.0f) pct from attacker. [Current Hit Chance %.2f]", hit_chance, tmp_hit_chance); @@ -768,7 +768,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ for (int j=0; j < max_loop; j++) { - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, 0, acc_override, 0, 0, add_avoid); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::invslot::slotPrimary, 0, 0, acc_override, 0, 0, add_avoid); if (Msg >= 3) Message(0, "#Tune - Processing... [%i] [AVOIDANCE %i] Hit Chance %.2f ",j,add_avoid,tmp_hit_chance); @@ -783,7 +783,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ if (end){ - Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, Msg, acc_override, 0);//Display Stat Report + Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::invslot::slotPrimary, 0, Msg, acc_override, 0);//Display Stat Report Message(0, " "); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index cef24a649..acb06bf19 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -673,7 +673,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* cont uint8 index = (uint8)atoi(row[0]); uint32 item_id = (uint32)atoi(row[1]); int8 charges = (int8)atoi(row[2]); - uint32 aug[EQEmu::inventory::SocketCount]; + uint32 aug[EQEmu::invaug::SOCKET_COUNT]; aug[0] = (uint32)atoi(row[3]); aug[1] = (uint32)atoi(row[4]); aug[2] = (uint32)atoi(row[5]); @@ -683,7 +683,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* cont EQEmu::ItemInstance* inst = database.CreateItem(item_id, charges); if (inst && inst->GetItem()->IsClassCommon()) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) if (aug[i]) inst->PutAugment(&database, i, aug[i]); // Put item inside world container @@ -706,17 +706,17 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const EQ DeleteWorldContainer(parent_id,zone_id); // Save all 10 items, if they exist - for (uint8 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; index++) { + for (uint8 index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; index++) { EQEmu::ItemInstance* inst = container->GetItem(index); if (!inst) continue; uint32 item_id = inst->GetItem()->ID; - uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; + uint32 augslot[EQEmu::invaug::SOCKET_COUNT] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsType(EQEmu::item::ItemClassCommon)) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { + for (int i = EQEmu::invaug::SOCKET_BEGIN; i <= EQEmu::invaug::SOCKET_END; i++) { EQEmu::ItemInstance *auginst=inst->GetAugment(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } @@ -1367,11 +1367,11 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp) { std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT %u", - character_id, EQEmu::legacy::BANDOLIERS_SIZE); + character_id, EQEmu::profile::BANDOLIERS_SIZE); auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0; - for (i = 0; i < EQEmu::legacy::BANDOLIERS_SIZE; i++) { + for (i = 0; i < EQEmu::profile::BANDOLIERS_SIZE; i++) { pp->bandoliers[i].Name[0] = '\0'; - for (int si = 0; si < EQEmu::legacy::BANDOLIER_ITEM_COUNT; si++) { + for (int si = 0; si < EQEmu::profile::BANDOLIER_ITEM_COUNT; si++) { pp->bandoliers[i].Items[si].ID = 0; pp->bandoliers[i].Items[si].Icon = 0; pp->bandoliers[i].Items[si].Name[0] = '\0'; @@ -1405,7 +1405,7 @@ bool ZoneDatabase::LoadCharacterTribute(uint32 character_id, PlayerProfile_Struc std::string query = StringFormat("SELECT `tier`, `tribute` FROM `character_tribute` WHERE `id` = %u", character_id); auto results = database.QueryDatabase(query); int i = 0; - for (i = 0; i < EQEmu::legacy::TRIBUTE_SIZE; i++){ + for (i = 0; i < EQEmu::invtype::TRIBUTE_SIZE; i++){ pp->tributes[i].tribute = 0xFFFFFFFF; pp->tributes[i].tier = 0; } @@ -1424,10 +1424,10 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc { std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT %u", - character_id, EQEmu::legacy::POTION_BELT_ITEM_COUNT); + character_id, EQEmu::profile::POTION_BELT_SIZE); auto results = database.QueryDatabase(query); int i = 0; - for (i = 0; i < EQEmu::legacy::POTION_BELT_ITEM_COUNT; i++) { + for (i = 0; i < EQEmu::profile::POTION_BELT_SIZE; i++) { pp->potionbelt.Items[i].Icon = 0; pp->potionbelt.Items[i].ID = 0; pp->potionbelt.Items[i].Name[0] = '\0'; @@ -1525,7 +1525,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc std::string query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", character_id); QueryDatabase(query); /* Save Tributes only if we have values... */ - for (int i = 0; i < EQEmu::legacy::TRIBUTE_SIZE; i++){ + for (int i = 0; i < EQEmu::invtype::TRIBUTE_SIZE; i++){ if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); @@ -2906,7 +2906,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { int itemCount = 0; for(auto row = results.begin(); row != results.end(); ++row) { - if (itemCount == EQEmu::legacy::EQUIPMENT_SIZE) + if (itemCount == EQEmu::invslot::EQUIPMENT_COUNT) break; if(atoi(row[0]) == 0) @@ -3456,7 +3456,7 @@ void ZoneDatabase::SavePetInfo(Client *client) query.clear(); // pet inventory! - for (int index = EQEmu::legacy::EQUIPMENT_BEGIN; index <= EQEmu::legacy::EQUIPMENT_END; index++) { + for (int index = EQEmu::invslot::EQUIPMENT_BEGIN; index <= EQEmu::invslot::EQUIPMENT_END; index++) { if (!petinfo->Items[index]) continue; @@ -3588,7 +3588,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) continue; int slot = atoi(row[1]); - if (slot < EQEmu::legacy::EQUIPMENT_BEGIN || slot > EQEmu::legacy::EQUIPMENT_END) + if (slot < EQEmu::invslot::EQUIPMENT_BEGIN || slot > EQEmu::invslot::EQUIPMENT_END) continue; pi->Items[slot] = atoul(row[2]); diff --git a/zone/zonedb.h b/zone/zonedb.h index 20bfd897a..8943f6f01 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -148,7 +148,7 @@ struct PetInfo { uint32 Mana; float size; SpellBuff_Struct Buffs[PET_BUFF_COUNT]; - uint32 Items[EQEmu::legacy::EQUIPMENT_SIZE]; + uint32 Items[EQEmu::invslot::EQUIPMENT_COUNT]; char Name[64]; };