diff --git a/changelog.txt b/changelog.txt index 1a717d165..cc18e584f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 07/27/2014 == +Uleat: More updates to the dictionary. Added a 'constants' file for each client translator..these will tie-in to the dictionary. Started +replacement of hard-coded numeric values with a pre-defined constant. This will help in the transition. == 07/16/2014 == Uleat: Initial commit of new client/server 'dictionaries' - work in-progress... Changed equipment slot references to reflect new naming diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 31dfcc978..9b84ecb05 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -72,6 +72,7 @@ SET(common_sources patches/SoD.cpp patches/SoF.cpp patches/RoF.cpp + #patches/RoF2.cpp patches/Titanium.cpp patches/Underfoot.cpp SocketLib/Base64.cpp @@ -191,15 +192,18 @@ SET(common_headers ZoneNumbers.h platform.h patches/Client62.h + patches/Client62_constants.h patches/Client62_itemfields.h patches/Client62_ops.h patches/Client62_structs.h patches/patches.h patches/SoD.h + patches/SoD_constants.h patches/SoD_itemfields.h patches/SoD_ops.h patches/SoD_structs.h patches/SoF.h + patches/SoF_constants.h patches/SoF_itemfields.h patches/SoF_opcode_list.h patches/SoF_ops.h @@ -208,14 +212,22 @@ SET(common_headers patches/SSDefine.h patches/SSRegister.h patches/RoF.h + patches/RoF_constants.h patches/RoF_itemfields.h patches/RoF_ops.h patches/RoF_structs.h + #patches/RoF2.h + #patches/RoF2_constants.h + #patches/RoF2_itemfields.h + #patches/RoF2_ops.h + #patches/RoF2_structs.h patches/Titanium.h + patches/Titanium_constants.h patches/Titanium_itemfields.h patches/Titanium_ops.h patches/Titanium_structs.h patches/Underfoot.h + patches/Underfoot_constants.h patches/Underfoot_itemfields.h patches/Underfoot_ops.h patches/Underfoot_structs.h @@ -240,16 +252,19 @@ SOURCE_GROUP(Patches FILES patches/Client62.h patches/Client62_itemfields.h patches/Client62_ops.h + patches/Client62_constants.h patches/Client62_structs.h patches/patches.h patches/SoD.h patches/SoD_itemfields.h patches/SoD_ops.h + patches/SoD_constants.h patches/SoD_structs.h patches/SoF.h patches/SoF_itemfields.h patches/SoF_opcode_list.h patches/SoF_ops.h + patches/SoF_constants.h patches/SoF_structs.h patches/SSDeclare.h patches/SSDefine.h @@ -257,20 +272,29 @@ SOURCE_GROUP(Patches FILES patches/RoF.h patches/RoF_itemfields.h patches/RoF_ops.h + patches/RoF_constants.h patches/RoF_structs.h + #patches/RoF2.h + #patches/RoF2_itemfields.h + #patches/RoF2_ops.h + #patches/RoF2_constants.h + #patches/RoF2_structs.h patches/Titanium.h patches/Titanium_itemfields.h patches/Titanium_ops.h + patches/Titanium_constants.h patches/Titanium_structs.h patches/Underfoot.h patches/Underfoot_itemfields.h patches/Underfoot_ops.h + patches/Underfoot_constants.h patches/Underfoot_structs.h patches/Client62.cpp patches/patches.cpp patches/SoD.cpp patches/SoF.cpp patches/RoF.cpp + #patches/RoF2.cpp patches/Titanium.cpp patches/Underfoot.cpp ) @@ -321,6 +345,7 @@ ADD_LIBRARY(common ${common_sources} ${common_headers}) IF(UNIX) ADD_DEFINITIONS(-fPIC) + #TODO: Add "patches/RoF2.cpp" when it becomes active SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) ENDIF(UNIX) diff --git a/common/Item.cpp b/common/Item.cpp index b046635c6..133cfe506 100644 --- a/common/Item.cpp +++ b/common/Item.cpp @@ -166,63 +166,63 @@ ItemInst* Inventory::GetItem(int16 slot_id) const ItemInst* result = nullptr; // Cursor - if (slot_id == MainCursor) { + if (slot_id == EmuConstants::CURSOR) { // Cursor slot result = m_cursor.peek_front(); } // Non bag slots - else if (slot_id >= 3000 && slot_id <= 3007) { - // Trade slots + else if (slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END) { result = _GetItem(m_trade, slot_id); } - else if (slot_id >= 2500 && slot_id <= 2501) { + else if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_END) { // Shared Bank slots result = _GetItem(m_shbank, slot_id); } - else if (slot_id >= 2000 && slot_id <= 2023) { + else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) { // Bank slots result = _GetItem(m_bank, slot_id); } - else if ((slot_id >= 22 && slot_id <= 29)) { + else if ((slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END)) { // Personal inventory slots result = _GetItem(m_inv, slot_id); } - else if ((slot_id >= 0 && slot_id <= 21) || (slot_id >= 400 && slot_id <= 404) || (slot_id == 9999)) { + else if ((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || + (slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) || (slot_id == EmuConstants::POWER_SOURCE)) { // Equippable slots (on body) result = _GetItem(m_worn, slot_id); } // Inner bag slots - else if (slot_id >= 3031 && slot_id <= 3110) { + else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) { // Trade bag slots ItemInst* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } - else if (slot_id >= 2531 && slot_id <= 2550) { + else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { // Shared Bank bag slots ItemInst* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } - else if (slot_id >= 2031 && slot_id <= 2270) { + else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) { // Bank bag slots ItemInst* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } - else if (slot_id >= 331 && slot_id <= 340) { + else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) { // Cursor bag slots ItemInst* inst = m_cursor.peek_front(); if (inst && inst->IsType(ItemClassContainer)) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } - else if (slot_id >= 251 && slot_id <= 330) { + else if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) { // Personal inventory bag slots ItemInst* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { @@ -651,67 +651,86 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo } // Opposite of below: Get parent bag slot_id from a slot inside of bag -int16 Inventory::CalcSlotId(int16 slot_id) -{ +int16 Inventory::CalcSlotId(int16 slot_id) { int16 parent_slot_id = INVALID_INDEX; - if (slot_id >= 251 && slot_id <= 330) - parent_slot_id = IDX_INV + (slot_id - 251) / MAX_ITEMS_PER_BAG; - else if (slot_id >= 331 && slot_id <= 340) - parent_slot_id = MainCursor; - else if (slot_id >= 2000 && slot_id <= 2023) - parent_slot_id = IDX_BANK + (slot_id - 2000) / MAX_ITEMS_PER_BAG; - else if (slot_id >= 2031 && slot_id <= 2270) - parent_slot_id = IDX_BANK + (slot_id - 2031) / MAX_ITEMS_PER_BAG; - else if (slot_id >= 2531 && slot_id <= 2550) - parent_slot_id = IDX_SHBANK + (slot_id - 2531) / MAX_ITEMS_PER_BAG; - else if (slot_id >= 3100 && slot_id <= 3179) - parent_slot_id = IDX_TRADE + (slot_id - 3100) / MAX_ITEMS_PER_BAG; + if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) + parent_slot_id = EmuConstants::GENERAL_BEGIN + (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + + else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) + parent_slot_id = EmuConstants::CURSOR; + + /* + // this is not a bag range... + else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) + parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + */ + + else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) + parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + + else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) + parent_slot_id = EmuConstants::SHARED_BANK_BEGIN + (slot_id - EmuConstants::SHARED_BANK_BAGS_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) + else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) + parent_slot_id = EmuConstants::TRADE_BEGIN + (slot_id - EmuConstants::TRADE_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; return parent_slot_id; } // Calculate slot_id for an item within a bag -int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) -{ - if (!Inventory::SupportsContainers(bagslot_id)) { +int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { + if (!Inventory::SupportsContainers(bagslot_id)) return INVALID_INDEX; - } int16 slot_id = INVALID_INDEX; - if (bagslot_id == MainCursor || bagslot_id == 8000) // Cursor - slot_id = IDX_CURSOR_BAG + bagidx; - else if (bagslot_id >= 22 && bagslot_id <= 29) // Inventory slots - slot_id = IDX_INV_BAG + (bagslot_id - 22)*MAX_ITEMS_PER_BAG + bagidx; - else if (bagslot_id >= 2000 && bagslot_id <= 2023) // Bank slots - slot_id = IDX_BANK_BAG + (bagslot_id - 2000)*MAX_ITEMS_PER_BAG + bagidx; - else if (bagslot_id >= 2500 && bagslot_id <= 2501) // Shared bank slots - slot_id = IDX_SHBANK_BAG + (bagslot_id - 2500)*MAX_ITEMS_PER_BAG + bagidx; - else if (bagslot_id >= 3000 && bagslot_id <= 3007) // Trade window slots - slot_id = IDX_TRADE_BAG + (bagslot_id - 3000)*MAX_ITEMS_PER_BAG + bagidx; + if (bagslot_id == EmuConstants::CURSOR || bagslot_id == 8000) + slot_id = EmuConstants::CURSOR_BAG_BEGIN + bagidx; + + else if (bagslot_id >= EmuConstants::GENERAL_BEGIN && bagslot_id <= EmuConstants::GENERAL_END) + slot_id = EmuConstants::GENERAL_BAGS_BEGIN + (bagslot_id - EmuConstants::GENERAL_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; + + else if (bagslot_id >= EmuConstants::BANK_BEGIN && bagslot_id <= EmuConstants::BANK_END) + slot_id = EmuConstants::BANK_BAGS_BEGIN + (bagslot_id - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; + + else if (bagslot_id >= EmuConstants::SHARED_BANK_BEGIN && bagslot_id <= EmuConstants::SHARED_BANK_END) + slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; + + else if (bagslot_id >= EmuConstants::TRADE_BEGIN && bagslot_id <= EmuConstants::TRADE_END) + slot_id = EmuConstants::TRADE_BAGS_BEGIN + (bagslot_id - EmuConstants::TRADE_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; return slot_id; } -uint8 Inventory::CalcBagIdx(int16 slot_id) -{ +uint8 Inventory::CalcBagIdx(int16 slot_id) { uint8 index = 0; - if (slot_id >= 251 && slot_id <= 330) - index = (slot_id - 251) % MAX_ITEMS_PER_BAG; - else if (slot_id >= 331 && slot_id <= 340) - index = (slot_id - 331) % MAX_ITEMS_PER_BAG; - else if (slot_id >= 2000 && slot_id <= 2023) - index = (slot_id - 2000) % MAX_ITEMS_PER_BAG; - else if (slot_id >= 2031 && slot_id <= 2270) - index = (slot_id - 2031) % MAX_ITEMS_PER_BAG; - else if (slot_id >= 2531 && slot_id <= 2550) - index = (slot_id - 2531) % MAX_ITEMS_PER_BAG; - else if (slot_id >= 3100 && slot_id <= 3179) - index = (slot_id - 3100) % MAX_ITEMS_PER_BAG; - else if (slot_id >= 4000 && slot_id <= 4009) - index = (slot_id - 4000) % MAX_ITEMS_PER_BAG; + if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) + index = (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + + else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) + index = (slot_id - EmuConstants::CURSOR_BAG_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + + /* + // this is not a bag range... + else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) + index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + */ + + else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) + index = (slot_id - EmuConstants::BANK_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + + else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) + index = (slot_id - EmuConstants::SHARED_BANK_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + + else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) + index = (slot_id - EmuConstants::TRADE_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + + // odd..but, ok... (probably a range-slot conversion for ItemInst* Object::item + else if (slot_id >= EmuConstants::WORLD_BEGIN && slot_id <= EmuConstants::WORLD_END) + index = (slot_id - EmuConstants::WORLD_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots return index; } diff --git a/common/Item.h b/common/Item.h index 7ca2f2247..9dd03e2bb 100644 --- a/common/Item.h +++ b/common/Item.h @@ -55,21 +55,6 @@ namespace ItemField }; }; -// Indexing positions to the beginning slot_id's for a bucket of slots -#define IDX_EQUIP 0 -#define IDX_CURSOR_BAG 331 -#define IDX_INV 22 -#define IDX_INV_BAG 251 -#define IDX_TRIBUTE 400 -#define IDX_BANK 2000 -#define IDX_BANK_BAG 2031 -#define IDX_SHBANK 2500 -#define IDX_SHBANK_BAG 2531 -#define IDX_TRADE 3000 -#define IDX_TRADE_BAG 3031 -#define IDX_TRADESKILL 4000 -#define MAX_ITEMS_PER_BAG 10 - // Specifies usage type for item inside ItemInst enum ItemInstTypes { diff --git a/common/clientversions.h b/common/clientversions.h index 5e4e601a0..47a7d0204 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -31,11 +31,6 @@ typedef enum { // Values below are not implemented, as yet... - // - RoF2 is added for convenience of implementor..creation client will need to be changed once that client is actually added - // - Code will be added to 'relieve' characters of any illegal inventory items based on their client version. This will - // oversee cheats and mis-placement of starting items whenever a client is loaded. - _EQCreationClient = EQClientRoF, // bump to latest client as new ones are added (make sure that db is updated accordingly) - EmuNPC = _EQClientCount, EmuMerc, EmuBot, diff --git a/common/database.cpp b/common/database.cpp index 4dcee568e..dda0719ba 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -793,7 +793,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven // Doodman: Is this even used? // now the inventory - for (i=0; i<=2270;) + for (i = EmuConstants::POSSESSIONS_BEGIN; i <= EmuConstants::BANK_BAGS_END;) { const ItemInst* newinv = inv->GetItem((int16)i); if (newinv) @@ -821,14 +821,16 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven safe_delete_array(invquery); } - if(i==30){ //end of standard inventory/cursor, jump to internals of bags/cursor - i = 251; + if (i == EmuConstants::CURSOR) { + i = EmuConstants::GENERAL_BAGS_BEGIN; continue; - } else if(i==340){ //end of internals of bags/cursor, jump to bank slots - i = 2000; + } + else if (i == EmuConstants::CURSOR_BAG_END) { + i = EmuConstants::BANK_BEGIN; continue; - } else if(i==2023){ //end of bank slots, jump to internals of bank bags - i = 2031; + } + else if (i == EmuConstants::BANK_END) { + i = EmuConstants::BANK_BAGS_BEGIN; continue; } diff --git a/common/emu_oplist.h b/common/emu_oplist.h index 6a62a4297..edee551a1 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -539,3 +539,4 @@ N(OP_MercenaryTimerRequest), N(OP_OpenInventory), N(OP_OpenContainer), N(OP_Marquee), +N(OP_ClientTimeStamp), diff --git a/common/eq_constants.h b/common/eq_constants.h index fabe85ae9..360fcba95 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -873,8 +873,8 @@ enum InventoryMainTypes : int16 { MainGeneral8, //MainGeneral9, //MainGeneral10, - MainCursor //, - //_MainCount, + MainCursor, + _MainCount }; enum InventorySlot @@ -949,5 +949,11 @@ enum InventorySlot #define NOT_USED 0 #define NO_ITEM 0 +// yes..these are redundant... but, they help to identify and define what is actually being performed +// plus, since they're pre-op's, they don't affect the actual binary size +#define MAP_BEGIN 0 +#define MAIN_BEGIN 0 +#define SUB_BEGIN 0 +#define AUG_BEGIN 0 #endif diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 4d2b995e6..7119d86a6 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -1,22 +1,26 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* +EQEMu: Everquest Server Emulator - 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. +Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net) - 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. +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 - 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 "eq_dictionary.h" +#include "StringUtil.h" // // class ServerConstants @@ -28,7 +32,7 @@ uint16 EmuConstants::InventoryMapSize(int16 map) { case MapBank: return MAP_BANK_SIZE; case MapSharedBank: - return MAP_SHAREDBANK_SIZE; + return MAP_SHARED_BANK_SIZE; case MapTrade: return MAP_TRADE_SIZE; case MapWorld: @@ -38,9 +42,9 @@ uint16 EmuConstants::InventoryMapSize(int16 map) { case MapTribute: return MAP_TRIBUTE_SIZE; case MapTrophyTribute: - return MAP_TROPHYTRIBUTE_SIZE; + return MAP_TROPHY_TRIBUTE_SIZE; case MapGuildTribute: - return MAP_GUILDTRIBUTE_SIZE; + return MAP_GUILD_TRIBUTE_SIZE; case MapMerchant: return MAP_MERCHANT_SIZE; case MapDeleted: @@ -52,23 +56,23 @@ uint16 EmuConstants::InventoryMapSize(int16 map) { case MapInspect: return MAP_INSPECT_SIZE; case MapRealEstate: - return MAP_REALESTATE_SIZE; + return MAP_REAL_ESTATE_SIZE; case MapViewMODPC: - return MAP_VIEWMODPC_SIZE; + return MAP_VIEW_MOD_PC_SIZE; case MapViewMODBank: - return MAP_VIEWMODBANK_SIZE; + return MAP_VIEW_MOD_BANK_SIZE; case MapViewMODSharedBank: - return MAP_VIEWMODSHAREDBANK_SIZE; + return MAP_VIEW_MOD_SHARED_BANK_SIZE; case MapViewMODLimbo: - return MAP_VIEWMODLIMBO_SIZE; + return MAP_VIEW_MOD_LIMBO_SIZE; case MapAltStorage: - return MAP_ALTSTORAGE_SIZE; + return MAP_ALT_STORAGE_SIZE; case MapArchived: return MAP_ARCHIVED_SIZE; case MapMail: return MAP_MAIL_SIZE; case MapGuildTrophyTribute: - return MAP_GUILDTROPHYTRIBUTE_SIZE; + return MAP_GUILD_TROPHY_TRIBUTE_SIZE; case MapKrono: return MAP_KRONO_SIZE; case MapOther: @@ -78,6 +82,179 @@ uint16 EmuConstants::InventoryMapSize(int16 map) { } } +/* +std::string EmuConstants::InventoryLocationName(Location_Struct location) { + // not ready for implementation... + std::string ret_str; + StringFormat(ret_str, "%s, %s, %s, %s", InventoryMapName(location.map), InventoryMainName(location.main), InventorySubName(location.sub), InventoryAugName(location.aug)); + return ret_str; +} +*/ + +std::string EmuConstants::InventoryMapName(int16 map) { + switch (map) { + case INVALID_INDEX: + return "Invalid Map"; + case MapPossessions: + return "Possessions"; + case MapBank: + return "Bank"; + case MapSharedBank: + return "Shared Bank"; + case MapTrade: + return "Trade"; + case MapWorld: + return "World"; + case MapLimbo: + return "Limbo"; + case MapTribute: + return "Tribute"; + case MapTrophyTribute: + return "Trophy Tribute"; + case MapGuildTribute: + return "Guild Tribute"; + case MapMerchant: + return "Merchant"; + case MapDeleted: + return "Deleted"; + case MapCorpse: + return "Corpse"; + case MapBazaar: + return "Bazaar"; + case MapInspect: + return "Inspect"; + case MapRealEstate: + return "Real Estate"; + case MapViewMODPC: + return "View MOD PC"; + case MapViewMODBank: + return "View MOD Bank"; + case MapViewMODSharedBank: + return "View MOD Shared Bank"; + case MapViewMODLimbo: + return "View MOD Limbo"; + case MapAltStorage: + return "Alt Storage"; + case MapArchived: + return "Archived"; + case MapMail: + return "Mail"; + case MapGuildTrophyTribute: + return "Guild Trophy Tribute"; + case MapKrono: + return "Krono"; + case MapOther: + return "Other"; + default: + return "Unknown Map"; + } +} + +std::string EmuConstants::InventoryMainName(int16 main) { + switch (main) { + case INVALID_INDEX: + return "Invalid Main"; + case MainCharm: + return "Charm"; + case MainEar1: + return "Ear 1"; + case MainHead: + return "Head"; + case MainFace: + return "Face"; + case MainEar2: + return "Ear 2"; + case MainNeck: + return "Neck"; + case MainShoulders: + return "Shoulders"; + case MainArms: + return "Arms"; + case MainBack: + return "Back"; + case MainWrist1: + return "Wrist 1"; + case MainWrist2: + return "Wrist 2"; + case MainRange: + return "Range"; + case MainHands: + return "Hands"; + case MainPrimary: + return "Primary"; + case MainSecondary: + return "Secondary"; + case MainFinger1: + return "Finger 1"; + case MainFinger2: + return "Finger 2"; + case MainChest: + return "Chest"; + case MainLegs: + return "Legs"; + case MainFeet: + return "Feet"; + case MainWaist: + return "Waist"; + case MainPowerSource: + return "Power Source"; + case MainAmmo: + return "Ammo"; + case MainGeneral1: + return "General 1"; + case MainGeneral2: + return "General 2"; + case MainGeneral3: + return "General 3"; + case MainGeneral4: + return "General 4"; + case MainGeneral5: + return "General 5"; + case MainGeneral6: + return "General 6"; + case MainGeneral7: + return "General 7"; + case MainGeneral8: + return "General 8"; + /* + case MainGeneral9: + return "General 9"; + case MainGeneral10: + return "General 10"; + */ + case MainCursor: + return "Cursor"; + default: + return "Unknown Main"; + } +} + +std::string EmuConstants::InventorySubName(int16 sub) { + if (sub == INVALID_INDEX) + return "Invalid Sub"; + + if ((uint16)sub >= ITEM_CONTAINER_SIZE) + return "Unknown Sub"; + + std::string ret_str; + StringFormat(ret_str, "Container %i", (sub + 1)); // zero-based index..but, count starts at one + + return ret_str; +} + +std::string EmuConstants::InventoryAugName(int16 aug) { + if (aug == INVALID_INDEX) + return "Invalid Aug"; + + if ((uint16)aug >= ITEM_COMMON_SIZE) + return "Unknown Aug"; + + std::string ret_str; + StringFormat(ret_str, "Augment %i", (aug + 1)); // zero-based index..but, count starts at one + + return ret_str; +} + // // class ClientLimits // @@ -160,34 +337,390 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { // // make sure that you transcribe the actual value from 'defaults' to here before updating or client crashes will ensue..and/or... // insert older clients inside of the progression of client order + // + // MAP_POSSESSIONS_SIZE does not reflect all actual _constants size due to bitmask-use compatibility + // + // when setting NPC-based values, try to adhere to an EmuConstants:: or NOT_USED value to avoid unnecessary issues static const uint16 local[_MapCount][_EmuClientCount] = { - /* { Unknown, 62, Titanium, SoF, SoD, Underfoot, RoF, RoF2, NPC, Merc, Bot, Pet }*/ - { NOT_USED, 34, 34, 34, 34, 34, EmuConstants::MAP_POSSESSIONS_SIZE, 0, 0, 0, 0, 0 }, // (requires bitmask use...) - { NOT_USED, 16, 16, 24, 24, 24, EmuConstants::MAP_BANK_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 2, 2, 2, 2, 2, EmuConstants::MAP_SHAREDBANK_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 8, 8, 8, 8, 8, EmuConstants::MAP_TRADE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 10, 10, 10, 10, 10, EmuConstants::MAP_WORLD_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 36, 36, 36, 36, 36, EmuConstants::MAP_LIMBO_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_TRIBUTE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_TROPHYTRIBUTE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_GUILDTRIBUTE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_MERCHANT_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_DELETED_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 34, EmuConstants::MAP_CORPSE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 80, EmuConstants::MAP_BAZAAR_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_INSPECT_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_REALESTATE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_VIEWMODPC_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_VIEWMODBANK_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_VIEWMODSHAREDBANK_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_VIEWMODLIMBO_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_ALTSTORAGE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_ARCHIVED_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_MAIL_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_GUILDTROPHYTRIBUTE_SIZE, 0, 0, 0, 0, 0 }, - { NOT_USED, NOT_USED, NOT_USED, NOT_USED, NOT_USED, NOT_USED, EmuConstants::MAP_KRONO_SIZE, 0, 0, 0, 0, 0 }, // (will be implemented in RoF2) - { NOT_USED, 0, 0, 0, 0, 0, EmuConstants::MAP_OTHER_SIZE, 0, 0, 0, 0, 0 } + // server and database are sync'd to current MapPossessions's client as set in 'using namespace RoF::slots;' and + // 'EmuConstants::MAP_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask() + // for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations + { // local[MainPossessions] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*Titanium*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*SoF*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*SoD*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*Underfoot*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*RoF*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*RoF2*/ 0, + +/*NPC*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*Merc*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*Bot*/ EmuConstants::MAP_POSSESSIONS_SIZE, +/*Pet*/ EmuConstants::MAP_POSSESSIONS_SIZE + }, + { // local[MapBank] +/*Unknown*/ NOT_USED, +/*62*/ Client62::consts::MAP_BANK_SIZE, +/*Titanium*/ Titanium::consts::MAP_BANK_SIZE, +/*SoF*/ EmuConstants::MAP_BANK_SIZE, +/*SoD*/ EmuConstants::MAP_BANK_SIZE, +/*Underfoot*/ EmuConstants::MAP_BANK_SIZE, +/*RoF*/ EmuConstants::MAP_BANK_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }, + { // local[MapSharedBank] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_SHARED_BANK_SIZE, +/*Titanium*/ EmuConstants::MAP_SHARED_BANK_SIZE, +/*SoF*/ EmuConstants::MAP_SHARED_BANK_SIZE, +/*SoD*/ EmuConstants::MAP_SHARED_BANK_SIZE, +/*Underfoot*/ EmuConstants::MAP_SHARED_BANK_SIZE, +/*RoF*/ EmuConstants::MAP_SHARED_BANK_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }, + { // local[MapTrade] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_TRADE_SIZE, +/*Titanium*/ EmuConstants::MAP_TRADE_SIZE, +/*SoF*/ EmuConstants::MAP_TRADE_SIZE, +/*SoD*/ EmuConstants::MAP_TRADE_SIZE, +/*Underfoot*/ EmuConstants::MAP_TRADE_SIZE, +/*RoF*/ EmuConstants::MAP_TRADE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 4, +/*Merc*/ 4, +/*Bot*/ EmuConstants::MAP_TRADE_SIZE, // client thinks this is another client +/*Pet*/ 4 + }, + { // local[MapWorld] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_WORLD_SIZE, +/*Titanium*/ EmuConstants::MAP_WORLD_SIZE, +/*SoF*/ EmuConstants::MAP_WORLD_SIZE, +/*SoD*/ EmuConstants::MAP_WORLD_SIZE, +/*Underfoot*/ EmuConstants::MAP_WORLD_SIZE, +/*RoF*/ EmuConstants::MAP_WORLD_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }, + { // local[MapLimbo] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_LIMBO_SIZE, +/*Titanium*/ EmuConstants::MAP_LIMBO_SIZE, +/*SoF*/ EmuConstants::MAP_LIMBO_SIZE, +/*SoD*/ EmuConstants::MAP_LIMBO_SIZE, +/*Underfoot*/ EmuConstants::MAP_LIMBO_SIZE, +/*RoF*/ EmuConstants::MAP_LIMBO_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }, + { // local[MapTribute] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_TRIBUTE_SIZE, +/*Titanium*/ EmuConstants::MAP_TRIBUTE_SIZE, +/*SoF*/ EmuConstants::MAP_TRIBUTE_SIZE, +/*SoD*/ EmuConstants::MAP_TRIBUTE_SIZE, +/*Underfoot*/ EmuConstants::MAP_TRIBUTE_SIZE, +/*RoF*/ EmuConstants::MAP_TRIBUTE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapTrophyTribute] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapGuildTribute] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapMerchant] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_MERCHANT_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapDeleted] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_DELETED_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapCorpse] +/*Unknown*/ NOT_USED, +/*62*/ Client62::consts::MAP_CORPSE_SIZE, +/*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE, +/*SoF*/ SoF::consts::MAP_CORPSE_SIZE, +/*SoD*/ SoD::consts::MAP_CORPSE_SIZE, +/*Underfoot*/ Underfoot::consts::MAP_CORPSE_SIZE, +/*RoF*/ RoF::consts::MAP_CORPSE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapBazaar] +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_BAZAAR_SIZE, +/*Titanium*/ EmuConstants::MAP_BAZAAR_SIZE, +/*SoF*/ EmuConstants::MAP_BAZAAR_SIZE, +/*SoD*/ EmuConstants::MAP_BAZAAR_SIZE, +/*Underfoot*/ EmuConstants::MAP_BAZAAR_SIZE, +/*RoF*/ EmuConstants::MAP_BAZAAR_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, // this may need to be 'EmuConstants::MAP_BAZAAR_SIZE' if offline client traders respawn as an npc +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapInspect] +/*Unknown*/ NOT_USED, +/*62*/ Client62::consts::MAP_INSPECT_SIZE, +/*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE, +/*SoF*/ SoF::consts::MAP_INSPECT_SIZE, +/*SoD*/ SoD::consts::MAP_INSPECT_SIZE, +/*Underfoot*/ Underfoot::consts::MAP_INSPECT_SIZE, +/*RoF*/ RoF::consts::MAP_INSPECT_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }, + { // local[MapRealEstate] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_REAL_ESTATE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapViewMODPC] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapViewMODBank] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapViewMODSharedBank] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapViewMODLimbo] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapAltStorage] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_ALT_STORAGE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapArchived] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_ARCHIVED_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapMail] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_MAIL_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapGuildTrophyTribute] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapKrono] +/*Unknown*/ NOT_USED, +/*62*/ NOT_USED, +/*Titanium*/ NOT_USED, +/*SoF*/ NOT_USED, +/*SoD*/ NOT_USED, +/*Underfoot*/ NOT_USED, +/*RoF*/ EmuConstants::MAP_KRONO_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + }, + { // local[MapOther] +/*Unknown*/ NOT_USED, +/*62*/ 0, +/*Titanium*/ 0, +/*SoF*/ 0, +/*SoD*/ 0, +/*Underfoot*/ 0, +/*RoF*/ EmuConstants::MAP_OTHER_SIZE, +/*RoF2*/ 0, + +/*NPC*/ 0, +/*Merc*/ 0, +/*Bot*/ 0, +/*Pet*/ 0 + } }; if ((uint16)map < _MapCount) @@ -197,10 +730,10 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { } uint64 EQLimits::PossessionsBitmask(uint32 version) { - // these are for the new inventory system..not the current one... + // these are for the new inventory system (RoF)..not the current (Ti) one... // 0x0000000000200000 is SlotPowerSource (SoF+) - // 0x0000000100000000 is SlotGeneral9 (RoF+) - // 0x0000000200000000 is SlotGeneral10 (RoF+) + // 0x0000000080000000 is SlotGeneral9 (RoF+) + // 0x0000000100000000 is SlotGeneral10 (RoF+) static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, @@ -218,7 +751,8 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) { /*Pet*/ 0 }; - return local[ValidateMobVersion(version)]; + return NOT_USED; + //return local[ValidateMobVersion(version)]; } uint64 EQLimits::EquipmentBitmask(uint32 version) { @@ -238,7 +772,8 @@ uint64 EQLimits::EquipmentBitmask(uint32 version) { /*Pet*/ 0 }; - return local[ValidateMobVersion(version)]; + return NOT_USED; + //return local[ValidateMobVersion(version)]; } uint64 EQLimits::GeneralBitmask(uint32 version) { @@ -258,7 +793,8 @@ uint64 EQLimits::GeneralBitmask(uint32 version) { /*Pet*/ 0 }; - return local[ValidateMobVersion(version)]; + return NOT_USED; + //return local[ValidateMobVersion(version)]; } uint64 EQLimits::CursorBitmask(uint32 version) { @@ -278,45 +814,47 @@ uint64 EQLimits::CursorBitmask(uint32 version) { /*Pet*/ 0 }; - return local[ValidateMobVersion(version)]; + return NOT_USED; + //return local[ValidateMobVersion(version)]; } bool EQLimits::AllowsEmptyBagInBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, -/*62*/ false, -/*Titanium*/ false, -/*SoF*/ false, -/*SoD*/ false, -/*Underfoot*/ false, -/*RoF*/ true, -/*RoF2*/ true, +/*62*/ Client62::limits::ALLOWS_EMPTY_BAG_IN_BAG, +/*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG, +/*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, +/*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG, +/*Underfoot*/ Underfoot::limits::ALLOWS_EMPTY_BAG_IN_BAG, +/*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, +/*RoF2*/ false, -/*NPC*/ true, -/*Merc*/ true, -/*Bot*/ true, -/*Pet*/ true +/*NPC*/ false, +/*Merc*/ false, +/*Bot*/ false, +/*Pet*/ false }; - return local[ValidateMobVersion(version)]; + return false; // not implemented + //return local[ValidateMobVersion(version)]; } // items uint16 EQLimits::ItemCommonSize(uint32 version) { static const uint16 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ 5, -/*Titanium*/ 5, -/*SoF*/ 5, -/*SoD*/ 5, -/*Underfoot*/ 5, +/*62*/ EmuConstants::ITEM_COMMON_SIZE, +/*Titanium*/ EmuConstants::ITEM_COMMON_SIZE, +/*SoF*/ EmuConstants::ITEM_COMMON_SIZE, +/*SoD*/ EmuConstants::ITEM_COMMON_SIZE, +/*Underfoot*/ EmuConstants::ITEM_COMMON_SIZE, /*RoF*/ EmuConstants::ITEM_COMMON_SIZE, /*RoF2*/ 0, -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 +/*NPC*/ EmuConstants::ITEM_COMMON_SIZE, +/*Merc*/ EmuConstants::ITEM_COMMON_SIZE, +/*Bot*/ EmuConstants::ITEM_COMMON_SIZE, +/*Pet*/ EmuConstants::ITEM_COMMON_SIZE }; return local[ValidateMobVersion(version)]; @@ -325,18 +863,18 @@ uint16 EQLimits::ItemCommonSize(uint32 version) { uint16 EQLimits::ItemContainerSize(uint32 version) { static const uint16 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ 10, -/*Titanium*/ 10, -/*SoF*/ 10, -/*SoD*/ 10, -/*Underfoot*/ 10, +/*62*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*SoF*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*SoD*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*Underfoot*/ EmuConstants::ITEM_CONTAINER_SIZE, /*RoF*/ EmuConstants::ITEM_CONTAINER_SIZE, /*RoF2*/ 0, -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 +/*NPC*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*Merc*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*Bot*/ EmuConstants::ITEM_CONTAINER_SIZE, +/*Pet*/ EmuConstants::ITEM_CONTAINER_SIZE }; return local[ValidateMobVersion(version)]; @@ -345,18 +883,78 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { bool EQLimits::CoinHasWeight(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ true, -/*62*/ true, -/*Titanium*/ true, -/*SoF*/ true, -/*SoD*/ false, -/*Underfoot*/ false, -/*RoF*/ false, -/*RoF2*/ false, +/*62*/ Client62::limits::COIN_HAS_WEIGHT, +/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, +/*SoF*/ SoF::limits::COIN_HAS_WEIGHT, +/*SoD*/ SoD::limits::COIN_HAS_WEIGHT, +/*Underfoot*/ Underfoot::limits::COIN_HAS_WEIGHT, +/*RoF*/ RoF::limits::COIN_HAS_WEIGHT, +/*RoF2*/ true, -/*NPC*/ false, -/*Merc*/ false, -/*Bot*/ false, -/*Pet*/ false +/*NPC*/ true, +/*Merc*/ true, +/*Bot*/ true, +/*Pet*/ true + }; + + return local[ValidateMobVersion(version)]; +} + +uint32 EQLimits::BandoliersCount(uint32 version) { + static const bool local[_EmuClientCount] = { +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::BANDOLIERS_COUNT, +/*Titanium*/ EmuConstants::BANDOLIERS_COUNT, +/*SoF*/ EmuConstants::BANDOLIERS_COUNT, +/*SoD*/ EmuConstants::BANDOLIERS_COUNT, +/*Underfoot*/ EmuConstants::BANDOLIERS_COUNT, +/*RoF*/ EmuConstants::BANDOLIERS_COUNT, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }; + + return local[ValidateMobVersion(version)]; +} + +uint32 EQLimits::BandolierSize(uint32 version) { + static const bool local[_EmuClientCount] = { +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::BANDOLIER_SIZE, +/*Titanium*/ EmuConstants::BANDOLIER_SIZE, +/*SoF*/ EmuConstants::BANDOLIER_SIZE, +/*SoD*/ EmuConstants::BANDOLIER_SIZE, +/*Underfoot*/ EmuConstants::BANDOLIER_SIZE, +/*RoF*/ EmuConstants::BANDOLIER_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED + }; + + return local[ValidateMobVersion(version)]; +} + +uint32 EQLimits::PotionBeltSize(uint32 version) { + static const bool local[_EmuClientCount] = { +/*Unknown*/ NOT_USED, +/*62*/ EmuConstants::POTION_BELT_SIZE, +/*Titanium*/ EmuConstants::POTION_BELT_SIZE, +/*SoF*/ EmuConstants::POTION_BELT_SIZE, +/*SoD*/ EmuConstants::POTION_BELT_SIZE, +/*Underfoot*/ EmuConstants::POTION_BELT_SIZE, +/*RoF*/ EmuConstants::POTION_BELT_SIZE, +/*RoF2*/ 0, + +/*NPC*/ NOT_USED, +/*Merc*/ NOT_USED, +/*Bot*/ NOT_USED, +/*Pet*/ NOT_USED }; return local[ValidateMobVersion(version)]; diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 08f7dee04..bce8b1f4c 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -1,19 +1,22 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net) +/* +EQEMu: Everquest Server Emulator - 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. +Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net) - 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. +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 - 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 EQ_DICTIONARY_H @@ -22,65 +25,145 @@ #include "types.h" #include "eq_constants.h" #include "clientversions.h" +#include +#include "../common/patches/Client62_constants.h" +#include "../common/patches/Titanium_constants.h" +#include "../common/patches/SoF_constants.h" +#include "../common/patches/SoD_constants.h" +#include "../common/patches/Underfoot_constants.h" +#include "../common/patches/RoF_constants.h" +//#include "../common/patches/RoF2_constants.h" + +// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! *** +// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to them change are made!! *** + +// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system + +// (future use) +//using namespace RoF2::maps; // server inventory maps enumeration (code and database sync'd to reference) +//using namespace RoF::slots; // server possessions slots enumeration (code and database sync'd to reference) -// an immutable value is required to initialize arrays, etc... use this class as a repository for those typedef class { + // an immutable value is required to initialize arrays, etc... use this class as a repository for those public: // database - static const EQClientVersion CHARACTER_CREATION_CLIENT = _EQCreationClient; + static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client // inventory static uint16 InventoryMapSize(int16 map); + //static std::string InventoryLocationName(Location_Struct location); + static std::string InventoryMapName(int16 map); + static std::string InventoryMainName(int16 main); + static std::string InventorySubName(int16 sub); + static std::string InventoryAugName(int16 aug); - static const uint16 MAP_POSSESSIONS_SIZE = 22; //_SlotCount; + // these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready + static const uint16 MAP_POSSESSIONS_SIZE = _MainCount; static const uint16 MAP_BANK_SIZE = 24; - static const uint16 MAP_SHAREDBANK_SIZE = 2; + static const uint16 MAP_SHARED_BANK_SIZE = 2; static const uint16 MAP_TRADE_SIZE = 8; static const uint16 MAP_WORLD_SIZE = 10; static const uint16 MAP_LIMBO_SIZE = 36; - static const uint16 MAP_TRIBUTE_SIZE = 5; - static const uint16 MAP_TROPHYTRIBUTE_SIZE = 0; - static const uint16 MAP_GUILDTRIBUTE_SIZE = 0; + static const uint16 MAP_TRIBUTE_SIZE = 5; // (need client values) + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; static const uint16 MAP_MERCHANT_SIZE = 0; static const uint16 MAP_DELETED_SIZE = 0; - static const uint16 MAP_CORPSE_SIZE = 22; //_SlotCount; // actual code still needs lots of work... - static const uint16 MAP_BAZAAR_SIZE = 80; //200; - static const uint16 MAP_INSPECT_SIZE = 22; //_SlotEquipmentCount; - static const uint16 MAP_REALESTATE_SIZE = 0; - static const uint16 MAP_VIEWMODPC_SIZE = NOT_USED; - static const uint16 MAP_VIEWMODBANK_SIZE = NOT_USED; - static const uint16 MAP_VIEWMODSHAREDBANK_SIZE = NOT_USED; - static const uint16 MAP_VIEWMODLIMBO_SIZE = NOT_USED; - static const uint16 MAP_ALTSTORAGE_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = _MainCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, WriteUInt32(structs::MAX_PLAYER_BANDOLIER); - for(uint32 r = 0; r < MAX_PLAYER_BANDOLIER; r++) + for(uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) { outapp->WriteString(emu->bandoliers[r].name); - for(uint32 j = 0; j < MAX_PLAYER_BANDOLIER_ITEMS; ++j) + for(uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) { outapp->WriteString(emu->bandoliers[r].items[j].item_name); outapp->WriteUInt32(emu->bandoliers[r].items[j].item_id); @@ -1212,11 +1212,11 @@ ENCODE(OP_PlayerProfile) } } - for(uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - MAX_PLAYER_BANDOLIER; r++) + for(uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++) { outapp->WriteString(""); - for(uint32 j = 0; j < MAX_PLAYER_BANDOLIER_ITEMS; ++j) + for(uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) { outapp->WriteString(""); outapp->WriteUInt32(0); @@ -1227,7 +1227,7 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT); - for(uint32 r = 0; r < MAX_POTIONS_IN_BELT; r++) + for(uint32 r = 0; r < EmuConstants::POTION_BELT_SIZE; r++) { outapp->WriteString(emu->potionbelt.items[r].item_name); outapp->WriteUInt32(emu->potionbelt.items[r].item_id); @@ -1235,7 +1235,7 @@ ENCODE(OP_PlayerProfile) } - for(uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - MAX_POTIONS_IN_BELT; r++) + for(uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++) { outapp->WriteString(""); outapp->WriteUInt32(0); @@ -1357,9 +1357,9 @@ ENCODE(OP_PlayerProfile) outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(MAX_PLAYER_TRIBUTES); + outapp->WriteUInt32(EmuConstants::TRIBUTE_SIZE); - for(uint32 r = 0; r < MAX_PLAYER_TRIBUTES; r++) + for(uint32 r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) { outapp->WriteUInt32(emu->tributes[r].tribute); outapp->WriteUInt32(emu->tributes[r].tier); diff --git a/common/patches/RoF_constants.h b/common/patches/RoF_constants.h new file mode 100644 index 000000000..4fdbe0187 --- /dev/null +++ b/common/patches/RoF_constants.h @@ -0,0 +1,218 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2014 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 RoF_CONSTANTS_H_ +#define RoF_CONSTANTS_H_ + +#include "../common/types.h" + +namespace RoF { + namespace maps { + typedef enum : int16 { + MapPossessions = 0, + MapBank, + MapSharedBank, + MapTrade, + MapWorld, + MapLimbo, + MapTribute, + MapTrophyTribute, + MapGuildTribute, + MapMerchant, + MapDeleted, + MapCorpse, + MapBazaar, + MapInspect, + MapRealEstate, + MapViewMODPC, + MapViewMODBank, + MapViewMODSharedBank, + MapViewMODLimbo, + MapAltStorage, + MapArchived, + MapMail, + MapGuildTrophyTribute, + MapOther, + _MapCount + }; + } + + namespace slots { + typedef enum : int16 { + MainCharm = 0, + MainEar1, + MainHead, + MainFace, + MainEar2, + MainNeck, + MainShoulders, + MainArms, + MainBack, + MainWrist1, + MainWrist2, + MainRange, + MainHands, + MainPrimary, + MainSecondary, + MainFinger1, + MainFinger2, + MainChest, + MainLegs, + MainFeet, + MainWaist, + MainPowerSource, + MainAmmo, + MainGeneral1, + MainGeneral2, + MainGeneral3, + MainGeneral4, + MainGeneral5, + MainGeneral6, + MainGeneral7, + MainGeneral8, + MainGeneral9, + MainGeneral10, + MainCursor, + _MainCount, + _MainEquipmentBegin = MainCharm, + _MainEquipmentEnd = MainAmmo, + _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), + _MainGeneralBegin = MainGeneral1, + _MainGeneralEnd = MainGeneral10, + _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) + }; + } + + namespace consts { + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; + static const uint16 MAP_BANK_SIZE = 24; + static const uint16 MAP_SHARED_BANK_SIZE = 2; + static const uint16 MAP_TRADE_SIZE = 8; + static const uint16 MAP_WORLD_SIZE = 10; + static const uint16 MAP_LIMBO_SIZE = 36; + static const uint16 MAP_TRIBUTE_SIZE = 0; //? + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; + static const uint16 MAP_MERCHANT_SIZE = 0; + static const uint16 MAP_DELETED_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; + static const uint16 MAP_BAZAAR_SIZE = 200; + static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; + static const uint16 MAP_REAL_ESTATE_SIZE = 0; + static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; + static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; + static const uint16 MAP_ALT_STORAGE_SIZE = 0; + static const uint16 MAP_ARCHIVED_SIZE = 0; + static const uint16 MAP_MAIL_SIZE = 0; + static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_KRONO_SIZE = NOT_USED; + static const uint16 MAP_OTHER_SIZE = 0; + + // most of these definitions will go away with the structure-based system..this maintains compatibility for now + // (bag slots and main slots beyond Possessions are assigned for compatibility with current server coding) + static const int16 POSSESSIONS_BEGIN = slots::MainCharm; + static const int16 POSSESSIONS_END = slots::MainCursor; + + static const int16 EQUIPMENT_BEGIN = slots::MainCharm; + static const int16 EQUIPMENT_END = slots::MainAmmo; + static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; + + static const int16 GENERAL_BEGIN = slots::MainGeneral1; + static const int16 GENERAL_END = slots::MainGeneral10; + static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; + static const int16 GENERAL_BAGS_BEGIN = 251; + static const int16 GENERAL_BAGS_END_OFFSET = 99; + static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; + + static const int16 CURSOR = slots::MainCursor; + static const int16 CURSOR_BAG_BEGIN = 351; + static const int16 CURSOR_BAG_END_OFFSET = 9; + static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; + + static const int16 BANK_BEGIN = 2000; + static const int16 BANK_END = 2023; + static const int16 BANK_BAGS_BEGIN = 2031; + static const int16 BANK_BAGS_END_OFFSET = 239; + static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; + + static const int16 SHARED_BANK_BEGIN = 2500; + static const int16 SHARED_BANK_END = 2501; + static const int16 SHARED_BANK_BAGS_BEGIN = 2531; + static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; + static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; + + static const int16 TRADE_BEGIN = 3000; + static const int16 TRADE_END = 3007; + static const int16 TRADE_END_NPC = 3003; + static const int16 TRADE_BAGS_BEGIN = 3031; + static const int16 TRADE_BAGS_END_OFFSET = 79; + static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; + + static const int16 WORLD_BEGIN = 4000; + static const int16 WORLD_END = 4009; + + static const int16 TRIBUTE_BEGIN = 400; + static const int16 TRIBUTE_END = 404; + + static const int16 CORPSE_BEGIN = slots::MainGeneral1; + static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; + + static const uint16 ITEM_COMMON_SIZE = 6; + static const uint16 ITEM_CONTAINER_SIZE = 255; // 255; (server max will be 255..unsure what actual client is - test) + + static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances + static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance + static const uint32 POTION_BELT_SIZE = 5; + } + + namespace limits { + static const bool ALLOWS_EMPTY_BAG_IN_BAG = true; + static const bool COIN_HAS_WEIGHT = false; + } + +}; //end namespace RoF + +#endif /*RoF_CONSTANTS_H_*/ + +/* +RoF Notes: + ** Structure-based inventory ** +ok Possessions: ( 0, { 0 .. 33 }, -1, -1 ) (Corpse: { 23 .. 56 } [Offset 23]) +ok [Equipment: ( 0, { 0 .. 22 }, -1, -1 )] +ok [General: ( 0, { 23 .. 32 }, -1, -1 )] +ok [Cursor: ( 0, 33, -1, -1 )] + General Bags: ( 0, { 23 .. 32 }, { 0 .. (maxsize - 1) }, -1 ) + Cursor Bags: ( 0, 33, { 0 .. (maxsize - 1) }, -1 ) + + Bank: ( 1, { 0 .. 23 }, -1, -1 ) + Bank Bags: ( 1, { 0 .. 23 }, { 0 .. (maxsize - 1)}, -1 ) + + Shared Bank: ( 2, { 0 .. 1 }, -1, -1 ) + Shared Bank Bags: ( 2, { 0 .. 1 }, { 0 .. (maxsize - 1) }, -1 ) + + Trade: ( 3, { 0 .. 8 }, -1, -1 ) + (Trade Bags: 3031 - 3110 -- server values) + + World: ( 4, { 0 .. 10 }, -1, -1 ) + +*/ diff --git a/common/patches/SoD_constants.h b/common/patches/SoD_constants.h new file mode 100644 index 000000000..7c359a8ab --- /dev/null +++ b/common/patches/SoD_constants.h @@ -0,0 +1,215 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2014 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 SoD_CONSTANTS_H_ +#define SoD_CONSTANTS_H_ + +#include "../common/types.h" + +namespace SoD { + namespace maps { + typedef enum : int16 { + // this needs work to match actual client equivilents + MapPossessions = 0, + MapBank, + MapSharedBank, + MapTrade, + MapWorld, + MapLimbo, + MapTribute, + MapTrophyTribute, + MapGuildTribute, + MapMerchant, + MapDeleted, + MapCorpse, + MapBazaar, + MapInspect, + MapRealEstate, + MapViewMODPC, + MapViewMODBank, + MapViewMODSharedBank, + MapViewMODLimbo, + MapAltStorage, + MapArchived, + MapMail, + MapGuildTrophyTribute, + MapOther, + _MapCount + }; + } + + namespace slots { + typedef enum : int16 { + MainCharm = 0, + MainEar1, + MainHead, + MainFace, + MainEar2, + MainNeck, + MainShoulders, + MainArms, + MainBack, + MainWrist1, + MainWrist2, + MainRange, + MainHands, + MainPrimary, + MainSecondary, + MainFinger1, + MainFinger2, + MainChest, + MainLegs, + MainFeet, + MainWaist, + MainPowerSource, + MainAmmo, + MainGeneral1, + MainGeneral2, + MainGeneral3, + MainGeneral4, + MainGeneral5, + MainGeneral6, + MainGeneral7, + MainGeneral8, + MainCursor, + _MainCount, + _MainEquipmentBegin = MainCharm, + _MainEquipmentEnd = MainAmmo, + _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), + _MainGeneralBegin = MainGeneral1, + _MainGeneralEnd = MainGeneral8, + _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) + }; + } + + namespace consts { + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; + static const uint16 MAP_BANK_SIZE = 24; + static const uint16 MAP_SHARED_BANK_SIZE = 2; + static const uint16 MAP_TRADE_SIZE = 8; + static const uint16 MAP_WORLD_SIZE = 10; + static const uint16 MAP_LIMBO_SIZE = 36; + static const uint16 MAP_TRIBUTE_SIZE = 0; //? + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; + static const uint16 MAP_MERCHANT_SIZE = 0; + static const uint16 MAP_DELETED_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; + static const uint16 MAP_BAZAAR_SIZE = 80; + static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; + static const uint16 MAP_REAL_ESTATE_SIZE = 0; + static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; + static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; + static const uint16 MAP_ALT_STORAGE_SIZE = 0; + static const uint16 MAP_ARCHIVED_SIZE = 0; + static const uint16 MAP_MAIL_SIZE = 0; + static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_KRONO_SIZE = NOT_USED; + static const uint16 MAP_OTHER_SIZE = 0; + + static const int16 POSSESSIONS_BEGIN = slots::MainCharm; + static const int16 POSSESSIONS_END = slots::MainCursor; + + static const int16 EQUIPMENT_BEGIN = slots::MainCharm; + static const int16 EQUIPMENT_END = slots::MainAmmo; + static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; + + static const int16 GENERAL_BEGIN = slots::MainGeneral1; + static const int16 GENERAL_END = slots::MainGeneral8; + static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; + static const int16 GENERAL_BAGS_BEGIN = 262; + static const int16 GENERAL_BAGS_END_OFFSET = 79; + static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; + + static const int16 CURSOR = slots::MainCursor; + static const int16 CURSOR_BAG_BEGIN = 342; + static const int16 CURSOR_BAG_END_OFFSET = 9; + static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; + + static const int16 BANK_BEGIN = 2000; + static const int16 BANK_END = 2023; + static const int16 BANK_BAGS_BEGIN = 2032; + static const int16 BANK_BAGS_END_OFFSET = 239; + static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; + + static const int16 SHARED_BANK_BEGIN = 2500; + static const int16 SHARED_BANK_END = 2501; + static const int16 SHARED_BANK_BAGS_BEGIN = 2532; + static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; + static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; + + static const int16 TRADE_BEGIN = 3000; + static const int16 TRADE_END = 3007; + static const int16 TRADE_END_NPC = 3003; + static const int16 TRADE_BAGS_BEGIN = 3031; // no change from Ti? + static const int16 TRADE_BAGS_END_OFFSET = 79; + static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; + + static const int16 WORLD_BEGIN = 4000; + static const int16 WORLD_END = 4009; + + static const int16 TRIBUTE_BEGIN = 400; + static const int16 TRIBUTE_END = 404; + + static const int16 CORPSE_BEGIN = slots::MainGeneral1; + static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; + + static const uint16 ITEM_COMMON_SIZE = 5; + static const uint16 ITEM_CONTAINER_SIZE = 10; + + static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances + static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance + static const uint32 POTION_BELT_SIZE = 5; + } + + namespace limits { + static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; + static const bool COIN_HAS_WEIGHT = false; + } + +}; //end namespace SoD + +#endif /*SoD_CONSTANTS_H_*/ + +/* +SoD Notes: + ** Integer-based inventory ** +ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23]) +ok [Equipment: 0 - 22] +ok [General: 23 - 30] +ok [Cursor: 31] +ok General Bags: 262 - 341 +ok Cursor Bags: 342 - 351 + +ok Bank: 2000 - 2023 +ok Bank Bags: 2032 - 2271 + +ok Shared Bank: 2500 - 2501 +ok Shared Bank Bags: 2532 - 2551 + + Trade: 3000 - 3007 + (Trade Bags: 3031 - 3110 -- server values) + + World: 4000 - 4009 + +*/ diff --git a/common/patches/SoF_constants.h b/common/patches/SoF_constants.h new file mode 100644 index 000000000..b97d1fc71 --- /dev/null +++ b/common/patches/SoF_constants.h @@ -0,0 +1,218 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2014 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 SoF_CONSTANTS_H_ +#define SoF_CONSTANTS_H_ + +#include "../common/types.h" + +namespace SoF { + namespace maps { + typedef enum : int16 { + // this needs work to match actual client equivilents + MapPossessions = 0, + MapBank, + MapSharedBank, + MapTrade, + MapWorld, + MapLimbo, + MapTribute, + MapTrophyTribute, + MapGuildTribute, + MapMerchant, + MapDeleted, + MapCorpse, + MapBazaar, + MapInspect, + MapRealEstate, + MapViewMODPC, + MapViewMODBank, + MapViewMODSharedBank, + MapViewMODLimbo, + MapAltStorage, + MapArchived, + MapMail, + MapGuildTrophyTribute, + MapOther, + _MapCount + }; + } + + namespace slots { + typedef enum : int16 { + MainCharm = 0, + MainEar1, + MainHead, + MainFace, + MainEar2, + MainNeck, + MainShoulders, + MainArms, + MainBack, + MainWrist1, + MainWrist2, + MainRange, + MainHands, + MainPrimary, + MainSecondary, + MainFinger1, + MainFinger2, + MainChest, + MainLegs, + MainFeet, + MainWaist, + MainPowerSource, + MainAmmo, + MainGeneral1, + MainGeneral2, + MainGeneral3, + MainGeneral4, + MainGeneral5, + MainGeneral6, + MainGeneral7, + MainGeneral8, + MainCursor, + _MainCount, + _MainEquipmentBegin = MainCharm, + _MainEquipmentEnd = MainAmmo, + _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), + _MainGeneralBegin = MainGeneral1, + _MainGeneralEnd = MainGeneral8, + _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) + }; + } + + namespace consts { + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; + static const uint16 MAP_BANK_SIZE = 24; + static const uint16 MAP_SHARED_BANK_SIZE = 2; + static const uint16 MAP_TRADE_SIZE = 8; + static const uint16 MAP_WORLD_SIZE = 10; + static const uint16 MAP_LIMBO_SIZE = 36; + static const uint16 MAP_TRIBUTE_SIZE = 0; //? + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; + static const uint16 MAP_MERCHANT_SIZE = 0; + static const uint16 MAP_DELETED_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; + static const uint16 MAP_BAZAAR_SIZE = 80; + static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; + static const uint16 MAP_REAL_ESTATE_SIZE = 0; + static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; + static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; + static const uint16 MAP_ALT_STORAGE_SIZE = 0; + static const uint16 MAP_ARCHIVED_SIZE = 0; + static const uint16 MAP_MAIL_SIZE = 0; + static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_KRONO_SIZE = NOT_USED; + static const uint16 MAP_OTHER_SIZE = 0; + + static const int16 POSSESSIONS_BEGIN = slots::MainCharm; + static const int16 POSSESSIONS_END = slots::MainCursor; + + static const int16 EQUIPMENT_BEGIN = slots::MainCharm; + static const int16 EQUIPMENT_END = slots::MainAmmo; + static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; + + static const int16 GENERAL_BEGIN = slots::MainGeneral1; + static const int16 GENERAL_END = slots::MainGeneral8; + static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; + static const int16 GENERAL_BAGS_BEGIN = 262; + static const int16 GENERAL_BAGS_END_OFFSET = 79; + static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; + + static const int16 CURSOR = slots::MainCursor; + static const int16 CURSOR_BAG_BEGIN = 342; + static const int16 CURSOR_BAG_END_OFFSET = 9; + static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; + + static const int16 BANK_BEGIN = 2000; + static const int16 BANK_END = 2023; + static const int16 BANK_BAGS_BEGIN = 2032; + static const int16 BANK_BAGS_END_OFFSET = 239; + static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; + + static const int16 SHARED_BANK_BEGIN = 2500; + static const int16 SHARED_BANK_END = 2501; + static const int16 SHARED_BANK_BAGS_BEGIN = 2532; + static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; + static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; + + static const int16 TRADE_BEGIN = 3000; + static const int16 TRADE_END = 3007; + static const int16 TRADE_END_NPC = 3003; + static const int16 TRADE_BAGS_BEGIN = 3031; // no change from Ti? + static const int16 TRADE_BAGS_END_OFFSET = 79; + static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; + + static const int16 WORLD_BEGIN = 4000; + static const int16 WORLD_END = 4009; + + static const int16 TRIBUTE_BEGIN = 400; + static const int16 TRIBUTE_END = 404; + + static const int16 CORPSE_BEGIN = slots::MainGeneral1; + static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; + + static const uint16 ITEM_COMMON_SIZE = 5; + static const uint16 ITEM_CONTAINER_SIZE = 10; + + static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances + static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance + static const uint32 POTION_BELT_SIZE = 5; + } + + namespace limits { + static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; + static const bool COIN_HAS_WEIGHT = true; + } + +}; //end namespace SoF + +#endif /*SoF_CONSTANTS_H_*/ + +/* +SoF Notes: + ** Integer-based inventory ** +ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23]) +ok [Equipment: 0 - 22] +ok [General: 23 - 30] +ok [Cursor: 31] +ok General Bags: 262 - 341 +ok Cursor Bags: 342 - 351 + +ok Bank: 2000 - 2023 +ok Bank Bags: 2032 - 2271 + +ok Shared Bank: 2500 - 2501 +ok Shared Bank Bags: 2532 - 2551 + + Trade: 3000 - 3007 + (Trade Bags: 3031 - 3110 -- server values) + + World: 4000 - 4009 + +code file reviewed.. + ..SerializeItem() needs work + ..still needs timestamp redirect code +*/ diff --git a/common/patches/Titanium_constants.h b/common/patches/Titanium_constants.h new file mode 100644 index 000000000..9ee4b01f7 --- /dev/null +++ b/common/patches/Titanium_constants.h @@ -0,0 +1,214 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2014 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 Titanium_CONSTANTS_H_ +#define Titanium_CONSTANTS_H_ + +#include "../common/types.h" + +namespace Titanium { + namespace maps { + typedef enum : int16 { + // this needs work to match actual client equivilents + MapPossessions = 0, + MapBank, + MapSharedBank, + MapTrade, + MapWorld, + MapLimbo, + MapTribute, + MapTrophyTribute, + MapGuildTribute, + MapMerchant, + MapDeleted, + MapCorpse, + MapBazaar, + MapInspect, + MapRealEstate, + MapViewMODPC, + MapViewMODBank, + MapViewMODSharedBank, + MapViewMODLimbo, + MapAltStorage, + MapArchived, + MapMail, + MapGuildTrophyTribute, + MapOther, + _MapCount + }; + } + + namespace slots { + typedef enum : int16 { + MainCharm = 0, + MainEar1, + MainHead, + MainFace, + MainEar2, + MainNeck, + MainShoulders, + MainArms, + MainBack, + MainWrist1, + MainWrist2, + MainRange, + MainHands, + MainPrimary, + MainSecondary, + MainFinger1, + MainFinger2, + MainChest, + MainLegs, + MainFeet, + MainWaist, + MainAmmo, + MainGeneral1, + MainGeneral2, + MainGeneral3, + MainGeneral4, + MainGeneral5, + MainGeneral6, + MainGeneral7, + MainGeneral8, + MainCursor, + _MainCount, + _MainEquipmentBegin = MainCharm, + _MainEquipmentEnd = MainAmmo, + _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), + _MainGeneralBegin = MainGeneral1, + _MainGeneralEnd = MainGeneral8, + _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) + }; + } + + namespace consts { + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; + static const uint16 MAP_BANK_SIZE = 16; + static const uint16 MAP_SHARED_BANK_SIZE = 2; + static const uint16 MAP_TRADE_SIZE = 8; + static const uint16 MAP_WORLD_SIZE = 10; + static const uint16 MAP_LIMBO_SIZE = 36; + static const uint16 MAP_TRIBUTE_SIZE = 0; //? + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; + static const uint16 MAP_MERCHANT_SIZE = 0; + static const uint16 MAP_DELETED_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; + static const uint16 MAP_BAZAAR_SIZE = 80; + static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; + static const uint16 MAP_REAL_ESTATE_SIZE = 0; + static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; + static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; + static const uint16 MAP_ALT_STORAGE_SIZE = 0; + static const uint16 MAP_ARCHIVED_SIZE = 0; + static const uint16 MAP_MAIL_SIZE = 0; + static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_KRONO_SIZE = NOT_USED; + static const uint16 MAP_OTHER_SIZE = 0; + + static const int16 POSSESSIONS_BEGIN = slots::MainCharm; + static const int16 POSSESSIONS_END = slots::MainCursor; + + static const int16 EQUIPMENT_BEGIN = slots::MainCharm; + static const int16 EQUIPMENT_END = slots::MainAmmo; + static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; + + static const int16 GENERAL_BEGIN = slots::MainGeneral1; + static const int16 GENERAL_END = slots::MainGeneral8; + static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; + static const int16 GENERAL_BAGS_BEGIN = 251; + static const int16 GENERAL_BAGS_END_OFFSET = 79; + static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; + + static const int16 CURSOR = slots::MainCursor; + static const int16 CURSOR_BAG_BEGIN = 331; + static const int16 CURSOR_BAG_END_OFFSET = 9; + static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; + + static const int16 BANK_BEGIN = 2000; + static const int16 BANK_END = 2015; + static const int16 BANK_BAGS_BEGIN = 2031; + static const int16 BANK_BAGS_END_OFFSET = 159; + static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; + + static const int16 SHARED_BANK_BEGIN = 2500; + static const int16 SHARED_BANK_END = 2501; + static const int16 SHARED_BANK_BAGS_BEGIN = 2531; + static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; + static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; + + static const int16 TRADE_BEGIN = 3000; + static const int16 TRADE_END = 3007; + static const int16 TRADE_END_NPC = 3003; + static const int16 TRADE_BAGS_BEGIN = 3031; + static const int16 TRADE_BAGS_END_OFFSET = 79; + static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; + + static const int16 WORLD_BEGIN = 4000; + static const int16 WORLD_END = 4009; + + static const int16 TRIBUTE_BEGIN = 400; + static const int16 TRIBUTE_END = 404; + + static const int16 CORPSE_BEGIN = slots::MainGeneral1; + static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; + + static const uint16 ITEM_COMMON_SIZE = 5; + static const uint16 ITEM_CONTAINER_SIZE = 10; + + static const uint32 BANDOLIERS_COUNT = 4; // count = number of bandolier instances + static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance + static const uint32 POTION_BELT_SIZE = 4; + } + + namespace limits { + static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; + static const bool COIN_HAS_WEIGHT = true; + } + +}; //end namespace Titanium + +#endif /*Titanium_CONSTANTS_H_*/ + +/* +Titanium Notes: + ** Integer-based inventory ** +ok Possessions: 0 - 30 (Corpse: 22 - 52 [Offset 22]) +ok [Equipment: 0 - 21] +ok [General: 22 - 29] +ok [Cursor: 30] +ok General Bags: 251 - 330 +ok Cursor Bags: 331 - 340 + +ok Bank: 2000 - 2015 +ok Bank Bags: 2031 - 2190 + +ok Shared Bank: 2500 - 2501 +ok Shared Bank Bags: 2531 - 2550 + + Trade: 3000 - 3007 + (Trade Bags: 3031 - 3110 -- server values) + + World: 4000 - 4009 + +*/ diff --git a/common/patches/Underfoot_constants.h b/common/patches/Underfoot_constants.h new file mode 100644 index 000000000..91aaf4ebf --- /dev/null +++ b/common/patches/Underfoot_constants.h @@ -0,0 +1,215 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2014 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 Underfoot_CONSTANTS_H_ +#define Underfoot_CONSTANTS_H_ + +#include "../common/types.h" + +namespace Underfoot { + namespace maps { + typedef enum : int16 { + // this needs work to match actual client equivilents + MapPossessions = 0, + MapBank, + MapSharedBank, + MapTrade, + MapWorld, + MapLimbo, + MapTribute, + MapTrophyTribute, + MapGuildTribute, + MapMerchant, + MapDeleted, + MapCorpse, + MapBazaar, + MapInspect, + MapRealEstate, + MapViewMODPC, + MapViewMODBank, + MapViewMODSharedBank, + MapViewMODLimbo, + MapAltStorage, + MapArchived, + MapMail, + MapGuildTrophyTribute, + MapOther, + _MapCount + }; + } + + namespace slots { + typedef enum : int16 { + MainCharm = 0, + MainEar1, + MainHead, + MainFace, + MainEar2, + MainNeck, + MainShoulders, + MainArms, + MainBack, + MainWrist1, + MainWrist2, + MainRange, + MainHands, + MainPrimary, + MainSecondary, + MainFinger1, + MainFinger2, + MainChest, + MainLegs, + MainFeet, + MainWaist, + MainPowerSource, + MainAmmo, + MainGeneral1, + MainGeneral2, + MainGeneral3, + MainGeneral4, + MainGeneral5, + MainGeneral6, + MainGeneral7, + MainGeneral8, + MainCursor, + _MainCount, + _MainEquipmentBegin = MainCharm, + _MainEquipmentEnd = MainAmmo, + _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), + _MainGeneralBegin = MainGeneral1, + _MainGeneralEnd = MainGeneral8, + _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) + }; + } + + namespace consts { + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; + static const uint16 MAP_BANK_SIZE = 24; + static const uint16 MAP_SHARED_BANK_SIZE = 2; + static const uint16 MAP_TRADE_SIZE = 8; + static const uint16 MAP_WORLD_SIZE = 10; + static const uint16 MAP_LIMBO_SIZE = 36; + static const uint16 MAP_TRIBUTE_SIZE = 0; //? + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; + static const uint16 MAP_MERCHANT_SIZE = 0; + static const uint16 MAP_DELETED_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; + static const uint16 MAP_BAZAAR_SIZE = 80; + static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; + static const uint16 MAP_REAL_ESTATE_SIZE = 0; + static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; + static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; + static const uint16 MAP_ALT_STORAGE_SIZE = 0; + static const uint16 MAP_ARCHIVED_SIZE = 0; + static const uint16 MAP_MAIL_SIZE = 0; + static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_KRONO_SIZE = NOT_USED; + static const uint16 MAP_OTHER_SIZE = 0; + + static const int16 POSSESSIONS_BEGIN = slots::MainCharm; + static const int16 POSSESSIONS_END = slots::MainCursor; + + static const int16 EQUIPMENT_BEGIN = slots::MainCharm; + static const int16 EQUIPMENT_END = slots::MainAmmo; + static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; + + static const int16 GENERAL_BEGIN = slots::MainGeneral1; + static const int16 GENERAL_END = slots::MainGeneral8; + static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; + static const int16 GENERAL_BAGS_BEGIN = 262; + static const int16 GENERAL_BAGS_END_OFFSET = 79; + static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; + + static const int16 CURSOR = slots::MainCursor; + static const int16 CURSOR_BAG_BEGIN = 342; + static const int16 CURSOR_BAG_END_OFFSET = 9; + static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; + + static const int16 BANK_BEGIN = 2000; + static const int16 BANK_END = 2023; + static const int16 BANK_BAGS_BEGIN = 2032; + static const int16 BANK_BAGS_END_OFFSET = 239; + static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; + + static const int16 SHARED_BANK_BEGIN = 2500; + static const int16 SHARED_BANK_END = 2501; + static const int16 SHARED_BANK_BAGS_BEGIN = 2532; + static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; + static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; + + static const int16 TRADE_BEGIN = 3000; + static const int16 TRADE_END = 3007; + static const int16 TRADE_END_NPC = 3003; + static const int16 TRADE_BAGS_BEGIN = 3031; // no change from Ti? + static const int16 TRADE_BAGS_END_OFFSET = 79; + static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; + + static const int16 WORLD_BEGIN = 4000; + static const int16 WORLD_END = 4009; + + static const int16 TRIBUTE_BEGIN = 400; + static const int16 TRIBUTE_END = 404; + + static const int16 CORPSE_BEGIN = slots::MainGeneral1; + static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; + + static const uint16 ITEM_COMMON_SIZE = 5; + static const uint16 ITEM_CONTAINER_SIZE = 10; + + static const uint32 BANDOLIERS_COUNT = 20; // count = number of bandolier instances + static const uint32 BANDOLIER_SIZE = 4; // size = number of equipment slots in bandolier instance + static const uint32 POTION_BELT_SIZE = 5; + } + + namespace limits { + static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; + static const bool COIN_HAS_WEIGHT = false; + } + +}; //end namespace Underfoot + +#endif /*Underfoot_CONSTANTS_H_*/ + +/* +Underfoot Notes: + ** Integer-based inventory ** +ok Possessions: 0 - 31 (Corpse: 23 - 54 [Offset 23]) +ok [Equipment: 0 - 22] +ok [General: 23 - 30] +ok [Cursor: 31] +ok General Bags: 262 - 341 +ok Cursor Bags: 342 - 351 + +ok Bank: 2000 - 2023 +ok Bank Bags: 2032 - 2271 + +ok Shared Bank: 2500 - 2501 +ok Shared Bank Bags: 2532 - 2551 + + Trade: 3000 - 3007 + (Trade Bags: 3031 - 3110 -- server values) + + World: 4000 - 4009 + +*/ diff --git a/common/patches/makepatch b/common/patches/makepatch index c270e6f26..e28b4bc2a 100644 --- a/common/patches/makepatch +++ b/common/patches/makepatch @@ -5,7 +5,7 @@ if [ -z "$1" ]; then exit 1 fi -for ext in .cpp .h _ops.h _structs.h +for ext in .cpp .h _ops.h _constants.h _structs.h do cp template$ext $1$ext perl -pi -e "s/TEMPLATE/$1/g" $1$ext diff --git a/common/patches/patches.cpp b/common/patches/patches.cpp index 3261b3153..febb344d7 100644 --- a/common/patches/patches.cpp +++ b/common/patches/patches.cpp @@ -8,6 +8,7 @@ #include "SoF.h" #include "SoD.h" #include "RoF.h" +//#include "RoF2.h" void RegisterAllPatches(EQStreamIdentifier &into) { Client62::Register(into); @@ -16,6 +17,7 @@ void RegisterAllPatches(EQStreamIdentifier &into) { SoD::Register(into); Underfoot::Register(into); RoF::Register(into); + //RoF2::Register(into); } void ReloadAllPatches() { @@ -25,4 +27,5 @@ void ReloadAllPatches() { SoD::Reload(); Underfoot::Reload(); RoF::Reload(); + //RoF2::Reload(); } diff --git a/common/patches/template_constants.h b/common/patches/template_constants.h new file mode 100644 index 000000000..f8dbc39e8 --- /dev/null +++ b/common/patches/template_constants.h @@ -0,0 +1,20 @@ +#ifndef TEMPLATE_CONSTANTS_H_ +#define TEMPLATE_CONSTANTS_H_ + +namespace TEMPLATE { + + // put constants here and #include appropriately + +}; //end namespace TEMPLATE + +#endif /*TEMPLATE_CONSTANTS_H_*/ + + + + + + + + + + diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index 37b4c33e7..bf32a980c 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -824,17 +824,17 @@ void Client::AI_Process() if(GetTarget() && !IsStunned() && !IsMezzed() && !GetFeigned()) { if(attack_timer.Check()) { - Attack(GetTarget(), 13); + Attack(GetTarget(), MainPrimary); if(GetTarget()) { if(CheckDoubleAttack()) { - Attack(GetTarget(), 13); + Attack(GetTarget(), MainPrimary); if(GetTarget()) { bool triple_attack_success = false; if((((GetClass() == MONK || GetClass() == WARRIOR || GetClass() == RANGER || GetClass() == BERSERKER) && GetLevel() >= 60) || GetSpecialAbility(SPECATK_TRIPLE)) && CheckDoubleAttack(true)) { - Attack(GetTarget(), 13, true); + Attack(GetTarget(), MainPrimary, true); triple_attack_success = true; } @@ -848,8 +848,8 @@ void Client::AI_Process() if(MakeRandomInt(0, 100) < flurrychance) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); - Attack(GetTarget(), 13, false); - Attack(GetTarget(), 13, false); + Attack(GetTarget(), MainPrimary, false); + Attack(GetTarget(), MainPrimary, false); } } @@ -864,7 +864,7 @@ void Client::AI_Process() { if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus) { - Attack(GetTarget(), 13, false); + Attack(GetTarget(), MainPrimary, false); } } } @@ -903,10 +903,10 @@ void Client::AI_Process() if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability) { - Attack(GetTarget(), 14); + Attack(GetTarget(), MainSecondary); if(CheckDoubleAttack()) { - Attack(GetTarget(), 14); + Attack(GetTarget(), MainSecondary); } } @@ -1145,14 +1145,14 @@ void Mob::AI_Process() { if(IsNPC()) { int16 n_atk = CastToNPC()->GetNumberOfAttacks(); if(n_atk <= 1) { - Attack(target, 13); + Attack(target, MainPrimary); } else { for(int i = 0; i < n_atk; ++i) { - Attack(target, 13); + Attack(target, MainPrimary); } } } else { - Attack(target, 13); + Attack(target, MainPrimary); } if (target) { @@ -1164,16 +1164,16 @@ void Mob::AI_Process() { || GetSpecialAbility(SPECATK_QUAD)) //check double attack, this is NOT the same rules that clients use... && RandRoll < (GetLevel() + NPCDualAttackModifier)) { - Attack(target, 13); + Attack(target, MainPrimary); // 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, 13); + Attack(target, MainPrimary); // now lets check the quad attack if (GetSpecialAbility(SPECATK_QUAD) && RandRoll < (GetLevel() + NPCQuadAttackModifier)) { - Attack(target, 13); + Attack(target, MainPrimary); } } } @@ -1319,13 +1319,13 @@ void Mob::AI_Process() { float DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel()) / 400.0f; if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability) { - Attack(target, 14); + Attack(target, MainSecondary); if (CanThisClassDoubleAttack()) { int32 RandRoll = MakeRandomInt(0, 99); if (RandRoll < (GetLevel() + 20)) { - Attack(target, 14); + Attack(target, MainSecondary); } } } @@ -2024,7 +2024,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, 13, false, false, false, opts); + Attack(target, MainPrimary, false, false, false, opts); } return true; } @@ -2073,14 +2073,14 @@ bool Mob::Rampage(ExtraAttackOptions *opts) if (m_target == GetTarget()) continue; if (CombatRange(m_target)) { - Attack(m_target, 13, false, false, false, opts); + Attack(m_target, MainPrimary, false, false, false, opts); index_hit++; } } } if (RuleB(Combat, RampageHitsTarget) && index_hit < rampage_targets) - Attack(GetTarget(), 13, false, false, false, opts); + Attack(GetTarget(), MainPrimary, false, false, false, opts); return true; } @@ -2099,7 +2099,7 @@ void Mob::AreaRampage(ExtraAttackOptions *opts) index_hit = hate_list.AreaRampage(this, GetTarget(), rampage_targets, opts); if(index_hit == 0) { - Attack(GetTarget(), 13, false, false, false, opts); + Attack(GetTarget(), MainPrimary, false, false, false, opts); } } diff --git a/zone/Object.cpp b/zone/Object.cpp index 11bc8f317..216afbbf9 100644 --- a/zone/Object.cpp +++ b/zone/Object.cpp @@ -349,7 +349,7 @@ void Object::Close() { ItemInst* container = this->m_inst; if(container != nullptr) { - for (uint8 i = 0; i < MAX_ITEMS_PER_BAG; i++) + for (uint8 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { ItemInst* inst = container->PopItem(i); if(inst != nullptr) diff --git a/zone/attack.cpp b/zone/attack.cpp index 67f351e17..d1536a978 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -454,9 +454,9 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) if(damage > 0 && (aabonuses.TwoHandBluntBlock || spellbonuses.TwoHandBluntBlock || itembonuses.TwoHandBluntBlock) && (other->InFrontMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) { - bool equiped2 = CastToClient()->m_inv.GetItem(13); + bool equiped2 = CastToClient()->m_inv.GetItem(MainPrimary); if(equiped2) { - uint8 TwoHandBlunt = CastToClient()->m_inv.GetItem(13)->GetItem()->ItemType; + uint8 TwoHandBlunt = CastToClient()->m_inv.GetItem(MainPrimary)->GetItem()->ItemType; float bonusStaffBlock = 0.0f; if(TwoHandBlunt == ItemType2HBlunt) { @@ -4055,7 +4055,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, rangedattk = true; } - if (!weapon && hand == 11 && GetSpecialAbility(SPECATK_RANGED_ATK)) + if (!weapon && hand == MainRange && GetSpecialAbility(SPECATK_RANGED_ATK)) rangedattk = true; for (uint32 i = 0; i < MAX_PROCS; i++) { diff --git a/zone/beacon.h b/zone/beacon.h index 32709fdf2..0aad56e21 100644 --- a/zone/beacon.h +++ b/zone/beacon.h @@ -33,7 +33,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, 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 9fd8406b7..9829e3d4e 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -159,8 +159,8 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { } //tribute items - for (i = 0; i < MAX_PLAYER_TRIBUTES; i++) { - const ItemInst* inst = m_inv[TRIBUTE_SLOT_START + i]; + for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++) { + const ItemInst* inst = m_inv[EmuConstants::TRIBUTE_BEGIN + i]; if(inst == 0) continue; AddItemBonuses(inst, newbon, false, true); @@ -544,7 +544,7 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { bool food = false; bool drink = false; - for (i = 22; i <= 29; i++) + for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_BAGS_BEGIN; i++) { if (food && drink) break; @@ -560,7 +560,7 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { AddItemBonuses(inst, newbon); } } - for (i = 251; i <= 330; i++) + for (i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::GENERAL_BAGS_END; i++) { if (food && drink) break; diff --git a/zone/bot.cpp b/zone/bot.cpp index 31c496c3f..4bbe8cdb4 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3304,7 +3304,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes int damage = 0; uint32 hate = 0; - int Hand = 13; + int Hand = MainPrimary; if (hate == 0 && weapon_damage > 1) hate = weapon_damage; if(weapon_damage > 0){ @@ -4103,7 +4103,7 @@ void Bot::PetAIProcess() { int32 RandRoll = MakeRandomInt(0, 99); if (botPet->CanThisClassDoubleAttack() && (RandRoll < (botPet->GetLevel() + NPCDualAttackModifier))) { - if(botPet->Attack(botPet->GetTarget(), 13)) + if(botPet->Attack(botPet->GetTarget(), MainPrimary)) {} } } @@ -4145,13 +4145,13 @@ void Bot::PetAIProcess() { float DualWieldProbability = (botPet->GetSkill(SkillDualWield) + botPet->GetLevel()) / 400.0f; DualWieldProbability -= MakeRandomFloat(0, 1); if(DualWieldProbability < 0){ - botPet->Attack(botPet->GetTarget(), 14); + botPet->Attack(botPet->GetTarget(), MainSecondary); if (botPet->CanThisClassDoubleAttack()) { int32 RandRoll = MakeRandomInt(0, 99); if (RandRoll < (botPet->GetLevel() + 20)) { - botPet->Attack(botPet->GetTarget(), 14); + botPet->Attack(botPet->GetTarget(), MainSecondary); } } } @@ -8195,7 +8195,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { } } else { //We do a single regular attack if we attack from the front without chaotic stab - Attack(other, 13); + Attack(other, MainPrimary); } } @@ -12333,30 +12333,31 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { gearbot->BotRemoveEquipItem(slotId); gearbot->CalcBotStats(); switch(slotId) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 8: - case 9: - case 10: - case 11: - case 13: - case 14: - case 15: - case 16: - case 17: - case 20: - case 21: + case MainCharm: + case MainEar1: + case MainHead: + case MainFace: + case MainEar2: + case MainNeck: + case MainBack: + case MainWrist1: + case MainWrist2: + case MainRange: + case MainPrimary: + case MainSecondary: + case MainFinger1: + case MainFinger2: + case MainChest: + case MainWaist: + //case MainPowerSource: + case MainAmmo: gearbot->Say("My %s is now unequipped.", equipped[slotId]); break; - case 6: - case 7: - case 12: - case 18: - case 19: + case MainShoulders: + case MainArms: + case MainHands: + case MainLegs: + case MainFeet: gearbot->Say("My %s are now unequipped.", equipped[slotId]); break; default: @@ -12365,30 +12366,31 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } else { switch(slotId) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 8: - case 9: - case 10: - case 11: - case 13: - case 14: - case 15: - case 16: - case 17: - case 20: - case 21: + case MainCharm: + case MainEar1: + case MainHead: + case MainFace: + case MainEar2: + case MainNeck: + case MainBack: + case MainWrist1: + case MainWrist2: + case MainRange: + case MainPrimary: + case MainSecondary: + case MainFinger1: + case MainFinger2: + case MainChest: + case MainWaist: + //case MainPowerSource: + case MainAmmo: c->GetTarget()->Say("My %s is already unequipped.", equipped[slotId]); break; - case 6: - case 7: - case 12: - case 18: - case 19: + case MainShoulders: + case MainArms: + case MainHands: + case MainLegs: + case MainFeet: c->GetTarget()->Say("My %s are already unequipped.", equipped[slotId]); break; default: diff --git a/zone/bot.h b/zone/bot.h index 493f43683..eba10a54e 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -137,7 +137,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, 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/client.cpp b/zone/client.cpp index 60ec66d29..0d3a8e683 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4141,14 +4141,14 @@ void Client::UpdateLFP() { uint16 Client::GetPrimarySkillValue() { SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill - bool equiped = m_inv.GetItem(13); + bool equiped = m_inv.GetItem(MainPrimary); if (!equiped) skill = SkillHandtoHand; else { - uint8 type = m_inv.GetItem(13)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(MainPrimary)->GetItem()->ItemType; //is this the best way to do this? switch (type) { @@ -5702,7 +5702,7 @@ void Client::AddCrystals(uint32 Radiant, uint32 Ebon) SendCrystalCounts(); } -// Processes a client request to inspect a SoF client's equipment. +// Processes a client request to inspect a SoF+ client's equipment. void Client::ProcessInspectRequest(Client* requestee, Client* requester) { if(requestee && requester) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_InspectAnswer, sizeof(InspectResponse_Struct)); @@ -5727,28 +5727,30 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { } } - inst = requestee->GetInv().GetItem(9999); + inst = requestee->GetInv().GetItem(MainPowerSource); if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[21], item->Name); - insr->itemicons[21] = item->Icon; + // 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::slots::MainPowerSource], item->Name); + insr->itemicons[SoF::slots::MainPowerSource] = item->Icon; } else - insr->itemicons[21] = 0xFFFFFFFF; + insr->itemicons[SoF::slots::MainPowerSource] = 0xFFFFFFFF; } - inst = requestee->GetInv().GetItem(21); + inst = requestee->GetInv().GetItem(MainAmmo); if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[22], item->Name); - insr->itemicons[22] = item->Icon; + strcpy(insr->itemnames[SoF::slots::MainAmmo], item->Name); + insr->itemicons[SoF::slots::MainAmmo] = item->Icon; } else - insr->itemicons[22] = 0xFFFFFFFF; + insr->itemicons[SoF::slots::MainAmmo] = 0xFFFFFFFF; } strcpy(insr->text, requestee->GetInspectMessage().text); @@ -6277,8 +6279,8 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid made_npc->PR = GetPR(); made_npc->Corrup = GetCorrup(); // looks - made_npc->texture = GetEquipmentMaterial(1); - made_npc->helmtexture = GetEquipmentMaterial(0); + made_npc->texture = GetEquipmentMaterial(MaterialChest); + made_npc->helmtexture = GetEquipmentMaterial(MaterialHead); made_npc->haircolor = GetHairColor(); made_npc->beardcolor = GetBeardColor(); made_npc->eyecolor1 = GetEyeColor1(); @@ -6289,9 +6291,9 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid made_npc->drakkin_heritage = GetDrakkinHeritage(); made_npc->drakkin_tattoo = GetDrakkinTattoo(); made_npc->drakkin_details = GetDrakkinDetails(); - made_npc->d_meele_texture1 = GetEquipmentMaterial(7); - made_npc->d_meele_texture2 = GetEquipmentMaterial(8); - for (int i = 0; i < _MaterialCount; i++) { + made_npc->d_meele_texture1 = GetEquipmentMaterial(MaterialPrimary); + made_npc->d_meele_texture2 = GetEquipmentMaterial(MaterialSecondary); + for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) { made_npc->armor_tint[i] = GetEquipmentColor(i); } made_npc->loottable_id = 0; @@ -7829,17 +7831,17 @@ void Client::TickItemCheck() if(zone->tick_items.empty()) { return; } //Scan equip slots for items - for(i = 0; i <= 21; i++) + for(i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) { TryItemTick(i); } //Scan main inventory + cursor - for(i = 22; i < 31; i++) + for(i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::CURSOR; i++) { TryItemTick(i); } //Scan bags - for(i = 251; i < 340; i++) + for(i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++) { TryItemTick(i); } @@ -7863,9 +7865,9 @@ void Client::TryItemTick(int slot) } //Only look at augs in main inventory - if(slot > 21) { return; } + if(slot > EmuConstants::EQUIPMENT_END) { return; } - for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x) + for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x) { ItemInst * a_inst = inst->GetAugment(x); if(!a_inst) { continue; } @@ -7886,17 +7888,17 @@ void Client::TryItemTick(int slot) void Client::ItemTimerCheck() { int i; - for(i = 0; i <= 21; i++) + for(i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) { TryItemTimer(i); } - for(i = 22; i < 31; i++) + for(i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::CURSOR; i++) { TryItemTimer(i); } - for(i = 251; i < 340; i++) + for(i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++) { TryItemTimer(i); } @@ -7918,11 +7920,11 @@ void Client::TryItemTimer(int slot) ++it_iter; } - if(slot > 21) { + if(slot > EmuConstants::EQUIPMENT_END) { return; } - for (int x = 0; x < EmuConstants::ITEM_COMMON_SIZE; ++x) + for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x) { ItemInst * a_inst = inst->GetAugment(x); if(!a_inst) { diff --git a/zone/client.h b/zone/client.h index 70528b98e..9423ac535 100644 --- a/zone/client.h +++ b/zone/client.h @@ -214,7 +214,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, 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/client_mods.cpp b/zone/client_mods.cpp index 0ead2cdfe..f62c6f5c2 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -873,9 +873,9 @@ int16 Client::CalcAC() { // Shield AC bonus for HeroicSTR if(itembonuses.HeroicSTR) { - bool equiped = CastToClient()->m_inv.GetItem(14); + bool equiped = CastToClient()->m_inv.GetItem(MainSecondary); if(equiped) { - uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType; + uint8 shield = CastToClient()->m_inv.GetItem(MainSecondary)->GetItem()->ItemType; if(shield == ItemTypeShield) displayed += itembonuses.HeroicSTR/2; } @@ -903,9 +903,9 @@ int16 Client::GetACMit() { // Shield AC bonus for HeroicSTR if(itembonuses.HeroicSTR) { - bool equiped = CastToClient()->m_inv.GetItem(14); + bool equiped = CastToClient()->m_inv.GetItem(MainSecondary); if(equiped) { - uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType; + uint8 shield = CastToClient()->m_inv.GetItem(MainSecondary)->GetItem()->ItemType; if(shield == ItemTypeShield) mitigation += itembonuses.HeroicSTR/2; } @@ -1127,7 +1127,7 @@ uint32 Client::CalcCurrentWeight() { ItemInst* ins; uint32 Total = 0; int x; - for(x = 0; x <= 30; x++) + for(x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::CURSOR; x++) // include cursor or not? { TempItem = 0; ins = GetInv().GetItem(x); @@ -1136,7 +1136,7 @@ uint32 Client::CalcCurrentWeight() { if (TempItem) Total += TempItem->Weight; } - for (x = 251; x < 331; x++) + for (x = EmuConstants::GENERAL_BAGS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) // include cursor bags or not? { int TmpWeight = 0; TempItem = 0; @@ -1147,9 +1147,11 @@ uint32 Client::CalcCurrentWeight() { TmpWeight = TempItem->Weight; if (TmpWeight > 0) { - int bagslot = 22; + // this code indicates that weight redux bags canonly 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 = MainGeneral1; int reduction = 0; - for (int m = 261; m < 331; m += 10) + for (int m = MainGeneral2; m <= EmuConstants::GENERAL_BAGS_END; m += 10) // include cursor bags or not? { if (x >= m) bagslot += 1; @@ -1172,10 +1174,9 @@ uint32 Client::CalcCurrentWeight() { This is the ONLY instance I have seen where the client is hard coded to particular Item IDs to set a certain property for an item. It is very odd. */ - // SoD client has no weight for coin - if (GetClientVersion() < EQClientSoD) { + // SoD+ client has no weight for coin + if (EQLimits::CoinHasWeight(ClientVersion)) Total += (m_pp.platinum + m_pp.gold + m_pp.silver + m_pp.copper) / 4; - } float Packrat = (float)spellbonuses.Packrat + (float)aabonuses.Packrat + (float)itembonuses.Packrat; if (Packrat > 0) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f370f2420..314e82513 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -386,6 +386,7 @@ void MapOpcodes() { ConnectedOpcodes[OP_MercenaryTimerRequest] = &Client::Handle_OP_MercenaryTimerRequest; ConnectedOpcodes[OP_OpenInventory] = &Client::Handle_OP_OpenInventory; ConnectedOpcodes[OP_OpenContainer] = &Client::Handle_OP_OpenContainer; + ConnectedOpcodes[OP_ClientTimeStamp] = &Client::Handle_OP_ClientTimeStamp; } void ClearMappedOpcode(EmuOpcode op) { @@ -1629,7 +1630,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; - ItemInst* inst = GetInv().GetItem(14); + ItemInst* inst = GetInv().GetItem(MainSecondary); if (!shield_target) return; if (inst) @@ -3259,7 +3260,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 < 30 || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) + if(mi->from_slot != mi->to_slot && (mi->from_slot <= EmuConstants::GENERAL_END || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) { char *detect = nullptr; const ItemInst *itm_from = GetInv().GetItem(mi->from_slot); @@ -3280,8 +3281,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) // Illegal bagslot useage checks. Currently, user only receives a message if this check is triggered. bool mi_hack = false; - if(mi->from_slot >= 251 && mi->from_slot <= 340) { - if(mi->from_slot > 330) { mi_hack = true; } + if(mi->from_slot >= EmuConstants::GENERAL_BAGS_BEGIN && mi->from_slot <= EmuConstants::CURSOR_BAG_END) { + if(mi->from_slot >= EmuConstants::CURSOR_BAG_BEGIN) { mi_hack = true; } else { int16 from_parent = m_inv.CalcSlotId(mi->from_slot); if(!m_inv[from_parent]) { mi_hack = true; } @@ -3290,8 +3291,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } } - if(mi->to_slot >= 251 && mi->to_slot <= 340) { - if(mi->to_slot > 330) { mi_hack = true; } + if(mi->to_slot >= EmuConstants::GENERAL_BAGS_BEGIN && mi->to_slot <= EmuConstants::CURSOR_BAG_END) { + if(mi->to_slot >= EmuConstants::CURSOR_BAG_BEGIN) { mi_hack = true; } else { int16 to_parent = m_inv.CalcSlotId(mi->to_slot); if(!m_inv[to_parent]) { mi_hack = true; } @@ -6782,7 +6783,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { for (int16 L = 0; L <= 20; L++) { const ItemInst* inst = GetInv().GetItem(L); - item = inst ? inst->GetItem() : nullptr; + item = inst ? inst->GetItem() : nullptr; if(item) { strcpy(insr->itemnames[L], item->Name); @@ -6791,14 +6792,15 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { else { insr->itemicons[L] = 0xFFFFFFFF; } } - const ItemInst* inst = GetInv().GetItem(21); + const ItemInst* inst = GetInv().GetItem(MainAmmo); item = inst ? inst->GetItem() : nullptr; if(item) { - strcpy(insr->itemnames[22], item->Name); - insr->itemicons[22] = item->Icon; + // another one..I did these, didn't I!!? + strcpy(insr->itemnames[SoF::slots::MainAmmo], item->Name); + insr->itemicons[SoF::slots::MainAmmo] = item->Icon; } - else { insr->itemicons[22] = 0xFFFFFFFF; } + else { insr->itemicons[SoF::slots::MainAmmo] = 0xFFFFFFFF; } InspectMessage_Struct* newmessage = (InspectMessage_Struct*) insr->text; InspectMessage_Struct& playermessage = this->GetInspectMessage(); @@ -13866,3 +13868,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) { // SideNote: Watching the slot translations, Unknown1 is showing '141' as well on certain item swaps. // Manually looting a corpse results in a from '34' to '68' value for equipment items, '0' to '0' for inventory. } + +void Client::Handle_OP_ClientTimeStamp(const EQApplicationPacket *app) { + // handle as needed or ignore like we have been doing... +} diff --git a/zone/client_packet.h b/zone/client_packet.h index 22e8f92f4..1b687edb9 100644 --- a/zone/client_packet.h +++ b/zone/client_packet.h @@ -288,3 +288,4 @@ void Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app); void Handle_OP_OpenInventory(const EQApplicationPacket *app); void Handle_OP_OpenContainer(const EQApplicationPacket *app); + void Handle_OP_ClientTimeStamp(const EQApplicationPacket *app); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index d5abb7f04..19449dbbf 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -402,10 +402,10 @@ bool Client::Process() { { entity_list.AEAttack(this, 30); } else { - Attack(auto_attack_target, 13); // Kaiyodo - added attacking hand to arguments + Attack(auto_attack_target, MainPrimary); // Kaiyodo - added attacking hand to arguments } ItemInst *wpn = GetInv().GetItem(MainPrimary); - TryWeaponProc(wpn, auto_attack_target, 13); + TryWeaponProc(wpn, auto_attack_target, MainPrimary); bool tripleAttackSuccess = false; if( auto_attack_target && CanThisClassDoubleAttack() ) { @@ -416,7 +416,7 @@ bool Client::Process() { if(CheckAAEffect(aaEffectRampage)) { entity_list.AEAttack(this, 30); } else { - Attack(auto_attack_target, 13, false); + Attack(auto_attack_target, MainPrimary, false); } } @@ -426,13 +426,13 @@ bool Client::Process() { && CheckDoubleAttack(true)) { tripleAttackSuccess = true; - Attack(auto_attack_target, 13, false); + Attack(auto_attack_target, MainPrimary, false); } //quad attack, does this belong here?? if(GetSpecialAbility(SPECATK_QUAD) && CheckDoubleAttack(true)) { - Attack(auto_attack_target, 13, false); + Attack(auto_attack_target, MainPrimary, false); } } @@ -444,8 +444,8 @@ bool Client::Process() { if(MakeRandomInt(0, 99) < flurrychance) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); - Attack(auto_attack_target, 13, false); - Attack(auto_attack_target, 13, false); + Attack(auto_attack_target, MainPrimary, false); + Attack(auto_attack_target, MainPrimary, false); } } @@ -460,7 +460,7 @@ bool Client::Process() { { if(MakeRandomInt(0, 99) < ExtraAttackChanceBonus) { - Attack(auto_attack_target, 13, false); + Attack(auto_attack_target, MainPrimary, false); } } } @@ -507,19 +507,19 @@ bool Client::Process() { CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10); if (random < DualWieldProbability){ // Max 78% of DW if(CheckAAEffect(aaEffectRampage)) { - entity_list.AEAttack(this, 30, 14); + entity_list.AEAttack(this, 30, MainSecondary); } else { - Attack(auto_attack_target, 14); // Single attack with offhand + Attack(auto_attack_target, MainSecondary); // Single attack with offhand } ItemInst *wpn = GetInv().GetItem(MainSecondary); - TryWeaponProc(wpn, auto_attack_target, 14); + TryWeaponProc(wpn, auto_attack_target, MainSecondary); if( CanThisClassDoubleAttack() && CheckDoubleAttack()) { if(CheckAAEffect(aaEffectRampage)) { - entity_list.AEAttack(this, 30, 14); + entity_list.AEAttack(this, 30, MainSecondary); } else { if(auto_attack_target && auto_attack_target->GetHP() > -10) - Attack(auto_attack_target, 14); // Single attack with offhand + Attack(auto_attack_target, MainSecondary); // Single attack with offhand } } } @@ -878,9 +878,9 @@ void Client::BulkSendInventoryItems() { // Power Source if(GetClientVersion() >= EQClientSoF) { - const ItemInst* inst = m_inv[9999]; + const ItemInst* inst = m_inv[MainPowerSource]; if(inst) { - std::string packet = inst->Serialize(9999); + std::string packet = inst->Serialize(MainPowerSource); ser_items[i++] = packet; size += packet.length(); } diff --git a/zone/command.cpp b/zone/command.cpp index dbc368546..ad485391a 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2957,9 +2957,9 @@ void command_peekinv(Client *c, const Seperator *sep) } if(c->GetClientVersion() >= EQClientSoF) { - const ItemInst* inst = client->GetInv().GetItem(9999); + const ItemInst* inst = client->GetInv().GetItem(MainPowerSource); item = (inst) ? inst->GetItem() : nullptr; - c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", 9999, + c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", MainPowerSource, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), ((item==0)?"null":item->Name), 0x12, ((item==0)?0:inst->GetCharges())); @@ -3034,7 +3034,7 @@ void command_peekinv(Client *c, const Seperator *sep) if (bAll || (strcasecmp(sep->arg[1], "trib")==0)) { // Active tribute effect items bFound = true; - for (int16 i=TRIBUTE_SLOT_START; i<(TRIBUTE_SLOT_START + MAX_PLAYER_TRIBUTES); i++) { + for (int16 i = EmuConstants::TRIBUTE_BEGIN; i <= EmuConstants::TRIBUTE_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; if (c->GetClientVersion() >= EQClientSoF) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 031bdcec8..4a9ba5541 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -367,9 +367,9 @@ Corpse::Corpse(Client* client, int32 in_rezexp) for(i = 0; i <= 30; i++) { if(i == 21 && client->GetClientVersion() >= EQClientSoF) { - item = client->GetInv().GetItem(9999); + item = client->GetInv().GetItem(MainPowerSource); if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { - std::list slot_list = MoveItemToCorpse(client, item, 9999); + std::list slot_list = MoveItemToCorpse(client, item, MainPowerSource); removed_list.merge(slot_list); } @@ -999,12 +999,8 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a end = itemlist.end(); uint8 containercount = 0; - int corpselootlimit; - if(client->GetClientVersion() >= EQClientRoF) { corpselootlimit = 34; } - else if(client->GetClientVersion() >= EQClientSoF) { corpselootlimit = 32; } - else if(client->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; } - else { corpselootlimit = 30; } + int corpselootlimit = EQLimits::InventoryMapSize(MapCorpse, client->GetClientVersion()); for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; @@ -1331,17 +1327,13 @@ void Corpse::QueryLoot(Client* to) { cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit; - - if (to->GetClientVersion() >= EQClientSoF) { corpselootlimit = 32; } - else if (to->GetClientVersion() == EQClientTitanium) { corpselootlimit = 31; } - else { corpselootlimit = 30; } + int corpselootlimit = EQLimits::InventoryMapSize(MapCorpse, to->GetClientVersion()); for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; if (IsPlayerCorpse()) { - if (sitem->equipSlot >= 251 && sitem->equipSlot <= 340) + if (sitem->equipSlot >= EmuConstants::GENERAL_BAGS_BEGIN && sitem->equipSlot <= EmuConstants::CURSOR_BAG_END) sitem->lootslot = 0xFFFF; else x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; diff --git a/zone/corpse.h b/zone/corpse.h index b9999e79b..cc274a319 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -41,7 +41,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } diff --git a/zone/entity.h b/zone/entity.h index ede4b3bea..8b94b0e0a 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -305,7 +305,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 = 13, int count = 0, bool IsFromSpell = false); + void AEAttack(Mob *attacker, float dist, int Hand = MainPrimary, int count = 0, bool IsFromSpell = false); void AETaunt(Client *caster, float range = 0); void AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true, int16 resist_adjust = 0); void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); diff --git a/zone/forage.cpp b/zone/forage.cpp index 637b4c895..4f8d17c0c 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -301,7 +301,7 @@ void Client::GoFish() Bait = m_inv.GetItem(bslot); //if the bait isnt equipped, need to add its skill bonus - if(bslot >= IDX_INV && Bait->GetItem()->SkillModType == SkillFishing) { + if(bslot >= EmuConstants::GENERAL_BEGIN && Bait->GetItem()->SkillModType == SkillFishing) { fishing_skill += Bait->GetItem()->SkillModValue; } @@ -393,7 +393,7 @@ void Client::GoFish() //and then swap out items in primary slot... too lazy to fix right now if (MakeRandomInt(0, 49) == 1) { Message_StringID(MT_Skills, FISHING_POLE_BROKE); //Your fishing pole broke! - DeleteItemInInventory(13,0,true); + DeleteItemInInventory(MainPrimary, 0, true); } if(CheckIncreaseSkill(SkillFishing, nullptr, 5)) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index abe32b5a7..bb39d224a 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -545,7 +545,7 @@ int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOption if(cur) { for(int i = 0; i < count; ++i) { - caster->Attack(cur, 13, false, false, false, opts); + caster->Attack(cur, MainPrimary, false, false, false, opts); } } iter++; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index fb4315292..553a2f456 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -44,7 +44,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { int i; if(where_to_check & invWhereWorn) { - for (i=0; i<=21; i++) { // Equipped + for (i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -57,9 +57,8 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - // Power Source Slot - if (GetItemIDAt(9999) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(9999) != INVALID_ID)) { - cur = m_inv.GetItem(9999); + if (GetItemIDAt(MainPowerSource) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(MainPowerSource) != INVALID_ID)) { + cur = m_inv.GetItem(MainPowerSource); if(cur && cur->GetItem()->Stackable) { x += cur->GetCharges(); } else { @@ -67,25 +66,25 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if (GetClientVersion() >= EQClientSoF) - DeleteItemInInventory(9999, 0, true); + DeleteItemInInventory(MainPowerSource, 0, true); else - DeleteItemInInventory(9999, 0, false); // Prevents Titanium crash + DeleteItemInInventory(MainPowerSource, 0, false); // Prevents Titanium crash } } if(where_to_check & invWhereCursor) { - if (GetItemIDAt(30) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(30) != INVALID_ID)) { - cur = m_inv.GetItem(30); + if (GetItemIDAt(MainCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(MainCursor) != INVALID_ID)) { + cur = m_inv.GetItem(MainCursor); if(cur && cur->GetItem()->Stackable) { x += cur->GetCharges(); } else { x++; } - DeleteItemInInventory(30, 0, true); + DeleteItemInInventory(MainCursor, 0, true); } - for (i=331; i<=340; i++) { // cursor's containers + for (i = EmuConstants::CURSOR_BAG_BEGIN; i <= EmuConstants::CURSOR_BAG_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -100,7 +99,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if(where_to_check & invWherePersonal) { - for (i=22; i<=29; i++) { // Equipped + for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -113,7 +112,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - for (i=251; i<=330; i++) { // Main inventory's containers + for (i = EmuConstants::GENERAL_BAGS_BEGIN; i <= EmuConstants::GENERAL_BAGS_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -128,7 +127,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if(where_to_check & invWhereBank) { - for (i=2000; i<=2023; i++) { // Bank slots + for (i = EmuConstants::BANK_BEGIN; i <= EmuConstants::BANK_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -141,7 +140,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - for (i=2031; i<=2270; i++) { // Bank's containers + for (i = EmuConstants::BANK_BAGS_BEGIN; i <= EmuConstants::BANK_BAGS_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -156,7 +155,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if(where_to_check & invWhereSharedBank) { - for (i=2500; i<=2501; i++) { // Shared bank + for (i = EmuConstants::SHARED_BANK_BEGIN; i <= EmuConstants::SHARED_BANK_END; i++) { if (GetItemIDAt(i) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(i) != INVALID_ID)) { cur = m_inv.GetItem(i); if(cur && cur->GetItem()->Stackable) { @@ -169,7 +168,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - for (i=2531; i<=2550; i++) { // Shared bank's containers + for (i = EmuConstants::SHARED_BANK_BAGS_BEGIN; i <= EmuConstants::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) { @@ -1225,17 +1224,17 @@ void Client::SendLootItemInPacket(const ItemInst* inst, int16 slot_id) } bool Client::IsValidSlot(uint32 slot) { - if ((slot == (uint32)INVALID_INDEX) || // Destroying/Dropping item - (slot >= MainCharm && slot <= MainCursor) || // Worn inventory, normal inventory, and cursor - (slot >= 251 && slot <= 340) || // Normal inventory bags and cursor bag - (slot >= 400 && slot <= 404) || // Tribute - (slot >= 2000 && slot <= 2023) || // Bank - (slot >= 2031 && slot <= 2270) || // Bank bags - (slot >= 2500 && slot <= 2501) || // Shared bank - (slot >= 2531 && slot <= 2550) || // Shared bank bags - (slot >= 3000 && slot <= 3007) || // Trade window - (slot >= 4000 && slot <= 4009) || // Tradeskill container - (slot == MainPowerSource)) // Power Source + if ((slot == (uint32)INVALID_INDEX) || + (slot >= EmuConstants::POSSESSIONS_BEGIN && slot <= EmuConstants::POSSESSIONS_END) || + (slot >= EmuConstants::GENERAL_BAGS_BEGIN && slot <= EmuConstants::CURSOR_BAG_END) || + (slot >= EmuConstants::TRIBUTE_BEGIN && slot <= EmuConstants::TRIBUTE_END) || + (slot >= EmuConstants::BANK_BEGIN && slot <= EmuConstants::BANK_END) || + (slot >= EmuConstants::BANK_BAGS_BEGIN && slot <= EmuConstants::BANK_BAGS_END) || + (slot >= EmuConstants::SHARED_BANK_BEGIN && slot <= EmuConstants::SHARED_BANK_END) || + (slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot <= EmuConstants::SHARED_BANK_BAGS_END) || + (slot >= EmuConstants::TRADE_BEGIN && slot <= EmuConstants::TRADE_END) || + (slot >= EmuConstants::WORLD_BEGIN && slot <= EmuConstants::WORLD_END) || + (slot == EmuConstants::POWER_SOURCE)) return true; else return false; @@ -1945,10 +1944,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { ItemInst* ins; int x; int num = 0; - for(x=0; x < 331; x++) + for(x = EmuConstants::POSSESSIONS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) { - if (x == 31) - x = 251; + if (x == EmuConstants::CURSOR + 1) + x = EmuConstants::GENERAL_BAGS_BEGIN; TempItem = 0; ins = GetInv().GetItem(x); if (ins) @@ -1962,10 +1961,10 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { } if (num < amt) return false; - for(x=0; x < 331; x++) + for(x = EmuConstants::POSSESSIONS_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) // should this be CURSOR_BAG_END { - if (x == 31) - x = 251; + if (x == EmuConstants::CURSOR + 1) + x = EmuConstants::GENERAL_BAGS_BEGIN; TempItem = 0; ins = GetInv().GetItem(x); if (ins) @@ -1994,7 +1993,7 @@ void Client::RemoveNoRent(bool client_update) { int16 slot_id; // personal - for(slot_id = 0; slot_id <= 30; slot_id++) { + for(slot_id = EmuConstants::POSSESSIONS_BEGIN; slot_id <= EmuConstants::POSSESSIONS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2003,14 +2002,14 @@ void Client::RemoveNoRent(bool client_update) { } // power source - const ItemInst* inst = m_inv[9999]; + const ItemInst* inst = m_inv[EmuConstants::POWER_SOURCE]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent + mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EmuConstants::POWER_SOURCE); + DeleteItemInInventory(EmuConstants::POWER_SOURCE, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } // containers - for(slot_id = 251; slot_id <= 340; slot_id++) { + for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2019,7 +2018,7 @@ void Client::RemoveNoRent(bool client_update) { } // bank - for(slot_id = 2000; slot_id <= 2023; slot_id++) { + for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2028,7 +2027,7 @@ void Client::RemoveNoRent(bool client_update) { } // bank containers - for(slot_id = 2031; slot_id <= 2270; slot_id++) { + for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2037,7 +2036,7 @@ void Client::RemoveNoRent(bool client_update) { } // shared bank - for(slot_id = 2500; slot_id <= 2501; slot_id++) { + for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2046,7 +2045,7 @@ void Client::RemoveNoRent(bool client_update) { } // shared bank containers - for(slot_id = 2531; slot_id <= 2550; slot_id++) { + for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); @@ -2061,7 +2060,7 @@ void Client::RemoveDuplicateLore(bool client_update) { int16 slot_id; // personal - for(slot_id = 0; slot_id <= 30; slot_id++) { + for(slot_id = EmuConstants::POSSESSIONS_BEGIN; slot_id <= EmuConstants::POSSESSIONS_END; slot_id++) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { @@ -2076,20 +2075,20 @@ void Client::RemoveDuplicateLore(bool client_update) { } // power source - ItemInst* inst = m_inv.PopItem(9999); + ItemInst* inst = m_inv.PopItem(EmuConstants::POWER_SOURCE); if(inst) { if(CheckLoreConflict(inst->GetItem())) { mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - database.SaveInventory(character_id, nullptr, 9999); + database.SaveInventory(character_id, nullptr, EmuConstants::POWER_SOURCE); } else { - m_inv.PutItem(9999, *inst); + m_inv.PutItem(EmuConstants::POWER_SOURCE, *inst); } safe_delete(inst); } // containers - for(slot_id = 251; slot_id <= 340; slot_id++) { + for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { @@ -2104,7 +2103,7 @@ void Client::RemoveDuplicateLore(bool client_update) { } // bank - for(slot_id = 2000; slot_id <= 2023; slot_id++) { + for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { @@ -2119,7 +2118,7 @@ void Client::RemoveDuplicateLore(bool client_update) { } // bank containers - for(slot_id = 2031; slot_id <= 2270; slot_id++) { + for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { @@ -2141,7 +2140,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { int16 slot_id; // equipment - for(slot_id = 0; slot_id <= 21; slot_id++) { + for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; @@ -2154,7 +2153,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { } // power source - slot_id = 9999; + slot_id = EmuConstants::POWER_SOURCE; if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 3a1a7154c..477e90648 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1453,13 +1453,13 @@ luabind::scope lua_register_slot() { luabind::value("General8", static_cast(MainGeneral8)), //luabind::value("General9", static_cast(MainGeneral9)), //luabind::value("General10", static_cast(MainGeneral10)), + luabind::value("Cursor", static_cast(MainCursor)), //luabind::value("EquipmentBegin", static_cast(EmuConstants::EQUIPMENT_BEGIN)), //luabind::value("EquipmentEnd", static_cast(EmuConstants::EQUIPMENT_END)), luabind::value("PersonalBegin", static_cast(EmuConstants::GENERAL_BEGIN)), // deprecated luabind::value("GeneralBegin", static_cast(EmuConstants::GENERAL_BEGIN)), luabind::value("PersonalEnd", static_cast(EmuConstants::GENERAL_END)), // deprecated luabind::value("GeneralEnd", static_cast(EmuConstants::GENERAL_END)), - luabind::value("Cursor", static_cast(MainCursor)), luabind::value("CursorEnd", 0xFFFE), // deprecated luabind::value("Tradeskill", static_cast(SLOT_TRADESKILL)), // deprecated luabind::value("Augment", static_cast(SLOT_AUGMENT)), // deprecated @@ -1483,6 +1483,7 @@ luabind::scope lua_register_material() { luabind::value("Secondary", static_cast(MaterialSecondary)), luabind::value("Max", static_cast(_MaterialCount)), // deprecated luabind::value("Count", static_cast(_MaterialCount)), + //luabind::value("TintCount", static_cast(_MaterialCount - 2)), luabind::value("Invalid", static_cast(_MaterialInvalid)) ]; } @@ -1497,7 +1498,8 @@ luabind::scope lua_register_client_version() { luabind::value("SoF", static_cast(EQClientSoF)), luabind::value("SoD", static_cast(EQClientSoD)), luabind::value("Underfoot", static_cast(EQClientUnderfoot)), - luabind::value("RoF", static_cast(EQClientRoF)) + luabind::value("RoF", static_cast(EQClientRoF))//, + //luabind::value("RoF2", static_cast(EQClientRoF2)) ]; } diff --git a/zone/merc.cpp b/zone/merc.cpp index ebf46c180..2a879ecf9 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -277,7 +277,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { //Power Source Slot /*if (GetClientVersion() >= EQClientSoF) { - const ItemInst* inst = m_inv[9999]; + const ItemInst* inst = m_inv[MainPowerSource]; if(inst) AddItemBonuses(inst, newbon); }*/ diff --git a/zone/mob.h b/zone/mob.h index a38b429f3..1793e0864 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -131,11 +131,11 @@ public: virtual void ThrowingAttack(Mob* other) { } uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg); // 13 = Primary (default), 14 = secondary - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) = 0; int MonkSpecialAttack(Mob* other, uint8 skill_used); virtual void TryBackstab(Mob *other,int ReuseTime = 10); - void TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand = 13, int damage = 0); + void TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand = MainPrimary, int damage = 0); virtual bool AvoidDamage(Mob* attacker, int32 &damage, bool CanRiposte = true); virtual bool CheckHitChance(Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod = 0); virtual void TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttackOptions *opts = nullptr); @@ -990,19 +990,19 @@ protected: bool focused; void CalcSpellBonuses(StatBonuses* newbon); virtual void CalcBonuses(); - void TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success = false, uint16 hand = 0, bool IsDefensive = false); + void TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success = false, uint16 hand = 0, bool IsDefensive = false); // hand = MainCharm? bool PassLimitToSkill(uint16 spell_id, uint16 skill); bool PassLimitClass(uint32 Classes_, uint16 Class_); - void TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand = 13); - void TryWeaponProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = 13); - void TrySpellProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = 13); - void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = 13); + void TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand = MainPrimary); + void TryWeaponProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = MainPrimary); + void TrySpellProc(const ItemInst* inst, const Item_Struct* weapon, Mob *on, uint16 hand = MainPrimary); + void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = MainPrimary); void ExecWeaponProc(const ItemInst* weapon, uint16 spell_id, Mob *on); - virtual float GetProcChances(float ProcBonus, uint16 hand = 13); - virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = 13, Mob *on = nullptr); + virtual float GetProcChances(float ProcBonus, uint16 hand = MainPrimary); + virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = MainPrimary, Mob *on = nullptr); virtual float GetSpecialProcChances(uint16 hand); virtual float GetAssassinateProcChances(uint16 ReuseTime); - virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); + virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm? uint16 GetWeaponSpeedbyHand(uint16 hand); int GetWeaponDamage(Mob *against, const Item_Struct *weapon_item); int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr); diff --git a/zone/npc.h b/zone/npc.h index d7290645c..6bc9813fe 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -104,7 +104,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); - virtual bool Attack(Mob* other, int Hand = 13, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 86cf58981..6f4c66e3e 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -872,7 +872,7 @@ XS(XS_Mob_Attack) Perl_croak(aTHX_ "other is nullptr, avoiding crash."); if (items < 3) - Hand = 13; + Hand = MainPrimary; else { Hand = (int)SvIV(ST(2)); } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index ab5e79087..3d3dfd225 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2429,12 +2429,12 @@ int QuestManager::collectitems(uint32 item_id, bool remove) int quantity = 0; int slot_id; - for (slot_id = 22; slot_id <= 29; ++slot_id) + for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; ++slot_id) { quantity += collectitems_processSlot(slot_id, item_id, remove); } - for (slot_id = 251; slot_id <= 330; ++slot_id) + for (slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::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 b25b1543f..f748ddc68 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -131,7 +131,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, min_damage += min_damage * GetMeleeMinDamageMod_SE(skill) / 100; - if(HitChance && !who->CheckHitChance(this, skill, 13)) + if(HitChance && !who->CheckHitChance(this, skill, MainPrimary)) max_damage = 0; else{ @@ -570,7 +570,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { CastToClient()->CheckIncreaseSkill(SkillBackstab, other, 10); } else { //We do a single regular attack if we attack from the front without chaotic stab - Attack(other, 13); + Attack(other, MainPrimary); } } @@ -817,7 +817,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item if (!CanDoSpecialAttack(other)) return; - if (!other->CheckHitChance(this, SkillArchery, 13,chance_mod)) { + if (!other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod)) { mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { @@ -939,27 +939,27 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item if (ReuseTime) TrySkillProc(other, SkillArchery, ReuseTime); else - TrySkillProc(other, SkillArchery, 0, true, 11); + TrySkillProc(other, SkillArchery, 0, true, MainRange); } } //try proc on hits and misses if((RangeWeapon != nullptr) && GetTarget() && other && !other->HasDied()) { - TryWeaponProc(RangeWeapon, other, 11); + TryWeaponProc(RangeWeapon, other, MainRange); } //Arrow procs because why not? if((Ammo != NULL) && GetTarget() && other && !other->HasDied()) { - TryWeaponProc(Ammo, other, 11); + TryWeaponProc(Ammo, other, MainRange); } if (HasSkillProcs() && GetTarget() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, SkillArchery, ReuseTime); else - TrySkillProc(other, SkillArchery, 0, false, 11); + TrySkillProc(other, SkillArchery, 0, false, MainRange); } } @@ -1028,7 +1028,7 @@ void NPC::RangedAttack(Mob* other) FaceTarget(other); - if (!other->CheckHitChance(this, skillinuse, 11, GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2))) + if (!other->CheckHitChance(this, skillinuse, MainRange, GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2))) { mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); other->Damage(this, 0, SPELL_UNKNOWN, skillinuse); @@ -1069,15 +1069,15 @@ void NPC::RangedAttack(Mob* other) other->Damage(this, TotalDmg, SPELL_UNKNOWN, skillinuse); if (TotalDmg > 0 && HasSkillProcSuccess() && GetTarget() && !other->HasDied()) - TrySkillProc(other, skillinuse, 0, true, 11); + TrySkillProc(other, skillinuse, 0, true, MainRange); } //try proc on hits and misses if(other && !other->HasDied()) - TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, 11); + TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, MainRange); if (HasSkillProcs() && other && !other->HasDied()) - TrySkillProc(other, skillinuse, 0, false, 11); + TrySkillProc(other, skillinuse, 0, false, MainRange); CommonBreakInvisible(); } @@ -1200,7 +1200,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (!CanDoSpecialAttack(other)) return; - if (!other->CheckHitChance(this, SkillThrowing, 13, chance_mod)){ + if (!other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){ mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { @@ -1251,18 +1251,18 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (ReuseTime) TrySkillProc(other, SkillThrowing, ReuseTime); else - TrySkillProc(other, SkillThrowing, 0, true, 11); + TrySkillProc(other, SkillThrowing, 0, true, MainRange); } } if((RangeWeapon != nullptr) && GetTarget() && other && (other->GetHP() > -10)) - TryWeaponProc(RangeWeapon, other, 11); + TryWeaponProc(RangeWeapon, other, MainRange); if (HasSkillProcs() && GetTarget() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, SkillThrowing, ReuseTime); else - TrySkillProc(other, SkillThrowing, 0, false, 11); + TrySkillProc(other, SkillThrowing, 0, false, MainRange); } } @@ -1987,7 +1987,7 @@ uint32 Mob::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { if(HeadShot_Dmg && HeadShot_Level && (defender->GetLevel() <= HeadShot_Level)){ - float ProcChance = GetSpecialProcChances(11); + float ProcChance = GetSpecialProcChances(MainRange); if(ProcChance > MakeRandomFloat(0,1)) return HeadShot_Dmg; } @@ -2050,7 +2050,7 @@ uint32 Mob::TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 Reuse float ProcChance = 0.0f; if (skillInUse == SkillThrowing) - ProcChance = GetSpecialProcChances(11); + ProcChance = GetSpecialProcChances(MainRange); else ProcChance = GetAssassinateProcChances(ReuseTime); @@ -2099,7 +2099,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes int damage = 0; int32 hate = 0; - int Hand = 13; + int Hand = MainPrimary; if (hate == 0 && weapon_damage > 1) hate = weapon_damage; if(weapon_damage > 0){ diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 5b20748ec..c3b3abadf 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2200,7 +2200,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) snprintf(effect_desc, _EDLEN, "Rampage"); #endif if(caster) - entity_list.AEAttack(caster, 30, 13, 0, true); // on live wars dont get a duration ramp, its a one shot deal + entity_list.AEAttack(caster, 30, MainPrimary, 0, true); // on live wars dont get a duration ramp, its a one shot deal break; } @@ -5264,7 +5264,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { } //Tribute Focus - for(int x = TRIBUTE_SLOT_START; x < (TRIBUTE_SLOT_START + MAX_PLAYER_TRIBUTES); ++x) + for(int x = EmuConstants::TRIBUTE_BEGIN; x <= EmuConstants::TRIBUTE_END; ++x) { TempItem = nullptr; ItemInst* ins = GetInv().GetItem(x); diff --git a/zone/trading.cpp b/zone/trading.cpp index 6e3a2780c..d00cd039f 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -146,13 +146,13 @@ void Trade::SendItemData(const ItemInst* inst, int16 dest_slot_id) Client* with = mob->CastToClient(); Client* trader = owner->CastToClient(); if (with && with->IsClient()) { - with->SendItemPacket(dest_slot_id -IDX_TRADE,inst,ItemPacketTradeView); + with->SendItemPacket(dest_slot_id - EmuConstants::TRADE_BEGIN, inst, ItemPacketTradeView); if (inst->GetItem()->ItemClass == 1) { for (uint16 i=0; i<10; i++) { uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i); const ItemInst* bagitem = trader->GetInv().GetItem(bagslot_id); if (bagitem) { - with->SendItemPacket(bagslot_id-IDX_TRADE,bagitem,ItemPacketTradeView); + with->SendItemPacket(bagslot_id - EmuConstants::TRADE_BEGIN, bagitem, ItemPacketTradeView); } } } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 57b969add..63166cc41 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 < MAX_PLAYER_TRIBUTES; r++) { + for(r = 0; r < EmuConstants::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 < MAX_PLAYER_TRIBUTES; r++) { + for(r = 0; r < EmuConstants::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 < MAX_PLAYER_TRIBUTES; r++) { + for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) { uint32 tid = m_pp.tributes[r].tribute; if(tid == TRIBUTE_NONE) { - if(m_inv[TRIBUTE_SLOT_START+r]) - DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false); + if(m_inv[EmuConstants::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false); continue; } if(tribute_list.count(tid) != 1) { - if(m_inv[TRIBUTE_SLOT_START+r]) - DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false); + if (m_inv[EmuConstants::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false); continue; } //sanity check if(m_pp.tributes[r].tier >= MAX_TRIBUTE_TIERS) { - if(m_inv[TRIBUTE_SLOT_START+r]) - DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false); + if (m_inv[EmuConstants::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, 0, false); m_pp.tributes[r].tier = 0; continue; } @@ -165,15 +165,15 @@ void Client::DoTributeUpdate() { if(inst == nullptr) continue; - PutItemInInventory(TRIBUTE_SLOT_START+r, *inst, false); - SendItemPacket(TRIBUTE_SLOT_START+r, inst, ItemPacketTributeItem); + PutItemInInventory(EmuConstants::TRIBUTE_BEGIN + r, *inst, false); + SendItemPacket(EmuConstants::TRIBUTE_BEGIN + r, inst, ItemPacketTributeItem); safe_delete(inst); } } else { //unequip tribute items... - for(r = 0; r < MAX_PLAYER_TRIBUTES; r++) { - if(m_inv[TRIBUTE_SLOT_START+r]) - DeleteItemInInventory(TRIBUTE_SLOT_START+r, 0, false); + for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) { + if (m_inv[EmuConstants::TRIBUTE_BEGIN + r]) + DeleteItemInInventory(EmuConstants::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 < MAX_PLAYER_TRIBUTES; r++) { + for(r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) { m_pp.tributes[r].tribute = TRIBUTE_NONE;