diff --git a/changelog.txt b/changelog.txt index 800eefa33..63a2a8908 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 05/25/2016 == +Uleat: Renamed and moved enumeration SkillUseTypes to EQEmu::skill::SkillType - added class EQEmu::SkillProfile, though not implemented at this time +Uleat: Some more work on eq_dictionary + == 05/21/2016 == Uleat: Moved struct Item_Struct into namespace EQEmu along with associated enumerations - enumerations into namespace EQEmu::item (run shared_memory) Uleat: Fixed a few possible crash points in linux builds associated with augments/ornamentations diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5c4f364a9..034cf415a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -15,6 +15,7 @@ SET(common_sources deity.cpp emu_constants.cpp emu_legacy.cpp + emu_limits.cpp emu_opcodes.cpp emu_tcp_connection.cpp emu_tcp_server.cpp @@ -121,6 +122,7 @@ SET(common_headers deity.h emu_constants.h emu_legacy.h + emu_limits.h emu_opcodes.h emu_oplist.h emu_tcp_connection.h diff --git a/common/emu_constants.cpp b/common/emu_constants.cpp index 8085f3004..a8fa73d1c 100644 --- a/common/emu_constants.cpp +++ b/common/emu_constants.cpp @@ -18,241 +18,3 @@ */ #include "emu_constants.h" -#include "string_util.h" - - -uint16 EQEmu::constants::InventoryTypeSize(int16 type_index) -{ - switch (type_index) { - case legacy::TypePossessions: - return legacy::TYPE_POSSESSIONS_SIZE; - case legacy::TypeBank: - return legacy::TYPE_BANK_SIZE; - case legacy::TypeSharedBank: - return legacy::TYPE_SHARED_BANK_SIZE; - case legacy::TypeTrade: - return legacy::TYPE_TRADE_SIZE; - case legacy::TypeWorld: - return legacy::TYPE_WORLD_SIZE; - case legacy::TypeLimbo: - return legacy::TYPE_LIMBO_SIZE; - case legacy::TypeTribute: - return legacy::TYPE_TRIBUTE_SIZE; - case legacy::TypeTrophyTribute: - return legacy::TYPE_TROPHY_TRIBUTE_SIZE; - case legacy::TypeGuildTribute: - return legacy::TYPE_GUILD_TRIBUTE_SIZE; - case legacy::TypeMerchant: - return legacy::TYPE_MERCHANT_SIZE; - case legacy::TypeDeleted: - return legacy::TYPE_DELETED_SIZE; - case legacy::TypeCorpse: - return legacy::TYPE_CORPSE_SIZE; - case legacy::TypeBazaar: - return legacy::TYPE_BAZAAR_SIZE; - case legacy::TypeInspect: - return legacy::TYPE_INSPECT_SIZE; - case legacy::TypeRealEstate: - return legacy::TYPE_REAL_ESTATE_SIZE; - case legacy::TypeViewMODPC: - return legacy::TYPE_VIEW_MOD_PC_SIZE; - case legacy::TypeViewMODBank: - return legacy::TYPE_VIEW_MOD_BANK_SIZE; - case legacy::TypeViewMODSharedBank: - return legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE; - case legacy::TypeViewMODLimbo: - return legacy::TYPE_VIEW_MOD_LIMBO_SIZE; - case legacy::TypeAltStorage: - return legacy::TYPE_ALT_STORAGE_SIZE; - case legacy::TypeArchived: - return legacy::TYPE_ARCHIVED_SIZE; - case legacy::TypeMail: - return legacy::TYPE_MAIL_SIZE; - case legacy::TypeGuildTrophyTribute: - return legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE; - case legacy::TypeKrono: - return legacy::TYPE_KRONO_SIZE; - case legacy::TypeOther: - return legacy::TYPE_OTHER_SIZE; - default: - return NOT_USED; - } -} - -/* -const char* EQEmu::constants::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; -} -*/ - -const char* EQEmu::constants::InventoryTypeName(int16 type_index) -{ - switch (type_index) { - case INVALID_INDEX: - return "Invalid Type"; - case legacy::TypePossessions: - return "Possessions"; - case legacy::TypeBank: - return "Bank"; - case legacy::TypeSharedBank: - return "SharedBank"; - case legacy::TypeTrade: - return "Trade"; - case legacy::TypeWorld: - return "World"; - case legacy::TypeLimbo: - return "Limbo"; - case legacy::TypeTribute: - return "Tribute"; - case legacy::TypeTrophyTribute: - return "TrophyTribute"; - case legacy::TypeGuildTribute: - return "GuildTribute"; - case legacy::TypeMerchant: - return "Merchant"; - case legacy::TypeDeleted: - return "Deleted"; - case legacy::TypeCorpse: - return "Corpse"; - case legacy::TypeBazaar: - return "Bazaar"; - case legacy::TypeInspect: - return "Inspect"; - case legacy::TypeRealEstate: - return "RealEstate"; - case legacy::TypeViewMODPC: - return "ViewMODPC"; - case legacy::TypeViewMODBank: - return "ViewMODBank"; - case legacy::TypeViewMODSharedBank: - return "ViewMODSharedBank"; - case legacy::TypeViewMODLimbo: - return "ViewMODLimbo"; - case legacy::TypeAltStorage: - return "AltStorage"; - case legacy::TypeArchived: - return "Archived"; - case legacy::TypeMail: - return "Mail"; - case legacy::TypeGuildTrophyTribute: - return "GuildTrophyTribute"; - case legacy::TypeKrono: - return "Krono"; - case legacy::TypeOther: - return "Other"; - default: - return "Unknown Type"; - } -} - -const char* EQEmu::constants::InventorySlotName(int16 slot_index) -{ - switch (slot_index) { - case INVALID_INDEX: - return "Invalid Slot"; - case legacy::SlotCharm: - return "Charm"; - case legacy::SlotEar1: - return "Ear1"; - case legacy::SlotHead: - return "Head"; - case legacy::SlotFace: - return "Face"; - case legacy::SlotEar2: - return "Ear2"; - case legacy::SlotNeck: - return "Neck"; - case legacy::SlotShoulders: - return "Shoulders"; - case legacy::SlotArms: - return "Arms"; - case legacy::SlotBack: - return "Back"; - case legacy::SlotWrist1: - return "Wrist1"; - case legacy::SlotWrist2: - return "Wrist2"; - case legacy::SlotRange: - return "Range"; - case legacy::SlotHands: - return "Hands"; - case legacy::SlotPrimary: - return "Primary"; - case legacy::SlotSecondary: - return "Secondary"; - case legacy::SlotFinger1: - return "Finger1"; - case legacy::SlotFinger2: - return "Finger2"; - case legacy::SlotChest: - return "Chest"; - case legacy::SlotLegs: - return "Legs"; - case legacy::SlotFeet: - return "Feet"; - case legacy::SlotWaist: - return "Waist"; - case legacy::SlotPowerSource: - return "PowerSource"; - case legacy::SlotAmmo: - return "Ammo"; - case legacy::SlotGeneral1: - return "General1"; - case legacy::SlotGeneral2: - return "General2"; - case legacy::SlotGeneral3: - return "General3"; - case legacy::SlotGeneral4: - return "General4"; - case legacy::SlotGeneral5: - return "General5"; - case legacy::SlotGeneral6: - return "General6"; - case legacy::SlotGeneral7: - return "General7"; - case legacy::SlotGeneral8: - return "General8"; - /* - case legacy::SlotGeneral9: - return "General9"; - case legacy::SlotGeneral10: - return "General10"; - */ - case legacy::SlotCursor: - return "Cursor"; - default: - return "Unknown Slot"; - } -} - -const char* EQEmu::constants::InventorySubName(int16 sub_index) -{ - if (sub_index == INVALID_INDEX) - return "Invalid Sub"; - - if ((uint16)sub_index >= legacy::ITEM_CONTAINER_SIZE) - return "Unknown Sub"; - - static std::string ret_str; - ret_str = StringFormat("Container%i", (sub_index + 1)); // zero-based index..but, count starts at one - - return ret_str.c_str(); -} - -const char* EQEmu::constants::InventoryAugName(int16 aug_index) -{ - if (aug_index == INVALID_INDEX) - return "Invalid Aug"; - - if ((uint16)aug_index >= legacy::ITEM_COMMON_SIZE) - return "Unknown Aug"; - - static std::string ret_str; - ret_str = StringFormat("Augment%i", (aug_index + 1)); // zero-based index..but, count starts at one - - return ret_str.c_str(); -} diff --git a/common/emu_constants.h b/common/emu_constants.h index 6c7f3e962..5e279d21c 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -21,41 +21,32 @@ #define COMMON_EMU_CONSTANTS_H #include "eq_limits.h" -// (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) - #include "emu_legacy.h" #include "inventory_version.h" -#include "light_source.h" -#include "deity.h" -#include "say_link.h" +//#include "deity.h" +//#include "say_link.h" #include -// *** 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 change them are made!! *** - -// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system - - namespace EQEmu { - // an immutable value is required to initialize arrays, etc... use this class as a repository for those + namespace inventory { + //using namespace RoF2::invtype; + //using namespace RoF2::invslot; + //using namespace RoF2::invbag; + //using namespace RoF2::invaug; + + } /*inventory*/ + namespace constants { - // database - static const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2; - static const size_t CharacterCreationLimit = RoF2::consts::CHARACTER_CREATION_LIMIT; + const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2; + const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit; - // inventory - extern uint16 InventoryTypeSize(int16 type_index); - //extern const char* InventoryLocationName(Location_Struct location); - extern const char* InventoryTypeName(int16 type_index); - extern const char* InventorySlotName(int16 slot_index); - extern const char* InventorySubName(int16 sub_index); - extern const char* InventoryAugName(int16 aug_index); - } -} + const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize; -#endif /* COMMON_EMU_CONSTANTS_H */ + } /*constants*/ + +} /*EQEmu*/ + +#endif /*COMMON_EMU_CONSTANTS_H*/ diff --git a/common/emu_limits.cpp b/common/emu_limits.cpp new file mode 100644 index 000000000..64d038a54 --- /dev/null +++ b/common/emu_limits.cpp @@ -0,0 +1,18 @@ +/* EQEMu: Everquest Server Emulator + + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ diff --git a/common/emu_limits.h b/common/emu_limits.h new file mode 100644 index 000000000..e5b66faeb --- /dev/null +++ b/common/emu_limits.h @@ -0,0 +1,56 @@ +/* EQEMu: Everquest Server Emulator + + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef COMMON_EMU_LIMITS_H +#define COMMON_EMU_LIMITS_H + +#include "types.h" + +#include + + +namespace EntityLimits +{ + namespace npc { + enum : int { Invalid = -1, Null, Safety }; + + enum : bool { False = false, True = true }; + } + + namespace merc { + enum : int { Invalid = -1, Null, Safety }; + + enum : bool { False = false, True = true }; + } + + namespace bot { + enum : int { Invalid = -1, Null, Safety }; + + enum : bool { False = false, True = true }; + } + + namespace pet { + enum : int { Invalid = -1, Null, Safety }; + + enum : bool { False = false, True = true }; + } + +}; /*EntityLimits*/ + +#endif /*COMMON_EMU_LIMITS_H*/ diff --git a/common/eq_constants.h b/common/eq_constants.h index 54f52620c..e23089ce6 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -399,7 +399,7 @@ static const uint8 DamageTypeUnknown = 0xFF; ** ** (indexed by 'Skill' of SkillUseTypes) */ -static const uint8 SkillDamageTypes[HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated +static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated { /*1HBlunt*/ 0, /*1HSlashing*/ 1, diff --git a/common/eq_limits.cpp b/common/eq_limits.cpp index 94d71a0c3..cd705add6 100644 --- a/common/eq_limits.cpp +++ b/common/eq_limits.cpp @@ -18,422 +18,381 @@ */ #include "emu_constants.h" +#include "emu_limits.h" -// database -size_t EQEmu::limits::CharacterCreationLimit(versions::ClientVersion client_version) +size_t EQEmu::constants::CharacterCreationLimit(versions::ClientVersion client_version) { static const size_t local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*Client62*/ NOT_USED, -/*Titanium*/ Titanium::consts::CHARACTER_CREATION_LIMIT, -/*SoF*/ SoF::consts::CHARACTER_CREATION_LIMIT, -/*SoD*/ SoD::consts::CHARACTER_CREATION_LIMIT, -/*UF*/ UF::consts::CHARACTER_CREATION_LIMIT, -/*RoF*/ RoF::consts::CHARACTER_CREATION_LIMIT, -/*RoF2*/ RoF2::consts::CHARACTER_CREATION_LIMIT, - -/*MobNPC*/ NOT_USED, -/*MobMerc*/ NOT_USED, -/*MobBot*/ NOT_USED, -/*MobPet*/ NOT_USED + ClientUnknown::Null, + Client62::Null, + Titanium::constants::CharacterCreationLimit, + SoF::constants::CharacterCreationLimit, + SoD::constants::CharacterCreationLimit, + UF::constants::CharacterCreationLimit, + RoF::constants::CharacterCreationLimit, + RoF2::constants::CharacterCreationLimit, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }; return local[static_cast(versions::ValidateClientVersion(client_version))]; } -// inventory -uint16 EQEmu::limits::InventoryTypeSize(versions::InventoryVersion inventory_version, int16 inv_type) +uint16 EQEmu::inventory::InventoryTypeSize(versions::InventoryVersion inventory_version, int16 inv_type) { - // not all maps will have an instantiated container..some are references for queue generators (i.e., bazaar, mail, etc...) - // a zero '0' indicates a needed value..otherwise, change to '_NOTUSED' for a null value so indices requiring research can be identified - // ALL of these values need to be verified before pushing to live - // - // 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 - // - // TYPE_POSSESSIONS_SIZE does not reflect all actual _constants size due to bitmask-use compatibility - // - // when setting NPC-based values, try to adhere to an constants:: or NOT_USED value to avoid unnecessary issues - static const uint16 local[legacy::TypeCount][versions::InventoryVersionCount] = { - // server and database are sync'd to current TypePossessions's client as set in 'using namespace RoF::slots;' and - // 'constants::TYPE_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask() - // for partial range validation checks and 'constants::TYPE_POSSESSIONS_SIZE' for full range iterations { // local[TypePossessions] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_POSSESSIONS_SIZE, -/*Titanium*/ legacy::TYPE_POSSESSIONS_SIZE, -/*SoF*/ legacy::TYPE_POSSESSIONS_SIZE, -/*SoD*/ legacy::TYPE_POSSESSIONS_SIZE, -/*Underfoot*/ legacy::TYPE_POSSESSIONS_SIZE, -/*RoF*/ legacy::TYPE_POSSESSIONS_SIZE, -/*RoF2*/ legacy::TYPE_POSSESSIONS_SIZE, - -/*NPC*/ legacy::TYPE_POSSESSIONS_SIZE, -/*Merc*/ legacy::TYPE_POSSESSIONS_SIZE, -/*Bot*/ legacy::TYPE_POSSESSIONS_SIZE, -/*Pet*/ legacy::TYPE_POSSESSIONS_SIZE + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE, + legacy::TYPE_POSSESSIONS_SIZE }, { // local[TypeBank] -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ Titanium::consts::TYPE_BANK_SIZE, -/*SoF*/ legacy::TYPE_BANK_SIZE, -/*SoD*/ legacy::TYPE_BANK_SIZE, -/*Underfoot*/ legacy::TYPE_BANK_SIZE, -/*RoF*/ legacy::TYPE_BANK_SIZE, -/*RoF2*/ legacy::TYPE_BANK_SIZE, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED + ClientUnknown::Null, + Client62::Null, + Titanium::invtype::InvTypeBankSize, + legacy::TYPE_BANK_SIZE, + legacy::TYPE_BANK_SIZE, + legacy::TYPE_BANK_SIZE, + legacy::TYPE_BANK_SIZE, + legacy::TYPE_BANK_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeSharedBank] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_SHARED_BANK_SIZE, -/*Titanium*/ legacy::TYPE_SHARED_BANK_SIZE, -/*SoF*/ legacy::TYPE_SHARED_BANK_SIZE, -/*SoD*/ legacy::TYPE_SHARED_BANK_SIZE, -/*Underfoot*/ legacy::TYPE_SHARED_BANK_SIZE, -/*RoF*/ legacy::TYPE_SHARED_BANK_SIZE, -/*RoF2*/ legacy::TYPE_SHARED_BANK_SIZE, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_SHARED_BANK_SIZE, + legacy::TYPE_SHARED_BANK_SIZE, + legacy::TYPE_SHARED_BANK_SIZE, + legacy::TYPE_SHARED_BANK_SIZE, + legacy::TYPE_SHARED_BANK_SIZE, + legacy::TYPE_SHARED_BANK_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeTrade] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_TRADE_SIZE, -/*Titanium*/ legacy::TYPE_TRADE_SIZE, -/*SoF*/ legacy::TYPE_TRADE_SIZE, -/*SoD*/ legacy::TYPE_TRADE_SIZE, -/*Underfoot*/ legacy::TYPE_TRADE_SIZE, -/*RoF*/ legacy::TYPE_TRADE_SIZE, -/*RoF2*/ legacy::TYPE_TRADE_SIZE, - -/*NPC*/ 4, -/*Merc*/ 4, -/*Bot*/ legacy::TYPE_TRADE_SIZE, // client thinks this is another client -/*Pet*/ 4 + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_TRADE_SIZE, + legacy::TYPE_TRADE_SIZE, + legacy::TYPE_TRADE_SIZE, + legacy::TYPE_TRADE_SIZE, + legacy::TYPE_TRADE_SIZE, + legacy::TYPE_TRADE_SIZE, + 4, + 4, + legacy::TYPE_TRADE_SIZE, // client thinks this is another client + 4 }, { // local[TypeWorld] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_WORLD_SIZE, -/*Titanium*/ legacy::TYPE_WORLD_SIZE, -/*SoF*/ legacy::TYPE_WORLD_SIZE, -/*SoD*/ legacy::TYPE_WORLD_SIZE, -/*Underfoot*/ legacy::TYPE_WORLD_SIZE, -/*RoF*/ legacy::TYPE_WORLD_SIZE, -/*RoF2*/ legacy::TYPE_WORLD_SIZE, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_WORLD_SIZE, + legacy::TYPE_WORLD_SIZE, + legacy::TYPE_WORLD_SIZE, + legacy::TYPE_WORLD_SIZE, + legacy::TYPE_WORLD_SIZE, + legacy::TYPE_WORLD_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeLimbo] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_LIMBO_SIZE, -/*Titanium*/ legacy::TYPE_LIMBO_SIZE, -/*SoF*/ legacy::TYPE_LIMBO_SIZE, -/*SoD*/ legacy::TYPE_LIMBO_SIZE, -/*Underfoot*/ legacy::TYPE_LIMBO_SIZE, -/*RoF*/ legacy::TYPE_LIMBO_SIZE, -/*RoF2*/ legacy::TYPE_LIMBO_SIZE, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_LIMBO_SIZE, + legacy::TYPE_LIMBO_SIZE, + legacy::TYPE_LIMBO_SIZE, + legacy::TYPE_LIMBO_SIZE, + legacy::TYPE_LIMBO_SIZE, + legacy::TYPE_LIMBO_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeTribute] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_TRIBUTE_SIZE, -/*Titanium*/ legacy::TYPE_TRIBUTE_SIZE, -/*SoF*/ legacy::TYPE_TRIBUTE_SIZE, -/*SoD*/ legacy::TYPE_TRIBUTE_SIZE, -/*Underfoot*/ legacy::TYPE_TRIBUTE_SIZE, -/*RoF*/ legacy::TYPE_TRIBUTE_SIZE, -/*RoF2*/ legacy::TYPE_TRIBUTE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_TRIBUTE_SIZE, + legacy::TYPE_TRIBUTE_SIZE, + legacy::TYPE_TRIBUTE_SIZE, + legacy::TYPE_TRIBUTE_SIZE, + legacy::TYPE_TRIBUTE_SIZE, + legacy::TYPE_TRIBUTE_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeTrophyTribute] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_TROPHY_TRIBUTE_SIZE, -/*RoF2*/ legacy::TYPE_TROPHY_TRIBUTE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_TROPHY_TRIBUTE_SIZE, + legacy::TYPE_TROPHY_TRIBUTE_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeGuildTribute] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_GUILD_TRIBUTE_SIZE, -/*RoF2*/ legacy::TYPE_GUILD_TRIBUTE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_GUILD_TRIBUTE_SIZE, + legacy::TYPE_GUILD_TRIBUTE_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeMerchant] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_MERCHANT_SIZE, -/*RoF2*/ legacy::TYPE_MERCHANT_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_MERCHANT_SIZE, + legacy::TYPE_MERCHANT_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeDeleted] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_DELETED_SIZE, -/*RoF2*/ legacy::TYPE_DELETED_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_DELETED_SIZE, + legacy::TYPE_DELETED_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeCorpse] -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ Titanium::consts::TYPE_CORPSE_SIZE, -/*SoF*/ SoF::consts::TYPE_CORPSE_SIZE, -/*SoD*/ SoD::consts::TYPE_CORPSE_SIZE, -/*Underfoot*/ UF::consts::TYPE_CORPSE_SIZE, -/*RoF*/ RoF::consts::TYPE_CORPSE_SIZE, -/*RoF2*/ RoF2::consts::TYPE_CORPSE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::invtype::InvTypeCorpseSize, + SoF::invtype::InvTypeCorpseSize, + SoD::invtype::InvTypeCorpseSize, + UF::invtype::InvTypeCorpseSize, + RoF::invtype::InvTypeCorpseSize, + RoF2::invtype::InvTypeCorpseSize, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeBazaar] -/*Unknown*/ NOT_USED, -/*62*/ legacy::TYPE_BAZAAR_SIZE, -/*Titanium*/ legacy::TYPE_BAZAAR_SIZE, -/*SoF*/ legacy::TYPE_BAZAAR_SIZE, -/*SoD*/ legacy::TYPE_BAZAAR_SIZE, -/*Underfoot*/ legacy::TYPE_BAZAAR_SIZE, -/*RoF*/ legacy::TYPE_BAZAAR_SIZE, -/*RoF2*/ legacy::TYPE_BAZAAR_SIZE, - -/*NPC*/ 0, // this may need to be 'legacy::TYPE_BAZAAR_SIZE' if offline client traders respawn as an npc -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + legacy::TYPE_BAZAAR_SIZE, + legacy::TYPE_BAZAAR_SIZE, + legacy::TYPE_BAZAAR_SIZE, + legacy::TYPE_BAZAAR_SIZE, + legacy::TYPE_BAZAAR_SIZE, + legacy::TYPE_BAZAAR_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeInspect] -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ Titanium::consts::TYPE_INSPECT_SIZE, -/*SoF*/ SoF::consts::TYPE_INSPECT_SIZE, -/*SoD*/ SoD::consts::TYPE_INSPECT_SIZE, -/*Underfoot*/ UF::consts::TYPE_INSPECT_SIZE, -/*RoF*/ RoF::consts::TYPE_INSPECT_SIZE, -/*RoF2*/ RoF2::consts::TYPE_INSPECT_SIZE, - -/*NPC*/ NOT_USED, -/*Merc*/ NOT_USED, -/*Bot*/ NOT_USED, -/*Pet*/ NOT_USED + ClientUnknown::Null, + Client62::Null, + Titanium::invtype::InvTypeInspectSize, + SoF::invtype::InvTypeInspectSize, + SoD::invtype::InvTypeInspectSize, + UF::invtype::InvTypeInspectSize, + RoF::invtype::InvTypeInspectSize, + RoF2::invtype::InvTypeInspectSize, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeRealEstate] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_REAL_ESTATE_SIZE, -/*RoF2*/ legacy::TYPE_REAL_ESTATE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_REAL_ESTATE_SIZE, + legacy::TYPE_REAL_ESTATE_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeViewMODPC] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_VIEW_MOD_PC_SIZE, -/*RoF2*/ legacy::TYPE_VIEW_MOD_PC_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_VIEW_MOD_PC_SIZE, + legacy::TYPE_VIEW_MOD_PC_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeViewMODBank] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_VIEW_MOD_BANK_SIZE, -/*RoF2*/ legacy::TYPE_VIEW_MOD_BANK_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_VIEW_MOD_BANK_SIZE, + legacy::TYPE_VIEW_MOD_BANK_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeViewMODSharedBank] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE, -/*RoF2*/ legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE, + legacy::TYPE_VIEW_MOD_SHARED_BANK_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeViewMODLimbo] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_VIEW_MOD_LIMBO_SIZE, -/*RoF2*/ legacy::TYPE_VIEW_MOD_LIMBO_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_VIEW_MOD_LIMBO_SIZE, + legacy::TYPE_VIEW_MOD_LIMBO_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeAltStorage] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_ALT_STORAGE_SIZE, -/*RoF2*/ legacy::TYPE_ALT_STORAGE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_ALT_STORAGE_SIZE, + legacy::TYPE_ALT_STORAGE_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeArchived] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_ARCHIVED_SIZE, -/*RoF2*/ legacy::TYPE_ARCHIVED_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_ARCHIVED_SIZE, + legacy::TYPE_ARCHIVED_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeMail] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_MAIL_SIZE, -/*RoF2*/ legacy::TYPE_MAIL_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_MAIL_SIZE, + legacy::TYPE_MAIL_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeGuildTrophyTribute] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE, -/*RoF2*/ legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE, + legacy::TYPE_GUILD_TROPHY_TRIBUTE_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeKrono] -/*Unknown*/ NOT_USED, -/*62*/ NOT_USED, -/*Titanium*/ NOT_USED, -/*SoF*/ NOT_USED, -/*SoD*/ NOT_USED, -/*Underfoot*/ NOT_USED, -/*RoF*/ legacy::TYPE_KRONO_SIZE, -/*RoF2*/ legacy::TYPE_KRONO_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_KRONO_SIZE, + legacy::TYPE_KRONO_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }, { // local[TypeOther] -/*Unknown*/ NOT_USED, -/*62*/ 0, -/*Titanium*/ 0, -/*SoF*/ 0, -/*SoD*/ 0, -/*Underfoot*/ 0, -/*RoF*/ legacy::TYPE_OTHER_SIZE, -/*RoF2*/ legacy::TYPE_OTHER_SIZE, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + Titanium::Null, + SoF::Null, + SoD::Null, + UF::Null, + legacy::TYPE_OTHER_SIZE, + legacy::TYPE_OTHER_SIZE, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null } }; @@ -443,201 +402,123 @@ uint16 EQEmu::limits::InventoryTypeSize(versions::InventoryVersion inventory_ver return NOT_USED; } -uint64 EQEmu::limits::PossessionsBitmask(versions::InventoryVersion inventory_version) +uint64 EQEmu::inventory::PossessionsBitmask(versions::InventoryVersion inventory_version) { - // these are for the new inventory system (RoF)..not the current (Ti) one... - // 0x0000000000200000 is SlotPowerSource (SoF+) - // 0x0000000080000000 is SlotGeneral9 (RoF+) - // 0x0000000100000000 is SlotGeneral10 (RoF+) - static const uint64 local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*62*/ 0x000000027FDFFFFF, -/*Titanium*/ 0x000000027FDFFFFF, -/*SoF*/ 0x000000027FFFFFFF, -/*SoD*/ 0x000000027FFFFFFF, -/*Underfoot*/ 0x000000027FFFFFFF, -/*RoF*/ 0x00000003FFFFFFFF, -/*RoF2*/ 0, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 + ClientUnknown::Null, + Client62::Null, + 0x000000027FDFFFFF, + 0x000000027FFFFFFF, + 0x000000027FFFFFFF, + 0x000000027FFFFFFF, + 0x00000003FFFFFFFF, + 0x00000003FFFFFFFF, + EntityLimits::npc::Null, + EntityLimits::merc::Null, + EntityLimits::bot::Null, + EntityLimits::pet::Null }; return NOT_USED; //return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; } -uint64 EQEmu::limits::EquipmentBitmask(versions::InventoryVersion inventory_version) -{ - static const uint64 local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*62*/ 0x00000000005FFFFF, -/*Titanium*/ 0x00000000005FFFFF, -/*SoF*/ 0x00000000007FFFFF, -/*SoD*/ 0x00000000007FFFFF, -/*Underfoot*/ 0x00000000007FFFFF, -/*RoF*/ 0x00000000007FFFFF, -/*RoF2*/ 0, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 - }; - - return NOT_USED; - //return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; -} - -uint64 EQEmu::limits::GeneralBitmask(versions::InventoryVersion inventory_version) -{ - static const uint64 local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*62*/ 0x000000007F800000, -/*Titanium*/ 0x000000007F800000, -/*SoF*/ 0x000000007F800000, -/*SoD*/ 0x000000007F800000, -/*Underfoot*/ 0x000000007F800000, -/*RoF*/ 0x00000001FF800000, -/*RoF2*/ 0, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 - }; - - return NOT_USED; - //return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; -} - -uint64 EQEmu::limits::CursorBitmask(versions::InventoryVersion inventory_version) -{ - static const uint64 local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*62*/ 0x0000000200000000, -/*Titanium*/ 0x0000000200000000, -/*SoF*/ 0x0000000200000000, -/*SoD*/ 0x0000000200000000, -/*Underfoot*/ 0x0000000200000000, -/*RoF*/ 0x0000000200000000, -/*RoF2*/ 0, - -/*NPC*/ 0, -/*Merc*/ 0, -/*Bot*/ 0, -/*Pet*/ 0 - }; - - return NOT_USED; - //return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; -} - -bool EQEmu::limits::AllowEmptyBagInBag(versions::InventoryVersion inventory_version) +bool EQEmu::inventory::AllowEmptyBagInBag(versions::InventoryVersion inventory_version) { static const bool local[versions::InventoryVersionCount] = { -/*Unknown*/ false, -/*62*/ false, -/*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*/ UF::limits::ALLOWS_EMPTY_BAG_IN_BAG, -/*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, -/*RoF2*/ RoF2::limits::ALLOWS_EMPTY_BAG_IN_BAG, - -/*NPC*/ false, -/*Merc*/ false, -/*Bot*/ false, -/*Pet*/ false + ClientUnknown::False, + Client62::False, + Titanium::behavior::AllowEmptyBagInBag, + SoF::behavior::AllowEmptyBagInBag, + SoD::behavior::AllowEmptyBagInBag, + UF::behavior::AllowEmptyBagInBag, + RoF::behavior::AllowEmptyBagInBag, + RoF2::behavior::AllowEmptyBagInBag, + EntityLimits::npc::False, + EntityLimits::merc::False, + EntityLimits::bot::False, + EntityLimits::pet::False }; - return false; // not implemented + return false; //return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; } -bool EQEmu::limits::AllowClickCastFromBag(versions::InventoryVersion inventory_version) +bool EQEmu::inventory::AllowClickCastFromBag(versions::InventoryVersion inventory_version) { static const bool local[versions::InventoryVersionCount] = { -/*Unknown*/ false, -/*62*/ false, -/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*Underfoot*/ UF::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*RoF*/ RoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*RoF2*/ RoF2::limits::ALLOWS_CLICK_CAST_FROM_BAG, - -/*NPC*/ false, -/*Merc*/ false, -/*Bot*/ false, -/*Pet*/ false + ClientUnknown::False, + Client62::False, + Titanium::behavior::AllowClickCastFromBag, + SoF::behavior::AllowClickCastFromBag, + SoD::behavior::AllowClickCastFromBag, + UF::behavior::AllowClickCastFromBag, + RoF::behavior::AllowClickCastFromBag, + RoF2::behavior::AllowClickCastFromBag, + EntityLimits::npc::False, + EntityLimits::merc::False, + EntityLimits::bot::False, + EntityLimits::pet::False }; return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; } -// items -uint16 EQEmu::limits::ItemCommonSize(versions::InventoryVersion inventory_version) +uint16 EQEmu::inventory::ItemAugSize(versions::InventoryVersion inventory_version) { static const uint16 local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*62*/ legacy::ITEM_COMMON_SIZE, -/*Titanium*/ legacy::ITEM_COMMON_SIZE, -/*SoF*/ legacy::ITEM_COMMON_SIZE, -/*SoD*/ legacy::ITEM_COMMON_SIZE, -/*Underfoot*/ legacy::ITEM_COMMON_SIZE, -/*RoF*/ legacy::ITEM_COMMON_SIZE, -/*RoF2*/ legacy::ITEM_COMMON_SIZE, - -/*NPC*/ legacy::ITEM_COMMON_SIZE, -/*Merc*/ legacy::ITEM_COMMON_SIZE, -/*Bot*/ legacy::ITEM_COMMON_SIZE, -/*Pet*/ legacy::ITEM_COMMON_SIZE + ClientUnknown::Null, + Client62::Null, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE, + legacy::ITEM_COMMON_SIZE }; return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; } -uint16 EQEmu::limits::ItemContainerSize(versions::InventoryVersion inventory_version) +uint16 EQEmu::inventory::ItemBagSize(versions::InventoryVersion inventory_version) { static const uint16 local[versions::InventoryVersionCount] = { -/*Unknown*/ NOT_USED, -/*62*/ legacy::ITEM_CONTAINER_SIZE, -/*Titanium*/ legacy::ITEM_CONTAINER_SIZE, -/*SoF*/ legacy::ITEM_CONTAINER_SIZE, -/*SoD*/ legacy::ITEM_CONTAINER_SIZE, -/*Underfoot*/ legacy::ITEM_CONTAINER_SIZE, -/*RoF*/ legacy::ITEM_CONTAINER_SIZE, -/*RoF2*/ legacy::ITEM_CONTAINER_SIZE, - -/*NPC*/ legacy::ITEM_CONTAINER_SIZE, -/*Merc*/ legacy::ITEM_CONTAINER_SIZE, -/*Bot*/ legacy::ITEM_CONTAINER_SIZE, -/*Pet*/ legacy::ITEM_CONTAINER_SIZE + ClientUnknown::Null, + Client62::Null, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE, + legacy::ITEM_CONTAINER_SIZE }; return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; } -bool EQEmu::limits::CoinHasWeight(versions::InventoryVersion inventory_version) +bool EQEmu::profile::CoinHasWeight(versions::InventoryVersion inventory_version) { static const bool local[versions::InventoryVersionCount] = { -/*Unknown*/ true, -/*62*/ true, -/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, -/*SoF*/ SoF::limits::COIN_HAS_WEIGHT, -/*SoD*/ SoD::limits::COIN_HAS_WEIGHT, -/*Underfoot*/ UF::limits::COIN_HAS_WEIGHT, -/*RoF*/ RoF::limits::COIN_HAS_WEIGHT, -/*RoF2*/ RoF::limits::COIN_HAS_WEIGHT, - -/*NPC*/ true, -/*Merc*/ true, -/*Bot*/ true, -/*Pet*/ true + ClientUnknown::True, + Client62::True, + Titanium::behavior::CoinHasWeight, + SoF::behavior::CoinHasWeight, + SoD::behavior::CoinHasWeight, + UF::behavior::CoinHasWeight, + RoF::behavior::CoinHasWeight, + RoF::behavior::CoinHasWeight, + EntityLimits::npc::True, + EntityLimits::merc::True, + EntityLimits::bot::True, + EntityLimits::pet::True }; return local[static_cast(versions::ValidateInventoryVersion(inventory_version))]; diff --git a/common/eq_limits.h b/common/eq_limits.h index eb9c983f0..d6b03d070 100644 --- a/common/eq_limits.h +++ b/common/eq_limits.h @@ -22,7 +22,7 @@ #include "types.h" #include "eq_constants.h" -#include "inventory_version.h" // inv2 watch +#include "inventory_version.h" #include "../common/patches/titanium_limits.h" #include "../common/patches/sof_limits.h" #include "../common/patches/sod_limits.h" @@ -31,35 +31,50 @@ #include "../common/patches/rof2_limits.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 change them are made!! *** - -// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system - - namespace EQEmu { - namespace limits { - // database + namespace constants { extern size_t CharacterCreationLimit(versions::ClientVersion client_version); - // inventory + } /*constants*/ + + namespace inventory { extern uint16 InventoryTypeSize(versions::InventoryVersion inventory_version, int16 inv_type); extern uint64 PossessionsBitmask(versions::InventoryVersion inventory_version); - extern uint64 EquipmentBitmask(versions::InventoryVersion inventory_version); - extern uint64 GeneralBitmask(versions::InventoryVersion inventory_version); - extern uint64 CursorBitmask(versions::InventoryVersion inventory_version); extern bool AllowEmptyBagInBag(versions::InventoryVersion inventory_version); extern bool AllowClickCastFromBag(versions::InventoryVersion inventory_version); - // items - extern uint16 ItemCommonSize(versions::InventoryVersion inventory_version); - extern uint16 ItemContainerSize(versions::InventoryVersion inventory_version); + extern uint16 ItemAugSize(versions::InventoryVersion inventory_version); + extern uint16 ItemBagSize(versions::InventoryVersion inventory_version); - // player profile + extern bool ConcatenateInvTypeLimbo(versions::InventoryVersion inventory_version); + + extern bool AllowOverLevelEquipment(versions::InventoryVersion inventory_version); + + } /*inventory*/ + + namespace profile { extern bool CoinHasWeight(versions::InventoryVersion inventory_version); - } -} -#endif /* COMMON_EQ_LIMITS_H */ + } /*profile*/ + +} /*EQEmu*/ + +namespace ClientUnknown +{ + enum : int { Invalid = -1, Null, Safety }; + + enum : bool { False = false, True = true }; + +} /*ClientUnknown*/ + +namespace Client62 +{ + enum : int { Invalid = -1, Null, Safety }; + + enum : bool { False = false, True = true }; + +} /*Client62*/ + +#endif /*COMMON_EQ_LIMITS_H*/ diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 0075f0cf0..0434e8947 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -1517,17 +1517,38 @@ struct ExpUpdate_Struct enum ItemPacketType { ItemPacketViewLink = 0x00, + ItemPacketMerchant = 0x64, ItemPacketTradeView = 0x65, ItemPacketLoot = 0x66, ItemPacketTrade = 0x67, ItemPacketCharInventory = 0x69, ItemPacketSummonItem = 0x6A, - ItemPacketTributeItem = 0x6C, - ItemPacketMerchant = 0x64, ItemPacketWorldContainer = 0x6B, - ItemPacketCharmUpdate = 0x6E, + ItemPacketTributeItem = 0x6C, + ItemPacketGuildTribute = 0x6D, + ItemPacketCharmUpdate = 0x6E, // noted as incorrect ItemPacketInvalid = 0xFF }; + +//enum ItemPacketType +//{ +// ItemPacketMerchant = /*100*/ 0x64, // Titanium+ +// ItemPacketTradeView = /*101*/ 0x65, +// ItemPacketLoot = /*102*/ 0x66, +// ItemPacketTrade = /*103*/ 0x67, +// ItemPacketCharInventory = /*105*/ 0x69, +// ItemPacketLimbo = /*106*/ 0x6A, // name change +// ItemPacketWorldContainer = /*107*/ 0x6B, +// ItemPacketTributeItem = /*108*/ 0x6C, +// ItemPacketGuildTribute = /*109*/ 0x6D, // missing from EQEmu +// ItemPacket10 = /*110*/ 0x6E, +// ItemPacket11 = /*111*/ 0x6F, // UF+ (equipment slots only) (RoF+ checks '(WORD*)slot + 4 != -1' [(WORD*)]slot + 2 would be bag index - if used) (guess) +// ItemPacket12 = /*112*/ 0x70, // RoF+ (causes stat update) (could be TrophyTribute and GuildTrophyTribute together - two case methodology - is it checking for GuildID?) +// ItemPacketRecovery = /*113*/ 0x71, (same handler as merchant..exception: parameter is '1' versus merchant '0' looks like tab id) +// ItemPacket14 = /*115*/ 0x73, (real estate/moving crate?) +// ItemPacket__ = /*xxx*/ 0xXX // switch 'default' - all clients +//}; + struct ItemPacket_Struct { /*00*/ ItemPacketType PacketType; diff --git a/common/item.cpp b/common/item.cpp index 054bbda42..fb824afc1 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -24,6 +24,8 @@ #include "shareddb.h" #include "string_util.h" +#include "../common/light_source.h" + #include #include @@ -927,7 +929,7 @@ bool Inventory::SupportsClickCasting(int16 slot_id) } else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - if (EQEmu::limits::AllowClickCastFromBag(m_inventory_version)) + if (EQEmu::inventory::AllowClickCastFromBag(m_inventory_version)) return true; } diff --git a/common/item.h b/common/item.h index bc002fa6f..181c57d9c 100644 --- a/common/item.h +++ b/common/item.h @@ -32,6 +32,7 @@ class EvolveInfo; // Stores information about an evolving item family #include "../common/item_struct.h" #include "../common/timer.h" #include "../common/bodytypes.h" +#include "../common/deity.h" // aren't we already in '/common'? #include "string_util.h" @@ -77,6 +78,7 @@ enum { invWhereCursor = 0x20 }; +class ItemInst; // ######################################## // Class: Queue diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index c0be7f070..9acc62a95 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2346,12 +2346,12 @@ namespace RoF outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(consts::BANDOLIERS_SIZE); + outapp->WriteUInt32(profile::BandoliersSize); // Copy bandoliers where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { + for (uint32 r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); if (emu->bandoliers[r].Items[j].Icon) { @@ -2364,19 +2364,19 @@ namespace RoF } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + for (uint32 r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { outapp->WriteString(""); - for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); } } - outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); + outapp->WriteUInt32(profile::PotionBeltSize); // Copy potion belt where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (uint32 r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); if (emu->potionbelt.Items[r].Icon) { @@ -2388,7 +2388,7 @@ namespace RoF } } // Nullify potion belt where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (uint32 r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); @@ -3002,7 +3002,7 @@ namespace RoF size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::SayLinkBodySize; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -5214,7 +5214,7 @@ namespace RoF structs::InventorySlot_Struct slot_id = ServerToRoFSlot(slot_id_in); - hdr.slot_type = (inst->GetMerchantSlot() ? inventory::TypeMerchant : slot_id.Type); + hdr.slot_type = (inst->GetMerchantSlot() ? invtype::InvTypeMerchant : slot_id.Type); hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot); hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex); hdr.aug_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.AugIndex); @@ -5402,7 +5402,7 @@ namespace RoF isbs.augdistiller = 65535; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < consts::ITEM_COMMON_SIZE; ++index) { + for (int index = 0; index < invaug::ItemAugSize; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -5650,11 +5650,11 @@ namespace RoF uint32 TempSlot = 0; if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // Main Inventory and Cursor - RoFSlot.Type = inventory::TypePossessions; + RoFSlot.Type = invtype::InvTypePossessions; RoFSlot.Slot = serverSlot; if (serverSlot == EQEmu::legacy::SlotPowerSource) - RoFSlot.Slot = inventory::SlotPowerSource; + RoFSlot.Slot = invslot::PossessionsPowerSource; else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory RoFSlot.Slot += 3; @@ -5669,22 +5669,22 @@ namespace RoF }*/ else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341) - RoFSlot.Type = inventory::TypePossessions; + RoFSlot.Type = invtype::InvTypePossessions; TempSlot = serverSlot - 1; RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2; RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE); - if (RoFSlot.Slot >= inventory::SlotGeneral9) // (> 30) - RoFSlot.Slot = inventory::SlotCursor; + if (RoFSlot.Slot >= invslot::PossessionsGeneral9) // (> 30) + RoFSlot.Slot = invslot::PossessionsCursor; } else if (serverSlot >= EQEmu::legacy::TRIBUTE_BEGIN && serverSlot <= EQEmu::legacy::TRIBUTE_END) { // Tribute - RoFSlot.Type = inventory::TypeTribute; + RoFSlot.Type = invtype::InvTypeTribute; RoFSlot.Slot = serverSlot - EQEmu::legacy::TRIBUTE_BEGIN; } else if (serverSlot >= EQEmu::legacy::BANK_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) { - RoFSlot.Type = inventory::TypeBank; + RoFSlot.Type = invtype::InvTypeBank; TempSlot = serverSlot - EQEmu::legacy::BANK_BEGIN; RoFSlot.Slot = TempSlot; @@ -5695,7 +5695,7 @@ namespace RoF } else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - RoFSlot.Type = inventory::TypeSharedBank; + RoFSlot.Type = invtype::InvTypeSharedBank; TempSlot = serverSlot - EQEmu::legacy::SHARED_BANK_BEGIN; RoFSlot.Slot = TempSlot; @@ -5706,7 +5706,7 @@ namespace RoF } else if (serverSlot >= EQEmu::legacy::TRADE_BEGIN && serverSlot <= EQEmu::legacy::TRADE_BAGS_END) { - RoFSlot.Type = inventory::TypeTrade; + RoFSlot.Type = invtype::InvTypeTrade; TempSlot = serverSlot - EQEmu::legacy::TRADE_BEGIN; RoFSlot.Slot = TempSlot; @@ -5730,7 +5730,7 @@ namespace RoF } else if (serverSlot >= EQEmu::legacy::WORLD_BEGIN && serverSlot <= EQEmu::legacy::WORLD_END) { - RoFSlot.Type = inventory::TypeWorld; + RoFSlot.Type = invtype::InvTypeWorld; TempSlot = serverSlot - EQEmu::legacy::WORLD_BEGIN; RoFSlot.Slot = TempSlot; } @@ -5754,7 +5754,7 @@ namespace RoF RoFSlot.Slot = serverSlot; if (serverSlot == EQEmu::legacy::SlotPowerSource) - RoFSlot.Slot = inventory::SlotPowerSource; + RoFSlot.Slot = invslot::PossessionsPowerSource; else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory RoFSlot.Slot += 3; @@ -5791,11 +5791,11 @@ namespace RoF uint32 ServerSlot = INVALID_INDEX; uint32 TempSlot = 0; - if (rofSlot.Type == inventory::TypePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) - if (rofSlot.Slot == inventory::SlotPowerSource) + if (rofSlot.Type == invtype::InvTypePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) + if (rofSlot.Slot == invslot::PossessionsPowerSource) TempSlot = EQEmu::legacy::SlotPowerSource; - else if (rofSlot.Slot >= inventory::SlotCursor) // Cursor and Extended Corpse Inventory + else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rofSlot.Slot - 3; /*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory/corpse slots @@ -5809,7 +5809,7 @@ namespace RoF // For now, it's probably best to leave as-is and let this work itself out in the inventory rework. }*/ - else if (rofSlot.Slot >= inventory::SlotAmmo) // Ammo and Main Inventory + else if (rofSlot.Slot >= invslot::PossessionsAmmo) // Ammo and Main Inventory TempSlot = rofSlot.Slot - 1; else // Worn Slots @@ -5821,7 +5821,7 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == inventory::TypeBank) { + else if (rofSlot.Type == invtype::InvTypeBank) { TempSlot = EQEmu::legacy::BANK_BEGIN; if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) @@ -5833,7 +5833,7 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == inventory::TypeSharedBank) { + else if (rofSlot.Type == invtype::InvTypeSharedBank) { TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN; if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) @@ -5845,7 +5845,7 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == inventory::TypeTrade) { + else if (rofSlot.Type == invtype::InvTypeTrade) { TempSlot = EQEmu::legacy::TRADE_BEGIN; if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) @@ -5859,7 +5859,7 @@ namespace RoF ServerSlot = TempSlot; } - else if (rofSlot.Type == inventory::TypeWorld) { + else if (rofSlot.Type == invtype::InvTypeWorld) { TempSlot = EQEmu::legacy::WORLD_BEGIN; if (rofSlot.Slot >= SUB_INDEX_BEGIN) @@ -5877,7 +5877,7 @@ namespace RoF ServerSlot = TempSlot; }*/ - else if (rofSlot.Type == inventory::TypeGuildTribute) { + else if (rofSlot.Type == invtype::InvTypeGuildTribute) { ServerSlot = INVALID_INDEX; } @@ -5892,10 +5892,10 @@ namespace RoF uint32 TempSlot = 0; if (rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33) - if (rofSlot.Slot == inventory::SlotPowerSource) + if (rofSlot.Slot == invslot::PossessionsPowerSource) TempSlot = EQEmu::legacy::SlotPowerSource; - else if (rofSlot.Slot >= inventory::SlotCursor) // Cursor and Extended Corpse Inventory + else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rofSlot.Slot - 3; /*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory slots @@ -5904,7 +5904,7 @@ namespace RoF // Same as above }*/ - else if (rofSlot.Slot >= inventory::SlotAmmo) // Main Inventory and Ammo Slots + else if (rofSlot.Slot >= invslot::PossessionsAmmo) // Main Inventory and Ammo Slots TempSlot = rofSlot.Slot - 1; else @@ -5928,7 +5928,7 @@ namespace RoF static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink) { - if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { + if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { rofTextLink = serverTextLink; return; } @@ -5967,7 +5967,7 @@ namespace RoF static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink) { - if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find('\x12') == std::string::npos)) { + if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (rofTextLink.find('\x12') == std::string::npos)) { serverTextLink = rofTextLink; return; } @@ -5976,7 +5976,7 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= constants::SayLinkBodySize) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 8e38d81f2..9bca53ec4 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2429,12 +2429,12 @@ namespace RoF2 outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(consts::BANDOLIERS_SIZE); + outapp->WriteUInt32(profile::BandoliersSize); // Copy bandoliers where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { + for (uint32 r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { outapp->WriteString(emu->bandoliers[r].Name); - for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(emu->bandoliers[r].Items[j].Name); outapp->WriteUInt32(emu->bandoliers[r].Items[j].ID); if (emu->bandoliers[r].Items[j].Icon) { @@ -2447,19 +2447,19 @@ namespace RoF2 } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + for (uint32 r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { outapp->WriteString(""); - for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true + for (uint32 j = 0; j < profile::BandolierItemCount; ++j) { // Will need adjusting if 'server != client' is ever true outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); } } - outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT); + outapp->WriteUInt32(profile::PotionBeltSize); // Copy potion belt where server and client indexes converge - for (uint32 r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (uint32 r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { outapp->WriteString(emu->potionbelt.Items[r].Name); outapp->WriteUInt32(emu->potionbelt.Items[r].ID); if (emu->potionbelt.Items[r].Icon) { @@ -2471,7 +2471,7 @@ namespace RoF2 } } // Nullify potion belt where server and client indexes diverge, with a client bias - for (uint32 r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (uint32 r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { outapp->WriteString(""); outapp->WriteUInt32(0); outapp->WriteSInt32(-1); @@ -3095,7 +3095,7 @@ namespace RoF2 size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -5489,7 +5489,7 @@ namespace RoF2 structs::InventorySlot_Struct slot_id = ServerToRoF2Slot(slot_id_in, packet_type); - hdr.slot_type = (inst->GetMerchantSlot() ? inventory::TypeMerchant : slot_id.Type); + hdr.slot_type = (inst->GetMerchantSlot() ? invtype::InvTypeMerchant : slot_id.Type); hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot); hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex); hdr.aug_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.AugIndex); @@ -5677,7 +5677,7 @@ namespace RoF2 isbs.augrestrict2 = -1; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < consts::ITEM_COMMON_SIZE; ++index) { + for (int index = 0; index < invaug::ItemAugSize; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -5937,17 +5937,17 @@ namespace RoF2 if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // Main Inventory and Cursor if (PacketType == ItemPacketLoot) { - RoF2Slot.Type = inventory::TypeCorpse; + RoF2Slot.Type = invtype::InvTypeCorpse; RoF2Slot.Slot = serverSlot - EQEmu::legacy::CORPSE_BEGIN; } else { - RoF2Slot.Type = inventory::TypePossessions; + RoF2Slot.Type = invtype::InvTypePossessions; RoF2Slot.Slot = serverSlot; } if (serverSlot == EQEmu::legacy::SlotPowerSource) - RoF2Slot.Slot = inventory::SlotPowerSource; + RoF2Slot.Slot = invslot::PossessionsPowerSource; else if (serverSlot >= EQEmu::legacy::SlotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory RoF2Slot.Slot += 3; @@ -5962,22 +5962,22 @@ namespace RoF2 }*/ else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341) - RoF2Slot.Type = inventory::TypePossessions; + RoF2Slot.Type = invtype::InvTypePossessions; TempSlot = serverSlot - 1; RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2; RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE); - if (RoF2Slot.Slot >= inventory::SlotGeneral9) // (> 30) - RoF2Slot.Slot = inventory::SlotCursor; + if (RoF2Slot.Slot >= invslot::PossessionsGeneral9) // (> 30) + RoF2Slot.Slot = invslot::PossessionsCursor; } else if (serverSlot >= EQEmu::legacy::TRIBUTE_BEGIN && serverSlot <= EQEmu::legacy::TRIBUTE_END) { // Tribute - RoF2Slot.Type = inventory::TypeTribute; + RoF2Slot.Type = invtype::InvTypeTribute; RoF2Slot.Slot = serverSlot - EQEmu::legacy::TRIBUTE_BEGIN; } else if (serverSlot >= EQEmu::legacy::BANK_BEGIN && serverSlot <= EQEmu::legacy::BANK_BAGS_END) { - RoF2Slot.Type = inventory::TypeBank; + RoF2Slot.Type = invtype::InvTypeBank; TempSlot = serverSlot - EQEmu::legacy::BANK_BEGIN; RoF2Slot.Slot = TempSlot; @@ -5988,7 +5988,7 @@ namespace RoF2 } else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - RoF2Slot.Type = inventory::TypeSharedBank; + RoF2Slot.Type = invtype::InvTypeSharedBank; TempSlot = serverSlot - EQEmu::legacy::SHARED_BANK_BEGIN; RoF2Slot.Slot = TempSlot; @@ -5999,7 +5999,7 @@ namespace RoF2 } else if (serverSlot >= EQEmu::legacy::TRADE_BEGIN && serverSlot <= EQEmu::legacy::TRADE_BAGS_END) { - RoF2Slot.Type = inventory::TypeTrade; + RoF2Slot.Type = invtype::InvTypeTrade; TempSlot = serverSlot - EQEmu::legacy::TRADE_BEGIN; RoF2Slot.Slot = TempSlot; @@ -6023,7 +6023,7 @@ namespace RoF2 } else if (serverSlot >= EQEmu::legacy::WORLD_BEGIN && serverSlot <= EQEmu::legacy::WORLD_END) { - RoF2Slot.Type = inventory::TypeWorld; + RoF2Slot.Type = invtype::InvTypeWorld; TempSlot = serverSlot - EQEmu::legacy::WORLD_BEGIN; RoF2Slot.Slot = TempSlot; } @@ -6047,7 +6047,7 @@ namespace RoF2 RoF2Slot.Slot = serverSlot; if (serverSlot == EQEmu::legacy::SlotPowerSource) - RoF2Slot.Slot = inventory::SlotPowerSource; + RoF2Slot.Slot = invslot::PossessionsPowerSource; else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory RoF2Slot.Slot += 3; @@ -6084,11 +6084,11 @@ namespace RoF2 uint32 ServerSlot = INVALID_INDEX; uint32 TempSlot = 0; - if (rof2Slot.Type == inventory::TypePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) - if (rof2Slot.Slot == inventory::SlotPowerSource) + if (rof2Slot.Type == invtype::InvTypePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) + if (rof2Slot.Slot == invslot::PossessionsPowerSource) TempSlot = EQEmu::legacy::SlotPowerSource; - else if (rof2Slot.Slot >= inventory::SlotCursor) // Cursor and Extended Corpse Inventory + else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rof2Slot.Slot - 3; /*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory/corpse slots @@ -6102,7 +6102,7 @@ namespace RoF2 // For now, it's probably best to leave as-is and let this work itself out in the inventory rework. }*/ - else if (rof2Slot.Slot >= inventory::SlotAmmo) // Ammo and Main Inventory + else if (rof2Slot.Slot >= invslot::PossessionsAmmo) // Ammo and Main Inventory TempSlot = rof2Slot.Slot - 1; else // Worn Slots @@ -6114,7 +6114,7 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == inventory::TypeBank) { + else if (rof2Slot.Type == invtype::InvTypeBank) { TempSlot = EQEmu::legacy::BANK_BEGIN; if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) @@ -6126,7 +6126,7 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == inventory::TypeSharedBank) { + else if (rof2Slot.Type == invtype::InvTypeSharedBank) { TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN; if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) @@ -6138,7 +6138,7 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == inventory::TypeTrade) { + else if (rof2Slot.Type == invtype::InvTypeTrade) { TempSlot = EQEmu::legacy::TRADE_BEGIN; if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) @@ -6152,7 +6152,7 @@ namespace RoF2 ServerSlot = TempSlot; } - else if (rof2Slot.Type == inventory::TypeWorld) { + else if (rof2Slot.Type == invtype::InvTypeWorld) { TempSlot = EQEmu::legacy::WORLD_BEGIN; if (rof2Slot.Slot >= SUB_INDEX_BEGIN) @@ -6170,11 +6170,11 @@ namespace RoF2 ServerSlot = TempSlot; }*/ - else if (rof2Slot.Type == inventory::TypeGuildTribute) { + else if (rof2Slot.Type == invtype::InvTypeGuildTribute) { ServerSlot = INVALID_INDEX; } - else if (rof2Slot.Type == inventory::TypeCorpse) { + else if (rof2Slot.Type == invtype::InvTypeCorpse) { ServerSlot = rof2Slot.Slot + EQEmu::legacy::CORPSE_BEGIN; } @@ -6189,10 +6189,10 @@ namespace RoF2 uint32 TempSlot = 0; if (rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33) - if (rof2Slot.Slot == inventory::SlotPowerSource) + if (rof2Slot.Slot == invslot::PossessionsPowerSource) TempSlot = EQEmu::legacy::SlotPowerSource; - else if (rof2Slot.Slot >= inventory::SlotCursor) // Cursor and Extended Corpse Inventory + else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rof2Slot.Slot - 3; /*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory slots @@ -6201,7 +6201,7 @@ namespace RoF2 // Same as above }*/ - else if (rof2Slot.Slot >= inventory::SlotAmmo) // Main Inventory and Ammo Slots + else if (rof2Slot.Slot >= invslot::PossessionsAmmo) // Main Inventory and Ammo Slots TempSlot = rof2Slot.Slot - 1; else @@ -6225,7 +6225,7 @@ namespace RoF2 static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink) { - if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { + if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { rof2TextLink = serverTextLink; return; } @@ -6257,7 +6257,7 @@ namespace RoF2 static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink) { - if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rof2TextLink.find('\x12') == std::string::npos)) { + if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (rof2TextLink.find('\x12') == std::string::npos)) { serverTextLink = rof2TextLink; return; } @@ -6266,7 +6266,7 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= constants::SayLinkBodySize) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/rof2_limits.cpp b/common/patches/rof2_limits.cpp index 93a5c7a3d..05ece56ca 100644 --- a/common/patches/rof2_limits.cpp +++ b/common/patches/rof2_limits.cpp @@ -16,3 +16,251 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "rof2_limits.h" + +#include "../string_util.h" + + +size_t RoF2::invtype::InvTypeSize(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypePossessions: + return invtype::InvTypePossessionsSize; + case invtype::InvTypeBank: + return invtype::InvTypeBankSize; + case invtype::InvTypeSharedBank: + return invtype::InvTypeSharedBankSize; + case invtype::InvTypeTrade: + return invtype::InvTypeTradeSize; + case invtype::InvTypeWorld: + return invtype::InvTypeWorldSize; + case invtype::InvTypeLimbo: + return invtype::InvTypeLimboSize; + case invtype::InvTypeTribute: + return invtype::InvTypeTributeSize; + case invtype::InvTypeTrophyTribute: + return invtype::InvTypeTrophyTributeSize; + case invtype::InvTypeGuildTribute: + return invtype::InvTypeGuildTributeSize; + case invtype::InvTypeMerchant: + return invtype::InvTypeMerchantSize; + case invtype::InvTypeDeleted: + return invtype::InvTypeDeletedSize; + case invtype::InvTypeCorpse: + return invtype::InvTypeCorpseSize; + case invtype::InvTypeBazaar: + return invtype::InvTypeBazaarSize; + case invtype::InvTypeInspect: + return invtype::InvTypeInspectSize; + case invtype::InvTypeRealEstate: + return invtype::InvTypeRealEstateSize; + case invtype::InvTypeViewMODPC: + return invtype::InvTypeViewMODPCSize; + case invtype::InvTypeViewMODBank: + return invtype::InvTypeViewMODBankSize; + case invtype::InvTypeViewMODSharedBank: + return invtype::InvTypeViewMODSharedBankSize; + case invtype::InvTypeViewMODLimbo: + return invtype::InvTypeViewMODLimboSize; + case invtype::InvTypeAltStorage: + return invtype::InvTypeAltStorageSize; + case invtype::InvTypeArchived: + return invtype::InvTypeArchivedSize; + case invtype::InvTypeMail: + return invtype::InvTypeMailSize; + case invtype::InvTypeGuildTrophyTribute: + return invtype::InvTypeGuildTrophyTributeSize; + case invtype::InvTypeKrono: + return invtype::InvTypeKronoSize; + case invtype::InvTypeOther: + return invtype::InvTypeOtherSize; + default: + return 0; + } +} + +const char* RoF2::invtype::InvTypeName(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypeInvalid: + return "Invalid Type"; + case invtype::InvTypePossessions: + return "Possessions"; + case invtype::InvTypeBank: + return "Bank"; + case invtype::InvTypeSharedBank: + return "Shared Bank"; + case invtype::InvTypeTrade: + return "Trade"; + case invtype::InvTypeWorld: + return "World"; + case invtype::InvTypeLimbo: + return "Limbo"; + case invtype::InvTypeTribute: + return "Tribute"; + case invtype::InvTypeTrophyTribute: + return "Trophy Tribute"; + case invtype::InvTypeGuildTribute: + return "Guild Tribute"; + case invtype::InvTypeMerchant: + return "Merchant"; + case invtype::InvTypeDeleted: + return "Deleted"; + case invtype::InvTypeCorpse: + return "Corpse"; + case invtype::InvTypeBazaar: + return "Bazaar"; + case invtype::InvTypeInspect: + return "Inspect"; + case invtype::InvTypeRealEstate: + return "Real Estate"; + case invtype::InvTypeViewMODPC: + return "View MOD PC"; + case invtype::InvTypeViewMODBank: + return "View MOD Bank"; + case invtype::InvTypeViewMODSharedBank: + return "View MOD Shared Bank"; + case invtype::InvTypeViewMODLimbo: + return "View MOD Limbo"; + case invtype::InvTypeAltStorage: + return "Alt Storage"; + case invtype::InvTypeArchived: + return "Archived"; + case invtype::InvTypeMail: + return "Mail"; + case invtype::InvTypeGuildTrophyTribute: + return "Guild Trophy Tribute"; + case invtype::InvTypeKrono: + return "Krono"; + case invtype::InvTypeOther: + return "Other"; + default: + return "Unknown Type"; + } +} + +const char* RoF2::invslot::InvPossessionsSlotName(int inv_slot) +{ + switch (inv_slot) { + case invslot::InvSlotInvalid: + return "Invalid Slot"; + case invslot::PossessionsCharm: + return "Charm"; + case invslot::PossessionsEar1: + return "Ear 1"; + case invslot::PossessionsHead: + return "Head"; + case invslot::PossessionsFace: + return "Face"; + case invslot::PossessionsEar2: + return "Ear 2"; + case invslot::PossessionsNeck: + return "Neck"; + case invslot::PossessionsShoulders: + return "Shoulders"; + case invslot::PossessionsArms: + return "Arms"; + case invslot::PossessionsBack: + return "Back"; + case invslot::PossessionsWrist1: + return "Wrist 1"; + case invslot::PossessionsWrist2: + return "Wrist 2"; + case invslot::PossessionsRange: + return "Range"; + case invslot::PossessionsHands: + return "Hands"; + case invslot::PossessionsPrimary: + return "Primary"; + case invslot::PossessionsSecondary: + return "Secondary"; + case invslot::PossessionsFinger1: + return "Finger 1"; + case invslot::PossessionsFinger2: + return "Finger 2"; + case invslot::PossessionsChest: + return "Chest"; + case invslot::PossessionsLegs: + return "Legs"; + case invslot::PossessionsFeet: + return "Feet"; + case invslot::PossessionsWaist: + return "Waist"; + case invslot::PossessionsPowerSource: + return "Power Source"; + case invslot::PossessionsAmmo: + return "Ammo"; + case invslot::PossessionsGeneral1: + return "General 1"; + case invslot::PossessionsGeneral2: + return "General 2"; + case invslot::PossessionsGeneral3: + return "General 3"; + case invslot::PossessionsGeneral4: + return "General 4"; + case invslot::PossessionsGeneral5: + return "General 5"; + case invslot::PossessionsGeneral6: + return "General 6"; + case invslot::PossessionsGeneral7: + return "General 7"; + case invslot::PossessionsGeneral8: + return "General 8"; + case invslot::PossessionsGeneral9: + return "General 9"; + case invslot::PossessionsGeneral10: + return "General 10"; + case invslot::PossessionsCursor: + return "Cursor"; + default: + return "Unknown Slot"; + } +} + +const char* RoF2::invslot::InvSlotName(int inv_type, int inv_slot) +{ + if (inv_type == invtype::InvTypePossessions) + return invslot::InvPossessionsSlotName(inv_slot); + + size_t type_size = invtype::InvTypeSize(inv_type); + + if (!type_size || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + if ((size_t)(inv_slot + 1) >= type_size) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* RoF2::invbag::InvBagIndexName(int bag_index) +{ + if (bag_index == invbag::InvBagInvalid) + return "Invalid Bag"; + + if ((size_t)bag_index >= invbag::ItemBagSize) + return "Unknown Bag"; + + static std::string ret_str; + ret_str = StringFormat("Bag %i", (bag_index + 1)); + + return ret_str.c_str(); +} + +const char* RoF2::invaug::InvAugIndexName(int aug_index) +{ + if (aug_index == invaug::InvAugInvalid) + return "Invalid Augment"; + + if ((size_t)aug_index >= invaug::ItemAugSize) + return "Unknown Augment"; + + static std::string ret_str; + ret_str = StringFormat("Augment %i", (aug_index + 1)); + + return ret_str.c_str(); +} diff --git a/common/patches/rof2_limits.h b/common/patches/rof2_limits.h index e26f19019..70ce833b6 100644 --- a/common/patches/rof2_limits.h +++ b/common/patches/rof2_limits.h @@ -17,183 +17,269 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_ROF2_CONSTANTS_H -#define COMMON_ROF2_CONSTANTS_H +#ifndef COMMON_ROF2_LIMITS_H +#define COMMON_ROF2_LIMITS_H #include "../types.h" +#include "../client_version.h" +#include "../skills.h" namespace RoF2 { - namespace inventory { - typedef enum : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, - TypeMail, - TypeGuildTrophyTribute, - TypeKrono, - TypeOther, - TypeCount - } InventoryTypes; + enum : int { Invalid = -1, Null, Safety }; - typedef enum : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, - SlotPowerSource, - SlotAmmo, - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - SlotGeneral9, - SlotGeneral10, - SlotCursor, - SlotCount, - SlotEquipmentBegin = SlotCharm, - SlotEquipmentEnd = SlotAmmo, - SlotEquipmentCount = (SlotEquipmentEnd - SlotEquipmentBegin + 1), - SlotGeneralBegin = SlotGeneral1, - SlotGeneralEnd = SlotGeneral10, - SlotGeneralCount = (SlotGeneralEnd - SlotGeneralBegin + 1) - } PossessionsSlots; - } + enum : bool { False = false, True = true }; - namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 12; + // pre-declarations + namespace invtype { + inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::RoF2; } - static const uint16 TYPE_POSSESSIONS_SIZE = inventory::SlotCount; - static const uint16 TYPE_BANK_SIZE = 24; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 0; //? - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = inventory::SlotCount; - static const uint16 TYPE_BAZAAR_SIZE = 200; - static const uint16 TYPE_INSPECT_SIZE = inventory::SlotEquipmentCount; - static const uint16 TYPE_REAL_ESTATE_SIZE = 0; - static const uint16 TYPE_VIEW_MOD_PC_SIZE = TYPE_POSSESSIONS_SIZE; - static const uint16 TYPE_VIEW_MOD_BANK_SIZE = TYPE_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = TYPE_SHARED_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = TYPE_LIMBO_SIZE; - static const uint16 TYPE_ALT_STORAGE_SIZE = 0; - static const uint16 TYPE_ARCHIVED_SIZE = 0; - static const uint16 TYPE_MAIL_SIZE = 0; - static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_KRONO_SIZE = NOT_USED; - static const uint16 TYPE_OTHER_SIZE = 0; + enum : int { InvTypeInvalid = -1, InvTypeBegin }; - // 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 EQUIPMENT_BEGIN = inventory::SlotCharm; - static const int16 EQUIPMENT_END = inventory::SlotAmmo; - static const uint16 EQUIPMENT_SIZE = inventory::SlotEquipmentCount; + enum InventoryType : int { + InvTypePossessions = InvTypeBegin, + InvTypeBank, + InvTypeSharedBank, + InvTypeTrade, + InvTypeWorld, + InvTypeLimbo, + InvTypeTribute, + InvTypeTrophyTribute, + InvTypeGuildTribute, + InvTypeMerchant, + InvTypeDeleted, + InvTypeCorpse, + InvTypeBazaar, + InvTypeInspect, + InvTypeRealEstate, + InvTypeViewMODPC, + InvTypeViewMODBank, + InvTypeViewMODSharedBank, + InvTypeViewMODLimbo, + InvTypeAltStorage, + InvTypeArchived, + InvTypeMail, + InvTypeGuildTrophyTribute, + InvTypeKrono, + InvTypeOther, + InvTypeCount + }; - static const int16 GENERAL_BEGIN = inventory::SlotGeneral1; - static const int16 GENERAL_END = inventory::SlotGeneral10; - static const uint16 GENERAL_SIZE = inventory::SlotGeneralCount; - 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; + } /*invtype*/ - static const int16 CURSOR = inventory::SlotCursor; - 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; + namespace invslot { + inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::RoF2; } - 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; + enum : int { InvSlotInvalid = -1, InvSlotBegin }; - 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; + enum PossessionsSlot : int { + PossessionsCharm = InvSlotBegin, + PossessionsEar1, + PossessionsHead, + PossessionsFace, + PossessionsEar2, + PossessionsNeck, + PossessionsShoulders, + PossessionsArms, + PossessionsBack, + PossessionsWrist1, + PossessionsWrist2, + PossessionsRange, + PossessionsHands, + PossessionsPrimary, + PossessionsSecondary, + PossessionsFinger1, + PossessionsFinger2, + PossessionsChest, + PossessionsLegs, + PossessionsFeet, + PossessionsWaist, + PossessionsPowerSource, + PossessionsAmmo, + PossessionsGeneral1, + PossessionsGeneral2, + PossessionsGeneral3, + PossessionsGeneral4, + PossessionsGeneral5, + PossessionsGeneral6, + PossessionsGeneral7, + PossessionsGeneral8, + PossessionsGeneral9, + PossessionsGeneral10, + PossessionsCursor, + PossessionsCount + }; - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 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; + const int EquipmentBegin = PossessionsCharm; + const int EquipmentEnd = PossessionsAmmo; + const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; + const int GeneralBegin = PossessionsGeneral1; + const int GeneralEnd = PossessionsGeneral10; + const int GeneralCount = (GeneralEnd - GeneralBegin + 1); - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; + } /*invslot*/ - static const int16 CORPSE_BEGIN = inventory::SlotGeneral1; - static const int16 CORPSE_END = inventory::SlotGeneral1 + inventory::SlotCursor; + namespace invbag { + inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::RoF2; } - 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) + enum : int { InvBagInvalid = -1, InvBagBegin }; - static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + } /*invbag*/ - static const size_t POTION_BELT_ITEM_COUNT = 5; + namespace invaug { + inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::RoF2; } - static const size_t TEXT_LINK_BODY_LENGTH = 56; + enum : int { InvAugInvalid = -1, InvAugBegin }; - static const size_t PLAYER_PROFILE_SKILL_MAX = Skill2HPiercing; - } + } /*invaug*/ - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = true; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = true; - static const bool COIN_HAS_WEIGHT = false; - } + namespace item { + inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::RoF2; } + + //enum Unknown : int { // looks like item class..but, RoF has it too - nothing in UF- + // Unknown1 = 0, + // Unknown2 = 1, + // Unknown3 = 2, + // Unknown4 = 5 // krono? + //}; + + enum ItemPacketType : int { + ItemPacketMerchant = 100, + ItemPacketTradeView = 101, + ItemPacketLoot = 102, + ItemPacketTrade = 103, + ItemPacketCharInventory = 105, + ItemPacketLimbo = 106, + ItemPacketWorldContainer = 107, + ItemPacketTributeItem = 108, + ItemPacketGuildTribute = 109, + ItemPacket10 = 110, + ItemPacket11 = 111, + ItemPacket12 = 112, + ItemPacketRecovery = 113, + ItemPacket14 = 115 + }; + + } /*item*/ + + namespace profile { + inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::RoF2; } + + } /*profile*/ + + namespace constants { + inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::RoF2; } + + } /*constants*/ + + namespace behavior { + inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::RoF2; } + + } /*behavior*/ + + namespace skills { + inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::RoF2; } + + } /*skills*/ + + + // declarations + namespace invtype { + const size_t InvTypePossessionsSize = invslot::PossessionsCount; + const size_t InvTypeBankSize = 24; + const size_t InvTypeSharedBankSize = 2; + const size_t InvTypeTradeSize = 8; + const size_t InvTypeWorldSize = 10; + const size_t InvTypeLimboSize = 36; + const size_t InvTypeTributeSize = 5; + const size_t InvTypeTrophyTributeSize = 0;//unknown + const size_t InvTypeGuildTributeSize = 0;//unknown + const size_t InvTypeMerchantSize = 200; + const size_t InvTypeDeletedSize = 0;//unknown - "Recovery Tab" + const size_t InvTypeCorpseSize = InvTypePossessionsSize; + const size_t InvTypeBazaarSize = 200; + const size_t InvTypeInspectSize = invslot::EquipmentCount; + const size_t InvTypeRealEstateSize = 0;//unknown + const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; + const size_t InvTypeViewMODBankSize = InvTypeBankSize; + const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; + const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; + const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" + const size_t InvTypeArchivedSize = 0;//unknown + const size_t InvTypeMailSize = 0;//unknown + const size_t InvTypeGuildTrophyTributeSize = 0;//unknown + const size_t InvTypeKronoSize = 0;//unknown + const size_t InvTypeOtherSize = 0;//unknown + + const size_t NPCTradeSize = 4; + + extern size_t InvTypeSize(int inv_type); + extern const char* InvTypeName(int inv_type); + + } /*invtype*/ + + namespace invslot { + extern const char* InvPossessionsSlotName(int inv_slot); + extern const char* InvSlotName(int inv_type, int inv_slot); + + } /*invslot*/ + + namespace invbag { + const size_t ItemBagSize = 255; // server Size will be 255..unsure what actual client is (test) + + extern const char* InvBagIndexName(int bag_index); + + } /*invbag*/ + + namespace invaug { + const size_t ItemAugSize = 6; + + extern const char* InvAugIndexName(int aug_index); + + } /*invaug*/ + + namespace item { + + } /*item*/ + + namespace profile { + const size_t TributeSize = invtype::InvTypeTributeSize; + + const size_t BandoliersSize = 20; // number of bandolier instances + const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance + + const size_t PotionBeltSize = 5; + + const size_t SkillArraySize = 100; + + } /*profile*/ + + namespace constants { + const size_t CharacterCreationLimit = 12; + + const size_t SayLinkBodySize = 56; + + } /*constants*/ + + namespace behavior { + const bool ConcatenateInvTypeLimbo = false; + + const bool AllowOverLevelEquipment = true; + + const bool AllowEmptyBagInBag = true; + const bool AllowClickCastFromBag = true; + + const bool CoinHasWeight = false; + + } /*behavior*/ + + namespace skills { + const size_t LastUsableSkill = EQEmu::skills::Skill2HPiercing; + + } /*skills*/ }; /*RoF2*/ -#endif /*COMMON_ROF2_CONSTANTS_H*/ +#endif /*COMMON_ROF2_LIMITS_H*/ diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index e1716478e..6d764857f 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -948,13 +948,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; struct PotionBeltItem_Struct @@ -974,12 +974,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct Items[profile::PotionBeltSize]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct_Old Items[profile::PotionBeltSize]; }; struct GroupLeadershipAA_Struct { @@ -1189,7 +1189,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 -/*12959*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*12959*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/rof_limits.cpp b/common/patches/rof_limits.cpp index 93a5c7a3d..94ed6039f 100644 --- a/common/patches/rof_limits.cpp +++ b/common/patches/rof_limits.cpp @@ -16,3 +16,247 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "rof_limits.h" + +#include "../string_util.h" + + +size_t RoF::invtype::InvTypeSize(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypePossessions: + return invtype::InvTypePossessionsSize; + case invtype::InvTypeBank: + return invtype::InvTypeBankSize; + case invtype::InvTypeSharedBank: + return invtype::InvTypeSharedBankSize; + case invtype::InvTypeTrade: + return invtype::InvTypeTradeSize; + case invtype::InvTypeWorld: + return invtype::InvTypeWorldSize; + case invtype::InvTypeLimbo: + return invtype::InvTypeLimboSize; + case invtype::InvTypeTribute: + return invtype::InvTypeTributeSize; + case invtype::InvTypeTrophyTribute: + return invtype::InvTypeTrophyTributeSize; + case invtype::InvTypeGuildTribute: + return invtype::InvTypeGuildTributeSize; + case invtype::InvTypeMerchant: + return invtype::InvTypeMerchantSize; + case invtype::InvTypeDeleted: + return invtype::InvTypeDeletedSize; + case invtype::InvTypeCorpse: + return invtype::InvTypeCorpseSize; + case invtype::InvTypeBazaar: + return invtype::InvTypeBazaarSize; + case invtype::InvTypeInspect: + return invtype::InvTypeInspectSize; + case invtype::InvTypeRealEstate: + return invtype::InvTypeRealEstateSize; + case invtype::InvTypeViewMODPC: + return invtype::InvTypeViewMODPCSize; + case invtype::InvTypeViewMODBank: + return invtype::InvTypeViewMODBankSize; + case invtype::InvTypeViewMODSharedBank: + return invtype::InvTypeViewMODSharedBankSize; + case invtype::InvTypeViewMODLimbo: + return invtype::InvTypeViewMODLimboSize; + case invtype::InvTypeAltStorage: + return invtype::InvTypeAltStorageSize; + case invtype::InvTypeArchived: + return invtype::InvTypeArchivedSize; + case invtype::InvTypeMail: + return invtype::InvTypeMailSize; + case invtype::InvTypeGuildTrophyTribute: + return invtype::InvTypeGuildTrophyTributeSize; + case invtype::InvTypeOther: + return invtype::InvTypeOtherSize; + default: + return 0; + } +} + +const char* RoF::invtype::InvTypeName(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypeInvalid: + return "Invalid Type"; + case invtype::InvTypePossessions: + return "Possessions"; + case invtype::InvTypeBank: + return "Bank"; + case invtype::InvTypeSharedBank: + return "Shared Bank"; + case invtype::InvTypeTrade: + return "Trade"; + case invtype::InvTypeWorld: + return "World"; + case invtype::InvTypeLimbo: + return "Limbo"; + case invtype::InvTypeTribute: + return "Tribute"; + case invtype::InvTypeTrophyTribute: + return "Trophy Tribute"; + case invtype::InvTypeGuildTribute: + return "Guild Tribute"; + case invtype::InvTypeMerchant: + return "Merchant"; + case invtype::InvTypeDeleted: + return "Deleted"; + case invtype::InvTypeCorpse: + return "Corpse"; + case invtype::InvTypeBazaar: + return "Bazaar"; + case invtype::InvTypeInspect: + return "Inspect"; + case invtype::InvTypeRealEstate: + return "Real Estate"; + case invtype::InvTypeViewMODPC: + return "View MOD PC"; + case invtype::InvTypeViewMODBank: + return "View MOD Bank"; + case invtype::InvTypeViewMODSharedBank: + return "View MOD Shared Bank"; + case invtype::InvTypeViewMODLimbo: + return "View MOD Limbo"; + case invtype::InvTypeAltStorage: + return "Alt Storage"; + case invtype::InvTypeArchived: + return "Archived"; + case invtype::InvTypeMail: + return "Mail"; + case invtype::InvTypeGuildTrophyTribute: + return "Guild Trophy Tribute"; + case invtype::InvTypeOther: + return "Other"; + default: + return "Unknown Type"; + } +} + +const char* RoF::invslot::InvPossessionsSlotName(int inv_slot) +{ + switch (inv_slot) { + case invslot::InvSlotInvalid: + return "Invalid Slot"; + case invslot::PossessionsCharm: + return "Charm"; + case invslot::PossessionsEar1: + return "Ear 1"; + case invslot::PossessionsHead: + return "Head"; + case invslot::PossessionsFace: + return "Face"; + case invslot::PossessionsEar2: + return "Ear 2"; + case invslot::PossessionsNeck: + return "Neck"; + case invslot::PossessionsShoulders: + return "Shoulders"; + case invslot::PossessionsArms: + return "Arms"; + case invslot::PossessionsBack: + return "Back"; + case invslot::PossessionsWrist1: + return "Wrist 1"; + case invslot::PossessionsWrist2: + return "Wrist 2"; + case invslot::PossessionsRange: + return "Range"; + case invslot::PossessionsHands: + return "Hands"; + case invslot::PossessionsPrimary: + return "Primary"; + case invslot::PossessionsSecondary: + return "Secondary"; + case invslot::PossessionsFinger1: + return "Finger 1"; + case invslot::PossessionsFinger2: + return "Finger 2"; + case invslot::PossessionsChest: + return "Chest"; + case invslot::PossessionsLegs: + return "Legs"; + case invslot::PossessionsFeet: + return "Feet"; + case invslot::PossessionsWaist: + return "Waist"; + case invslot::PossessionsPowerSource: + return "Power Source"; + case invslot::PossessionsAmmo: + return "Ammo"; + case invslot::PossessionsGeneral1: + return "General 1"; + case invslot::PossessionsGeneral2: + return "General 2"; + case invslot::PossessionsGeneral3: + return "General 3"; + case invslot::PossessionsGeneral4: + return "General 4"; + case invslot::PossessionsGeneral5: + return "General 5"; + case invslot::PossessionsGeneral6: + return "General 6"; + case invslot::PossessionsGeneral7: + return "General 7"; + case invslot::PossessionsGeneral8: + return "General 8"; + case invslot::PossessionsGeneral9: + return "General 9"; + case invslot::PossessionsGeneral10: + return "General 10"; + case invslot::PossessionsCursor: + return "Cursor"; + default: + return "Unknown Slot"; + } +} + +const char* RoF::invslot::InvSlotName(int inv_type, int inv_slot) +{ + if (inv_type == invtype::InvTypePossessions) + return invslot::InvPossessionsSlotName(inv_slot); + + size_t type_size = invtype::InvTypeSize(inv_type); + + if (!type_size || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + if ((size_t)(inv_slot + 1) >= type_size) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* RoF::invbag::InvBagIndexName(int bag_index) +{ + if (bag_index == invbag::InvBagInvalid) + return "Invalid Bag"; + + if ((size_t)bag_index >= invbag::ItemBagSize) + return "Unknown Bag"; + + static std::string ret_str; + ret_str = StringFormat("Bag %i", (bag_index + 1)); + + return ret_str.c_str(); +} + +const char* RoF::invaug::InvAugIndexName(int aug_index) +{ + if (aug_index == invaug::InvAugInvalid) + return "Invalid Augment"; + + if ((size_t)aug_index >= invaug::ItemAugSize) + return "Unknown Augment"; + + static std::string ret_str; + ret_str = StringFormat("Augment %i", (aug_index + 1)); + + return ret_str.c_str(); +} diff --git a/common/patches/rof_limits.h b/common/patches/rof_limits.h index 9b888d3af..8b3d95591 100644 --- a/common/patches/rof_limits.h +++ b/common/patches/rof_limits.h @@ -17,182 +17,260 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_ROF_CONSTANTS_H -#define COMMON_ROF_CONSTANTS_H +#ifndef COMMON_ROF_LIMITS_H +#define COMMON_ROF_LIMITS_H #include "../types.h" +#include "../client_version.h" +#include "../skills.h" namespace RoF { - namespace inventory { - typedef enum : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, - TypeMail, - TypeGuildTrophyTribute, - TypeOther, - TypeCount - } InventoryTypes; + enum : int { Invalid = -1, Null, Safety }; - typedef enum : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, - SlotPowerSource, - SlotAmmo, - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - SlotGeneral9, - SlotGeneral10, - SlotCursor, - SlotCount, - SlotEquipmentBegin = SlotCharm, - SlotEquipmentEnd = SlotAmmo, - SlotEquipmentCount = (SlotEquipmentEnd - SlotEquipmentBegin + 1), - SlotGeneralBegin = SlotGeneral1, - SlotGeneralEnd = SlotGeneral10, - SlotGeneralCount = (SlotGeneralEnd - SlotGeneralBegin + 1) - } PossessionsSlots; - } + enum : bool { False = false, True = true }; - namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 12; + // pre-declarations + namespace invtype { + inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::RoF; } - static const uint16 TYPE_POSSESSIONS_SIZE = inventory::SlotCount; - static const uint16 TYPE_BANK_SIZE = 24; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 0; //? - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = inventory::SlotCount; - static const uint16 TYPE_BAZAAR_SIZE = 200; - static const uint16 TYPE_INSPECT_SIZE = inventory::SlotEquipmentCount; - static const uint16 TYPE_REAL_ESTATE_SIZE = 0; - static const uint16 TYPE_VIEW_MOD_PC_SIZE = TYPE_POSSESSIONS_SIZE; - static const uint16 TYPE_VIEW_MOD_BANK_SIZE = TYPE_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = TYPE_SHARED_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = TYPE_LIMBO_SIZE; - static const uint16 TYPE_ALT_STORAGE_SIZE = 0; - static const uint16 TYPE_ARCHIVED_SIZE = 0; - static const uint16 TYPE_MAIL_SIZE = 0; - static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_KRONO_SIZE = NOT_USED; - static const uint16 TYPE_OTHER_SIZE = 0; + enum : int { InvTypeInvalid = -1, InvTypeBegin }; - // 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 EQUIPMENT_BEGIN = inventory::SlotCharm; - static const int16 EQUIPMENT_END = inventory::SlotAmmo; - static const uint16 EQUIPMENT_SIZE = inventory::SlotEquipmentCount; + enum InventoryType : int { + InvTypePossessions = InvTypeBegin, + InvTypeBank, + InvTypeSharedBank, + InvTypeTrade, + InvTypeWorld, + InvTypeLimbo, + InvTypeTribute, + InvTypeTrophyTribute, + InvTypeGuildTribute, + InvTypeMerchant, + InvTypeDeleted, + InvTypeCorpse, + InvTypeBazaar, + InvTypeInspect, + InvTypeRealEstate, + InvTypeViewMODPC, + InvTypeViewMODBank, + InvTypeViewMODSharedBank, + InvTypeViewMODLimbo, + InvTypeAltStorage, + InvTypeArchived, + InvTypeMail, + InvTypeGuildTrophyTribute, + InvTypeOther, + InvTypeCount + }; - static const int16 GENERAL_BEGIN = inventory::SlotGeneral1; - static const int16 GENERAL_END = inventory::SlotGeneral10; - static const uint16 GENERAL_SIZE = inventory::SlotGeneralCount; - 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; + } /*invtype*/ - static const int16 CURSOR = inventory::SlotCursor; - 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; + namespace invslot { + inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::RoF; } - 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; + enum : int { InvSlotInvalid = -1, InvSlotBegin }; - 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; + enum PossessionsSlot : int { + PossessionsCharm = InvSlotBegin, + PossessionsEar1, + PossessionsHead, + PossessionsFace, + PossessionsEar2, + PossessionsNeck, + PossessionsShoulders, + PossessionsArms, + PossessionsBack, + PossessionsWrist1, + PossessionsWrist2, + PossessionsRange, + PossessionsHands, + PossessionsPrimary, + PossessionsSecondary, + PossessionsFinger1, + PossessionsFinger2, + PossessionsChest, + PossessionsLegs, + PossessionsFeet, + PossessionsWaist, + PossessionsPowerSource, + PossessionsAmmo, + PossessionsGeneral1, + PossessionsGeneral2, + PossessionsGeneral3, + PossessionsGeneral4, + PossessionsGeneral5, + PossessionsGeneral6, + PossessionsGeneral7, + PossessionsGeneral8, + PossessionsGeneral9, + PossessionsGeneral10, + PossessionsCursor, + PossessionsCount + }; - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 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; + const int EquipmentBegin = PossessionsCharm; + const int EquipmentEnd = PossessionsAmmo; + const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; + const int GeneralBegin = PossessionsGeneral1; + const int GeneralEnd = PossessionsGeneral10; + const int GeneralCount = (GeneralEnd - GeneralBegin + 1); - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; + } /*invslot*/ - static const int16 CORPSE_BEGIN = inventory::SlotGeneral1; - static const int16 CORPSE_END = inventory::SlotGeneral1 + inventory::SlotCursor; + namespace invbag { + inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::RoF; } - 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) + enum : int { InvBagInvalid = -1, InvBagBegin }; - static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + } /*invbag*/ - static const size_t POTION_BELT_ITEM_COUNT = 5; + namespace invaug { + inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::RoF; } - static const size_t TEXT_LINK_BODY_LENGTH = 55; + enum : int { InvAugInvalid = -1, InvAugBegin }; - static const size_t PLAYER_PROFILE_SKILL_MAX = SkillTripleAttack; - } + } /*invaug*/ - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = true; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = true; - static const bool COIN_HAS_WEIGHT = false; - } + namespace item { + inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::RoF; } + + enum ItemPacketType : int { + ItemPacketMerchant = 100, + ItemPacketTradeView = 101, + ItemPacketLoot = 102, + ItemPacketTrade = 103, + ItemPacketCharInventory = 105, + ItemPacketLimbo = 106, + ItemPacketWorldContainer = 107, + ItemPacketTributeItem = 108, + ItemPacketGuildTribute = 109, + ItemPacket10 = 110, + ItemPacket11 = 111, + ItemPacket12 = 112, + ItemPacketRecovery = 113, + ItemPacket14 = 115 + }; + + } /*item*/ + + namespace profile { + inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::RoF; } + + } /*profile*/ + + namespace constants { + inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::RoF; } + + } /*constants*/ + + namespace behavior { + inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::RoF; } + + } /*behavior*/ + + namespace skills { + inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::RoF; } + + } /*skills*/ + + + // declarations + namespace invtype { + const size_t InvTypePossessionsSize = invslot::PossessionsCount; + const size_t InvTypeBankSize = 24; + const size_t InvTypeSharedBankSize = 2; + const size_t InvTypeTradeSize = 8; + const size_t InvTypeWorldSize = 10; + const size_t InvTypeLimboSize = 36; + const size_t InvTypeTributeSize = 5; + const size_t InvTypeTrophyTributeSize = 0;//unknown + const size_t InvTypeGuildTributeSize = 0;//unknown + const size_t InvTypeMerchantSize = 200; + const size_t InvTypeDeletedSize = 0;//unknown - "Recovery Tab" + const size_t InvTypeCorpseSize = InvTypePossessionsSize; + const size_t InvTypeBazaarSize = 200; + const size_t InvTypeInspectSize = invslot::EquipmentCount; + const size_t InvTypeRealEstateSize = 0;//unknown + const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; + const size_t InvTypeViewMODBankSize = InvTypeBankSize; + const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; + const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; + const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" + const size_t InvTypeArchivedSize = 0;//unknown + const size_t InvTypeMailSize = 0;//unknown + const size_t InvTypeGuildTrophyTributeSize = 0;//unknown + const size_t InvTypeOtherSize = 0;//unknown + + const size_t NPCTradeSize = 4; + + extern size_t InvTypeSize(int inv_type); + extern const char* InvTypeName(int inv_type); + + } /*invtype*/ + + namespace invslot { + extern const char* InvPossessionsSlotName(int inv_slot); + extern const char* InvSlotName(int inv_type, int inv_slot); + + } /*invslot*/ + + namespace invbag { + const size_t ItemBagSize = 255; // server Size will be 255..unsure what actual client is (test) + + extern const char* InvBagIndexName(int bag_index); + + } /*invbag*/ + + namespace invaug { + const size_t ItemAugSize = 6; + + extern const char* InvAugIndexName(int aug_index); + + } /*invaug*/ + + namespace item { + + } /*item*/ + + namespace profile { + const size_t TributeSize = invtype::InvTypeTributeSize; + + const size_t BandoliersSize = 20; // number of bandolier instances + const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance + + const size_t PotionBeltSize = 5; + + const size_t SkillArraySize = 100; + + } /*profile*/ + + namespace constants { + const size_t CharacterCreationLimit = 12; + + const size_t SayLinkBodySize = 55; + + } /*constants*/ + + namespace behavior { + const bool ConcatenateInvTypeLimbo = false; + + const bool AllowOverLevelEquipment = true; + + const bool AllowEmptyBagInBag = true; + const bool AllowClickCastFromBag = true; + + const bool CoinHasWeight = false; + + } /*behavior*/ + + namespace skills { + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; + + } /*skills*/ }; /*RoF*/ -#endif /*COMMON_ROF_CONSTANTS_H*/ +#endif /*COMMON_ROF_LIMITS_H*/ diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index d3d83fca6..a0d95f841 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -931,13 +931,13 @@ struct BandolierItem_Struct_Old struct Bandolier_Struct { char Name[1]; // Variable Length - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; struct Bandolier_Struct_Old { char Name[32]; - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; struct PotionBeltItem_Struct @@ -957,12 +957,12 @@ struct PotionBeltItem_Struct_Old struct PotionBelt_Struct { - PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct Items[profile::PotionBeltSize]; }; struct PotionBelt_Struct_Old { - PotionBeltItem_Struct_Old Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct_Old Items[profile::PotionBeltSize]; }; struct GroupLeadershipAA_Struct { @@ -1172,7 +1172,7 @@ union /*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 /*12953*/ uint16 unknown_rof20; // /*12955*/ uint32 bandolier_count; // Seen 20 -/*12959*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*12959*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents /*13699*/ uint32 potionbelt_count; // Seen 5 /*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) /*13748*/ int32 unknown_rof21; // Seen -1 diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 244e63c71..f915743c1 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1623,18 +1623,18 @@ namespace SoD // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { + for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1644,13 +1644,13 @@ namespace SoD // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -1938,8 +1938,8 @@ namespace SoD eq->CharCount = emu->CharCount; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) - eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + if (eq->TotalChars > constants::CharacterCreationLimit) + eq->TotalChars = constants::CharacterCreationLimit; FINISH_ENCODE(); return; @@ -1951,7 +1951,7 @@ namespace SoD size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -1967,8 +1967,8 @@ namespace SoD eq->CharCount = character_count; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) - eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + if (eq->TotalChars > constants::CharacterCreationLimit) + eq->TotalChars = constants::CharacterCreationLimit; emu_ptr = __emu_buffer; emu_ptr += sizeof(CharacterSelect_Struct); @@ -3706,7 +3706,7 @@ namespace SoD isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < consts::ITEM_COMMON_SIZE; ++index) { + for (int index = 0; index < invaug::ItemAugSize; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -3917,7 +3917,7 @@ namespace SoD else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) SoDSlot = serverSlot + 1; else if (serverSlot == EQEmu::legacy::SlotPowerSource) - SoDSlot = inventory::SlotPowerSource; + SoDSlot = invslot::PossessionsPowerSource; else SoDSlot = serverSlot; return SoDSlot; @@ -3933,15 +3933,15 @@ namespace SoD { uint32 ServerSlot = 0; - if (sodSlot >= inventory::SlotAmmo && sodSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (sodSlot >= invslot::PossessionsAmmo && sodSlot <= invslot::CorpseEnd) // Cursor/Ammo/Power Source and Normal Inventory Slots ServerSlot = sodSlot - 1; - else if (sodSlot >= consts::GENERAL_BAGS_BEGIN && sodSlot <= consts::CURSOR_BAG_END) + else if (sodSlot >= invbag::GeneralBagsBegin && sodSlot <= invbag::CursorBagEnd) ServerSlot = sodSlot - 11; - else if (sodSlot >= consts::BANK_BAGS_BEGIN && sodSlot <= consts::BANK_BAGS_END) + else if (sodSlot >= invbag::BankBagsBegin && sodSlot <= invbag::BankBagsEnd) ServerSlot = sodSlot - 1; - else if (sodSlot >= consts::SHARED_BANK_BAGS_BEGIN && sodSlot <= consts::SHARED_BANK_BAGS_END) + else if (sodSlot >= invbag::SharedBankBagsBegin && sodSlot <= invbag::SharedBankBagsEnd) ServerSlot = sodSlot - 1; - else if (sodSlot == inventory::SlotPowerSource) + else if (sodSlot == invslot::PossessionsPowerSource) ServerSlot = EQEmu::legacy::SlotPowerSource; else ServerSlot = sodSlot; @@ -3956,7 +3956,7 @@ namespace SoD static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink) { - if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { + if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { sodTextLink = serverTextLink; return; } @@ -3996,7 +3996,7 @@ namespace SoD static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink) { - if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sodTextLink.find('\x12') == std::string::npos)) { + if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (sodTextLink.find('\x12') == std::string::npos)) { serverTextLink = sodTextLink; return; } @@ -4005,7 +4005,7 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= constants::SayLinkBodySize) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/sod_limits.cpp b/common/patches/sod_limits.cpp index 93a5c7a3d..de1abba02 100644 --- a/common/patches/sod_limits.cpp +++ b/common/patches/sod_limits.cpp @@ -16,3 +16,240 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "sod_limits.h" + +#include "../string_util.h" + + +size_t SoD::invtype::InvTypeSize(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypePossessions: + return invtype::InvTypePossessionsSize; + case invtype::InvTypeBank: + return invtype::InvTypeBankSize; + case invtype::InvTypeSharedBank: + return invtype::InvTypeSharedBankSize; + case invtype::InvTypeTrade: + return invtype::InvTypeTradeSize; + case invtype::InvTypeWorld: + return invtype::InvTypeWorldSize; + case invtype::InvTypeLimbo: + return invtype::InvTypeLimboSize; + case invtype::InvTypeTribute: + return invtype::InvTypeTributeSize; + case invtype::InvTypeGuildTribute: + return invtype::InvTypeGuildTributeSize; + case invtype::InvTypeMerchant: + return invtype::InvTypeMerchantSize; + case invtype::InvTypeCorpse: + return invtype::InvTypeCorpseSize; + case invtype::InvTypeBazaar: + return invtype::InvTypeBazaarSize; + case invtype::InvTypeInspect: + return invtype::InvTypeInspectSize; + case invtype::InvTypeViewMODPC: + return invtype::InvTypeViewMODPCSize; + case invtype::InvTypeViewMODBank: + return invtype::InvTypeViewMODBankSize; + case invtype::InvTypeViewMODSharedBank: + return invtype::InvTypeViewMODSharedBankSize; + case invtype::InvTypeViewMODLimbo: + return invtype::InvTypeViewMODLimboSize; + case invtype::InvTypeAltStorage: + return invtype::InvTypeAltStorageSize; + case invtype::InvTypeArchived: + return invtype::InvTypeArchivedSize; + case invtype::InvTypeOther: + return invtype::InvTypeOtherSize; + default: + return 0; + } +} + +const char* SoD::invtype::InvTypeName(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypeInvalid: + return "Invalid Type"; + case invtype::InvTypePossessions: + return "Possessions"; + case invtype::InvTypeBank: + return "Bank"; + case invtype::InvTypeSharedBank: + return "Shared Bank"; + case invtype::InvTypeTrade: + return "Trade"; + case invtype::InvTypeWorld: + return "World"; + case invtype::InvTypeLimbo: + return "Limbo"; + case invtype::InvTypeTribute: + return "Tribute"; + case invtype::InvTypeGuildTribute: + return "Guild Tribute"; + case invtype::InvTypeMerchant: + return "Merchant"; + case invtype::InvTypeCorpse: + return "Corpse"; + case invtype::InvTypeBazaar: + return "Bazaar"; + case invtype::InvTypeInspect: + return "Inspect"; + case invtype::InvTypeViewMODPC: + return "View MOD PC"; + case invtype::InvTypeViewMODBank: + return "View MOD Bank"; + case invtype::InvTypeViewMODSharedBank: + return "View MOD Shared Bank"; + case invtype::InvTypeViewMODLimbo: + return "View MOD Limbo"; + case invtype::InvTypeAltStorage: + return "Alt Storage"; + case invtype::InvTypeArchived: + return "Archived"; + case invtype::InvTypeOther: + return "Other"; + default: + return "Unknown Type"; + } +} + +const char* SoD::invslot::InvPossessionsSlotName(int inv_slot) +{ + switch (inv_slot) { + case invslot::InvSlotInvalid: + return "Invalid Slot"; + case invslot::PossessionsCharm: + return "Charm"; + case invslot::PossessionsEar1: + return "Ear 1"; + case invslot::PossessionsHead: + return "Head"; + case invslot::PossessionsFace: + return "Face"; + case invslot::PossessionsEar2: + return "Ear 2"; + case invslot::PossessionsNeck: + return "Neck"; + case invslot::PossessionsShoulders: + return "Shoulders"; + case invslot::PossessionsArms: + return "Arms"; + case invslot::PossessionsBack: + return "Back"; + case invslot::PossessionsWrist1: + return "Wrist 1"; + case invslot::PossessionsWrist2: + return "Wrist 2"; + case invslot::PossessionsRange: + return "Range"; + case invslot::PossessionsHands: + return "Hands"; + case invslot::PossessionsPrimary: + return "Primary"; + case invslot::PossessionsSecondary: + return "Secondary"; + case invslot::PossessionsFinger1: + return "Finger 1"; + case invslot::PossessionsFinger2: + return "Finger 2"; + case invslot::PossessionsChest: + return "Chest"; + case invslot::PossessionsLegs: + return "Legs"; + case invslot::PossessionsFeet: + return "Feet"; + case invslot::PossessionsWaist: + return "Waist"; + case invslot::PossessionsPowerSource: + return "Power Source"; + case invslot::PossessionsAmmo: + return "Ammo"; + case invslot::PossessionsGeneral1: + return "General 1"; + case invslot::PossessionsGeneral2: + return "General 2"; + case invslot::PossessionsGeneral3: + return "General 3"; + case invslot::PossessionsGeneral4: + return "General 4"; + case invslot::PossessionsGeneral5: + return "General 5"; + case invslot::PossessionsGeneral6: + return "General 6"; + case invslot::PossessionsGeneral7: + return "General 7"; + case invslot::PossessionsGeneral8: + return "General 8"; + case invslot::PossessionsCursor: + return "Cursor"; + default: + return "Unknown Slot"; + } +} + +const char* SoD::invslot::InvCorpseSlotName(int inv_slot) +{ + if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + // needs work + if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* SoD::invslot::InvSlotName(int inv_type, int inv_slot) +{ + if (inv_type == invtype::InvTypePossessions) + return invslot::InvPossessionsSlotName(inv_slot); + else if (inv_type == invtype::InvTypeCorpse) + return invslot::InvCorpseSlotName(inv_slot); + + size_t type_size = invtype::InvTypeSize(inv_type); + + if (!type_size || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + if ((size_t)(inv_slot + 1) >= type_size) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* SoD::invbag::InvBagIndexName(int bag_index) +{ + if (bag_index == invbag::InvBagInvalid) + return "Invalid Bag"; + + if ((size_t)bag_index >= invbag::ItemBagSize) + return "Unknown Bag"; + + static std::string ret_str; + ret_str = StringFormat("Bag %i", (bag_index + 1)); + + return ret_str.c_str(); +} + +const char* SoD::invaug::InvAugIndexName(int aug_index) +{ + if (aug_index == invaug::InvAugInvalid) + return "Invalid Augment"; + + if ((size_t)aug_index >= invaug::ItemAugSize) + return "Unknown Augment"; + + static std::string ret_str; + ret_str = StringFormat("Augment %i", (aug_index + 1)); + + return ret_str.c_str(); +} diff --git a/common/patches/sod_limits.h b/common/patches/sod_limits.h index 7a803f957..1d364a431 100644 --- a/common/patches/sod_limits.h +++ b/common/patches/sod_limits.h @@ -17,178 +17,284 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_SOD_CONSTANTS_H -#define COMMON_SOD_CONSTANTS_H +#ifndef COMMON_SOD_LIMITS_H +#define COMMON_SOD_LIMITS_H #include "../types.h" +#include "../client_version.h" +#include "../skills.h" namespace SoD { - namespace inventory { - typedef enum : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, - TypeMail, - TypeGuildTrophyTribute, - TypeOther, - TypeCount - } InventoryTypes; + enum : int { Invalid = -1, Null, Safety }; - typedef enum : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, - SlotPowerSource, - SlotAmmo, - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - SlotCursor, - SlotCount, - SlotEquipmentBegin = SlotCharm, - SlotEquipmentEnd = SlotAmmo, - SlotEquipmentCount = (SlotEquipmentEnd - SlotEquipmentBegin + 1), - SlotGeneralBegin = SlotGeneral1, - SlotGeneralEnd = SlotGeneral8, - SlotGeneralCount = (SlotGeneralEnd - SlotGeneralBegin + 1) - } PossessionsSlots; - } + enum : bool { False = false, True = true }; - namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 12; + // pre-declarations + namespace invtype { + inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::SoD; } - static const uint16 TYPE_POSSESSIONS_SIZE = inventory::SlotCount; - static const uint16 TYPE_BANK_SIZE = 24; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 0; //? - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = inventory::SlotCount; - static const uint16 TYPE_BAZAAR_SIZE = 80; - static const uint16 TYPE_INSPECT_SIZE = inventory::SlotEquipmentCount; - static const uint16 TYPE_REAL_ESTATE_SIZE = 0; - static const uint16 TYPE_VIEW_MOD_PC_SIZE = TYPE_POSSESSIONS_SIZE; - static const uint16 TYPE_VIEW_MOD_BANK_SIZE = TYPE_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = TYPE_SHARED_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = TYPE_LIMBO_SIZE; - static const uint16 TYPE_ALT_STORAGE_SIZE = 0; - static const uint16 TYPE_ARCHIVED_SIZE = 0; - static const uint16 TYPE_MAIL_SIZE = 0; - static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_KRONO_SIZE = NOT_USED; - static const uint16 TYPE_OTHER_SIZE = 0; + enum : int { InvTypeInvalid = -1, InvTypeBegin }; - static const int16 EQUIPMENT_BEGIN = inventory::SlotCharm; - static const int16 EQUIPMENT_END = inventory::SlotAmmo; - static const uint16 EQUIPMENT_SIZE = inventory::SlotEquipmentCount; + enum InventoryType : int { + InvTypePossessions = InvTypeBegin, + InvTypeBank, + InvTypeSharedBank, + InvTypeTrade, + InvTypeWorld, + InvTypeLimbo, + InvTypeTribute, + InvTypeGuildTribute, + InvTypeMerchant, + InvTypeCorpse, + InvTypeBazaar, + InvTypeInspect, + InvTypeViewMODPC, + InvTypeViewMODBank, + InvTypeViewMODSharedBank, + InvTypeViewMODLimbo, + InvTypeAltStorage, + InvTypeArchived, + InvTypeOther, + InvTypeCount + }; - static const int16 GENERAL_BEGIN = inventory::SlotGeneral1; - static const int16 GENERAL_END = inventory::SlotGeneral8; - static const uint16 GENERAL_SIZE = inventory::SlotGeneralCount; - 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; + } /*invtype*/ - static const int16 CURSOR = inventory::SlotCursor; - 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; + namespace invslot { + inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::SoD; } - 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; + enum : int { InvSlotInvalid = -1, InvSlotBegin }; - 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; + enum PossessionsSlot : int { + PossessionsCharm = InvSlotBegin, + PossessionsEar1, + PossessionsHead, + PossessionsFace, + PossessionsEar2, + PossessionsNeck, + PossessionsShoulders, + PossessionsArms, + PossessionsBack, + PossessionsWrist1, + PossessionsWrist2, + PossessionsRange, + PossessionsHands, + PossessionsPrimary, + PossessionsSecondary, + PossessionsFinger1, + PossessionsFinger2, + PossessionsChest, + PossessionsLegs, + PossessionsFeet, + PossessionsWaist, + PossessionsPowerSource, + PossessionsAmmo, + PossessionsGeneral1, + PossessionsGeneral2, + PossessionsGeneral3, + PossessionsGeneral4, + PossessionsGeneral5, + PossessionsGeneral6, + PossessionsGeneral7, + PossessionsGeneral8, + PossessionsCursor, + PossessionsCount + }; - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 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; + const int EquipmentBegin = PossessionsCharm; + const int EquipmentEnd = PossessionsAmmo; + const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; + const int GeneralBegin = PossessionsGeneral1; + const int GeneralEnd = PossessionsGeneral8; + const int GeneralCount = (GeneralEnd - GeneralBegin + 1); - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; + } /*invslot*/ - static const int16 CORPSE_BEGIN = inventory::SlotGeneral1; - static const int16 CORPSE_END = inventory::SlotGeneral1 + inventory::SlotCursor; + namespace invbag { + inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::SoD; } - static const uint16 ITEM_COMMON_SIZE = 5; - static const uint16 ITEM_CONTAINER_SIZE = 10; + enum : int { InvBagInvalid = -1, InvBagBegin }; - static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + } /*invbag*/ - static const size_t POTION_BELT_ITEM_COUNT = 5; + namespace invaug { + inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::SoD; } - static const size_t TEXT_LINK_BODY_LENGTH = 50; + enum : int { InvAugInvalid = -1, InvAugBegin }; - static const size_t PLAYER_PROFILE_SKILL_MAX = SkillTripleAttack; - } + } /*invaug*/ - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = false; - static const bool COIN_HAS_WEIGHT = false; - } + namespace item { + inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::SoD; } + + enum ItemPacketType : int { + ItemPacketMerchant = 100, + ItemPacketTradeView = 101, + ItemPacketLoot = 102, + ItemPacketTrade = 103, + ItemPacketCharInventory = 105, + ItemPacketLimbo = 106, + ItemPacketWorldContainer = 107, + ItemPacketTributeItem = 108, + ItemPacketGuildTribute = 109, + ItemPacketCharmUpdate = 110 + }; + + } /*item*/ + + namespace profile { + inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::SoD; } + + } /*profile*/ + + namespace constants { + inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::SoD; } + + } /*constants*/ + + namespace behavior { + inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::SoD; } + + } /*behavior*/ + + namespace skills { + inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::SoD; } + + } /*skills*/ + + + // declarations + namespace invtype { + const size_t InvTypePossessionsSize = invslot::PossessionsCount; + const size_t InvTypeBankSize = 24; + const size_t InvTypeSharedBankSize = 2; + const size_t InvTypeTradeSize = 8; + const size_t InvTypeWorldSize = 10; + const size_t InvTypeLimboSize = 36; + const size_t InvTypeTributeSize = 5; + const size_t InvTypeGuildTributeSize = 0;//unknown + const size_t InvTypeMerchantSize = 80; + const size_t InvTypeCorpseSize = InvTypePossessionsSize; + const size_t InvTypeBazaarSize = 80; + const size_t InvTypeInspectSize = invslot::EquipmentCount; + const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; + const size_t InvTypeViewMODBankSize = InvTypeBankSize; + const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; + const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; + const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" + const size_t InvTypeArchivedSize = 0;//unknown + const size_t InvTypeOtherSize = 0;//unknown + + const size_t NPCTradeSize = 4; + + extern size_t InvTypeSize(int inv_type); + extern const char* InvTypeName(int inv_type); + + } /*invtype*/ + + namespace invslot { + const int BankBegin = 2000; + const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; + + const int SharedBankBegin = 2500; + const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; + + const int TradeBegin = 3000; + const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; + const int TradeNPCEnd = 3003; + + const int WorldBegin = 4000; + const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; + + const int TributeBegin = 400; + const int TributeEnd = 404; + + const int CorpseBegin = invslot::PossessionsGeneral1; + const int CorpseEnd = invslot::PossessionsGeneral1 + invslot::PossessionsCursor; + + extern const char* InvPossessionsSlotName(int inv_slot); + extern const char* InvCorpseSlotName(int inv_slot); + extern const char* InvSlotName(int inv_type, int inv_slot); + + } /*invslot*/ + + namespace invbag { + const size_t ItemBagSize = 10; + + const int GeneralBagsBegin = 262; + const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; + const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; + + const int CursorBagBegin = 342; + const int CursorBagSize = ItemBagSize; + const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; + + const int BankBagsBegin = 2032; + const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); + const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; + + const int SharedBankBagsBegin = 2532; + const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; + const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; + + const int TradeBagsBegin = 3031; + const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; + const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; + + extern const char* InvBagIndexName(int bag_index); + + } /*invbag*/ + + namespace invaug { + const size_t ItemAugSize = 5; + + extern const char* InvAugIndexName(int aug_index); + + } /*invaug*/ + + namespace item { + + } /*item*/ + + namespace profile { + const size_t TributeSize = invtype::InvTypeTributeSize; + + const size_t BandoliersSize = 20; // number of bandolier instances + const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance + + const size_t PotionBeltSize = 5; + + const size_t SkillArraySize = 100; + + } /*profile*/ + + namespace constants { + const size_t CharacterCreationLimit = 12; + + const size_t SayLinkBodySize = 50; + + } /*constants*/ + + namespace behavior { + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = false; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + + const bool CoinHasWeight = false; + + } /*behavior*/ + + namespace skills { + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; + + } /*skills*/ }; /*SoD*/ -#endif /*COMMON_SOD_CONSTANTS_H*/ +#endif /*COMMON_SOD_LIMITS_H*/ diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 67498f4ad..5acb51ad1 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -726,7 +726,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; //len = 72 @@ -740,7 +740,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct Items[profile::PotionBeltSize]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -960,7 +960,7 @@ struct PlayerProfile_Struct /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 5ea473904..819fd45a8 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1279,18 +1279,18 @@ namespace SoF // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { + for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1300,13 +1300,13 @@ namespace SoF // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -1594,8 +1594,8 @@ namespace SoF eq->CharCount = emu->CharCount; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) - eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + if (eq->TotalChars > constants::CharacterCreationLimit) + eq->TotalChars = constants::CharacterCreationLimit; FINISH_ENCODE(); return; @@ -1607,7 +1607,7 @@ namespace SoF size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -1623,8 +1623,8 @@ namespace SoF eq->CharCount = character_count; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) - eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + if (eq->TotalChars > constants::CharacterCreationLimit) + eq->TotalChars = constants::CharacterCreationLimit; emu_ptr = __emu_buffer; emu_ptr += sizeof(CharacterSelect_Struct); @@ -3027,7 +3027,7 @@ namespace SoF isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < consts::ITEM_COMMON_SIZE; ++index) { + for (int index = 0; index < invaug::ItemAugSize; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -3237,7 +3237,7 @@ namespace SoF else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) SoFSlot = serverSlot + 1; else if (serverSlot == EQEmu::legacy::SlotPowerSource) - SoFSlot = inventory::SlotPowerSource; + SoFSlot = invslot::PossessionsPowerSource; else SoFSlot = serverSlot; @@ -3254,15 +3254,15 @@ namespace SoF { uint32 ServerSlot = 0; - if (sofSlot >= inventory::SlotAmmo && sofSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (sofSlot >= invslot::PossessionsAmmo && sofSlot <= invslot::CorpseEnd) // Cursor/Ammo/Power Source and Normal Inventory Slots ServerSlot = sofSlot - 1; - else if (sofSlot >= consts::GENERAL_BAGS_BEGIN && sofSlot <= consts::CURSOR_BAG_END) + else if (sofSlot >= invbag::GeneralBagsBegin && sofSlot <= invbag::CursorBagEnd) ServerSlot = sofSlot - 11; - else if (sofSlot >= consts::BANK_BAGS_BEGIN && sofSlot <= consts::BANK_BAGS_END) + else if (sofSlot >= invbag::BankBagsBegin && sofSlot <= invbag::BankBagsEnd) ServerSlot = sofSlot - 1; - else if (sofSlot >= consts::SHARED_BANK_BAGS_BEGIN && sofSlot <= consts::SHARED_BANK_BAGS_END) + else if (sofSlot >= invbag::SharedBankBagsBegin && sofSlot <= invbag::SharedBankBagsEnd) ServerSlot = sofSlot - 1; - else if (sofSlot == inventory::SlotPowerSource) + else if (sofSlot == invslot::PossessionsPowerSource) ServerSlot = EQEmu::legacy::SlotPowerSource; else ServerSlot = sofSlot; @@ -3278,7 +3278,7 @@ namespace SoF static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink) { - if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { + if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { sofTextLink = serverTextLink; return; } @@ -3318,7 +3318,7 @@ namespace SoF static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink) { - if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sofTextLink.find('\x12') == std::string::npos)) { + if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (sofTextLink.find('\x12') == std::string::npos)) { serverTextLink = sofTextLink; return; } @@ -3327,7 +3327,7 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= constants::SayLinkBodySize) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/sof_limits.cpp b/common/patches/sof_limits.cpp index 93a5c7a3d..2e81eef1d 100644 --- a/common/patches/sof_limits.cpp +++ b/common/patches/sof_limits.cpp @@ -16,3 +16,240 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "sof_limits.h" + +#include "../string_util.h" + + +size_t SoF::invtype::InvTypeSize(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypePossessions: + return invtype::InvTypePossessionsSize; + case invtype::InvTypeBank: + return invtype::InvTypeBankSize; + case invtype::InvTypeSharedBank: + return invtype::InvTypeSharedBankSize; + case invtype::InvTypeTrade: + return invtype::InvTypeTradeSize; + case invtype::InvTypeWorld: + return invtype::InvTypeWorldSize; + case invtype::InvTypeLimbo: + return invtype::InvTypeLimboSize; + case invtype::InvTypeTribute: + return invtype::InvTypeTributeSize; + case invtype::InvTypeGuildTribute: + return invtype::InvTypeGuildTributeSize; + case invtype::InvTypeMerchant: + return invtype::InvTypeMerchantSize; + case invtype::InvTypeCorpse: + return invtype::InvTypeCorpseSize; + case invtype::InvTypeBazaar: + return invtype::InvTypeBazaarSize; + case invtype::InvTypeInspect: + return invtype::InvTypeInspectSize; + case invtype::InvTypeViewMODPC: + return invtype::InvTypeViewMODPCSize; + case invtype::InvTypeViewMODBank: + return invtype::InvTypeViewMODBankSize; + case invtype::InvTypeViewMODSharedBank: + return invtype::InvTypeViewMODSharedBankSize; + case invtype::InvTypeViewMODLimbo: + return invtype::InvTypeViewMODLimboSize; + case invtype::InvTypeAltStorage: + return invtype::InvTypeAltStorageSize; + case invtype::InvTypeArchived: + return invtype::InvTypeArchivedSize; + case invtype::InvTypeOther: + return invtype::InvTypeOtherSize; + default: + return 0; + } +} + +const char* SoF::invtype::InvTypeName(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypeInvalid: + return "Invalid Type"; + case invtype::InvTypePossessions: + return "Possessions"; + case invtype::InvTypeBank: + return "Bank"; + case invtype::InvTypeSharedBank: + return "Shared Bank"; + case invtype::InvTypeTrade: + return "Trade"; + case invtype::InvTypeWorld: + return "World"; + case invtype::InvTypeLimbo: + return "Limbo"; + case invtype::InvTypeTribute: + return "Tribute"; + case invtype::InvTypeGuildTribute: + return "Guild Tribute"; + case invtype::InvTypeMerchant: + return "Merchant"; + case invtype::InvTypeCorpse: + return "Corpse"; + case invtype::InvTypeBazaar: + return "Bazaar"; + case invtype::InvTypeInspect: + return "Inspect"; + case invtype::InvTypeViewMODPC: + return "View MOD PC"; + case invtype::InvTypeViewMODBank: + return "View MOD Bank"; + case invtype::InvTypeViewMODSharedBank: + return "View MOD Shared Bank"; + case invtype::InvTypeViewMODLimbo: + return "View MOD Limbo"; + case invtype::InvTypeAltStorage: + return "Alt Storage"; + case invtype::InvTypeArchived: + return "Archived"; + case invtype::InvTypeOther: + return "Other"; + default: + return "Unknown Type"; + } +} + +const char* SoF::invslot::InvPossessionsSlotName(int inv_slot) +{ + switch (inv_slot) { + case invslot::InvSlotInvalid: + return "Invalid Slot"; + case invslot::PossessionsCharm: + return "Charm"; + case invslot::PossessionsEar1: + return "Ear 1"; + case invslot::PossessionsHead: + return "Head"; + case invslot::PossessionsFace: + return "Face"; + case invslot::PossessionsEar2: + return "Ear 2"; + case invslot::PossessionsNeck: + return "Neck"; + case invslot::PossessionsShoulders: + return "Shoulders"; + case invslot::PossessionsArms: + return "Arms"; + case invslot::PossessionsBack: + return "Back"; + case invslot::PossessionsWrist1: + return "Wrist 1"; + case invslot::PossessionsWrist2: + return "Wrist 2"; + case invslot::PossessionsRange: + return "Range"; + case invslot::PossessionsHands: + return "Hands"; + case invslot::PossessionsPrimary: + return "Primary"; + case invslot::PossessionsSecondary: + return "Secondary"; + case invslot::PossessionsFinger1: + return "Finger 1"; + case invslot::PossessionsFinger2: + return "Finger 2"; + case invslot::PossessionsChest: + return "Chest"; + case invslot::PossessionsLegs: + return "Legs"; + case invslot::PossessionsFeet: + return "Feet"; + case invslot::PossessionsWaist: + return "Waist"; + case invslot::PossessionsPowerSource: + return "Power Source"; + case invslot::PossessionsAmmo: + return "Ammo"; + case invslot::PossessionsGeneral1: + return "General 1"; + case invslot::PossessionsGeneral2: + return "General 2"; + case invslot::PossessionsGeneral3: + return "General 3"; + case invslot::PossessionsGeneral4: + return "General 4"; + case invslot::PossessionsGeneral5: + return "General 5"; + case invslot::PossessionsGeneral6: + return "General 6"; + case invslot::PossessionsGeneral7: + return "General 7"; + case invslot::PossessionsGeneral8: + return "General 8"; + case invslot::PossessionsCursor: + return "Cursor"; + default: + return "Unknown Slot"; + } +} + +const char* SoF::invslot::InvCorpseSlotName(int inv_slot) +{ + if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + // needs work + if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* SoF::invslot::InvSlotName(int inv_type, int inv_slot) +{ + if (inv_type == invtype::InvTypePossessions) + return invslot::InvPossessionsSlotName(inv_slot); + else if (inv_type == invtype::InvTypeCorpse) + return invslot::InvCorpseSlotName(inv_slot); + + size_t type_size = invtype::InvTypeSize(inv_type); + + if (!type_size || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + if ((size_t)(inv_slot + 1) >= type_size) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* SoF::invbag::InvBagIndexName(int bag_index) +{ + if (bag_index == invbag::InvBagInvalid) + return "Invalid Bag"; + + if ((size_t)bag_index >= invbag::ItemBagSize) + return "Unknown Bag"; + + static std::string ret_str; + ret_str = StringFormat("Bag %i", (bag_index + 1)); + + return ret_str.c_str(); +} + +const char* SoF::invaug::InvAugIndexName(int aug_index) +{ + if (aug_index == invaug::InvAugInvalid) + return "Invalid Augment"; + + if ((size_t)aug_index >= invaug::ItemAugSize) + return "Unknown Augment"; + + static std::string ret_str; + ret_str = StringFormat("Augment %i", (aug_index + 1)); + + return ret_str.c_str(); +} diff --git a/common/patches/sof_limits.h b/common/patches/sof_limits.h index 48855a455..1a91ba942 100644 --- a/common/patches/sof_limits.h +++ b/common/patches/sof_limits.h @@ -17,178 +17,284 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_SOF_CONSTANTS_H -#define COMMON_SOF_CONSTANTS_H +#ifndef COMMON_SOF_LIMITS_H +#define COMMON_SOF_LIMITS_H #include "../types.h" +#include "../client_version.h" +#include "../skills.h" namespace SoF { - namespace inventory { - typedef enum : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, - TypeMail, - TypeGuildTrophyTribute, - TypeOther, - TypeCount - } InventoryTypes; + enum : int { Invalid = -1, Null, Safety }; - typedef enum : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, - SlotPowerSource, - SlotAmmo, - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - SlotCursor, - SlotCount, - SlotEquipmentBegin = SlotCharm, - SlotEquipmentEnd = SlotAmmo, - SlotEquipmentCount = (SlotEquipmentEnd - SlotEquipmentBegin + 1), - SlotGeneralBegin = SlotGeneral1, - SlotGeneralEnd = SlotGeneral8, - SlotGeneralCount = (SlotGeneralEnd - SlotGeneralBegin + 1) - } PossessionsSlots; - } + enum : bool { False = false, True = true }; - namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 12; + // pre-declarations + namespace invtype { + inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::SoF; } - static const uint16 TYPE_POSSESSIONS_SIZE = inventory::SlotCount; - static const uint16 TYPE_BANK_SIZE = 24; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 0; //? - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = inventory::SlotCount; - static const uint16 TYPE_BAZAAR_SIZE = 80; - static const uint16 TYPE_INSPECT_SIZE = inventory::SlotEquipmentCount; - static const uint16 TYPE_REAL_ESTATE_SIZE = 0; - static const uint16 TYPE_VIEW_MOD_PC_SIZE = TYPE_POSSESSIONS_SIZE; - static const uint16 TYPE_VIEW_MOD_BANK_SIZE = TYPE_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = TYPE_SHARED_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = TYPE_LIMBO_SIZE; - static const uint16 TYPE_ALT_STORAGE_SIZE = 0; - static const uint16 TYPE_ARCHIVED_SIZE = 0; - static const uint16 TYPE_MAIL_SIZE = 0; - static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_KRONO_SIZE = NOT_USED; - static const uint16 TYPE_OTHER_SIZE = 0; + enum : int { InvTypeInvalid = -1, InvTypeBegin }; - static const int16 EQUIPMENT_BEGIN = inventory::SlotCharm; - static const int16 EQUIPMENT_END = inventory::SlotAmmo; - static const uint16 EQUIPMENT_SIZE = inventory::SlotEquipmentCount; + enum InventoryType : int { + InvTypePossessions = InvTypeBegin, + InvTypeBank, + InvTypeSharedBank, + InvTypeTrade, + InvTypeWorld, + InvTypeLimbo, + InvTypeTribute, + InvTypeGuildTribute, + InvTypeMerchant, + InvTypeCorpse, + InvTypeBazaar, + InvTypeInspect, + InvTypeViewMODPC, + InvTypeViewMODBank, + InvTypeViewMODSharedBank, + InvTypeViewMODLimbo, + InvTypeAltStorage, + InvTypeArchived, + InvTypeOther, + InvTypeCount + }; - static const int16 GENERAL_BEGIN = inventory::SlotGeneral1; - static const int16 GENERAL_END = inventory::SlotGeneral8; - static const uint16 GENERAL_SIZE = inventory::SlotGeneralCount; - 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; + } /*invtype*/ - static const int16 CURSOR = inventory::SlotCursor; - 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; + namespace invslot { + inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::SoF; } - 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; + enum : int { InvSlotInvalid = -1, InvSlotBegin }; - 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; + enum PossessionsSlot : int { + PossessionsCharm = InvSlotBegin, + PossessionsEar1, + PossessionsHead, + PossessionsFace, + PossessionsEar2, + PossessionsNeck, + PossessionsShoulders, + PossessionsArms, + PossessionsBack, + PossessionsWrist1, + PossessionsWrist2, + PossessionsRange, + PossessionsHands, + PossessionsPrimary, + PossessionsSecondary, + PossessionsFinger1, + PossessionsFinger2, + PossessionsChest, + PossessionsLegs, + PossessionsFeet, + PossessionsWaist, + PossessionsPowerSource, + PossessionsAmmo, + PossessionsGeneral1, + PossessionsGeneral2, + PossessionsGeneral3, + PossessionsGeneral4, + PossessionsGeneral5, + PossessionsGeneral6, + PossessionsGeneral7, + PossessionsGeneral8, + PossessionsCursor, + PossessionsCount + }; - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 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; + const int EquipmentBegin = PossessionsCharm; + const int EquipmentEnd = PossessionsAmmo; + const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; + const int GeneralBegin = PossessionsGeneral1; + const int GeneralEnd = PossessionsGeneral8; + const int GeneralCount = (GeneralEnd - GeneralBegin + 1); - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; + } /*invslot*/ - static const int16 CORPSE_BEGIN = inventory::SlotGeneral1; - static const int16 CORPSE_END = inventory::SlotGeneral1 + inventory::SlotCursor; + namespace invbag { + inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::SoF; } - static const uint16 ITEM_COMMON_SIZE = 5; - static const uint16 ITEM_CONTAINER_SIZE = 10; + enum : int { InvBagInvalid = -1, InvBagBegin }; - static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + } /*invbag*/ - static const size_t POTION_BELT_ITEM_COUNT = 5; + namespace invaug { + inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::SoF; } - static const size_t TEXT_LINK_BODY_LENGTH = 50; + enum : int { InvAugInvalid = -1, InvAugBegin }; - static const size_t PLAYER_PROFILE_SKILL_MAX = SkillTripleAttack; - } + } /*invaug*/ - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = false; - static const bool COIN_HAS_WEIGHT = true; - } + namespace item { + inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::SoF; } + + enum ItemPacketType : int { + ItemPacketMerchant = 100, + ItemPacketTradeView = 101, + ItemPacketLoot = 102, + ItemPacketTrade = 103, + ItemPacketCharInventory = 105, + ItemPacketLimbo = 106, + ItemPacketWorldContainer = 107, + ItemPacketTributeItem = 108, + ItemPacketGuildTribute = 109, + ItemPacketCharmUpdate = 110 + }; + + } /*item*/ + + namespace profile { + inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::SoF; } + + } /*profile*/ + + namespace constants { + inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::SoF; } + + } /*constants*/ + + namespace behavior { + inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::SoF; } + + } /*behavior*/ + + namespace skills { + inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::SoF; } + + } /*skills*/ + + + // declarations + namespace invtype { + const size_t InvTypePossessionsSize = invslot::PossessionsCount; + const size_t InvTypeBankSize = 24; + const size_t InvTypeSharedBankSize = 2; + const size_t InvTypeTradeSize = 8; + const size_t InvTypeWorldSize = 10; + const size_t InvTypeLimboSize = 36; + const size_t InvTypeTributeSize = 5; + const size_t InvTypeGuildTributeSize = 0;//unknown + const size_t InvTypeMerchantSize = 80; + const size_t InvTypeCorpseSize = InvTypePossessionsSize; + const size_t InvTypeBazaarSize = 80; + const size_t InvTypeInspectSize = invslot::EquipmentCount; + const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; + const size_t InvTypeViewMODBankSize = InvTypeBankSize; + const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; + const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; + const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" + const size_t InvTypeArchivedSize = 0;//unknown + const size_t InvTypeOtherSize = 0;//unknown + + const size_t NPCTradeSize = 4; + + extern size_t InvTypeSize(int inv_type); + extern const char* InvTypeName(int inv_type); + + } /*invtype*/ + + namespace invslot { + const int BankBegin = 2000; + const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; + + const int SharedBankBegin = 2500; + const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; + + const int TradeBegin = 3000; + const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; + const int TradeNPCEnd = 3003; + + const int WorldBegin = 4000; + const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; + + const int TributeBegin = 400; + const int TributeEnd = 404; + + const int CorpseBegin = PossessionsGeneral1; + const int CorpseEnd = PossessionsGeneral1 + PossessionsCursor; + + extern const char* InvPossessionsSlotName(int inv_slot); + extern const char* InvCorpseSlotName(int inv_slot); + extern const char* InvSlotName(int inv_type, int inv_slot); + + } /*invslot*/ + + namespace invbag { + const size_t ItemBagSize = 10; + + const int GeneralBagsBegin = 262; + const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; + const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; + + const int CursorBagBegin = 342; + const int CursorBagSize = ItemBagSize; + const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; + + const int BankBagsBegin = 2032; + const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); + const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; + + const int SharedBankBagsBegin = 2532; + const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; + const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; + + const int TradeBagsBegin = 3031; + const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; + const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; + + extern const char* InvBagIndexName(int bag_index); + + } /*invbag*/ + + namespace invaug { + const size_t ItemAugSize = 5; + + extern const char* InvAugIndexName(int aug_index); + + } /*invaug*/ + + namespace item { + + } /*item*/ + + namespace profile { + const size_t TributeSize = invtype::InvTypeTributeSize; + + const size_t BandoliersSize = 20; // number of bandolier instances + const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance + + const size_t PotionBeltSize = 5; + + const size_t SkillArraySize = 100; + + } /*profile*/ + + namespace constants { + const size_t CharacterCreationLimit = 12; + + const size_t SayLinkBodySize = 50; + + } /*constants*/ + + namespace behavior { + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = false; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + + const bool CoinHasWeight = true; + + } /*behavior*/ + + namespace skills { + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; + + } /*skills*/ }; /*SoF*/ -#endif /*COMMON_SOF_CONSTANTS_H*/ +#endif /*COMMON_SOF_LIMITS_H*/ diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 79941cd38..98fecd469 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -705,7 +705,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; //len = 72 @@ -719,7 +719,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct Items[profile::PotionBeltSize]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -938,7 +938,7 @@ struct PlayerProfile_Struct //23576 Octets /*08288*/ uint32 aapoints_spent; // Number of spent AA points /*08292*/ uint32 aapoints; // Unspent AA points /*08296*/ uint8 unknown06160[4]; -/*08300*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents +/*08300*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [6400] bandolier contents /*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*15060*/ uint8 unknown12852[8]; /*15068*/ uint32 available_slots; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 3cde09beb..0cdb9e848 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -966,18 +966,18 @@ namespace Titanium // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { + for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -987,13 +987,13 @@ namespace Titanium // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -2325,7 +2325,7 @@ namespace Titanium ob << StringFormat("%.*s\"", depth, protection); // Quotes (and protection, if needed) around static data // Sub data - for (int index = SUB_INDEX_BEGIN; index < consts::ITEM_CONTAINER_SIZE; ++index) { + for (int index = SUB_INDEX_BEGIN; index < invbag::ItemBagSize; ++index) { ob << '|'; ItemInst* sub = inst->GetItem(index); @@ -2373,7 +2373,7 @@ namespace Titanium static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink) { - if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { + if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { titaniumTextLink = serverTextLink; return; } @@ -2413,7 +2413,7 @@ namespace Titanium static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink) { - if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (titaniumTextLink.find('\x12') == std::string::npos)) { + if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (titaniumTextLink.find('\x12') == std::string::npos)) { serverTextLink = titaniumTextLink; return; } @@ -2422,7 +2422,7 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= constants::SayLinkBodySize) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/titanium_limits.cpp b/common/patches/titanium_limits.cpp index 93a5c7a3d..2d5faac6b 100644 --- a/common/patches/titanium_limits.cpp +++ b/common/patches/titanium_limits.cpp @@ -16,3 +16,238 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "titanium_limits.h" + +#include "../string_util.h" + + +size_t Titanium::invtype::InvTypeSize(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypePossessions: + return invtype::InvTypePossessionsSize; + case invtype::InvTypeBank: + return invtype::InvTypeBankSize; + case invtype::InvTypeSharedBank: + return invtype::InvTypeSharedBankSize; + case invtype::InvTypeTrade: + return invtype::InvTypeTradeSize; + case invtype::InvTypeWorld: + return invtype::InvTypeWorldSize; + case invtype::InvTypeLimbo: + return invtype::InvTypeLimboSize; + case invtype::InvTypeTribute: + return invtype::InvTypeTributeSize; + case invtype::InvTypeGuildTribute: + return invtype::InvTypeGuildTributeSize; + case invtype::InvTypeMerchant: + return invtype::InvTypeMerchantSize; + case invtype::InvTypeCorpse: + return invtype::InvTypeCorpseSize; + case invtype::InvTypeBazaar: + return invtype::InvTypeBazaarSize; + case invtype::InvTypeInspect: + return invtype::InvTypeInspectSize; + case invtype::InvTypeViewMODPC: + return invtype::InvTypeViewMODPCSize; + case invtype::InvTypeViewMODBank: + return invtype::InvTypeViewMODBankSize; + case invtype::InvTypeViewMODSharedBank: + return invtype::InvTypeViewMODSharedBankSize; + case invtype::InvTypeViewMODLimbo: + return invtype::InvTypeViewMODLimboSize; + case invtype::InvTypeAltStorage: + return invtype::InvTypeAltStorageSize; + case invtype::InvTypeArchived: + return invtype::InvTypeArchivedSize; + case invtype::InvTypeOther: + return invtype::InvTypeOtherSize; + default: + return 0; + } +} + +const char* Titanium::invtype::InvTypeName(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypeInvalid: + return "Invalid Type"; + case invtype::InvTypePossessions: + return "Possessions"; + case invtype::InvTypeBank: + return "Bank"; + case invtype::InvTypeSharedBank: + return "Shared Bank"; + case invtype::InvTypeTrade: + return "Trade"; + case invtype::InvTypeWorld: + return "World"; + case invtype::InvTypeLimbo: + return "Limbo"; + case invtype::InvTypeTribute: + return "Tribute"; + case invtype::InvTypeGuildTribute: + return "Guild Tribute"; + case invtype::InvTypeMerchant: + return "Merchant"; + case invtype::InvTypeCorpse: + return "Corpse"; + case invtype::InvTypeBazaar: + return "Bazaar"; + case invtype::InvTypeInspect: + return "Inspect"; + case invtype::InvTypeViewMODPC: + return "View MOD PC"; + case invtype::InvTypeViewMODBank: + return "View MOD Bank"; + case invtype::InvTypeViewMODSharedBank: + return "View MOD Shared Bank"; + case invtype::InvTypeViewMODLimbo: + return "View MOD Limbo"; + case invtype::InvTypeAltStorage: + return "Alt Storage"; + case invtype::InvTypeArchived: + return "Archived"; + case invtype::InvTypeOther: + return "Other"; + default: + return "Unknown Type"; + } +} + +const char* Titanium::invslot::InvPossessionsSlotName(int inv_slot) +{ + switch (inv_slot) { + case invslot::InvSlotInvalid: + return "Invalid Slot"; + case invslot::PossessionsCharm: + return "Charm"; + case invslot::PossessionsEar1: + return "Ear 1"; + case invslot::PossessionsHead: + return "Head"; + case invslot::PossessionsFace: + return "Face"; + case invslot::PossessionsEar2: + return "Ear 2"; + case invslot::PossessionsNeck: + return "Neck"; + case invslot::PossessionsShoulders: + return "Shoulders"; + case invslot::PossessionsArms: + return "Arms"; + case invslot::PossessionsBack: + return "Back"; + case invslot::PossessionsWrist1: + return "Wrist 1"; + case invslot::PossessionsWrist2: + return "Wrist 2"; + case invslot::PossessionsRange: + return "Range"; + case invslot::PossessionsHands: + return "Hands"; + case invslot::PossessionsPrimary: + return "Primary"; + case invslot::PossessionsSecondary: + return "Secondary"; + case invslot::PossessionsFinger1: + return "Finger 1"; + case invslot::PossessionsFinger2: + return "Finger 2"; + case invslot::PossessionsChest: + return "Chest"; + case invslot::PossessionsLegs: + return "Legs"; + case invslot::PossessionsFeet: + return "Feet"; + case invslot::PossessionsWaist: + return "Waist"; + case invslot::PossessionsAmmo: + return "Ammo"; + case invslot::PossessionsGeneral1: + return "General 1"; + case invslot::PossessionsGeneral2: + return "General 2"; + case invslot::PossessionsGeneral3: + return "General 3"; + case invslot::PossessionsGeneral4: + return "General 4"; + case invslot::PossessionsGeneral5: + return "General 5"; + case invslot::PossessionsGeneral6: + return "General 6"; + case invslot::PossessionsGeneral7: + return "General 7"; + case invslot::PossessionsGeneral8: + return "General 8"; + case invslot::PossessionsCursor: + return "Cursor"; + default: + return "Unknown Slot"; + } +} + +const char* Titanium::invslot::InvCorpseSlotName(int inv_slot) +{ + if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + // needs work + if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* Titanium::invslot::InvSlotName(int inv_type, int inv_slot) +{ + if (inv_type == invtype::InvTypePossessions) + return invslot::InvPossessionsSlotName(inv_slot); + else if (inv_type == invtype::InvTypeCorpse) + return invslot::InvCorpseSlotName(inv_slot); + + size_t type_size = invtype::InvTypeSize(inv_type); + + if (!type_size || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + if ((size_t)(inv_slot + 1) >= type_size) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* Titanium::invbag::InvBagIndexName(int bag_index) +{ + if (bag_index == invbag::InvBagInvalid) + return "Invalid Bag"; + + if ((size_t)bag_index >= invbag::ItemBagSize) + return "Unknown Bag"; + + static std::string ret_str; + ret_str = StringFormat("Bag %i", (bag_index + 1)); + + return ret_str.c_str(); +} + +const char* Titanium::invaug::InvAugIndexName(int aug_index) +{ + if (aug_index == invaug::InvAugInvalid) + return "Invalid Augment"; + + if ((size_t)aug_index >= invaug::ItemAugSize) + return "Unknown Augment"; + + static std::string ret_str; + ret_str = StringFormat("Augment %i", (aug_index + 1)); + + return ret_str.c_str(); +} diff --git a/common/patches/titanium_limits.h b/common/patches/titanium_limits.h index 220ad99c7..cbb023efd 100644 --- a/common/patches/titanium_limits.h +++ b/common/patches/titanium_limits.h @@ -17,177 +17,283 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_TITANIUM_CONSTANTS_H -#define COMMON_TITANIUM_CONSTANTS_H +#ifndef COMMON_TITANIUM_LIMITS_H +#define COMMON_TITANIUM_LIMITS_H #include "../types.h" +#include "../client_version.h" +#include "../skills.h" namespace Titanium { - namespace inventory { - typedef enum : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, - TypeMail, - TypeGuildTrophyTribute, - TypeOther, - TypeCount - } InventoryTypes; + enum : int { Invalid = -1, Null, Safety }; - typedef enum : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, - SlotAmmo, - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - SlotCursor, - SlotCount, - SlotEquipmentBegin = SlotCharm, - SlotEquipmentEnd = SlotAmmo, - SlotEquipmentCount = (SlotEquipmentEnd - SlotEquipmentBegin + 1), - SlotGeneralBegin = SlotGeneral1, - SlotGeneralEnd = SlotGeneral8, - SlotGeneralCount = (SlotGeneralEnd - SlotGeneralBegin + 1) - } PossessionsSlots; - } + enum : bool { False = false, True = true }; + + // pre-declarations + namespace invtype { + inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::Titanium; } - namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER + enum : int { InvTypeInvalid = -1, InvTypeBegin }; - static const uint16 TYPE_POSSESSIONS_SIZE = inventory::SlotCount; - static const uint16 TYPE_BANK_SIZE = 16; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 0; //? - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = inventory::SlotCount; - static const uint16 TYPE_BAZAAR_SIZE = 80; - static const uint16 TYPE_INSPECT_SIZE = inventory::SlotEquipmentCount; - static const uint16 TYPE_REAL_ESTATE_SIZE = 0; - static const uint16 TYPE_VIEW_MOD_PC_SIZE = TYPE_POSSESSIONS_SIZE; - static const uint16 TYPE_VIEW_MOD_BANK_SIZE = TYPE_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = TYPE_SHARED_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = TYPE_LIMBO_SIZE; - static const uint16 TYPE_ALT_STORAGE_SIZE = 0; - static const uint16 TYPE_ARCHIVED_SIZE = 0; - static const uint16 TYPE_MAIL_SIZE = 0; - static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_KRONO_SIZE = NOT_USED; - static const uint16 TYPE_OTHER_SIZE = 0; + enum InventoryType : int { + InvTypePossessions = InvTypeBegin, + InvTypeBank, + InvTypeSharedBank, + InvTypeTrade, + InvTypeWorld, + InvTypeLimbo, + InvTypeTribute, + InvTypeGuildTribute, + InvTypeMerchant, + InvTypeCorpse, + InvTypeBazaar, + InvTypeInspect, + InvTypeViewMODPC, + InvTypeViewMODBank, + InvTypeViewMODSharedBank, + InvTypeViewMODLimbo, + InvTypeAltStorage, + InvTypeArchived, + InvTypeOther, + InvTypeCount + }; - static const int16 EQUIPMENT_BEGIN = inventory::SlotCharm; - static const int16 EQUIPMENT_END = inventory::SlotAmmo; - static const uint16 EQUIPMENT_SIZE = inventory::SlotEquipmentCount; + } /*invtype*/ - static const int16 GENERAL_BEGIN = inventory::SlotGeneral1; - static const int16 GENERAL_END = inventory::SlotGeneral8; - static const uint16 GENERAL_SIZE = inventory::SlotGeneralCount; - 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; + namespace invslot { + inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::Titanium; } - static const int16 CURSOR = inventory::SlotCursor; - 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; + enum : int { InvSlotInvalid = -1, InvSlotBegin }; - 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; + enum PossessionsSlot : int { + PossessionsCharm = InvSlotBegin, + PossessionsEar1, + PossessionsHead, + PossessionsFace, + PossessionsEar2, + PossessionsNeck, + PossessionsShoulders, + PossessionsArms, + PossessionsBack, + PossessionsWrist1, + PossessionsWrist2, + PossessionsRange, + PossessionsHands, + PossessionsPrimary, + PossessionsSecondary, + PossessionsFinger1, + PossessionsFinger2, + PossessionsChest, + PossessionsLegs, + PossessionsFeet, + PossessionsWaist, + PossessionsAmmo, + PossessionsGeneral1, + PossessionsGeneral2, + PossessionsGeneral3, + PossessionsGeneral4, + PossessionsGeneral5, + PossessionsGeneral6, + PossessionsGeneral7, + PossessionsGeneral8, + PossessionsCursor, + PossessionsCount + }; - 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; + const int EquipmentBegin = PossessionsCharm; + const int EquipmentEnd = PossessionsAmmo; + const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 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; + const int GeneralBegin = PossessionsGeneral1; + const int GeneralEnd = PossessionsGeneral8; + const int GeneralCount = (GeneralEnd - GeneralBegin + 1); - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; + } /*invslot*/ - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; + namespace invbag { + inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::Titanium; } - static const int16 CORPSE_BEGIN = inventory::SlotGeneral1; - static const int16 CORPSE_END = inventory::SlotGeneral1 + inventory::SlotCursor; + enum : int { InvBagInvalid = -1, InvBagBegin }; - static const uint16 ITEM_COMMON_SIZE = 5; - static const uint16 ITEM_CONTAINER_SIZE = 10; + } /*invbag*/ - static const size_t BANDOLIERS_SIZE = 4; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + namespace invaug { + inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::Titanium; } - static const size_t POTION_BELT_ITEM_COUNT = 4; + enum : int { InvAugInvalid = -1, InvAugBegin }; - static const size_t TEXT_LINK_BODY_LENGTH = 45; + } /*invaug*/ - static const size_t PLAYER_PROFILE_SKILL_MAX = SkillFrenzy; - } + namespace item { + inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::Titanium; } - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = false; - static const bool COIN_HAS_WEIGHT = true; - } + enum ItemPacketType : int { + ItemPacketMerchant = 100, + ItemPacketTradeView = 101, + ItemPacketLoot = 102, + ItemPacketTrade = 103, + ItemPacketCharInventory = 105, + ItemPacketLimbo = 106, + ItemPacketWorldContainer = 107, + ItemPacketTributeItem = 108, + ItemPacketGuildTribute = 109, + ItemPacketCharmUpdate = 110 + }; + + } /*item*/ + + namespace profile { + inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::Titanium; } + + } /*profile*/ + + namespace constants { + inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::Titanium; } + + } /*constants*/ + + namespace behavior { + inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::Titanium; } + + } /*behavior*/ + + namespace skills { + inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::Titanium; } + + } /*skills*/ + + + // declarations + namespace invtype { + const size_t InvTypePossessionsSize = invslot::PossessionsCount; + const size_t InvTypeBankSize = 16; + const size_t InvTypeSharedBankSize = 2; + const size_t InvTypeTradeSize = 8; + const size_t InvTypeWorldSize = 10; + const size_t InvTypeLimboSize = 36; + const size_t InvTypeTributeSize = 5; + const size_t InvTypeGuildTributeSize = 0;//unknown + const size_t InvTypeMerchantSize = 80; + const size_t InvTypeCorpseSize = InvTypePossessionsSize; + const size_t InvTypeBazaarSize = 80; + const size_t InvTypeInspectSize = invslot::EquipmentCount; + const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; + const size_t InvTypeViewMODBankSize = InvTypeBankSize; + const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; + const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; + const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" + const size_t InvTypeArchivedSize = 0;//unknown + const size_t InvTypeOtherSize = 0;//unknown + + const size_t NPCTradeSize = 4; + + extern size_t InvTypeSize(int inv_type); + extern const char* InvTypeName(int inv_type); + + } /*invtype*/ + + namespace invslot { + const int BankBegin = 2000; + const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; + + const int SharedBankBegin = 2500; + const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; + + const int TradeBegin = 3000; + const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; + const int TradeNPCEnd = 3003; + + const int WorldBegin = 4000; + const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; + + const int TributeBegin = 400; + const int TributeEnd = 404; + + const int CorpseBegin = PossessionsGeneral1; + const int CorpseEnd = PossessionsGeneral1 + PossessionsCursor; + + extern const char* InvPossessionsSlotName(int inv_slot); + extern const char* InvCorpseSlotName(int inv_slot); + extern const char* InvSlotName(int inv_type, int inv_slot); + + } /*invslot*/ + + namespace invbag { + const size_t ItemBagSize = 10; + + const int GeneralBagsBegin = 251; + const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; + const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; + + const int CursorBagBegin = 331; + const int CursorBagSize = ItemBagSize; + const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; + + const int BankBagsBegin = 2031; + const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); + const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; + + const int SharedBankBagsBegin = 2531; + const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; + const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; + + const int TradeBagsBegin = 3031; + const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; + const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; + + extern const char* InvBagIndexName(int bag_index); + + } /*invbag*/ + + namespace invaug { + const size_t ItemAugSize = 5; + + extern const char* InvAugIndexName(int aug_index); + + } /*invaug*/ + + namespace item { + + } /*item*/ + + namespace profile { + const size_t TributeSize = invtype::InvTypeTributeSize; + + const size_t BandoliersSize = 4; // number of bandolier instances + const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance + + const size_t PotionBeltSize = 4; + + const size_t SkillArraySize = 100; + + } /*profile*/ + + namespace constants { + const size_t CharacterCreationLimit = 8; // Hard-coded in client - DO NOT ALTER + + const size_t SayLinkBodySize = 45; + + } /*constants*/ + + namespace behavior { + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = false; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + + const bool CoinHasWeight = true; + + } /*behavior*/ + + namespace skills { + const size_t LastUsableSkill = EQEmu::skills::SkillFrenzy; + + } /*skills*/ }; /*Titanium*/ -#endif /*COMMON_TITANIUM_CONSTANTS_H*/ +#endif /*COMMON_TITANIUM_LIMITS_H*/ diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index d3a382855..141966b09 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -633,7 +633,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; //len = 72 @@ -647,7 +647,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct Items[profile::PotionBeltSize]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -851,7 +851,7 @@ struct PlayerProfile_Struct /*06152*/ uint32 aapoints_spent; // Number of spent AA points /*06156*/ uint32 aapoints; // Unspent AA points /*06160*/ uint8 unknown06160[4]; -/*06164*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // bandolier contents +/*06164*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // bandolier contents /*07444*/ uint8 unknown07444[5120]; /*12564*/ PotionBelt_Struct potionbelt; // potion belt /*12852*/ uint8 unknown12852[8]; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index d07914cb8..cb3fc68e3 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1891,18 +1891,18 @@ namespace UF // OUT(unknown06160[4]); // Copy bandoliers where server and client indexes converge - for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) { + for (r = 0; r < EQEmu::legacy::BANDOLIERS_SIZE && r < profile::BandoliersSize; ++r) { OUT_str(bandoliers[r].Name); - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true OUT(bandoliers[r].Items[k].ID); OUT(bandoliers[r].Items[k].Icon); OUT_str(bandoliers[r].Items[k].Name); } } // Nullify bandoliers where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) { + for (r = EQEmu::legacy::BANDOLIERS_SIZE; r < profile::BandoliersSize; ++r) { eq->bandoliers[r].Name[0] = '\0'; - for (uint32 k = 0; k < consts::BANDOLIER_ITEM_COUNT; ++k) { // Will need adjusting if 'server != client' is ever true + for (uint32 k = 0; k < profile::BandolierItemCount; ++k) { // Will need adjusting if 'server != client' is ever true eq->bandoliers[r].Items[k].ID = 0; eq->bandoliers[r].Items[k].Icon = 0; eq->bandoliers[r].Items[k].Name[0] = '\0'; @@ -1912,13 +1912,13 @@ namespace UF // OUT(unknown07444[5120]); // Copy potion belt where server and client indexes converge - for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = 0; r < EQEmu::legacy::POTION_BELT_ITEM_COUNT && r < profile::PotionBeltSize; ++r) { OUT(potionbelt.Items[r].ID); OUT(potionbelt.Items[r].Icon); OUT_str(potionbelt.Items[r].Name); } // Nullify potion belt where server and client indexes diverge, with a client bias - for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) { + for (r = EQEmu::legacy::POTION_BELT_ITEM_COUNT; r < profile::PotionBeltSize; ++r) { eq->potionbelt.Items[r].ID = 0; eq->potionbelt.Items[r].Icon = 0; eq->potionbelt.Items[r].Name[0] = '\0'; @@ -2227,8 +2227,8 @@ namespace UF eq->CharCount = emu->CharCount; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) - eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + if (eq->TotalChars > constants::CharacterCreationLimit) + eq->TotalChars = constants::CharacterCreationLimit; // Special Underfoot adjustment - field should really be 'AdditionalChars' or 'BonusChars' uint32 adjusted_total = eq->TotalChars - 8; // Yes, it rolls under for '< 8' - probably an int32 field @@ -2244,7 +2244,7 @@ namespace UF size_t names_length = 0; size_t character_count = 0; - for (; character_count < emu->CharCount && character_count < consts::CHARACTER_CREATION_LIMIT; ++character_count) { + for (; character_count < emu->CharCount && character_count < constants::CharacterCreationLimit; ++character_count) { emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; names_length += strlen(emu_cse->Name); emu_ptr += sizeof(CharacterSelectEntry_Struct); @@ -2260,8 +2260,8 @@ namespace UF eq->CharCount = character_count; eq->TotalChars = emu->TotalChars; - if (eq->TotalChars > consts::CHARACTER_CREATION_LIMIT) - eq->TotalChars = consts::CHARACTER_CREATION_LIMIT; + if (eq->TotalChars > constants::CharacterCreationLimit) + eq->TotalChars = constants::CharacterCreationLimit; // Special Underfoot adjustment - field should really be 'AdditionalChars' or 'BonusChars' in this client uint32 adjusted_total = eq->TotalChars - 8; // Yes, it rolls under for '< 8' - probably an int32 field @@ -4020,7 +4020,7 @@ namespace UF isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int index = 0; index < consts::ITEM_COMMON_SIZE; ++index) { + for (int index = 0; index < invaug::ItemAugSize; ++index) { isbs.augslots[index].type = item->AugSlotType[index]; isbs.augslots[index].visible = item->AugSlotVisible[index]; isbs.augslots[index].unknown = item->AugSlotUnk2[index]; @@ -4254,7 +4254,7 @@ namespace UF else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END) UnderfootSlot = serverSlot + 1; else if (serverSlot == EQEmu::legacy::SlotPowerSource) - UnderfootSlot = inventory::SlotPowerSource; + UnderfootSlot = invslot::PossessionsPowerSource; else UnderfootSlot = serverSlot; @@ -4271,15 +4271,15 @@ namespace UF { uint32 ServerSlot = 0; - if (ufSlot >= inventory::SlotAmmo && ufSlot <= consts::CORPSE_END) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (ufSlot >= invslot::PossessionsAmmo && ufSlot <= invslot::CorpseEnd) // Cursor/Ammo/Power Source and Normal Inventory Slots ServerSlot = ufSlot - 1; - else if (ufSlot >= consts::GENERAL_BAGS_BEGIN && ufSlot <= consts::CURSOR_BAG_END) + else if (ufSlot >= invbag::GeneralBagsBegin && ufSlot <= invbag::CursorBagEnd) ServerSlot = ufSlot - 11; - else if (ufSlot >= consts::BANK_BAGS_BEGIN && ufSlot <= consts::BANK_BAGS_END) + else if (ufSlot >= invbag::BankBagsBegin && ufSlot <= invbag::BankBagsEnd) ServerSlot = ufSlot - 1; - else if (ufSlot >= consts::SHARED_BANK_BAGS_BEGIN && ufSlot <= consts::SHARED_BANK_BAGS_END) + else if (ufSlot >= invbag::SharedBankBagsBegin && ufSlot <= invbag::SharedBankBagsEnd) ServerSlot = ufSlot - 1; - else if (ufSlot == inventory::SlotPowerSource) + else if (ufSlot == invslot::PossessionsPowerSource) ServerSlot = EQEmu::legacy::SlotPowerSource; else ServerSlot = ufSlot; @@ -4295,7 +4295,7 @@ namespace UF static inline void ServerToUFTextLink(std::string& ufTextLink, const std::string& serverTextLink) { - if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { + if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { ufTextLink = serverTextLink; return; } @@ -4335,7 +4335,7 @@ namespace UF static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink) { - if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (ufTextLink.find('\x12') == std::string::npos)) { + if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (ufTextLink.find('\x12') == std::string::npos)) { serverTextLink = ufTextLink; return; } @@ -4344,7 +4344,7 @@ namespace UF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= constants::SayLinkBodySize) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/uf_limits.cpp b/common/patches/uf_limits.cpp index 93a5c7a3d..8e72b8b03 100644 --- a/common/patches/uf_limits.cpp +++ b/common/patches/uf_limits.cpp @@ -16,3 +16,240 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "uf_limits.h" + +#include "../string_util.h" + + +size_t UF::invtype::InvTypeSize(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypePossessions: + return invtype::InvTypePossessionsSize; + case invtype::InvTypeBank: + return invtype::InvTypeBankSize; + case invtype::InvTypeSharedBank: + return invtype::InvTypeSharedBankSize; + case invtype::InvTypeTrade: + return invtype::InvTypeTradeSize; + case invtype::InvTypeWorld: + return invtype::InvTypeWorldSize; + case invtype::InvTypeLimbo: + return invtype::InvTypeLimboSize; + case invtype::InvTypeTribute: + return invtype::InvTypeTributeSize; + case invtype::InvTypeGuildTribute: + return invtype::InvTypeGuildTributeSize; + case invtype::InvTypeMerchant: + return invtype::InvTypeMerchantSize; + case invtype::InvTypeCorpse: + return invtype::InvTypeCorpseSize; + case invtype::InvTypeBazaar: + return invtype::InvTypeBazaarSize; + case invtype::InvTypeInspect: + return invtype::InvTypeInspectSize; + case invtype::InvTypeViewMODPC: + return invtype::InvTypeViewMODPCSize; + case invtype::InvTypeViewMODBank: + return invtype::InvTypeViewMODBankSize; + case invtype::InvTypeViewMODSharedBank: + return invtype::InvTypeViewMODSharedBankSize; + case invtype::InvTypeViewMODLimbo: + return invtype::InvTypeViewMODLimboSize; + case invtype::InvTypeAltStorage: + return invtype::InvTypeAltStorageSize; + case invtype::InvTypeArchived: + return invtype::InvTypeArchivedSize; + case invtype::InvTypeOther: + return invtype::InvTypeOtherSize; + default: + return 0; + } +} + +const char* UF::invtype::InvTypeName(int inv_type) +{ + switch (inv_type) { + case invtype::InvTypeInvalid: + return "Invalid Type"; + case invtype::InvTypePossessions: + return "Possessions"; + case invtype::InvTypeBank: + return "Bank"; + case invtype::InvTypeSharedBank: + return "Shared Bank"; + case invtype::InvTypeTrade: + return "Trade"; + case invtype::InvTypeWorld: + return "World"; + case invtype::InvTypeLimbo: + return "Limbo"; + case invtype::InvTypeTribute: + return "Tribute"; + case invtype::InvTypeGuildTribute: + return "Guild Tribute"; + case invtype::InvTypeMerchant: + return "Merchant"; + case invtype::InvTypeCorpse: + return "Corpse"; + case invtype::InvTypeBazaar: + return "Bazaar"; + case invtype::InvTypeInspect: + return "Inspect"; + case invtype::InvTypeViewMODPC: + return "View MOD PC"; + case invtype::InvTypeViewMODBank: + return "View MOD Bank"; + case invtype::InvTypeViewMODSharedBank: + return "View MOD Shared Bank"; + case invtype::InvTypeViewMODLimbo: + return "View MOD Limbo"; + case invtype::InvTypeAltStorage: + return "Alt Storage"; + case invtype::InvTypeArchived: + return "Archived"; + case invtype::InvTypeOther: + return "Other"; + default: + return "Unknown Type"; + } +} + +const char* UF::invslot::InvPossessionsSlotName(int inv_slot) +{ + switch (inv_slot) { + case invslot::InvSlotInvalid: + return "Invalid Slot"; + case invslot::PossessionsCharm: + return "Charm"; + case invslot::PossessionsEar1: + return "Ear 1"; + case invslot::PossessionsHead: + return "Head"; + case invslot::PossessionsFace: + return "Face"; + case invslot::PossessionsEar2: + return "Ear 2"; + case invslot::PossessionsNeck: + return "Neck"; + case invslot::PossessionsShoulders: + return "Shoulders"; + case invslot::PossessionsArms: + return "Arms"; + case invslot::PossessionsBack: + return "Back"; + case invslot::PossessionsWrist1: + return "Wrist 1"; + case invslot::PossessionsWrist2: + return "Wrist 2"; + case invslot::PossessionsRange: + return "Range"; + case invslot::PossessionsHands: + return "Hands"; + case invslot::PossessionsPrimary: + return "Primary"; + case invslot::PossessionsSecondary: + return "Secondary"; + case invslot::PossessionsFinger1: + return "Finger 1"; + case invslot::PossessionsFinger2: + return "Finger 2"; + case invslot::PossessionsChest: + return "Chest"; + case invslot::PossessionsLegs: + return "Legs"; + case invslot::PossessionsFeet: + return "Feet"; + case invslot::PossessionsWaist: + return "Waist"; + case invslot::PossessionsPowerSource: + return "Power Source"; + case invslot::PossessionsAmmo: + return "Ammo"; + case invslot::PossessionsGeneral1: + return "General 1"; + case invslot::PossessionsGeneral2: + return "General 2"; + case invslot::PossessionsGeneral3: + return "General 3"; + case invslot::PossessionsGeneral4: + return "General 4"; + case invslot::PossessionsGeneral5: + return "General 5"; + case invslot::PossessionsGeneral6: + return "General 6"; + case invslot::PossessionsGeneral7: + return "General 7"; + case invslot::PossessionsGeneral8: + return "General 8"; + case invslot::PossessionsCursor: + return "Cursor"; + default: + return "Unknown Slot"; + } +} + +const char* UF::invslot::InvCorpseSlotName(int inv_slot) +{ + if (!invtype::InvTypeSize(invtype::InvTypeCorpse) || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + // needs work + if ((size_t)(inv_slot + 1) < invslot::CorpseBegin || (size_t)(inv_slot + 1) >= invslot::CorpseEnd) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* UF::invslot::InvSlotName(int inv_type, int inv_slot) +{ + if (inv_type == invtype::InvTypePossessions) + return invslot::InvPossessionsSlotName(inv_slot); + else if (inv_type == invtype::InvTypeCorpse) + return invslot::InvCorpseSlotName(inv_slot); + + size_t type_size = invtype::InvTypeSize(inv_type); + + if (!type_size || inv_slot == invslot::InvSlotInvalid) + return "Invalid Slot"; + + if ((size_t)(inv_slot + 1) >= type_size) + return "Unknown Slot"; + + static std::string ret_str; + ret_str = StringFormat("Slot %i", (inv_slot + 1)); + + return ret_str.c_str(); +} + +const char* UF::invbag::InvBagIndexName(int bag_index) +{ + if (bag_index == invbag::InvBagInvalid) + return "Invalid Bag"; + + if ((size_t)bag_index >= invbag::ItemBagSize) + return "Unknown Bag"; + + static std::string ret_str; + ret_str = StringFormat("Bag %i", (bag_index + 1)); + + return ret_str.c_str(); +} + +const char* UF::invaug::InvAugIndexName(int aug_index) +{ + if (aug_index == invaug::InvAugInvalid) + return "Invalid Augment"; + + if ((size_t)aug_index >= invaug::ItemAugSize) + return "Unknown Augment"; + + static std::string ret_str; + ret_str = StringFormat("Augment %i", (aug_index + 1)); + + return ret_str.c_str(); +} diff --git a/common/patches/uf_limits.h b/common/patches/uf_limits.h index e19c6e014..e44d7f856 100644 --- a/common/patches/uf_limits.h +++ b/common/patches/uf_limits.h @@ -17,178 +17,285 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_UF_CONSTANTS_H -#define COMMON_UF_CONSTANTS_H +#ifndef COMMON_UF_LIMITS_H +#define COMMON_UF_LIMITS_H #include "../types.h" +#include "../client_version.h" +#include "../skills.h" namespace UF { - namespace inventory { - typedef enum : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, - TypeMail, - TypeGuildTrophyTribute, - TypeOther, - TypeCount - } InventoryTypes; + enum : int { Invalid = -1, Null, Safety }; - typedef enum : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, - SlotPowerSource, - SlotAmmo, - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - SlotCursor, - SlotCount, - SlotEquipmentBegin = SlotCharm, - SlotEquipmentEnd = SlotAmmo, - SlotEquipmentCount = (SlotEquipmentEnd - SlotEquipmentBegin + 1), - SlotGeneralBegin = SlotGeneral1, - SlotGeneralEnd = SlotGeneral8, - SlotGeneralCount = (SlotGeneralEnd - SlotGeneralBegin + 1) - } PossessionsSlots; - } + enum : bool { False = false, True = true }; - namespace consts { - static const size_t CHARACTER_CREATION_LIMIT = 12; + // pre-declarations + namespace invtype { + inline EQEmu::versions::ClientVersion InvTypeRef() { return EQEmu::versions::ClientVersion::UF; } - static const uint16 TYPE_POSSESSIONS_SIZE = inventory::SlotCount; - static const uint16 TYPE_BANK_SIZE = 24; - static const uint16 TYPE_SHARED_BANK_SIZE = 2; - static const uint16 TYPE_TRADE_SIZE = 8; - static const uint16 TYPE_WORLD_SIZE = 10; - static const uint16 TYPE_LIMBO_SIZE = 36; - static const uint16 TYPE_TRIBUTE_SIZE = 0; //? - static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0; - static const uint16 TYPE_MERCHANT_SIZE = 0; - static const uint16 TYPE_DELETED_SIZE = 0; - static const uint16 TYPE_CORPSE_SIZE = inventory::SlotCount; - static const uint16 TYPE_BAZAAR_SIZE = 80; - static const uint16 TYPE_INSPECT_SIZE = inventory::SlotEquipmentCount; - static const uint16 TYPE_REAL_ESTATE_SIZE = 0; - static const uint16 TYPE_VIEW_MOD_PC_SIZE = TYPE_POSSESSIONS_SIZE; - static const uint16 TYPE_VIEW_MOD_BANK_SIZE = TYPE_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = TYPE_SHARED_BANK_SIZE; - static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = TYPE_LIMBO_SIZE; - static const uint16 TYPE_ALT_STORAGE_SIZE = 0; - static const uint16 TYPE_ARCHIVED_SIZE = 0; - static const uint16 TYPE_MAIL_SIZE = 0; - static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 TYPE_KRONO_SIZE = NOT_USED; - static const uint16 TYPE_OTHER_SIZE = 0; + enum : int { InvTypeInvalid = -1, InvTypeBegin }; - static const int16 EQUIPMENT_BEGIN = inventory::SlotCharm; - static const int16 EQUIPMENT_END = inventory::SlotAmmo; - static const uint16 EQUIPMENT_SIZE = inventory::SlotEquipmentCount; + enum InventoryType : int { + InvTypePossessions = InvTypeBegin, + InvTypeBank, + InvTypeSharedBank, + InvTypeTrade, + InvTypeWorld, + InvTypeLimbo, + InvTypeTribute, + InvTypeGuildTribute, + InvTypeMerchant, + InvTypeCorpse, + InvTypeBazaar, + InvTypeInspect, + InvTypeViewMODPC, + InvTypeViewMODBank, + InvTypeViewMODSharedBank, + InvTypeViewMODLimbo, + InvTypeAltStorage, + InvTypeArchived, + InvTypeOther, + InvTypeCount + }; + + } /*invtype*/ - static const int16 GENERAL_BEGIN = inventory::SlotGeneral1; - static const int16 GENERAL_END = inventory::SlotGeneral8; - static const uint16 GENERAL_SIZE = inventory::SlotGeneralCount; - 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; + namespace invslot { + inline EQEmu::versions::ClientVersion InvSlotRef() { return EQEmu::versions::ClientVersion::UF; } - static const int16 CURSOR = inventory::SlotCursor; - 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; + enum : int { InvSlotInvalid = -1, InvSlotBegin }; - 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; + enum PossessionsSlot : int { + PossessionsCharm = InvSlotBegin, + PossessionsEar1, + PossessionsHead, + PossessionsFace, + PossessionsEar2, + PossessionsNeck, + PossessionsShoulders, + PossessionsArms, + PossessionsBack, + PossessionsWrist1, + PossessionsWrist2, + PossessionsRange, + PossessionsHands, + PossessionsPrimary, + PossessionsSecondary, + PossessionsFinger1, + PossessionsFinger2, + PossessionsChest, + PossessionsLegs, + PossessionsFeet, + PossessionsWaist, + PossessionsPowerSource, + PossessionsAmmo, + PossessionsGeneral1, + PossessionsGeneral2, + PossessionsGeneral3, + PossessionsGeneral4, + PossessionsGeneral5, + PossessionsGeneral6, + PossessionsGeneral7, + PossessionsGeneral8, + PossessionsCursor, + PossessionsCount + }; - 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; + const int EquipmentBegin = PossessionsCharm; + const int EquipmentEnd = PossessionsAmmo; + const int EquipmentCount = (EquipmentEnd - EquipmentBegin + 1); - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 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; + const int GeneralBegin = PossessionsGeneral1; + const int GeneralEnd = PossessionsGeneral8; + const int GeneralCount = (GeneralEnd - GeneralBegin + 1); + + } /*invslot*/ - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; + namespace invbag { + inline EQEmu::versions::ClientVersion InvBagRef() { return EQEmu::versions::ClientVersion::UF; } - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; + enum : int { InvBagInvalid = -1, InvBagBegin }; + + } /*invbag*/ - static const int16 CORPSE_BEGIN = inventory::SlotGeneral1; - static const int16 CORPSE_END = inventory::SlotGeneral1 + inventory::SlotCursor; + namespace invaug { + inline EQEmu::versions::ClientVersion InvAugRef() { return EQEmu::versions::ClientVersion::UF; } - static const uint16 ITEM_COMMON_SIZE = 5; - static const uint16 ITEM_CONTAINER_SIZE = 10; + enum : int { InvAugInvalid = -1, InvAugBegin }; + + } /*invaug*/ - static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances - static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance + namespace item { + inline EQEmu::versions::ClientVersion ItemRef() { return EQEmu::versions::ClientVersion::UF; } - static const size_t POTION_BELT_ITEM_COUNT = 5; + enum ItemPacketType : int { + ItemPacketMerchant = 100, + ItemPacketTradeView = 101, + ItemPacketLoot = 102, + ItemPacketTrade = 103, + ItemPacketCharInventory = 105, + ItemPacketLimbo = 106, + ItemPacketWorldContainer = 107, + ItemPacketTributeItem = 108, + ItemPacketGuildTribute = 109, + ItemPacketCharmUpdate = 110, + ItemPacket11 = 111 + }; + + } /*item*/ - static const size_t TEXT_LINK_BODY_LENGTH = 50; + namespace profile { + inline EQEmu::versions::ClientVersion ProfileRef() { return EQEmu::versions::ClientVersion::UF; } + + } /*profile*/ - static const size_t PLAYER_PROFILE_SKILL_MAX = SkillTripleAttack; - } + namespace constants { + inline EQEmu::versions::ClientVersion ConstantsRef() { return EQEmu::versions::ClientVersion::UF; } + + } /*constants*/ - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = false; - static const bool COIN_HAS_WEIGHT = false; - } + namespace behavior { + inline EQEmu::versions::ClientVersion BehaviorRef() { return EQEmu::versions::ClientVersion::UF; } + + } /*behavior*/ + + namespace skills { + inline EQEmu::versions::ClientVersion SkillsRef() { return EQEmu::versions::ClientVersion::UF; } + + } /*skills*/ + + + // declarations + namespace invtype { + const size_t InvTypePossessionsSize = invslot::PossessionsCount; + const size_t InvTypeBankSize = 24; + const size_t InvTypeSharedBankSize = 2; + const size_t InvTypeTradeSize = 8; + const size_t InvTypeWorldSize = 10; + const size_t InvTypeLimboSize = 36; + const size_t InvTypeTributeSize = 5; + const size_t InvTypeGuildTributeSize = 0;//unknown + const size_t InvTypeMerchantSize = 80; + const size_t InvTypeCorpseSize = InvTypePossessionsSize; + const size_t InvTypeBazaarSize = 80; + const size_t InvTypeInspectSize = invslot::EquipmentCount; + const size_t InvTypeViewMODPCSize = InvTypePossessionsSize; + const size_t InvTypeViewMODBankSize = InvTypeBankSize; + const size_t InvTypeViewMODSharedBankSize = InvTypeSharedBankSize; + const size_t InvTypeViewMODLimboSize = InvTypeLimboSize; + const size_t InvTypeAltStorageSize = 0;//unknown - "Shroud Bank" + const size_t InvTypeArchivedSize = 0;//unknown + const size_t InvTypeOtherSize = 0;//unknown + + const size_t NPCTradeSize = 4; + + extern size_t InvTypeSize(int inv_type); + extern const char* InvTypeName(int inv_type); + + } /*invtype*/ + + namespace invslot { + const int BankBegin = 2000; + const int BankEnd = (BankBegin + invtype::InvTypeBankSize) - 1; + + const int SharedBankBegin = 2500; + const int SharedBankEnd = (SharedBankBegin + invtype::InvTypeSharedBankSize) - 1; + + const int TradeBegin = 3000; + const int TradeEnd = (TradeBegin + invtype::InvTypeTradeSize) - 1; + const int TradeNPCEnd = 3003; + + const int WorldBegin = 4000; + const int WorldEnd = (WorldBegin + invtype::InvTypeWorldSize) - 1; + + const int TributeBegin = 400; + const int TributeEnd = 404; + + const int CorpseBegin = invslot::PossessionsGeneral1; + const int CorpseEnd = invslot::PossessionsGeneral1 + invslot::PossessionsCursor; + + extern const char* InvPossessionsSlotName(int inv_slot); + extern const char* InvCorpseSlotName(int inv_slot); + extern const char* InvSlotName(int inv_type, int inv_slot); + + } /*invslot*/ + + namespace invbag { + const size_t ItemBagSize = 10; + + const int GeneralBagsBegin = 262; + const int GeneralBagsSize = invslot::GeneralCount * ItemBagSize; + const int GeneralBagsEnd = (GeneralBagsBegin + GeneralBagsSize) - 1; + + const int CursorBagBegin = 342; + const int CursorBagSize = ItemBagSize; + const int CursorBagEnd = (CursorBagBegin + CursorBagSize) - 1; + + const int BankBagsBegin = 2032; + const int BankBagsSize = (invtype::InvTypeBankSize * ItemBagSize); + const int BankBagsEnd = (BankBagsBegin + BankBagsSize) - 1; + + const int SharedBankBagsBegin = 2532; + const int SharedBankBagsSize = invtype::InvTypeSharedBankSize * ItemBagSize; + const int SharedBankBagsEnd = (SharedBankBagsBegin + SharedBankBagsSize) - 1; + + const int TradeBagsBegin = 3031; + const int TradeBagsSize = invtype::InvTypeTradeSize * ItemBagSize; + const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; + + extern const char* InvBagIndexName(int bag_index); + + } /*invbag*/ + + namespace invaug { + const size_t ItemAugSize = 5; + + extern const char* InvAugIndexName(int aug_index); + + } /*invaug*/ + + namespace item { + + } /*item*/ + + namespace profile { + const size_t TributeSize = invtype::InvTypeTributeSize; + + const size_t BandoliersSize = 20; // number of bandolier instances + const size_t BandolierItemCount = 4; // number of equipment slots in bandolier instance + + const size_t PotionBeltSize = 5; + + const size_t SkillArraySize = 100; + + } /*profile*/ + + namespace constants { + const size_t CharacterCreationLimit = 12; + + const size_t SayLinkBodySize = 50; + + } /*constants*/ + + namespace behavior { + const bool ConcatenateInvTypeLimbo = true; + + const bool AllowOverLevelEquipment = true; + + const bool AllowEmptyBagInBag = false; + const bool AllowClickCastFromBag = false; + + const bool CoinHasWeight = false; + + } /*behavior*/ + + namespace skills { + const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; + + } /*skills*/ }; /*UF*/ -#endif /*COMMON_UF_CONSTANTS_H*/ +#endif /*COMMON_UF_LIMITS_H*/ diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 6c2f198bb..808cef4df 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -773,7 +773,7 @@ struct BandolierItem_Struct struct Bandolier_Struct { char Name[32]; - BandolierItem_Struct Items[consts::BANDOLIER_ITEM_COUNT]; + BandolierItem_Struct Items[profile::BandolierItemCount]; }; //len = 72 @@ -787,7 +787,7 @@ struct PotionBeltItem_Struct //len = 288 struct PotionBelt_Struct { - PotionBeltItem_Struct Items[consts::POTION_BELT_ITEM_COUNT]; + PotionBeltItem_Struct Items[profile::PotionBeltSize]; }; static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; @@ -1010,7 +1010,7 @@ struct PlayerProfile_Struct /*11236*/ uint32 aapoints_spent; // Number of spent AA points /*11240*/ uint32 aapoints; // Unspent AA points /*11244*/ uint8 unknown11244[4]; -/*11248*/ Bandolier_Struct bandoliers[consts::BANDOLIERS_SIZE]; // [6400] bandolier contents +/*11248*/ Bandolier_Struct bandoliers[profile::BandoliersSize]; // [6400] bandolier contents /*17648*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot /*18008*/ uint8 unknown18008[8]; /*18016*/ uint32 available_slots; diff --git a/common/say_link.cpp b/common/say_link.cpp index 3cfc46878..6d64837e3 100644 --- a/common/say_link.cpp +++ b/common/say_link.cpp @@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "say_link.h" #include "emu_constants.h" #include "string_util.h" diff --git a/common/shareddb.cpp b/common/shareddb.cpp index e8046167b..634a2b0b1 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1382,7 +1382,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) { skill_caps_mmf.reset(nullptr); uint32 class_count = PLAYER_CLASS_COUNT; - uint32 skill_count = HIGHEST_SKILL + 1; + uint32 skill_count = EQEmu::skills::HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); @@ -1403,7 +1403,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) { void SharedDatabase::LoadSkillCaps(void *data) { uint32 class_count = PLAYER_CLASS_COUNT; - uint32 skill_count = HIGHEST_SKILL + 1; + uint32 skill_count = EQEmu::skills::HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; uint16 *skill_caps_table = reinterpret_cast(data); @@ -1428,7 +1428,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { } } -uint16 SharedDatabase::GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Level) { +uint16 SharedDatabase::GetSkillCap(uint8 Class_, EQEmu::skills::SkillType Skill, uint8 Level) { if(!skill_caps_mmf) { return 0; } @@ -1442,7 +1442,7 @@ uint16 SharedDatabase::GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Leve } uint32 class_count = PLAYER_CLASS_COUNT; - uint32 skill_count = HIGHEST_SKILL + 1; + uint32 skill_count = EQEmu::skills::HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { return 0; @@ -1457,7 +1457,7 @@ uint16 SharedDatabase::GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Leve return skill_caps_table[index]; } -uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Level) { +uint8 SharedDatabase::GetTrainLevel(uint8 Class_, EQEmu::skills::SkillType Skill, uint8 Level) { if(!skill_caps_mmf) { return 0; } @@ -1471,7 +1471,7 @@ uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Lev } uint32 class_count = PLAYER_CLASS_COUNT; - uint32 skill_count = HIGHEST_SKILL + 1; + uint32 skill_count = EQEmu::skills::HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; if(Class_ > class_count || static_cast(Skill) > skill_count || Level > level_count) { return 0; @@ -1642,10 +1642,10 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { int tmp_skill = atoi(row[100]);; - if(tmp_skill < 0 || tmp_skill > HIGHEST_SKILL) - sp[tempid].skill = SkillBegging; /* not much better we can do. */ // can probably be changed to client-based 'SkillNone' once activated + if (tmp_skill < 0 || tmp_skill > EQEmu::skills::HIGHEST_SKILL) + sp[tempid].skill = EQEmu::skills::SkillBegging; /* not much better we can do. */ // can probably be changed to client-based 'SkillNone' once activated else - sp[tempid].skill = (SkillUseTypes) tmp_skill; + sp[tempid].skill = (EQEmu::skills::SkillType) tmp_skill; sp[tempid].zonetype=atoi(row[101]); sp[tempid].EnvironmentType=atoi(row[102]); diff --git a/common/shareddb.h b/common/shareddb.h index bf21313b7..719735ecd 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -131,8 +131,8 @@ class SharedDatabase : public Database void LoadSkillCaps(void *data); bool LoadSkillCaps(const std::string &prefix); - uint16 GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Level); - uint8 GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Level); + uint16 GetSkillCap(uint8 Class_, EQEmu::skills::SkillType Skill, uint8 Level); + uint8 GetTrainLevel(uint8 Class_, EQEmu::skills::SkillType Skill, uint8 Level); int GetMaxSpellID(); bool LoadSpells(const std::string &prefix, int32 *records, const SPDat_Spell_Struct **sp); diff --git a/common/skills.cpp b/common/skills.cpp index bc5942fcd..1e6827490 100644 --- a/common/skills.cpp +++ b/common/skills.cpp @@ -1,5 +1,6 @@ /* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) + + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -9,17 +10,20 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "types.h" #include "skills.h" -bool EQEmu::IsTradeskill(SkillUseTypes skill) +#include + + +bool EQEmu::skills::IsTradeskill(SkillType skill) { switch (skill) { case SkillFishing: @@ -40,7 +44,7 @@ bool EQEmu::IsTradeskill(SkillUseTypes skill) } } -bool EQEmu::IsSpecializedSkill(SkillUseTypes skill) +bool EQEmu::skills::IsSpecializedSkill(SkillType skill) { // this could be a simple if, but if this is more portable if any IDs change (probably won't) // or any other specialized are added (also unlikely) @@ -56,7 +60,7 @@ bool EQEmu::IsSpecializedSkill(SkillUseTypes skill) } } -float EQEmu::GetSkillMeleePushForce(SkillUseTypes skill) +float EQEmu::skills::GetSkillMeleePushForce(SkillType skill) { // This is the force/magnitude of the push from an attack of this skill type // You can find these numbers in the clients skill struct @@ -93,7 +97,7 @@ float EQEmu::GetSkillMeleePushForce(SkillUseTypes skill) } } -bool EQEmu::IsBardInstrumentSkill(SkillUseTypes skill) +bool EQEmu::skills::IsBardInstrumentSkill(SkillType skill) { switch (skill) { case SkillBrassInstruments: @@ -107,7 +111,7 @@ bool EQEmu::IsBardInstrumentSkill(SkillUseTypes skill) } } -const std::map& EQEmu::GetSkillUseTypesMap() +const std::map& EQEmu::skills::GetSkillTypeMap() { /* VS2013 code static const std::map skill_use_types_map = { @@ -194,7 +198,7 @@ const std::map& EQEmu::GetSkillUseTypesMap() /* VS2012 code - begin */ - static const char* skill_use_names[_EmuSkillCount] = { + static const char* skill_use_names[SkillCount] = { "1H Blunt", "1H Slashing", "2H Blunt", @@ -275,14 +279,160 @@ const std::map& EQEmu::GetSkillUseTypesMap() "2H Piercing" }; - static std::map skill_use_types_map; + static std::map skill_type_map; - skill_use_types_map.clear(); + skill_type_map.clear(); - for (int i = Skill1HBlunt; i < _EmuSkillCount; ++i) - skill_use_types_map[(SkillUseTypes)i] = skill_use_names[i]; + for (int i = Skill1HBlunt; i < SkillCount; ++i) + skill_type_map[(SkillType)i] = skill_use_names[i]; /* VS2012 code - end */ - return skill_use_types_map; + return skill_type_map; +} + +struct EQEmu::SkillProfile // prototype - not implemented +{ + union { + struct { + uint32 _1HBlunt; + uint32 _1HSlashing; + uint32 _2HBlunt; + uint32 _2HSlashing; + uint32 Abjuration; + uint32 Alteration; + uint32 ApplyPoison; + uint32 Archery; + uint32 Backstab; + uint32 BindWound; + uint32 Bash; + uint32 Block; + uint32 BrassInstruments; + uint32 Channeling; + uint32 Conjuration; + uint32 Defense; + uint32 Disarm; + uint32 DisarmTraps; + uint32 Divination; + uint32 Dodge; + uint32 DoubleAttack; + union { + uint32 DragonPunch; + uint32 TailRake; + }; + uint32 DualWield; + uint32 EagleStrike; + uint32 Evocation; + uint32 FeignDeath; + uint32 FlyingKick; + uint32 Forage; + uint32 HandtoHand; + uint32 Hide; + uint32 Kick; + uint32 Meditate; + uint32 Mend; + uint32 Offense; + uint32 Parry; + uint32 PickLock; + uint32 _1HPiercing; + uint32 Riposte; + uint32 RoundKick; + uint32 SafeFall; + uint32 SenseHeading; + uint32 Singing; + uint32 Sneak; + uint32 SpecializeAbjure; + uint32 SpecializeAlteration; + uint32 SpecializeConjuration; + uint32 SpecializeDivination; + uint32 SpecializeEvocation; + uint32 PickPockets; + uint32 StringedInstruments; + uint32 Swimming; + uint32 Throwing; + uint32 TigerClaw; + uint32 Tracking; + uint32 WindInstruments; + uint32 Fishing; + uint32 MakePoison; + uint32 Tinkering; + uint32 Research; + uint32 Alchemy; + uint32 Baking; + uint32 Tailoring; + uint32 SenseTraps; + uint32 Blacksmithing; + uint32 Fletching; + uint32 Brewing; + uint32 AlcoholTolerance; + uint32 Begging; + uint32 JewelryMaking; + uint32 Pottery; + uint32 PercussionInstruments; + uint32 Intimidation; + uint32 Berserking; + uint32 Taunt; + uint32 Frenzy; + uint32 RemoveTraps; + uint32 TripleAttack; + uint32 _2HPiercing; + uint32 unused1; + uint32 unused2; + uint32 unused3; + uint32 unused4; + uint32 unused5; + uint32 unused6; + uint32 unused7; + uint32 unused8; + uint32 unused9; + uint32 unused10; + uint32 unused11; + uint32 unused12; + uint32 unused13; + uint32 unused14; + uint32 unused15; + uint32 unused16; + uint32 unused17; + uint32 unused18; + uint32 unused19; + uint32 unused20; + uint32 unused21; + uint32 unused22; + }; + uint32 skill[PACKET_SKILL_ARRAY_SIZE]; + }; + + SkillProfile(); + + uint32* GetSkills() { return reinterpret_cast(&skill); } + + skills::SkillType GetLastUseableSkill() { return EQEmu::skills::Skill2HPiercing; } + + size_t GetSkillsArraySize() { return PACKET_SKILL_ARRAY_SIZE; } + uint32 GetSkill(int skill_id); + + uint32 operator[](int skill_id) { return GetSkill(skill_id); } + + // const + uint32* GetSkills() const { return const_cast(this)->GetSkills(); } + + skills::SkillType GetLastUseableSkill() const { return const_cast(this)->GetLastUseableSkill(); } + + size_t GetSkillsArraySize() const { return const_cast(this)->GetSkillsArraySize(); } + uint32 GetSkill(int skill_id) const { return const_cast(this)->GetSkill(skill_id); } + + uint32 operator[](int skill_id) const { return const_cast(this)->GetSkill(skill_id); } +}; + +EQEmu::SkillProfile::SkillProfile() +{ + memset(&skill, 0, (sizeof(uint32) * PACKET_SKILL_ARRAY_SIZE)); +} + +uint32 EQEmu::SkillProfile::GetSkill(int skill_id) +{ + if (skill_id < 0 || skill_id >= PACKET_SKILL_ARRAY_SIZE) + return 0; + + return skill[skill_id]; } diff --git a/common/skills.h b/common/skills.h index 0868c3329..af8f4a543 100644 --- a/common/skills.h +++ b/common/skills.h @@ -1,5 +1,6 @@ /* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.org) + + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -9,25 +10,24 @@ 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. + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef SKILLS_H -#define SKILLS_H + +#ifndef COMMON_SKILLS_H +#define COMMON_SKILLS_H #include #include -/* -** Skill use types -** -** (ref: eqstr_us.txt [05-10-2013]) -*/ -enum SkillUseTypes + +namespace EQEmu { + namespace skills { + enum SkillType : int { /*13855*/ Skill1HBlunt = 0, /*13856*/ Skill1HSlashing, /*13857*/ Skill2HBlunt, @@ -111,78 +111,65 @@ enum SkillUseTypes // RoF2+ specific skills /*00789*/ Skill2HPiercing, // 77 -// /*01216*/ SkillNone, // This needs to move down as new skills are added +// /*01216*/ SkillNone, // This needs to move down as new skills are added -/*00000*/ _EmuSkillCount // move to last position of active enumeration labels +/*00000*/ SkillCount // move to last position of active enumeration labels // Skill Counts -// /*-----*/ _SkillCount_62 = 75, // use for Ti and earlier max skill checks -// /*-----*/ _SkillCount_SoF = 77, // use for SoF thru RoF1 max skill checks -// /*-----*/ _SkillCount_RoF2 = 78, // use for RoF2 max skill checks +// /*-----*/ SkillCount_62 = 75, // use for Ti and earlier max skill checks +// /*-----*/ SkillCount_SoF = 77, // use for SoF thru RoF1 max skill checks +// /*-----*/ SkillCount_RoF2 = 78, // use for RoF2 max skill checks // Support values -// /*-----*/ _SkillServerArraySize = _SkillCount_RoF2, // Should reflect last client '_SkillCount' +// /*-----*/ SkillServerArraySize = _SkillCount_RoF2, // Should reflect last client '_SkillCount' // Superfluous additions to SkillUseTypes..server-use only // /*-----*/ ExtSkillGenericTradeskill = 100 -/* ([EQClientVersion] [0] - Unknown, [3] - SoF, [7] - RoF2[05-10-2013]) - [Skill] [index] | [0] [1] [2] [3] [4] [5] [6] [7] - Frenzy (05837) | --- 074 074 074 074 074 074 074 - Remove Traps (03670) | --- --- --- 075 075 075 075 075 - Triple Attack (13049) | --- --- --- 076 076 076 076 076 - 2H Piercing (00789) | --- --- --- --- --- --- --- 077 -*/ + /* ([EQClientVersion] [0] - Unknown, [3] - SoF, [7] - RoF2[05-10-2013]) + [Skill] [index] | [0] [1] [2] [3] [4] [5] [6] [7] + Frenzy (05837) | --- 074 074 074 074 074 074 074 + Remove Traps (03670) | --- --- --- 075 075 075 075 075 + Triple Attack (13049) | --- --- --- 076 076 076 076 076 + 2H Piercing (00789) | --- --- --- --- --- --- --- 077 + */ -/* - [SkillCaps.txt] (SoF+) - a^b^c^d(^e) (^e is RoF+, but cursory glance appears to be all zeros) + /* + [SkillCaps.txt] (SoF+) + a^b^c^d(^e) (^e is RoF+, but cursory glance appears to be all zeros) - a - Class - b - Skill - c - Level - d - Max Value - (e - Unknown) -*/ + a - Class + b - Skill + c - Level + d - Max Value + (e - Unknown) + */ -/* - NOTE: Disregard this until it is sorted out + /* + Changed (tradeskill==75) to ExtSkillGenericTradeskill in tradeskills.cpp for both instances. If it's a pseudo-enumeration of + an AA ability, then use the 'ExtSkill' ('ExtendedSkill') prefix with a value >= 100. (current implementation) + */ + }; - I changed (tradeskill==75) to ExtSkillGenericTradeskill in tradeskills.cpp for both instances. If it's a pseudo-enumeration of - an AA ability, then use the 'ExtSkill' ('ExtendedSkill') prefix with a value >= 100. (current implementation) - - We probably need to recode ALL of the skill checks to use the new Skill2HPiercing and ensure that the animation value is - properly changed in the patch files. As far as earlier clients using this new skill, it can be done, but we just need to ensure - that skill address is not inadvertently passed to the client..and we can just send an actual message for the skill-up. Use of a - command can tell the player what that particular skill value is. - - Nothing on SkillTripleAttack just yet..haven't looked into its current implementation. - - In addition to the above re-coding, we're probably going to need to rework the database pp blob to reserve space for the current - 100-dword buffer allocation. This way, we can just add new ones without having to rework it each time. - (Wasn't done for this in particular..but, thanks Akkadius!) - - -U -*/ -}; - -// temporary until it can be sorted out... + // temporary until it can be sorted out... #define HIGHEST_SKILL Skill2HPiercing -// Spell Effects use this value to determine if an effect applies to all skills. + // Spell Effects use this value to determine if an effect applies to all skills. #define ALL_SKILLS -1 -// server profile does not reflect this yet..so, prefixed with 'PACKET_' + // server profile does not reflect this yet..so, prefixed with 'PACKET_' #define PACKET_SKILL_ARRAY_SIZE 100 + extern bool IsTradeskill(SkillType skill); + extern bool IsSpecializedSkill(SkillType skill); + extern float GetSkillMeleePushForce(SkillType skill); + extern bool IsBardInstrumentSkill(SkillType skill); -// for skill related helper functions -namespace EQEmu { - bool IsTradeskill(SkillUseTypes skill); - bool IsSpecializedSkill(SkillUseTypes skill); - float GetSkillMeleePushForce(SkillUseTypes skill); - bool IsBardInstrumentSkill(SkillUseTypes skill); + extern const std::map& GetSkillTypeMap(); - const std::map& GetSkillUseTypesMap(); -} + } /*skills*/ -#endif + struct SkillProfile; + +} /*EQEmu*/ + +#endif /*COMMON_SKILLS_H*/ diff --git a/common/spdat.h b/common/spdat.h index 0e9096f1a..d083f0dbd 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -681,7 +681,7 @@ struct SPDat_Spell_Struct /* 086 */ int effectid[EFFECT_COUNT]; // Spell's effects /* 098 */ SpellTargetType targettype; // Spell's Target /* 099 */ int basediff; // base difficulty fizzle adjustment -/* 100 */ SkillUseTypes skill; +/* 100 */ EQEmu::skills::SkillType skill; /* 101 */ int8 zonetype; // 01=Outdoors, 02=dungeons, ff=Any /* 102 */ int8 EnvironmentType; /* 103 */ int8 TimeOfDay; diff --git a/shared_memory/skill_caps.cpp b/shared_memory/skill_caps.cpp index bd8eabb5a..758ce6955 100644 --- a/shared_memory/skill_caps.cpp +++ b/shared_memory/skill_caps.cpp @@ -30,7 +30,7 @@ void LoadSkillCaps(SharedDatabase *database, const std::string &prefix) { mutex.Lock(); uint32 class_count = PLAYER_CLASS_COUNT; - uint32 skill_count = HIGHEST_SKILL + 1; + uint32 skill_count = EQEmu::skills::HIGHEST_SKILL + 1; uint32 level_count = HARD_LEVEL_CAP + 1; uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); diff --git a/tests/skills_util_test.h b/tests/skills_util_test.h index 96507256e..478de4206 100644 --- a/tests/skills_util_test.h +++ b/tests/skills_util_test.h @@ -35,13 +35,13 @@ public: private: void IsTradeskill() { - TEST_ASSERT(EQEmu::IsTradeskill(SkillPottery)); - TEST_ASSERT(!EQEmu::IsTradeskill(SkillParry)); + TEST_ASSERT(EQEmu::skills::IsTradeskill(EQEmu::skills::SkillPottery)); + TEST_ASSERT(!EQEmu::skills::IsTradeskill(EQEmu::skills::SkillParry)); } void IsSpecializedSkill() { - TEST_ASSERT(EQEmu::IsSpecializedSkill(SkillSpecializeConjuration)); - TEST_ASSERT(!EQEmu::IsSpecializedSkill(SkillConjuration)) + TEST_ASSERT(EQEmu::skills::IsSpecializedSkill(EQEmu::skills::SkillSpecializeConjuration)); + TEST_ASSERT(!EQEmu::skills::IsSpecializedSkill(EQEmu::skills::SkillConjuration)) } }; diff --git a/world/client.cpp b/world/client.cpp index 7065c79f5..057db0961 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -211,9 +211,9 @@ void Client::SendMaxCharCreate() { auto outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct)); MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer; - mc->max_chars = EQEmu::limits::CharacterCreationLimit(m_ClientVersion); - if (mc->max_chars > EQEmu::constants::CharacterCreationLimit) - mc->max_chars = EQEmu::constants::CharacterCreationLimit; + mc->max_chars = EQEmu::constants::CharacterCreationLimit(m_ClientVersion); + if (mc->max_chars > EQEmu::constants::CharacterCreationMax) + mc->max_chars = EQEmu::constants::CharacterCreationMax; QueuePacket(outapp); safe_delete(outapp); @@ -746,8 +746,8 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { // This can probably be moved outside and have another method return requested info (don't forget to remove the #include "../common/shareddb.h" above) // (This is a literal translation of the original process..I don't see why it can't be changed to a single-target query over account iteration) if (!pZoning) { - size_t character_limit = EQEmu::limits::CharacterCreationLimit(eqs->ClientVersion()); - if (character_limit > EQEmu::constants::CharacterCreationLimit) { character_limit = EQEmu::constants::CharacterCreationLimit; } + size_t character_limit = EQEmu::constants::CharacterCreationLimit(eqs->ClientVersion()); + if (character_limit > EQEmu::constants::CharacterCreationMax) { character_limit = EQEmu::constants::CharacterCreationMax; } if (eqs->ClientVersion() == EQEmu::versions::ClientVersion::Titanium) { character_limit = 8; } std::string tgh_query = StringFormat( @@ -1464,8 +1464,8 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) SetClassStartingSkills(&pp); SetClassLanguages(&pp); - pp.skills[SkillSwimming] = RuleI(Skills, SwimmingStartValue); - pp.skills[SkillSenseHeading] = RuleI(Skills, SenseHeadingStartValue); + pp.skills[EQEmu::skills::SkillSwimming] = RuleI(Skills, SwimmingStartValue); + pp.skills[EQEmu::skills::SkillSenseHeading] = RuleI(Skills, SenseHeadingStartValue); // strcpy(pp.servername, WorldConfig::get()->ShortName.c_str()); @@ -1839,21 +1839,21 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) { - for (uint32 i = 0; i <= HIGHEST_SKILL; ++i) { + for (uint32 i = 0; i <= EQEmu::skills::HIGHEST_SKILL; ++i) { if (pp->skills[i] == 0) { // Skip specialized, tradeskills (fishing excluded), Alcohol Tolerance, and Bind Wound - if (EQEmu::IsSpecializedSkill((SkillUseTypes)i) || - (EQEmu::IsTradeskill((SkillUseTypes)i) && i != SkillFishing) || - i == SkillAlcoholTolerance || i == SkillBindWound) + if (EQEmu::skills::IsSpecializedSkill((EQEmu::skills::SkillType)i) || + (EQEmu::skills::IsTradeskill((EQEmu::skills::SkillType)i) && i != EQEmu::skills::SkillFishing) || + i == EQEmu::skills::SkillAlcoholTolerance || i == EQEmu::skills::SkillBindWound) continue; - pp->skills[i] = database.GetSkillCap(pp->class_, (SkillUseTypes)i, 1); + pp->skills[i] = database.GetSkillCap(pp->class_, (EQEmu::skills::SkillType)i, 1); } } if (cle->GetClientVersion() < static_cast(EQEmu::versions::ClientVersion::RoF2) && pp->class_ == BERSERKER) { - pp->skills[Skill1HPiercing] = pp->skills[Skill2HPiercing]; - pp->skills[Skill2HPiercing] = 0; + pp->skills[EQEmu::skills::Skill1HPiercing] = pp->skills[EQEmu::skills::Skill2HPiercing]; + pp->skills[EQEmu::skills::Skill2HPiercing] = 0; } } @@ -1876,41 +1876,41 @@ void Client::SetRaceStartingSkills( PlayerProfile_Struct *pp ) } case DARK_ELF: { - pp->skills[SkillHide] = 50; + pp->skills[EQEmu::skills::SkillHide] = 50; break; } case FROGLOK: { - pp->skills[SkillSwimming] = 125; + pp->skills[EQEmu::skills::SkillSwimming] = 125; break; } case GNOME: { - pp->skills[SkillTinkering] = 50; + pp->skills[EQEmu::skills::SkillTinkering] = 50; break; } case HALFLING: { - pp->skills[SkillHide] = 50; - pp->skills[SkillSneak] = 50; + pp->skills[EQEmu::skills::SkillHide] = 50; + pp->skills[EQEmu::skills::SkillSneak] = 50; break; } case IKSAR: { - pp->skills[SkillForage] = 50; - pp->skills[SkillSwimming] = 100; + pp->skills[EQEmu::skills::SkillForage] = 50; + pp->skills[EQEmu::skills::SkillSwimming] = 100; break; } case WOOD_ELF: { - pp->skills[SkillForage] = 50; - pp->skills[SkillHide] = 50; + pp->skills[EQEmu::skills::SkillForage] = 50; + pp->skills[EQEmu::skills::SkillHide] = 50; break; } case VAHSHIR: { - pp->skills[SkillSafeFall] = 50; - pp->skills[SkillSneak] = 50; + pp->skills[EQEmu::skills::SkillSafeFall] = 50; + pp->skills[EQEmu::skills::SkillSneak] = 50; break; } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 0deb8c052..b41672a33 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -37,11 +37,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou { /* Set Character Creation Limit */ EQEmu::versions::ClientVersion client_version = EQEmu::versions::ConvertClientVersionBitToClientVersion(clientVersionBit); - size_t character_limit = EQEmu::limits::CharacterCreationLimit(client_version); + size_t character_limit = EQEmu::constants::CharacterCreationLimit(client_version); // Validate against absolute server max - if (character_limit > EQEmu::constants::CharacterCreationLimit) - character_limit = EQEmu::constants::CharacterCreationLimit; + if (character_limit > EQEmu::constants::CharacterCreationMax) + character_limit = EQEmu::constants::CharacterCreationMax; // Force Titanium clients to use '8' if (client_version == EQEmu::versions::ClientVersion::Titanium) diff --git a/zone/attack.cpp b/zone/attack.cpp index 354517279..8cf3971f8 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -50,7 +50,7 @@ extern WorldServer worldserver; extern EntityList entity_list; extern Zone* zone; -bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon) +bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const ItemInst* weapon) { // Determine animation int type = 0; @@ -61,63 +61,63 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w switch (item->ItemType) { case EQEmu::item::ItemType1HSlash: // 1H Slashing - skillinuse = Skill1HSlashing; + skillinuse = EQEmu::skills::Skill1HSlashing; type = anim1HWeapon; break; case EQEmu::item::ItemType2HSlash: // 2H Slashing - skillinuse = Skill2HSlashing; + skillinuse = EQEmu::skills::Skill2HSlashing; type = anim2HSlashing; break; case EQEmu::item::ItemType1HPiercing: // Piercing - skillinuse = Skill1HPiercing; + skillinuse = EQEmu::skills::Skill1HPiercing; type = anim1HPiercing; break; case EQEmu::item::ItemType1HBlunt: // 1H Blunt - skillinuse = Skill1HBlunt; + skillinuse = EQEmu::skills::Skill1HBlunt; type = anim1HWeapon; break; case EQEmu::item::ItemType2HBlunt: // 2H Blunt - skillinuse = Skill2HBlunt; + skillinuse = EQEmu::skills::Skill2HBlunt; type = anim2HSlashing; //anim2HWeapon break; case EQEmu::item::ItemType2HPiercing: // 2H Piercing if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - skillinuse = Skill1HPiercing; + skillinuse = EQEmu::skills::Skill1HPiercing; else - skillinuse = Skill2HPiercing; + skillinuse = EQEmu::skills::Skill2HPiercing; type = anim2HWeapon; break; case EQEmu::item::ItemTypeMartial: - skillinuse = SkillHandtoHand; + skillinuse = EQEmu::skills::SkillHandtoHand; type = animHand2Hand; break; default: - skillinuse = SkillHandtoHand; + skillinuse = EQEmu::skills::SkillHandtoHand; type = animHand2Hand; break; }// switch } else if(IsNPC()) { switch (skillinuse) { - case Skill1HSlashing: // 1H Slashing + case EQEmu::skills::Skill1HSlashing: // 1H Slashing type = anim1HWeapon; break; - case Skill2HSlashing: // 2H Slashing + case EQEmu::skills::Skill2HSlashing: // 2H Slashing type = anim2HSlashing; break; - case Skill1HPiercing: // Piercing + case EQEmu::skills::Skill1HPiercing: // Piercing type = anim1HPiercing; break; - case Skill1HBlunt: // 1H Blunt + case EQEmu::skills::Skill1HBlunt: // 1H Blunt type = anim1HWeapon; break; - case Skill2HBlunt: // 2H Blunt + case EQEmu::skills::Skill2HBlunt: // 2H Blunt type = anim2HSlashing; //anim2HWeapon break; - case Skill2HPiercing: // 2H Piercing + case EQEmu::skills::Skill2HPiercing: // 2H Piercing type = anim2HWeapon; break; - case SkillHandtoHand: + case EQEmu::skills::SkillHandtoHand: type = animHand2Hand; break; default: @@ -126,7 +126,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w }// switch } else { - skillinuse = SkillHandtoHand; + skillinuse = EQEmu::skills::SkillHandtoHand; type = animHand2Hand; } @@ -140,7 +140,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w // called when a mob is attacked, does the checks to see if it's a hit // and does other mitigation checks. 'this' is the mob being attacked. -bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 chance_mod) +bool Mob::CheckHitChance(Mob* other, EQEmu::skills::SkillType skillinuse, int Hand, int16 chance_mod) { /*/ //Reworked a lot of this code to achieve better balance at higher levels. @@ -218,7 +218,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(defender->IsClient()) { - chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); + chancetohit += (RuleR(Combat, WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(EQEmu::skills::SkillDefense) - defender->GetSkill(EQEmu::skills::SkillDefense))); Log.Out(Logs::Detail, Logs::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } @@ -254,15 +254,15 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c hitBonus += attacker->itembonuses.HitChanceEffect[skillinuse] + attacker->spellbonuses.HitChanceEffect[skillinuse]+ attacker->aabonuses.HitChanceEffect[skillinuse]+ - attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1] + - attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1] + - attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]; + attacker->itembonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->spellbonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->aabonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]; //Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect //Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim) - hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] + + hitBonus += (attacker->itembonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->spellbonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->aabonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] + attacker->aabonuses.Accuracy[skillinuse] + attacker->itembonuses.HitChance) / 15.0f; //Item Mod 'Accuracy' @@ -271,7 +271,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC()) hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database - if(skillinuse == SkillArchery) + if (skillinuse == EQEmu::skills::SkillArchery) hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty); //Calculate final chance to hit @@ -382,13 +382,13 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) // Need to check if we have something in MainHand to actually attack with (or fists) if (hand != EQEmu::legacy::SlotRange && CanThisClassRiposte() && InFront && !ImmuneRipo) { if (IsClient()) - CastToClient()->CheckIncreaseSkill(SkillRiposte, other, -10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillRiposte, other, -10); // check auto discs ... I guess aa/items too :P if (spellbonuses.RiposteChance == 10000 || aabonuses.RiposteChance == 10000 || itembonuses.RiposteChance == 10000) { damage = -3; return true; } - int chance = GetSkill(SkillRiposte) + 100; + int chance = GetSkill(EQEmu::skills::SkillRiposte) + 100; chance += (chance * (aabonuses.RiposteChance + spellbonuses.RiposteChance + itembonuses.RiposteChance)) / 100; chance /= 50; chance += itembonuses.HeroicDEX / 25; // live has "heroic strickthrough" here to counter @@ -420,14 +420,14 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) if (CanThisClassBlock() && (InFront || bBlockFromRear)) { if (IsClient()) - CastToClient()->CheckIncreaseSkill(SkillBlock, other, -10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillBlock, other, -10); // check auto discs ... I guess aa/items too :P if (spellbonuses.IncreaseBlockChance == 10000 || aabonuses.IncreaseBlockChance == 10000 || itembonuses.IncreaseBlockChance == 10000) { damage = -1; return true; } - int chance = GetSkill(SkillBlock) + 100; + int chance = GetSkill(EQEmu::skills::SkillBlock) + 100; chance += (chance * (aabonuses.IncreaseBlockChance + spellbonuses.IncreaseBlockChance + itembonuses.IncreaseBlockChance)) / 100; chance /= 25; chance += itembonuses.HeroicDEX / 25; // live has "heroic strickthrough" here to counter @@ -444,13 +444,13 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) // parry if (CanThisClassParry() && InFront && hand != EQEmu::legacy::SlotRange) { if (IsClient()) - CastToClient()->CheckIncreaseSkill(SkillParry, other, -10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillParry, other, -10); // check auto discs ... I guess aa/items too :P if (spellbonuses.ParryChance == 10000 || aabonuses.ParryChance == 10000 || itembonuses.ParryChance == 10000) { damage = -2; return true; } - int chance = GetSkill(SkillParry) + 100; + int chance = GetSkill(EQEmu::skills::SkillParry) + 100; chance += (chance * (aabonuses.ParryChance + spellbonuses.ParryChance + itembonuses.ParryChance)) / 100; chance /= 45; chance += itembonuses.HeroicDEX / 25; // live has "heroic strickthrough" here to counter @@ -467,13 +467,13 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) // dodge if (CanThisClassDodge() && (InFront || GetClass() == MONK) ) { if (IsClient()) - CastToClient()->CheckIncreaseSkill(SkillDodge, other, -10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillDodge, other, -10); // check auto discs ... I guess aa/items too :P if (spellbonuses.DodgeChance == 10000 || aabonuses.DodgeChance == 10000 || itembonuses.DodgeChance == 10000) { damage = -4; return true; } - int chance = GetSkill(SkillDodge) + 100; + int chance = GetSkill(EQEmu::skills::SkillDodge) + 100; chance += (chance * (aabonuses.DodgeChance + spellbonuses.DodgeChance + itembonuses.DodgeChance)) / 100; chance /= 45; chance += itembonuses.HeroicAGI / 25; // live has "heroic strickthrough" here to counter @@ -525,7 +525,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac spellbonuses.CombatStability) / 100.0f; if (RuleB(Combat, UseIntervalAC)) { - float softcap = (GetSkill(SkillDefense) + GetLevel()) * + float softcap = (GetSkill(EQEmu::skills::SkillDefense) + GetLevel()) * RuleR(Combat, SoftcapFactor) * (1.0 + aa_mit); float mitigation_rating = 0.0; float attack_rating = 0.0; @@ -625,17 +625,17 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac if (GetClass() == WIZARD || GetClass() == MAGICIAN || GetClass() == NECROMANCER || GetClass() == ENCHANTER) - mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 4.0) + armor + 1; + mitigation_rating = ((GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 4.0) + armor + 1; else - mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 3.0) + (armor * 1.333333) + 1; + mitigation_rating = ((GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 3.0) + (armor * 1.333333) + 1; mitigation_rating *= 0.847; mitigation_rating = mod_mitigation_rating(mitigation_rating, attacker); if (attacker->IsClient()) - attack_rating = (attacker->CastToClient()->CalcATK() + ((attacker->GetSTR()-66) * 0.9) + (attacker->GetSkill(SkillOffense)*1.345)); + attack_rating = (attacker->CastToClient()->CalcATK() + ((attacker->GetSTR() - 66) * 0.9) + (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345)); else - attack_rating = (attacker->GetATK() + (attacker->GetSkill(SkillOffense)*1.345) + ((attacker->GetSTR()-66) * 0.9)); + attack_rating = (attacker->GetATK() + (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345) + ((attacker->GetSTR() - 66) * 0.9)); attack_rating = attacker->mod_attack_rating(attack_rating, this); @@ -1059,7 +1059,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients - SkillUseTypes skillinuse; + EQEmu::skills::SkillType skillinuse; AttackAnimation(skillinuse, Hand, weapon); Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); @@ -1095,7 +1095,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b max_hit = (RuleI(Combat, HitCapPre20)); CheckIncreaseSkill(skillinuse, other, -15); - CheckIncreaseSkill(SkillOffense, other, -15); + CheckIncreaseSkill(EQEmu::skills::SkillOffense, other, -15); // *************************************************************** // *** Calculate the damage bonus, if applicable, for this hit *** @@ -1236,7 +1236,7 @@ void Mob::Heal() SendHPUpdate(); } -void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) +void Client::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) { if(dead || IsCorpse()) return; @@ -1249,7 +1249,7 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att //Don't do PvP mitigation if the caster is damaging himself if(other && other->IsClient() && (other != this) && damage > 0) { int PvPMitigation = 100; - if(attack_skill == SkillArchery) + if (attack_skill == EQEmu::skills::SkillArchery) PvPMitigation = 80; else PvPMitigation = 67; @@ -1265,11 +1265,11 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att if (damage > 0) { if (spell_id == SPELL_UNKNOWN) - CheckIncreaseSkill(SkillDefense, other, -15); + CheckIncreaseSkill(EQEmu::skills::SkillDefense, other, -15); } } -bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) +bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::SkillType attack_skill) { if(!ClientFinishedLoading()) return false; @@ -1584,13 +1584,13 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool FaceTarget(GetTarget()); - SkillUseTypes skillinuse = SkillHandtoHand; + EQEmu::skills::SkillType skillinuse = EQEmu::skills::SkillHandtoHand; if (Hand == EQEmu::legacy::SlotPrimary) { - skillinuse = static_cast(GetPrimSkill()); + skillinuse = static_cast(GetPrimSkill()); OffHandAtk(false); } if (Hand == EQEmu::legacy::SlotSecondary) { - skillinuse = static_cast(GetSecSkill()); + skillinuse = static_cast(GetSecSkill()); OffHandAtk(true); } @@ -1613,32 +1613,32 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool switch(weapon->ItemType) { case EQEmu::item::ItemType1HSlash: - skillinuse = Skill1HSlashing; + skillinuse = EQEmu::skills::Skill1HSlashing; break; case EQEmu::item::ItemType2HSlash: - skillinuse = Skill2HSlashing; + skillinuse = EQEmu::skills::Skill2HSlashing; break; case EQEmu::item::ItemType1HPiercing: - skillinuse = Skill1HPiercing; + skillinuse = EQEmu::skills::Skill1HPiercing; break; case EQEmu::item::ItemType2HPiercing: - skillinuse = Skill2HPiercing; + skillinuse = EQEmu::skills::Skill2HPiercing; break; case EQEmu::item::ItemType1HBlunt: - skillinuse = Skill1HBlunt; + skillinuse = EQEmu::skills::Skill1HBlunt; break; case EQEmu::item::ItemType2HBlunt: - skillinuse = Skill2HBlunt; + skillinuse = EQEmu::skills::Skill2HBlunt; break; case EQEmu::item::ItemTypeBow: - skillinuse = SkillArchery; + skillinuse = EQEmu::skills::SkillArchery; break; case EQEmu::item::ItemTypeLargeThrowing: case EQEmu::item::ItemTypeSmallThrowing: - skillinuse = SkillThrowing; + skillinuse = EQEmu::skills::SkillThrowing; break; default: - skillinuse = SkillHandtoHand; + skillinuse = EQEmu::skills::SkillHandtoHand; break; } } @@ -1795,7 +1795,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool return false; } -void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) { +void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) { if(spell_id==0) spell_id = SPELL_UNKNOWN; @@ -1838,7 +1838,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack } } -bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attack_skill) +bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::SkillType attack_skill) { Log.Out(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", ((killer_mob) ? (killer_mob->GetName()) : ("[nullptr]")), damage, spell, attack_skill); @@ -2485,7 +2485,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { } DS -= DS * attacker->itembonuses.DSMitigation / 100; } - attacker->Damage(this, -DS, spellid, SkillAbjuration/*hackish*/, false); + attacker->Damage(this, -DS, spellid, EQEmu::skills::SkillAbjuration/*hackish*/, false); //we can assume there is a spell now auto outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct* cds = (CombatDamage_Struct*)outapp->pBuffer; @@ -2512,7 +2512,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { if(rev_ds < 0) { Log.Out(Logs::Detail, Logs::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); - attacker->Damage(this, -rev_ds, rev_ds_spell_id, SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this + attacker->Damage(this, -rev_ds, rev_ds_spell_id, EQEmu::skills::SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this //do we need to send a damage packet here also? } } @@ -2584,7 +2584,7 @@ int Mob::GetHandToHandDamage(void) { if (RuleB(Combat, UseRevampHandToHand)) { // everyone uses this in the revamp! - int skill = GetSkill(SkillHandtoHand); + int skill = GetSkill(EQEmu::skills::SkillHandtoHand); int epic = 0; if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652 && GetLevel() > 46) epic = 280; @@ -2625,7 +2625,7 @@ int Mob::GetHandToHandDelay(void) { if (RuleB(Combat, UseRevampHandToHand)) { // everyone uses this in the revamp! - int skill = GetSkill(SkillHandtoHand); + int skill = GetSkill(EQEmu::skills::SkillHandtoHand); int epic = 0; int iksar = 0; if (IsClient() && CastToClient()->GetItemIDAt(12) == 10652 && GetLevel() > 46) @@ -2968,7 +2968,7 @@ bool Mob::HasRangedProcs() const bool Client::CheckDoubleAttack() { int chance = 0; - int skill = GetSkill(SkillDoubleAttack); + int skill = GetSkill(EQEmu::skills::SkillDoubleAttack); //Check for bonuses that give you a double attack chance regardless of skill (ie Bestial Frenzy/Harmonious Attack AA) int bonusGiveDA = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack; if (skill > 0) @@ -2989,7 +2989,7 @@ bool Client::CheckDoubleAttack() // with varying triple attack skill (1-3% error at least) bool Client::CheckTripleAttack() { - int chance = GetSkill(SkillTripleAttack); + int chance = GetSkill(EQEmu::skills::SkillTripleAttack); if (chance < 1) return false; @@ -3013,7 +3013,7 @@ bool Mob::CheckDoubleAttack() { // Not 100% certain pets follow this or if it's just from pets not always // having the same skills as most mobs - int chance = GetSkill(SkillDoubleAttack); + int chance = GetSkill(EQEmu::skills::SkillDoubleAttack); if (GetLevel() > 35) chance += GetLevel(); @@ -3024,9 +3024,9 @@ bool Mob::CheckDoubleAttack() return zone->random.Int(1, 500) <= chance; } -void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, const SkillUseTypes skill_used, bool &avoidable, const int8 buffslot, const bool iBuffTic, int special) { +void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, const EQEmu::skills::SkillType skill_used, bool &avoidable, const int8 buffslot, const bool iBuffTic, int special) { // This method is called with skill_used=ABJURE for Damage Shield damage. - bool FromDamageShield = (skill_used == SkillAbjuration); + bool FromDamageShield = (skill_used == EQEmu::skills::SkillAbjuration); Log.Out(Logs::Detail, Logs::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot); @@ -3041,7 +3041,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // only apply DS if physical damage (no spell damage) // damage shield calls this function with spell_id set, so its unavoidable - if (attacker && damage > 0 && spell_id == SPELL_UNKNOWN && skill_used != SkillArchery && skill_used != SkillThrowing) { + if (attacker && damage > 0 && spell_id == SPELL_UNKNOWN && skill_used != EQEmu::skills::SkillArchery && skill_used != EQEmu::skills::SkillThrowing) { DamageShield(attacker); } @@ -3167,7 +3167,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } //check stun chances if bashing - if (damage > 0 && ((skill_used == SkillBash || skill_used == SkillKick) && attacker)) { + if (damage > 0 && ((skill_used == EQEmu::skills::SkillBash || skill_used == EQEmu::skills::SkillKick) && attacker)) { // NPCs can stun with their bash/kick as soon as they receive it. // Clients can stun mobs under level 56 with their kick when they get level 55 or greater. // Clients have a chance to stun if the mob is 56+ @@ -3181,15 +3181,15 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // Less than base immunity // Client vs. Client always uses the chance if (!IsClient() && GetLevel() <= RuleI(Spells, BaseImmunityLevel)) { - if (skill_used == SkillBash) // Bash always will + if (skill_used == EQEmu::skills::SkillBash) // Bash always will stun_chance = 100; else if (attacker->GetLevel() >= RuleI(Combat, ClientStunLevel)) stun_chance = 100; // only if you're over level 55 and using kick } else { // higher than base immunity or Client vs. Client // not sure on this number, use same as NPC for now - if (skill_used == SkillKick && attacker->GetLevel() < RuleI(Combat, ClientStunLevel)) + if (skill_used == EQEmu::skills::SkillKick && attacker->GetLevel() < RuleI(Combat, ClientStunLevel)) stun_chance = RuleI(Combat, NPCBashKickStunChance); - else if (skill_used == SkillBash) + else if (skill_used == EQEmu::skills::SkillBash) stun_chance = RuleI(Combat, NPCBashKickStunChance) + attacker->spellbonuses.StunBashChance + attacker->itembonuses.StunBashChance + @@ -3268,7 +3268,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons a->meleepush_xy = attacker->GetHeading() * 2.0f; if (RuleB(Combat, MeleePush) && damage > 0 && !IsRooted() && (IsClient() || zone->random.Roll(RuleI(Combat, MeleePushChance)))) { - a->force = EQEmu::GetSkillMeleePushForce(skill_used); + a->force = EQEmu::skills::GetSkillMeleePushForce(skill_used); // update NPC stuff auto new_pos = glm::vec3(m_Position.x + (a->force * std::sin(a->meleepush_xy) + m_Delta.x), m_Position.y + (a->force * std::cos(a->meleepush_xy) + m_Delta.y), m_Position.z); @@ -3868,10 +3868,10 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack int deadlyChance = 0; int deadlyMod = 0; - if(skill == SkillArchery && GetClass() == RANGER && GetSkill(SkillArchery) >= 65) + if (skill == EQEmu::skills::SkillArchery && GetClass() == RANGER && GetSkill(EQEmu::skills::SkillArchery) >= 65) critChance += 6; - if (skill == SkillThrowing && GetClass() == ROGUE && GetSkill(SkillThrowing) >= 65) { + if (skill == EQEmu::skills::SkillThrowing && GetClass() == ROGUE && GetSkill(EQEmu::skills::SkillThrowing) >= 65) { critChance += RuleI(Combat, RogueCritThrowingChance); deadlyChance = RuleI(Combat, RogueDeadlyStrikeChance); deadlyMod = RuleI(Combat, RogueDeadlyStrikeMod); @@ -3952,7 +3952,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack } } -bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) +bool Mob::TryFinishingBlow(Mob *defender, EQEmu::skills::SkillType skillinuse) { if (defender && !defender->IsClient() && defender->GetHPRatio() < 10){ @@ -4024,7 +4024,7 @@ void Mob::DoRiposte(Mob *defender) if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]); - else if (defender->IsClient() && defender->CastToClient()->HasSkill((SkillUseTypes)defender->aabonuses.GiveDoubleRiposte[2])) + else if (defender->IsClient() && defender->CastToClient()->HasSkill((EQEmu::skills::SkillType)defender->aabonuses.GiveDoubleRiposte[2])) defender->CastToClient()->DoClassAttacks(this, defender->aabonuses.GiveDoubleRiposte[2], true); } } @@ -4063,7 +4063,7 @@ bool Mob::HasDied() { return Result; } -uint16 Mob::GetDamageTable(SkillUseTypes skillinuse) +uint16 Mob::GetDamageTable(EQEmu::skills::SkillType skillinuse) { if(GetLevel() <= 51) { @@ -4156,7 +4156,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui ProcMod = static_cast(spells[base_spell_id].base2[i]); } - else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].base[i] <= HIGHEST_SKILL) { + else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].base[i] <= EQEmu::skills::HIGHEST_SKILL) { if (CanProc && spells[base_spell_id].base[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); @@ -4200,7 +4200,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui ProcMod = static_cast(spells[base_spell_id].base2[i]); } - else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].base[i] <= HIGHEST_SKILL) { + else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].base[i] <= EQEmu::skills::HIGHEST_SKILL) { if (CanProc && spells[base_spell_id].base[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); @@ -4261,7 +4261,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui proc_spell_id = base1; ProcMod = static_cast(base2); } - else if(effect_id == SE_LimitToSkill && base1 <= HIGHEST_SKILL) { + else if (effect_id == SE_LimitToSkill && base1 <= EQEmu::skills::HIGHEST_SKILL) { if (CanProc && base1 == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); @@ -4406,7 +4406,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) return damage; } -void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse, ExtraAttackOptions *opts) +void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, EQEmu::skills::SkillType skillInUse, ExtraAttackOptions *opts) { if (!defender) return; @@ -4623,15 +4623,15 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) // extra off hand non-sense, can only double with skill of 150 or above // or you have any amount of GiveDoubleAttack if (candouble && hand == EQEmu::legacy::SlotSecondary) - candouble = GetSkill(SkillDoubleAttack) > 149 || (aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack) > 0; + candouble = GetSkill(EQEmu::skills::SkillDoubleAttack) > 149 || (aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack) > 0; if (candouble) { - CheckIncreaseSkill(SkillDoubleAttack, target, -10); + CheckIncreaseSkill(EQEmu::skills::SkillDoubleAttack, target, -10); if (CheckDoubleAttack()) { Attack(target, hand, false, false, IsFromSpell); // you can only triple from the main hand if (hand == EQEmu::legacy::SlotPrimary && CanThisClassTripleAttack()) { - CheckIncreaseSkill(SkillTripleAttack, target, -10); + CheckIncreaseSkill(EQEmu::skills::SkillTripleAttack, target, -10); if (CheckTripleAttack()) Attack(target, hand, false, false, IsFromSpell); } @@ -4659,7 +4659,7 @@ bool Mob::CheckDualWield() { // Pets /might/ follow a slightly different progression // although it could all be from pets having different skills than most mobs - int chance = GetSkill(SkillDualWield); + int chance = GetSkill(EQEmu::skills::SkillDualWield); if (GetLevel() > 35) chance += GetLevel(); @@ -4673,7 +4673,7 @@ bool Mob::CheckDualWield() bool Client::CheckDualWield() { - int chance = GetSkill(SkillDualWield) + GetLevel(); + int chance = GetSkill(EQEmu::skills::SkillDualWield) + GetLevel(); chance += aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; int per_inc = spellbonuses.DualWieldChance + aabonuses.DualWieldChance + itembonuses.DualWieldChance; diff --git a/zone/beacon.h b/zone/beacon.h index bc09dae4b..398c9680e 100644 --- a/zone/beacon.h +++ b/zone/beacon.h @@ -34,8 +34,8 @@ public: ~Beacon(); //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, int special = 0) { return; } + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0) { return; } virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0) { return false; } virtual bool HasRaid() { return false; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index c5c1c92d2..ab15326cc 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -507,7 +507,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAu } } - if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= HIGHEST_SKILL) { + if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= EQEmu::skills::HIGHEST_SKILL) { if ((newbon->SkillDamageAmount[item->ExtraDmgSkill] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap)) newbon->SkillDamageAmount[item->ExtraDmgSkill] = RuleI(Character, ItemExtraDmgCap); @@ -517,7 +517,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAu } // Process when ammo_slot_item = true or false - if (item->SkillModValue != 0 && item->SkillModType <= HIGHEST_SKILL) { + if (item->SkillModValue != 0 && item->SkillModType <= EQEmu::skills::HIGHEST_SKILL) { if ((item->SkillModValue > 0 && newbon->skillmod[item->SkillModType] < item->SkillModValue) || (item->SkillModValue < 0 && newbon->skillmod[item->SkillModType] > item->SkillModValue)) { @@ -672,10 +672,10 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) // Note: AA effects that use accuracy are skill limited, while spell effect is not. case SE_Accuracy: // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - if ((base2 == ALL_SKILLS) && (newbon->Accuracy[HIGHEST_SKILL + 1] < base1)) - newbon->Accuracy[HIGHEST_SKILL + 1] = base1; + if ((base2 == ALL_SKILLS) && (newbon->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] < base1)) + newbon->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] = base1; else if (newbon->Accuracy[base2] < base1) newbon->Accuracy[base2] += base1; break; @@ -1015,10 +1015,10 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_HitChance: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (base2 == ALL_SKILLS) - newbon->HitChanceEffect[HIGHEST_SKILL + 1] += base1; + newbon->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] += base1; else newbon->HitChanceEffect[base2] += base1; } @@ -1069,21 +1069,21 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_CriticalHitChance: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (base2 == ALL_SKILLS) - newbon->CriticalHitChance[HIGHEST_SKILL + 1] += base1; + newbon->CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] += base1; else newbon->CriticalHitChance[base2] += base1; } break; case SE_CriticalDamageMob: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; // base1 = effect value, base2 = skill restrictions(-1 for all) if (base2 == ALL_SKILLS) - newbon->CritDmgMob[HIGHEST_SKILL + 1] += base1; + newbon->CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] += base1; else newbon->CritDmgMob[base2] += base1; break; @@ -1109,10 +1109,10 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_SkillDamageAmount: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (base2 == ALL_SKILLS) - newbon->SkillDamageAmount[HIGHEST_SKILL + 1] += base1; + newbon->SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 1] += base1; else newbon->SkillDamageAmount[base2] += base1; break; @@ -1128,10 +1128,10 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_DamageModifier: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (base2 == ALL_SKILLS) - newbon->DamageModifier[HIGHEST_SKILL + 1] += base1; + newbon->DamageModifier[EQEmu::skills::HIGHEST_SKILL + 1] += base1; else newbon->DamageModifier[base2] += base1; break; @@ -1139,10 +1139,10 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_DamageModifier2: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (base2 == ALL_SKILLS) - newbon->DamageModifier2[HIGHEST_SKILL + 1] += base1; + newbon->DamageModifier2[EQEmu::skills::HIGHEST_SKILL + 1] += base1; else newbon->DamageModifier2[base2] += base1; break; @@ -1178,7 +1178,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) // Physically raises skill cap ie if 55/55 it will raise to 55/60 case SE_RaiseSkillCap: { - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (newbon->RaiseSkillCap[base2] < base1) @@ -1350,9 +1350,9 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_LimitToSkill: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - if (base1 <= HIGHEST_SKILL) + if (base1 <= EQEmu::skills::HIGHEST_SKILL) newbon->LimitToSkill[base1] = true; break; } @@ -1416,7 +1416,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) case SE_ReduceTradeskillFail:{ - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; newbon->ReduceTradeskillFail[base2] += base1; @@ -1938,26 +1938,26 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_CriticalHitChance: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (AdditiveWornBonus) { if(base2 == ALL_SKILLS) - new_bonus->CriticalHitChance[HIGHEST_SKILL+1] += effect_value; + new_bonus->CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value; else new_bonus->CriticalHitChance[base2] += effect_value; } else if(effect_value < 0) { - if(base2 == ALL_SKILLS && new_bonus->CriticalHitChance[HIGHEST_SKILL+1] > effect_value) - new_bonus->CriticalHitChance[HIGHEST_SKILL+1] = effect_value; + if (base2 == ALL_SKILLS && new_bonus->CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] > effect_value) + new_bonus->CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; else if(base2 != ALL_SKILLS && new_bonus->CriticalHitChance[base2] > effect_value) new_bonus->CriticalHitChance[base2] = effect_value; } - else if(base2 == ALL_SKILLS && new_bonus->CriticalHitChance[HIGHEST_SKILL+1] < effect_value) - new_bonus->CriticalHitChance[HIGHEST_SKILL+1] = effect_value; + else if (base2 == ALL_SKILLS && new_bonus->CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] < effect_value) + new_bonus->CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; else if(base2 != ALL_SKILLS && new_bonus->CriticalHitChance[base2] < effect_value) new_bonus->CriticalHitChance[base2] = effect_value; @@ -2144,24 +2144,24 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_HitChance: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (AdditiveWornBonus){ if(base2 == ALL_SKILLS) - new_bonus->HitChanceEffect[HIGHEST_SKILL+1] += effect_value; + new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value; else new_bonus->HitChanceEffect[base2] += effect_value; } else if(base2 == ALL_SKILLS){ - if ((effect_value < 0) && (new_bonus->HitChanceEffect[HIGHEST_SKILL+1] > effect_value)) - new_bonus->HitChanceEffect[HIGHEST_SKILL+1] = effect_value; + if ((effect_value < 0) && (new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] > effect_value)) + new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; - else if (!new_bonus->HitChanceEffect[HIGHEST_SKILL+1] || - ((new_bonus->HitChanceEffect[HIGHEST_SKILL+1] > 0) && (new_bonus->HitChanceEffect[HIGHEST_SKILL+1] < effect_value))) - new_bonus->HitChanceEffect[HIGHEST_SKILL+1] = effect_value; + else if (!new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] || + ((new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] > 0) && (new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] < effect_value))) + new_bonus->HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; } else { @@ -2181,9 +2181,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_DamageModifier: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - int skill = base2 == ALL_SKILLS ? HIGHEST_SKILL + 1 : base2; + int skill = base2 == ALL_SKILLS ? EQEmu::skills::HIGHEST_SKILL + 1 : base2; if (effect_value < 0 && new_bonus->DamageModifier[skill] > effect_value) new_bonus->DamageModifier[skill] = effect_value; else if (effect_value > 0 && new_bonus->DamageModifier[skill] < effect_value) @@ -2194,9 +2194,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_DamageModifier2: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - int skill = base2 == ALL_SKILLS ? HIGHEST_SKILL + 1 : base2; + int skill = base2 == ALL_SKILLS ? EQEmu::skills::HIGHEST_SKILL + 1 : base2; if (effect_value < 0 && new_bonus->DamageModifier2[skill] > effect_value) new_bonus->DamageModifier2[skill] = effect_value; else if (effect_value > 0 && new_bonus->DamageModifier2[skill] < effect_value) @@ -2207,9 +2207,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_MinDamageModifier: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - int skill = base2 == ALL_SKILLS ? HIGHEST_SKILL + 1 : base2; + int skill = base2 == ALL_SKILLS ? EQEmu::skills::HIGHEST_SKILL + 1 : base2; if (effect_value < 0 && new_bonus->MinDamageModifier[skill] > effect_value) new_bonus->MinDamageModifier[skill] = effect_value; else if (effect_value > 0 && new_bonus->MinDamageModifier[skill] < effect_value) @@ -2284,14 +2284,14 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_Accuracy: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - if ((effect_value < 0) && (new_bonus->Accuracy[HIGHEST_SKILL+1] > effect_value)) - new_bonus->Accuracy[HIGHEST_SKILL+1] = effect_value; + if ((effect_value < 0) && (new_bonus->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] > effect_value)) + new_bonus->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; - else if (!new_bonus->Accuracy[HIGHEST_SKILL+1] || - ((new_bonus->Accuracy[HIGHEST_SKILL+1] > 0) && (new_bonus->Accuracy[HIGHEST_SKILL+1] < effect_value))) - new_bonus->Accuracy[HIGHEST_SKILL+1] = effect_value; + else if (!new_bonus->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] || + ((new_bonus->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] > 0) && (new_bonus->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] < effect_value))) + new_bonus->Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; break; } @@ -2310,19 +2310,19 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_SkillDamageTaken: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; //When using npc_spells_effects if MAX value set, use stackable quest based modifier. if (IsAISpellEffect && max){ if(base2 == ALL_SKILLS) - SkillDmgTaken_Mod[HIGHEST_SKILL+1] = effect_value; + SkillDmgTaken_Mod[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; else SkillDmgTaken_Mod[base2] = effect_value; } else { if(base2 == ALL_SKILLS) - new_bonus->SkillDmgTaken[HIGHEST_SKILL+1] += effect_value; + new_bonus->SkillDmgTaken[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value; else new_bonus->SkillDmgTaken[base2] += effect_value; @@ -2431,10 +2431,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_CriticalDamageMob: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if(base2 == ALL_SKILLS) - new_bonus->CritDmgMob[HIGHEST_SKILL+1] += effect_value; + new_bonus->CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value; else new_bonus->CritDmgMob[base2] += effect_value; break; @@ -2450,10 +2450,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_SkillDamageAmount: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if(base2 == ALL_SKILLS) - new_bonus->SkillDamageAmount[HIGHEST_SKILL+1] += effect_value; + new_bonus->SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value; else new_bonus->SkillDamageAmount[base2] += effect_value; break; @@ -2558,10 +2558,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_SkillDamageAmount2: { // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if(base2 == ALL_SKILLS) - new_bonus->SkillDamageAmount2[HIGHEST_SKILL+1] += effect_value; + new_bonus->SkillDamageAmount2[EQEmu::skills::HIGHEST_SKILL + 1] += effect_value; else new_bonus->SkillDamageAmount2[base2] += effect_value; break; @@ -3096,9 +3096,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_LimitToSkill:{ // Bad data or unsupported new skill - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; - if (effect_value <= HIGHEST_SKILL){ + if (effect_value <= EQEmu::skills::HIGHEST_SKILL){ new_bonus->LimitToSkill[effect_value] = true; } break; @@ -3155,7 +3155,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne case SE_ReduceTradeskillFail:{ - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; new_bonus->ReduceTradeskillFail[base2] += effect_value; @@ -3168,7 +3168,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne break; case SE_RaiseSkillCap: { - if (base2 > HIGHEST_SKILL) + if (base2 > EQEmu::skills::HIGHEST_SKILL) break; if (new_bonus->RaiseSkillCap[base2] < effect_value) @@ -3866,7 +3866,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_CriticalHitChance: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.CriticalHitChance[e] = effect_value; aabonuses.CriticalHitChance[e] = effect_value; @@ -3984,7 +3984,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_HitChance: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.HitChanceEffect[e] = effect_value; aabonuses.HitChanceEffect[e] = effect_value; @@ -3995,7 +3995,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_DamageModifier: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.DamageModifier[e] = effect_value; aabonuses.DamageModifier[e] = effect_value; @@ -4006,7 +4006,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_DamageModifier2: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.DamageModifier2[e] = effect_value; aabonuses.DamageModifier2[e] = effect_value; @@ -4017,7 +4017,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_MinDamageModifier: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.MinDamageModifier[e] = effect_value; aabonuses.MinDamageModifier[e] = effect_value; @@ -4058,10 +4058,10 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_Accuracy: { - spellbonuses.Accuracy[HIGHEST_SKILL+1] = effect_value; - itembonuses.Accuracy[HIGHEST_SKILL+1] = effect_value; + spellbonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; + itembonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] = effect_value; - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { aabonuses.Accuracy[e] = effect_value; } @@ -4088,7 +4088,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_SkillDamageTaken: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.SkillDmgTaken[e] = effect_value; aabonuses.SkillDmgTaken[e] = effect_value; @@ -4193,7 +4193,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_CriticalDamageMob: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.CritDmgMob[e] = effect_value; aabonuses.CritDmgMob[e] = effect_value; @@ -4204,7 +4204,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_SkillDamageAmount: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.SkillDamageAmount[e] = effect_value; aabonuses.SkillDamageAmount[e] = effect_value; @@ -4255,7 +4255,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) case SE_SkillDamageAmount2: { - for(int e = 0; e < HIGHEST_SKILL+1; e++) + for (int e = 0; e < EQEmu::skills::HIGHEST_SKILL + 1; e++) { spellbonuses.SkillDamageAmount2[e] = effect_value; aabonuses.SkillDamageAmount2[e] = effect_value; diff --git a/zone/bot.cpp b/zone/bot.cpp index 0cb75e8a5..a72c8f142 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -23,6 +23,7 @@ #include "doors.h" #include "quest_parser_collection.h" #include "../common/string_util.h" +#include "../common/say_link.h" extern volatile bool is_zone_loaded; @@ -1139,16 +1140,16 @@ int32 Bot::acmod() { void Bot::GenerateArmorClass() { /// new formula int avoidance = 0; - avoidance = (acmod() + ((GetSkill(SkillDefense) * 16) / 9)); + avoidance = (acmod() + ((GetSkill(EQEmu::skills::SkillDefense) * 16) / 9)); if(avoidance < 0) avoidance = 0; int mitigation = 0; if(GetClass() == WIZARD || GetClass() == MAGICIAN || GetClass() == NECROMANCER || GetClass() == ENCHANTER) { - mitigation = (GetSkill(SkillDefense) / 4 + (itembonuses.AC + 1)); + mitigation = (GetSkill(EQEmu::skills::SkillDefense) / 4 + (itembonuses.AC + 1)); mitigation -= 4; } else { - mitigation = (GetSkill(SkillDefense) / 3 + ((itembonuses.AC * 4) / 3)); + mitigation = (GetSkill(EQEmu::skills::SkillDefense) / 3 + ((itembonuses.AC * 4) / 3)); if(GetClass() == MONK) mitigation += (GetLevel() * 13 / 10); //the 13/10 might be wrong, but it is close... } @@ -1173,36 +1174,36 @@ void Bot::GenerateArmorClass() { } uint16 Bot::GetPrimarySkillValue() { - SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill + EQEmu::skills::SkillType skill = EQEmu::skills::HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill bool equiped = m_inv.GetItem(EQEmu::legacy::SlotPrimary); if(!equiped) - skill = SkillHandtoHand; + skill = EQEmu::skills::SkillHandtoHand; else { uint8 type = m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType; //is this the best way to do this? switch(type) { case EQEmu::item::ItemType1HSlash: - skill = Skill1HSlashing; + skill = EQEmu::skills::Skill1HSlashing; break; case EQEmu::item::ItemType2HSlash: - skill = Skill2HSlashing; + skill = EQEmu::skills::Skill2HSlashing; break; case EQEmu::item::ItemType1HPiercing: - skill = Skill1HPiercing; + skill = EQEmu::skills::Skill1HPiercing; break; case EQEmu::item::ItemType1HBlunt: - skill = Skill1HBlunt; + skill = EQEmu::skills::Skill1HBlunt; break; case EQEmu::item::ItemType2HBlunt: - skill = Skill2HBlunt; + skill = EQEmu::skills::Skill2HBlunt; break; case EQEmu::item::ItemType2HPiercing: - skill = Skill2HPiercing; + skill = EQEmu::skills::Skill2HPiercing; break; case EQEmu::item::ItemTypeMartial: - skill = SkillHandtoHand; + skill = EQEmu::skills::SkillHandtoHand; break; default: - skill = SkillHandtoHand; + skill = EQEmu::skills::SkillHandtoHand; break; } } @@ -1210,7 +1211,7 @@ uint16 Bot::GetPrimarySkillValue() { return GetSkill(skill); } -uint16 Bot::MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const { +uint16 Bot::MaxSkill(EQEmu::skills::SkillType skillid, uint16 class_, uint16 level) const { return(database.GetSkillCap(class_, skillid, level)); } @@ -1218,7 +1219,7 @@ uint32 Bot::GetTotalATK() { uint32 AttackRating = 0; uint32 WornCap = itembonuses.ATK; if(IsBot()) { - AttackRating = ((WornCap * 1.342) + (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); + AttackRating = ((WornCap * 1.342) + (GetSkill(EQEmu::skills::SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); AttackRating += aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); if (AttackRating < 10) AttackRating = 10; @@ -1233,7 +1234,7 @@ uint32 Bot::GetTotalATK() { uint32 Bot::GetATKRating() { uint32 AttackRating = 0; if(IsBot()) { - AttackRating = (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); + AttackRating = (GetSkill(EQEmu::skills::SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); if (AttackRating < 10) AttackRating = 10; } @@ -1914,7 +1915,7 @@ void Bot::BotRangedAttack(Mob* other) { if(!IsAttackAllowed(other) || IsCasting() || DivineAura() || IsStunned() || IsMezzed() || (GetAppearance() == eaDead)) return; - SendItemAnimation(other, Ammo, SkillArchery); + SendItemAnimation(other, Ammo, EQEmu::skills::SkillArchery); //DoArcheryAttackDmg(GetTarget(), rangedItem, ammoItem); DoArcheryAttackDmg(other, rangedItem, ammoItem); // watch @@ -1959,12 +1960,12 @@ bool Bot::CheckBotDoubleAttack(bool tripleAttack) { //Check for bonuses that give you a double attack chance regardless of skill (ie Bestial Frenzy/Harmonious Attack AA) uint32 bonusGiveDA = (aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack); // If you don't have the double attack skill, return - if(!GetSkill(SkillDoubleAttack) && !(GetClass() == BARD || GetClass() == BEASTLORD)) + if (!GetSkill(EQEmu::skills::SkillDoubleAttack) && !(GetClass() == BARD || GetClass() == BEASTLORD)) return false; // You start with no chance of double attacking float chance = 0.0f; - uint16 skill = GetSkill(SkillDoubleAttack); + uint16 skill = GetSkill(EQEmu::skills::SkillDoubleAttack); int32 bonusDA = (aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance); //Use skill calculations otherwise, if you only have AA applied GiveDoubleAttack chance then use that value as the base. if (skill) @@ -1989,13 +1990,13 @@ bool Bot::CheckBotDoubleAttack(bool tripleAttack) { return false; } -void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime) { +void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime) { if (!CanDoSpecialAttack(other)) return; //For spells using skill value 98 (feral swipe ect) server sets this to 67 automatically. - if (skillinuse == SkillBegging) - skillinuse = SkillOffense; + if (skillinuse == EQEmu::skills::SkillBegging) + skillinuse = EQEmu::skills::SkillOffense; int damage = 0; uint32 hate = 0; @@ -2052,7 +2053,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes else damage = -5; - if(skillinuse == SkillBash){ + if (skillinuse == EQEmu::skills::SkillBash){ const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); const EQEmu::Item_Struct* botweapon = 0; if(inst) @@ -2069,8 +2070,8 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes other->AddToHateList(this, hate); bool CanSkillProc = true; - if (skillinuse == SkillOffense){ //Hack to allow damage to display. - skillinuse = SkillTigerClaw; //'strike' your opponent - Arbitrary choice for message. + if (skillinuse == EQEmu::skills::SkillOffense){ //Hack to allow damage to display. + skillinuse = EQEmu::skills::SkillTigerClaw; //'strike' your opponent - Arbitrary choice for message. CanSkillProc = false; //Disable skill procs } @@ -2081,7 +2082,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if (damage > 0) CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); - if((skillinuse == SkillDragonPunch) && GetAA(aaDragonPunch) && zone->random.Int(0, 99) < 25){ + if ((skillinuse == EQEmu::skills::SkillDragonPunch) && GetAA(aaDragonPunch) && zone->random.Int(0, 99) < 25){ SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff); other->Stun(100); } @@ -2093,23 +2094,23 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes TrySkillProc(other, skillinuse, ReuseTime, true); } -void Bot::ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg) { +void Bot::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int32 &mindmg) { int item_slot = -1; //1: Apply bonus from AC (BOOT/SHIELD/HANDS) est. 40AC=6dmg switch (skill) { - case SkillFlyingKick: - case SkillRoundKick: - case SkillKick: - item_slot = EQEmu::legacy::SlotFeet; - break; - case SkillBash: - item_slot = EQEmu::legacy::SlotSecondary; - break; - case SkillDragonPunch: - case SkillEagleStrike: - case SkillTigerClaw: - item_slot = EQEmu::legacy::SlotHands; - break; + case EQEmu::skills::SkillFlyingKick: + case EQEmu::skills::SkillRoundKick: + case EQEmu::skills::SkillKick: + item_slot = EQEmu::legacy::SlotFeet; + break; + case EQEmu::skills::SkillBash: + item_slot = EQEmu::legacy::SlotSecondary; + break; + case EQEmu::skills::SkillDragonPunch: + case EQEmu::skills::SkillEagleStrike: + case EQEmu::skills::SkillTigerClaw: + item_slot = EQEmu::legacy::SlotHands; + break; } if (item_slot >= EQEmu::legacy::EQUIPMENT_BEGIN){ @@ -2518,7 +2519,7 @@ void Bot::AI_Process() { if (bIsFist || !weapon->IsType2HWeapon()) { float DualWieldProbability = 0.0f; int32 Ambidexterity = (aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity); - DualWieldProbability = ((GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f); // 78.0 max + DualWieldProbability = ((GetSkill(EQEmu::skills::SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f); // 78.0 max int32 DWBonus = (spellbonuses.DualWieldChance + itembonuses.DualWieldChance); DualWieldProbability += (DualWieldProbability * float(DWBonus) / 100.0f); float random = zone->random.Real(0, 1); @@ -2739,7 +2740,7 @@ void Bot::PetAIProcess() { // Ok now, let's check pet's offhand. if (botPet->GetAttackDWTimer().Check() && botPet->GetOwnerID() && botPet->GetOwner() && ((botPet->GetOwner()->GetClass() == MAGICIAN) || (botPet->GetOwner()->GetClass() == NECROMANCER) || (botPet->GetOwner()->GetClass() == SHADOWKNIGHT) || (botPet->GetOwner()->GetClass() == BEASTLORD))) { if(botPet->GetOwner()->GetLevel() >= 24) { - float DualWieldProbability = ((botPet->GetSkill(SkillDualWield) + botPet->GetLevel()) / 400.0f); + float DualWieldProbability = ((botPet->GetSkill(EQEmu::skills::SkillDualWield) + botPet->GetLevel()) / 400.0f); DualWieldProbability -= zone->random.Real(0, 1); if(DualWieldProbability < 0) { botPet->Attack(botPet->GetTarget(), EQEmu::legacy::SlotSecondary); @@ -3586,7 +3587,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } } -bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { +bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { if(!NPC::Death(killerMob, damage, spell_id, attack_skill)) return false; @@ -3661,7 +3662,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att return true; } -void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) { +void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) { if(spell_id == 0) spell_id = SPELL_UNKNOWN; @@ -3758,7 +3759,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients - SkillUseTypes skillinuse; + EQEmu::skills::SkillType skillinuse; AttackAnimation(skillinuse, Hand, weapon); Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage @@ -4776,7 +4777,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { int Bot::GetHandToHandDamage(void) { if (RuleB(Combat, UseRevampHandToHand)) { // everyone uses this in the revamp! - int skill = GetSkill(SkillHandtoHand); + int skill = GetSkill(EQEmu::skills::SkillHandtoHand); int epic = 0; if (CastToNPC()->GetEquipment(EQEmu::legacy::MaterialHands) == 10652 && GetLevel() > 46) epic = 280; @@ -4813,7 +4814,7 @@ int Bot::GetHandToHandDamage(void) { return 2; } -bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) { +bool Bot::TryFinishingBlow(Mob *defender, EQEmu::skills::SkillType skillinuse) { if (!defender) return false; @@ -4855,12 +4856,12 @@ void Bot::DoRiposte(Mob* defender) { } } -void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage, int32 hate_override,int ReuseTime, bool HitChance) { +void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 max_damage, int32 min_damage, int32 hate_override, int ReuseTime, bool HitChance) { int32 hate = max_damage; if(hate_override > -1) hate = hate_override; - if(skill == SkillBash) { + if (skill == EQEmu::skills::SkillBash) { const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); const EQEmu::Item_Struct* botweapon = 0; if(inst) @@ -4876,7 +4877,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, min_damage += (min_damage * GetMeleeMinDamageMod_SE(skill) / 100); int hand = EQEmu::legacy::SlotPrimary; - if (skill == SkillThrowing || skill == SkillArchery) + if (skill == EQEmu::skills::SkillThrowing || skill == EQEmu::skills::SkillArchery) hand = EQEmu::legacy::SlotRange; if (who->AvoidDamage(this, max_damage, hand)) { if (max_damage == -3) @@ -4953,7 +4954,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { } else { RogueBackstab(other); if (level > 54) { - float DoubleAttackProbability = ((GetSkill(SkillDoubleAttack) + GetLevel()) / 500.0f); + float DoubleAttackProbability = ((GetSkill(EQEmu::skills::SkillDoubleAttack) + GetLevel()) / 500.0f); if(zone->random.Real(0, 1) < DoubleAttackProbability) { if(other->GetHP() > 0) RogueBackstab(other,false,ReuseTime); @@ -4966,7 +4967,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { } else if(aabonuses.FrontalBackstabMinDmg || itembonuses.FrontalBackstabMinDmg || spellbonuses.FrontalBackstabMinDmg) { RogueBackstab(other, true); if (level > 54) { - float DoubleAttackProbability = ((GetSkill(SkillDoubleAttack) + GetLevel()) / 500.0f); + float DoubleAttackProbability = ((GetSkill(EQEmu::skills::SkillDoubleAttack) + GetLevel()) / 500.0f); if(zone->random.Real(0, 1) < DoubleAttackProbability) if(other->GetHP() > 0) RogueBackstab(other,true, ReuseTime); @@ -5002,11 +5003,11 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { if(primaryweapondamage > 0) { if(level > 25) { - max_hit = (((((2 * backstab_dmg) * GetDamageTable(SkillBackstab) / 100) * 10 * GetSkill(SkillBackstab) / 355) + ((level - 25) / 3) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); - hate = (20 * backstab_dmg * GetSkill(SkillBackstab) / 355); + max_hit = (((((2 * backstab_dmg) * GetDamageTable(EQEmu::skills::SkillBackstab) / 100) * 10 * GetSkill(EQEmu::skills::SkillBackstab) / 355) + ((level - 25) / 3) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); + hate = (20 * backstab_dmg * GetSkill(EQEmu::skills::SkillBackstab) / 355); } else { - max_hit = (((((2 * backstab_dmg) * GetDamageTable(SkillBackstab) / 100) * 10 * GetSkill(SkillBackstab) / 355) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); - hate = (20 * backstab_dmg * GetSkill(SkillBackstab) / 355); + max_hit = (((((2 * backstab_dmg) * GetDamageTable(EQEmu::skills::SkillBackstab) / 100) * 10 * GetSkill(EQEmu::skills::SkillBackstab) / 355) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); + hate = (20 * backstab_dmg * GetSkill(EQEmu::skills::SkillBackstab) / 355); } if (level < 51) @@ -5014,7 +5015,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { else min_hit = ((level * ( level * 5 - 105)) / 100); - if(!other->CheckHitChance(this, SkillBackstab, 0)) + if (!other->CheckHitChance(this, EQEmu::skills::SkillBackstab, 0)) ndamage = 0; else { if (min_damage) { @@ -5029,7 +5030,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { } else ndamage = -5; - DoSpecialAttackDamage(other, SkillBackstab, ndamage, min_hit, hate, ReuseTime); + DoSpecialAttackDamage(other, EQEmu::skills::SkillBackstab, ndamage, min_hit, hate, ReuseTime); DoAnim(anim1HPiercing); } @@ -5037,9 +5038,9 @@ void Bot::RogueAssassinate(Mob* other) { ItemInst* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); if(botweaponInst) { if(GetWeaponDamage(other, botweaponInst)) - other->Damage(this, 32000, SPELL_UNKNOWN, SkillBackstab); + other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); else - other->Damage(this, -5, SPELL_UNKNOWN, SkillBackstab); + other->Damage(this, -5, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); } DoAnim(anim1HPiercing); @@ -5104,54 +5105,54 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { canBash = true; if(!canBash || zone->random.Int(0, 100) > 25) - skill_to_use = SkillKick; + skill_to_use = EQEmu::skills::SkillKick; else - skill_to_use = SkillBash; + skill_to_use = EQEmu::skills::SkillBash; } case RANGER: case BEASTLORD: - skill_to_use = SkillKick; + skill_to_use = EQEmu::skills::SkillKick; break; case BERSERKER: - skill_to_use = SkillFrenzy; + skill_to_use = EQEmu::skills::SkillFrenzy; break; case CLERIC: case SHADOWKNIGHT: case PALADIN: if(level >= RuleI(Combat, NPCBashKickLevel)){ if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) - skill_to_use = SkillBash; + skill_to_use = EQEmu::skills::SkillBash; } break; case MONK: if(GetLevel() >= 30) - skill_to_use = SkillFlyingKick; + skill_to_use = EQEmu::skills::SkillFlyingKick; else if(GetLevel() >= 25) - skill_to_use = SkillDragonPunch; + skill_to_use = EQEmu::skills::SkillDragonPunch; else if(GetLevel() >= 20) - skill_to_use = SkillEagleStrike; + skill_to_use = EQEmu::skills::SkillEagleStrike; else if(GetLevel() >= 10) - skill_to_use = SkillTigerClaw; + skill_to_use = EQEmu::skills::SkillTigerClaw; else if(GetLevel() >= 5) - skill_to_use = SkillRoundKick; + skill_to_use = EQEmu::skills::SkillRoundKick; else - skill_to_use = SkillKick; + skill_to_use = EQEmu::skills::SkillKick; break; case ROGUE: - skill_to_use = SkillBackstab; + skill_to_use = EQEmu::skills::SkillBackstab; break; } if(skill_to_use == -1) return; - if(skill_to_use == SkillBash) { + if (skill_to_use == EQEmu::skills::SkillBash) { if (target != this) { DoAnim(animTailRake); if (GetWeaponDamage(target, GetBotItem(EQEmu::legacy::SlotSecondary)) <= 0 && GetWeaponDamage(target, GetBotItem(EQEmu::legacy::SlotShoulders)) <= 0) dmg = -5; else { - if(!target->CheckHitChance(this, SkillBash, 0)) + if (!target->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) dmg = 0; else { if(RuleB(Combat, UseIntervalAC)) @@ -5161,16 +5162,16 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { } } reuse = (BashReuseTime * 1000); - DoSpecialAttackDamage(target, SkillBash, dmg, 1, -1,reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillBash, dmg, 1, -1, reuse); did_attack = true; } } - if(skill_to_use == SkillFrenzy) { + if (skill_to_use == EQEmu::skills::SkillFrenzy) { int AtkRounds = 3; int skillmod = 0; - if(MaxSkill(SkillFrenzy) > 0) - skillmod = (100 * GetSkill(SkillFrenzy)/MaxSkill(SkillFrenzy)); + if (MaxSkill(EQEmu::skills::SkillFrenzy) > 0) + skillmod = (100 * GetSkill(EQEmu::skills::SkillFrenzy) / MaxSkill(EQEmu::skills::SkillFrenzy)); int32 max_dmg = (26 + ((((GetLevel() - 6) * 2) * skillmod) / 100)) * ((100 + RuleI(Combat, FrenzyBonus)) / 100); int32 min_dmg = 0; @@ -5188,20 +5189,20 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { did_attack = true; while(AtkRounds > 0) { if (GetTarget() && (AtkRounds == 1 || zone->random.Int(0, 100) < 75)) { - DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, max_dmg, reuse, true); + DoSpecialAttackDamage(GetTarget(), EQEmu::skills::SkillFrenzy, max_dmg, min_dmg, max_dmg, reuse, true); } AtkRounds--; } } - if(skill_to_use == SkillKick) { + if (skill_to_use == EQEmu::skills::SkillKick) { if(target != this) { DoAnim(animKick); if (GetWeaponDamage(target, GetBotItem(EQEmu::legacy::SlotFeet)) <= 0) dmg = -5; else { - if(!target->CheckHitChance(this, SkillKick, 0)) + if (!target->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) dmg = 0; else { if(RuleB(Combat, UseIntervalAC)) @@ -5211,17 +5212,17 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { } } reuse = (KickReuseTime * 1000); - DoSpecialAttackDamage(target, SkillKick, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillKick, dmg, 1, -1, reuse); did_attack = true; } } - if(skill_to_use == SkillFlyingKick || skill_to_use == SkillDragonPunch || skill_to_use == SkillEagleStrike || skill_to_use == SkillTigerClaw || skill_to_use == SkillRoundKick) { + if (skill_to_use == EQEmu::skills::SkillFlyingKick || skill_to_use == EQEmu::skills::SkillDragonPunch || skill_to_use == EQEmu::skills::SkillEagleStrike || skill_to_use == EQEmu::skills::SkillTigerClaw || skill_to_use == EQEmu::skills::SkillRoundKick) { reuse = (MonkSpecialAttack(target, skill_to_use) - 1); MonkSpecialAttack(target, skill_to_use); uint32 bDoubleSpecialAttack = (itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack); if(bDoubleSpecialAttack && (bDoubleSpecialAttack >= 100 || bDoubleSpecialAttack > zone->random.Int(0, 100))) { - int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; + int MonkSPA[5] = { EQEmu::skills::SkillFlyingKick, EQEmu::skills::SkillDragonPunch, EQEmu::skills::SkillEagleStrike, EQEmu::skills::SkillTigerClaw, EQEmu::skills::SkillRoundKick }; MonkSpecialAttack(target, MonkSPA[zone->random.Int(0, 4)]); int TripleChance = 25; if (bDoubleSpecialAttack > 100) @@ -5235,7 +5236,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { did_attack = true; } - if(skill_to_use == SkillBackstab) { + if (skill_to_use == EQEmu::skills::SkillBackstab) { reuse = (BackstabReuseTime * 1000); did_attack = true; if (IsRiposte) @@ -5246,9 +5247,9 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { classattack_timer.Start(reuse / HasteModifier); } -bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { +bool Bot::TryHeadShot(Mob* defender, EQEmu::skills::SkillType skillInUse) { bool Result = false; - if(defender && (defender->GetBodyType() == BT_Humanoid) && (skillInUse == SkillArchery) && (GetClass() == RANGER) && (GetLevel() >= 62)) { + if (defender && (defender->GetBodyType() == BT_Humanoid) && (skillInUse == EQEmu::skills::SkillArchery) && (GetClass() == RANGER) && (GetLevel() >= 62)) { int defenderLevel = defender->GetLevel(); int rangerLevel = GetLevel(); if(GetAA(aaHeadshot) && ((defenderLevel - 46) <= GetAA(aaHeadshot) * 2)) { @@ -5515,7 +5516,7 @@ void Bot::SetAttackTimer() { } } - if (!GetSkill(SkillDualWield)) { + if (!GetSkill(EQEmu::skills::SkillDualWield)) { attack_dw_timer.Disable(); continue; } @@ -6731,7 +6732,7 @@ int32 Bot::CalcManaRegen() { if (IsSitting()) { BuffFadeBySitModifier(); if(botclass != WARRIOR && botclass != MONK && botclass != ROGUE && botclass != BERSERKER) { - regen = ((((GetSkill(SkillMeditate) / 10) + (level - (level / 4))) / 4) + 4); + regen = ((((GetSkill(EQEmu::skills::SkillMeditate) / 10) + (level - (level / 4))) / 4) + 4); regen += (spellbonuses.ManaRegen + itembonuses.ManaRegen); } else regen = (2 + spellbonuses.ManaRegen + itembonuses.ManaRegen); @@ -7202,11 +7203,11 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[SoF::inventory::SlotPowerSource], item->Name); - insr->itemicons[SoF::inventory::SlotPowerSource] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::PossessionsPowerSource], item->Name); + insr->itemicons[SoF::invslot::PossessionsPowerSource] = item->Icon; } else - insr->itemicons[SoF::inventory::SlotPowerSource] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::PossessionsPowerSource] = 0xFFFFFFFF; } inst = inspectedBot->GetBotItem(EQEmu::legacy::SlotAmmo); @@ -7214,11 +7215,11 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[SoF::inventory::SlotAmmo], item->Name); - insr->itemicons[SoF::inventory::SlotAmmo] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::PossessionsAmmo], item->Name); + insr->itemicons[SoF::invslot::PossessionsAmmo] = item->Icon; } else - insr->itemicons[SoF::inventory::SlotAmmo] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::PossessionsAmmo] = 0xFFFFFFFF; } strcpy(insr->text, inspectedBot->GetInspectMessage().text); @@ -7527,7 +7528,7 @@ void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, } } - if (item->SkillModValue != 0 && item->SkillModType <= HIGHEST_SKILL){ + if (item->SkillModValue != 0 && item->SkillModType <= EQEmu::skills::HIGHEST_SKILL){ if ((item->SkillModValue > 0 && newbon->skillmod[item->SkillModType] < item->SkillModValue) || (item->SkillModValue < 0 && newbon->skillmod[item->SkillModType] > item->SkillModValue)) { @@ -7535,7 +7536,7 @@ void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, } } - if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= HIGHEST_SKILL) { + if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= EQEmu::skills::HIGHEST_SKILL) { if((newbon->SkillDamageAmount[item->ExtraDmgSkill] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap)) newbon->SkillDamageAmount[item->ExtraDmgSkill] = RuleI(Character, ItemExtraDmgCap); else @@ -7598,7 +7599,7 @@ void Bot::CalcBotStats(bool showtext) { // Test Code if(GetClass() == BARD) GetBotOwner()->Message(15, "Bard Skills-- Brass: %i, Percussion: %i, Singing: %i, Stringed: %i, Wind: %i", - GetSkill(SkillBrassInstruments), GetSkill(SkillPercussionInstruments), GetSkill(SkillSinging), GetSkill(SkillStringedInstruments), GetSkill(SkillWindInstruments)); + GetSkill(EQEmu::skills::SkillBrassInstruments), GetSkill(EQEmu::skills::SkillPercussionInstruments), GetSkill(EQEmu::skills::SkillSinging), GetSkill(EQEmu::skills::SkillStringedInstruments), GetSkill(EQEmu::skills::SkillWindInstruments)); } /*if(this->Save()) @@ -7617,11 +7618,11 @@ void Bot::CalcBotStats(bool showtext) { // Test Code if(GetClass() == BARD) { GetBotOwner()->Message(15, "Bard Skills-- Brass: %i, Percussion: %i, Singing: %i, Stringed: %i, Wind: %i", - GetSkill(SkillBrassInstruments) + GetBrassMod(), - GetSkill(SkillPercussionInstruments) + GetPercMod(), - GetSkill(SkillSinging) + GetSingMod(), - GetSkill(SkillStringedInstruments) + GetStringMod(), - GetSkill(SkillWindInstruments) + GetWindMod()); + GetSkill(EQEmu::skills::SkillBrassInstruments) + GetBrassMod(), + GetSkill(EQEmu::skills::SkillPercussionInstruments) + GetPercMod(), + GetSkill(EQEmu::skills::SkillSinging) + GetSingMod(), + GetSkill(EQEmu::skills::SkillStringedInstruments) + GetStringMod(), + GetSkill(EQEmu::skills::SkillWindInstruments) + GetWindMod()); GetBotOwner()->Message(15, "Bard Skill Mods-- Brass: %i, Percussion: %i, Singing: %i, Stringed: %i, Wind: %i", GetBrassMod(), GetPercMod(), GetSingMod(), GetStringMod(), GetWindMod()); } } diff --git a/zone/bot.h b/zone/bot.h index b04481bd1..da42147a2 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -205,8 +205,8 @@ public: Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType npcTypeData); //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, int special = 0); + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return (GetRaid() ? true : false); } @@ -239,23 +239,23 @@ public: uint16 BotGetSpellPriority(int spellslot) { return AIspells[spellslot].priority; } virtual float GetProcChances(float ProcBonus, uint16 hand); virtual int GetHandToHandDamage(void); - virtual bool TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse); + virtual bool TryFinishingBlow(Mob *defender, EQEmu::skills::SkillType skillinuse); virtual void DoRiposte(Mob* defender); - inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } + inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(EQEmu::skills::SkillOffense)) * 9 / 10); } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } uint32 GetTotalATK(); uint32 GetATKRating(); uint16 GetPrimarySkillValue(); - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } - virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false); + uint16 MaxSkill(EQEmu::skills::SkillType skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(EQEmu::skills::SkillType skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + virtual void DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance = false); virtual void TryBackstab(Mob *other,int ReuseTime = 10); virtual void RogueBackstab(Mob* other, bool min_damage = false, int ReuseTime = 10); virtual void RogueAssassinate(Mob* other); virtual void DoClassAttacks(Mob *target, bool IsRiposte=false); - virtual bool TryHeadShot(Mob* defender, SkillUseTypes skillInUse); - virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime =0); - virtual void ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg); + virtual bool TryHeadShot(Mob* defender, EQEmu::skills::SkillType skillInUse); + virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod = 0, int16 focus = 0, bool CanRiposte = false, int ReuseTime = 0); + virtual void ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int32 &mindmg); bool CanDoSpecialAttack(Mob *other); virtual int32 CheckAggroAmount(uint16 spellid); virtual void CalcBonuses(); diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 92fd8cf44..2884ec838 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -54,6 +54,7 @@ #include "../common/rulesys.h" #include "../common/serverinfo.h" #include "../common/string_util.h" +#include "../common/say_link.h" #include "../common/eqemu_logsys.h" @@ -335,11 +336,11 @@ public: while (spells[spell_id].typedescnum == 27) { if (!spells[spell_id].goodEffect) break; - if (spells[spell_id].skill != SkillOffense && spells[spell_id].skill != SkillDefense) + if (spells[spell_id].skill != EQEmu::skills::SkillOffense && spells[spell_id].skill != EQEmu::skills::SkillDefense) break; entry_prototype = new STStanceEntry(); - if (spells[spell_id].skill == SkillOffense) + if (spells[spell_id].skill == EQEmu::skills::SkillOffense) entry_prototype->SafeCastToStance()->stance_type = BCEnum::StT_Aggressive; else entry_prototype->SafeCastToStance()->stance_type = BCEnum::StT_Defensive; @@ -2388,7 +2389,7 @@ namespace ActionableBots sbl.remove_if([bot_owner](Bot* l) { return (!l->IsBotArcher()); }); } - static void Filter_ByHighestSkill(Client* bot_owner, std::list& sbl, SkillUseTypes skill_type, float& skill_value) { + static void Filter_ByHighestSkill(Client* bot_owner, std::list& sbl, EQEmu::skills::SkillType skill_type, float& skill_value) { sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); }); skill_value = 0.0f; @@ -2425,7 +2426,7 @@ namespace ActionableBots sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() == ROGUE && l->GetLevel() < 5); }); sbl.remove_if([bot_owner](const Bot* l) { return (l->GetClass() == BARD && l->GetLevel() < 40); }); - ActionableBots::Filter_ByHighestSkill(bot_owner, sbl, SkillPickLock, pick_lock_value); + ActionableBots::Filter_ByHighestSkill(bot_owner, sbl, EQEmu::skills::SkillPickLock, pick_lock_value); } }; @@ -3906,7 +3907,7 @@ void bot_command_taunt(Client *c, const Seperator *sep) int taunting_count = 0; for (auto bot_iter : sbl) { - if (!bot_iter->GetSkill(SkillTaunt)) + if (!bot_iter->GetSkill(EQEmu::skills::SkillTaunt)) continue; if (toggle_taunt) diff --git a/zone/client.cpp b/zone/client.cpp index 38e5d7c7e..4027bb6e1 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1433,8 +1433,8 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme) return(false); } -void Client::SetSkill(SkillUseTypes skillid, uint16 value) { - if (skillid > HIGHEST_SKILL) +void Client::SetSkill(EQEmu::skills::SkillType skillid, uint16 value) { + if (skillid > EQEmu::skills::HIGHEST_SKILL) return; m_pp.skills[skillid] = value; // We need to be able to #setskill 254 and 255 to reset skills @@ -1470,8 +1470,8 @@ void Client::IncreaseLanguageSkill(int skill_id, int value) { Message_StringID( MT_Skills, LANG_SKILL_IMPROVED ); //Notify client } -void Client::AddSkill(SkillUseTypes skillid, uint16 value) { - if (skillid > HIGHEST_SKILL) +void Client::AddSkill(EQEmu::skills::SkillType skillid, uint16 value) { + if (skillid > EQEmu::skills::HIGHEST_SKILL) return; value = GetRawSkill(skillid) + value; uint16 max = GetMaxSkillAfterSpecializationRules(skillid, MaxSkill(skillid)); @@ -2289,12 +2289,12 @@ uint64 Client::GetAllMoney() { (static_cast(m_pp.platinum_shared) * 1000))))); } -bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi) { +bool Client::CheckIncreaseSkill(EQEmu::skills::SkillType skillid, Mob *against_who, int chancemodi) { if (IsDead() || IsUnconscious()) return false; if (IsAIControlled()) // no skillups while chamred =p return false; - if (skillid > HIGHEST_SKILL) + if (skillid > EQEmu::skills::HIGHEST_SKILL) return false; int skillval = GetRawSkill(skillid); int maxskill = GetMaxSkillAfterSpecializationRules(skillid, MaxSkill(skillid)); @@ -2359,34 +2359,34 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { } } -bool Client::HasSkill(SkillUseTypes skill_id) const { +bool Client::HasSkill(EQEmu::skills::SkillType skill_id) const { return((GetSkill(skill_id) > 0) && CanHaveSkill(skill_id)); } -bool Client::CanHaveSkill(SkillUseTypes skill_id) const { - if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && class_ == BERSERKER && skill_id == Skill1HPiercing) - skill_id = Skill2HPiercing; +bool Client::CanHaveSkill(EQEmu::skills::SkillType skill_id) const { + if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && class_ == BERSERKER && skill_id == EQEmu::skills::Skill1HPiercing) + skill_id = EQEmu::skills::Skill2HPiercing; return(database.GetSkillCap(GetClass(), skill_id, RuleI(Character, MaxLevel)) > 0); //if you don't have it by max level, then odds are you never will? } -uint16 Client::MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const { - if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && class_ == BERSERKER && skillid == Skill1HPiercing) - skillid = Skill2HPiercing; +uint16 Client::MaxSkill(EQEmu::skills::SkillType skillid, uint16 class_, uint16 level) const { + if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && class_ == BERSERKER && skillid == EQEmu::skills::Skill1HPiercing) + skillid = EQEmu::skills::Skill2HPiercing; return(database.GetSkillCap(class_, skillid, level)); } -uint8 Client::SkillTrainLevel(SkillUseTypes skillid, uint16 class_) +uint8 Client::SkillTrainLevel(EQEmu::skills::SkillType skillid, uint16 class_) { - if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && class_ == BERSERKER && skillid == Skill1HPiercing) - skillid = Skill2HPiercing; + if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && class_ == BERSERKER && skillid == EQEmu::skills::Skill1HPiercing) + skillid = EQEmu::skills::Skill2HPiercing; return(database.GetTrainLevel(class_, skillid, RuleI(Character, MaxLevel))); } -uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill) +uint16 Client::GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skillid, uint16 maxSkill) { uint16 Result = maxSkill; @@ -2396,13 +2396,13 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 uint16 MaxSpecializations = GetAA(aaSecondaryForte) ? 2 : 1; - if(skillid >= SkillSpecializeAbjure && skillid <= SkillSpecializeEvocation) + if (skillid >= EQEmu::skills::SkillSpecializeAbjure && skillid <= EQEmu::skills::SkillSpecializeEvocation) { bool HasPrimarySpecSkill = false; int NumberOfPrimarySpecSkills = 0; - for(int i = SkillSpecializeAbjure; i <= SkillSpecializeEvocation; ++i) + for (int i = EQEmu::skills::SkillSpecializeAbjure; i <= EQEmu::skills::SkillSpecializeEvocation; ++i) { if(m_pp.skills[i] > 50) { @@ -2459,8 +2459,8 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Message(13, "Your spell casting specializations skills have been reset. " "Only %i primary specialization skill is allowed.", MaxSpecializations); - for(int i = SkillSpecializeAbjure; i <= SkillSpecializeEvocation; ++i) - SetSkill((SkillUseTypes)i, 1); + for (int i = EQEmu::skills::SkillSpecializeAbjure; i <= EQEmu::skills::SkillSpecializeEvocation; ++i) + SetSkill((EQEmu::skills::SkillType)i, 1); Save(); @@ -2643,14 +2643,14 @@ bool Client::BindWound(Mob *bindmob, bool start, bool fail) bind_out->type = 1; // Done QueuePacket(outapp); bind_out->type = 0; - CheckIncreaseSkill(SkillBindWound, nullptr, 5); + CheckIncreaseSkill(EQEmu::skills::SkillBindWound, nullptr, 5); int maxHPBonus = spellbonuses.MaxBindWound + itembonuses.MaxBindWound + aabonuses.MaxBindWound; int max_percent = 50 + 10 * maxHPBonus; - if (GetClass() == MONK && GetSkill(SkillBindWound) > 200) { + if (GetClass() == MONK && GetSkill(EQEmu::skills::SkillBindWound) > 200) { max_percent = 70 + 10 * maxHPBonus; } @@ -2663,10 +2663,11 @@ bool Client::BindWound(Mob *bindmob, bool start, bool fail) // 0.120 per skill point, 0.60 per skill level, minimum 3 max 30 int bindhps = 3; - if (GetSkill(SkillBindWound) > 200) { - bindhps += GetSkill(SkillBindWound) * 4 / 10; - } else if (GetSkill(SkillBindWound) >= 10) { - bindhps += GetSkill(SkillBindWound) / 4; + if (GetSkill(EQEmu::skills::SkillBindWound) > 200) { + bindhps += GetSkill(EQEmu::skills::SkillBindWound) * 4 / 10; + } + else if (GetSkill(EQEmu::skills::SkillBindWound) >= 10) { + bindhps += GetSkill(EQEmu::skills::SkillBindWound) / 4; } // Implementation of aaMithanielsBinding is a guess (the multiplier) @@ -3774,7 +3775,7 @@ void Client::SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu pick_out->coin = amt; pick_out->from = GetID(); pick_out->to = from->GetID(); - pick_out->myskill = GetSkill(SkillPickPockets); + pick_out->myskill = GetSkill(EQEmu::skills::SkillPickPockets); if ((type >= PickPocketPlatinum) && (type <= PickPocketCopper) && (amt == 0)) type = PickPocketFailed; @@ -4196,11 +4197,11 @@ bool Client::GroupFollow(Client* inviter) { uint16 Client::GetPrimarySkillValue() { - SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill + EQEmu::skills::SkillType skill = EQEmu::skills::HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill bool equiped = m_inv.GetItem(EQEmu::legacy::SlotPrimary); if (!equiped) - skill = SkillHandtoHand; + skill = EQEmu::skills::SkillHandtoHand; else { @@ -4208,31 +4209,31 @@ uint16 Client::GetPrimarySkillValue() switch (type) { case EQEmu::item::ItemType1HSlash: // 1H Slashing - skill = Skill1HSlashing; + skill = EQEmu::skills::Skill1HSlashing; break; case EQEmu::item::ItemType2HSlash: // 2H Slashing - skill = Skill2HSlashing; + skill = EQEmu::skills::Skill2HSlashing; break; case EQEmu::item::ItemType1HPiercing: // Piercing - skill = Skill1HPiercing; + skill = EQEmu::skills::Skill1HPiercing; break; case EQEmu::item::ItemType1HBlunt: // 1H Blunt - skill = Skill1HBlunt; + skill = EQEmu::skills::Skill1HBlunt; break; case EQEmu::item::ItemType2HBlunt: // 2H Blunt - skill = Skill2HBlunt; + skill = EQEmu::skills::Skill2HBlunt; break; case EQEmu::item::ItemType2HPiercing: // 2H Piercing if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - skill = Skill1HPiercing; + skill = EQEmu::skills::Skill1HPiercing; else - skill = Skill2HPiercing; + skill = EQEmu::skills::Skill2HPiercing; break; case EQEmu::item::ItemTypeMartial: // Hand to Hand - skill = SkillHandtoHand; + skill = EQEmu::skills::SkillHandtoHand; break; default: // All other types default to Hand to Hand - skill = SkillHandtoHand; + skill = EQEmu::skills::SkillHandtoHand; break; } } @@ -4246,7 +4247,7 @@ uint32 Client::GetTotalATK() uint32 WornCap = itembonuses.ATK; if(IsClient()) { - AttackRating = ((WornCap * 1.342) + (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); + AttackRating = ((WornCap * 1.342) + (GetSkill(EQEmu::skills::SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); AttackRating += aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); if (AttackRating < 10) @@ -4264,7 +4265,7 @@ uint32 Client::GetATKRating() { uint32 AttackRating = 0; if(IsClient()) { - AttackRating = (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); + AttackRating = (GetSkill(EQEmu::skills::SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); if (AttackRating < 10) AttackRating = 10; @@ -4639,7 +4640,7 @@ void Client::HandleLDoNOpen(NPC *target) AddEXP(target->GetLevel()*target->GetLevel()*2625/10, GetLevelCon(target->GetLevel())); } } - target->Death(this, 0, SPELL_UNKNOWN, SkillHandtoHand); + target->Death(this, 0, SPELL_UNKNOWN, EQEmu::skills::SkillHandtoHand); } } } @@ -4952,14 +4953,14 @@ void Client::ShowSkillsWindow() { const char *WindowTitle = "Skills"; std::string WindowText; - std::map Skills = EQEmu::GetSkillUseTypesMap(); + std::map Skills = EQEmu::skills::GetSkillTypeMap(); if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - Skills[Skill1HPiercing] = "Piercing"; + Skills[EQEmu::skills::Skill1HPiercing] = "Piercing"; // print out all available skills for (auto skills_iter : Skills) { - if (skills_iter.first == Skill2HPiercing && ClientVersion() < EQEmu::versions::ClientVersion::RoF2) + if (skills_iter.first == EQEmu::skills::Skill2HPiercing && ClientVersion() < EQEmu::versions::ClientVersion::RoF2) continue; if (!GetSkill(skills_iter.first) && !MaxSkill(skills_iter.first)) continue; @@ -5721,11 +5722,11 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { if(item) { // we shouldn't do this..but, that's the way it's coded atm... // (this type of action should be handled exclusively in the client translator) - strcpy(insr->itemnames[SoF::inventory::SlotPowerSource], item->Name); - insr->itemicons[SoF::inventory::SlotPowerSource] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::PossessionsPowerSource], item->Name); + insr->itemicons[SoF::invslot::PossessionsPowerSource] = item->Icon; } else - insr->itemicons[SoF::inventory::SlotPowerSource] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::PossessionsPowerSource] = 0xFFFFFFFF; } inst = requestee->GetInv().GetItem(EQEmu::legacy::SlotAmmo); @@ -5733,11 +5734,11 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[SoF::inventory::SlotAmmo], item->Name); - insr->itemicons[SoF::inventory::SlotAmmo] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::PossessionsAmmo], item->Name); + insr->itemicons[SoF::invslot::PossessionsAmmo] = item->Icon; } else - insr->itemicons[SoF::inventory::SlotAmmo] = 0xFFFFFFFF; + insr->itemicons[SoF::invslot::PossessionsAmmo] = 0xFFFFFFFF; } strcpy(insr->text, requestee->GetInspectMessage().text); @@ -6750,7 +6751,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) }; std::string skill_mods = ""; - for(int j = 0; j <= HIGHEST_SKILL; j++) { + for (int j = 0; j <= EQEmu::skills::HIGHEST_SKILL; j++) { if(itembonuses.skillmod[j] > 0) skill_mods += indP + skill_list[j] + " : +" + itoa(itembonuses.skillmod[j]) + "%
"; else if(itembonuses.skillmod[j] < 0) @@ -6758,7 +6759,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) } std::string skill_dmgs = ""; - for(int j = 0; j <= HIGHEST_SKILL; j++) { + for (int j = 0; j <= EQEmu::skills::HIGHEST_SKILL; j++) { if((itembonuses.SkillDamageAmount[j] + spellbonuses.SkillDamageAmount[j]) > 0) skill_dmgs += indP + skill_list[j] + " : +" + itoa(itembonuses.SkillDamageAmount[j] + spellbonuses.SkillDamageAmount[j]) + "
"; else if((itembonuses.SkillDamageAmount[j] + spellbonuses.SkillDamageAmount[j]) < 0) diff --git a/zone/client.h b/zone/client.h index 28da7ee72..ca26c8fcb 100644 --- a/zone/client.h +++ b/zone/client.h @@ -220,8 +220,8 @@ public: ~Client(); //abstract virtual function implementations required 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, int special = 0); + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return (GetRaid() ? true : false); } @@ -306,7 +306,7 @@ public: void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); void SendSound(); void LearnRecipe(uint32 recipeID); - bool CanIncreaseTradeskill(SkillUseTypes tradeskill); + bool CanIncreaseTradeskill(EQEmu::skills::SkillType tradeskill); EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); @@ -418,7 +418,7 @@ public: virtual void CalcBonuses(); //these are all precalculated now inline virtual int32 GetAC() const { return AC; } - inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } + inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(EQEmu::skills::SkillOffense)) * 9 / 10); } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } inline virtual int GetHaste() const { return Haste; } int GetRawACNoShield(int &shield_ac) const; @@ -682,31 +682,31 @@ public: uint16 GetSkillPoints() { return m_pp.points;} void SetSkillPoints(int inp) { m_pp.points = inp;} - void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } + void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= EQEmu::skills::HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } void IncreaseLanguageSkill(int skill_id, int value = 1); - virtual uint16 GetSkill(SkillUseTypes skill_id) const {if (skill_id <= HIGHEST_SKILL) {return(itembonuses.skillmod[skill_id] > 0 ? (itembonuses.skillmodmax[skill_id] > 0 ? std::min(m_pp.skills[skill_id] + itembonuses.skillmodmax[skill_id], m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100) : m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100) : m_pp.skills[skill_id]);} return 0;} - uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - void SetSkill(SkillUseTypes skill_num, uint16 value); - void AddSkill(SkillUseTypes skillid, uint16 value); + virtual uint16 GetSkill(EQEmu::skills::SkillType skill_id) const { if (skill_id <= EQEmu::skills::HIGHEST_SKILL) { return(itembonuses.skillmod[skill_id] > 0 ? (itembonuses.skillmodmax[skill_id] > 0 ? std::min(m_pp.skills[skill_id] + itembonuses.skillmodmax[skill_id], m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100) : m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100) : m_pp.skills[skill_id]); } return 0; } + uint32 GetRawSkill(EQEmu::skills::SkillType skill_id) const { if (skill_id <= EQEmu::skills::HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } + bool HasSkill(EQEmu::skills::SkillType skill_id) const; + bool CanHaveSkill(EQEmu::skills::SkillType skill_id) const; + void SetSkill(EQEmu::skills::SkillType skill_num, uint16 value); + void AddSkill(EQEmu::skills::SkillType skillid, uint16 value); void CheckSpecializeIncrease(uint16 spell_id); void CheckSongSkillIncrease(uint16 spell_id); - bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); + bool CheckIncreaseSkill(EQEmu::skills::SkillType skillid, Mob *against_who, int chancemodi = 0); void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); void SetLanguageSkill(int langid, int value); void SetHoTT(uint32 mobid); void ShowSkillsWindow(); void SendStatsWindow(Client* client, bool use_window); - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } - uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); + uint16 MaxSkill(EQEmu::skills::SkillType skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(EQEmu::skills::SkillType skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + uint8 SkillTrainLevel(EQEmu::skills::SkillType skillid, uint16 class_); void TradeskillSearchResults(const std::string &query, unsigned long objtype, unsigned long someid); void SendTradeskillDetails(uint32 recipe_id); bool TradeskillExecute(DBTradeskillRecipe_Struct *spec); - void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill); + void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, EQEmu::skills::SkillType tradeskill); void GMKill(); inline bool IsMedding() const {return medding;} @@ -928,7 +928,7 @@ public: int GetNextAvailableSpellBookSlot(int starting_slot = 0); inline uint32 GetSpellByBookSlot(int book_slot) { return m_pp.spell_book[book_slot]; } inline bool HasSpellScribed(int spellid) { return (FindSpellBookSlotBySpellID(spellid) != -1 ? true : false); } - uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); + uint16 GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skillid, uint16 maxSkill); void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); bool PendingTranslocate; @@ -1176,13 +1176,14 @@ public: int32 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); } void LoadAccountFlags(); void SetAccountFlag(std::string flag, std::string val); - std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); + std::string GetAccountFlag(std::string flag); + float GetDamageMultiplier(EQEmu::skills::SkillType how_long_has_this_been_missing); void Consume(const EQEmu::Item_Struct *item, uint8 type, int16 slot, bool auto_consume); void PlayMP3(const char* fname); void ExpeditionSay(const char *str, int ExpID); - int mod_client_damage(int damage, SkillUseTypes skillinuse, int hand, const ItemInst* weapon, Mob* other); + int mod_client_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const ItemInst* weapon, Mob* other); bool mod_client_message(char* message, uint8 chan_num); - bool mod_can_increase_skill(SkillUseTypes skillid, Mob* against_who); + bool mod_can_increase_skill(EQEmu::skills::SkillType skillid, Mob* against_who); int16 mod_increase_skill_chance(int16 chance, Mob* against_who); int mod_bindwound_percent(int max_percent, Mob* bindmob); int mod_bindwound_hp(int bindhps, Mob* bindmob); diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index c6860a52f..1311f7b53 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1032,7 +1032,7 @@ int32 Client::acmod() int32 Client::CalcAC() { // new formula - int avoidance = (acmod() + ((GetSkill(SkillDefense) + itembonuses.HeroicAGI / 10) * 16) / 9); + int avoidance = (acmod() + ((GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) * 16) / 9); if (avoidance < 0) { avoidance = 0; } @@ -1040,13 +1040,13 @@ int32 Client::CalcAC() if (m_pp.class_ == WIZARD || m_pp.class_ == MAGICIAN || m_pp.class_ == NECROMANCER || m_pp.class_ == ENCHANTER) { //something is wrong with this, naked casters have the wrong natural AC // mitigation = (spellbonuses.AC/3) + (GetSkill(DEFENSE)/2) + (itembonuses.AC+1); - mitigation = (GetSkill(SkillDefense) + itembonuses.HeroicAGI / 10) / 4 + (itembonuses.AC + 1); + mitigation = (GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 4 + (itembonuses.AC + 1); //this might be off by 4.. mitigation -= 4; } else { // mitigation = (spellbonuses.AC/4) + (GetSkill(DEFENSE)/3) + ((itembonuses.AC*4)/3); - mitigation = (GetSkill(SkillDefense) + itembonuses.HeroicAGI / 10) / 3 + ((itembonuses.AC * 4) / 3); + mitigation = (GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 3 + ((itembonuses.AC * 4) / 3); if (m_pp.class_ == MONK) { mitigation += GetLevel() * 13 / 10; //the 13/10 might be wrong, but it is close... } @@ -1085,11 +1085,11 @@ int32 Client::GetACMit() { int mitigation = 0; if (m_pp.class_ == WIZARD || m_pp.class_ == MAGICIAN || m_pp.class_ == NECROMANCER || m_pp.class_ == ENCHANTER) { - mitigation = (GetSkill(SkillDefense) + itembonuses.HeroicAGI / 10) / 4 + (itembonuses.AC + 1); + mitigation = (GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 4 + (itembonuses.AC + 1); mitigation -= 4; } else { - mitigation = (GetSkill(SkillDefense) + itembonuses.HeroicAGI / 10) / 3 + ((itembonuses.AC * 4) / 3); + mitigation = (GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 3 + ((itembonuses.AC * 4) / 3); if (m_pp.class_ == MONK) { mitigation += GetLevel() * 13 / 10; //the 13/10 might be wrong, but it is close... } @@ -1109,7 +1109,7 @@ int32 Client::GetACMit() int32 Client::GetACAvoid() { - int32 avoidance = (acmod() + ((GetSkill(SkillDefense) + itembonuses.HeroicAGI / 10) * 16) / 9); + int32 avoidance = (acmod() + ((GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) * 16) / 9); if (avoidance < 0) { avoidance = 0; } @@ -1247,8 +1247,8 @@ int32 Client::CalcBaseManaRegen() uint8 clevel = GetLevel(); int32 regen = 0; if (IsSitting() || (GetHorseId() != 0)) { - if (HasSkill(SkillMeditate)) { - regen = (((GetSkill(SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4; + if (HasSkill(EQEmu::skills::SkillMeditate)) { + regen = (((GetSkill(EQEmu::skills::SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4; } else { regen = 2; @@ -1267,11 +1267,11 @@ int32 Client::CalcManaRegen() //this should be changed so we dont med while camping, etc... if (IsSitting() || (GetHorseId() != 0)) { BuffFadeBySitModifier(); - if (HasSkill(SkillMeditate)) { + if (HasSkill(EQEmu::skills::SkillMeditate)) { this->medding = true; - regen = (((GetSkill(SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4; + regen = (((GetSkill(EQEmu::skills::SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4; regen += spellbonuses.ManaRegen + itembonuses.ManaRegen; - CheckIncreaseSkill(SkillMeditate, nullptr, -5); + CheckIncreaseSkill(EQEmu::skills::SkillMeditate, nullptr, -5); } else { regen = 2 + spellbonuses.ManaRegen + itembonuses.ManaRegen; @@ -1355,7 +1355,7 @@ 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 (EQEmu::limits::CoinHasWeight(EQEmu::versions::ConvertClientVersionToInventoryVersion(ClientVersion()))) { + if (EQEmu::profile::CoinHasWeight(EQEmu::versions::ConvertClientVersionToInventoryVersion(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; @@ -2046,10 +2046,10 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const // clickies (Symphony of Battle) that have a song skill don't get AA bonus for some reason // but clickies that are songs (selo's on Composers Greaves) do get AA mod as well switch (spells[spell_id].skill) { - case SkillPercussionInstruments: + case EQEmu::skills::SkillPercussionInstruments: if (itembonuses.percussionMod == 0 && spellbonuses.percussionMod == 0) effectmod = 10; - else if (GetSkill(SkillPercussionInstruments) == 0) + else if (GetSkill(EQEmu::skills::SkillPercussionInstruments) == 0) effectmod = 10; else if (itembonuses.percussionMod > spellbonuses.percussionMod) effectmod = itembonuses.percussionMod; @@ -2058,10 +2058,10 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (IsBardSong(spell_id)) effectmod += aabonuses.percussionMod; break; - case SkillStringedInstruments: + case EQEmu::skills::SkillStringedInstruments: if (itembonuses.stringedMod == 0 && spellbonuses.stringedMod == 0) effectmod = 10; - else if (GetSkill(SkillStringedInstruments) == 0) + else if (GetSkill(EQEmu::skills::SkillStringedInstruments) == 0) effectmod = 10; else if (itembonuses.stringedMod > spellbonuses.stringedMod) effectmod = itembonuses.stringedMod; @@ -2070,10 +2070,10 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (IsBardSong(spell_id)) effectmod += aabonuses.stringedMod; break; - case SkillWindInstruments: + case EQEmu::skills::SkillWindInstruments: if (itembonuses.windMod == 0 && spellbonuses.windMod == 0) effectmod = 10; - else if (GetSkill(SkillWindInstruments) == 0) + else if (GetSkill(EQEmu::skills::SkillWindInstruments) == 0) effectmod = 10; else if (itembonuses.windMod > spellbonuses.windMod) effectmod = itembonuses.windMod; @@ -2082,10 +2082,10 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (IsBardSong(spell_id)) effectmod += aabonuses.windMod; break; - case SkillBrassInstruments: + case EQEmu::skills::SkillBrassInstruments: if (itembonuses.brassMod == 0 && spellbonuses.brassMod == 0) effectmod = 10; - else if (GetSkill(SkillBrassInstruments) == 0) + else if (GetSkill(EQEmu::skills::SkillBrassInstruments) == 0) effectmod = 10; else if (itembonuses.brassMod > spellbonuses.brassMod) effectmod = itembonuses.brassMod; @@ -2094,7 +2094,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (IsBardSong(spell_id)) effectmod += aabonuses.brassMod; break; - case SkillSinging: + case EQEmu::skills::SkillSinging: if (itembonuses.singingMod == 0 && spellbonuses.singingMod == 0) effectmod = 10; else if (itembonuses.singingMod > spellbonuses.singingMod) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 9712e031a..ac4466aab 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2830,10 +2830,10 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if ((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing) || (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing)) { - float SuccessChance = (GetSkill(SkillApplyPoison) + GetLevel()) / 400.0f; + float SuccessChance = (GetSkill(EQEmu::skills::SkillApplyPoison) + GetLevel()) / 400.0f; double ChanceRoll = zone->random.Real(0, 1); - CheckIncreaseSkill(SkillApplyPoison, nullptr, 10); + CheckIncreaseSkill(EQEmu::skills::SkillApplyPoison, nullptr, 10); if (ChanceRoll < SuccessChance) { ApplyPoisonSuccessResult = 1; @@ -3630,7 +3630,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) return; } - if (!HasSkill(SkillBegging) || !GetTarget()) + if (!HasSkill(EQEmu::skills::SkillBegging) || !GetTarget()) return; if (GetTarget()->GetClass() == LDON_TREASURE) @@ -3668,7 +3668,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) return; } - uint16 CurrentSkill = GetSkill(SkillBegging); + uint16 CurrentSkill = GetSkill(EQEmu::skills::SkillBegging); float ChanceToBeg = ((float)(CurrentSkill / 700.0f) + 0.15f) * 100; @@ -3690,7 +3690,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) } QueuePacket(outapp); safe_delete(outapp); - CheckIncreaseSkill(SkillBegging, nullptr, -10); + CheckIncreaseSkill(EQEmu::skills::SkillBegging, nullptr, -10); } void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) @@ -4526,7 +4526,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if(IsTracking() && ((m_Position.x!=ppu->x_pos) || (m_Position.y!=ppu->y_pos))){ if(zone->random.Real(0, 100) < 70)//should be good - CheckIncreaseSkill(SkillTracking, nullptr, -20); + CheckIncreaseSkill(EQEmu::skills::SkillTracking, nullptr, -20); } // Break Hide if moving without sneaking and set rewind timer if moved @@ -4581,7 +4581,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) } if(zone->watermap && zone->watermap->InLiquid(glm::vec3(m_Position))) - CheckIncreaseSkill(SkillSwimming, nullptr, -17); + CheckIncreaseSkill(EQEmu::skills::SkillSwimming, nullptr, -17); return; } @@ -5070,7 +5070,7 @@ void Client::Handle_OP_Death(const EQApplicationPacket *app) Death_Struct* ds = (Death_Struct*)app->pBuffer; //I think this attack_skill value is really a value from SkillDamageTypes... - if (ds->attack_skill > HIGHEST_SKILL) { + if (ds->attack_skill > EQEmu::skills::HIGHEST_SKILL) { return; } @@ -5078,7 +5078,7 @@ void Client::Handle_OP_Death(const EQApplicationPacket *app) return; Mob* killer = entity_list.GetMob(ds->killer_id); - Death(killer, ds->damage, ds->spell_id, (SkillUseTypes)ds->attack_skill); + Death(killer, ds->damage, ds->spell_id, (EQEmu::skills::SkillType)ds->attack_skill); return; } @@ -5139,9 +5139,9 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app) const ItemInst *inst = GetInv().GetItem(alc->from_slot); if (inst && inst->GetItem()->ItemType == EQEmu::item::ItemTypeAlcohol) { entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), inst->GetItem()->Name); - CheckIncreaseSkill(SkillAlcoholTolerance, nullptr, 25); + CheckIncreaseSkill(EQEmu::skills::SkillAlcoholTolerance, nullptr, 25); - int16 AlcoholTolerance = GetSkill(SkillAlcoholTolerance); + int16 AlcoholTolerance = GetSkill(EQEmu::skills::SkillAlcoholTolerance); int16 IntoxicationIncrease; if (ClientVersion() < EQEmu::versions::ClientVersion::SoD) @@ -5209,7 +5209,7 @@ void Client::Handle_OP_DeleteSpell(const EQApplicationPacket *app) void Client::Handle_OP_DisarmTraps(const EQApplicationPacket *app) { - if (!HasSkill(SkillDisarmTraps)) + if (!HasSkill(EQEmu::skills::SkillDisarmTraps)) return; if (!p_timers.Expired(&database, pTimerDisarmTraps, false)) { @@ -5217,7 +5217,7 @@ void Client::Handle_OP_DisarmTraps(const EQApplicationPacket *app) return; } - int reuse = DisarmTrapsReuseTime - GetSkillReuseTime(SkillDisarmTraps); + int reuse = DisarmTrapsReuseTime - GetSkillReuseTime(EQEmu::skills::SkillDisarmTraps); if (reuse < 1) reuse = 1; @@ -5227,7 +5227,7 @@ void Client::Handle_OP_DisarmTraps(const EQApplicationPacket *app) Trap* trap = entity_list.FindNearbyTrap(this, 60); if (trap && trap->detected) { - int uskill = GetSkill(SkillDisarmTraps); + int uskill = GetSkill(EQEmu::skills::SkillDisarmTraps); if ((zone->random.Int(0, 49) + uskill) >= (zone->random.Int(0, 49) + trap->skill)) { Message(MT_Skills, "You disarm a trap."); @@ -5245,7 +5245,7 @@ void Client::Handle_OP_DisarmTraps(const EQApplicationPacket *app) Message(MT_Skills, "You failed to disarm a trap."); } } - CheckIncreaseSkill(SkillDisarmTraps, nullptr); + CheckIncreaseSkill(EQEmu::skills::SkillDisarmTraps, nullptr); return; } Message(MT_Skills, "You did not find any traps close enough to disarm."); @@ -5527,7 +5527,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) if (GetHP() <= 0) { mod_client_death_env(); - Death(0, 32000, SPELL_UNKNOWN, SkillHandtoHand); + Death(0, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillHandtoHand); } SendHPUpdate(); return; @@ -5571,7 +5571,7 @@ void Client::Handle_OP_FeignDeath(const EQApplicationPacket *app) } int reuse = FeignDeathReuseTime; - reuse -= GetSkillReuseTime(SkillFeignDeath); + reuse -= GetSkillReuseTime(EQEmu::skills::SkillFeignDeath); if (reuse < 1) reuse = 1; @@ -5580,8 +5580,8 @@ void Client::Handle_OP_FeignDeath(const EQApplicationPacket *app) //BreakInvis(); - uint16 primfeign = GetSkill(SkillFeignDeath); - uint16 secfeign = GetSkill(SkillFeignDeath); + uint16 primfeign = GetSkill(EQEmu::skills::SkillFeignDeath); + uint16 secfeign = GetSkill(EQEmu::skills::SkillFeignDeath); if (primfeign > 100) { primfeign = 100; secfeign = secfeign - 100; @@ -5599,7 +5599,7 @@ void Client::Handle_OP_FeignDeath(const EQApplicationPacket *app) SetFeigned(true); } - CheckIncreaseSkill(SkillFeignDeath, nullptr, 5); + CheckIncreaseSkill(EQEmu::skills::SkillFeignDeath, nullptr, 5); return; } @@ -7859,7 +7859,7 @@ void Client::Handle_OP_Heartbeat(const EQApplicationPacket *app) void Client::Handle_OP_Hide(const EQApplicationPacket *app) { - if (!HasSkill(SkillHide) && GetSkill(SkillHide) == 0) + if (!HasSkill(EQEmu::skills::SkillHide) && GetSkill(EQEmu::skills::SkillHide) == 0) { //Can not be able to train hide but still have it from racial though return; //You cannot hide if you do not have hide @@ -7869,16 +7869,16 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) Message(13, "Ability recovery time not yet met."); return; } - int reuse = HideReuseTime - GetSkillReuseTime(SkillHide); + int reuse = HideReuseTime - GetSkillReuseTime(EQEmu::skills::SkillHide); if (reuse < 1) reuse = 1; p_timers.Start(pTimerHide, reuse - 1); - float hidechance = ((GetSkill(SkillHide) / 250.0f) + .25) * 100; + float hidechance = ((GetSkill(EQEmu::skills::SkillHide) / 250.0f) + .25) * 100; float random = zone->random.Real(0, 100); - CheckIncreaseSkill(SkillHide, nullptr, 5); + CheckIncreaseSkill(EQEmu::skills::SkillHide, nullptr, 5); if (random < hidechance) { auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; @@ -7901,7 +7901,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) Mob *evadetar = GetTarget(); if (!auto_attack && (evadetar && evadetar->CheckAggro(this) && evadetar->IsNPC())) { - if (zone->random.Int(0, 260) < (int)GetSkill(SkillHide)) { + if (zone->random.Int(0, 260) < (int)GetSkill(EQEmu::skills::SkillHide)) { msg->string_id = EVADE_SUCCESS; RogueEvade(evadetar); } @@ -8023,10 +8023,10 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) if (item) { // another one..I did these, didn't I!!? - strcpy(insr->itemnames[SoF::inventory::SlotAmmo], item->Name); - insr->itemicons[SoF::inventory::SlotAmmo] = item->Icon; + strcpy(insr->itemnames[SoF::invslot::PossessionsAmmo], item->Name); + insr->itemicons[SoF::invslot::PossessionsAmmo] = item->Icon; } - else { insr->itemicons[SoF::inventory::SlotAmmo] = 0xFFFFFFFF; } + else { insr->itemicons[SoF::invslot::PossessionsAmmo] = 0xFFFFFFFF; } InspectMessage_Struct* newmessage = (InspectMessage_Struct*)insr->text; InspectMessage_Struct& playermessage = this->GetInspectMessage(); @@ -8689,14 +8689,14 @@ void Client::Handle_OP_LDoNDisarmTraps(const EQApplicationPacket *app) Mob * target = GetTarget(); if (target->IsNPC()) { - if (HasSkill(SkillDisarmTraps)) + if (HasSkill(EQEmu::skills::SkillDisarmTraps)) { if (DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; } - HandleLDoNDisarm(target->CastToNPC(), GetSkill(SkillDisarmTraps), LDoNTypeMechanical); + HandleLDoNDisarm(target->CastToNPC(), GetSkill(EQEmu::skills::SkillDisarmTraps), LDoNTypeMechanical); } else Message(13, "You do not have the disarm trap skill."); @@ -8722,14 +8722,14 @@ void Client::Handle_OP_LDoNPickLock(const EQApplicationPacket *app) Mob * target = GetTarget(); if (target->IsNPC()) { - if (HasSkill(SkillPickLock)) + if (HasSkill(EQEmu::skills::SkillPickLock)) { if (DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; } - HandleLDoNPickLock(target->CastToNPC(), GetSkill(SkillPickLock), LDoNTypeMechanical); + HandleLDoNPickLock(target->CastToNPC(), GetSkill(EQEmu::skills::SkillPickLock), LDoNTypeMechanical); } else Message(13, "You do not have the pick locks skill."); @@ -8741,14 +8741,14 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) Mob * target = GetTarget(); if (target->IsNPC()) { - if (HasSkill(SkillSenseTraps)) + if (HasSkill(EQEmu::skills::SkillSenseTraps)) { if (DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; } - HandleLDoNSenseTraps(target->CastToNPC(), GetSkill(SkillSenseTraps), LDoNTypeMechanical); + HandleLDoNSenseTraps(target->CastToNPC(), GetSkill(EQEmu::skills::SkillSenseTraps), LDoNTypeMechanical); } else Message(13, "You do not have the sense traps skill."); @@ -9251,7 +9251,7 @@ void Client::Handle_OP_MemorizeSpell(const EQApplicationPacket *app) void Client::Handle_OP_Mend(const EQApplicationPacket *app) { - if (!HasSkill(SkillMend)) + if (!HasSkill(EQEmu::skills::SkillMend)) return; if (!p_timers.Expired(&database, pTimerMend, false)) { @@ -9262,7 +9262,7 @@ void Client::Handle_OP_Mend(const EQApplicationPacket *app) int mendhp = GetMaxHP() / 4; int currenthp = GetHP(); - if (zone->random.Int(0, 199) < (int)GetSkill(SkillMend)) { + if (zone->random.Int(0, 199) < (int)GetSkill(EQEmu::skills::SkillMend)) { int criticalchance = spellbonuses.CriticalMend + itembonuses.CriticalMend + aabonuses.CriticalMend; @@ -9281,7 +9281,7 @@ void Client::Handle_OP_Mend(const EQApplicationPacket *app) 0 skill - 25% chance to worsen 20 skill - 23% chance to worsen 50 skill - 16% chance to worsen */ - if ((GetSkill(SkillMend) <= 75) && (zone->random.Int(GetSkill(SkillMend), 100) < 75) && (zone->random.Int(1, 3) == 1)) + if ((GetSkill(EQEmu::skills::SkillMend) <= 75) && (zone->random.Int(GetSkill(EQEmu::skills::SkillMend), 100) < 75) && (zone->random.Int(1, 3) == 1)) { SetHP(currenthp > mendhp ? (GetHP() - mendhp) : 1); SendHPUpdate(); @@ -9291,7 +9291,7 @@ void Client::Handle_OP_Mend(const EQApplicationPacket *app) Message_StringID(4, MEND_FAIL); } - CheckIncreaseSkill(SkillMend, nullptr, 10); + CheckIncreaseSkill(EQEmu::skills::SkillMend, nullptr, 10); return; } @@ -10440,7 +10440,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) DumpPacket(app); } - if (!HasSkill(SkillPickPockets)) + if (!HasSkill(EQEmu::skills::SkillPickPockets)) { return; } @@ -10465,7 +10465,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) pick_out->coin = 0; pick_out->from = victim->GetID(); pick_out->to = GetID(); - pick_out->myskill = GetSkill(SkillPickPockets); + pick_out->myskill = GetSkill(EQEmu::skills::SkillPickPockets); pick_out->type = 0; //if we do not send this packet the client will lock up and require the player to relog. QueuePacket(outapp); @@ -10478,7 +10478,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) pick_out->coin = 0; pick_out->from = victim->GetID(); pick_out->to = GetID(); - pick_out->myskill = GetSkill(SkillPickPockets); + pick_out->myskill = GetSkill(EQEmu::skills::SkillPickPockets); pick_out->type = 0; //if we do not send this packet the client will lock up and require the player to relog. QueuePacket(outapp); @@ -10494,7 +10494,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) pick_out->coin = 0; pick_out->from = victim->GetID(); pick_out->to = GetID(); - pick_out->myskill = GetSkill(SkillPickPockets); + pick_out->myskill = GetSkill(EQEmu::skills::SkillPickPockets); pick_out->type = 0; //if we do not send this packet the client will lock up and require the player to relog. QueuePacket(outapp); @@ -11739,8 +11739,8 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) void Client::Handle_OP_SafeFallSuccess(const EQApplicationPacket *app) // bit of a misnomer, sent whenever safe fall is used (success of fail) { - if (HasSkill(SkillSafeFall)) //this should only get called if the client has safe fall, but just in case... - CheckIncreaseSkill(SkillSafeFall, nullptr); //check for skill up + if (HasSkill(EQEmu::skills::SkillSafeFall)) //this should only get called if the client has safe fall, but just in case... + CheckIncreaseSkill(EQEmu::skills::SkillSafeFall, nullptr); //check for skill up } void Client::Handle_OP_SafePoint(const EQApplicationPacket *app) @@ -11777,7 +11777,7 @@ void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) void Client::Handle_OP_SenseHeading(const EQApplicationPacket *app) { - if (!HasSkill(SkillSenseHeading)) + if (!HasSkill(EQEmu::skills::SkillSenseHeading)) return; int chancemod=0; @@ -11791,14 +11791,14 @@ void Client::Handle_OP_SenseHeading(const EQApplicationPacket *app) if (GetLevel() <= 8) chancemod += (9-level) * 10; - CheckIncreaseSkill(SkillSenseHeading, nullptr, chancemod); + CheckIncreaseSkill(EQEmu::skills::SkillSenseHeading, nullptr, chancemod); return; } void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) { - if (!HasSkill(SkillSenseTraps)) + if (!HasSkill(EQEmu::skills::SkillSenseTraps)) return; if (!p_timers.Expired(&database, pTimerSenseTraps, false)) { @@ -11806,7 +11806,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) return; } - int reuse = SenseTrapsReuseTime - GetSkillReuseTime(SkillSenseTraps); + int reuse = SenseTrapsReuseTime - GetSkillReuseTime(EQEmu::skills::SkillSenseTraps); if (reuse < 1) reuse = 1; @@ -11815,10 +11815,10 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) Trap* trap = entity_list.FindNearbyTrap(this, 800); - CheckIncreaseSkill(SkillSenseTraps, nullptr); + CheckIncreaseSkill(EQEmu::skills::SkillSenseTraps, nullptr); if (trap && trap->skill > 0) { - int uskill = GetSkill(SkillSenseTraps); + int uskill = GetSkill(EQEmu::skills::SkillSenseTraps); if ((zone->random.Int(0, 99) + uskill) >= (zone->random.Int(0, 99) + trap->skill*0.75)) { auto diff = trap->m_Position - glm::vec3(GetPosition()); @@ -12621,7 +12621,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) void Client::Handle_OP_Sneak(const EQApplicationPacket *app) { - if (!HasSkill(SkillSneak) && GetSkill(SkillSneak) == 0) { + if (!HasSkill(EQEmu::skills::SkillSneak) && GetSkill(EQEmu::skills::SkillSneak) == 0) { return; //You cannot sneak if you do not have sneak } @@ -12645,9 +12645,9 @@ void Client::Handle_OP_Sneak(const EQApplicationPacket *app) safe_delete(outapp); } else { - CheckIncreaseSkill(SkillSneak, nullptr, 5); + CheckIncreaseSkill(EQEmu::skills::SkillSneak, nullptr, 5); } - float hidechance = ((GetSkill(SkillSneak) / 300.0f) + .25) * 100; + float hidechance = ((GetSkill(EQEmu::skills::SkillSneak) / 300.0f) + .25) * 100; float random = zone->random.Real(0, 99); if (!was && random < hidechance) { sneaking = true; @@ -12688,7 +12688,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) if (sa->type == AT_Invis) { if (sa->parameter != 0) { - if (!HasSkill(SkillHide) && GetSkill(SkillHide) == 0) + if (!HasSkill(EQEmu::skills::SkillHide) && GetSkill(EQEmu::skills::SkillHide) == 0) { if (ClientVersion() < EQEmu::versions::ClientVersion::SoF) { @@ -12790,7 +12790,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) if (sa->parameter != 0) { - if (!HasSkill(SkillSneak)) + if (!HasSkill(EQEmu::skills::SkillSneak)) { char *hack_str = nullptr; MakeAnyLenString(&hack_str, "Player sent OP_SpawnAppearance with AT_Sneak: %i", sa->parameter); @@ -13234,10 +13234,10 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) if (GetClass() != RANGER && GetClass() != DRUID && GetClass() != BARD) return; - if (GetSkill(SkillTracking) == 0) - SetSkill(SkillTracking, 1); + if (GetSkill(EQEmu::skills::SkillTracking) == 0) + SetSkill(EQEmu::skills::SkillTracking, 1); else - CheckIncreaseSkill(SkillTracking, nullptr, 15); + CheckIncreaseSkill(EQEmu::skills::SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) Log.Out(Logs::General, Logs::Error, "Unable to generate OP_Track packet requested by client."); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 984a66240..b0e742901 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -428,7 +428,7 @@ bool Client::Process() { //you can't see your target } else if(auto_attack_target->GetHP() > -10) { - CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10); + CheckIncreaseSkill(EQEmu::skills::SkillDualWield, auto_attack_target, -10); if (CheckDualWield()) { ItemInst *wpn = GetInv().GetItem(EQEmu::legacy::SlotSecondary); TryWeaponProc(wpn, auto_attack_target, EQEmu::legacy::SlotSecondary); @@ -1481,19 +1481,19 @@ void Client::OPGMTraining(const EQApplicationPacket *app) // if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas //#pragma GCC push_options //#pragma GCC optimize ("O0") - for (int sk = Skill1HBlunt; sk <= HIGHEST_SKILL; ++sk) { - if(sk == SkillTinkering && GetRace() != GNOME) { + for (int sk = EQEmu::skills::Skill1HBlunt; sk <= EQEmu::skills::HIGHEST_SKILL; ++sk) { + if (sk == EQEmu::skills::SkillTinkering && GetRace() != GNOME) { gmtrain->skills[sk] = 0; //Non gnomes can't tinker! } else { - gmtrain->skills[sk] = GetMaxSkillAfterSpecializationRules((SkillUseTypes)sk, MaxSkill((SkillUseTypes)sk, GetClass(), RuleI(Character, MaxLevel))); + gmtrain->skills[sk] = GetMaxSkillAfterSpecializationRules((EQEmu::skills::SkillType)sk, MaxSkill((EQEmu::skills::SkillType)sk, GetClass(), RuleI(Character, MaxLevel))); //this is the highest level that the trainer can train you to, this is enforced clientside so we can't just //Set it to 1 with CanHaveSkill or you wont be able to train past 1. } } if (ClientVersion() < EQEmu::versions::ClientVersion::RoF2 && GetClass() == BERSERKER) { - gmtrain->skills[Skill1HPiercing] = gmtrain->skills[Skill2HPiercing]; - gmtrain->skills[Skill2HPiercing] = 0; + gmtrain->skills[EQEmu::skills::Skill1HPiercing] = gmtrain->skills[EQEmu::skills::Skill2HPiercing]; + gmtrain->skills[EQEmu::skills::Skill2HPiercing] = 0; } //#pragma GCC pop_options @@ -1578,14 +1578,14 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) else if (gmskill->skillbank == 0x00) { // normal skills go here - if (gmskill->skill_id > HIGHEST_SKILL) + if (gmskill->skill_id > EQEmu::skills::HIGHEST_SKILL) { std::cout << "Wrong Training Skill (abilities)" << std::endl; DumpPacket(app); return; } - SkillUseTypes skill = (SkillUseTypes) gmskill->skill_id; + EQEmu::skills::SkillType skill = (EQEmu::skills::SkillType)gmskill->skill_id; if(!CanHaveSkill(skill)) { Log.Out(Logs::Detail, Logs::Skills, "Tried to train skill %d, which is not allowed.", skill); @@ -1610,27 +1610,27 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) SetSkill(skill, t_level); } else { switch(skill) { - case SkillBrewing: - case SkillMakePoison: - case SkillTinkering: - case SkillResearch: - case SkillAlchemy: - case SkillBaking: - case SkillTailoring: - case SkillBlacksmithing: - case SkillFletching: - case SkillJewelryMaking: - case SkillPottery: + case EQEmu::skills::SkillBrewing: + case EQEmu::skills::SkillMakePoison: + case EQEmu::skills::SkillTinkering: + case EQEmu::skills::SkillResearch: + case EQEmu::skills::SkillAlchemy: + case EQEmu::skills::SkillBaking: + case EQEmu::skills::SkillTailoring: + case EQEmu::skills::SkillBlacksmithing: + case EQEmu::skills::SkillFletching: + case EQEmu::skills::SkillJewelryMaking: + case EQEmu::skills::SkillPottery: if(skilllevel >= RuleI(Skills, MaxTrainTradeskills)) { Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName()); return; } break; - case SkillSpecializeAbjure: - case SkillSpecializeAlteration: - case SkillSpecializeConjuration: - case SkillSpecializeDivination: - case SkillSpecializeEvocation: + case EQEmu::skills::SkillSpecializeAbjure: + case EQEmu::skills::SkillSpecializeAlteration: + case EQEmu::skills::SkillSpecializeConjuration: + case EQEmu::skills::SkillSpecializeDivination: + case EQEmu::skills::SkillSpecializeEvocation: if(skilllevel >= RuleI(Skills, MaxTrainSpecializations)) { Message_StringID(13, MORE_SKILLED_THAN_I, pTrainer->GetCleanName()); return; @@ -1647,7 +1647,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) return; } - if(gmskill->skill_id >= SkillSpecializeAbjure && gmskill->skill_id <= SkillSpecializeEvocation) + if (gmskill->skill_id >= EQEmu::skills::SkillSpecializeAbjure && gmskill->skill_id <= EQEmu::skills::SkillSpecializeEvocation) { int MaxSpecSkill = GetMaxSkillAfterSpecializationRules(skill, MaxSkillValue); if (skilllevel >= MaxSpecSkill) @@ -1685,7 +1685,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) gmtsc->SkillID += 100; } else - gmtsc->NewSkill = (GetRawSkill((SkillUseTypes)gmtsc->SkillID) == 1); + gmtsc->NewSkill = (GetRawSkill((EQEmu::skills::SkillType)gmtsc->SkillID) == 1); gmtsc->Cost = Cost; diff --git a/zone/command.cpp b/zone/command.cpp index dd2b8941e..92116485c 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -52,6 +52,7 @@ #include "../common/rulesys.h" #include "../common/serverinfo.h" #include "../common/string_util.h" +#include "../say_link.h" #include "../common/eqemu_logsys.h" @@ -2129,7 +2130,7 @@ void command_showskills(Client *c, const Seperator *sep) t=c->GetTarget()->CastToClient(); c->Message(0, "Skills for %s", t->GetName()); - for (SkillUseTypes i=Skill1HBlunt; i <= HIGHEST_SKILL; i=(SkillUseTypes)(i+1)) + for (EQEmu::skills::SkillType i = EQEmu::skills::Skill1HBlunt; i <= EQEmu::skills::HIGHEST_SKILL; i = (EQEmu::skills::SkillType)(i + 1)) c->Message(0, "Skill [%d] is at [%d] - %u", i, t->GetSkill(i), t->GetRawSkill(i)); } @@ -2277,20 +2278,20 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, "Error: #setskill: Target must be a client."); } else if ( - !sep->IsNumber(1) || atoi(sep->arg[1]) < 0 || atoi(sep->arg[1]) > HIGHEST_SKILL || + !sep->IsNumber(1) || atoi(sep->arg[1]) < 0 || atoi(sep->arg[1]) > EQEmu::skills::HIGHEST_SKILL || !sep->IsNumber(2) || atoi(sep->arg[2]) < 0 || atoi(sep->arg[2]) > HIGHEST_CAN_SET_SKILL ) { c->Message(0, "Usage: #setskill skill x "); - c->Message(0, " skill = 0 to %d", HIGHEST_SKILL); + c->Message(0, " skill = 0 to %d", EQEmu::skills::HIGHEST_SKILL); c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { Log.Out(Logs::General, Logs::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); - if(skill_num <= HIGHEST_SKILL) - c->GetTarget()->CastToClient()->SetSkill((SkillUseTypes)skill_num, skill_value); + if (skill_num <= EQEmu::skills::HIGHEST_SKILL) + c->GetTarget()->CastToClient()->SetSkill((EQEmu::skills::SkillType)skill_num, skill_value); } } @@ -2308,7 +2309,7 @@ void command_setskillall(Client *c, const Seperator *sep) if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { Log.Out(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); - for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { + for (EQEmu::skills::SkillType skill_num = EQEmu::skills::Skill1HBlunt; skill_num <= EQEmu::skills::HIGHEST_SKILL; skill_num = (EQEmu::skills::SkillType)(skill_num + 1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); } } @@ -4197,7 +4198,7 @@ void command_damage(Client *c, const Seperator *sep) if (nkdmg > 2100000000) c->Message(0, "Enter a value less then 2,100,000,000."); else - c->GetTarget()->Damage(c, nkdmg, SPELL_UNKNOWN, SkillHandtoHand, false); + c->GetTarget()->Damage(c, nkdmg, SPELL_UNKNOWN, EQEmu::skills::SkillHandtoHand, false); } } @@ -9942,16 +9943,16 @@ void command_max_all_skills(Client *c, const Seperator *sep) { if(c) { - for(int i = 0; i <= HIGHEST_SKILL; ++i) + for (int i = 0; i <= EQEmu::skills::HIGHEST_SKILL; ++i) { - if(i >= SkillSpecializeAbjure && i <= SkillSpecializeEvocation) + if (i >= EQEmu::skills::SkillSpecializeAbjure && i <= EQEmu::skills::SkillSpecializeEvocation) { - c->SetSkill((SkillUseTypes)i, 50); + c->SetSkill((EQEmu::skills::SkillType)i, 50); } else { - int max_skill_level = database.GetSkillCap(c->GetClass(), (SkillUseTypes)i, c->GetLevel()); - c->SetSkill((SkillUseTypes)i, max_skill_level); + int max_skill_level = database.GetSkillCap(c->GetClass(), (EQEmu::skills::SkillType)i, c->GetLevel()); + c->SetSkill((EQEmu::skills::SkillType)i, max_skill_level); } } } @@ -10037,14 +10038,14 @@ void command_disarmtrap(Client *c, const Seperator *sep) if(target->IsNPC()) { - if(c->HasSkill(SkillDisarmTraps)) + if (c->HasSkill(EQEmu::skills::SkillDisarmTraps)) { if(DistanceSquaredNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; } - c->HandleLDoNDisarm(target->CastToNPC(), c->GetSkill(SkillDisarmTraps), LDoNTypeMechanical); + c->HandleLDoNDisarm(target->CastToNPC(), c->GetSkill(EQEmu::skills::SkillDisarmTraps), LDoNTypeMechanical); } else c->Message(13, "You do not have the disarm trap skill."); @@ -10062,14 +10063,14 @@ void command_sensetrap(Client *c, const Seperator *sep) if(target->IsNPC()) { - if(c->HasSkill(SkillSenseTraps)) + if (c->HasSkill(EQEmu::skills::SkillSenseTraps)) { if(DistanceSquaredNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; } - c->HandleLDoNSenseTraps(target->CastToNPC(), c->GetSkill(SkillSenseTraps), LDoNTypeMechanical); + c->HandleLDoNSenseTraps(target->CastToNPC(), c->GetSkill(EQEmu::skills::SkillSenseTraps), LDoNTypeMechanical); } else c->Message(13, "You do not have the sense traps skill."); @@ -10087,14 +10088,14 @@ void command_picklock(Client *c, const Seperator *sep) if(target->IsNPC()) { - if(c->HasSkill(SkillPickLock)) + if (c->HasSkill(EQEmu::skills::SkillPickLock)) { if(DistanceSquaredNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; } - c->HandleLDoNPickLock(target->CastToNPC(), c->GetSkill(SkillPickLock), LDoNTypeMechanical); + c->HandleLDoNPickLock(target->CastToNPC(), c->GetSkill(EQEmu::skills::SkillPickLock), LDoNTypeMechanical); } else c->Message(13, "You do not have the pick locks skill."); diff --git a/zone/common.h b/zone/common.h index 8a6d9c783..d517bb721 100644 --- a/zone/common.h +++ b/zone/common.h @@ -277,8 +277,8 @@ struct StatBonuses { int32 inhibitmelee; float AggroRange; // when calculate just replace original value with this float AssistRange; - int32 skillmod[HIGHEST_SKILL+1]; - int32 skillmodmax[HIGHEST_SKILL+1]; + int32 skillmod[EQEmu::skills::HIGHEST_SKILL + 1]; + int32 skillmodmax[EQEmu::skills::HIGHEST_SKILL + 1]; int effective_casting_level; int reflect_chance; // chance to reflect incoming spell uint32 singingMod; @@ -294,7 +294,7 @@ struct StatBonuses { int32 StrikeThrough; // PoP: Strike Through % int32 MeleeMitigation; //i = Shielding int32 MeleeMitigationEffect; //i = Spell Effect Melee Mitigation - int32 CriticalHitChance[HIGHEST_SKILL+2]; //i + int32 CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 2]; //i int32 CriticalSpellChance; //i int32 SpellCritDmgIncrease; //i int32 SpellCritDmgIncNoStack; // increase @@ -321,10 +321,10 @@ struct StatBonuses { int32 MeleeSkillCheck; //i uint8 MeleeSkillCheckSkill; int32 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy) - int32 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase - int32 DamageModifier[HIGHEST_SKILL+2]; //i - int32 DamageModifier2[HIGHEST_SKILL+2]; //i - int32 MinDamageModifier[HIGHEST_SKILL+2]; //i + int32 HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 2]; //Spell effect Chance to Hit, straight percent increase + int32 DamageModifier[EQEmu::skills::HIGHEST_SKILL + 2]; //i + int32 DamageModifier2[EQEmu::skills::HIGHEST_SKILL + 2]; //i + int32 MinDamageModifier[EQEmu::skills::HIGHEST_SKILL + 2]; //i int32 ProcChance; // ProcChance/10 == % increase i = CombatEffects int32 ProcChanceSPA; // ProcChance from spell effects int32 ExtraAttackChance; @@ -332,13 +332,13 @@ struct StatBonuses { int32 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger) uint32 DeathSave[4]; // Death Pact [0](value = 1 partial 2 = full) [1]=slot [2]=LvLimit [3]=HealAmt int32 FlurryChance; - int32 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy) + int32 Accuracy[EQEmu::skills::HIGHEST_SKILL + 2]; //Accuracy/15 == % increase [Spell Effect: Accuracy) int32 HundredHands; //extra haste, stacks with all other haste i int32 MeleeLifetap; //i int32 Vampirism; //i int32 HealRate; // Spell effect that influences effectiveness of heals int32 MaxHPChange; // Spell Effect - int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1 + int16 SkillDmgTaken[EQEmu::skills::HIGHEST_SKILL + 2]; // All Skills + -1 int32 HealAmt; // Item Effect int32 SpellDmg; // Item Effect int32 Clairvoyance; // Item Effect @@ -347,9 +347,9 @@ struct StatBonuses { uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die - int32 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1 - int32 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers - int32 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1 + int32 CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 2]; // All Skills + -1 + int32 SkillReuseTime[EQEmu::skills::HIGHEST_SKILL + 1]; // Reduces skill timers + int32 SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 2]; // All Skills + -1 int32 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon uint32 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect) int32 GravityEffect; // Indictor of spell effect @@ -372,7 +372,7 @@ struct StatBonuses { uint8 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. int16 FocusEffectsWorn[HIGHEST_FOCUS+1]; // Optional to allow focus effects to be applied additively from worn slot bool NegateEffects; // Check if you contain a buff with negate effect. (only spellbonuses) - int32 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage + int32 SkillDamageAmount2[EQEmu::skills::HIGHEST_SKILL + 2]; // Adds skill specific damage uint32 NegateAttacks[3]; // 0 = bool HasEffect 1 = Buff Slot 2 = Max damage absorbed per hit uint32 MitigateMeleeRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per hit 3 = Rune Amt uint32 MeleeThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. @@ -405,7 +405,7 @@ struct StatBonuses { int32 Metabolism; // Food/drink consumption rates. bool Sanctuary; // Sanctuary effect, lowers place on hate list until cast on others. int32 FactionModPct; // Modifies amount of faction gained. - bool LimitToSkill[HIGHEST_SKILL+2]; // Determines if we need to search for a skill proc. + bool LimitToSkill[EQEmu::skills::HIGHEST_SKILL + 2]; // Determines if we need to search for a skill proc. uint32 SkillProc[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs. uint32 SkillProcSuccess[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs_success. uint32 PC_Pet_Rampage[2]; // 0= % chance to rampage, 1=damage modifier @@ -440,7 +440,7 @@ struct StatBonuses { int32 CombatStability; // Melee damage mitigation. int32 DoubleRiposte; // Chance to double riposte int32 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill - uint32 RaiseSkillCap[HIGHEST_SKILL+1]; // Raise a specific skill cap (base1= value, base2=skill) + uint32 RaiseSkillCap[EQEmu::skills::HIGHEST_SKILL + 1]; // Raise a specific skill cap (base1= value, base2=skill) int32 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'. int32 PetMaxHP; // Increase the max hp of your pet. int32 PetFlurry; // Chance for pet to flurry. @@ -470,7 +470,7 @@ struct StatBonuses { uint16 extra_xtargets; // extra xtarget entries bool ShroudofStealth; // rogue improved invisiblity uint16 ReduceFallDamage; // reduce fall damage by percent - int32 ReduceTradeskillFail[HIGHEST_SKILL+1]; // Reduces chance for trade skills to fail by percent. + int32 ReduceTradeskillFail[EQEmu::skills::HIGHEST_SKILL + 1]; // Reduces chance for trade skills to fail by percent. uint8 TradeSkillMastery; // Allow number of tradeskills to exceed 200 skill. int16 NoBreakAESneak; // Percent value int16 FeignedCastOnChance; // Percent Value diff --git a/zone/corpse.cpp b/zone/corpse.cpp index bb88e305b..2286e5e71 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -34,6 +34,7 @@ Child of the Mob class. #include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" +#include "../common/say_link.h" #include "client.h" #include "corpse.h" @@ -997,7 +998,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::limits::InventoryTypeSize(EQEmu::versions::ConvertClientVersionToInventoryVersion(client->ClientVersion()), EQEmu::legacy::TypeCorpse); + int corpselootlimit = EQEmu::inventory::InventoryTypeSize(EQEmu::versions::ConvertClientVersionToInventoryVersion(client->ClientVersion()), EQEmu::legacy::TypeCorpse); for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; @@ -1291,7 +1292,7 @@ void Corpse::QueryLoot(Client* to) { cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::limits::InventoryTypeSize(EQEmu::versions::ConvertClientVersionToInventoryVersion(to->ClientVersion()), EQEmu::legacy::TypeCorpse); + int corpselootlimit = EQEmu::inventory::InventoryTypeSize(EQEmu::versions::ConvertClientVersionToInventoryVersion(to->ClientVersion()), EQEmu::legacy::TypeCorpse); for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; diff --git a/zone/corpse.h b/zone/corpse.h index d96a38bdd..03a48dd87 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -47,8 +47,8 @@ class Corpse : public Mob { static Corpse* LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std::string in_charname, const glm::vec4& position, std::string time_of_death, bool rezzed, bool was_at_graveyard); /* Corpse: General */ - 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, int special = 0) { return; } + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0) { return; } virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0) { return false; } virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } diff --git a/zone/doors.cpp b/zone/doors.cpp index c80b749f9..9b1f41370 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -284,12 +284,12 @@ void Doors::HandleClick(Client* sender, uint8 trigger) } else if(lockpicks != nullptr) { - if(sender->GetSkill(SkillPickLock)) + if (sender->GetSkill(EQEmu::skills::SkillPickLock)) { if(lockpicks->GetItem()->ItemType == EQEmu::item::ItemTypeLockPick) { - float modskill=sender->GetSkill(SkillPickLock); - sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); + float modskill = sender->GetSkill(EQEmu::skills::SkillPickLock); + sender->CheckIncreaseSkill(EQEmu::skills::SkillPickLock, nullptr, 1); Log.Out(Logs::General, Logs::Skills, "Client has lockpicks: skill=%f", modskill); diff --git a/zone/encounter.h b/zone/encounter.h index 05c1b075b..ed8faec34 100644 --- a/zone/encounter.h +++ b/zone/encounter.h @@ -34,8 +34,8 @@ public: ~Encounter(); //abstract virtual function implementations required 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, int special = 0) { return; } + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0) { return; } virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0) { return false; diff --git a/zone/entity.cpp b/zone/entity.cpp index f788b06c2..e5c5c193d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3008,11 +3008,11 @@ bool EntityList::MakeTrackPacket(Client *client) float MobDistance; if (client->GetClass() == DRUID) - distance = (client->GetSkill(SkillTracking) * 10); + distance = (client->GetSkill(EQEmu::skills::SkillTracking) * 10); else if (client->GetClass() == RANGER) - distance = (client->GetSkill(SkillTracking) * 12); + distance = (client->GetSkill(EQEmu::skills::SkillTracking) * 12); else if (client->GetClass() == BARD) - distance = (client->GetSkill(SkillTracking) * 7); + distance = (client->GetSkill(EQEmu::skills::SkillTracking) * 7); if (distance <= 0) return false; if (distance < 300) diff --git a/zone/forage.cpp b/zone/forage.cpp index be3e0a3b3..eb54d674d 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -249,7 +249,7 @@ void Client::GoFish() //success formula is not researched at all - int fishing_skill = GetSkill(SkillFishing); //will take into account skill bonuses on pole & bait + int fishing_skill = GetSkill(EQEmu::skills::SkillFishing); //will take into account skill bonuses on pole & bait //make sure we still have a fishing pole on: int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); @@ -258,7 +258,7 @@ void Client::GoFish() Bait = m_inv.GetItem(bslot); //if the bait isnt equipped, need to add its skill bonus - if (bslot >= EQEmu::legacy::GENERAL_BEGIN && Bait != nullptr && Bait->GetItem()->SkillModType == SkillFishing) { + if (bslot >= EQEmu::legacy::GENERAL_BEGIN && Bait != nullptr && Bait->GetItem()->SkillModType == EQEmu::skills::SkillFishing) { fishing_skill += Bait->GetItem()->SkillModValue; } @@ -357,16 +357,16 @@ void Client::GoFish() DeleteItemInInventory(EQEmu::legacy::SlotPrimary, 0, true); } - if(CheckIncreaseSkill(SkillFishing, nullptr, 5)) + if (CheckIncreaseSkill(EQEmu::skills::SkillFishing, nullptr, 5)) { - if(title_manager.IsNewTradeSkillTitleAvailable(SkillFishing, GetRawSkill(SkillFishing))) + if (title_manager.IsNewTradeSkillTitleAvailable(EQEmu::skills::SkillFishing, GetRawSkill(EQEmu::skills::SkillFishing))) NotifyNewTitlesAvailable(); } } void Client::ForageItem(bool guarantee) { - int skill_level = GetSkill(SkillForage); + int skill_level = GetSkill(EQEmu::skills::SkillForage); //be wary of the string ids in switch below when changing this. uint32 common_food_ids[MAX_COMMON_FOOD_IDS] = { @@ -457,7 +457,7 @@ void Client::ForageItem(bool guarantee) { parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0); } - CheckIncreaseSkill(SkillForage, nullptr, 5); + CheckIncreaseSkill(EQEmu::skills::SkillForage, nullptr, 5); } diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 935516040..6c2345856 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -432,27 +432,27 @@ void Lua_Client::IncreaseLanguageSkill(int skill_id, int value) { int Lua_Client::GetRawSkill(int skill_id) { Lua_Safe_Call_Int(); - return self->GetRawSkill(static_cast(skill_id)); + return self->GetRawSkill(static_cast(skill_id)); } bool Lua_Client::HasSkill(int skill_id) { Lua_Safe_Call_Bool(); - return self->HasSkill(static_cast(skill_id)); + return self->HasSkill(static_cast(skill_id)); } bool Lua_Client::CanHaveSkill(int skill_id) { Lua_Safe_Call_Bool(); - return self->CanHaveSkill(static_cast(skill_id)); + return self->CanHaveSkill(static_cast(skill_id)); } void Lua_Client::SetSkill(int skill_id, int value) { Lua_Safe_Call_Void(); - self->SetSkill(static_cast(skill_id), value); + self->SetSkill(static_cast(skill_id), value); } void Lua_Client::AddSkill(int skill_id, int value) { Lua_Safe_Call_Void(); - self->AddSkill(static_cast(skill_id), value); + self->AddSkill(static_cast(skill_id), value); } void Lua_Client::CheckSpecializeIncrease(int spell_id) { @@ -462,12 +462,12 @@ void Lua_Client::CheckSpecializeIncrease(int spell_id) { void Lua_Client::CheckIncreaseSkill(int skill_id, Lua_Mob target) { Lua_Safe_Call_Void(); - self->CheckIncreaseSkill(static_cast(skill_id), target); + self->CheckIncreaseSkill(static_cast(skill_id), target); } void Lua_Client::CheckIncreaseSkill(int skill_id, Lua_Mob target, int chance_mod) { Lua_Safe_Call_Void(); - self->CheckIncreaseSkill(static_cast(skill_id), target, chance_mod); + self->CheckIncreaseSkill(static_cast(skill_id), target, chance_mod); } void Lua_Client::SetLanguageSkill(int language, int value) { @@ -477,7 +477,7 @@ void Lua_Client::SetLanguageSkill(int language, int value) { int Lua_Client::MaxSkill(int skill_id) { Lua_Safe_Call_Int(); - return self->MaxSkill(static_cast(skill_id)); + return self->MaxSkill(static_cast(skill_id)); } bool Lua_Client::IsMedding() { diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 38fd80cc7..124726b3f 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -178,22 +178,22 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill) { Lua_Safe_Call_Void(); - return self->Damage(from, damage, spell_id, static_cast(attack_skill)); + return self->Damage(from, damage, spell_id, static_cast(attack_skill)); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill, bool avoidable) { Lua_Safe_Call_Void(); - return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable); + return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill, bool avoidable, int buffslot) { Lua_Safe_Call_Void(); - return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot); + return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot); } void Lua_Mob::Damage(Lua_Mob from, int damage, int spell_id, int attack_skill, bool avoidable, int buffslot, bool buff_tic) { Lua_Safe_Call_Void(); - return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot, buff_tic); + return self->Damage(from, damage, spell_id, static_cast(attack_skill), avoidable, buffslot, buff_tic); } void Lua_Mob::RangedAttack(Lua_Mob other) { @@ -1252,28 +1252,28 @@ bool Lua_Mob::CombatRange(Lua_Mob other) { void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage) { Lua_Safe_Call_Void(); - self->DoSpecialAttackDamage(other, static_cast(skill), max_damage); + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage); } void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage) { Lua_Safe_Call_Void(); - self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage); + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage); } void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override) { Lua_Safe_Call_Void(); - self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override); + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override); } void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time) { Lua_Safe_Call_Void(); - self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time); + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time); } void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, bool hit_chance) { Lua_Safe_Call_Void(); - self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time, hit_chance); + self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time, hit_chance); } void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other) { @@ -1309,22 +1309,22 @@ void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skill) { Lua_Safe_Call_Void(); - self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill)); + self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill)); } void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skill, int chance_mod) { Lua_Safe_Call_Void(); - self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill), chance_mod); + self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill), chance_mod); } void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skill, int chance_mod, int focus) { Lua_Safe_Call_Void(); - self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill), chance_mod, focus); + self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill), chance_mod, focus); } void Lua_Mob::DoMeleeSkillAttackDmg(Lua_Mob other, int weapon_damage, int skill, int chance_mod, int focus, bool can_riposte) { Lua_Safe_Call_Void(); - self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill), chance_mod, focus, can_riposte); + self->DoMeleeSkillAttackDmg(other, weapon_damage, static_cast(skill), chance_mod, focus, can_riposte); } void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other) { @@ -1713,17 +1713,17 @@ void Lua_Mob::SetTargetable(bool on) { void Lua_Mob::ModSkillDmgTaken(int skill, int value) { Lua_Safe_Call_Void(); - self->ModSkillDmgTaken(static_cast(skill), value); + self->ModSkillDmgTaken(static_cast(skill), value); } int Lua_Mob::GetModSkillDmgTaken(int skill) { Lua_Safe_Call_Int(); - return self->GetModSkillDmgTaken(static_cast(skill)); + return self->GetModSkillDmgTaken(static_cast(skill)); } int Lua_Mob::GetSkillDmgTaken(int skill) { Lua_Safe_Call_Int(); - return self->GetSkillDmgTaken(static_cast(skill)); + return self->GetSkillDmgTaken(static_cast(skill)); } void Lua_Mob::SetAllowBeneficial(bool value) { @@ -1773,7 +1773,7 @@ int Lua_Mob::GetFlurryChance() { int Lua_Mob::GetSkill(int skill) { Lua_Safe_Call_Int(); - return self->GetSkill(static_cast(skill)); + return self->GetSkill(static_cast(skill)); } int Lua_Mob::GetSpecialAbility(int ability) { diff --git a/zone/merc.cpp b/zone/merc.cpp index 51eac564d..d4ecabdd8 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -70,8 +70,8 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) rest_timer.Disable(); int r; - for(r = 0; r <= HIGHEST_SKILL; r++) { - skills[r] = database.GetSkillCap(GetClass(),(SkillUseTypes)r,GetLevel()); + for (r = 0; r <= EQEmu::skills::HIGHEST_SKILL; r++) { + skills[r] = database.GetSkillCap(GetClass(), (EQEmu::skills::SkillType)r, GetLevel()); } size = d->size; @@ -512,7 +512,7 @@ void Merc::AddItemBonuses(const EQEmu::Item_Struct *item, StatBonuses* newbon) { } } - if (item->SkillModValue != 0 && item->SkillModType <= HIGHEST_SKILL){ + if (item->SkillModValue != 0 && item->SkillModType <= EQEmu::skills::HIGHEST_SKILL){ if ((item->SkillModValue > 0 && newbon->skillmod[item->SkillModType] < item->SkillModValue) || (item->SkillModValue < 0 && newbon->skillmod[item->SkillModType] > item->SkillModValue)) { @@ -566,7 +566,7 @@ void Merc::AddItemBonuses(const EQEmu::Item_Struct *item, StatBonuses* newbon) { } } - if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= HIGHEST_SKILL) { + if (item->ExtraDmgSkill != 0 && item->ExtraDmgSkill <= EQEmu::skills::HIGHEST_SKILL) { if((newbon->SkillDamageAmount[item->ExtraDmgSkill] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap)) newbon->SkillDamageAmount[item->ExtraDmgSkill] = RuleI(Character, ItemExtraDmgCap); else @@ -931,8 +931,8 @@ int32 Merc::CalcBaseManaRegen() int32 regen = 0; if (IsSitting()) { - if(HasSkill(SkillMeditate)) - regen = (((GetSkill(SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4; + if (HasSkill(EQEmu::skills::SkillMeditate)) + regen = (((GetSkill(EQEmu::skills::SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4; else regen = 2; } @@ -948,9 +948,9 @@ int32 Merc::CalcManaRegen() if (IsSitting()) { BuffFadeBySitModifier(); - if(HasSkill(SkillMeditate)) { + if (HasSkill(EQEmu::skills::SkillMeditate)) { this->_medding = true; - regen = ((GetSkill(SkillMeditate) / 10) + mana_regen); + regen = ((GetSkill(EQEmu::skills::SkillMeditate) / 10) + mana_regen); regen += spellbonuses.ManaRegen + itembonuses.ManaRegen; } else @@ -1179,16 +1179,16 @@ void Merc::CalcRestState() { RestRegenEndurance = (GetMaxEndurance() * RuleI(Character, RestRegenPercent) / 100); } -bool Merc::HasSkill(SkillUseTypes skill_id) const { +bool Merc::HasSkill(EQEmu::skills::SkillType skill_id) const { return((GetSkill(skill_id) > 0) && CanHaveSkill(skill_id)); } -bool Merc::CanHaveSkill(SkillUseTypes skill_id) const { +bool Merc::CanHaveSkill(EQEmu::skills::SkillType skill_id) const { return(database.GetSkillCap(GetClass(), skill_id, RuleI(Character, MaxLevel)) > 0); //if you don't have it by max level, then odds are you never will? } -uint16 Merc::MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const { +uint16 Merc::MaxSkill(EQEmu::skills::SkillType skillid, uint16 class_, uint16 level) const { return(database.GetSkillCap(class_, skillid, level)); } @@ -1627,7 +1627,7 @@ void Merc::AI_Process() { float DualWieldProbability = 0.0f; int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; - DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max + DualWieldProbability = (GetSkill(EQEmu::skills::SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; @@ -2318,7 +2318,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { continue; } - if(spells[selectedMercSpell.spellid].skill == SkillBackstab && spells[selectedMercSpell.spellid].targettype == ST_Self) { + if (spells[selectedMercSpell.spellid].skill == EQEmu::skills::SkillBackstab && spells[selectedMercSpell.spellid].targettype == ST_Self) { if(!hidden) { continue; } @@ -4432,7 +4432,7 @@ void Merc::DoClassAttacks(Mob *target) { dmg = -5; } else{ - if(target->CheckHitChance(this, SkillKick, 0)) { + if (target->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else @@ -4442,7 +4442,7 @@ void Merc::DoClassAttacks(Mob *target) { } reuse = KickReuseTime * 1000; - DoSpecialAttackDamage(target, SkillKick, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillKick, dmg, 1, -1, reuse); did_attack = true; } else @@ -4454,7 +4454,7 @@ void Merc::DoClassAttacks(Mob *target) { dmg = -5; } else{ - if(target->CheckHitChance(this, SkillBash, 0)) { + if (target->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else @@ -4463,7 +4463,7 @@ void Merc::DoClassAttacks(Mob *target) { } reuse = BashReuseTime * 1000; - DoSpecialAttackDamage(target, SkillBash, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillBash, dmg, 1, -1, reuse); did_attack = true; } } @@ -4485,7 +4485,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo return NPC::Attack(other, Hand, bRiposte, IsStrikethrough, IsFromSpell, opts); } -void Merc::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) +void Merc::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable, int8 buffslot, bool iBuffTic, int special) { if(IsDead() || IsCorpse()) return; @@ -4526,7 +4526,7 @@ Mob* Merc::GetOwnerOrSelf() { return Result; } -bool Merc::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) +bool Merc::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::SkillType attack_skill) { if(!NPC::Death(killerMob, damage, spell, attack_skill)) { diff --git a/zone/merc.h b/zone/merc.h index e9f993063..275417adb 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -64,8 +64,8 @@ public: virtual ~Merc(); //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, int special = 0); + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return false; } @@ -181,10 +181,10 @@ public: inline const uint8 GetClientVersion() const { return _OwnerClientVersion; } virtual void SetTarget(Mob* mob); - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + bool HasSkill(EQEmu::skills::SkillType skill_id) const; + bool CanHaveSkill(EQEmu::skills::SkillType skill_id) const; + uint16 MaxSkill(EQEmu::skills::SkillType skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(EQEmu::skills::SkillType skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } virtual void DoClassAttacks(Mob *target); void CheckHateList(); bool CheckTaunt(); @@ -291,7 +291,7 @@ protected: std::vector merc_spells; std::map timers; - uint16 skills[HIGHEST_SKILL+1]; + uint16 skills[EQEmu::skills::HIGHEST_SKILL + 1]; uint32 equipment[EQEmu::legacy::EQUIPMENT_SIZE]; //this is an array of item IDs uint16 d_melee_texture1; //this is an item Material value uint16 d_melee_texture2; //this is an item Material value (offhand) diff --git a/zone/mob.cpp b/zone/mob.cpp index aa7862601..7f2224deb 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -427,7 +427,7 @@ Mob::Mob(const char* in_name, m_AllowBeneficial = false; m_DisableMelee = false; - for (int i = 0; i < HIGHEST_SKILL+2; i++) { SkillDmgTaken_Mod[i] = 0; } + for (int i = 0; i < EQEmu::skills::HIGHEST_SKILL + 2; i++) { SkillDmgTaken_Mod[i] = 0; } for (int i = 0; i < HIGHEST_RESIST+2; i++) { Vulnerability_Mod[i] = 0; } emoteid = 0; @@ -2369,14 +2369,14 @@ void Mob::SetZone(uint32 zone_id, uint32 instance_id) } void Mob::Kill() { - Death(this, 0, SPELL_UNKNOWN, SkillHandtoHand); + Death(this, 0, SPELL_UNKNOWN, EQEmu::skills::SkillHandtoHand); } bool Mob::CanThisClassDualWield(void) const { if(!IsClient()) { - return(GetSkill(SkillDualWield) > 0); + return(GetSkill(EQEmu::skills::SkillDualWield) > 0); } - else if(CastToClient()->HasSkill(SkillDualWield)) { + else if (CastToClient()->HasSkill(EQEmu::skills::SkillDualWield)) { const ItemInst* pinst = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); const ItemInst* sinst = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); @@ -2406,12 +2406,12 @@ bool Mob::CanThisClassDualWield(void) const { bool Mob::CanThisClassDoubleAttack(void) const { if(!IsClient()) { - return(GetSkill(SkillDoubleAttack) > 0); + return(GetSkill(EQEmu::skills::SkillDoubleAttack) > 0); } else { if(aabonuses.GiveDoubleAttack || itembonuses.GiveDoubleAttack || spellbonuses.GiveDoubleAttack) { return true; } - return(CastToClient()->HasSkill(SkillDoubleAttack)); + return(CastToClient()->HasSkill(EQEmu::skills::SkillDoubleAttack)); } } @@ -2420,7 +2420,7 @@ bool Mob::CanThisClassTripleAttack() const if (!IsClient()) return false; // When they added the real triple attack skill, mobs lost the ability to triple else - return CastToClient()->HasSkill(SkillTripleAttack); + return CastToClient()->HasSkill(EQEmu::skills::SkillTripleAttack); } bool Mob::IsWarriorClass(void) const @@ -2459,36 +2459,36 @@ bool Mob::IsWarriorClass(void) const bool Mob::CanThisClassParry(void) const { if(!IsClient()) { - return(GetSkill(SkillParry) > 0); + return(GetSkill(EQEmu::skills::SkillParry) > 0); } else { - return(CastToClient()->HasSkill(SkillParry)); + return(CastToClient()->HasSkill(EQEmu::skills::SkillParry)); } } bool Mob::CanThisClassDodge(void) const { if(!IsClient()) { - return(GetSkill(SkillDodge) > 0); + return(GetSkill(EQEmu::skills::SkillDodge) > 0); } else { - return(CastToClient()->HasSkill(SkillDodge)); + return(CastToClient()->HasSkill(EQEmu::skills::SkillDodge)); } } bool Mob::CanThisClassRiposte(void) const { if(!IsClient()) { - return(GetSkill(SkillRiposte) > 0); + return(GetSkill(EQEmu::skills::SkillRiposte) > 0); } else { - return(CastToClient()->HasSkill(SkillRiposte)); + return(CastToClient()->HasSkill(EQEmu::skills::SkillRiposte)); } } bool Mob::CanThisClassBlock(void) const { if(!IsClient()) { - return(GetSkill(SkillBlock) > 0); + return(GetSkill(EQEmu::skills::SkillBlock) > 0); } else { - return(CastToClient()->HasSkill(SkillBlock)); + return(CastToClient()->HasSkill(EQEmu::skills::SkillBlock)); } } /* @@ -3411,19 +3411,19 @@ void Mob::TriggerDefensiveProcs(Mob *on, uint16 hand, bool FromSkillProc, int da uint16 skillinuse = 0; switch (damage) { case (-1): - skillinuse = SkillBlock; + skillinuse = EQEmu::skills::SkillBlock; break; case (-2): - skillinuse = SkillParry; + skillinuse = EQEmu::skills::SkillParry; break; case (-3): - skillinuse = SkillRiposte; + skillinuse = EQEmu::skills::SkillRiposte; break; case (-4): - skillinuse = SkillDodge; + skillinuse = EQEmu::skills::SkillDodge; break; } @@ -3784,15 +3784,15 @@ int32 Mob::GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining) return value; } -int16 Mob::GetSkillDmgTaken(const SkillUseTypes skill_used, ExtraAttackOptions *opts) +int16 Mob::GetSkillDmgTaken(const EQEmu::skills::SkillType skill_used, ExtraAttackOptions *opts) { int skilldmg_mod = 0; // All skill dmg mod + Skill specific - skilldmg_mod += itembonuses.SkillDmgTaken[HIGHEST_SKILL+1] + spellbonuses.SkillDmgTaken[HIGHEST_SKILL+1] + + skilldmg_mod += itembonuses.SkillDmgTaken[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.SkillDmgTaken[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.SkillDmgTaken[skill_used] + spellbonuses.SkillDmgTaken[skill_used]; - skilldmg_mod += SkillDmgTaken_Mod[skill_used] + SkillDmgTaken_Mod[HIGHEST_SKILL+1]; + skilldmg_mod += SkillDmgTaken_Mod[skill_used] + SkillDmgTaken_Mod[EQEmu::skills::HIGHEST_SKILL + 1]; if (opts) skilldmg_mod += opts->skilldmgtaken_bonus_flat; @@ -4606,7 +4606,7 @@ int16 Mob::GetCritDmgMob(uint16 skill) int critDmg_mod = 0; // All skill dmg mod + Skill specific - critDmg_mod += itembonuses.CritDmgMob[HIGHEST_SKILL+1] + spellbonuses.CritDmgMob[HIGHEST_SKILL+1] + aabonuses.CritDmgMob[HIGHEST_SKILL+1] + + critDmg_mod += itembonuses.CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.CritDmgMob[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.CritDmgMob[skill] + spellbonuses.CritDmgMob[skill] + aabonuses.CritDmgMob[skill]; if(critDmg_mod < -100) @@ -4651,7 +4651,7 @@ int16 Mob::GetCriticalChanceBonus(uint16 skill) int critical_chance = 0; // All skills + Skill specific - critical_chance += itembonuses.CriticalHitChance[HIGHEST_SKILL+1] + spellbonuses.CriticalHitChance[HIGHEST_SKILL+1] + aabonuses.CriticalHitChance[HIGHEST_SKILL+1] + + critical_chance += itembonuses.CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.CriticalHitChance[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.CriticalHitChance[skill] + spellbonuses.CriticalHitChance[skill] + aabonuses.CriticalHitChance[skill]; if(critical_chance < -100) @@ -4665,10 +4665,10 @@ int16 Mob::GetMeleeDamageMod_SE(uint16 skill) int dmg_mod = 0; // All skill dmg mod + Skill specific - dmg_mod += itembonuses.DamageModifier[HIGHEST_SKILL+1] + spellbonuses.DamageModifier[HIGHEST_SKILL+1] + aabonuses.DamageModifier[HIGHEST_SKILL+1] + + dmg_mod += itembonuses.DamageModifier[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.DamageModifier[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.DamageModifier[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.DamageModifier[skill] + spellbonuses.DamageModifier[skill] + aabonuses.DamageModifier[skill]; - dmg_mod += itembonuses.DamageModifier2[HIGHEST_SKILL+1] + spellbonuses.DamageModifier2[HIGHEST_SKILL+1] + aabonuses.DamageModifier2[HIGHEST_SKILL+1] + + dmg_mod += itembonuses.DamageModifier2[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.DamageModifier2[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.DamageModifier2[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.DamageModifier2[skill] + spellbonuses.DamageModifier2[skill] + aabonuses.DamageModifier2[skill]; if (HasShieldEquiped() && !IsOffHandAtk()) @@ -4685,7 +4685,7 @@ int16 Mob::GetMeleeMinDamageMod_SE(uint16 skill) int dmg_mod = 0; dmg_mod = itembonuses.MinDamageModifier[skill] + spellbonuses.MinDamageModifier[skill] + - itembonuses.MinDamageModifier[HIGHEST_SKILL+1] + spellbonuses.MinDamageModifier[HIGHEST_SKILL+1]; + itembonuses.MinDamageModifier[EQEmu::skills::HIGHEST_SKILL + 1] + spellbonuses.MinDamageModifier[EQEmu::skills::HIGHEST_SKILL + 1]; if(dmg_mod < -100) dmg_mod = -100; @@ -4717,10 +4717,10 @@ int16 Mob::GetSkillDmgAmt(uint16 skill) int skill_dmg = 0; // All skill dmg(only spells do this) + Skill specific - skill_dmg += spellbonuses.SkillDamageAmount[HIGHEST_SKILL+1] + itembonuses.SkillDamageAmount[HIGHEST_SKILL+1] + aabonuses.SkillDamageAmount[HIGHEST_SKILL+1] + skill_dmg += spellbonuses.SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 1] + aabonuses.SkillDamageAmount[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.SkillDamageAmount[skill] + spellbonuses.SkillDamageAmount[skill] + aabonuses.SkillDamageAmount[skill]; - skill_dmg += spellbonuses.SkillDamageAmount2[HIGHEST_SKILL+1] + itembonuses.SkillDamageAmount2[HIGHEST_SKILL+1] + skill_dmg += spellbonuses.SkillDamageAmount2[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.SkillDamageAmount2[EQEmu::skills::HIGHEST_SKILL + 1] + itembonuses.SkillDamageAmount2[skill] + spellbonuses.SkillDamageAmount2[skill]; return skill_dmg; @@ -4740,7 +4740,7 @@ void Mob::MeleeLifeTap(int32 damage) { if (lifetap_amt > 0) HealDamage(lifetap_amt); //Heal self for modified damage amount. else - Damage(this, -lifetap_amt,0, SkillEvocation,false); //Dmg self for modified damage amount. + Damage(this, -lifetap_amt, 0, EQEmu::skills::SkillEvocation, false); //Dmg self for modified damage amount. } } @@ -4914,21 +4914,21 @@ void Mob::SetBodyType(bodyType new_body, bool overwrite_orig) { } -void Mob::ModSkillDmgTaken(SkillUseTypes skill_num, int value) +void Mob::ModSkillDmgTaken(EQEmu::skills::SkillType skill_num, int value) { if (skill_num == ALL_SKILLS) - SkillDmgTaken_Mod[HIGHEST_SKILL+1] = value; + SkillDmgTaken_Mod[EQEmu::skills::HIGHEST_SKILL + 1] = value; - else if (skill_num >= 0 && skill_num <= HIGHEST_SKILL) + else if (skill_num >= 0 && skill_num <= EQEmu::skills::HIGHEST_SKILL) SkillDmgTaken_Mod[skill_num] = value; } -int16 Mob::GetModSkillDmgTaken(const SkillUseTypes skill_num) +int16 Mob::GetModSkillDmgTaken(const EQEmu::skills::SkillType skill_num) { if (skill_num == ALL_SKILLS) - return SkillDmgTaken_Mod[HIGHEST_SKILL+1]; + return SkillDmgTaken_Mod[EQEmu::skills::HIGHEST_SKILL + 1]; - else if (skill_num >= 0 && skill_num <= HIGHEST_SKILL) + else if (skill_num >= 0 && skill_num <= EQEmu::skills::HIGHEST_SKILL) return SkillDmgTaken_Mod[skill_num]; return 0; @@ -5021,52 +5021,52 @@ uint16 Mob::GetSkillByItemType(int ItemType) { switch (ItemType) { case EQEmu::item::ItemType1HSlash: - return Skill1HSlashing; + return EQEmu::skills::Skill1HSlashing; case EQEmu::item::ItemType2HSlash: - return Skill2HSlashing; + return EQEmu::skills::Skill2HSlashing; case EQEmu::item::ItemType1HPiercing: - return Skill1HPiercing; + return EQEmu::skills::Skill1HPiercing; case EQEmu::item::ItemType1HBlunt: - return Skill1HBlunt; + return EQEmu::skills::Skill1HBlunt; case EQEmu::item::ItemType2HBlunt: - return Skill2HBlunt; + return EQEmu::skills::Skill2HBlunt; case EQEmu::item::ItemType2HPiercing: if (IsClient() && CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::RoF2) - return Skill1HPiercing; + return EQEmu::skills::Skill1HPiercing; else - return Skill2HPiercing; + return EQEmu::skills::Skill2HPiercing; case EQEmu::item::ItemTypeBow: - return SkillArchery; + return EQEmu::skills::SkillArchery; case EQEmu::item::ItemTypeLargeThrowing: case EQEmu::item::ItemTypeSmallThrowing: - return SkillThrowing; + return EQEmu::skills::SkillThrowing; case EQEmu::item::ItemTypeMartial: - return SkillHandtoHand; + return EQEmu::skills::SkillHandtoHand; default: - return SkillHandtoHand; + return EQEmu::skills::SkillHandtoHand; } } -uint8 Mob::GetItemTypeBySkill(SkillUseTypes skill) +uint8 Mob::GetItemTypeBySkill(EQEmu::skills::SkillType skill) { switch (skill) { - case SkillThrowing: + case EQEmu::skills::SkillThrowing: return EQEmu::item::ItemTypeSmallThrowing; - case SkillArchery: + case EQEmu::skills::SkillArchery: return EQEmu::item::ItemTypeArrow; - case Skill1HSlashing: + case EQEmu::skills::Skill1HSlashing: return EQEmu::item::ItemType1HSlash; - case Skill2HSlashing: + case EQEmu::skills::Skill2HSlashing: return EQEmu::item::ItemType2HSlash; - case Skill1HPiercing: + case EQEmu::skills::Skill1HPiercing: return EQEmu::item::ItemType1HPiercing; - case Skill2HPiercing: // watch for undesired client behavior + case EQEmu::skills::Skill2HPiercing: // watch for undesired client behavior return EQEmu::item::ItemType2HPiercing; - case Skill1HBlunt: + case EQEmu::skills::Skill1HBlunt: return EQEmu::item::ItemType1HBlunt; - case Skill2HBlunt: + case EQEmu::skills::Skill2HBlunt: return EQEmu::item::ItemType2HBlunt; - case SkillHandtoHand: + case EQEmu::skills::SkillHandtoHand: return EQEmu::item::ItemTypeMartial; default: return EQEmu::item::ItemTypeMartial; diff --git a/zone/mob.h b/zone/mob.h index 18c46cb61..ed6dc1154 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -25,6 +25,7 @@ #include "position.h" #include "aa_ability.h" #include "aa.h" +#include "../common/light_source.h" #include #include #include @@ -157,12 +158,12 @@ public: int MonkSpecialAttack(Mob* other, uint8 skill_used); virtual void TryBackstab(Mob *other,int ReuseTime = 10); bool AvoidDamage(Mob* attacker, int32 &damage, int hand); - virtual bool CheckHitChance(Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod = 0); + virtual bool CheckHitChance(Mob* attacker, EQEmu::skills::SkillType skillinuse, int Hand, int16 chance_mod = 0); virtual void TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttackOptions *opts = nullptr); void TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage); - virtual bool TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse); - uint32 TryHeadShot(Mob* defender, SkillUseTypes skillInUse); - uint32 TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 ReuseTime); + virtual bool TryFinishingBlow(Mob *defender, EQEmu::skills::SkillType skillinuse); + uint32 TryHeadShot(Mob* defender, EQEmu::skills::SkillType skillInUse); + uint32 TryAssassinate(Mob* defender, EQEmu::skills::SkillType skillInUse, uint16 ReuseTime); virtual void DoRiposte(Mob* defender); void ApplyMeleeDamageBonus(uint16 skill, int32 &damage,ExtraAttackOptions *opts = nullptr); virtual void MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttackOptions *opts = nullptr); @@ -170,7 +171,7 @@ public: bool CombatRange(Mob* other); virtual inline bool IsBerserk() { return false; } // only clients void RogueEvade(Mob *other); - void CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse,ExtraAttackOptions *opts = nullptr); + void CommonOutgoingHitSuccess(Mob* defender, int32 &damage, EQEmu::skills::SkillType skillInUse, ExtraAttackOptions *opts = nullptr); void BreakInvisibleSpells(); void CommonBreakInvisibleFromCombat(); bool HasDied(); @@ -203,7 +204,7 @@ public: virtual void WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 hero_forge_model = 0); void DoAnim(const int animnum, int type=0, bool ackreq = true, eqFilterType filter = FilterNone); void ProjectileAnimation(Mob* to, int item_id, bool IsArrow = false, float speed = 0, - float angle = 0, float tilt = 0, float arc = 0, const char *IDFile = nullptr, SkillUseTypes skillInUse = SkillArchery); + float angle = 0, float tilt = 0, float arc = 0, const char *IDFile = nullptr, EQEmu::skills::SkillType skillInUse = EQEmu::skills::SkillArchery); void ChangeSize(float in_size, bool bNoRestriction = false); inline uint8 SeeInvisible() const { return see_invis; } inline bool SeeInvisibleUndead() const { return see_invis_undead; } @@ -211,7 +212,7 @@ public: inline bool SeeImprovedHide() const { return see_improved_hide; } bool IsInvisible(Mob* other = 0) const; void SetInvisible(uint8 state); - bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon); + bool AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const ItemInst* weapon); //Song bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); @@ -348,7 +349,7 @@ public: inline void SetTwoHandBluntEquiped(bool val) { has_twohandbluntequiped = val; } bool HasTwoHanderEquipped() { return has_twohanderequipped; } void SetTwoHanderEquipped(bool val) { has_twohanderequipped = val; } - virtual uint16 GetSkill(SkillUseTypes skill_num) const { return 0; } + virtual uint16 GetSkill(EQEmu::skills::SkillType skill_num) const { return 0; } virtual uint32 GetEquipment(uint8 material_slot) const { return(0); } virtual int32 GetEquipmentMaterial(uint8 material_slot) const; virtual int32 GetHerosForgeModel(uint8 material_slot) const; @@ -356,8 +357,8 @@ public: virtual uint32 IsEliteMaterialItem(uint8 material_slot) const; bool CanClassEquipItem(uint32 item_id); bool AffectedBySpellExcludingSlot(int slot, int effect); - virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) = 0; - virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) = 0; + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0) = 0; inline virtual void SetHP(int32 hp) { if (hp >= max_hp) cur_hp = max_hp; else cur_hp = hp;} bool ChangeHP(Mob* other, int32 amount, uint16 spell_id = 0, int8 buffslot = -1, bool iBuffTic = false); @@ -556,7 +557,7 @@ public: static uint8 GetDefaultGender(uint16 in_race, uint8 in_gender = 0xFF); static bool IsPlayerRace(uint16 in_race); uint16 GetSkillByItemType(int ItemType); - uint8 GetItemTypeBySkill(SkillUseTypes skill); + uint8 GetItemTypeBySkill(EQEmu::skills::SkillType skill); virtual void MakePet(uint16 spell_id, const char* pettype, const char *petname = nullptr); virtual void MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const char *petname = nullptr, float in_size = 0.0f); bool IsWarriorClass() const; @@ -649,7 +650,7 @@ public: int32 GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining); int32 GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill = false, uint16 skill=0); int32 GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spell_id); - int16 GetSkillDmgTaken(const SkillUseTypes skill_used,ExtraAttackOptions *opts=nullptr); + int16 GetSkillDmgTaken(const EQEmu::skills::SkillType skill_used, ExtraAttackOptions *opts = nullptr); void DoKnockback(Mob *caster, uint32 pushback, uint32 pushup); int16 CalcResistChanceBonus(); int16 CalcFearResistChance(); @@ -682,8 +683,8 @@ public: inline void SetSpellPowerDistanceMod(int16 value) { SpellPowerDistanceMod = value; }; int32 GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot = 0); - void ModSkillDmgTaken(SkillUseTypes skill_num, int value); - int16 GetModSkillDmgTaken(const SkillUseTypes skill_num); + void ModSkillDmgTaken(EQEmu::skills::SkillType skill_num, int value); + int16 GetModSkillDmgTaken(const EQEmu::skills::SkillType skill_num); void ModVulnerability(uint8 resist, int16 value); int16 GetModVulnerability(const uint8 resist); @@ -768,7 +769,7 @@ public: int32 GetMeleeMitigation(); uint8 GetWeaponDamageBonus(const EQEmu::Item_Struct* weapon, bool offhand = false); - uint16 GetDamageTable(SkillUseTypes skillinuse); + uint16 GetDamageTable(EQEmu::skills::SkillType skillinuse); virtual int GetHandToHandDamage(void); bool CanThisClassDoubleAttack(void) const; @@ -791,11 +792,11 @@ public: int32 AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTic, Mob* attacker); int32 ReduceAllDamage(int32 damage); - virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool CheckHitChance=false, bool CanAvoid=true); + virtual void DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool CheckHitChance = false, bool CanAvoid = true); virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const EQEmu::Item_Struct* AmmoItem=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 range_id=0, int AmmoSlot=0, float speed = 4.0f); - virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); + virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod = 0, int16 focus = 0, bool CanRiposte = false, int ReuseTime = 0); virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const EQEmu::Item_Struct *AmmoItem=nullptr, int AmmoSlot=0, float speed= 4.0f); - bool TryProjectileAttack(Mob* other, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed); + bool TryProjectileAttack(Mob* other, const EQEmu::Item_Struct *item, EQEmu::skills::SkillType skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed); void ProjectileAttack(); inline bool HasProjectileAttack() const { return ActiveProjectileATK; } inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } @@ -913,7 +914,7 @@ public: // HP Event inline int GetNextHPEvent() const { return nexthpevent; } void SetNextHPEvent( int hpevent ); - void SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, float velocity= 4.0); + void SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, EQEmu::skills::SkillType skillInUse, float velocity = 4.0); inline int& GetNextIncHPEvent() { return nextinchpevent; } void SetNextIncHPEvent( int inchpevent ); @@ -964,7 +965,7 @@ public: bool HasSpellEffect(int effectid); int mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster, uint16 caster_id); - float mod_hit_chance(float chancetohit, SkillUseTypes skillinuse, Mob* attacker); + float mod_hit_chance(float chancetohit, EQEmu::skills::SkillType skillinuse, Mob* attacker); float mod_riposte_chance(float ripostchance, Mob* attacker); float mod_block_chance(float blockchance, Mob* attacker); float mod_parry_chance(float parrychance, Mob* attacker); @@ -975,7 +976,7 @@ public: int32 mod_kick_damage(int32 dmg); int32 mod_bash_damage(int32 dmg); int32 mod_frenzy_damage(int32 dmg); - int32 mod_monk_special_damage(int32 ndamage, SkillUseTypes skill_type); + int32 mod_monk_special_damage(int32 ndamage, EQEmu::skills::SkillType skill_type); int32 mod_backstab_damage(int32 ndamage); int mod_archery_bonus_chance(int bonuschance, const ItemInst* RangeWeapon); uint32 mod_archery_bonus_damage(uint32 MaxDmg, const ItemInst* RangeWeapon); @@ -994,7 +995,7 @@ public: uint32 Tune_GetMeanDamage(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts = nullptr, int Msg = 0,int ac_override=0, int atk_override=0, int add_ac=0, int add_atk = 0); void Tune_FindATKByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 50, int max_loop = 100, int ac_override=0,int Msg =0); void Tune_FindACByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 50, int max_loop = 100, int atk_override=0,int Msg =0); - float Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod, int Msg = 1,int acc_override=0, int avoid_override=0, int add_acc=0, int add_avoid = 0); + float Tune_CheckHitChance(Mob* defender, Mob* attacker, EQEmu::skills::SkillType skillinuse, int Hand, int16 chance_mod, int Msg = 1, int acc_override = 0, int avoid_override = 0, int add_acc = 0, int add_avoid = 0); void Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int avoid_override, int Msg = 0); void Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int acc_override, int Msg = 0); @@ -1031,7 +1032,7 @@ public: #endif protected: - void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const SkillUseTypes attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic, int special = 0); + void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const EQEmu::skills::SkillType attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic, int special = 0); static uint16 GetProcID(uint16 spell_id, uint8 effect_index); float _GetMovementSpeed(int mod) const; int _GetWalkSpeed() const; @@ -1049,7 +1050,7 @@ protected: std::vector RampageArray; std::map m_EntityVariables; - int16 SkillDmgTaken_Mod[HIGHEST_SKILL+2]; + int16 SkillDmgTaken_Mod[EQEmu::skills::HIGHEST_SKILL + 2]; int16 Vulnerability_Mod[HIGHEST_RESIST+2]; bool m_AllowBeneficial; bool m_DisableMelee; @@ -1165,7 +1166,7 @@ protected: int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr); int GetKickDamage(); int GetBashDamage(); - virtual void ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg); + virtual void ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int32 &mindmg); virtual int16 GetFocusEffect(focusType type, uint16 spell_id) { return 0; } void CalculateNewFearpoint(); float FindGroundZ(float new_x, float new_y, float z_offset=0.0); diff --git a/zone/mod_functions.cpp b/zone/mod_functions.cpp index e58945732..a38003504 100644 --- a/zone/mod_functions.cpp +++ b/zone/mod_functions.cpp @@ -29,7 +29,7 @@ void Zone::mod_repop() { return; } void NPC::mod_prespawn(Spawn2 *sp) { return; } //Base damage from NPC::Attack -int NPC::mod_npc_damage(int damage, SkillUseTypes skillinuse, int hand, const EQEmu::Item_Struct* weapon, Mob* other) { return(damage); } +int NPC::mod_npc_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::Item_Struct* weapon, Mob* other) { return(damage); } //Mob c has been given credit for a kill. This is called after the regular EVENT_KILLED_MERIT event. void NPC::mod_npc_killed_merit(Mob* c) { return; } @@ -38,7 +38,7 @@ void NPC::mod_npc_killed_merit(Mob* c) { return; } void NPC::mod_npc_killed(Mob* oos) { return; } //Base damage from Client::Attack - can cover myriad skill types -int Client::mod_client_damage(int damage, SkillUseTypes skillinuse, int hand, const ItemInst* weapon, Mob* other) { return(damage); } +int Client::mod_client_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const ItemInst* weapon, Mob* other) { return(damage); } //message is char[4096], don't screw it up. Return true for normal behavior, false to return immediately. // Channels: @@ -58,7 +58,7 @@ bool Client::mod_client_message(char* message, uint8 chan_num) { return(true); } //Skillup override. When this is called the regular skillup check has failed. Return false to proceed with default behavior. //This will NOT allow a client to increase skill past a cap. -bool Client::mod_can_increase_skill(SkillUseTypes skillid, Mob* against_who) { return(false); } +bool Client::mod_can_increase_skill(EQEmu::skills::SkillType skillid, Mob* against_who) { return(false); } //chance of general skill increase, rolled against 0-99 where higher chance is better. int16 Client::mod_increase_skill_chance(int16 chance, Mob* against_who) { return(chance); } @@ -114,7 +114,7 @@ int Client::mod_drink_value(const EQEmu::Item_Struct *item, int change) { return int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster, uint16 caster_id) { return(effect_value); } //chancetohit - 0 to 100 percent - set over 1000 for a guaranteed hit -float Mob::mod_hit_chance(float chancetohit, SkillUseTypes skillinuse, Mob* attacker) { return(chancetohit); } +float Mob::mod_hit_chance(float chancetohit, EQEmu::skills::SkillType skillinuse, Mob* attacker) { return(chancetohit); } //Final riposte chance float Mob::mod_riposte_chance(float ripostechance, Mob* attacker) { return(ripostechance); } @@ -146,7 +146,7 @@ int32 Mob::mod_bash_damage(int32 dmg) { return(dmg); } int32 Mob::mod_frenzy_damage(int32 dmg) { return(dmg); } //Special attack damage after all other bonuses are applied. -int32 Mob::mod_monk_special_damage(int32 ndamage, SkillUseTypes skill_type) { return(ndamage); } +int32 Mob::mod_monk_special_damage(int32 ndamage, EQEmu::skills::SkillType skill_type) { return(ndamage); } //ndamage - Backstab damage as calculated by default formulas int32 Mob::mod_backstab_damage(int32 ndamage) { return(ndamage); } diff --git a/zone/npc.cpp b/zone/npc.cpp index 54c375f8c..b875a2d1b 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -30,6 +30,7 @@ #include "../common/item_struct.h" #include "../common/linked_list.h" #include "../common/servertalk.h" +#include "../common/say_link.h" #include "client.h" #include "entity.h" @@ -276,20 +277,20 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if //give NPCs skill values... int r; - for(r = 0; r <= HIGHEST_SKILL; r++) { - skills[r] = database.GetSkillCap(GetClass(),(SkillUseTypes)r,moblevel); + for (r = 0; r <= EQEmu::skills::HIGHEST_SKILL; r++) { + skills[r] = database.GetSkillCap(GetClass(), (EQEmu::skills::SkillType)r, moblevel); } // some overrides -- really we need to be able to set skills for mobs in the DB // There are some known low level SHM/BST pets that do not follow this, which supports // the theory of needing to be able to set skills for each mob separately if (moblevel > 50) { - skills[SkillDoubleAttack] = 250; - skills[SkillDualWield] = 250; + skills[EQEmu::skills::SkillDoubleAttack] = 250; + skills[EQEmu::skills::SkillDualWield] = 250; } else if (moblevel > 3) { - skills[SkillDoubleAttack] = moblevel * 5; - skills[SkillDualWield] = skills[SkillDoubleAttack]; + skills[EQEmu::skills::SkillDoubleAttack] = moblevel * 5; + skills[EQEmu::skills::SkillDualWield] = skills[EQEmu::skills::SkillDoubleAttack]; } else { - skills[SkillDoubleAttack] = moblevel * 5; + skills[EQEmu::skills::SkillDoubleAttack] = moblevel * 5; } if(d->trap_template > 0) @@ -1427,7 +1428,7 @@ uint32 NPC::GetMaxDamage(uint8 tlevel) void NPC::PickPocket(Client* thief) { - thief->CheckIncreaseSkill(SkillPickPockets, nullptr, 5); + thief->CheckIncreaseSkill(EQEmu::skills::SkillPickPockets, nullptr, 5); //make sure were allowed to target them: int over_level = GetLevel(); @@ -1446,7 +1447,7 @@ void NPC::PickPocket(Client* thief) return; } - int steal_skill = thief->GetSkill(SkillPickPockets); + int steal_skill = thief->GetSkill(EQEmu::skills::SkillPickPockets); int steal_chance = steal_skill * 100 / (5 * over_level + 5); // Determine whether to steal money or an item. diff --git a/zone/npc.h b/zone/npc.h index 0456ca211..5131eb569 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -108,8 +108,8 @@ public: virtual ~NPC(); //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, int special = 0); + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return false; } @@ -142,7 +142,7 @@ public: void CalcNPCDamage(); virtual void SetTarget(Mob* mob); - virtual uint16 GetSkill(SkillUseTypes skill_num) const { if (skill_num <= HIGHEST_SKILL) { return skills[skill_num]; } return 0; } + virtual uint16 GetSkill(EQEmu::skills::SkillType skill_num) const { if (skill_num <= EQEmu::skills::HIGHEST_SKILL) { return skills[skill_num]; } return 0; } void CalcItemBonuses(StatBonuses *newbon); virtual void CalcBonuses(); @@ -161,7 +161,7 @@ public: virtual void RangedAttack(Mob* other); virtual void ThrowingAttack(Mob* other) { } int32 GetNumberOfAttacks() const { return attack_count; } - void DoRangedAttackDmg(Mob* other, bool Launch=true, int16 damage_mod=0, int16 chance_mod=0, SkillUseTypes skill=SkillArchery, float speed=4.0f, const char *IDFile = nullptr); + void DoRangedAttackDmg(Mob* other, bool Launch = true, int16 damage_mod = 0, int16 chance_mod = 0, EQEmu::skills::SkillType skill = EQEmu::skills::SkillArchery, float speed = 4.0f, const char *IDFile = nullptr); bool DatabaseCastAccepted(int spell_id); bool IsFactionListAlly(uint32 other_faction); @@ -403,7 +403,7 @@ public: void SetMerchantProbability(uint8 amt) { probability = amt; } uint8 GetMerchantProbability() { return probability; } void mod_prespawn(Spawn2 *sp); - int mod_npc_damage(int damage, SkillUseTypes skillinuse, int hand, const EQEmu::Item_Struct* weapon, Mob* other); + int mod_npc_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::Item_Struct* weapon, Mob* other); void mod_npc_killed_merit(Mob* c); void mod_npc_killed(Mob* oos); void AISpellsList(Client *c); @@ -497,7 +497,7 @@ protected: uint32 roambox_delay; uint32 roambox_min_delay; - uint16 skills[HIGHEST_SKILL+1]; + uint16 skills[EQEmu::skills::HIGHEST_SKILL + 1]; uint32 equipment[EQEmu::legacy::EQUIPMENT_SIZE]; //this is an array of item IDs diff --git a/zone/object.h b/zone/object.h index c39ee61c9..c7ebdd677 100644 --- a/zone/object.h +++ b/zone/object.h @@ -108,7 +108,7 @@ public: static void HandleAugmentation(Client* user, const AugmentItem_Struct* in_augment, Object *worldo); static void HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac); - static SkillUseTypes TypeToSkill(uint32 type); + static EQEmu::skills::SkillType TypeToSkill(uint32 type); // Packet functions void CreateSpawnPacket(EQApplicationPacket* app); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 129dafd73..76c085714 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1940,7 +1940,7 @@ XS(XS_Client_GetSkill) Client * THIS; uint16 RETVAL; dXSTARG; - SkillUseTypes skill_id = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_id = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -1967,7 +1967,7 @@ XS(XS_Client_GetRawSkill) Client * THIS; uint32 RETVAL; dXSTARG; - SkillUseTypes skill_id = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_id = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -1993,7 +1993,7 @@ XS(XS_Client_HasSkill) { Client * THIS; bool RETVAL; - SkillUseTypes skill_id = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_id = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -2020,7 +2020,7 @@ XS(XS_Client_CanHaveSkill) { Client * THIS; bool RETVAL; - SkillUseTypes skill_id = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_id = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -2046,7 +2046,7 @@ XS(XS_Client_SetSkill) Perl_croak(aTHX_ "Usage: Client::SetSkill(THIS, skill_num, value)"); { Client * THIS; - SkillUseTypes skill_num = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_num = (EQEmu::skills::SkillType)SvUV(ST(1)); uint16 value = (uint16)SvUV(ST(2)); if (sv_derived_from(ST(0), "Client")) { @@ -2071,7 +2071,7 @@ XS(XS_Client_AddSkill) Perl_croak(aTHX_ "Usage: Client::AddSkill(THIS, skillid, value)"); { Client * THIS; - SkillUseTypes skillid = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skillid = (EQEmu::skills::SkillType)SvUV(ST(1)); uint16 value = (uint16)SvUV(ST(2)); if (sv_derived_from(ST(0), "Client")) { @@ -2121,7 +2121,7 @@ XS(XS_Client_CheckIncreaseSkill) { Client * THIS; bool RETVAL; - SkillUseTypes skillid = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skillid = (EQEmu::skills::SkillType)SvUV(ST(1)); int chancemodi; if (sv_derived_from(ST(0), "Client")) { @@ -2180,7 +2180,7 @@ XS(XS_Client_MaxSkill) { Client * THIS; uint16 RETVAL; - SkillUseTypes skillid = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skillid = (EQEmu::skills::SkillType)SvUV(ST(1)); uint16 class_ = 0; uint16 level = 0; dXSTARG; diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index c9c24b955..89c94e7e3 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -619,7 +619,7 @@ XS(XS_Mob_GetSkill) Mob * THIS; uint32 RETVAL; dXSTARG; - SkillUseTypes skill_num = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_num = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -901,7 +901,7 @@ XS(XS_Mob_Damage) Mob* from; int32 damage = (int32)SvIV(ST(2)); uint16 spell_id = (uint16)SvUV(ST(3)); - SkillUseTypes attack_skill = (SkillUseTypes)SvUV(ST(4)); + EQEmu::skills::SkillType attack_skill = (EQEmu::skills::SkillType)SvUV(ST(4)); bool avoidable; int8 buffslot; bool iBuffTic; @@ -6836,7 +6836,7 @@ XS(XS_Mob_DoSpecialAttackDamage) { Mob * THIS; Mob* target; - SkillUseTypes attack_skill = (SkillUseTypes)SvUV(ST(2)); + EQEmu::skills::SkillType attack_skill = (EQEmu::skills::SkillType)SvUV(ST(2)); int32 max_damage = (int32)SvIV(ST(3)); int32 min_damage = 1; int32 hate_override = -11; @@ -7835,7 +7835,7 @@ XS(XS_Mob_ModSkillDmgTaken) Perl_croak(aTHX_ "Usage: Mob::ModSkillDmgTaken(THIS, skill, value)"); { Mob * THIS; - SkillUseTypes skill_num = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_num = (EQEmu::skills::SkillType)SvUV(ST(1)); int16 value = (int16)SvIV(ST(2)); if (sv_derived_from(ST(0), "Mob")) { @@ -7862,7 +7862,7 @@ XS(XS_Mob_GetModSkillDmgTaken) Mob * THIS; int16 RETVAL; dXSTARG; - SkillUseTypes skill_num = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_num = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -7889,7 +7889,7 @@ XS(XS_Mob_GetSkillDmgTaken) Mob * THIS; int32 RETVAL; dXSTARG; - SkillUseTypes skill_num = (SkillUseTypes)SvUV(ST(1)); + EQEmu::skills::SkillType skill_num = (EQEmu::skills::SkillType)SvUV(ST(1)); if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -8055,7 +8055,7 @@ XS(XS_Mob_DoMeleeSkillAttackDmg) Mob * THIS; Mob* target; uint16 weapon_damage = (uint16)SvIV(ST(2)); - SkillUseTypes skill = (SkillUseTypes)SvUV(ST(3)); + EQEmu::skills::SkillType skill = (EQEmu::skills::SkillType)SvUV(ST(3)); int16 chance_mod = (int16)SvIV(ST(4)); int16 focus = (int16)SvIV(ST(5)); uint8 CanRiposte = (uint8)SvIV(ST(6)); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 70c7c404f..f28755efb 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -22,6 +22,7 @@ #include "../common/skills.h" #include "../common/spdat.h" #include "../common/string_util.h" +#include "../common/say_link.h" #include "entity.h" #include "event_codes.h" @@ -1152,10 +1153,10 @@ void QuestManager::doanim(int anim_id) { void QuestManager::addskill(int skill_id, int value) { QuestManagerCurrentQuestVars(); - if(skill_id < 0 || skill_id > HIGHEST_SKILL) + if (skill_id < 0 || skill_id > EQEmu::skills::HIGHEST_SKILL) return; if (initiator && initiator->IsClient()) - initiator->AddSkill((SkillUseTypes) skill_id, value); + initiator->AddSkill((EQEmu::skills::SkillType) skill_id, value); } void QuestManager::setlanguage(int skill_id, int value) { @@ -1166,10 +1167,10 @@ void QuestManager::setlanguage(int skill_id, int value) { void QuestManager::setskill(int skill_id, int value) { QuestManagerCurrentQuestVars(); - if(skill_id < 0 || skill_id > HIGHEST_SKILL) + if (skill_id < 0 || skill_id > EQEmu::skills::HIGHEST_SKILL) return; if (initiator && initiator->IsClient()) - initiator->SetSkill((SkillUseTypes) skill_id, value); + initiator->SetSkill((EQEmu::skills::SkillType) skill_id, value); } void QuestManager::setallskill(int value) { @@ -1177,8 +1178,8 @@ void QuestManager::setallskill(int value) { if (!initiator) return; if (initiator && initiator->IsClient()) { - SkillUseTypes sk; - for (sk = Skill1HBlunt; sk <= HIGHEST_SKILL; sk = (SkillUseTypes)(sk+1)) { + EQEmu::skills::SkillType sk; + for (sk = EQEmu::skills::Skill1HBlunt; sk <= EQEmu::skills::HIGHEST_SKILL; sk = (EQEmu::skills::SkillType)(sk + 1)) { initiator->SetSkill(sk, value); } } @@ -1772,7 +1773,7 @@ void QuestManager::clear_zone_flag(int zone_id) { void QuestManager::sethp(int hpperc) { QuestManagerCurrentQuestVars(); int newhp = (owner->GetMaxHP() * (100 - hpperc)) / 100; - owner->Damage(owner, newhp, SPELL_UNKNOWN, SkillHandtoHand, false, 0, false); + owner->Damage(owner, newhp, SPELL_UNKNOWN, EQEmu::skills::SkillHandtoHand, false, 0, false); } bool QuestManager::summonburiedplayercorpse(uint32 char_id, const glm::vec4& position) { diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 674c15d03..dd6f72b8b 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -30,14 +30,14 @@ int Mob::GetKickDamage() { int multiple=(GetLevel()*100/5); multiple += 100; - int32 dmg=(((GetSkill(SkillKick) + GetSTR() + GetLevel())*100 / 9000) * multiple) + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. + int32 dmg = (((GetSkill(EQEmu::skills::SkillKick) + GetSTR() + GetLevel()) * 100 / 9000) * multiple) + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. if(GetClass() == WARRIOR || GetClass() == WARRIORGM ||GetClass() == BERSERKER || GetClass() == BERSERKERGM) { dmg*=12/10;//small increase for warriors } dmg /= 100; int32 mindmg = 1; - ApplySpecialAttackMod(SkillKick, dmg,mindmg); + ApplySpecialAttackMod(EQEmu::skills::SkillKick, dmg, mindmg); dmg = mod_kick_damage(dmg); @@ -49,41 +49,37 @@ int Mob::GetBashDamage() { multiple += 100; //this is complete shite - int32 dmg=((((GetSkill(SkillBash) + GetSTR())*100 + GetLevel()*100/2) / 10000) * multiple) + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. + int32 dmg = ((((GetSkill(EQEmu::skills::SkillBash) + GetSTR()) * 100 + GetLevel() * 100 / 2) / 10000) * multiple) + 600; //Set a base of 6 damage, 1 seemed too low at the sub level 30 level. dmg /= 100; int32 mindmg = 1; - ApplySpecialAttackMod(SkillBash, dmg, mindmg); + ApplySpecialAttackMod(EQEmu::skills::SkillBash, dmg, mindmg); dmg = mod_bash_damage(dmg); return(dmg); } -void Mob::ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg) { +void Mob::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int32 &mindmg) { int item_slot = -1; //1: Apply bonus from AC (BOOT/SHIELD/HANDS) est. 40AC=6dmg if (IsClient()){ - switch (skill){ - - case SkillFlyingKick: - case SkillRoundKick: - case SkillKick: - item_slot = EQEmu::legacy::SlotFeet; - break; - - case SkillBash: - item_slot = EQEmu::legacy::SlotSecondary; - break; - - case SkillDragonPunch: - case SkillEagleStrike: - case SkillTigerClaw: - item_slot = EQEmu::legacy::SlotHands; - break; - - default: - break; + switch (skill) { + case EQEmu::skills::SkillFlyingKick: + case EQEmu::skills::SkillRoundKick: + case EQEmu::skills::SkillKick: + item_slot = EQEmu::legacy::SlotFeet; + break; + case EQEmu::skills::SkillBash: + item_slot = EQEmu::legacy::SlotSecondary; + break; + case EQEmu::skills::SkillDragonPunch: + case EQEmu::skills::SkillEagleStrike: + case EQEmu::skills::SkillTigerClaw: + item_slot = EQEmu::legacy::SlotHands; + break; + default: + break; } if (item_slot >= 0){ @@ -95,7 +91,7 @@ void Mob::ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg) } } -void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage, int32 hate_override,int ReuseTime, +void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 max_damage, int32 min_damage, int32 hate_override, int ReuseTime, bool CheckHitChance, bool CanAvoid) { //this really should go through the same code as normal melee damage to //pick up all the special behavior there @@ -106,14 +102,14 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if(who->GetInvul() || who->GetSpecialAbility(IMMUNE_MELEE)) max_damage = -5; - if (who->GetSpecialAbility(IMMUNE_MELEE_EXCEPT_BANE) && skill != SkillBackstab) + if (who->GetSpecialAbility(IMMUNE_MELEE_EXCEPT_BANE) && skill != EQEmu::skills::SkillBackstab) max_damage = -5; uint32 hate = max_damage; if(hate_override > -1) hate = hate_override; - if(skill == SkillBash){ + if (skill == EQEmu::skills::SkillBash){ if(IsClient()){ ItemInst *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); if(item) @@ -134,7 +130,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, min_damage += min_damage * GetMeleeMinDamageMod_SE(skill) / 100; int hand = EQEmu::legacy::SlotPrimary; // Avoid checks hand for throwing/archery exclusion, primary should work for most - if (skill == SkillThrowing || skill == SkillArchery) + if (skill == EQEmu::skills::SkillThrowing || skill == EQEmu::skills::SkillArchery) hand = EQEmu::legacy::SlotRange; if (who->AvoidDamage(this, max_damage, hand)) { if (max_damage == -3) @@ -182,11 +178,11 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { pTimerType timer = pTimerCombatAbility; // RoF2+ Tiger Claw is unlinked from other monk skills, if they ever do that for other classes there will need // to be more checks here - if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF2 && ca_atk->m_skill == SkillTigerClaw) + if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF2 && ca_atk->m_skill == EQEmu::skills::SkillTigerClaw) timer = pTimerCombatAbility2; /* Check to see if actually have skill */ - if (!MaxSkill(static_cast(ca_atk->m_skill))) + if (!MaxSkill(static_cast(ca_atk->m_skill))) return; if(GetTarget()->GetID() != ca_atk->m_target) @@ -199,7 +195,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { //allready do their checking in conjunction with the attack timer //throwing weapons if (ca_atk->m_atk == EQEmu::legacy::SlotRange) { - if (ca_atk->m_skill == SkillThrowing) { + if (ca_atk->m_skill == EQEmu::skills::SkillThrowing) { SetAttackTimer(); ThrowingAttack(GetTarget()); if (CheckDoubleRangedAttack()) @@ -207,7 +203,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { return; } //ranged attack (archery) - if (ca_atk->m_skill == SkillArchery) { + if (ca_atk->m_skill == EQEmu::skills::SkillArchery) { SetAttackTimer(); RangedAttack(GetTarget()); if (CheckDoubleRangedAttack()) @@ -241,10 +237,10 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { int32 skill_reduction = this->GetSkillReuseTime(ca_atk->m_skill); // not sure what the '100' indicates..if ->m_atk is not used as 'slot' reference, then change SlotRange above back to '11' - if ((ca_atk->m_atk == 100) && (ca_atk->m_skill == SkillBash)) { // SLAM - Bash without a shield equipped + if ((ca_atk->m_atk == 100) && (ca_atk->m_skill == EQEmu::skills::SkillBash)) { // SLAM - Bash without a shield equipped if (GetTarget() != this) { - CheckIncreaseSkill(SkillBash, GetTarget(), 10); + CheckIncreaseSkill(EQEmu::skills::SkillBash, GetTarget(), 10); DoAnim(animTailRake); int32 ht = 0; @@ -253,7 +249,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { dmg = -5; } else{ - if(!GetTarget()->CheckHitChance(this, SkillBash, 0)) { + if (!GetTarget()->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) { dmg = 0; ht = GetBashDamage(); } @@ -268,7 +264,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { ReuseTime = BashReuseTime-1-skill_reduction; ReuseTime = (ReuseTime*HasteMod)/100; - DoSpecialAttackDamage(GetTarget(), SkillBash, dmg, 1, ht, ReuseTime); + DoSpecialAttackDamage(GetTarget(), EQEmu::skills::SkillBash, dmg, 1, ht, ReuseTime); if(ReuseTime > 0) { p_timers.Start(timer, ReuseTime); @@ -277,10 +273,10 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { return; } - if ((ca_atk->m_atk == 100) && (ca_atk->m_skill == SkillFrenzy)){ - CheckIncreaseSkill(SkillFrenzy, GetTarget(), 10); + if ((ca_atk->m_atk == 100) && (ca_atk->m_skill == EQEmu::skills::SkillFrenzy)){ + CheckIncreaseSkill(EQEmu::skills::SkillFrenzy, GetTarget(), 10); int AtkRounds = 3; - int skillmod = 100*GetSkill(SkillFrenzy)/MaxSkill(SkillFrenzy); + int skillmod = 100 * GetSkill(EQEmu::skills::SkillFrenzy) / MaxSkill(EQEmu::skills::SkillFrenzy); int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); int32 min_dmg = 0; DoAnim(anim2HSlashing); @@ -301,7 +297,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { //Live parses show around 55% Triple 35% Double 10% Single, you will always get first hit. while(AtkRounds > 0) { if (GetTarget() && (AtkRounds == 1 || zone->random.Roll(75))) { - DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, max_dmg , ReuseTime, true); + DoSpecialAttackDamage(GetTarget(), EQEmu::skills::SkillFrenzy, max_dmg, min_dmg, max_dmg, ReuseTime, true); } AtkRounds--; } @@ -317,11 +313,11 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { case WARRIOR: case RANGER: case BEASTLORD: - if (ca_atk->m_atk != 100 || ca_atk->m_skill != SkillKick) { + if (ca_atk->m_atk != 100 || ca_atk->m_skill != EQEmu::skills::SkillKick) { break; } if (GetTarget() != this) { - CheckIncreaseSkill(SkillKick, GetTarget(), 10); + CheckIncreaseSkill(EQEmu::skills::SkillKick, GetTarget(), 10); DoAnim(animKick); int32 ht = 0; @@ -329,7 +325,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { dmg = -5; } else{ - if(!GetTarget()->CheckHitChance(this, SkillKick, 0)) { + if (!GetTarget()->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) { dmg = 0; ht = GetKickDamage(); } @@ -342,7 +338,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { } ReuseTime = KickReuseTime-1-skill_reduction; - DoSpecialAttackDamage(GetTarget(), SkillKick, dmg, 1, ht, ReuseTime); + DoSpecialAttackDamage(GetTarget(), EQEmu::skills::SkillKick, dmg, 1, ht, ReuseTime); } break; @@ -353,7 +349,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; if (wuchance) { if (wuchance >= 100 || zone->random.Roll(wuchance)) { - int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; + int MonkSPA[5] = { EQEmu::skills::SkillFlyingKick, EQEmu::skills::SkillDragonPunch, EQEmu::skills::SkillEagleStrike, EQEmu::skills::SkillTigerClaw, EQEmu::skills::SkillRoundKick }; int extra = 1; // always 1/4 of the double attack chance, 25% at rank 5 (100/4) if (zone->random.Roll(wuchance / 4)) @@ -373,12 +369,12 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { //hackish... but we return a huge reuse time if this is an // invalid skill, otherwise, we can safely assume it is a // valid monk skill and just cast it to a SkillType - CheckIncreaseSkill((SkillUseTypes) ca_atk->m_skill, GetTarget(), 10); + CheckIncreaseSkill((EQEmu::skills::SkillType) ca_atk->m_skill, GetTarget(), 10); } break; } case ROGUE: { - if (ca_atk->m_atk != 100 || ca_atk->m_skill != SkillBackstab) { + if (ca_atk->m_atk != 100 || ca_atk->m_skill != EQEmu::skills::SkillBackstab) { break; } ReuseTime = BackstabReuseTime-1 - skill_reduction; @@ -407,68 +403,58 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) int32 max_dmg = 0; int32 min_dmg = 1; int reuse = 0; - SkillUseTypes skill_type; //to avoid casting... even though it "would work" + EQEmu::skills::SkillType skill_type; //to avoid casting... even though it "would work" uint8 itemslot = EQEmu::legacy::SlotFeet; - switch(unchecked_type){ - case SkillFlyingKick:{ - skill_type = SkillFlyingKick; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, FlyingKickBonus) / 100) + 35; - min_dmg = ((level*8)/10); - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animFlyingKick); - reuse = FlyingKickReuseTime; - break; - } - case SkillDragonPunch:{ - skill_type = SkillDragonPunch; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, DragonPunchBonus) / 100) + 26; - itemslot = EQEmu::legacy::SlotHands; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animTailRake); - reuse = TailRakeReuseTime; - break; - } - - case SkillEagleStrike:{ - skill_type = SkillEagleStrike; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, EagleStrikeBonus) / 100) + 19; - itemslot = EQEmu::legacy::SlotHands; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animEagleStrike); - reuse = EagleStrikeReuseTime; - break; - } - - case SkillTigerClaw:{ - skill_type = SkillTigerClaw; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, TigerClawBonus) / 100) + 12; - itemslot = EQEmu::legacy::SlotHands; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animTigerClaw); - reuse = TigerClawReuseTime; - break; - } - - case SkillRoundKick:{ - skill_type = SkillRoundKick; - max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, RoundKickBonus) / 100) + 10; - ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); - DoAnim(animRoundKick); - reuse = RoundKickReuseTime; - break; - } - - case SkillKick:{ - skill_type = SkillKick; - max_dmg = GetKickDamage(); - DoAnim(animKick); - reuse = KickReuseTime; - break; - } - default: - Log.Out(Logs::Detail, Logs::Attack, "Invalid special attack type %d attempted", unchecked_type); - return(1000); /* nice long delay for them, the caller depends on this! */ + switch(unchecked_type) { + case EQEmu::skills::SkillFlyingKick: + skill_type = EQEmu::skills::SkillFlyingKick; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, FlyingKickBonus) / 100) + 35; + min_dmg = ((level*8)/10); + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animFlyingKick); + reuse = FlyingKickReuseTime; + break; + case EQEmu::skills::SkillDragonPunch: + skill_type = EQEmu::skills::SkillDragonPunch; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, DragonPunchBonus) / 100) + 26; + itemslot = EQEmu::legacy::SlotHands; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animTailRake); + reuse = TailRakeReuseTime; + break; + case EQEmu::skills::SkillEagleStrike: + skill_type = EQEmu::skills::SkillEagleStrike; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, EagleStrikeBonus) / 100) + 19; + itemslot = EQEmu::legacy::SlotHands; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animEagleStrike); + reuse = EagleStrikeReuseTime; + break; + case EQEmu::skills::SkillTigerClaw: + skill_type = EQEmu::skills::SkillTigerClaw; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, TigerClawBonus) / 100) + 12; + itemslot = EQEmu::legacy::SlotHands; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animTigerClaw); + reuse = TigerClawReuseTime; + break; + case EQEmu::skills::SkillRoundKick: + skill_type = EQEmu::skills::SkillRoundKick; + max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, RoundKickBonus) / 100) + 10; + ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); + DoAnim(animRoundKick); + reuse = RoundKickReuseTime; + break; + case EQEmu::skills::SkillKick: + skill_type = EQEmu::skills::SkillKick; + max_dmg = GetKickDamage(); + DoAnim(animKick); + reuse = KickReuseTime; + break; + default: + Log.Out(Logs::Detail, Logs::Attack, "Invalid special attack type %d attempted", unchecked_type); + return(1000); /* nice long delay for them, the caller depends on this! */ } if(IsClient()){ @@ -550,7 +536,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { } if(IsClient()) - CastToClient()->CheckIncreaseSkill(SkillBackstab, other, 10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillBackstab, other, 10); } //Live AA - Chaotic Backstab @@ -570,7 +556,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { } if(IsClient()) - CastToClient()->CheckIncreaseSkill(SkillBackstab, other, 10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillBackstab, other, 10); } else { //We do a single regular attack if we attack from the front without chaotic stab Attack(other, EQEmu::legacy::SlotPrimary); @@ -613,12 +599,12 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) if(primaryweapondamage > 0){ if(level > 25){ - max_hit = (((((2*backstab_dmg) * GetDamageTable(SkillBackstab) / 100) * 10 * GetSkill(SkillBackstab) / 355) + ((level-25)/3) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); - hate = 20 * backstab_dmg * GetSkill(SkillBackstab) / 355; + max_hit = (((((2 * backstab_dmg) * GetDamageTable(EQEmu::skills::SkillBackstab) / 100) * 10 * GetSkill(EQEmu::skills::SkillBackstab) / 355) + ((level - 25) / 3) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); + hate = 20 * backstab_dmg * GetSkill(EQEmu::skills::SkillBackstab) / 355; } else{ - max_hit = (((((2*backstab_dmg) * GetDamageTable(SkillBackstab) / 100) * 10 * GetSkill(SkillBackstab) / 355) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); - hate = 20 * backstab_dmg * GetSkill(SkillBackstab) / 355; + max_hit = (((((2 * backstab_dmg) * GetDamageTable(EQEmu::skills::SkillBackstab) / 100) * 10 * GetSkill(EQEmu::skills::SkillBackstab) / 355) + 1) * ((100 + RuleI(Combat, BackstabBonus)) / 100)); + hate = 20 * backstab_dmg * GetSkill(EQEmu::skills::SkillBackstab) / 355; } // determine minimum hits @@ -630,7 +616,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) min_hit = (level * ( level*5 - 105)) / 100; } - if(!other->CheckHitChance(this, SkillBackstab, 0)) { + if (!other->CheckHitChance(this, EQEmu::skills::SkillBackstab, 0)) { ndamage = 0; } else{ @@ -655,14 +641,14 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) ndamage = mod_backstab_damage(ndamage); uint32 Assassinate_Dmg = 0; - Assassinate_Dmg = TryAssassinate(other, SkillBackstab, ReuseTime); + Assassinate_Dmg = TryAssassinate(other, EQEmu::skills::SkillBackstab, ReuseTime); if (Assassinate_Dmg) { ndamage = Assassinate_Dmg; entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); } - DoSpecialAttackDamage(other, SkillBackstab, ndamage, min_hit, hate, ReuseTime, false, false); + DoSpecialAttackDamage(other, EQEmu::skills::SkillBackstab, ndamage, min_hit, hate, ReuseTime, false, false); DoAnim(anim1HPiercing); } @@ -672,9 +658,9 @@ void Mob::RogueAssassinate(Mob* other) //can you dodge, parry, etc.. an assassinate?? //if so, use DoSpecialAttackDamage(other, BACKSTAB, 32000); instead if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary) : (const ItemInst*)nullptr) > 0){ - other->Damage(this, 32000, SPELL_UNKNOWN, SkillBackstab); + other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); }else{ - other->Damage(this, -5, SPELL_UNKNOWN, SkillBackstab); + other->Damage(this, -5, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); } DoAnim(anim1HPiercing); //piercing animation } @@ -807,7 +793,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { Log.Out(Logs::Detail, Logs::Combat, "Endless Quiver prevented ammo consumption."); } - CheckIncreaseSkill(SkillArchery, GetTarget(), -15); + CheckIncreaseSkill(EQEmu::skills::SkillArchery, GetTarget(), -15); CommonBreakInvisibleFromCombat(); } @@ -873,22 +859,22 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } else if (AmmoItem) - SendItemAnimation(other, AmmoItem, SkillArchery); + SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillArchery); - if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, EQEmu::legacy::SlotPrimary, chance_mod))) { + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, EQEmu::skills::SkillArchery, EQEmu::legacy::SlotPrimary, chance_mod))) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); + TryProjectileAttack(other, AmmoItem, EQEmu::skills::SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); return; } else - other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); + other->Damage(this, 0, SPELL_UNKNOWN, EQEmu::skills::SkillArchery); } else { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack hit %s.", other->GetName()); bool HeadShot = false; - uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); + uint32 HeadShot_Dmg = TryHeadShot(other, EQEmu::skills::SkillArchery); if (HeadShot_Dmg) HeadShot = true; @@ -904,7 +890,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite WDmg = weapon_damage; if (LaunchProjectile){//1: Shoot the Projectile once we calculate weapon damage. - TryProjectileAttack(other, AmmoItem, SkillArchery, (WDmg + ADmg), RangeWeapon, Ammo, AmmoSlot, speed); + TryProjectileAttack(other, AmmoItem, EQEmu::skills::SkillArchery, (WDmg + ADmg), RangeWeapon, Ammo, AmmoSlot, speed); return; } @@ -916,7 +902,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite WDmg = 0; if(ADmg < 0) ADmg = 0; - uint32 MaxDmg = (RuleR(Combat, ArcheryBaseDamageBonus)*(WDmg+ADmg)*GetDamageTable(SkillArchery)) / 100; + uint32 MaxDmg = (RuleR(Combat, ArcheryBaseDamageBonus)*(WDmg + ADmg)*GetDamageTable(EQEmu::skills::SkillArchery)) / 100; hate = ((WDmg+ADmg)); if (HeadShot) @@ -968,7 +954,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite //twice, for ammo and weapon TotalDmg += (2*((GetLevel()-25)/3)); minDmg += (2*((GetLevel()-25)/3)); - minDmg += minDmg * GetMeleeMinDamageMod_SE(SkillArchery) / 100; + minDmg += minDmg * GetMeleeMinDamageMod_SE(EQEmu::skills::SkillArchery) / 100; hate += (2*((GetLevel()-25)/3)); } @@ -977,7 +963,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite other->MeleeMitigation(this, TotalDmg, minDmg); if(TotalDmg > 0){ - CommonOutgoingHitSuccess(other, TotalDmg, SkillArchery); + CommonOutgoingHitSuccess(other, TotalDmg, EQEmu::skills::SkillArchery); TotalDmg = mod_archery_damage(TotalDmg, dobonus, RangeWeapon); } } @@ -990,14 +976,14 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (IsClient() && !CastToClient()->GetFeigned()) other->AddToHateList(this, hate, 0, false); - other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillArchery); + other->Damage(this, TotalDmg, SPELL_UNKNOWN, EQEmu::skills::SkillArchery); //Skill Proc Success if (TotalDmg > 0 && HasSkillProcSuccess() && other && !other->HasDied()){ if (ReuseTime) - TrySkillProc(other, SkillArchery, ReuseTime); + TrySkillProc(other, EQEmu::skills::SkillArchery, ReuseTime); else - TrySkillProc(other, SkillArchery, 0, true, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillArchery, 0, true, EQEmu::legacy::SlotRange); } } @@ -1017,13 +1003,13 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite //Skill Proc if (HasSkillProcs() && other && !other->HasDied()){ if (ReuseTime) - TrySkillProc(other, SkillArchery, ReuseTime); + TrySkillProc(other, EQEmu::skills::SkillArchery, ReuseTime); else - TrySkillProc(other, SkillArchery, 0, false, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillArchery, 0, false, EQEmu::legacy::SlotRange); } } -bool Mob::TryProjectileAttack(Mob* other, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed){ +bool Mob::TryProjectileAttack(Mob* other, const EQEmu::Item_Struct *item, EQEmu::skills::SkillType skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed){ if (!other) return false; @@ -1108,21 +1094,21 @@ void Mob::ProjectileAttack() if (target){ if (IsNPC()){ - if (ProjectileAtk[i].skill == SkillConjuration){ + if (ProjectileAtk[i].skill == EQEmu::skills::SkillConjuration){ if (IsValidSpell(ProjectileAtk[i].wpn_dmg)) SpellOnTarget(ProjectileAtk[i].wpn_dmg, target, false, true, spells[ProjectileAtk[i].wpn_dmg].ResistDiff, true); } else - CastToNPC()->DoRangedAttackDmg(target, false, ProjectileAtk[i].wpn_dmg,0, static_cast(ProjectileAtk[i].skill)); + CastToNPC()->DoRangedAttackDmg(target, false, ProjectileAtk[i].wpn_dmg, 0, static_cast(ProjectileAtk[i].skill)); } else { - if (ProjectileAtk[i].skill == SkillArchery) + if (ProjectileAtk[i].skill == EQEmu::skills::SkillArchery) DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); - else if (ProjectileAtk[i].skill == SkillThrowing) + else if (ProjectileAtk[i].skill == EQEmu::skills::SkillThrowing) DoThrowingAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0, ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_slot); - else if (ProjectileAtk[i].skill == SkillConjuration && IsValidSpell(ProjectileAtk[i].wpn_dmg)) + else if (ProjectileAtk[i].skill == EQEmu::skills::SkillConjuration && IsValidSpell(ProjectileAtk[i].wpn_dmg)) SpellOnTarget(ProjectileAtk[i].wpn_dmg, target, false, true, spells[ProjectileAtk[i].wpn_dmg].ResistDiff, true); } } @@ -1247,7 +1233,7 @@ void NPC::RangedAttack(Mob* other) } } -void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 chance_mod, SkillUseTypes skill, float speed, const char *IDFile) { +void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 chance_mod, EQEmu::skills::SkillType skill, float speed, const char *IDFile) { if ((other == nullptr || (other->HasDied())) || @@ -1259,7 +1245,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha return; } - SkillUseTypes skillInUse = static_cast(GetRangedSkill()); + EQEmu::skills::SkillType skillInUse = static_cast(GetRangedSkill()); if (skill != skillInUse) skillInUse = skill; @@ -1334,7 +1320,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha } uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) { - uint16 MaxDmg = (((2 * wDmg) * GetDamageTable(SkillThrowing)) / 100); + uint16 MaxDmg = (((2 * wDmg) * GetDamageTable(EQEmu::skills::SkillThrowing)) / 100); if (MaxDmg == 0) MaxDmg = 1; @@ -1348,7 +1334,7 @@ uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) { if(GetLevel() > 25){ TotalDmg += ((GetLevel()-25)/3); minDmg += ((GetLevel()-25)/3); - minDmg += minDmg * GetMeleeMinDamageMod_SE(SkillThrowing) / 100; + minDmg += minDmg * GetMeleeMinDamageMod_SE(EQEmu::skills::SkillThrowing) / 100; } if(MaxDmg < minDmg) @@ -1438,7 +1424,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //consume ammo DeleteItemInInventory(ammo_slot, 1, true); - CheckIncreaseSkill(SkillThrowing, GetTarget()); + CheckIncreaseSkill(EQEmu::skills::SkillThrowing, GetTarget()); CommonBreakInvisibleFromCombat(); } @@ -1491,16 +1477,16 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE } } else if (AmmoItem) - SendItemAnimation(other, AmmoItem, SkillThrowing); + SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillThrowing); - if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, EQEmu::legacy::SlotPrimary, chance_mod))){ + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, EQEmu::skills::SkillThrowing, EQEmu::legacy::SlotPrimary, chance_mod))){ Log.Out(Logs::Detail, Logs::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); + TryProjectileAttack(other, AmmoItem, EQEmu::skills::SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; } else - other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); + other->Damage(this, 0, SPELL_UNKNOWN, EQEmu::skills::SkillThrowing); } else { Log.Out(Logs::Detail, Logs::Combat, "Throwing attack hit %s.", other->GetName()); @@ -1513,7 +1499,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE WDmg = GetWeaponDamage(other, AmmoItem); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillThrowing, WDmg, RangeWeapon, nullptr, AmmoSlot, speed); + TryProjectileAttack(other, AmmoItem, EQEmu::skills::SkillThrowing, WDmg, RangeWeapon, nullptr, AmmoSlot, speed); return; } } @@ -1527,7 +1513,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE uint32 Assassinate_Dmg = 0; if (GetClass() == ROGUE && (BehindMob(other, GetX(), GetY()))) - Assassinate_Dmg = TryAssassinate(other, SkillThrowing, ranged_timer.GetDuration()); + Assassinate_Dmg = TryAssassinate(other, EQEmu::skills::SkillThrowing, ranged_timer.GetDuration()); if(WDmg > 0){ int minDmg = 1; @@ -1544,7 +1530,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE other->MeleeMitigation(this, TotalDmg, minDmg); if(TotalDmg > 0) - CommonOutgoingHitSuccess(other, TotalDmg, SkillThrowing); + CommonOutgoingHitSuccess(other, TotalDmg, EQEmu::skills::SkillThrowing); } else @@ -1553,13 +1539,13 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE if (IsClient() && !CastToClient()->GetFeigned()) other->AddToHateList(this, 2*WDmg, 0, false); - other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillThrowing); + other->Damage(this, TotalDmg, SPELL_UNKNOWN, EQEmu::skills::SkillThrowing); if (TotalDmg > 0 && HasSkillProcSuccess() && other && !other->HasDied()){ if (ReuseTime) - TrySkillProc(other, SkillThrowing, ReuseTime); + TrySkillProc(other, EQEmu::skills::SkillThrowing, ReuseTime); else - TrySkillProc(other, SkillThrowing, 0, true, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, true, EQEmu::legacy::SlotRange); } } @@ -1574,13 +1560,13 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE if (HasSkillProcs() && other && !other->HasDied()){ if (ReuseTime) - TrySkillProc(other, SkillThrowing, ReuseTime); + TrySkillProc(other, EQEmu::skills::SkillThrowing, ReuseTime); else - TrySkillProc(other, SkillThrowing, 0, false, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, false, EQEmu::legacy::SlotRange); } } -void Mob::SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, float velocity) { +void Mob::SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, EQEmu::skills::SkillType skillInUse, float velocity) { auto outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); Arrow_Struct *as = (Arrow_Struct *) outapp->pBuffer; as->type = 1; @@ -1626,7 +1612,7 @@ void Mob::SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, SkillUseTyp safe_delete(outapp); } -void Mob::ProjectileAnimation(Mob* to, int item_id, bool IsArrow, float speed, float angle, float tilt, float arc, const char *IDFile, SkillUseTypes skillInUse) { +void Mob::ProjectileAnimation(Mob* to, int item_id, bool IsArrow, float speed, float angle, float tilt, float arc, const char *IDFile, EQEmu::skills::SkillType skillInUse) { if (!to) return; @@ -1753,12 +1739,12 @@ void NPC::DoClassAttacks(Mob *target) { } break; case MONK: case MONKGM: { - uint8 satype = SkillKick; - if(level > 29) { satype = SkillFlyingKick; } - else if(level > 24) { satype = SkillDragonPunch; } - else if(level > 19) { satype = SkillEagleStrike; } - else if(level > 9) { satype = SkillTigerClaw; } - else if(level > 4) { satype = SkillRoundKick; } + uint8 satype = EQEmu::skills::SkillKick; + if (level > 29) { satype = EQEmu::skills::SkillFlyingKick; } + else if (level > 24) { satype = EQEmu::skills::SkillDragonPunch; } + else if (level > 19) { satype = EQEmu::skills::SkillEagleStrike; } + else if (level > 9) { satype = EQEmu::skills::SkillTigerClaw; } + else if (level > 4) { satype = EQEmu::skills::SkillRoundKick; } reuse = MonkSpecialAttack(target, satype); reuse *= 1000; @@ -1775,7 +1761,7 @@ void NPC::DoClassAttacks(Mob *target) { dmg = -5; } else{ - if(target->CheckHitChance(this, SkillKick, 0)) { + if (target->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else @@ -1785,7 +1771,7 @@ void NPC::DoClassAttacks(Mob *target) { } reuse = (KickReuseTime + 3) * 1000; - DoSpecialAttackDamage(target, SkillKick, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillKick, dmg, 1, -1, reuse); did_attack = true; } else { @@ -1796,7 +1782,7 @@ void NPC::DoClassAttacks(Mob *target) { dmg = -5; } else{ - if(target->CheckHitChance(this, SkillBash, 0)) { + if (target->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else @@ -1805,7 +1791,7 @@ void NPC::DoClassAttacks(Mob *target) { } reuse = (BashReuseTime + 3) * 1000; - DoSpecialAttackDamage(target, SkillBash, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillBash, dmg, 1, -1, reuse); did_attack = true; } } @@ -1829,7 +1815,7 @@ void NPC::DoClassAttacks(Mob *target) { while(AtkRounds > 0) { if (GetTarget() && (AtkRounds == 1 || zone->random.Roll(75))) { - DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, -1 , reuse, true); + DoSpecialAttackDamage(GetTarget(), EQEmu::skills::SkillFrenzy, max_dmg, min_dmg, -1, reuse, true); } AtkRounds--; } @@ -1849,7 +1835,7 @@ void NPC::DoClassAttacks(Mob *target) { dmg = -5; } else{ - if(target->CheckHitChance(this, SkillKick, 0)) { + if (target->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else @@ -1858,7 +1844,7 @@ void NPC::DoClassAttacks(Mob *target) { } reuse = (KickReuseTime + 3) * 1000; - DoSpecialAttackDamage(target, SkillKick, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillKick, dmg, 1, -1, reuse); did_attack = true; } break; @@ -1874,7 +1860,7 @@ void NPC::DoClassAttacks(Mob *target) { dmg = -5; } else{ - if(target->CheckHitChance(this, SkillBash, 0)) { + if (target->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else @@ -1883,7 +1869,7 @@ void NPC::DoClassAttacks(Mob *target) { } reuse = (BashReuseTime + 3) * 1000; - DoSpecialAttackDamage(target, SkillBash, dmg, 1, -1, reuse); + DoSpecialAttackDamage(target, EQEmu::skills::SkillBash, dmg, 1, -1, reuse); did_attack = true; } break; @@ -1925,43 +1911,43 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) case WARRIOR: case RANGER: case BEASTLORD: - skill_to_use = SkillKick; + skill_to_use = EQEmu::skills::SkillKick; break; case BERSERKER: - skill_to_use = SkillFrenzy; + skill_to_use = EQEmu::skills::SkillFrenzy; break; case SHADOWKNIGHT: case PALADIN: - skill_to_use = SkillBash; + skill_to_use = EQEmu::skills::SkillBash; break; case MONK: if(GetLevel() >= 30) { - skill_to_use = SkillFlyingKick; + skill_to_use = EQEmu::skills::SkillFlyingKick; } else if(GetLevel() >= 25) { - skill_to_use = SkillDragonPunch; + skill_to_use = EQEmu::skills::SkillDragonPunch; } else if(GetLevel() >= 20) { - skill_to_use = SkillEagleStrike; + skill_to_use = EQEmu::skills::SkillEagleStrike; } else if(GetLevel() >= 10) { - skill_to_use = SkillTigerClaw; + skill_to_use = EQEmu::skills::SkillTigerClaw; } else if(GetLevel() >= 5) { - skill_to_use = SkillRoundKick; + skill_to_use = EQEmu::skills::SkillRoundKick; } else { - skill_to_use = SkillKick; + skill_to_use = EQEmu::skills::SkillKick; } break; case ROGUE: - skill_to_use = SkillBackstab; + skill_to_use = EQEmu::skills::SkillBackstab; break; } } @@ -1972,7 +1958,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if(skill_to_use == -1) return; - if(skill_to_use == SkillBash) { + if (skill_to_use == EQEmu::skills::SkillBash) { if (ca_target!=this) { DoAnim(animTailRake); @@ -1980,7 +1966,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) dmg = -5; } else{ - if(!ca_target->CheckHitChance(this, SkillBash, 0)) { + if (!ca_target->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) { dmg = 0; } else{ @@ -1994,7 +1980,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) ReuseTime = (BashReuseTime - 1) / HasteMod; - DoSpecialAttackDamage(ca_target, SkillBash, dmg, 1,-1,ReuseTime); + DoSpecialAttackDamage(ca_target, EQEmu::skills::SkillBash, dmg, 1, -1, ReuseTime); if(ReuseTime > 0 && !IsRiposte) { p_timers.Start(pTimerCombatAbility, ReuseTime); @@ -2003,10 +1989,10 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) return; } - if(skill_to_use == SkillFrenzy){ - CheckIncreaseSkill(SkillFrenzy, GetTarget(), 10); + if (skill_to_use == EQEmu::skills::SkillFrenzy){ + CheckIncreaseSkill(EQEmu::skills::SkillFrenzy, GetTarget(), 10); int AtkRounds = 3; - int skillmod = 100*GetSkill(SkillFrenzy)/MaxSkill(SkillFrenzy); + int skillmod = 100 * GetSkill(EQEmu::skills::SkillFrenzy) / MaxSkill(EQEmu::skills::SkillFrenzy); int32 max_dmg = (26 + ((((GetLevel()-6) * 2)*skillmod)/100)) * ((100+RuleI(Combat, FrenzyBonus))/100); int32 min_dmg = 0; DoAnim(anim2HSlashing); @@ -2025,7 +2011,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) while(AtkRounds > 0) { if (GetTarget() && (AtkRounds == 1 || zone->random.Roll(75))) { - DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, max_dmg , ReuseTime, true); + DoSpecialAttackDamage(GetTarget(), EQEmu::skills::SkillFrenzy, max_dmg, min_dmg, max_dmg, ReuseTime, true); } AtkRounds--; } @@ -2036,7 +2022,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) return; } - if(skill_to_use == SkillKick){ + if (skill_to_use == EQEmu::skills::SkillKick){ if(ca_target!=this){ DoAnim(animKick); @@ -2044,7 +2030,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) dmg = -5; } else{ - if(!ca_target->CheckHitChance(this, SkillKick, 0)) { + if (!ca_target->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) { dmg = 0; } else{ @@ -2057,11 +2043,11 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) ReuseTime = KickReuseTime-1; - DoSpecialAttackDamage(ca_target, SkillKick, dmg, 1,-1, ReuseTime); + DoSpecialAttackDamage(ca_target, EQEmu::skills::SkillKick, dmg, 1, -1, ReuseTime); } } - if(skill_to_use == SkillFlyingKick || skill_to_use == SkillDragonPunch || skill_to_use == SkillEagleStrike || skill_to_use == SkillTigerClaw || skill_to_use == SkillRoundKick) { + if (skill_to_use == EQEmu::skills::SkillFlyingKick || skill_to_use == EQEmu::skills::SkillDragonPunch || skill_to_use == EQEmu::skills::SkillEagleStrike || skill_to_use == EQEmu::skills::SkillTigerClaw || skill_to_use == EQEmu::skills::SkillRoundKick) { ReuseTime = MonkSpecialAttack(ca_target, skill_to_use) - 1; MonkSpecialAttack(ca_target, skill_to_use); @@ -2072,7 +2058,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; if (wuchance) { if (wuchance >= 100 || zone->random.Roll(wuchance)) { - int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; + int MonkSPA[5] = { EQEmu::skills::SkillFlyingKick, EQEmu::skills::SkillDragonPunch, EQEmu::skills::SkillEagleStrike, EQEmu::skills::SkillTigerClaw, EQEmu::skills::SkillRoundKick }; int extra = 1; if (zone->random.Roll(wuchance / 4)) extra++; @@ -2088,7 +2074,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) } } - if(skill_to_use == SkillBackstab){ + if (skill_to_use == EQEmu::skills::SkillBackstab){ ReuseTime = BackstabReuseTime-1; if (IsRiposte) @@ -2115,7 +2101,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus, bool FromSpel return; if(!always_succeed && IsClient()) - CastToClient()->CheckIncreaseSkill(SkillTaunt, who, 10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillTaunt, who, 10); Mob *hate_top = who->GetHateMost(); @@ -2154,7 +2140,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus, bool FromSpel //TauntSkillFalloff rate is not based on any real data. Default of 33% gives a reasonable result. if (IsClient() && !always_succeed) - tauntchance -= (RuleR(Combat,TauntSkillFalloff) * (CastToClient()->MaxSkill(SkillTaunt) - GetSkill(SkillTaunt))); + tauntchance -= (RuleR(Combat, TauntSkillFalloff) * (CastToClient()->MaxSkill(EQEmu::skills::SkillTaunt) - GetSkill(EQEmu::skills::SkillTaunt))); //From SE_Taunt (Does a taunt with a chance modifier) if (chance_bonus) @@ -2186,10 +2172,10 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus, bool FromSpel Message_StringID(MT_SpellFailure,FAILED_TAUNT); if (HasSkillProcs()) - TrySkillProc(who, SkillTaunt, TauntReuseTime*1000); + TrySkillProc(who, EQEmu::skills::SkillTaunt, TauntReuseTime * 1000); if (Success && HasSkillProcSuccess()) - TrySkillProc(who, SkillTaunt, TauntReuseTime*1000, true); + TrySkillProc(who, EQEmu::skills::SkillTaunt, TauntReuseTime * 1000, true); } @@ -2209,14 +2195,14 @@ void Mob::InstillDoubt(Mob *who) { return; if(IsClient()) { - CastToClient()->CheckIncreaseSkill(SkillIntimidation, who, 10); + CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillIntimidation, who, 10); } //I think this formula needs work int value = 0; //user's bonus - value += GetSkill(SkillIntimidation) + GetCHA()/4; + value += GetSkill(EQEmu::skills::SkillIntimidation) + GetCHA() / 4; //target's counters value -= target->GetLevel()*4 + who->GetWIS()/4; @@ -2238,10 +2224,10 @@ void Mob::InstillDoubt(Mob *who) { } } -uint32 Mob::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { +uint32 Mob::TryHeadShot(Mob* defender, EQEmu::skills::SkillType skillInUse) { //Only works on YOUR target. if(defender && (defender->GetBodyType() == BT_Humanoid) && !defender->IsClient() - && (skillInUse == SkillArchery) && (GetTarget() == defender)) { + && (skillInUse == EQEmu::skills::SkillArchery) && (GetTarget() == defender)) { uint32 HeadShot_Dmg = aabonuses.HeadShot[1] + spellbonuses.HeadShot[1] + itembonuses.HeadShot[1]; uint8 HeadShot_Level = 0; //Get Highest Headshot Level @@ -2289,10 +2275,10 @@ float Mob::GetSpecialProcChances(uint16 hand) return ProcChance; } -uint32 Mob::TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 ReuseTime) { +uint32 Mob::TryAssassinate(Mob* defender, EQEmu::skills::SkillType skillInUse, uint16 ReuseTime) { if(defender && (defender->GetBodyType() == BT_Humanoid) && !defender->IsClient() && - (skillInUse == SkillBackstab || skillInUse == SkillThrowing)) { + (skillInUse == EQEmu::skills::SkillBackstab || skillInUse == EQEmu::skills::SkillThrowing)) { uint32 Assassinate_Dmg = aabonuses.Assassinate[1] + spellbonuses.Assassinate[1] + itembonuses.Assassinate[1]; @@ -2314,7 +2300,7 @@ uint32 Mob::TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 Reuse if(Assassinate_Dmg && Assassinate_Level && (defender->GetLevel() <= Assassinate_Level)){ float ProcChance = 0.0f; - if (skillInUse == SkillThrowing) + if (skillInUse == EQEmu::skills::SkillThrowing) ProcChance = GetSpecialProcChances(EQEmu::legacy::SlotRange); else ProcChance = GetAssassinateProcChances(ReuseTime); @@ -2352,7 +2338,7 @@ float Mob::GetAssassinateProcChances(uint16 ReuseTime) return ProcChance; } -void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime) +void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills::SkillType skillinuse, int16 chance_mod, int16 focus, bool CanRiposte, int ReuseTime) { if (!CanDoSpecialAttack(other)) return; @@ -2361,8 +2347,8 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes For spells using skill value 98 (feral swipe ect) server sets this to 67 automatically. Kayen: This is unlikely to be completely accurate but use OFFENSE skill value for these effects. */ - if (skillinuse == SkillBegging) - skillinuse = SkillOffense; + if (skillinuse == EQEmu::skills::SkillBegging) + skillinuse = EQEmu::skills::SkillOffense; int damage = 0; uint32 hate = 0; @@ -2388,7 +2374,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes hate += ucDamageBonus; } - if(skillinuse == SkillBash){ + if (skillinuse == EQEmu::skills::SkillBash){ if(IsClient()){ ItemInst *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); if(item){ @@ -2433,8 +2419,8 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes damage = -5; bool CanSkillProc = true; - if (skillinuse == SkillOffense){ //Hack to allow damage to display. - skillinuse = SkillTigerClaw; //'strike' your opponent - Arbitrary choice for message. + if (skillinuse == EQEmu::skills::SkillOffense){ //Hack to allow damage to display. + skillinuse = EQEmu::skills::SkillTigerClaw; //'strike' your opponent - Arbitrary choice for message. CanSkillProc = false; //Disable skill procs } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 35d1c64bd..6508d6fc6 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2271,18 +2271,15 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove focus = caster->GetFocusEffect(focusFcBaseEffects, spell_id); - switch(spells[spell_id].skill) - { - case SkillThrowing: - caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i], focus, ReuseTime); + switch(spells[spell_id].skill) { + case EQEmu::skills::SkillThrowing: + caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i], focus, ReuseTime); break; - - case SkillArchery: - caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i],focus, ReuseTime); + case EQEmu::skills::SkillArchery: + caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i],focus, ReuseTime); break; - - default: - caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base[i], spells[spell_id].skill, spells[spell_id].base2[i], focus, false, ReuseTime); + default: + caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base[i], spells[spell_id].skill, spells[spell_id].base2[i], focus, false, ReuseTime); break; } break; @@ -3046,7 +3043,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, effect_value = CalcSpellEffectValue_formula(formula, base, max, caster_level, spell_id, ticsremaining); // this doesn't actually need to be a song to get mods, just the right skill - if (EQEmu::IsBardInstrumentSkill(spells[spell_id].skill) && + if (EQEmu::skills::IsBardInstrumentSkill(spells[spell_id].skill) && spells[spell_id].effectid[effect_id] != SE_AttackSpeed && spells[spell_id].effectid[effect_id] != SE_AttackSpeed2 && spells[spell_id].effectid[effect_id] != SE_AttackSpeed3 && @@ -3613,13 +3610,13 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster) if (!IsBardSong(buff.spellid)) { double break_chance = 2.0; if (caster) { - break_chance -= (2 * (((double)caster->GetSkill(SkillDivination) + + break_chance -= (2 * (((double)caster->GetSkill(EQEmu::skills::SkillDivination) + ((double)caster->GetLevel() * 3.0)) / 650.0)); } else { break_chance -= (2 * - (((double)GetSkill(SkillDivination) + ((double)GetLevel() * 3.0)) / + (((double)GetSkill(EQEmu::skills::SkillDivination) + ((double)GetLevel() * 3.0)) / 650.0)); } @@ -6564,7 +6561,7 @@ bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id, float speed){ ProjectileAtk[slot].origin_x = GetX(); ProjectileAtk[slot].origin_y = GetY(); ProjectileAtk[slot].origin_z = GetZ(); - ProjectileAtk[slot].skill = SkillConjuration; + ProjectileAtk[slot].skill = EQEmu::skills::SkillConjuration; ProjectileAtk[slot].speed_mod = speed_mod; SetProjectileAttack(true); @@ -6619,7 +6616,7 @@ void Mob::ResourceTap(int32 damage, uint16 spellid) if (damage > 0) HealDamage(damage); else - Damage(this, -damage, 0, SkillEvocation, false); + Damage(this, -damage, 0, EQEmu::skills::SkillEvocation, false); } if (spells[spellid].base2[i] == 1) // Mana Tap diff --git a/zone/spells.cpp b/zone/spells.cpp index f4eb422cb..c48baa00d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -556,16 +556,16 @@ bool Mob::DoCastingChecks() uint16 Mob::GetSpecializeSkillValue(uint16 spell_id) const { switch(spells[spell_id].skill) { - case SkillAbjuration: - return(GetSkill(SkillSpecializeAbjure)); - case SkillAlteration: - return(GetSkill(SkillSpecializeAlteration)); - case SkillConjuration: - return(GetSkill(SkillSpecializeConjuration)); - case SkillDivination: - return(GetSkill(SkillSpecializeDivination)); - case SkillEvocation: - return(GetSkill(SkillSpecializeEvocation)); + case EQEmu::skills::SkillAbjuration: + return(GetSkill(EQEmu::skills::SkillSpecializeAbjure)); + case EQEmu::skills::SkillAlteration: + return(GetSkill(EQEmu::skills::SkillSpecializeAlteration)); + case EQEmu::skills::SkillConjuration: + return(GetSkill(EQEmu::skills::SkillSpecializeConjuration)); + case EQEmu::skills::SkillDivination: + return(GetSkill(EQEmu::skills::SkillSpecializeDivination)); + case EQEmu::skills::SkillEvocation: + return(GetSkill(EQEmu::skills::SkillSpecializeEvocation)); default: //wtf... break; @@ -584,20 +584,20 @@ void Client::CheckSpecializeIncrease(uint16 spell_id) { */ switch(spells[spell_id].skill) { - case SkillAbjuration: - CheckIncreaseSkill(SkillSpecializeAbjure, nullptr); + case EQEmu::skills::SkillAbjuration: + CheckIncreaseSkill(EQEmu::skills::SkillSpecializeAbjure, nullptr); break; - case SkillAlteration: - CheckIncreaseSkill(SkillSpecializeAlteration, nullptr); + case EQEmu::skills::SkillAlteration: + CheckIncreaseSkill(EQEmu::skills::SkillSpecializeAlteration, nullptr); break; - case SkillConjuration: - CheckIncreaseSkill(SkillSpecializeConjuration, nullptr); + case EQEmu::skills::SkillConjuration: + CheckIncreaseSkill(EQEmu::skills::SkillSpecializeConjuration, nullptr); break; - case SkillDivination: - CheckIncreaseSkill(SkillSpecializeDivination, nullptr); + case EQEmu::skills::SkillDivination: + CheckIncreaseSkill(EQEmu::skills::SkillSpecializeDivination, nullptr); break; - case SkillEvocation: - CheckIncreaseSkill(SkillSpecializeEvocation, nullptr); + case EQEmu::skills::SkillEvocation: + CheckIncreaseSkill(EQEmu::skills::SkillSpecializeEvocation, nullptr); break; default: //wtf... @@ -617,48 +617,48 @@ void Client::CheckSongSkillIncrease(uint16 spell_id){ switch(spells[spell_id].skill) { - case SkillSinging: - CheckIncreaseSkill(SkillSinging, nullptr, -15); + case EQEmu::skills::SkillSinging: + CheckIncreaseSkill(EQEmu::skills::SkillSinging, nullptr, -15); break; - case SkillPercussionInstruments: + case EQEmu::skills::SkillPercussionInstruments: if(this->itembonuses.percussionMod > 0) { - if(GetRawSkill(SkillPercussionInstruments) > 0) // no skill increases if not trained in the instrument - CheckIncreaseSkill(SkillPercussionInstruments, nullptr, -15); + if (GetRawSkill(EQEmu::skills::SkillPercussionInstruments) > 0) // no skill increases if not trained in the instrument + CheckIncreaseSkill(EQEmu::skills::SkillPercussionInstruments, nullptr, -15); else Message_StringID(13,NO_INSTRUMENT_SKILL); // tell the client that they need instrument training } else - CheckIncreaseSkill(SkillSinging, nullptr, -15); + CheckIncreaseSkill(EQEmu::skills::SkillSinging, nullptr, -15); break; - case SkillStringedInstruments: + case EQEmu::skills::SkillStringedInstruments: if(this->itembonuses.stringedMod > 0) { - if(GetRawSkill(SkillStringedInstruments) > 0) - CheckIncreaseSkill(SkillStringedInstruments, nullptr, -15); + if (GetRawSkill(EQEmu::skills::SkillStringedInstruments) > 0) + CheckIncreaseSkill(EQEmu::skills::SkillStringedInstruments, nullptr, -15); else Message_StringID(13,NO_INSTRUMENT_SKILL); } else - CheckIncreaseSkill(SkillSinging, nullptr, -15); + CheckIncreaseSkill(EQEmu::skills::SkillSinging, nullptr, -15); break; - case SkillWindInstruments: + case EQEmu::skills::SkillWindInstruments: if(this->itembonuses.windMod > 0) { - if(GetRawSkill(SkillWindInstruments) > 0) - CheckIncreaseSkill(SkillWindInstruments, nullptr, -15); + if (GetRawSkill(EQEmu::skills::SkillWindInstruments) > 0) + CheckIncreaseSkill(EQEmu::skills::SkillWindInstruments, nullptr, -15); else Message_StringID(13,NO_INSTRUMENT_SKILL); } else - CheckIncreaseSkill(SkillSinging, nullptr, -15); + CheckIncreaseSkill(EQEmu::skills::SkillSinging, nullptr, -15); break; - case SkillBrassInstruments: + case EQEmu::skills::SkillBrassInstruments: if(this->itembonuses.brassMod > 0) { - if(GetRawSkill(SkillBrassInstruments) > 0) - CheckIncreaseSkill(SkillBrassInstruments, nullptr, -15); + if (GetRawSkill(EQEmu::skills::SkillBrassInstruments) > 0) + CheckIncreaseSkill(EQEmu::skills::SkillBrassInstruments, nullptr, -15); else Message_StringID(13,NO_INSTRUMENT_SKILL); } else - CheckIncreaseSkill(SkillSinging, nullptr, -15); + CheckIncreaseSkill(EQEmu::skills::SkillSinging, nullptr, -15); break; default: break; @@ -991,7 +991,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, channelbonuses += spellbonuses.ChannelChanceSpells + itembonuses.ChannelChanceSpells + aabonuses.ChannelChanceSpells; // max 93% chance at 252 skill - channelchance = 30 + GetSkill(SkillChanneling) / 400.0f * 100; + channelchance = 30 + GetSkill(EQEmu::skills::SkillChanneling) / 400.0f * 100; channelchance -= attacked_count * 2; channelchance += channelchance * channelbonuses / 100.0f; } @@ -1005,7 +1005,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, channelbonuses += spellbonuses.ChannelChanceSpells + itembonuses.ChannelChanceSpells + aabonuses.ChannelChanceSpells; // max 93% chance at 252 skill - channelchance = 30 + GetSkill(SkillChanneling) / 400.0f * 100; + channelchance = 30 + GetSkill(EQEmu::skills::SkillChanneling) / 400.0f * 100; channelchance -= attacked_count * 2; channelchance += channelchance * channelbonuses / 100.0f; } @@ -1037,7 +1037,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - Log.Out(Logs::Detail, Logs::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); + Log.Out(Logs::Detail, Logs::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(EQEmu::skills::SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: interrupted.", spell_id); @@ -1330,7 +1330,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, c->CheckIncreaseSkill(spells[spell_id].skill, nullptr); // increased chance of gaining channel skill if you regained concentration - c->CheckIncreaseSkill(SkillChanneling, nullptr, regain_conc ? 5 : 0); + c->CheckIncreaseSkill(EQEmu::skills::SkillChanneling, nullptr, regain_conc ? 5 : 0); c->CheckSpecializeIncrease(spell_id); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index fb5c867c9..0fc22dffa 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -29,6 +29,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) #include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" +#include "../common/say_link.h" #include "client.h" #include "entity.h" diff --git a/zone/titles.cpp b/zone/titles.cpp index 1e0cc7cb7..388f12997 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -46,7 +46,7 @@ bool TitleManager::LoadTitles() for (auto row = results.begin(); row != results.end(); ++row) { TitleEntry Title; Title.TitleID = atoi(row[0]); - Title.SkillID = (SkillUseTypes) atoi(row[1]); + Title.SkillID = (EQEmu::skills::SkillType) atoi(row[1]); Title.MinSkillValue = atoi(row[2]); Title.MaxSkillValue = atoi(row[3]); Title.MinAAPoints = atoi(row[4]); @@ -187,10 +187,10 @@ bool TitleManager::IsClientEligibleForTitle(Client *c, std::vector:: if(Title->SkillID >= 0) { - if((Title->MinSkillValue >= 0) && (c->GetRawSkill(static_cast(Title->SkillID)) < static_cast(Title->MinSkillValue))) + if ((Title->MinSkillValue >= 0) && (c->GetRawSkill(static_cast(Title->SkillID)) < static_cast(Title->MinSkillValue))) return false; - if((Title->MaxSkillValue >= 0) && (c->GetRawSkill(static_cast(Title->SkillID)) > static_cast(Title->MaxSkillValue))) + if ((Title->MaxSkillValue >= 0) && (c->GetRawSkill(static_cast(Title->SkillID)) > static_cast(Title->MaxSkillValue))) return false; } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 2a3a3cdfe..6c0dc667a 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -36,7 +36,7 @@ extern QueryServ* QServ; -static const SkillUseTypes TradeskillUnknown = Skill1HBlunt; /* an arbitrary non-tradeskill */ +static const EQEmu::skills::SkillType TradeskillUnknown = EQEmu::skills::Skill1HBlunt; /* an arbitrary non-tradeskill */ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augment, Object *worldo) { @@ -363,7 +363,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } //changing from a switch to string of if's since we don't need to iterate through all of the skills in the SkillType enum - if (spec.tradeskill == SkillAlchemy) { + if (spec.tradeskill == EQEmu::skills::SkillAlchemy) { if (user_pp.class_ != SHAMAN) { user->Message(13, "This tradeskill can only be performed by a shaman."); return; @@ -373,13 +373,13 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob return; } } - else if (spec.tradeskill == SkillTinkering) { + else if (spec.tradeskill == EQEmu::skills::SkillTinkering) { if (user_pp.race != GNOME) { user->Message(13, "Only gnomes can tinker."); return; } } - else if (spec.tradeskill == SkillMakePoison) { + else if (spec.tradeskill == EQEmu::skills::SkillMakePoison) { if (user_pp.class_ != ROGUE) { user->Message(13, "Only rogues can mix poisons."); return; @@ -604,17 +604,17 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac parse->EventPlayer(EVENT_COMBINE_FAILURE, user, spec.name.c_str(), spec.recipe_id); } -SkillUseTypes Object::TypeToSkill(uint32 type) +EQEmu::skills::SkillType Object::TypeToSkill(uint32 type) { switch(type) { // grouped and ordered by SkillUseTypes name - new types need to be verified for proper SkillUseTypes and use /*SkillAlchemy*/ case EQEmu::item::BagTypeMedicineBag: - return SkillAlchemy; + return EQEmu::skills::SkillAlchemy; /*SkillBaking*/ //case EQEmu::item::BagTypeMixingBowl: // No idea... case EQEmu::item::BagTypeOven: - return SkillBaking; + return EQEmu::skills::SkillBaking; /*SkillBlacksmithing*/ case EQEmu::item::BagTypeForge: @@ -632,25 +632,25 @@ SkillUseTypes Object::TypeToSkill(uint32 type) case EQEmu::item::BagTypeValeForge: //case EQEmu::item::BagTypeErudForge: //case EQEmu::item::BagTypeGuktaForge: - return SkillBlacksmithing; + return EQEmu::skills::SkillBlacksmithing; /*SkillBrewing*/ //case EQEmu::item::BagTypeIceCreamChurn: // No idea... case EQEmu::item::BagTypeBrewBarrel: - return SkillBrewing; + return EQEmu::skills::SkillBrewing; /*SkillFishing*/ case EQEmu::item::BagTypeTackleBox: - return SkillFishing; + return EQEmu::skills::SkillFishing; /*SkillFletching*/ case EQEmu::item::BagTypeFletchingKit: //case EQEmu::item::BagTypeFierDalFletchingKit: - return SkillFletching; + return EQEmu::skills::SkillFletching; /*SkillJewelryMaking*/ case EQEmu::item::BagTypeJewelersKit: - return SkillJewelryMaking; + return EQEmu::skills::SkillJewelryMaking; /*SkillMakePoison*/ // This is a guess and needs to be verified... (Could be SkillAlchemy) @@ -661,7 +661,7 @@ SkillUseTypes Object::TypeToSkill(uint32 type) case EQEmu::item::BagTypePotteryWheel: case EQEmu::item::BagTypeKiln: //case EQEmu::item::BagTypeIksarPotteryWheel: - return SkillPottery; + return EQEmu::skills::SkillPottery; /*SkillResearch*/ //case EQEmu::item::BagTypeLexicon: @@ -670,18 +670,18 @@ SkillUseTypes Object::TypeToSkill(uint32 type) case EQEmu::item::BagTypeNecromancersLexicon: case EQEmu::item::BagTypeEnchantersLexicon: //case EQEmu::item::BagTypeConcordanceofResearch: - return SkillResearch; + return EQEmu::skills::SkillResearch; /*SkillTailoring*/ case EQEmu::item::BagTypeSewingKit: //case EQEmu::item::BagTypeHalflingTailoringKit: //case EQEmu::item::BagTypeErudTailoringKit: //case EQEmu::item::BagTypeFierDalTailoringKit: - return SkillTailoring; + return EQEmu::skills::SkillTailoring; /*SkillTinkering*/ case EQEmu::item::BagTypeToolBox: - return SkillTinkering; + return EQEmu::skills::SkillTinkering; /*Undefined*/ default: @@ -718,7 +718,7 @@ void Client::TradeskillSearchResults(const std::string &query, unsigned long obj // Recipes that have either been made before or were // explicitly learned are excempt from that limit if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff) - && ((int32)trivial - (int32)GetSkill((SkillUseTypes)tradeskill)) > RuleI(Skills, MaxTradeskillSearchSkillDiff) + && ((int32)trivial - (int32)GetSkill((EQEmu::skills::SkillType)tradeskill)) > RuleI(Skills, MaxTradeskillSearchSkillDiff) && row[4] == nullptr) continue; @@ -866,49 +866,50 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { // Some tradeskills are more eqal then others. ;-) // If you want to customize the stage1 success rate do it here. // Remember: skillup_modifier is (float). Lower is better - switch(spec->tradeskill) { - case SkillFletching: - skillup_modifier = RuleI(Character, TradeskillUpFletching); - break; - case SkillAlchemy: - skillup_modifier = RuleI(Character, TradeskillUpAlchemy); - break; - case SkillJewelryMaking: - skillup_modifier = RuleI(Character, TradeskillUpJewelcrafting); - break; - case SkillPottery: - skillup_modifier = RuleI(Character, TradeskillUpPottery); - break; - case SkillBaking: - skillup_modifier = RuleI(Character, TradeskillUpBaking); - break; - case SkillBrewing: - skillup_modifier = RuleI(Character, TradeskillUpBrewing); - break; - case SkillBlacksmithing: - skillup_modifier = RuleI(Character, TradeskillUpBlacksmithing); - break; - case SkillResearch: - skillup_modifier = RuleI(Character, TradeskillUpResearch); - break; - case SkillMakePoison: - skillup_modifier = RuleI(Character, TradeskillUpMakePoison); - break; - case SkillTinkering: - skillup_modifier = RuleI(Character, TradeskillUpTinkering); - break; - default: - skillup_modifier = 2; - break; - } + switch(spec->tradeskill) { + case EQEmu::skills::SkillFletching: + skillup_modifier = RuleI(Character, TradeskillUpFletching); + break; + case EQEmu::skills::SkillAlchemy: + skillup_modifier = RuleI(Character, TradeskillUpAlchemy); + break; + case EQEmu::skills::SkillJewelryMaking: + skillup_modifier = RuleI(Character, TradeskillUpJewelcrafting); + break; + case EQEmu::skills::SkillPottery: + skillup_modifier = RuleI(Character, TradeskillUpPottery); + break; + case EQEmu::skills::SkillBaking: + skillup_modifier = RuleI(Character, TradeskillUpBaking); + break; + case EQEmu::skills::SkillBrewing: + skillup_modifier = RuleI(Character, TradeskillUpBrewing); + break; + case EQEmu::skills::SkillBlacksmithing: + skillup_modifier = RuleI(Character, TradeskillUpBlacksmithing); + break; + case EQEmu::skills::SkillResearch: + skillup_modifier = RuleI(Character, TradeskillUpResearch); + break; + case EQEmu::skills::SkillMakePoison: + skillup_modifier = RuleI(Character, TradeskillUpMakePoison); + break; + case EQEmu::skills::SkillTinkering: + skillup_modifier = RuleI(Character, TradeskillUpTinkering); + break; + default: + skillup_modifier = 2; + break; + } // Some tradeskills take the higher of one additional stat beside INT and WIS // to determine the skillup rate. Additionally these tradeskills do not have an // -15 modifier on their statbonus. - if (spec->tradeskill == SkillFletching || spec->tradeskill == SkillMakePoison) { + if (spec->tradeskill == EQEmu::skills::SkillFletching || spec->tradeskill == EQEmu::skills::SkillMakePoison) { thirdstat = GetDEX(); stat_modifier = 0; - } else if (spec->tradeskill == SkillBlacksmithing) { + } + else if (spec->tradeskill == EQEmu::skills::SkillBlacksmithing) { thirdstat = GetSTR(); stat_modifier = 0; } @@ -1045,7 +1046,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { return(false); } -void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill) +void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, EQEmu::skills::SkillType tradeskill) { uint16 current_raw_skill = GetRawSkill(tradeskill); @@ -1290,7 +1291,7 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id return false;//just not found i guess.. auto row = results.begin(); - spec->tradeskill = (SkillUseTypes)atoi(row[1]); + spec->tradeskill = (EQEmu::skills::SkillType)atoi(row[1]); spec->skill_needed = (int16)atoi(row[2]); spec->trivial = (uint16)atoi(row[3]); spec->nofail = atoi(row[4]) ? true : false; @@ -1406,43 +1407,43 @@ void Client::LearnRecipe(uint32 recipeID) results = database.QueryDatabase(query); } -bool Client::CanIncreaseTradeskill(SkillUseTypes tradeskill) { +bool Client::CanIncreaseTradeskill(EQEmu::skills::SkillType tradeskill) { uint32 rawskill = GetRawSkill(tradeskill); uint16 maxskill = MaxSkill(tradeskill); if (rawskill >= maxskill) //Max skill sanity check return false; - uint8 Baking = (GetRawSkill(SkillBaking) > 200) ? 1 : 0; - uint8 Smithing = (GetRawSkill(SkillBlacksmithing) > 200) ? 1 : 0; - uint8 Brewing = (GetRawSkill(SkillBrewing) > 200) ? 1 : 0; - uint8 Fletching = (GetRawSkill(SkillFletching) > 200) ? 1 : 0; - uint8 Jewelry = (GetRawSkill(SkillJewelryMaking) > 200) ? 1 : 0; - uint8 Pottery = (GetRawSkill(SkillPottery) > 200) ? 1 : 0; - uint8 Tailoring = (GetRawSkill(SkillTailoring) > 200) ? 1 : 0; + uint8 Baking = (GetRawSkill(EQEmu::skills::SkillBaking) > 200) ? 1 : 0; + uint8 Smithing = (GetRawSkill(EQEmu::skills::SkillBlacksmithing) > 200) ? 1 : 0; + uint8 Brewing = (GetRawSkill(EQEmu::skills::SkillBrewing) > 200) ? 1 : 0; + uint8 Fletching = (GetRawSkill(EQEmu::skills::SkillFletching) > 200) ? 1 : 0; + uint8 Jewelry = (GetRawSkill(EQEmu::skills::SkillJewelryMaking) > 200) ? 1 : 0; + uint8 Pottery = (GetRawSkill(EQEmu::skills::SkillPottery) > 200) ? 1 : 0; + uint8 Tailoring = (GetRawSkill(EQEmu::skills::SkillTailoring) > 200) ? 1 : 0; uint8 SkillTotal = Baking + Smithing + Brewing + Fletching + Jewelry + Pottery + Tailoring; //Tradeskills above 200 //New Tanaan AA: Each level allows an additional tradeskill above 200 (first one is free) uint8 aaLevel = spellbonuses.TradeSkillMastery + itembonuses.TradeSkillMastery + aabonuses.TradeSkillMastery; switch (tradeskill) { - case SkillBaking: - case SkillBlacksmithing: - case SkillBrewing: - case SkillFletching: - case SkillJewelryMaking: - case SkillPottery: - case SkillTailoring: - if (aaLevel == 6) - break; //Maxed AA - if (SkillTotal == 0) - break; //First tradeskill freebie - if ((SkillTotal == (aaLevel + 1)) && (rawskill > 200)) - break; //One of the tradeskills already allowed to go over 200 - if ((SkillTotal >= (aaLevel + 1)) && (rawskill >= 200)) - return false; //One or more tradeskills already at or beyond limit - break; - default: - break; //Other skills unchecked and ability to increase assumed true + case EQEmu::skills::SkillBaking: + case EQEmu::skills::SkillBlacksmithing: + case EQEmu::skills::SkillBrewing: + case EQEmu::skills::SkillFletching: + case EQEmu::skills::SkillJewelryMaking: + case EQEmu::skills::SkillPottery: + case EQEmu::skills::SkillTailoring: + if (aaLevel == 6) + break; //Maxed AA + if (SkillTotal == 0) + break; //First tradeskill freebie + if ((SkillTotal == (aaLevel + 1)) && (rawskill > 200)) + break; //One of the tradeskills already allowed to go over 200 + if ((SkillTotal >= (aaLevel + 1)) && (rawskill >= 200)) + return false; //One or more tradeskills already at or beyond limit + break; + default: + break; //Other skills unchecked and ability to increase assumed true } return true; } diff --git a/zone/tune.cpp b/zone/tune.cpp index a6b55f02e..76fb97b89 100644 --- a/zone/tune.cpp +++ b/zone/tune.cpp @@ -255,7 +255,7 @@ int32 Mob::Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minh } if (RuleB(Combat, UseIntervalAC)) { - float softcap = (GetSkill(SkillDefense) + GetLevel()) * + float softcap = (GetSkill(EQEmu::skills::SkillDefense) + GetLevel()) * RuleR(Combat, SoftcapFactor) * (1.0 + aa_mit); float mitigation_rating = 0.0; float attack_rating = 0.0; @@ -410,14 +410,14 @@ int32 Mob::Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minh int tmp_armor = armor; if (GetClass() == WIZARD || GetClass() == MAGICIAN || GetClass() == NECROMANCER || GetClass() == ENCHANTER){ - mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 4.0) + armor + 1; + mitigation_rating = ((GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 4.0) + armor + 1; if (Msg >= 2) - GM->Message(0, "# + %.2f #### DEFENDER Armor Bonus [Defense Skill %i Heroic Agi %i]", mitigation_rating - tmp_armor, GetSkill(SkillDefense), itembonuses.HeroicAGI); + GM->Message(0, "# + %.2f #### DEFENDER Armor Bonus [Defense Skill %i Heroic Agi %i]", mitigation_rating - tmp_armor, GetSkill(EQEmu::skills::SkillDefense), itembonuses.HeroicAGI); } else{ - mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 3.0) + (armor * 1.333333) + 1; + mitigation_rating = ((GetSkill(EQEmu::skills::SkillDefense) + itembonuses.HeroicAGI / 10) / 3.0) + (armor * 1.333333) + 1; if (Msg >= 2) - GM->Message(0, "# + %.2f #### DEFENDER Armor Bonus [Defense Skill %i Heroic Agi %i]", mitigation_rating - tmp_armor, GetSkill(SkillDefense), itembonuses.HeroicAGI); + GM->Message(0, "# + %.2f #### DEFENDER Armor Bonus [Defense Skill %i Heroic Agi %i]", mitigation_rating - tmp_armor, GetSkill(EQEmu::skills::SkillDefense), itembonuses.HeroicAGI); } mitigation_rating *= 0.847; @@ -443,16 +443,16 @@ int32 Mob::Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minh if (attacker->IsClient()){ if (atk_override) - attack_rating = (atk_override + ((attacker->GetSTR()-66) * 0.9) + (attacker->GetSkill(SkillOffense)*1.345)); + attack_rating = (atk_override + ((attacker->GetSTR() - 66) * 0.9) + (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345)); else - attack_rating = ((attacker->CastToClient()->CalcATK() + add_atk) + ((attacker->GetSTR()-66) * 0.9) + (attacker->GetSkill(SkillOffense)*1.345)); + attack_rating = ((attacker->CastToClient()->CalcATK() + add_atk) + ((attacker->GetSTR() - 66) * 0.9) + (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345)); } else{ if (atk_override) - attack_rating = (atk_override + (attacker->GetSkill(SkillOffense)*1.345) + ((attacker->GetSTR()-66) * 0.9)); + attack_rating = (atk_override + (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345) + ((attacker->GetSTR() - 66) * 0.9)); else - attack_rating = ((attacker->GetATK() + add_atk) + (attacker->GetSkill(SkillOffense)*1.345) + ((attacker->GetSTR()-66) * 0.9)); + attack_rating = ((attacker->GetATK() + add_atk) + (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345) + ((attacker->GetSTR() - 66) * 0.9)); } attack_rating = attacker->mod_attack_rating(attack_rating, this); @@ -468,7 +468,7 @@ int32 Mob::Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minh GM->Message(0, "# %i #### ATTACKER Worn/Equip ATK Bonus", attacker->itembonuses.ATK); GM->Message(0, "# %i #### ATTACKER Worn/Equip ATK Bonus", attacker->itembonuses.ATK); GM->Message(0, "# %.2f #### ATTACKER Strength Stat ATK Bonus [Stat Amt: %i]", ((attacker->GetSTR()-66) * 0.9),attacker->GetSTR()); - GM->Message(0, "# %.2f #### ATTACKER Offensive Skill ATK Bonus [Stat Amt: %i]", (attacker->GetSkill(SkillOffense)*1.345) ,attacker->GetSkill(SkillOffense)); + GM->Message(0, "# %.2f #### ATTACKER Offensive Skill ATK Bonus [Stat Amt: %i]", (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345), attacker->GetSkill(EQEmu::skills::SkillOffense)); } else{ @@ -476,7 +476,7 @@ int32 Mob::Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minh GM->Message(0, "# %i #### ATTACKER SE_ATK(2) spell Bonus", attacker->spellbonuses.ATK); GM->Message(0, "# %i #### ATTACKER NPC ATK Stat", attacker->CastToNPC()->ATK); GM->Message(0, "# %.2f #### ATTACKER Strength Stat ATK Bonus [Stat Amt: %i]", ((attacker->GetSTR()-66) * 0.9),attacker->GetSTR()); - GM->Message(0, "# %.2f #### ATTACKER Offensive Skill ATK Bonus [Stat Amt: %i]", (attacker->GetSkill(SkillOffense)*1.345) ,attacker->GetSkill(SkillOffense)); + GM->Message(0, "# %.2f #### ATTACKER Offensive Skill ATK Bonus [Stat Amt: %i]", (attacker->GetSkill(EQEmu::skills::SkillOffense)*1.345), attacker->GetSkill(EQEmu::skills::SkillOffense)); } } @@ -596,7 +596,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) } } - SkillUseTypes skillinuse; + EQEmu::skills::SkillType skillinuse; AttackAnimation(skillinuse, Hand, weapon); int damage = 0; @@ -621,7 +621,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) max_hit = (RuleI(Combat, HitCapPre20)); CheckIncreaseSkill(skillinuse, other, -15); - CheckIncreaseSkill(SkillOffense, other, -15); + CheckIncreaseSkill(EQEmu::skills::SkillOffense, other, -15); #ifndef EQEMU_NO_WEAPON_DAMAGE_BONUS @@ -658,7 +658,7 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch float tmp_hit_chance = 0.0f; bool end = false; - SkillUseTypes skillinuse = SkillHandtoHand; + EQEmu::skills::SkillType skillinuse = EQEmu::skills::SkillHandtoHand; if (attacker->IsClient()) {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. ItemInst* weapon; @@ -738,7 +738,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ float tmp_hit_chance = 0.0f; bool end = false; - SkillUseTypes skillinuse = SkillHandtoHand; + EQEmu::skills::SkillType skillinuse = EQEmu::skills::SkillHandtoHand; if (attacker->IsClient()) {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. ItemInst* weapon; @@ -809,7 +809,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ } -float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod, int Msg,int acc_override, int avoid_override, int add_acc, int add_avoid) +float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, EQEmu::skills::SkillType skillinuse, int Hand, int16 chance_mod, int Msg, int acc_override, int avoid_override, int add_acc, int add_avoid) { float chancetohit = RuleR(Combat, BaseHitChance); @@ -897,9 +897,9 @@ float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skill if(defender->IsClient()) { - chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); + chancetohit += (RuleR(Combat, WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(EQEmu::skills::SkillDefense) - defender->GetSkill(EQEmu::skills::SkillDefense))); if (Msg >= 2) - Message(0, "# + %.2f Total: %.2f #### DEFENDER Defense Skill Mod", (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))), chancetohit); + Message(0, "# + %.2f Total: %.2f #### DEFENDER Defense Skill Mod", (RuleR(Combat, WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(EQEmu::skills::SkillDefense) - defender->GetSkill(EQEmu::skills::SkillDefense))), chancetohit); } @@ -988,17 +988,17 @@ float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skill hitBonus += attacker->itembonuses.HitChanceEffect[skillinuse] + attacker->spellbonuses.HitChanceEffect[skillinuse]+ attacker->aabonuses.HitChanceEffect[skillinuse]+ - attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1] + - attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1] + - attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]; + attacker->itembonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->spellbonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->aabonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]; if (Msg >= 2){ - if (attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]) - Message(0, "# %i #### ATTACKER SE_HitChance(184) AA Bonus [All Skills]", attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]); - if (attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1]) - Message(0, "# %i #### ATTACKER SE_HitChance(184) Spell Bonus [All Skills]", attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1]); - if (attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1]) - Message(0, "# %i #### ATTACKER SE_HitChance(184) Worn Bonus [All Skills]", attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1]); + if (attacker->aabonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) AA Bonus [All Skills]", attacker->aabonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]); + if (attacker->spellbonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) Spell Bonus [All Skills]", attacker->spellbonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]); + if (attacker->itembonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) Worn Bonus [All Skills]", attacker->itembonuses.HitChanceEffect[EQEmu::skills::HIGHEST_SKILL + 1]); if (attacker->itembonuses.HitChanceEffect[skillinuse]) Message(0, "# %i #### ATTACKER SE_HitChance(184) AA Bonus [Skill]", attacker->aabonuses.HitChanceEffect[skillinuse]); if (attacker->spellbonuses.HitChanceEffect[skillinuse]) @@ -1009,19 +1009,19 @@ float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skill //Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect //Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim) - hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] + - attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] + + hitBonus += (attacker->itembonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->spellbonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] + + attacker->aabonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1] + attacker->aabonuses.Accuracy[skillinuse] + attacker->itembonuses.HitChance) / 15.0f; //Item Mod 'Accuracy' if (Msg >= 2) { - if (attacker->aabonuses.Accuracy[HIGHEST_SKILL+1]) - Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) AA Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->aabonuses.Accuracy[HIGHEST_SKILL+1])/15.0f,attacker->aabonuses.Accuracy[HIGHEST_SKILL+1]); - if (attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1]) - Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) Spell Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1])/15.0f,attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1]); - if (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1]) - Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) Worn Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->itembonuses.Accuracy[HIGHEST_SKILL+1])/15.0f,attacker->itembonuses.Accuracy[HIGHEST_SKILL+1]); + if (attacker->aabonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) AA Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->aabonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]) / 15.0f, attacker->aabonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]); + if (attacker->spellbonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) Spell Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->spellbonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]) / 15.0f, attacker->spellbonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]); + if (attacker->itembonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) Worn Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->itembonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]) / 15.0f, attacker->itembonuses.Accuracy[EQEmu::skills::HIGHEST_SKILL + 1]); if (attacker->aabonuses.Accuracy[skillinuse]) Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) AA Bonus [Skill] [Stat Amt: %i]", static_cast(attacker->aabonuses.Accuracy[skillinuse])/15.0f,attacker->aabonuses.Accuracy[skillinuse]); if (attacker->itembonuses.HitChance) @@ -1053,7 +1053,7 @@ float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skill hitBonus += (add_acc / 15.0f); //Modifier from database } - if(skillinuse == SkillArchery){ + if (skillinuse == EQEmu::skills::SkillArchery){ hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty); if (Msg >= 2) Message(0, "# %.2f pct #### RuleR(Combat, ArcheryHitPenalty) ", RuleR(Combat, ArcheryHitPenalty)); diff --git a/zone/zonedb.h b/zone/zonedb.h index a4fc5af7b..ef5a6810d 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -92,7 +92,7 @@ struct DBnpcspellseffects_Struct { }; struct DBTradeskillRecipe_Struct { - SkillUseTypes tradeskill; + EQEmu::skills::SkillType tradeskill; int16 skill_needed; uint16 trivial; bool nofail;