From 6079b34a2a30e350d5b9c17e239aa30ad36b1b23 Mon Sep 17 00:00:00 2001 From: Xackery Date: Mon, 26 Sep 2016 02:09:39 -0700 Subject: [PATCH 01/65] Added Ruleset AA:ShowExpValues. --- common/ruletypes.h | 1 + zone/exp.cpp | 51 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 2731c1a26..bf35d03e8 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -55,6 +55,7 @@ RULE_REAL(Character, AAExpMultiplier, 0.5) RULE_REAL(Character, GroupExpMultiplier, 0.5) RULE_REAL(Character, RaidExpMultiplier, 0.2) RULE_BOOL(Character, UseXPConScaling, true) +RULE_INT(Character, ShowExpValues, 0) //0 - normal, 1 - Show raw experience values, 2 - Show raw experience values AND percent. RULE_INT(Character, LightBlueModifier, 40) RULE_INT(Character, BlueModifier, 90) RULE_INT(Character, WhiteModifier, 100) diff --git a/zone/exp.cpp b/zone/exp.cpp index 63989a4e9..9d2d33a31 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -350,19 +350,50 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { } if ((set_exp + set_aaxp) > (m_pp.exp+m_pp.expAA)) { - if (isrezzexp) - this->Message_StringID(MT_Experience, REZ_REGAIN); - else{ - if(membercount > 1) - this->Message_StringID(MT_Experience, GAIN_GROUPXP); - else if(IsRaidGrouped()) - Message_StringID(MT_Experience, GAIN_RAIDEXP); - else - this->Message_StringID(MT_Experience, GAIN_XP); + + uint32 exp_gained = set_exp - m_pp.exp; + uint32 aaxp_gained = set_aaxp - m_pp.expAA; + float exp_percent = (float)((float)exp_gained / (float)(GetEXPForLevel(GetLevel() + 1) - GetEXPForLevel(GetLevel())))*(float)100; //EXP needed for level + float aaxp_percent = (float)((float)aaxp_gained / (float)(RuleI(AA, ExpPerPoint)))*(float)100; //AAEXP needed for level + std::string exp_amount_message = ""; + if (RuleI(Character, ShowExpValues) >= 1) { + if (exp_gained > 0 && aaxp_gained > 0) exp_amount_message = StringFormat("%u, %u AA", exp_gained, aaxp_gained); + else if (exp_gained > 0) exp_amount_message = StringFormat("%u", exp_gained); + else exp_amount_message = StringFormat("%u AA", aaxp_gained); + } + + std::string exp_percent_message = ""; + if (RuleI(Character, ShowExpValues) >= 2) { + if (exp_gained > 0 && aaxp_gained > 0) exp_percent_message = StringFormat("(%.3f%%, %.3f%%AA)", exp_percent, aaxp_percent); + else if (exp_gained > 0) exp_percent_message = StringFormat("(%.3f%%)", exp_percent); + else exp_percent_message = StringFormat("(%.3f%%AA)", aaxp_percent); + } + + if (isrezzexp) { + if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str()); + else Message_StringID(MT_Experience, REZ_REGAIN); + } else { + if (membercount > 1) { + if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str()); + else Message_StringID(MT_Experience, GAIN_GROUPXP); + } + else if (IsRaidGrouped()) { + if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str()); + else Message_StringID(MT_Experience, GAIN_RAIDEXP); + } + else { + if (RuleI(Character, ShowExpValues) > 0) Message(MT_Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str()); + else Message_StringID(MT_Experience, GAIN_XP); + } } } else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing. - Message(15, "You have lost experience."); + uint32 exp_lost = m_pp.exp - set_exp; + float exp_percent = (float)((float)exp_lost / (float)(GetEXPForLevel(GetLevel() + 1) - GetEXPForLevel(GetLevel())))*(float)100; + + if (RuleI(Character, ShowExpValues) == 1 && exp_lost > 0) Message(13, "You have lost %i experience.", exp_lost); + else if (RuleI(Character, ShowExpValues) == 2 && exp_lost > 0) Message(13, "You have lost %i experience. (%.3f%%)", exp_lost, exp_percent); + else Message(15, "You have lost experience."); } //check_level represents the level we should be when we have From 19b6a96063ccde0cf62481d85dd48efedebd134b Mon Sep 17 00:00:00 2001 From: Xackery Date: Mon, 26 Sep 2016 02:11:50 -0700 Subject: [PATCH 02/65] Changed lost exp message to all be 15. --- zone/exp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/exp.cpp b/zone/exp.cpp index 9d2d33a31..d6b0b903a 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -391,8 +391,8 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { uint32 exp_lost = m_pp.exp - set_exp; float exp_percent = (float)((float)exp_lost / (float)(GetEXPForLevel(GetLevel() + 1) - GetEXPForLevel(GetLevel())))*(float)100; - if (RuleI(Character, ShowExpValues) == 1 && exp_lost > 0) Message(13, "You have lost %i experience.", exp_lost); - else if (RuleI(Character, ShowExpValues) == 2 && exp_lost > 0) Message(13, "You have lost %i experience. (%.3f%%)", exp_lost, exp_percent); + if (RuleI(Character, ShowExpValues) == 1 && exp_lost > 0) Message(15, "You have lost %i experience.", exp_lost); + else if (RuleI(Character, ShowExpValues) == 2 && exp_lost > 0) Message(15, "You have lost %i experience. (%.3f%%)", exp_lost, exp_percent); else Message(15, "You have lost experience."); } From 4fa8c89e5cc7471402742e47c5d361167948de26 Mon Sep 17 00:00:00 2001 From: Joshua Packard Date: Wed, 28 Sep 2016 19:24:09 -0700 Subject: [PATCH 03/65] Added Best Z Calculation to Ground Spawn Loc --- zone/object.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/zone/object.cpp b/zone/object.cpp index c00f718b3..b28a886f3 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -451,6 +451,21 @@ void Object::RandomSpawn(bool send_packet) { m_data.x = zone->random.Real(m_min_x, m_max_x); m_data.y = zone->random.Real(m_min_y, m_max_y); + + if(m_data.z == BEST_Z_INVALID) { + glm::vec3 me; + me.x = m_data.x; + me.y = m_data.y; + me.z = 0; + glm::vec3 hit; + float best_z = zone->zonemap->FindClosestZ(me, &hit); + if (best_z != BEST_Z_INVALID) { + m_data.z = best_z; + } + } + + Log.Out(Logs::Detail, Logs::Zone_Server, "Object::RandomSpawn(%s): %d (%.2f, %.2f, %.2f)", m_data.object_name, m_inst->GetID(), m_data.x, m_data.y, m_data.z); + respawn_timer.Disable(); if(send_packet) { From 329c9c8d98535b410880389227e8167130fa9930 Mon Sep 17 00:00:00 2001 From: Joshua Packard Date: Wed, 28 Sep 2016 19:26:44 -0700 Subject: [PATCH 04/65] Reordered zone initialization Needed to reorder zone init so that the zonemap is loaded before ground spawns are made, otherwise the best Z won't calculate. --- zone/zone.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 35b2d52bb..1edf1a268 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -100,9 +100,6 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { worldserver.SetZoneData(0); return false; } - zone->zonemap = Map::LoadMapFile(zone->map_name); - zone->watermap = WaterMap::LoadWaterMapfile(zone->map_name); - zone->pathing = PathManager::LoadPathFile(zone->map_name); std::string tmp; if (database.GetVariable("loglevel", tmp)) { @@ -877,6 +874,23 @@ Zone::~Zone() { //Modified for timezones. bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); + + //load the zone config file. + if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... + LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults + + if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) + { + std::string r_name = RuleManager::Instance()->GetRulesetName(&database, default_ruleset); + if(r_name.size() > 0) + { + RuleManager::Instance()->LoadRules(&database, r_name.c_str()); + } + } + + zone->zonemap = Map::LoadMapFile(zone->map_name); + zone->watermap = WaterMap::LoadWaterMapfile(zone->map_name); + zone->pathing = PathManager::LoadPathFile(zone->map_name); Log.Out(Logs::General, Logs::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { @@ -969,19 +983,6 @@ bool Zone::Init(bool iStaticZone) { petition_list.ClearPetitions(); petition_list.ReadDatabase(); - //load the zone config file. - if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... - LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - - if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) - { - std::string r_name = RuleManager::Instance()->GetRulesetName(&database, default_ruleset); - if(r_name.size() > 0) - { - RuleManager::Instance()->LoadRules(&database, r_name.c_str()); - } - } - Log.Out(Logs::General, Logs::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); From 379ef7eed314fc887e47b36859dbc69b1c888024 Mon Sep 17 00:00:00 2001 From: Joshua Packard Date: Thu, 29 Sep 2016 16:49:05 -0700 Subject: [PATCH 05/65] Added optional SQL to apply max z updates --- utils/sql/git/optional/2016_09_29_GroundSpawnsMaxZ.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 utils/sql/git/optional/2016_09_29_GroundSpawnsMaxZ.sql diff --git a/utils/sql/git/optional/2016_09_29_GroundSpawnsMaxZ.sql b/utils/sql/git/optional/2016_09_29_GroundSpawnsMaxZ.sql new file mode 100644 index 000000000..1cc98e246 --- /dev/null +++ b/utils/sql/git/optional/2016_09_29_GroundSpawnsMaxZ.sql @@ -0,0 +1 @@ +UPDATE ground_spawns SET max_z = -99999 WHERE max_x != min_x OR max_y != min_y From 013f7cfd2145ba79f8417d41f0c02f1e54225135 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 3 Oct 2016 01:35:11 -0400 Subject: [PATCH 06/65] Set no_target_hotkey in Mob ctor Fixes UBSan error --- zone/mob.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/mob.cpp b/zone/mob.cpp index fb4c14bf2..1caf69918 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -365,6 +365,7 @@ Mob::Mob(const char* in_name, patrol=0; follow=0; follow_dist = 100; // Default Distance for Follow + no_target_hotkey = false; flee_mode = false; currently_fleeing = false; flee_timer.Start(); From 7b5ea9e99c461b8243e724906e4bb2d352288a1b Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Sun, 9 Oct 2016 10:22:55 -0400 Subject: [PATCH 07/65] Fix rogue merchant usage under sneak. --- changelog.txt | 5 +++++ zone/client_process.cpp | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 73be04468..a0339ee08 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/09/2016 == +Noudess: Rogue usage of merchants while utilizing sneak was limited to +temporary items, as the code that checked faction per item sold did not +take into account that rogue was sneaking. Now sneaking rogues can see full +inventory on merchants (well, unless an item requires a + faction value). == 09/12/2016 == Akkadius: Massive overhaul of the update system and EQEmu Server management utility framework (known as eqemu_update.pl) now known as eqemu_server.pl diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e1a769743..9e7b230d7 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -857,7 +857,17 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { continue; int32 fac = merch ? merch->GetPrimaryFaction() : 0; - if (fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) + int32 cur_fac_level; + if (fac == 0 || sneaking) + { + cur_fac_level = 0; + } + else + { + cur_fac_level = GetModCharacterFactionLevel(fac); + } + + if (cur_fac_level < ml.faction_required) continue; handychance = zone->random.Int(0, merlist.size() + tmp_merlist.size() - 1); From c263c4ef07d6ae1d73791c12fc272efe59e03561 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Sun, 9 Oct 2016 11:12:09 -0400 Subject: [PATCH 08/65] 2nd check for faction not needed - had to either check for sneaking again or remove un-needed 2nd check. --- zone/client_packet.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index fa253664b..6fc45fee0 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12134,11 +12134,6 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) continue; } - int32 fac = tmp->GetPrimaryFaction(); - if (fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { - continue; - } - if (mp->itemslot == ml.slot){ item_id = ml.item; break; From a5b19d0c0df7dff2b4d648f204aeb7f91da05363 Mon Sep 17 00:00:00 2001 From: Joshua Packard Date: Mon, 10 Oct 2016 09:39:55 -0700 Subject: [PATCH 09/65] Added 0.1 to calculated Z so that objects show better above ground --- zone/object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/object.cpp b/zone/object.cpp index b28a886f3..ab9637e96 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -460,7 +460,7 @@ void Object::RandomSpawn(bool send_packet) { glm::vec3 hit; float best_z = zone->zonemap->FindClosestZ(me, &hit); if (best_z != BEST_Z_INVALID) { - m_data.z = best_z; + m_data.z = best_z + 0.1f; } } From 343c41bb1824877957f892b50a257077b496fe49 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 13 Oct 2016 23:54:56 -0400 Subject: [PATCH 10/65] Elemental dmg shouldn't allow you to hit bane only --- zone/attack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 991e251f3..9b83f7994 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -858,7 +858,7 @@ int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemBase *weapon_item) { } } - if(!eledmg && !banedmg){ + if(!banedmg){ if(!GetSpecialAbility(SPECATK_BANE)) return 0; else @@ -979,7 +979,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate banedmg = against->CheckBaneDamage(weapon_item); if (against->GetSpecialAbility(IMMUNE_MELEE_EXCEPT_BANE)) { - if (!eledmg && !banedmg) { + if (!banedmg) { if (!GetSpecialAbility(SPECATK_BANE)) return 0; else From 1e865a524628175b9152c93df0c71757bf6c95ff Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 13 Oct 2016 23:55:44 -0400 Subject: [PATCH 11/65] Take in elem/bane dmg in BS calc --- zone/special_attacks.cpp | 53 +++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index eb7f5aac1..06d8ba4a9 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -576,33 +576,30 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) int32 primaryweapondamage = 0; int32 backstab_dmg = 0; - if(IsClient()){ - const ItemInst *wpn = nullptr; - wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); - if(wpn) { + if (IsClient()) { + const ItemInst *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + if (wpn) { primaryweapondamage = GetWeaponDamage(other, wpn); - backstab_dmg = wpn->GetItem()->BackstabDmg; - for (int i = 0; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) - { - ItemInst *aug = wpn->GetAugment(i); - if(aug) - { - backstab_dmg += aug->GetItem()->BackstabDmg; - } + if (primaryweapondamage) { + backstab_dmg = wpn->GetItemBackstabDamage(true); + backstab_dmg += other->ResistElementalWeaponDmg(wpn); + if (wpn->GetItemBaneDamageBody(true) || wpn->GetItemBaneDamageRace(true)) + backstab_dmg += other->CheckBaneDamage(wpn); } } - } - else{ - primaryweapondamage = (GetLevel()/7)+1; // fallback incase it's a npc without a weapon, 2 dmg at 10, 10 dmg at 65 + } else { + primaryweapondamage = + (GetLevel() / 7) + 1; // fallback incase it's a npc without a weapon, 2 dmg at 10, 10 dmg at 65 backstab_dmg = primaryweapondamage; } - if(primaryweapondamage > 0){ - if(level > 25){ + // ex. bane can make this false + if (primaryweapondamage > 0) { + // this is very wrong but not worth it until we fix the full dmg + if (level > 25) { 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{ + } else { 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; } @@ -610,31 +607,27 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) // determine minimum hits if (level < 51) { min_hit = (level*15/10); - } - else { + } else { // Trumpcard: Replaced switch statement with formula calc. This will give minhit increases all the way to 65. min_hit = (level * ( level*5 - 105)) / 100; } - if (!other->CheckHitChance(this, EQEmu::skills::SkillBackstab, 0)) { + if (!other->CheckHitChance(this, EQEmu::skills::SkillBackstab, 0)) { ndamage = 0; - } - else{ - if(min_damage){ + } else { + if (min_damage) { ndamage = min_hit; - } - else { + } else { if (max_hit < min_hit) max_hit = min_hit; - if(RuleB(Combat, UseIntervalAC)) + if (RuleB(Combat, UseIntervalAC)) ndamage = max_hit; else ndamage = zone->random.Int(min_hit, max_hit); } } - } - else{ + } else { ndamage = -5; } From c90a436db30366b7063331e35e2bc9c5055827d6 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 14 Oct 2016 13:52:01 -0400 Subject: [PATCH 12/65] Clang format ConeDirectional --- zone/spells.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index c818c8e90..52a1e1ab9 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5673,45 +5673,45 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) float angle_start = spells[spell_id].directional_start + (GetHeading() * 360.0f / 256.0f); float angle_end = spells[spell_id].directional_end + (GetHeading() * 360.0f / 256.0f); - while(angle_start > 360.0f) + while (angle_start > 360.0f) angle_start -= 360.0f; - while(angle_end > 360.0f) + while (angle_end > 360.0f) angle_end -= 360.0f; - std::list targets_in_range; - std::list::iterator iter; + std::list targets_in_range; - entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range); - iter = targets_in_range.begin(); + entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].aoerange, + spells[spell_id].aoerange / 2, targets_in_range); + auto iter = targets_in_range.begin(); - while(iter != targets_in_range.end()){ - - if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient()))){ - ++iter; + while (iter != targets_in_range.end()) { + if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient()))) { + ++iter; continue; } - float heading_to_target = (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f); + float heading_to_target = + (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f); - while(heading_to_target < 0.0f) + while (heading_to_target < 0.0f) heading_to_target += 360.0f; - while(heading_to_target > 360.0f) + while (heading_to_target > 360.0f) heading_to_target -= 360.0f; - if(angle_start > angle_end){ - if((heading_to_target >= angle_start && heading_to_target <= 360.0f) || (heading_to_target >= 0.0f && heading_to_target <= angle_end)){ - if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los){ + if (angle_start > angle_end) { + if ((heading_to_target >= angle_start && heading_to_target <= 360.0f) || + (heading_to_target >= 0.0f && heading_to_target <= angle_end)) { + if (CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); - SpellOnTarget(spell_id,(*iter), false, true, resist_adjust); + SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); maxtarget_count++; } } - } - else{ - if(heading_to_target >= angle_start && heading_to_target <= angle_end){ - if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { + } else { + if (heading_to_target >= angle_start && heading_to_target <= angle_end) { + if (CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); maxtarget_count++; From 05ed623056633ea52f5c30eec9f14143e6425819 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 14 Oct 2016 13:55:04 -0400 Subject: [PATCH 13/65] Add NPC NPC faction check to ConeDirectional --- zone/spells.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index 52a1e1ab9..ccae7922b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5700,6 +5700,19 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) while (heading_to_target > 360.0f) heading_to_target -= 360.0f; + if (IsNPC() && (*iter)->IsNPC()) { + auto fac = (*iter)->GetReverseFactionCon(this); + if (beneficial_targets) { + // only affect mobs we would assist. + if (!(fac <= FACTION_AMIABLE)) + continue; + } else { + // affect mobs that are on our hate list, or which have bad faction with us + if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) + continue; + } + } + if (angle_start > angle_end) { if ((heading_to_target >= angle_start && heading_to_target <= 360.0f) || (heading_to_target >= 0.0f && heading_to_target <= angle_end)) { From 46cbd147b567ebc960dd96be12bbd5a6d82d1f3d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 14 Oct 2016 13:58:20 -0400 Subject: [PATCH 14/65] clang format BeamDirectional --- zone/spells.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index ccae7922b..f744541e0 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5619,11 +5619,11 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) if (IsBeneficialSpell(spell_id) && IsClient()) beneficial_targets = true; - std::list targets_in_range; - std::list::iterator iter; + std::list targets_in_range; - entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].range, spells[spell_id].range / 2, targets_in_range); - iter = targets_in_range.begin(); + entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].range, + spells[spell_id].range / 2, targets_in_range); + auto iter = targets_in_range.begin(); float dX = 0; float dY = 0; @@ -5632,24 +5632,22 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) CalcDestFromHeading(GetHeading(), spells[spell_id].range, 5, GetX(), GetY(), dX, dY, dZ); dZ = GetZ(); - //FIND SLOPE: Put it into the form y = mx + b + // FIND SLOPE: Put it into the form y = mx + b float m = (dY - GetY()) / (dX - GetX()); float b = (GetY() * dX - dY * GetX()) / (dX - GetX()); - while(iter != targets_in_range.end()) - { - if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) - || (*iter)->BehindMob(this, (*iter)->GetX(),(*iter)->GetY())){ - ++iter; + while (iter != targets_in_range.end()) { + if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) || + (*iter)->BehindMob(this, (*iter)->GetX(), (*iter)->GetY())) { + ++iter; continue; } //# shortest distance from line to target point float d = std::abs((*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1); - if (d <= spells[spell_id].aoerange) - { - if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { + if (d <= spells[spell_id].aoerange) { + if (CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); maxtarget_count++; From e86fca3affc4e5e97cabfdc3f1a5ef85172206ca Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 14 Oct 2016 13:59:45 -0400 Subject: [PATCH 15/65] Add NPC NPC faction check to BeamDirectional --- zone/spells.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index f744541e0..04129b554 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5643,6 +5643,19 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) continue; } + if (IsNPC() && (*iter)->IsNPC()) { + auto fac = (*iter)->GetReverseFactionCon(this); + if (beneficial_targets) { + // only affect mobs we would assist. + if (!(fac <= FACTION_AMIABLE)) + continue; + } else { + // affect mobs that are on our hate list, or which have bad faction with us + if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) + continue; + } + } + //# shortest distance from line to target point float d = std::abs((*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1); From 8496bf16ff201291928ecb33a3067df783d97d58 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 14 Oct 2016 14:37:25 -0500 Subject: [PATCH 16/65] eqemu_server.pl [skip ci] Make the internet connection check more multi-lingual friendly --- utils/scripts/eqemu_server.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index 821736fef..180dda907 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -488,11 +488,11 @@ sub check_internet_connection { $count = "n"; } - if (`ping 8.8.8.8 -$count 1 -w 500`=~/Reply from|1 received/i) { + if (`ping 8.8.8.8 -$count 1 -w 500`=~/TTL|1 received/i) { # print "[Update] We have a connection to the internet, continuing...\n"; return 1; } - elsif (`ping 4.2.2.2 -$count 1 -w 500`=~/Reply from|1 received/i) { + elsif (`ping 4.2.2.2 -$count 1 -w 500`=~/TTL|1 received/i) { # print "[Update] We have a connection to the internet, continuing...\n"; return 1; } @@ -2154,4 +2154,4 @@ sub generate_random_password { map $alphanumeric[rand @alphanumeric], 0..$passwordsize; return $randpassword; -} \ No newline at end of file +} From 56babc18012982e6097f78d91fbedc691c80f9f6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 15 Oct 2016 14:54:57 -0500 Subject: [PATCH 17/65] Update client_process.cpp --- zone/client_process.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 9e7b230d7..407343419 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -858,14 +858,12 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { int32 fac = merch ? merch->GetPrimaryFaction() : 0; int32 cur_fac_level; - if (fac == 0 || sneaking) - { + if (fac == 0 || sneaking) { cur_fac_level = 0; - } - else - { + } + else { cur_fac_level = GetModCharacterFactionLevel(fac); - } + } if (cur_fac_level < ml.faction_required) continue; From 16642b7c4c0b2d7f4e8f533043d3894f1721e73f Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 15 Oct 2016 22:14:03 -0400 Subject: [PATCH 18/65] Filename changes to facilitate future updates --- changelog.txt | 3 +++ common/CMakeLists.txt | 26 ++++++------------------- common/extprofile.h | 2 +- common/{item_base.cpp => item_data.cpp} | 2 +- common/{item_base.h => item_data.h} | 0 common/{item.cpp => item_instance.cpp} | 2 +- common/{item.h => item_instance.h} | 2 +- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/titanium.cpp | 2 +- common/patches/uf.cpp | 2 +- common/say_link.cpp | 4 ++-- common/shareddb.cpp | 2 +- shared_memory/items.cpp | 2 +- world/client.cpp | 2 +- world/worlddb.cpp | 2 +- zone/bonuses.cpp | 2 +- zone/client.h | 4 ++-- zone/npc.cpp | 4 ++-- zone/perl_questitem.cpp | 2 +- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 2 +- zone/zonedb.cpp | 2 +- zone/zonedump.h | 2 +- 26 files changed, 35 insertions(+), 46 deletions(-) rename common/{item_base.cpp => item_data.cpp} (99%) rename common/{item_base.h => item_data.h} (100%) rename common/{item.cpp => item_instance.cpp} (99%) rename common/{item.h => item_instance.h} (99%) diff --git a/changelog.txt b/changelog.txt index 73be04468..c211d6066 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/15/2016 == +Uleat: Changed filenames to facilitate future inventory naming conventions + == 09/12/2016 == Akkadius: Massive overhaul of the update system and EQEmu Server management utility framework (known as eqemu_update.pl) now known as eqemu_server.pl diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 3ed2862ce..2138c5c9e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -35,9 +35,10 @@ SET(common_sources faction.cpp guild_base.cpp guilds.cpp +# inventory_slot.cpp ipc_mutex.cpp - item.cpp - item_base.cpp + item_data.cpp + item_instance.cpp light_source.cpp md5.cpp memory_buffer.cpp @@ -155,10 +156,11 @@ SET(common_headers global_define.h guild_base.h guilds.h +# inventory_slot.h ipc_mutex.h - item.h - item_base.h + item_data.h item_fieldlist.h + item_instance.h languages.h light_source.h linked_list.h @@ -212,37 +214,29 @@ SET(common_headers zone_numbers.h patches/patches.h patches/sod.h -# patches/sod_itemfields.h patches/sod_limits.h patches/sod_ops.h patches/sod_structs.h patches/sof.h -# patches/sof_itemfields.h patches/sof_limits.h -# patches/sof_opcode_list.h patches/sof_ops.h patches/sof_structs.h patches/ss_declare.h patches/ss_define.h patches/ss_register.h patches/rof.h -# patches/rof_itemfields.h patches/rof_limits.h patches/rof_ops.h patches/rof_structs.h patches/rof2.h -# patches/rof2_itemfields.h patches/rof2_limits.h patches/rof2_ops.h patches/rof2_structs.h patches/titanium.h -# patches/titanium_itemfields_a.h -# patches/titanium_itemfields_b.h patches/titanium_limits.h patches/titanium_ops.h patches/titanium_structs.h patches/uf.h -# patches/uf_itemfields.h patches/uf_limits.h patches/uf_ops.h patches/uf_structs.h @@ -266,37 +260,29 @@ SET(common_headers SOURCE_GROUP(Patches FILES patches/patches.h patches/sod.h -# patches/sod_itemfields.h patches/sod_limits.h patches/sod_ops.h patches/sod_structs.h patches/sof.h -# patches/sof_itemfields.h patches/sof_limits.h -# patches/sof_opcode_list.h patches/sof_ops.h patches/sof_structs.h patches/ss_declare.h patches/ss_define.h patches/ss_register.h patches/rof.h -# patches/rof_itemfields.h patches/rof_limits.h patches/rof_ops.h patches/rof_structs.h patches/rof2.h -# patches/rof2_itemfields.h patches/rof2_limits.h patches/rof2_ops.h patches/rof2_structs.h patches/titanium.h -# patches/titanium_itemfields_a.h -# patches/titanium_itemfields_b.h patches/titanium_limits.h patches/titanium_ops.h patches/titanium_structs.h patches/uf.h -# patches/uf_itemfields.h patches/uf_limits.h patches/uf_ops.h patches/uf_structs.h diff --git a/common/extprofile.h b/common/extprofile.h index e53480631..72cc987b2 100644 --- a/common/extprofile.h +++ b/common/extprofile.h @@ -19,7 +19,7 @@ #define EXTENDED_PROFILE_H #include "eq_packet_structs.h" -#include "item.h" +#include "item_instance.h" #pragma pack(1) diff --git a/common/item_base.cpp b/common/item_data.cpp similarity index 99% rename from common/item_base.cpp rename to common/item_data.cpp index c2cef6918..fd40c2b7f 100644 --- a/common/item_base.cpp +++ b/common/item_data.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "item_base.h" +#include "item_data.h" #include "classes.h" #include "races.h" //#include "deity.h" diff --git a/common/item_base.h b/common/item_data.h similarity index 100% rename from common/item_base.h rename to common/item_data.h diff --git a/common/item.cpp b/common/item_instance.cpp similarity index 99% rename from common/item.cpp rename to common/item_instance.cpp index 61e7f926a..c8a75d0a7 100644 --- a/common/item.cpp +++ b/common/item_instance.cpp @@ -18,7 +18,7 @@ #include "classes.h" #include "global_define.h" -#include "item.h" +#include "item_instance.h" #include "races.h" #include "rulesys.h" #include "shareddb.h" diff --git a/common/item.h b/common/item_instance.h similarity index 99% rename from common/item.h rename to common/item_instance.h index f20b41fac..3ea3ba224 100644 --- a/common/item.h +++ b/common/item_instance.h @@ -29,7 +29,7 @@ class ItemParse; // Parses item packets class EvolveInfo; // Stores information about an evolving item family #include "../common/eq_constants.h" -#include "../common/item_base.h" +#include "../common/item_data.h" #include "../common/timer.h" #include "../common/bodytypes.h" #include "../common/deity.h" diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 8ab38905f..dba092bed 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item.h" +#include "../item_instance.h" #include "rof_structs.h" #include "../rulesys.h" diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index aedd7b592..609fdc123 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item.h" +#include "../item_instance.h" #include "rof2_structs.h" #include "../rulesys.h" diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index c1d573020..3b02cbbcb 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item.h" +#include "../item_instance.h" #include "sod_structs.h" #include "../rulesys.h" diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index bfad8d296..0d1afa000 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item.h" +#include "../item_instance.h" #include "sof_structs.h" #include "../rulesys.h" diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 72b492eeb..63feea81f 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -30,7 +30,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item.h" +#include "../item_instance.h" #include "titanium_structs.h" #include diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index ba5bf7622..0436f5af4 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item.h" +#include "../item_instance.h" #include "uf_structs.h" #include "../rulesys.h" diff --git a/common/say_link.cpp b/common/say_link.cpp index 3c9fe7c6e..2a4065403 100644 --- a/common/say_link.cpp +++ b/common/say_link.cpp @@ -21,8 +21,8 @@ #include "emu_constants.h" #include "string_util.h" -#include "item.h" -#include "item_base.h" +#include "item_instance.h" +#include "item_data.h" #include "../zone/zonedb.h" diff --git a/common/shareddb.cpp b/common/shareddb.cpp index fd89831c0..8e55269e7 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -29,7 +29,7 @@ #include "faction.h" #include "features.h" #include "ipc_mutex.h" -#include "item.h" +#include "item_instance.h" #include "loottable.h" #include "memory_mapped_file.h" #include "mysql.h" diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index e4c938af2..b58382420 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -22,7 +22,7 @@ #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" #include "../common/eqemu_exception.h" -#include "../common/item_base.h" +#include "../common/item_data.h" void LoadItems(SharedDatabase *database, const std::string &prefix) { EQEmu::IPCMutex mutex("items"); diff --git a/world/client.cpp b/world/client.cpp index 8d036827c..ff3c0ce9a 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -25,7 +25,7 @@ #include "../common/eq_packet_structs.h" #include "../common/packet_dump.h" #include "../common/eq_stream_intf.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/races.h" #include "../common/classes.h" #include "../common/languages.h" diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 8d65f7a78..def22adf4 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -20,7 +20,7 @@ //#include "../common/item.h" #include "../common/string_util.h" #include "../common/eq_packet_structs.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/rulesys.h" #include #include diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 1a49aaf66..a898e02ec 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -17,7 +17,7 @@ */ #include "../common/classes.h" #include "../common/global_define.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/rulesys.h" #include "../common/skills.h" #include "../common/spdat.h" diff --git a/zone/client.h b/zone/client.h index da2188fc7..75ce82bf5 100644 --- a/zone/client.h +++ b/zone/client.h @@ -45,9 +45,9 @@ namespace EQEmu #include "../common/extprofile.h" #include "../common/races.h" #include "../common/seperator.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/guilds.h" -#include "../common/item_base.h" +#include "../common/item_data.h" #include "common.h" #include "merc.h" diff --git a/zone/npc.cpp b/zone/npc.cpp index ecc3bf101..d958ff598 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -26,8 +26,8 @@ #include "../common/string_util.h" #include "../common/emu_versions.h" #include "../common/features.h" -#include "../common/item.h" -#include "../common/item_base.h" +#include "../common/item_instance.h" +#include "../common/item_data.h" #include "../common/linked_list.h" #include "../common/servertalk.h" #include "../common/say_link.h" diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index fa186a9b5..053748e97 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -26,7 +26,7 @@ #undef seed #endif -#include "../common/item.h" +#include "../common/item_instance.h" #ifdef THIS /* this macro seems to leak out on some systems */ #undef THIS diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 8f66345d2..564a9756a 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -20,7 +20,7 @@ #include "../common/bodytypes.h" #include "../common/classes.h" #include "../common/global_define.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/rulesys.h" #include "../common/skills.h" #include "../common/spdat.h" diff --git a/zone/spells.cpp b/zone/spells.cpp index c818c8e90..a7e37048e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -70,7 +70,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/classes.h" #include "../common/global_define.h" #include "../common/eqemu_logsys.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/rulesys.h" #include "../common/skills.h" #include "../common/spdat.h" diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7f86f5110..bf9452c4e 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1,7 +1,7 @@ #include "../common/eqemu_logsys.h" #include "../common/extprofile.h" -#include "../common/item.h" +#include "../common/item_instance.h" #include "../common/rulesys.h" #include "../common/string_util.h" diff --git a/zone/zonedump.h b/zone/zonedump.h index 6782881fe..20412ed70 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -28,7 +28,7 @@ spawn2 mediumblob, npcs mediumblob, npc_loot mediumblob, gmspawntype mediumblob, #define ZONEDUMP_H #include "../common/faction.h" #include "../common/eq_packet_structs.h" -#include "../common/item.h" +#include "../common/item_instance.h" #pragma pack(1) From e29ec1675990499439e0eed785d65e5253ba1d41 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 15 Oct 2016 22:23:50 -0400 Subject: [PATCH 19/65] Missed 2 reference changes --- tests/fixed_memory_test.h | 2 +- world/worlddb.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fixed_memory_test.h b/tests/fixed_memory_test.h index 06b529f3c..244394ce5 100644 --- a/tests/fixed_memory_test.h +++ b/tests/fixed_memory_test.h @@ -21,7 +21,7 @@ #include "cppunit/cpptest.h" #include "../common/fixed_memory_hash_set.h" -#include "../common/item.h" +#include "../common/item_instance.h" class FixedMemoryHashTest : public Test::Suite { typedef void(FixedMemoryHashTest::*TestFunction)(void); diff --git a/world/worlddb.cpp b/world/worlddb.cpp index def22adf4..205663ea5 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -17,7 +17,7 @@ */ #include "worlddb.h" -//#include "../common/item.h" +//#include "../common/item_instance.h" #include "../common/string_util.h" #include "../common/eq_packet_structs.h" #include "../common/item_instance.h" From 8b5dd58e96ec38da88ad325485031d2f60c175fa Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 16 Oct 2016 05:10:54 -0400 Subject: [PATCH 20/65] Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance --- changelog.txt | 3 + common/database.cpp | 2 +- common/eq_packet_structs.h | 2 +- common/item_data.cpp | 14 +- common/item_data.h | 46 +-- common/item_instance.cpp | 352 ++++++++++----------- common/item_instance.h | 523 ++++++++++++++++--------------- common/patches/rof.cpp | 12 +- common/patches/rof2.cpp | 12 +- common/patches/rof2_structs.h | 2 +- common/patches/rof_structs.h | 2 +- common/patches/sod.cpp | 12 +- common/patches/sod_structs.h | 2 +- common/patches/sof.cpp | 12 +- common/patches/titanium.cpp | 12 +- common/patches/uf.cpp | 14 +- common/patches/uf_structs.h | 2 +- common/say_link.cpp | 4 +- common/say_link.h | 12 +- common/shareddb.cpp | 74 ++--- common/shareddb.h | 26 +- shared_memory/items.cpp | 2 +- tests/fixed_memory_test.h | 46 +-- world/worlddb.cpp | 4 +- zone/aa.cpp | 2 +- zone/attack.cpp | 44 +-- zone/bonuses.cpp | 40 +-- zone/bot.cpp | 134 ++++---- zone/bot.h | 10 +- zone/bot_command.cpp | 16 +- zone/bot_database.cpp | 4 +- zone/bot_database.h | 8 +- zone/client.cpp | 44 +-- zone/client.h | 60 ++-- zone/client_mods.cpp | 10 +- zone/client_packet.cpp | 136 ++++---- zone/client_process.cpp | 28 +- zone/command.cpp | 26 +- zone/common.h | 8 +- zone/corpse.cpp | 24 +- zone/corpse.h | 8 +- zone/doors.cpp | 2 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 56 ++-- zone/embparser.h | 22 +- zone/embparser_api.cpp | 2 +- zone/embxs.cpp | 2 +- zone/entity.cpp | 6 +- zone/forage.cpp | 14 +- zone/guild_mgr.cpp | 24 +- zone/guild_mgr.h | 2 +- zone/inventory.cpp | 174 +++++----- zone/loottables.cpp | 16 +- zone/lua_client.cpp | 4 +- zone/lua_inventory.cpp | 4 +- zone/lua_item.cpp | 2 +- zone/lua_item.h | 12 +- zone/lua_iteminst.cpp | 4 +- zone/lua_iteminst.h | 20 +- zone/lua_parser.cpp | 10 +- zone/lua_parser.h | 16 +- zone/lua_parser_events.cpp | 34 +- zone/lua_parser_events.h | 20 +- zone/merc.cpp | 16 +- zone/merc.h | 4 +- zone/mob.cpp | 40 +-- zone/mob.h | 38 +-- zone/mod_functions.cpp | 22 +- zone/npc.cpp | 4 +- zone/npc.h | 8 +- zone/object.cpp | 36 +-- zone/object.h | 22 +- zone/perl_client.cpp | 8 +- zone/perl_mob.cpp | 8 +- zone/perl_questitem.cpp | 50 +-- zone/pets.cpp | 4 +- zone/quest_interface.h | 14 +- zone/quest_parser_collection.cpp | 6 +- zone/quest_parser_collection.h | 14 +- zone/questmgr.cpp | 24 +- zone/questmgr.h | 18 +- zone/special_attacks.cpp | 72 ++--- zone/spell_effects.cpp | 38 +-- zone/spells.cpp | 18 +- zone/tasks.cpp | 6 +- zone/tasks.h | 8 +- zone/tradeskills.cpp | 54 ++-- zone/trading.cpp | 112 +++---- zone/tribute.cpp | 4 +- zone/tune.cpp | 8 +- zone/zone.cpp | 8 +- zone/zonedb.cpp | 22 +- zone/zonedb.h | 19 +- 93 files changed, 1492 insertions(+), 1455 deletions(-) diff --git a/changelog.txt b/changelog.txt index f3a6c326b..50640ff55 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/16/2016 == +Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance. + == 10/15/2016 == Uleat: Changed filenames to facilitate future inventory naming conventions diff --git a/common/database.cpp b/common/database.cpp index 41220b4d9..93bbe7e0c 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -701,7 +701,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven /* Insert starting inventory... */ std::string invquery; for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) { - const ItemInst* newinv = inv->GetItem(i); + const EQEmu::ItemInstance* newinv = inv->GetItem(i); if (newinv) { invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)", charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor()); diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index fec5af412..5569c86e0 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -2071,7 +2071,7 @@ struct AdventureLeaderboard_Struct /*struct Item_Shop_Struct { uint16 merchantid; uint8 itemtype; - EQEmu::ItemBase item; + EQEmu::ItemData item; uint8 iss_unknown001[6]; };*/ diff --git a/common/item_data.cpp b/common/item_data.cpp index fd40c2b7f..3286bf97e 100644 --- a/common/item_data.cpp +++ b/common/item_data.cpp @@ -167,7 +167,7 @@ uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit) } } -bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id) +bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const { if (!(Races & GetPlayerRaceBit(race_id))) return false; @@ -178,32 +178,32 @@ bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id) return true; } -bool EQEmu::ItemBase::IsClassCommon() +bool EQEmu::ItemData::IsClassCommon() const { return (ItemClass == item::ItemClassCommon); } -bool EQEmu::ItemBase::IsClassBag() +bool EQEmu::ItemData::IsClassBag() const { return (ItemClass == item::ItemClassBag); } -bool EQEmu::ItemBase::IsClassBook() +bool EQEmu::ItemData::IsClassBook() const { return (ItemClass == item::ItemClassBook); } -bool EQEmu::ItemBase::IsType1HWeapon() +bool EQEmu::ItemData::IsType1HWeapon() const { return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing)); } -bool EQEmu::ItemBase::IsType2HWeapon() +bool EQEmu::ItemData::IsType2HWeapon() const { return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing)); } -bool EQEmu::ItemBase::IsTypeShield() +bool EQEmu::ItemData::IsTypeShield() const { return (ItemType == item::ItemTypeShield); } diff --git a/common/item_data.h b/common/item_data.h index 1ecba6734..ce3eccefa 100644 --- a/common/item_data.h +++ b/common/item_data.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA */ -#ifndef COMMON_ITEM_BASE_H -#define COMMON_ITEM_BASE_H +#ifndef COMMON_ITEM_DATA_H +#define COMMON_ITEM_DATA_H /* @@ -50,17 +50,6 @@ namespace EQEmu { namespace item { - enum ItemAttributeBit : uint32 { - bit_ItemAttributeNone = 0x00000000, - bit_ItemAttributeLore = 0x00000001, - bit_ItemAttributeArtifact = 0x00000002, - bit_ItemAttributeSummoned = 0x00000004, - bit_ItemAttributeMagic = 0x00000008, - bit_ItemAttributeAugment = 0x00000010, - bit_ItemAttributePendingLore = 0x00000020, - bit_ItemAttributeUnknown = 0xFFFFFFFF - }; - enum ItemClass { ItemClassCommon = 0, ItemClassBag, @@ -354,8 +343,8 @@ namespace EQEmu //ProcRate }; - extern uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type); - extern uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit); + uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type); + uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit); } /*item*/ @@ -364,10 +353,9 @@ namespace EQEmu const void * inst; }; - struct ItemBase { + struct ItemData { // Non packet based fields uint8 MinStatus; - uint8 ItemDataType; // memset to item::ItemDataBase ('0') during mmf load // Packet based fields uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book @@ -543,23 +531,15 @@ namespace EQEmu char ScrollName[65]; //BardName - bool IsEquipable(uint16 Race, uint16 Class); - bool IsClassCommon(); - bool IsClassBag(); - bool IsClassBook(); - bool IsType1HWeapon(); - bool IsType2HWeapon(); - bool IsTypeShield(); - - bool IsEquipable(uint16 Race, uint16 Class) const { return const_cast(this)->IsEquipable(Race, Class); } - bool IsClassCommon() const { return const_cast(this)->IsClassCommon(); } - bool IsClassBag() const { return const_cast(this)->IsClassBag(); } - bool IsClassBook() const { return const_cast(this)->IsClassBook(); } - bool IsType1HWeapon() const { return const_cast(this)->IsType1HWeapon(); } - bool IsType2HWeapon() const { return const_cast(this)->IsType2HWeapon(); } - bool IsTypeShield() const { return const_cast(this)->IsTypeShield(); } + bool IsEquipable(uint16 Race, uint16 Class) const; + bool IsClassCommon() const; + bool IsClassBag() const; + bool IsClassBook() const; + bool IsType1HWeapon() const; + bool IsType2HWeapon() const; + bool IsTypeShield() const; }; } /*EQEmu*/ -#endif /*COMMON_ITEM_BASE_H*/ +#endif /*COMMON_ITEM_DATA_H*/ diff --git a/common/item_instance.cpp b/common/item_instance.cpp index c8a75d0a7..c8beddd3c 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -30,7 +30,7 @@ #include -std::list dirty_inst; +std::list dirty_inst; int32 NextItemInstSerialNumber = 1; static inline int32 GetNextItemInstSerialNumber() { @@ -66,41 +66,41 @@ ItemInstQueue::~ItemInstQueue() } // Put item onto back of queue -void ItemInstQueue::push(ItemInst* inst) +void ItemInstQueue::push(EQEmu::ItemInstance* inst) { m_list.push_back(inst); } // Put item onto front of queue -void ItemInstQueue::push_front(ItemInst* inst) +void ItemInstQueue::push_front(EQEmu::ItemInstance* inst) { m_list.push_front(inst); } // Remove item from front of queue -ItemInst* ItemInstQueue::pop() +EQEmu::ItemInstance* ItemInstQueue::pop() { if (m_list.empty()) return nullptr; - ItemInst* inst = m_list.front(); + EQEmu::ItemInstance* inst = m_list.front(); m_list.pop_front(); return inst; } // Remove item from back of queue -ItemInst* ItemInstQueue::pop_back() +EQEmu::ItemInstance* ItemInstQueue::pop_back() { if (m_list.empty()) return nullptr; - ItemInst* inst = m_list.back(); + EQEmu::ItemInstance* inst = m_list.back(); m_list.pop_back(); return inst; } // Look at item at front of queue -ItemInst* ItemInstQueue::peek_front() const +EQEmu::ItemInstance* ItemInstQueue::peek_front() const { return (m_list.empty()) ? nullptr : m_list.front(); } @@ -146,16 +146,16 @@ void Inventory::CleanDirty() { dirty_inst.clear(); } -void Inventory::MarkDirty(ItemInst *inst) { +void Inventory::MarkDirty(EQEmu::ItemInstance *inst) { if (inst) { dirty_inst.push_back(inst); } } // Retrieve item at specified slot; returns false if item not found -ItemInst* Inventory::GetItem(int16 slot_id) const +EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const { - ItemInst* result = nullptr; + EQEmu::ItemInstance* result = nullptr; // Cursor if (slot_id == EQEmu::legacy::SlotCursor) { @@ -188,35 +188,35 @@ ItemInst* Inventory::GetItem(int16 slot_id) const // Inner bag slots else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { // Trade bag slots - ItemInst* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); + EQEmu::ItemInstance* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { // Shared Bank bag slots - ItemInst* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); + EQEmu::ItemInstance* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { // Bank bag slots - ItemInst* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); + EQEmu::ItemInstance* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { // Cursor bag slots - ItemInst* inst = m_cursor.peek_front(); + EQEmu::ItemInstance* inst = m_cursor.peek_front(); if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } } else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { // Personal inventory bag slots - ItemInst* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); + EQEmu::ItemInstance* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); } @@ -226,13 +226,13 @@ ItemInst* Inventory::GetItem(int16 slot_id) const } // Retrieve item at specified position within bag -ItemInst* Inventory::GetItem(int16 slot_id, uint8 bagidx) const +EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id, uint8 bagidx) const { return GetItem(Inventory::CalcSlotId(slot_id, bagidx)); } // Put an item snto specified slot -int16 Inventory::PutItem(int16 slot_id, const ItemInst& inst) +int16 Inventory::PutItem(int16 slot_id, const EQEmu::ItemInstance& inst) { // Clean up item already in slot (if exists) DeleteItem(slot_id); @@ -247,13 +247,13 @@ int16 Inventory::PutItem(int16 slot_id, const ItemInst& inst) return _PutItem(slot_id, inst.Clone()); } -int16 Inventory::PushCursor(const ItemInst& inst) +int16 Inventory::PushCursor(const EQEmu::ItemInstance& inst) { m_cursor.push(inst.Clone()); return EQEmu::legacy::SlotCursor; } -ItemInst* Inventory::GetCursorItem() +EQEmu::ItemInstance* Inventory::GetCursorItem() { return m_cursor.peek_front(); } @@ -262,8 +262,8 @@ ItemInst* Inventory::GetCursorItem() bool Inventory::SwapItem(int16 slot_a, int16 slot_b) { // Temp holding areas for a and b - ItemInst* inst_a = GetItem(slot_a); - ItemInst* inst_b = GetItem(slot_b); + EQEmu::ItemInstance* inst_a = GetItem(slot_a); + EQEmu::ItemInstance* inst_b = GetItem(slot_b); if (inst_a) { if (!inst_a->IsSlotAllowed(slot_b)) { return false; } } if (inst_b) { if (!inst_b->IsSlotAllowed(slot_a)) { return false; } } @@ -278,7 +278,7 @@ bool Inventory::SwapItem(int16 slot_a, int16 slot_b) bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) { // Pop item out of inventory map (or queue) - ItemInst* item_to_delete = PopItem(slot_id); + EQEmu::ItemInstance* item_to_delete = PopItem(slot_id); // Determine if object should be fully deleted, or // just a quantity of charges of the item can be deleted @@ -312,12 +312,12 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) // Checks All items in a bag for No Drop bool Inventory::CheckNoDrop(int16 slot_id) { - ItemInst* inst = GetItem(slot_id); + EQEmu::ItemInstance* inst = GetItem(slot_id); if (!inst) return false; if (!inst->GetItem()->NoDrop) return true; if (inst->GetItem()->ItemClass == 1) { for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { - ItemInst* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); + EQEmu::ItemInstance* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); if (bagitem && !bagitem->GetItem()->NoDrop) return true; } @@ -327,9 +327,9 @@ bool Inventory::CheckNoDrop(int16 slot_id) { // Remove item from bucket without memory delete // Returns item pointer if full delete was successful -ItemInst* Inventory::PopItem(int16 slot_id) +EQEmu::ItemInstance* Inventory::PopItem(int16 slot_id) { - ItemInst* p = nullptr; + EQEmu::ItemInstance* p = nullptr; if (slot_id == EQEmu::legacy::SlotCursor) { p = m_cursor.pop(); @@ -360,7 +360,7 @@ ItemInst* Inventory::PopItem(int16 slot_id) } else { // Is slot inside bag? - ItemInst* baginst = GetItem(Inventory::CalcSlotId(slot_id)); + EQEmu::ItemInstance* baginst = GetItem(Inventory::CalcSlotId(slot_id)); if (baginst != nullptr && baginst->IsClassBag()) { p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); } @@ -370,13 +370,13 @@ ItemInst* Inventory::PopItem(int16 slot_id) return p; } -bool Inventory::HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity) { +bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity) { if (ItemToTry->Stackable) { for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - ItemInst* InvItem = GetItem(i); + EQEmu::ItemInstance* InvItem = GetItem(i); if (InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { @@ -413,7 +413,7 @@ bool Inventory::HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - ItemInst* InvItem = GetItem(i); + EQEmu::ItemInstance* InvItem = GetItem(i); if (!InvItem) { @@ -625,7 +625,7 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo if (!for_bag) { for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - const ItemInst* inst = GetItem(i); + const EQEmu::ItemInstance* inst = GetItem(i); if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size) { if (inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver && inst->GetItem()->ItemType != EQEmu::item::ItemTypeArrow) @@ -658,7 +658,7 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo } // This is a mix of HasSpaceForItem and FindFreeSlot..due to existing coding behavior, it was better to add a new helper function... -int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { +int16 Inventory::FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst) { // Do not arbitrarily use this function..it is designed for use with Client::ResetTrade() and Client::FinishTrade(). // If you have a need, use it..but, understand it is not a compatible replacement for Inventory::FindFreeSlot(). // @@ -680,7 +680,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { // step 2: find partial room for stackables if (inst->IsStackable()) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const ItemInst* main_inst = m_inv[free_slot]; + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) continue; @@ -690,14 +690,14 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { } for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const ItemInst* main_inst = m_inv[free_slot]; + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) continue; if (main_inst->IsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { - const ItemInst* sub_inst = main_inst->GetItem(free_bag_slot); + const EQEmu::ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); if (!sub_inst) continue; @@ -712,7 +712,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { // step 3a: find room for container-specific items (ItemClassArrow) if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const ItemInst* main_inst = m_inv[free_slot]; + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeQuiver) || !main_inst->IsClassBag()) continue; @@ -727,7 +727,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { // step 3b: find room for container-specific items (ItemClassSmallThrowing) if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing) { for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const ItemInst* main_inst = m_inv[free_slot]; + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeBandolier) || !main_inst->IsClassBag()) continue; @@ -741,14 +741,14 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { // step 4: just find an empty slot for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const ItemInst* main_inst = m_inv[free_slot]; + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) return free_slot; } for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const ItemInst* main_inst = m_inv[free_slot]; + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; if (main_inst && main_inst->IsClassBag()) { if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeBandolier) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver)) @@ -903,7 +903,7 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) } } -bool Inventory::CanItemFitInContainer(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container) { +bool Inventory::CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container) { if (!ItemToTry || !Container) return false; @@ -959,7 +959,7 @@ bool Inventory::SupportsContainers(int16 slot_id) return false; } -int Inventory::GetSlotByItemInst(ItemInst *inst) { +int Inventory::GetSlotByItemInst(EQEmu::ItemInstance *inst) { if (!inst) return INVALID_INDEX; @@ -1066,9 +1066,9 @@ void Inventory::dumpSharedBankItems() { dumpItemCollection(m_shbank); } -int Inventory::GetSlotByItemInstCollection(const std::map &collection, ItemInst *inst) { +int Inventory::GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst) { for (auto iter = collection.begin(); iter != collection.end(); ++iter) { - ItemInst *t_inst = iter->second; + EQEmu::ItemInstance *t_inst = iter->second; if (t_inst == inst) { return iter->first; } @@ -1085,7 +1085,7 @@ int Inventory::GetSlotByItemInstCollection(const std::map &col return -1; } -void Inventory::dumpItemCollection(const std::map &collection) +void Inventory::dumpItemCollection(const std::map &collection) { for (auto it = collection.cbegin(); it != collection.cend(); ++it) { auto inst = it->second; @@ -1099,14 +1099,14 @@ void Inventory::dumpItemCollection(const std::map &collection) } } -void Inventory::dumpBagContents(ItemInst *inst, std::map::const_iterator *it) +void Inventory::dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it) { if (!inst || !inst->IsClassBag()) return; // Go through bag, if bag for (auto itb = inst->_cbegin(); itb != inst->_cend(); ++itb) { - ItemInst* baginst = itb->second; + EQEmu::ItemInstance* baginst = itb->second; if (!baginst || !baginst->GetItem()) continue; @@ -1118,7 +1118,7 @@ void Inventory::dumpBagContents(ItemInst *inst, std::map::cons } // Internal Method: Retrieves item within an inventory bucket -ItemInst* Inventory::_GetItem(const std::map& bucket, int16 slot_id) const +EQEmu::ItemInstance* Inventory::_GetItem(const std::map& bucket, int16 slot_id) const { auto it = bucket.find(slot_id); if (it != bucket.end()) { @@ -1131,7 +1131,7 @@ ItemInst* Inventory::_GetItem(const std::map& bucket, int16 sl // Internal Method: "put" item into bucket, without regard for what is currently in bucket // Assumes item has already been allocated -int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) +int16 Inventory::_PutItem(int16 slot_id, EQEmu::ItemInstance* inst) { // What happens here when we _PutItem(MainCursor)? Bad things..really bad things... // @@ -1178,7 +1178,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) else { // Slot must be within a bag parentSlot = Inventory::CalcSlotId(slot_id); - ItemInst* baginst = GetItem(parentSlot); // Get parent bag + EQEmu::ItemInstance* baginst = GetItem(parentSlot); // Get parent bag if (baginst && baginst->IsClassBag()) { baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); @@ -1195,7 +1195,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } // Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) +int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) { uint32 quantity_found = 0; @@ -1288,7 +1288,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) } // Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) +int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) { uint32 quantity_found = 0; @@ -1354,7 +1354,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) return INVALID_INDEX; } -int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) +int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) { for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { auto inst = iter->second; @@ -1438,12 +1438,12 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) // -// class ItemInst +// class EQEmu::ItemInstance // -ItemInst::ItemInst(const EQEmu::ItemBase* item, int16 charges) { +EQEmu::ItemInstance::ItemInstance(const ItemData* item, int16 charges) { m_use_type = ItemInstNormal; if(item) { - m_item = new EQEmu::ItemBase(*item); + m_item = new ItemData(*item); } else { m_item = nullptr; } @@ -1470,11 +1470,11 @@ ItemInst::ItemInst(const EQEmu::ItemBase* item, int16 charges) { m_recast_timestamp = 0; } -ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { +EQEmu::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges) { m_use_type = ItemInstNormal; m_item = db->GetItem(item_id); if(m_item) { - m_item = new EQEmu::ItemBase(*m_item); + m_item = new ItemData(*m_item); } else { m_item = nullptr; @@ -1503,7 +1503,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { m_recast_timestamp = 0; } -ItemInst::ItemInst(ItemInstTypes use_type) { +EQEmu::ItemInstance::ItemInstance(ItemInstTypes use_type) { m_use_type = use_type; m_item = nullptr; m_charges = 0; @@ -1524,12 +1524,12 @@ ItemInst::ItemInst(ItemInstTypes use_type) { m_recast_timestamp = 0; } -// Make a copy of an ItemInst object -ItemInst::ItemInst(const ItemInst& copy) +// Make a copy of an EQEmu::ItemInstance object +EQEmu::ItemInstance::ItemInstance(const ItemInstance& copy) { m_use_type=copy.m_use_type; if(copy.m_item) - m_item = new EQEmu::ItemBase(*copy.m_item); + m_item = new ItemData(*copy.m_item); else m_item = nullptr; @@ -1542,8 +1542,8 @@ ItemInst::ItemInst(const ItemInst& copy) m_merchantcount=copy.m_merchantcount; // Copy container contents for (auto it = copy.m_contents.begin(); it != copy.m_contents.end(); ++it) { - ItemInst* inst_old = it->second; - ItemInst* inst_new = nullptr; + ItemInstance* inst_old = it->second; + ItemInstance* inst_new = nullptr; if (inst_old) { inst_new = inst_old->Clone(); @@ -1565,7 +1565,7 @@ ItemInst::ItemInst(const ItemInst& copy) m_evolveLvl = copy.m_evolveLvl; m_activated = copy.m_activated; if (copy.m_scaledItem) - m_scaledItem = new EQEmu::ItemBase(*copy.m_scaledItem); + m_scaledItem = new ItemData(*copy.m_scaledItem); else m_scaledItem = nullptr; @@ -1582,7 +1582,7 @@ ItemInst::ItemInst(const ItemInst& copy) } // Clean up container contents -ItemInst::~ItemInst() +EQEmu::ItemInstance::~ItemInstance() { Clear(); safe_delete(m_item); @@ -1591,7 +1591,7 @@ ItemInst::~ItemInst() } // Query item type -bool ItemInst::IsType(EQEmu::item::ItemClass item_class) const +bool EQEmu::ItemInstance::IsType(EQEmu::item::ItemClass item_class) const { // IsType() does not protect against 'm_item = nullptr' @@ -1605,23 +1605,23 @@ bool ItemInst::IsType(EQEmu::item::ItemClass item_class) const return (m_item->ItemClass == item_class); } -bool ItemInst::IsClassCommon() +bool EQEmu::ItemInstance::IsClassCommon() const { return (m_item && m_item->IsClassCommon()); } -bool ItemInst::IsClassBag() +bool EQEmu::ItemInstance::IsClassBag() const { return (m_item && m_item->IsClassBag()); } -bool ItemInst::IsClassBook() +bool EQEmu::ItemInstance::IsClassBook() const { return (m_item && m_item->IsClassBook()); } // Is item stackable? -bool ItemInst::IsStackable() const +bool EQEmu::ItemInstance::IsStackable() const { if (!m_item) return false; @@ -1629,7 +1629,7 @@ bool ItemInst::IsStackable() const return m_item->Stackable; } -bool ItemInst::IsCharged() const +bool EQEmu::ItemInstance::IsCharged() const { if (!m_item) return false; @@ -1641,7 +1641,7 @@ bool ItemInst::IsCharged() const } // Can item be equipped? -bool ItemInst::IsEquipable(uint16 race, uint16 class_) const +bool EQEmu::ItemInstance::IsEquipable(uint16 race, uint16 class_) const { if (!m_item || (m_item->Slots == 0)) return false; @@ -1650,7 +1650,7 @@ bool ItemInst::IsEquipable(uint16 race, uint16 class_) const } // Can equip at this slot? -bool ItemInst::IsEquipable(int16 slot_id) const +bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const { if (!m_item) return false; @@ -1668,7 +1668,7 @@ bool ItemInst::IsEquipable(int16 slot_id) const return false; } -bool ItemInst::IsAugmentable() const +bool EQEmu::ItemInstance::IsAugmentable() const { if (!m_item) return false; @@ -1681,7 +1681,7 @@ bool ItemInst::IsAugmentable() const return false; } -bool ItemInst::AvailableWearSlot(uint32 aug_wear_slots) const { +bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const { // TODO: check to see if incoming 'aug_wear_slots' "switches" bit assignments like above... // (if wrong, would only affect MainAmmo and MainPowerSource augments) if (!m_item || !m_item->IsClassCommon()) @@ -1698,7 +1698,7 @@ bool ItemInst::AvailableWearSlot(uint32 aug_wear_slots) const { return (index < 23) ? true : false; } -int8 ItemInst::AvailableAugmentSlot(int32 augtype) const +int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const { if (!m_item || !m_item->IsClassCommon()) return INVALID_INDEX; @@ -1713,7 +1713,7 @@ int8 ItemInst::AvailableAugmentSlot(int32 augtype) const return (index < EQEmu::legacy::ITEM_COMMON_SIZE) ? index : INVALID_INDEX; } -bool ItemInst::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const +bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const { if (!m_item || !m_item->IsClassCommon()) return false; @@ -1725,7 +1725,7 @@ bool ItemInst::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const } // Retrieve item inside container -ItemInst* ItemInst::GetItem(uint8 index) const +EQEmu::ItemInstance* EQEmu::ItemInstance::GetItem(uint8 index) const { auto it = m_contents.find(index); if (it != m_contents.end()) { @@ -1735,16 +1735,16 @@ ItemInst* ItemInst::GetItem(uint8 index) const return nullptr; } -uint32 ItemInst::GetItemID(uint8 slot) const +uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const { - ItemInst *item = GetItem(slot); + ItemInstance *item = GetItem(slot); if (item) return item->GetID(); return NO_ITEM; } -void ItemInst::PutItem(uint8 index, const ItemInst& inst) +void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst) { // Clean up item already in slot (if exists) DeleteItem(index); @@ -1754,19 +1754,19 @@ void ItemInst::PutItem(uint8 index, const ItemInst& inst) } // Remove item inside container -void ItemInst::DeleteItem(uint8 index) +void EQEmu::ItemInstance::DeleteItem(uint8 index) { - ItemInst* inst = PopItem(index); + ItemInstance* inst = PopItem(index); safe_delete(inst); } // Remove item from container without memory delete // Hands over memory ownership to client of this function call -ItemInst* ItemInst::PopItem(uint8 index) +EQEmu::ItemInstance* EQEmu::ItemInstance::PopItem(uint8 index) { auto iter = m_contents.find(index); if (iter != m_contents.end()) { - ItemInst* inst = iter->second; + ItemInstance* inst = iter->second; m_contents.erase(index); return inst; // Return pointer that needs to be deleted (or otherwise managed) } @@ -1775,7 +1775,7 @@ ItemInst* ItemInst::PopItem(uint8 index) } // Remove all items from container -void ItemInst::Clear() +void EQEmu::ItemInstance::Clear() { // Destroy container contents for (auto iter = m_contents.begin(); iter != m_contents.end(); ++iter) { @@ -1785,22 +1785,22 @@ void ItemInst::Clear() } // Remove all items from container -void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) +void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) { // TODO: This needs work... // Destroy container contents - std::map::const_iterator cur, end, del; + std::map::const_iterator cur, end, del; cur = m_contents.begin(); end = m_contents.end(); for (; cur != end;) { - ItemInst* inst = cur->second; + ItemInstance* inst = cur->second; if (inst == nullptr) { cur = m_contents.erase(cur); continue; } - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (item == nullptr) { cur = m_contents.erase(cur); continue; @@ -1847,7 +1847,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) } } -uint8 ItemInst::FirstOpenSlot() const +uint8 EQEmu::ItemInstance::FirstOpenSlot() const { if (!m_item) return INVALID_INDEX; @@ -1861,7 +1861,7 @@ uint8 ItemInst::FirstOpenSlot() const return (i < slots) ? i : INVALID_INDEX; } -uint8 ItemInst::GetTotalItemCount() const +uint8 EQEmu::ItemInstance::GetTotalItemCount() const { if (!m_item) return 0; @@ -1875,7 +1875,7 @@ uint8 ItemInst::GetTotalItemCount() const return item_count; } -bool ItemInst::IsNoneEmptyContainer() +bool EQEmu::ItemInstance::IsNoneEmptyContainer() { if (!m_item || !m_item->IsClassBag()) return false; @@ -1889,7 +1889,7 @@ bool ItemInst::IsNoneEmptyContainer() } // Retrieve augment inside item -ItemInst* ItemInst::GetAugment(uint8 slot) const +EQEmu::ItemInstance* EQEmu::ItemInstance::GetAugment(uint8 slot) const { if (m_item && m_item->IsClassCommon()) return GetItem(slot); @@ -1897,7 +1897,7 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const return nullptr; } -ItemInst* ItemInst::GetOrnamentationAug(int32 ornamentationAugtype) const +EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentationAugtype) const { if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (ornamentationAugtype == 0) { return nullptr; } @@ -1922,7 +1922,7 @@ ItemInst* ItemInst::GetOrnamentationAug(int32 ornamentationAugtype) const return nullptr; } -uint32 ItemInst::GetOrnamentHeroModel(int32 material_slot) const { +uint32 EQEmu::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const { uint32 HeroModel = 0; if (m_ornament_hero_model > 0) { @@ -1935,7 +1935,7 @@ uint32 ItemInst::GetOrnamentHeroModel(int32 material_slot) const { return HeroModel; } -bool ItemInst::UpdateOrnamentationInfo() { +bool EQEmu::ItemInstance::UpdateOrnamentationInfo() { if (!m_item || !m_item->IsClassCommon()) return false; @@ -1944,7 +1944,7 @@ bool ItemInst::UpdateOrnamentationInfo() { int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); if (GetOrnamentationAug(ornamentationAugtype)) { - const EQEmu::ItemBase* ornamentItem; + const ItemData* ornamentItem; ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem(); if (ornamentItem != nullptr) { @@ -1971,7 +1971,7 @@ bool ItemInst::UpdateOrnamentationInfo() { return ornamentSet; } -bool ItemInst::CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container, bool AllowAll) { +bool EQEmu::ItemInstance::CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll) { if (!ItemToTry || !Container) return false; if (ItemToTry->ItemType == EQEmu::item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) @@ -2017,7 +2017,7 @@ bool ItemInst::CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemB return false; } -uint32 ItemInst::GetAugmentItemID(uint8 slot) const +uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const { if (!m_item || !m_item->IsClassCommon()) return NO_ITEM; @@ -2026,7 +2026,7 @@ uint32 ItemInst::GetAugmentItemID(uint8 slot) const } // Add an augment to the item -void ItemInst::PutAugment(uint8 slot, const ItemInst& augment) +void EQEmu::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment) { if (!m_item || !m_item->IsClassCommon()) return; @@ -2034,12 +2034,12 @@ void ItemInst::PutAugment(uint8 slot, const ItemInst& augment) PutItem(slot, augment); } -void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) +void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) { if (item_id == NO_ITEM) { return; } if (db == nullptr) { return; /* TODO: add log message for nullptr */ } - const ItemInst* aug = db->CreateItem(item_id); + const ItemInstance* aug = db->CreateItem(item_id); if (aug) { PutAugment(slot, *aug); safe_delete(aug); @@ -2047,7 +2047,7 @@ void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) } // Remove augment from item and destroy it -void ItemInst::DeleteAugment(uint8 index) +void EQEmu::ItemInstance::DeleteAugment(uint8 index) { if (!m_item || !m_item->IsClassCommon()) return; @@ -2056,7 +2056,7 @@ void ItemInst::DeleteAugment(uint8 index) } // Remove augment from item and return it -ItemInst* ItemInst::RemoveAugment(uint8 index) +EQEmu::ItemInstance* EQEmu::ItemInstance::RemoveAugment(uint8 index) { if (!m_item || !m_item->IsClassCommon()) return nullptr; @@ -2064,7 +2064,7 @@ ItemInst* ItemInst::RemoveAugment(uint8 index) return PopItem(index); } -bool ItemInst::IsAugmented() +bool EQEmu::ItemInstance::IsAugmented() { if (!m_item || !m_item->IsClassCommon()) return false; @@ -2078,7 +2078,7 @@ bool ItemInst::IsAugmented() } // Has attack/delay? -bool ItemInst::IsWeapon() const +bool EQEmu::ItemInstance::IsWeapon() const { if (!m_item || !m_item->IsClassCommon()) return false; @@ -2089,7 +2089,7 @@ bool ItemInst::IsWeapon() const return ((m_item->Damage != 0) && (m_item->Delay != 0)); } -bool ItemInst::IsAmmo() const +bool EQEmu::ItemInstance::IsAmmo() const { if (!m_item) return false; @@ -2105,7 +2105,7 @@ bool ItemInst::IsAmmo() const } -const EQEmu::ItemBase* ItemInst::GetItem() const +const EQEmu::ItemData* EQEmu::ItemInstance::GetItem() const { if (!m_item) return nullptr; @@ -2116,13 +2116,13 @@ const EQEmu::ItemBase* ItemInst::GetItem() const return m_item; } -const EQEmu::ItemBase* ItemInst::GetUnscaledItem() const +const EQEmu::ItemData* EQEmu::ItemInstance::GetUnscaledItem() const { // No operator calls and defaults to nullptr return m_item; } -std::string ItemInst::GetCustomDataString() const { +std::string EQEmu::ItemInstance::GetCustomDataString() const { std::string ret_val; auto iter = m_custom_data.begin(); while (iter != m_custom_data.end()) { @@ -2141,7 +2141,7 @@ std::string ItemInst::GetCustomDataString() const { return ret_val; } -std::string ItemInst::GetCustomData(std::string identifier) { +std::string EQEmu::ItemInstance::GetCustomData(std::string identifier) { std::map::const_iterator iter = m_custom_data.find(identifier); if (iter != m_custom_data.end()) { return iter->second; @@ -2150,49 +2150,49 @@ std::string ItemInst::GetCustomData(std::string identifier) { return ""; } -void ItemInst::SetCustomData(std::string identifier, std::string value) { +void EQEmu::ItemInstance::SetCustomData(std::string identifier, std::string value) { DeleteCustomData(identifier); m_custom_data[identifier] = value; } -void ItemInst::SetCustomData(std::string identifier, int value) { +void EQEmu::ItemInstance::SetCustomData(std::string identifier, int value) { DeleteCustomData(identifier); std::stringstream ss; ss << value; m_custom_data[identifier] = ss.str(); } -void ItemInst::SetCustomData(std::string identifier, float value) { +void EQEmu::ItemInstance::SetCustomData(std::string identifier, float value) { DeleteCustomData(identifier); std::stringstream ss; ss << value; m_custom_data[identifier] = ss.str(); } -void ItemInst::SetCustomData(std::string identifier, bool value) { +void EQEmu::ItemInstance::SetCustomData(std::string identifier, bool value) { DeleteCustomData(identifier); std::stringstream ss; ss << value; m_custom_data[identifier] = ss.str(); } -void ItemInst::DeleteCustomData(std::string identifier) { +void EQEmu::ItemInstance::DeleteCustomData(std::string identifier) { auto iter = m_custom_data.find(identifier); if (iter != m_custom_data.end()) { m_custom_data.erase(iter); } } -// Clone a type of ItemInst object +// Clone a type of EQEmu::ItemInstance object // c++ doesn't allow a polymorphic copy constructor, // so we have to resort to a polymorphic Clone() -ItemInst* ItemInst::Clone() const +EQEmu::ItemInstance* EQEmu::ItemInstance::Clone() const { // Pseudo-polymorphic copy constructor - return new ItemInst(*this); + return new ItemInstance(*this); } -bool ItemInst::IsSlotAllowed(int16 slot_id) const { +bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const { // 'SupportsContainers' and 'slot_id > 21' previously saw the reassigned PowerSource slot (9999 to 22) as valid if (!m_item) { return false; } else if (Inventory::SupportsContainers(slot_id)) { return true; } @@ -2202,7 +2202,7 @@ bool ItemInst::IsSlotAllowed(int16 slot_id) const { else { return false; } } -void ItemInst::Initialize(SharedDatabase *db) { +void EQEmu::ItemInstance::Initialize(SharedDatabase *db) { // if there's no actual item, don't do anything if (!m_item) return; @@ -2219,15 +2219,15 @@ void ItemInst::Initialize(SharedDatabase *db) { } } -void ItemInst::ScaleItem() { +void EQEmu::ItemInstance::ScaleItem() { if (!m_item) return; if (m_scaledItem) { - memcpy(m_scaledItem, m_item, sizeof(EQEmu::ItemBase)); + memcpy(m_scaledItem, m_item, sizeof(ItemData)); } else { - m_scaledItem = new EQEmu::ItemBase(*m_item); + m_scaledItem = new ItemData(*m_item); } float Mult = (float)(GetExp()) / 10000; // scaling is determined by exp, with 10,000 being full stats @@ -2303,18 +2303,18 @@ void ItemInst::ScaleItem() { m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself. } -bool ItemInst::EvolveOnAllKills() const { +bool EQEmu::ItemInstance::EvolveOnAllKills() const { return (m_evolveInfo && m_evolveInfo->AllKills); } -int8 ItemInst::GetMaxEvolveLvl() const { +int8 EQEmu::ItemInstance::GetMaxEvolveLvl() const { if (m_evolveInfo) return m_evolveInfo->MaxLvl; else return 0; } -uint32 ItemInst::GetKillsNeeded(uint8 currentlevel) { +uint32 EQEmu::ItemInstance::GetKillsNeeded(uint8 currentlevel) { uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero. if (m_evolveInfo) if (currentlevel != m_evolveInfo->MaxLvl) @@ -2326,24 +2326,24 @@ uint32 ItemInst::GetKillsNeeded(uint8 currentlevel) { return kills; } -void ItemInst::SetTimer(std::string name, uint32 time) { +void EQEmu::ItemInstance::SetTimer(std::string name, uint32 time) { Timer t(time); t.Start(time, false); m_timers[name] = t; } -void ItemInst::StopTimer(std::string name) { +void EQEmu::ItemInstance::StopTimer(std::string name) { auto iter = m_timers.find(name); if(iter != m_timers.end()) { m_timers.erase(iter); } } -void ItemInst::ClearTimers() { +void EQEmu::ItemInstance::ClearTimers() { m_timers.clear(); } -int ItemInst::GetItemArmorClass(bool augments) const +int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const { int ac = 0; const auto item = GetItem(); @@ -2357,7 +2357,7 @@ int ItemInst::GetItemArmorClass(bool augments) const return ac; } -int ItemInst::GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments) const +int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments) const { const auto item = GetItem(); if (item) { @@ -2399,7 +2399,7 @@ int ItemInst::GetItemElementalDamage(int &magic, int &fire, int &cold, int &pois return magic + fire + cold + poison + disease + chromatic + prismatic + physical + corruption; } -int ItemInst::GetItemElementalFlag(bool augments) const +int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const { int flag = 0; const auto item = GetItem(); @@ -2420,7 +2420,7 @@ int ItemInst::GetItemElementalFlag(bool augments) const return flag; } -int ItemInst::GetItemElementalDamage(bool augments) const +int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const { int damage = 0; const auto item = GetItem(); @@ -2441,7 +2441,7 @@ int ItemInst::GetItemElementalDamage(bool augments) const return damage; } -int ItemInst::GetItemRecommendedLevel(bool augments) const +int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const { int level = 0; const auto item = GetItem(); @@ -2463,7 +2463,7 @@ int ItemInst::GetItemRecommendedLevel(bool augments) const return level; } -int ItemInst::GetItemRequiredLevel(bool augments) const +int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const { int level = 0; const auto item = GetItem(); @@ -2485,7 +2485,7 @@ int ItemInst::GetItemRequiredLevel(bool augments) const return level; } -int ItemInst::GetItemWeaponDamage(bool augments) const +int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const { int damage = 0; const auto item = GetItem(); @@ -2501,7 +2501,7 @@ int ItemInst::GetItemWeaponDamage(bool augments) const return damage; } -int ItemInst::GetItemBackstabDamage(bool augments) const +int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const { int damage = 0; const auto item = GetItem(); @@ -2517,7 +2517,7 @@ int ItemInst::GetItemBackstabDamage(bool augments) const return damage; } -int ItemInst::GetItemBaneDamageBody(bool augments) const +int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const { int body = 0; const auto item = GetItem(); @@ -2538,7 +2538,7 @@ int ItemInst::GetItemBaneDamageBody(bool augments) const return body; } -int ItemInst::GetItemBaneDamageRace(bool augments) const +int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const { int race = 0; const auto item = GetItem(); @@ -2559,7 +2559,7 @@ int ItemInst::GetItemBaneDamageRace(bool augments) const return race; } -int ItemInst::GetItemBaneDamageBody(bodyType against, bool augments) const +int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) const { int damage = 0; const auto item = GetItem(); @@ -2576,7 +2576,7 @@ int ItemInst::GetItemBaneDamageBody(bodyType against, bool augments) const return damage; } -int ItemInst::GetItemBaneDamageRace(uint16 against, bool augments) const +int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) const { int damage = 0; const auto item = GetItem(); @@ -2593,7 +2593,7 @@ int ItemInst::GetItemBaneDamageRace(uint16 against, bool augments) const return damage; } -int ItemInst::GetItemMagical(bool augments) const +int EQEmu::ItemInstance::GetItemMagical(bool augments) const { const auto item = GetItem(); if (item) { @@ -2609,7 +2609,7 @@ int ItemInst::GetItemMagical(bool augments) const return 0; } -int ItemInst::GetItemHP(bool augments) const +int EQEmu::ItemInstance::GetItemHP(bool augments) const { int hp = 0; const auto item = GetItem(); @@ -2623,7 +2623,7 @@ int ItemInst::GetItemHP(bool augments) const return hp; } -int ItemInst::GetItemMana(bool augments) const +int EQEmu::ItemInstance::GetItemMana(bool augments) const { int mana = 0; const auto item = GetItem(); @@ -2637,7 +2637,7 @@ int ItemInst::GetItemMana(bool augments) const return mana; } -int ItemInst::GetItemEndur(bool augments) const +int EQEmu::ItemInstance::GetItemEndur(bool augments) const { int endur = 0; const auto item = GetItem(); @@ -2651,7 +2651,7 @@ int ItemInst::GetItemEndur(bool augments) const return endur; } -int ItemInst::GetItemAttack(bool augments) const +int EQEmu::ItemInstance::GetItemAttack(bool augments) const { int atk = 0; const auto item = GetItem(); @@ -2665,7 +2665,7 @@ int ItemInst::GetItemAttack(bool augments) const return atk; } -int ItemInst::GetItemStr(bool augments) const +int EQEmu::ItemInstance::GetItemStr(bool augments) const { int str = 0; const auto item = GetItem(); @@ -2679,7 +2679,7 @@ int ItemInst::GetItemStr(bool augments) const return str; } -int ItemInst::GetItemSta(bool augments) const +int EQEmu::ItemInstance::GetItemSta(bool augments) const { int sta = 0; const auto item = GetItem(); @@ -2693,7 +2693,7 @@ int ItemInst::GetItemSta(bool augments) const return sta; } -int ItemInst::GetItemDex(bool augments) const +int EQEmu::ItemInstance::GetItemDex(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2707,7 +2707,7 @@ int ItemInst::GetItemDex(bool augments) const return total; } -int ItemInst::GetItemAgi(bool augments) const +int EQEmu::ItemInstance::GetItemAgi(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2721,7 +2721,7 @@ int ItemInst::GetItemAgi(bool augments) const return total; } -int ItemInst::GetItemInt(bool augments) const +int EQEmu::ItemInstance::GetItemInt(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2735,7 +2735,7 @@ int ItemInst::GetItemInt(bool augments) const return total; } -int ItemInst::GetItemWis(bool augments) const +int EQEmu::ItemInstance::GetItemWis(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2749,7 +2749,7 @@ int ItemInst::GetItemWis(bool augments) const return total; } -int ItemInst::GetItemCha(bool augments) const +int EQEmu::ItemInstance::GetItemCha(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2763,7 +2763,7 @@ int ItemInst::GetItemCha(bool augments) const return total; } -int ItemInst::GetItemMR(bool augments) const +int EQEmu::ItemInstance::GetItemMR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2777,7 +2777,7 @@ int ItemInst::GetItemMR(bool augments) const return total; } -int ItemInst::GetItemFR(bool augments) const +int EQEmu::ItemInstance::GetItemFR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2791,7 +2791,7 @@ int ItemInst::GetItemFR(bool augments) const return total; } -int ItemInst::GetItemCR(bool augments) const +int EQEmu::ItemInstance::GetItemCR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2805,7 +2805,7 @@ int ItemInst::GetItemCR(bool augments) const return total; } -int ItemInst::GetItemPR(bool augments) const +int EQEmu::ItemInstance::GetItemPR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2819,7 +2819,7 @@ int ItemInst::GetItemPR(bool augments) const return total; } -int ItemInst::GetItemDR(bool augments) const +int EQEmu::ItemInstance::GetItemDR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2833,7 +2833,7 @@ int ItemInst::GetItemDR(bool augments) const return total; } -int ItemInst::GetItemCorrup(bool augments) const +int EQEmu::ItemInstance::GetItemCorrup(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2847,7 +2847,7 @@ int ItemInst::GetItemCorrup(bool augments) const return total; } -int ItemInst::GetItemHeroicStr(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2861,7 +2861,7 @@ int ItemInst::GetItemHeroicStr(bool augments) const return total; } -int ItemInst::GetItemHeroicSta(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2875,7 +2875,7 @@ int ItemInst::GetItemHeroicSta(bool augments) const return total; } -int ItemInst::GetItemHeroicDex(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2889,7 +2889,7 @@ int ItemInst::GetItemHeroicDex(bool augments) const return total; } -int ItemInst::GetItemHeroicAgi(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2903,7 +2903,7 @@ int ItemInst::GetItemHeroicAgi(bool augments) const return total; } -int ItemInst::GetItemHeroicInt(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2917,7 +2917,7 @@ int ItemInst::GetItemHeroicInt(bool augments) const return total; } -int ItemInst::GetItemHeroicWis(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2931,7 +2931,7 @@ int ItemInst::GetItemHeroicWis(bool augments) const return total; } -int ItemInst::GetItemHeroicCha(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2945,7 +2945,7 @@ int ItemInst::GetItemHeroicCha(bool augments) const return total; } -int ItemInst::GetItemHeroicMR(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2959,7 +2959,7 @@ int ItemInst::GetItemHeroicMR(bool augments) const return total; } -int ItemInst::GetItemHeroicFR(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2973,7 +2973,7 @@ int ItemInst::GetItemHeroicFR(bool augments) const return total; } -int ItemInst::GetItemHeroicCR(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -2987,7 +2987,7 @@ int ItemInst::GetItemHeroicCR(bool augments) const return total; } -int ItemInst::GetItemHeroicPR(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -3001,7 +3001,7 @@ int ItemInst::GetItemHeroicPR(bool augments) const return total; } -int ItemInst::GetItemHeroicDR(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const { int total = 0; const auto item = GetItem(); @@ -3015,7 +3015,7 @@ int ItemInst::GetItemHeroicDR(bool augments) const return total; } -int ItemInst::GetItemHeroicCorrup(bool augments) const +int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const { int total = 0; const auto item = GetItem(); @@ -3029,7 +3029,7 @@ int ItemInst::GetItemHeroicCorrup(bool augments) const return total; } -int ItemInst::GetItemHaste(bool augments) const +int EQEmu::ItemInstance::GetItemHaste(bool augments) const { int total = 0; const auto item = GetItem(); diff --git a/common/item_instance.h b/common/item_instance.h index 3ea3ba224..29523c1b1 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -21,8 +21,8 @@ // These classes could be optimized with database reads/writes by storing // a status flag indicating how object needs to interact with database -#ifndef COMMON_ITEM_H -#define COMMON_ITEM_H +#ifndef COMMON_ITEM_INSTANCE_H +#define COMMON_ITEM_INSTANCE_H class ItemParse; // Parses item packets @@ -51,7 +51,7 @@ namespace ItemField }; }; -// Specifies usage type for item inside ItemInst +// Specifies usage type for item inside EQEmu::ItemInstance enum ItemInstTypes { ItemInstNormal = 0, @@ -76,7 +76,10 @@ enum { invWhereCursor = 0x20 }; -class ItemInst; +namespace EQEmu +{ + class ItemInstance; +} // ######################################## // Class: Queue @@ -89,24 +92,24 @@ public: // Public Methods ///////////////////////// - inline std::list::const_iterator cbegin() { return m_list.cbegin(); } - inline std::list::const_iterator cend() { return m_list.cend(); } + inline std::list::const_iterator cbegin() { return m_list.cbegin(); } + inline std::list::const_iterator cend() { return m_list.cend(); } inline int size() { return static_cast(m_list.size()); } // TODO: change to size_t inline bool empty() { return m_list.empty(); } - void push(ItemInst* inst); - void push_front(ItemInst* inst); - ItemInst* pop(); - ItemInst* pop_back(); - ItemInst* peek_front() const; + void push(EQEmu::ItemInstance* inst); + void push_front(EQEmu::ItemInstance* inst); + EQEmu::ItemInstance* pop(); + EQEmu::ItemInstance* pop_back(); + EQEmu::ItemInstance* peek_front() const; protected: ///////////////////////// // Protected Members ///////////////////////// - std::list m_list; + std::list m_list; }; // ######################################## @@ -114,7 +117,7 @@ protected: // Character inventory class Inventory { - friend class ItemInst; + friend class EQEmu::ItemInstance; public: /////////////////////////////// // Public Methods @@ -138,29 +141,29 @@ public: EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; } static void CleanDirty(); - static void MarkDirty(ItemInst *inst); + static void MarkDirty(EQEmu::ItemInstance *inst); // Retrieve a writeable item at specified slot - ItemInst* GetItem(int16 slot_id) const; - ItemInst* GetItem(int16 slot_id, uint8 bagidx) const; + EQEmu::ItemInstance* GetItem(int16 slot_id) const; + EQEmu::ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const; - inline std::list::const_iterator cursor_cbegin() { return m_cursor.cbegin(); } - inline std::list::const_iterator cursor_cend() { return m_cursor.cend(); } + inline std::list::const_iterator cursor_cbegin() { return m_cursor.cbegin(); } + inline std::list::const_iterator cursor_cend() { return m_cursor.cend(); } inline int CursorSize() { return m_cursor.size(); } inline bool CursorEmpty() { return m_cursor.empty(); } // Retrieve a read-only item from inventory - inline const ItemInst* operator[](int16 slot_id) const { return GetItem(slot_id); } + inline const EQEmu::ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); } // Add item to inventory - int16 PutItem(int16 slot_id, const ItemInst& inst); + int16 PutItem(int16 slot_id, const EQEmu::ItemInstance& inst); // Add item to cursor queue - int16 PushCursor(const ItemInst& inst); + int16 PushCursor(const EQEmu::ItemInstance& inst); // Get cursor item in front of queue - ItemInst* GetCursorItem(); + EQEmu::ItemInstance* GetCursorItem(); // Swap items in inventory bool SwapItem(int16 slot_a, int16 slot_b); @@ -172,10 +175,10 @@ public: bool CheckNoDrop(int16 slot_id); // Remove item from inventory (and take control of memory) - ItemInst* PopItem(int16 slot_id); + EQEmu::ItemInstance* PopItem(int16 slot_id); // Check whether there is space for the specified number of the specified item. - bool HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity); + bool HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity); // Check whether item exists in inventory // where argument specifies OR'd list of invWhere constants to look @@ -191,7 +194,7 @@ public: // Locate an available inventory slot int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); - int16 FindFreeSlotForTradeItem(const ItemInst* inst); + int16 FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst); // Calculate slot_id for an item within a bag static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id @@ -200,7 +203,7 @@ public: static int16 CalcSlotFromMaterial(uint8 material); static uint8 CalcMaterialFromSlot(int16 equipslot); - static bool CanItemFitInContainer(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container); + static bool CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container); // Test for valid inventory casting slot bool SupportsClickCasting(int16 slot_id); @@ -209,7 +212,7 @@ public: // Test whether a given slot can support a container item static bool SupportsContainers(int16 slot_id); - int GetSlotByItemInst(ItemInst *inst); + int GetSlotByItemInst(EQEmu::ItemInstance *inst); uint8 FindBrightestLightType(); @@ -229,31 +232,31 @@ protected: // Protected Methods /////////////////////////////// - int GetSlotByItemInstCollection(const std::map &collection, ItemInst *inst); - void dumpItemCollection(const std::map &collection); - void dumpBagContents(ItemInst *inst, std::map::const_iterator *it); + int GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst); + void dumpItemCollection(const std::map &collection); + void dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it); // Retrieves item within an inventory bucket - ItemInst* _GetItem(const std::map& bucket, int16 slot_id) const; + EQEmu::ItemInstance* _GetItem(const std::map& bucket, int16 slot_id) const; // Private "put" item into bucket, without regard for what is currently in bucket - int16 _PutItem(int16 slot_id, ItemInst* inst); + int16 _PutItem(int16 slot_id, EQEmu::ItemInstance* inst); // Checks an inventory bucket for a particular item - int16 _HasItem(std::map& bucket, uint32 item_id, uint8 quantity); + int16 _HasItem(std::map& bucket, uint32 item_id, uint8 quantity); int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); - int16 _HasItemByUse(std::map& bucket, uint8 use, uint8 quantity); + int16 _HasItemByUse(std::map& bucket, uint8 use, uint8 quantity); int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); - int16 _HasItemByLoreGroup(std::map& bucket, uint32 loregroup); + int16 _HasItemByLoreGroup(std::map& bucket, uint32 loregroup); int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); // Player inventory - std::map m_worn; // Items worn by character - std::map m_inv; // Items in character personal inventory - std::map m_bank; // Items in character bank - std::map m_shbank; // Items in character shared bank - std::map m_trade; // Items in a trade session + std::map m_worn; // Items worn by character + std::map m_inv; // Items in character personal inventory + std::map m_bank; // Items in character bank + std::map m_shbank; // Items in character shared bank + std::map m_trade; // Items in a trade session ItemInstQueue m_cursor; // Items on cursor: FIFO private: @@ -265,271 +268,269 @@ private: class SharedDatabase; // ######################################## -// Class: ItemInst +// Class: EQEmu::ItemInstance // Base class for an instance of an item // An item instance encapsulates item data + data specific // to an item instance (includes dye, augments, charges, etc) -class ItemInst +namespace EQEmu { -public: - ///////////////////////// - // Methods - ///////////////////////// + class ItemInstance { + public: + ///////////////////////// + // Methods + ///////////////////////// - // Constructors/Destructor - ItemInst(const EQEmu::ItemBase* item = nullptr, int16 charges = 0); + // Constructors/Destructor + ItemInstance(const ItemData* item = nullptr, int16 charges = 0); - ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0); + ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges = 0); - ItemInst(ItemInstTypes use_type); + ItemInstance(ItemInstTypes use_type); - ItemInst(const ItemInst& copy); + ItemInstance(const ItemInstance& copy); - ~ItemInst(); + ~ItemInstance(); - // Query item type - bool IsType(EQEmu::item::ItemClass item_class) const; + // Query item type + bool IsType(EQEmu::item::ItemClass item_class) const; - bool IsClassCommon(); - bool IsClassBag(); - bool IsClassBook(); + bool IsClassCommon() const; + bool IsClassBag() const; + bool IsClassBook() const; - bool IsClassCommon() const { return const_cast(this)->IsClassCommon(); } - bool IsClassBag() const { return const_cast(this)->IsClassBag(); } - bool IsClassBook() const { return const_cast(this)->IsClassBook(); } + // Can item be stacked? + bool IsStackable() const; + bool IsCharged() const; - // Can item be stacked? - bool IsStackable() const; - bool IsCharged() const; + // Can item be equipped by/at? + bool IsEquipable(uint16 race, uint16 class_) const; + bool IsEquipable(int16 slot_id) const; - // Can item be equipped by/at? - bool IsEquipable(uint16 race, uint16 class_) const; - bool IsEquipable(int16 slot_id) const; + // + // Augments + // + bool IsAugmentable() const; + bool AvailableWearSlot(uint32 aug_wear_slots) const; + int8 AvailableAugmentSlot(int32 augtype) const; + bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; + inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); } - // - // Augments - // - bool IsAugmentable() const; - bool AvailableWearSlot(uint32 aug_wear_slots) const; - int8 AvailableAugmentSlot(int32 augtype) const; - bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; - inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); } + inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); } - inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); } + // + // Contents + // + ItemInstance* GetItem(uint8 slot) const; + uint32 GetItemID(uint8 slot) const; + inline const ItemInstance* operator[](uint8 slot) const { return GetItem(slot); } + void PutItem(uint8 slot, const ItemInstance& inst); + void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id) { return; } // not defined anywhere... + void DeleteItem(uint8 slot); + ItemInstance* PopItem(uint8 index); + void Clear(); + void ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent); + uint8 FirstOpenSlot() const; + uint8 GetTotalItemCount() const; + bool IsNoneEmptyContainer(); + std::map* GetContents() { return &m_contents; } - // - // Contents - // - ItemInst* GetItem(uint8 slot) const; - uint32 GetItemID(uint8 slot) const; - inline const ItemInst* operator[](uint8 slot) const { return GetItem(slot); } - void PutItem(uint8 slot, const ItemInst& inst); - void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id) { return; } // not defined anywhere... - void DeleteItem(uint8 slot); - ItemInst* PopItem(uint8 index); - void Clear(); - void ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent); - uint8 FirstOpenSlot() const; - uint8 GetTotalItemCount() const; - bool IsNoneEmptyContainer(); - std::map* GetContents() { return &m_contents; } + // + // Augments + // + ItemInstance* GetAugment(uint8 slot) const; + uint32 GetAugmentItemID(uint8 slot) const; + void PutAugment(uint8 slot, const ItemInstance& inst); + void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id); + void DeleteAugment(uint8 slot); + ItemInstance* RemoveAugment(uint8 index); + bool IsAugmented(); + ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const; + bool UpdateOrnamentationInfo(); + static bool CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll = false); - // - // Augments - // - ItemInst* GetAugment(uint8 slot) const; - uint32 GetAugmentItemID(uint8 slot) const; - void PutAugment(uint8 slot, const ItemInst& inst); - void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id); - void DeleteAugment(uint8 slot); - ItemInst* RemoveAugment(uint8 index); - bool IsAugmented(); - ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const; - bool UpdateOrnamentationInfo(); - static bool CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container, bool AllowAll = false); - - // Has attack/delay? - bool IsWeapon() const; - bool IsAmmo() const; + // Has attack/delay? + bool IsWeapon() const; + bool IsAmmo() const; - // Accessors - const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); } - const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); } - const EQEmu::ItemBase* GetItem() const; - const EQEmu::ItemBase* GetUnscaledItem() const; + // Accessors + const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); } + const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); } + const ItemData* GetItem() const; + const ItemData* GetUnscaledItem() const; - int16 GetCharges() const { return m_charges; } - void SetCharges(int16 charges) { m_charges = charges; } + int16 GetCharges() const { return m_charges; } + void SetCharges(int16 charges) { m_charges = charges; } - uint32 GetPrice() const { return m_price; } - void SetPrice(uint32 price) { m_price = price; } + uint32 GetPrice() const { return m_price; } + void SetPrice(uint32 price) { m_price = price; } - void SetColor(uint32 color) { m_color = color; } - uint32 GetColor() const { return m_color; } + void SetColor(uint32 color) { m_color = color; } + uint32 GetColor() const { return m_color; } - uint32 GetMerchantSlot() const { return m_merchantslot; } - void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; } + uint32 GetMerchantSlot() const { return m_merchantslot; } + void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; } - int32 GetMerchantCount() const { return m_merchantcount; } - void SetMerchantCount(int32 count) { m_merchantcount = count; } + int32 GetMerchantCount() const { return m_merchantcount; } + void SetMerchantCount(int32 count) { m_merchantcount = count; } - int16 GetCurrentSlot() const { return m_currentslot; } - void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; } + int16 GetCurrentSlot() const { return m_currentslot; } + void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; } - // Is this item already attuned? - bool IsAttuned() const { return m_attuned; } - void SetAttuned(bool flag) { m_attuned=flag; } + // Is this item already attuned? + bool IsAttuned() const { return m_attuned; } + void SetAttuned(bool flag) { m_attuned = flag; } - std::string GetCustomDataString() const; - std::string GetCustomData(std::string identifier); - void SetCustomData(std::string identifier, std::string value); - void SetCustomData(std::string identifier, int value); - void SetCustomData(std::string identifier, float value); - void SetCustomData(std::string identifier, bool value); - void DeleteCustomData(std::string identifier); + std::string GetCustomDataString() const; + std::string GetCustomData(std::string identifier); + void SetCustomData(std::string identifier, std::string value); + void SetCustomData(std::string identifier, int value); + void SetCustomData(std::string identifier, float value); + void SetCustomData(std::string identifier, bool value); + void DeleteCustomData(std::string identifier); - // Allows treatment of this object as though it were a pointer to m_item - operator bool() const { return (m_item != nullptr); } + // Allows treatment of this object as though it were a pointer to m_item + operator bool() const { return (m_item != nullptr); } - // Compare inner Item_Struct of two ItemInst objects - bool operator==(const ItemInst& right) const { return (this->m_item == right.m_item); } - bool operator!=(const ItemInst& right) const { return (this->m_item != right.m_item); } + // Compare inner Item_Struct of two ItemInstance objects + bool operator==(const ItemInstance& right) const { return (this->m_item == right.m_item); } + bool operator!=(const ItemInstance& right) const { return (this->m_item != right.m_item); } - // Clone current item - ItemInst* Clone() const; + // Clone current item + ItemInstance* Clone() const; - bool IsSlotAllowed(int16 slot_id) const; + bool IsSlotAllowed(int16 slot_id) const; - bool IsScaling() const { return m_scaling; } - bool IsEvolving() const { return (m_evolveLvl >= 1); } - uint32 GetExp() const { return m_exp; } - void SetExp(uint32 exp) { m_exp = exp; } - void AddExp(uint32 exp) { m_exp += exp; } - bool IsActivated() { return m_activated; } - void SetActivated(bool activated) { m_activated = activated; } - int8 GetEvolveLvl() const { return m_evolveLvl; } - void SetScaling(bool v) { m_scaling = v; } - uint32 GetOrnamentationIcon() const { return m_ornamenticon; } - void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; } - uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; } - void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; } - uint32 GetOrnamentHeroModel(int32 material_slot = -1) const; - void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; } - uint32 GetRecastTimestamp() const { return m_recast_timestamp; } - void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; } + bool IsScaling() const { return m_scaling; } + bool IsEvolving() const { return (m_evolveLvl >= 1); } + uint32 GetExp() const { return m_exp; } + void SetExp(uint32 exp) { m_exp = exp; } + void AddExp(uint32 exp) { m_exp += exp; } + bool IsActivated() { return m_activated; } + void SetActivated(bool activated) { m_activated = activated; } + int8 GetEvolveLvl() const { return m_evolveLvl; } + void SetScaling(bool v) { m_scaling = v; } + uint32 GetOrnamentationIcon() const { return m_ornamenticon; } + void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; } + uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; } + void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; } + uint32 GetOrnamentHeroModel(int32 material_slot = -1) const; + void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; } + uint32 GetRecastTimestamp() const { return m_recast_timestamp; } + void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; } - void Initialize(SharedDatabase *db = nullptr); - void ScaleItem(); - bool EvolveOnAllKills() const; - int8 GetMaxEvolveLvl() const; - uint32 GetKillsNeeded(uint8 currentlevel); + void Initialize(SharedDatabase *db = nullptr); + void ScaleItem(); + bool EvolveOnAllKills() const; + int8 GetMaxEvolveLvl() const; + uint32 GetKillsNeeded(uint8 currentlevel); - std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; } - void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); } - - inline int32 GetSerialNumber() const { return m_SerialNumber; } - inline void SetSerialNumber(int32 id) { m_SerialNumber = id; } + std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; } + void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); } - std::map& GetTimers() { return m_timers; } - void SetTimer(std::string name, uint32 time); - void StopTimer(std::string name); - void ClearTimers(); + inline int32 GetSerialNumber() const { return m_SerialNumber; } + inline void SetSerialNumber(int32 id) { m_SerialNumber = id; } - // Get a total of a stat, including augs - // These functions should be used in place of other code manually totaling - // to centralize where it is done to make future changes easier (ex. whenever powersources come around) - // and to minimize errors. CalcItemBonuses however doesn't use these in interest of performance - // by default these do not recurse into augs - int GetItemArmorClass(bool augments = false) const; - int GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments = false) const; - // These two differ in the fact that they're quick checks (they are checked BEFORE the one above - int GetItemElementalFlag(bool augments = false) const; - int GetItemElementalDamage(bool augments = false) const; - int GetItemRecommendedLevel(bool augments = false) const; - int GetItemRequiredLevel(bool augments = false) const; - int GetItemWeaponDamage(bool augments = false) const; - int GetItemBackstabDamage(bool augments = false) const; - // these two are just quick checks - int GetItemBaneDamageBody(bool augments = false) const; - int GetItemBaneDamageRace(bool augments = false) const; - int GetItemBaneDamageBody(bodyType against, bool augments = false) const; - int GetItemBaneDamageRace(uint16 against, bool augments = false) const; - int GetItemMagical(bool augments = false) const; - int GetItemHP(bool augments = false) const; - int GetItemMana(bool augments = false) const; - int GetItemEndur(bool augments = false) const; - int GetItemAttack(bool augments = false) const; - int GetItemStr(bool augments = false) const; - int GetItemSta(bool augments = false) const; - int GetItemDex(bool augments = false) const; - int GetItemAgi(bool augments = false) const; - int GetItemInt(bool augments = false) const; - int GetItemWis(bool augments = false) const; - int GetItemCha(bool augments = false) const; - int GetItemMR(bool augments = false) const; - int GetItemFR(bool augments = false) const; - int GetItemCR(bool augments = false) const; - int GetItemPR(bool augments = false) const; - int GetItemDR(bool augments = false) const; - int GetItemCorrup(bool augments = false) const; - int GetItemHeroicStr(bool augments = false) const; - int GetItemHeroicSta(bool augments = false) const; - int GetItemHeroicDex(bool augments = false) const; - int GetItemHeroicAgi(bool augments = false) const; - int GetItemHeroicInt(bool augments = false) const; - int GetItemHeroicWis(bool augments = false) const; - int GetItemHeroicCha(bool augments = false) const; - int GetItemHeroicMR(bool augments = false) const; - int GetItemHeroicFR(bool augments = false) const; - int GetItemHeroicCR(bool augments = false) const; - int GetItemHeroicPR(bool augments = false) const; - int GetItemHeroicDR(bool augments = false) const; - int GetItemHeroicCorrup(bool augments = false) const; - int GetItemHaste(bool augments = false) const; + std::map& GetTimers() { return m_timers; } + void SetTimer(std::string name, uint32 time); + void StopTimer(std::string name); + void ClearTimers(); -protected: - ////////////////////////// - // Protected Members - ////////////////////////// - std::map::const_iterator _cbegin() { return m_contents.cbegin(); } - std::map::const_iterator _cend() { return m_contents.cend(); } + // Get a total of a stat, including augs + // These functions should be used in place of other code manually totaling + // to centralize where it is done to make future changes easier (ex. whenever powersources come around) + // and to minimize errors. CalcItemBonuses however doesn't use these in interest of performance + // by default these do not recurse into augs + int GetItemArmorClass(bool augments = false) const; + int GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments = false) const; + // These two differ in the fact that they're quick checks (they are checked BEFORE the one above + int GetItemElementalFlag(bool augments = false) const; + int GetItemElementalDamage(bool augments = false) const; + int GetItemRecommendedLevel(bool augments = false) const; + int GetItemRequiredLevel(bool augments = false) const; + int GetItemWeaponDamage(bool augments = false) const; + int GetItemBackstabDamage(bool augments = false) const; + // these two are just quick checks + int GetItemBaneDamageBody(bool augments = false) const; + int GetItemBaneDamageRace(bool augments = false) const; + int GetItemBaneDamageBody(bodyType against, bool augments = false) const; + int GetItemBaneDamageRace(uint16 against, bool augments = false) const; + int GetItemMagical(bool augments = false) const; + int GetItemHP(bool augments = false) const; + int GetItemMana(bool augments = false) const; + int GetItemEndur(bool augments = false) const; + int GetItemAttack(bool augments = false) const; + int GetItemStr(bool augments = false) const; + int GetItemSta(bool augments = false) const; + int GetItemDex(bool augments = false) const; + int GetItemAgi(bool augments = false) const; + int GetItemInt(bool augments = false) const; + int GetItemWis(bool augments = false) const; + int GetItemCha(bool augments = false) const; + int GetItemMR(bool augments = false) const; + int GetItemFR(bool augments = false) const; + int GetItemCR(bool augments = false) const; + int GetItemPR(bool augments = false) const; + int GetItemDR(bool augments = false) const; + int GetItemCorrup(bool augments = false) const; + int GetItemHeroicStr(bool augments = false) const; + int GetItemHeroicSta(bool augments = false) const; + int GetItemHeroicDex(bool augments = false) const; + int GetItemHeroicAgi(bool augments = false) const; + int GetItemHeroicInt(bool augments = false) const; + int GetItemHeroicWis(bool augments = false) const; + int GetItemHeroicCha(bool augments = false) const; + int GetItemHeroicMR(bool augments = false) const; + int GetItemHeroicFR(bool augments = false) const; + int GetItemHeroicCR(bool augments = false) const; + int GetItemHeroicPR(bool augments = false) const; + int GetItemHeroicDR(bool augments = false) const; + int GetItemHeroicCorrup(bool augments = false) const; + int GetItemHaste(bool augments = false) const; - friend class Inventory; + protected: + ////////////////////////// + // Protected Members + ////////////////////////// + std::map::const_iterator _cbegin() { return m_contents.cbegin(); } + std::map::const_iterator _cend() { return m_contents.cend(); } + + friend class Inventory; - void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } + void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; } - ItemInstTypes m_use_type; // Usage type for item - const EQEmu::ItemBase* m_item; // Ptr to item data - int16 m_charges; // # of charges for chargeable items - uint32 m_price; // Bazaar /trader price - uint32 m_color; - uint32 m_merchantslot; - int16 m_currentslot; - bool m_attuned; - int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited - int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar. - uint32 m_exp; - int8 m_evolveLvl; - bool m_activated; - EQEmu::ItemBase* m_scaledItem; - EvolveInfo* m_evolveInfo; - bool m_scaling; - uint32 m_ornamenticon; - uint32 m_ornamentidfile; - uint32 m_ornament_hero_model; - uint32 m_recast_timestamp; + ItemInstTypes m_use_type; // Usage type for item + const ItemData* m_item; // Ptr to item data + int16 m_charges; // # of charges for chargeable items + uint32 m_price; // Bazaar /trader price + uint32 m_color; + uint32 m_merchantslot; + int16 m_currentslot; + bool m_attuned; + int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited + int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar. + uint32 m_exp; + int8 m_evolveLvl; + bool m_activated; + ItemData* m_scaledItem; + EvolveInfo* m_evolveInfo; + bool m_scaling; + uint32 m_ornamenticon; + uint32 m_ornamentidfile; + uint32 m_ornament_hero_model; + uint32 m_recast_timestamp; - // - // Items inside of this item (augs or contents); - std::map m_contents; // Zero-based index: min=0, max=9 - std::map m_custom_data; - std::map m_timers; -}; + // + // Items inside of this item (augs or contents); + std::map m_contents; // Zero-based index: min=0, max=9 + std::map m_custom_data; + std::map m_timers; + }; +} class EvolveInfo { public: - friend class ItemInst; + friend class EQEmu::ItemInstance; //temporary uint16 LvlKills[9]; uint32 FirstItem; @@ -541,4 +542,4 @@ public: ~EvolveInfo(); }; -#endif /*COMMON_ITEM_H*/ +#endif /*COMMON_ITEM_INSTANCE_H*/ diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index dba092bed..a6fcae35c 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -45,7 +45,7 @@ namespace RoF static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth); + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth); // server to client inventory location converters static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot); @@ -596,7 +596,7 @@ namespace RoF ob.write((const char*)&item_count, sizeof(uint32)); for (int index = 0; index < item_count; ++index, ++eq) { - SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0); if (ob.tellp() == last_pos) Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); @@ -1533,7 +1533,7 @@ namespace RoF ob.write((const char*)__emu_buffer, 4); - SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0); if (ob.tellp() == last_pos) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; @@ -5209,9 +5209,9 @@ namespace RoF return NextItemInstSerialNumber; } - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) { - const EQEmu::ItemBase *item = inst->GetUnscaledItem(); + const EQEmu::ItemData *item = inst->GetUnscaledItem(); RoF::structs::ItemSerializationHeader hdr; @@ -5623,7 +5623,7 @@ namespace RoF ob.write((const char*)&subitem_count, sizeof(uint32)); for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { - ItemInst* sub = inst->GetItem(index); + EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 609fdc123..47be172a2 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -45,7 +45,7 @@ namespace RoF2 static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type); + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type); // server to client inventory location converters static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot, ItemPacketType PacketType = ItemPacketInvalid); @@ -671,7 +671,7 @@ namespace RoF2 ob.write((const char*)&item_count, sizeof(uint32)); for (int index = 0; index < item_count; ++index, ++eq) { - SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory); + SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory); if (ob.tellp() == last_pos) Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); @@ -1609,7 +1609,7 @@ namespace RoF2 ob.write((const char*)__emu_buffer, 4); - SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType); + SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType); if (ob.tellp() == last_pos) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; @@ -5499,9 +5499,9 @@ namespace RoF2 return NextItemInstSerialNumber; } - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type) + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type) { - const EQEmu::ItemBase *item = inst->GetUnscaledItem(); + const EQEmu::ItemData *item = inst->GetUnscaledItem(); RoF2::structs::ItemSerializationHeader hdr; @@ -5923,7 +5923,7 @@ namespace RoF2 ob.write((const char*)&subitem_count, sizeof(uint32)); for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { - ItemInst* sub = inst->GetItem(index); + EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index ae4d2c799..12f467a71 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -2423,7 +2423,7 @@ struct AdventureLeaderboard_Struct /*struct Item_Shop_Struct { uint16 merchantid; uint8 itemtype; - ItemBase item; + ItemData item; uint8 iss_unknown001[6]; };*/ diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 74b47c09e..3b6e01318 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -2450,7 +2450,7 @@ struct AdventureLeaderboard_Struct /*struct Item_Shop_Struct { uint16 merchantid; uint8 itemtype; - ItemBase item; + ItemData item; uint8 iss_unknown001[6]; };*/ diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 3b02cbbcb..0e1a3fdcd 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -43,7 +43,7 @@ namespace SoD static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth); + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth); // server to client inventory location converters static inline uint32 ServerToSoDSlot(uint32 ServerSlot); @@ -396,7 +396,7 @@ namespace SoD ob.write((const char*)&item_count, sizeof(uint32)); for (int index = 0; index < item_count; ++index, ++eq) { - SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0); if (ob.tellp() == last_pos) Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); @@ -1060,7 +1060,7 @@ namespace SoD ob.write((const char*)__emu_buffer, 4); - SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0); if (ob.tellp() == last_pos) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; @@ -3553,9 +3553,9 @@ namespace SoD return NextItemInstSerialNumber; } - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) { - const EQEmu::ItemBase *item = inst->GetUnscaledItem(); + const EQEmu::ItemData *item = inst->GetUnscaledItem(); SoD::structs::ItemSerializationHeader hdr; @@ -3870,7 +3870,7 @@ namespace SoD ob.write((const char*)&subitem_count, sizeof(uint32)); for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { - ItemInst* sub = inst->GetItem(index); + EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index bd428c653..d4a4d49a3 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -1970,7 +1970,7 @@ struct AdventureLeaderboard_Struct /*struct Item_Shop_Struct { uint16 merchantid; uint8 itemtype; - ItemBase item; + ItemData item; uint8 iss_unknown001[6]; };*/ diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 0d1afa000..b73e998aa 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -43,7 +43,7 @@ namespace SoF static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth); + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth); // server to client inventory location converters static inline uint32 ServerToSoFSlot(uint32 serverSlot); @@ -378,7 +378,7 @@ namespace SoF ob.write((const char*)&item_count, sizeof(uint32)); for (int index = 0; index < item_count; ++index, ++eq) { - SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0); if (ob.tellp() == last_pos) Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); @@ -857,7 +857,7 @@ namespace SoF ob.write((const char*)__emu_buffer, 4); - SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0); if (ob.tellp() == last_pos) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; @@ -2923,9 +2923,9 @@ namespace SoF return NextItemInstSerialNumber; } - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) { - const EQEmu::ItemBase *item = inst->GetUnscaledItem(); + const EQEmu::ItemData *item = inst->GetUnscaledItem(); SoF::structs::ItemSerializationHeader hdr; @@ -3238,7 +3238,7 @@ namespace SoF ob.write((const char*)&subitem_count, sizeof(uint32)); for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { - ItemInst* sub = inst->GetItem(index); + EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 63feea81f..9b6459afb 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -42,7 +42,7 @@ namespace Titanium static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth); + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth); // server to client inventory location converters static inline int16 ServerToTitaniumSlot(uint32 serverSlot); @@ -329,7 +329,7 @@ namespace Titanium EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); for (int r = 0; r < itemcount; r++, eq++) { - SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0); if (ob.tellp() == last_pos) Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); @@ -815,7 +815,7 @@ namespace Titanium ob.write((const char*)__emu_buffer, 4); - SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0); if (ob.tellp() == last_pos) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; @@ -2216,10 +2216,10 @@ namespace Titanium } // file scope helper methods - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) { const char* protection = "\\\\\\\\\\"; - const EQEmu::ItemBase* item = inst->GetUnscaledItem(); + const EQEmu::ItemData* item = inst->GetUnscaledItem(); ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem; @@ -2440,7 +2440,7 @@ namespace Titanium for (int index = SUB_INDEX_BEGIN; index < invbag::ItemBagSize; ++index) { ob << '|'; - ItemInst* sub = inst->GetItem(index); + EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 0436f5af4..fd45b0c61 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -43,7 +43,7 @@ namespace UF static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth); + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth); // server to client inventory location converters static inline uint32 ServerToUFSlot(uint32 serverSlot); @@ -541,7 +541,7 @@ namespace UF ob.write((const char*)&item_count, sizeof(uint32)); for (int index = 0; index < item_count; ++index, ++eq) { - SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0); if (ob.tellp() == last_pos) Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); @@ -1293,7 +1293,7 @@ namespace UF ob.write((const char*)__emu_buffer, 4); - SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0); + SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0); if (ob.tellp() == last_pos) { Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; @@ -3847,9 +3847,9 @@ namespace UF return NextItemInstSerialNumber; } - void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth) + void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) { - const EQEmu::ItemBase *item = inst->GetUnscaledItem(); + const EQEmu::ItemData *item = inst->GetUnscaledItem(); UF::structs::ItemSerializationHeader hdr; @@ -3893,7 +3893,7 @@ namespace UF int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); uint16 ornaIcon = 0; if (inst->GetOrnamentationAug(ornamentationAugtype)) { - const EQEmu::ItemBase *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + const EQEmu::ItemData *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); ornaIcon = aug_weap->Icon; ob.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); @@ -4225,7 +4225,7 @@ namespace UF ob.write((const char*)&subitem_count, sizeof(uint32)); for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { - ItemInst* sub = inst->GetItem(index); + EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 8decaa04a..7ebedbec5 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -2011,7 +2011,7 @@ struct AdventureLeaderboard_Struct /*struct Item_Shop_Struct { uint16 merchantid; uint8 itemtype; - ItemBase item; + ItemData item; uint8 iss_unknown001[6]; };*/ diff --git a/common/say_link.cpp b/common/say_link.cpp index 2a4065403..42c0f46a1 100644 --- a/common/say_link.cpp +++ b/common/say_link.cpp @@ -147,7 +147,7 @@ void EQEmu::SayLinkEngine::generate_body() memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct)); - const EQEmu::ItemBase* item_data = nullptr; + const EQEmu::ItemData* item_data = nullptr; switch (m_LinkType) { case saylink::SayLinkBlank: @@ -250,7 +250,7 @@ void EQEmu::SayLinkEngine::generate_text() return; } - const EQEmu::ItemBase* item_data = nullptr; + const EQEmu::ItemData* item_data = nullptr; switch (m_LinkType) { case saylink::SayLinkBlank: diff --git a/common/say_link.h b/common/say_link.h index 0bbac2e36..6bc3e5535 100644 --- a/common/say_link.h +++ b/common/say_link.h @@ -26,11 +26,11 @@ struct ServerLootItem_Struct; -class ItemInst; namespace EQEmu { - struct ItemBase; + struct ItemData; + class ItemInstance; struct SayLinkBody_Struct; namespace saylink { @@ -67,9 +67,9 @@ namespace EQEmu SayLinkEngine(); void SetLinkType(saylink::SayLinkType link_type) { m_LinkType = link_type; } - void SetItemData(const EQEmu::ItemBase* item_data) { m_ItemData = item_data; } + void SetItemData(const EQEmu::ItemData* item_data) { m_ItemData = item_data; } void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_data; } - void SetItemInst(const ItemInst* item_inst) { m_ItemInst = item_inst; } + void SetItemInst(const ItemInstance* item_inst) { m_ItemInst = item_inst; } // mainly for saylinks..but, not limited to void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; } @@ -103,9 +103,9 @@ namespace EQEmu void generate_text(); int m_LinkType; - const ItemBase* m_ItemData; + const ItemData* m_ItemData; const ServerLootItem_Struct* m_LootData; - const ItemInst* m_ItemInst; + const ItemInstance* m_ItemInst; uint8 m_Proxy_unknown_1; uint32 m_ProxyItemID; diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 8e55269e7..d896fba9c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -99,7 +99,7 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { return EntitledTime; } -bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end) +bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end) { // Delete cursor items std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i " @@ -116,7 +116,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iter int i = 8000; for(auto it = start; it != end; ++it, i++) { if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high - ItemInst *inst = *it; + EQEmu::ItemInstance *inst = *it; int16 use_slot = (i == 8000) ? EQEmu::legacy::SlotCursor : i; if (!SaveInventory(char_id, inst, use_slot)) { return false; @@ -126,7 +126,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iter return true; } -bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst) +bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst) { // Delete cursor items std::string query = StringFormat("SELECT itemid, charges FROM sharedbank " @@ -159,7 +159,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite return true; } -bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id) { +bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { //never save tribute slots: if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) @@ -189,13 +189,13 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s return UpdateInventorySlot(char_id, inst, slot_id); } -bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { +bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { - ItemInst *auginst = inst->GetItem(i); + EQEmu::ItemInstance *auginst = inst->GetItem(i); augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } @@ -225,7 +225,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { - const ItemInst* baginst = inst->GetItem(idx); + const EQEmu::ItemInstance* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } @@ -236,13 +236,13 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i return true; } -bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { +bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { - ItemInst *auginst = inst->GetItem(i); + EQEmu::ItemInstance *auginst = inst->GetItem(i); augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } @@ -271,7 +271,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { - const ItemInst* baginst = inst->GetItem(idx); + const EQEmu::ItemInstance* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } } @@ -364,7 +364,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { - const EQEmu::ItemBase* myitem; + const EQEmu::ItemData* myitem; std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items " "WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND " @@ -385,7 +385,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, if(!myitem) continue; - ItemInst* myinst = CreateBaseItem(myitem, charges); + EQEmu::ItemInstance* myinst = CreateBaseItem(myitem, charges); if(slot < 0) slot = inv->FindFreeSlot(0, 0); @@ -436,7 +436,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) aug[4] = (uint32)atoi(row[7]); aug[5] = (uint32)atoi(row[8]); - const EQEmu::ItemBase *item = GetItem(item_id); + const EQEmu::ItemData *item = GetItem(item_id); if (!item) { Log.Out(Logs::General, Logs::Error, @@ -447,7 +447,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) int16 put_slot_id = INVALID_INDEX; - ItemInst *inst = CreateBaseItem(item, charges); + EQEmu::ItemInstance *inst = CreateBaseItem(item, charges); if (inst && item->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { if (aug[i]) @@ -539,7 +539,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) uint32 ornament_idfile = (uint32)atoul(row[13]); uint32 ornament_hero_model = (uint32)atoul(row[14]); - const EQEmu::ItemBase *item = GetItem(item_id); + const EQEmu::ItemData *item = GetItem(item_id); if (!item) { Log.Out(Logs::General, Logs::Error, @@ -550,7 +550,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) int16 put_slot_id = INVALID_INDEX; - ItemInst *inst = CreateBaseItem(item, charges); + EQEmu::ItemInstance *inst = CreateBaseItem(item, charges); if (inst == nullptr) continue; @@ -679,12 +679,12 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) uint32 ornament_idfile = (uint32)atoul(row[13]); uint32 ornament_hero_model = (uint32)atoul(row[14]); - const EQEmu::ItemBase *item = GetItem(item_id); + const EQEmu::ItemData *item = GetItem(item_id); int16 put_slot_id = INVALID_INDEX; if (!item) continue; - ItemInst *inst = CreateBaseItem(item, charges); + EQEmu::ItemInstance *inst = CreateBaseItem(item, charges); if (inst == nullptr) continue; @@ -816,7 +816,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("items"); items_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name)); - items_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size())); + items_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size())); mutex.Unlock(); } catch(std::exception& ex) { Log.Out(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what()); @@ -828,7 +828,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id) { - EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); + EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); std::string ndbuffer; bool disableNoRent = false; @@ -856,7 +856,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } } - EQEmu::ItemBase item; + EQEmu::ItemData item; const std::string query = "SELECT source," #define F(x) "`"#x"`," @@ -869,7 +869,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } for (auto row = results.begin(); row != results.end(); ++row) { - memset(&item, 0, sizeof(EQEmu::ItemBase)); + memset(&item, 0, sizeof(EQEmu::ItemData)); item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); strcpy(item.Name, row[ItemField::name]); @@ -1086,7 +1086,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } } -const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) { +const EQEmu::ItemData* SharedDatabase::GetItem(uint32 id) { if (id == 0) { return nullptr; @@ -1105,7 +1105,7 @@ const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) { return nullptr; } -const EQEmu::ItemBase* SharedDatabase::IterateItems(uint32* id) { +const EQEmu::ItemData* SharedDatabase::IterateItems(uint32* id) { if(!items_hash || !id) { return nullptr; } @@ -1250,18 +1250,18 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) { return true; } -// Create appropriate ItemInst class -ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) +// Create appropriate EQEmu::ItemInstance class +EQEmu::ItemInstance* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { - const EQEmu::ItemBase* item = nullptr; - ItemInst* inst = nullptr; + const EQEmu::ItemData* item = nullptr; + EQEmu::ItemInstance* inst = nullptr; item = GetItem(item_id); if (item) { inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1279,15 +1279,15 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, } -// Create appropriate ItemInst class -ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) +// Create appropriate EQEmu::ItemInstance class +EQEmu::ItemInstance* SharedDatabase::CreateItem(const EQEmu::ItemData* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { - ItemInst* inst = nullptr; + EQEmu::ItemInstance* inst = nullptr; if (item) { inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1304,8 +1304,8 @@ ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges, return inst; } -ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 charges) { - ItemInst* inst = nullptr; +EQEmu::ItemInstance* SharedDatabase::CreateBaseItem(const EQEmu::ItemData* item, int16 charges) { + EQEmu::ItemInstance* inst = nullptr; if (item) { // if maxcharges is -1 that means it is an unlimited use item. // set it to 1 charge so that it is usable on creation @@ -1315,10 +1315,10 @@ ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 char if(charges <= 0 && item->Stackable) charges = 1; - inst = new ItemInst(item, charges); + inst = new EQEmu::ItemInstance(item, charges); if (inst == nullptr) { - Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateBaseItem()"); Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } diff --git a/common/shareddb.h b/common/shareddb.h index 68e1821d3..42dfcf4ce 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -34,7 +34,6 @@ class EvolveInfo; class Inventory; -class ItemInst; struct BaseDataStruct; struct InspectMessage_Struct; struct PlayerProfile_Struct; @@ -45,7 +44,8 @@ struct LootDrop_Struct; namespace EQEmu { - struct ItemBase; + struct ItemData; + class ItemInstance; class MemoryMappedFile; } @@ -76,13 +76,13 @@ class SharedDatabase : public Database /* Character Inventory */ - bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); - bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id); + bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); + bool SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id); bool DeleteSharedBankSlot(uint32 char_id, int16 slot_id); bool DeleteInventorySlot(uint32 char_id, int16 slot_id); - bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id); - bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id); - bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst); + bool UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id); + bool UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id); + bool VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst); bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid); int32 GetSharedPlatinum(uint32 account_id); bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); @@ -99,9 +99,9 @@ class SharedDatabase : public Database /* Item Methods */ - ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); - ItemInst* CreateItem(const EQEmu::ItemBase* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); - ItemInst* CreateBaseItem(const EQEmu::ItemBase* item, int16 charges = 0); + EQEmu::ItemInstance* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); + EQEmu::ItemInstance* CreateItem(const EQEmu::ItemData* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); + EQEmu::ItemInstance* CreateBaseItem(const EQEmu::ItemData* item, int16 charges = 0); /* Shared Memory crap @@ -111,8 +111,8 @@ class SharedDatabase : public Database void GetItemsCount(int32 &item_count, uint32 &max_id); void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id); bool LoadItems(const std::string &prefix); - const EQEmu::ItemBase* IterateItems(uint32* id); - const EQEmu::ItemBase* GetItem(uint32 id); + const EQEmu::ItemData* IterateItems(uint32* id); + const EQEmu::ItemData* GetItem(uint32 id); const EvolveInfo* GetEvolveInfo(uint32 loregroup); //faction lists @@ -149,7 +149,7 @@ class SharedDatabase : public Database std::unique_ptr skill_caps_mmf; std::unique_ptr items_mmf; - std::unique_ptr> items_hash; + std::unique_ptr> items_hash; std::unique_ptr faction_mmf; std::unique_ptr> faction_hash; std::unique_ptr loot_table_mmf; diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index b58382420..6923fea3d 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -35,7 +35,7 @@ void LoadItems(SharedDatabase *database, const std::string &prefix) { EQ_EXCEPT("Shared Memory", "Unable to get any items from the database."); } - uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); + uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); auto Config = EQEmuConfig::get(); std::string file_name = Config->SharedMemDir + prefix + std::string("items"); diff --git a/tests/fixed_memory_test.h b/tests/fixed_memory_test.h index 244394ce5..055a85d79 100644 --- a/tests/fixed_memory_test.h +++ b/tests/fixed_memory_test.h @@ -27,7 +27,7 @@ class FixedMemoryHashTest : public Test::Suite { typedef void(FixedMemoryHashTest::*TestFunction)(void); public: FixedMemoryHashTest() { - size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); + size_ = EQEmu::FixedMemoryHashSet::estimated_size(72000, 190000); data_ = new uint8[size_]; memset(data_, 0, size_); TEST_ADD(FixedMemoryHashTest::InitTest); @@ -49,7 +49,7 @@ public: private: void InitTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); + EQEmu::FixedMemoryHashSet hash(data_, size_, 72000, 190000); TEST_ASSERT(!hash.exists(1001)); TEST_ASSERT(hash.size() == 0); TEST_ASSERT(hash.max_size() == 72000); @@ -57,7 +57,7 @@ public: } void LoadTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(!hash.exists(1001)); TEST_ASSERT(hash.size() == 0); TEST_ASSERT(hash.max_size() == 72000); @@ -65,8 +65,8 @@ public: } void InsertTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - EQEmu::ItemBase item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::ItemData item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Iron Sword"); item.ID = 1001; @@ -79,20 +79,20 @@ public: } void RetrieveTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 1); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - EQEmu::ItemBase item = hash[1001]; + EQEmu::ItemData item = hash[1001]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1001); } void OverwriteTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - EQEmu::ItemBase item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::ItemData item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Steel Sword"); item.ID = 1001; @@ -105,20 +105,20 @@ public: } void OverwriteRetrieveTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 1); TEST_ASSERT((hash.max_size() == 72000)); TEST_ASSERT(!hash.empty()); - EQEmu::ItemBase item = hash[1001]; + EQEmu::ItemData item = hash[1001]; TEST_ASSERT(strcmp(item.Name, "Steel Sword") == 0); TEST_ASSERT(item.ID == 1001); } void InsertAgainTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - EQEmu::ItemBase item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::ItemData item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Iron Sword"); item.ID = 1000; @@ -132,14 +132,14 @@ public: } void RetrieveAgainTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1000)); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.size() == 2); TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - EQEmu::ItemBase item = hash[1000]; + EQEmu::ItemData item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); @@ -149,8 +149,8 @@ public: } void InsertBeginTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - EQEmu::ItemBase item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::ItemData item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Bronze Sword"); item.ID = 0; @@ -165,7 +165,7 @@ public: } void RetrieveBeginTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1000)); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.exists(0)); @@ -173,7 +173,7 @@ public: TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - EQEmu::ItemBase item = hash[1000]; + EQEmu::ItemData item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); @@ -187,8 +187,8 @@ public: } void InsertEndTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); - EQEmu::ItemBase item; + EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::ItemData item; memset(&item, 0, sizeof(item)); strcpy(item.Name, "Jade Sword"); item.ID = 190000; @@ -204,7 +204,7 @@ public: } void RetrieveEndTest() { - EQEmu::FixedMemoryHashSet hash(data_, size_); + EQEmu::FixedMemoryHashSet hash(data_, size_); TEST_ASSERT(hash.exists(1000)); TEST_ASSERT(hash.exists(1001)); TEST_ASSERT(hash.exists(0)); @@ -213,7 +213,7 @@ public: TEST_ASSERT(hash.max_size() == 72000); TEST_ASSERT(!hash.empty()); - EQEmu::ItemBase item = hash[1000]; + EQEmu::ItemData item = hash[1000]; TEST_ASSERT(strcmp(item.Name, "Iron Sword") == 0); TEST_ASSERT(item.ID == 1000); diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 205663ea5..858a84323 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -245,8 +245,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou /* Load Inventory */ // If we ensure that the material data is updated appropriately, we can do away with inventory loads if (GetInventory(accountID, cse->Name, &inv)) { - const EQEmu::ItemBase* item = nullptr; - const ItemInst* inst = nullptr; + const EQEmu::ItemData* item = nullptr; + const EQEmu::ItemInstance* inst = nullptr; int16 invslot = 0; for (uint32 matslot = 0; matslot < EQEmu::textures::TextureCount; matslot++) { diff --git a/zone/aa.cpp b/zone/aa.cpp index 97b444311..b1fadf5e8 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -423,7 +423,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) uint32 sitem = 0; sitem = CorpseToUse->GetWornItem(x); if(sitem){ - const EQEmu::ItemBase * itm = database.GetItem(sitem); + const EQEmu::ItemData * itm = database.GetItem(sitem); npca->AddLootDrop(itm, &npca->itemlist, 1, 1, 255, true, true); } } diff --git a/zone/attack.cpp b/zone/attack.cpp index 9b83f7994..45de2d6b8 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -51,12 +51,12 @@ extern WorldServer worldserver; extern EntityList entity_list; extern Zone* zone; -bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const ItemInst* weapon) +bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const EQEmu::ItemInstance* weapon) { // Determine animation int type = 0; if (weapon && weapon->IsClassCommon()) { - const EQEmu::ItemBase* item = weapon->GetItem(); + const EQEmu::ItemData* item = weapon->GetItem(); Log.Out(Logs::Detail, Logs::Attack, "Weapon skill : %i", item->ItemType); @@ -786,9 +786,9 @@ int32 Client::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit, //Returns the weapon damage against the input mob //if we cannot hit the mob with the current weapon we will get a value less than or equal to zero //Else we know we can hit. -//GetWeaponDamage(mob*, const ItemBase*) is intended to be used for mobs or any other situation where we do not have a client inventory item -//GetWeaponDamage(mob*, const ItemInst*) is intended to be used for situations where we have a client inventory item -int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemBase *weapon_item) { +//GetWeaponDamage(mob*, const EQEmu::ItemData*) is intended to be used for mobs or any other situation where we do not have a client inventory item +//GetWeaponDamage(mob*, const EQEmu::ItemInstance*) is intended to be used for situations where we have a client inventory item +int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemData *weapon_item) { int dmg = 0; int banedmg = 0; @@ -888,7 +888,7 @@ int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemBase *weapon_item) { return dmg; } -int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate) +int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, uint32 *hate) { int dmg = 0; int banedmg = 0; @@ -927,7 +927,7 @@ int Mob::GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate } else { bool MagicGloves = false; if (IsClient()) { - const ItemInst *gloves = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotHands); + const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotHands); if (gloves) MagicGloves = gloves->GetItemMagical(true); } @@ -1035,7 +1035,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (GetFeigned()) return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code. - ItemInst* weapon; + EQEmu::ItemInstance* weapon; if (Hand == EQEmu::legacy::SlotSecondary){ // Kaiyodo - Pick weapon from the attacking hand weapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary); OffHandAtk(true); @@ -1114,7 +1114,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b // Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above // who belong to a melee class. If we're here, then all of these conditions apply. - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemBase*) nullptr); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; @@ -1125,7 +1125,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (Hand == EQEmu::legacy::SlotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemBase*) nullptr, true); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr, true); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; @@ -1593,7 +1593,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } //figure out what weapon they are using, if any - const EQEmu::ItemBase* weapon = nullptr; + const EQEmu::ItemData* weapon = nullptr; if (Hand == EQEmu::legacy::SlotPrimary && equipment[EQEmu::legacy::SlotPrimary] > 0) weapon = database.GetItem(equipment[EQEmu::legacy::SlotPrimary]); else if (equipment[EQEmu::legacy::SlotSecondary]) @@ -1645,7 +1645,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //do attack animation regardless of whether or not we can hit below int16 charges = 0; - ItemInst weapon_inst(weapon, charges); + EQEmu::ItemInstance weapon_inst(weapon, charges); AttackAnimation(skillinuse, Hand, &weapon_inst); //basically "if not immune" then do the attack @@ -2515,7 +2515,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { } } -uint8 Mob::GetWeaponDamageBonus(const EQEmu::ItemBase *weapon, bool offhand) +uint8 Mob::GetWeaponDamageBonus(const EQEmu::ItemData *weapon, bool offhand) { // dev quote with old and new formulas // https://forums.daybreakgames.com/eq/index.php?threads/test-update-09-17-15.226618/page-5#post-3326194 @@ -3526,7 +3526,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) { } } -void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { +void Mob::TryWeaponProc(const EQEmu::ItemInstance* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); @@ -3544,12 +3544,12 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { } if(!weapon_g) { - TrySpellProc(nullptr, (const EQEmu::ItemBase*)nullptr, on); + TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, on); return; } if (!weapon_g->IsClassCommon()) { - TrySpellProc(nullptr, (const EQEmu::ItemBase*)nullptr, on); + TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, on); return; } @@ -3562,7 +3562,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { return; } -void Mob::TryWeaponProc(const ItemInst *inst, const EQEmu::ItemBase *weapon, Mob *on, uint16 hand) +void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *weapon, Mob *on, uint16 hand) { if (!weapon) @@ -3612,10 +3612,10 @@ void Mob::TryWeaponProc(const ItemInst *inst, const EQEmu::ItemBase *weapon, Mob if (!proced && inst) { for (int r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { - const ItemInst *aug_i = inst->GetAugment(r); + const EQEmu::ItemInstance *aug_i = inst->GetAugment(r); if (!aug_i) // no aug, try next slot! continue; - const EQEmu::ItemBase *aug = aug_i->GetItem(); + const EQEmu::ItemData *aug = aug_i->GetItem(); if (!aug) continue; @@ -3645,7 +3645,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const EQEmu::ItemBase *weapon, Mob return; } -void Mob::TrySpellProc(const ItemInst *inst, const EQEmu::ItemBase *weapon, Mob *on, uint16 hand) +void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *weapon, Mob *on, uint16 hand) { float ProcBonus = static_cast(spellbonuses.SpellProcChance + itembonuses.SpellProcChance + aabonuses.SpellProcChance); @@ -4489,10 +4489,10 @@ void Client::SetAttackTimer() else //invalid slot (hands will always hit this) continue; - const EQEmu::ItemBase *ItemToUse = nullptr; + const EQEmu::ItemData *ItemToUse = nullptr; //find our item - ItemInst *ci = GetInv().GetItem(i); + EQEmu::ItemInstance *ci = GetInv().GetItem(i); if (ci) ItemToUse = ci->GetItem(); diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a898e02ec..240643934 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -146,13 +146,13 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { unsigned int i; // Update: MainAmmo should only calc skill mods (TODO: Check for other cases) for (i = EQEmu::legacy::SlotCharm; i <= EQEmu::legacy::SlotAmmo; i++) { - const ItemInst* inst = m_inv[i]; + const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; AddItemBonuses(inst, newbon, false, false, 0, (i == EQEmu::legacy::SlotAmmo)); //These are given special flags due to how often they are checked for various spell effects. - const EQEmu::ItemBase *item = inst->GetItem(); + const EQEmu::ItemData *item = inst->GetItem(); if (i == EQEmu::legacy::SlotSecondary && (item && item->ItemType == EQEmu::item::ItemTypeShield)) SetShieldEquiped(true); else if (i == EQEmu::legacy::SlotPrimary && (item && item->ItemType == EQEmu::item::ItemType2HBlunt)) { @@ -166,14 +166,14 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const ItemInst* inst = m_inv[EQEmu::legacy::SlotPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::SlotPowerSource]; if(inst) AddItemBonuses(inst, newbon); } //tribute items for (i = 0; i < EQEmu::legacy::TRIBUTE_SIZE; i++) { - const ItemInst* inst = m_inv[EQEmu::legacy::TRIBUTE_BEGIN + i]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::TRIBUTE_BEGIN + i]; if(inst == 0) continue; AddItemBonuses(inst, newbon, false, true); @@ -182,7 +182,7 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { //Optional ability to have worn effects calculate as an addititive bonus instead of highest value if (RuleI(Spells, AdditiveBonusWornType) && RuleI(Spells, AdditiveBonusWornType) != EQEmu::item::ItemEffectWorn){ for (i = EQEmu::legacy::SlotCharm; i < EQEmu::legacy::SlotAmmo; i++) { - const ItemInst* inst = m_inv[i]; + const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; AdditiveWornBonuses(inst, newbon); @@ -208,7 +208,7 @@ void Client::ProcessItemCaps() itembonuses.ATK = std::min(itembonuses.ATK, CalcItemATKCap()); } -void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAug, bool isTribute, int rec_override, bool ammo_slot_item) +void Client::AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses *newbon, bool isAug, bool isTribute, int rec_override, bool ammo_slot_item) { if (!inst || !inst->IsClassCommon()) { return; @@ -218,7 +218,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAu return; } - const EQEmu::ItemBase *item = inst->GetItem(); + const EQEmu::ItemData *item = inst->GetItem(); if (!isTribute && !inst->IsEquipable(GetBaseRace(), GetClass())) { if (item->ItemType != EQEmu::item::ItemTypeFood && item->ItemType != EQEmu::item::ItemTypeDrink) @@ -532,7 +532,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses *newbon, bool isAu } } -void Client::AdditiveWornBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug) { +void Client::AdditiveWornBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, bool isAug) { /* Powerful Non-live like option allows developers to add worn effects on items that @@ -550,7 +550,7 @@ void Client::AdditiveWornBonuses(const ItemInst *inst, StatBonuses* newbon, bool if(inst->GetAugmentType()==0 && isAug == true) return; - const EQEmu::ItemBase *item = inst->GetItem(); + const EQEmu::ItemData *item = inst->GetItem(); if(!inst->IsEquipable(GetBaseRace(),GetClass())) return; @@ -580,9 +580,9 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { { if (food && drink) break; - const ItemInst* inst = GetInv().GetItem(i); + const EQEmu::ItemInstance* inst = GetInv().GetItem(i); if (inst && inst->GetItem() && inst->IsClassCommon()) { - const EQEmu::ItemBase *item = inst->GetItem(); + const EQEmu::ItemData *item = inst->GetItem(); if (item->ItemType == EQEmu::item::ItemTypeFood && !food) food = true; else if (item->ItemType == EQEmu::item::ItemTypeDrink && !drink) @@ -596,9 +596,9 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) { { if (food && drink) break; - const ItemInst* inst = GetInv().GetItem(i); + const EQEmu::ItemInstance* inst = GetInv().GetItem(i); if (inst && inst->GetItem() && inst->IsClassCommon()) { - const EQEmu::ItemBase *item = inst->GetItem(); + const EQEmu::ItemData *item = inst->GetItem(); if (item->ItemType == EQEmu::item::ItemTypeFood && !food) food = true; else if (item->ItemType == EQEmu::item::ItemTypeDrink && !drink) @@ -3205,7 +3205,7 @@ void NPC::CalcItemBonuses(StatBonuses *newbon) if(newbon){ for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++){ - const EQEmu::ItemBase *cur = database.GetItem(equipment[i]); + const EQEmu::ItemData *cur = database.GetItem(equipment[i]); if(cur){ //basic stats newbon->AC += cur->AC; @@ -3317,7 +3317,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { if (i == EQEmu::legacy::SlotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; - ItemInst* inst = m_inv.GetItem(i); + EQEmu::ItemInstance* inst = m_inv.GetItem(i); if(inst == nullptr) continue; @@ -3325,7 +3325,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) { - ItemInst* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); + EQEmu::ItemInstance* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; } @@ -3346,7 +3346,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { //iterate all augments for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) { - ItemInst * a_inst = inst->GetAugment(x); + EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) continue; @@ -3410,7 +3410,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { if (i == EQEmu::legacy::SlotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; - ItemInst* inst = m_inv.GetItem(i); + EQEmu::ItemInstance* inst = m_inv.GetItem(i); if(!inst) continue; @@ -3418,7 +3418,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) { - ItemInst* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); + EQEmu::ItemInstance* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; } @@ -3449,7 +3449,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { //iterate all augments for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) { - ItemInst *a_inst = inst->GetAugment(x); + EQEmu::ItemInstance *a_inst = inst->GetAugment(x); if(!a_inst) continue; diff --git a/zone/bot.cpp b/zone/bot.cpp index a3dd19b2d..072f99bcd 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -229,13 +229,13 @@ void Bot::SetBotSpellID(uint32 newSpellID) { } uint32 Bot::GetBotArcheryRange() { - const ItemInst *range_inst = GetBotItem(EQEmu::legacy::SlotRange); - const ItemInst *ammo_inst = GetBotItem(EQEmu::legacy::SlotAmmo); + const EQEmu::ItemInstance *range_inst = GetBotItem(EQEmu::legacy::SlotRange); + const EQEmu::ItemInstance *ammo_inst = GetBotItem(EQEmu::legacy::SlotAmmo); if (!range_inst || !ammo_inst) return 0; - const EQEmu::ItemBase *range_item = range_inst->GetItem(); - const EQEmu::ItemBase *ammo_item = ammo_inst->GetItem(); + const EQEmu::ItemData *range_item = range_inst->GetItem(); + const EQEmu::ItemData *ammo_item = ammo_inst->GetItem(); if (!range_item || !ammo_item || range_item->ItemType != EQEmu::item::ItemTypeBow || ammo_item->ItemType != EQEmu::item::ItemTypeArrow) return 0; @@ -1900,13 +1900,13 @@ void Bot::BotRangedAttack(Mob* other) { return; } - ItemInst* rangedItem = GetBotItem(EQEmu::legacy::SlotRange); - const EQEmu::ItemBase* RangeWeapon = 0; + EQEmu::ItemInstance* rangedItem = GetBotItem(EQEmu::legacy::SlotRange); + const EQEmu::ItemData* RangeWeapon = 0; if(rangedItem) RangeWeapon = rangedItem->GetItem(); - ItemInst* ammoItem = GetBotItem(EQEmu::legacy::SlotAmmo); - const EQEmu::ItemBase* Ammo = 0; + EQEmu::ItemInstance* ammoItem = GetBotItem(EQEmu::legacy::SlotAmmo); + const EQEmu::ItemData* Ammo = 0; if(ammoItem) Ammo = ammoItem->GetItem(); @@ -2015,7 +2015,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: int32 min_hit = 1; int32 max_hit = ((2 * weapon_damage * GetDamageTable(skillinuse)) / 100); if(GetLevel() >= 28 && IsWarriorClass()) { - int ucDamageBonus = GetWeaponDamageBonus((const EQEmu::ItemBase*) nullptr); + int ucDamageBonus = GetWeaponDamageBonus((const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -2056,8 +2056,8 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: damage = -5; if (skillinuse == EQEmu::skills::SkillBash){ - const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); - const EQEmu::ItemBase* botweapon = 0; + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemData* botweapon = 0; if(inst) botweapon = inst->GetItem(); @@ -2116,8 +2116,8 @@ void Bot::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int3 } if (item_slot >= EQEmu::legacy::EQUIPMENT_BEGIN){ - const ItemInst* inst = GetBotItem(item_slot); - const EQEmu::ItemBase* botweapon = 0; + const EQEmu::ItemInstance* inst = GetBotItem(item_slot); + const EQEmu::ItemData* botweapon = 0; if(inst) botweapon = inst->GetItem(); @@ -2451,7 +2451,7 @@ void Bot::AI_Process() { if(attack_timer.Check()) { Attack(GetTarget(), EQEmu::legacy::SlotPrimary); TriggerDefensiveProcs(GetTarget(), EQEmu::legacy::SlotPrimary, false); - ItemInst *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); TryWeaponProc(wpn, GetTarget(), EQEmu::legacy::SlotPrimary); bool tripleSuccess = false; if(BotOwner && GetTarget() && CanThisClassDoubleAttack()) { @@ -2480,7 +2480,7 @@ void Bot::AI_Process() { int32 ExtraAttackChanceBonus = (spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance); if (GetTarget() && ExtraAttackChanceBonus) { - ItemInst *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); if(wpn) { if (wpn->GetItem()->IsType2HWeapon()) { if(zone->random.Int(0, 100) < ExtraAttackChanceBonus) @@ -2504,8 +2504,8 @@ void Bot::AI_Process() { //now off hand if(GetTarget() && attack_dw_timer.Check() && CanThisClassDualWield()) { - const ItemInst* instweapon = GetBotItem(EQEmu::legacy::SlotSecondary); - const EQEmu::ItemBase* weapon = 0; + const EQEmu::ItemInstance* instweapon = GetBotItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemData* weapon = 0; //can only dual wield without a weapon if you're a monk if(instweapon || (botClass == MONK)) { if(instweapon) @@ -2527,7 +2527,7 @@ void Bot::AI_Process() { float random = zone->random.Real(0, 1); if (random < DualWieldProbability){ // Max 78% of DW Attack(GetTarget(), EQEmu::legacy::SlotSecondary); // Single attack with offhand - ItemInst *wpn = GetBotItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::legacy::SlotSecondary); TryWeaponProc(wpn, GetTarget(), EQEmu::legacy::SlotSecondary); if( CanThisClassDoubleAttack() && CheckBotDoubleAttack()) { if(GetTarget() && GetTarget()->GetHP() > -10) @@ -2952,8 +2952,8 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.light = m_Light.Type[EQEmu::lightsource::LightActive]; ns->spawn.helm = helmtexture; //(GetShowHelm() ? helmtexture : 0); //0xFF; ns->spawn.equip_chest2 = texture; //0xFF; - const EQEmu::ItemBase* item = 0; - const ItemInst* inst = 0; + const EQEmu::ItemData* item = 0; + const EQEmu::ItemInstance* inst = 0; uint32 spawnedbotid = 0; spawnedbotid = this->GetBotID(); for (int i = 0; i < EQEmu::textures::TexturePrimary; i++) { @@ -3224,8 +3224,8 @@ void Bot::SendBotArcheryWearChange(uint8 material_slot, uint32 material, uint32 } // Returns the item id that is in the bot inventory collection for the specified slot. -ItemInst* Bot::GetBotItem(uint32 slotID) { - ItemInst* item = m_inv.GetItem(slotID); +EQEmu::ItemInstance* Bot::GetBotItem(uint32 slotID) { + EQEmu::ItemInstance* item = m_inv.GetItem(slotID); if(item) return item; @@ -3266,7 +3266,7 @@ void Bot::BotRemoveEquipItem(int slot) { } } -void Bot::BotTradeSwapItem(Client* client, int16 lootSlot, const ItemInst* inst, const ItemInst* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap) { +void Bot::BotTradeSwapItem(Client* client, int16 lootSlot, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap) { if(!errorMessage->empty()) return; @@ -3289,7 +3289,7 @@ void Bot::BotTradeSwapItem(Client* client, int16 lootSlot, const ItemInst* inst, } } -void Bot::BotTradeAddItem(uint32 id, const ItemInst* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb) +void Bot::BotTradeAddItem(uint32 id, const EQEmu::ItemInstance* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb) { if(addToDb) { if (!botdb.SaveItemBySlot(this, lootSlot, inst)) { @@ -3383,7 +3383,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli bool already_returned = false; Inventory& clientInventory = client->GetInv(); - const ItemInst* inst = clientInventory[i]; + const EQEmu::ItemInstance* inst = clientInventory[i]; if(inst) { items[i] = inst->GetItem()->ID; charges[i] = inst->GetCharges(); @@ -3395,10 +3395,10 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli //EQoffline: will give the items to the bots and change the bot stats if(inst && (GetBotOwner() == client->CastToMob()) && !IsEngaged()) { std::string TempErrorMessage; - const EQEmu::ItemBase* mWeaponItem = inst->GetItem(); + const EQEmu::ItemData* mWeaponItem = inst->GetItem(); bool failedLoreCheck = false; for (int m = AUG_INDEX_BEGIN; m < EQEmu::legacy::ITEM_COMMON_SIZE; ++m) { - ItemInst *itm = inst->GetAugment(m); + EQEmu::ItemInstance *itm = inst->GetAugment(m); if(itm) { if(CheckLoreConflict(itm->GetItem())) { @@ -3415,7 +3415,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli if(!failedLoreCheck && mWeaponItem && inst->IsEquipable(GetBaseRace(), GetClass()) && (GetLevel() >= mWeaponItem->ReqLevel)) { BotCanWear = true; botCanWear[i] = BotCanWear; - ItemInst* swap_item = nullptr; + EQEmu::ItemInstance* swap_item = nullptr; const char* equipped[EQEmu::legacy::EQUIPMENT_SIZE + 1] = { "Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back", "Left Wrist", "Right Wrist", "Range", "Hands", "Primary Hand", "Secondary Hand", @@ -3438,7 +3438,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } } else { - ItemInst* remove_item = GetBotItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotSecondary); BotTradeSwapItem(client, EQEmu::legacy::SlotSecondary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } @@ -3466,7 +3466,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } if(success) { if (GetBotItem(EQEmu::legacy::SlotPrimary)) { - ItemInst* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); if (remove_item->GetItem()->IsType2HWeapon()) { BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } @@ -3491,7 +3491,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli swap_item = GetBotItem(j); failedLoreCheck = false; for (int k = AUG_INDEX_BEGIN; k < EQEmu::legacy::ITEM_COMMON_SIZE; ++k) { - ItemInst *itm = swap_item->GetAugment(k); + EQEmu::ItemInstance *itm = swap_item->GetAugment(k); if(itm) { if(client->CheckLoreConflict(itm->GetItem())) { @@ -3510,7 +3510,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli failedLoreCheck = true; } else { - ItemInst* remove_item = GetBotItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotSecondary); BotTradeSwapItem(client, EQEmu::legacy::SlotSecondary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } @@ -3537,7 +3537,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli success = true; } if (success && GetBotItem(EQEmu::legacy::SlotPrimary)) { - ItemInst* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); if (remove_item->GetItem()->IsType2HWeapon()) { BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } @@ -3574,7 +3574,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } } - const EQEmu::ItemBase* item2 = 0; + const EQEmu::ItemData* item2 = 0; for(int y = beginSlotID; y <= endSlotID; ++y) { item2 = database.GetItem(items[y]); if(item2) { @@ -3738,7 +3738,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b } FaceTarget(GetTarget()); - ItemInst* weapon = nullptr; + EQEmu::ItemInstance* weapon = nullptr; if (Hand == EQEmu::legacy::SlotPrimary) { weapon = GetBotItem(EQEmu::legacy::SlotPrimary); OffHandAtk(false); @@ -3813,7 +3813,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) { // Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above // who belong to a melee class. If we're here, then all of these conditions apply. - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemBase*) nullptr); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -3822,7 +3822,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon. if (Hand == EQEmu::legacy::SlotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemBase*) nullptr); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -4280,9 +4280,9 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[bottype]) { - const EQEmu::ItemBase* TempItem = 0; - const EQEmu::ItemBase* UsedItem = 0; - const ItemInst* TempInst = 0; + const EQEmu::ItemData* TempItem = 0; + const EQEmu::ItemData* UsedItem = 0; + const EQEmu::ItemInstance* TempInst = 0; uint16 UsedFocusID = 0; int32 Total = 0; int32 focus_max = 0; @@ -4290,7 +4290,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { //item focus for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) { TempItem = nullptr; - ItemInst* ins = GetBotItem(x); + EQEmu::ItemInstance* ins = GetBotItem(x); if (!ins) continue; @@ -4314,10 +4314,10 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { } for (int y = AUG_INDEX_BEGIN; y < EQEmu::legacy::ITEM_COMMON_SIZE; ++y) { - ItemInst *aug = nullptr; + EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); if(aug) { - const EQEmu::ItemBase* TempItemAug = aug->GetItem(); + const EQEmu::ItemData* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && TempItemAug->Focus.Effect != SPELL_UNKNOWN) { if(rand_effectiveness) { focus_max = CalcBotFocusEffect(bottype, TempItemAug->Focus.Effect, spell_id, true); @@ -4864,8 +4864,8 @@ void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 hate = hate_override; if (skill == EQEmu::skills::SkillBash) { - const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); - const EQEmu::ItemBase* botweapon = 0; + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemData* botweapon = 0; if(inst) botweapon = inst->GetItem(); @@ -4929,8 +4929,8 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { bool bIsBehind = false; bool bCanFrontalBS = false; - const ItemInst* inst = GetBotItem(EQEmu::legacy::SlotPrimary); - const EQEmu::ItemBase* botpiercer = nullptr; + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemData* botpiercer = nullptr; if(inst) botpiercer = inst->GetItem(); @@ -4989,12 +4989,12 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { int32 hate = 0; int32 primaryweapondamage = 0; int32 backstab_dmg = 0; - ItemInst* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); if(botweaponInst) { primaryweapondamage = GetWeaponDamage(other, botweaponInst); backstab_dmg = botweaponInst->GetItem()->BackstabDmg; for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) { - ItemInst *aug = botweaponInst->GetAugment(i); + EQEmu::ItemInstance *aug = botweaponInst->GetAugment(i); if(aug) backstab_dmg += aug->GetItem()->BackstabDmg; } @@ -5037,7 +5037,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { } void Bot::RogueAssassinate(Mob* other) { - ItemInst* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); if(botweaponInst) { if(GetWeaponDamage(other, botweaponInst)) other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); @@ -5366,8 +5366,8 @@ bool Bot::IsBotAttackAllowed(Mob* attacker, Mob* target, bool& hasRuleDefined) { void Bot::EquipBot(std::string* errorMessage) { GetBotItems(m_inv, errorMessage); - const ItemInst* inst = 0; - const EQEmu::ItemBase* item = 0; + const EQEmu::ItemInstance* inst = 0; + const EQEmu::ItemData* item = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { inst = GetBotItem(i); if(inst) { @@ -5494,7 +5494,7 @@ void Bot::SetAttackTimer() { float haste_mod = (GetHaste() * 0.01f); attack_timer.SetAtTrigger(4000, true); Timer* TimerToUse = nullptr; - const EQEmu::ItemBase* PrimaryWeapon = nullptr; + const EQEmu::ItemData* PrimaryWeapon = nullptr; for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) { if (i == EQEmu::legacy::SlotPrimary) TimerToUse = &attack_timer; @@ -5505,8 +5505,8 @@ void Bot::SetAttackTimer() { else continue; - const EQEmu::ItemBase* ItemToUse = nullptr; - ItemInst* ci = GetBotItem(i); + const EQEmu::ItemData* ItemToUse = nullptr; + EQEmu::ItemInstance* ci = GetBotItem(i); if (ci) ItemToUse = ci->GetItem(); @@ -7180,8 +7180,8 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { insr->TargetID = inspectedBot->GetNPCTypeID(); insr->playerid = inspectedBot->GetID(); - const EQEmu::ItemBase* item = 0; - const ItemInst* inst = 0; + const EQEmu::ItemData* item = 0; + const EQEmu::ItemInstance* inst = 0; // Modded to display power source items (will only show up on SoF+ client inspect windows though.) // I don't think bots are currently coded to use them..but, you'll have to use '#bot inventory list' @@ -7232,10 +7232,10 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { void Bot::CalcItemBonuses(StatBonuses* newbon) { - const EQEmu::ItemBase* itemtmp = 0; + const EQEmu::ItemData* itemtmp = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { - const ItemInst* item = GetBotItem((i == 22 ? 9999 : i)); + const EQEmu::ItemInstance* item = GetBotItem((i == 22 ? 9999 : i)); if(item) { AddItemBonuses(item, newbon); } @@ -7252,7 +7252,7 @@ void Bot::CalcItemBonuses(StatBonuses* newbon) newbon->EnduranceRegen = CalcEnduranceRegenCap(); } -void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, bool isTribute, int rec_override) { +void Bot::AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, bool isAug, bool isTribute, int rec_override) { if (!inst || !inst->IsClassCommon()) { return; @@ -7263,7 +7263,7 @@ void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, return; } - const EQEmu::ItemBase *item = inst->GetItem(); + const EQEmu::ItemData *item = inst->GetItem(); if(!isTribute && !inst->IsEquipable(GetBaseRace(),GetClass())) { @@ -7630,7 +7630,7 @@ void Bot::CalcBotStats(bool showtext) { } } -bool Bot::CheckLoreConflict(const EQEmu::ItemBase* item) { +bool Bot::CheckLoreConflict(const EQEmu::ItemData* item) { if (!item || !(item->LoreFlag)) return false; @@ -8036,7 +8036,7 @@ uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) { int Bot::GetRawACNoShield(int &shield_ac) { int ac = itembonuses.AC + spellbonuses.AC; shield_ac = 0; - ItemInst* inst = GetBotItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotSecondary); if(inst) { if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; @@ -8053,8 +8053,8 @@ int Bot::GetRawACNoShield(int &shield_ac) { } uint32 Bot::CalcCurrentWeight() { - const EQEmu::ItemBase* TempItem = 0; - ItemInst* inst; + const EQEmu::ItemData* TempItem = 0; + EQEmu::ItemInstance* inst; uint32 Total = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { inst = GetBotItem(i); @@ -8435,7 +8435,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag) for (uint8 i = 0; i < EQEmu::textures::TexturePrimary; ++i) { uint8 inv_slot = Inventory::CalcSlotFromMaterial(i); - ItemInst* inst = m_inv.GetItem(inv_slot); + EQEmu::ItemInstance* inst = m_inv.GetItem(inv_slot); if (!inst) continue; @@ -8448,7 +8448,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag) if (mat_slot == EQEmu::textures::TextureInvalid || mat_slot >= EQEmu::textures::TexturePrimary) return false; - ItemInst* inst = m_inv.GetItem(slot_id); + EQEmu::ItemInstance* inst = m_inv.GetItem(slot_id); if (!inst) return false; diff --git a/zone/bot.h b/zone/bot.h index 3d45475a3..5bafe1caa 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -260,7 +260,7 @@ public: virtual int32 CheckAggroAmount(uint16 spellid); virtual void CalcBonuses(); void CalcItemBonuses(StatBonuses* newbon); - void AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug = false, bool isTribute = false, int rec_override = 0); + void AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, bool isAug = false, bool isTribute = false, int rec_override = 0); int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); virtual void MakePet(uint16 spell_id, const char* pettype, const char *petname = nullptr); virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther); @@ -382,10 +382,10 @@ public: virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 aa_id = 0); // Bot Equipment & Inventory Class Methods - void BotTradeSwapItem(Client* client, int16 lootSlot, const ItemInst* inst, const ItemInst* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap = true); - void BotTradeAddItem(uint32 id, const ItemInst* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb = true); + void BotTradeSwapItem(Client* client, int16 lootSlot, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* inst_swap, uint32 equipableSlots, std::string* errorMessage, bool swap = true); + void BotTradeAddItem(uint32 id, const EQEmu::ItemInstance* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb = true); void EquipBot(std::string* errorMessage); - bool CheckLoreConflict(const EQEmu::ItemBase* item); + bool CheckLoreConflict(const EQEmu::ItemData* item); virtual void UpdateEquipmentLight() { m_Light.Type[EQEmu::lightsource::LightEquipment] = m_inv.FindBrightestLightType(); m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); } // Static Class Methods @@ -457,7 +457,7 @@ public: uint32 GetBotSpellID() { return npc_spells_id; } Mob* GetBotOwner() { return this->_botOwner; } uint32 GetBotArcheryRange(); - ItemInst* GetBotItem(uint32 slotID); + EQEmu::ItemInstance* GetBotItem(uint32 slotID); virtual bool GetSpawnStatus() { return _spawnStatus; } uint8 GetPetChooserID() { return _petChooserID; } bool IsPetChooser() { return _petChooser; } diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 6b07bbdda..398a0d6b0 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -2402,7 +2402,7 @@ namespace ActionableBots mod_skill_value = base_skill_value; for (int16 index = EQEmu::legacy::EQUIPMENT_BEGIN; index <= EQEmu::legacy::EQUIPMENT_END; ++index) { - const ItemInst* indexed_item = bot_iter->GetBotItem(index); + const EQEmu::ItemInstance* indexed_item = bot_iter->GetBotItem(index); if (indexed_item && indexed_item->GetItem()->SkillModType == skill_type) mod_skill_value += (base_skill_value * (((float)indexed_item->GetItem()->SkillModValue) / 100.0f)); } @@ -7062,8 +7062,8 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep) return; } - const ItemInst* inst = nullptr; - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemInstance* inst = nullptr; + const EQEmu::ItemData* item = nullptr; bool is2Hweapon = false; std::string item_link; @@ -7132,8 +7132,8 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) return; } - const EQEmu::ItemBase* itm = nullptr; - const ItemInst* itminst = my_bot->GetBotItem(slotId); + const EQEmu::ItemData* itm = nullptr; + const EQEmu::ItemInstance* itminst = my_bot->GetBotItem(slotId); if (itminst) itm = itminst->GetItem(); @@ -7146,7 +7146,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) if (!itminst) break; - ItemInst *itma = itminst->GetAugment(m); + EQEmu::ItemInstance *itma = itminst->GetAugment(m); if (!itma) continue; if (!c->CheckLoreConflict(itma->GetItem())) @@ -7235,8 +7235,8 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep) //linker.SetLinkType(linker.linkItemInst); for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { - const EQEmu::ItemBase* item = nullptr; - const ItemInst* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::legacy::SlotPowerSource : i); + const EQEmu::ItemData* item = nullptr; + const EQEmu::ItemInstance* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::legacy::SlotPowerSource : i); if (inst) item = inst->GetItem(); diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 182f4e09f..8e4ddc203 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1064,7 +1064,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, Inventory& inventory_inst) uint32 item_id = atoi(row[1]); uint16 item_charges = (uint16)atoi(row[2]); - ItemInst* item_inst = database.CreateItem( + EQEmu::ItemInstance* item_inst = database.CreateItem( item_id, item_charges, (uint32)atoul(row[9]), @@ -1177,7 +1177,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint return true; } -bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const ItemInst* item_inst) +bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEmu::ItemInstance* item_inst) { if (!bot_inst || !bot_inst->GetBotID() || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::legacy::SlotPowerSource)) return false; diff --git a/zone/bot_database.h b/zone/bot_database.h index 5ade661c2..3eaaf21d9 100644 --- a/zone/bot_database.h +++ b/zone/bot_database.h @@ -31,10 +31,14 @@ class Bot; -class ItemInst; class Inventory; struct BotsAvailableList; +namespace EQEmu +{ + class ItemInstance; +} + class BotDatabase : public DBcore { @@ -91,7 +95,7 @@ public: bool LoadItemBySlot(Bot* bot_inst); bool LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint32& item_id); - bool SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const ItemInst* item_inst); + bool SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEmu::ItemInstance* item_inst); bool DeleteItemBySlot(const uint32 bot_id, const uint32 slot_id); bool LoadEquipmentColor(const uint32 bot_id, const uint8 material_slot_id, uint32& rgb); diff --git a/zone/client.cpp b/zone/client.cpp index 3a7b60eb5..c0b8078bb 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2017,7 +2017,7 @@ void Client::ReadBook(BookRequest_Struct *book) { out->window = book->window; if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const ItemInst *inst = m_inv[book->invslot]; + const EQEmu::ItemInstance *inst = m_inv[book->invslot]; if(inst) out->type = inst->GetItem()->Book; else @@ -2549,7 +2549,7 @@ void Client::SetFeigned(bool in_feigned) { feigned=in_feigned; } -void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::ItemBase* item, bool buying) +void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::ItemData* item, bool buying) { if(!player || !merchant || !item) return; @@ -2796,7 +2796,7 @@ bool Client::BindWound(Mob *bindmob, bool start, bool fail) } void Client::SetMaterial(int16 in_slot, uint32 item_id) { - const EQEmu::ItemBase* item = database.GetItem(item_id); + const EQEmu::ItemData* item = database.GetItem(item_id); if (item && item->IsClassCommon()) { uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); @@ -3839,7 +3839,7 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { return; } -void Client::SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::ItemBase* item){ +void Client::SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::ItemData* item){ auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); sPickPocket_Struct *pick_out = (sPickPocket_Struct *)outapp->pBuffer; pick_out->coin = amt; @@ -4013,7 +4013,7 @@ bool Client::KeyRingCheck(uint32 item_id) void Client::KeyRingList() { Message(4,"Keys on Keyring:"); - const EQEmu::ItemBase *item = 0; + const EQEmu::ItemData *item = 0; for (auto iter = keyring.begin(); iter != keyring.end(); ++iter) { if ((item = database.GetItem(*iter))!=nullptr) { Message(4,item->Name); @@ -5440,7 +5440,7 @@ bool Client::TryReward(uint32 claim_id) uint32 free_slot = 0xFFFFFFFF; for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; ++i) { - ItemInst *item = GetInv().GetItem(i); + EQEmu::ItemInstance *item = GetInv().GetItem(i); if (!item) { free_slot = i; break; @@ -5486,7 +5486,7 @@ bool Client::TryReward(uint32 claim_id) } auto &ivr = (*iter); - ItemInst *claim = database.CreateItem(ivr.items[0].item_id, ivr.items[0].charges); + EQEmu::ItemInstance *claim = database.CreateItem(ivr.items[0].item_id, ivr.items[0].charges); if (!claim) { Save(); return true; @@ -5496,7 +5496,7 @@ bool Client::TryReward(uint32 claim_id) for (int y = 1; y < 8; y++) if (ivr.items[y].item_id && claim->GetItem()->ItemClass == 1) { - ItemInst *item_temp = database.CreateItem(ivr.items[y].item_id, ivr.items[y].charges); + EQEmu::ItemInstance *item_temp = database.CreateItem(ivr.items[y].item_id, ivr.items[y].charges); if (item_temp) { if (CheckLoreConflict(item_temp->GetItem())) { lore_conflict = true; @@ -5756,8 +5756,8 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { insr->TargetID = requester->GetID(); insr->playerid = requestee->GetID(); - const EQEmu::ItemBase* item = nullptr; - const ItemInst* inst = nullptr; + const EQEmu::ItemData* item = nullptr; + const EQEmu::ItemInstance* inst = nullptr; int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for(int16 L = 0; L <= 20; L++) { inst = requestee->GetInv().GetItem(L); @@ -5768,7 +5768,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { strcpy(insr->itemnames[L], item->Name); if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - const EQEmu::ItemBase *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + const EQEmu::ItemData *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); insr->itemicons[L] = aug_item->Icon; } else if (inst && inst->GetOrnamentationIcon()) @@ -6949,7 +6949,7 @@ void Client::SendAltCurrencies() { uint32 i = 0; auto iter = zone->AlternateCurrencies.begin(); while(iter != zone->AlternateCurrencies.end()) { - const EQEmu::ItemBase* item = database.GetItem((*iter).item_id); + const EQEmu::ItemData* item = database.GetItem((*iter).item_id); altc->entries[i].currency_number = (*iter).id; altc->entries[i].unknown00 = 1; altc->entries[i].currency_number2 = (*iter).id; @@ -7604,7 +7604,7 @@ void Client::DuplicateLoreMessage(uint32 ItemID) return; } - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item) return; @@ -8075,7 +8075,7 @@ void Client::TickItemCheck() void Client::TryItemTick(int slot) { int iid = 0; - const ItemInst* inst = m_inv[slot]; + const EQEmu::ItemInstance* inst = m_inv[slot]; if(inst == 0) { return; } iid = inst->GetID(); @@ -8084,7 +8084,7 @@ void Client::TryItemTick(int slot) { if (GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EQEmu::legacy::EQUIPMENT_END)) { - ItemInst* e_inst = (ItemInst*)inst; + EQEmu::ItemInstance* e_inst = (EQEmu::ItemInstance*)inst; parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot); } } @@ -8094,7 +8094,7 @@ void Client::TryItemTick(int slot) for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) { - ItemInst * a_inst = inst->GetAugment(x); + EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) { continue; } iid = a_inst->GetID(); @@ -8103,7 +8103,7 @@ void Client::TryItemTick(int slot) { if( GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) ) { - ItemInst* e_inst = (ItemInst*)a_inst; + EQEmu::ItemInstance* e_inst = (EQEmu::ItemInstance*)a_inst; parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot); } } @@ -8131,7 +8131,7 @@ void Client::ItemTimerCheck() void Client::TryItemTimer(int slot) { - ItemInst* inst = m_inv.GetItem(slot); + EQEmu::ItemInstance* inst = m_inv.GetItem(slot); if(!inst) { return; } @@ -8151,7 +8151,7 @@ void Client::TryItemTimer(int slot) for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) { - ItemInst * a_inst = inst->GetAugment(x); + EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) { continue; } @@ -8167,7 +8167,7 @@ void Client::TryItemTimer(int slot) } } -void Client::SendItemScale(ItemInst *inst) { +void Client::SendItemScale(EQEmu::ItemInstance *inst) { int slot = m_inv.GetSlotByItemInst(inst); if(slot != -1) { inst->ScaleItem(); @@ -8321,7 +8321,7 @@ void Client::SetConsumption(int32 in_hunger, int32 in_thirst) safe_delete(outapp); } -void Client::Consume(const EQEmu::ItemBase *item, uint8 type, int16 slot, bool auto_consume) +void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool auto_consume) { if(!item) { return; } @@ -8436,7 +8436,7 @@ void Client::ShowNumHits() int Client::GetQuiverHaste(int delay) { - const ItemInst *pi = nullptr; + const EQEmu::ItemInstance *pi = nullptr; for (int r = EQEmu::legacy::GENERAL_BEGIN; r <= EQEmu::legacy::GENERAL_END; r++) { pi = GetInv().GetItem(r); if (pi && pi->IsClassBag() && pi->GetItem()->BagType == EQEmu::item::BagTypeQuiver && diff --git a/zone/client.h b/zone/client.h index 75ce82bf5..cc5abb88d 100644 --- a/zone/client.h +++ b/zone/client.h @@ -31,7 +31,7 @@ enum WaterRegionType : int; namespace EQEmu { - struct ItemBase; + struct ItemData; } #include "../common/timer.h" @@ -250,7 +250,7 @@ public: void KeyRingList(); virtual bool IsClient() const { return true; } void CompleteConnect(); - bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); + bool TryStacking(EQEmu::ItemInstance* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); void SendBuyerPacket(Client* Buyer); GetItems_Struct* GetTraderItems(); @@ -273,7 +273,7 @@ public: void SendTraderItem(uint32 item_id,uint16 quantity); uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); uint32 FindTraderItemSerialNumber(int32 ItemID); - ItemInst* FindTraderItemBySerialNumber(int32 SerialNumber); + EQEmu::ItemInstance* FindTraderItemBySerialNumber(int32 SerialNumber); void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); void NukeTraderItem(uint16 slot, int16 charges, uint16 quantity, Client* customer, uint16 traderslot, int32 uniqueid, int32 itemid = 0); void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges, uint32 itemid = 0); @@ -294,7 +294,7 @@ public: void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); virtual bool Process(); - void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::ItemBase* item, bool buying); + void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const EQEmu::ItemData* item, bool buying); void SendPacketQueue(bool Block = true); void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); @@ -308,7 +308,7 @@ public: void LearnRecipe(uint32 recipeID); bool CanIncreaseTradeskill(EQEmu::skills::SkillType tradeskill); - EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + EQApplicationPacket* ReturnItemPacket(int16 slot_id, const EQEmu::ItemInstance* inst, ItemPacketType packet_type); bool GetRevoked() const { return revoked; } void SetRevoked(bool rev) { revoked = rev; } @@ -403,7 +403,7 @@ public: inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } - void SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::ItemBase* item = nullptr); + void SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::ItemData* item = nullptr); inline const char* GetLastName() const { return lastname; } @@ -601,7 +601,7 @@ public: void AssignToInstance(uint16 instance_id); void RemoveFromInstance(uint16 instance_id); void WhoAll(); - bool CheckLoreConflict(const EQEmu::ItemBase* item); + bool CheckLoreConflict(const EQEmu::ItemData* item); void ChangeLastName(const char* in_lastname); void GetGroupAAs(GroupLeadershipAA_Struct *into) const; void GetRaidAAs(RaidLeadershipAA_Struct *into) const; @@ -813,25 +813,25 @@ public: void Undye(); int32 GetItemIDAt(int16 slot_id); int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); - bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); - bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); + bool PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, bool client_update = false); + bool PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_update = false); void SendCursorBuffer(); void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); bool SwapItem(MoveItem_Struct* move_in); void SwapItemResync(MoveItem_Struct* move_slots); void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); - void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); - bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); + void PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, ServerLootItem_Struct** bag_item_data = 0); + bool AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::legacy::SlotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); - int GetItemLinkHash(const ItemInst* inst); // move to ItemBase..or make use of the pre-calculated database field + int GetItemLinkHash(const EQEmu::ItemInstance* inst); // move to ItemData..or make use of the pre-calculated database field - void SendItemLink(const ItemInst* inst, bool sendtoall=false); - void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); - void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + void SendItemLink(const EQEmu::ItemInstance* inst, bool sendtoall=false); + void SendLootItemInPacket(const EQEmu::ItemInstance* inst, int16 slot_id); + void SendItemPacket(int16 slot_id, const EQEmu::ItemInstance* inst, ItemPacketType packet_type); bool IsValidSlot(uint32 slot); bool IsBankSlot(uint32 slot); @@ -887,7 +887,7 @@ public: //Calculate vendor price modifier based on CHA: (reverse==selling) float CalcPriceMod(Mob* other = 0, bool reverse = false); void ResetTrade(); - void DropInst(const ItemInst* inst); + void DropInst(const EQEmu::ItemInstance* inst); bool TrainDiscipline(uint32 itemid); void TrainDiscBySpellID(int32 spell_id); int GetDiscSlotBySpellID(int32 spellid); @@ -965,7 +965,7 @@ public: inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); } inline void UpdateTasksOnExplore(int ExploreID) { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); } inline bool UpdateTasksOnSpeakWith(int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; } - inline bool UpdateTasksOnDeliver(std::list& Items, int Cash, int NPCTypeID) { if (taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; } + inline bool UpdateTasksOnDeliver(std::list& Items, int Cash, int NPCTypeID) { if (taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; } inline void TaskSetSelector(Mob *mob, int TaskSetID) { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); } inline void EnableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); } inline void DisableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); } @@ -1080,7 +1080,7 @@ public: inline bool GetPendingGuildInvitation() { return PendingGuildInvitation; } void LocateCorpse(); void SendTargetCommand(uint32 EntityID); - bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); + bool MoveItemToInventory(EQEmu::ItemInstance *BInst, bool UpdateClient = false); void HandleRespawnFromHover(uint32 Option); bool IsHoveringForRespawn() { return RespawnFromHoverTimer.Enabled(); } std::list respawn_options; @@ -1173,7 +1173,7 @@ public: void TryItemTick(int slot); void ItemTimerCheck(); void TryItemTimer(int slot); - void SendItemScale(ItemInst *inst); + void SendItemScale(EQEmu::ItemInstance *inst); int32 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); } int32 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); } @@ -1186,10 +1186,10 @@ public: void SetAccountFlag(std::string flag, std::string val); std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(EQEmu::skills::SkillType how_long_has_this_been_missing); - void Consume(const EQEmu::ItemBase *item, uint8 type, int16 slot, bool auto_consume); + void Consume(const EQEmu::ItemData *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, EQEmu::skills::SkillType skillinuse, int hand, const ItemInst* weapon, Mob* other); + int mod_client_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::ItemInstance* weapon, Mob* other); bool mod_client_message(char* message, uint8 chan_num); bool mod_can_increase_skill(EQEmu::skills::SkillType skillid, Mob* against_who); int16 mod_increase_skill_chance(int16 chance, Mob* against_who); @@ -1201,16 +1201,16 @@ public: int16 mod_pet_power(int16 act_power, uint16 spell_id); float mod_tradeskill_chance(float chance, DBTradeskillRecipe_Struct *spec); float mod_tradeskill_skillup(float chance_stage2); - int32 mod_tribute_item_value(int32 pts, const ItemInst* item); + int32 mod_tribute_item_value(int32 pts, const EQEmu::ItemInstance* item); void mod_client_death_npc(Mob* killerMob); void mod_client_death_duel(Mob* killerMob); void mod_client_death_env(); int32 mod_client_xp(int32 in_exp, NPC *npc); uint32 mod_client_xp_for_level(uint32 xp, uint16 check_level); int mod_client_haste_cap(int cap); - int mod_consume(EQEmu::ItemBase *item, EQEmu::item::ItemType type, int change); - int mod_food_value(const EQEmu::ItemBase *item, int change); - int mod_drink_value(const EQEmu::ItemBase *item, int change); + int mod_consume(EQEmu::ItemData *item, EQEmu::item::ItemType type, int change); + int mod_food_value(const EQEmu::ItemData *item, int change); + int mod_drink_value(const EQEmu::ItemData *item, int change); void SetEngagedRaidTarget(bool value) { EngagedRaidTarget = value; } bool GetEngagedRaidTarget() const { return EngagedRaidTarget; } @@ -1244,8 +1244,8 @@ public: protected: friend class Mob; void CalcItemBonuses(StatBonuses* newbon); - void AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug = false, bool isTribute = false, int rec_override = 0, bool ammo_slot_item = false); - void AdditiveWornBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug = false); + void AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, bool isAug = false, bool isTribute = false, int rec_override = 0, bool ammo_slot_item = false); + void AdditiveWornBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, bool isAug = false); int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); void CalcEdibleBonuses(StatBonuses* newbon); void ProcessItemCaps(); @@ -1286,7 +1286,7 @@ private: void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); void OPMemorizeSpell(const EQApplicationPacket *app); void OPMoveCoin(const EQApplicationPacket* app); - void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); + void MoveItemCharges(EQEmu::ItemInstance &from, int16 to_slot, uint8 type); void OPGMTraining(const EQApplicationPacket *app); void OPGMEndTraining(const EQApplicationPacket *app); void OPGMTrainSkill(const EQApplicationPacket *app); @@ -1561,8 +1561,8 @@ private: bool interrogateinv_flag; // used to minimize log spamming by players - void InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth); - bool InterrogateInventory_error(int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, int depth); + void InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, bool log, bool silent, bool &error, int depth); + bool InterrogateInventory_error(int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, int depth); }; #endif diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index c57fc340f..69f1444f1 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -486,7 +486,7 @@ int32 Client::GetRawItemAC() int32 Total = 0; // this skips MainAmmo..add an '=' conditional if that slot is required (original behavior) for (int16 slot_id = EQEmu::legacy::EQUIPMENT_BEGIN; slot_id < EQEmu::legacy::EQUIPMENT_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (inst && inst->IsClassCommon()) { Total += inst->GetItem()->AC; } @@ -1316,8 +1316,8 @@ int32 Client::CalcManaRegenCap() uint32 Client::CalcCurrentWeight() { - const EQEmu::ItemBase* TempItem = 0; - ItemInst* ins; + const EQEmu::ItemData* TempItem = 0; + EQEmu::ItemInstance* ins; uint32 Total = 0; int x; for (x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::SlotCursor; x++) { // include cursor or not? @@ -1350,7 +1350,7 @@ uint32 Client::CalcCurrentWeight() bagslot += 1; } } - ItemInst* baginst = GetInv().GetItem(bagslot); + EQEmu::ItemInstance* baginst = GetInv().GetItem(bagslot); if (baginst && baginst->GetItem() && baginst->IsClassBag()) { reduction = baginst->GetItem()->BagWR; } @@ -2219,7 +2219,7 @@ int Client::GetRawACNoShield(int &shield_ac) const { int ac = itembonuses.AC + spellbonuses.AC + aabonuses.AC; shield_ac = 0; - const ItemInst *inst = m_inv.GetItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::legacy::SlotSecondary); if (inst) { if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6fc45fee0..a8c96e146 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1690,7 +1690,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* First item cursor is sent in bulk inventory packet */ if (iter == m_inv.cursor_cbegin()) continue; - const ItemInst *inst = *iter; + const EQEmu::ItemInstance *inst = *iter; SendItemPacket(EQEmu::legacy::SlotCursor, inst, ItemPacketLimbo); } } @@ -1883,7 +1883,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) merchantid = tmp->CastToNPC()->MerchantType; - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; bool found = false; std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; @@ -2026,7 +2026,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) if (item->MaxCharges != 0) charges = item->MaxCharges; - ItemInst *inst = database.CreateItem(item, charges); + EQEmu::ItemInstance *inst = database.CreateItem(item, charges); if (!AutoPutLootInInventory(*inst, true, true)) { PutLootInInventory(EQEmu::legacy::SlotCursor, *inst); @@ -2059,7 +2059,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) merchantid = tmp->CastToNPC()->MerchantType; tmp->CastToNPC()->FaceTarget(this->CastToMob()); - const EQEmu::ItemBase *item = 0; + const EQEmu::ItemData *item = 0; std::list merlist = zone->merchanttable[merchantid]; std::list::const_iterator itr; for (itr = merlist.begin(); itr != merlist.end() && count<255; ++itr){ @@ -2158,8 +2158,8 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) return; } - const EQEmu::ItemBase* item = database.GetItem(itemid); - ItemInst* inst = GetInv().GetItem(ams_in->slot); + const EQEmu::ItemData* item = database.GetItem(itemid); + EQEmu::ItemInstance* inst = GetInv().GetItem(ams_in->slot); if (!item || !inst){ Message(13, "You seemed to have misplaced that item..."); return; @@ -2435,7 +2435,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app ss << alt_cur_id << "|1|" << alt_cur_id; uint32 count = 0; uint32 merchant_id = tar->MerchantType; - const EQEmu::ItemBase *item = nullptr; + const EQEmu::ItemData *item = nullptr; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; @@ -2495,7 +2495,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) return; } - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; @@ -2551,7 +2551,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) if (item->MaxCharges != 0) charges = item->MaxCharges; - ItemInst *inst = database.CreateItem(item, charges); + EQEmu::ItemInstance *inst = database.CreateItem(item, charges); if (!AutoPutLootInInventory(*inst, true, true)) { PutLootInInventory(EQEmu::legacy::SlotCursor, *inst); @@ -2635,7 +2635,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) return; } - ItemInst* inst = GetInv().GetItem(sell->slot_id); + EQEmu::ItemInstance* inst = GetInv().GetItem(sell->slot_id); if (!inst) { return; } @@ -2644,7 +2644,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) return; } - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; @@ -2732,12 +2732,12 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) return; } - ItemInst *inst = m_inv.GetItem(select->slot_id); + EQEmu::ItemInstance *inst = m_inv.GetItem(select->slot_id); if (!inst) { return; } - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; @@ -2816,9 +2816,9 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) } uint32 ApplyPoisonSuccessResult = 0; ApplyPoison_Struct* ApplyPoisonData = (ApplyPoison_Struct*)app->pBuffer; - const ItemInst* PrimaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary); - const ItemInst* SecondaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary); - const ItemInst* PoisonItemInstance = GetInv()[ApplyPoisonData->inventorySlot]; + const EQEmu::ItemInstance* PrimaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance* SecondaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance* PoisonItemInstance = GetInv()[ApplyPoisonData->inventorySlot]; bool IsPoison = PoisonItemInstance && (PoisonItemInstance->GetItem()->ItemType == EQEmu::item::ItemTypePoison); @@ -2912,7 +2912,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) } AugmentInfo_Struct* AugInfo = (AugmentInfo_Struct*)app->pBuffer; - const EQEmu::ItemBase * item = database.GetItem(AugInfo->itemid); + const EQEmu::ItemData * item = database.GetItem(AugInfo->itemid); if (item) { strn0cpy(AugInfo->augment_info, item->Name, 64); @@ -2933,12 +2933,12 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) bool deleteItems = false; if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) { - ItemInst *itemOneToPush = nullptr, *itemTwoToPush = nullptr; + EQEmu::ItemInstance *itemOneToPush = nullptr, *itemTwoToPush = nullptr; //Log.Out(Logs::DebugLevel::Moderate, Logs::Debug, "cslot: %i aslot: %i cidx: %i aidx: %i act: %i dest: %i", // in_augment->container_slot, in_augment->augment_slot, in_augment->container_index, in_augment->augment_index, in_augment->augment_action, in_augment->dest_inst_id); - ItemInst *tobe_auged = nullptr, *old_aug = nullptr, *new_aug = nullptr, *aug = nullptr, *solvent = nullptr; + EQEmu::ItemInstance *tobe_auged = nullptr, *old_aug = nullptr, *new_aug = nullptr, *aug = nullptr, *solvent = nullptr; Inventory& user_inv = GetInv(); uint16 item_slot = in_augment->container_slot; @@ -3494,13 +3494,13 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) { BarterItemSearchLinkRequest_Struct* bislr = (BarterItemSearchLinkRequest_Struct*)app->pBuffer; - const EQEmu::ItemBase* item = database.GetItem(bislr->ItemID); + const EQEmu::ItemData* item = database.GetItem(bislr->ItemID); if (!item) Message(13, "Error: This item does not exist!"); else { - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if (inst) { SendItemPacket(0, inst, ItemPacketViewLink); @@ -3527,13 +3527,13 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) { BuyerItemSearchLinkRequest_Struct* bislr = (BuyerItemSearchLinkRequest_Struct*)app->pBuffer; - const EQEmu::ItemBase* item = database.GetItem(bislr->ItemID); + const EQEmu::ItemData* item = database.GetItem(bislr->ItemID); if (!item) Message(13, "Error: This item does not exist!"); else { - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if (inst) { SendItemPacket(0, inst, ItemPacketViewLink); @@ -3566,14 +3566,14 @@ void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) BazaarInspect_Struct* bis = (BazaarInspect_Struct*)app->pBuffer; - const EQEmu::ItemBase* item = database.GetItem(bis->ItemID); + const EQEmu::ItemData* item = database.GetItem(bis->ItemID); if (!item) { Message(13, "Error: This item does not exist!"); return; } - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if (inst) { SendItemPacket(0, inst, ItemPacketViewLink); @@ -3606,7 +3606,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) Client *c = entity_list.GetClientByName(nbis->Name); if (c) { - ItemInst* inst = c->FindTraderItemBySerialNumber(nbis->SerialNumber); + EQEmu::ItemInstance* inst = c->FindTraderItemBySerialNumber(nbis->SerialNumber); if (inst) SendItemPacket(0, inst, ItemPacketViewLink); } @@ -4007,11 +4007,11 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) if (m_inv.SupportsClickCasting(castspell->inventoryslot) || slot == CastingSlot::PotionBelt) // sanity check { // packet field types will be reviewed as packet transistions occur - const ItemInst* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field + const EQEmu::ItemInstance* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field //bool cancast = true; if (inst && inst->IsClassCommon()) { - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (item->Click.Effect != (uint32)castspell->spell_id) { database.SetMQDetectionFlag(account_name, name, "OP_CastSpell with item, tried to cast a different spell.", zone->GetShortName()); @@ -4025,7 +4025,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) { if (GetLevel() >= item->Click.Level2) { - ItemInst* p_inst = (ItemInst*)inst; + EQEmu::ItemInstance* p_inst = (EQEmu::ItemInstance*)inst; int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot); if (i == 0) { @@ -4045,7 +4045,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) } else { - ItemInst* p_inst = (ItemInst*)inst; + EQEmu::ItemInstance* p_inst = (EQEmu::ItemInstance*)inst; int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot); if (i == 0) { @@ -4857,13 +4857,13 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) } } - ItemInst *myitem = GetInv().GetItem(pcs->slot); + EQEmu::ItemInstance *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { Log.Out(Logs::General, Logs::Error, "Consuming from empty slot %d", pcs->slot); return; } - const EQEmu::ItemBase* eat_item = myitem->GetItem(); + const EQEmu::ItemData* eat_item = myitem->GetItem(); if (pcs->type == 0x01) { Consume(eat_item, EQEmu::item::ItemTypeFood, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } @@ -5146,7 +5146,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app) } DeleteItem_Struct* alc = (DeleteItem_Struct*)app->pBuffer; - const ItemInst *inst = GetInv().GetItem(alc->from_slot); + const EQEmu::ItemInstance *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(EQEmu::skills::SkillAlcoholTolerance, nullptr, 25); @@ -6876,7 +6876,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (Slot >= 0) { - ItemInst* inst = GuildBanks->GetItem(GuildID(), GuildBankMainArea, Slot, 1); + EQEmu::ItemInstance* inst = GuildBanks->GetItem(GuildID(), GuildBankMainArea, Slot, 1); if (inst) { @@ -6896,7 +6896,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { GuildBankViewItem_Struct *gbvis = (GuildBankViewItem_Struct*)app->pBuffer; - ItemInst* inst = GuildBanks->GetItem(GuildID(), gbvis->Area, gbvis->SlotID, 1); + EQEmu::ItemInstance* inst = GuildBanks->GetItem(GuildID(), gbvis->Area, gbvis->SlotID, 1); if (!inst) break; @@ -6919,7 +6919,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) return; } - ItemInst *CursorItemInst = GetInv().GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance *CursorItemInst = GetInv().GetItem(EQEmu::legacy::SlotCursor); bool Allowed = true; @@ -6932,7 +6932,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) return; } - const EQEmu::ItemBase* CursorItem = CursorItemInst->GetItem(); + const EQEmu::ItemData* CursorItem = CursorItemInst->GetItem(); if (!CursorItem->NoDrop || CursorItemInst->IsAttuned()) { @@ -6999,7 +6999,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) GuildBankWithdrawItem_Struct *gbwis = (GuildBankWithdrawItem_Struct*)app->pBuffer; - ItemInst* inst = GuildBanks->GetItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity); + EQEmu::ItemInstance* inst = GuildBanks->GetItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity); if (!inst) { @@ -8013,17 +8013,17 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) EQApplicationPacket* outapp = app->Copy(); InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer; Mob* tmp = entity_list.GetMob(insr->TargetID); - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::legacy::SlotWaist; L++) { - const ItemInst* inst = GetInv().GetItem(L); + const EQEmu::ItemInstance* inst = GetInv().GetItem(L); item = inst ? inst->GetItem() : nullptr; if (item) { strcpy(insr->itemnames[L], item->Name); if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - const EQEmu::ItemBase *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + const EQEmu::ItemData *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); insr->itemicons[L] = aug_item->Icon; } else if (inst->GetOrnamentationIcon()) { @@ -8036,7 +8036,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) else { insr->itemicons[L] = 0xFFFFFFFF; } } - const ItemInst* inst = GetInv().GetItem(EQEmu::legacy::SlotAmmo); + const EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::legacy::SlotAmmo); item = inst ? inst->GetItem() : nullptr; if (item) { @@ -8123,7 +8123,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) // todo: verify ivrs->link_hash based on a rule, in case we don't care about people being able to sniff data // from the item DB - const EQEmu::ItemBase *item = database.GetItem(ivrs->item_id); + const EQEmu::ItemData *item = database.GetItem(ivrs->item_id); if (!item) { if (ivrs->item_id != SAYLINK_ITEM_ID) { Message(13, "Error: The item for the link you have clicked on does not exist!"); @@ -8181,7 +8181,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) } } - ItemInst *inst = + EQEmu::ItemInstance *inst = database.CreateItem(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4], ivrs->augments[5]); if (inst) { @@ -8198,7 +8198,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; - ItemInst* inst = database.CreateItem(item->item_id); + EQEmu::ItemInstance* inst = database.CreateItem(item->item_id); if (inst) { SendItemPacket(0, inst, ItemPacketViewLink); safe_delete(inst); @@ -8214,7 +8214,7 @@ void Client::Handle_OP_ItemName(const EQApplicationPacket *app) return; } ItemNamePacket_Struct *p = (ItemNamePacket_Struct*)app->pBuffer; - const EQEmu::ItemBase *item = 0; + const EQEmu::ItemData *item = 0; if ((item = database.GetItem(p->item_id)) != nullptr) { auto outapp = new EQApplicationPacket(OP_ItemName, sizeof(ItemNamePacket_Struct)); p = (ItemNamePacket_Struct*)outapp->pBuffer; @@ -8230,7 +8230,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) VERIFY_PACKET_LENGTH(OP_ItemPreview, app, ItemPreview_Struct); ItemPreview_Struct *ips = (ItemPreview_Struct *)app->pBuffer; - const EQEmu::ItemBase* item = database.GetItem(ips->itemid); + const EQEmu::ItemData* item = database.GetItem(ips->itemid); if (item) { auto outapp = new EQApplicationPacket(OP_ItemPreview, strlen(item->Name) + strlen(item->Lore) + @@ -8441,14 +8441,14 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) { Message(0, "Error: item not found in inventory slot #%i", slot_id); DeleteItemInInventory(slot_id, 0, true); return; } - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (!item) { Message(0, "Error: item not found in inventory slot #%i", slot_id); DeleteItemInInventory(slot_id, 0, true); @@ -8484,7 +8484,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == EQEmu::item::ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { - ItemInst* p_inst = (ItemInst*)inst; + EQEmu::ItemInstance* p_inst = (EQEmu::ItemInstance*)inst; parse->EventItem(EVENT_ITEM_CLICK, this, p_inst, nullptr, "", slot_id); inst = m_inv[slot_id]; @@ -8495,22 +8495,22 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) int r; bool tryaug = false; - ItemInst* clickaug = 0; - EQEmu::ItemBase* augitem = 0; + EQEmu::ItemInstance* clickaug = 0; + EQEmu::ItemData* augitem = 0; for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { - const ItemInst* aug_i = inst->GetAugment(r); + const EQEmu::ItemInstance* aug_i = inst->GetAugment(r); if (!aug_i) continue; - const EQEmu::ItemBase* aug = aug_i->GetItem(); + const EQEmu::ItemData* aug = aug_i->GetItem(); if (!aug) continue; if ((aug->Click.Type == EQEmu::item::ItemEffectClick) || (aug->Click.Type == EQEmu::item::ItemEffectExpendable) || (aug->Click.Type == EQEmu::item::ItemEffectEquipClick) || (aug->Click.Type == EQEmu::item::ItemEffectClick2)) { tryaug = true; - clickaug = (ItemInst*)aug_i; - augitem = (EQEmu::ItemBase*)aug; + clickaug = (EQEmu::ItemInstance*)aug_i; + augitem = (EQEmu::ItemData*)aug; spell_id = aug->Click.Effect; break; } @@ -9678,8 +9678,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) if (mi->from_slot != mi->to_slot && (mi->from_slot <= EQEmu::legacy::GENERAL_END || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) { char *detect = nullptr; - const ItemInst *itm_from = GetInv().GetItem(mi->from_slot); - const ItemInst *itm_to = GetInv().GetItem(mi->to_slot); + const EQEmu::ItemInstance *itm_from = GetInv().GetItem(mi->from_slot); + const EQEmu::ItemInstance *itm_to = GetInv().GetItem(mi->to_slot); MakeAnyLenString(&detect, "Player issued a move item from %u(item id %u) to %u(item id %u) while casting %u.", mi->from_slot, itm_from ? itm_from->GetID() : 0, @@ -10545,7 +10545,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) } if (mptbs->Action == 0) { - const EQEmu::ItemBase *BaseItem = database.GetItem(mptbs->ItemID); + const EQEmu::ItemData *BaseItem = database.GetItem(mptbs->ItemID); if (BaseItem) { m_pp.potionbelt.Items[mptbs->SlotNumber].ID = BaseItem->ID; m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = BaseItem->Icon; @@ -12031,12 +12031,12 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app) Shielding_Struct* shield = (Shielding_Struct*)app->pBuffer; shield_target = entity_list.GetMob(shield->target_id); bool ack = false; - ItemInst* inst = GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::legacy::SlotSecondary); if (!shield_target) return; if (inst) { - const EQEmu::ItemBase* shield = inst->GetItem(); + const EQEmu::ItemData* shield = inst->GetItem(); if (shield && shield->ItemType == EQEmu::item::ItemTypeShield) { for (int x = 0; x < 2; x++) @@ -12139,7 +12139,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) break; } } - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; uint32 prevcharges = 0; if (item_id == 0) { //check to see if its on the temporary table std::list tmp_merlist = zone->tmpmerchanttable[tmp->GetNPCTypeID()]; @@ -12200,7 +12200,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) else charges = item->MaxCharges; - ItemInst* inst = database.CreateItem(item, charges); + EQEmu::ItemInstance* inst = database.CreateItem(item, charges); int SinglePrice = 0; if (RuleB(Merchant, UsePriceMod)) @@ -12321,7 +12321,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) qsaudit->items[0].item_id = item->ID; qsaudit->items[0].charges = mpo->quantity; - const ItemInst* audit_inst = m_inv[freeslotid]; + const EQEmu::ItemInstance* audit_inst = m_inv[freeslotid]; if (audit_inst) { qsaudit->items[0].aug_1 = audit_inst->GetAugmentItemID(0); @@ -12387,8 +12387,8 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) uint32 itemid = GetItemIDAt(mp->itemslot); if (itemid == 0) return; - const EQEmu::ItemBase* item = database.GetItem(itemid); - ItemInst* inst = GetInv().GetItem(mp->itemslot); + const EQEmu::ItemData* item = database.GetItem(itemid); + EQEmu::ItemInstance* inst = GetInv().GetItem(mp->itemslot); if (!item || !inst){ Message(13, "You seemed to have misplaced that item.."); return; @@ -12433,7 +12433,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) int freeslot = 0; if (charges > 0 && (freeslot = zone->SaveTempItem(vendor->CastToNPC()->MerchantType, vendor->GetNPCTypeID(), itemid, charges, true)) > 0){ - ItemInst* inst2 = inst->Clone(); + EQEmu::ItemInstance* inst2 = inst->Clone(); while (true) { if (inst2 == nullptr) @@ -13498,7 +13498,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) TradeItemsValid = false; break; } - const EQEmu::ItemBase *Item = database.GetItem(gis->Items[i]); + const EQEmu::ItemData *Item = database.GetItem(gis->Items[i]); if (!Item) { Message(13, "Unexpected error. Unable to start trader mode"); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 407343419..8e2ab8313 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -296,7 +296,7 @@ bool Client::Process() { } if(AutoFireEnabled()){ - ItemInst *ranged = GetInv().GetItem(EQEmu::legacy::SlotRange); + EQEmu::ItemInstance *ranged = GetInv().GetItem(EQEmu::legacy::SlotRange); if(ranged) { if (ranged->GetItem() && ranged->GetItem()->ItemType == EQEmu::item::ItemTypeBow){ @@ -391,7 +391,7 @@ bool Client::Process() { } else if (auto_attack_target->GetHP() > -10) // -10 so we can watch people bleed in PvP { - ItemInst *wpn = GetInv().GetItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::legacy::SlotPrimary); TryWeaponProc(wpn, auto_attack_target, EQEmu::legacy::SlotPrimary); DoAttackRounds(auto_attack_target, EQEmu::legacy::SlotPrimary); @@ -430,7 +430,7 @@ bool Client::Process() { else if(auto_attack_target->GetHP() > -10) { CheckIncreaseSkill(EQEmu::skills::SkillDualWield, auto_attack_target, -10); if (CheckDualWield()) { - ItemInst *wpn = GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::legacy::SlotSecondary); TryWeaponProc(wpn, auto_attack_target, EQEmu::legacy::SlotSecondary); DoAttackRounds(auto_attack_target, EQEmu::legacy::SlotSecondary); @@ -738,7 +738,7 @@ void Client::BulkSendInventoryItems() // LINKDEAD TRADE ITEMS // Move trade slot items back into normal inventory..need them there now for the proceeding validity checks for (int16 slot_id = EQEmu::legacy::TRADE_BEGIN; slot_id <= EQEmu::legacy::TRADE_END; slot_id++) { - ItemInst* inst = m_inv.PopItem(slot_id); + EQEmu::ItemInstance* inst = m_inv.PopItem(slot_id); if(inst) { bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow); @@ -764,7 +764,7 @@ void Client::BulkSendInventoryItems() // Possessions items for (int16 slot_id = SLOT_BEGIN; slot_id < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -778,7 +778,7 @@ void Client::BulkSendInventoryItems() // PowerSource item if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const ItemInst* inst = m_inv[EQEmu::legacy::SlotPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::SlotPowerSource]; if (inst) { inst->Serialize(ob, EQEmu::legacy::SlotPowerSource); @@ -791,7 +791,7 @@ void Client::BulkSendInventoryItems() // Bank items for (int16 slot_id = EQEmu::legacy::BANK_BEGIN; slot_id <= EQEmu::legacy::BANK_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -805,7 +805,7 @@ void Client::BulkSendInventoryItems() // SharedBank items for (int16 slot_id = EQEmu::legacy::SHARED_BANK_BEGIN; slot_id <= EQEmu::legacy::SHARED_BANK_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -825,12 +825,12 @@ void Client::BulkSendInventoryItems() } void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { - const EQEmu::ItemBase* handyitem = nullptr; + const EQEmu::ItemData* handyitem = nullptr; uint32 numItemSlots = 80; //The max number of items passed in the transaction. if (m_ClientVersionBit & EQEmu::versions::bit_RoFAndLater) { // RoF+ can send 200 items numItemSlots = 200; } - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; Mob* merch = entity_list.GetMobByNpcTypeID(npcid); @@ -879,7 +879,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { int charges = 1; if (item->IsClassCommon()) charges = item->MaxCharges; - ItemInst* inst = database.CreateItem(item, charges); + EQEmu::ItemInstance* inst = database.CreateItem(item, charges); if (inst) { if (RuleB(Merchant, UsePriceMod)) { inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false))); @@ -920,7 +920,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // charges=ml.charges; //else charges = item->MaxCharges; - ItemInst* inst = database.CreateItem(item, charges); + EQEmu::ItemInstance* inst = database.CreateItem(item, charges); if (inst) { if (RuleB(Merchant, UsePriceMod)) { inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false))); @@ -1095,11 +1095,11 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) switch(memspell->scribing) { case memSpellScribing: { // scribing spell to book - const ItemInst* inst = m_inv[EQEmu::legacy::SlotCursor]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::SlotCursor]; if (inst && inst->IsClassCommon()) { - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (RuleB(Character, RestrictSpellScribing) && !item->IsEquipable(GetRace(), GetClass())) { Message_StringID(13, CANNOT_USE_ITEM); diff --git a/zone/command.cpp b/zone/command.cpp index 86f745710..1ac321223 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2545,9 +2545,9 @@ void command_peekinv(Client *c, const Seperator *sep) } Client* targetClient = c->GetTarget()->CastToClient(); - const ItemInst* inst_main = nullptr; - const ItemInst* inst_sub = nullptr; - const EQEmu::ItemBase* item_data = nullptr; + const EQEmu::ItemInstance* inst_main = nullptr; + const EQEmu::ItemInstance* inst_sub = nullptr; + const EQEmu::ItemData* item_data = nullptr; std::string item_link; EQEmu::SayLinkEngine linker; linker.SetLinkType(EQEmu::saylink::SayLinkItemInst); @@ -2780,7 +2780,7 @@ void command_interrogateinv(Client *c, const Seperator *sep) } Client* target = nullptr; - std::map instmap; + std::map instmap; bool log = false; bool silent = false; bool error = false; @@ -3146,8 +3146,8 @@ void command_equipitem(Client *c, const Seperator *sep) { uint32 slot_id = atoi(sep->arg[1]); if (sep->IsNumber(1) && ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::legacy::SlotPowerSource))) { - const ItemInst* from_inst = c->GetInv().GetItem(EQEmu::legacy::SlotCursor); - const ItemInst* to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack) + const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::legacy::SlotCursor); + const EQEmu::ItemInstance* to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack) bool partialmove = false; int16 movecount; @@ -5519,7 +5519,7 @@ void command_summonitem(Client *c, const Seperator *sep) } int16 item_status = 0; - const EQEmu::ItemBase* item = database.GetItem(itemid); + const EQEmu::ItemData* item = database.GetItem(itemid); if (item) { item_status = static_cast(item->MinStatus); } @@ -5558,7 +5558,7 @@ void command_giveitem(Client *c, const Seperator *sep) Client *t = c->GetTarget()->CastToClient(); uint32 itemid = atoi(sep->arg[1]); int16 item_status = 0; - const EQEmu::ItemBase* item = database.GetItem(itemid); + const EQEmu::ItemData* item = database.GetItem(itemid); if(item) { item_status = static_cast(item->MinStatus); } @@ -5611,7 +5611,7 @@ void command_itemsearch(Client *c, const Seperator *sep) { const char *search_criteria=sep->argplus[1]; - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; std::string item_link; EQEmu::SayLinkEngine linker; linker.SetLinkType(EQEmu::saylink::SayLinkItemData); @@ -7126,7 +7126,7 @@ void command_path(Client *c, const Seperator *sep) void Client::Undye() { for (int cur_slot = EQEmu::textures::TextureBegin; cur_slot <= EQEmu::textures::LastTexture; cur_slot++) { uint8 slot2=SlotConvert(cur_slot); - ItemInst* inst = m_inv.GetItem(slot2); + EQEmu::ItemInstance* inst = m_inv.GetItem(slot2); if(inst != nullptr) { inst->SetColor(inst->GetItem()->Color); @@ -10235,7 +10235,7 @@ void command_zopp(Client *c, const Seperator *sep) uint32 itemid = atoi(sep->arg[3]); int16 charges = sep->argnum == 4 ? atoi(sep->arg[4]) : 1; // defaults to 1 charge if not specified - const EQEmu::ItemBase* FakeItem = database.GetItem(itemid); + const EQEmu::ItemData* FakeItem = database.GetItem(itemid); if (!FakeItem) { c->Message(13, "Error: Item [%u] is not a valid item id.", itemid); @@ -10243,7 +10243,7 @@ void command_zopp(Client *c, const Seperator *sep) } int16 item_status = 0; - const EQEmu::ItemBase* item = database.GetItem(itemid); + const EQEmu::ItemData* item = database.GetItem(itemid); if(item) { item_status = static_cast(item->MinStatus); } @@ -10257,7 +10257,7 @@ void command_zopp(Client *c, const Seperator *sep) c->Message(0, "Processing request..results may cause unpredictable behavior."); } - ItemInst* FakeItemInst = database.CreateItem(FakeItem, charges); + EQEmu::ItemInstance* FakeItemInst = database.CreateItem(FakeItem, charges); c->SendItemPacket(slotid, FakeItemInst, packettype); c->Message(0, "Sending zephyr op packet to client - [%s] %s (%u) with %i %s to slot %i.", packettype == ItemPacketTrade ? "Trade" : "Summon", FakeItem->Name, itemid, charges, diff --git a/zone/common.h b/zone/common.h index 9a5768c56..fd4ea0a89 100644 --- a/zone/common.h +++ b/zone/common.h @@ -568,7 +568,11 @@ struct MercData { uint32 NPCID; }; -class ItemInst; +namespace EQEmu +{ + class ItemInstance; +} + class Mob; // All data associated with a single trade class Trade @@ -606,7 +610,7 @@ public: private: // Send item data for trade item to other person involved in trade - void SendItemData(const ItemInst* inst, int16 dest_slot_id); + void SendItemData(const EQEmu::ItemInstance* inst, int16 dest_slot_id); uint32 with_id; Mob* owner; diff --git a/zone/corpse.cpp b/zone/corpse.cpp index ca32fc528..3690a3b4f 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -268,7 +268,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( int i; PlayerProfile_Struct *pp = &client->GetPP(); - ItemInst *item; + EQEmu::ItemInstance *item; /* Check if Zone has Graveyard First */ if(!zone->HasGraveyard()) { @@ -387,7 +387,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( Save(); } -void Corpse::MoveItemToCorpse(Client *client, ItemInst *inst, int16 equipSlot, std::list &removedList) +void Corpse::MoveItemToCorpse(Client *client, EQEmu::ItemInstance *inst, int16 equipSlot, std::list &removedList) { AddItem( inst->GetItem()->ID, @@ -979,8 +979,8 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a safe_delete(outapp); if(Loot_Request_Type == 5) { int pkitem = GetPlayerKillItem(); - const EQEmu::ItemBase* item = database.GetItem(pkitem); - ItemInst* inst = database.CreateItem(item, item->MaxCharges); + const EQEmu::ItemData* item = database.GetItem(pkitem); + EQEmu::ItemInstance* inst = database.CreateItem(item, item->MaxCharges); if(inst) { if (item->RecastDelay) inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0); @@ -994,7 +994,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } int i = 0; - const EQEmu::ItemBase* item = 0; + const EQEmu::ItemData* item = 0; ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); @@ -1013,7 +1013,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(i < corpselootlimit) { item = database.GetItem(item_data->item_id); if(client && item) { - ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned); + EQEmu::ItemInstance* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned); if(inst) { if (item->RecastDelay) inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0); @@ -1110,8 +1110,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { being_looted_by = 0xFFFFFFFF; return; } - const EQEmu::ItemBase* item = 0; - ItemInst *inst = 0; + const EQEmu::ItemData* item = 0; + EQEmu::ItemInstance *inst = 0; ServerLootItem_Struct* item_data = nullptr, *bag_item_data[10]; memset(bag_item_data, 0, sizeof(bag_item_data)); @@ -1149,7 +1149,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { if (inst->IsAugmented()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { - ItemInst *itm = inst->GetAugment(i); + EQEmu::ItemInstance *itm = inst->GetAugment(i); if (itm) { if (client->CheckLoreConflict(itm->GetItem())) { client->Message_StringID(0, LOOT_LORE_ERROR); @@ -1305,7 +1305,7 @@ void Corpse::QueryLoot(Client* to) { else x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; - const EQEmu::ItemBase* item = database.GetItem(sitem->item_id); + const EQEmu::ItemData* item = database.GetItem(sitem->item_id); if (item) to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast(sitem->lootslot), sitem->equip_slot, item->Name, item->ID, sitem->charges); @@ -1319,7 +1319,7 @@ void Corpse::QueryLoot(Client* to) { } else { sitem->lootslot=y; - const EQEmu::ItemBase* item = database.GetItem(sitem->item_id); + const EQEmu::ItemData* item = database.GetItem(sitem->item_id); if (item) to->Message(0, "LootSlot: %i Item: %s (%d), Count: %i", sitem->lootslot, item->Name, item->ID, sitem->charges); @@ -1414,7 +1414,7 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const { } uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; if (material_slot > EQEmu::textures::LastTexture) { return 0; diff --git a/zone/corpse.h b/zone/corpse.h index 509899827..e43c4c020 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -24,13 +24,17 @@ class Client; class EQApplicationPacket; class Group; -class ItemInst; class NPC; class Raid; struct ExtraAttackOptions; struct NPCType; +namespace EQEmu +{ + class ItemInstance; +} + #define MAX_LOOTERS 72 class Corpse : public Mob { @@ -128,7 +132,7 @@ class Corpse : public Mob { virtual void UpdateEquipmentLight(); protected: - void MoveItemToCorpse(Client *client, ItemInst *inst, int16 equipSlot, std::list &removedList); + void MoveItemToCorpse(Client *client, EQEmu::ItemInstance *inst, int16 equipSlot, std::list &removedList); private: bool is_player_corpse; /* Determines if Player Corpse or not */ diff --git a/zone/doors.cpp b/zone/doors.cpp index 9b1f41370..dd3dbd651 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -188,7 +188,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) uint8 keepoffkeyring = GetNoKeyring(); uint32 haskey = 0; uint32 playerkey = 0; - const ItemInst *lockpicks = sender->GetInv().GetItem(EQEmu::legacy::SlotCursor); + const EQEmu::ItemInstance *lockpicks = sender->GetInv().GetItem(EQEmu::legacy::SlotCursor); haskey = sender->GetInv().HasItem(keyneeded, 1); diff --git a/zone/effects.cpp b/zone/effects.cpp index 5b022f97d..e2d9d4075 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -481,7 +481,7 @@ int32 Client::GetActSpellCasttime(uint16 spell_id, int32 casttime) bool Client::TrainDiscipline(uint32 itemid) { //get the item info - const EQEmu::ItemBase *item = database.GetItem(itemid); + const EQEmu::ItemData *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); Log.Out(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 43f4c3cdc..bf9bbe5cb 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -157,7 +157,7 @@ void PerlembParser::ReloadQuests() { spell_quest_status_.clear(); } -int PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob, +int PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, uint32 extradata, bool global, std::vector *extra_pointers) { if(!perl) @@ -174,9 +174,9 @@ int PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * da std::string package_name; GetQuestTypes(isPlayerQuest, isGlobalPlayerQuest, isGlobalNPC, isItemQuest, isSpellQuest, - event, npcmob, iteminst, mob, global); + event, npcmob, item_inst, mob, global); GetQuestPackageName(isPlayerQuest, isGlobalPlayerQuest, isGlobalNPC, isItemQuest, isSpellQuest, - package_name, event, objid, data, npcmob, iteminst, global); + package_name, event, objid, data, npcmob, item_inst, global); const char *sub_name = QuestEventSubroutines[event]; if(!perl->SubExists(package_name.c_str(), sub_name)) { @@ -208,14 +208,14 @@ int PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * da /* Check for Event export event enable */ if (parse->perl_event_export_settings[event].event_variables){ - ExportEventVariables(package_name, event, objid, data, npcmob, iteminst, mob, extradata, extra_pointers); + ExportEventVariables(package_name, event, objid, data, npcmob, item_inst, mob, extradata, extra_pointers); } if(isPlayerQuest || isGlobalPlayerQuest){ return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr); } else if(isItemQuest) { - return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, iteminst); + return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, item_inst); } else if(isSpellQuest){ if(mob) { @@ -249,7 +249,7 @@ int PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::stri return EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true, extra_pointers); } -int PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, +int PerlembParser::EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { // needs pointer validation on 'item' argument return EventCommon(evt, item->GetID(), nullptr, nullptr, item, client, extra_data, false, extra_pointers); @@ -348,7 +348,7 @@ bool PerlembParser::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) { return(perl->SubExists(package_name.str().c_str(), subname)); } -bool PerlembParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { +bool PerlembParser::ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt) { std::stringstream package_name; package_name << "qst_item_" << itm->GetID(); @@ -471,7 +471,7 @@ void PerlembParser::LoadGlobalPlayerScript(std::string filename) { global_player_quest_status_ = questLoaded; } -void PerlembParser::LoadItemScript(std::string filename, ItemInst *item) { +void PerlembParser::LoadItemScript(std::string filename, EQEmu::ItemInstance *item) { if (item == nullptr) return; @@ -642,13 +642,13 @@ void PerlembParser::ExportVar(const char *pkgprefix, const char *varname, const } } -int PerlembParser::SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst) { +int PerlembParser::SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, EQEmu::ItemInstance* item_inst) { if(!perl) return 0; int ret_value = 0; if(mob && mob->IsClient()) - quest_manager.StartQuest(other, mob->CastToClient(), iteminst); + quest_manager.StartQuest(other, mob->CastToClient(), item_inst); else quest_manager.StartQuest(other, nullptr, nullptr); @@ -711,8 +711,8 @@ int PerlembParser::SendCommands(const char *pkgprefix, const char *event, uint32 } //only export QuestItem if it's an item quest - if(iteminst) { - ItemInst* curi = quest_manager.GetQuestItem(); + if(item_inst) { + EQEmu::ItemInstance* curi = quest_manager.GetQuestItem(); snprintf(namebuf, 64, "%s::questitem", pkgprefix); SV *questitem = get_sv(namebuf, true); sv_setref_pv(questitem, "QuestItem", curi); @@ -840,7 +840,7 @@ void PerlembParser::MapFunctions() { } void PerlembParser::GetQuestTypes(bool &isPlayerQuest, bool &isGlobalPlayerQuest, bool &isGlobalNPC, bool &isItemQuest, - bool &isSpellQuest, QuestEventID event, NPC* npcmob, ItemInst* iteminst, Mob* mob, bool global) + bool &isSpellQuest, QuestEventID event, NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, bool global) { if(event == EVENT_SPELL_EFFECT_CLIENT || event == EVENT_SPELL_EFFECT_NPC || @@ -854,7 +854,7 @@ void PerlembParser::GetQuestTypes(bool &isPlayerQuest, bool &isGlobalPlayerQuest else { if(!npcmob && mob) { - if(!iteminst) { + if(!item_inst) { if(global) { isGlobalPlayerQuest = true; } else { @@ -869,7 +869,7 @@ void PerlembParser::GetQuestTypes(bool &isPlayerQuest, bool &isGlobalPlayerQuest void PerlembParser::GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlayerQuest, bool &isGlobalNPC, bool &isItemQuest, bool &isSpellQuest, std::string &package_name, QuestEventID event, uint32 objid, const char * data, - NPC* npcmob, ItemInst* iteminst, bool global) + NPC* npcmob, EQEmu::ItemInstance* item_inst, bool global) { if(!isPlayerQuest && !isGlobalPlayerQuest && !isItemQuest && !isSpellQuest) { if(global) { @@ -881,8 +881,8 @@ void PerlembParser::GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlaye } } else if(isItemQuest) { - // need a valid ItemInst pointer check here..unsure how to cancel this process - const EQEmu::ItemBase* item = iteminst->GetItem(); + // need a valid EQEmu::ItemInstance pointer check here..unsure how to cancel this process + const EQEmu::ItemData* item = item_inst->GetItem(); package_name = "qst_item_"; package_name += itoa(item->ID); } @@ -1141,7 +1141,7 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) { #undef HASITEM_ISNULLITEM void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data, - NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector *extra_pointers) + NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, uint32 extradata, std::vector *extra_pointers) { switch (event) { case EVENT_SAY: { @@ -1159,7 +1159,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID if(extra_pointers) { size_t sz = extra_pointers->size(); for(size_t i = 0; i < sz; ++i) { - ItemInst *inst = EQEmu::any_cast(extra_pointers->at(i)); + EQEmu::ItemInstance *inst = EQEmu::any_cast(extra_pointers->at(i)); std::string var_name = "item"; var_name += std::to_string(i + 1); @@ -1327,19 +1327,19 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID case EVENT_SCALE_CALC: case EVENT_ITEM_ENTER_ZONE: { - // need a valid ItemInst pointer check here..unsure how to cancel this process + // need a valid EQEmu::ItemInstance pointer check here..unsure how to cancel this process ExportVar(package_name.c_str(), "itemid", objid); - ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name); + ExportVar(package_name.c_str(), "itemname", item_inst->GetItem()->Name); break; } case EVENT_ITEM_CLICK_CAST: case EVENT_ITEM_CLICK: { - // need a valid ItemInst pointer check here..unsure how to cancel this process + // need a valid EQEmu::ItemInstance pointer check here..unsure how to cancel this process ExportVar(package_name.c_str(), "itemid", objid); - ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name); + ExportVar(package_name.c_str(), "itemname", item_inst->GetItem()->Name); ExportVar(package_name.c_str(), "slotid", extradata); - ExportVar(package_name.c_str(), "spell_id", iteminst->GetItem()->Click.Effect); + ExportVar(package_name.c_str(), "spell_id", item_inst->GetItem()->Click.Effect); break; } @@ -1419,10 +1419,10 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID break; } case EVENT_DROP_ITEM: { - ExportVar(package_name.c_str(), "quantity", iteminst->IsStackable() ? iteminst->GetCharges() : 1); - ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name); - ExportVar(package_name.c_str(), "itemid", iteminst->GetItem()->ID); - ExportVar(package_name.c_str(), "spell_id", iteminst->GetItem()->Click.Effect); + ExportVar(package_name.c_str(), "quantity", item_inst->IsStackable() ? item_inst->GetCharges() : 1); + ExportVar(package_name.c_str(), "itemname", item_inst->GetItem()->Name); + ExportVar(package_name.c_str(), "itemid", item_inst->GetItem()->ID); + ExportVar(package_name.c_str(), "spell_id", item_inst->GetItem()->Click.Effect); ExportVar(package_name.c_str(), "slotid", extradata); break; } diff --git a/zone/embparser.h b/zone/embparser.h index 9b33b1ad2..8ae3fa10e 100644 --- a/zone/embparser.h +++ b/zone/embparser.h @@ -27,11 +27,15 @@ #include #include "embperl.h" -class ItemInst; class Mob; class Client; class NPC; +namespace EQEmu +{ + class ItemInstance; +} + typedef enum { questUnloaded, @@ -52,7 +56,7 @@ public: std::vector *extra_pointers); virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers); - virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + virtual int EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers); @@ -62,13 +66,13 @@ public: virtual bool PlayerHasQuestSub(QuestEventID evt); virtual bool GlobalPlayerHasQuestSub(QuestEventID evt); virtual bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt); - virtual bool ItemHasQuestSub(ItemInst *itm, QuestEventID evt); + virtual bool ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt); virtual void LoadNPCScript(std::string filename, int npc_id); virtual void LoadGlobalNPCScript(std::string filename); virtual void LoadPlayerScript(std::string filename); virtual void LoadGlobalPlayerScript(std::string filename); - virtual void LoadItemScript(std::string filename, ItemInst *item); + virtual void LoadItemScript(std::string filename, EQEmu::ItemInstance *item); virtual void LoadSpellScript(std::string filename, uint32 spell_id); virtual void AddVar(std::string name, std::string val); @@ -86,16 +90,16 @@ private: void ExportVar(const char *pkgprefix, const char *varname, float value); void ExportVarComplex(const char *pkgprefix, const char *varname, const char *value); - int EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob, + int EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, uint32 extradata, bool global, std::vector *extra_pointers); - int SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst *iteminst); + int SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, EQEmu::ItemInstance *item_inst); void MapFunctions(); void GetQuestTypes(bool &isPlayerQuest, bool &isGlobalPlayerQuest, bool &isGlobalNPC, bool &isItemQuest, - bool &isSpellQuest, QuestEventID event, NPC* npcmob, ItemInst* iteminst, Mob* mob, bool global); + bool &isSpellQuest, QuestEventID event, NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, bool global); void GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlayerQuest, bool &isGlobalNPC, bool &isItemQuest, bool &isSpellQuest, std::string &package_name, QuestEventID event, uint32 objid, const char * data, - NPC* npcmob, ItemInst* iteminst, bool global); + NPC* npcmob, EQEmu::ItemInstance* item_inst, bool global); void ExportCharID(const std::string &package_name, int &char_id, NPC *npcmob, Mob *mob); void ExportQGlobals(bool isPlayerQuest, bool isGlobalPlayerQuest, bool isGlobalNPC, bool isItemQuest, bool isSpellQuest, std::string &package_name, NPC *npcmob, Mob *mob, int char_id); @@ -104,7 +108,7 @@ private: void ExportZoneVariables(std::string &package_name); void ExportItemVariables(std::string &package_name, Mob *mob); void ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data, - NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector *extra_pointers); + NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, uint32 extradata, std::vector *extra_pointers); std::map npc_quest_status_; PerlQuestStatus global_npc_quest_status_; diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index adaaf3325..c6b07e764 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -110,7 +110,7 @@ XS(XS_QuestItem_new) if (items != 1) Perl_croak(aTHX_ "Usage: QuestItem::new()"); - ItemInst* RETVAL; + EQEmu::ItemInstance* RETVAL; RETVAL = quest_manager.GetQuestItem(); ST(0) = sv_newmortal(); diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 5c8769895..5a4acc36d 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -33,7 +33,7 @@ const char *getItemName(unsigned itemid) { - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; item = database.GetItem(itemid); if (item) diff --git a/zone/entity.cpp b/zone/entity.cpp index 4eda2e75e..2bbcdef20 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2009,7 +2009,7 @@ void EntityList::QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struc memcpy(outgbius, gbius, sizeof(GuildBankItemUpdate_Struct)); - const EQEmu::ItemBase *Item = database.GetItem(gbius->ItemID); + const EQEmu::ItemData *Item = database.GetItem(gbius->ItemID); auto it = client_list.begin(); while (it != client_list.end()) { @@ -3878,11 +3878,11 @@ void EntityList::GroupMessage(uint32 gid, const char *from, const char *message) uint16 EntityList::CreateGroundObject(uint32 itemid, const glm::vec4& position, uint32 decay_time) { - const EQEmu::ItemBase *is = database.GetItem(itemid); + const EQEmu::ItemData *is = database.GetItem(itemid); if (!is) return 0; - auto i = new ItemInst(is, is->MaxCharges); + auto i = new EQEmu::ItemInstance(is, is->MaxCharges); if (!i) return 0; diff --git a/zone/forage.cpp b/zone/forage.cpp index 324467025..b1ff0f545 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -153,9 +153,9 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, //we need this function to immediately determine, after we receive OP_Fishing, if we can even try to fish, otherwise we have to wait a while to get the failure bool Client::CanFish() { //make sure we still have a fishing pole on: - const ItemInst* Pole = m_inv[EQEmu::legacy::SlotPrimary]; + const EQEmu::ItemInstance* Pole = m_inv[EQEmu::legacy::SlotPrimary]; int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); - const ItemInst* Bait = nullptr; + const EQEmu::ItemInstance* Bait = nullptr; if (bslot != INVALID_INDEX) Bait = m_inv.GetItem(bslot); @@ -253,7 +253,7 @@ void Client::GoFish() //make sure we still have a fishing pole on: int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); - const ItemInst* Bait = nullptr; + const EQEmu::ItemInstance* Bait = nullptr; if (bslot != INVALID_INDEX) Bait = m_inv.GetItem(bslot); @@ -304,10 +304,10 @@ void Client::GoFish() food_id = common_fish_ids[index]; } - const EQEmu::ItemBase* food_item = database.GetItem(food_id); + const EQEmu::ItemData* food_item = database.GetItem(food_id); Message_StringID(MT_Skills, FISHING_SUCCESS); - ItemInst* inst = database.CreateItem(food_item, 1); + EQEmu::ItemInstance* inst = database.CreateItem(food_item, 1); if(inst != nullptr) { if(CheckLoreConflict(inst->GetItem())) { @@ -396,7 +396,7 @@ void Client::ForageItem(bool guarantee) { foragedfood = common_food_ids[index]; } - const EQEmu::ItemBase* food_item = database.GetItem(foragedfood); + const EQEmu::ItemData* food_item = database.GetItem(foragedfood); if(!food_item) { Log.Out(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem"); @@ -421,7 +421,7 @@ void Client::ForageItem(bool guarantee) { } Message_StringID(MT_Skills, stringid); - ItemInst* inst = database.CreateItem(food_item, 1); + EQEmu::ItemInstance* inst = database.CreateItem(food_item, 1); if(inst != nullptr) { // check to make sure it isn't a foraged lore item if(CheckLoreConflict(inst->GetItem())) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 57f83a981..3dfa6b958 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -694,7 +694,7 @@ void GuildBankManager::SendGuildBank(Client *c) if (c->ClientVersionBit() & EQEmu::versions::bit_RoFAndLater) { auto outapp = new EQApplicationPacket(OP_GuildBankItemList, sizeof(GuildBankItemListEntry_Struct) * 240); for (int i = 0; i < GUILD_BANK_DEPOSIT_AREA_SIZE; ++i) { - const EQEmu::ItemBase *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); + const EQEmu::ItemData *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); if (Item) { outapp->WriteUInt8(1); outapp->WriteUInt32(guild_bank->Items.DepositArea[i].Permissions); @@ -718,7 +718,7 @@ void GuildBankManager::SendGuildBank(Client *c) outapp->SetWritePosition(outapp->GetWritePosition() + 20); // newer clients have 40 deposit slots, keep them 0 for now for (int i = 0; i < GUILD_BANK_MAIN_AREA_SIZE; ++i) { - const EQEmu::ItemBase *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); + const EQEmu::ItemData *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); if (Item) { outapp->WriteUInt8(1); outapp->WriteUInt32(guild_bank->Items.MainArea[i].Permissions); @@ -749,7 +749,7 @@ void GuildBankManager::SendGuildBank(Client *c) { if(guild_bank->Items.DepositArea[i].ItemID > 0) { - const EQEmu::ItemBase *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); + const EQEmu::ItemData *Item = database.GetItem(guild_bank->Items.DepositArea[i].ItemID); if(!Item) continue; @@ -785,7 +785,7 @@ void GuildBankManager::SendGuildBank(Client *c) { if(guild_bank->Items.MainArea[i].ItemID > 0) { - const EQEmu::ItemBase *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); + const EQEmu::ItemData *Item = database.GetItem(guild_bank->Items.MainArea[i].ItemID); if(!Item) continue; @@ -916,7 +916,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 return false; } - const EQEmu::ItemBase *Item = database.GetItem(ItemID); + const EQEmu::ItemData *Item = database.GetItem(ItemID); GuildBankItemUpdate_Struct gbius; @@ -982,7 +982,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) (*iter)->Items.DepositArea[slotID].ItemID = 0; - const EQEmu::ItemBase *Item = database.GetItem((*iter)->Items.MainArea[mainSlot].ItemID); + const EQEmu::ItemData *Item = database.GetItem((*iter)->Items.MainArea[mainSlot].ItemID); GuildBankItemUpdate_Struct gbius; @@ -1038,7 +1038,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm else (*iter)->Items.MainArea[slotID].WhoFor[0] = '\0'; - const EQEmu::ItemBase *Item = database.GetItem((*iter)->Items.MainArea[slotID].ItemID); + const EQEmu::ItemData *Item = database.GetItem((*iter)->Items.MainArea[slotID].ItemID); GuildBankItemUpdate_Struct gbius; @@ -1062,7 +1062,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm entity_list.QueueClientsGuildBankItemUpdate(&gbius, guildID); } -ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity) +EQEmu::ItemInstance* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity) { auto Iterator = GetGuildBank(GuildID); @@ -1071,7 +1071,7 @@ ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, GuildBankItem* BankArea = nullptr; - ItemInst* inst = nullptr; + EQEmu::ItemInstance* inst = nullptr; if(Area == GuildBankDepositArea) { @@ -1169,7 +1169,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui bool deleted = true; - const EQEmu::ItemBase *Item = database.GetItem(BankArea[slotID].ItemID); + const EQEmu::ItemData *Item = database.GetItem(BankArea[slotID].ItemID); if(!Item->Stackable || (quantity >= BankArea[slotID].Quantity)) { std::string query = StringFormat("DELETE FROM `guild_bank` WHERE `guildid` = %i " @@ -1230,7 +1230,7 @@ bool GuildBankManager::MergeStacks(uint32 GuildID, uint16 SlotID) if(BankArea[SlotID].ItemID == 0) return false; - const EQEmu::ItemBase *Item = database.GetItem(BankArea[SlotID].ItemID); + const EQEmu::ItemData *Item = database.GetItem(BankArea[SlotID].ItemID); if(!Item->Stackable) return false; @@ -1328,7 +1328,7 @@ bool GuildBankManager::SplitStack(uint32 GuildID, uint16 SlotID, uint32 Quantity if(BankArea[SlotID].Quantity <= Quantity || Quantity == 0) return false; - const EQEmu::ItemBase *Item = database.GetItem(BankArea[SlotID].ItemID); + const EQEmu::ItemData *Item = database.GetItem(BankArea[SlotID].ItemID); if(!Item->Stackable) return false; diff --git a/zone/guild_mgr.h b/zone/guild_mgr.h index d06473392..abd11fd9f 100644 --- a/zone/guild_mgr.h +++ b/zone/guild_mgr.h @@ -117,7 +117,7 @@ public: bool AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 QtyOrCharges, const char *Donator, uint8 Permissions, const char *WhoFor); int Promote(uint32 GuildID, int SlotID); void SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Permissions, const char *MemberName); - ItemInst* GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity); + EQEmu::ItemInstance* GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity); bool DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity); bool HasItem(uint32 GuildID, uint32 ItemID); bool IsAreaFull(uint32 GuildID, uint16 Area); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index d03cac310..ae0a82ae3 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -31,7 +31,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { if (itemnum == 0) return 0; uint32 x = 0; - ItemInst *cur = nullptr; + EQEmu::ItemInstance *cur = nullptr; int i; if(where_to_check & invWhereWorn) { @@ -177,7 +177,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } -bool Client::CheckLoreConflict(const EQEmu::ItemBase* item) +bool Client::CheckLoreConflict(const EQEmu::ItemData* item) { if (!item) { return false; } if (!item->LoreFlag) { return false; } @@ -195,7 +195,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // TODO: update calling methods and script apis to handle a failure return - const EQEmu::ItemBase* item = database.GetItem(item_id); + const EQEmu::ItemData* item = database.GetItem(item_id); // make sure the item exists if(item == nullptr) { @@ -247,7 +247,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, bool enforceusable = RuleB(Inventory, EnforceAugmentUsability); for (int iter = AUG_INDEX_BEGIN; iter < EQEmu::legacy::ITEM_COMMON_SIZE; ++iter) { - const EQEmu::ItemBase* augtest = database.GetItem(augments[iter]); + const EQEmu::ItemData* augtest = database.GetItem(augments[iter]); if(augtest == nullptr) { if(augments[iter]) { @@ -528,7 +528,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // in any other situation just use charges as passed - ItemInst* inst = database.CreateItem(item, charges); + EQEmu::ItemInstance* inst = database.CreateItem(item, charges); if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); @@ -604,7 +604,7 @@ void Client::DropItem(int16 slot_id) } // Take control of item in client inventory - ItemInst *inst = m_inv.PopItem(slot_id); + EQEmu::ItemInstance *inst = m_inv.PopItem(slot_id); if(inst) { int i = parse->EventItem(EVENT_DROP_ITEM, this, inst, nullptr, "", slot_id); if(i != 0) { @@ -637,7 +637,7 @@ void Client::DropItem(int16 slot_id) } // Drop inst -void Client::DropInst(const ItemInst* inst) +void Client::DropInst(const EQEmu::ItemInstance* inst) { if (!inst) { // Item doesn't exist in inventory! @@ -660,7 +660,7 @@ void Client::DropInst(const ItemInst* inst) // Returns a slot's item ID (returns INVALID_ID if not found) int32 Client::GetItemIDAt(int16 slot_id) { - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (inst) return inst->GetItem()->ID; @@ -671,7 +671,7 @@ int32 Client::GetItemIDAt(int16 slot_id) { // Returns an augment's ID that's in an item (returns INVALID_ID if not found) // Pass in the slot ID of the item and which augslot you want to check (0-5) int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) { - const ItemInst* inst = m_inv[slot_id]; + const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (inst && inst->GetAugmentItemID(augslot)) { return inst->GetAugmentItemID(augslot); } @@ -764,7 +764,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd if (m_inv[slot_id]->IsClassBag()) { for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) { - ItemInst* bagitem = m_inv[slot_id]->GetItem(bag_idx); + EQEmu::ItemInstance* bagitem = m_inv[slot_id]->GetItem(bag_idx); if(bagitem) { int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx); @@ -789,7 +789,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool isDeleted = m_inv.DeleteItem(slot_id, quantity); - const ItemInst* inst = nullptr; + const EQEmu::ItemInstance* inst = nullptr; if (slot_id == EQEmu::legacy::SlotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); if(update_db) @@ -836,7 +836,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd } } -bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) +bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_update) { Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); m_inv.PushCursor(inst); @@ -853,7 +853,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) // Any items already there will be removed from user's inventory // (Also saves changes back to the database: this may be optimized in the future) // client_update: Sends packet to client -bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { +bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, bool client_update) { Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); if (slot_id == EQEmu::legacy::SlotCursor) { // don't trust macros before conditional statements... @@ -881,7 +881,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client // a lot of wasted checks and calls coded above... } -void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) +void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, ServerLootItem_Struct** bag_item_data) { Log.Out(Logs::Detail, Logs::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); @@ -912,7 +912,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI if (bag_item_data[index] == nullptr) continue; - const ItemInst *bagitem = database.CreateItem( + const EQEmu::ItemInstance *bagitem = database.CreateItem( bag_item_data[index]->item_id, bag_item_data[index]->charges, bag_item_data[index]->aug_1, @@ -948,13 +948,13 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI CalcBonuses(); } -bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cursor){ +bool Client::TryStacking(EQEmu::ItemInstance* item, uint8 type, bool try_worn, bool try_cursor){ if(!item || !item->IsStackable() || item->GetCharges()>=item->GetItem()->StackSize) return false; int16 i; uint32 item_id = item->GetItem()->ID; for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - ItemInst* tmp_inst = m_inv.GetItem(i); + EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(i); if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize){ MoveItemCharges(*item, i, type); CalcBonuses(); @@ -967,7 +967,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { for (uint8 j = SUB_INDEX_BEGIN; j < EQEmu::legacy::ITEM_CONTAINER_SIZE; j++) { uint16 slotid = Inventory::CalcSlotId(i, j); - ItemInst* tmp_inst = m_inv.GetItem(slotid); + EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(slotid); if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) { MoveItemCharges(*item, slotid, type); @@ -985,7 +985,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur // Locate an available space in inventory to place an item // and then put the item there // The change will be saved to the database -bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_cursor, ServerLootItem_Struct** bag_item_data) +bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bool try_cursor, ServerLootItem_Struct** bag_item_data) { // #1: Try to auto equip if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel <= level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != EQEmu::item::ItemTypeAugmentation) { @@ -1048,9 +1048,9 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs } // helper function for AutoPutLootInInventory -void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) +void Client::MoveItemCharges(EQEmu::ItemInstance &from, int16 to_slot, uint8 type) { - ItemInst *tmp_inst = m_inv.GetItem(to_slot); + EQEmu::ItemInstance *tmp_inst = m_inv.GetItem(to_slot); if(tmp_inst && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) { // this is how much room is left on the item we're stacking onto @@ -1074,7 +1074,7 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) #if 0 // TODO: needs clean-up to save references -bool MakeItemLink(char* &ret_link, const ItemBase *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint8 evolving, uint8 evolvedlevel) { +bool MakeItemLink(char* &ret_link, const ItemData *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint8 evolving, uint8 evolvedlevel) { //we're sending back the entire "link", minus the null characters & item name //that way, we can use it for regular links & Task links //note: initiator needs to pass us ret_link @@ -1183,13 +1183,13 @@ bool MakeItemLink(char* &ret_link, const ItemBase *item, uint32 aug0, uint32 aug } #endif -int Client::GetItemLinkHash(const ItemInst* inst) { +int Client::GetItemLinkHash(const EQEmu::ItemInstance* inst) { //pre-Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=70&postdays=0&postorder=asc //Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145 if (!inst) //have to have an item to make the hash return 0; - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); char* hash_str = 0; /*register */int hash = 0; @@ -1272,7 +1272,7 @@ int Client::GetItemLinkHash(const ItemInst* inst) { } // This appears to still be in use... The core of this should be incorporated into class Client::TextLink -void Client::SendItemLink(const ItemInst* inst, bool send_to_all) +void Client::SendItemLink(const EQEmu::ItemInstance* inst, bool send_to_all) { /* @@ -1283,7 +1283,7 @@ packet with the item number in it, but I cant seem to find it right now if (!inst) return; - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); const char* name2 = &item->Name[0]; auto outapp = new EQApplicationPacket(OP_ItemLinkText, strlen(name2) + 68); char buffer2[135] = {0}; @@ -1312,7 +1312,7 @@ packet with the item number in it, but I cant seem to find it right now safe_delete(outapp); } -void Client::SendLootItemInPacket(const ItemInst* inst, int16 slot_id) +void Client::SendLootItemInPacket(const EQEmu::ItemInstance* inst, int16 slot_id) { SendItemPacket(slot_id,inst, ItemPacketTrade); } @@ -1409,7 +1409,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { Log.Out(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit - ItemInst *inst = m_inv.GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::legacy::SlotCursor); if(inst) { parse->EventItem(EVENT_DESTROY_ITEM, this, inst, nullptr, "", 0); } @@ -1453,8 +1453,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //Setup uint32 srcitemid = 0; uint32 dstitemid = 0; - ItemInst* src_inst = m_inv.GetItem(src_slot_id); - ItemInst* dst_inst = m_inv.GetItem(dst_slot_id); + EQEmu::ItemInstance* src_inst = m_inv.GetItem(src_slot_id); + EQEmu::ItemInstance* dst_inst = m_inv.GetItem(dst_slot_id); if (src_inst){ Log.Out(Logs::Detail, Logs::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); srcitemid = src_inst->GetItem()->ID; @@ -1470,8 +1470,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { dstitemid = dst_inst->GetItem()->ID; } if (Trader && srcitemid>0){ - ItemInst* srcbag; - ItemInst* dstbag; + EQEmu::ItemInstance* srcbag; + EQEmu::ItemInstance* dstbag; uint32 srcbagid =0; uint32 dstbagid = 0; @@ -1517,7 +1517,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if (src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_END && src_inst->IsClassBag()){ for (uint8 idx = SUB_INDEX_BEGIN; idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { - const ItemInst* baginst = src_inst->GetItem(idx); + const EQEmu::ItemInstance* baginst = src_inst->GetItem(idx); if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){ DeleteItemInInventory(Inventory::CalcSlotId(src_slot_id, idx),0,false); } @@ -1532,7 +1532,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_END && dst_inst->IsClassBag()){ for (uint8 idx = SUB_INDEX_BEGIN; idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { - const ItemInst* baginst = dst_inst->GetItem(idx); + const EQEmu::ItemInstance* baginst = dst_inst->GetItem(idx); if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){ DeleteItemInInventory(Inventory::CalcSlotId(dst_slot_id, idx),0,false); } @@ -1550,12 +1550,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { auto ndh_inst = m_inv[src_slot_id]; std::string ndh_item_data; if (ndh_inst == nullptr) { - ndh_item_data.append("[nullptr on ItemInst*]"); + ndh_item_data.append("[nullptr on EQEmu::ItemInstance*]"); } else { auto ndh_item = ndh_inst->GetItem(); if (ndh_item == nullptr) { - ndh_item_data.append("[nullptr on ItemBase*]"); + ndh_item_data.append("[nullptr on ItemData*]"); } else { ndh_item_data.append(StringFormat("name=%s", ndh_item->Name)); @@ -1576,7 +1576,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(m_tradeskill_object != nullptr) { if (src_slot_id >= EQEmu::legacy::WORLD_BEGIN && src_slot_id <= EQEmu::legacy::WORLD_END) { // Picking up item from world container - ItemInst* inst = m_tradeskill_object->PopItem(Inventory::CalcBagIdx(src_slot_id)); + EQEmu::ItemInstance* inst = m_tradeskill_object->PopItem(Inventory::CalcBagIdx(src_slot_id)); if (inst) { PutItemInInventory(dst_slot_id, *inst, false); safe_delete(inst); @@ -1589,7 +1589,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { else if (dst_slot_id >= EQEmu::legacy::WORLD_BEGIN && dst_slot_id <= EQEmu::legacy::WORLD_END) { // Putting item into world container, which may swap (or pile onto) with existing item uint8 world_idx = Inventory::CalcBagIdx(dst_slot_id); - ItemInst* world_inst = m_tradeskill_object->PopItem(world_idx); + EQEmu::ItemInstance* world_inst = m_tradeskill_object->PopItem(world_idx); // Case 1: No item in container, unidirectional "Put" if (world_inst == nullptr) { @@ -1597,8 +1597,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { m_inv.DeleteItem(src_slot_id); } else { - const EQEmu::ItemBase* world_item = world_inst->GetItem(); - const EQEmu::ItemBase* src_item = src_inst->GetItem(); + const EQEmu::ItemData* world_item = world_inst->GetItem(); + const EQEmu::ItemData* src_item = src_inst->GetItem(); if (world_item && src_item) { // Case 2: Same item on cursor, stacks, transfer of charges needed if ((world_item->ID == src_item->ID) && src_inst->IsStackable()) { @@ -1629,7 +1629,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { else { // Case 3: Swap the item on user with item in world container // World containers don't follow normal rules for swapping - ItemInst* inv_inst = m_inv.PopItem(src_slot_id); + EQEmu::ItemInstance* inv_inst = m_inv.PopItem(src_slot_id); m_tradeskill_object->PutItem(world_idx, inv_inst); m_inv.PutItem(src_slot_id, *world_inst); safe_delete(inv_inst); @@ -1744,7 +1744,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Split into two src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); Log.Out(Logs::Detail, Logs::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); - ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); + EQEmu::ItemInstance* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); m_inv.PutItem(dst_slot_id, *inst); safe_delete(inst); } @@ -1838,8 +1838,8 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { // This prevents the client from crashing when closing any 'phantom' bags - const EQEmu::ItemBase* token_struct = database.GetItem(22292); // 'Copper Coin' - ItemInst* token_inst = database.CreateItem(token_struct, 1); + const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' + EQEmu::ItemInstance* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); @@ -1863,8 +1863,8 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { - const EQEmu::ItemBase* token_struct = database.GetItem(22292); // 'Copper Coin' - ItemInst* token_inst = database.CreateItem(token_struct, 1); + const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' + EQEmu::ItemInstance* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); @@ -1880,8 +1880,8 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::legacy::SlotPowerSource) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { - const EQEmu::ItemBase* token_struct = database.GetItem(22292); // 'Copper Coin' - ItemInst* token_inst = database.CreateItem(token_struct, 1); + const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' + EQEmu::ItemInstance* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); @@ -1905,8 +1905,8 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { - const EQEmu::ItemBase* token_struct = database.GetItem(22292); // 'Copper Coin' - ItemInst* token_inst = database.CreateItem(token_struct, 1); + const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' + EQEmu::ItemInstance* token_inst = database.CreateItem(token_struct, 1); SendItemPacket(resync_slot, token_inst, ItemPacketTrade); SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); @@ -1945,7 +1945,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { move_count = 0; - const ItemInst* from_inst = m_inv[postaction_call?to_slot_id:from_slot_id]; + const EQEmu::ItemInstance* from_inst = m_inv[postaction_call?to_slot_id:from_slot_id]; if(from_inst) { qsaudit->items[move_count].from_slot = from_slot_id; @@ -1960,7 +1960,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { if (from_inst->IsType(EQEmu::item::ItemClassBag)) { for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { - const ItemInst* from_baginst = from_inst->GetItem(bag_idx); + const EQEmu::ItemInstance* from_baginst = from_inst->GetItem(bag_idx); if(from_baginst) { qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); @@ -1978,7 +1978,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { } if(to_slot_id != from_slot_id) { - const ItemInst* to_inst = m_inv[postaction_call?from_slot_id:to_slot_id]; + const EQEmu::ItemInstance* to_inst = m_inv[postaction_call?from_slot_id:to_slot_id]; if(to_inst) { qsaudit->items[move_count].from_slot = to_slot_id; @@ -1993,7 +1993,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { if (to_inst->IsType(EQEmu::item::ItemClassBag)) { for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { - const ItemInst* to_baginst = to_inst->GetItem(bag_idx); + const EQEmu::ItemInstance* to_baginst = to_inst->GetItem(bag_idx); if(to_baginst) { qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); @@ -2027,7 +2027,7 @@ void Client::DyeArmor(EQEmu::TintProfile* dye){ if (slot != INVALID_INDEX){ DeleteItemInInventory(slot,1,true); uint8 slot2=SlotConvert(i); - ItemInst* inst = this->m_inv.GetItem(slot2); + EQEmu::ItemInstance* inst = this->m_inv.GetItem(slot2); if(inst){ uint32 armor_color = ((uint32)dye->Slot[i].Red << 16) | ((uint32)dye->Slot[i].Green << 8) | ((uint32)dye->Slot[i].Blue); inst->SetColor(armor_color); @@ -2057,8 +2057,8 @@ void Client::DyeArmor(EQEmu::TintProfile* dye){ #if 0 bool Client::DecreaseByItemType(uint32 type, uint8 amt) { - const ItemBase* TempItem = 0; - ItemInst* ins; + const ItemData* TempItem = 0; + EQEmu::ItemInstance* ins; int x; for(x=EQEmu::legacy::POSSESSIONS_BEGIN; x <= EQEmu::legacy::POSSESSIONS_END; x++) { @@ -2109,8 +2109,8 @@ bool Client::DecreaseByItemType(uint32 type, uint8 amt) { #endif bool Client::DecreaseByID(uint32 type, uint8 amt) { - const EQEmu::ItemBase* TempItem = nullptr; - ItemInst* ins = nullptr; + const EQEmu::ItemData* TempItem = nullptr; + EQEmu::ItemInstance* ins = nullptr; int x; int num = 0; for(x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::GENERAL_BAGS_END; x++) @@ -2204,7 +2204,7 @@ static uint32 GetDisenchantedBagID(uint8 bag_slots) } } -static bool CopyBagContents(ItemInst* new_bag, const ItemInst* old_bag) +static bool CopyBagContents(EQEmu::ItemInstance* new_bag, const EQEmu::ItemInstance* old_bag) { if (!new_bag || !old_bag) { return false; } if (new_bag->GetItem()->BagSlots < old_bag->GetItem()->BagSlots) { return false; } @@ -2308,7 +2308,7 @@ void Client::DisenchantSummonedBags(bool client_update) if (CopyBagContents(new_inst, inst)) { Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::legacy::SlotCursor); - std::list local; + std::list local; local.push_front(new_inst); m_inv.PopItem(EQEmu::legacy::SlotCursor); safe_delete(inst); @@ -2405,7 +2405,7 @@ void Client::RemoveNoRent(bool client_update) } if (!m_inv.CursorEmpty()) { - std::list local; + std::list local; while (!m_inv.CursorEmpty()) { auto inst = m_inv.PopItem(EQEmu::legacy::SlotCursor); @@ -2516,8 +2516,8 @@ void Client::RemoveDuplicateLore(bool client_update) // Shared Bank and Shared Bank Containers are not checked due to their allowing duplicate lore items if (!m_inv.CursorEmpty()) { - std::list local_1; - std::list local_2; + std::list local_1; + std::list local_2; while (!m_inv.CursorEmpty()) { auto inst = m_inv.PopItem(EQEmu::legacy::SlotCursor); @@ -2591,7 +2591,7 @@ void Client::MoveSlotNotAllowed(bool client_update) uint32 Client::GetEquipment(uint8 material_slot) const { int16 invslot; - const ItemInst *item; + const EQEmu::ItemInstance *item; if(material_slot > EQEmu::textures::LastTexture) { @@ -2617,7 +2617,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const #if 0 int32 Client::GetEquipmentMaterial(uint8 material_slot) { - const ItemBase *item; + const ItemData *item; item = database.GetItem(GetEquipment(material_slot)); if(item != 0) @@ -2634,7 +2634,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const if (material_slot > EQEmu::textures::LastTexture) return 0; - const EQEmu::ItemBase *item = database.GetItem(GetEquipment(material_slot)); + const EQEmu::ItemData *item = database.GetItem(GetEquipment(material_slot)); if(item != nullptr) return ((m_pp.item_tint.Slot[material_slot].UseTint) ? m_pp.item_tint.Slot[material_slot].Color : item->Color); @@ -2642,7 +2642,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const } // Send an item packet (including all subitems of the item) -void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type) +void Client::SendItemPacket(int16 slot_id, const EQEmu::ItemInstance* inst, ItemPacketType packet_type) { if (!inst) return; @@ -2667,7 +2667,7 @@ void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType FastQueuePacket(&outapp); } -EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type) +EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const EQEmu::ItemInstance* inst, ItemPacketType packet_type) { if (!inst) return nullptr; @@ -2717,8 +2717,8 @@ void Client::CreateBandolier(const EQApplicationPacket *app) Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name); strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name); - const ItemInst* InvItem = nullptr; - const EQEmu::ItemBase *BaseItem = nullptr; + const EQEmu::ItemInstance* InvItem = nullptr; + const EQEmu::ItemData *BaseItem = nullptr; int16 WeaponSlot = 0; database.DeleteCharacterBandolier(this->CharacterID(), bs->Number); @@ -2762,7 +2762,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->Number); int16 slot = 0; int16 WeaponSlot = 0; - ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory + EQEmu::ItemInstance *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory // First we pull the items for this bandolier set out of their inventory, this makes space to put the // currently equipped items back. @@ -2827,7 +2827,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { Log.Out(Logs::Detail, Logs::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); - ItemInst *InvItem = m_inv.PopItem(WeaponSlot); + EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory Log.Out(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", @@ -2861,7 +2861,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) // if the player has this item in their inventory, and it is not already where it needs to be if(BandolierItems[BandolierSlot]) { // Pull the item that we are going to replace - ItemInst *InvItem = m_inv.PopItem(WeaponSlot); + EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot); // Put the item specified in the bandolier where it needs to be m_inv.PutItem(WeaponSlot, *BandolierItems[BandolierSlot]); @@ -2881,7 +2881,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) else { // This bandolier set has no item for this slot, so take whatever is in the weapon slot and // put it in the player's inventory. - ItemInst *InvItem = m_inv.PopItem(WeaponSlot); + EQEmu::ItemInstance *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { Log.Out(Logs::Detail, Logs::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory @@ -2899,7 +2899,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) CalcBonuses(); } -bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { +bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateClient) { // This is a support function for Client::SetBandolier, however it can be used anywhere it's functionality is required. // @@ -2932,7 +2932,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::SlotCursor; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving. - ItemInst* InvItem = m_inv.GetItem(i); + EQEmu::ItemInstance* InvItem = m_inv.GetItem(i); if(InvItem && (InvItem->GetItem()->ID == ItemID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { @@ -2991,7 +2991,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::SlotCursor; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor. - ItemInst* InvItem = m_inv.GetItem(i); + EQEmu::ItemInstance* InvItem = m_inv.GetItem(i); if (!InvItem) { // Found available slot in personal inventory @@ -3047,7 +3047,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool if (!requester) return false; - std::map instmap; + std::map instmap; // build reference map for (int16 index = SLOT_BEGIN; index < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++index) { @@ -3140,7 +3140,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool return true; } -void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) +void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); @@ -3153,7 +3153,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea } else { if (inst) { - for (int16 sub = SUB_INDEX_BEGIN; (sub < EQEmu::legacy::ITEM_CONTAINER_SIZE) && (!error); ++sub) { // treat any ItemInst as having the max internal slots available + for (int16 sub = SUB_INDEX_BEGIN; (sub < EQEmu::legacy::ITEM_CONTAINER_SIZE) && (!error); ++sub) { // treat any EQEmu::ItemInstance as having the max internal slots available if (inst->GetItem(sub)) InterrogateInventory_(true, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); } @@ -3193,7 +3193,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea return; } -bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, int depth) +bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::ItemInstance* inst, const EQEmu::ItemInstance* parent, int depth) { // very basic error checking - can be elaborated upon if more in-depth testing is needed... @@ -3273,7 +3273,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { - ItemInst *inst = GetItem(slot_id); + EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); database.SaveInventory(character_id, inst, slot_id); @@ -3281,7 +3281,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) { - ItemInst *inst = GetItem(slot_id); + EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); database.SaveInventory(character_id, inst, slot_id); @@ -3289,7 +3289,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) { - ItemInst *inst = GetItem(slot_id); + EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); database.SaveInventory(character_id, inst, slot_id); @@ -3297,7 +3297,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) { - ItemInst *inst = GetItem(slot_id); + EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); database.SaveInventory(character_id, inst, slot_id); @@ -3305,7 +3305,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier) { - ItemInst *inst = GetItem(slot_id); + EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { return inst->GetCustomData(identifier); } diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 910331e27..2a43eda39 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -119,7 +119,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml int charges = lds->Entries[i].multiplier; for(int j = 0; j < charges; ++j) { if(zone->random.Real(0.0, 100.0) <= lds->Entries[i].chance) { - const EQEmu::ItemBase* dbitem = GetItem(lds->Entries[i].item_id); + const EQEmu::ItemData* dbitem = GetItem(lds->Entries[i].item_id); npc->AddLootDrop(dbitem, itemlist, lds->Entries[i].item_charges, lds->Entries[i].minlevel, lds->Entries[i].maxlevel, lds->Entries[i].equip_item > 0 ? true : false, false); } @@ -140,7 +140,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml float roll_t_min = 0.0f; bool active_item_list = false; for(uint32 i = 0; i < lds->NumEntries; ++i) { - const EQEmu::ItemBase* db_item = GetItem(lds->Entries[i].item_id); + const EQEmu::ItemData* db_item = GetItem(lds->Entries[i].item_id); if(db_item) { roll_t += lds->Entries[i].chance; active_item_list = true; @@ -157,7 +157,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml for(int i = 0; i < mindrop; ++i) { float roll = (float)zone->random.Real(0.0, roll_t_min); for(uint32 j = 0; j < lds->NumEntries; ++j) { - const EQEmu::ItemBase* db_item = GetItem(lds->Entries[j].item_id); + const EQEmu::ItemData* db_item = GetItem(lds->Entries[j].item_id); if(db_item) { if(roll < lds->Entries[j].chance) { npc->AddLootDrop(db_item, itemlist, lds->Entries[j].item_charges, lds->Entries[j].minlevel, @@ -187,7 +187,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml for(int i = mindrop; i < droplimit; ++i) { float roll = (float)zone->random.Real(0.0, roll_t); for(uint32 j = 0; j < lds->NumEntries; ++j) { - const EQEmu::ItemBase* db_item = GetItem(lds->Entries[j].item_id); + const EQEmu::ItemData* db_item = GetItem(lds->Entries[j].item_id); if(db_item) { if(roll < lds->Entries[j].chance) { npc->AddLootDrop(db_item, itemlist, lds->Entries[j].item_charges, lds->Entries[j].minlevel, @@ -221,7 +221,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml } //if itemlist is null, just send wear changes -void NPC::AddLootDrop(const EQEmu::ItemBase *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) { +void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) { if(item2 == nullptr) return; @@ -258,7 +258,7 @@ void NPC::AddLootDrop(const EQEmu::ItemBase *item2, ItemList* itemlist, int16 ch if (equipit) { uint8 eslot = 0xFF; char newid[20]; - const EQEmu::ItemBase* compitem = nullptr; + const EQEmu::ItemData* compitem = nullptr; bool found = false; // track if we found an empty slot we fit into int32 foundslot = -1; // for multi-slot items @@ -415,14 +415,14 @@ void NPC::AddLootDrop(const EQEmu::ItemBase *item2, ItemList* itemlist, int16 ch SendAppearancePacket(AT_Light, GetActiveLightType()); } -void NPC::AddItem(const EQEmu::ItemBase* item, uint16 charges, bool equipitem) { +void NPC::AddItem(const EQEmu::ItemData* item, uint16 charges, bool equipitem) { //slot isnt needed, its determined from the item. AddLootDrop(item, &itemlist, charges, 1, 255, equipitem, equipitem); } void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem) { //slot isnt needed, its determined from the item. - const EQEmu::ItemBase * i = database.GetItem(itemid); + const EQEmu::ItemData * i = database.GetItem(itemid); if(i == nullptr) return; AddLootDrop(i, &itemlist, charges, 1, 255, equipitem, equipitem); diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 403ca82aa..2e83c5625 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -1219,13 +1219,13 @@ Lua_Raid Lua_Client::GetRaid() { bool Lua_Client::PutItemInInventory(int slot_id, Lua_ItemInst inst) { Lua_Safe_Call_Bool(); - ItemInst *rinst = inst; + EQEmu::ItemInstance *rinst = inst; return self->PutItemInInventory(slot_id, *rinst, true); } bool Lua_Client::PushItemOnCursor(Lua_ItemInst inst) { Lua_Safe_Call_Bool(); - ItemInst *rinst = inst; + EQEmu::ItemInstance *rinst = inst; return self->PushItemOnCursor(*rinst, true); } diff --git a/zone/lua_inventory.cpp b/zone/lua_inventory.cpp index 498835926..0866eebc5 100644 --- a/zone/lua_inventory.cpp +++ b/zone/lua_inventory.cpp @@ -20,7 +20,7 @@ Lua_ItemInst Lua_Inventory::GetItem(int slot_id, int bag_slot) { int Lua_Inventory::PutItem(int slot_id, Lua_ItemInst item) { Lua_Safe_Call_Int(); - ItemInst *inst = item; + EQEmu::ItemInstance *inst = item; if(!inst) { return 0; } @@ -30,7 +30,7 @@ int Lua_Inventory::PutItem(int slot_id, Lua_ItemInst item) { int Lua_Inventory::PushCursor(Lua_ItemInst item) { Lua_Safe_Call_Int(); - ItemInst *inst = item; + EQEmu::ItemInstance *inst = item; if(!inst) { return 0; } diff --git a/zone/lua_item.cpp b/zone/lua_item.cpp index d6846abc0..67e7a1bd4 100644 --- a/zone/lua_item.cpp +++ b/zone/lua_item.cpp @@ -7,7 +7,7 @@ #include "lua_item.h" Lua_Item::Lua_Item(uint32 item_id) { - const EQEmu::ItemBase *t = database.GetItem(item_id); + const EQEmu::ItemData *t = database.GetItem(item_id); SetLuaPtrData(t); } diff --git a/zone/lua_item.h b/zone/lua_item.h index 74294f2a5..d5a32c41f 100644 --- a/zone/lua_item.h +++ b/zone/lua_item.h @@ -6,7 +6,7 @@ namespace EQEmu { - struct ItemBase; + struct ItemData; } namespace luabind { @@ -15,17 +15,17 @@ namespace luabind { luabind::scope lua_register_item(); -class Lua_Item : public Lua_Ptr +class Lua_Item : public Lua_Ptr { - typedef const EQEmu::ItemBase NativeType; + typedef const EQEmu::ItemData NativeType; public: Lua_Item(uint32 item_id); Lua_Item() : Lua_Ptr(nullptr) { } - Lua_Item(const EQEmu::ItemBase *d) : Lua_Ptr(d) { } + Lua_Item(const EQEmu::ItemData *d) : Lua_Ptr(d) { } virtual ~Lua_Item() { } - operator const EQEmu::ItemBase*() { - return reinterpret_cast(GetLuaPtrData()); + operator const EQEmu::ItemData*() { + return reinterpret_cast(GetLuaPtrData()); } int GetMinStatus(); diff --git a/zone/lua_iteminst.cpp b/zone/lua_iteminst.cpp index 0b6981358..7844a64bb 100644 --- a/zone/lua_iteminst.cpp +++ b/zone/lua_iteminst.cpp @@ -21,7 +21,7 @@ Lua_ItemInst::Lua_ItemInst(int item_id, int charges) { Lua_ItemInst& Lua_ItemInst::operator=(const Lua_ItemInst& o) { if(o.cloned_) { cloned_ = true; - d_ = new ItemInst(*o.d_); + d_ = new EQEmu::ItemInstance(*o.d_); } else { cloned_ = false; d_ = o.d_; @@ -32,7 +32,7 @@ Lua_ItemInst& Lua_ItemInst::operator=(const Lua_ItemInst& o) { Lua_ItemInst::Lua_ItemInst(const Lua_ItemInst& o) { if(o.cloned_) { cloned_ = true; - d_ = new ItemInst(*o.d_); + d_ = new EQEmu::ItemInstance(*o.d_); } else { cloned_ = false; d_ = o.d_; diff --git a/zone/lua_iteminst.h b/zone/lua_iteminst.h index f12d16983..98943d6dc 100644 --- a/zone/lua_iteminst.h +++ b/zone/lua_iteminst.h @@ -4,30 +4,34 @@ #include "lua_ptr.h" -class ItemInst; class Lua_Item; +namespace EQEmu +{ + class ItemInstance; +} + namespace luabind { struct scope; } luabind::scope lua_register_iteminst(); -class Lua_ItemInst : public Lua_Ptr +class Lua_ItemInst : public Lua_Ptr { - typedef ItemInst NativeType; + typedef EQEmu::ItemInstance NativeType; public: Lua_ItemInst(int item_id); Lua_ItemInst(int item_id, int charges); Lua_ItemInst() : Lua_Ptr(nullptr), cloned_(false) { } - Lua_ItemInst(ItemInst *d) : Lua_Ptr(d), cloned_(false) { } - Lua_ItemInst(ItemInst *d, bool cloned) : Lua_Ptr(d), cloned_(cloned) { } + Lua_ItemInst(EQEmu::ItemInstance *d) : Lua_Ptr(d), cloned_(false) { } + Lua_ItemInst(EQEmu::ItemInstance *d, bool cloned) : Lua_Ptr(d), cloned_(cloned) { } Lua_ItemInst& operator=(const Lua_ItemInst& o); Lua_ItemInst(const Lua_ItemInst& o); - virtual ~Lua_ItemInst() { if(cloned_) { ItemInst *ptr = GetLuaPtrData(); if(ptr) { delete ptr; } } } + virtual ~Lua_ItemInst() { if(cloned_) { EQEmu::ItemInstance *ptr = GetLuaPtrData(); if(ptr) { delete ptr; } } } - operator ItemInst*() { - return reinterpret_cast(GetLuaPtrData()); + operator EQEmu::ItemInstance*() { + return reinterpret_cast(GetLuaPtrData()); } bool IsType(int item_class); diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index ea23df73f..d28c592a4 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -422,7 +422,7 @@ int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client * return 0; } -int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, +int LuaParser::EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { evt = ConvertLuaEvent(evt); if(evt >= _LargestEventID) { @@ -442,7 +442,7 @@ int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob * return _EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers); } -int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *client, ItemInst *item, Mob *mob, +int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers, luabind::adl::object *l_func) { const char *sub_name = LuaEvents[evt]; @@ -706,7 +706,7 @@ bool LuaParser::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) { return HasFunction(subname, package_name); } -bool LuaParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { +bool LuaParser::ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt) { if (itm == nullptr) { return false; } @@ -752,7 +752,7 @@ void LuaParser::LoadGlobalPlayerScript(std::string filename) { LoadScript(filename, "global_player"); } -void LuaParser::LoadItemScript(std::string filename, ItemInst *item) { +void LuaParser::LoadItemScript(std::string filename, EQEmu::ItemInstance *item) { if (item == nullptr) return; std::string package_name = "item_"; @@ -1129,7 +1129,7 @@ int LuaParser::DispatchEventPlayer(QuestEventID evt, Client *client, std::string return ret; } -int LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, +int LuaParser::DispatchEventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { evt = ConvertLuaEvent(evt); if(evt >= _LargestEventID) { diff --git a/zone/lua_parser.h b/zone/lua_parser.h index 1e4df4740..003c936ce 100644 --- a/zone/lua_parser.h +++ b/zone/lua_parser.h @@ -13,10 +13,14 @@ extern const ZoneConfig *Config; struct lua_State; -class ItemInst; class Client; class NPC; +namespace EQEmu +{ + class ItemInstance; +} + #include "lua_parser_events.h" struct lua_registered_event; @@ -39,7 +43,7 @@ public: std::vector *extra_pointers); virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers); - virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + virtual int EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers); @@ -51,14 +55,14 @@ public: virtual bool PlayerHasQuestSub(QuestEventID evt); virtual bool GlobalPlayerHasQuestSub(QuestEventID evt); virtual bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt); - virtual bool ItemHasQuestSub(ItemInst *itm, QuestEventID evt); + virtual bool ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt); virtual bool EncounterHasQuestSub(std::string encounter_name, QuestEventID evt); virtual void LoadNPCScript(std::string filename, int npc_id); virtual void LoadGlobalNPCScript(std::string filename); virtual void LoadPlayerScript(std::string filename); virtual void LoadGlobalPlayerScript(std::string filename); - virtual void LoadItemScript(std::string filename, ItemInst *item); + virtual void LoadItemScript(std::string filename, EQEmu::ItemInstance *item); virtual void LoadSpellScript(std::string filename, uint32 spell_id); virtual void LoadEncounterScript(std::string filename, std::string encounter_name); @@ -72,7 +76,7 @@ public: std::vector *extra_pointers); virtual int DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers); - virtual int DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + virtual int DispatchEventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers); @@ -82,7 +86,7 @@ private: std::vector *extra_pointers, luabind::adl::object *l_func = nullptr); int _EventPlayer(std::string package_name, QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers, luabind::adl::object *l_func = nullptr); - int _EventItem(std::string package_name, QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, + int _EventItem(std::string package_name, QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers, luabind::adl::object *l_func = nullptr); int _EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers, luabind::adl::object *l_func = nullptr); diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index 030e43689..f01af5a6d 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -58,7 +58,7 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob * size_t sz = extra_pointers->size(); for(size_t i = 0; i < sz; ++i) { std::string prefix = "item" + std::to_string(i + 1); - ItemInst *inst = EQEmu::any_cast(extra_pointers->at(i)); + EQEmu::ItemInstance *inst = EQEmu::any_cast(extra_pointers->at(i)); Lua_ItemInst l_inst = inst; luabind::adl::object l_inst_o = luabind::adl::object(L, l_inst); @@ -298,7 +298,7 @@ void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, st void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { - const EQEmu::ItemBase *item = database.GetItem(extra_data); + const EQEmu::ItemData *item = database.GetItem(extra_data); if(item) { Lua_Item l_item(item); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); @@ -314,7 +314,7 @@ void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* cl void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { - Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); + Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); @@ -350,7 +350,7 @@ void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* c void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { - Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); + Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); @@ -402,7 +402,7 @@ void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers) { - Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); + Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); @@ -506,19 +506,19 @@ void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std } //Item -void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { lua_pushinteger(L, extra_data); lua_setfield(L, -2, "slot_id"); } -void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { lua_pushstring(L, data.c_str()); lua_setfield(L, -2, "timer"); } -void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { Lua_Mob l_mob(mob); @@ -539,7 +539,7 @@ void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, ItemI } } -void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { if(mob && mob->IsCorpse()) { Lua_Corpse l_corpse(mob->CastToCorpse()); @@ -554,15 +554,15 @@ void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, ItemI } } -void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { lua_pushinteger(L, extra_data); lua_setfield(L, -2, "slot_id"); } -void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { - Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); + Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "aug"); @@ -571,9 +571,9 @@ void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, It lua_setfield(L, -2, "slot_id"); } -void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { - Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); + Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); @@ -582,9 +582,9 @@ void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* cli lua_setfield(L, -2, "slot_id"); } -void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { - Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); + Lua_ItemInst l_item(EQEmu::any_cast(extra_pointers->at(0))); luabind::adl::object l_item_o = luabind::adl::object(L, l_item); l_item_o.push(L); lua_setfield(L, -2, "item"); @@ -596,7 +596,7 @@ void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* cli lua_setfield(L, -2, "destroyed"); } -void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { } diff --git a/zone/lua_parser_events.h b/zone/lua_parser_events.h index 0a2ab5ad9..42315ed0b 100644 --- a/zone/lua_parser_events.h +++ b/zone/lua_parser_events.h @@ -4,7 +4,7 @@ typedef void(*NPCArgumentHandler)(QuestInterface*, lua_State*, NPC*, Mob*, std::string, uint32, std::vector*); typedef void(*PlayerArgumentHandler)(QuestInterface*, lua_State*, Client*, std::string, uint32, std::vector*); -typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, ItemInst*, Mob*, std::string, uint32, std::vector*); +typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, EQEmu::ItemInstance*, Mob*, std::string, uint32, std::vector*); typedef void(*SpellArgumentHandler)(QuestInterface*, lua_State*, NPC*, Client*, uint32, uint32, std::vector*); typedef void(*EncounterArgumentHandler)(QuestInterface*, lua_State*, Encounter* encounter, std::string, uint32, std::vector*); @@ -97,23 +97,23 @@ void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std std::vector *extra_pointers); //Item -void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_proc(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_loot(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_equip(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_augment(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_augment_insert(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_augment_remove(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); -void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, Mob *mob, std::string data, uint32 extra_data, +void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, EQEmu::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); //Spell diff --git a/zone/merc.cpp b/zone/merc.cpp index c787d00c8..c9d177324 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -217,7 +217,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { for (i = 0; i < EQEmu::legacy::SlotAmmo; i++) { if(equipment[i] == 0) continue; - const EQEmu::ItemBase * itm = database.GetItem(equipment[i]); + const EQEmu::ItemData * itm = database.GetItem(equipment[i]); if(itm) AddItemBonuses(itm, newbon); } @@ -225,7 +225,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { //Power Source Slot /*if (GetClientVersion() >= EQClientSoF) { - const ItemInst* inst = m_inv[MainPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[MainPowerSource]; if(inst) AddItemBonuses(inst, newbon); }*/ @@ -243,7 +243,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { SetAttackTimer(); } -void Merc::AddItemBonuses(const EQEmu::ItemBase *item, StatBonuses* newbon) { +void Merc::AddItemBonuses(const EQEmu::ItemData *item, StatBonuses* newbon) { if(GetLevel() < item->ReqLevel) { @@ -1221,7 +1221,7 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { { continue; } - const ItemBase* item = database.GetItem(equipment[i]); + const ItemData* item = database.GetItem(equipment[i]); if(item) { ns->spawn.equipment[i].material = item->Material; @@ -2547,8 +2547,8 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[type]){ - const EQEmu::ItemBase* TempItem = 0; - const EQEmu::ItemBase* UsedItem = 0; + const EQEmu::ItemData* TempItem = 0; + const EQEmu::ItemData* UsedItem = 0; uint16 UsedFocusID = 0; int16 Total = 0; int16 focus_max = 0; @@ -4428,7 +4428,7 @@ void Merc::DoClassAttacks(Mob *target) { DoAnim(animKick); int32 dmg = 0; - if (GetWeaponDamage(target, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(target, (const EQEmu::ItemData*)nullptr) <= 0){ dmg = -5; } else{ @@ -4450,7 +4450,7 @@ void Merc::DoClassAttacks(Mob *target) { DoAnim(animTailRake); int32 dmg = 0; - if (GetWeaponDamage(target, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(target, (const EQEmu::ItemData*)nullptr) <= 0){ dmg = -5; } else{ diff --git a/zone/merc.h b/zone/merc.h index 00c953288..c78ec22b7 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -14,7 +14,7 @@ struct NewSpawn_Struct; namespace EQEmu { - struct ItemBase; + struct ItemData; } #define MAXMERCS 1 @@ -283,7 +283,7 @@ public: protected: void CalcItemBonuses(StatBonuses* newbon); - void AddItemBonuses(const EQEmu::ItemBase *item, StatBonuses* newbon); + void AddItemBonuses(const EQEmu::ItemData *item, StatBonuses* newbon); int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); int16 GetFocusEffect(focusType type, uint16 spell_id); diff --git a/zone/mob.cpp b/zone/mob.cpp index 1caf69918..21409c695 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2374,12 +2374,12 @@ bool Mob::CanThisClassDualWield(void) const { return(GetSkill(EQEmu::skills::SkillDualWield) > 0); } 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); + const EQEmu::ItemInstance* pinst = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance* sinst = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); // 2HS, 2HB, or 2HP if(pinst && pinst->IsWeapon()) { - const EQEmu::ItemBase* item = pinst->GetItem(); + const EQEmu::ItemData* item = pinst->GetItem(); if (item->IsType2HWeapon()) return false; @@ -2749,7 +2749,7 @@ void Mob::SendArmorAppearance(Client *one_client) { if (!IsClient()) { - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; for (int i = 0; i < 7; ++i) { item = database.GetItem(GetEquipment(i)); @@ -2852,7 +2852,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { uint32 equipmaterial = 0; int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; item = database.GetItem(GetEquipment(material_slot)); if (item != 0) @@ -2867,7 +2867,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { return 0; } - const ItemInst* inst = CastToClient()->m_inv[invslot]; + const EQEmu::ItemInstance* inst = CastToClient()->m_inv[invslot]; if (inst) { if (inst->GetOrnamentationAug(ornamentationAugtype)) @@ -2905,7 +2905,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const if (material_slot >= 0 && material_slot < EQEmu::textures::TexturePrimary) { uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; item = database.GetItem(GetEquipment(material_slot)); int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); @@ -2913,7 +2913,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const { if (IsClient()) { - const ItemInst* inst = CastToClient()->m_inv[invslot]; + const EQEmu::ItemInstance* inst = CastToClient()->m_inv[invslot]; if (inst) { if (inst->GetOrnamentationAug(ornamentationAugtype)) @@ -2959,7 +2959,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const uint32 Mob::GetEquipmentColor(uint8 material_slot) const { - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; if (armor_tint.Slot[material_slot].Color) { @@ -2975,7 +2975,7 @@ uint32 Mob::GetEquipmentColor(uint8 material_slot) const uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const { - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; item = database.GetItem(GetEquipment(material_slot)); if(item != 0) @@ -3187,7 +3187,7 @@ int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime) { return casttime; } -void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on, int level_override) { +void Mob::ExecWeaponProc(const EQEmu::ItemInstance *inst, uint16 spell_id, Mob *on, int level_override) { // Changed proc targets to look up based on the spells goodEffect flag. // This should work for the majority of weapons. if(spell_id == SPELL_UNKNOWN || on->GetSpecialAbility(NO_HARM_FROM_CLIENT)) { @@ -3208,9 +3208,9 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on, int lev if(inst && IsClient()) { //const cast is dirty but it would require redoing a ton of interfaces at this point - //It should be safe as we don't have any truly const ItemInst floating around anywhere. + //It should be safe as we don't have any truly const EQEmu::ItemInstance floating around anywhere. //So we'll live with it for now - int i = parse->EventItem(EVENT_WEAPON_PROC, CastToClient(), const_cast(inst), on, "", spell_id); + int i = parse->EventItem(EVENT_WEAPON_PROC, CastToClient(), const_cast(inst), on, "", spell_id); if(i != 0) { return; } @@ -3888,11 +3888,11 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) int32 Mob::GetItemStat(uint32 itemid, const char *identifier) { - const ItemInst* inst = database.CreateItem(itemid); + const EQEmu::ItemInstance* inst = database.CreateItem(itemid); if (!inst) return 0; - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (!item) return 0; @@ -5623,7 +5623,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) bool Mob::CanClassEquipItem(uint32 item_id) { - const EQEmu::ItemBase* itm = nullptr; + const EQEmu::ItemData* itm = nullptr; itm = database.GetItem(item_id); if (!itm) @@ -5692,9 +5692,9 @@ int32 Mob::GetMeleeMitigation() { } /* this is the mob being attacked. - * Pass in the weapon's ItemInst + * Pass in the weapon's EQEmu::ItemInstance */ -int Mob::ResistElementalWeaponDmg(const ItemInst *item) +int Mob::ResistElementalWeaponDmg(const EQEmu::ItemInstance *item) { if (!item) return 0; @@ -5844,9 +5844,9 @@ int Mob::ResistElementalWeaponDmg(const ItemInst *item) } /* this is the mob being attacked. - * Pass in the weapon's ItemInst + * Pass in the weapon's EQEmu::ItemInstance */ -int Mob::CheckBaneDamage(const ItemInst *item) +int Mob::CheckBaneDamage(const EQEmu::ItemInstance *item) { if (!item) return 0; diff --git a/zone/mob.h b/zone/mob.h index c09da4e0b..120e1f116 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -43,7 +43,6 @@ class EGNode; class Client; class EQApplicationPacket; class Group; -class ItemInst; class NPC; class Raid; struct NewSpawn_Struct; @@ -51,7 +50,8 @@ struct PlayerPositionUpdateServer_Struct; namespace EQEmu { - struct ItemBase; + struct ItemData; + class ItemInstance; } class Mob : public Entity { @@ -215,7 +215,7 @@ public: inline bool SeeImprovedHide() const { return see_improved_hide; } bool IsInvisible(Mob* other = 0) const; void SetInvisible(uint8 state); - bool AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const ItemInst* weapon); + bool AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const EQEmu::ItemInstance* weapon); //Song bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); @@ -242,8 +242,8 @@ public: int resist_override = 0, bool CharismaCheck = false, bool CharmTick = false, bool IsRoot = false, int level_override = -1); int ResistPhysical(int level_diff, uint8 caster_level); - int ResistElementalWeaponDmg(const ItemInst *item); - int CheckBaneDamage(const ItemInst *item); + int ResistElementalWeaponDmg(const EQEmu::ItemInstance *item); + int CheckBaneDamage(const EQEmu::ItemInstance *item); uint16 GetSpecializeSkillValue(uint16 spell_id) const; void SendSpellBarDisable(); void SendSpellBarEnable(uint16 spellid); @@ -774,7 +774,7 @@ public: virtual int GetHaste(); int32 GetMeleeMitigation(); - uint8 GetWeaponDamageBonus(const EQEmu::ItemBase* weapon, bool offhand = false); + uint8 GetWeaponDamageBonus(const EQEmu::ItemData* weapon, bool offhand = false); uint16 GetDamageTable(EQEmu::skills::SkillType skillinuse); virtual int GetHandToHandDamage(void); @@ -799,10 +799,10 @@ public: int32 ReduceAllDamage(int32 damage); 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::ItemBase* AmmoItem = nullptr, uint16 weapon_damage = 0, int16 chance_mod = 0, int16 focus = 0, int ReuseTime = 0, uint32 range_id = 0, int AmmoSlot = 0, float speed = 4.0f); + virtual void DoThrowingAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon = nullptr, const EQEmu::ItemData* 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, 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::ItemBase *AmmoItem = nullptr, int AmmoSlot = 0, float speed = 4.0f); - bool TryProjectileAttack(Mob* other, const EQEmu::ItemBase *item, EQEmu::skills::SkillType skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed); + virtual void DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon = nullptr, const EQEmu::ItemInstance* 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::ItemData *AmmoItem = nullptr, int AmmoSlot = 0, float speed = 4.0f); + bool TryProjectileAttack(Mob* other, const EQEmu::ItemData *item, EQEmu::skills::SkillType skillInUse, uint16 weapon_dmg, const EQEmu::ItemInstance* RangeWeapon, const EQEmu::ItemInstance* Ammo, int AmmoSlot, float speed); void ProjectileAttack(); inline bool HasProjectileAttack() const { return ActiveProjectileATK; } inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } @@ -921,7 +921,7 @@ public: // HP Event inline int GetNextHPEvent() const { return nexthpevent; } void SetNextHPEvent( int hpevent ); - void SendItemAnimation(Mob *to, const EQEmu::ItemBase *item, EQEmu::skills::SkillType skillInUse, float velocity = 4.0); + void SendItemAnimation(Mob *to, const EQEmu::ItemData *item, EQEmu::skills::SkillType skillInUse, float velocity = 4.0); inline int& GetNextIncHPEvent() { return nextinchpevent; } void SetNextIncHPEvent( int inchpevent ); @@ -985,9 +985,9 @@ public: int32 mod_frenzy_damage(int32 dmg); 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); - int32 mod_archery_damage(int32 TotalDmg, bool hasbonus, const ItemInst* RangeWeapon); + int mod_archery_bonus_chance(int bonuschance, const EQEmu::ItemInstance* RangeWeapon); + uint32 mod_archery_bonus_damage(uint32 MaxDmg, const EQEmu::ItemInstance* RangeWeapon); + int32 mod_archery_damage(int32 TotalDmg, bool hasbonus, const EQEmu::ItemInstance* RangeWeapon); uint16 mod_throwing_damage(uint16 MaxDmg); int32 mod_cast_time(int32 cast_time); int mod_buff_duration(int res, Mob* caster, Mob* target, uint16 spell_id); @@ -1159,18 +1159,18 @@ protected: bool PassLimitToSkill(uint16 spell_id, uint16 skill); bool PassLimitClass(uint32 Classes_, uint16 Class_); void TryDefensiveProc(Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TryWeaponProc(const ItemInst* inst, const EQEmu::ItemBase* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TrySpellProc(const ItemInst* inst, const EQEmu::ItemBase* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TryWeaponProc(const ItemInst* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void ExecWeaponProc(const ItemInst* weapon, uint16 spell_id, Mob *on, int level_override = -1); + void TryWeaponProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); + void TrySpellProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); + void TryWeaponProc(const EQEmu::ItemInstance* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); + void ExecWeaponProc(const EQEmu::ItemInstance* weapon, uint16 spell_id, Mob *on, int level_override = -1); virtual float GetProcChances(float ProcBonus, uint16 hand = EQEmu::legacy::SlotPrimary); virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQEmu::legacy::SlotPrimary, Mob *on = nullptr); virtual float GetSpecialProcChances(uint16 hand); virtual float GetAssassinateProcChances(uint16 ReuseTime); virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm? uint16 GetWeaponSpeedbyHand(uint16 hand); - int GetWeaponDamage(Mob *against, const EQEmu::ItemBase *weapon_item); - int GetWeaponDamage(Mob *against, const ItemInst *weapon_item, uint32 *hate = nullptr); + int GetWeaponDamage(Mob *against, const EQEmu::ItemData *weapon_item); + int GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, uint32 *hate = nullptr); int GetKickDamage(); int GetBashDamage(); virtual void ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int32 &mindmg); diff --git a/zone/mod_functions.cpp b/zone/mod_functions.cpp index 601041361..ca9a5e107 100644 --- a/zone/mod_functions.cpp +++ b/zone/mod_functions.cpp @@ -5,11 +5,15 @@ #include "worldserver.h" #include "zone.h" -class ItemInst; class Spawn2; struct Consider_Struct; struct DBTradeskillRecipe_Struct; +namespace EQEmu +{ + class ItemInstance; +} + extern EntityList entity_list; extern Zone* zone; @@ -25,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, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::ItemBase* weapon, Mob* other) { return(damage); } +int NPC::mod_npc_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::ItemData* 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; } @@ -34,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, EQEmu::skills::SkillType skillinuse, int hand, const ItemInst* weapon, Mob* other) { return(damage); } +int Client::mod_client_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::ItemInstance* weapon, Mob* other) { return(damage); } //message is char[4096], don't screw it up. Return true for normal behavior, false to return immediately. // Channels: @@ -87,7 +91,7 @@ float Client::mod_tradeskill_chance(float chance, DBTradeskillRecipe_Struct *spe float Client::mod_tradeskill_skillup(float chance_stage2) { return(chance_stage2); } //Tribute value override -int32 Client::mod_tribute_item_value(int32 pts, const ItemInst* item) { return(pts); } +int32 Client::mod_tribute_item_value(int32 pts, const EQEmu::ItemInstance* item) { return(pts); } //Death reporting void Client::mod_client_death_npc(Mob* killerMob) { return; } @@ -103,8 +107,8 @@ int32 Client::mod_client_xp(int32 in_xp, NPC *npc) { return(in_xp); } uint32 Client::mod_client_xp_for_level(uint32 xp, uint16 check_level) { return(xp); } //Food and drink values as computed by consume requests. Return < 0 to abort the request. -int Client::mod_food_value(const EQEmu::ItemBase *item, int change) { return(change); } -int Client::mod_drink_value(const EQEmu::ItemBase *item, int change) { return(change); } +int Client::mod_food_value(const EQEmu::ItemData *item, int change) { return(change); } +int Client::mod_drink_value(const EQEmu::ItemData *item, int change) { return(change); } //effect_vallue - Spell effect value as calculated by default formulas. You will want to ignore effects that don't lend themselves to scaling - pet ID's, gate coords, etc. int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster, uint16 caster_id) { return(effect_value); } @@ -148,13 +152,13 @@ int32 Mob::mod_monk_special_damage(int32 ndamage, EQEmu::skills::SkillType skill int32 Mob::mod_backstab_damage(int32 ndamage) { return(ndamage); } //Chance for 50+ archery bonus damage if Combat:UseArcheryBonusRoll is true. Base is Combat:ArcheryBonusChance -int Mob::mod_archery_bonus_chance(int bonuschance, const ItemInst* RangeWeapon) { return(bonuschance); } +int Mob::mod_archery_bonus_chance(int bonuschance, const EQEmu::ItemInstance* RangeWeapon) { return(bonuschance); } //Archery bonus damage -uint32 Mob::mod_archery_bonus_damage(uint32 MaxDmg, const ItemInst* RangeWeapon) { return(MaxDmg); } +uint32 Mob::mod_archery_bonus_damage(uint32 MaxDmg, const EQEmu::ItemInstance* RangeWeapon) { return(MaxDmg); } //Final archery damage including bonus if it was applied. -int32 Mob::mod_archery_damage(int32 TotalDmg, bool hasbonus, const ItemInst* RangeWeapon) { return(TotalDmg); } +int32 Mob::mod_archery_damage(int32 TotalDmg, bool hasbonus, const EQEmu::ItemInstance* RangeWeapon) { return(TotalDmg); } //Thrown weapon damage after all other calcs uint16 Mob::mod_throwing_damage(uint16 MaxDmg) { return(MaxDmg); } diff --git a/zone/npc.cpp b/zone/npc.cpp index d958ff598..78c4604ea 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -525,7 +525,7 @@ void NPC::QueryLoot(Client* to) int x = 0; for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { - const EQEmu::ItemBase* item = database.GetItem((*cur)->item_id); + const EQEmu::ItemData* item = database.GetItem((*cur)->item_id); if (item == nullptr) { Log.Out(Logs::General, Logs::Error, "Database error, invalid item"); continue; @@ -1462,7 +1462,7 @@ void NPC::PickPocket(Client* thief) // still needs to have FindFreeSlot vs PutItemInInventory issue worked out while (steal_item) { - std::vector> loot_selection; // + std::vector> loot_selection; // for (auto item_iter : itemlist) { if (!item_iter || !item_iter->item_id) continue; diff --git a/zone/npc.h b/zone/npc.h index d3e7928a2..0230b550f 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -93,7 +93,7 @@ class Spawn2; namespace EQEmu { - struct ItemBase; + struct ItemData; } class NPC : public Mob @@ -178,7 +178,7 @@ public: virtual void SpellProcess(); virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); - void AddItem(const EQEmu::ItemBase* item, uint16 charges, bool equipitem = true); + void AddItem(const EQEmu::ItemData* item, uint16 charges, bool equipitem = true); void AddItem(uint32 itemid, uint16 charges, bool equipitem = true); void AddLootTable(); void AddLootTable(uint32 ldid); @@ -270,7 +270,7 @@ public: bool IsTaunting() const { return taunting; } void PickPocket(Client* thief); void StartSwarmTimer(uint32 duration) { swarm_timer.Start(duration); } - void AddLootDrop(const EQEmu::ItemBase*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); + void AddLootDrop(const EQEmu::ItemData*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); virtual void DoClassAttacks(Mob *target); void CheckSignal(); inline bool IsNotTargetableWithHotkey() const { return no_target_hotkey; } @@ -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, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::ItemBase* weapon, Mob* other); + int mod_npc_damage(int damage, EQEmu::skills::SkillType skillinuse, int hand, const EQEmu::ItemData* weapon, Mob* other); void mod_npc_killed_merit(Mob* c); void mod_npc_killed(Mob* oos); void AISpellsList(Client *c); diff --git a/zone/object.cpp b/zone/object.cpp index ab9637e96..a2bb912bc 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -37,7 +37,7 @@ extern Zone* zone; extern EntityList entity_list; // Loading object from database -Object::Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst) +Object::Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const EQEmu::ItemInstance* inst) : respawn_timer(0), decay_timer(300000) { @@ -69,7 +69,7 @@ Object::Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, } //creating a re-ocurring ground spawn. -Object::Object(const ItemInst* inst, char* name,float max_x,float min_x,float max_y,float min_y,float z,float heading,uint32 respawntimer) +Object::Object(const EQEmu::ItemInstance* inst, char* name,float max_x,float min_x,float max_y,float min_y,float z,float heading,uint32 respawntimer) : respawn_timer(respawntimer), decay_timer(300000) { @@ -102,7 +102,7 @@ Object::Object(const ItemInst* inst, char* name,float max_x,float min_x,float ma } // Loading object from client dropping item on ground -Object::Object(Client* client, const ItemInst* inst) +Object::Object(Client* client, const EQEmu::ItemInstance* inst) : respawn_timer(0), decay_timer(300000) { user = nullptr; @@ -141,7 +141,7 @@ Object::Object(Client* client, const ItemInst* inst) // Set object name if (inst) { - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (item && item->IDFile) { if (strlen(item->IDFile) == 0) { strcpy(m_data.object_name, DEFAULT_OBJECT_NAME); @@ -164,7 +164,7 @@ Object::Object(Client* client, const ItemInst* inst) } } -Object::Object(const ItemInst *inst, float x, float y, float z, float heading, uint32 decay_time) +Object::Object(const EQEmu::ItemInstance *inst, float x, float y, float z, float heading, uint32 decay_time) : respawn_timer(0), decay_timer(decay_time) { user = nullptr; @@ -197,7 +197,7 @@ Object::Object(const ItemInst *inst, float x, float y, float z, float heading, u // Set object name if (inst) { - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (item && item->IDFile) { if (strlen(item->IDFile) == 0) { strcpy(m_data.object_name, DEFAULT_OBJECT_NAME); @@ -225,8 +225,8 @@ Object::Object(const char *model, float x, float y, float z, float heading, uint { user = nullptr; last_user = nullptr; - ItemInst* inst = nullptr; - inst = new ItemInst(ItemInstWorldContainer); + EQEmu::ItemInstance* inst = nullptr; + inst = new EQEmu::ItemInstance(ItemInstWorldContainer); // Initialize members m_id = 0; @@ -326,7 +326,7 @@ void Object::Delete(bool reset_state) } } -const ItemInst* Object::GetItem(uint8 index) { +const EQEmu::ItemInstance* Object::GetItem(uint8 index) { if (index < EQEmu::legacy::TYPE_WORLD_SIZE) { return m_inst->GetItem(index); } @@ -335,7 +335,7 @@ const ItemInst* Object::GetItem(uint8 index) { } // Add item to object (only logical for world tradeskill containers -void Object::PutItem(uint8 index, const ItemInst* inst) +void Object::PutItem(uint8 index, const EQEmu::ItemInstance* inst) { if (index > 9) { Log.Out(Logs::General, Logs::Error, "Object::PutItem: Invalid index specified (%i)", index); @@ -362,12 +362,12 @@ void Object::Close() { last_user = user; // put any remaining items from the world container back into the player's inventory to avoid item loss // if they close the container without removing all items - ItemInst* container = this->m_inst; + EQEmu::ItemInstance* container = this->m_inst; if(container != nullptr) { for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { - ItemInst* inst = container->PopItem(i); + EQEmu::ItemInstance* inst = container->PopItem(i); if(inst != nullptr) { user->MoveItemToInventory(inst, true); @@ -392,9 +392,9 @@ void Object::DeleteItem(uint8 index) } // Pop item out of container -ItemInst* Object::PopItem(uint8 index) +EQEmu::ItemInstance* Object::PopItem(uint8 index) { - ItemInst* inst = nullptr; + EQEmu::ItemInstance* inst = nullptr; if (m_inst && m_inst->IsType(EQEmu::item::ItemClassBag)) { inst = m_inst->PopItem(index); @@ -603,7 +603,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) sender->QueuePacket(outapp); safe_delete(outapp); for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { - const ItemInst* inst = m_inst->GetItem(i); + const EQEmu::ItemInstance* inst = m_inst->GetItem(i); if (inst) { //sender->GetInv().PutItem(i+4000,inst); sender->SendItemPacket(i, inst, ItemPacketWorldContainer); @@ -616,7 +616,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) } // Add new Zone Object (theoretically only called for items dropped to ground) -uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst) +uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& object, const EQEmu::ItemInstance* inst) { uint32 database_id = 0; uint32 item_id = 0; @@ -654,7 +654,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob } // Update information about existing object in database -void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst) +void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const EQEmu::ItemInstance* inst) { uint32 item_id = 0; int16 charges = 0; @@ -945,7 +945,7 @@ uint32 Object::GetItemID() return 0; } - const EQEmu::ItemBase* item = this->m_inst->GetItem(); + const EQEmu::ItemData* item = this->m_inst->GetItem(); if (item == 0) { diff --git a/zone/object.h b/zone/object.h index 23c152cea..1afe574ea 100644 --- a/zone/object.h +++ b/zone/object.h @@ -29,7 +29,11 @@ class Client; class EQApplicationPacket; -class ItemInst; + +namespace EQEmu +{ + class ItemInstance; +} /* item icon numbers (showeq) @@ -89,11 +93,11 @@ class Object: public Entity { public: // Loading object from database - Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& data, const ItemInst* inst); - Object(const ItemInst* inst, char* name,float max_x,float min_x,float max_y,float min_y,float z,float heading,uint32 respawntimer); + Object(uint32 id, uint32 type, uint32 icon, const Object_Struct& data, const EQEmu::ItemInstance* inst); + Object(const EQEmu::ItemInstance* inst, char* name,float max_x,float min_x,float max_y,float min_y,float z,float heading,uint32 respawntimer); // Loading object from client dropping item on ground - Object(Client* client, const ItemInst* inst); - Object(const ItemInst *inst, float x, float y, float z, float heading, uint32 decay_time = 300000); + Object(Client* client, const EQEmu::ItemInstance* inst); + Object(const EQEmu::ItemInstance *inst, float x, float y, float z, float heading, uint32 decay_time = 300000); Object(const char *model, float x, float y, float z, float heading, uint8 type, uint32 decay_time = 0); // Destructor @@ -120,10 +124,10 @@ public: void StartDecay() {decay_timer.Start();} // Container functions - const ItemInst* GetItem(uint8 index); - void PutItem(uint8 index, const ItemInst* inst); + const EQEmu::ItemInstance* GetItem(uint8 index); + void PutItem(uint8 index, const EQEmu::ItemInstance* inst); void DeleteItem(uint8 index); // Item inside container - ItemInst* PopItem(uint8 index); // Pop item out of container + EQEmu::ItemInstance* PopItem(uint8 index); // Pop item out of container // Override base class implementations virtual bool IsObject() const { return true; } @@ -176,7 +180,7 @@ protected: void RandomSpawn(bool send_packet = false); //spawn this ground spawn at a random place Object_Struct m_data; // Packet data - ItemInst* m_inst; // Item representing object + EQEmu::ItemInstance* m_inst; // Item representing object bool m_inuse; // Currently in use by a client? uint32 m_id; // Database key, different than drop_id uint32 m_type; // Object Type, ie, forge, oven, dropped item, etc (ref: ContainerUseTypes) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index de334d5d0..65ff5a4e0 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -4324,7 +4324,7 @@ XS(XS_Client_GetItemAt) Perl_croak(aTHX_ "Usage: Client::GetItemAt(THIS, slot)"); { Client * THIS; - ItemInst * RETVAL; + EQEmu::ItemInstance * RETVAL; uint32 slot = (int32)SvIV(ST(1)); if (sv_derived_from(ST(0), "Client")) { @@ -4351,7 +4351,7 @@ XS(XS_Client_GetAugmentAt) Perl_croak(aTHX_ "Usage: Client::GetAugmentAt(THIS, slot, aug_slot)"); { Client * THIS; - ItemInst * RETVAL; + EQEmu::ItemInstance * RETVAL; uint32 slot = (int32)SvIV(ST(1)); uint32 aug_slot = (int32)SvIV(ST(1)); @@ -4364,7 +4364,7 @@ XS(XS_Client_GetAugmentAt) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - ItemInst * inst = THIS->GetInv().GetItem(slot); + EQEmu::ItemInstance * inst = THIS->GetInv().GetItem(slot); if(inst) { RETVAL = inst->GetAugment(aug_slot); @@ -5627,7 +5627,7 @@ XS(XS_Client_GetItemInInventory) { Client * THIS; int16 slot_id = (int16)SvIV(ST(1)); - ItemInst *RETVAL = nullptr; + EQEmu::ItemInstance *RETVAL = nullptr; if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index f171d8d79..9af0fa43f 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -8092,8 +8092,8 @@ XS(XS_Mob_DoArcheryAttackDmg) { Mob * THIS; Mob* target; - ItemInst* RangeWeapon = nullptr; - ItemInst* Ammo = nullptr; + EQEmu::ItemInstance* RangeWeapon = nullptr; + EQEmu::ItemInstance* Ammo = nullptr; uint16 weapon_damage = (uint16)SvIV(ST(4)); int16 chance_mod = (int16)SvIV(ST(5)); int16 focus = (int16)SvIV(ST(6)); @@ -8130,8 +8130,8 @@ XS(XS_Mob_DoThrowingAttackDmg) { Mob * THIS; Mob* target; - ItemInst* RangeWeapon = nullptr; - EQEmu::ItemBase* item = nullptr; + EQEmu::ItemInstance* RangeWeapon = nullptr; + EQEmu::ItemData* item = nullptr; uint16 weapon_damage = (uint16)SvIV(ST(4)); int16 chance_mod = (int16)SvIV(ST(5)); int16 focus = (int16)SvIV(ST(6)); diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index 053748e97..742a00814 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -38,16 +38,16 @@ XS(XS_QuestItem_GetName) { if (items != 1) Perl_croak(aTHX_ "Usage: QuestItem::GetName(THIS)"); { - ItemInst * THIS; + EQEmu::ItemInstance * THIS; Const_char * RETVAL; dXSTARG; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -64,15 +64,15 @@ XS(XS_QuestItem_SetScale) if (items != 2) Perl_croak(aTHX_ "Usage: QuestItem::SetScale(THIS, scale factor)"); { - ItemInst * THIS; + EQEmu::ItemInstance * THIS; float Mult; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -92,16 +92,16 @@ XS(XS_QuestItem_ItemSay) if (items != 2 && items != 3) Perl_croak(aTHX_ "Usage: QuestItem::ItemSay(THIS, text [, language])"); { - ItemInst* THIS; + EQEmu::ItemInstance* THIS; Const_char* text; int lang = 0; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -121,16 +121,16 @@ XS(XS_QuestItem_IsType) if (items != 2) Perl_croak(aTHX_ "Usage: QuestItem::IsType(THIS, type)"); { - ItemInst* THIS; + EQEmu::ItemInstance* THIS; bool RETVAL; uint32 type = (int32)SvIV(ST(1)); if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -148,15 +148,15 @@ XS(XS_QuestItem_IsAttuned) if (items != 1) Perl_croak(aTHX_ "Usage: QuestItem::IsAttuned(THIS)"); { - ItemInst* THIS; + EQEmu::ItemInstance* THIS; bool RETVAL; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -174,16 +174,16 @@ XS(XS_QuestItem_GetCharges) if (items != 1) Perl_croak(aTHX_ "Usage: QuestItem::GetCharges(THIS)"); { - ItemInst* THIS; + EQEmu::ItemInstance* THIS; int16 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -200,16 +200,16 @@ XS(XS_QuestItem_GetAugment) if (items != 2) Perl_croak(aTHX_ "Usage: QuestItem::GetAugment(THIS, augment_id)"); { - ItemInst* THIS; + EQEmu::ItemInstance* THIS; int16 slot_id = (int16)SvIV(ST(1)); - ItemInst* RETVAL; + EQEmu::ItemInstance* RETVAL; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); @@ -227,16 +227,16 @@ XS(XS_QuestItem_GetID) if (items != 1) Perl_croak(aTHX_ "Usage: QuestItem::GetID(THIS)"); { - ItemInst* THIS; + EQEmu::ItemInstance* THIS; uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "QuestItem")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(ItemInst *,tmp); + THIS = INT2PTR(EQEmu::ItemInstance *,tmp); } else - Perl_croak(aTHX_ "THIS is not of type ItemInst"); + Perl_croak(aTHX_ "THIS is not of type EQEmu::ItemInstance"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); diff --git a/zone/pets.cpp b/zone/pets.cpp index e527d80ce..a50dcbed4 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -420,7 +420,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, // like the special back items some focused pets may receive. uint32 petinv[EQEmu::legacy::EQUIPMENT_SIZE]; memset(petinv, 0, sizeof(petinv)); - const EQEmu::ItemBase *item = 0; + const EQEmu::ItemData *item = 0; if (database.GetBasePetItems(record.equipmentset, petinv)) { for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++) @@ -665,7 +665,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) { if(items[i] == 0) continue; - const EQEmu::ItemBase* item2 = database.GetItem(items[i]); + const EQEmu::ItemData* item2 = database.GetItem(items[i]); if (item2 && item2->NoDrop != 0) { //dont bother saving item charges for now, NPCs never use them //and nobody should be able to get them off the corpse..? diff --git a/zone/quest_interface.h b/zone/quest_interface.h index c1cf3dc73..36ca9458f 100644 --- a/zone/quest_interface.h +++ b/zone/quest_interface.h @@ -23,10 +23,14 @@ #include "../common/any.h" #include "event_codes.h" -class ItemInst; class Client; class NPC; +namespace EQEmu +{ + class ItemInstance; +} + class QuestInterface { public: virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, @@ -37,7 +41,7 @@ public: std::vector *extra_pointers) { return 0; } virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers) { return 0; } - virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + virtual int EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { return 0; } virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers) { return 0; } @@ -49,14 +53,14 @@ public: virtual bool PlayerHasQuestSub(QuestEventID evt) { return false; } virtual bool GlobalPlayerHasQuestSub(QuestEventID evt) { return false; } virtual bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt) { return false; } - virtual bool ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { return false; } + virtual bool ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt) { return false; } virtual bool EncounterHasQuestSub(std::string encounter_name, QuestEventID evt) { return false; } virtual void LoadNPCScript(std::string filename, int npc_id) { } virtual void LoadGlobalNPCScript(std::string filename) { } virtual void LoadPlayerScript(std::string filename) { } virtual void LoadGlobalPlayerScript(std::string filename) { } - virtual void LoadItemScript(std::string filename, ItemInst *item) { } + virtual void LoadItemScript(std::string filename, EQEmu::ItemInstance *item) { } virtual void LoadSpellScript(std::string filename, uint32 spell_id) { } virtual void LoadEncounterScript(std::string filename, std::string encounter_name) { } @@ -64,7 +68,7 @@ public: std::vector *extra_pointers) { return 0; } virtual int DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers) { return 0; } - virtual int DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + virtual int DispatchEventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { return 0; } virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers) { return 0; } diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index 290b71ab9..2c2086d8c 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -200,7 +200,7 @@ bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) return false; } -bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { +bool QuestParserCollection::ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt) { if (itm == nullptr) return false; @@ -352,7 +352,7 @@ int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, s return 0; } -int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, +int QuestParserCollection::EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { // needs pointer validation check on 'item' argument @@ -1013,7 +1013,7 @@ int QuestParserCollection::DispatchEventPlayer(QuestEventID evt, Client *client, return ret; } -int QuestParserCollection::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, +int QuestParserCollection::DispatchEventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { int ret = 0; auto iter = _load_precedence.begin(); diff --git a/zone/quest_parser_collection.h b/zone/quest_parser_collection.h index c17e2ccda..196cfffc2 100644 --- a/zone/quest_parser_collection.h +++ b/zone/quest_parser_collection.h @@ -44,11 +44,15 @@ extern const ZoneConfig *Config; class Client; -class ItemInst; class Mob; class NPC; class QuestInterface; -namespace EQEmu { class Any; } + +namespace EQEmu +{ + class Any; + class ItemInstance; +} class QuestParserCollection { public: @@ -65,13 +69,13 @@ public: bool HasQuestSub(uint32 npcid, QuestEventID evt); bool PlayerHasQuestSub(QuestEventID evt); bool SpellHasQuestSub(uint32 spell_id, QuestEventID evt); - bool ItemHasQuestSub(ItemInst *itm, QuestEventID evt); + bool ItemHasQuestSub(EQEmu::ItemInstance *itm, QuestEventID evt); int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector *extra_pointers = nullptr); int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers = nullptr); - int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + int EventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers = nullptr); int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers = nullptr); @@ -124,7 +128,7 @@ private: std::vector *extra_pointers); int DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector *extra_pointers); - int DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, + int DispatchEventItem(QuestEventID evt, Client *client, EQEmu::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers); int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 5803e547c..1df7492c2 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -54,7 +54,7 @@ QuestManager quest_manager; #define QuestManagerCurrentQuestVars() \ Mob *owner = nullptr; \ Client *initiator = nullptr; \ - ItemInst* questitem = nullptr; \ + EQEmu::ItemInstance* questitem = nullptr; \ bool depop_npc = false; \ std::string encounter; \ do { \ @@ -116,7 +116,7 @@ void QuestManager::Process() { } } -void QuestManager::StartQuest(Mob *_owner, Client *_initiator, ItemInst* _questitem, std::string encounter) { +void QuestManager::StartQuest(Mob *_owner, Client *_initiator, EQEmu::ItemInstance* _questitem, std::string encounter) { running_quest run; run.owner = _owner; run.initiator = _initiator; @@ -450,7 +450,7 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) { QTimerList.push_back(QuestTimer(milliseconds, owner, timer_name)); } -void QuestManager::settimerMS(const char *timer_name, int milliseconds, ItemInst *inst) { +void QuestManager::settimerMS(const char *timer_name, int milliseconds, EQEmu::ItemInstance *inst) { if (inst) { inst->SetTimer(timer_name, milliseconds); } @@ -493,7 +493,7 @@ void QuestManager::stoptimer(const char *timer_name) { } } -void QuestManager::stoptimer(const char *timer_name, ItemInst *inst) { +void QuestManager::stoptimer(const char *timer_name, EQEmu::ItemInstance *inst) { if (inst) { inst->StopTimer(timer_name); } @@ -531,7 +531,7 @@ void QuestManager::stopalltimers() { } } -void QuestManager::stopalltimers(ItemInst *inst) { +void QuestManager::stopalltimers(EQEmu::ItemInstance *inst) { if (inst) { inst->ClearTimers(); } @@ -814,7 +814,7 @@ void QuestManager::traindisc(int discipline_tome_item_id) { } bool QuestManager::isdisctome(int item_id) { - const EQEmu::ItemBase *item = database.GetItem(item_id); + const EQEmu::ItemData *item = database.GetItem(item_id); if(item == nullptr) { return(false); } @@ -1305,7 +1305,7 @@ void QuestManager::settime(uint8 new_hour, uint8 new_min, bool update_world /*= void QuestManager::itemlink(int item_id) { QuestManagerCurrentQuestVars(); if (initiator) { - const EQEmu::ItemBase* item = database.GetItem(item_id); + const EQEmu::ItemData* item = database.GetItem(item_id); if (item == nullptr) return; @@ -2408,7 +2408,7 @@ int QuestManager::collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove) { QuestManagerCurrentQuestVars(); - ItemInst *item = nullptr; + EQEmu::ItemInstance *item = nullptr; int quantity = 0; item = initiator->GetInv().GetItem(slot_id); @@ -2497,7 +2497,7 @@ void QuestManager::MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity) if (merchant == 0 || !merchant->IsNPC() || (merchant->GetClass() != MERCHANT)) return; // don't do anything if NPCid isn't a merchant - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; item = database.GetItem(itemid); if (!item) return; // if the item id doesn't correspond to a real item, do nothing @@ -2510,7 +2510,7 @@ uint32 QuestManager::MerchantCountItem(uint32 NPCid, uint32 itemid) { if (merchant == 0 || !merchant->IsNPC() || (merchant->GetClass() != MERCHANT)) return 0; // if it isn't a merchant, it doesn't have any items - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; item = database.GetItem(itemid); if (!item) return 0; // if it isn't a valid item, the merchant doesn't have any @@ -2533,7 +2533,7 @@ uint32 QuestManager::MerchantCountItem(uint32 NPCid, uint32 itemid) { // Item Link for use in Variables - "my $example_link = quest::varlink(item_id);" const char* QuestManager::varlink(char* perltext, int item_id) { QuestManagerCurrentQuestVars(); - const EQEmu::ItemBase* item = database.GetItem(item_id); + const EQEmu::ItemData* item = database.GetItem(item_id); if (!item) return "INVALID ITEM ID IN VARLINK"; @@ -3087,7 +3087,7 @@ Mob *QuestManager::GetOwner() const { return nullptr; } -ItemInst *QuestManager::GetQuestItem() const { +EQEmu::ItemInstance *QuestManager::GetQuestItem() const { if(!quests_running_.empty()) { running_quest e = quests_running_.top(); return e.questitem; diff --git a/zone/questmgr.h b/zone/questmgr.h index 10c82c1ee..1bef4e1ee 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -25,15 +25,19 @@ #include class Client; -class ItemInst; class Mob; class NPC; +namespace EQEmu +{ + class ItemInstance; +} + class QuestManager { struct running_quest { Mob *owner; Client *initiator; - ItemInst* questitem; + EQEmu::ItemInstance* questitem; bool depop_npc; std::string encounter; }; @@ -41,7 +45,7 @@ public: QuestManager(); virtual ~QuestManager(); - void StartQuest(Mob *_owner, Client *_initiator = nullptr, ItemInst* _questitem = nullptr, std::string encounter = ""); + void StartQuest(Mob *_owner, Client *_initiator = nullptr, EQEmu::ItemInstance* _questitem = nullptr, std::string encounter = ""); void EndQuest(); bool QuestsRunning() { return !quests_running_.empty(); } @@ -70,13 +74,13 @@ public: void Zone(const char *zone_name); void settimer(const char *timer_name, int seconds); void settimerMS(const char *timer_name, int milliseconds); - void settimerMS(const char *timer_name, int milliseconds, ItemInst *inst); + void settimerMS(const char *timer_name, int milliseconds, EQEmu::ItemInstance *inst); void settimerMS(const char *timer_name, int milliseconds, Mob *mob); void stoptimer(const char *timer_name); - void stoptimer(const char *timer_name, ItemInst *inst); + void stoptimer(const char *timer_name, EQEmu::ItemInstance *inst); void stoptimer(const char *timer_name, Mob *mob); void stopalltimers(); - void stopalltimers(ItemInst *inst); + void stopalltimers(EQEmu::ItemInstance *inst); void stopalltimers(Mob *mob); void emote(const char *str); void shout(const char *str); @@ -261,7 +265,7 @@ public: Client *GetInitiator() const; NPC *GetNPC() const; Mob *GetOwner() const; - ItemInst *GetQuestItem() const; + EQEmu::ItemInstance *GetQuestItem() const; std::string GetEncounter() const; inline bool ProximitySayInUse() { return HaveProximitySays; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 06d8ba4a9..be0c04abb 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -83,7 +83,7 @@ void Mob::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int3 } if (item_slot >= 0){ - const ItemInst* itm = nullptr; + const EQEmu::ItemInstance* itm = nullptr; itm = CastToClient()->GetInv().GetItem(item_slot); if(itm) dmg += itm->GetItem()->AC * (RuleI(Combat, SpecialAttackACBonus))/100; @@ -111,14 +111,14 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 if (skill == EQEmu::skills::SkillBash){ if(IsClient()){ - ItemInst *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); if(item) { if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; } - const EQEmu::ItemBase *itm = item->GetItem(); + const EQEmu::ItemData *itm = item->GetItem(); auto fbash = GetFuriousBash(itm->Focus.Effect); hate = hate * (100 + fbash) / 100; if (fbash) @@ -463,7 +463,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) } } else{ - if (GetWeaponDamage(other, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(other, (const EQEmu::ItemData*)nullptr) <= 0){ ndamage = -5; } } @@ -498,7 +498,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { //make sure we have a proper weapon if we are a client. if(IsClient()) { - const ItemInst *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); if (!wpn || (wpn->GetItem()->ItemType != EQEmu::item::ItemType1HPiercing)){ Message_StringID(13, BACKSTAB_WEAPON); return; @@ -577,7 +577,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) int32 backstab_dmg = 0; if (IsClient()) { - const ItemInst *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); if (wpn) { primaryweapondamage = GetWeaponDamage(other, wpn); if (primaryweapondamage) { @@ -650,7 +650,7 @@ void Mob::RogueAssassinate(Mob* other) { //can you dodge, parry, etc.. an assassinate?? //if so, use DoSpecialAttackDamage(other, BACKSTAB, 32000); instead - if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary) : (const ItemInst*)nullptr) > 0){ + if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary) : (const EQEmu::ItemInstance*)nullptr) > 0){ other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); }else{ other->Damage(this, -5, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); @@ -670,11 +670,11 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } - const ItemInst* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; + const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; //locate ammo int ammo_slot = EQEmu::legacy::SlotAmmo; - const ItemInst* Ammo = m_inv[EQEmu::legacy::SlotAmmo]; + const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::legacy::SlotAmmo]; if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotRange), EQEmu::legacy::SlotRange); @@ -687,8 +687,8 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { return; } - const EQEmu::ItemBase* RangeItem = RangeWeapon->GetItem(); - const EQEmu::ItemBase* AmmoItem = Ammo->GetItem(); + const EQEmu::ItemData* RangeItem = RangeWeapon->GetItem(); + const EQEmu::ItemData* AmmoItem = Ammo->GetItem(); if (RangeItem->ItemType != EQEmu::item::ItemTypeBow) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); @@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { int r; bool found = false; for (r = EQEmu::legacy::GENERAL_BEGIN; r <= EQEmu::legacy::GENERAL_END; r++) { - const ItemInst *pi = m_inv[r]; + const EQEmu::ItemInstance *pi = m_inv[r]; if (pi == nullptr || !pi->IsClassBag()) continue; - const EQEmu::ItemBase* bagitem = pi->GetItem(); + const EQEmu::ItemData* bagitem = pi->GetItem(); if (!bagitem || bagitem->BagType != EQEmu::item::BagTypeQuiver) continue; //we found a quiver, look for the ammo in it int i; for (i = 0; i < bagitem->BagSlots; i++) { - ItemInst* baginst = pi->GetItem(i); + EQEmu::ItemInstance* baginst = pi->GetItem(i); if(!baginst) continue; //empty if(baginst->GetID() == Ammo->GetID()) { @@ -790,8 +790,8 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { CommonBreakInvisibleFromCombat(); } -void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const ItemInst* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, - uint32 range_id, uint32 ammo_id, const EQEmu::ItemBase *AmmoItem, int AmmoSlot, float speed) { +void Mob::DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon, const EQEmu::ItemInstance* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, + uint32 range_id, uint32 ammo_id, const EQEmu::ItemData *AmmoItem, int AmmoSlot, float speed) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -804,9 +804,9 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite return; } - const ItemInst* _RangeWeapon = nullptr; - const ItemInst* _Ammo = nullptr; - const EQEmu::ItemBase* ammo_lost = nullptr; + const EQEmu::ItemInstance* _RangeWeapon = nullptr; + const EQEmu::ItemInstance* _Ammo = nullptr; + const EQEmu::ItemData* ammo_lost = nullptr; /* If LaunchProjectile is false this function will do archery damage on target, @@ -1002,7 +1002,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } -bool Mob::TryProjectileAttack(Mob* other, const EQEmu::ItemBase *item, EQEmu::skills::SkillType skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed){ +bool Mob::TryProjectileAttack(Mob* other, const EQEmu::ItemData *item, EQEmu::skills::SkillType skillInUse, uint16 weapon_dmg, const EQEmu::ItemInstance* RangeWeapon, const EQEmu::ItemInstance* Ammo, int AmmoSlot, float speed){ if (!other) return false; @@ -1306,7 +1306,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha //try proc on hits and misses if(other && !other->HasDied()) - TrySpellProc(nullptr, (const EQEmu::ItemBase*)nullptr, other, EQEmu::legacy::SlotRange); + TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, other, EQEmu::legacy::SlotRange); if (HasSkillProcs() && other && !other->HasDied()) TrySkillProc(other, skillInUse, 0, false, EQEmu::legacy::SlotRange); @@ -1352,7 +1352,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 } int ammo_slot = EQEmu::legacy::SlotRange; - const ItemInst* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; + const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotRange), EQEmu::legacy::SlotRange); @@ -1360,7 +1360,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 return; } - const EQEmu::ItemBase* item = RangeWeapon->GetItem(); + const EQEmu::ItemData* item = RangeWeapon->GetItem(); if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::legacy::SlotRange)); @@ -1371,7 +1371,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 if(RangeWeapon->GetCharges() == 1) { //first check ammo - const ItemInst* AmmoItem = m_inv[EQEmu::legacy::SlotAmmo]; + const EQEmu::ItemInstance* AmmoItem = m_inv[EQEmu::legacy::SlotAmmo]; if(AmmoItem != nullptr && AmmoItem->GetID() == RangeWeapon->GetID()) { //more in the ammo slot, use it RangeWeapon = AmmoItem; @@ -1421,7 +1421,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 CommonBreakInvisibleFromCombat(); } -void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQEmu::ItemBase* AmmoItem, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot, float speed) +void Mob::DoThrowingAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon, const EQEmu::ItemData* AmmoItem, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot, float speed) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -1434,8 +1434,8 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE return; } - const ItemInst* _RangeWeapon = nullptr; - const EQEmu::ItemBase* ammo_lost = nullptr; + const EQEmu::ItemInstance* _RangeWeapon = nullptr; + const EQEmu::ItemData* ammo_lost = nullptr; /* If LaunchProjectile is false this function will do archery damage on target, @@ -1559,7 +1559,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE } } -void Mob::SendItemAnimation(Mob *to, const EQEmu::ItemBase *item, EQEmu::skills::SkillType skillInUse, float velocity) { +void Mob::SendItemAnimation(Mob *to, const EQEmu::ItemData *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; @@ -1609,7 +1609,7 @@ void Mob::ProjectileAnimation(Mob* to, int item_id, bool IsArrow, float speed, f if (!to) return; - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; uint8 item_type = 0; if(!item_id) { @@ -1750,7 +1750,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animKick); int32 dmg = 0; - if (GetWeaponDamage(target, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(target, (const EQEmu::ItemData*)nullptr) <= 0){ dmg = -5; } else{ @@ -1771,7 +1771,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animTailRake); int32 dmg = 0; - if (GetWeaponDamage(target, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(target, (const EQEmu::ItemData*)nullptr) <= 0){ dmg = -5; } else{ @@ -1824,7 +1824,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animKick); int32 dmg = 0; - if (GetWeaponDamage(target, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(target, (const EQEmu::ItemData*)nullptr) <= 0){ dmg = -5; } else{ @@ -1849,7 +1849,7 @@ void NPC::DoClassAttacks(Mob *target) { DoAnim(animTailRake); int32 dmg = 0; - if (GetWeaponDamage(target, (const EQEmu::ItemBase*)nullptr) <= 0){ + if (GetWeaponDamage(target, (const EQEmu::ItemData*)nullptr) <= 0){ dmg = -5; } else{ @@ -2361,7 +2361,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: int32 max_hit = (2 * weapon_damage*GetDamageTable(skillinuse)) / 100; if(GetLevel() >= 28 && IsWarriorClass() ) { - int ucDamageBonus = GetWeaponDamageBonus((const EQEmu::ItemBase*) nullptr); + int ucDamageBonus = GetWeaponDamageBonus((const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; hate += ucDamageBonus; @@ -2369,12 +2369,12 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: if (skillinuse == EQEmu::skills::SkillBash){ if(IsClient()){ - ItemInst *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); if(item){ if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; } - const EQEmu::ItemBase *itm = item->GetItem(); + const EQEmu::ItemData *itm = item->GetItem(); hate = hate * (100 + GetFuriousBash(itm->Focus.Effect)) / 100; } } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 564a9756a..161604ea9 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -48,7 +48,7 @@ extern WorldServer worldserver; bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_override) { int caster_level, buffslot, effect, effect_value, i; - ItemInst *SummonedItem=nullptr; + EQEmu::ItemInstance *SummonedItem=nullptr; #ifdef SPELL_EFFECT_SPAM #define _EDLEN 200 char effect_desc[_EDLEN]; @@ -61,7 +61,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove bool c_override = false; if (caster && caster->IsClient() && GetCastedSpellInvSlot() > 0) { - const ItemInst *inst = caster->CastToClient()->GetInv().GetItem(GetCastedSpellInvSlot()); + const EQEmu::ItemInstance *inst = caster->CastToClient()->GetInv().GetItem(GetCastedSpellInvSlot()); if (inst) { if (inst->GetItem()->Click.Level > 0) { caster_level = inst->GetItem()->Click.Level; @@ -622,7 +622,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove snprintf(effect_desc, _EDLEN, "Flesh To Bone"); #endif if(IsClient()){ - ItemInst* transI = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance* transI = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotCursor); if (transI && transI->IsClassCommon() && transI->IsStackable()){ uint32 fcharges = transI->GetCharges(); //Does it sound like meat... maybe should check if it looks like meat too... @@ -1148,7 +1148,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove case SE_SummonItem: { - const EQEmu::ItemBase *item = database.GetItem(spell.base[i]); + const EQEmu::ItemData *item = database.GetItem(spell.base[i]); #ifdef SPELL_EFFECT_SPAM const char *itemname = item ? item->Name : "*Unknown Item*"; snprintf(effect_desc, _EDLEN, "Summon Item: %s (id %d)", itemname, spell.base[i]); @@ -1184,7 +1184,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove } case SE_SummonItemIntoBag: { - const EQEmu::ItemBase *item = database.GetItem(spell.base[i]); + const EQEmu::ItemData *item = database.GetItem(spell.base[i]); #ifdef SPELL_EFFECT_SPAM const char *itemname = item ? item->Name : "*Unknown Item*"; snprintf(effect_desc, _EDLEN, "Summon Item In Bag: %s (id %d)", itemname, spell.base[i]); @@ -1213,7 +1213,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (charges < 1) charges = 1; - ItemInst *SubItem = database.CreateItem(spell.base[i], charges); + EQEmu::ItemInstance *SubItem = database.CreateItem(spell.base[i], charges); if (SubItem != nullptr) { SummonedItem->PutItem(slot, *SubItem); safe_delete(SubItem); @@ -5172,7 +5172,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { //item focus if (itembonuses.FocusEffects[type]){ - const EQEmu::ItemBase* TempItem = 0; + const EQEmu::ItemData* TempItem = 0; for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) { @@ -5180,7 +5180,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { continue; TempItem = nullptr; - ItemInst* ins = GetInv().GetItem(x); + EQEmu::ItemInstance* ins = GetInv().GetItem(x); if (!ins) continue; TempItem = ins->GetItem(); @@ -5199,11 +5199,11 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS) continue; - ItemInst *aug = nullptr; + EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); if(aug) { - const EQEmu::ItemBase* TempItemAug = aug->GetItem(); + const EQEmu::ItemData* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && IsValidSpell(TempItemAug->Focus.Effect)) { proc_spellid = CalcFocusEffect(type, TempItemAug->Focus.Effect, spell_id); if (IsValidSpell(proc_spellid)){ @@ -5301,8 +5301,8 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[type]){ - const EQEmu::ItemBase* TempItem = 0; - const EQEmu::ItemBase* UsedItem = 0; + const EQEmu::ItemData* TempItem = 0; + const EQEmu::ItemData* UsedItem = 0; uint16 UsedFocusID = 0; int16 Total = 0; int16 focus_max = 0; @@ -5312,7 +5312,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) for (int x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::EQUIPMENT_END; x++) { TempItem = nullptr; - ItemInst* ins = GetInv().GetItem(x); + EQEmu::ItemInstance* ins = GetInv().GetItem(x); if (!ins) continue; TempItem = ins->GetItem(); @@ -5345,11 +5345,11 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) for (int y = AUG_INDEX_BEGIN; y < EQEmu::legacy::ITEM_COMMON_SIZE; ++y) { - ItemInst *aug = nullptr; + EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); if(aug) { - const EQEmu::ItemBase* TempItemAug = aug->GetItem(); + const EQEmu::ItemData* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && TempItemAug->Focus.Effect != SPELL_UNKNOWN) { if(rand_effectiveness) { focus_max = CalcFocusEffect(type, TempItemAug->Focus.Effect, spell_id, true); @@ -5384,7 +5384,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) for (int x = EQEmu::legacy::TRIBUTE_BEGIN; x <= EQEmu::legacy::TRIBUTE_END; ++x) { TempItem = nullptr; - ItemInst* ins = GetInv().GetItem(x); + EQEmu::ItemInstance* ins = GetInv().GetItem(x); if (!ins) continue; TempItem = ins->GetItem(); @@ -5573,8 +5573,8 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { if (RuleB(Spells, NPC_UseFocusFromItems) && itembonuses.FocusEffects[type]){ - const EQEmu::ItemBase* TempItem = 0; - const EQEmu::ItemBase* UsedItem = 0; + const EQEmu::ItemData* TempItem = 0; + const EQEmu::ItemData* UsedItem = 0; uint16 UsedFocusID = 0; int16 Total = 0; int16 focus_max = 0; @@ -5582,7 +5582,7 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { //item focus for (int i = 0; i < EQEmu::legacy::EQUIPMENT_SIZE; i++){ - const EQEmu::ItemBase *cur = database.GetItem(equipment[i]); + const EQEmu::ItemData *cur = database.GetItem(equipment[i]); if(!cur) continue; diff --git a/zone/spells.cpp b/zone/spells.cpp index 6c27ab610..e00fc05c2 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -256,7 +256,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, //Added to prevent MQ2 exploitation of equipping normally-unequippable/clickable items with effects and clicking them for benefits. if(item_slot && IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt)) { - ItemInst *itm = CastToClient()->GetInv().GetItem(item_slot); + EQEmu::ItemInstance *itm = CastToClient()->GetInv().GetItem(item_slot); int bitmask = 1; bitmask = bitmask << (CastToClient()->GetClass() - 1); if( itm && itm->GetItem()->Classes != 65535 ) { @@ -936,7 +936,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt)) { IsFromItem = true; - ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot); + EQEmu::ItemInstance *itm = CastToClient()->GetInv().GetItem(inventory_slot); if(itm && itm->GetItem()->RecastDelay > 0) { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { @@ -1174,7 +1174,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo missingreags=true; } - const EQEmu::ItemBase *item = database.GetItem(component); + const EQEmu::ItemData *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); @@ -1235,8 +1235,8 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo && inventory_slot != 0xFFFFFFFF) // 10 is an item { bool fromaug = false; - const ItemInst* inst = CastToClient()->GetInv()[inventory_slot]; - EQEmu::ItemBase* augitem = 0; + const EQEmu::ItemInstance* inst = CastToClient()->GetInv()[inventory_slot]; + EQEmu::ItemData* augitem = 0; uint32 recastdelay = 0; uint32 recasttype = 0; @@ -1245,11 +1245,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo break; for (int r = AUG_INDEX_BEGIN; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { - const ItemInst* aug_i = inst->GetAugment(r); + const EQEmu::ItemInstance* aug_i = inst->GetAugment(r); if (!aug_i) continue; - const EQEmu::ItemBase* aug = aug_i->GetItem(); + const EQEmu::ItemData* aug = aug_i->GetItem(); if (!aug) continue; @@ -1285,7 +1285,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if (inst && inst->IsClassCommon() && (inst->GetItem()->Click.Effect == spell_id) && inst->GetCharges() || fromaug) { - //const ItemBase* item = inst->GetItem(); + //const ItemData* item = inst->GetItem(); int16 charges = inst->GetItem()->MaxCharges; if(fromaug) { charges = -1; } //Don't destroy the parent item @@ -2385,7 +2385,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui if(IsClient() && (slot == CastingSlot::Item || slot == CastingSlot::PotionBelt)) { - ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot); + EQEmu::ItemInstance *itm = CastToClient()->GetInv().GetItem(inventory_slot); if(itm && itm->GetItem()->RecastDelay > 0){ auto recast_type = itm->GetItem()->RecastType; CastToClient()->GetPTimers().Start((pTimerItemStart + recast_type), itm->GetItem()->RecastDelay); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 40e7d8b67..dff042388 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1708,7 +1708,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { return; } -bool ClientTaskState::UpdateTasksOnDeliver(Client *c, std::list& Items, int Cash, int NPCTypeID) { +bool ClientTaskState::UpdateTasksOnDeliver(Client *c, std::list& Items, int Cash, int NPCTypeID) { bool Ret = false; @@ -1900,7 +1900,7 @@ void ClientTaskState::RewardTask(Client *c, TaskInformation *Task) { if(!Task || !c) return; - const EQEmu::ItemBase* Item; + const EQEmu::ItemData* Item; std::vector RewardList; switch(Task->RewardMethod) { @@ -2791,7 +2791,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN } if(ItemID) { - const EQEmu::ItemBase* reward_item = database.GetItem(ItemID); + const EQEmu::ItemData* reward_item = database.GetItem(ItemID); EQEmu::SayLinkEngine linker; linker.SetLinkType(EQEmu::saylink::SayLinkItemData); diff --git a/zone/tasks.h b/zone/tasks.h index 9b5543b3d..5a6944639 100644 --- a/zone/tasks.h +++ b/zone/tasks.h @@ -45,7 +45,11 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) class Client; class Mob; -class ItemInst; + +namespace EQEmu +{ + class ItemInstance; +} struct TaskGoalList_Struct { int ListID; @@ -187,7 +191,7 @@ public: void UpdateTasksForItem(Client *c, ActivityType Type, int ItemID, int Count=1); void UpdateTasksOnExplore(Client *c, int ExploreID); bool UpdateTasksOnSpeakWith(Client *c, int NPCTypeID); - bool UpdateTasksOnDeliver(Client *c, std::list& Items, int Cash, int NPCTypeID); + bool UpdateTasksOnDeliver(Client *c, std::list& Items, int Cash, int NPCTypeID); void UpdateTasksOnTouch(Client *c, int ZoneID); void ProcessTaskProximities(Client *c, float X, float Y, float Z); bool TaskOutOfTime(int Index); diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 6deb51778..38bb5a231 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -46,7 +46,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme return; } - ItemInst* container = nullptr; + EQEmu::ItemInstance* container = nullptr; if (worldo) { @@ -56,12 +56,12 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { // Check to see if they have an inventory container type 53 that is used for this. Inventory& user_inv = user->GetInv(); - ItemInst* inst = nullptr; + EQEmu::ItemInstance* inst = nullptr; inst = user_inv.GetItem(in_augment->container_slot); if (inst) { - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (item && inst->IsType(EQEmu::item::ItemClassBag) && item->BagType == 53) { // We have found an appropriate inventory augmentation sealer @@ -71,7 +71,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme uint8 itemsFound = 0; for (uint8 i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { - const ItemInst* inst = container->GetItem(i); + const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { itemsFound++; @@ -94,7 +94,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme return; } - ItemInst *tobe_auged = nullptr, *auged_with = nullptr; + EQEmu::ItemInstance *tobe_auged = nullptr, *auged_with = nullptr; int8 slot=-1; // Verify 2 items in the augmentation device @@ -135,7 +135,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme bool deleteItems = false; - ItemInst *itemOneToPush = nullptr, *itemTwoToPush = nullptr; + EQEmu::ItemInstance *itemOneToPush = nullptr, *itemTwoToPush = nullptr; // Adding augment if (in_augment->augment_slot == -1) @@ -145,7 +145,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { tobe_auged->PutAugment(slot, *auged_with); - ItemInst *aug = tobe_auged->GetAugment(slot); + EQEmu::ItemInstance *aug = tobe_auged->GetAugment(slot); if(aug) { std::vector args; args.push_back(aug); @@ -165,7 +165,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme } else { - ItemInst *old_aug = nullptr; + EQEmu::ItemInstance *old_aug = nullptr; bool isSolvent = auged_with->GetItem()->ItemType == EQEmu::item::ItemTypeAugmentationSolvent; if (!isSolvent && auged_with->GetItem()->ItemType != EQEmu::item::ItemTypeAugmentationDistiller) { @@ -175,7 +175,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme return; } - ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_slot); + EQEmu::ItemInstance *aug = tobe_auged->GetAugment(in_augment->augment_slot); if (aug) { if (!isSolvent && auged_with->GetItem()->ID != aug->GetItem()->AugDistiller) { @@ -224,7 +224,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme // Delete items in our inventory container... for (uint8 i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { - const ItemInst* inst = container->GetItem(i); + const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { user->DeleteItemInInventory(Inventory::CalcSlotId(in_augment->container_slot,i),0,true); @@ -258,8 +258,8 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob Inventory& user_inv = user->GetInv(); PlayerProfile_Struct& user_pp = user->GetPP(); - ItemInst* container = nullptr; - ItemInst* inst = nullptr; + EQEmu::ItemInstance* container = nullptr; + EQEmu::ItemInstance* inst = nullptr; uint8 c_type = 0xE8; uint32 some_id = 0; bool worldcontainer=false; @@ -276,7 +276,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob else { inst = user_inv.GetItem(in_combine->container_slot); if (inst) { - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if (item && inst->IsType(EQEmu::item::ItemClassBag)) { c_type = item->BagType; some_id = item->ID; @@ -291,10 +291,10 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob container = inst; if (container->GetItem() && container->GetItem()->BagType == EQEmu::item::BagTypeTransformationmold) { - const ItemInst* inst = container->GetItem(0); + const EQEmu::ItemInstance* inst = container->GetItem(0); bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); - if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { - const EQEmu::ItemBase* new_weapon = inst->GetItem(); + if (inst && EQEmu::ItemInstance::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { + const EQEmu::ItemData* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::legacy::SlotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); @@ -312,9 +312,9 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } if (container->GetItem() && container->GetItem()->BagType == EQEmu::item::BagTypeDetransformationmold) { - const ItemInst* inst = container->GetItem(0); + const EQEmu::ItemInstance* inst = container->GetItem(0); if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) { - const EQEmu::ItemBase* new_weapon = inst->GetItem(); + const EQEmu::ItemData* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::legacy::SlotCursor, 0, 0); @@ -402,7 +402,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob database.DeleteWorldContainer(worldo->m_id, zone->GetZoneID()); } else{ for (uint8 i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { - const ItemInst* inst = container->GetItem(i); + const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot,i),0,true); } @@ -537,7 +537,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac user->Message_StringID(MT_Skills, TRADESKILL_MISSING_COMPONENTS); for (auto it = MissingItems.begin(); it != MissingItems.end(); ++it) { - const EQEmu::ItemBase* item = database.GetItem(*it); + const EQEmu::ItemData* item = database.GetItem(*it); if(item) user->Message_StringID(MT_Skills, TRADESKILL_MISSING_ITEM, item->Name); @@ -566,7 +566,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac return; } - const ItemInst* inst = user_inv.GetItem(slot); + const EQEmu::ItemInstance* inst = user_inv.GetItem(slot); if (inst && !inst->IsStackable()) user->DeleteItemInInventory(slot, 0, true); @@ -962,7 +962,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { aa_chance = spellbonuses.ReduceTradeskillFail[spec->tradeskill] + itembonuses.ReduceTradeskillFail[spec->tradeskill] + aabonuses.ReduceTradeskillFail[spec->tradeskill]; - const EQEmu::ItemBase* item = nullptr; + const EQEmu::ItemData* item = nullptr; chance = mod_tradeskill_chance(chance, spec); @@ -1090,7 +1090,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } -bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, +bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec) { if (container == nullptr) @@ -1109,11 +1109,11 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 uint32 count = 0; uint32 sum = 0; for (uint8 i = 0; i < 10; i++) { // TODO: need to determine if this is bound to world/item container size - const ItemInst* inst = container->GetItem(i); + const EQEmu::ItemInstance* inst = container->GetItem(i); if (!inst) continue; - const EQEmu::ItemBase* item = GetItem(inst->GetItem()->ID); + const EQEmu::ItemData* item = GetItem(inst->GetItem()->ID); if (!item) continue; @@ -1238,11 +1238,11 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 int ccnt = 0; for (int x = SLOT_BEGIN; x < EQEmu::legacy::TYPE_WORLD_SIZE; x++) { - const ItemInst* inst = container->GetItem(x); + const EQEmu::ItemInstance* inst = container->GetItem(x); if(!inst) continue; - const EQEmu::ItemBase* item = GetItem(inst->GetItem()->ID); + const EQEmu::ItemData* item = GetItem(inst->GetItem()->ID); if (!item) continue; diff --git a/zone/trading.cpp b/zone/trading.cpp index aab8ac8ac..cfca3a2e6 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -98,14 +98,14 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { // Item always goes into trade bucket from cursor Client* client = owner->CastToClient(); - ItemInst* inst = client->GetInv().GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance* inst = client->GetInv().GetItem(EQEmu::legacy::SlotCursor); if (!inst) { client->Message(13, "Error: Could not find item on your cursor!"); return; } - ItemInst* inst2 = client->GetInv().GetItem(trade_slot_id); + EQEmu::ItemInstance* inst2 = client->GetInv().GetItem(trade_slot_id); // it looks like the original code attempted to allow stacking... // (it just didn't handle partial stack move actions) @@ -158,7 +158,7 @@ Mob* Trade::With() } // Private Method: Send item data for trade item to other person involved in trade -void Trade::SendItemData(const ItemInst* inst, int16 dest_slot_id) +void Trade::SendItemData(const EQEmu::ItemInstance* inst, int16 dest_slot_id) { if (inst == nullptr) return; @@ -175,7 +175,7 @@ void Trade::SendItemData(const ItemInst* inst, int16 dest_slot_id) if (inst->GetItem()->ItemClass == 1) { for (uint16 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i); - const ItemInst* bagitem = trader->GetInv().GetItem(bagslot_id); + const EQEmu::ItemInstance* bagitem = trader->GetInv().GetItem(bagslot_id); if (bagitem) { with->SendItemPacket(bagslot_id - EQEmu::legacy::TRADE_BEGIN, bagitem, ItemPacketTradeView); } @@ -252,7 +252,7 @@ void Trade::LogTrade() strcat(logtext, "items {"); for (uint16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++) { - const ItemInst* inst = trader->GetInv().GetItem(i); + const EQEmu::ItemInstance* inst = trader->GetInv().GetItem(i); if (!comma) comma = true; @@ -304,7 +304,7 @@ void Trade::DumpTrade() Client* trader = owner->CastToClient(); for (uint16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++) { - const ItemInst* inst = trader->GetInv().GetItem(i); + const EQEmu::ItemInstance* inst = trader->GetInv().GetItem(i); if (inst) { Log.Out(Logs::Detail, Logs::Trading, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", @@ -333,7 +333,7 @@ void Client::ResetTrade() { // step 1: process bags for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { - const ItemInst* inst = m_inv[trade_slot]; + const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst && inst->IsClassBag()) { int16 free_slot = m_inv.FindFreeSlotForTradeItem(inst); @@ -352,7 +352,7 @@ void Client::ResetTrade() { // step 2a: process stackables for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { - ItemInst* inst = GetInv().GetItem(trade_slot); + EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { while (true) { @@ -362,7 +362,7 @@ void Client::ResetTrade() { if ((free_slot == EQEmu::legacy::SlotCursor) || (free_slot == INVALID_INDEX)) break; - ItemInst* partial_inst = GetInv().GetItem(free_slot); + EQEmu::ItemInstance* partial_inst = GetInv().GetItem(free_slot); if (!partial_inst) break; @@ -399,14 +399,14 @@ void Client::ResetTrade() { // step 2b: adjust trade stack bias // (if any partial stacks exist before the final stack, FindFreeSlotForTradeItem() will return that slot in step 3 and an overwrite will occur) for (int16 trade_slot = EQEmu::legacy::TRADE_END; trade_slot >= EQEmu::legacy::TRADE_BEGIN; --trade_slot) { - ItemInst* inst = GetInv().GetItem(trade_slot); + EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { for (int16 bias_slot = EQEmu::legacy::TRADE_BEGIN; bias_slot <= EQEmu::legacy::TRADE_END; ++bias_slot) { if (bias_slot >= trade_slot) break; - ItemInst* bias_inst = GetInv().GetItem(bias_slot); + EQEmu::ItemInstance* bias_inst = GetInv().GetItem(bias_slot); if (!bias_inst || (bias_inst->GetID() != inst->GetID()) || (bias_inst->GetCharges() >= bias_inst->GetItem()->StackSize)) continue; @@ -433,7 +433,7 @@ void Client::ResetTrade() { // step 3: process everything else for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { - const ItemInst* inst = m_inv[trade_slot]; + const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst) { int16 free_slot = m_inv.FindFreeSlotForTradeItem(inst); @@ -488,7 +488,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // step 1: process bags for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { - const ItemInst* inst = m_inv[trade_slot]; + const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst && inst->IsClassBag()) { Log.Out(Logs::Detail, Logs::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); @@ -524,7 +524,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st //for (uint8 sub_slot = SUB_BEGIN; ((sub_slot < inst->GetItem()->BagSlots) && (sub_slot < EmuConstants::ITEM_CONTAINER_SIZE)); ++sub_slot) { for (uint8 sub_slot = SUB_INDEX_BEGIN; (sub_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++sub_slot) { // this is to catch ALL items - const ItemInst* bag_inst = inst->GetItem(sub_slot); + const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot); if (bag_inst) { detail = new QSTradeItems_Struct; @@ -572,7 +572,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // step 2a: process stackables for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { - ItemInst* inst = GetInv().GetItem(trade_slot); + EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { while (true) { @@ -582,7 +582,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if ((partial_slot == EQEmu::legacy::SlotCursor) || (partial_slot == INVALID_INDEX)) break; - ItemInst* partial_inst = other->GetInv().GetItem(partial_slot); + EQEmu::ItemInstance* partial_inst = other->GetInv().GetItem(partial_slot); if (!partial_inst) break; @@ -654,14 +654,14 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // step 2b: adjust trade stack bias // (if any partial stacks exist before the final stack, FindFreeSlotForTradeItem() will return that slot in step 3 and an overwrite will occur) for (int16 trade_slot = EQEmu::legacy::TRADE_END; trade_slot >= EQEmu::legacy::TRADE_BEGIN; --trade_slot) { - ItemInst* inst = GetInv().GetItem(trade_slot); + EQEmu::ItemInstance* inst = GetInv().GetItem(trade_slot); if (inst && inst->IsStackable()) { for (int16 bias_slot = EQEmu::legacy::TRADE_BEGIN; bias_slot <= EQEmu::legacy::TRADE_END; ++bias_slot) { if (bias_slot >= trade_slot) break; - ItemInst* bias_inst = GetInv().GetItem(bias_slot); + EQEmu::ItemInstance* bias_inst = GetInv().GetItem(bias_slot); if (!bias_inst || (bias_inst->GetID() != inst->GetID()) || (bias_inst->GetCharges() >= bias_inst->GetItem()->StackSize)) continue; @@ -707,7 +707,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // step 3: process everything else for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_END; ++trade_slot) { - const ItemInst* inst = m_inv[trade_slot]; + const EQEmu::ItemInstance* inst = m_inv[trade_slot]; if (inst) { Log.Out(Logs::Detail, Logs::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); @@ -744,7 +744,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // 'step 3' should never really see containers..but, just in case... //for (uint8 sub_slot = SUB_BEGIN; ((sub_slot < inst->GetItem()->BagSlots) && (sub_slot < EmuConstants::ITEM_CONTAINER_SIZE)); ++sub_slot) { for (uint8 sub_slot = SUB_INDEX_BEGIN; (sub_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++sub_slot) { // this is to catch ALL items - const ItemInst* bag_inst = inst->GetItem(sub_slot); + const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot); if (bag_inst) { detail = new QSTradeItems_Struct; @@ -821,7 +821,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if(qs_log) { // This can be incorporated below when revisions are made for (int16 trade_slot = EQEmu::legacy::TRADE_BEGIN; trade_slot <= EQEmu::legacy::TRADE_NPC_END; ++trade_slot) { - const ItemInst* trade_inst = m_inv[trade_slot]; + const EQEmu::ItemInstance* trade_inst = m_inv[trade_slot]; if(trade_inst) { auto detail = new QSHandinItems_Struct; @@ -842,7 +842,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (trade_inst->IsClassBag()) { for (uint8 sub_slot = SUB_INDEX_BEGIN; sub_slot < trade_inst->GetItem()->BagSlots; ++sub_slot) { - const ItemInst* trade_baginst = trade_inst->GetItem(sub_slot); + const EQEmu::ItemInstance* trade_baginst = trade_inst->GetItem(sub_slot); if(trade_baginst) { detail = new QSHandinItems_Struct; @@ -874,27 +874,27 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } std::vector item_list; - std::list items; + std::list items; for (int i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_NPC_END; ++i) { - ItemInst *inst = m_inv.GetItem(i); + EQEmu::ItemInstance *inst = m_inv.GetItem(i); if(inst) { items.push_back(inst); item_list.push_back(inst); } else { - item_list.push_back((ItemInst*)nullptr); + item_list.push_back((EQEmu::ItemInstance*)nullptr); continue; } - const EQEmu::ItemBase* item = inst->GetItem(); + const EQEmu::ItemData* item = inst->GetItem(); if(item && quest_npc == false) { // if it was not a NO DROP or Attuned item (or if a GM is trading), let the NPC have it if(GetGM() || (item->NoDrop != 0 && inst->IsAttuned() == false)) { // pets need to look inside bags and try to equip items found there if (item->IsClassBag() && item->BagSlots > 0) { for (int16 bslot = SUB_INDEX_BEGIN; bslot < item->BagSlots; bslot++) { - const ItemInst* baginst = inst->GetItem(bslot); + const EQEmu::ItemInstance* baginst = inst->GetItem(bslot); if (baginst) { - const EQEmu::ItemBase* bagitem = baginst->GetItem(); + const EQEmu::ItemData* bagitem = baginst->GetItem(); if (bagitem && (GetGM() || (bagitem->NoDrop != 0 && baginst->IsAttuned() == false))) { tradingWith->CastToNPC()->AddLootDrop(bagitem, &tradingWith->CastToNPC()->itemlist, baginst->GetCharges(), 1, 127, true, true); @@ -947,7 +947,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st tradingWith->FaceTarget(this); } - ItemInst *insts[4] = { 0 }; + EQEmu::ItemInstance *insts[4] = { 0 }; for (int i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_NPC_END; ++i) { insts[i - EQEmu::legacy::TRADE_BEGIN] = m_inv.PopItem(i); database.SaveInventory(CharacterID(), nullptr, i); @@ -969,7 +969,7 @@ bool Client::CheckTradeLoreConflict(Client* other) return true; // Move each trade slot into free inventory slot for (int16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++){ - const ItemInst* inst = m_inv[i]; + const EQEmu::ItemInstance* inst = m_inv[i]; if (inst && inst->GetItem()) { if (other->CheckLoreConflict(inst->GetItem())) @@ -978,7 +978,7 @@ bool Client::CheckTradeLoreConflict(Client* other) } for (int16 i = EQEmu::legacy::TRADE_BAGS_BEGIN; i <= EQEmu::legacy::TRADE_BAGS_END; i++){ - const ItemInst* inst = m_inv[i]; + const EQEmu::ItemInstance* inst = m_inv[i]; if (inst && inst->GetItem()) { if (other->CheckLoreConflict(inst->GetItem())) @@ -1158,14 +1158,14 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { std::string Packet; int16 FreeSlotID=0; - const EQEmu::ItemBase* item = database.GetItem(ItemID); + const EQEmu::ItemData* item = database.GetItem(ItemID); if(!item){ Log.Out(Logs::Detail, Logs::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } - ItemInst* inst = database.CreateItem(item, Quantity); + EQEmu::ItemInstance* inst = database.CreateItem(item, Quantity); if (inst) { @@ -1183,7 +1183,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { void Client::SendSingleTraderItem(uint32 CharID, int SerialNumber) { - ItemInst* inst= database.LoadSingleTraderItem(CharID, SerialNumber); + EQEmu::ItemInstance* inst= database.LoadSingleTraderItem(CharID, SerialNumber); if(inst) { SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? safe_delete(inst); @@ -1192,7 +1192,7 @@ void Client::SendSingleTraderItem(uint32 CharID, int SerialNumber) { } void Client::BulkSendTraderInventory(uint32 char_id) { - const EQEmu::ItemBase *item; + const EQEmu::ItemData *item; TraderCharges_Struct* TraderItems = database.LoadTraderItemWithCharges(char_id); @@ -1204,7 +1204,7 @@ void Client::BulkSendTraderInventory(uint32 char_id) { item=database.GetItem(TraderItems->ItemID[i]); if (item && (item->NoDrop!=0)) { - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if (inst) { inst->SetSerialNumber(TraderItems->SerialNumber[i]); if(TraderItems->Charges[i] > 0) @@ -1230,7 +1230,7 @@ void Client::BulkSendTraderInventory(uint32 char_id) { uint32 Client::FindTraderItemSerialNumber(int32 ItemID) { - ItemInst* item = nullptr; + EQEmu::ItemInstance* item = nullptr; uint16 SlotID = 0; for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++){ item = this->GetInv().GetItem(i); @@ -1251,9 +1251,9 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) { return 0; } -ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ +EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ - ItemInst* item = nullptr; + EQEmu::ItemInstance* item = nullptr; uint16 SlotID = 0; for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++){ item = this->GetInv().GetItem(i); @@ -1277,7 +1277,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ GetItems_Struct* Client::GetTraderItems(){ - const ItemInst* item = nullptr; + const EQEmu::ItemInstance* item = nullptr; uint16 SlotID = 0; auto gis = new GetItems_Struct; @@ -1308,7 +1308,7 @@ GetItems_Struct* Client::GetTraderItems(){ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ - const ItemInst* item= nullptr; + const EQEmu::ItemInstance* item= nullptr; uint16 SlotID = 0; for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { item = this->GetInv().GetItem(i); @@ -1370,7 +1370,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu } // This updates the trader. Removes it from his trading bags. // - const ItemInst* Inst = m_inv[Slot]; + const EQEmu::ItemInstance* Inst = m_inv[Slot]; database.SaveInventory(CharacterID(), Inst, Slot); @@ -1412,7 +1412,7 @@ void Client::TraderUpdate(uint16 SlotID,uint32 TraderID){ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* Customer, uint16 TraderSlot){ - const ItemInst* item= nullptr; + const EQEmu::ItemInstance* item= nullptr; bool Stackable = false; int16 Charges=0; @@ -1564,7 +1564,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic outtbs->ItemID = tbs->ItemID; - const ItemInst* BuyItem = nullptr; + const EQEmu::ItemInstance* BuyItem = nullptr; uint32 ItemID = 0; if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) @@ -2027,11 +2027,11 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(!Customer) return; - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item) return; - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if(!inst) return; @@ -2071,7 +2071,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(!Customer) return; - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item) return; @@ -2112,7 +2112,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St Log.Out(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName()); - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if(!inst) return; @@ -2230,7 +2230,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { } - const EQEmu::ItemBase *item = 0; + const EQEmu::ItemData *item = 0; if(IDOfItemToAdd) item = database.GetItem(IDOfItemToAdd); @@ -2396,7 +2396,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { char *buf = (char *)outapp->pBuffer; - const EQEmu::ItemBase* item = database.GetItem(itemID); + const EQEmu::ItemData* item = database.GetItem(itemID); if(!item) { safe_delete(outapp); @@ -2492,7 +2492,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { char *Buf = (char *)outapp->pBuffer; - const EQEmu::ItemBase* item = database.GetItem(ItemID); + const EQEmu::ItemData* item = database.GetItem(ItemID); if(!item) { safe_delete(outapp); @@ -2536,7 +2536,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { /*uint32 BuyerID2 =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused /*uint32 Unknown3 =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item || !Quantity || !Price || !QtyBuyerWants) return; @@ -2602,7 +2602,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { return; } - ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); + EQEmu::ItemInstance* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); @@ -2648,7 +2648,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { return; } - ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); + EQEmu::ItemInstance* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); @@ -2927,7 +2927,7 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { /*uint32 UnknownZ =*/ VARSTRUCT_SKIP_TYPE(uint32, Buf); //unused uint32 ItemCount = VARSTRUCT_DECODE_TYPE(uint32, Buf); - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item) return; @@ -2991,7 +2991,7 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) { BuyerItemSearchResults_Struct* bisr = (BuyerItemSearchResults_Struct*)outapp->pBuffer; - const EQEmu::ItemBase* item = 0; + const EQEmu::ItemData* item = 0; int Count=0; diff --git a/zone/tribute.cpp b/zone/tribute.cpp index d40dfa6f2..537473e72 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -161,7 +161,7 @@ void Client::DoTributeUpdate() { uint32 item_id = tier.tribute_item_id; //summon the item for them - const ItemInst* inst = database.CreateItem(item_id, 1); + const EQEmu::ItemInstance* inst = database.CreateItem(item_id, 1); if(inst == nullptr) continue; @@ -239,7 +239,7 @@ void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { //returns the number of points received from the tribute int32 Client::TributeItem(uint32 slot, uint32 quantity) { - const ItemInst*inst = m_inv[slot]; + const EQEmu::ItemInstance*inst = m_inv[slot]; if(inst == nullptr) return(0); diff --git a/zone/tune.cpp b/zone/tune.cpp index ea93a43f3..f8655d66a 100644 --- a/zone/tune.cpp +++ b/zone/tune.cpp @@ -587,7 +587,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) if (!other) return 0; - ItemInst* weapon; + EQEmu::ItemInstance* weapon; weapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary); if(weapon != nullptr) { @@ -630,7 +630,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) { - ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemBase*) nullptr); + ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; max_hit += (int) ucDamageBonus; @@ -661,7 +661,7 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch 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; + EQEmu::ItemInstance* weapon; weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); if(weapon && weapon->IsWeapon()){ @@ -741,7 +741,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ 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; + EQEmu::ItemInstance* weapon; weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); if(weapon && weapon->IsWeapon()){ diff --git a/zone/zone.cpp b/zone/zone.cpp index 1edf1a268..9391b47bb 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -248,12 +248,12 @@ bool Zone::LoadZoneObjects() data.tilt_y = atof(row[18]); data.unknown084 = 0; - ItemInst *inst = nullptr; + EQEmu::ItemInstance *inst = nullptr; // FatherNitwit: this dosent seem to work... // tradeskill containers do not have an itemid of 0... at least what I am seeing if (itemid == 0) { // Generic tradeskill container - inst = new ItemInst(ItemInstWorldContainer); + inst = new EQEmu::ItemInstance(ItemInstWorldContainer); } else { // Groundspawn object inst = database.CreateItem(itemid); @@ -261,7 +261,7 @@ bool Zone::LoadZoneObjects() // Father Nitwit's fix... not perfect... if (inst == nullptr && type != OT_DROPPEDITEM) { - inst = new ItemInst(ItemInstWorldContainer); + inst = new EQEmu::ItemInstance(ItemInstWorldContainer); } // Load child objects if container @@ -294,7 +294,7 @@ bool Zone::LoadGroundSpawns() { uint32 gsnumber=0; for(gsindex=0;gsindex<50;gsindex++){ if(groundspawn.spawn[gsindex].item>0 && groundspawn.spawn[gsindex].itemGetItem()->IsClassCommon()) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) if (aug[i]) @@ -509,7 +509,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) } // Save child objects for a world container (i.e., forge, bag dropped to ground, etc) -void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const ItemInst* container) +void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const EQEmu::ItemInstance* container) { // Since state is not saved for each world container action, we'll just delete // all and save from scratch .. we may come back later to optimize @@ -522,7 +522,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It // Save all 10 items, if they exist for (uint8 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; index++) { - ItemInst* inst = container->GetItem(index); + EQEmu::ItemInstance* inst = container->GetItem(index); if (!inst) continue; @@ -531,7 +531,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It if (inst->IsType(EQEmu::item::ItemClassCommon)) { for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { - ItemInst *auginst=inst->GetAugment(i); + EQEmu::ItemInstance *auginst=inst->GetAugment(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } } @@ -611,7 +611,7 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) return loadti; } -ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { +EQEmu::ItemInstance* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i AND serialnumber = %i " "ORDER BY slot_id LIMIT 80", CharID, SerialNumber); auto results = QueryDatabase(query); @@ -629,7 +629,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { int Charges = atoi(row[3]); int Cost = atoi(row[4]); - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item) { Log.Out(Logs::Detail, Logs::Trading, "Unable to create item\n"); @@ -640,7 +640,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { if (item->NoDrop == 0) return nullptr; - ItemInst* inst = database.CreateItem(item); + EQEmu::ItemInstance* inst = database.CreateItem(item); if(!inst) { Log.Out(Logs::Detail, Logs::Trading, "Unable to create item instance\n"); fflush(stdout); @@ -684,7 +684,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg Log.Out(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); - const EQEmu::ItemBase *item = database.GetItem(ItemID); + const EQEmu::ItemData *item = database.GetItem(ItemID); if(!item) return; @@ -1197,7 +1197,7 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str i = atoi(row[r]); /* Bandolier ID */ r++; si = atoi(row[r]); /* Bandolier Slot */ r++; - const EQEmu::ItemBase* item_data = database.GetItem(atoi(row[r])); + const EQEmu::ItemData* item_data = database.GetItem(atoi(row[r])); if (item_data) { pp->bandoliers[i].Items[si].ID = item_data->ID; r++; pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; // Must use db value in case an Ornamentation is assigned @@ -1249,7 +1249,7 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); - const EQEmu::ItemBase *item_data = database.GetItem(atoi(row[1])); + const EQEmu::ItemData *item_data = database.GetItem(atoi(row[1])); if (!item_data) continue; pp->potionbelt.Items[i].ID = item_data->ID; diff --git a/zone/zonedb.h b/zone/zonedb.h index 689f9a82f..1c96ee298 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -16,7 +16,6 @@ class NPC; class Petition; class Spawn2; class SpawnGroupList; -class ItemInst; struct CharacterEventLog_Struct; struct Door; struct ExtendedProfile_Struct; @@ -24,6 +23,12 @@ struct NPCType; struct PlayerCorpse_Struct; struct ZonePoint; struct npcDecayTimes_Struct; + +namespace EQEmu +{ + class ItemInstance; +} + template class LinkedList; //#include "doors.h" @@ -224,11 +229,11 @@ public: virtual ~ZoneDatabase(); /* Objects and World Containers */ - void LoadWorldContainer(uint32 parentid, ItemInst* container); - void SaveWorldContainer(uint32 zone_id, uint32 parent_id, const ItemInst* container); + void LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* container); + void SaveWorldContainer(uint32 zone_id, uint32 parent_id, const EQEmu::ItemInstance* container); void DeleteWorldContainer(uint32 parent_id,uint32 zone_id); - uint32 AddObject(uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst); - void UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const ItemInst* inst); + uint32 AddObject(uint32 type, uint32 icon, const Object_Struct& object, const EQEmu::ItemInstance* inst); + void UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const EQEmu::ItemInstance* inst); void DeleteObject(uint32 id); Ground_Spawns* LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs); @@ -239,7 +244,7 @@ public: void DeleteTraderItem(uint32 char_id); void DeleteTraderItem(uint32 char_id,uint16 slot_id); - ItemInst* LoadSingleTraderItem(uint32 char_id, int uniqueid); + EQEmu::ItemInstance* LoadSingleTraderItem(uint32 char_id, int uniqueid); Trader_Struct* LoadTraderItem(uint32 char_id); TraderCharges_Struct* LoadTraderItemWithCharges(uint32 char_id); @@ -427,7 +432,7 @@ public: void DeleteMerchantTemp(uint32 npcid, uint32 slot); /* Tradeskills */ - bool GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); + bool GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); bool GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); uint32 GetZoneForage(uint32 ZoneID, uint8 skill); /* for foraging */ uint32 GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance); From bfd07b101082545bf253ee3c424e036c05077695 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 16 Oct 2016 21:36:39 -0400 Subject: [PATCH 21/65] Added class EQEmu::InventorySlot --- changelog.txt | 3 +- common/CMakeLists.txt | 4 +- common/database.cpp | 2 +- common/database_conversions.cpp | 8 +- common/emu_constants.h | 80 ++++++ common/emu_legacy.h | 103 ++------ common/eq_constants.h | 8 - common/eq_limits.cpp | 40 +-- common/eq_limits.h | 2 +- common/eq_packet_structs.h | 10 +- common/extprofile.h | 2 +- common/inventory_slot.cpp | 397 ++++++++++++++++++++++++++++++ common/inventory_slot.h | 133 ++++++++++ common/item_data.h | 6 +- common/item_instance.cpp | 306 +++++++++++------------ common/item_instance.h | 6 +- common/patches/rof.cpp | 105 ++++---- common/patches/rof2.cpp | 102 ++++---- common/patches/rof2_structs.h | 4 +- common/patches/rof_structs.h | 2 +- common/patches/sod.cpp | 30 +-- common/patches/sod_structs.h | 6 +- common/patches/sof.cpp | 26 +- common/patches/sof_structs.h | 6 +- common/patches/titanium.cpp | 14 +- common/patches/titanium_structs.h | 4 +- common/patches/uf.cpp | 30 +-- common/patches/uf_structs.h | 6 +- common/shareddb.cpp | 34 +-- common/textures.cpp | 79 ------ common/textures.h | 181 +++++++------- world/worlddb.cpp | 16 +- zone/attack.cpp | 106 ++++---- zone/beacon.h | 2 +- zone/bonuses.cpp | 34 +-- zone/bot.cpp | 230 ++++++++--------- zone/bot.h | 4 +- zone/bot_command.cpp | 72 +++--- zone/bot_database.cpp | 22 +- zone/client.cpp | 94 +++---- zone/client.h | 6 +- zone/client_mods.cpp | 16 +- zone/client_packet.cpp | 52 ++-- zone/client_process.cpp | 26 +- zone/command.cpp | 38 +-- zone/corpse.cpp | 42 ++-- zone/corpse.h | 2 +- zone/doors.cpp | 2 +- zone/encounter.h | 2 +- zone/entity.h | 2 +- zone/forage.cpp | 12 +- zone/inventory.cpp | 228 ++++++++--------- zone/loottables.cpp | 38 +-- zone/lua_general.cpp | 100 ++++---- zone/merc.cpp | 32 +-- zone/merc.h | 2 +- zone/mob.cpp | 14 +- zone/mob.h | 18 +- zone/mob_ai.cpp | 8 +- zone/npc.cpp | 26 +- zone/npc.h | 2 +- zone/object.cpp | 10 +- zone/special_attacks.cpp | 118 ++++----- zone/spell_effects.cpp | 20 +- zone/spells.cpp | 4 +- zone/tradeskills.cpp | 12 +- zone/trading.cpp | 32 +-- zone/tune.cpp | 42 ++-- zone/zonedb.cpp | 18 +- 69 files changed, 1852 insertions(+), 1391 deletions(-) create mode 100644 common/inventory_slot.cpp create mode 100644 common/inventory_slot.h diff --git a/changelog.txt b/changelog.txt index 50640ff55..5dfeca1d1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 10/16/2016 == -Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance. +Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance +Uleat: Added class EQEmu::InventorySlot. Re-attached pertinent inventory token references to EQDictionary == 10/15/2016 == Uleat: Changed filenames to facilitate future inventory naming conventions diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2138c5c9e..fbfc9305e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -35,7 +35,7 @@ SET(common_sources faction.cpp guild_base.cpp guilds.cpp -# inventory_slot.cpp + inventory_slot.cpp ipc_mutex.cpp item_data.cpp item_instance.cpp @@ -156,7 +156,7 @@ SET(common_headers global_define.h guild_base.h guilds.h -# inventory_slot.h + inventory_slot.h ipc_mutex.h item_data.h item_fieldlist.h diff --git a/common/database.cpp b/common/database.cpp index 93bbe7e0c..743bec9f2 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -709,7 +709,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); } - if (i == EQEmu::legacy::SlotCursor) { + if (i == EQEmu::inventory::slotCursor) { i = EQEmu::legacy::GENERAL_BAGS_BEGIN; continue; } diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index c282acc94..d5cdbdb25 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -186,7 +186,7 @@ namespace Convert { /*002*/ uint32 HP; /*006*/ uint32 Mana; /*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT]; - /*510*/ uint32 Items[EQEmu::textures::TextureCount]; + /*510*/ uint32 Items[EQEmu::textures::materialCount]; /*546*/ char Name[64]; /*610*/ }; @@ -227,9 +227,9 @@ namespace Convert { /*0304*/ uint8 ability_time_minutes; /*0305*/ uint8 ability_time_hours; //place holder /*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag? - /*0312*/ uint32 item_material[EQEmu::textures::TextureCount]; // Item texture/material of worn/held items + /*0312*/ uint32 item_material[EQEmu::textures::materialCount]; // Item texture/material of worn/held items /*0348*/ uint8 unknown0348[44]; - /*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::TextureCount]; + /*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::materialCount]; /*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY]; /*2348*/ float unknown2384; //seen ~128, ~47 /*2352*/ char servername[32]; // length probably not right @@ -1403,7 +1403,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Material Color Convert */ first_entry = 0; rquery = ""; - for (i = 0; i < EQEmu::textures::TextureCount; i++){ + for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++){ if (pp->item_tint[i].color > 0){ if (first_entry != 1){ rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); diff --git a/common/emu_constants.h b/common/emu_constants.h index bf8189acc..9e44976a8 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -35,6 +35,79 @@ namespace EQEmu //using namespace RoF2::invbag; //using namespace RoF2::invaug; + enum : int16 { typeInvalid = -1, slotInvalid = -1, containerInvalid = -1, socketInvalid = -1 }; // temporary + enum : int16 { typeBegin = 0, slotBegin = 0, containerBegin = 0, socketBegin = 0 }; // temporary + + enum PossessionsSlots : int16 { // temporary + slotCharm = 0, + slotEar1, + slotHead, + slotFace, + slotEar2, + slotNeck, // 5 + slotShoulders, + slotArms, + slotBack, + slotWrist1, + slotWrist2, // 10 + slotRange, + slotHands, + slotPrimary, + slotSecondary, + slotFinger1, // 15 + slotFinger2, + slotChest, + slotLegs, + slotFeet, + slotWaist, // 20 + slotPowerSource = 9999, + slotAmmo = 21, + slotGeneral1, + slotGeneral2, + slotGeneral3, + slotGeneral4, // 25 + slotGeneral5, + slotGeneral6, + slotGeneral7, + slotGeneral8, + slotCursor, // 30 + slotCount + }; + + enum InventoryTypes : int16 { // temporary + typePossessions = 0, + typeBank, + typeSharedBank, + typeTrade, + typeWorld, + typeLimbo, // 5 + typeTribute, + typeTrophyTribute, + typeGuildTribute, + typeMerchant, + typeDeleted, // 10 + typeCorpse, + typeBazaar, + typeInspect, + typeRealEstate, + typeViewMODPC, // 15 + typeViewMODBank, + typeViewMODSharedBank, + typeViewMODLimbo, + typeAltStorage, + typeArchived, // 20 + typeMail, + typeGuildTrophyTribute, + typeKrono, + typeOther, + typeCount + }; + + static int16 SlotCount(int16 type_index) { return 0; } // temporary + + const int16 ContainerCount = 10; // temporary + const int16 SocketCount = 6; // temporary + } /*inventory*/ namespace constants { @@ -44,6 +117,7 @@ namespace EQEmu const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize; } /*constants*/ + enum class CastingSlot : uint32 { Gem1 = 0, Gem2 = 1, @@ -68,3 +142,9 @@ namespace EQEmu } /*EQEmu*/ #endif /*COMMON_EMU_CONSTANTS_H*/ + +/* hack list to prevent circular references + + eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n]; + +*/ diff --git a/common/emu_legacy.h b/common/emu_legacy.h index 98829eae4..b70d7143c 100644 --- a/common/emu_legacy.h +++ b/common/emu_legacy.h @@ -61,8 +61,6 @@ namespace EQEmu SLOT_GENERAL_6 = 27, SLOT_GENERAL_7 = 28, SLOT_GENERAL_8 = 29, - //SLOT_GENERAL_9 = not supported - //SLOT_GENERAL_10 = not supported SLOT_CURSOR = 30, SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this... SLOT_TRADESKILL = 1000, @@ -96,75 +94,8 @@ namespace EQEmu SLOT_WORLD_END = 4009 }; - enum InventoryTypes : int16 { - TypePossessions = 0, - TypeBank, - TypeSharedBank, - TypeTrade, - TypeWorld, - TypeLimbo, // 5 - TypeTribute, - TypeTrophyTribute, - TypeGuildTribute, - TypeMerchant, - TypeDeleted, // 10 - TypeCorpse, - TypeBazaar, - TypeInspect, - TypeRealEstate, - TypeViewMODPC, // 15 - TypeViewMODBank, - TypeViewMODSharedBank, - TypeViewMODLimbo, - TypeAltStorage, - TypeArchived, // 20 - TypeMail, - TypeGuildTrophyTribute, - TypeKrono, - TypeOther, - TypeCount - }; - - enum PossessionsSlots : int16 { - SlotCharm = 0, - SlotEar1, - SlotHead, - SlotFace, - SlotEar2, - SlotNeck, // 5 - SlotShoulders, - SlotArms, - SlotBack, - SlotWrist1, - SlotWrist2, // 10 - SlotRange, - SlotHands, - SlotPrimary, - SlotSecondary, - SlotFinger1, // 15 - SlotFinger2, - SlotChest, - SlotLegs, - SlotFeet, - SlotWaist, // 20 - SlotPowerSource = 9999, // temp - SlotAmmo = 21, // temp - SlotGeneral1, - SlotGeneral2, - SlotGeneral3, - SlotGeneral4, // 25 - SlotGeneral5, - SlotGeneral6, - SlotGeneral7, - SlotGeneral8, - //SlotGeneral9, - //SlotGeneral10, - SlotCursor, // 30 - SlotCount - }; - // these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready - static const uint16 TYPE_POSSESSIONS_SIZE = SlotCount; + static const uint16 TYPE_POSSESSIONS_SIZE = 31; static const uint16 TYPE_BANK_SIZE = 24; static const uint16 TYPE_SHARED_BANK_SIZE = 2; static const uint16 TYPE_TRADE_SIZE = 8; @@ -175,14 +106,14 @@ namespace EQEmu 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 = SlotCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, = slot_count) + return false; + + if (_container_index < inventory::containerInvalid || _container_index >= inventory::ContainerCount) + return false; + + if (_socket_index < inventory::socketInvalid || _socket_index >= inventory::SocketCount) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsDeleteSlot() const +{ + if (_typeless) + return (_slot_index == inventory::slotInvalid && _container_index == inventory::containerInvalid && _socket_index == inventory::socketInvalid); + else + return (_type_index == inventory::typeInvalid && _slot_index == inventory::slotInvalid && _container_index == inventory::containerInvalid && _socket_index == inventory::socketInvalid); +} + +bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index) +{ + /*if (slot_index < inventory::EquipmentBegin || slot_index > inventory::EquipmentEnd) + return false;*/ + if ((slot_index < legacy::EQUIPMENT_BEGIN || slot_index > legacy::EQUIPMENT_END) && slot_index != legacy::SLOT_POWER_SOURCE) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index) +{ + /*if (slot_index < inventory::GeneralBegin || slot_index > inventory::GeneralEnd) + return false;*/ + if (slot_index < legacy::GENERAL_BEGIN || slot_index > legacy::GENERAL_END) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index) +{ + /*if (slot_index != inventory::slotCursor) + return false;*/ + if (slot_index != legacy::SLOT_CURSOR) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index) +{ + /*if ((slot_index != inventory::slotRange) && (slot_index != inventory::slotPrimary) && (slot_index != inventory::slotSecondary)) + return false;*/ + if ((slot_index != legacy::SLOT_RANGE) && (slot_index != legacy::SLOT_PRIMARY) && (slot_index != legacy::SLOT_SECONDARY)) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index) +{ + switch (slot_index) { + case inventory::slotHead: + case inventory::slotChest: + case inventory::slotArms: + case inventory::slotWrist1: + case inventory::slotHands: + case inventory::slotLegs: + case inventory::slotFeet: + case inventory::slotPrimary: + case inventory::slotSecondary: + return true; + default: + return false; + } +} + +bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index) +{ + switch (slot_index) { + case inventory::slotHead: + case inventory::slotChest: + case inventory::slotArms: + case inventory::slotWrist1: + case inventory::slotHands: + case inventory::slotLegs: + case inventory::slotFeet: + return true; + default: + return false; + } +} + +bool EQEmu::InventorySlot::IsEquipmentSlot() const +{ + if (!_typeless && (_type_index != inventory::typePossessions)) + return false; + + if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + return false; + + return IsEquipmentIndex(_slot_index); +} + +bool EQEmu::InventorySlot::IsGeneralSlot() const +{ + if (!_typeless && (_type_index != inventory::typePossessions)) + return false; + + if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + return false; + + return IsGeneralIndex(_socket_index); +} + +bool EQEmu::InventorySlot::IsCursorSlot() const +{ + if (!_typeless && (_type_index != inventory::typePossessions)) + return false; + + if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + return false; + + return IsCursorIndex(_slot_index); +} + +bool EQEmu::InventorySlot::IsWeaponSlot() const +{ + if (!_typeless && (_type_index != inventory::typePossessions)) + return false; + + if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + return false; + + return IsWeaponIndex(_slot_index); +} + +bool EQEmu::InventorySlot::IsTextureSlot() const +{ + if (!_typeless && (_type_index != inventory::typePossessions)) + return false; + + if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + return false; + + return IsTextureIndex(_slot_index); +} + +bool EQEmu::InventorySlot::IsTintableSlot() const +{ + if (!_typeless && (_type_index != inventory::typePossessions)) + return false; + + if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) + return false; + + return IsTintableIndex(_slot_index); +} + +bool EQEmu::InventorySlot::IsSlot() const +{ + if (!_typeless && (_type_index == inventory::typeInvalid)) + return false; + if (_slot_index == inventory::slotInvalid) + return false; + if (_container_index != inventory::containerInvalid) + return false; + if (_socket_index != inventory::socketInvalid) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsSlotSocket() const +{ + if (!_typeless && (_type_index == inventory::typeInvalid)) + return false; + if (_slot_index == inventory::slotInvalid) + return false; + if (_container_index != inventory::containerInvalid) + return false; + if (_socket_index == inventory::socketInvalid) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsContainer() const +{ + if (!_typeless && (_type_index == inventory::typeInvalid)) + return false; + if (_slot_index == inventory::slotInvalid) + return false; + if (_container_index == inventory::containerInvalid) + return false; + if (_socket_index != inventory::socketInvalid) + return false; + + return true; +} + +bool EQEmu::InventorySlot::IsContainerSocket() const +{ + if (!_typeless && (_type_index == inventory::typeInvalid)) + return false; + if (_slot_index == inventory::slotInvalid) + return false; + if (_container_index == inventory::containerInvalid) + return false; + if (_socket_index == inventory::socketInvalid) + return false; + + return true; +} + +EQEmu::InventorySlot EQEmu::InventorySlot::ToTopOwner() const +{ + return InventorySlot(_type_index, _slot_index); +} + +EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const +{ + if (IsSlot() || IsSlotSocket() || IsContainer()) + return InventorySlot(_type_index, _slot_index); + + if (IsContainerSocket()) + return InventorySlot(_type_index, _slot_index, _container_index); + + return InventorySlot(); +} + +const std::string EQEmu::InventorySlot::ToString() const +{ + return StringFormat("(%i%s, %i, %i, %i)", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index); +} + +const std::string EQEmu::InventorySlot::ToName() const +{ + return StringFormat("InventorySlot - _type_index: %i%s, _slot_index: %i, _container_index: %i, _socket_index: %i", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index); +} + +void EQEmu::InventorySlot::SetInvalidSlot() +{ + _type_index = inventory::typeInvalid; + _slot_index = inventory::slotInvalid; + _container_index = inventory::containerInvalid; + _socket_index = inventory::socketInvalid; +} + +//bool EQEmu::InventorySlot::IsBonusIndex(int16 slot_index) +//{ +// if ((slot_index >= inventory::EquipmentBegin) && (slot_index <= inventory::EquipmentEnd) && (slot_index != inventory::slotAmmo)) +// return true; +// +// return false; +//} + +//bool EQEmu::InventorySlot::IsBonusSlot() const +//{ +// if ((_type_index != inventory::typePossessions) || (_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid)) +// return false; +// +// return IsBonusIndex(_slot_index); +//} + +bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQEmu::InventorySlot& rhs) +{ + if (lhs.SlotIndex() < rhs.SlotIndex()) + return true; + + if ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() < rhs.ContainerIndex())) + return true; + + if ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() < rhs.SocketIndex())) + return true; + + return false; +} + +bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const +{ + if (Typeless() || rhs.Typeless()) + return inventory_slot_typeless_lessthan(*this, rhs); + + if (TypeIndex() < rhs.TypeIndex()) + return true; + + if ((TypeIndex() == rhs.TypeIndex()) && (SlotIndex() < rhs.SlotIndex())) + return true; + + if ((TypeIndex() == rhs.TypeIndex()) && (SlotIndex() == rhs.SlotIndex()) && (ContainerIndex() < rhs.ContainerIndex())) + return true; + + if ((TypeIndex() == rhs.TypeIndex()) && (SlotIndex() == rhs.SlotIndex()) && (ContainerIndex() == rhs.ContainerIndex()) && (SocketIndex() < rhs.SocketIndex())) + return true; + + return false; +} + +bool EQEmu::operator==(const InventorySlot& lhs, const InventorySlot& rhs) +{ + if (lhs.Typeless() || rhs.Typeless()) + return ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex())); + + return ((lhs.TypeIndex() == rhs.TypeIndex()) && (lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex())); +} diff --git a/common/inventory_slot.h b/common/inventory_slot.h new file mode 100644 index 000000000..695282e34 --- /dev/null +++ b/common/inventory_slot.h @@ -0,0 +1,133 @@ +/* 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_INVENTORY_SLOT +#define COMMON_INVENTORY_SLOT + +#include "emu_constants.h" + + +namespace EQEmu +{ + class InventorySlot; + + namespace inventory { + int8 ConvertEquipmentIndexToTextureIndex(int16 slot_index); + int8 ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot); + int16 ConvertTextureIndexToEquipmentIndex(int8 texture_index); + } + + class InventorySlot { + public: + InventorySlot() : _type_index(inventory::typeInvalid), _slot_index(inventory::slotInvalid), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { } + InventorySlot(int16 type_index) : _type_index(type_index), _slot_index(inventory::slotInvalid), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { } + InventorySlot(int16 type_index, int16 parent_index) : _type_index(type_index), _slot_index(parent_index), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { } + InventorySlot(int16 type_index, int16 parent_index, int16 bag_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(inventory::socketInvalid), _typeless(false) { } + InventorySlot(int16 type_index, int16 parent_index, int16 bag_index, int16 aug_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(aug_index), _typeless(false) { } + InventorySlot(const InventorySlot& r) : _type_index(r._type_index), _slot_index(r._slot_index), _container_index(r._container_index), _socket_index(r._socket_index), _typeless(r._typeless) { } + InventorySlot(int16 type_index, const InventorySlot& r) : _type_index(type_index), _slot_index(r._slot_index), _container_index(r._container_index), _socket_index(r._socket_index), _typeless(false) { } + + inline int16 TypeIndex() const { return _type_index; } + inline int16 SlotIndex() const { return _slot_index; } + inline int16 ContainerIndex() const { return _container_index; } + inline int16 SocketIndex() const { return _socket_index; } + + bool Typeless() const { return _typeless; } + + bool IsValidSlot() const; + bool IsDeleteSlot() const; + + static bool IsEquipmentIndex(int16 slot_index); + static bool IsGeneralIndex(int16 slot_index); + static bool IsCursorIndex(int16 slot_index); + static bool IsWeaponIndex(int16 slot_index); + static bool IsTextureIndex(int16 slot_index); + static bool IsTintableIndex(int16 slot_index); + + bool IsEquipmentSlot() const; + bool IsGeneralSlot() const; + bool IsCursorSlot() const; + bool IsWeaponSlot() const; + bool IsTextureSlot() const; + bool IsTintableSlot() const; + + bool IsSlot() const; + bool IsSlotSocket() const; + bool IsContainer() const; + bool IsContainerSocket() const; + + InventorySlot ToTopOwner() const; + InventorySlot ToOwner() const; + + const std::string ToString() const; + const std::string ToName() const; + + bool IsTypeIndex(int16 type_index) const { return (_type_index == type_index); } + bool IsSlotIndex(int16 slot_index) const { return (_slot_index == slot_index); } + bool IsContainerIndex(int16 container_index) const { return (_container_index == container_index); } + bool IsSocketIndex(int16 socket_index) const { return (_socket_index == socket_index); } + + void SetType(int16 type_index) { _type_index = type_index; } + void SetSlot(int16 slot_index) { _slot_index = slot_index; } + void SetContainer(int16 container_index) { _container_index = container_index; } + void SetSocket(int16 socket_index) { _socket_index = socket_index; } + + void SetInvalidSlot(); + + void SetTypeInvalid() { _type_index = inventory::typeInvalid; } + void SetSlotInvalid() { _slot_index = inventory::slotInvalid; } + void SetContainerInvalid() { _container_index = inventory::containerInvalid; } + void SetSocketInvalid() { _socket_index = inventory::socketInvalid; } + + void SetTypeBegin() { _type_index = inventory::typeBegin; } + void SetSlotBegin() { _slot_index = inventory::slotBegin; } + void SetContainerBegin() { _container_index = inventory::containerBegin; } + void SetSocketBegin() { _socket_index = inventory::socketBegin; } + + void IncrementType() { ++_type_index; } + void IncrementSlot() { ++_slot_index; } + void IncrementContainer() { ++_container_index; } + void IncrementSocket() { ++_socket_index; } + + void SetTypeless() { _typeless = true; } + void ClearTypeless() { _typeless = false; } + + // these two methods should really check for all bonus-valid slots..currently checks for equipment only (rework needed) + //static bool IsBonusIndex(int16 slot_index); + //bool IsBonusSlot() const; + + bool operator<(const InventorySlot& rhs) const; + + private: + int16 _type_index; + //int16 _unknown2; // not implemented + int16 _slot_index; + int16 _container_index; + int16 _socket_index; + //int16 _unknown1; // not implemented + + bool _typeless; + }; + + bool operator==(const InventorySlot& lhs, const InventorySlot& rhs); + bool operator!=(const InventorySlot& lhs, const InventorySlot& rhs) { return (!(lhs == rhs)); } + +} /*EQEmu*/ + +#endif /*COMMON_INVENTORY_SLOT*/ diff --git a/common/item_data.h b/common/item_data.h index ce3eccefa..14aa368c2 100644 --- a/common/item_data.h +++ b/common/item_data.h @@ -464,9 +464,9 @@ namespace EQEmu int32 FactionAmt4; // Faction Amt 4 char CharmFile[32]; // ? uint32 AugType; - uint8 AugSlotType[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Type - uint8 AugSlotVisible[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Visible - uint8 AugSlotUnk2[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related + uint8 AugSlotType[inventory::SocketCount]; // RoF: Augment Slot 1-6 Type + uint8 AugSlotVisible[inventory::SocketCount]; // RoF: Augment Slot 1-6 Visible + uint8 AugSlotUnk2[inventory::SocketCount]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related uint32 LDoNTheme; uint32 LDoNPrice; uint32 LDoNSold; diff --git a/common/item_instance.cpp b/common/item_instance.cpp index c8beddd3c..fbe2af543 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -158,7 +158,7 @@ EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const EQEmu::ItemInstance* result = nullptr; // Cursor - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { // Cursor slot result = m_cursor.peek_front(); } @@ -180,7 +180,7 @@ EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const result = _GetItem(m_inv, slot_id); } else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || - (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) || (slot_id == EQEmu::legacy::SlotPowerSource)) { + (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { // Equippable slots (on body) result = _GetItem(m_worn, slot_id); } @@ -250,7 +250,7 @@ int16 Inventory::PutItem(int16 slot_id, const EQEmu::ItemInstance& inst) int16 Inventory::PushCursor(const EQEmu::ItemInstance& inst) { m_cursor.push(inst.Clone()); - return EQEmu::legacy::SlotCursor; + return EQEmu::inventory::slotCursor; } EQEmu::ItemInstance* Inventory::GetCursorItem() @@ -316,7 +316,7 @@ bool Inventory::CheckNoDrop(int16 slot_id) { if (!inst) return false; if (!inst->GetItem()->NoDrop) return true; if (inst->GetItem()->ItemClass == 1) { - for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { + for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { EQEmu::ItemInstance* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); if (bagitem && !bagitem->GetItem()->NoDrop) return true; @@ -331,10 +331,10 @@ EQEmu::ItemInstance* Inventory::PopItem(int16 slot_id) { EQEmu::ItemInstance* p = nullptr; - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { p = m_cursor.pop(); } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::legacy::SlotPowerSource)) { + else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { p = m_worn[slot_id]; m_worn.erase(slot_id); } @@ -390,9 +390,9 @@ bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity } if (InvItem && InvItem->IsClassBag()) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); + int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = SUB_INDEX_BEGIN; BagSlot < BagSize; BagSlot++) { + for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { InvItem = GetItem(BaseSlotID + BagSlot); @@ -434,11 +434,11 @@ bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity } else if (InvItem->IsClassBag() && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); + int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = SUB_INDEX_BEGIN; BagSlotGetItem()->BagSlots; uint8 j; - for (j = SUB_INDEX_BEGIN; jIsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... - for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { const EQEmu::ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); if (!sub_inst) @@ -717,7 +717,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst) { if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeQuiver) || !main_inst->IsClassBag()) continue; - for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return Inventory::CalcSlotId(free_slot, free_bag_slot); } @@ -732,7 +732,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst) { if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeBandolier) || !main_inst->IsClassBag()) continue; - for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return Inventory::CalcSlotId(free_slot, free_bag_slot); } @@ -754,7 +754,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst) { if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeBandolier) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver)) continue; - for (uint8 free_bag_slot = SUB_INDEX_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++free_bag_slot) { + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return Inventory::CalcSlotId(free_slot, free_bag_slot); } @@ -762,7 +762,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst) { } //return INVALID_INDEX; // everything else pushes to the cursor - return EQEmu::legacy::SlotCursor; + return EQEmu::inventory::slotCursor; } // Opposite of below: Get parent bag slot_id from a slot inside of bag @@ -775,19 +775,19 @@ int16 Inventory::CalcSlotId(int16 slot_id) { //else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range) if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - parent_slot_id = EQEmu::legacy::GENERAL_BEGIN + (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) / EQEmu::legacy::ITEM_CONTAINER_SIZE; + parent_slot_id = EQEmu::legacy::GENERAL_BEGIN + (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { - parent_slot_id = EQEmu::legacy::SlotCursor; + parent_slot_id = EQEmu::inventory::slotCursor; } else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - parent_slot_id = EQEmu::legacy::BANK_BEGIN + (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) / EQEmu::legacy::ITEM_CONTAINER_SIZE; + parent_slot_id = EQEmu::legacy::BANK_BEGIN + (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - parent_slot_id = EQEmu::legacy::SHARED_BANK_BEGIN + (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) / EQEmu::legacy::ITEM_CONTAINER_SIZE; + parent_slot_id = EQEmu::legacy::SHARED_BANK_BEGIN + (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - parent_slot_id = EQEmu::legacy::TRADE_BEGIN + (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) / EQEmu::legacy::ITEM_CONTAINER_SIZE; + parent_slot_id = EQEmu::legacy::TRADE_BEGIN + (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; } return parent_slot_id; @@ -800,20 +800,20 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { int16 slot_id = INVALID_INDEX; - if (bagslot_id == EQEmu::legacy::SlotCursor || bagslot_id == 8000) { + if (bagslot_id == EQEmu::inventory::slotCursor || bagslot_id == 8000) { slot_id = EQEmu::legacy::CURSOR_BAG_BEGIN + bagidx; } else if (bagslot_id >= EQEmu::legacy::GENERAL_BEGIN && bagslot_id <= EQEmu::legacy::GENERAL_END) { - slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::GENERAL_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE + bagidx; + slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::GENERAL_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; } else if (bagslot_id >= EQEmu::legacy::BANK_BEGIN && bagslot_id <= EQEmu::legacy::BANK_END) { - slot_id = EQEmu::legacy::BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE + bagidx; + slot_id = EQEmu::legacy::BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; } else if (bagslot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && bagslot_id <= EQEmu::legacy::SHARED_BANK_END) { - slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE + bagidx; + slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; } else if (bagslot_id >= EQEmu::legacy::TRADE_BEGIN && bagslot_id <= EQEmu::legacy::TRADE_END) { - slot_id = EQEmu::legacy::TRADE_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::TRADE_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE + bagidx; + slot_id = EQEmu::legacy::TRADE_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::TRADE_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; } return slot_id; @@ -827,19 +827,19 @@ uint8 Inventory::CalcBagIdx(int16 slot_id) { // index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - index = (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) % EQEmu::legacy::ITEM_CONTAINER_SIZE; + index = (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { index = (slot_id - EQEmu::legacy::CURSOR_BAG_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots } else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - index = (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) % EQEmu::legacy::ITEM_CONTAINER_SIZE; + index = (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - index = (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) % EQEmu::legacy::ITEM_CONTAINER_SIZE; + index = (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - index = (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) % EQEmu::legacy::ITEM_CONTAINER_SIZE; + index = (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; } else if (slot_id >= EQEmu::legacy::WORLD_BEGIN && slot_id <= EQEmu::legacy::WORLD_END) { index = (slot_id - EQEmu::legacy::WORLD_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots @@ -852,24 +852,24 @@ int16 Inventory::CalcSlotFromMaterial(uint8 material) { switch (material) { - case EQEmu::textures::TextureHead: - return EQEmu::legacy::SlotHead; - case EQEmu::textures::TextureChest: - return EQEmu::legacy::SlotChest; - case EQEmu::textures::TextureArms: - return EQEmu::legacy::SlotArms; - case EQEmu::textures::TextureWrist: - return EQEmu::legacy::SlotWrist1; // there's 2 bracers, only one bracer material - case EQEmu::textures::TextureHands: - return EQEmu::legacy::SlotHands; - case EQEmu::textures::TextureLegs: - return EQEmu::legacy::SlotLegs; - case EQEmu::textures::TextureFeet: - return EQEmu::legacy::SlotFeet; - case EQEmu::textures::TexturePrimary: - return EQEmu::legacy::SlotPrimary; - case EQEmu::textures::TextureSecondary: - return EQEmu::legacy::SlotSecondary; + case EQEmu::textures::armorHead: + return EQEmu::inventory::slotHead; + case EQEmu::textures::armorChest: + return EQEmu::inventory::slotChest; + case EQEmu::textures::armorArms: + return EQEmu::inventory::slotArms; + case EQEmu::textures::armorWrist: + return EQEmu::inventory::slotWrist1; // there's 2 bracers, only one bracer material + case EQEmu::textures::armorHands: + return EQEmu::inventory::slotHands; + case EQEmu::textures::armorLegs: + return EQEmu::inventory::slotLegs; + case EQEmu::textures::armorFeet: + return EQEmu::inventory::slotFeet; + case EQEmu::textures::weaponPrimary: + return EQEmu::inventory::slotPrimary; + case EQEmu::textures::weaponSecondary: + return EQEmu::inventory::slotSecondary; default: return INVALID_INDEX; } @@ -879,27 +879,27 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) { switch (equipslot) { - case EQEmu::legacy::SlotHead: - return EQEmu::textures::TextureHead; - case EQEmu::legacy::SlotChest: - return EQEmu::textures::TextureChest; - case EQEmu::legacy::SlotArms: - return EQEmu::textures::TextureArms; - case EQEmu::legacy::SlotWrist1: + case EQEmu::inventory::slotHead: + return EQEmu::textures::armorHead; + case EQEmu::inventory::slotChest: + return EQEmu::textures::armorChest; + case EQEmu::inventory::slotArms: + return EQEmu::textures::armorArms; + case EQEmu::inventory::slotWrist1: //case SLOT_BRACER02: // non-live behavior - return EQEmu::textures::TextureWrist; - case EQEmu::legacy::SlotHands: - return EQEmu::textures::TextureHands; - case EQEmu::legacy::SlotLegs: - return EQEmu::textures::TextureLegs; - case EQEmu::legacy::SlotFeet: - return EQEmu::textures::TextureFeet; - case EQEmu::legacy::SlotPrimary: - return EQEmu::textures::TexturePrimary; - case EQEmu::legacy::SlotSecondary: - return EQEmu::textures::TextureSecondary; + return EQEmu::textures::armorWrist; + case EQEmu::inventory::slotHands: + return EQEmu::textures::armorHands; + case EQEmu::inventory::slotLegs: + return EQEmu::textures::armorLegs; + case EQEmu::inventory::slotFeet: + return EQEmu::textures::armorFeet; + case EQEmu::inventory::slotPrimary: + return EQEmu::textures::weaponPrimary; + case EQEmu::inventory::slotSecondary: + return EQEmu::textures::weaponSecondary; default: - return EQEmu::textures::TextureInvalid; + return EQEmu::textures::materialInvalid; } } @@ -923,7 +923,7 @@ bool Inventory::CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQ bool Inventory::SupportsClickCasting(int16 slot_id) { // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range - if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::legacy::SlotPowerSource) + if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource) { return true; } @@ -938,7 +938,7 @@ bool Inventory::SupportsClickCasting(int16 slot_id) bool Inventory::SupportsPotionBeltCasting(int16 slot_id) { - if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::legacy::SlotPowerSource || (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END)) + if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource || (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END)) return true; return false; @@ -947,7 +947,7 @@ bool Inventory::SupportsPotionBeltCasting(int16 slot_id) // Test whether a given slot can support a container item bool Inventory::SupportsContainers(int16 slot_id) { - if ((slot_id == EQEmu::legacy::SlotCursor) || + if ((slot_id == EQEmu::inventory::slotCursor) || (slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END) || (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) || (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) || @@ -989,7 +989,7 @@ int Inventory::GetSlotByItemInst(EQEmu::ItemInstance *inst) { } if (m_cursor.peek_front() == inst) { - return EQEmu::legacy::SlotCursor; + return EQEmu::inventory::slotCursor; } return INVALID_INDEX; @@ -1000,8 +1000,8 @@ uint8 Inventory::FindBrightestLightType() uint8 brightest_light_type = 0; for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { - if ((iter->first < EQEmu::legacy::EQUIPMENT_BEGIN || iter->first > EQEmu::legacy::EQUIPMENT_END) && iter->first != EQEmu::legacy::SlotPowerSource) { continue; } - if (iter->first == EQEmu::legacy::SlotAmmo) { continue; } + if ((iter->first < EQEmu::legacy::EQUIPMENT_BEGIN || iter->first > EQEmu::legacy::EQUIPMENT_END) && iter->first != EQEmu::inventory::slotPowerSource) { continue; } + if (iter->first == EQEmu::inventory::slotAmmo) { continue; } auto inst = iter->second; if (inst == nullptr) { continue; } @@ -1145,13 +1145,13 @@ int16 Inventory::_PutItem(int16 slot_id, EQEmu::ItemInstance* inst) int16 result = INVALID_INDEX; int16 parentSlot = INVALID_INDEX; - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { // Replace current item on cursor, if exists m_cursor.pop(); // no memory delete, clients of this function know what they are doing m_cursor.push_front(inst); result = slot_id; } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::legacy::SlotPowerSource)) { + else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { m_worn[slot_id] = inst; result = slot_id; } @@ -1209,7 +1209,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 return iter->first; } - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) return EQEmu::legacy::SLOT_AUGMENT; } @@ -1226,7 +1226,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 return Inventory::CalcSlotId(iter->first, bag_iter->first); } - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) return EQEmu::legacy::SLOT_AUGMENT; } @@ -1254,10 +1254,10 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) if (inst->GetID() == item_id) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return EQEmu::legacy::SlotCursor; + return EQEmu::inventory::slotCursor; } - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) return EQEmu::legacy::SLOT_AUGMENT; } @@ -1271,10 +1271,10 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) if (bag_inst->GetID() == item_id) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(EQEmu::legacy::SlotCursor, bag_iter->first); + return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); } - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) return EQEmu::legacy::SLOT_AUGMENT; } @@ -1331,7 +1331,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return EQEmu::legacy::SlotCursor; + return EQEmu::inventory::slotCursor; } if (!inst->IsClassBag()) { continue; } @@ -1343,7 +1343,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(EQEmu::legacy::SlotCursor, bag_iter->first); + return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); } } @@ -1363,7 +1363,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& buck if (inst->GetItem()->LoreGroup == loregroup) return iter->first; - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { auto aug_inst = inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1380,7 +1380,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& buck if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(iter->first, bag_iter->first); - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { auto aug_inst = bag_inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1401,9 +1401,9 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) if (inst == nullptr) { continue; } if (inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SlotCursor; + return EQEmu::inventory::slotCursor; - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { auto aug_inst = inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1418,9 +1418,9 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) if (bag_inst == nullptr) { continue; } if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(EQEmu::legacy::SlotCursor, bag_iter->first); + return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { auto aug_inst = bag_inst->GetAugment(index); if (aug_inst == nullptr) { continue; } @@ -1657,7 +1657,7 @@ bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const // another "shouldn't do" fix..will be fixed in future updates (requires code and database work) int16 use_slot = INVALID_INDEX; - if (slot_id == EQEmu::legacy::SlotPowerSource) { use_slot = EQEmu::legacy::SlotGeneral1; } + if (slot_id == EQEmu::inventory::slotPowerSource) { use_slot = EQEmu::inventory::slotGeneral1; } if ((uint16)slot_id <= EQEmu::legacy::EQUIPMENT_END) { use_slot = slot_id; } if (use_slot != INVALID_INDEX) { @@ -1673,8 +1673,8 @@ bool EQEmu::ItemInstance::IsAugmentable() const if (!m_item) return false; - for (int index = 0; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { - if (m_item->AugSlotType[index] != NO_ITEM) + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + if (m_item->AugSlotType[index] != 0) return true; } @@ -1688,7 +1688,7 @@ bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const { return false; int index = EQEmu::legacy::EQUIPMENT_BEGIN; - for (; index <= EQEmu::legacy::SlotGeneral1; ++index) { // MainGeneral1 should be EQEmu::legacy::EQUIPMENT_END + for (; index <= EQEmu::inventory::slotGeneral1; ++index) { // MainGeneral1 should be EQEmu::legacy::EQUIPMENT_END if (m_item->Slots & (1 << index)) { if (aug_wear_slots & (1 << index)) break; @@ -1703,14 +1703,14 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const if (!m_item || !m_item->IsClassCommon()) return INVALID_INDEX; - int index = AUG_INDEX_BEGIN; - for (; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + int index = EQEmu::inventory::socketBegin; + for (; index < EQEmu::inventory::SocketCount; ++index) { if (GetItem(index)) { continue; } if (augtype == -1 || (m_item->AugSlotType[index] && ((1 << (m_item->AugSlotType[index] - 1)) & augtype))) break; } - return (index < EQEmu::legacy::ITEM_COMMON_SIZE) ? index : INVALID_INDEX; + return (index < EQEmu::inventory::SocketCount) ? index : INVALID_INDEX; } bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const @@ -1741,7 +1741,7 @@ uint32 EQEmu::ItemInstance::GetItemID(uint8 slot) const if (item) return item->GetID(); - return NO_ITEM; + return 0; } void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst) @@ -1853,7 +1853,7 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const return INVALID_INDEX; uint8 slots = m_item->BagSlots, i; - for (i = SUB_INDEX_BEGIN; i < slots; i++) { + for (i = EQEmu::inventory::containerBegin; i < slots; i++) { if (!GetItem(i)) break; } @@ -1870,7 +1870,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const if (m_item && !m_item->IsClassBag()) { return item_count; } - for (int index = SUB_INDEX_BEGIN; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } + for (int index = EQEmu::inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } return item_count; } @@ -1880,7 +1880,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer() if (!m_item || !m_item->IsClassBag()) return false; - for (int index = SUB_INDEX_BEGIN; index < m_item->BagSlots; ++index) { + for (int index = EQEmu::inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) return true; } @@ -1902,7 +1902,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (ornamentationAugtype == 0) { return nullptr; } - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) { @@ -2020,7 +2020,7 @@ bool EQEmu::ItemInstance::CanTransform(const EQEmu::ItemData *ItemToTry, const E uint32 EQEmu::ItemInstance::GetAugmentItemID(uint8 slot) const { if (!m_item || !m_item->IsClassCommon()) - return NO_ITEM; + return 0; return GetItemID(slot); } @@ -2036,7 +2036,7 @@ void EQEmu::ItemInstance::PutAugment(uint8 slot, const ItemInstance& augment) void EQEmu::ItemInstance::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) { - if (item_id == NO_ITEM) { return; } + if (item_id == 0) { return; } if (db == nullptr) { return; /* TODO: add log message for nullptr */ } const ItemInstance* aug = db->CreateItem(item_id); @@ -2069,7 +2069,7 @@ bool EQEmu::ItemInstance::IsAugmented() if (!m_item || !m_item->IsClassCommon()) return false; - for (int index = AUG_INDEX_BEGIN; index < EQEmu::legacy::ITEM_COMMON_SIZE; ++index) { + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { if (GetAugmentItemID(index)) return true; } @@ -2197,8 +2197,8 @@ bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const { if (!m_item) { return false; } else if (Inventory::SupportsContainers(slot_id)) { return true; } else if (m_item->Slots & (1 << slot_id)) { return true; } - else if (slot_id == EQEmu::legacy::SlotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... - else if (slot_id != EQEmu::legacy::SlotPowerSource && slot_id > EQEmu::legacy::EQUIPMENT_END) { return true; } + else if (slot_id == EQEmu::inventory::slotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... + else if (slot_id != EQEmu::inventory::slotPowerSource && slot_id > EQEmu::legacy::EQUIPMENT_END) { return true; } else { return false; } } @@ -2350,7 +2350,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const if (item) { ac = item->AC; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) ac += GetAugment(i)->GetItemArmorClass(); } @@ -2392,7 +2392,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold } if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) GetAugment(i)->GetItemElementalDamage(magic, fire, cold, poison, disease, chromatic, prismatic, physical, corruption); } @@ -2409,7 +2409,7 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const return flag; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { if (GetAugment(i)) flag = GetAugment(i)->GetItemElementalFlag(); if (flag) @@ -2430,7 +2430,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const return damage; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { if (GetAugment(i)) damage = GetAugment(i)->GetItemElementalDamage(); if (damage) @@ -2449,7 +2449,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const level = item->RecLevel; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { int temp = 0; if (GetAugment(i)) { temp = GetAugment(i)->GetItemRecommendedLevel(); @@ -2471,7 +2471,7 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const level = item->ReqLevel; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { int temp = 0; if (GetAugment(i)) { temp = GetAugment(i)->GetItemRequiredLevel(); @@ -2493,7 +2493,7 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const damage = item->Damage; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemWeaponDamage(); } @@ -2509,7 +2509,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const damage = item->BackstabDmg; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBackstabDamage(); } @@ -2527,7 +2527,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const return body; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) { body = GetAugment(i)->GetItemBaneDamageBody(); if (body) @@ -2548,7 +2548,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const return race; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) { race = GetAugment(i)->GetItemBaneDamageRace(); if (race) @@ -2568,7 +2568,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) damage += item->BaneDmgAmt; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBaneDamageBody(against); } @@ -2585,7 +2585,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co damage += item->BaneDmgRaceAmt; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBaneDamageRace(against); } @@ -2601,7 +2601,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const return 1; if (augments) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i) && GetAugment(i)->GetItemMagical()) return 1; } @@ -2616,7 +2616,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const if (item) { hp = item->HP; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) hp += GetAugment(i)->GetItemHP(); } @@ -2630,7 +2630,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const if (item) { mana = item->Mana; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) mana += GetAugment(i)->GetItemMana(); } @@ -2644,7 +2644,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const if (item) { endur = item->Endur; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) endur += GetAugment(i)->GetItemEndur(); } @@ -2658,7 +2658,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const if (item) { atk = item->Attack; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) atk += GetAugment(i)->GetItemAttack(); } @@ -2672,7 +2672,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const if (item) { str = item->AStr; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) str += GetAugment(i)->GetItemStr(); } @@ -2686,7 +2686,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const if (item) { sta = item->ASta; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) sta += GetAugment(i)->GetItemSta(); } @@ -2700,7 +2700,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const if (item) { total = item->ADex; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemDex(); } @@ -2714,7 +2714,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const if (item) { total = item->AAgi; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemAgi(); } @@ -2728,7 +2728,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const if (item) { total = item->AInt; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemInt(); } @@ -2742,7 +2742,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const if (item) { total = item->AWis; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemWis(); } @@ -2756,7 +2756,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const if (item) { total = item->ACha; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCha(); } @@ -2770,7 +2770,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const if (item) { total = item->MR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemMR(); } @@ -2784,7 +2784,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const if (item) { total = item->FR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemFR(); } @@ -2798,7 +2798,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const if (item) { total = item->CR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCR(); } @@ -2812,7 +2812,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const if (item) { total = item->PR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemPR(); } @@ -2826,7 +2826,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const if (item) { total = item->DR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemDR(); } @@ -2840,7 +2840,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const if (item) { total = item->SVCorruption; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCorrup(); } @@ -2854,7 +2854,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const if (item) { total = item->HeroicStr; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicStr(); } @@ -2868,7 +2868,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const if (item) { total = item->HeroicSta; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicSta(); } @@ -2882,7 +2882,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const if (item) { total = item->HeroicDex; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicDex(); } @@ -2896,7 +2896,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const if (item) { total = item->HeroicAgi; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicAgi(); } @@ -2910,7 +2910,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const if (item) { total = item->HeroicInt; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicInt(); } @@ -2924,7 +2924,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const if (item) { total = item->HeroicWis; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicWis(); } @@ -2938,7 +2938,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const if (item) { total = item->HeroicCha; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCha(); } @@ -2952,7 +2952,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const if (item) { total = item->HeroicMR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicMR(); } @@ -2966,7 +2966,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const if (item) { total = item->HeroicFR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicFR(); } @@ -2980,7 +2980,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const if (item) { total = item->HeroicCR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCR(); } @@ -2994,7 +2994,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const if (item) { total = item->HeroicPR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicPR(); } @@ -3008,7 +3008,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const if (item) { total = item->HeroicDR; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicDR(); } @@ -3022,7 +3022,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const if (item) { total = item->HeroicSVCorrup; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCorrup(); } @@ -3036,7 +3036,7 @@ int EQEmu::ItemInstance::GetItemHaste(bool augments) const if (item) { total = item->Haste; if (augments) - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) if (GetAugment(i)) { int temp = GetAugment(i)->GetItemHaste(); if (temp > total) diff --git a/common/item_instance.h b/common/item_instance.h index 29523c1b1..7fbf03cd9 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -313,7 +313,7 @@ namespace EQEmu bool AvailableWearSlot(uint32 aug_wear_slots) const; int8 AvailableAugmentSlot(int32 augtype) const; bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; - inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); } + inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : 0); } inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); } @@ -353,8 +353,8 @@ namespace EQEmu bool IsAmmo() const; // Accessors - const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); } - const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); } + const uint32 GetID() const { return ((m_item) ? m_item->ID : 0); } + const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : 0); } const ItemData* GetItem() const; const ItemData* GetUnscaledItem() const; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index a6fcae35c..d3b4456b7 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2079,7 +2079,7 @@ namespace RoF outapp->WriteUInt32(22); // Equipment count - for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) + for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { outapp->WriteUInt32(emu->item_material.Slot[r].Material); outapp->WriteUInt32(0); @@ -2099,9 +2099,9 @@ namespace RoF outapp->WriteUInt32(0); } - outapp->WriteUInt32(EQEmu::textures::TextureCount); // Equipment2 count + outapp->WriteUInt32(EQEmu::textures::materialCount); // Equipment2 count - for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) + for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { outapp->WriteUInt32(0); outapp->WriteUInt32(0); @@ -2110,7 +2110,7 @@ namespace RoF outapp->WriteUInt32(0); } - outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint Count + outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint Count for (int r = 0; r < 7; r++) { @@ -2120,7 +2120,7 @@ namespace RoF outapp->WriteUInt32(0); outapp->WriteUInt32(0); - outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint2 Count + outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint2 Count for (int r = 0; r < 7; r++) { @@ -3059,12 +3059,12 @@ namespace RoF eq_cse->Gender = emu_cse->Gender; eq_cse->Face = emu_cse->Face; - for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) { + for (int equip_index = 0; equip_index < EQEmu::textures::materialCount; equip_index++) { eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; - eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; - eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel; - eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; + eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroicModel; + eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Unknown2; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -4096,7 +4096,7 @@ namespace RoF if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k) + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k) { { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color); @@ -4105,15 +4105,15 @@ namespace RoF structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer; - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { Equipment[k].Material = emu->equipment.Slot[k].Material; Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1; - Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial; - Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroForgeModel; - Equipment[k].Material2 = emu->equipment.Slot[k].Material2; + Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; + Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroicModel; + Equipment[k].Material2 = emu->equipment.Slot[k].Unknown2; } - Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount); + Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount); } else { @@ -4829,10 +4829,9 @@ namespace RoF IN(item_id); int r; - for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { + for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { IN(augments[r]); } - // Max Augs is now 6, but no code to support that many yet IN(link_hash); IN(icon); @@ -5622,18 +5621,18 @@ namespace RoF ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { + for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1); + SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -5659,17 +5658,17 @@ namespace RoF uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // Main Inventory and Cursor + if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // Main Inventory and Cursor RoFSlot.Type = invtype::InvTypePossessions; RoFSlot.Slot = serverSlot; - if (serverSlot == EQEmu::legacy::SlotPowerSource) + if (serverSlot == EQEmu::inventory::slotPowerSource) RoFSlot.Slot = invslot::PossessionsPowerSource; - else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory RoFSlot.Slot += 3; - else if (serverSlot >= EQEmu::legacy::SlotAmmo) // (> 20) + else if (serverSlot >= EQEmu::inventory::slotAmmo) // (> 20) RoFSlot.Slot += 1; } @@ -5681,8 +5680,8 @@ namespace RoF else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341) 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); + RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::inventory::ContainerCount); if (RoFSlot.Slot >= invslot::PossessionsGeneral9) // (> 30) RoFSlot.Slot = invslot::PossessionsCursor; @@ -5699,8 +5698,8 @@ namespace RoF RoFSlot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount); } } @@ -5710,8 +5709,8 @@ namespace RoF RoFSlot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount); } } @@ -5721,8 +5720,8 @@ namespace RoF RoFSlot.Slot = TempSlot; if (TempSlot > 30) { - RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount); } /* @@ -5760,16 +5759,16 @@ namespace RoF uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // (< 52) + if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // (< 52) RoFSlot.Slot = serverSlot; - if (serverSlot == EQEmu::legacy::SlotPowerSource) + if (serverSlot == EQEmu::inventory::slotPowerSource) RoFSlot.Slot = invslot::PossessionsPowerSource; - else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory RoFSlot.Slot += 3; - else if (serverSlot >= EQEmu::legacy::SlotAmmo) // Ammo and Personl Inventory + else if (serverSlot >= EQEmu::inventory::slotAmmo) // Ammo and Personl Inventory RoFSlot.Slot += 1; /*else if (ServerSlot >= MainCursor) { // Cursor @@ -5782,8 +5781,8 @@ namespace RoF else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { TempSlot = serverSlot - 1; - RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2; - RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; + RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::inventory::ContainerCount); } Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown01); @@ -5803,7 +5802,7 @@ namespace RoF if (rofSlot.Type == invtype::InvTypePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) if (rofSlot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::legacy::SlotPowerSource; + TempSlot = EQEmu::inventory::slotPowerSource; else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rofSlot.Slot - 3; @@ -5825,8 +5824,8 @@ namespace RoF else // Worn Slots TempSlot = rofSlot.Slot; - if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; ServerSlot = TempSlot; } @@ -5834,8 +5833,8 @@ namespace RoF else if (rofSlot.Type == invtype::InvTypeBank) { TempSlot = EQEmu::legacy::BANK_BEGIN; - if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) - TempSlot += ((rofSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) + TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; else TempSlot += rofSlot.Slot; @@ -5846,8 +5845,8 @@ namespace RoF else if (rofSlot.Type == invtype::InvTypeSharedBank) { TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN; - if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) - TempSlot += ((rofSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) + TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; else TempSlot += rofSlot.Slot; @@ -5858,10 +5857,10 @@ namespace RoF else if (rofSlot.Type == invtype::InvTypeTrade) { TempSlot = EQEmu::legacy::TRADE_BEGIN; - if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) - TempSlot += ((rofSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) + TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; // OLD CODE: - //TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::legacy::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot; + //TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::inventory::ContainerCount) + RoFSlot.SubSlot; else TempSlot += rofSlot.Slot; @@ -5872,7 +5871,7 @@ namespace RoF else if (rofSlot.Type == invtype::InvTypeWorld) { TempSlot = EQEmu::legacy::WORLD_BEGIN; - if (rofSlot.Slot >= SUB_INDEX_BEGIN) + if (rofSlot.Slot >= EQEmu::inventory::containerBegin) TempSlot += rofSlot.Slot; ServerSlot = TempSlot; @@ -5903,7 +5902,7 @@ namespace RoF if (rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33) if (rofSlot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::legacy::SlotPowerSource; + TempSlot = EQEmu::inventory::slotPowerSource; else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rofSlot.Slot - 3; @@ -5920,8 +5919,8 @@ namespace RoF else TempSlot = rofSlot.Slot; - if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1; + if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1; ServerSlot = TempSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 47be172a2..676f4c89f 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2164,7 +2164,7 @@ namespace RoF2 outapp->WriteUInt32(22); // Equipment count - for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) + for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { outapp->WriteUInt32(emu->item_material.Slot[r].Material); outapp->WriteUInt32(0); @@ -2184,9 +2184,9 @@ namespace RoF2 outapp->WriteUInt32(0); } - outapp->WriteUInt32(EQEmu::textures::TextureCount); // Equipment2 count + outapp->WriteUInt32(EQEmu::textures::materialCount); // Equipment2 count - for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) + for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { outapp->WriteUInt32(0); outapp->WriteUInt32(0); @@ -2195,7 +2195,7 @@ namespace RoF2 outapp->WriteUInt32(0); } - outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint Count + outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint Count for (int r = 0; r < 7; r++) { @@ -2205,7 +2205,7 @@ namespace RoF2 outapp->WriteUInt32(0); outapp->WriteUInt32(0); - outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint2 Count + outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint2 Count for (int r = 0; r < 7; r++) { @@ -3154,12 +3154,12 @@ namespace RoF2 eq_cse->Gender = emu_cse->Gender; eq_cse->Face = emu_cse->Face; - for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) { + for (int equip_index = 0; equip_index < EQEmu::textures::materialCount; equip_index++) { eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; - eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; - eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel; - eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; + eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroicModel; + eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Unknown2; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -4321,7 +4321,7 @@ namespace RoF2 if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k) + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k) { { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color); @@ -4330,15 +4330,15 @@ namespace RoF2 structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer; - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { Equipment[k].Material = emu->equipment.Slot[k].Material; Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1; - Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial; - Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroForgeModel; - Equipment[k].Material2 = emu->equipment.Slot[k].Material2; + Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; + Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroicModel; + Equipment[k].Material2 = emu->equipment.Slot[k].Unknown2; } - Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount); + Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount); } else { @@ -5066,7 +5066,7 @@ namespace RoF2 IN(item_id); int r; - for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { + for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { IN(augments[r]); } IN(link_hash); @@ -5922,18 +5922,18 @@ namespace RoF2 ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { + for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1); + SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -5959,7 +5959,7 @@ namespace RoF2 uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // Main Inventory and Cursor + if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // Main Inventory and Cursor if (PacketType == ItemPacketLoot) { RoF2Slot.Type = invtype::InvTypeCorpse; @@ -5971,13 +5971,13 @@ namespace RoF2 RoF2Slot.Slot = serverSlot; } - if (serverSlot == EQEmu::legacy::SlotPowerSource) + if (serverSlot == EQEmu::inventory::slotPowerSource) RoF2Slot.Slot = invslot::PossessionsPowerSource; - else if (serverSlot >= EQEmu::legacy::SlotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::inventory::slotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory RoF2Slot.Slot += 3; - else if (serverSlot >= EQEmu::legacy::SlotAmmo) // (> 20) + else if (serverSlot >= EQEmu::inventory::slotAmmo) // (> 20) RoF2Slot.Slot += 1; } @@ -5989,8 +5989,8 @@ namespace RoF2 else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341) 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); + RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::inventory::ContainerCount); if (RoF2Slot.Slot >= invslot::PossessionsGeneral9) // (> 30) RoF2Slot.Slot = invslot::PossessionsCursor; @@ -6007,8 +6007,8 @@ namespace RoF2 RoF2Slot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount); } } @@ -6018,8 +6018,8 @@ namespace RoF2 RoF2Slot.Slot = TempSlot; if (TempSlot > 30) { // (> 30) - RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount); } } @@ -6029,8 +6029,8 @@ namespace RoF2 RoF2Slot.Slot = TempSlot; if (TempSlot > 30) { - RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount); } /* @@ -6068,16 +6068,16 @@ namespace RoF2 uint32 TempSlot = 0; - if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // (< 52) + if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // (< 52) RoF2Slot.Slot = serverSlot; - if (serverSlot == EQEmu::legacy::SlotPowerSource) + if (serverSlot == EQEmu::inventory::slotPowerSource) RoF2Slot.Slot = invslot::PossessionsPowerSource; - else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory + else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory RoF2Slot.Slot += 3; - else if (serverSlot >= EQEmu::legacy::SlotAmmo) // Ammo and Personl Inventory + else if (serverSlot >= EQEmu::inventory::slotAmmo) // Ammo and Personl Inventory RoF2Slot.Slot += 1; /*else if (ServerSlot >= MainCursor) { // Cursor @@ -6090,8 +6090,8 @@ namespace RoF2 else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { TempSlot = serverSlot - 1; - RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2; - RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE); + RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2; + RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::inventory::ContainerCount); } Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown01); @@ -6111,7 +6111,7 @@ namespace RoF2 if (rof2Slot.Type == invtype::InvTypePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51) if (rof2Slot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::legacy::SlotPowerSource; + TempSlot = EQEmu::inventory::slotPowerSource; else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rof2Slot.Slot - 3; @@ -6133,8 +6133,8 @@ namespace RoF2 else // Worn Slots TempSlot = rof2Slot.Slot; - if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; ServerSlot = TempSlot; } @@ -6142,8 +6142,8 @@ namespace RoF2 else if (rof2Slot.Type == invtype::InvTypeBank) { TempSlot = EQEmu::legacy::BANK_BEGIN; - if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) - TempSlot += ((rof2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) + TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; else TempSlot += rof2Slot.Slot; @@ -6154,8 +6154,8 @@ namespace RoF2 else if (rof2Slot.Type == invtype::InvTypeSharedBank) { TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN; - if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) - TempSlot += ((rof2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) + TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; else TempSlot += rof2Slot.Slot; @@ -6166,8 +6166,8 @@ namespace RoF2 else if (rof2Slot.Type == invtype::InvTypeTrade) { TempSlot = EQEmu::legacy::TRADE_BEGIN; - if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) - TempSlot += ((rof2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) + TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; // OLD CODE: //TempSlot += 100 + (RoF2Slot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot; @@ -6180,7 +6180,7 @@ namespace RoF2 else if (rof2Slot.Type == invtype::InvTypeWorld) { TempSlot = EQEmu::legacy::WORLD_BEGIN; - if (rof2Slot.Slot >= SUB_INDEX_BEGIN) + if (rof2Slot.Slot >= EQEmu::inventory::containerBegin) TempSlot += rof2Slot.Slot; ServerSlot = TempSlot; @@ -6215,7 +6215,7 @@ namespace RoF2 if (rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33) if (rof2Slot.Slot == invslot::PossessionsPowerSource) - TempSlot = EQEmu::legacy::SlotPowerSource; + TempSlot = EQEmu::inventory::slotPowerSource; else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory TempSlot = rof2Slot.Slot - 3; @@ -6232,8 +6232,8 @@ namespace RoF2 else TempSlot = rof2Slot.Slot; - if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots - TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1; + if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots + TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1; ServerSlot = TempSlot; } diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 12f467a71..850df8ddf 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -190,7 +190,7 @@ struct TintProfile Tint_Struct Primary; Tint_Struct Secondary; }; - Tint_Struct Slot[EQEmu::textures::TextureCount]; + Tint_Struct Slot[EQEmu::textures::materialCount]; }; }; @@ -1082,7 +1082,7 @@ union /*00184*/ Texture_Struct equipment[22]; // Total Slots }; /*00624*/ uint32 equip2_count; // Seen 9 -/*00628*/ Texture_Struct equipment2[EQEmu::textures::TextureCount]; // Appears to be Visible slots, but all 0s +/*00628*/ Texture_Struct equipment2[EQEmu::textures::materialCount]; // Appears to be Visible slots, but all 0s /*00808*/ uint32 tint_count; // Seen 9 /*00812*/ TintProfile item_tint; // RR GG BB 00 /*00848*/ uint32 tint_count2; // Seen 9 diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 3b6e01318..879afc1d4 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -190,7 +190,7 @@ struct TintProfile Tint_Struct Primary; Tint_Struct Secondary; }; - Tint_Struct Slot[EQEmu::textures::TextureCount]; + Tint_Struct Slot[EQEmu::textures::materialCount]; }; }; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 0e1a3fdcd..330f7ee20 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1558,7 +1558,7 @@ namespace SoD OUT(hairstyle); OUT(beard); // OUT(unknown00178[10]); - for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) { + for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material; eq->equipment.Slot[r].Unknown1 = 0; eq->equipment.Slot[r].EliteMaterial = 0; @@ -1998,10 +1998,10 @@ namespace SoD eq_cse->HairColor = emu_cse->HairColor; eq_cse->Face = emu_cse->Face; - for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) { + for (int equip_index = EQEmu::textures::textureBegin; equip_index < EQEmu::textures::materialCount; equip_index++) { eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; - eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -2568,7 +2568,7 @@ namespace SoD float SpawnSize = emu->size; if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))) { - PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount); + PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount); if (emu->size == 0) { @@ -2765,7 +2765,7 @@ namespace SoD if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k) + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k) { { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color); @@ -2792,13 +2792,13 @@ namespace SoD { structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer; - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { Equipment[k].Material = emu->equipment.Slot[k].Material; Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1; - Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial; + Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; } - Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount); + Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount); } if (strlen(emu->title)) { @@ -3869,18 +3869,18 @@ namespace SoD ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { + for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1); + SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -3898,7 +3898,7 @@ namespace SoD { uint32 SoDSlot = 0; - if (serverSlot >= EQEmu::legacy::SlotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots SoDSlot = serverSlot + 1; else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) SoDSlot = serverSlot + 11; @@ -3906,7 +3906,7 @@ namespace SoD SoDSlot = serverSlot + 1; 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) + else if (serverSlot == EQEmu::inventory::slotPowerSource) SoDSlot = invslot::PossessionsPowerSource; else SoDSlot = serverSlot; @@ -3932,7 +3932,7 @@ namespace SoD else if (sodSlot >= invbag::SharedBankBagsBegin && sodSlot <= invbag::SharedBankBagsEnd) ServerSlot = sodSlot - 1; else if (sodSlot == invslot::PossessionsPowerSource) - ServerSlot = EQEmu::legacy::SlotPowerSource; + ServerSlot = EQEmu::inventory::slotPowerSource; else ServerSlot = sodSlot; return ServerSlot; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index d4a4d49a3..cd76218e0 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -149,7 +149,7 @@ struct TintProfile Tint_Struct Primary; Tint_Struct Secondary; }; - Tint_Struct Slot[EQEmu::textures::TextureCount]; + Tint_Struct Slot[EQEmu::textures::materialCount]; }; }; @@ -178,7 +178,7 @@ struct TextureProfile Texture_Struct Primary; Texture_Struct Secondary; }; - Texture_Struct Slot[EQEmu::textures::TextureCount]; + Texture_Struct Slot[EQEmu::textures::materialCount]; }; TextureProfile(); @@ -195,7 +195,7 @@ struct CharacterSelectEntry_Struct /*0000*/ uint8 Beard; // /*0001*/ uint8 HairColor; // /*0000*/ uint8 Face; // -/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount]; +/*0000*/ CharSelectEquip Equip[EQEmu::textures::materialCount]; /*0000*/ uint32 PrimaryIDFile; // /*0000*/ uint32 SecondaryIDFile; // /*0000*/ uint8 Unknown15; // 0xff diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index b73e998aa..59e0edb5f 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1230,7 +1230,7 @@ namespace SoF OUT(hairstyle); OUT(beard); // OUT(unknown00178[10]); - for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) { + for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material; eq->equipment.Slot[r].Unknown1 = 0; eq->equipment.Slot[r].EliteMaterial = 0; @@ -1670,10 +1670,10 @@ namespace SoF eq_cse->HairColor = emu_cse->HairColor; eq_cse->Face = emu_cse->Face; - for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) { + for (int equip_index = EQEmu::textures::textureBegin; equip_index < EQEmu::textures::materialCount; equip_index++) { eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; - eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -2101,10 +2101,10 @@ namespace SoF eq->deity = emu->deity; eq->drakkin_heritage = emu->drakkin_heritage; eq->gender = emu->gender; - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material; eq->equipment.Slot[k].Unknown1 = emu->equipment.Slot[k].Unknown1; - eq->equipment.Slot[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial; + eq->equipment.Slot[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color; } eq->StandState = emu->StandState; @@ -2167,7 +2167,7 @@ namespace SoF strcpy(eq->name, emu->name); eq->petOwnerId = emu->petOwnerId; eq->pvp = 0; // 0 = non-pvp colored name, 1 = red pvp name - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color; } eq->anon = emu->anon; @@ -3237,18 +3237,18 @@ namespace SoF ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { + for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1); + SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -3266,7 +3266,7 @@ namespace SoF { uint32 SoFSlot = 0; - if (serverSlot >= EQEmu::legacy::SlotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots SoFSlot = serverSlot + 1; else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) SoFSlot = serverSlot + 11; @@ -3274,7 +3274,7 @@ namespace SoF SoFSlot = serverSlot + 1; 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) + else if (serverSlot == EQEmu::inventory::slotPowerSource) SoFSlot = invslot::PossessionsPowerSource; else SoFSlot = serverSlot; @@ -3301,7 +3301,7 @@ namespace SoF else if (sofSlot >= invbag::SharedBankBagsBegin && sofSlot <= invbag::SharedBankBagsEnd) ServerSlot = sofSlot - 1; else if (sofSlot == invslot::PossessionsPowerSource) - ServerSlot = EQEmu::legacy::SlotPowerSource; + ServerSlot = EQEmu::inventory::slotPowerSource; else ServerSlot = sofSlot; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 0981fd4ee..9be93d49f 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -149,7 +149,7 @@ struct TintProfile Tint_Struct Primary; Tint_Struct Secondary; }; - Tint_Struct Slot[EQEmu::textures::TextureCount]; + Tint_Struct Slot[EQEmu::textures::materialCount]; }; }; @@ -178,7 +178,7 @@ struct TextureProfile Texture_Struct Primary; Texture_Struct Secondary; }; - Texture_Struct Slot[EQEmu::textures::TextureCount]; + Texture_Struct Slot[EQEmu::textures::materialCount]; }; TextureProfile(); @@ -195,7 +195,7 @@ struct CharacterSelectEntry_Struct /*0000*/ uint8 Beard; // /*0001*/ uint8 HairColor; // /*0000*/ uint8 Face; // -/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount]; +/*0000*/ CharSelectEquip Equip[EQEmu::textures::materialCount]; /*0000*/ uint32 PrimaryIDFile; // /*0000*/ uint32 SecondaryIDFile; // /*0000*/ uint8 Unknown15; // 0xff diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 9b6459afb..286d09d1b 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -981,7 +981,7 @@ namespace Titanium OUT(hairstyle); OUT(beard); // OUT(unknown00178[10]); - for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) { + for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { OUT(item_material.Slot[r].Material); OUT(item_tint.Slot[r].Color); } @@ -1301,14 +1301,14 @@ namespace Titanium if (eq->Race[char_index] > 473) eq->Race[char_index] = 1; - for (int index = 0; index < EQEmu::textures::TextureCount; ++index) { + for (int index = 0; index < EQEmu::textures::materialCount; ++index) { eq->CS_Colors[char_index].Slot[index].Color = emu_cse->Equip[index].Color; } eq->BeardColor[char_index] = emu_cse->BeardColor; eq->HairStyle[char_index] = emu_cse->HairStyle; - for (int index = 0; index < EQEmu::textures::TextureCount; ++index) { + for (int index = 0; index < EQEmu::textures::materialCount; ++index) { eq->Equip[char_index].Slot[index].Material = emu_cse->Equip[index].Material; } @@ -1338,14 +1338,14 @@ namespace Titanium for (; char_index < 10; ++char_index) { eq->Race[char_index] = 0; - for (int index = 0; index < EQEmu::textures::TextureCount; ++index) { + for (int index = 0; index < EQEmu::textures::materialCount; ++index) { eq->CS_Colors[char_index].Slot[index].Color = 0; } eq->BeardColor[char_index] = 0; eq->HairStyle[char_index] = 0; - for (int index = 0; index < EQEmu::textures::TextureCount; ++index) { + for (int index = 0; index < EQEmu::textures::materialCount; ++index) { eq->Equip[char_index].Slot[index].Material = 0; } @@ -1677,7 +1677,7 @@ namespace Titanium eq->petOwnerId = emu->petOwnerId; eq->guildrank = emu->guildrank; // eq->unknown0194[3] = emu->unknown0194[3]; - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material; eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color; } @@ -2437,7 +2437,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 < invbag::ItemBagSize; ++index) { + for (int index = EQEmu::inventory::containerBegin; index < invbag::ItemBagSize; ++index) { ob << '|'; EQEmu::ItemInstance* sub = inst->GetItem(index); diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index c4f6d4959..91921da2e 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -144,7 +144,7 @@ struct TintProfile { Tint_Struct Primary; Tint_Struct Secondary; }; - Tint_Struct Slot[EQEmu::textures::TextureCount]; + Tint_Struct Slot[EQEmu::textures::materialCount]; }; }; @@ -167,7 +167,7 @@ struct TextureProfile Texture_Struct Primary; Texture_Struct Secondary; }; - Texture_Struct Slot[EQEmu::textures::TextureCount]; + Texture_Struct Slot[EQEmu::textures::materialCount]; }; TextureProfile(); diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index fd45b0c61..92be237b1 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -1817,7 +1817,7 @@ namespace UF OUT(hairstyle); OUT(beard); // OUT(unknown00178[10]); - for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) { + for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) { eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material; eq->equipment.Slot[r].Unknown1 = 0; eq->equipment.Slot[r].EliteMaterial = 0; @@ -2301,10 +2301,10 @@ namespace UF eq_cse->HairColor = emu_cse->HairColor; eq_cse->Face = emu_cse->Face; - for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) { + for (int equip_index = EQEmu::textures::textureBegin; equip_index < EQEmu::textures::materialCount; equip_index++) { eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; - eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial; + eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -2869,7 +2869,7 @@ namespace UF float SpawnSize = emu->size; if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))) { - PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount); + PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount); if (emu->size == 0) { @@ -3068,7 +3068,7 @@ namespace UF if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k) + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k) { { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color); @@ -3104,17 +3104,17 @@ namespace UF { structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer; - for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) { + for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) { if (emu->equipment.Slot[k].Material > 99999) { Equipment[k].Material = 63; } else { Equipment[k].Material = emu->equipment.Slot[k].Material; } Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1; - Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial; + Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; } - Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount); + Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount); } if (strlen(emu->title)) { @@ -4224,18 +4224,18 @@ namespace UF ob.write((const char*)&subitem_count, sizeof(uint32)); - for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { + for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) { EQEmu::ItemInstance* sub = inst->GetItem(index); if (!sub) continue; int SubSlotNumber = INVALID_INDEX; if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END) - SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1); + SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1); else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index); else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END) - SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); + SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index); else SubSlotNumber = slot_id_in; @@ -4253,7 +4253,7 @@ namespace UF { uint32 UnderfootSlot = 0; - if (serverSlot >= EQEmu::legacy::SlotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots + if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots UnderfootSlot = serverSlot + 1; else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) UnderfootSlot = serverSlot + 11; @@ -4261,7 +4261,7 @@ namespace UF UnderfootSlot = serverSlot + 1; 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) + else if (serverSlot == EQEmu::inventory::slotPowerSource) UnderfootSlot = invslot::PossessionsPowerSource; else UnderfootSlot = serverSlot; @@ -4288,7 +4288,7 @@ namespace UF else if (ufSlot >= invbag::SharedBankBagsBegin && ufSlot <= invbag::SharedBankBagsEnd) ServerSlot = ufSlot - 1; else if (ufSlot == invslot::PossessionsPowerSource) - ServerSlot = EQEmu::legacy::SlotPowerSource; + ServerSlot = EQEmu::inventory::slotPowerSource; else ServerSlot = ufSlot; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 7ebedbec5..ec279e56c 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -149,7 +149,7 @@ struct TintProfile Tint_Struct Primary; Tint_Struct Secondary; }; - Tint_Struct Slot[EQEmu::textures::TextureCount]; + Tint_Struct Slot[EQEmu::textures::materialCount]; }; }; @@ -178,7 +178,7 @@ struct TextureProfile Texture_Struct Primary; Texture_Struct Secondary; }; - Texture_Struct Slot[EQEmu::textures::TextureCount]; + Texture_Struct Slot[EQEmu::textures::materialCount]; }; TextureProfile(); @@ -195,7 +195,7 @@ struct CharacterSelectEntry_Struct /*0000*/ uint8 Beard; // /*0001*/ uint8 HairColor; // /*0000*/ uint8 Face; // -/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount]; +/*0000*/ CharSelectEquip Equip[EQEmu::textures::materialCount]; /*0000*/ uint32 PrimaryIDFile; // /*0000*/ uint32 SecondaryIDFile; // /*0000*/ uint8 Unknown15; // 0xff diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d896fba9c..e748a2d56 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -105,7 +105,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list: std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i " "AND ((slotid >= 8000 AND slotid <= 8999) " "OR slotid = %i OR (slotid >= %i AND slotid <= %i) )", - char_id, EQEmu::legacy::SlotCursor, + char_id, EQEmu::inventory::slotCursor, EQEmu::legacy::CURSOR_BAG_BEGIN, EQEmu::legacy::CURSOR_BAG_END); auto results = QueryDatabase(query); if (!results.Success()) { @@ -117,7 +117,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list: for(auto it = start; it != end; ++it, i++) { if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high EQEmu::ItemInstance *inst = *it; - int16 use_slot = (i == 8000) ? EQEmu::legacy::SlotCursor : i; + int16 use_slot = (i == 8000) ? EQEmu::inventory::slotCursor : i; if (!SaveInventory(char_id, inst, use_slot)) { return false; } @@ -192,9 +192,9 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* in bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer - uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 }; + uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsClassCommon()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { EQEmu::ItemInstance *auginst = inst->GetItem(i); augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } @@ -224,7 +224,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstan if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) - for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { + for (uint8 idx = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } @@ -239,9 +239,9 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstan bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) { // need to check 'inst' argument for valid pointer - uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 }; + uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsClassCommon()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { EQEmu::ItemInstance *auginst = inst->GetItem(i); augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } @@ -270,7 +270,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInsta if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) { // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) - for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { + for (uint8 idx = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } @@ -296,7 +296,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { if (!Inventory::SupportsContainers(slot_id)) return true; - int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_INDEX_BEGIN); + int16 base_slot_id = Inventory::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i", char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); @@ -322,7 +322,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { if (!Inventory::SupportsContainers(slot_id)) return true; - int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_INDEX_BEGIN); + int16 base_slot_id = Inventory::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i " "AND slotid >= %i AND slotid < %i", account_id, base_slot_id, (base_slot_id+10)); @@ -428,7 +428,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) uint32 item_id = (uint32)atoi(row[1]); int8 charges = (int8)atoi(row[2]); - uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE]; + uint32 aug[EQEmu::inventory::SocketCount]; aug[0] = (uint32)atoi(row[3]); aug[1] = (uint32)atoi(row[4]); aug[2] = (uint32)atoi(row[5]); @@ -449,7 +449,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) EQEmu::ItemInstance *inst = CreateBaseItem(item, charges); if (inst && item->IsClassCommon()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); } @@ -524,7 +524,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) uint16 charges = atoi(row[2]); uint32 color = atoul(row[3]); - uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE]; + uint32 aug[EQEmu::inventory::SocketCount]; aug[0] = (uint32)atoul(row[4]); aug[1] = (uint32)atoul(row[5]); @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) if (instnodrop || (((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || - slot_id == EQEmu::legacy::SlotPowerSource) && + slot_id == EQEmu::inventory::slotPowerSource) && inst->GetItem()->Attuneable)) inst->SetAttuned(true); @@ -609,7 +609,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) } if (item->IsClassCommon()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); } @@ -666,7 +666,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) int8 charges = atoi(row[2]); uint32 color = atoul(row[3]); - uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE]; + uint32 aug[EQEmu::inventory::SocketCount]; aug[0] = (uint32)atoi(row[4]); aug[1] = (uint32)atoi(row[5]); aug[2] = (uint32)atoi(row[6]); @@ -727,7 +727,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) inst->SetCharges(charges); if (item->IsClassCommon()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if (aug[i]) inst->PutAugment(this, i, aug[i]); } diff --git a/common/textures.cpp b/common/textures.cpp index 7993ec384..262b4786c 100644 --- a/common/textures.cpp +++ b/common/textures.cpp @@ -18,82 +18,3 @@ */ #include "textures.h" -//#include "inventory_slot.h" - -#include // temp - - -//int EQEmu::textures::ConvertEquipmentSlotToTextureSlot(int equipment_slot) -//{ -// switch (equipment_slot) { -// case inventory::PossessionsHead: -// return textures::TextureHead; -// case inventory::PossessionsChest: -// return textures::TextureChest; -// case inventory::PossessionsArms: -// return textures::TextureArms; -// case inventory::PossessionsWrist1: -// return textures::TextureWrist; -// case inventory::PossessionsHands: -// return textures::TextureHands; -// case inventory::PossessionsLegs: -// return textures::TextureLegs; -// case inventory::PossessionsFeet: -// return textures::TextureFeet; -// case inventory::PossessionsPrimary: -// return textures::TexturePrimary; -// case inventory::PossessionsSecondary: -// return textures::TextureSecondary; -// default: -// return textures::TextureInvalid; -// } -//} - -//int EQEmu::textures::ConvertEquipmentSlotToTextureSlot(const InventorySlot &equipment_slot) -//{ -// if (equipment_slot.Type() != inventory::InvTypePossessions || equipment_slot.Bag() != inventory::InvBagInvalid || equipment_slot.Aug() != inventory::InvAugInvalid) -// return textures::TextureInvalid; -// -// return ConvertEquipmentSlotToTextureSlot(equipment_slot.Slot()); -//} - -//EQEmu::InventorySlot EQEmu::textures::ConvertTextureSlotToEquipmentSlot(int texture_slot) -//{ -// switch (texture_slot) { -// case textures::TextureHead: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsHead); -// case textures::TextureChest: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsChest); -// case textures::TextureArms: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsArms); -// case textures::TextureWrist: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsWrist1); -// case textures::TextureHands: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsHands); -// case textures::TextureLegs: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsLegs); -// case textures::TextureFeet: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsFeet); -// case textures::TexturePrimary: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsPrimary); -// case textures::TextureSecondary: -// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsSecondary); -// default: -// return EQEmu::InventorySlot(); -// } -//} - -EQEmu::TextureProfile::TextureProfile() -{ - memset(&Slot, 0, (sizeof(Texture_Struct) * textures::TextureCount)); -} - -EQEmu::TextureShortProfile::TextureShortProfile() -{ - memset(&Slot, 0, (sizeof(uint32) * textures::TextureCount)); -} - -EQEmu::TintProfile::TintProfile() -{ - memset(&Slot, 0, (sizeof(uint32) * textures::TextureCount)); -} diff --git a/common/textures.h b/common/textures.h index a6333a03f..bbf5f71c9 100644 --- a/common/textures.h +++ b/common/textures.h @@ -25,116 +25,129 @@ namespace EQEmu { - //class InventorySlot; - namespace textures { - //enum : int { TextureInvalid = -1, TextureBegin }; - enum : uint8 { TextureInvalid = 255, TextureBegin = 0 }; + enum : int8 { textureInvalid = -1, textureBegin }; - //enum TextureSlot : int { - enum TextureSlot : uint8 { - TextureHead = TextureBegin, - TextureChest, - TextureArms, - TextureWrist, - TextureHands, - TextureLegs, - TextureFeet, - TexturePrimary, - TextureSecondary, - TextureCount + enum TextureSlot : int8 { + armorHead = textureBegin, + armorChest, + armorArms, + armorWrist, + armorHands, + armorLegs, + armorFeet, + weaponPrimary, + weaponSecondary, + materialCount, + materialInvalid = textureInvalid }; - const int LastTexture = TextureSecondary; - const int LastTintableTexture = TextureFeet; + enum TintSlot : int8 { + tintHead = textureBegin, + tintChest, + tintArms, + tintWrist, + tintHands, + tintLegs, + tintFeet, + tintCount, + tintInvalid = textureInvalid + }; - //extern int ConvertEquipmentSlotToTextureSlot(int equipment_slot); - //extern int ConvertEquipmentSlotToTextureSlot(const InventorySlot &equipment_slot); - //extern InventorySlot ConvertTextureSlotToEquipmentSlot(int texture_slot); + const int8 LastTexture = weaponSecondary; + const int8 LastTintableTexture = tintFeet; + + struct Texture_Struct { + union { + struct { + struct { + struct { + uint32 _material; + } _1_field; + + uint32 _unknown1; + uint32 _elite_model; + } _3_fields; + + uint32 _heroic_model; + uint32 _unknown2; + } _5_fields; + + uint32 Material; + uint32 Unknown1; + uint32 EliteModel; + uint32 HeroicModel; + uint32 Unknown2; // same as material? + }; + }; + + struct TextureMaterial_Struct { + uint32 Material; + }; + + struct Tint_Struct { + union { + struct { + uint8 Blue; + uint8 Green; + uint8 Red; + uint8 UseTint; // if there's a tint, this is FF + }; + uint32 Color; + }; + }; } /*textures*/ - struct Texture_Struct { - uint32 Material; - uint32 Unknown1; - uint32 EliteMaterial; - uint32 HeroForgeModel; - uint32 Material2; // Same as material? - }; - struct TextureProfile { union { struct { - Texture_Struct Head; - Texture_Struct Chest; - Texture_Struct Arms; - Texture_Struct Wrist; - Texture_Struct Hands; - Texture_Struct Legs; - Texture_Struct Feet; - Texture_Struct Primary; - Texture_Struct Secondary; + textures::Texture_Struct Head; + textures::Texture_Struct Chest; + textures::Texture_Struct Arms; + textures::Texture_Struct Wrist; + textures::Texture_Struct Hands; + textures::Texture_Struct Legs; + textures::Texture_Struct Feet; + textures::Texture_Struct Primary; + textures::Texture_Struct Secondary; }; - Texture_Struct Slot[textures::TextureCount]; + textures::Texture_Struct Slot[textures::materialCount]; }; - - TextureProfile(); }; - struct TextureShort_Struct { - uint32 Material; - }; - - struct TextureShortProfile { + struct TextureMaterialProfile { union { struct { - TextureShort_Struct Head; - TextureShort_Struct Chest; - TextureShort_Struct Arms; - TextureShort_Struct Wrist; - TextureShort_Struct Hands; - TextureShort_Struct Legs; - TextureShort_Struct Feet; - TextureShort_Struct Primary; - TextureShort_Struct Secondary; + textures::TextureMaterial_Struct Head; + textures::TextureMaterial_Struct Chest; + textures::TextureMaterial_Struct Arms; + textures::TextureMaterial_Struct Wrist; + textures::TextureMaterial_Struct Hands; + textures::TextureMaterial_Struct Legs; + textures::TextureMaterial_Struct Feet; + textures::TextureMaterial_Struct Primary; + textures::TextureMaterial_Struct Secondary; }; - TextureShort_Struct Slot[textures::TextureCount]; + textures::TextureMaterial_Struct Slot[textures::materialCount]; }; - - TextureShortProfile(); - }; - - struct Tint_Struct { - union { - struct { - uint8 Blue; - uint8 Green; - uint8 Red; - uint8 UseTint; // if there's a tint this is FF - }; - uint32 Color; - }; - - //Tint_Struct(); }; struct TintProfile { union { struct { - Tint_Struct Head; - Tint_Struct Chest; - Tint_Struct Arms; - Tint_Struct Wrist; - Tint_Struct Hands; - Tint_Struct Legs; - Tint_Struct Feet; - Tint_Struct Primary; - Tint_Struct Secondary; + textures::Tint_Struct Head; + textures::Tint_Struct Chest; + textures::Tint_Struct Arms; + textures::Tint_Struct Wrist; + textures::Tint_Struct Hands; + textures::Tint_Struct Legs; + textures::Tint_Struct Feet; + textures::Tint_Struct Primary; + textures::Tint_Struct Secondary; }; - Tint_Struct Slot[textures::TextureCount]; + textures::Tint_Struct Slot[textures::materialCount]; // materialCount is correct..but, {[weaponPrimary],[weaponSecondary]} are not tintable... }; - - TintProfile(); }; } /*EQEmu*/ diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 858a84323..0fa814417 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -117,12 +117,12 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou cse->Gender = (uint8)atoi(row[2]); cse->Face = (uint8)atoi(row[15]); - for (uint32 matslot = 0; matslot < EQEmu::textures::TextureCount; matslot++) { // Processed below + for (uint32 matslot = 0; matslot < EQEmu::textures::materialCount; matslot++) { // Processed below cse->Equip[matslot].Material = 0; cse->Equip[matslot].Unknown1 = 0; - cse->Equip[matslot].EliteMaterial = 0; - cse->Equip[matslot].HeroForgeModel = 0; - cse->Equip[matslot].Material2 = 0; + cse->Equip[matslot].EliteModel = 0; + cse->Equip[matslot].HeroicModel = 0; + cse->Equip[matslot].Unknown2 = 0; cse->Equip[matslot].Color = 0; } @@ -249,7 +249,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou const EQEmu::ItemInstance* inst = nullptr; int16 invslot = 0; - for (uint32 matslot = 0; matslot < EQEmu::textures::TextureCount; matslot++) { + for (uint32 matslot = EQEmu::textures::textureBegin; matslot < EQEmu::textures::materialCount; matslot++) { invslot = Inventory::CalcSlotFromMaterial(matslot); if (invslot == INVALID_INDEX) { continue; } inst = inv.GetItem(invslot); @@ -270,7 +270,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou cse->Equip[matslot].Material = idfile; } } - if (matslot == EQEmu::textures::TexturePrimary) { + if (matslot == EQEmu::textures::weaponPrimary) { cse->PrimaryIDFile = idfile; } else { @@ -288,8 +288,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou // Armor Materials/Models cse->Equip[matslot].Material = item->Material; - cse->Equip[matslot].EliteMaterial = item->EliteMaterial; - cse->Equip[matslot].HeroForgeModel = inst->GetOrnamentHeroModel(matslot); + cse->Equip[matslot].EliteModel = item->EliteMaterial; + cse->Equip[matslot].HeroicModel = inst->GetOrnamentHeroModel(matslot); cse->Equip[matslot].Color = color; } } diff --git a/zone/attack.cpp b/zone/attack.cpp index 45de2d6b8..475aee7b3 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -132,7 +132,7 @@ bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const } // If we're attacking with the secondary hand, play the dual wield anim - if (Hand == EQEmu::legacy::SlotSecondary) // DW anim + if (Hand == EQEmu::inventory::slotSecondary) // DW anim type = animDualWield; DoAnim(type); @@ -373,7 +373,7 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) // riposte -- it may seem crazy, but if the attacker has SPA 173 on them, they are immune to Ripo bool ImmuneRipo = attacker->aabonuses.RiposteChance || attacker->spellbonuses.RiposteChance || attacker->itembonuses.RiposteChance; // Need to check if we have something in MainHand to actually attack with (or fists) - if (hand != EQEmu::legacy::SlotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) { + if (hand != EQEmu::inventory::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) { if (IsEnraged()) { damage = -3; Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack."); @@ -395,7 +395,7 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) chance -= chance * counter; } // AA Slippery Attacks - if (hand == EQEmu::legacy::SlotSecondary) { + if (hand == EQEmu::inventory::slotSecondary) { int slip = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail; chance += chance * slip / 100; } @@ -440,7 +440,7 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand) } // parry - if (CanThisClassParry() && InFront && hand != EQEmu::legacy::SlotRange) { + if (CanThisClassParry() && InFront && hand != EQEmu::inventory::slotRange) { if (IsClient()) CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillParry, other, -10); // check auto discs ... I guess aa/items too :P @@ -927,7 +927,7 @@ int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, u } else { bool MagicGloves = false; if (IsClient()) { - const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotHands); + const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotHands); if (gloves) MagicGloves = gloves->GetItemMagical(true); } @@ -1036,12 +1036,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code. EQEmu::ItemInstance* weapon; - if (Hand == EQEmu::legacy::SlotSecondary){ // Kaiyodo - Pick weapon from the attacking hand - weapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary); + if (Hand == EQEmu::inventory::slotSecondary){ // Kaiyodo - Pick weapon from the attacking hand + weapon = GetInv().GetItem(EQEmu::inventory::slotSecondary); OffHandAtk(true); } else{ - weapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary); + weapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); OffHandAtk(false); } @@ -1109,7 +1109,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b int ucDamageBonus = 0; - if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) + if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) { // Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above // who belong to a melee class. If we're here, then all of these conditions apply. @@ -1122,7 +1122,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b } #endif //Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon. - if (Hand == EQEmu::legacy::SlotSecondary) { + if (Hand == EQEmu::inventory::slotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr, true); @@ -1583,28 +1583,28 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool FaceTarget(GetTarget()); EQEmu::skills::SkillType skillinuse = EQEmu::skills::SkillHandtoHand; - if (Hand == EQEmu::legacy::SlotPrimary) { + if (Hand == EQEmu::inventory::slotPrimary) { skillinuse = static_cast(GetPrimSkill()); OffHandAtk(false); } - if (Hand == EQEmu::legacy::SlotSecondary) { + if (Hand == EQEmu::inventory::slotSecondary) { skillinuse = static_cast(GetSecSkill()); OffHandAtk(true); } //figure out what weapon they are using, if any const EQEmu::ItemData* weapon = nullptr; - if (Hand == EQEmu::legacy::SlotPrimary && equipment[EQEmu::legacy::SlotPrimary] > 0) - weapon = database.GetItem(equipment[EQEmu::legacy::SlotPrimary]); - else if (equipment[EQEmu::legacy::SlotSecondary]) - weapon = database.GetItem(equipment[EQEmu::legacy::SlotSecondary]); + if (Hand == EQEmu::inventory::slotPrimary && equipment[EQEmu::inventory::slotPrimary] > 0) + weapon = database.GetItem(equipment[EQEmu::inventory::slotPrimary]); + else if (equipment[EQEmu::inventory::slotSecondary]) + weapon = database.GetItem(equipment[EQEmu::inventory::slotSecondary]); //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if(weapon) { Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); - if (Hand == EQEmu::legacy::SlotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield){ + if (Hand == EQEmu::inventory::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield){ Log.Out(Logs::Detail, Logs::Combat, "Attack with shield canceled."); return false; } @@ -3501,7 +3501,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) { float ProcChance, ProcBonus; on->GetDefensiveProcChances(ProcBonus, ProcChance, hand , this); - if (hand != EQEmu::legacy::SlotPrimary) + if (hand != EQEmu::inventory::slotPrimary) ProcChance /= 2; int level_penalty = 0; @@ -3574,7 +3574,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData * ProcBonus += static_cast(itembonuses.ProcChance) / 10.0f; // Combat Effects float ProcChance = GetProcChances(ProcBonus, hand); - if (hand != EQEmu::legacy::SlotPrimary) //Is Archery intened to proc at 50% rate? + if (hand != EQEmu::inventory::slotPrimary) //Is Archery intened to proc at 50% rate? ProcChance /= 2; // Try innate proc on weapon @@ -3611,7 +3611,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData * proced = false; if (!proced && inst) { - for (int r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { + for (int r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { const EQEmu::ItemInstance *aug_i = inst->GetAugment(r); if (!aug_i) // no aug, try next slot! continue; @@ -3652,11 +3652,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w float ProcChance = 0.0f; ProcChance = GetProcChances(ProcBonus, hand); - if (hand != EQEmu::legacy::SlotPrimary) //Is Archery intened to proc at 50% rate? + if (hand != EQEmu::inventory::slotPrimary) //Is Archery intened to proc at 50% rate? ProcChance /= 2; bool rangedattk = false; - if (weapon && hand == EQEmu::legacy::SlotRange) { + if (weapon && hand == EQEmu::inventory::slotRange) { if (weapon->ItemType == EQEmu::item::ItemTypeArrow || weapon->ItemType == EQEmu::item::ItemTypeLargeThrowing || weapon->ItemType == EQEmu::item::ItemTypeSmallThrowing || @@ -3665,11 +3665,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w } } - if (!weapon && hand == EQEmu::legacy::SlotRange && GetSpecialAbility(SPECATK_RANGED_ATK)) + if (!weapon && hand == EQEmu::inventory::slotRange && GetSpecialAbility(SPECATK_RANGED_ATK)) rangedattk = true; for (uint32 i = 0; i < MAX_PROCS; i++) { - if (IsPet() && hand != EQEmu::legacy::SlotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets) + if (IsPet() && hand != EQEmu::inventory::slotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets) continue; // If pets ever can proc from off hand, this will need to change // Not ranged @@ -3732,7 +3732,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w } } - if (HasSkillProcs() && hand != EQEmu::legacy::SlotRange){ //We check ranged skill procs within the attack functions. + if (HasSkillProcs() && hand != EQEmu::inventory::slotRange){ //We check ranged skill procs within the attack functions. uint16 skillinuse = 28; if (weapon) skillinuse = GetSkillByItemType(weapon->ItemType); @@ -3980,7 +3980,7 @@ void Mob::DoRiposte(Mob *defender) if (!defender) return; - defender->Attack(this, EQEmu::legacy::SlotPrimary, true); + defender->Attack(this, EQEmu::inventory::slotPrimary, true); if (HasDied()) return; @@ -3991,7 +3991,7 @@ void Mob::DoRiposte(Mob *defender) if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) { Log.Out(Logs::Detail, Logs::Combat, "Preforming a double riposted from SE_DoubleRiposte (%d percent chance)", DoubleRipChance); - defender->Attack(this, EQEmu::legacy::SlotPrimary, true); + defender->Attack(this, EQEmu::inventory::slotPrimary, true); if (HasDied()) return; } @@ -4004,7 +4004,7 @@ void Mob::DoRiposte(Mob *defender) Log.Out(Logs::Detail, Logs::Combat, "Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 (%d percent chance)", DoubleRipChance); - defender->Attack(this, EQEmu::legacy::SlotPrimary, true); + defender->Attack(this, EQEmu::inventory::slotPrimary, true); if (HasDied()) return; } @@ -4288,7 +4288,7 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) { if (!ReuseTime && hand) { weapon_speed = GetWeaponSpeedbyHand(hand); ProcChance = static_cast(weapon_speed) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f); - if (hand != EQEmu::legacy::SlotPrimary) + if (hand != EQEmu::inventory::slotPrimary) ProcChance /= 2; } @@ -4478,13 +4478,13 @@ void Client::SetAttackTimer() Timer *TimerToUse = nullptr; - for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) { + for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) { //pick a timer - if (i == EQEmu::legacy::SlotPrimary) + if (i == EQEmu::inventory::slotPrimary) TimerToUse = &attack_timer; - else if (i == EQEmu::legacy::SlotRange) + else if (i == EQEmu::inventory::slotRange) TimerToUse = &ranged_timer; - else if (i == EQEmu::legacy::SlotSecondary) + else if (i == EQEmu::inventory::slotSecondary) TimerToUse = &attack_dw_timer; else //invalid slot (hands will always hit this) continue; @@ -4497,7 +4497,7 @@ void Client::SetAttackTimer() ItemToUse = ci->GetItem(); //special offhand stuff - if (i == EQEmu::legacy::SlotSecondary) { + if (i == EQEmu::inventory::slotSecondary) { //if we cant dual wield, skip it if (!CanThisClassDualWield() || HasTwoHanderEquipped()) { attack_dw_timer.Disable(); @@ -4571,19 +4571,19 @@ void NPC::SetAttackTimer() else speed = static_cast(((attack_delay / haste_mod) + ((hhe / 100.0f) * attack_delay)) * 100); - for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) { + for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) { //pick a timer - if (i == EQEmu::legacy::SlotPrimary) + if (i == EQEmu::inventory::slotPrimary) TimerToUse = &attack_timer; - else if (i == EQEmu::legacy::SlotRange) + else if (i == EQEmu::inventory::slotRange) TimerToUse = &ranged_timer; - else if (i == EQEmu::legacy::SlotSecondary) + else if (i == EQEmu::inventory::slotSecondary) TimerToUse = &attack_dw_timer; else //invalid slot (hands will always hit this) continue; //special offhand stuff - if (i == EQEmu::legacy::SlotSecondary) { + if (i == EQEmu::inventory::slotSecondary) { // SPECATK_QUAD is uncheesable if(!CanThisClassDualWield() || (HasTwoHanderEquipped() && !GetSpecialAbility(SPECATK_QUAD))) { attack_dw_timer.Disable(); @@ -4605,7 +4605,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) bool candouble = CanThisClassDoubleAttack(); // extra off hand non-sense, can only double with skill of 150 or above // or you have any amount of GiveDoubleAttack - if (candouble && hand == EQEmu::legacy::SlotSecondary) + if (candouble && hand == EQEmu::inventory::slotSecondary) candouble = GetSkill(EQEmu::skills::SkillDoubleAttack) > 149 || (aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack) > 0; if (candouble) { @@ -4613,7 +4613,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) if (CheckDoubleAttack()) { Attack(target, hand, false, false, IsFromSpell); // you can only triple from the main hand - if (hand == EQEmu::legacy::SlotPrimary && CanThisClassTripleAttack()) { + if (hand == EQEmu::inventory::slotPrimary && CanThisClassTripleAttack()) { CheckIncreaseSkill(EQEmu::skills::SkillTripleAttack, target, -10); if (CheckTripleAttack()) Attack(target, hand, false, false, IsFromSpell); @@ -4621,7 +4621,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) } } - if (hand == EQEmu::legacy::SlotPrimary) { + if (hand == EQEmu::inventory::slotPrimary) { // According to http://www.monkly-business.net/forums/showpost.php?p=312095&postcount=168 a dev told them flurry isn't dependant on triple attack // the parses kind of back that up and all of my parses seemed to be 4 or 5 attacks in the round which would work out to be // doubles or triples with 2 from flurries or triple with 1 or 2 flurries ... Going with the "dev quote" I guess like we've always had it @@ -4674,9 +4674,9 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int spec if (RuleB(Combat, UseLiveCombatRounds)) { // A "quad" on live really is just a successful dual wield where both double attack // The mobs that could triple lost the ability to when the triple attack skill was added in - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); if (CanThisClassDoubleAttack() && CheckDoubleAttack()){ - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); if ((IsPet() || IsTempPet()) && IsPetOwnerClient()){ int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry; @@ -4690,14 +4690,14 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int spec if (IsNPC()) { int16 n_atk = CastToNPC()->GetNumberOfAttacks(); if (n_atk <= 1) { - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); } else { for (int i = 0; i < n_atk; ++i) { - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); } } } else { - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); } // we use this random value in three comparisons with different @@ -4708,15 +4708,15 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int spec // check double attack, this is NOT the same rules that clients use... && RandRoll < (GetLevel() + NPCDualAttackModifier)) { - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); // lets see if we can do a triple attack with the main hand // pets are excluded from triple and quads... if ((GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) && !IsPet() && RandRoll < (GetLevel() + NPCTripleAttackModifier)) { - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); // now lets check the quad attack if (GetSpecialAbility(SPECATK_QUAD) && RandRoll < (GetLevel() + NPCQuadAttackModifier)) { - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special); } } } @@ -4730,11 +4730,11 @@ void Mob::DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int speci // For now, SPECATK_QUAD means innate DW when Combat:UseLiveCombatRounds is true if ((GetSpecialAbility(SPECATK_INNATE_DW) || (RuleB(Combat, UseLiveCombatRounds) && GetSpecialAbility(SPECATK_QUAD))) || - GetEquipment(EQEmu::textures::TextureSecondary) != 0) { + GetEquipment(EQEmu::textures::weaponSecondary) != 0) { if (CheckDualWield()) { - Attack(target, EQEmu::legacy::SlotSecondary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotSecondary, false, false, false, opts, special); if (CanThisClassDoubleAttack() && GetLevel() > 35 && CheckDoubleAttack()){ - Attack(target, EQEmu::legacy::SlotSecondary, false, false, false, opts, special); + Attack(target, EQEmu::inventory::slotSecondary, false, false, false, opts, special); if ((IsPet() || IsTempPet()) && IsPetOwnerClient()){ int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry; diff --git a/zone/beacon.h b/zone/beacon.h index 398c9680e..cd66269bb 100644 --- a/zone/beacon.h +++ b/zone/beacon.h @@ -36,7 +36,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0) { return; } - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, 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/bonuses.cpp b/zone/bonuses.cpp index 240643934..4ff4fbabe 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -145,28 +145,28 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { unsigned int i; // Update: MainAmmo should only calc skill mods (TODO: Check for other cases) - for (i = EQEmu::legacy::SlotCharm; i <= EQEmu::legacy::SlotAmmo; i++) { + for (i = EQEmu::inventory::slotCharm; i <= EQEmu::inventory::slotAmmo; i++) { const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; - AddItemBonuses(inst, newbon, false, false, 0, (i == EQEmu::legacy::SlotAmmo)); + AddItemBonuses(inst, newbon, false, false, 0, (i == EQEmu::inventory::slotAmmo)); //These are given special flags due to how often they are checked for various spell effects. const EQEmu::ItemData *item = inst->GetItem(); - if (i == EQEmu::legacy::SlotSecondary && (item && item->ItemType == EQEmu::item::ItemTypeShield)) + if (i == EQEmu::inventory::slotSecondary && (item && item->ItemType == EQEmu::item::ItemTypeShield)) SetShieldEquiped(true); - else if (i == EQEmu::legacy::SlotPrimary && (item && item->ItemType == EQEmu::item::ItemType2HBlunt)) { + else if (i == EQEmu::inventory::slotPrimary && (item && item->ItemType == EQEmu::item::ItemType2HBlunt)) { SetTwoHandBluntEquiped(true); SetTwoHanderEquipped(true); } - else if (i == EQEmu::legacy::SlotPrimary && (item && (item->ItemType == EQEmu::item::ItemType2HSlash || item->ItemType == EQEmu::item::ItemType2HPiercing))) + else if (i == EQEmu::inventory::slotPrimary && (item && (item->ItemType == EQEmu::item::ItemType2HSlash || item->ItemType == EQEmu::item::ItemType2HPiercing))) SetTwoHanderEquipped(true); } //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::SlotPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::inventory::slotPowerSource]; if(inst) AddItemBonuses(inst, newbon); } @@ -181,7 +181,7 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { //Optional ability to have worn effects calculate as an addititive bonus instead of highest value if (RuleI(Spells, AdditiveBonusWornType) && RuleI(Spells, AdditiveBonusWornType) != EQEmu::item::ItemEffectWorn){ - for (i = EQEmu::legacy::SlotCharm; i < EQEmu::legacy::SlotAmmo; i++) { + for (i = EQEmu::inventory::slotCharm; i < EQEmu::inventory::slotAmmo; i++) { const EQEmu::ItemInstance* inst = m_inv[i]; if(inst == 0) continue; @@ -527,7 +527,7 @@ void Client::AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses *newbon } if (!isAug) { - for (int i = 0; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) AddItemBonuses(inst->GetAugment(i), newbon, true, false, rec_level, ammo_slot_item); } } @@ -565,7 +565,7 @@ void Client::AdditiveWornBonuses(const EQEmu::ItemInstance *inst, StatBonuses* n if (!isAug) { int i; - for (i = 0; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { AdditiveWornBonuses(inst->GetAugment(i),newbon,true); } } @@ -3299,7 +3299,7 @@ void Client::CalcItemScale() { //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - if (CalcItemScale(EQEmu::legacy::SlotPowerSource, EQEmu::legacy::SlotPowerSource)) + if (CalcItemScale(EQEmu::inventory::slotPowerSource, EQEmu::inventory::slotPowerSource)) changed = true; } @@ -3314,7 +3314,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { bool changed = false; uint32 i; for (i = slot_x; i <= slot_y; i++) { - if (i == EQEmu::legacy::SlotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot + if (i == EQEmu::inventory::slotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; EQEmu::ItemInstance* inst = m_inv.GetItem(i); @@ -3344,7 +3344,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { } //iterate all augments - for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) + for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) { EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) @@ -3393,7 +3393,7 @@ void Client::DoItemEnterZone() { //Power Source Slot if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - if (DoItemEnterZone(EQEmu::legacy::SlotPowerSource, EQEmu::legacy::SlotPowerSource)) + if (DoItemEnterZone(EQEmu::inventory::slotPowerSource, EQEmu::inventory::slotPowerSource)) changed = true; } @@ -3407,7 +3407,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1 bool changed = false; for(uint32 i = slot_x; i <= slot_y; i++) { - if (i == EQEmu::legacy::SlotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot + if (i == EQEmu::inventory::slotAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; EQEmu::ItemInstance* inst = m_inv.GetItem(i); @@ -3429,7 +3429,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { uint16 oldexp = inst->GetExp(); parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, inst, nullptr, "", 0); - if (i <= EQEmu::legacy::SlotAmmo || i == EQEmu::legacy::SlotPowerSource) { + if (i <= EQEmu::inventory::slotAmmo || i == EQEmu::inventory::slotPowerSource) { parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i); } @@ -3439,7 +3439,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { update_slot = true; } } else { - if (i <= EQEmu::legacy::SlotAmmo || i == EQEmu::legacy::SlotPowerSource) { + if (i <= EQEmu::inventory::slotAmmo || i == EQEmu::inventory::slotPowerSource) { parse->EventItem(EVENT_EQUIP_ITEM, this, inst, nullptr, "", i); } @@ -3447,7 +3447,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { } //iterate all augments - for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) + for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) { EQEmu::ItemInstance *a_inst = inst->GetAugment(x); if(!a_inst) diff --git a/zone/bot.cpp b/zone/bot.cpp index 072f99bcd..03ba04dfd 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -229,8 +229,8 @@ void Bot::SetBotSpellID(uint32 newSpellID) { } uint32 Bot::GetBotArcheryRange() { - const EQEmu::ItemInstance *range_inst = GetBotItem(EQEmu::legacy::SlotRange); - const EQEmu::ItemInstance *ammo_inst = GetBotItem(EQEmu::legacy::SlotAmmo); + const EQEmu::ItemInstance *range_inst = GetBotItem(EQEmu::inventory::slotRange); + const EQEmu::ItemInstance *ammo_inst = GetBotItem(EQEmu::inventory::slotAmmo); if (!range_inst || !ammo_inst) return 0; @@ -246,15 +246,15 @@ uint32 Bot::GetBotArcheryRange() { void Bot::ChangeBotArcherWeapons(bool isArcher) { if((GetClass()==WARRIOR) || (GetClass()==PALADIN) || (GetClass()==RANGER) || (GetClass()==SHADOWKNIGHT) || (GetClass()==ROGUE)) { if(!isArcher) { - BotAddEquipItem(EQEmu::legacy::SlotPrimary, GetBotItemBySlot(EQEmu::legacy::SlotPrimary)); - BotAddEquipItem(EQEmu::legacy::SlotSecondary, GetBotItemBySlot(EQEmu::legacy::SlotSecondary)); + BotAddEquipItem(EQEmu::inventory::slotPrimary, GetBotItemBySlot(EQEmu::inventory::slotPrimary)); + BotAddEquipItem(EQEmu::inventory::slotSecondary, GetBotItemBySlot(EQEmu::inventory::slotSecondary)); SetAttackTimer(); BotGroupSay(this, "My blade is ready"); } else { - BotRemoveEquipItem(EQEmu::legacy::SlotPrimary); - BotRemoveEquipItem(EQEmu::legacy::SlotSecondary); - BotAddEquipItem(EQEmu::legacy::SlotAmmo, GetBotItemBySlot(EQEmu::legacy::SlotAmmo)); - BotAddEquipItem(EQEmu::legacy::SlotSecondary, GetBotItemBySlot(EQEmu::legacy::SlotRange)); + BotRemoveEquipItem(EQEmu::inventory::slotPrimary); + BotRemoveEquipItem(EQEmu::inventory::slotSecondary); + BotAddEquipItem(EQEmu::inventory::slotAmmo, GetBotItemBySlot(EQEmu::inventory::slotAmmo)); + BotAddEquipItem(EQEmu::inventory::slotSecondary, GetBotItemBySlot(EQEmu::inventory::slotRange)); SetAttackTimer(); BotGroupSay(this, "My bow is true and ready"); } @@ -1175,11 +1175,11 @@ void Bot::GenerateArmorClass() { uint16 Bot::GetPrimarySkillValue() { EQEmu::skills::SkillType skill = EQEmu::skills::HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill - bool equiped = m_inv.GetItem(EQEmu::legacy::SlotPrimary); + bool equiped = m_inv.GetItem(EQEmu::inventory::slotPrimary); if(!equiped) skill = EQEmu::skills::SkillHandtoHand; else { - uint8 type = m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->ItemType; //is this the best way to do this? switch(type) { case EQEmu::item::ItemType1HSlash: skill = EQEmu::skills::Skill1HSlashing; @@ -1900,12 +1900,12 @@ void Bot::BotRangedAttack(Mob* other) { return; } - EQEmu::ItemInstance* rangedItem = GetBotItem(EQEmu::legacy::SlotRange); + EQEmu::ItemInstance* rangedItem = GetBotItem(EQEmu::inventory::slotRange); const EQEmu::ItemData* RangeWeapon = 0; if(rangedItem) RangeWeapon = rangedItem->GetItem(); - EQEmu::ItemInstance* ammoItem = GetBotItem(EQEmu::legacy::SlotAmmo); + EQEmu::ItemInstance* ammoItem = GetBotItem(EQEmu::inventory::slotAmmo); const EQEmu::ItemData* Ammo = 0; if(ammoItem) Ammo = ammoItem->GetItem(); @@ -2002,7 +2002,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: int damage = 0; uint32 hate = 0; - int Hand = EQEmu::legacy::SlotPrimary; + int Hand = EQEmu::inventory::slotPrimary; if (hate == 0 && weapon_damage > 1) hate = weapon_damage; @@ -2031,7 +2031,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: else damage = zone->random.Int(min_hit, max_hit); - if (other->AvoidDamage(this, damage, CanRiposte ? EQEmu::legacy::SlotRange : EQEmu::legacy::SlotPrimary)) { // MainRange excludes ripo, primary doesn't have any extra behavior + if (other->AvoidDamage(this, damage, CanRiposte ? EQEmu::inventory::slotRange : EQEmu::inventory::slotPrimary)) { // MainRange excludes ripo, primary doesn't have any extra behavior if (damage == -3) { DoRiposte(other); if (HasDied()) @@ -2056,7 +2056,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: damage = -5; if (skillinuse == EQEmu::skills::SkillBash){ - const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotSecondary); const EQEmu::ItemData* botweapon = 0; if(inst) botweapon = inst->GetItem(); @@ -2103,15 +2103,15 @@ void Bot::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int3 case EQEmu::skills::SkillFlyingKick: case EQEmu::skills::SkillRoundKick: case EQEmu::skills::SkillKick: - item_slot = EQEmu::legacy::SlotFeet; + item_slot = EQEmu::inventory::slotFeet; break; case EQEmu::skills::SkillBash: - item_slot = EQEmu::legacy::SlotSecondary; + item_slot = EQEmu::inventory::slotSecondary; break; case EQEmu::skills::SkillDragonPunch: case EQEmu::skills::SkillEagleStrike: case EQEmu::skills::SkillTigerClaw: - item_slot = EQEmu::legacy::SlotHands; + item_slot = EQEmu::inventory::slotHands; break; } @@ -2449,23 +2449,23 @@ void Bot::AI_Process() { // First, special attack per class (kick, backstab etc..) DoClassAttacks(GetTarget()); if(attack_timer.Check()) { - Attack(GetTarget(), EQEmu::legacy::SlotPrimary); - TriggerDefensiveProcs(GetTarget(), EQEmu::legacy::SlotPrimary, false); - EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); - TryWeaponProc(wpn, GetTarget(), EQEmu::legacy::SlotPrimary); + Attack(GetTarget(), EQEmu::inventory::slotPrimary); + TriggerDefensiveProcs(GetTarget(), EQEmu::inventory::slotPrimary, false); + EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::inventory::slotPrimary); + TryWeaponProc(wpn, GetTarget(), EQEmu::inventory::slotPrimary); bool tripleSuccess = false; if(BotOwner && GetTarget() && CanThisClassDoubleAttack()) { if(BotOwner && CheckBotDoubleAttack()) - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, true); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); if(BotOwner && GetTarget() && GetSpecialAbility(SPECATK_TRIPLE) && CheckBotDoubleAttack(true)) { tripleSuccess = true; - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, true); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); } //quad attack, does this belong here?? if(BotOwner && GetTarget() && GetSpecialAbility(SPECATK_QUAD) && CheckBotDoubleAttack(true)) - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, true); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); } //Live AA - Flurry, Rapid Strikes ect (Flurry does not require Triple Attack). @@ -2473,18 +2473,18 @@ void Bot::AI_Process() { if (GetTarget() && flurrychance) { if(zone->random.Int(0, 100) < flurrychance) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); } } int32 ExtraAttackChanceBonus = (spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance); if (GetTarget() && ExtraAttackChanceBonus) { - EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::inventory::slotPrimary); if(wpn) { if (wpn->GetItem()->IsType2HWeapon()) { if(zone->random.Int(0, 100) < ExtraAttackChanceBonus) - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); } } } @@ -2504,7 +2504,7 @@ void Bot::AI_Process() { //now off hand if(GetTarget() && attack_dw_timer.Check() && CanThisClassDualWield()) { - const EQEmu::ItemInstance* instweapon = GetBotItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance* instweapon = GetBotItem(EQEmu::inventory::slotSecondary); const EQEmu::ItemData* weapon = 0; //can only dual wield without a weapon if you're a monk if(instweapon || (botClass == MONK)) { @@ -2526,12 +2526,12 @@ void Bot::AI_Process() { DualWieldProbability += (DualWieldProbability * float(DWBonus) / 100.0f); float random = zone->random.Real(0, 1); if (random < DualWieldProbability){ // Max 78% of DW - Attack(GetTarget(), EQEmu::legacy::SlotSecondary); // Single attack with offhand - EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::legacy::SlotSecondary); - TryWeaponProc(wpn, GetTarget(), EQEmu::legacy::SlotSecondary); + Attack(GetTarget(), EQEmu::inventory::slotSecondary); // Single attack with offhand + EQEmu::ItemInstance *wpn = GetBotItem(EQEmu::inventory::slotSecondary); + TryWeaponProc(wpn, GetTarget(), EQEmu::inventory::slotSecondary); if( CanThisClassDoubleAttack() && CheckBotDoubleAttack()) { if(GetTarget() && GetTarget()->GetHP() > -10) - Attack(GetTarget(), EQEmu::legacy::SlotSecondary); // Single attack with offhand + Attack(GetTarget(), EQEmu::inventory::slotSecondary); // Single attack with offhand } } } @@ -2702,12 +2702,12 @@ void Bot::PetAIProcess() { if(!botPet->BehindMob(botPet->GetTarget(), botPet->GetX(), botPet->GetY()) && botPet->GetTarget()->IsEnraged()) return; - if (botPet->Attack(GetTarget(), EQEmu::legacy::SlotPrimary)) // try the main hand + if (botPet->Attack(GetTarget(), EQEmu::inventory::slotPrimary)) // try the main hand if (botPet->GetTarget()) { // We're a pet so we re able to dual attack int32 RandRoll = zone->random.Int(0, 99); if (botPet->CanThisClassDoubleAttack() && (RandRoll < (botPet->GetLevel() + NPCDualAttackModifier))) { - if (botPet->Attack(botPet->GetTarget(), EQEmu::legacy::SlotPrimary)) {} + if (botPet->Attack(botPet->GetTarget(), EQEmu::inventory::slotPrimary)) {} } } @@ -2745,11 +2745,11 @@ void Bot::PetAIProcess() { float DualWieldProbability = ((botPet->GetSkill(EQEmu::skills::SkillDualWield) + botPet->GetLevel()) / 400.0f); DualWieldProbability -= zone->random.Real(0, 1); if(DualWieldProbability < 0) { - botPet->Attack(botPet->GetTarget(), EQEmu::legacy::SlotSecondary); + botPet->Attack(botPet->GetTarget(), EQEmu::inventory::slotSecondary); if (botPet->CanThisClassDoubleAttack()) { int32 RandRoll = zone->random.Int(0, 99); if (RandRoll < (botPet->GetLevel() + 20)) - botPet->Attack(botPet->GetTarget(), EQEmu::legacy::SlotSecondary); + botPet->Attack(botPet->GetTarget(), EQEmu::inventory::slotSecondary); } } } @@ -2956,14 +2956,14 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { const EQEmu::ItemInstance* inst = 0; uint32 spawnedbotid = 0; spawnedbotid = this->GetBotID(); - for (int i = 0; i < EQEmu::textures::TexturePrimary; i++) { + for (int i = EQEmu::textures::textureBegin; i < EQEmu::textures::weaponPrimary; i++) { inst = GetBotItem(i); if (inst) { item = inst->GetItem(); if (item != 0) { ns->spawn.equipment.Slot[i].Material = item->Material; - ns->spawn.equipment.Slot[i].EliteMaterial = item->EliteMaterial; - ns->spawn.equipment.Slot[i].HeroForgeModel = item->HerosForgeModel; + ns->spawn.equipment.Slot[i].EliteModel = item->EliteMaterial; + ns->spawn.equipment.Slot[i].HeroicModel = item->HerosForgeModel; if (armor_tint.Slot[i].Color) ns->spawn.equipment_tint.Slot[i].Color = armor_tint.Slot[i].Color; else @@ -2975,25 +2975,25 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { } } - inst = GetBotItem(EQEmu::legacy::SlotPrimary); + inst = GetBotItem(EQEmu::inventory::slotPrimary); if(inst) { item = inst->GetItem(); if(item) { if(strlen(item->IDFile) > 2) ns->spawn.equipment.Primary.Material = atoi(&item->IDFile[2]); - ns->spawn.equipment_tint.Primary.Color = GetEquipmentColor(EQEmu::textures::TexturePrimary); + ns->spawn.equipment_tint.Primary.Color = GetEquipmentColor(EQEmu::textures::weaponPrimary); } } - inst = GetBotItem(EQEmu::legacy::SlotSecondary); + inst = GetBotItem(EQEmu::inventory::slotSecondary); if(inst) { item = inst->GetItem(); if(item) { if(strlen(item->IDFile) > 2) ns->spawn.equipment.Secondary.Material = atoi(&item->IDFile[2]); - ns->spawn.equipment_tint.Secondary.Color = GetEquipmentColor(EQEmu::textures::TextureSecondary); + ns->spawn.equipment_tint.Secondary.Color = GetEquipmentColor(EQEmu::textures::weaponSecondary); } } } @@ -3237,7 +3237,7 @@ void Bot::BotAddEquipItem(int slot, uint32 id) { if(slot > 0 && id > 0) { uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot); - if (materialFromSlot != EQEmu::textures::TextureInvalid) { + if (materialFromSlot != EQEmu::textures::materialInvalid) { equipment[slot] = id; // npc has more than just material slots. Valid material should mean valid inventory index SendWearChange(materialFromSlot); } @@ -3253,11 +3253,11 @@ void Bot::BotRemoveEquipItem(int slot) { if(slot > 0) { uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot); - if (materialFromSlot != EQEmu::textures::TextureInvalid) { + if (materialFromSlot != EQEmu::textures::materialInvalid) { equipment[slot] = 0; // npc has more than just material slots. Valid material should mean valid inventory index SendWearChange(materialFromSlot); - if (materialFromSlot == EQEmu::textures::TextureChest) - SendWearChange(EQEmu::textures::TextureArms); + if (materialFromSlot == EQEmu::textures::armorChest) + SendWearChange(EQEmu::textures::armorArms); } UpdateEquipmentLight(); @@ -3360,7 +3360,7 @@ void Bot::FinishTrade(Client* client, BotTradeType tradeType) { else if(tradeType == BotTradeClientNoDropNoTrade) { // Items being traded are found on the Client's cursor slot, slot id 30. This item can be either a single item or it can be a bag. // If it is a bag, then we have to search for items in slots 331 thru 340 - PerformTradeWithClient(EQEmu::legacy::SlotCursor, EQEmu::legacy::SlotCursor, client); + PerformTradeWithClient(EQEmu::inventory::slotCursor, EQEmu::inventory::slotCursor, client); // TODO: Add logic here to test if the item in SLOT_CURSOR is a container type, if it is then we need to call the following: // PerformTradeWithClient(331, 340, client); @@ -3389,7 +3389,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli charges[i] = inst->GetCharges(); } - if (i == EQEmu::legacy::SlotCursor) + if (i == EQEmu::inventory::slotCursor) UpdateClient = true; //EQoffline: will give the items to the bots and change the bot stats @@ -3397,7 +3397,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli std::string TempErrorMessage; const EQEmu::ItemData* mWeaponItem = inst->GetItem(); bool failedLoreCheck = false; - for (int m = AUG_INDEX_BEGIN; m < EQEmu::legacy::ITEM_COMMON_SIZE; ++m) { + for (int m = EQEmu::inventory::socketBegin; m < EQEmu::inventory::SocketCount; ++m) { EQEmu::ItemInstance *itm = inst->GetAugment(m); if(itm) { @@ -3429,17 +3429,17 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli how_many_slots++; if(!GetBotItem(j)) { - if (j == EQEmu::legacy::SlotPrimary) { + if (j == EQEmu::inventory::slotPrimary) { if (mWeaponItem->IsType2HWeapon()) { - if (GetBotItem(EQEmu::legacy::SlotSecondary)) { + if (GetBotItem(EQEmu::inventory::slotSecondary)) { if (mWeaponItem && mWeaponItem->IsType2HWeapon()) { - if (client->CheckLoreConflict(GetBotItem(EQEmu::legacy::SlotSecondary)->GetItem())) { + if (client->CheckLoreConflict(GetBotItem(EQEmu::inventory::slotSecondary)->GetItem())) { failedLoreCheck = true; } } else { - EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotSecondary); - BotTradeSwapItem(client, EQEmu::legacy::SlotSecondary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::inventory::slotSecondary); + BotTradeSwapItem(client, EQEmu::inventory::slotSecondary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } } @@ -3449,7 +3449,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } break; } - else if (j == EQEmu::legacy::SlotSecondary) { + else if (j == EQEmu::inventory::slotSecondary) { if(inst->IsWeapon()) { if(CanThisClassDualWield()) { BotTradeAddItem(mWeaponItem->ID, inst, inst->GetCharges(), mWeaponItem->Slots, j, &TempErrorMessage); @@ -3465,10 +3465,10 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli success = true; } if(success) { - if (GetBotItem(EQEmu::legacy::SlotPrimary)) { - EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); + if (GetBotItem(EQEmu::inventory::slotPrimary)) { + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::inventory::slotPrimary); if (remove_item->GetItem()->IsType2HWeapon()) { - BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); + BotTradeSwapItem(client, EQEmu::inventory::slotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } break; @@ -3490,7 +3490,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli swap_item = GetBotItem(j); failedLoreCheck = false; - for (int k = AUG_INDEX_BEGIN; k < EQEmu::legacy::ITEM_COMMON_SIZE; ++k) { + for (int k = EQEmu::inventory::socketBegin; k < EQEmu::inventory::SocketCount; ++k) { EQEmu::ItemInstance *itm = swap_item->GetAugment(k); if(itm) { @@ -3503,28 +3503,28 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli failedLoreCheck = true; } if(!failedLoreCheck) { - if (j == EQEmu::legacy::SlotPrimary) { + if (j == EQEmu::inventory::slotPrimary) { if (mWeaponItem->IsType2HWeapon()) { - if (GetBotItem(EQEmu::legacy::SlotSecondary)) { - if (client->CheckLoreConflict(GetBotItem(EQEmu::legacy::SlotSecondary)->GetItem())) { + if (GetBotItem(EQEmu::inventory::slotSecondary)) { + if (client->CheckLoreConflict(GetBotItem(EQEmu::inventory::slotSecondary)->GetItem())) { failedLoreCheck = true; } else { - EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotSecondary); - BotTradeSwapItem(client, EQEmu::legacy::SlotSecondary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::inventory::slotSecondary); + BotTradeSwapItem(client, EQEmu::inventory::slotSecondary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } } if(!failedLoreCheck) { - BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, inst, swap_item, mWeaponItem->Slots, &TempErrorMessage); + BotTradeSwapItem(client, EQEmu::inventory::slotPrimary, inst, swap_item, mWeaponItem->Slots, &TempErrorMessage); success = true; } break; } - else if (j == EQEmu::legacy::SlotSecondary) { + else if (j == EQEmu::inventory::slotSecondary) { if(inst->IsWeapon()) { if(CanThisClassDualWield()) { - BotTradeSwapItem(client, EQEmu::legacy::SlotSecondary, inst, swap_item, mWeaponItem->Slots, &TempErrorMessage); + BotTradeSwapItem(client, EQEmu::inventory::slotSecondary, inst, swap_item, mWeaponItem->Slots, &TempErrorMessage); success = true; } else { @@ -3533,13 +3533,13 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli } } else { - BotTradeSwapItem(client, EQEmu::legacy::SlotSecondary, inst, swap_item, mWeaponItem->Slots, &TempErrorMessage); + BotTradeSwapItem(client, EQEmu::inventory::slotSecondary, inst, swap_item, mWeaponItem->Slots, &TempErrorMessage); success = true; } - if (success && GetBotItem(EQEmu::legacy::SlotPrimary)) { - EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::legacy::SlotPrimary); + if (success && GetBotItem(EQEmu::inventory::slotPrimary)) { + EQEmu::ItemInstance* remove_item = GetBotItem(EQEmu::inventory::slotPrimary); if (remove_item->GetItem()->IsType2HWeapon()) { - BotTradeSwapItem(client, EQEmu::legacy::SlotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); + BotTradeSwapItem(client, EQEmu::inventory::slotPrimary, 0, remove_item, remove_item->GetItem()->Slots, &TempErrorMessage, false); } } break; @@ -3739,13 +3739,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b FaceTarget(GetTarget()); EQEmu::ItemInstance* weapon = nullptr; - if (Hand == EQEmu::legacy::SlotPrimary) { - weapon = GetBotItem(EQEmu::legacy::SlotPrimary); + if (Hand == EQEmu::inventory::slotPrimary) { + weapon = GetBotItem(EQEmu::inventory::slotPrimary); OffHandAtk(false); } - if (Hand == EQEmu::legacy::SlotSecondary) { - weapon = GetBotItem(EQEmu::legacy::SlotSecondary); + if (Hand == EQEmu::inventory::slotSecondary) { + weapon = GetBotItem(EQEmu::inventory::slotSecondary); OffHandAtk(true); } @@ -3810,7 +3810,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b // This is not recommended for normal usage, as the damage bonus represents a non-trivial component of the DPS output // of weapons wielded by higher-level melee characters (especially for two-handed weapons). int ucDamageBonus = 0; - if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) { + if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) { // Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above // who belong to a melee class. If we're here, then all of these conditions apply. ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); @@ -3820,7 +3820,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b } #endif //Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon. - if (Hand == EQEmu::legacy::SlotSecondary) { + if (Hand == EQEmu::inventory::slotSecondary) { if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){ ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); min_hit += (int) ucDamageBonus; @@ -4313,7 +4313,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { } } - for (int y = AUG_INDEX_BEGIN; y < EQEmu::legacy::ITEM_COMMON_SIZE; ++y) { + for (int y = EQEmu::inventory::socketBegin; y < EQEmu::inventory::SocketCount; ++y) { EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); if(aug) { @@ -4749,13 +4749,13 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { float ProcChance = 0.0f; uint32 weapon_speed = 0; switch (hand) { - case EQEmu::legacy::SlotPrimary: + case EQEmu::inventory::slotPrimary: weapon_speed = attack_timer.GetDuration(); break; - case EQEmu::legacy::SlotSecondary: + case EQEmu::inventory::slotSecondary: weapon_speed = attack_dw_timer.GetDuration(); break; - case EQEmu::legacy::SlotRange: + case EQEmu::inventory::slotRange: weapon_speed = ranged_timer.GetDuration(); break; } @@ -4781,7 +4781,7 @@ int Bot::GetHandToHandDamage(void) { // everyone uses this in the revamp! int skill = GetSkill(EQEmu::skills::SkillHandtoHand); int epic = 0; - if (CastToNPC()->GetEquipment(EQEmu::textures::TextureHands) == 10652 && GetLevel() > 46) + if (CastToNPC()->GetEquipment(EQEmu::textures::armorHands) == 10652 && GetLevel() > 46) epic = 280; if (epic > skill) skill = epic; @@ -4803,7 +4803,7 @@ int Bot::GetHandToHandDamage(void) { 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, // 31-40 10, 11, 11, 11, 11, 11, 11, 12, 12}; // 41-49 if (GetClass() == MONK) { - if (CastToNPC()->GetEquipment(EQEmu::textures::TextureHands) == 10652 && GetLevel() > 50) + if (CastToNPC()->GetEquipment(EQEmu::textures::armorHands) == 10652 && GetLevel() > 50) return 9; if (level > 62) return 15; @@ -4842,11 +4842,11 @@ void Bot::DoRiposte(Mob* defender) { if (!defender) return; - defender->Attack(this, EQEmu::legacy::SlotPrimary, true); + defender->Attack(this, EQEmu::inventory::slotPrimary, true); int32 DoubleRipChance = (defender->GetAABonuses().GiveDoubleRiposte[0] + defender->GetSpellBonuses().GiveDoubleRiposte[0] + defender->GetItemBonuses().GiveDoubleRiposte[0]); if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { Log.Out(Logs::Detail, Logs::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); - defender->Attack(this, EQEmu::legacy::SlotPrimary, true); + defender->Attack(this, EQEmu::inventory::slotPrimary, true); } DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[1]; @@ -4864,7 +4864,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 hate = hate_override; if (skill == EQEmu::skills::SkillBash) { - const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotSecondary); const EQEmu::ItemData* botweapon = 0; if(inst) botweapon = inst->GetItem(); @@ -4878,14 +4878,14 @@ void Bot::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 } min_damage += (min_damage * GetMeleeMinDamageMod_SE(skill) / 100); - int hand = EQEmu::legacy::SlotPrimary; + int hand = EQEmu::inventory::slotPrimary; if (skill == EQEmu::skills::SkillThrowing || skill == EQEmu::skills::SkillArchery) - hand = EQEmu::legacy::SlotRange; + hand = EQEmu::inventory::slotRange; if (who->AvoidDamage(this, max_damage, hand)) { if (max_damage == -3) DoRiposte(who); } else { - if (HitChance || who->CheckHitChance(this, skill, EQEmu::legacy::SlotPrimary)) { + if (HitChance || who->CheckHitChance(this, skill, EQEmu::inventory::slotPrimary)) { who->MeleeMitigation(this, max_damage, min_damage); ApplyMeleeDamageBonus(skill, max_damage); max_damage += who->GetFcDamageAmtIncoming(this, 0, true, skill); @@ -4929,7 +4929,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { bool bIsBehind = false; bool bCanFrontalBS = false; - const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotPrimary); const EQEmu::ItemData* botpiercer = nullptr; if(inst) botpiercer = inst->GetItem(); @@ -4979,7 +4979,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { } } else - Attack(other, EQEmu::legacy::SlotPrimary); + Attack(other, EQEmu::inventory::slotPrimary); } void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { @@ -4989,11 +4989,11 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { int32 hate = 0; int32 primaryweapondamage = 0; int32 backstab_dmg = 0; - EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::inventory::slotPrimary); if(botweaponInst) { primaryweapondamage = GetWeaponDamage(other, botweaponInst); backstab_dmg = botweaponInst->GetItem()->BackstabDmg; - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; ++i) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { EQEmu::ItemInstance *aug = botweaponInst->GetAugment(i); if(aug) backstab_dmg += aug->GetItem()->BackstabDmg; @@ -5037,7 +5037,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) { } void Bot::RogueAssassinate(Mob* other) { - EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance* botweaponInst = GetBotItem(EQEmu::inventory::slotPrimary); if(botweaponInst) { if(GetWeaponDamage(other, botweaponInst)) other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); @@ -5103,7 +5103,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { case WARRIOR: if(level >= RuleI(Combat, NPCBashKickLevel)){ bool canBash = false; - if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) + if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::inventory::slotSecondary) && m_inv.GetItem(EQEmu::inventory::slotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::inventory::slotPrimary) && m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) canBash = true; if(!canBash || zone->random.Int(0, 100) > 25) @@ -5122,7 +5122,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { case SHADOWKNIGHT: case PALADIN: if(level >= RuleI(Combat, NPCBashKickLevel)){ - if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::legacy::SlotSecondary) && m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::legacy::SlotPrimary) && m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) + if ((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(EQEmu::inventory::slotSecondary) && m_inv.GetItem(EQEmu::inventory::slotSecondary)->GetItem()->ItemType == EQEmu::item::ItemTypeShield) || (m_inv.GetItem(EQEmu::inventory::slotPrimary) && m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->IsType2HWeapon() && GetAA(aa2HandBash) >= 1)) skill_to_use = EQEmu::skills::SkillBash; } break; @@ -5151,7 +5151,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if (skill_to_use == EQEmu::skills::SkillBash) { if (target != this) { DoAnim(animTailRake); - if (GetWeaponDamage(target, GetBotItem(EQEmu::legacy::SlotSecondary)) <= 0 && GetWeaponDamage(target, GetBotItem(EQEmu::legacy::SlotShoulders)) <= 0) + if (GetWeaponDamage(target, GetBotItem(EQEmu::inventory::slotSecondary)) <= 0 && GetWeaponDamage(target, GetBotItem(EQEmu::inventory::slotShoulders)) <= 0) dmg = -5; else { if (!target->CheckHitChance(this, EQEmu::skills::SkillBash, 0)) @@ -5201,7 +5201,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if (skill_to_use == EQEmu::skills::SkillKick) { if(target != this) { DoAnim(animKick); - if (GetWeaponDamage(target, GetBotItem(EQEmu::legacy::SlotFeet)) <= 0) + if (GetWeaponDamage(target, GetBotItem(EQEmu::inventory::slotFeet)) <= 0) dmg = -5; else { if (!target->CheckHitChance(this, EQEmu::skills::SkillKick, 0)) @@ -5495,12 +5495,12 @@ void Bot::SetAttackTimer() { attack_timer.SetAtTrigger(4000, true); Timer* TimerToUse = nullptr; const EQEmu::ItemData* PrimaryWeapon = nullptr; - for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) { - if (i == EQEmu::legacy::SlotPrimary) + for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) { + if (i == EQEmu::inventory::slotPrimary) TimerToUse = &attack_timer; - else if (i == EQEmu::legacy::SlotRange) + else if (i == EQEmu::inventory::slotRange) TimerToUse = &ranged_timer; - else if (i == EQEmu::legacy::SlotSecondary) + else if (i == EQEmu::inventory::slotSecondary) TimerToUse = &attack_dw_timer; else continue; @@ -5510,7 +5510,7 @@ void Bot::SetAttackTimer() { if (ci) ItemToUse = ci->GetItem(); - if (i == EQEmu::legacy::SlotSecondary) { + if (i == EQEmu::inventory::slotSecondary) { if (PrimaryWeapon != nullptr) { if (PrimaryWeapon->IsClassCommon() && PrimaryWeapon->IsType2HWeapon()) { attack_dw_timer.Disable(); @@ -5541,7 +5541,7 @@ void Bot::SetAttackTimer() { speed = (RuleB(Spells, Jun182014HundredHandsRevamp) ? static_cast(((delay / haste_mod) + ((hhe / 1000.0f) * (delay / haste_mod))) * 100) : static_cast(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100)); TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true); - if (i == EQEmu::legacy::SlotPrimary) + if (i == EQEmu::inventory::slotPrimary) PrimaryWeapon = ItemToUse; } } @@ -7186,7 +7186,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { // Modded to display power source items (will only show up on SoF+ client inspect windows though.) // I don't think bots are currently coded to use them..but, you'll have to use '#bot inventory list' // to see them on a Titanium client when/if they are activated. - for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::legacy::SlotWaist; L++) { + for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::inventory::slotWaist; L++) { inst = inspectedBot->GetBotItem(L); if(inst) { @@ -7200,7 +7200,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { } } - inst = inspectedBot->GetBotItem(EQEmu::legacy::SlotPowerSource); + inst = inspectedBot->GetBotItem(EQEmu::inventory::slotPowerSource); if(inst) { item = inst->GetItem(); @@ -7212,7 +7212,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) { insr->itemicons[SoF::invslot::PossessionsPowerSource] = 0xFFFFFFFF; } - inst = inspectedBot->GetBotItem(EQEmu::legacy::SlotAmmo); + inst = inspectedBot->GetBotItem(EQEmu::inventory::slotAmmo); if(inst) { item = inst->GetItem(); @@ -7547,7 +7547,7 @@ void Bot::AddItemBonuses(const EQEmu::ItemInstance *inst, StatBonuses* newbon, b if (!isAug) { - for (int i = 0; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) AddItemBonuses(inst->GetAugment(i),newbon,true, false, rec_level); } @@ -8036,12 +8036,12 @@ uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) { int Bot::GetRawACNoShield(int &shield_ac) { int ac = itembonuses.AC + spellbonuses.AC; shield_ac = 0; - EQEmu::ItemInstance* inst = GetBotItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance* inst = GetBotItem(EQEmu::inventory::slotSecondary); if(inst) { if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; shield_ac = inst->GetItem()->AC; - for (uint8 i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (uint8 i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if(inst->GetAugment(i)) { ac -= inst->GetAugment(i)->GetItem()->AC; shield_ac += inst->GetAugment(i)->GetItem()->AC; @@ -8433,7 +8433,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag) if (slot_id != INVALID_INDEX) return false; - for (uint8 i = 0; i < EQEmu::textures::TexturePrimary; ++i) { + for (uint8 i = EQEmu::textures::textureBegin; i < EQEmu::textures::weaponPrimary; ++i) { uint8 inv_slot = Inventory::CalcSlotFromMaterial(i); EQEmu::ItemInstance* inst = m_inv.GetItem(inv_slot); if (!inst) @@ -8445,7 +8445,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag) } else { uint8 mat_slot = Inventory::CalcMaterialFromSlot(slot_id); - if (mat_slot == EQEmu::textures::TextureInvalid || mat_slot >= EQEmu::textures::TexturePrimary) + if (mat_slot == EQEmu::textures::materialInvalid || mat_slot >= EQEmu::textures::weaponPrimary) return false; EQEmu::ItemInstance* inst = m_inv.GetItem(slot_id); diff --git a/zone/bot.h b/zone/bot.h index 5bafe1caa..96ca86eec 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -77,7 +77,7 @@ static const std::string bot_stance_name[BOT_STANCE_COUNT] = { static const char* GetBotStanceName(int stance_id) { return bot_stance_name[VALIDBOTSTANCE(stance_id)].c_str(); } -#define VALIDBOTEQUIPSLOT(x) ((x >= EQEmu::legacy::EQUIPMENT_BEGIN && x <= EQEmu::legacy::EQUIPMENT_END) ? (x) : ((x == EQEmu::legacy::SlotPowerSource) ? (22) : (23))) +#define VALIDBOTEQUIPSLOT(x) ((x >= EQEmu::legacy::EQUIPMENT_BEGIN && x <= EQEmu::legacy::EQUIPMENT_END) ? (x) : ((x == EQEmu::inventory::slotPowerSource) ? (22) : (23))) static std::string bot_equip_slot_name[EQEmu::legacy::EQUIPMENT_SIZE + 2] = { @@ -207,7 +207,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 398a0d6b0..57dd2d418 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -4358,7 +4358,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep) // TODO: Trouble-shoot model update issue const std::string msg_matslot = StringFormat("mat_slot: %c(All), %i(Head), %i(Chest), %i(Arms), %i(Wrists), %i(Hands), %i(Legs), %i(Feet)", - '*', EQEmu::textures::TextureHead, EQEmu::textures::TextureChest, EQEmu::textures::TextureArms, EQEmu::textures::TextureWrist, EQEmu::textures::TextureHands, EQEmu::textures::TextureLegs, EQEmu::textures::TextureFeet); + '*', EQEmu::textures::armorHead, EQEmu::textures::armorChest, EQEmu::textures::armorArms, EQEmu::textures::armorWrist, EQEmu::textures::armorHands, EQEmu::textures::armorLegs, EQEmu::textures::armorFeet); if (helper_command_alias_fail(c, "bot_subcommand_bot_dye_armor", sep->arg[0], "botdyearmor")) return; @@ -4369,7 +4369,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep) } const int ab_mask = ActionableBots::ABM_NoFilter; - uint8 material_slot = EQEmu::textures::TextureInvalid; + uint8 material_slot = EQEmu::textures::materialInvalid; int16 slot_id = INVALID_INDEX; bool dye_all = (sep->arg[1][0] == '*'); @@ -4377,7 +4377,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep) material_slot = atoi(sep->arg[1]); slot_id = Inventory::CalcSlotFromMaterial(material_slot); - if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQEmu::textures::TextureFeet) { + if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQEmu::textures::LastTintableTexture) { c->Message(m_fail, "Valid [mat_slot]s for this command are:"); c->Message(m_fail, msg_matslot.c_str()); return; @@ -7072,23 +7072,23 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep) uint32 inventory_count = 0; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { - if ((i == EQEmu::legacy::SlotSecondary) && is2Hweapon) + if ((i == EQEmu::inventory::slotSecondary) && is2Hweapon) continue; - inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::legacy::SlotPowerSource : i); + inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::inventory::slotPowerSource : i); if (!inst || !inst->GetItem()) { - c->Message(m_message, "I need something for my %s (slot %i)", GetBotEquipSlotName(i), (i == 22 ? EQEmu::legacy::SlotPowerSource : i)); + c->Message(m_message, "I need something for my %s (slot %i)", GetBotEquipSlotName(i), (i == 22 ? EQEmu::inventory::slotPowerSource : i)); continue; } item = inst->GetItem(); - if ((i == EQEmu::legacy::SlotPrimary) && item->IsType2HWeapon()) { + if ((i == EQEmu::inventory::slotPrimary) && item->IsType2HWeapon()) { is2Hweapon = true; } linker.SetItemInst(inst); item_link = linker.GenerateLink(); - c->Message(m_message, "Using %s in my %s (slot %i)", item_link.c_str(), GetBotEquipSlotName(i), (i == 22 ? EQEmu::legacy::SlotPowerSource : i)); + c->Message(m_message, "Using %s in my %s (slot %i)", item_link.c_str(), GetBotEquipSlotName(i), (i == 22 ? EQEmu::inventory::slotPowerSource : i)); ++inventory_count; } @@ -7127,7 +7127,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) } int slotId = atoi(sep->arg[1]); - if (!sep->IsNumber(1) || ((slotId > EQEmu::legacy::EQUIPMENT_END || slotId < EQEmu::legacy::EQUIPMENT_BEGIN) && slotId != EQEmu::legacy::SlotPowerSource)) { + if (!sep->IsNumber(1) || ((slotId > EQEmu::legacy::EQUIPMENT_END || slotId < EQEmu::legacy::EQUIPMENT_BEGIN) && slotId != EQEmu::inventory::slotPowerSource)) { c->Message(m_fail, "Valid slots are 0-21 or 9999"); return; } @@ -7142,7 +7142,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) return; } - for (int m = AUG_INDEX_BEGIN; m < EQEmu::legacy::ITEM_COMMON_SIZE; ++m) { + for (int m = EQEmu::inventory::socketBegin; m < EQEmu::inventory::SocketCount; ++m) { if (!itminst) break; @@ -7159,7 +7159,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) std::string error_message; if (itm) { c->PushItemOnCursor(*itminst, true); - if ((slotId == EQEmu::legacy::SlotRange) || (slotId == EQEmu::legacy::SlotAmmo) || (slotId == EQEmu::legacy::SlotPrimary) || (slotId == EQEmu::legacy::SlotSecondary)) + if ((slotId == EQEmu::inventory::slotRange) || (slotId == EQEmu::inventory::slotAmmo) || (slotId == EQEmu::inventory::slotPrimary) || (slotId == EQEmu::inventory::slotSecondary)) my_bot->SetBotArcher(false); my_bot->RemoveBotItemBySlot(slotId, &error_message); @@ -7173,31 +7173,31 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep) } switch (slotId) { - case EQEmu::legacy::SlotCharm: - case EQEmu::legacy::SlotEar1: - case EQEmu::legacy::SlotHead: - case EQEmu::legacy::SlotFace: - case EQEmu::legacy::SlotEar2: - case EQEmu::legacy::SlotNeck: - case EQEmu::legacy::SlotBack: - case EQEmu::legacy::SlotWrist1: - case EQEmu::legacy::SlotWrist2: - case EQEmu::legacy::SlotRange: - case EQEmu::legacy::SlotPrimary: - case EQEmu::legacy::SlotSecondary: - case EQEmu::legacy::SlotFinger1: - case EQEmu::legacy::SlotFinger2: - case EQEmu::legacy::SlotChest: - case EQEmu::legacy::SlotWaist: - case EQEmu::legacy::SlotPowerSource: - case EQEmu::legacy::SlotAmmo: + case EQEmu::inventory::slotCharm: + case EQEmu::inventory::slotEar1: + case EQEmu::inventory::slotHead: + case EQEmu::inventory::slotFace: + case EQEmu::inventory::slotEar2: + case EQEmu::inventory::slotNeck: + case EQEmu::inventory::slotBack: + case EQEmu::inventory::slotWrist1: + case EQEmu::inventory::slotWrist2: + case EQEmu::inventory::slotRange: + case EQEmu::inventory::slotPrimary: + case EQEmu::inventory::slotSecondary: + case EQEmu::inventory::slotFinger1: + case EQEmu::inventory::slotFinger2: + case EQEmu::inventory::slotChest: + case EQEmu::inventory::slotWaist: + case EQEmu::inventory::slotPowerSource: + case EQEmu::inventory::slotAmmo: c->Message(m_message, "My %s is %s unequipped", GetBotEquipSlotName(slotId), ((itm) ? ("now") : ("already"))); break; - case EQEmu::legacy::SlotShoulders: - case EQEmu::legacy::SlotArms: - case EQEmu::legacy::SlotHands: - case EQEmu::legacy::SlotLegs: - case EQEmu::legacy::SlotFeet: + case EQEmu::inventory::slotShoulders: + case EQEmu::inventory::slotArms: + case EQEmu::inventory::slotHands: + case EQEmu::inventory::slotLegs: + case EQEmu::inventory::slotFeet: c->Message(m_message, "My %s are %s unequipped", GetBotEquipSlotName(slotId), ((itm) ? ("now") : ("already"))); break; default: @@ -7236,12 +7236,12 @@ void bot_subcommand_inventory_window(Client *c, const Seperator *sep) for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { const EQEmu::ItemData* item = nullptr; - const EQEmu::ItemInstance* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::legacy::SlotPowerSource : i); + const EQEmu::ItemInstance* inst = my_bot->CastToBot()->GetBotItem(i == 22 ? EQEmu::inventory::slotPowerSource : i); if (inst) item = inst->GetItem(); window_text.append(""); - window_text.append(GetBotEquipSlotName(i == 22 ? EQEmu::legacy::SlotPowerSource : i)); + window_text.append(GetBotEquipSlotName(i == 22 ? EQEmu::inventory::slotPowerSource : i)); window_text.append(": "); if (item) { //window_text.append(""); diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 8e4ddc203..259df1d63 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1058,7 +1058,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, Inventory& inventory_inst) for (auto row = results.begin(); row != results.end(); ++row) { int16 slot_id = atoi(row[0]); - if ((slot_id < EQEmu::legacy::EQUIPMENT_BEGIN || slot_id > EQEmu::legacy::EQUIPMENT_END) && slot_id != EQEmu::legacy::SlotPowerSource) + if ((slot_id < EQEmu::legacy::EQUIPMENT_BEGIN || slot_id > EQEmu::legacy::EQUIPMENT_END) && slot_id != EQEmu::inventory::slotPowerSource) continue; uint32 item_id = atoi(row[1]); @@ -1093,7 +1093,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, Inventory& inventory_inst) if (item_inst->GetItem()->Attuneable) { if (atoi(row[4])) item_inst->SetAttuned(true); - else if (((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || slot_id == EQEmu::legacy::SlotPowerSource)) + else if (((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || slot_id == EQEmu::inventory::slotPowerSource)) item_inst->SetAttuned(true); } @@ -1161,7 +1161,7 @@ bool BotDatabase::LoadItemBySlot(Bot* bot_inst) bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint32& item_id) { - if (!bot_id || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::legacy::SlotPowerSource)) + if (!bot_id || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::inventory::slotPowerSource)) return false; query = StringFormat("SELECT `item_id` FROM `bot_inventories` WHERE `bot_id` = '%i' AND `slot_id` = '%i' LIMIT 1", bot_id, slot_id); @@ -1179,7 +1179,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEmu::ItemInstance* item_inst) { - if (!bot_inst || !bot_inst->GetBotID() || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::legacy::SlotPowerSource)) + if (!bot_inst || !bot_inst->GetBotID() || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::inventory::slotPowerSource)) return false; if (!DeleteItemBySlot(bot_inst->GetBotID(), slot_id)) @@ -1188,8 +1188,8 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEm if (!item_inst || !item_inst->GetID()) return true; - uint32 augment_id[] = { 0, 0, 0, 0, 0, 0 }; - for (int augment_iter = 0; augment_iter < EQEmu::legacy::ITEM_COMMON_SIZE; ++augment_iter) + uint32 augment_id[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; + for (int augment_iter = EQEmu::inventory::socketBegin; augment_iter < EQEmu::inventory::SocketCount; ++augment_iter) augment_id[augment_iter] = item_inst->GetAugmentItemID(augment_iter); uint16 item_charges = 0; @@ -1263,7 +1263,7 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEm bool BotDatabase::DeleteItemBySlot(const uint32 bot_id, const uint32 slot_id) { - if (!bot_id || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::legacy::SlotPowerSource)) + if (!bot_id || (slot_id > EQEmu::legacy::EQUIPMENT_END && slot_id != EQEmu::inventory::slotPowerSource)) return false; query = StringFormat("DELETE FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u'", bot_id, slot_id); @@ -1302,12 +1302,12 @@ bool BotDatabase::SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, c return false; bool all_flag = (slot_id == -2); - if ((slot_id < EQEmu::legacy::EQUIPMENT_BEGIN || slot_id > EQEmu::legacy::EQUIPMENT_END) && slot_id != EQEmu::legacy::SlotPowerSource && !all_flag) + if ((slot_id < EQEmu::legacy::EQUIPMENT_BEGIN || slot_id > EQEmu::legacy::EQUIPMENT_END) && slot_id != EQEmu::inventory::slotPowerSource && !all_flag) return false; std::string where_clause; if (all_flag) - where_clause = StringFormat(" AND `slot_id` IN ('%u', '%u', '%u', '%u', '%u', '%u', '%u')", EQEmu::legacy::SlotHead, EQEmu::legacy::SlotArms, EQEmu::legacy::SlotWrist1, EQEmu::legacy::SlotHands, EQEmu::legacy::SlotChest, EQEmu::legacy::SlotLegs, EQEmu::legacy::SlotFeet); + where_clause = StringFormat(" AND `slot_id` IN ('%u', '%u', '%u', '%u', '%u', '%u', '%u')", EQEmu::inventory::slotHead, EQEmu::inventory::slotArms, EQEmu::inventory::slotWrist1, EQEmu::inventory::slotHands, EQEmu::inventory::slotChest, EQEmu::inventory::slotLegs, EQEmu::inventory::slotFeet); else where_clause = StringFormat(" AND `slot_id` = '%u'", slot_id); @@ -1752,7 +1752,7 @@ bool BotDatabase::SaveAllArmorColorBySlot(const uint32 owner_id, const int16 slo " AND bi.`slot_id` = '%i'", owner_id, rgb_value, - EQEmu::legacy::SlotHead, EQEmu::legacy::SlotChest, EQEmu::legacy::SlotArms, EQEmu::legacy::SlotWrist1, EQEmu::legacy::SlotWrist2, EQEmu::legacy::SlotHands, EQEmu::legacy::SlotLegs, EQEmu::legacy::SlotFeet, + EQEmu::inventory::slotHead, EQEmu::inventory::slotChest, EQEmu::inventory::slotArms, EQEmu::inventory::slotWrist1, EQEmu::inventory::slotWrist2, EQEmu::inventory::slotHands, EQEmu::inventory::slotLegs, EQEmu::inventory::slotFeet, slot_id ); auto results = QueryDatabase(query); @@ -1776,7 +1776,7 @@ bool BotDatabase::SaveAllArmorColors(const uint32 owner_id, const uint32 rgb_val " AND bi.`slot_id` IN ('%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", owner_id, rgb_value, - EQEmu::legacy::SlotHead, EQEmu::legacy::SlotChest, EQEmu::legacy::SlotArms, EQEmu::legacy::SlotWrist1, EQEmu::legacy::SlotWrist2, EQEmu::legacy::SlotHands, EQEmu::legacy::SlotLegs, EQEmu::legacy::SlotFeet + EQEmu::inventory::slotHead, EQEmu::inventory::slotChest, EQEmu::inventory::slotArms, EQEmu::inventory::slotWrist1, EQEmu::inventory::slotWrist2, EQEmu::inventory::slotHands, EQEmu::inventory::slotLegs, EQEmu::inventory::slotFeet ); auto results = QueryDatabase(query); if (!results.Success()) diff --git a/zone/client.cpp b/zone/client.cpp index c0b8078bb..09f843616 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2800,7 +2800,7 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { if (item && item->IsClassCommon()) { uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); - if (matslot != EQEmu::textures::TextureInvalid) + if (matslot != EQEmu::textures::materialInvalid) { m_pp.item_material.Slot[matslot].Material = GetEquipmentMaterial(matslot); } @@ -3132,17 +3132,17 @@ void Client::Tell_StringID(uint32 string_id, const char *who, const char *messag } void Client::SetTint(int16 in_slot, uint32 color) { - EQEmu::Tint_Struct new_color; + EQEmu::textures::Tint_Struct new_color; new_color.Color = color; SetTint(in_slot, new_color); database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color); } // Still need to reconcile bracer01 versus bracer02 -void Client::SetTint(int16 in_slot, EQEmu::Tint_Struct& color) { +void Client::SetTint(int16 in_slot, EQEmu::textures::Tint_Struct& color) { uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); - if (matslot != EQEmu::textures::TextureInvalid) + if (matslot != EQEmu::textures::materialInvalid) { m_pp.item_tint.Slot[matslot].Color = color.Color; database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.Color); @@ -3219,28 +3219,28 @@ void Client::LinkDead() uint8 Client::SlotConvert(uint8 slot,bool bracer){ uint8 slot2 = 0; // why are we returning MainCharm instead of INVALID_INDEX? (must be a pre-charm segment...) if(bracer) - return EQEmu::legacy::SlotWrist2; + return EQEmu::inventory::slotWrist2; switch(slot) { - case EQEmu::textures::TextureHead: - slot2 = EQEmu::legacy::SlotHead; + case EQEmu::textures::armorHead: + slot2 = EQEmu::inventory::slotHead; break; - case EQEmu::textures::TextureChest: - slot2 = EQEmu::legacy::SlotChest; + case EQEmu::textures::armorChest: + slot2 = EQEmu::inventory::slotChest; break; - case EQEmu::textures::TextureArms: - slot2 = EQEmu::legacy::SlotArms; + case EQEmu::textures::armorArms: + slot2 = EQEmu::inventory::slotArms; break; - case EQEmu::textures::TextureWrist: - slot2 = EQEmu::legacy::SlotWrist1; + case EQEmu::textures::armorWrist: + slot2 = EQEmu::inventory::slotWrist1; break; - case EQEmu::textures::TextureHands: - slot2 = EQEmu::legacy::SlotHands; + case EQEmu::textures::armorHands: + slot2 = EQEmu::inventory::slotHands; break; - case EQEmu::textures::TextureLegs: - slot2 = EQEmu::legacy::SlotLegs; + case EQEmu::textures::armorLegs: + slot2 = EQEmu::inventory::slotLegs; break; - case EQEmu::textures::TextureFeet: - slot2 = EQEmu::legacy::SlotFeet; + case EQEmu::textures::armorFeet: + slot2 = EQEmu::inventory::slotFeet; break; } return slot2; @@ -3249,26 +3249,26 @@ uint8 Client::SlotConvert(uint8 slot,bool bracer){ uint8 Client::SlotConvert2(uint8 slot){ uint8 slot2 = 0; // same as above... switch(slot){ - case EQEmu::legacy::SlotHead: - slot2 = EQEmu::textures::TextureHead; + case EQEmu::inventory::slotHead: + slot2 = EQEmu::textures::armorHead; break; - case EQEmu::legacy::SlotChest: - slot2 = EQEmu::textures::TextureChest; + case EQEmu::inventory::slotChest: + slot2 = EQEmu::textures::armorChest; break; - case EQEmu::legacy::SlotArms: - slot2 = EQEmu::textures::TextureArms; + case EQEmu::inventory::slotArms: + slot2 = EQEmu::textures::armorArms; break; - case EQEmu::legacy::SlotWrist1: - slot2 = EQEmu::textures::TextureWrist; + case EQEmu::inventory::slotWrist1: + slot2 = EQEmu::textures::armorWrist; break; - case EQEmu::legacy::SlotHands: - slot2 = EQEmu::textures::TextureHands; + case EQEmu::inventory::slotHands: + slot2 = EQEmu::textures::armorHands; break; - case EQEmu::legacy::SlotLegs: - slot2 = EQEmu::textures::TextureLegs; + case EQEmu::inventory::slotLegs: + slot2 = EQEmu::textures::armorLegs; break; - case EQEmu::legacy::SlotFeet: - slot2 = EQEmu::textures::TextureFeet; + case EQEmu::inventory::slotFeet: + slot2 = EQEmu::textures::armorFeet; break; } return slot2; @@ -4268,14 +4268,14 @@ bool Client::GroupFollow(Client* inviter) { uint16 Client::GetPrimarySkillValue() { EQEmu::skills::SkillType skill = EQEmu::skills::HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill - bool equiped = m_inv.GetItem(EQEmu::legacy::SlotPrimary); + bool equiped = m_inv.GetItem(EQEmu::inventory::slotPrimary); if (!equiped) skill = EQEmu::skills::SkillHandtoHand; else { - uint8 type = m_inv.GetItem(EQEmu::legacy::SlotPrimary)->GetItem()->ItemType; //is this the best way to do this? + uint8 type = m_inv.GetItem(EQEmu::inventory::slotPrimary)->GetItem()->ItemType; //is this the best way to do this? switch (type) { case EQEmu::item::ItemType1HSlash: // 1H Slashing @@ -5785,7 +5785,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { } } - inst = requestee->GetInv().GetItem(EQEmu::legacy::SlotPowerSource); + inst = requestee->GetInv().GetItem(EQEmu::inventory::slotPowerSource); if(inst) { item = inst->GetItem(); @@ -5799,7 +5799,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { insr->itemicons[SoF::invslot::PossessionsPowerSource] = 0xFFFFFFFF; } - inst = requestee->GetInv().GetItem(EQEmu::legacy::SlotAmmo); + inst = requestee->GetInv().GetItem(EQEmu::inventory::slotAmmo); if(inst) { item = inst->GetItem(); @@ -6341,8 +6341,8 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid made_npc->Corrup = GetCorrup(); made_npc->PhR = GetPhR(); // looks - made_npc->texture = GetEquipmentMaterial(EQEmu::textures::TextureChest); - made_npc->helmtexture = GetEquipmentMaterial(EQEmu::textures::TextureHead); + made_npc->texture = GetEquipmentMaterial(EQEmu::textures::armorChest); + made_npc->helmtexture = GetEquipmentMaterial(EQEmu::textures::armorHead); made_npc->haircolor = GetHairColor(); made_npc->beardcolor = GetBeardColor(); made_npc->eyecolor1 = GetEyeColor1(); @@ -6353,9 +6353,9 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid made_npc->drakkin_heritage = GetDrakkinHeritage(); made_npc->drakkin_tattoo = GetDrakkinTattoo(); made_npc->drakkin_details = GetDrakkinDetails(); - made_npc->d_melee_texture1 = GetEquipmentMaterial(EQEmu::textures::TexturePrimary); - made_npc->d_melee_texture2 = GetEquipmentMaterial(EQEmu::textures::TextureSecondary); - for (int i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTexture; i++) { + made_npc->d_melee_texture1 = GetEquipmentMaterial(EQEmu::textures::weaponPrimary); + made_npc->d_melee_texture2 = GetEquipmentMaterial(EQEmu::textures::weaponSecondary); + for (int i = EQEmu::textures::textureBegin; i <= EQEmu::textures::LastTexture; i++) { made_npc->armor_tint.Slot[i].Color = GetEquipmentColor(i); } made_npc->loottable_id = 0; @@ -8061,7 +8061,7 @@ void Client::TickItemCheck() TryItemTick(i); } //Scan main inventory + cursor - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::SlotCursor; i++) + for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) { TryItemTick(i); } @@ -8092,7 +8092,7 @@ void Client::TryItemTick(int slot) //Only look at augs in main inventory if (slot > EQEmu::legacy::EQUIPMENT_END) { return; } - for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) + for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) { EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) { continue; } @@ -8118,7 +8118,7 @@ void Client::ItemTimerCheck() TryItemTimer(i); } - for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::SlotCursor; i++) + for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) { TryItemTimer(i); } @@ -8149,7 +8149,7 @@ void Client::TryItemTimer(int slot) return; } - for (int x = AUG_INDEX_BEGIN; x < EQEmu::legacy::ITEM_COMMON_SIZE; ++x) + for (int x = EQEmu::inventory::socketBegin; x < EQEmu::inventory::SocketCount; ++x) { EQEmu::ItemInstance * a_inst = inst->GetAugment(x); if(!a_inst) { @@ -8482,7 +8482,7 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, AddMoneyToPP(copper, silver, gold, platinum, false); if (itemid > 0) - SummonItem(itemid, 0, 0, 0, 0, 0, 0, false, EQEmu::legacy::SlotPowerSource); + SummonItem(itemid, 0, 0, 0, 0, 0, 0, false, EQEmu::inventory::slotPowerSource); if (faction) { diff --git a/zone/client.h b/zone/client.h index cc5abb88d..bfe9f96cd 100644 --- a/zone/client.h +++ b/zone/client.h @@ -222,7 +222,7 @@ public: //abstract virtual function implementations required by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } @@ -808,7 +808,7 @@ public: uint32 NukeItem(uint32 itemnum, uint8 where_to_check = (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); void SetTint(int16 slot_id, uint32 color); - void SetTint(int16 slot_id, EQEmu::Tint_Struct& color); + void SetTint(int16 slot_id, EQEmu::textures::Tint_Struct& color); void SetMaterial(int16 slot_id, uint32 item_id); void Undye(); int32 GetItemIDAt(int16 slot_id); @@ -822,7 +822,7 @@ public: void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); void PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, ServerLootItem_Struct** bag_item_data = 0); bool AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::legacy::SlotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::inventory::slotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 69f1444f1..f2205aabd 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1074,9 +1074,9 @@ int32 Client::CalcAC() } // Shield AC bonus for HeroicSTR if (itembonuses.HeroicSTR) { - bool equiped = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary); + bool equiped = CastToClient()->m_inv.GetItem(EQEmu::inventory::slotSecondary); if (equiped) { - uint8 shield = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType; + uint8 shield = CastToClient()->m_inv.GetItem(EQEmu::inventory::slotSecondary)->GetItem()->ItemType; if (shield == EQEmu::item::ItemTypeShield) { displayed += itembonuses.HeroicSTR / 2; } @@ -1103,9 +1103,9 @@ int32 Client::GetACMit() } // Shield AC bonus for HeroicSTR if (itembonuses.HeroicSTR) { - bool equiped = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary); + bool equiped = CastToClient()->m_inv.GetItem(EQEmu::inventory::slotSecondary); if (equiped) { - uint8 shield = CastToClient()->m_inv.GetItem(EQEmu::legacy::SlotSecondary)->GetItem()->ItemType; + uint8 shield = CastToClient()->m_inv.GetItem(EQEmu::inventory::slotSecondary)->GetItem()->ItemType; if (shield == EQEmu::item::ItemTypeShield) { mitigation += itembonuses.HeroicSTR / 2; } @@ -1320,7 +1320,7 @@ uint32 Client::CalcCurrentWeight() EQEmu::ItemInstance* ins; uint32 Total = 0; int x; - for (x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::SlotCursor; x++) { // include cursor or not? + for (x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::inventory::slotCursor; x++) { // include cursor or not? TempItem = 0; ins = GetInv().GetItem(x); if (ins) { @@ -1343,7 +1343,7 @@ uint32 Client::CalcCurrentWeight() if (TmpWeight > 0) { // this code indicates that weight redux bags can only be in the first general inventory slot to be effective... // is this correct? or can we scan for the highest weight redux and use that? (need client verifications) - int bagslot = EQEmu::legacy::SlotGeneral1; + int bagslot = EQEmu::inventory::slotGeneral1; int reduction = 0; for (int m = EQEmu::legacy::GENERAL_BAGS_BEGIN + 10; m <= EQEmu::legacy::GENERAL_BAGS_END; m += 10) { // include cursor bags or not? if (x >= m) { @@ -2219,12 +2219,12 @@ int Client::GetRawACNoShield(int &shield_ac) const { int ac = itembonuses.AC + spellbonuses.AC + aabonuses.AC; shield_ac = 0; - const EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::inventory::slotSecondary); if (inst) { if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { ac -= inst->GetItem()->AC; shield_ac = inst->GetItem()->AC; - for (uint8 i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (uint8 i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if (inst->GetAugment(i)) { ac -= inst->GetAugment(i)->GetItem()->AC; shield_ac += inst->GetAugment(i)->GetItem()->AC; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a8c96e146..a537c1db2 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1334,7 +1334,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) } /* Set item material tint */ - for (int i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTexture; i++) + for (int i = EQEmu::textures::textureBegin; i <= EQEmu::textures::LastTexture; i++) { if (m_pp.item_tint.Slot[i].UseTint == 1 || m_pp.item_tint.Slot[i].UseTint == 255) { @@ -1691,7 +1691,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (iter == m_inv.cursor_cbegin()) continue; const EQEmu::ItemInstance *inst = *iter; - SendItemPacket(EQEmu::legacy::SlotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); } } @@ -2029,7 +2029,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) EQEmu::ItemInstance *inst = database.CreateItem(item, charges); if (!AutoPutLootInInventory(*inst, true, true)) { - PutLootInInventory(EQEmu::legacy::SlotCursor, *inst); + PutLootInInventory(EQEmu::inventory::slotCursor, *inst); } Save(1); } @@ -2554,7 +2554,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) EQEmu::ItemInstance *inst = database.CreateItem(item, charges); if (!AutoPutLootInInventory(*inst, true, true)) { - PutLootInInventory(EQEmu::legacy::SlotCursor, *inst); + PutLootInInventory(EQEmu::inventory::slotCursor, *inst); } Save(1); @@ -2604,7 +2604,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) SetAlternateCurrencyValue(reclaim->currency_id, 0); } else { - SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, 0, false, EQEmu::legacy::SlotCursor); + SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, 0, false, EQEmu::inventory::slotCursor); AddAlternateCurrencyValue(reclaim->currency_id, -((int32)reclaim->count)); } /* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */ @@ -2816,8 +2816,8 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) } uint32 ApplyPoisonSuccessResult = 0; ApplyPoison_Struct* ApplyPoisonData = (ApplyPoison_Struct*)app->pBuffer; - const EQEmu::ItemInstance* PrimaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary); - const EQEmu::ItemInstance* SecondaryWeapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance* PrimaryWeapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); + const EQEmu::ItemInstance* SecondaryWeapon = GetInv().GetItem(EQEmu::inventory::slotSecondary); const EQEmu::ItemInstance* PoisonItemInstance = GetInv()[ApplyPoisonData->inventorySlot]; bool IsPoison = PoisonItemInstance && (PoisonItemInstance->GetItem()->ItemType == EQEmu::item::ItemTypePoison); @@ -2999,7 +2999,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { case 0: // Adding an augment case 2: // Swapping augment - new_aug = user_inv.GetItem(EQEmu::legacy::SlotCursor); + new_aug = user_inv.GetItem(EQEmu::inventory::slotCursor); if (!new_aug) // Shouldn't get the OP code without the augment on the user's cursor, but maybe it's h4x. { @@ -3057,7 +3057,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (itemOneToPush) { DeleteItemInInventory(item_slot, 0, true); - DeleteItemInInventory(EQEmu::legacy::SlotCursor, new_aug->IsStackable() ? 1 : 0, true); + DeleteItemInInventory(EQEmu::inventory::slotCursor, new_aug->IsStackable() ? 1 : 0, true); if (solvent) { @@ -3068,7 +3068,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (itemTwoToPush) { // This is a swap. Return the old aug to the player's cursor. - if (!PutItemInInventory(EQEmu::legacy::SlotCursor, *itemTwoToPush, true)) + if (!PutItemInInventory(EQEmu::inventory::slotCursor, *itemTwoToPush, true)) { Log.Out(Logs::General, Logs::Error, "Problem returning old augment to player's cursor after augmentation swap."); Message(15, "Error: Failed to retrieve old augment after augmentation swap!"); @@ -3081,7 +3081,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) CalcBonuses(); - if (mat != EQEmu::textures::TextureInvalid) + if (mat != EQEmu::textures::materialInvalid) { SendWearChange(mat); // Visible item augged while equipped. Send WC in case ornamentation changed. } @@ -3146,13 +3146,13 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) CalcBonuses(); - if (mat != EQEmu::textures::TextureInvalid) + if (mat != EQEmu::textures::materialInvalid) { SendWearChange(mat); // Visible item augged while equipped. Send WC in case ornamentation changed. } // Drop the removed augment on the player's cursor - if (!PutItemInInventory(EQEmu::legacy::SlotCursor, *itemTwoToPush, true)) + if (!PutItemInInventory(EQEmu::inventory::slotCursor, *itemTwoToPush, true)) { Log.Out(Logs::General, Logs::Error, "Problem returning augment to player's cursor after safe removal."); Message(15, "Error: Failed to return augment after removal from item!"); @@ -3201,7 +3201,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) CalcBonuses(); - if (mat != EQEmu::textures::TextureInvalid) + if (mat != EQEmu::textures::materialInvalid) { SendWearChange(mat); } @@ -4070,7 +4070,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) } else { - Message(0, "Error: castspell->inventoryslot >= %i (0x%04x)", EQEmu::legacy::SlotCursor, castspell->inventoryslot); + Message(0, "Error: castspell->inventoryslot >= %i (0x%04x)", EQEmu::inventory::slotCursor, castspell->inventoryslot); InterruptSpell(castspell->spell_id); } } @@ -4993,7 +4993,7 @@ void Client::Handle_OP_CrashDump(const EQApplicationPacket *app) void Client::Handle_OP_CreateObject(const EQApplicationPacket *app) { - DropItem(EQEmu::legacy::SlotCursor); + DropItem(EQEmu::inventory::slotCursor); return; } @@ -6919,7 +6919,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) return; } - EQEmu::ItemInstance *CursorItemInst = GetInv().GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance *CursorItemInst = GetInv().GetItem(EQEmu::inventory::slotCursor); bool Allowed = true; @@ -6967,7 +6967,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { GuildBankDepositAck(false, sentAction); - DeleteItemInInventory(EQEmu::legacy::SlotCursor, 0, false); + DeleteItemInInventory(EQEmu::inventory::slotCursor, 0, false); } break; @@ -6988,7 +6988,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) case GuildBankWithdraw: { - if (GetInv()[EQEmu::legacy::SlotCursor]) + if (GetInv()[EQEmu::inventory::slotCursor]) { Message_StringID(13, GUILD_BANK_EMPTY_HANDS); @@ -7034,7 +7034,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::legacy::SlotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); GuildBanks->DeleteItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity); } @@ -8016,7 +8016,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) const EQEmu::ItemData* item = nullptr; int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::legacy::SlotWaist; L++) { + for (int16 L = EQEmu::legacy::EQUIPMENT_BEGIN; L <= EQEmu::inventory::slotWaist; L++) { const EQEmu::ItemInstance* inst = GetInv().GetItem(L); item = inst ? inst->GetItem() : nullptr; @@ -8036,7 +8036,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) else { insr->itemicons[L] = 0xFFFFFFFF; } } - const EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::legacy::SlotAmmo); + const EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::inventory::slotAmmo); item = inst ? inst->GetItem() : nullptr; if (item) { @@ -8498,7 +8498,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) EQEmu::ItemInstance* clickaug = 0; EQEmu::ItemData* augitem = 0; - for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { + for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { const EQEmu::ItemInstance* aug_i = inst->GetAugment(r); if (!aug_i) continue; @@ -12031,7 +12031,7 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app) Shielding_Struct* shield = (Shielding_Struct*)app->pBuffer; shield_target = entity_list.GetMob(shield->target_id); bool ack = false; - EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance* inst = GetInv().GetItem(EQEmu::inventory::slotSecondary); if (!shield_target) return; if (inst) @@ -12243,8 +12243,8 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) // shouldn't we be reimbursing if these two fail? //make sure we are not completely full... - if (freeslotid == EQEmu::legacy::SlotCursor) { - if (m_inv.GetItem(EQEmu::legacy::SlotCursor) != nullptr) { + if (freeslotid == EQEmu::inventory::slotCursor) { + if (m_inv.GetItem(EQEmu::inventory::slotCursor) != nullptr) { Message(13, "You do not have room for any more items."); safe_delete(outapp); safe_delete(inst); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 8e2ab8313..55843e724 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -296,7 +296,7 @@ bool Client::Process() { } if(AutoFireEnabled()){ - EQEmu::ItemInstance *ranged = GetInv().GetItem(EQEmu::legacy::SlotRange); + EQEmu::ItemInstance *ranged = GetInv().GetItem(EQEmu::inventory::slotRange); if(ranged) { if (ranged->GetItem() && ranged->GetItem()->ItemType == EQEmu::item::ItemTypeBow){ @@ -391,10 +391,10 @@ bool Client::Process() { } else if (auto_attack_target->GetHP() > -10) // -10 so we can watch people bleed in PvP { - EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::legacy::SlotPrimary); - TryWeaponProc(wpn, auto_attack_target, EQEmu::legacy::SlotPrimary); + EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::inventory::slotPrimary); + TryWeaponProc(wpn, auto_attack_target, EQEmu::inventory::slotPrimary); - DoAttackRounds(auto_attack_target, EQEmu::legacy::SlotPrimary); + DoAttackRounds(auto_attack_target, EQEmu::inventory::slotPrimary); if (CheckAATimer(aaTimerRampage)) entity_list.AEAttack(this, 30); } @@ -430,10 +430,10 @@ bool Client::Process() { else if(auto_attack_target->GetHP() > -10) { CheckIncreaseSkill(EQEmu::skills::SkillDualWield, auto_attack_target, -10); if (CheckDualWield()) { - EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::legacy::SlotSecondary); - TryWeaponProc(wpn, auto_attack_target, EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *wpn = GetInv().GetItem(EQEmu::inventory::slotSecondary); + TryWeaponProc(wpn, auto_attack_target, EQEmu::inventory::slotSecondary); - DoAttackRounds(auto_attack_target, EQEmu::legacy::SlotSecondary); + DoAttackRounds(auto_attack_target, EQEmu::inventory::slotSecondary); } } } @@ -763,7 +763,7 @@ void Client::BulkSendInventoryItems() EQEmu::OutBuffer::pos_type last_pos = ob.tellp(); // Possessions items - for (int16 slot_id = SLOT_BEGIN; slot_id < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; slot_id++) { + for (int16 slot_id = EQEmu::inventory::slotBegin; slot_id < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; slot_id++) { const EQEmu::ItemInstance* inst = m_inv[slot_id]; if (!inst) continue; @@ -778,12 +778,12 @@ void Client::BulkSendInventoryItems() // PowerSource item if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::SlotPowerSource]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::inventory::slotPowerSource]; if (inst) { - inst->Serialize(ob, EQEmu::legacy::SlotPowerSource); + inst->Serialize(ob, EQEmu::inventory::slotPowerSource); if (ob.tellp() == last_pos) - Log.Out(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", EQEmu::legacy::SlotPowerSource); + Log.Out(Logs::General, Logs::Inventory, "Serialization failed on item slot %d during BulkSendInventoryItems. Item skipped.", EQEmu::inventory::slotPowerSource); last_pos = ob.tellp(); } @@ -1095,7 +1095,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) switch(memspell->scribing) { case memSpellScribing: { // scribing spell to book - const EQEmu::ItemInstance* inst = m_inv[EQEmu::legacy::SlotCursor]; + const EQEmu::ItemInstance* inst = m_inv[EQEmu::inventory::slotCursor]; if (inst && inst->IsClassCommon()) { @@ -1109,7 +1109,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) if(item && item->Scroll.Effect == (int32)(memspell->spell_id)) { ScribeSpell(memspell->spell_id, memspell->slot); - DeleteItemInInventory(EQEmu::legacy::SlotCursor, 1, true); + DeleteItemInInventory(EQEmu::inventory::slotCursor, 1, true); } else Message(0,"Scribing spell: inst exists but item does not or spell ids do not match."); diff --git a/zone/command.cpp b/zone/command.cpp index 1ac321223..487e25286 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2417,14 +2417,14 @@ void command_texture(Client *c, const Seperator *sep) // Player Races Wear Armor, so Wearchange is sent instead int i; if (!c->GetTarget()) - for (i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTintableTexture; i++) + for (i = EQEmu::textures::textureBegin; i <= EQEmu::textures::LastTintableTexture; i++) { c->SendTextureWC(i, texture); } else if ((c->GetTarget()->GetRace() > 0 && c->GetTarget()->GetRace() <= 12) || c->GetTarget()->GetRace() == 128 || c->GetTarget()->GetRace() == 130 || c->GetTarget()->GetRace() == 330 || c->GetTarget()->GetRace() == 522) { - for (i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTintableTexture; i++) + for (i = EQEmu::textures::textureBegin; i <= EQEmu::textures::LastTintableTexture; i++) { c->GetTarget()->SendTextureWC(i, texture); } @@ -2567,14 +2567,14 @@ void command_peekinv(Client *c, const Seperator *sep) } if ((scopeWhere & peekWorn) && (targetClient->ClientVersion() >= EQEmu::versions::ClientVersion::SoF)) { - inst_main = targetClient->GetInv().GetItem(EQEmu::legacy::SlotPowerSource); + inst_main = targetClient->GetInv().GetItem(EQEmu::inventory::slotPowerSource); item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); linker.SetItemInst(inst_main); item_link = linker.GenerateLink(); c->Message((item_data == nullptr), "WornSlot: %i, Item: %i (%s), Charges: %i", - EQEmu::legacy::SlotPowerSource, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); + EQEmu::inventory::slotPowerSource, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); } // inv @@ -2588,7 +2588,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "InvSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = EQEmu::inventory::containerBegin; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::inventory::ContainerCount); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2608,7 +2608,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message(1, "CursorSlot: %i, Item: %i (%s), Charges: %i", - EQEmu::legacy::SlotCursor, 0, item_link.c_str(), 0); + EQEmu::inventory::slotCursor, 0, item_link.c_str(), 0); } else { int cursorDepth = 0; @@ -2620,9 +2620,9 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", - EQEmu::legacy::SlotCursor, cursorDepth, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); + EQEmu::inventory::slotCursor, cursorDepth, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; (cursorDepth == 0) && inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = EQEmu::inventory::containerBegin; (cursorDepth == 0) && inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::inventory::ContainerCount); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2630,7 +2630,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(EQEmu::legacy::SlotCursor, indexSub), EQEmu::legacy::SlotCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + Inventory::CalcSlotId(EQEmu::inventory::slotCursor, indexSub), EQEmu::inventory::slotCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } } @@ -2659,7 +2659,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "BankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = EQEmu::inventory::containerBegin; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::inventory::ContainerCount); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2681,7 +2681,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = EQEmu::inventory::containerBegin; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::inventory::ContainerCount); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2704,7 +2704,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "TradeSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = EQEmu::inventory::containerBegin; inst_main && inst_main->IsClassBag() && (indexSub < EQEmu::inventory::ContainerCount); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -2726,7 +2726,7 @@ void command_peekinv(Client *c, const Seperator *sep) else { c->Message(0, "[WorldObject DBID: %i (entityid: %i)]", objectTradeskill->GetDBID(), objectTradeskill->GetID()); - for (int16 indexMain = SLOT_BEGIN; indexMain < EQEmu::legacy::TYPE_WORLD_SIZE; ++indexMain) { + for (int16 indexMain = EQEmu::inventory::slotBegin; indexMain < EQEmu::legacy::TYPE_WORLD_SIZE; ++indexMain) { inst_main = objectTradeskill->GetItem(indexMain); item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); linker.SetItemInst(inst_main); @@ -2736,7 +2736,7 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item_data == nullptr), "WorldSlot: %i, Item: %i (%s), Charges: %i", (EQEmu::legacy::WORLD_BEGIN + indexMain), ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_INDEX_BEGIN; inst_main && inst_main->IsType(EQEmu::item::ItemClassBag) && (indexSub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++indexSub) { + for (uint8 indexSub = EQEmu::inventory::containerBegin; inst_main && inst_main->IsType(EQEmu::item::ItemClassBag) && (indexSub < EQEmu::inventory::ContainerCount); ++indexSub) { inst_sub = inst_main->GetItem(indexSub); item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); linker.SetItemInst(inst_sub); @@ -3145,8 +3145,8 @@ void command_listpetition(Client *c, const Seperator *sep) void command_equipitem(Client *c, const Seperator *sep) { uint32 slot_id = atoi(sep->arg[1]); - if (sep->IsNumber(1) && ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::legacy::SlotPowerSource))) { - const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::legacy::SlotCursor); + if (sep->IsNumber(1) && ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) && (slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource))) { + const EQEmu::ItemInstance* from_inst = c->GetInv().GetItem(EQEmu::inventory::slotCursor); const EQEmu::ItemInstance* to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack) bool partialmove = false; int16 movecount; @@ -3154,7 +3154,7 @@ void command_equipitem(Client *c, const Seperator *sep) if (from_inst && from_inst->IsClassCommon()) { auto outapp = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mi = (MoveItem_Struct*)outapp->pBuffer; - mi->from_slot = EQEmu::legacy::SlotCursor; + mi->from_slot = EQEmu::inventory::slotCursor; mi->to_slot = slot_id; // mi->number_in_stack = from_inst->GetCharges(); // replaced with con check for stacking @@ -4339,7 +4339,7 @@ void command_goto(Client *c, const Seperator *sep) void command_iteminfo(Client *c, const Seperator *sep) { - auto inst = c->GetInv()[EQEmu::legacy::SlotCursor]; + auto inst = c->GetInv()[EQEmu::inventory::slotCursor]; if (!inst) { c->Message(13, "Error: You need an item on your cursor for this command"); return; @@ -7124,7 +7124,7 @@ void command_path(Client *c, const Seperator *sep) } void Client::Undye() { - for (int cur_slot = EQEmu::textures::TextureBegin; cur_slot <= EQEmu::textures::LastTexture; cur_slot++) { + for (int cur_slot = EQEmu::textures::textureBegin; cur_slot <= EQEmu::textures::LastTexture; cur_slot++) { uint8 slot2=SlotConvert(cur_slot); EQEmu::ItemInstance* inst = m_inv.GetItem(slot2); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 3690a3b4f..57a85aff9 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -323,12 +323,12 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( // to go into the regular slots on the player, out of bags std::list removed_list; - for (i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++i) { - if (i == EQEmu::legacy::SlotAmmo && client->ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - item = client->GetInv().GetItem(EQEmu::legacy::SlotPowerSource); + for (i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++i) { + if (i == EQEmu::inventory::slotAmmo && client->ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { + item = client->GetInv().GetItem(EQEmu::inventory::slotPowerSource); if (item != nullptr) { if (!client->IsBecomeNPC() || (client->IsBecomeNPC() && !item->GetItem()->NoRent)) - MoveItemToCorpse(client, item, EQEmu::legacy::SlotPowerSource, removed_list); + MoveItemToCorpse(client, item, EQEmu::inventory::slotPowerSource, removed_list); } } @@ -405,9 +405,9 @@ void Corpse::MoveItemToCorpse(Client *client, EQEmu::ItemInstance *inst, int16 e while (true) { if (!inst->IsClassBag()) { break; } - if (equipSlot < EQEmu::legacy::GENERAL_BEGIN || equipSlot > EQEmu::legacy::SlotCursor) { break; } + if (equipSlot < EQEmu::legacy::GENERAL_BEGIN || equipSlot > EQEmu::inventory::slotCursor) { break; } - for (auto sub_index = SUB_INDEX_BEGIN; sub_index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++sub_index) { + for (int16 sub_index = EQEmu::inventory::containerBegin; sub_index < EQEmu::inventory::ContainerCount; ++sub_index) { int16 real_bag_slot = Inventory::CalcSlotId(equipSlot, sub_index); auto bag_inst = client->GetInv().GetItem(real_bag_slot); if (bag_inst == nullptr) { continue; } @@ -685,7 +685,7 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot)) { - int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, SUB_INDEX_BEGIN); + int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, EQEmu::inventory::containerBegin); cur = itemlist.begin(); end = itemlist.end(); @@ -740,7 +740,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data) itemlist.erase(iter); uint8 material = Inventory::CalcMaterialFromSlot(sitem->equip_slot); // autos to unsigned char - if (material != EQEmu::textures::TextureInvalid) + if (material != EQEmu::textures::materialInvalid) SendWearChange(material); UpdateEquipmentLight(); @@ -999,7 +999,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(client->ClientVersion()))->InventoryTypeSize[EQEmu::legacy::TypeCorpse]; + int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(client->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; @@ -1008,7 +1008,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a // Dont display the item if it's in a bag // Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse. - if (!IsPlayerCorpse() || item_data->equip_slot <= EQEmu::legacy::SlotCursor || item_data->equip_slot == EQEmu::legacy::SlotPowerSource || Loot_Request_Type >= 3 || + if (!IsPlayerCorpse() || item_data->equip_slot <= EQEmu::inventory::slotCursor || item_data->equip_slot == EQEmu::inventory::slotPowerSource || Loot_Request_Type >= 3 || (item_data->equip_slot >= 8000 && item_data->equip_slot <= 8999)) { if(i < corpselootlimit) { item = database.GetItem(item_data->item_id); @@ -1148,7 +1148,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } if (inst->IsAugmented()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { EQEmu::ItemInstance *itm = inst->GetAugment(i); if (itm) { if (client->CheckLoreConflict(itm->GetItem())) { @@ -1190,10 +1190,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { /* First add it to the looter - this will do the bag contents too */ if (lootitem->auto_loot) { if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data)) - client->PutLootInInventory(EQEmu::legacy::SlotCursor, *inst, bag_item_data); + client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data); } else { - client->PutLootInInventory(EQEmu::legacy::SlotCursor, *inst, bag_item_data); + client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data); } /* Update any tasks that have an activity to loot this item */ @@ -1210,7 +1210,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { /* Remove Bag Contents */ if (item->IsClassBag() && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) { - for (int i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { + for (int i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { if (bag_item_data[i]) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id); @@ -1294,7 +1294,7 @@ void Corpse::QueryLoot(Client* to) { cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(to->ClientVersion()))->InventoryTypeSize[EQEmu::legacy::TypeCorpse]; + int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(to->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; @@ -1403,12 +1403,12 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const { int16 invslot; if (material_slot > EQEmu::textures::LastTexture) { - return NO_ITEM; + return 0; } invslot = Inventory::CalcSlotFromMaterial(material_slot); - if(invslot == INVALID_INDEX) // GetWornItem() should be returning a NO_ITEM for any invalid index... - return NO_ITEM; + if(invslot == INVALID_INDEX) // GetWornItem() should be returning a 0 for any invalid index... + return 0; return GetWornItem(invslot); } @@ -1421,7 +1421,7 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { } item = database.GetItem(GetEquipment(material_slot)); - if(item != NO_ITEM) { + if(item != 0) { return (item_tint.Slot[material_slot].UseTint ? item_tint.Slot[material_slot].Color : item->Color); } @@ -1434,8 +1434,8 @@ void Corpse::UpdateEquipmentLight() m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { - if (((*iter)->equip_slot < EQEmu::legacy::EQUIPMENT_BEGIN || (*iter)->equip_slot > EQEmu::legacy::EQUIPMENT_END) && (*iter)->equip_slot != EQEmu::legacy::SlotPowerSource) { continue; } - if ((*iter)->equip_slot == EQEmu::legacy::SlotAmmo) { continue; } + if (((*iter)->equip_slot < EQEmu::legacy::EQUIPMENT_BEGIN || (*iter)->equip_slot > EQEmu::legacy::EQUIPMENT_END) && (*iter)->equip_slot != EQEmu::inventory::slotPowerSource) { continue; } + if ((*iter)->equip_slot == EQEmu::inventory::slotAmmo) { continue; } auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } diff --git a/zone/corpse.h b/zone/corpse.h index e43c4c020..e83235c1e 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -53,7 +53,7 @@ class Corpse : public Mob { /* Corpse: General */ virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, 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 Attack(Mob* other, int Hand = EQEmu::inventory::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; } virtual Raid* GetRaid() { return 0; } diff --git a/zone/doors.cpp b/zone/doors.cpp index dd3dbd651..45953fc89 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -188,7 +188,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) uint8 keepoffkeyring = GetNoKeyring(); uint32 haskey = 0; uint32 playerkey = 0; - const EQEmu::ItemInstance *lockpicks = sender->GetInv().GetItem(EQEmu::legacy::SlotCursor); + const EQEmu::ItemInstance *lockpicks = sender->GetInv().GetItem(EQEmu::inventory::slotCursor); haskey = sender->GetInv().HasItem(keyneeded, 1); diff --git a/zone/encounter.h b/zone/encounter.h index ed8faec34..8b672fdd4 100644 --- a/zone/encounter.h +++ b/zone/encounter.h @@ -36,7 +36,7 @@ public: //abstract virtual function implementations required by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0) { return; } - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0) { return false; } diff --git a/zone/entity.h b/zone/entity.h index 8abb34ca2..d2141d1b9 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -352,7 +352,7 @@ public: void QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app); void QueueManaged(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true); - void AEAttack(Mob *attacker, float dist, int Hand = EQEmu::legacy::SlotPrimary, int count = 0, bool IsFromSpell = false); + void AEAttack(Mob *attacker, float dist, int Hand = EQEmu::inventory::slotPrimary, int count = 0, bool IsFromSpell = false); void AETaunt(Client *caster, float range=0, int32 bonus_hate=0); void AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true, int16 resist_adjust = 0); void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); diff --git a/zone/forage.cpp b/zone/forage.cpp index b1ff0f545..aec4d6b73 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -153,7 +153,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, //we need this function to immediately determine, after we receive OP_Fishing, if we can even try to fish, otherwise we have to wait a while to get the failure bool Client::CanFish() { //make sure we still have a fishing pole on: - const EQEmu::ItemInstance* Pole = m_inv[EQEmu::legacy::SlotPrimary]; + const EQEmu::ItemInstance* Pole = m_inv[EQEmu::inventory::slotPrimary]; int32 bslot = m_inv.HasItemByUse(EQEmu::item::ItemTypeFishingBait, 1, invWhereWorn | invWherePersonal); const EQEmu::ItemInstance* Bait = nullptr; if (bslot != INVALID_INDEX) @@ -317,12 +317,12 @@ void Client::GoFish() else { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::legacy::SlotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); if(RuleB(TaskSystem, EnableTaskSystem)) UpdateTasksForItem(ActivityFish, food_id); safe_delete(inst); - inst = m_inv.GetItem(EQEmu::legacy::SlotCursor); + inst = m_inv.GetItem(EQEmu::inventory::slotCursor); } if(inst) { @@ -354,7 +354,7 @@ void Client::GoFish() //and then swap out items in primary slot... too lazy to fix right now if (zone->random.Int(0, 49) == 1) { Message_StringID(MT_Skills, FISHING_POLE_BROKE); //Your fishing pole broke! - DeleteItemInInventory(EQEmu::legacy::SlotPrimary, 0, true); + DeleteItemInInventory(EQEmu::inventory::slotPrimary, 0, true); } if (CheckIncreaseSkill(EQEmu::skills::SkillFishing, nullptr, 5)) @@ -431,12 +431,12 @@ void Client::ForageItem(bool guarantee) { } else { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::legacy::SlotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); if(RuleB(TaskSystem, EnableTaskSystem)) UpdateTasksForItem(ActivityForage, foragedfood); safe_delete(inst); - inst = m_inv.GetItem(EQEmu::legacy::SlotCursor); + inst = m_inv.GetItem(EQEmu::inventory::slotCursor); } if(inst) { diff --git a/zone/inventory.cpp b/zone/inventory.cpp index ae0a82ae3..c89879610 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -48,8 +48,8 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } } - if (GetItemIDAt(EQEmu::legacy::SlotPowerSource) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::legacy::SlotPowerSource) != INVALID_ID)) { - cur = m_inv.GetItem(EQEmu::legacy::SlotPowerSource); + if (GetItemIDAt(EQEmu::inventory::slotPowerSource) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::inventory::slotPowerSource) != INVALID_ID)) { + cur = m_inv.GetItem(EQEmu::inventory::slotPowerSource); if(cur && cur->GetItem()->Stackable) { x += cur->GetCharges(); } else { @@ -57,22 +57,22 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { } if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) - DeleteItemInInventory(EQEmu::legacy::SlotPowerSource, 0, true); + DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, true); else - DeleteItemInInventory(EQEmu::legacy::SlotPowerSource, 0, false); // Prevents Titanium crash + DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, false); // Prevents Titanium crash } } if(where_to_check & invWhereCursor) { - if (GetItemIDAt(EQEmu::legacy::SlotCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::legacy::SlotCursor) != INVALID_ID)) { - cur = m_inv.GetItem(EQEmu::legacy::SlotCursor); + if (GetItemIDAt(EQEmu::inventory::slotCursor) == itemnum || (itemnum == 0xFFFE && GetItemIDAt(EQEmu::inventory::slotCursor) != INVALID_ID)) { + cur = m_inv.GetItem(EQEmu::inventory::slotCursor); if(cur && cur->GetItem()->Stackable) { x += cur->GetCharges(); } else { x++; } - DeleteItemInInventory(EQEmu::legacy::SlotCursor, 0, true); + DeleteItemInInventory(EQEmu::inventory::slotCursor, 0, true); } for (i = EQEmu::legacy::CURSOR_BAG_BEGIN; i <= EQEmu::legacy::CURSOR_BAG_END; i++) { @@ -236,7 +236,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, } */ - uint32 augments[EQEmu::legacy::ITEM_COMMON_SIZE] = { aug1, aug2, aug3, aug4, aug5, aug6 }; + uint32 augments[EQEmu::inventory::SocketCount] = { aug1, aug2, aug3, aug4, aug5, aug6 }; uint32 classes = item->Classes; uint32 races = item->Races; @@ -246,7 +246,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, bool enforcerestr = RuleB(Inventory, EnforceAugmentRestriction); bool enforceusable = RuleB(Inventory, EnforceAugmentUsability); - for (int iter = AUG_INDEX_BEGIN; iter < EQEmu::legacy::ITEM_COMMON_SIZE; ++iter) { + for (int iter = EQEmu::inventory::socketBegin; iter < EQEmu::inventory::SocketCount; ++iter) { const EQEmu::ItemData* augtest = database.GetItem(augments[iter]); if(augtest == nullptr) { @@ -540,7 +540,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, } // add any validated augments - for (int iter = AUG_INDEX_BEGIN; iter < EQEmu::legacy::ITEM_COMMON_SIZE; ++iter) { + for (int iter = EQEmu::inventory::socketBegin; iter < EQEmu::inventory::SocketCount; ++iter) { if(augments[iter]) inst->PutAugment(&database, iter, augments[iter]); } @@ -554,22 +554,22 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, inst->SetOrnamentHeroModel(ornament_hero_model); // check to see if item is usable in requested slot - if (enforceusable && (((to_slot >= EQEmu::legacy::SlotCharm) && (to_slot <= EQEmu::legacy::SlotAmmo)) || (to_slot == EQEmu::legacy::SlotPowerSource))) { - uint32 slottest = (to_slot == EQEmu::legacy::SlotPowerSource) ? 22 : to_slot; // can't change '22' just yet... + if (enforceusable && (((to_slot >= EQEmu::inventory::slotCharm) && (to_slot <= EQEmu::inventory::slotAmmo)) || (to_slot == EQEmu::inventory::slotPowerSource))) { + uint32 slottest = (to_slot == EQEmu::inventory::slotPowerSource) ? 22 : to_slot; // can't change '22' just yet... if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); - to_slot = EQEmu::legacy::SlotCursor; + to_slot = EQEmu::inventory::slotCursor; } } // put item into inventory - if (to_slot == EQEmu::legacy::SlotCursor) { + if (to_slot == EQEmu::inventory::slotCursor) { PushItemOnCursor(*inst); - SendItemPacket(EQEmu::legacy::SlotCursor, inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, inst, ItemPacketLimbo); } else { PutItemInInventory(to_slot, *inst, true); @@ -617,7 +617,7 @@ void Client::DropItem(int16 slot_id) } // Save client inventory change to database - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { SendCursorBuffer(); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(CharacterID(), s, e); @@ -706,11 +706,11 @@ void Client::SendCursorBuffer() GetName(), test_item->Name, test_item->ID); Message_StringID(MT_LootMessages, 290); parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0); - DeleteItemInInventory(EQEmu::legacy::SlotCursor); + DeleteItemInInventory(EQEmu::inventory::slotCursor); SendCursorBuffer(); } else { - SendItemPacket(EQEmu::legacy::SlotCursor, test_inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, test_inst, ItemPacketLimbo); } } @@ -763,7 +763,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd qsaudit->items[parent_offset].aug_5 = m_inv[slot_id]->GetAugmentItemID(5); if (m_inv[slot_id]->IsClassBag()) { - for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) { + for (uint8 bag_idx = EQEmu::inventory::containerBegin; bag_idx < m_inv[slot_id]->GetItem()->BagSlots; bag_idx++) { EQEmu::ItemInstance* bagitem = m_inv[slot_id]->GetItem(bag_idx); if(bagitem) { @@ -790,7 +790,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool isDeleted = m_inv.DeleteItem(slot_id, quantity); const EQEmu::ItemInstance* inst = nullptr; - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); if(update_db) database.SaveCursor(character_id, s, e); @@ -842,7 +842,7 @@ bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_updat m_inv.PushCursor(inst); if (client_update) { - SendItemPacket(EQEmu::legacy::SlotCursor, &inst, ItemPacketLimbo); + SendItemPacket(EQEmu::inventory::slotCursor, &inst, ItemPacketLimbo); } auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); @@ -856,7 +856,7 @@ bool Client::PushItemOnCursor(const EQEmu::ItemInstance& inst, bool client_updat bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, bool client_update) { Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); - if (slot_id == EQEmu::legacy::SlotCursor) { // don't trust macros before conditional statements... + if (slot_id == EQEmu::inventory::slotCursor) { // don't trust macros before conditional statements... return PushItemOnCursor(inst, client_update); } else { @@ -865,11 +865,11 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, if (client_update) { - SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::legacy::SlotCursor) ? ItemPacketLimbo : ItemPacketTrade)); + SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::inventory::slotCursor) ? ItemPacketLimbo : ItemPacketTrade)); //SendWearChange(Inventory::CalcMaterialFromSlot(slot_id)); } - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); return database.SaveCursor(this->CharacterID(), s, e); } @@ -887,7 +887,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, bool cursor_empty = m_inv.CursorEmpty(); - if (slot_id == EQEmu::legacy::SlotCursor) { + if (slot_id == EQEmu::inventory::slotCursor) { m_inv.PushCursor(inst); auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(this->CharacterID(), s, e); @@ -898,7 +898,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, } // Subordinate items in cursor buffer must be sent via ItemPacketSummonItem or we just overwrite the visible cursor and desync the client - if (slot_id == EQEmu::legacy::SlotCursor && !cursor_empty) { + if (slot_id == EQEmu::inventory::slotCursor && !cursor_empty) { // RoF+ currently has a specialized cursor handler if (ClientVersion() < EQEmu::versions::ClientVersion::RoF) SendItemPacket(slot_id, &inst, ItemPacketLimbo); @@ -908,7 +908,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, } if (bag_item_data) { - for (int index = 0; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) { + for (int index = 0; index < EQEmu::inventory::ContainerCount; ++index) { if (bag_item_data[index] == nullptr) continue; @@ -926,12 +926,12 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, // Dump bag contents to cursor in the event that owning bag is not the first cursor item // (This assumes that the data passed is correctly associated..no safety checks are implemented) - if (slot_id == EQEmu::legacy::SlotCursor && !cursor_empty) { + if (slot_id == EQEmu::inventory::slotCursor && !cursor_empty) { Log.Out(Logs::Detail, Logs::Inventory, "Putting bag loot item %s (%d) into slot %d (non-empty cursor override)", - inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::legacy::SlotCursor); + inst.GetItem()->Name, inst.GetItem()->ID, EQEmu::inventory::slotCursor); - PutLootInInventory(EQEmu::legacy::SlotCursor, *bagitem); + PutLootInInventory(EQEmu::inventory::slotCursor, *bagitem); } else { auto bag_slot = Inventory::CalcSlotId(slot_id, index); @@ -965,7 +965,7 @@ bool Client::TryStacking(EQEmu::ItemInstance* item, uint8 type, bool try_worn, b } } for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - for (uint8 j = SUB_INDEX_BEGIN; j < EQEmu::legacy::ITEM_CONTAINER_SIZE; j++) { + for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { uint16 slotid = Inventory::CalcSlotId(i, j); EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(slotid); @@ -990,28 +990,28 @@ bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bo // #1: Try to auto equip if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel <= level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != EQEmu::item::ItemTypeAugmentation) { // too messy as-is... - for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i < EQEmu::legacy::SlotPowerSource; i++) { // originally (i < 22) + for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i < EQEmu::inventory::slotPowerSource; i++) { // originally (i < 22) if (i == EQEmu::legacy::GENERAL_BEGIN) { // added power source check for SoF+ clients if (this->ClientVersion() >= EQEmu::versions::ClientVersion::SoF) - i = EQEmu::legacy::SlotPowerSource; + i = EQEmu::inventory::slotPowerSource; else break; } if (!m_inv[i]) { - if (i == EQEmu::legacy::SlotPrimary && inst.IsWeapon()) { // If item is primary slot weapon + if (i == EQEmu::inventory::slotPrimary && inst.IsWeapon()) { // If item is primary slot weapon if (inst.GetItem()->IsType2HWeapon()) { // and uses 2hs \ 2hb \ 2hp - if (m_inv[EQEmu::legacy::SlotSecondary]) { // and if secondary slot is not empty + if (m_inv[EQEmu::inventory::slotSecondary]) { // and if secondary slot is not empty continue; // Can't auto-equip } } } - if (i == EQEmu::legacy::SlotSecondary && m_inv[EQEmu::legacy::SlotPrimary]) { // check to see if primary slot is a two hander - if (m_inv[EQEmu::legacy::SlotPrimary]->GetItem()->IsType2HWeapon()) + if (i == EQEmu::inventory::slotSecondary && m_inv[EQEmu::inventory::slotPrimary]) { // check to see if primary slot is a two hander + if (m_inv[EQEmu::inventory::slotPrimary]->GetItem()->IsType2HWeapon()) continue; } - if (i == EQEmu::legacy::SlotSecondary && inst.IsWeapon() && !CanThisClassDualWield()) { + if (i == EQEmu::inventory::slotSecondary && inst.IsWeapon() && !CanThisClassDualWield()) { continue; } @@ -1019,7 +1019,7 @@ bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bo //send worn to everyone... PutLootInInventory(i, inst); uint8 worn_slot_material = Inventory::CalcMaterialFromSlot(i); - if (worn_slot_material != EQEmu::textures::TextureInvalid) { + if (worn_slot_material != EQEmu::textures::materialInvalid) { SendWearChange(worn_slot_material); } @@ -1062,7 +1062,7 @@ void Client::MoveItemCharges(EQEmu::ItemInstance &from, int16 to_slot, uint8 typ tmp_inst->SetCharges(tmp_inst->GetCharges() + charges_to_move); from.SetCharges(from.GetCharges() - charges_to_move); SendLootItemInPacket(tmp_inst, to_slot); - if (to_slot == EQEmu::legacy::SlotCursor) { + if (to_slot == EQEmu::inventory::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(this->CharacterID(), s, e); } @@ -1319,7 +1319,7 @@ void Client::SendLootItemInPacket(const EQEmu::ItemInstance* inst, int16 slot_id bool Client::IsValidSlot(uint32 slot) { if ((slot == (uint32)INVALID_INDEX) || - (slot >= SLOT_BEGIN && slot < EQEmu::legacy::TYPE_POSSESSIONS_SIZE) || + (slot >= EQEmu::inventory::slotBegin && slot < EQEmu::legacy::TYPE_POSSESSIONS_SIZE) || (slot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot <= EQEmu::legacy::CURSOR_BAG_END) || (slot >= EQEmu::legacy::TRIBUTE_BEGIN && slot <= EQEmu::legacy::TRIBUTE_END) || (slot >= EQEmu::legacy::BANK_BEGIN && slot <= EQEmu::legacy::BANK_END) || @@ -1328,7 +1328,7 @@ bool Client::IsValidSlot(uint32 slot) { (slot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot <= EQEmu::legacy::SHARED_BANK_BAGS_END) || (slot >= EQEmu::legacy::TRADE_BEGIN && slot <= EQEmu::legacy::TRADE_END) || (slot >= EQEmu::legacy::WORLD_BEGIN && slot <= EQEmu::legacy::WORLD_END) || - (slot == EQEmu::legacy::SlotPowerSource) + (slot == EQEmu::inventory::slotPowerSource) ) { return true; } @@ -1378,8 +1378,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) { return true; } // Can't do RoF+ - if (move_in->to_slot == EQEmu::legacy::SlotCursor) { - auto test_inst = m_inv.GetItem(EQEmu::legacy::SlotCursor); + if (move_in->to_slot == EQEmu::inventory::slotCursor) { + auto test_inst = m_inv.GetItem(EQEmu::inventory::slotCursor); if (test_inst == nullptr) { return true; } auto test_item = test_inst->GetItem(); if (test_item == nullptr) { return true; } @@ -1398,18 +1398,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { GetName(), test_item->Name, test_item->ID); Message_StringID(MT_LootMessages, 290); parse->EventItem(EVENT_DESTROY_ITEM, this, test_inst, nullptr, "", 0); - DeleteItemInInventory(EQEmu::legacy::SlotCursor, 0, true); + DeleteItemInInventory(EQEmu::inventory::slotCursor, 0, true); } } return true; } if (move_in->to_slot == (uint32)INVALID_INDEX) { - if (move_in->from_slot == (uint32)EQEmu::legacy::SlotCursor) { + if (move_in->from_slot == (uint32)EQEmu::inventory::slotCursor) { Log.Out(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit - EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance *inst = m_inv.GetItem(EQEmu::inventory::slotCursor); if(inst) { parse->EventItem(EVENT_DESTROY_ITEM, this, inst, nullptr, "", 0); } @@ -1426,9 +1426,9 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item deletion } } - if (auto_attack && (move_in->from_slot == EQEmu::legacy::SlotPrimary || move_in->from_slot == EQEmu::legacy::SlotSecondary || move_in->from_slot == EQEmu::legacy::SlotRange)) + if (auto_attack && (move_in->from_slot == EQEmu::inventory::slotPrimary || move_in->from_slot == EQEmu::inventory::slotSecondary || move_in->from_slot == EQEmu::inventory::slotRange)) SetAttackTimer(); - else if (auto_attack && (move_in->to_slot == EQEmu::legacy::SlotPrimary || move_in->to_slot == EQEmu::legacy::SlotSecondary || move_in->to_slot == EQEmu::legacy::SlotRange)) + else if (auto_attack && (move_in->to_slot == EQEmu::inventory::slotPrimary || move_in->to_slot == EQEmu::inventory::slotSecondary || move_in->to_slot == EQEmu::inventory::slotRange)) SetAttackTimer(); // Step 1: Variables int16 src_slot_id = (int16)move_in->from_slot; @@ -1516,7 +1516,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return(false); } if (src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_END && src_inst->IsClassBag()){ - for (uint8 idx = SUB_INDEX_BEGIN; idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { + for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = src_inst->GetItem(idx); if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){ DeleteItemInInventory(Inventory::CalcSlotId(src_slot_id, idx),0,false); @@ -1531,7 +1531,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return(false); } if (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_END && dst_inst->IsClassBag()){ - for (uint8 idx = SUB_INDEX_BEGIN; idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) { + for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = dst_inst->GetItem(idx); if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){ DeleteItemInInventory(Inventory::CalcSlotId(dst_slot_id, idx),0,false); @@ -1638,7 +1638,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } safe_delete(world_inst); - if (src_slot_id == EQEmu::legacy::SlotCursor) + if (src_slot_id == EQEmu::inventory::slotCursor) { if (dstitemid == 0) { @@ -1660,14 +1660,14 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Step 4: Check for entity trade if (dst_slot_id >= EQEmu::legacy::TRADE_BEGIN && dst_slot_id <= EQEmu::legacy::TRADE_END) { - if (src_slot_id != EQEmu::legacy::SlotCursor) { + if (src_slot_id != EQEmu::inventory::slotCursor) { Kick(); return false; } if (with) { Log.Out(Logs::Detail, Logs::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor - if (!m_inv[EQEmu::legacy::SlotCursor]) { + if (!m_inv[EQEmu::inventory::slotCursor]) { Message(13, "Error: Cursor item not located on server!"); return false; } @@ -1687,7 +1687,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit SummonItem(src_inst->GetID(), src_inst->GetCharges()); - DeleteItemInInventory(EQEmu::legacy::SlotCursor); + DeleteItemInInventory(EQEmu::inventory::slotCursor); return true; } @@ -1752,12 +1752,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } else { // Not dealing with charges - just do direct swap - if (src_inst && (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END || dst_slot_id == EQEmu::legacy::SlotPowerSource) && dst_slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) { + if (src_inst && (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END || dst_slot_id == EQEmu::inventory::slotPowerSource) && dst_slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN) { if (src_inst->GetItem()->Attuneable) { src_inst->SetAttuned(true); } if (src_inst->IsAugmented()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { if (src_inst->GetAugment(i)) { if (src_inst->GetAugment(i)->GetItem()->Attuneable) { src_inst->GetAugment(i)->SetAttuned(true); @@ -1770,7 +1770,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } Log.Out(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); - if (src_slot_id <= EQEmu::legacy::EQUIPMENT_END || src_slot_id == EQEmu::legacy::SlotPowerSource) { + if (src_slot_id <= EQEmu::legacy::EQUIPMENT_END || src_slot_id == EQEmu::inventory::slotPowerSource) { if(src_inst) { parse->EventItem(EVENT_UNEQUIP_ITEM, this, src_inst, nullptr, "", src_slot_id); } @@ -1780,7 +1780,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } - if (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END || dst_slot_id == EQEmu::legacy::SlotPowerSource) { + if (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END || dst_slot_id == EQEmu::inventory::slotPowerSource) { if(dst_inst) { parse->EventItem(EVENT_UNEQUIP_ITEM, this, dst_inst, nullptr, "", dst_slot_id); } @@ -1792,12 +1792,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } int matslot = SlotConvert2(dst_slot_id); - if (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END && matslot != EQEmu::textures::TextureHead) { // think this is to allow the client to update with /showhelm + if (dst_slot_id <= EQEmu::legacy::EQUIPMENT_END && matslot != EQEmu::textures::armorHead) { // think this is to allow the client to update with /showhelm SendWearChange(matslot); } // Step 7: Save change to the database - if (src_slot_id == EQEmu::legacy::SlotCursor) { + if (src_slot_id == EQEmu::inventory::slotCursor) { // If not swapping another item to cursor and stacking items were depleted if (dstitemid == 0 || all_to_stack == true) { @@ -1810,7 +1810,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id); } - if (dst_slot_id == EQEmu::legacy::SlotCursor) { + if (dst_slot_id == EQEmu::inventory::slotCursor) { auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); database.SaveCursor(character_id, s, e); } @@ -1834,7 +1834,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { Log.Out(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); - if ((move_slots->from_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::legacy::SlotPowerSource) { + if ((move_slots->from_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::inventory::slotPowerSource) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { // This prevents the client from crashing when closing any 'phantom' bags @@ -1877,7 +1877,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); } } - if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::legacy::SlotPowerSource) { + if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::inventory::slotPowerSource) { int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1959,7 +1959,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { qsaudit->items[move_count++].aug_5 = from_inst->GetAugmentItemID(5); if (from_inst->IsType(EQEmu::item::ItemClassBag)) { - for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { + for (uint8 bag_idx = EQEmu::inventory::containerBegin; bag_idx < from_inst->GetItem()->BagSlots; bag_idx++) { const EQEmu::ItemInstance* from_baginst = from_inst->GetItem(bag_idx); if(from_baginst) { @@ -1992,7 +1992,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { qsaudit->items[move_count++].aug_5 = to_inst->GetAugmentItemID(5); if (to_inst->IsType(EQEmu::item::ItemClassBag)) { - for (uint8 bag_idx = SUB_INDEX_BEGIN; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { + for (uint8 bag_idx = EQEmu::inventory::containerBegin; bag_idx < to_inst->GetItem()->BagSlots; bag_idx++) { const EQEmu::ItemInstance* to_baginst = to_inst->GetItem(bag_idx); if(to_baginst) { @@ -2021,7 +2021,7 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { void Client::DyeArmor(EQEmu::TintProfile* dye){ int16 slot=0; - for (int i = EQEmu::textures::TextureBegin; i <= EQEmu::textures::LastTintableTexture; i++) { + for (int i = EQEmu::textures::textureBegin; i <= EQEmu::textures::LastTintableTexture; i++) { if ((m_pp.item_tint.Slot[i].Color & 0x00FFFFFF) != (dye->Slot[i].Color & 0x00FFFFFF)) { slot = m_inv.HasItem(32557, 1, invWherePersonal); if (slot != INVALID_INDEX){ @@ -2115,7 +2115,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { int num = 0; for(x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::GENERAL_BAGS_END; x++) { - if (x == EQEmu::legacy::SlotCursor + 1) + if (x == EQEmu::inventory::slotCursor + 1) x = EQEmu::legacy::GENERAL_BAGS_BEGIN; TempItem = nullptr; ins = GetInv().GetItem(x); @@ -2132,7 +2132,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { return false; for(x = EQEmu::legacy::EQUIPMENT_BEGIN; x <= EQEmu::legacy::GENERAL_BAGS_END; x++) // should this be CURSOR_BAG_END? { - if (x == EQEmu::legacy::SlotCursor + 1) + if (x == EQEmu::inventory::slotCursor + 1) x = EQEmu::legacy::GENERAL_BAGS_BEGIN; TempItem = nullptr; ins = GetInv().GetItem(x); @@ -2293,7 +2293,7 @@ void Client::DisenchantSummonedBags(bool client_update) } while (!m_inv.CursorEmpty()) { - auto inst = m_inv[EQEmu::legacy::SlotCursor]; + auto inst = m_inv[EQEmu::inventory::slotCursor]; if (!inst) { break; } if (!IsSummonedBagID(inst->GetItem()->ID)) { break; } if (!inst->GetItem()->IsClassBag()) { break; } @@ -2307,14 +2307,14 @@ void Client::DisenchantSummonedBags(bool client_update) if (!new_inst) { break; } if (CopyBagContents(new_inst, inst)) { - Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::legacy::SlotCursor); + Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, EQEmu::inventory::slotCursor); std::list local; local.push_front(new_inst); - m_inv.PopItem(EQEmu::legacy::SlotCursor); + m_inv.PopItem(EQEmu::inventory::slotCursor); safe_delete(inst); while (!m_inv.CursorEmpty()) { - auto limbo_inst = m_inv.PopItem(EQEmu::legacy::SlotCursor); + auto limbo_inst = m_inv.PopItem(EQEmu::inventory::slotCursor); if (limbo_inst == nullptr) { continue; } local.push_back(limbo_inst); } @@ -2356,11 +2356,11 @@ void Client::RemoveNoRent(bool client_update) } } - if (m_inv[EQEmu::legacy::SlotPowerSource]) { - auto inst = m_inv[EQEmu::legacy::SlotPowerSource]; + if (m_inv[EQEmu::inventory::slotPowerSource]) { + auto inst = m_inv[EQEmu::inventory::slotPowerSource]; if (inst && !inst->GetItem()->NoRent) { - Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::legacy::SlotPowerSource); - DeleteItemInInventory(EQEmu::legacy::SlotPowerSource, 0, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); // Ti slot non-existent + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource); + DeleteItemInInventory(EQEmu::inventory::slotPowerSource, 0, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); // Ti slot non-existent } } @@ -2408,7 +2408,7 @@ void Client::RemoveNoRent(bool client_update) std::list local; while (!m_inv.CursorEmpty()) { - auto inst = m_inv.PopItem(EQEmu::legacy::SlotCursor); + auto inst = m_inv.PopItem(EQEmu::inventory::slotCursor); if (inst == nullptr) { continue; } local.push_back(inst); } @@ -2460,15 +2460,15 @@ void Client::RemoveDuplicateLore(bool client_update) safe_delete(inst); } - if (m_inv[EQEmu::legacy::SlotPowerSource]) { - auto inst = m_inv.PopItem(EQEmu::legacy::SlotPowerSource); + if (m_inv[EQEmu::inventory::slotPowerSource]) { + auto inst = m_inv.PopItem(EQEmu::inventory::slotPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::legacy::SlotPowerSource); - database.SaveInventory(character_id, nullptr, EQEmu::legacy::SlotPowerSource); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource); + database.SaveInventory(character_id, nullptr, EQEmu::inventory::slotPowerSource); } else { - m_inv.PutItem(EQEmu::legacy::SlotPowerSource, *inst); + m_inv.PutItem(EQEmu::inventory::slotPowerSource, *inst); } safe_delete(inst); } @@ -2520,7 +2520,7 @@ void Client::RemoveDuplicateLore(bool client_update) std::list local_2; while (!m_inv.CursorEmpty()) { - auto inst = m_inv.PopItem(EQEmu::legacy::SlotCursor); + auto inst = m_inv.PopItem(EQEmu::inventory::slotCursor); if (inst == nullptr) { continue; } local_1.push_back(inst); } @@ -2573,13 +2573,13 @@ void Client::MoveSlotNotAllowed(bool client_update) } } - if (m_inv[EQEmu::legacy::SlotPowerSource] && !m_inv[EQEmu::legacy::SlotPowerSource]->IsSlotAllowed(EQEmu::legacy::SlotPowerSource)) { - auto inst = m_inv.PopItem(EQEmu::legacy::SlotPowerSource); + if (m_inv[EQEmu::inventory::slotPowerSource] && !m_inv[EQEmu::inventory::slotPowerSource]->IsSlotAllowed(EQEmu::inventory::slotPowerSource)) { + auto inst = m_inv.PopItem(EQEmu::inventory::slotPowerSource); bool is_arrow = (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsClassBag(), true, inst->GetItem()->Size, is_arrow); - Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::legacy::SlotPowerSource, free_slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, EQEmu::inventory::slotPowerSource, free_slot_id); PutItemInInventory(free_slot_id, *inst, (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) ? client_update : false); - database.SaveInventory(character_id, nullptr, EQEmu::legacy::SlotPowerSource); + database.SaveInventory(character_id, nullptr, EQEmu::inventory::slotPowerSource); safe_delete(inst); } @@ -2697,13 +2697,13 @@ static int16 BandolierSlotToWeaponSlot(int BandolierSlot) switch (BandolierSlot) { case bandolierPrimary: - return EQEmu::legacy::SlotPrimary; + return EQEmu::inventory::slotPrimary; case bandolierSecondary: - return EQEmu::legacy::SlotSecondary; + return EQEmu::inventory::slotSecondary; case bandolierRange: - return EQEmu::legacy::SlotRange; + return EQEmu::inventory::slotRange; default: - return EQEmu::legacy::SlotAmmo; + return EQEmu::inventory::slotAmmo; } } @@ -2778,12 +2778,12 @@ void Client::SetBandolier(const EQApplicationPacket *app) // removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here if (slot == INVALID_INDEX) { - if (m_inv.GetItem(EQEmu::legacy::SlotCursor)) { - if (m_inv.GetItem(EQEmu::legacy::SlotCursor)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && - m_inv.GetItem(EQEmu::legacy::SlotCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check - slot = EQEmu::legacy::SlotCursor; + if (m_inv.GetItem(EQEmu::inventory::slotCursor)) { + if (m_inv.GetItem(EQEmu::inventory::slotCursor)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && + m_inv.GetItem(EQEmu::inventory::slotCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check + slot = EQEmu::inventory::slotCursor; } - else if (m_inv.GetItem(EQEmu::legacy::SlotCursor)->GetItem()->ItemClass == 1) { + else if (m_inv.GetItem(EQEmu::inventory::slotCursor)->GetItem()->ItemClass == 1) { for(int16 CursorBagSlot = EQEmu::legacy::CURSOR_BAG_BEGIN; CursorBagSlot <= EQEmu::legacy::CURSOR_BAG_END; CursorBagSlot++) { if (m_inv.GetItem(CursorBagSlot)) { if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID && @@ -2930,7 +2930,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // if(ItemToReturn->IsStackable()) { - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::SlotCursor; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving. + for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) { // changed slot max to 30 from 29. client will stack into slot 30 (bags too) before moving. EQEmu::ItemInstance* InvItem = m_inv.GetItem(i); @@ -2956,12 +2956,12 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // if (InvItem && InvItem->IsClassBag()) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); + int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); uint8 BagSize=InvItem->GetItem()->BagSlots; uint8 BagSlot; - for (BagSlot = SUB_INDEX_BEGIN; BagSlot < BagSize; BagSlot++) { + for (BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { InvItem = m_inv.GetItem(BaseSlotID + BagSlot); if (InvItem && (InvItem->GetItem()->ID == ItemID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { @@ -2989,7 +2989,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // We have tried stacking items, now just try and find an empty slot. - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::SlotCursor; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor. + for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::inventory::slotCursor; i++) { // changed slot max to 30 from 29. client will move into slot 30 (bags too) before pushing onto cursor. EQEmu::ItemInstance* InvItem = m_inv.GetItem(i); @@ -3008,11 +3008,11 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC } if (InvItem->IsClassBag() && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_INDEX_BEGIN); + int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); uint8 BagSize=InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = SUB_INDEX_BEGIN; BagSlot < BagSize; BagSlot++) { + for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { InvItem = m_inv.GetItem(BaseSlotID + BagSlot); @@ -3050,7 +3050,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool std::map instmap; // build reference map - for (int16 index = SLOT_BEGIN; index < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++index) { + for (int16 index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::TYPE_POSSESSIONS_SIZE; ++index) { auto inst = m_inv[index]; if (inst == nullptr) { continue; } instmap[index] = inst; @@ -3078,7 +3078,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool auto tsobject = GetTradeskillObject(); if (tsobject != nullptr) { - for (int16 index = SLOT_BEGIN; index < EQEmu::legacy::TYPE_WORLD_SIZE; ++index) { + for (int16 index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::TYPE_WORLD_SIZE; ++index) { auto inst = tsobject->GetItem(index); if (inst == nullptr) { continue; } instmap[EQEmu::legacy::WORLD_BEGIN + index] = inst; @@ -3094,8 +3094,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool instmap[8000 + limbo] = *cursor_itr; } - if (m_inv[EQEmu::legacy::SlotPowerSource]) - instmap[EQEmu::legacy::SlotPowerSource] = m_inv[EQEmu::legacy::SlotPowerSource]; + if (m_inv[EQEmu::inventory::slotPowerSource]) + instmap[EQEmu::inventory::slotPowerSource] = m_inv[EQEmu::inventory::slotPowerSource]; // call InterrogateInventory_ for error check for (auto instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) { @@ -3153,7 +3153,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea } else { if (inst) { - for (int16 sub = SUB_INDEX_BEGIN; (sub < EQEmu::legacy::ITEM_CONTAINER_SIZE) && (!error); ++sub) { // treat any EQEmu::ItemInstance as having the max internal slots available + for (int16 sub = EQEmu::inventory::containerBegin; (sub < EQEmu::inventory::ContainerCount) && (!error); ++sub) { // treat any EQEmu::ItemInstance as having the max internal slots available if (inst->GetItem(sub)) InterrogateInventory_(true, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); } @@ -3183,7 +3183,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea } if (inst) { - for (int16 sub = SUB_INDEX_BEGIN; (sub < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++sub) { + for (int16 sub = EQEmu::inventory::containerBegin; (sub < EQEmu::inventory::ContainerCount); ++sub) { if (inst->GetItem(sub)) InterrogateInventory_(false, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); } @@ -3202,7 +3202,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It (head >= EQEmu::legacy::TRIBUTE_BEGIN && head <= EQEmu::legacy::TRIBUTE_END) || (head >= EQEmu::legacy::WORLD_BEGIN && head <= EQEmu::legacy::WORLD_END) || (head >= 8000 && head <= 8101) || - (head == EQEmu::legacy::SlotPowerSource)) { + (head == EQEmu::inventory::slotPowerSource)) { switch (depth) { case 0: // requirement: inst is extant @@ -3214,7 +3214,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It return true; if (!parent->IsType(EQEmu::item::ItemClassCommon)) return true; - if (index >= EQEmu::legacy::ITEM_COMMON_SIZE) + if (index >= EQEmu::inventory::SocketCount) return true; break; default: // requirement: none (something bad happened...) @@ -3223,7 +3223,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It } else if ( (head >= EQEmu::legacy::GENERAL_BEGIN && head <= EQEmu::legacy::GENERAL_END) || - (head == EQEmu::legacy::SlotCursor) || + (head == EQEmu::inventory::slotCursor) || (head >= EQEmu::legacy::BANK_BEGIN && head <= EQEmu::legacy::BANK_END) || (head >= EQEmu::legacy::SHARED_BANK_BEGIN && head <= EQEmu::legacy::SHARED_BANK_END) || (head >= EQEmu::legacy::TRADE_BEGIN && head <= EQEmu::legacy::TRADE_END)) { @@ -3243,7 +3243,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It if (parent->IsClassCommon()) { if (!(inst->GetItem()->AugType > 0)) return true; - if (index >= EQEmu::legacy::ITEM_COMMON_SIZE) + if (index >= EQEmu::inventory::SocketCount) return true; } break; @@ -3257,7 +3257,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It if (parent->IsClassCommon()) { if (!(inst->GetItem()->AugType > 0)) return true; - if (index >= EQEmu::legacy::ITEM_COMMON_SIZE) + if (index >= EQEmu::inventory::SocketCount) return true; } break; diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 2a43eda39..4dae50960 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -313,7 +313,7 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch // @merth: IDFile size has been increased, this needs to change uint16 emat; if(item2->Material <= 0 - || item2->Slots & (1 << EQEmu::legacy::SlotPrimary | 1 << EQEmu::legacy::SlotSecondary)) { + || item2->Slots & (1 << EQEmu::inventory::slotPrimary | 1 << EQEmu::inventory::slotSecondary)) { memset(newid, 0, sizeof(newid)); for(int i=0;i<7;i++){ if (!isalpha(item2->IDFile[i])){ @@ -327,47 +327,47 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch emat = item2->Material; } - if (foundslot == EQEmu::legacy::SlotPrimary) { + if (foundslot == EQEmu::inventory::slotPrimary) { if (item2->Proc.Effect != 0) CastToMob()->AddProcToWeapon(item2->Proc.Effect, true); - eslot = EQEmu::textures::TexturePrimary; + eslot = EQEmu::textures::weaponPrimary; if (item2->Damage > 0) SendAddPlayerState(PlayerState::PrimaryWeaponEquipped); if (item2->IsType2HWeapon()) SetTwoHanderEquipped(true); } - else if (foundslot == EQEmu::legacy::SlotSecondary + else if (foundslot == EQEmu::inventory::slotSecondary && (GetOwner() != nullptr || (CanThisClassDualWield() && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) && (item2->IsType1HWeapon() || item2->ItemType == EQEmu::item::ItemTypeShield)) { if (item2->Proc.Effect!=0) CastToMob()->AddProcToWeapon(item2->Proc.Effect, true); - eslot = EQEmu::textures::TextureSecondary; + eslot = EQEmu::textures::weaponSecondary; if (item2->Damage > 0) SendAddPlayerState(PlayerState::SecondaryWeaponEquipped); } - else if (foundslot == EQEmu::legacy::SlotHead) { - eslot = EQEmu::textures::TextureHead; + else if (foundslot == EQEmu::inventory::slotHead) { + eslot = EQEmu::textures::armorHead; } - else if (foundslot == EQEmu::legacy::SlotChest) { - eslot = EQEmu::textures::TextureChest; + else if (foundslot == EQEmu::inventory::slotChest) { + eslot = EQEmu::textures::armorChest; } - else if (foundslot == EQEmu::legacy::SlotArms) { - eslot = EQEmu::textures::TextureArms; + else if (foundslot == EQEmu::inventory::slotArms) { + eslot = EQEmu::textures::armorArms; } - else if (foundslot == EQEmu::legacy::SlotWrist1 || foundslot == EQEmu::legacy::SlotWrist2) { - eslot = EQEmu::textures::TextureWrist; + else if (foundslot == EQEmu::inventory::slotWrist1 || foundslot == EQEmu::inventory::slotWrist2) { + eslot = EQEmu::textures::armorWrist; } - else if (foundslot == EQEmu::legacy::SlotHands) { - eslot = EQEmu::textures::TextureHands; + else if (foundslot == EQEmu::inventory::slotHands) { + eslot = EQEmu::textures::armorHands; } - else if (foundslot == EQEmu::legacy::SlotLegs) { - eslot = EQEmu::textures::TextureLegs; + else if (foundslot == EQEmu::inventory::slotLegs) { + eslot = EQEmu::textures::armorLegs; } - else if (foundslot == EQEmu::legacy::SlotFeet) { - eslot = EQEmu::textures::TextureFeet; + else if (foundslot == EQEmu::inventory::slotFeet) { + eslot = EQEmu::textures::armorFeet; } /* diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 9f413128b..e71153d8e 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1762,43 +1762,43 @@ luabind::scope lua_register_slot() { return luabind::class_("Slot") .enum_("constants") [ - luabind::value("Charm", static_cast(EQEmu::legacy::SlotCharm)), - luabind::value("Ear1", static_cast(EQEmu::legacy::SlotEar1)), - luabind::value("Head", static_cast(EQEmu::legacy::SlotHead)), - luabind::value("Face", static_cast(EQEmu::legacy::SlotFace)), - luabind::value("Ear2", static_cast(EQEmu::legacy::SlotEar2)), - luabind::value("Neck", static_cast(EQEmu::legacy::SlotNeck)), - luabind::value("Shoulder", static_cast(EQEmu::legacy::SlotShoulders)), // deprecated - luabind::value("Shoulders", static_cast(EQEmu::legacy::SlotShoulders)), - luabind::value("Arms", static_cast(EQEmu::legacy::SlotArms)), - luabind::value("Back", static_cast(EQEmu::legacy::SlotBack)), - luabind::value("Bracer1", static_cast(EQEmu::legacy::SlotWrist1)), // deprecated - luabind::value("Wrist1", static_cast(EQEmu::legacy::SlotWrist1)), - luabind::value("Bracer2", static_cast(EQEmu::legacy::SlotWrist2)), // deprecated - luabind::value("Wrist2", static_cast(EQEmu::legacy::SlotWrist2)), - luabind::value("Range", static_cast(EQEmu::legacy::SlotRange)), - luabind::value("Hands", static_cast(EQEmu::legacy::SlotHands)), - luabind::value("Primary", static_cast(EQEmu::legacy::SlotPrimary)), - luabind::value("Secondary", static_cast(EQEmu::legacy::SlotSecondary)), - luabind::value("Ring1", static_cast(EQEmu::legacy::SlotFinger1)), // deprecated - luabind::value("Finger1", static_cast(EQEmu::legacy::SlotFinger1)), - luabind::value("Ring2", static_cast(EQEmu::legacy::SlotFinger2)), // deprecated - luabind::value("Finger2", static_cast(EQEmu::legacy::SlotFinger2)), - luabind::value("Chest", static_cast(EQEmu::legacy::SlotChest)), - luabind::value("Legs", static_cast(EQEmu::legacy::SlotLegs)), - luabind::value("Feet", static_cast(EQEmu::legacy::SlotFeet)), - luabind::value("Waist", static_cast(EQEmu::legacy::SlotWaist)), - luabind::value("PowerSource", static_cast(EQEmu::legacy::SlotPowerSource)), - luabind::value("Ammo", static_cast(EQEmu::legacy::SlotAmmo)), - luabind::value("General1", static_cast(EQEmu::legacy::SlotGeneral1)), - luabind::value("General2", static_cast(EQEmu::legacy::SlotGeneral2)), - luabind::value("General3", static_cast(EQEmu::legacy::SlotGeneral3)), - luabind::value("General4", static_cast(EQEmu::legacy::SlotGeneral4)), - luabind::value("General5", static_cast(EQEmu::legacy::SlotGeneral5)), - luabind::value("General6", static_cast(EQEmu::legacy::SlotGeneral6)), - luabind::value("General7", static_cast(EQEmu::legacy::SlotGeneral7)), - luabind::value("General8", static_cast(EQEmu::legacy::SlotGeneral8)), - luabind::value("Cursor", static_cast(EQEmu::legacy::SlotCursor)), + luabind::value("Charm", static_cast(EQEmu::inventory::slotCharm)), + luabind::value("Ear1", static_cast(EQEmu::inventory::slotEar1)), + luabind::value("Head", static_cast(EQEmu::inventory::slotHead)), + luabind::value("Face", static_cast(EQEmu::inventory::slotFace)), + luabind::value("Ear2", static_cast(EQEmu::inventory::slotEar2)), + luabind::value("Neck", static_cast(EQEmu::inventory::slotNeck)), + luabind::value("Shoulder", static_cast(EQEmu::inventory::slotShoulders)), // deprecated + luabind::value("Shoulders", static_cast(EQEmu::inventory::slotShoulders)), + luabind::value("Arms", static_cast(EQEmu::inventory::slotArms)), + luabind::value("Back", static_cast(EQEmu::inventory::slotBack)), + luabind::value("Bracer1", static_cast(EQEmu::inventory::slotWrist1)), // deprecated + luabind::value("Wrist1", static_cast(EQEmu::inventory::slotWrist1)), + luabind::value("Bracer2", static_cast(EQEmu::inventory::slotWrist2)), // deprecated + luabind::value("Wrist2", static_cast(EQEmu::inventory::slotWrist2)), + luabind::value("Range", static_cast(EQEmu::inventory::slotRange)), + luabind::value("Hands", static_cast(EQEmu::inventory::slotHands)), + luabind::value("Primary", static_cast(EQEmu::inventory::slotPrimary)), + luabind::value("Secondary", static_cast(EQEmu::inventory::slotSecondary)), + luabind::value("Ring1", static_cast(EQEmu::inventory::slotFinger1)), // deprecated + luabind::value("Finger1", static_cast(EQEmu::inventory::slotFinger1)), + luabind::value("Ring2", static_cast(EQEmu::inventory::slotFinger2)), // deprecated + luabind::value("Finger2", static_cast(EQEmu::inventory::slotFinger2)), + luabind::value("Chest", static_cast(EQEmu::inventory::slotChest)), + luabind::value("Legs", static_cast(EQEmu::inventory::slotLegs)), + luabind::value("Feet", static_cast(EQEmu::inventory::slotFeet)), + luabind::value("Waist", static_cast(EQEmu::inventory::slotWaist)), + luabind::value("PowerSource", static_cast(EQEmu::inventory::slotPowerSource)), + luabind::value("Ammo", static_cast(EQEmu::inventory::slotAmmo)), + luabind::value("General1", static_cast(EQEmu::inventory::slotGeneral1)), + luabind::value("General2", static_cast(EQEmu::inventory::slotGeneral2)), + luabind::value("General3", static_cast(EQEmu::inventory::slotGeneral3)), + luabind::value("General4", static_cast(EQEmu::inventory::slotGeneral4)), + luabind::value("General5", static_cast(EQEmu::inventory::slotGeneral5)), + luabind::value("General6", static_cast(EQEmu::inventory::slotGeneral6)), + luabind::value("General7", static_cast(EQEmu::inventory::slotGeneral7)), + luabind::value("General8", static_cast(EQEmu::inventory::slotGeneral8)), + luabind::value("Cursor", static_cast(EQEmu::inventory::slotCursor)), luabind::value("PersonalBegin", static_cast(EQEmu::legacy::GENERAL_BEGIN)), // deprecated luabind::value("GeneralBegin", static_cast(EQEmu::legacy::GENERAL_BEGIN)), luabind::value("PersonalEnd", static_cast(EQEmu::legacy::GENERAL_END)), // deprecated @@ -1814,19 +1814,19 @@ luabind::scope lua_register_material() { return luabind::class_("Material") .enum_("constants") [ - luabind::value("Head", static_cast(EQEmu::textures::TextureHead)), - luabind::value("Chest", static_cast(EQEmu::textures::TextureChest)), - luabind::value("Arms", static_cast(EQEmu::textures::TextureArms)), - luabind::value("Bracer", static_cast(EQEmu::textures::TextureWrist)), // deprecated - luabind::value("Wrist", static_cast(EQEmu::textures::TextureWrist)), - luabind::value("Hands", static_cast(EQEmu::textures::TextureHands)), - luabind::value("Legs", static_cast(EQEmu::textures::TextureLegs)), - luabind::value("Feet", static_cast(EQEmu::textures::TextureFeet)), - luabind::value("Primary", static_cast(EQEmu::textures::TexturePrimary)), - luabind::value("Secondary", static_cast(EQEmu::textures::TextureSecondary)), - luabind::value("Max", static_cast(EQEmu::textures::TextureCount)), // deprecated - luabind::value("Count", static_cast(EQEmu::textures::TextureCount)), - luabind::value("Invalid", static_cast(EQEmu::textures::TextureInvalid)) + luabind::value("Head", static_cast(EQEmu::textures::armorHead)), + luabind::value("Chest", static_cast(EQEmu::textures::armorChest)), + luabind::value("Arms", static_cast(EQEmu::textures::armorArms)), + luabind::value("Bracer", static_cast(EQEmu::textures::armorWrist)), // deprecated + luabind::value("Wrist", static_cast(EQEmu::textures::armorWrist)), + luabind::value("Hands", static_cast(EQEmu::textures::armorHands)), + luabind::value("Legs", static_cast(EQEmu::textures::armorLegs)), + luabind::value("Feet", static_cast(EQEmu::textures::armorFeet)), + luabind::value("Primary", static_cast(EQEmu::textures::weaponPrimary)), + luabind::value("Secondary", static_cast(EQEmu::textures::weaponSecondary)), + luabind::value("Max", static_cast(EQEmu::textures::materialCount)), // deprecated + luabind::value("Count", static_cast(EQEmu::textures::materialCount)), + luabind::value("Invalid", static_cast(EQEmu::textures::materialInvalid)) ]; } diff --git a/zone/merc.cpp b/zone/merc.cpp index c9d177324..c45d0c268 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -214,7 +214,7 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { unsigned int i; //should not include 21 (SLOT_AMMO) - for (i = 0; i < EQEmu::legacy::SlotAmmo; i++) { + for (i = 0; i < EQEmu::inventory::slotAmmo; i++) { if(equipment[i] == 0) continue; const EQEmu::ItemData * itm = database.GetItem(equipment[i]); @@ -1559,24 +1559,24 @@ void Merc::AI_Process() { //try main hand first if(attack_timer.Check()) { - Attack(GetTarget(), EQEmu::legacy::SlotPrimary); + Attack(GetTarget(), EQEmu::inventory::slotPrimary); bool tripleSuccess = false; if(GetOwner() && GetTarget() && CanThisClassDoubleAttack()) { if(GetOwner()) { - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, true); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); } if(GetOwner() && GetTarget() && GetSpecialAbility(SPECATK_TRIPLE)) { tripleSuccess = true; - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, true); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); } //quad attack, does this belong here?? if(GetOwner() && GetTarget() && GetSpecialAbility(SPECATK_QUAD)) { - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, true); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, true); } } @@ -1588,8 +1588,8 @@ void Merc::AI_Process() { if(zone->random.Roll(flurrychance)) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); } } @@ -1598,7 +1598,7 @@ void Merc::AI_Process() { if (GetTarget() && ExtraAttackChanceBonus) { if(zone->random.Roll(ExtraAttackChanceBonus)) { - Attack(GetTarget(), EQEmu::legacy::SlotPrimary, false); + Attack(GetTarget(), EQEmu::inventory::slotPrimary, false); } } } @@ -1634,11 +1634,11 @@ void Merc::AI_Process() { // Max 78% of DW if (zone->random.Roll(DualWieldProbability)) { - Attack(GetTarget(), EQEmu::legacy::SlotSecondary); // Single attack with offhand + Attack(GetTarget(), EQEmu::inventory::slotSecondary); // Single attack with offhand if(CanThisClassDoubleAttack()) { if(GetTarget() && GetTarget()->GetHP() > -10) - Attack(GetTarget(), EQEmu::legacy::SlotSecondary); // Single attack with offhand + Attack(GetTarget(), EQEmu::inventory::slotSecondary); // Single attack with offhand } } } @@ -5045,13 +5045,13 @@ void Merc::ScaleStats(int scalepercent, bool setmax) { void Merc::UpdateMercAppearance() { // Copied from Bot Code: - uint32 itemID = NO_ITEM; - uint8 materialFromSlot = EQEmu::textures::TextureInvalid; + uint32 itemID = 0; + uint8 materialFromSlot = EQEmu::textures::materialInvalid; for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { itemID = equipment[i]; - if(itemID != NO_ITEM) { + if(itemID != 0) { materialFromSlot = Inventory::CalcMaterialFromSlot(i); - if (materialFromSlot != EQEmu::textures::TextureInvalid) + if (materialFromSlot != EQEmu::textures::materialInvalid) this->SendWearChange(materialFromSlot); } } @@ -5065,8 +5065,8 @@ void Merc::UpdateEquipmentLight() m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; - for (int index = SLOT_BEGIN; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { - if (index == EQEmu::legacy::SlotAmmo) { continue; } + for (int index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { + if (index == EQEmu::inventory::slotAmmo) { continue; } auto item = database.GetItem(equipment[index]); if (item == nullptr) { continue; } diff --git a/zone/merc.h b/zone/merc.h index c78ec22b7..ad219a2ec 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -66,7 +66,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return false; } virtual bool HasGroup() { return (GetGroup() ? true : false); } diff --git a/zone/mob.cpp b/zone/mob.cpp index 21409c695..dcb9792f2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -278,7 +278,7 @@ Mob::Mob(const char* in_name, RangedProcs[j].level_override = -1; } - for (i = 0; i < EQEmu::textures::TextureCount; i++) + for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++) { armor_tint.Slot[i].Color = in_armor_tint.Slot[i].Color; } @@ -1158,8 +1158,8 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) if (Mob::IsPlayerRace(race) || i > 6) { ns->spawn.equipment.Slot[i].Material = GetEquipmentMaterial(i); - ns->spawn.equipment.Slot[i].EliteMaterial = IsEliteMaterialItem(i); - ns->spawn.equipment.Slot[i].HeroForgeModel = GetHerosForgeModel(i); + ns->spawn.equipment.Slot[i].EliteModel = IsEliteMaterialItem(i); + ns->spawn.equipment.Slot[i].HeroicModel = GetHerosForgeModel(i); ns->spawn.equipment_tint.Slot[i].Color = GetEquipmentColor(i); } } @@ -2374,8 +2374,8 @@ bool Mob::CanThisClassDualWield(void) const { return(GetSkill(EQEmu::skills::SkillDualWield) > 0); } else if (CastToClient()->HasSkill(EQEmu::skills::SkillDualWield)) { - const EQEmu::ItemInstance* pinst = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); - const EQEmu::ItemInstance* sinst = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + const EQEmu::ItemInstance* pinst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); + const EQEmu::ItemInstance* sinst = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); // 2HS, 2HB, or 2HP if(pinst && pinst->IsWeapon()) { @@ -2858,7 +2858,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const if (item != 0) { // For primary and secondary we need the model, not the material - if (material_slot == EQEmu::textures::TexturePrimary || material_slot == EQEmu::textures::TextureSecondary) + if (material_slot == EQEmu::textures::weaponPrimary || material_slot == EQEmu::textures::weaponSecondary) { if (this->IsClient()) { @@ -2902,7 +2902,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const int32 Mob::GetHerosForgeModel(uint8 material_slot) const { uint32 HeroModel = 0; - if (material_slot >= 0 && material_slot < EQEmu::textures::TexturePrimary) + if (material_slot >= 0 && material_slot < EQEmu::textures::weaponPrimary) { uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); const EQEmu::ItemData *item; diff --git a/zone/mob.h b/zone/mob.h index 120e1f116..94a251394 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -154,7 +154,7 @@ public: virtual void ThrowingAttack(Mob* other) { } uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg); // 13 = Primary (default), 14 = secondary - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0) = 0; int MonkSpecialAttack(Mob* other, uint8 skill_used); virtual void TryBackstab(Mob *other,int ReuseTime = 10); @@ -390,7 +390,7 @@ public: inline uint8 GetDrakkinHeritage() const { return drakkin_heritage; } inline uint8 GetDrakkinTattoo() const { return drakkin_tattoo; } inline uint8 GetDrakkinDetails() const { return drakkin_details; } - inline uint32 GetArmorTint(uint8 i) const { return armor_tint.Slot[(i < EQEmu::textures::TextureCount) ? i : 0].Color; } + inline uint32 GetArmorTint(uint8 i) const { return armor_tint.Slot[(i < EQEmu::textures::materialCount) ? i : 0].Color; } inline uint8 GetClass() const { return class_; } inline uint8 GetLevel() const { return level; } inline uint8 GetOrigLevel() const { return orig_level; } @@ -577,7 +577,7 @@ public: bool lookForAftArc = true); //Procs - void TriggerDefensiveProcs(Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary, bool FromSkillProc = false, int damage = 0); + void TriggerDefensiveProcs(Mob *on, uint16 hand = EQEmu::inventory::slotPrimary, bool FromSkillProc = false, int damage = 0); bool AddRangedProc(uint16 spell_id, uint16 iChance = 3, uint16 base_spell_id = SPELL_UNKNOWN); bool RemoveRangedProc(uint16 spell_id, bool bAll = false); bool HasRangedProcs() const; @@ -1158,13 +1158,13 @@ protected: void TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success = false, uint16 hand = 0, bool IsDefensive = false); // hand = SlotCharm? bool PassLimitToSkill(uint16 spell_id, uint16 skill); bool PassLimitClass(uint32 Classes_, uint16 Class_); - void TryDefensiveProc(Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TryWeaponProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TrySpellProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); - void TryWeaponProc(const EQEmu::ItemInstance* weapon, Mob *on, uint16 hand = EQEmu::legacy::SlotPrimary); + void TryDefensiveProc(Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); + void TryWeaponProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); + void TrySpellProc(const EQEmu::ItemInstance* inst, const EQEmu::ItemData* weapon, Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); + void TryWeaponProc(const EQEmu::ItemInstance* weapon, Mob *on, uint16 hand = EQEmu::inventory::slotPrimary); void ExecWeaponProc(const EQEmu::ItemInstance* weapon, uint16 spell_id, Mob *on, int level_override = -1); - virtual float GetProcChances(float ProcBonus, uint16 hand = EQEmu::legacy::SlotPrimary); - virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQEmu::legacy::SlotPrimary, Mob *on = nullptr); + virtual float GetProcChances(float ProcBonus, uint16 hand = EQEmu::inventory::slotPrimary); + virtual float GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand = EQEmu::inventory::slotPrimary, Mob *on = nullptr); virtual float GetSpecialProcChances(uint16 hand); virtual float GetAssassinateProcChances(uint16 ReuseTime); virtual float GetSkillProcChances(uint16 ReuseTime, uint16 hand = 0); // hand = MainCharm? diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index f09df1e7f..836cd086f 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -847,7 +847,7 @@ void Client::AI_Process() if (GetTarget() && !IsStunned() && !IsMezzed() && !GetFeigned()) { if (attack_timer.Check()) { // Should charmed clients not be procing? - DoAttackRounds(GetTarget(), EQEmu::legacy::SlotPrimary); + DoAttackRounds(GetTarget(), EQEmu::inventory::slotPrimary); } } @@ -855,7 +855,7 @@ void Client::AI_Process() if (attack_dw_timer.Check()) { if (CheckDualWield()) { // Should charmed clients not be procing? - DoAttackRounds(GetTarget(), EQEmu::legacy::SlotSecondary); + DoAttackRounds(GetTarget(), EQEmu::inventory::slotSecondary); } } } @@ -1106,7 +1106,7 @@ void Mob::AI_Process() { //try main hand first if(attack_timer.Check()) { DoMainHandAttackRounds(target); - TriggerDefensiveProcs(target, EQEmu::legacy::SlotPrimary, false); + TriggerDefensiveProcs(target, EQEmu::inventory::slotPrimary, false); bool specialed = false; // NPCs can only do one of these a round if (GetSpecialAbility(SPECATK_FLURRY)) { @@ -1952,7 +1952,7 @@ bool Mob::Flurry(ExtraAttackOptions *opts) int num_attacks = GetSpecialAbilityParam(SPECATK_FLURRY, 1); num_attacks = num_attacks > 0 ? num_attacks : RuleI(Combat, MaxFlurryHits); for (int i = 0; i < num_attacks; i++) - Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts); + Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts); } return true; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 78c4604ea..166cd33fc 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -490,7 +490,7 @@ void NPC::CheckMinMaxLevel(Mob *them) if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level) { material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot); - if (material != EQEmu::textures::TextureInvalid) + if (material != EQEmu::textures::materialInvalid) SendWearChange(material); cur = itemlist.erase(cur); @@ -750,8 +750,8 @@ void NPC::UpdateEquipmentLight() m_Light.Type[EQEmu::lightsource::LightEquipment] = 0; m_Light.Level[EQEmu::lightsource::LightEquipment] = 0; - for (int index = SLOT_BEGIN; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { - if (index == EQEmu::legacy::SlotAmmo) { continue; } + for (int index = EQEmu::inventory::slotBegin; index < EQEmu::legacy::EQUIPMENT_SIZE; ++index) { + if (index == EQEmu::inventory::slotAmmo) { continue; } auto item = database.GetItem(equipment[index]); if (item == nullptr) { continue; } @@ -1378,7 +1378,7 @@ uint32 ZoneDatabase::NPCSpawnDB(uint8 command, const char* zone, uint32 zone_ver int32 NPC::GetEquipmentMaterial(uint8 material_slot) const { - if (material_slot >= EQEmu::textures::TextureCount) + if (material_slot >= EQEmu::textures::materialCount) return 0; int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); @@ -1389,23 +1389,23 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const { switch(material_slot) { - case EQEmu::textures::TextureHead: + case EQEmu::textures::armorHead: return helmtexture; - case EQEmu::textures::TextureChest: + case EQEmu::textures::armorChest: return texture; - case EQEmu::textures::TextureArms: + case EQEmu::textures::armorArms: return armtexture; - case EQEmu::textures::TextureWrist: + case EQEmu::textures::armorWrist: return bracertexture; - case EQEmu::textures::TextureHands: + case EQEmu::textures::armorHands: return handtexture; - case EQEmu::textures::TextureLegs: + case EQEmu::textures::armorLegs: return legtexture; - case EQEmu::textures::TextureFeet: + case EQEmu::textures::armorFeet: return feettexture; - case EQEmu::textures::TexturePrimary: + case EQEmu::textures::weaponPrimary: return d_melee_texture1; - case EQEmu::textures::TextureSecondary: + case EQEmu::textures::weaponSecondary: return d_melee_texture2; default: //they have nothing in the slot, and its not a special slot... they get nothing. diff --git a/zone/npc.h b/zone/npc.h index 0230b550f..ba9e93843 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -110,7 +110,7 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, EQEmu::skills::SkillType attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false, int special = 0); - virtual bool Attack(Mob* other, int Hand = EQEmu::legacy::SlotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + virtual bool Attack(Mob* other, int Hand = EQEmu::inventory::slotPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr, int special = 0); virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } diff --git a/zone/object.cpp b/zone/object.cpp index a2bb912bc..15c14a77c 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -365,7 +365,7 @@ void Object::Close() { EQEmu::ItemInstance* container = this->m_inst; if(container != nullptr) { - for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) + for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { EQEmu::ItemInstance* inst = container->PopItem(i); if(inst != nullptr) @@ -521,11 +521,11 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) // Transfer item to client - sender->PutItemInInventory(EQEmu::legacy::SlotCursor, *m_inst, false); - sender->SendItemPacket(EQEmu::legacy::SlotCursor, m_inst, ItemPacketTrade); + sender->PutItemInInventory(EQEmu::inventory::slotCursor, *m_inst, false); + sender->SendItemPacket(EQEmu::inventory::slotCursor, m_inst, ItemPacketTrade); if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet - sender->DeleteItemInInventory(EQEmu::legacy::SlotCursor); + sender->DeleteItemInInventory(EQEmu::inventory::slotCursor); if(!m_ground_spawn) safe_delete(m_inst); @@ -602,7 +602,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) auto outapp = new EQApplicationPacket(OP_ClientReady, 0); sender->QueuePacket(outapp); safe_delete(outapp); - for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { + for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { const EQEmu::ItemInstance* inst = m_inst->GetItem(i); if (inst) { //sender->GetInv().PutItem(i+4000,inst); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index be0c04abb..d582975e9 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -68,15 +68,15 @@ void Mob::ApplySpecialAttackMod(EQEmu::skills::SkillType skill, int32 &dmg, int3 case EQEmu::skills::SkillFlyingKick: case EQEmu::skills::SkillRoundKick: case EQEmu::skills::SkillKick: - item_slot = EQEmu::legacy::SlotFeet; + item_slot = EQEmu::inventory::slotFeet; break; case EQEmu::skills::SkillBash: - item_slot = EQEmu::legacy::SlotSecondary; + item_slot = EQEmu::inventory::slotSecondary; break; case EQEmu::skills::SkillDragonPunch: case EQEmu::skills::SkillEagleStrike: case EQEmu::skills::SkillTigerClaw: - item_slot = EQEmu::legacy::SlotHands; + item_slot = EQEmu::inventory::slotHands; break; default: break; @@ -111,7 +111,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 if (skill == EQEmu::skills::SkillBash){ if(IsClient()){ - EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); if(item) { if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) @@ -129,14 +129,14 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQEmu::skills::SkillType skill, int32 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 + int hand = EQEmu::inventory::slotPrimary; // Avoid checks hand for throwing/archery exclusion, primary should work for most if (skill == EQEmu::skills::SkillThrowing || skill == EQEmu::skills::SkillArchery) - hand = EQEmu::legacy::SlotRange; + hand = EQEmu::inventory::slotRange; if (who->AvoidDamage(this, max_damage, hand)) { if (max_damage == -3) DoRiposte(who); } else { - if (!CheckHitChance || (CheckHitChance && who->CheckHitChance(this, skill, EQEmu::legacy::SlotPrimary))) { + if (!CheckHitChance || (CheckHitChance && who->CheckHitChance(this, skill, EQEmu::inventory::slotPrimary))) { who->MeleeMitigation(this, max_damage, min_damage); CommonOutgoingHitSuccess(who, max_damage, skill); } else { @@ -194,7 +194,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { //These two are not subject to the combat ability timer, as they //allready do their checking in conjunction with the attack timer //throwing weapons - if (ca_atk->m_atk == EQEmu::legacy::SlotRange) { + if (ca_atk->m_atk == EQEmu::inventory::slotRange) { if (ca_atk->m_skill == EQEmu::skills::SkillThrowing) { SetAttackTimer(); ThrowingAttack(GetTarget()); @@ -244,8 +244,8 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { DoAnim(animTailRake); int32 ht = 0; - if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::legacy::SlotSecondary)) <= 0 && - GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::legacy::SlotShoulders)) <= 0){ + if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::inventory::slotSecondary)) <= 0 && + GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::inventory::slotShoulders)) <= 0){ dmg = -5; } else{ @@ -321,7 +321,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { DoAnim(animKick); int32 ht = 0; - if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::legacy::SlotFeet)) <= 0){ + if (GetWeaponDamage(GetTarget(), GetInv().GetItem(EQEmu::inventory::slotFeet)) <= 0){ dmg = -5; } else{ @@ -404,7 +404,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) int32 min_dmg = 1; int reuse = 0; EQEmu::skills::SkillType skill_type; //to avoid casting... even though it "would work" - uint8 itemslot = EQEmu::legacy::SlotFeet; + uint8 itemslot = EQEmu::inventory::slotFeet; switch(unchecked_type) { case EQEmu::skills::SkillFlyingKick: @@ -418,7 +418,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) case EQEmu::skills::SkillDragonPunch: skill_type = EQEmu::skills::SkillDragonPunch; max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, DragonPunchBonus) / 100) + 26; - itemslot = EQEmu::legacy::SlotHands; + itemslot = EQEmu::inventory::slotHands; ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); DoAnim(animTailRake); reuse = TailRakeReuseTime; @@ -426,7 +426,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) case EQEmu::skills::SkillEagleStrike: skill_type = EQEmu::skills::SkillEagleStrike; max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, EagleStrikeBonus) / 100) + 19; - itemslot = EQEmu::legacy::SlotHands; + itemslot = EQEmu::inventory::slotHands; ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); DoAnim(animEagleStrike); reuse = EagleStrikeReuseTime; @@ -434,7 +434,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) case EQEmu::skills::SkillTigerClaw: skill_type = EQEmu::skills::SkillTigerClaw; max_dmg = ((GetSTR()+GetSkill(skill_type)) * RuleI(Combat, TigerClawBonus) / 100) + 12; - itemslot = EQEmu::legacy::SlotHands; + itemslot = EQEmu::inventory::slotHands; ApplySpecialAttackMod(skill_type, max_dmg, min_dmg); DoAnim(animTigerClaw); reuse = TigerClawReuseTime; @@ -498,7 +498,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { //make sure we have a proper weapon if we are a client. if(IsClient()) { - const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); if (!wpn || (wpn->GetItem()->ItemType != EQEmu::item::ItemType1HPiercing)){ Message_StringID(13, BACKSTAB_WEAPON); return; @@ -559,7 +559,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { 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); + Attack(other, EQEmu::inventory::slotPrimary); } } @@ -577,7 +577,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) int32 backstab_dmg = 0; if (IsClient()) { - const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + const EQEmu::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); if (wpn) { primaryweapondamage = GetWeaponDamage(other, wpn); if (primaryweapondamage) { @@ -650,7 +650,7 @@ void Mob::RogueAssassinate(Mob* other) { //can you dodge, parry, etc.. an assassinate?? //if so, use DoSpecialAttackDamage(other, BACKSTAB, 32000); instead - if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary) : (const EQEmu::ItemInstance*)nullptr) > 0){ + if (GetWeaponDamage(other, IsClient() ? CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary) : (const EQEmu::ItemInstance*)nullptr) > 0){ other->Damage(this, 32000, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); }else{ other->Damage(this, -5, SPELL_UNKNOWN, EQEmu::skills::SkillBackstab); @@ -670,20 +670,20 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } - const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; + const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::inventory::slotRange]; //locate ammo - int ammo_slot = EQEmu::legacy::SlotAmmo; - const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::legacy::SlotAmmo]; + int ammo_slot = EQEmu::inventory::slotAmmo; + const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::inventory::slotAmmo]; if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { - Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotRange), EQEmu::legacy::SlotRange); - Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::legacy::SlotRange)); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange); + Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::inventory::slotRange)); return; } if (!Ammo || !Ammo->IsClassCommon()) { - Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotAmmo), EQEmu::legacy::SlotAmmo); - Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::legacy::SlotAmmo)); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotAmmo), EQEmu::inventory::slotAmmo); + Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::inventory::slotAmmo)); return; } @@ -838,7 +838,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon if (IsClient()){ - _RangeWeapon = CastToClient()->m_inv[EQEmu::legacy::SlotRange]; + _RangeWeapon = CastToClient()->m_inv[EQEmu::inventory::slotRange]; if (_RangeWeapon && _RangeWeapon->GetItem() && _RangeWeapon->GetItem()->ID == range_id) RangeWeapon = _RangeWeapon; @@ -854,7 +854,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon else if (AmmoItem) SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillArchery); - if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, EQEmu::skills::SkillArchery, EQEmu::legacy::SlotPrimary, chance_mod))) { + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, EQEmu::skills::SkillArchery, EQEmu::inventory::slotPrimary, chance_mod))) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ @@ -952,7 +952,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon } if (!HeadShot) - other->AvoidDamage(this, TotalDmg, EQEmu::legacy::SlotRange); + other->AvoidDamage(this, TotalDmg, EQEmu::inventory::slotRange); other->MeleeMitigation(this, TotalDmg, minDmg); if(TotalDmg > 0){ @@ -976,7 +976,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillArchery, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillArchery, 0, true, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillArchery, 0, true, EQEmu::inventory::slotRange); } } @@ -985,20 +985,20 @@ void Mob::DoArcheryAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon //Weapon Proc if(RangeWeapon && other && !other->HasDied()) - TryWeaponProc(RangeWeapon, other, EQEmu::legacy::SlotRange); + TryWeaponProc(RangeWeapon, other, EQEmu::inventory::slotRange); //Ammo Proc if (ammo_lost) - TryWeaponProc(nullptr, ammo_lost, other, EQEmu::legacy::SlotRange); + TryWeaponProc(nullptr, ammo_lost, other, EQEmu::inventory::slotRange); else if(Ammo && other && !other->HasDied()) - TryWeaponProc(Ammo, other, EQEmu::legacy::SlotRange); + TryWeaponProc(Ammo, other, EQEmu::inventory::slotRange); //Skill Proc if (HasSkillProcs() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillArchery, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillArchery, 0, false, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillArchery, 0, false, EQEmu::inventory::slotRange); } } @@ -1264,7 +1264,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha if (!chance_mod) chance_mod = GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2); - if (!other->CheckHitChance(this, skillInUse, EQEmu::legacy::SlotRange, chance_mod)) + if (!other->CheckHitChance(this, skillInUse, EQEmu::inventory::slotRange, chance_mod)) { other->Damage(this, 0, SPELL_UNKNOWN, skillInUse); } @@ -1285,7 +1285,7 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha TotalDmg += TotalDmg * damage_mod / 100; - other->AvoidDamage(this, TotalDmg, EQEmu::legacy::SlotRange); + other->AvoidDamage(this, TotalDmg, EQEmu::inventory::slotRange); other->MeleeMitigation(this, TotalDmg, MinDmg); if (TotalDmg > 0) @@ -1301,15 +1301,15 @@ void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 cha other->Damage(this, TotalDmg, SPELL_UNKNOWN, skillInUse); if (TotalDmg > 0 && HasSkillProcSuccess() && !other->HasDied()) - TrySkillProc(other, skillInUse, 0, true, EQEmu::legacy::SlotRange); + TrySkillProc(other, skillInUse, 0, true, EQEmu::inventory::slotRange); } //try proc on hits and misses if(other && !other->HasDied()) - TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, other, EQEmu::legacy::SlotRange); + TrySpellProc(nullptr, (const EQEmu::ItemData*)nullptr, other, EQEmu::inventory::slotRange); if (HasSkillProcs() && other && !other->HasDied()) - TrySkillProc(other, skillInUse, 0, false, EQEmu::legacy::SlotRange); + TrySkillProc(other, skillInUse, 0, false, EQEmu::inventory::slotRange); } uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) { @@ -1351,19 +1351,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 return; } - int ammo_slot = EQEmu::legacy::SlotRange; - const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::legacy::SlotRange]; + int ammo_slot = EQEmu::inventory::slotRange; + const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::inventory::slotRange]; if (!RangeWeapon || !RangeWeapon->IsClassCommon()) { - Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::legacy::SlotRange), EQEmu::legacy::SlotRange); - Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::legacy::SlotRange)); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::inventory::slotRange), EQEmu::inventory::slotRange); + Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::inventory::slotRange)); return; } const EQEmu::ItemData* item = RangeWeapon->GetItem(); if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) { Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); - Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::legacy::SlotRange)); + Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::inventory::slotRange)); return; } @@ -1371,11 +1371,11 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 if(RangeWeapon->GetCharges() == 1) { //first check ammo - const EQEmu::ItemInstance* AmmoItem = m_inv[EQEmu::legacy::SlotAmmo]; + const EQEmu::ItemInstance* AmmoItem = m_inv[EQEmu::inventory::slotAmmo]; if(AmmoItem != nullptr && AmmoItem->GetID() == RangeWeapon->GetID()) { //more in the ammo slot, use it RangeWeapon = AmmoItem; - ammo_slot = EQEmu::legacy::SlotAmmo; + ammo_slot = EQEmu::inventory::slotAmmo; Log.Out(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more @@ -1472,7 +1472,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon else if (AmmoItem) SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillThrowing); - if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, EQEmu::skills::SkillThrowing, EQEmu::legacy::SlotPrimary, chance_mod))){ + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, EQEmu::skills::SkillThrowing, EQEmu::inventory::slotPrimary, chance_mod))){ Log.Out(Logs::Detail, Logs::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, EQEmu::skills::SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); @@ -1519,7 +1519,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon Log.Out(Logs::Detail, Logs::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); if (!Assassinate_Dmg) - other->AvoidDamage(this, TotalDmg, EQEmu::legacy::SlotRange); + other->AvoidDamage(this, TotalDmg, EQEmu::inventory::slotRange); other->MeleeMitigation(this, TotalDmg, minDmg); if(TotalDmg > 0) @@ -1538,7 +1538,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillThrowing, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, true, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, true, EQEmu::inventory::slotRange); } } @@ -1547,15 +1547,15 @@ void Mob::DoThrowingAttackDmg(Mob* other, const EQEmu::ItemInstance* RangeWeapon //Throwing item Proc if (ammo_lost) - TryWeaponProc(nullptr, ammo_lost, other, EQEmu::legacy::SlotRange); + TryWeaponProc(nullptr, ammo_lost, other, EQEmu::inventory::slotRange); else if(RangeWeapon && other && !other->HasDied()) - TryWeaponProc(RangeWeapon, other, EQEmu::legacy::SlotRange); + TryWeaponProc(RangeWeapon, other, EQEmu::inventory::slotRange); if (HasSkillProcs() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, EQEmu::skills::SkillThrowing, ReuseTime); else - TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, false, EQEmu::legacy::SlotRange); + TrySkillProc(other, EQEmu::skills::SkillThrowing, 0, false, EQEmu::inventory::slotRange); } } @@ -1955,7 +1955,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if (ca_target!=this) { DoAnim(animTailRake); - if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::legacy::SlotSecondary)) <= 0 && GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::legacy::SlotShoulders)) <= 0){ + if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::inventory::slotSecondary)) <= 0 && GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::inventory::slotShoulders)) <= 0){ dmg = -5; } else{ @@ -2019,7 +2019,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if(ca_target!=this){ DoAnim(animKick); - if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::legacy::SlotFeet)) <= 0){ + if (GetWeaponDamage(ca_target, GetInv().GetItem(EQEmu::inventory::slotFeet)) <= 0){ dmg = -5; } else{ @@ -2231,7 +2231,7 @@ uint32 Mob::TryHeadShot(Mob* defender, EQEmu::skills::SkillType skillInUse) { HeadShot_Level = itembonuses.HSLevel; if(HeadShot_Dmg && HeadShot_Level && (defender->GetLevel() <= HeadShot_Level)){ - float ProcChance = GetSpecialProcChances(EQEmu::legacy::SlotRange); + float ProcChance = GetSpecialProcChances(EQEmu::inventory::slotRange); if(zone->random.Roll(ProcChance)) return HeadShot_Dmg; } @@ -2294,7 +2294,7 @@ uint32 Mob::TryAssassinate(Mob* defender, EQEmu::skills::SkillType skillInUse, u float ProcChance = 0.0f; if (skillInUse == EQEmu::skills::SkillThrowing) - ProcChance = GetSpecialProcChances(EQEmu::legacy::SlotRange); + ProcChance = GetSpecialProcChances(EQEmu::inventory::slotRange); else ProcChance = GetAssassinateProcChances(ReuseTime); @@ -2345,7 +2345,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: int damage = 0; uint32 hate = 0; - int Hand = EQEmu::legacy::SlotPrimary; + int Hand = EQEmu::inventory::slotPrimary; if (hate == 0 && weapon_damage > 1) hate = weapon_damage; if(weapon_damage > 0){ @@ -2369,7 +2369,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: if (skillinuse == EQEmu::skills::SkillBash){ if(IsClient()){ - EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + EQEmu::ItemInstance *item = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); if(item){ if (item->GetItem()->ItemType == EQEmu::item::ItemTypeShield) { hate += item->GetItem()->AC; @@ -2391,7 +2391,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, EQEmu::skills: else damage = zone->random.Int(min_hit, max_hit); - if (other->AvoidDamage(this, damage, CanRiposte ? EQEmu::legacy::SlotRange : EQEmu::legacy::SlotPrimary)) { // SlotRange excludes ripo, primary doesn't have any extra behavior + if (other->AvoidDamage(this, damage, CanRiposte ? EQEmu::inventory::slotRange : EQEmu::inventory::slotPrimary)) { // SlotRange excludes ripo, primary doesn't have any extra behavior if (damage == -3) { DoRiposte(other); if (HasDied()) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 161604ea9..841457bdc 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -622,7 +622,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove snprintf(effect_desc, _EDLEN, "Flesh To Bone"); #endif if(IsClient()){ - EQEmu::ItemInstance* transI = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance* transI = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotCursor); if (transI && transI->IsClassCommon() && transI->IsStackable()){ uint32 fcharges = transI->GetCharges(); //Does it sound like meat... maybe should check if it looks like meat too... @@ -632,7 +632,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove strstr(transI->GetItem()->Name, "Flesh") || strstr(transI->GetItem()->Name, "parts") || strstr(transI->GetItem()->Name, "Parts")){ - CastToClient()->DeleteItemInInventory(EQEmu::legacy::SlotCursor, fcharges, true); + CastToClient()->DeleteItemInInventory(EQEmu::inventory::slotCursor, fcharges, true); CastToClient()->SummonItem(13073, fcharges); } else{ @@ -1173,7 +1173,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (SummonedItem) { c->PushItemOnCursor(*SummonedItem); - c->SendItemPacket(EQEmu::legacy::SlotCursor, SummonedItem, ItemPacketLimbo); + c->SendItemPacket(EQEmu::inventory::slotCursor, SummonedItem, ItemPacketLimbo); safe_delete(SummonedItem); } SummonedItem = database.CreateItem(spell.base[i], charges); @@ -1445,7 +1445,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove } } - for (int x = EQEmu::textures::TextureBegin; x <= EQEmu::textures::LastTintableTexture; x++) + for (int x = EQEmu::textures::textureBegin; x <= EQEmu::textures::LastTintableTexture; x++) SendWearChange(x); if (caster == this && spell.id != 287 && spell.id != 601 && @@ -1471,7 +1471,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove ); caster->SendAppearancePacket(AT_Size, static_cast(caster->GetTarget()->GetSize())); - for (int x = EQEmu::textures::TextureBegin; x <= EQEmu::textures::LastTintableTexture; x++) + for (int x = EQEmu::textures::textureBegin; x <= EQEmu::textures::LastTintableTexture; x++) caster->SendWearChange(x); } } @@ -2239,7 +2239,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove snprintf(effect_desc, _EDLEN, "Rampage"); #endif if(caster) - entity_list.AEAttack(caster, 30, EQEmu::legacy::SlotPrimary, 0, true); // on live wars dont get a duration ramp, its a one shot deal + entity_list.AEAttack(caster, 30, EQEmu::inventory::slotPrimary, 0, true); // on live wars dont get a duration ramp, its a one shot deal break; } @@ -3037,7 +3037,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (SummonedItem) { Client *c=CastToClient(); c->PushItemOnCursor(*SummonedItem); - c->SendItemPacket(EQEmu::legacy::SlotCursor, SummonedItem, ItemPacketLimbo); + c->SendItemPacket(EQEmu::inventory::slotCursor, SummonedItem, ItemPacketLimbo); safe_delete(SummonedItem); } @@ -3855,7 +3855,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) else{ SendAppearancePacket(AT_Size, 6); } - for (int x = EQEmu::textures::TextureBegin; x <= EQEmu::textures::LastTintableTexture; x++){ + for (int x = EQEmu::textures::textureBegin; x <= EQEmu::textures::LastTintableTexture; x++){ SendWearChange(x); } break; @@ -5194,7 +5194,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { } } - for (int y = AUG_INDEX_BEGIN; y < EQEmu::legacy::ITEM_COMMON_SIZE; ++y) + for (int y = EQEmu::inventory::socketBegin; y < EQEmu::inventory::SocketCount; ++y) { if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS) continue; @@ -5343,7 +5343,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) } } - for (int y = AUG_INDEX_BEGIN; y < EQEmu::legacy::ITEM_COMMON_SIZE; ++y) + for (int y = EQEmu::inventory::socketBegin; y < EQEmu::inventory::SocketCount; ++y) { EQEmu::ItemInstance *aug = nullptr; aug = ins->GetAugment(y); diff --git a/zone/spells.cpp b/zone/spells.cpp index e00fc05c2..649fa99c9 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -293,7 +293,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, return(false); } } - if (itm && (itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(item_slot <= EQEmu::legacy::SlotAmmo || item_slot == EQEmu::legacy::SlotPowerSource)){ + if (itm && (itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(item_slot <= EQEmu::inventory::slotAmmo || item_slot == EQEmu::inventory::slotPowerSource)){ if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are attempting to cast a must equip clicky without having it equipped Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); @@ -1244,7 +1244,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if (inst == nullptr) break; - for (int r = AUG_INDEX_BEGIN; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) { + for (int r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) { const EQEmu::ItemInstance* aug_i = inst->GetAugment(r); if (!aug_i) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 38bb5a231..8db24d81e 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -69,7 +69,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme // Verify that no more than two items are in container to guarantee no inadvertant wipes. uint8 itemsFound = 0; - for (uint8 i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) + for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) @@ -222,7 +222,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme else { // Delete items in our inventory container... - for (uint8 i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) + for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) @@ -297,7 +297,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const EQEmu::ItemData* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); - user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::legacy::SlotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); + user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::inventory::slotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); if (RuleB(Inventory, DeleteTransformationMold)) user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -317,7 +317,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const EQEmu::ItemData* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); - user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::legacy::SlotCursor, 0, 0); + user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::inventory::slotCursor, 0, 0); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); } else if (inst) { @@ -401,7 +401,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob safe_delete(outapp); database.DeleteWorldContainer(worldo->m_id, zone->GetZoneID()); } else{ - for (uint8 i = SLOT_BEGIN; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { + for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot,i),0,true); @@ -1237,7 +1237,7 @@ bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_ for (auto row = results.begin(); row != results.end(); ++row) { int ccnt = 0; - for (int x = SLOT_BEGIN; x < EQEmu::legacy::TYPE_WORLD_SIZE; x++) { + for (int x = EQEmu::inventory::slotBegin; x < EQEmu::legacy::TYPE_WORLD_SIZE; x++) { const EQEmu::ItemInstance* inst = container->GetItem(x); if(!inst) continue; diff --git a/zone/trading.cpp b/zone/trading.cpp index cfca3a2e6..9d9738ffc 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -98,7 +98,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { // Item always goes into trade bucket from cursor Client* client = owner->CastToClient(); - EQEmu::ItemInstance* inst = client->GetInv().GetItem(EQEmu::legacy::SlotCursor); + EQEmu::ItemInstance* inst = client->GetInv().GetItem(EQEmu::inventory::slotCursor); if (!inst) { client->Message(13, "Error: Could not find item on your cursor!"); @@ -131,7 +131,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (_stack_size > 0) inst->SetCharges(_stack_size); else - client->DeleteItemInInventory(EQEmu::legacy::SlotCursor); + client->DeleteItemInInventory(EQEmu::inventory::slotCursor); SendItemData(inst2, trade_slot_id); } @@ -146,7 +146,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { Log.Out(Logs::Detail, Logs::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); - client->DeleteItemInInventory(EQEmu::legacy::SlotCursor); + client->DeleteItemInInventory(EQEmu::inventory::slotCursor); } } @@ -173,7 +173,7 @@ void Trade::SendItemData(const EQEmu::ItemInstance* inst, int16 dest_slot_id) if (with && with->IsClient()) { with->SendItemPacket(dest_slot_id - EQEmu::legacy::TRADE_BEGIN, inst, ItemPacketTradeView); if (inst->GetItem()->ItemClass == 1) { - for (uint16 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { + for (uint16 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i); const EQEmu::ItemInstance* bagitem = trader->GetInv().GetItem(bagslot_id); if (bagitem) { @@ -267,7 +267,7 @@ void Trade::LogTrade() strcat(logtext, item_num); if (inst->IsClassBag()) { - for (uint8 j = SUB_INDEX_BEGIN; j < EQEmu::legacy::ITEM_CONTAINER_SIZE; j++) { + for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { strcat(logtext, ","); @@ -312,7 +312,7 @@ void Trade::DumpTrade() i, ((inst->IsClassBag()) ? "True" : "False")); if (inst->IsClassBag()) { - for (uint8 j = SUB_INDEX_BEGIN; j < EQEmu::legacy::ITEM_CONTAINER_SIZE; j++) { + for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { Log.Out(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)", @@ -359,7 +359,7 @@ void Client::ResetTrade() { // there's no built-in safety check against an infinite loop..but, it should break on one of the conditional checks int16 free_slot = m_inv.FindFreeSlotForTradeItem(inst); - if ((free_slot == EQEmu::legacy::SlotCursor) || (free_slot == INVALID_INDEX)) + if ((free_slot == EQEmu::inventory::slotCursor) || (free_slot == INVALID_INDEX)) break; EQEmu::ItemInstance* partial_inst = GetInv().GetItem(free_slot); @@ -523,7 +523,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st qs_audit->char1_count += detail->charges; //for (uint8 sub_slot = SUB_BEGIN; ((sub_slot < inst->GetItem()->BagSlots) && (sub_slot < EmuConstants::ITEM_CONTAINER_SIZE)); ++sub_slot) { - for (uint8 sub_slot = SUB_INDEX_BEGIN; (sub_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++sub_slot) { // this is to catch ALL items + for (uint8 sub_slot = EQEmu::inventory::containerBegin; (sub_slot < EQEmu::inventory::ContainerCount); ++sub_slot) { // this is to catch ALL items const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot); if (bag_inst) { @@ -579,7 +579,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // there's no built-in safety check against an infinite loop..but, it should break on one of the conditional checks int16 partial_slot = other->GetInv().FindFreeSlotForTradeItem(inst); - if ((partial_slot == EQEmu::legacy::SlotCursor) || (partial_slot == INVALID_INDEX)) + if ((partial_slot == EQEmu::inventory::slotCursor) || (partial_slot == INVALID_INDEX)) break; EQEmu::ItemInstance* partial_inst = other->GetInv().GetItem(partial_slot); @@ -743,7 +743,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st // 'step 3' should never really see containers..but, just in case... //for (uint8 sub_slot = SUB_BEGIN; ((sub_slot < inst->GetItem()->BagSlots) && (sub_slot < EmuConstants::ITEM_CONTAINER_SIZE)); ++sub_slot) { - for (uint8 sub_slot = SUB_INDEX_BEGIN; (sub_slot < EQEmu::legacy::ITEM_CONTAINER_SIZE); ++sub_slot) { // this is to catch ALL items + for (uint8 sub_slot = EQEmu::inventory::containerBegin; (sub_slot < EQEmu::inventory::ContainerCount); ++sub_slot) { // this is to catch ALL items const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot); if (bag_inst) { @@ -841,7 +841,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st qs_audit->char_count += detail->charges; if (trade_inst->IsClassBag()) { - for (uint8 sub_slot = SUB_INDEX_BEGIN; sub_slot < trade_inst->GetItem()->BagSlots; ++sub_slot) { + for (uint8 sub_slot = EQEmu::inventory::containerBegin; sub_slot < trade_inst->GetItem()->BagSlots; ++sub_slot) { const EQEmu::ItemInstance* trade_baginst = trade_inst->GetItem(sub_slot); if(trade_baginst) { @@ -891,7 +891,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if(GetGM() || (item->NoDrop != 0 && inst->IsAttuned() == false)) { // pets need to look inside bags and try to equip items found there if (item->IsClassBag() && item->BagSlots > 0) { - for (int16 bslot = SUB_INDEX_BEGIN; bslot < item->BagSlots; bslot++) { + for (int16 bslot = EQEmu::inventory::containerBegin; bslot < item->BagSlots; bslot++) { const EQEmu::ItemInstance* baginst = inst->GetItem(bslot); if (baginst) { const EQEmu::ItemData* bagitem = baginst->GetItem(); @@ -1235,7 +1235,7 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) { for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++){ item = this->GetInv().GetItem(i); if (item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = SUB_INDEX_BEGIN; x < EQEmu::legacy::ITEM_CONTAINER_SIZE; x++) { + for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? SlotID = Inventory::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1258,7 +1258,7 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++){ item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = SUB_INDEX_BEGIN; x < EQEmu::legacy::ITEM_CONTAINER_SIZE; x++) { + for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? SlotID = Inventory::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1289,7 +1289,7 @@ GetItems_Struct* Client::GetTraderItems(){ for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = SUB_INDEX_BEGIN; x < EQEmu::legacy::ITEM_CONTAINER_SIZE; x++) { + for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { SlotID = Inventory::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1313,7 +1313,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ for (int i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel - for (int x = SUB_INDEX_BEGIN; x < EQEmu::legacy::ITEM_CONTAINER_SIZE; x++){ + for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++){ SlotID = Inventory::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); diff --git a/zone/tune.cpp b/zone/tune.cpp index f8655d66a..6595ad4d0 100644 --- a/zone/tune.cpp +++ b/zone/tune.cpp @@ -582,13 +582,13 @@ int32 Client::Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 mi int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) { - int Hand = EQEmu::legacy::SlotPrimary; + int Hand = EQEmu::inventory::slotPrimary; if (!other) return 0; EQEmu::ItemInstance* weapon; - weapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary); + weapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); if(weapon != nullptr) { if (!weapon->IsWeapon()) { @@ -628,7 +628,7 @@ int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) int ucDamageBonus = 0; - if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass()) + if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass()) { ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr); @@ -662,24 +662,24 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch if (attacker->IsClient()) {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. EQEmu::ItemInstance* weapon; - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); if(weapon && weapon->IsWeapon()){ - attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::legacy::SlotPrimary, weapon); + attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotPrimary, weapon); } else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); if (weapon && weapon->IsWeapon()) - attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::legacy::SlotSecondary, weapon); + attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotSecondary, weapon); else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotRange); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotRange); if (weapon && weapon->IsWeapon()) - attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::legacy::SlotRange, weapon); + attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotRange, weapon); } } } - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::legacy::SlotPrimary, 0, 0, 0, avoid_override); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, 0, 0, avoid_override); Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); @@ -691,7 +691,7 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch for (int j=0; j < max_loop; j++) { - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::legacy::SlotPrimary, 0, false, 0, avoid_override, add_acc); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, false, 0, avoid_override, add_acc); if (Msg >= 3) Message(15, "#Tune - Processing... [%i] [ACCURACY %i] Hit Chance %.2f ",j,add_acc,tmp_hit_chance); @@ -706,7 +706,7 @@ void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_ch if (end){ - Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::legacy::SlotPrimary, 0, Msg, 0, avoid_override);//Display Stat Report + Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, Msg, 0, avoid_override);//Display Stat Report Message(0, " "); @@ -742,24 +742,24 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ if (attacker->IsClient()) {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. EQEmu::ItemInstance* weapon; - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotPrimary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotPrimary); if(weapon && weapon->IsWeapon()){ - attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::legacy::SlotPrimary, weapon); + attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotPrimary, weapon); } else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotSecondary); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotSecondary); if (weapon && weapon->IsWeapon()) - attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::legacy::SlotSecondary, weapon); + attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotSecondary, weapon); else { - weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotRange); + weapon = attacker->CastToClient()->GetInv().GetItem(EQEmu::inventory::slotRange); if (weapon && weapon->IsWeapon()) - attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::legacy::SlotRange, weapon); + attacker->CastToClient()->AttackAnimation(skillinuse, EQEmu::inventory::slotRange, weapon); } } } - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::legacy::SlotPrimary, 0, 0, acc_override, 0); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, 0, acc_override, 0); Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); Message(0, "#Tune - Processing... Find Avoidance for hit chance on defender of (%.0f) pct from attacker. [Current Hit Chance %.2f]", hit_chance, tmp_hit_chance); @@ -769,7 +769,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ for (int j=0; j < max_loop; j++) { - tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::legacy::SlotPrimary, 0, 0, acc_override, 0, 0, add_avoid); + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, 0, acc_override, 0, 0, add_avoid); if (Msg >= 3) Message(0, "#Tune - Processing... [%i] [AVOIDANCE %i] Hit Chance %.2f ",j,add_avoid,tmp_hit_chance); @@ -784,7 +784,7 @@ void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_ if (end){ - Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::legacy::SlotPrimary, 0, Msg, acc_override, 0);//Display Stat Report + Tune_CheckHitChance(defender, attacker, skillinuse, EQEmu::inventory::slotPrimary, 0, Msg, acc_override, 0);//Display Stat Report Message(0, " "); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 98c5e6c92..8bf2e4d31 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -487,7 +487,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* cont uint8 index = (uint8)atoi(row[0]); uint32 item_id = (uint32)atoi(row[1]); int8 charges = (int8)atoi(row[2]); - uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE]; + uint32 aug[EQEmu::inventory::SocketCount]; aug[0] = (uint32)atoi(row[3]); aug[1] = (uint32)atoi(row[4]); aug[2] = (uint32)atoi(row[5]); @@ -497,7 +497,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQEmu::ItemInstance* cont EQEmu::ItemInstance* inst = database.CreateItem(item_id, charges); if (inst && inst->GetItem()->IsClassCommon()) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) if (aug[i]) inst->PutAugment(&database, i, aug[i]); // Put item inside world container @@ -520,17 +520,17 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const EQ DeleteWorldContainer(parent_id,zone_id); // Save all 10 items, if they exist - for (uint8 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; index++) { + for (uint8 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; index++) { EQEmu::ItemInstance* inst = container->GetItem(index); if (!inst) continue; uint32 item_id = inst->GetItem()->ID; - uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 }; if (inst->IsType(EQEmu::item::ItemClassCommon)) { - for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) { + for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) { EQEmu::ItemInstance *auginst=inst->GetAugment(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0; } @@ -2092,7 +2092,7 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load else { auto armorTint_row = armortint_results.begin(); - for (int index = EQEmu::textures::TextureBegin; index <= EQEmu::textures::LastTexture; index++) { + for (int index = EQEmu::textures::textureBegin; index <= EQEmu::textures::LastTexture; index++) { temp_npctype_data->armor_tint.Slot[index].Color = atoi(armorTint_row[index * 3]) << 16; temp_npctype_data->armor_tint.Slot[index].Color |= atoi(armorTint_row[index * 3 + 1]) << 8; temp_npctype_data->armor_tint.Slot[index].Color |= atoi(armorTint_row[index * 3 + 2]); @@ -2102,7 +2102,7 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load } // Try loading npc_types tint fields if armor tint is 0 or query failed to get results if (armor_tint_id == 0) { - for (int index = EQEmu::textures::TextureChest; index < EQEmu::textures::TextureCount; index++) { + for (int index = EQEmu::textures::armorChest; index < EQEmu::textures::materialCount; index++) { temp_npctype_data->armor_tint.Slot[index].Color = temp_npctype_data->armor_tint.Slot[0].Color; // odd way to 'zero-out' the array... } } @@ -2307,7 +2307,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->armor_tint.Slot[0].Color |= (tmpNPCType->armor_tint.Slot[0].Color) ? (0xFF << 24) : 0; if (armor_tint_id == 0) - for (int index = EQEmu::textures::TextureChest; index <= EQEmu::textures::LastTexture; index++) + for (int index = EQEmu::textures::armorChest; index <= EQEmu::textures::LastTexture; index++) tmpNPCType->armor_tint.Slot[index].Color = tmpNPCType->armor_tint.Slot[0].Color; else if (tmpNPCType->armor_tint.Slot[0].Color == 0) { std::string armorTint_query = StringFormat("SELECT red1h, grn1h, blu1h, " @@ -2327,7 +2327,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client else { auto armorTint_row = results.begin(); - for (int index = EQEmu::textures::TextureBegin; index <= EQEmu::textures::LastTexture; index++) { + for (int index = EQEmu::textures::textureBegin; index <= EQEmu::textures::LastTexture; index++) { tmpNPCType->armor_tint.Slot[index].Color = atoi(armorTint_row[index * 3]) << 16; tmpNPCType->armor_tint.Slot[index].Color |= atoi(armorTint_row[index * 3 + 1]) << 8; tmpNPCType->armor_tint.Slot[index].Color |= atoi(armorTint_row[index * 3 + 2]); From 7071b271831f5ecb757fb133131b689190a6c6ec Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 16 Oct 2016 21:59:35 -0400 Subject: [PATCH 22/65] Fix for travis-ci build failure --- common/item_instance.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/item_instance.h b/common/item_instance.h index 7fbf03cd9..df28d72b4 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -491,11 +491,10 @@ namespace EQEmu ////////////////////////// // Protected Members ////////////////////////// - std::map::const_iterator _cbegin() { return m_contents.cbegin(); } - std::map::const_iterator _cend() { return m_contents.cend(); } - friend class Inventory; + std::map::const_iterator _cbegin() { return m_contents.cbegin(); } + std::map::const_iterator _cend() { return m_contents.cend(); } void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; } From 9f01d14c64c688e7f8cec638b9a2c62f4dc5c460 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 16 Oct 2016 23:18:12 -0400 Subject: [PATCH 23/65] Real fix for travis-ci build failure (thanks demonstar55!) --- common/item_instance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/item_instance.h b/common/item_instance.h index df28d72b4..a1793dee2 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -491,7 +491,7 @@ namespace EQEmu ////////////////////////// // Protected Members ////////////////////////// - friend class Inventory; + friend class ::Inventory; std::map::const_iterator _cbegin() { return m_contents.cbegin(); } std::map::const_iterator _cend() { return m_contents.cend(); } From 3438247904baff7a95ba51775d81c438543c9937 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 17 Oct 2016 01:03:40 -0400 Subject: [PATCH 24/65] Moved namespace ItemField from item_instance.h to shareddb.cpp --- changelog.txt | 3 +++ common/item_instance.h | 12 ------------ common/shareddb.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5dfeca1d1..0d4412bbd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/17/2016 == +Uleat: Moved namespace ItemField from item_instance.h to shareddb.cpp - the only place it is used + == 10/16/2016 == Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance Uleat: Added class EQEmu::InventorySlot. Re-attached pertinent inventory token references to EQDictionary diff --git a/common/item_instance.h b/common/item_instance.h index a1793dee2..b83baa13f 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -39,18 +39,6 @@ class EvolveInfo; // Stores information about an evolving item family #include -namespace ItemField -{ - enum - { - source = 0, -#define F(x) x, -#include "item_fieldlist.h" -#undef F - updated - }; -}; - // Specifies usage type for item inside EQEmu::ItemInstance enum ItemInstTypes { diff --git a/common/shareddb.cpp b/common/shareddb.cpp index e748a2d56..35369c758 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -38,6 +38,17 @@ #include "string_util.h" #include "eqemu_config.h" +namespace ItemField +{ + enum { + source = 0, +#define F(x) x, +#include "item_fieldlist.h" +#undef F + updated + }; +} + SharedDatabase::SharedDatabase() : Database() { From 195bc03645e4eff575f1e2de81c477429d0926ba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 17 Oct 2016 00:56:17 -0500 Subject: [PATCH 25/65] Update eqemu_server.pl [skip ci] - Make eqemu_config.xml parsing more strict to look inside the database section --- utils/scripts/eqemu_server.pl | 49 ++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index 180dda907..4fd6bb796 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -1063,17 +1063,46 @@ sub trim { } sub read_eqemu_config_xml { - my $confile = "eqemu_config.xml"; #default - open(F, "<$confile"); - my $indb = 0; - while() { - s/\r//g; - if(/(.*)<\/host>/i) { $host = $1; } - elsif(/(.*)<\/username>/i) { $user = $1; } - elsif(/(.*)<\/password>/i) { $pass = $1; } - elsif(/(.*)<\/db>/i) { $db = $1; } - if(/(.*)<\/longname>/i) { $long_name = $1; } + open (CONFIG, "eqemu_config.xml"); + while (){ + chomp; + $o = $_; + + if($o=~/\<\!--/i){ + next; + } + + if($o=~/database/i && $o=~/\<\//i){ + $in_database_tag = 0; + } + if($o=~/\/i){ + print "IN DATABASE TAG\n" if $debug; + $in_database_tag = 1; + } + if($o=~/\/i){ + ($long_name) = $o =~ /(.*)<\/longname>/; + print "Long Name: " . $long_name . "\n" if $debug; + } + if($in_database_tag == 1){ + if($o=~/\/i && $in_database_tag){ + ($user) = $o =~ />(\w+)/i && $in_database_tag){ + ($pass) = $o =~ />(\w+)/i){ + ($db) = $o =~ />(\w+)/i){ + ($host) = $o =~ />(\w+) Date: Mon, 17 Oct 2016 02:41:09 -0400 Subject: [PATCH 26/65] Separated class Inventory from item_instance files into inventory_profile files --- changelog.txt | 1 + common/CMakeLists.txt | 2 + common/extprofile.h | 2 +- common/inventory_profile.cpp | 1419 ++++++++++++++++++++++++++++++++++ common/inventory_profile.h | 228 ++++++ common/item_instance.cpp | 1400 +-------------------------------- common/item_instance.h | 203 +---- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/shareddb.cpp | 2 +- world/client.cpp | 2 +- world/worlddb.cpp | 3 +- zone/client.h | 4 +- zone/zonedump.h | 2 +- 14 files changed, 1668 insertions(+), 1604 deletions(-) create mode 100644 common/inventory_profile.cpp create mode 100644 common/inventory_profile.h diff --git a/changelog.txt b/changelog.txt index 0d4412bbd..5806a984f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 10/17/2016 == Uleat: Moved namespace ItemField from item_instance.h to shareddb.cpp - the only place it is used +Uleat: Separated class Inventory from item_instance files into inventory_profile files == 10/16/2016 == Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index fbfc9305e..cecb47d12 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -35,6 +35,7 @@ SET(common_sources faction.cpp guild_base.cpp guilds.cpp + inventory_profile.cpp inventory_slot.cpp ipc_mutex.cpp item_data.cpp @@ -156,6 +157,7 @@ SET(common_headers global_define.h guild_base.h guilds.h + inventory_profile.h inventory_slot.h ipc_mutex.h item_data.h diff --git a/common/extprofile.h b/common/extprofile.h index e2dae7579..bdb746068 100644 --- a/common/extprofile.h +++ b/common/extprofile.h @@ -19,7 +19,7 @@ #define EXTENDED_PROFILE_H #include "eq_packet_structs.h" -#include "item_instance.h" +#include "inventory_profile.h" #pragma pack(1) diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp new file mode 100644 index 000000000..9e4c4fc94 --- /dev/null +++ b/common/inventory_profile.cpp @@ -0,0 +1,1419 @@ +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "inventory_profile.h" +#include "textures.h" +#include "eqemu_logsys.h" +//#include "classes.h" +//#include "global_define.h" +//#include "item_instance.h" +//#include "races.h" +//#include "rulesys.h" +//#include "shareddb.h" +#include "string_util.h" + +#include "../common/light_source.h" + +//#include + +#include + +std::list dirty_inst; + + +// +// class ItemInstQueue +// +ItemInstQueue::~ItemInstQueue() +{ + for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { + safe_delete(*iter); + } + m_list.clear(); +} + +// Put item onto back of queue +void ItemInstQueue::push(EQEmu::ItemInstance* inst) +{ + m_list.push_back(inst); +} + +// Put item onto front of queue +void ItemInstQueue::push_front(EQEmu::ItemInstance* inst) +{ + m_list.push_front(inst); +} + +// Remove item from front of queue +EQEmu::ItemInstance* ItemInstQueue::pop() +{ + if (m_list.empty()) + return nullptr; + + EQEmu::ItemInstance* inst = m_list.front(); + m_list.pop_front(); + return inst; +} + +// Remove item from back of queue +EQEmu::ItemInstance* ItemInstQueue::pop_back() +{ + if (m_list.empty()) + return nullptr; + + EQEmu::ItemInstance* inst = m_list.back(); + m_list.pop_back(); + return inst; +} + +// Look at item at front of queue +EQEmu::ItemInstance* ItemInstQueue::peek_front() const +{ + return (m_list.empty()) ? nullptr : m_list.front(); +} + + +// +// class Inventory +// +Inventory::~Inventory() +{ + for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { + safe_delete(iter->second); + } + m_worn.clear(); + + for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { + safe_delete(iter->second); + } + m_inv.clear(); + + for (auto iter = m_bank.begin(); iter != m_bank.end(); ++iter) { + safe_delete(iter->second); + } + m_bank.clear(); + + for (auto iter = m_shbank.begin(); iter != m_shbank.end(); ++iter) { + safe_delete(iter->second); + } + m_shbank.clear(); + + for (auto iter = m_trade.begin(); iter != m_trade.end(); ++iter) { + safe_delete(iter->second); + } + m_trade.clear(); +} + +void Inventory::CleanDirty() { + auto iter = dirty_inst.begin(); + while (iter != dirty_inst.end()) { + delete (*iter); + ++iter; + } + dirty_inst.clear(); +} + +void Inventory::MarkDirty(EQEmu::ItemInstance *inst) { + if (inst) { + dirty_inst.push_back(inst); + } +} + +// Retrieve item at specified slot; returns false if item not found +EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const +{ + EQEmu::ItemInstance* result = nullptr; + + // Cursor + if (slot_id == EQEmu::inventory::slotCursor) { + // Cursor slot + result = m_cursor.peek_front(); + } + + // Non bag slots + else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { + result = _GetItem(m_trade, slot_id); + } + else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { + // Shared Bank slots + result = _GetItem(m_shbank, slot_id); + } + else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { + // Bank slots + result = _GetItem(m_bank, slot_id); + } + else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { + // Personal inventory slots + result = _GetItem(m_inv, slot_id); + } + else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || + (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { + // Equippable slots (on body) + result = _GetItem(m_worn, slot_id); + } + + // Inner bag slots + else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { + // Trade bag slots + EQEmu::ItemInstance* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); + if (inst && inst->IsClassBag()) { + result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + } + } + else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + // Shared Bank bag slots + EQEmu::ItemInstance* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); + if (inst && inst->IsClassBag()) { + result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + } + } + else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { + // Bank bag slots + EQEmu::ItemInstance* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); + if (inst && inst->IsClassBag()) { + result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + } + } + else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { + // Cursor bag slots + EQEmu::ItemInstance* inst = m_cursor.peek_front(); + if (inst && inst->IsClassBag()) { + result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + } + } + else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { + // Personal inventory bag slots + EQEmu::ItemInstance* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); + if (inst && inst->IsClassBag()) { + result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + } + } + + return result; +} + +// Retrieve item at specified position within bag +EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id, uint8 bagidx) const +{ + return GetItem(Inventory::CalcSlotId(slot_id, bagidx)); +} + +// Put an item snto specified slot +int16 Inventory::PutItem(int16 slot_id, const EQEmu::ItemInstance& inst) +{ + // Clean up item already in slot (if exists) + DeleteItem(slot_id); + + if (!inst) { + // User is effectively deleting the item + // in the slot, why hold a null ptr in map<>? + return slot_id; + } + + // Delegate to internal method + return _PutItem(slot_id, inst.Clone()); +} + +int16 Inventory::PushCursor(const EQEmu::ItemInstance& inst) +{ + m_cursor.push(inst.Clone()); + return EQEmu::inventory::slotCursor; +} + +EQEmu::ItemInstance* Inventory::GetCursorItem() +{ + return m_cursor.peek_front(); +} + +// Swap items in inventory +bool Inventory::SwapItem(int16 slot_a, int16 slot_b) +{ + // Temp holding areas for a and b + EQEmu::ItemInstance* inst_a = GetItem(slot_a); + EQEmu::ItemInstance* inst_b = GetItem(slot_b); + + if (inst_a) { if (!inst_a->IsSlotAllowed(slot_b)) { return false; } } + if (inst_b) { if (!inst_b->IsSlotAllowed(slot_a)) { return false; } } + + _PutItem(slot_a, inst_b); // Copy b->a + _PutItem(slot_b, inst_a); // Copy a->b + + return true; +} + +// Remove item from inventory (with memory delete) +bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) +{ + // Pop item out of inventory map (or queue) + EQEmu::ItemInstance* item_to_delete = PopItem(slot_id); + + // Determine if object should be fully deleted, or + // just a quantity of charges of the item can be deleted + if (item_to_delete && (quantity > 0)) { + + item_to_delete->SetCharges(item_to_delete->GetCharges() - quantity); + + // If there are no charges left on the item, + if (item_to_delete->GetCharges() <= 0) { + // If the item is stackable (e.g arrows), or + // the item is not stackable, and is not a charged item, or is expendable, delete it + if (item_to_delete->IsStackable() || + (!item_to_delete->IsStackable() && + ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) + ) { + // Item can now be destroyed + Inventory::MarkDirty(item_to_delete); + return true; + } + } + + // Charges still exist, or it is a charged item that is not expendable. Put back into inventory + _PutItem(slot_id, item_to_delete); + return false; + } + + Inventory::MarkDirty(item_to_delete); + return true; + +} + +// Checks All items in a bag for No Drop +bool Inventory::CheckNoDrop(int16 slot_id) { + EQEmu::ItemInstance* inst = GetItem(slot_id); + if (!inst) return false; + if (!inst->GetItem()->NoDrop) return true; + if (inst->GetItem()->ItemClass == 1) { + for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { + EQEmu::ItemInstance* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); + if (bagitem && !bagitem->GetItem()->NoDrop) + return true; + } + } + return false; +} + +// Remove item from bucket without memory delete +// Returns item pointer if full delete was successful +EQEmu::ItemInstance* Inventory::PopItem(int16 slot_id) +{ + EQEmu::ItemInstance* p = nullptr; + + if (slot_id == EQEmu::inventory::slotCursor) { + p = m_cursor.pop(); + } + else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { + p = m_worn[slot_id]; + m_worn.erase(slot_id); + } + else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { + p = m_inv[slot_id]; + m_inv.erase(slot_id); + } + else if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) { + p = m_worn[slot_id]; + m_worn.erase(slot_id); + } + else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { + p = m_bank[slot_id]; + m_bank.erase(slot_id); + } + else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { + p = m_shbank[slot_id]; + m_shbank.erase(slot_id); + } + else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { + p = m_trade[slot_id]; + m_trade.erase(slot_id); + } + else { + // Is slot inside bag? + EQEmu::ItemInstance* baginst = GetItem(Inventory::CalcSlotId(slot_id)); + if (baginst != nullptr && baginst->IsClassBag()) { + p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); + } + } + + // Return pointer that needs to be deleted (or otherwise managed) + return p; +} + +bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity) { + + if (ItemToTry->Stackable) { + + for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + + EQEmu::ItemInstance* InvItem = GetItem(i); + + if (InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { + + int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); + + if (Quantity <= ChargeSlotsLeft) + return true; + + Quantity -= ChargeSlotsLeft; + + } + if (InvItem && InvItem->IsClassBag()) { + + int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + uint8 BagSize = InvItem->GetItem()->BagSlots; + for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { + + InvItem = GetItem(BaseSlotID + BagSlot); + + if (InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && + (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { + + int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); + + if (Quantity <= ChargeSlotsLeft) + return true; + + Quantity -= ChargeSlotsLeft; + } + } + } + } + } + + for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + + EQEmu::ItemInstance* InvItem = GetItem(i); + + if (!InvItem) { + + if (!ItemToTry->Stackable) { + + if (Quantity == 1) + return true; + else + Quantity--; + } + else { + if (Quantity <= ItemToTry->StackSize) + return true; + else + Quantity -= ItemToTry->StackSize; + } + + } + else if (InvItem->IsClassBag() && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { + + int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + + uint8 BagSize = InvItem->GetItem()->BagSlots; + + for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlotStackable) { + + if (Quantity == 1) + return true; + else + Quantity--; + } + else { + if (Quantity <= ItemToTry->StackSize) + return true; + else + Quantity -= ItemToTry->StackSize; + } + } + } + } + } + + return false; + +} + +// Checks that user has at least 'quantity' number of items in a given inventory slot +// Returns first slot it was found in, or SLOT_INVALID if not found + +//This function has a flaw in that it only returns the last stack that it looked at +//when quantity is greater than 1 and not all of quantity can be found in 1 stack. +int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) +{ + int16 slot_id = INVALID_INDEX; + + //Altered by Father Nitwit to support a specification of + //where to search, with a default value to maintain compatibility + + // Check each inventory bucket + if (where & invWhereWorn) { + slot_id = _HasItem(m_worn, item_id, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWherePersonal) { + slot_id = _HasItem(m_inv, item_id, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereBank) { + slot_id = _HasItem(m_bank, item_id, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereSharedBank) { + slot_id = _HasItem(m_shbank, item_id, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereTrading) { + slot_id = _HasItem(m_trade, item_id, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + // Behavioral change - Limbo is no longer checked due to improper handling of return value + if (where & invWhereCursor) { + // Check cursor queue + slot_id = _HasItem(m_cursor, item_id, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + return slot_id; +} + +//this function has the same quantity flaw mentioned above in HasItem() +int16 Inventory::HasItemByUse(uint8 use, uint8 quantity, uint8 where) +{ + int16 slot_id = INVALID_INDEX; + + // Check each inventory bucket + if (where & invWhereWorn) { + slot_id = _HasItemByUse(m_worn, use, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWherePersonal) { + slot_id = _HasItemByUse(m_inv, use, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereBank) { + slot_id = _HasItemByUse(m_bank, use, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereSharedBank) { + slot_id = _HasItemByUse(m_shbank, use, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereTrading) { + slot_id = _HasItemByUse(m_trade, use, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + // Behavioral change - Limbo is no longer checked due to improper handling of return value + if (where & invWhereCursor) { + // Check cursor queue + slot_id = _HasItemByUse(m_cursor, use, quantity); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + return slot_id; +} + +int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) +{ + int16 slot_id = INVALID_INDEX; + + // Check each inventory bucket + if (where & invWhereWorn) { + slot_id = _HasItemByLoreGroup(m_worn, loregroup); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWherePersonal) { + slot_id = _HasItemByLoreGroup(m_inv, loregroup); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereBank) { + slot_id = _HasItemByLoreGroup(m_bank, loregroup); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereSharedBank) { + slot_id = _HasItemByLoreGroup(m_shbank, loregroup); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + if (where & invWhereTrading) { + slot_id = _HasItemByLoreGroup(m_trade, loregroup); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + // Behavioral change - Limbo is no longer checked due to improper handling of return value + if (where & invWhereCursor) { + // Check cursor queue + slot_id = _HasItemByLoreGroup(m_cursor, loregroup); + if (slot_id != INVALID_INDEX) + return slot_id; + } + + return slot_id; +} + +// Locate an available inventory slot +// Returns slot_id when there's one available, else SLOT_INVALID +int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow) +{ + // Check basic inventory + for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + if (!GetItem(i)) + // Found available slot in personal inventory + return i; + } + + if (!for_bag) { + for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + const EQEmu::ItemInstance* inst = GetItem(i); + if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size) + { + if (inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver && inst->GetItem()->ItemType != EQEmu::item::ItemTypeArrow) + { + continue; + } + + int16 base_slot_id = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + + uint8 slots = inst->GetItem()->BagSlots; + uint8 j; + for (j = EQEmu::inventory::containerBegin; jGetID()) + return INVALID_INDEX; + + // step 1: find room for bags (caller should really ask for slots for bags first to avoid sending them to cursor..and bag item loss) + if (inst->IsClassBag()) { + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + if (!m_inv[free_slot]) + return free_slot; + } + + return EQEmu::inventory::slotCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) + } + + // step 2: find partial room for stackables + if (inst->IsStackable()) { + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + + if (!main_inst) + continue; + + if ((main_inst->GetID() == inst->GetID()) && (main_inst->GetCharges() < main_inst->GetItem()->StackSize)) + return free_slot; + } + + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + + if (!main_inst) + continue; + + if (main_inst->IsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + const EQEmu::ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); + + if (!sub_inst) + continue; + + if ((sub_inst->GetID() == inst->GetID()) && (sub_inst->GetCharges() < sub_inst->GetItem()->StackSize)) + return Inventory::CalcSlotId(free_slot, free_bag_slot); + } + } + } + } + + // step 3a: find room for container-specific items (ItemClassArrow) + if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) { + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + + if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeQuiver) || !main_inst->IsClassBag()) + continue; + + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + if (!main_inst->GetItem(free_bag_slot)) + return Inventory::CalcSlotId(free_slot, free_bag_slot); + } + } + } + + // step 3b: find room for container-specific items (ItemClassSmallThrowing) + if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing) { + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + + if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeBandolier) || !main_inst->IsClassBag()) + continue; + + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + if (!main_inst->GetItem(free_bag_slot)) + return Inventory::CalcSlotId(free_slot, free_bag_slot); + } + } + } + + // step 4: just find an empty slot + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + + if (!main_inst) + return free_slot; + } + + for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + + if (main_inst && main_inst->IsClassBag()) { + if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeBandolier) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver)) + continue; + + for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + if (!main_inst->GetItem(free_bag_slot)) + return Inventory::CalcSlotId(free_slot, free_bag_slot); + } + } + } + + //return INVALID_INDEX; // everything else pushes to the cursor + return EQEmu::inventory::slotCursor; +} + +// Opposite of below: Get parent bag slot_id from a slot inside of bag +int16 Inventory::CalcSlotId(int16 slot_id) { + int16 parent_slot_id = INVALID_INDEX; + + // this is not a bag range... using this risks over-writing existing items + //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) + // parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + //else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range) + + if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { + parent_slot_id = EQEmu::legacy::GENERAL_BEGIN + (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { + parent_slot_id = EQEmu::inventory::slotCursor; + } + else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { + parent_slot_id = EQEmu::legacy::BANK_BEGIN + (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + parent_slot_id = EQEmu::legacy::SHARED_BANK_BEGIN + (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { + parent_slot_id = EQEmu::legacy::TRADE_BEGIN + (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + } + + return parent_slot_id; +} + +// Calculate slot_id for an item within a bag +int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { + if (!Inventory::SupportsContainers(bagslot_id)) + return INVALID_INDEX; + + int16 slot_id = INVALID_INDEX; + + if (bagslot_id == EQEmu::inventory::slotCursor || bagslot_id == 8000) { + slot_id = EQEmu::legacy::CURSOR_BAG_BEGIN + bagidx; + } + else if (bagslot_id >= EQEmu::legacy::GENERAL_BEGIN && bagslot_id <= EQEmu::legacy::GENERAL_END) { + slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::GENERAL_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + } + else if (bagslot_id >= EQEmu::legacy::BANK_BEGIN && bagslot_id <= EQEmu::legacy::BANK_END) { + slot_id = EQEmu::legacy::BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + } + else if (bagslot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && bagslot_id <= EQEmu::legacy::SHARED_BANK_END) { + slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + } + else if (bagslot_id >= EQEmu::legacy::TRADE_BEGIN && bagslot_id <= EQEmu::legacy::TRADE_END) { + slot_id = EQEmu::legacy::TRADE_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::TRADE_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + } + + return slot_id; +} + +uint8 Inventory::CalcBagIdx(int16 slot_id) { + uint8 index = 0; + + // this is not a bag range... using this risks over-writing existing items + //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) + // index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + + if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { + index = (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { + index = (slot_id - EQEmu::legacy::CURSOR_BAG_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + } + else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { + index = (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + index = (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { + index = (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + } + else if (slot_id >= EQEmu::legacy::WORLD_BEGIN && slot_id <= EQEmu::legacy::WORLD_END) { + index = (slot_id - EQEmu::legacy::WORLD_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + } + + return index; +} + +int16 Inventory::CalcSlotFromMaterial(uint8 material) +{ + switch (material) + { + case EQEmu::textures::armorHead: + return EQEmu::inventory::slotHead; + case EQEmu::textures::armorChest: + return EQEmu::inventory::slotChest; + case EQEmu::textures::armorArms: + return EQEmu::inventory::slotArms; + case EQEmu::textures::armorWrist: + return EQEmu::inventory::slotWrist1; // there's 2 bracers, only one bracer material + case EQEmu::textures::armorHands: + return EQEmu::inventory::slotHands; + case EQEmu::textures::armorLegs: + return EQEmu::inventory::slotLegs; + case EQEmu::textures::armorFeet: + return EQEmu::inventory::slotFeet; + case EQEmu::textures::weaponPrimary: + return EQEmu::inventory::slotPrimary; + case EQEmu::textures::weaponSecondary: + return EQEmu::inventory::slotSecondary; + default: + return INVALID_INDEX; + } +} + +uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) +{ + switch (equipslot) + { + case EQEmu::inventory::slotHead: + return EQEmu::textures::armorHead; + case EQEmu::inventory::slotChest: + return EQEmu::textures::armorChest; + case EQEmu::inventory::slotArms: + return EQEmu::textures::armorArms; + case EQEmu::inventory::slotWrist1: + //case SLOT_BRACER02: // non-live behavior + return EQEmu::textures::armorWrist; + case EQEmu::inventory::slotHands: + return EQEmu::textures::armorHands; + case EQEmu::inventory::slotLegs: + return EQEmu::textures::armorLegs; + case EQEmu::inventory::slotFeet: + return EQEmu::textures::armorFeet; + case EQEmu::inventory::slotPrimary: + return EQEmu::textures::weaponPrimary; + case EQEmu::inventory::slotSecondary: + return EQEmu::textures::weaponSecondary; + default: + return EQEmu::textures::materialInvalid; + } +} + +bool Inventory::CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container) { + + if (!ItemToTry || !Container) + return false; + + if (ItemToTry->Size > Container->BagSize) + return false; + + if ((Container->BagType == EQEmu::item::BagTypeQuiver) && (ItemToTry->ItemType != EQEmu::item::ItemTypeArrow)) + return false; + + if ((Container->BagType == EQEmu::item::BagTypeBandolier) && (ItemToTry->ItemType != EQEmu::item::ItemTypeSmallThrowing)) + return false; + + return true; +} + +bool Inventory::SupportsClickCasting(int16 slot_id) +{ + // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range + if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource) + { + return true; + } + else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) + { + if (EQEmu::inventory::Lookup(m_inventory_version)->AllowClickCastFromBag) + return true; + } + + return false; +} + +bool Inventory::SupportsPotionBeltCasting(int16 slot_id) +{ + if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource || (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END)) + return true; + + return false; +} + +// Test whether a given slot can support a container item +bool Inventory::SupportsContainers(int16 slot_id) +{ + if ((slot_id == EQEmu::inventory::slotCursor) || + (slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END) || + (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) || + (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) || + (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) + ) { + return true; + } + + return false; +} + +int Inventory::GetSlotByItemInst(EQEmu::ItemInstance *inst) { + if (!inst) + return INVALID_INDEX; + + int i = GetSlotByItemInstCollection(m_worn, inst); + if (i != INVALID_INDEX) { + return i; + } + + i = GetSlotByItemInstCollection(m_inv, inst); + if (i != INVALID_INDEX) { + return i; + } + + i = GetSlotByItemInstCollection(m_bank, inst); + if (i != INVALID_INDEX) { + return i; + } + + i = GetSlotByItemInstCollection(m_shbank, inst); + if (i != INVALID_INDEX) { + return i; + } + + i = GetSlotByItemInstCollection(m_trade, inst); + if (i != INVALID_INDEX) { + return i; + } + + if (m_cursor.peek_front() == inst) { + return EQEmu::inventory::slotCursor; + } + + return INVALID_INDEX; +} + +uint8 Inventory::FindBrightestLightType() +{ + uint8 brightest_light_type = 0; + + for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { + if ((iter->first < EQEmu::legacy::EQUIPMENT_BEGIN || iter->first > EQEmu::legacy::EQUIPMENT_END) && iter->first != EQEmu::inventory::slotPowerSource) { continue; } + if (iter->first == EQEmu::inventory::slotAmmo) { continue; } + + auto inst = iter->second; + if (inst == nullptr) { continue; } + auto item = inst->GetItem(); + if (item == nullptr) { continue; } + + if (EQEmu::lightsource::IsLevelGreater(item->Light, brightest_light_type)) + brightest_light_type = item->Light; + } + + uint8 general_light_type = 0; + for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { + if (iter->first < EQEmu::legacy::GENERAL_BEGIN || iter->first > EQEmu::legacy::GENERAL_END) { continue; } + + auto inst = iter->second; + if (inst == nullptr) { continue; } + auto item = inst->GetItem(); + if (item == nullptr) { continue; } + + if (!item->IsClassCommon()) { continue; } + if (item->Light < 9 || item->Light > 13) { continue; } + + if (EQEmu::lightsource::TypeToLevel(item->Light)) + general_light_type = item->Light; + } + + if (EQEmu::lightsource::IsLevelGreater(general_light_type, brightest_light_type)) + brightest_light_type = general_light_type; + + return brightest_light_type; +} + +void Inventory::dumpEntireInventory() { + + dumpWornItems(); + dumpInventory(); + dumpBankItems(); + dumpSharedBankItems(); + + std::cout << std::endl; +} + +void Inventory::dumpWornItems() { + std::cout << "Worn items:" << std::endl; + dumpItemCollection(m_worn); +} + +void Inventory::dumpInventory() { + std::cout << "Inventory items:" << std::endl; + dumpItemCollection(m_inv); +} + +void Inventory::dumpBankItems() { + + std::cout << "Bank items:" << std::endl; + dumpItemCollection(m_bank); +} + +void Inventory::dumpSharedBankItems() { + + std::cout << "Shared Bank items:" << std::endl; + dumpItemCollection(m_shbank); +} + +int Inventory::GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst) { + for (auto iter = collection.begin(); iter != collection.end(); ++iter) { + EQEmu::ItemInstance *t_inst = iter->second; + if (t_inst == inst) { + return iter->first; + } + + if (t_inst && !t_inst->IsClassBag()) { + for (auto b_iter = t_inst->_cbegin(); b_iter != t_inst->_cend(); ++b_iter) { + if (b_iter->second == inst) { + return Inventory::CalcSlotId(iter->first, b_iter->first); + } + } + } + } + + return -1; +} + +void Inventory::dumpItemCollection(const std::map &collection) +{ + for (auto it = collection.cbegin(); it != collection.cend(); ++it) { + auto inst = it->second; + if (!inst || !inst->GetItem()) + continue; + + std::string slot = StringFormat("Slot %d: %s (%d)", it->first, it->second->GetItem()->Name, (inst->GetCharges() <= 0) ? 1 : inst->GetCharges()); + std::cout << slot << std::endl; + + dumpBagContents(inst, &it); + } +} + +void Inventory::dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it) +{ + if (!inst || !inst->IsClassBag()) + return; + + // Go through bag, if bag + for (auto itb = inst->_cbegin(); itb != inst->_cend(); ++itb) { + EQEmu::ItemInstance* baginst = itb->second; + if (!baginst || !baginst->GetItem()) + continue; + + std::string subSlot = StringFormat(" Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first), + baginst->GetItem()->Name, (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges()); + std::cout << subSlot << std::endl; + } + +} + +// Internal Method: Retrieves item within an inventory bucket +EQEmu::ItemInstance* Inventory::_GetItem(const std::map& bucket, int16 slot_id) const +{ + auto it = bucket.find(slot_id); + if (it != bucket.end()) { + return it->second; + } + + // Not found! + return nullptr; +} + +// Internal Method: "put" item into bucket, without regard for what is currently in bucket +// Assumes item has already been allocated +int16 Inventory::_PutItem(int16 slot_id, EQEmu::ItemInstance* inst) +{ + // What happens here when we _PutItem(MainCursor)? Bad things..really bad things... + // + // If putting a nullptr into slot, we need to remove slot without memory delete + if (inst == nullptr) { + //Why do we not delete the poped item here???? + PopItem(slot_id); + return slot_id; + } + + int16 result = INVALID_INDEX; + int16 parentSlot = INVALID_INDEX; + + if (slot_id == EQEmu::inventory::slotCursor) { + // Replace current item on cursor, if exists + m_cursor.pop(); // no memory delete, clients of this function know what they are doing + m_cursor.push_front(inst); + result = slot_id; + } + else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { + m_worn[slot_id] = inst; + result = slot_id; + } + else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { + m_inv[slot_id] = inst; + result = slot_id; + } + else if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) { + m_worn[slot_id] = inst; + result = slot_id; + } + else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { + m_bank[slot_id] = inst; + result = slot_id; + } + else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { + m_shbank[slot_id] = inst; + result = slot_id; + } + else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { + m_trade[slot_id] = inst; + result = slot_id; + } + else { + // Slot must be within a bag + parentSlot = Inventory::CalcSlotId(slot_id); + EQEmu::ItemInstance* baginst = GetItem(parentSlot); // Get parent bag + if (baginst && baginst->IsClassBag()) + { + baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); + result = slot_id; + } + } + + if (result == INVALID_INDEX) { + Log.Out(Logs::General, Logs::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + Inventory::MarkDirty(inst); // Slot not found, clean up + } + + return result; +} + +// Internal Method: Checks an inventory bucket for a particular item +int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) +{ + uint32 quantity_found = 0; + + for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { + auto inst = iter->second; + if (inst == nullptr) { continue; } + + if (inst->GetID() == item_id) { + quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); + if (quantity_found >= quantity) + return iter->first; + } + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return EQEmu::legacy::SLOT_AUGMENT; + } + + if (!inst->IsClassBag()) { continue; } + + for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->GetID() == item_id) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(iter->first, bag_iter->first); + } + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return EQEmu::legacy::SLOT_AUGMENT; + } + } + } + + return INVALID_INDEX; +} + +// Internal Method: Checks an inventory queue type bucket for a particular item +int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) +{ + // The downfall of this (these) queue procedure is that callers presume that when an item is + // found, it is presented as being available on the cursor. In cases of a parity check, this + // is sufficient. However, in cases where referential criteria is considered, this can lead + // to unintended results. Funtionality should be observed when referencing the return value + // of this query + + uint32 quantity_found = 0; + + for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } + + if (inst->GetID() == item_id) { + quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); + if (quantity_found >= quantity) + return EQEmu::inventory::slotCursor; + } + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return EQEmu::legacy::SLOT_AUGMENT; + } + + if (!inst->IsClassBag()) { continue; } + + for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->GetID() == item_id) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); + } + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return EQEmu::legacy::SLOT_AUGMENT; + } + } + + // We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo) + break; + } + + return INVALID_INDEX; +} + +// Internal Method: Checks an inventory bucket for a particular item +int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) +{ + uint32 quantity_found = 0; + + for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { + auto inst = iter->second; + if (inst == nullptr) { continue; } + + if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { + quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); + if (quantity_found >= quantity) + return iter->first; + } + + if (!inst->IsClassBag()) { continue; } + + for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(iter->first, bag_iter->first); + } + } + } + + return INVALID_INDEX; +} + +// Internal Method: Checks an inventory queue type bucket for a particular item +int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) +{ + uint32 quantity_found = 0; + + for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } + + if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { + quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); + if (quantity_found >= quantity) + return EQEmu::inventory::slotCursor; + } + + if (!inst->IsClassBag()) { continue; } + + for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); + } + } + + // We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo) + break; + } + + return INVALID_INDEX; +} + +int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) +{ + for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { + auto inst = iter->second; + if (inst == nullptr) { continue; } + + if (inst->GetItem()->LoreGroup == loregroup) + return iter->first; + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + auto aug_inst = inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return EQEmu::legacy::SLOT_AUGMENT; + } + + if (!inst->IsClassBag()) { continue; } + + for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) + return Inventory::CalcSlotId(iter->first, bag_iter->first); + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + auto aug_inst = bag_inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return EQEmu::legacy::SLOT_AUGMENT; + } + } + } + + return INVALID_INDEX; +} + +// Internal Method: Checks an inventory queue type bucket for a particular item +int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) +{ + for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } + + if (inst->GetItem()->LoreGroup == loregroup) + return EQEmu::inventory::slotCursor; + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + auto aug_inst = inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return EQEmu::legacy::SLOT_AUGMENT; + } + + if (!inst->IsClassBag()) { continue; } + + for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) + return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); + + for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + auto aug_inst = bag_inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return EQEmu::legacy::SLOT_AUGMENT; + } + } + + // We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo) + break; + } + + return INVALID_INDEX; +} diff --git a/common/inventory_profile.h b/common/inventory_profile.h new file mode 100644 index 000000000..3903f9812 --- /dev/null +++ b/common/inventory_profile.h @@ -0,0 +1,228 @@ +/* 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 04111-1307 USA +*/ + +// @merth notes: +// These classes could be optimized with database reads/writes by storing +// a status flag indicating how object needs to interact with database + +#ifndef COMMON_INVENTORY_PROFILE_H +#define COMMON_INVENTORY_PROFILE_H + + +#include "item_instance.h" + +#include + + +//FatherNitwit: location bits for searching specific +//places with HasItem() and HasItemByUse() +enum { + invWhereWorn = 0x01, + invWherePersonal = 0x02, //in the character's inventory + invWhereBank = 0x04, + invWhereSharedBank = 0x08, + invWhereTrading = 0x10, + invWhereCursor = 0x20 +}; + +// ######################################## +// Class: Queue +// Queue that allows a read-only iterator +class ItemInstQueue +{ +public: + ~ItemInstQueue(); + ///////////////////////// + // Public Methods + ///////////////////////// + + inline std::list::const_iterator cbegin() { return m_list.cbegin(); } + inline std::list::const_iterator cend() { return m_list.cend(); } + + inline int size() { return static_cast(m_list.size()); } // TODO: change to size_t + inline bool empty() { return m_list.empty(); } + + void push(EQEmu::ItemInstance* inst); + void push_front(EQEmu::ItemInstance* inst); + EQEmu::ItemInstance* pop(); + EQEmu::ItemInstance* pop_back(); + EQEmu::ItemInstance* peek_front() const; + +protected: + ///////////////////////// + // Protected Members + ///////////////////////// + + std::list m_list; +}; + +// ######################################## +// Class: Inventory +// Character inventory +class Inventory +{ + friend class EQEmu::ItemInstance; +public: + /////////////////////////////// + // Public Methods + /////////////////////////////// + + Inventory() { m_inventory_version = EQEmu::versions::InventoryVersion::Unknown; m_inventory_version_set = false; } + ~Inventory(); + + // inv2 creep + bool SetInventoryVersion(EQEmu::versions::InventoryVersion inventory_version) { + if (!m_inventory_version_set) { + m_inventory_version = EQEmu::versions::ValidateInventoryVersion(inventory_version); + return (m_inventory_version_set = true); + } + else { + return false; + } + } + bool SetInventoryVersion(EQEmu::versions::ClientVersion client_version) { return SetInventoryVersion(EQEmu::versions::ConvertClientVersionToInventoryVersion(client_version)); } + + EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; } + + static void CleanDirty(); + static void MarkDirty(EQEmu::ItemInstance *inst); + + // Retrieve a writeable item at specified slot + EQEmu::ItemInstance* GetItem(int16 slot_id) const; + EQEmu::ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const; + + inline std::list::const_iterator cursor_cbegin() { return m_cursor.cbegin(); } + inline std::list::const_iterator cursor_cend() { return m_cursor.cend(); } + + inline int CursorSize() { return m_cursor.size(); } + inline bool CursorEmpty() { return m_cursor.empty(); } + + // Retrieve a read-only item from inventory + inline const EQEmu::ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); } + + // Add item to inventory + int16 PutItem(int16 slot_id, const EQEmu::ItemInstance& inst); + + // Add item to cursor queue + int16 PushCursor(const EQEmu::ItemInstance& inst); + + // Get cursor item in front of queue + EQEmu::ItemInstance* GetCursorItem(); + + // Swap items in inventory + bool SwapItem(int16 slot_a, int16 slot_b); + + // Remove item from inventory + bool DeleteItem(int16 slot_id, uint8 quantity=0); + + // Checks All items in a bag for No Drop + bool CheckNoDrop(int16 slot_id); + + // Remove item from inventory (and take control of memory) + EQEmu::ItemInstance* PopItem(int16 slot_id); + + // Check whether there is space for the specified number of the specified item. + bool HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity); + + // Check whether item exists in inventory + // where argument specifies OR'd list of invWhere constants to look + int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF); + + // Check whether item exists in inventory + // where argument specifies OR'd list of invWhere constants to look + int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF); + + // Check whether item exists in inventory + // where argument specifies OR'd list of invWhere constants to look + int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF); + + // Locate an available inventory slot + int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); + int16 FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst); + + // Calculate slot_id for an item within a bag + static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id + static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag + static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id + static int16 CalcSlotFromMaterial(uint8 material); + static uint8 CalcMaterialFromSlot(int16 equipslot); + + static bool CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container); + + // Test for valid inventory casting slot + bool SupportsClickCasting(int16 slot_id); + bool SupportsPotionBeltCasting(int16 slot_id); + + // Test whether a given slot can support a container item + static bool SupportsContainers(int16 slot_id); + + int GetSlotByItemInst(EQEmu::ItemInstance *inst); + + uint8 FindBrightestLightType(); + + void dumpEntireInventory(); + void dumpWornItems(); + void dumpInventory(); + void dumpBankItems(); + void dumpSharedBankItems(); + + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value); + std::string GetCustomItemData(int16 slot_id, std::string identifier); +protected: + /////////////////////////////// + // Protected Methods + /////////////////////////////// + + int GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst); + void dumpItemCollection(const std::map &collection); + void dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it); + + // Retrieves item within an inventory bucket + EQEmu::ItemInstance* _GetItem(const std::map& bucket, int16 slot_id) const; + + // Private "put" item into bucket, without regard for what is currently in bucket + int16 _PutItem(int16 slot_id, EQEmu::ItemInstance* inst); + + // Checks an inventory bucket for a particular item + int16 _HasItem(std::map& bucket, uint32 item_id, uint8 quantity); + int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); + int16 _HasItemByUse(std::map& bucket, uint8 use, uint8 quantity); + int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); + int16 _HasItemByLoreGroup(std::map& bucket, uint32 loregroup); + int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); + + + // Player inventory + std::map m_worn; // Items worn by character + std::map m_inv; // Items in character personal inventory + std::map m_bank; // Items in character bank + std::map m_shbank; // Items in character shared bank + std::map m_trade; // Items in a trade session + ItemInstQueue m_cursor; // Items on cursor: FIFO + +private: + // Active inventory version + EQEmu::versions::InventoryVersion m_inventory_version; + bool m_inventory_version_set; +}; + +#endif /*COMMON_INVENTORY_PROFILE_H*/ diff --git a/common/item_instance.cpp b/common/item_instance.cpp index fbe2af543..de01c0893 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -16,21 +16,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "classes.h" -#include "global_define.h" -#include "item_instance.h" -#include "races.h" +#include "inventory_profile.h" +//#include "classes.h" +//#include "global_define.h" +//#include "item_instance.h" +//#include "races.h" #include "rulesys.h" #include "shareddb.h" #include "string_util.h" -#include "../common/light_source.h" +//#include "../common/light_source.h" -#include +//#include -#include +//#include -std::list dirty_inst; int32 NextItemInstSerialNumber = 1; static inline int32 GetNextItemInstSerialNumber() { @@ -53,1390 +53,6 @@ static inline int32 GetNextItemInstSerialNumber() { return NextItemInstSerialNumber; } - -// -// class ItemInstQueue -// -ItemInstQueue::~ItemInstQueue() -{ - for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { - safe_delete(*iter); - } - m_list.clear(); -} - -// Put item onto back of queue -void ItemInstQueue::push(EQEmu::ItemInstance* inst) -{ - m_list.push_back(inst); -} - -// Put item onto front of queue -void ItemInstQueue::push_front(EQEmu::ItemInstance* inst) -{ - m_list.push_front(inst); -} - -// Remove item from front of queue -EQEmu::ItemInstance* ItemInstQueue::pop() -{ - if (m_list.empty()) - return nullptr; - - EQEmu::ItemInstance* inst = m_list.front(); - m_list.pop_front(); - return inst; -} - -// Remove item from back of queue -EQEmu::ItemInstance* ItemInstQueue::pop_back() -{ - if (m_list.empty()) - return nullptr; - - EQEmu::ItemInstance* inst = m_list.back(); - m_list.pop_back(); - return inst; -} - -// Look at item at front of queue -EQEmu::ItemInstance* ItemInstQueue::peek_front() const -{ - return (m_list.empty()) ? nullptr : m_list.front(); -} - - -// -// class Inventory -// -Inventory::~Inventory() -{ - for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { - safe_delete(iter->second); - } - m_worn.clear(); - - for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { - safe_delete(iter->second); - } - m_inv.clear(); - - for (auto iter = m_bank.begin(); iter != m_bank.end(); ++iter) { - safe_delete(iter->second); - } - m_bank.clear(); - - for (auto iter = m_shbank.begin(); iter != m_shbank.end(); ++iter) { - safe_delete(iter->second); - } - m_shbank.clear(); - - for (auto iter = m_trade.begin(); iter != m_trade.end(); ++iter) { - safe_delete(iter->second); - } - m_trade.clear(); -} - -void Inventory::CleanDirty() { - auto iter = dirty_inst.begin(); - while (iter != dirty_inst.end()) { - delete (*iter); - ++iter; - } - dirty_inst.clear(); -} - -void Inventory::MarkDirty(EQEmu::ItemInstance *inst) { - if (inst) { - dirty_inst.push_back(inst); - } -} - -// Retrieve item at specified slot; returns false if item not found -EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const -{ - EQEmu::ItemInstance* result = nullptr; - - // Cursor - if (slot_id == EQEmu::inventory::slotCursor) { - // Cursor slot - result = m_cursor.peek_front(); - } - - // Non bag slots - else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { - result = _GetItem(m_trade, slot_id); - } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { - // Shared Bank slots - result = _GetItem(m_shbank, slot_id); - } - else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { - // Bank slots - result = _GetItem(m_bank, slot_id); - } - else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { - // Personal inventory slots - result = _GetItem(m_inv, slot_id); - } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || - (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { - // Equippable slots (on body) - result = _GetItem(m_worn, slot_id); - } - - // Inner bag slots - else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - // Trade bag slots - EQEmu::ItemInstance* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); - } - } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - // Shared Bank bag slots - EQEmu::ItemInstance* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); - } - } - else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - // Bank bag slots - EQEmu::ItemInstance* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); - } - } - else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { - // Cursor bag slots - EQEmu::ItemInstance* inst = m_cursor.peek_front(); - if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); - } - } - else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - // Personal inventory bag slots - EQEmu::ItemInstance* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); - if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); - } - } - - return result; -} - -// Retrieve item at specified position within bag -EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id, uint8 bagidx) const -{ - return GetItem(Inventory::CalcSlotId(slot_id, bagidx)); -} - -// Put an item snto specified slot -int16 Inventory::PutItem(int16 slot_id, const EQEmu::ItemInstance& inst) -{ - // Clean up item already in slot (if exists) - DeleteItem(slot_id); - - if (!inst) { - // User is effectively deleting the item - // in the slot, why hold a null ptr in map<>? - return slot_id; - } - - // Delegate to internal method - return _PutItem(slot_id, inst.Clone()); -} - -int16 Inventory::PushCursor(const EQEmu::ItemInstance& inst) -{ - m_cursor.push(inst.Clone()); - return EQEmu::inventory::slotCursor; -} - -EQEmu::ItemInstance* Inventory::GetCursorItem() -{ - return m_cursor.peek_front(); -} - -// Swap items in inventory -bool Inventory::SwapItem(int16 slot_a, int16 slot_b) -{ - // Temp holding areas for a and b - EQEmu::ItemInstance* inst_a = GetItem(slot_a); - EQEmu::ItemInstance* inst_b = GetItem(slot_b); - - if (inst_a) { if (!inst_a->IsSlotAllowed(slot_b)) { return false; } } - if (inst_b) { if (!inst_b->IsSlotAllowed(slot_a)) { return false; } } - - _PutItem(slot_a, inst_b); // Copy b->a - _PutItem(slot_b, inst_a); // Copy a->b - - return true; -} - -// Remove item from inventory (with memory delete) -bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) -{ - // Pop item out of inventory map (or queue) - EQEmu::ItemInstance* item_to_delete = PopItem(slot_id); - - // Determine if object should be fully deleted, or - // just a quantity of charges of the item can be deleted - if (item_to_delete && (quantity > 0)) { - - item_to_delete->SetCharges(item_to_delete->GetCharges() - quantity); - - // If there are no charges left on the item, - if (item_to_delete->GetCharges() <= 0) { - // If the item is stackable (e.g arrows), or - // the item is not stackable, and is not a charged item, or is expendable, delete it - if (item_to_delete->IsStackable() || - (!item_to_delete->IsStackable() && - ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) - ) { - // Item can now be destroyed - Inventory::MarkDirty(item_to_delete); - return true; - } - } - - // Charges still exist, or it is a charged item that is not expendable. Put back into inventory - _PutItem(slot_id, item_to_delete); - return false; - } - - Inventory::MarkDirty(item_to_delete); - return true; - -} - -// Checks All items in a bag for No Drop -bool Inventory::CheckNoDrop(int16 slot_id) { - EQEmu::ItemInstance* inst = GetItem(slot_id); - if (!inst) return false; - if (!inst->GetItem()->NoDrop) return true; - if (inst->GetItem()->ItemClass == 1) { - for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { - EQEmu::ItemInstance* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); - if (bagitem && !bagitem->GetItem()->NoDrop) - return true; - } - } - return false; -} - -// Remove item from bucket without memory delete -// Returns item pointer if full delete was successful -EQEmu::ItemInstance* Inventory::PopItem(int16 slot_id) -{ - EQEmu::ItemInstance* p = nullptr; - - if (slot_id == EQEmu::inventory::slotCursor) { - p = m_cursor.pop(); - } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { - p = m_worn[slot_id]; - m_worn.erase(slot_id); - } - else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { - p = m_inv[slot_id]; - m_inv.erase(slot_id); - } - else if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) { - p = m_worn[slot_id]; - m_worn.erase(slot_id); - } - else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { - p = m_bank[slot_id]; - m_bank.erase(slot_id); - } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { - p = m_shbank[slot_id]; - m_shbank.erase(slot_id); - } - else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { - p = m_trade[slot_id]; - m_trade.erase(slot_id); - } - else { - // Is slot inside bag? - EQEmu::ItemInstance* baginst = GetItem(Inventory::CalcSlotId(slot_id)); - if (baginst != nullptr && baginst->IsClassBag()) { - p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); - } - } - - // Return pointer that needs to be deleted (or otherwise managed) - return p; -} - -bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity) { - - if (ItemToTry->Stackable) { - - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - - EQEmu::ItemInstance* InvItem = GetItem(i); - - if (InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { - - int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - - if (Quantity <= ChargeSlotsLeft) - return true; - - Quantity -= ChargeSlotsLeft; - - } - if (InvItem && InvItem->IsClassBag()) { - - int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); - uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { - - InvItem = GetItem(BaseSlotID + BagSlot); - - if (InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && - (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { - - int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - - if (Quantity <= ChargeSlotsLeft) - return true; - - Quantity -= ChargeSlotsLeft; - } - } - } - } - } - - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - - EQEmu::ItemInstance* InvItem = GetItem(i); - - if (!InvItem) { - - if (!ItemToTry->Stackable) { - - if (Quantity == 1) - return true; - else - Quantity--; - } - else { - if (Quantity <= ItemToTry->StackSize) - return true; - else - Quantity -= ItemToTry->StackSize; - } - - } - else if (InvItem->IsClassBag() && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { - - int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); - - uint8 BagSize = InvItem->GetItem()->BagSlots; - - for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlotStackable) { - - if (Quantity == 1) - return true; - else - Quantity--; - } - else { - if (Quantity <= ItemToTry->StackSize) - return true; - else - Quantity -= ItemToTry->StackSize; - } - } - } - } - } - - return false; - -} - -// Checks that user has at least 'quantity' number of items in a given inventory slot -// Returns first slot it was found in, or SLOT_INVALID if not found - -//This function has a flaw in that it only returns the last stack that it looked at -//when quantity is greater than 1 and not all of quantity can be found in 1 stack. -int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) -{ - int16 slot_id = INVALID_INDEX; - - //Altered by Father Nitwit to support a specification of - //where to search, with a default value to maintain compatibility - - // Check each inventory bucket - if (where & invWhereWorn) { - slot_id = _HasItem(m_worn, item_id, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWherePersonal) { - slot_id = _HasItem(m_inv, item_id, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereBank) { - slot_id = _HasItem(m_bank, item_id, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereSharedBank) { - slot_id = _HasItem(m_shbank, item_id, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereTrading) { - slot_id = _HasItem(m_trade, item_id, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - // Behavioral change - Limbo is no longer checked due to improper handling of return value - if (where & invWhereCursor) { - // Check cursor queue - slot_id = _HasItem(m_cursor, item_id, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - return slot_id; -} - -//this function has the same quantity flaw mentioned above in HasItem() -int16 Inventory::HasItemByUse(uint8 use, uint8 quantity, uint8 where) -{ - int16 slot_id = INVALID_INDEX; - - // Check each inventory bucket - if (where & invWhereWorn) { - slot_id = _HasItemByUse(m_worn, use, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWherePersonal) { - slot_id = _HasItemByUse(m_inv, use, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereBank) { - slot_id = _HasItemByUse(m_bank, use, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereSharedBank) { - slot_id = _HasItemByUse(m_shbank, use, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereTrading) { - slot_id = _HasItemByUse(m_trade, use, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - // Behavioral change - Limbo is no longer checked due to improper handling of return value - if (where & invWhereCursor) { - // Check cursor queue - slot_id = _HasItemByUse(m_cursor, use, quantity); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - return slot_id; -} - -int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) -{ - int16 slot_id = INVALID_INDEX; - - // Check each inventory bucket - if (where & invWhereWorn) { - slot_id = _HasItemByLoreGroup(m_worn, loregroup); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWherePersonal) { - slot_id = _HasItemByLoreGroup(m_inv, loregroup); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereBank) { - slot_id = _HasItemByLoreGroup(m_bank, loregroup); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereSharedBank) { - slot_id = _HasItemByLoreGroup(m_shbank, loregroup); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - if (where & invWhereTrading) { - slot_id = _HasItemByLoreGroup(m_trade, loregroup); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - // Behavioral change - Limbo is no longer checked due to improper handling of return value - if (where & invWhereCursor) { - // Check cursor queue - slot_id = _HasItemByLoreGroup(m_cursor, loregroup); - if (slot_id != INVALID_INDEX) - return slot_id; - } - - return slot_id; -} - -// Locate an available inventory slot -// Returns slot_id when there's one available, else SLOT_INVALID -int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow) -{ - // Check basic inventory - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - if (!GetItem(i)) - // Found available slot in personal inventory - return i; - } - - if (!for_bag) { - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { - const EQEmu::ItemInstance* inst = GetItem(i); - if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size) - { - if (inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver && inst->GetItem()->ItemType != EQEmu::item::ItemTypeArrow) - { - continue; - } - - int16 base_slot_id = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); - - uint8 slots = inst->GetItem()->BagSlots; - uint8 j; - for (j = EQEmu::inventory::containerBegin; jGetID()) - return INVALID_INDEX; - - // step 1: find room for bags (caller should really ask for slots for bags first to avoid sending them to cursor..and bag item loss) - if (inst->IsClassBag()) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - if (!m_inv[free_slot]) - return free_slot; - } - - return EQEmu::inventory::slotCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) - } - - // step 2: find partial room for stackables - if (inst->IsStackable()) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; - - if (!main_inst) - continue; - - if ((main_inst->GetID() == inst->GetID()) && (main_inst->GetCharges() < main_inst->GetItem()->StackSize)) - return free_slot; - } - - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; - - if (!main_inst) - continue; - - if (main_inst->IsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { - const EQEmu::ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); - - if (!sub_inst) - continue; - - if ((sub_inst->GetID() == inst->GetID()) && (sub_inst->GetCharges() < sub_inst->GetItem()->StackSize)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); - } - } - } - } - - // step 3a: find room for container-specific items (ItemClassArrow) - if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; - - if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeQuiver) || !main_inst->IsClassBag()) - continue; - - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { - if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); - } - } - } - - // step 3b: find room for container-specific items (ItemClassSmallThrowing) - if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; - - if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeBandolier) || !main_inst->IsClassBag()) - continue; - - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { - if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); - } - } - } - - // step 4: just find an empty slot - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; - - if (!main_inst) - return free_slot; - } - - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; - - if (main_inst && main_inst->IsClassBag()) { - if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeBandolier) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver)) - continue; - - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { - if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); - } - } - } - - //return INVALID_INDEX; // everything else pushes to the cursor - return EQEmu::inventory::slotCursor; -} - -// Opposite of below: Get parent bag slot_id from a slot inside of bag -int16 Inventory::CalcSlotId(int16 slot_id) { - int16 parent_slot_id = INVALID_INDEX; - - // this is not a bag range... using this risks over-writing existing items - //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) - // parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; - //else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range) - - if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - parent_slot_id = EQEmu::legacy::GENERAL_BEGIN + (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { - parent_slot_id = EQEmu::inventory::slotCursor; - } - else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - parent_slot_id = EQEmu::legacy::BANK_BEGIN + (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - parent_slot_id = EQEmu::legacy::SHARED_BANK_BEGIN + (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - parent_slot_id = EQEmu::legacy::TRADE_BEGIN + (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; - } - - return parent_slot_id; -} - -// Calculate slot_id for an item within a bag -int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { - if (!Inventory::SupportsContainers(bagslot_id)) - return INVALID_INDEX; - - int16 slot_id = INVALID_INDEX; - - if (bagslot_id == EQEmu::inventory::slotCursor || bagslot_id == 8000) { - slot_id = EQEmu::legacy::CURSOR_BAG_BEGIN + bagidx; - } - else if (bagslot_id >= EQEmu::legacy::GENERAL_BEGIN && bagslot_id <= EQEmu::legacy::GENERAL_END) { - slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::GENERAL_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; - } - else if (bagslot_id >= EQEmu::legacy::BANK_BEGIN && bagslot_id <= EQEmu::legacy::BANK_END) { - slot_id = EQEmu::legacy::BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; - } - else if (bagslot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && bagslot_id <= EQEmu::legacy::SHARED_BANK_END) { - slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; - } - else if (bagslot_id >= EQEmu::legacy::TRADE_BEGIN && bagslot_id <= EQEmu::legacy::TRADE_END) { - slot_id = EQEmu::legacy::TRADE_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::TRADE_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; - } - - return slot_id; -} - -uint8 Inventory::CalcBagIdx(int16 slot_id) { - uint8 index = 0; - - // this is not a bag range... using this risks over-writing existing items - //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) - // index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - - if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - index = (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { - index = (slot_id - EQEmu::legacy::CURSOR_BAG_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots - } - else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - index = (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - index = (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - index = (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; - } - else if (slot_id >= EQEmu::legacy::WORLD_BEGIN && slot_id <= EQEmu::legacy::WORLD_END) { - index = (slot_id - EQEmu::legacy::WORLD_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots - } - - return index; -} - -int16 Inventory::CalcSlotFromMaterial(uint8 material) -{ - switch (material) - { - case EQEmu::textures::armorHead: - return EQEmu::inventory::slotHead; - case EQEmu::textures::armorChest: - return EQEmu::inventory::slotChest; - case EQEmu::textures::armorArms: - return EQEmu::inventory::slotArms; - case EQEmu::textures::armorWrist: - return EQEmu::inventory::slotWrist1; // there's 2 bracers, only one bracer material - case EQEmu::textures::armorHands: - return EQEmu::inventory::slotHands; - case EQEmu::textures::armorLegs: - return EQEmu::inventory::slotLegs; - case EQEmu::textures::armorFeet: - return EQEmu::inventory::slotFeet; - case EQEmu::textures::weaponPrimary: - return EQEmu::inventory::slotPrimary; - case EQEmu::textures::weaponSecondary: - return EQEmu::inventory::slotSecondary; - default: - return INVALID_INDEX; - } -} - -uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) -{ - switch (equipslot) - { - case EQEmu::inventory::slotHead: - return EQEmu::textures::armorHead; - case EQEmu::inventory::slotChest: - return EQEmu::textures::armorChest; - case EQEmu::inventory::slotArms: - return EQEmu::textures::armorArms; - case EQEmu::inventory::slotWrist1: - //case SLOT_BRACER02: // non-live behavior - return EQEmu::textures::armorWrist; - case EQEmu::inventory::slotHands: - return EQEmu::textures::armorHands; - case EQEmu::inventory::slotLegs: - return EQEmu::textures::armorLegs; - case EQEmu::inventory::slotFeet: - return EQEmu::textures::armorFeet; - case EQEmu::inventory::slotPrimary: - return EQEmu::textures::weaponPrimary; - case EQEmu::inventory::slotSecondary: - return EQEmu::textures::weaponSecondary; - default: - return EQEmu::textures::materialInvalid; - } -} - -bool Inventory::CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container) { - - if (!ItemToTry || !Container) - return false; - - if (ItemToTry->Size > Container->BagSize) - return false; - - if ((Container->BagType == EQEmu::item::BagTypeQuiver) && (ItemToTry->ItemType != EQEmu::item::ItemTypeArrow)) - return false; - - if ((Container->BagType == EQEmu::item::BagTypeBandolier) && (ItemToTry->ItemType != EQEmu::item::ItemTypeSmallThrowing)) - return false; - - return true; -} - -bool Inventory::SupportsClickCasting(int16 slot_id) -{ - // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range - if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource) - { - return true; - } - else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) - { - if (EQEmu::inventory::Lookup(m_inventory_version)->AllowClickCastFromBag) - return true; - } - - return false; -} - -bool Inventory::SupportsPotionBeltCasting(int16 slot_id) -{ - if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource || (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END)) - return true; - - return false; -} - -// Test whether a given slot can support a container item -bool Inventory::SupportsContainers(int16 slot_id) -{ - if ((slot_id == EQEmu::inventory::slotCursor) || - (slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END) || - (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) || - (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) || - (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) - ) { - return true; - } - - return false; -} - -int Inventory::GetSlotByItemInst(EQEmu::ItemInstance *inst) { - if (!inst) - return INVALID_INDEX; - - int i = GetSlotByItemInstCollection(m_worn, inst); - if (i != INVALID_INDEX) { - return i; - } - - i = GetSlotByItemInstCollection(m_inv, inst); - if (i != INVALID_INDEX) { - return i; - } - - i = GetSlotByItemInstCollection(m_bank, inst); - if (i != INVALID_INDEX) { - return i; - } - - i = GetSlotByItemInstCollection(m_shbank, inst); - if (i != INVALID_INDEX) { - return i; - } - - i = GetSlotByItemInstCollection(m_trade, inst); - if (i != INVALID_INDEX) { - return i; - } - - if (m_cursor.peek_front() == inst) { - return EQEmu::inventory::slotCursor; - } - - return INVALID_INDEX; -} - -uint8 Inventory::FindBrightestLightType() -{ - uint8 brightest_light_type = 0; - - for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { - if ((iter->first < EQEmu::legacy::EQUIPMENT_BEGIN || iter->first > EQEmu::legacy::EQUIPMENT_END) && iter->first != EQEmu::inventory::slotPowerSource) { continue; } - if (iter->first == EQEmu::inventory::slotAmmo) { continue; } - - auto inst = iter->second; - if (inst == nullptr) { continue; } - auto item = inst->GetItem(); - if (item == nullptr) { continue; } - - if (EQEmu::lightsource::IsLevelGreater(item->Light, brightest_light_type)) - brightest_light_type = item->Light; - } - - uint8 general_light_type = 0; - for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { - if (iter->first < EQEmu::legacy::GENERAL_BEGIN || iter->first > EQEmu::legacy::GENERAL_END) { continue; } - - auto inst = iter->second; - if (inst == nullptr) { continue; } - auto item = inst->GetItem(); - if (item == nullptr) { continue; } - - if (!item->IsClassCommon()) { continue; } - if (item->Light < 9 || item->Light > 13) { continue; } - - if (EQEmu::lightsource::TypeToLevel(item->Light)) - general_light_type = item->Light; - } - - if (EQEmu::lightsource::IsLevelGreater(general_light_type, brightest_light_type)) - brightest_light_type = general_light_type; - - return brightest_light_type; -} - -void Inventory::dumpEntireInventory() { - - dumpWornItems(); - dumpInventory(); - dumpBankItems(); - dumpSharedBankItems(); - - std::cout << std::endl; -} - -void Inventory::dumpWornItems() { - std::cout << "Worn items:" << std::endl; - dumpItemCollection(m_worn); -} - -void Inventory::dumpInventory() { - std::cout << "Inventory items:" << std::endl; - dumpItemCollection(m_inv); -} - -void Inventory::dumpBankItems() { - - std::cout << "Bank items:" << std::endl; - dumpItemCollection(m_bank); -} - -void Inventory::dumpSharedBankItems() { - - std::cout << "Shared Bank items:" << std::endl; - dumpItemCollection(m_shbank); -} - -int Inventory::GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst) { - for (auto iter = collection.begin(); iter != collection.end(); ++iter) { - EQEmu::ItemInstance *t_inst = iter->second; - if (t_inst == inst) { - return iter->first; - } - - if (t_inst && !t_inst->IsClassBag()) { - for (auto b_iter = t_inst->_cbegin(); b_iter != t_inst->_cend(); ++b_iter) { - if (b_iter->second == inst) { - return Inventory::CalcSlotId(iter->first, b_iter->first); - } - } - } - } - - return -1; -} - -void Inventory::dumpItemCollection(const std::map &collection) -{ - for (auto it = collection.cbegin(); it != collection.cend(); ++it) { - auto inst = it->second; - if (!inst || !inst->GetItem()) - continue; - - std::string slot = StringFormat("Slot %d: %s (%d)", it->first, it->second->GetItem()->Name, (inst->GetCharges() <= 0) ? 1 : inst->GetCharges()); - std::cout << slot << std::endl; - - dumpBagContents(inst, &it); - } -} - -void Inventory::dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it) -{ - if (!inst || !inst->IsClassBag()) - return; - - // Go through bag, if bag - for (auto itb = inst->_cbegin(); itb != inst->_cend(); ++itb) { - EQEmu::ItemInstance* baginst = itb->second; - if (!baginst || !baginst->GetItem()) - continue; - - std::string subSlot = StringFormat(" Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first), - baginst->GetItem()->Name, (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges()); - std::cout << subSlot << std::endl; - } - -} - -// Internal Method: Retrieves item within an inventory bucket -EQEmu::ItemInstance* Inventory::_GetItem(const std::map& bucket, int16 slot_id) const -{ - auto it = bucket.find(slot_id); - if (it != bucket.end()) { - return it->second; - } - - // Not found! - return nullptr; -} - -// Internal Method: "put" item into bucket, without regard for what is currently in bucket -// Assumes item has already been allocated -int16 Inventory::_PutItem(int16 slot_id, EQEmu::ItemInstance* inst) -{ - // What happens here when we _PutItem(MainCursor)? Bad things..really bad things... - // - // If putting a nullptr into slot, we need to remove slot without memory delete - if (inst == nullptr) { - //Why do we not delete the poped item here???? - PopItem(slot_id); - return slot_id; - } - - int16 result = INVALID_INDEX; - int16 parentSlot = INVALID_INDEX; - - if (slot_id == EQEmu::inventory::slotCursor) { - // Replace current item on cursor, if exists - m_cursor.pop(); // no memory delete, clients of this function know what they are doing - m_cursor.push_front(inst); - result = slot_id; - } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { - m_worn[slot_id] = inst; - result = slot_id; - } - else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { - m_inv[slot_id] = inst; - result = slot_id; - } - else if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) { - m_worn[slot_id] = inst; - result = slot_id; - } - else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { - m_bank[slot_id] = inst; - result = slot_id; - } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { - m_shbank[slot_id] = inst; - result = slot_id; - } - else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { - m_trade[slot_id] = inst; - result = slot_id; - } - else { - // Slot must be within a bag - parentSlot = Inventory::CalcSlotId(slot_id); - EQEmu::ItemInstance* baginst = GetItem(parentSlot); // Get parent bag - if (baginst && baginst->IsClassBag()) - { - baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); - result = slot_id; - } - } - - if (result == INVALID_INDEX) { - Log.Out(Logs::General, Logs::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); - Inventory::MarkDirty(inst); // Slot not found, clean up - } - - return result; -} - -// Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) -{ - uint32 quantity_found = 0; - - for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { - auto inst = iter->second; - if (inst == nullptr) { continue; } - - if (inst->GetID() == item_id) { - quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); - if (quantity_found >= quantity) - return iter->first; - } - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; - } - - if (!inst->IsClassBag()) { continue; } - - for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { - auto bag_inst = bag_iter->second; - if (bag_inst == nullptr) { continue; } - - if (bag_inst->GetID() == item_id) { - quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(iter->first, bag_iter->first); - } - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; - } - } - } - - return INVALID_INDEX; -} - -// Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) -{ - // The downfall of this (these) queue procedure is that callers presume that when an item is - // found, it is presented as being available on the cursor. In cases of a parity check, this - // is sufficient. However, in cases where referential criteria is considered, this can lead - // to unintended results. Funtionality should be observed when referencing the return value - // of this query - - uint32 quantity_found = 0; - - for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { - auto inst = *iter; - if (inst == nullptr) { continue; } - - if (inst->GetID() == item_id) { - quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); - if (quantity_found >= quantity) - return EQEmu::inventory::slotCursor; - } - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; - } - - if (!inst->IsClassBag()) { continue; } - - for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { - auto bag_inst = bag_iter->second; - if (bag_inst == nullptr) { continue; } - - if (bag_inst->GetID() == item_id) { - quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); - } - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; - } - } - - // We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo) - break; - } - - return INVALID_INDEX; -} - -// Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) -{ - uint32 quantity_found = 0; - - for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { - auto inst = iter->second; - if (inst == nullptr) { continue; } - - if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { - quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); - if (quantity_found >= quantity) - return iter->first; - } - - if (!inst->IsClassBag()) { continue; } - - for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { - auto bag_inst = bag_iter->second; - if (bag_inst == nullptr) { continue; } - - if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { - quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(iter->first, bag_iter->first); - } - } - } - - return INVALID_INDEX; -} - -// Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) -{ - uint32 quantity_found = 0; - - for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { - auto inst = *iter; - if (inst == nullptr) { continue; } - - if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { - quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); - if (quantity_found >= quantity) - return EQEmu::inventory::slotCursor; - } - - if (!inst->IsClassBag()) { continue; } - - for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { - auto bag_inst = bag_iter->second; - if (bag_inst == nullptr) { continue; } - - if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { - quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); - } - } - - // We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo) - break; - } - - return INVALID_INDEX; -} - -int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) -{ - for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { - auto inst = iter->second; - if (inst == nullptr) { continue; } - - if (inst->GetItem()->LoreGroup == loregroup) - return iter->first; - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - auto aug_inst = inst->GetAugment(index); - if (aug_inst == nullptr) { continue; } - - if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; - } - - if (!inst->IsClassBag()) { continue; } - - for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { - auto bag_inst = bag_iter->second; - if (bag_inst == nullptr) { continue; } - - if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(iter->first, bag_iter->first); - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - auto aug_inst = bag_inst->GetAugment(index); - if (aug_inst == nullptr) { continue; } - - if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; - } - } - } - - return INVALID_INDEX; -} - -// Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) -{ - for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { - auto inst = *iter; - if (inst == nullptr) { continue; } - - if (inst->GetItem()->LoreGroup == loregroup) - return EQEmu::inventory::slotCursor; - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - auto aug_inst = inst->GetAugment(index); - if (aug_inst == nullptr) { continue; } - - if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; - } - - if (!inst->IsClassBag()) { continue; } - - for (auto bag_iter = inst->_cbegin(); bag_iter != inst->_cend(); ++bag_iter) { - auto bag_inst = bag_iter->second; - if (bag_inst == nullptr) { continue; } - - if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); - - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { - auto aug_inst = bag_inst->GetAugment(index); - if (aug_inst == nullptr) { continue; } - - if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; - } - } - - // We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo) - break; - } - - return INVALID_INDEX; -} - - // // class EQEmu::ItemInstance // diff --git a/common/item_instance.h b/common/item_instance.h index b83baa13f..2a4afdca1 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -35,7 +35,6 @@ class EvolveInfo; // Stores information about an evolving item family #include "../common/deity.h" #include "../common/memory_buffer.h" -#include #include @@ -52,208 +51,8 @@ typedef enum { byFlagNotSet //apply action if the flag is NOT set } byFlagSetting; - -//FatherNitwit: location bits for searching specific -//places with HasItem() and HasItemByUse() -enum { - invWhereWorn = 0x01, - invWherePersonal = 0x02, //in the character's inventory - invWhereBank = 0x04, - invWhereSharedBank = 0x08, - invWhereTrading = 0x10, - invWhereCursor = 0x20 -}; - -namespace EQEmu -{ - class ItemInstance; -} - -// ######################################## -// Class: Queue -// Queue that allows a read-only iterator -class ItemInstQueue -{ -public: - ~ItemInstQueue(); - ///////////////////////// - // Public Methods - ///////////////////////// - - inline std::list::const_iterator cbegin() { return m_list.cbegin(); } - inline std::list::const_iterator cend() { return m_list.cend(); } - - inline int size() { return static_cast(m_list.size()); } // TODO: change to size_t - inline bool empty() { return m_list.empty(); } - - void push(EQEmu::ItemInstance* inst); - void push_front(EQEmu::ItemInstance* inst); - EQEmu::ItemInstance* pop(); - EQEmu::ItemInstance* pop_back(); - EQEmu::ItemInstance* peek_front() const; - -protected: - ///////////////////////// - // Protected Members - ///////////////////////// - - std::list m_list; -}; - -// ######################################## -// Class: Inventory -// Character inventory -class Inventory -{ - friend class EQEmu::ItemInstance; -public: - /////////////////////////////// - // Public Methods - /////////////////////////////// - - Inventory() { m_inventory_version = EQEmu::versions::InventoryVersion::Unknown; m_inventory_version_set = false; } - ~Inventory(); - - // inv2 creep - bool SetInventoryVersion(EQEmu::versions::InventoryVersion inventory_version) { - if (!m_inventory_version_set) { - m_inventory_version = EQEmu::versions::ValidateInventoryVersion(inventory_version); - return (m_inventory_version_set = true); - } - else { - return false; - } - } - bool SetInventoryVersion(EQEmu::versions::ClientVersion client_version) { return SetInventoryVersion(EQEmu::versions::ConvertClientVersionToInventoryVersion(client_version)); } - - EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; } - - static void CleanDirty(); - static void MarkDirty(EQEmu::ItemInstance *inst); - - // Retrieve a writeable item at specified slot - EQEmu::ItemInstance* GetItem(int16 slot_id) const; - EQEmu::ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const; - - inline std::list::const_iterator cursor_cbegin() { return m_cursor.cbegin(); } - inline std::list::const_iterator cursor_cend() { return m_cursor.cend(); } - - inline int CursorSize() { return m_cursor.size(); } - inline bool CursorEmpty() { return m_cursor.empty(); } - - // Retrieve a read-only item from inventory - inline const EQEmu::ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); } - - // Add item to inventory - int16 PutItem(int16 slot_id, const EQEmu::ItemInstance& inst); - - // Add item to cursor queue - int16 PushCursor(const EQEmu::ItemInstance& inst); - - // Get cursor item in front of queue - EQEmu::ItemInstance* GetCursorItem(); - - // Swap items in inventory - bool SwapItem(int16 slot_a, int16 slot_b); - - // Remove item from inventory - bool DeleteItem(int16 slot_id, uint8 quantity=0); - - // Checks All items in a bag for No Drop - bool CheckNoDrop(int16 slot_id); - - // Remove item from inventory (and take control of memory) - EQEmu::ItemInstance* PopItem(int16 slot_id); - - // Check whether there is space for the specified number of the specified item. - bool HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity); - - // Check whether item exists in inventory - // where argument specifies OR'd list of invWhere constants to look - int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF); - - // Check whether item exists in inventory - // where argument specifies OR'd list of invWhere constants to look - int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF); - - // Check whether item exists in inventory - // where argument specifies OR'd list of invWhere constants to look - int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF); - - // Locate an available inventory slot - int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); - int16 FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst); - - // Calculate slot_id for an item within a bag - static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id - static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag - static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id - static int16 CalcSlotFromMaterial(uint8 material); - static uint8 CalcMaterialFromSlot(int16 equipslot); - - static bool CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container); - - // Test for valid inventory casting slot - bool SupportsClickCasting(int16 slot_id); - bool SupportsPotionBeltCasting(int16 slot_id); - - // Test whether a given slot can support a container item - static bool SupportsContainers(int16 slot_id); - - int GetSlotByItemInst(EQEmu::ItemInstance *inst); - - uint8 FindBrightestLightType(); - - void dumpEntireInventory(); - void dumpWornItems(); - void dumpInventory(); - void dumpBankItems(); - void dumpSharedBankItems(); - - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value); - std::string GetCustomItemData(int16 slot_id, std::string identifier); -protected: - /////////////////////////////// - // Protected Methods - /////////////////////////////// - - int GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst); - void dumpItemCollection(const std::map &collection); - void dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it); - - // Retrieves item within an inventory bucket - EQEmu::ItemInstance* _GetItem(const std::map& bucket, int16 slot_id) const; - - // Private "put" item into bucket, without regard for what is currently in bucket - int16 _PutItem(int16 slot_id, EQEmu::ItemInstance* inst); - - // Checks an inventory bucket for a particular item - int16 _HasItem(std::map& bucket, uint32 item_id, uint8 quantity); - int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); - int16 _HasItemByUse(std::map& bucket, uint8 use, uint8 quantity); - int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); - int16 _HasItemByLoreGroup(std::map& bucket, uint32 loregroup); - int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); - - - // Player inventory - std::map m_worn; // Items worn by character - std::map m_inv; // Items in character personal inventory - std::map m_bank; // Items in character bank - std::map m_shbank; // Items in character shared bank - std::map m_trade; // Items in a trade session - ItemInstQueue m_cursor; // Items on cursor: FIFO - -private: - // Active inventory version - EQEmu::versions::InventoryVersion m_inventory_version; - bool m_inventory_version_set; -}; - class SharedDatabase; +class Inventory; // ######################################## // Class: EQEmu::ItemInstance diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d3b4456b7..cc1744a31 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item_instance.h" +#include "../inventory_profile.h" #include "rof_structs.h" #include "../rulesys.h" diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 676f4c89f..aadd0a90b 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -29,7 +29,7 @@ #include "../eq_packet_structs.h" #include "../misc_functions.h" #include "../string_util.h" -#include "../item_instance.h" +#include "../inventory_profile.h" #include "rof2_structs.h" #include "../rulesys.h" diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 35369c758..8cd62f164 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -29,7 +29,7 @@ #include "faction.h" #include "features.h" #include "ipc_mutex.h" -#include "item_instance.h" +#include "inventory_profile.h" #include "loottable.h" #include "memory_mapped_file.h" #include "mysql.h" diff --git a/world/client.cpp b/world/client.cpp index ff3c0ce9a..5614d6317 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -25,7 +25,7 @@ #include "../common/eq_packet_structs.h" #include "../common/packet_dump.h" #include "../common/eq_stream_intf.h" -#include "../common/item_instance.h" +#include "../common/inventory_profile.h" #include "../common/races.h" #include "../common/classes.h" #include "../common/languages.h" diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 0fa814417..65476190e 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -17,10 +17,9 @@ */ #include "worlddb.h" -//#include "../common/item_instance.h" #include "../common/string_util.h" #include "../common/eq_packet_structs.h" -#include "../common/item_instance.h" +#include "../common/inventory_profile.h" #include "../common/rulesys.h" #include #include diff --git a/zone/client.h b/zone/client.h index bfe9f96cd..82ee442d2 100644 --- a/zone/client.h +++ b/zone/client.h @@ -45,9 +45,9 @@ namespace EQEmu #include "../common/extprofile.h" #include "../common/races.h" #include "../common/seperator.h" -#include "../common/item_instance.h" +#include "../common/inventory_profile.h" #include "../common/guilds.h" -#include "../common/item_data.h" +//#include "../common/item_data.h" #include "common.h" #include "merc.h" diff --git a/zone/zonedump.h b/zone/zonedump.h index 20412ed70..80888d31e 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -28,7 +28,7 @@ spawn2 mediumblob, npcs mediumblob, npc_loot mediumblob, gmspawntype mediumblob, #define ZONEDUMP_H #include "../common/faction.h" #include "../common/eq_packet_structs.h" -#include "../common/item_instance.h" +#include "../common/inventory_profile.h" #pragma pack(1) From 04f4fd652bdbc05766bf1eb390aaa23dcb81a7ff Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 17 Oct 2016 04:59:00 -0400 Subject: [PATCH 27/65] Renamed class Inventory to EQEmu::InventoryProfile --- changelog.txt | 1 + common/database.cpp | 2 +- common/database.h | 8 +- common/inventory_profile.cpp | 526 +++++++++++++++++------------------ common/inventory_profile.h | 231 +++++++-------- common/item_instance.cpp | 138 ++++----- common/item_instance.h | 17 +- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/shareddb.cpp | 28 +- common/shareddb.h | 12 +- world/client.cpp | 2 +- world/worlddb.cpp | 4 +- zone/bonuses.cpp | 4 +- zone/bot.cpp | 14 +- zone/bot.h | 4 +- zone/bot_command.cpp | 2 +- zone/bot_database.cpp | 4 +- zone/bot_database.h | 4 +- zone/client.cpp | 4 +- zone/client.h | 6 +- zone/client_packet.cpp | 4 +- zone/command.cpp | 10 +- zone/corpse.cpp | 10 +- zone/inventory.cpp | 56 ++-- zone/lua_inventory.h | 16 +- zone/merc.cpp | 2 +- zone/merc.h | 2 +- zone/mob.cpp | 6 +- zone/npc.cpp | 4 +- zone/tradeskills.cpp | 14 +- zone/trading.cpp | 18 +- zone/zone.cpp | 2 +- 33 files changed, 586 insertions(+), 573 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5806a984f..1ac1ec731 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 10/17/2016 == Uleat: Moved namespace ItemField from item_instance.h to shareddb.cpp - the only place it is used Uleat: Separated class Inventory from item_instance files into inventory_profile files +Uleat: Renamed class Inventory to EQEmu::InventoryProfile == 10/16/2016 == Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance diff --git a/common/database.cpp b/common/database.cpp index 743bec9f2..66ac8495b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -672,7 +672,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe } /* This only for new Character creation storing */ -bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv) { +bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) { uint32 charid = 0; char zone[50]; float x, y, z; diff --git a/common/database.h b/common/database.h index 69ad0c576..6f3fd0642 100644 --- a/common/database.h +++ b/common/database.h @@ -37,10 +37,14 @@ //atoi is not uint32 or uint32 safe!!!! #define atoul(str) strtoul(str, nullptr, 10) -class Inventory; class MySQLRequestResult; class Client; +namespace EQEmu +{ + class InventoryProfile; +} + struct EventLogDetails_Struct { uint32 id; char accountname[64]; @@ -109,7 +113,7 @@ public: bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp); bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked); bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone); - bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv); + bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv); bool UpdateName(const char* oldname, const char* newname); /* General Information Queries */ diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp index 9e4c4fc94..c952392b1 100644 --- a/common/inventory_profile.cpp +++ b/common/inventory_profile.cpp @@ -89,9 +89,9 @@ EQEmu::ItemInstance* ItemInstQueue::peek_front() const // -// class Inventory +// class EQEmu::InventoryProfile // -Inventory::~Inventory() +EQEmu::InventoryProfile::~InventoryProfile() { for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { safe_delete(iter->second); @@ -119,7 +119,7 @@ Inventory::~Inventory() m_trade.clear(); } -void Inventory::CleanDirty() { +void EQEmu::InventoryProfile::CleanDirty() { auto iter = dirty_inst.begin(); while (iter != dirty_inst.end()) { delete (*iter); @@ -128,79 +128,79 @@ void Inventory::CleanDirty() { dirty_inst.clear(); } -void Inventory::MarkDirty(EQEmu::ItemInstance *inst) { +void EQEmu::InventoryProfile::MarkDirty(ItemInstance *inst) { if (inst) { dirty_inst.push_back(inst); } } // Retrieve item at specified slot; returns false if item not found -EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const +EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const { - EQEmu::ItemInstance* result = nullptr; + ItemInstance* result = nullptr; // Cursor - if (slot_id == EQEmu::inventory::slotCursor) { + if (slot_id == inventory::slotCursor) { // Cursor slot result = m_cursor.peek_front(); } // Non bag slots - else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { + else if (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) { result = _GetItem(m_trade, slot_id); } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { + else if (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) { // Shared Bank slots result = _GetItem(m_shbank, slot_id); } - else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { + else if (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) { // Bank slots result = _GetItem(m_bank, slot_id); } - else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { + else if ((slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END)) { // Personal inventory slots result = _GetItem(m_inv, slot_id); } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || - (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { + else if ((slot_id >= legacy::EQUIPMENT_BEGIN && slot_id <= legacy::EQUIPMENT_END) || + (slot_id >= legacy::TRIBUTE_BEGIN && slot_id <= legacy::TRIBUTE_END) || (slot_id == inventory::slotPowerSource)) { // Equippable slots (on body) result = _GetItem(m_worn, slot_id); } // Inner bag slots - else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { + else if (slot_id >= legacy::TRADE_BAGS_BEGIN && slot_id <= legacy::TRADE_BAGS_END) { // Trade bag slots - EQEmu::ItemInstance* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); + ItemInstance* inst = _GetItem(m_trade, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { + else if (slot_id >= legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= legacy::SHARED_BANK_BAGS_END) { // Shared Bank bag slots - EQEmu::ItemInstance* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); + ItemInstance* inst = _GetItem(m_shbank, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { + else if (slot_id >= legacy::BANK_BAGS_BEGIN && slot_id <= legacy::BANK_BAGS_END) { // Bank bag slots - EQEmu::ItemInstance* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); + ItemInstance* inst = _GetItem(m_bank, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { + else if (slot_id >= legacy::CURSOR_BAG_BEGIN && slot_id <= legacy::CURSOR_BAG_END) { // Cursor bag slots - EQEmu::ItemInstance* inst = m_cursor.peek_front(); + ItemInstance* inst = m_cursor.peek_front(); if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } - else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { + else if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { // Personal inventory bag slots - EQEmu::ItemInstance* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); + ItemInstance* inst = _GetItem(m_inv, InventoryProfile::CalcSlotId(slot_id)); if (inst && inst->IsClassBag()) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryProfile::CalcBagIdx(slot_id)); } } @@ -208,13 +208,13 @@ EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id) const } // Retrieve item at specified position within bag -EQEmu::ItemInstance* Inventory::GetItem(int16 slot_id, uint8 bagidx) const +EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id, uint8 bagidx) const { - return GetItem(Inventory::CalcSlotId(slot_id, bagidx)); + return GetItem(InventoryProfile::CalcSlotId(slot_id, bagidx)); } // Put an item snto specified slot -int16 Inventory::PutItem(int16 slot_id, const EQEmu::ItemInstance& inst) +int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst) { // Clean up item already in slot (if exists) DeleteItem(slot_id); @@ -229,23 +229,23 @@ int16 Inventory::PutItem(int16 slot_id, const EQEmu::ItemInstance& inst) return _PutItem(slot_id, inst.Clone()); } -int16 Inventory::PushCursor(const EQEmu::ItemInstance& inst) +int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance& inst) { m_cursor.push(inst.Clone()); - return EQEmu::inventory::slotCursor; + return inventory::slotCursor; } -EQEmu::ItemInstance* Inventory::GetCursorItem() +EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() { return m_cursor.peek_front(); } // Swap items in inventory -bool Inventory::SwapItem(int16 slot_a, int16 slot_b) +bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b) { // Temp holding areas for a and b - EQEmu::ItemInstance* inst_a = GetItem(slot_a); - EQEmu::ItemInstance* inst_b = GetItem(slot_b); + ItemInstance* inst_a = GetItem(slot_a); + ItemInstance* inst_b = GetItem(slot_b); if (inst_a) { if (!inst_a->IsSlotAllowed(slot_b)) { return false; } } if (inst_b) { if (!inst_b->IsSlotAllowed(slot_a)) { return false; } } @@ -257,10 +257,10 @@ bool Inventory::SwapItem(int16 slot_a, int16 slot_b) } // Remove item from inventory (with memory delete) -bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) +bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) { // Pop item out of inventory map (or queue) - EQEmu::ItemInstance* item_to_delete = PopItem(slot_id); + ItemInstance* item_to_delete = PopItem(slot_id); // Determine if object should be fully deleted, or // just a quantity of charges of the item can be deleted @@ -277,7 +277,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) ) { // Item can now be destroyed - Inventory::MarkDirty(item_to_delete); + InventoryProfile::MarkDirty(item_to_delete); return true; } } @@ -287,19 +287,19 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) return false; } - Inventory::MarkDirty(item_to_delete); + InventoryProfile::MarkDirty(item_to_delete); return true; } // Checks All items in a bag for No Drop -bool Inventory::CheckNoDrop(int16 slot_id) { - EQEmu::ItemInstance* inst = GetItem(slot_id); +bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id) { + ItemInstance* inst = GetItem(slot_id); if (!inst) return false; if (!inst->GetItem()->NoDrop) return true; if (inst->GetItem()->ItemClass == 1) { - for (uint8 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { - EQEmu::ItemInstance* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); + for (uint8 i = inventory::containerBegin; i < inventory::ContainerCount; i++) { + ItemInstance* bagitem = GetItem(InventoryProfile::CalcSlotId(slot_id, i)); if (bagitem && !bagitem->GetItem()->NoDrop) return true; } @@ -309,42 +309,42 @@ bool Inventory::CheckNoDrop(int16 slot_id) { // Remove item from bucket without memory delete // Returns item pointer if full delete was successful -EQEmu::ItemInstance* Inventory::PopItem(int16 slot_id) +EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id) { - EQEmu::ItemInstance* p = nullptr; + ItemInstance* p = nullptr; - if (slot_id == EQEmu::inventory::slotCursor) { + if (slot_id == inventory::slotCursor) { p = m_cursor.pop(); } - else if ((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { + else if ((slot_id >= legacy::EQUIPMENT_BEGIN && slot_id <= legacy::EQUIPMENT_END) || (slot_id == inventory::slotPowerSource)) { p = m_worn[slot_id]; m_worn.erase(slot_id); } - else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { + else if ((slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END)) { p = m_inv[slot_id]; m_inv.erase(slot_id); } - else if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) { + else if (slot_id >= legacy::TRIBUTE_BEGIN && slot_id <= legacy::TRIBUTE_END) { p = m_worn[slot_id]; m_worn.erase(slot_id); } - else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { + else if (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) { p = m_bank[slot_id]; m_bank.erase(slot_id); } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { + else if (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) { p = m_shbank[slot_id]; m_shbank.erase(slot_id); } - else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { + else if (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) { p = m_trade[slot_id]; m_trade.erase(slot_id); } else { // Is slot inside bag? - EQEmu::ItemInstance* baginst = GetItem(Inventory::CalcSlotId(slot_id)); + ItemInstance* baginst = GetItem(InventoryProfile::CalcSlotId(slot_id)); if (baginst != nullptr && baginst->IsClassBag()) { - p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); + p = baginst->PopItem(InventoryProfile::CalcBagIdx(slot_id)); } } @@ -352,13 +352,13 @@ EQEmu::ItemInstance* Inventory::PopItem(int16 slot_id) return p; } -bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity) { +bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity) { if (ItemToTry->Stackable) { - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + for (int16 i = legacy::GENERAL_BEGIN; i <= legacy::GENERAL_END; i++) { - EQEmu::ItemInstance* InvItem = GetItem(i); + ItemInstance* InvItem = GetItem(i); if (InvItem && (InvItem->GetItem()->ID == ItemToTry->ID) && (InvItem->GetCharges() < InvItem->GetItem()->StackSize)) { @@ -372,9 +372,9 @@ bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity } if (InvItem && InvItem->IsClassBag()) { - int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 BaseSlotID = InventoryProfile::CalcSlotId(i, inventory::containerBegin); uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlot < BagSize; BagSlot++) { + for (uint8 BagSlot = inventory::containerBegin; BagSlot < BagSize; BagSlot++) { InvItem = GetItem(BaseSlotID + BagSlot); @@ -393,9 +393,9 @@ bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity } } - for (int16 i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { + for (int16 i = legacy::GENERAL_BEGIN; i <= legacy::GENERAL_END; i++) { - EQEmu::ItemInstance* InvItem = GetItem(i); + ItemInstance* InvItem = GetItem(i); if (!InvItem) { @@ -416,11 +416,11 @@ bool Inventory::HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity } else if (InvItem->IsClassBag() && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { - int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 BaseSlotID = InventoryProfile::CalcSlotId(i, inventory::containerBegin); uint8 BagSize = InvItem->GetItem()->BagSlots; - for (uint8 BagSlot = EQEmu::inventory::containerBegin; BagSlotIsClassBag() && inst->GetItem()->BagSize >= min_size) { - if (inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver && inst->GetItem()->ItemType != EQEmu::item::ItemTypeArrow) + if (inst->GetItem()->BagType == item::BagTypeQuiver && inst->GetItem()->ItemType != item::ItemTypeArrow) { continue; } - int16 base_slot_id = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 base_slot_id = InventoryProfile::CalcSlotId(i, inventory::containerBegin); uint8 slots = inst->GetItem()->BagSlots; uint8 j; - for (j = EQEmu::inventory::containerBegin; jIsClassBag()) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { if (!m_inv[free_slot]) return free_slot; } - return EQEmu::inventory::slotCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) + return inventory::slotCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) } // step 2: find partial room for stackables if (inst->IsStackable()) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { + const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) continue; @@ -671,84 +671,84 @@ int16 Inventory::FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst) { return free_slot; } - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { + const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) continue; if (main_inst->IsClassBag()) { // if item-specific containers already have bad items, we won't fix it here... - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { - const EQEmu::ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); + for (uint8 free_bag_slot = inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { + const ItemInstance* sub_inst = main_inst->GetItem(free_bag_slot); if (!sub_inst) continue; if ((sub_inst->GetID() == inst->GetID()) && (sub_inst->GetCharges() < sub_inst->GetItem()->StackSize)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } } } } // step 3a: find room for container-specific items (ItemClassArrow) - if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeArrow) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + if (inst->GetItem()->ItemType == item::ItemTypeArrow) { + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { + const ItemInstance* main_inst = m_inv[free_slot]; - if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeQuiver) || !main_inst->IsClassBag()) + if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeQuiver) || !main_inst->IsClassBag()) continue; - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + for (uint8 free_bag_slot = inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } } } // step 3b: find room for container-specific items (ItemClassSmallThrowing) - if (inst->GetItem()->ItemType == EQEmu::item::ItemTypeSmallThrowing) { - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + if (inst->GetItem()->ItemType == item::ItemTypeSmallThrowing) { + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { + const ItemInstance* main_inst = m_inv[free_slot]; - if (!main_inst || (main_inst->GetItem()->BagType != EQEmu::item::BagTypeBandolier) || !main_inst->IsClassBag()) + if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeBandolier) || !main_inst->IsClassBag()) continue; - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + for (uint8 free_bag_slot = inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } } } // step 4: just find an empty slot - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { + const ItemInstance* main_inst = m_inv[free_slot]; if (!main_inst) return free_slot; } - for (int16 free_slot = EQEmu::legacy::GENERAL_BEGIN; free_slot <= EQEmu::legacy::GENERAL_END; ++free_slot) { - const EQEmu::ItemInstance* main_inst = m_inv[free_slot]; + for (int16 free_slot = legacy::GENERAL_BEGIN; free_slot <= legacy::GENERAL_END; ++free_slot) { + const ItemInstance* main_inst = m_inv[free_slot]; if (main_inst && main_inst->IsClassBag()) { - if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeBandolier) || (main_inst->GetItem()->BagType == EQEmu::item::BagTypeQuiver)) + if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == item::BagTypeBandolier) || (main_inst->GetItem()->BagType == item::BagTypeQuiver)) continue; - for (uint8 free_bag_slot = EQEmu::inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EQEmu::inventory::ContainerCount); ++free_bag_slot) { + for (uint8 free_bag_slot = inventory::containerBegin; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < inventory::ContainerCount); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryProfile::CalcSlotId(free_slot, free_bag_slot); } } } //return INVALID_INDEX; // everything else pushes to the cursor - return EQEmu::inventory::slotCursor; + return inventory::slotCursor; } // Opposite of below: Get parent bag slot_id from a slot inside of bag -int16 Inventory::CalcSlotId(int16 slot_id) { +int16 EQEmu::InventoryProfile::CalcSlotId(int16 slot_id) { int16 parent_slot_id = INVALID_INDEX; // this is not a bag range... using this risks over-writing existing items @@ -756,136 +756,136 @@ int16 Inventory::CalcSlotId(int16 slot_id) { // parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; //else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range) - if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - parent_slot_id = EQEmu::legacy::GENERAL_BEGIN + (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { + parent_slot_id = legacy::GENERAL_BEGIN + (slot_id - legacy::GENERAL_BAGS_BEGIN) / inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { - parent_slot_id = EQEmu::inventory::slotCursor; + else if (slot_id >= legacy::CURSOR_BAG_BEGIN && slot_id <= legacy::CURSOR_BAG_END) { + parent_slot_id = inventory::slotCursor; } - else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - parent_slot_id = EQEmu::legacy::BANK_BEGIN + (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + else if (slot_id >= legacy::BANK_BAGS_BEGIN && slot_id <= legacy::BANK_BAGS_END) { + parent_slot_id = legacy::BANK_BEGIN + (slot_id - legacy::BANK_BAGS_BEGIN) / inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - parent_slot_id = EQEmu::legacy::SHARED_BANK_BEGIN + (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + else if (slot_id >= legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= legacy::SHARED_BANK_BAGS_END) { + parent_slot_id = legacy::SHARED_BANK_BEGIN + (slot_id - legacy::SHARED_BANK_BAGS_BEGIN) / inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - parent_slot_id = EQEmu::legacy::TRADE_BEGIN + (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) / EQEmu::inventory::ContainerCount; + else if (slot_id >= legacy::TRADE_BAGS_BEGIN && slot_id <= legacy::TRADE_BAGS_END) { + parent_slot_id = legacy::TRADE_BEGIN + (slot_id - legacy::TRADE_BAGS_BEGIN) / inventory::ContainerCount; } return parent_slot_id; } // Calculate slot_id for an item within a bag -int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { - if (!Inventory::SupportsContainers(bagslot_id)) +int16 EQEmu::InventoryProfile::CalcSlotId(int16 bagslot_id, uint8 bagidx) { + if (!InventoryProfile::SupportsContainers(bagslot_id)) return INVALID_INDEX; int16 slot_id = INVALID_INDEX; - if (bagslot_id == EQEmu::inventory::slotCursor || bagslot_id == 8000) { - slot_id = EQEmu::legacy::CURSOR_BAG_BEGIN + bagidx; + if (bagslot_id == inventory::slotCursor || bagslot_id == 8000) { + slot_id = legacy::CURSOR_BAG_BEGIN + bagidx; } - else if (bagslot_id >= EQEmu::legacy::GENERAL_BEGIN && bagslot_id <= EQEmu::legacy::GENERAL_END) { - slot_id = EQEmu::legacy::GENERAL_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::GENERAL_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + else if (bagslot_id >= legacy::GENERAL_BEGIN && bagslot_id <= legacy::GENERAL_END) { + slot_id = legacy::GENERAL_BAGS_BEGIN + (bagslot_id - legacy::GENERAL_BEGIN) * inventory::ContainerCount + bagidx; } - else if (bagslot_id >= EQEmu::legacy::BANK_BEGIN && bagslot_id <= EQEmu::legacy::BANK_END) { - slot_id = EQEmu::legacy::BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + else if (bagslot_id >= legacy::BANK_BEGIN && bagslot_id <= legacy::BANK_END) { + slot_id = legacy::BANK_BAGS_BEGIN + (bagslot_id - legacy::BANK_BEGIN) * inventory::ContainerCount + bagidx; } - else if (bagslot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && bagslot_id <= EQEmu::legacy::SHARED_BANK_END) { - slot_id = EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + else if (bagslot_id >= legacy::SHARED_BANK_BEGIN && bagslot_id <= legacy::SHARED_BANK_END) { + slot_id = legacy::SHARED_BANK_BAGS_BEGIN + (bagslot_id - legacy::SHARED_BANK_BEGIN) * inventory::ContainerCount + bagidx; } - else if (bagslot_id >= EQEmu::legacy::TRADE_BEGIN && bagslot_id <= EQEmu::legacy::TRADE_END) { - slot_id = EQEmu::legacy::TRADE_BAGS_BEGIN + (bagslot_id - EQEmu::legacy::TRADE_BEGIN) * EQEmu::inventory::ContainerCount + bagidx; + else if (bagslot_id >= legacy::TRADE_BEGIN && bagslot_id <= legacy::TRADE_END) { + slot_id = legacy::TRADE_BAGS_BEGIN + (bagslot_id - legacy::TRADE_BEGIN) * inventory::ContainerCount + bagidx; } return slot_id; } -uint8 Inventory::CalcBagIdx(int16 slot_id) { +uint8 EQEmu::InventoryProfile::CalcBagIdx(int16 slot_id) { uint8 index = 0; // this is not a bag range... using this risks over-writing existing items //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) // index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) { - index = (slot_id - EQEmu::legacy::GENERAL_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { + index = (slot_id - legacy::GENERAL_BAGS_BEGIN) % inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::CURSOR_BAG_BEGIN && slot_id <= EQEmu::legacy::CURSOR_BAG_END) { - index = (slot_id - EQEmu::legacy::CURSOR_BAG_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + else if (slot_id >= legacy::CURSOR_BAG_BEGIN && slot_id <= legacy::CURSOR_BAG_END) { + index = (slot_id - legacy::CURSOR_BAG_BEGIN); // % inventory::ContainerCount; - not needed since range is 10 slots } - else if (slot_id >= EQEmu::legacy::BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::BANK_BAGS_END) { - index = (slot_id - EQEmu::legacy::BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + else if (slot_id >= legacy::BANK_BAGS_BEGIN && slot_id <= legacy::BANK_BAGS_END) { + index = (slot_id - legacy::BANK_BAGS_BEGIN) % inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_BAGS_END) { - index = (slot_id - EQEmu::legacy::SHARED_BANK_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + else if (slot_id >= legacy::SHARED_BANK_BAGS_BEGIN && slot_id <= legacy::SHARED_BANK_BAGS_END) { + index = (slot_id - legacy::SHARED_BANK_BAGS_BEGIN) % inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::TRADE_BAGS_BEGIN && slot_id <= EQEmu::legacy::TRADE_BAGS_END) { - index = (slot_id - EQEmu::legacy::TRADE_BAGS_BEGIN) % EQEmu::inventory::ContainerCount; + else if (slot_id >= legacy::TRADE_BAGS_BEGIN && slot_id <= legacy::TRADE_BAGS_END) { + index = (slot_id - legacy::TRADE_BAGS_BEGIN) % inventory::ContainerCount; } - else if (slot_id >= EQEmu::legacy::WORLD_BEGIN && slot_id <= EQEmu::legacy::WORLD_END) { - index = (slot_id - EQEmu::legacy::WORLD_BEGIN); // % EQEmu::legacy::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + else if (slot_id >= legacy::WORLD_BEGIN && slot_id <= legacy::WORLD_END) { + index = (slot_id - legacy::WORLD_BEGIN); // % inventory::ContainerCount; - not needed since range is 10 slots } return index; } -int16 Inventory::CalcSlotFromMaterial(uint8 material) +int16 EQEmu::InventoryProfile::CalcSlotFromMaterial(uint8 material) { switch (material) { - case EQEmu::textures::armorHead: - return EQEmu::inventory::slotHead; - case EQEmu::textures::armorChest: - return EQEmu::inventory::slotChest; - case EQEmu::textures::armorArms: - return EQEmu::inventory::slotArms; - case EQEmu::textures::armorWrist: - return EQEmu::inventory::slotWrist1; // there's 2 bracers, only one bracer material - case EQEmu::textures::armorHands: - return EQEmu::inventory::slotHands; - case EQEmu::textures::armorLegs: - return EQEmu::inventory::slotLegs; - case EQEmu::textures::armorFeet: - return EQEmu::inventory::slotFeet; - case EQEmu::textures::weaponPrimary: - return EQEmu::inventory::slotPrimary; - case EQEmu::textures::weaponSecondary: - return EQEmu::inventory::slotSecondary; + case textures::armorHead: + return inventory::slotHead; + case textures::armorChest: + return inventory::slotChest; + case textures::armorArms: + return inventory::slotArms; + case textures::armorWrist: + return inventory::slotWrist1; // there's 2 bracers, only one bracer material + case textures::armorHands: + return inventory::slotHands; + case textures::armorLegs: + return inventory::slotLegs; + case textures::armorFeet: + return inventory::slotFeet; + case textures::weaponPrimary: + return inventory::slotPrimary; + case textures::weaponSecondary: + return inventory::slotSecondary; default: return INVALID_INDEX; } } -uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) +uint8 EQEmu::InventoryProfile::CalcMaterialFromSlot(int16 equipslot) { switch (equipslot) { - case EQEmu::inventory::slotHead: - return EQEmu::textures::armorHead; - case EQEmu::inventory::slotChest: - return EQEmu::textures::armorChest; - case EQEmu::inventory::slotArms: - return EQEmu::textures::armorArms; - case EQEmu::inventory::slotWrist1: + case inventory::slotHead: + return textures::armorHead; + case inventory::slotChest: + return textures::armorChest; + case inventory::slotArms: + return textures::armorArms; + case inventory::slotWrist1: //case SLOT_BRACER02: // non-live behavior - return EQEmu::textures::armorWrist; - case EQEmu::inventory::slotHands: - return EQEmu::textures::armorHands; - case EQEmu::inventory::slotLegs: - return EQEmu::textures::armorLegs; - case EQEmu::inventory::slotFeet: - return EQEmu::textures::armorFeet; - case EQEmu::inventory::slotPrimary: - return EQEmu::textures::weaponPrimary; - case EQEmu::inventory::slotSecondary: - return EQEmu::textures::weaponSecondary; + return textures::armorWrist; + case inventory::slotHands: + return textures::armorHands; + case inventory::slotLegs: + return textures::armorLegs; + case inventory::slotFeet: + return textures::armorFeet; + case inventory::slotPrimary: + return textures::weaponPrimary; + case inventory::slotSecondary: + return textures::weaponSecondary; default: - return EQEmu::textures::materialInvalid; + return textures::materialInvalid; } } -bool Inventory::CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container) { +bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container) { if (!ItemToTry || !Container) return false; @@ -893,47 +893,47 @@ bool Inventory::CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQ if (ItemToTry->Size > Container->BagSize) return false; - if ((Container->BagType == EQEmu::item::BagTypeQuiver) && (ItemToTry->ItemType != EQEmu::item::ItemTypeArrow)) + if ((Container->BagType == item::BagTypeQuiver) && (ItemToTry->ItemType != item::ItemTypeArrow)) return false; - if ((Container->BagType == EQEmu::item::BagTypeBandolier) && (ItemToTry->ItemType != EQEmu::item::ItemTypeSmallThrowing)) + if ((Container->BagType == item::BagTypeBandolier) && (ItemToTry->ItemType != item::ItemTypeSmallThrowing)) return false; return true; } -bool Inventory::SupportsClickCasting(int16 slot_id) +bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id) { // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range - if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource) + if ((uint16)slot_id <= legacy::GENERAL_END || slot_id == inventory::slotPowerSource) { return true; } - else if (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END) + else if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { - if (EQEmu::inventory::Lookup(m_inventory_version)->AllowClickCastFromBag) + if (inventory::Lookup(m_inventory_version)->AllowClickCastFromBag) return true; } return false; } -bool Inventory::SupportsPotionBeltCasting(int16 slot_id) +bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id) { - if ((uint16)slot_id <= EQEmu::legacy::GENERAL_END || slot_id == EQEmu::inventory::slotPowerSource || (slot_id >= EQEmu::legacy::GENERAL_BAGS_BEGIN && slot_id <= EQEmu::legacy::GENERAL_BAGS_END)) + if ((uint16)slot_id <= legacy::GENERAL_END || slot_id == inventory::slotPowerSource || (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END)) return true; return false; } // Test whether a given slot can support a container item -bool Inventory::SupportsContainers(int16 slot_id) +bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id) { - if ((slot_id == EQEmu::inventory::slotCursor) || - (slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END) || - (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) || - (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) || - (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) + if ((slot_id == inventory::slotCursor) || + (slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END) || + (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) || + (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) || + (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) ) { return true; } @@ -941,7 +941,7 @@ bool Inventory::SupportsContainers(int16 slot_id) return false; } -int Inventory::GetSlotByItemInst(EQEmu::ItemInstance *inst) { +int EQEmu::InventoryProfile::GetSlotByItemInst(ItemInstance *inst) { if (!inst) return INVALID_INDEX; @@ -971,32 +971,32 @@ int Inventory::GetSlotByItemInst(EQEmu::ItemInstance *inst) { } if (m_cursor.peek_front() == inst) { - return EQEmu::inventory::slotCursor; + return inventory::slotCursor; } return INVALID_INDEX; } -uint8 Inventory::FindBrightestLightType() +uint8 EQEmu::InventoryProfile::FindBrightestLightType() { uint8 brightest_light_type = 0; for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { - if ((iter->first < EQEmu::legacy::EQUIPMENT_BEGIN || iter->first > EQEmu::legacy::EQUIPMENT_END) && iter->first != EQEmu::inventory::slotPowerSource) { continue; } - if (iter->first == EQEmu::inventory::slotAmmo) { continue; } + if ((iter->first < legacy::EQUIPMENT_BEGIN || iter->first > legacy::EQUIPMENT_END) && iter->first != inventory::slotPowerSource) { continue; } + if (iter->first == inventory::slotAmmo) { continue; } auto inst = iter->second; if (inst == nullptr) { continue; } auto item = inst->GetItem(); if (item == nullptr) { continue; } - if (EQEmu::lightsource::IsLevelGreater(item->Light, brightest_light_type)) + if (lightsource::IsLevelGreater(item->Light, brightest_light_type)) brightest_light_type = item->Light; } uint8 general_light_type = 0; for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { - if (iter->first < EQEmu::legacy::GENERAL_BEGIN || iter->first > EQEmu::legacy::GENERAL_END) { continue; } + if (iter->first < legacy::GENERAL_BEGIN || iter->first > legacy::GENERAL_END) { continue; } auto inst = iter->second; if (inst == nullptr) { continue; } @@ -1006,17 +1006,17 @@ uint8 Inventory::FindBrightestLightType() if (!item->IsClassCommon()) { continue; } if (item->Light < 9 || item->Light > 13) { continue; } - if (EQEmu::lightsource::TypeToLevel(item->Light)) + if (lightsource::TypeToLevel(item->Light)) general_light_type = item->Light; } - if (EQEmu::lightsource::IsLevelGreater(general_light_type, brightest_light_type)) + if (lightsource::IsLevelGreater(general_light_type, brightest_light_type)) brightest_light_type = general_light_type; return brightest_light_type; } -void Inventory::dumpEntireInventory() { +void EQEmu::InventoryProfile::dumpEntireInventory() { dumpWornItems(); dumpInventory(); @@ -1026,31 +1026,31 @@ void Inventory::dumpEntireInventory() { std::cout << std::endl; } -void Inventory::dumpWornItems() { +void EQEmu::InventoryProfile::dumpWornItems() { std::cout << "Worn items:" << std::endl; dumpItemCollection(m_worn); } -void Inventory::dumpInventory() { +void EQEmu::InventoryProfile::dumpInventory() { std::cout << "Inventory items:" << std::endl; dumpItemCollection(m_inv); } -void Inventory::dumpBankItems() { +void EQEmu::InventoryProfile::dumpBankItems() { std::cout << "Bank items:" << std::endl; dumpItemCollection(m_bank); } -void Inventory::dumpSharedBankItems() { +void EQEmu::InventoryProfile::dumpSharedBankItems() { std::cout << "Shared Bank items:" << std::endl; dumpItemCollection(m_shbank); } -int Inventory::GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst) { +int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map &collection, ItemInstance *inst) { for (auto iter = collection.begin(); iter != collection.end(); ++iter) { - EQEmu::ItemInstance *t_inst = iter->second; + ItemInstance *t_inst = iter->second; if (t_inst == inst) { return iter->first; } @@ -1058,7 +1058,7 @@ int Inventory::GetSlotByItemInstCollection(const std::mapIsClassBag()) { for (auto b_iter = t_inst->_cbegin(); b_iter != t_inst->_cend(); ++b_iter) { if (b_iter->second == inst) { - return Inventory::CalcSlotId(iter->first, b_iter->first); + return InventoryProfile::CalcSlotId(iter->first, b_iter->first); } } } @@ -1067,7 +1067,7 @@ int Inventory::GetSlotByItemInstCollection(const std::map &collection) +void EQEmu::InventoryProfile::dumpItemCollection(const std::map &collection) { for (auto it = collection.cbegin(); it != collection.cend(); ++it) { auto inst = it->second; @@ -1081,18 +1081,18 @@ void Inventory::dumpItemCollection(const std::map & } } -void Inventory::dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it) +void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map::const_iterator *it) { if (!inst || !inst->IsClassBag()) return; // Go through bag, if bag for (auto itb = inst->_cbegin(); itb != inst->_cend(); ++itb) { - EQEmu::ItemInstance* baginst = itb->second; + ItemInstance* baginst = itb->second; if (!baginst || !baginst->GetItem()) continue; - std::string subSlot = StringFormat(" Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first), + std::string subSlot = StringFormat(" Slot %d: %s (%d)", InventoryProfile::CalcSlotId((*it)->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges()); std::cout << subSlot << std::endl; } @@ -1100,7 +1100,7 @@ void Inventory::dumpBagContents(EQEmu::ItemInstance *inst, std::map& bucket, int16 slot_id) const +EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map& bucket, int16 slot_id) const { auto it = bucket.find(slot_id); if (it != bucket.end()) { @@ -1113,7 +1113,7 @@ EQEmu::ItemInstance* Inventory::_GetItem(const std::map= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) || (slot_id == EQEmu::inventory::slotPowerSource)) { + else if ((slot_id >= legacy::EQUIPMENT_BEGIN && slot_id <= legacy::EQUIPMENT_END) || (slot_id == inventory::slotPowerSource)) { m_worn[slot_id] = inst; result = slot_id; } - else if ((slot_id >= EQEmu::legacy::GENERAL_BEGIN && slot_id <= EQEmu::legacy::GENERAL_END)) { + else if ((slot_id >= legacy::GENERAL_BEGIN && slot_id <= legacy::GENERAL_END)) { m_inv[slot_id] = inst; result = slot_id; } - else if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END) { + else if (slot_id >= legacy::TRIBUTE_BEGIN && slot_id <= legacy::TRIBUTE_END) { m_worn[slot_id] = inst; result = slot_id; } - else if (slot_id >= EQEmu::legacy::BANK_BEGIN && slot_id <= EQEmu::legacy::BANK_END) { + else if (slot_id >= legacy::BANK_BEGIN && slot_id <= legacy::BANK_END) { m_bank[slot_id] = inst; result = slot_id; } - else if (slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id <= EQEmu::legacy::SHARED_BANK_END) { + else if (slot_id >= legacy::SHARED_BANK_BEGIN && slot_id <= legacy::SHARED_BANK_END) { m_shbank[slot_id] = inst; result = slot_id; } - else if (slot_id >= EQEmu::legacy::TRADE_BEGIN && slot_id <= EQEmu::legacy::TRADE_END) { + else if (slot_id >= legacy::TRADE_BEGIN && slot_id <= legacy::TRADE_END) { m_trade[slot_id] = inst; result = slot_id; } else { // Slot must be within a bag - parentSlot = Inventory::CalcSlotId(slot_id); - EQEmu::ItemInstance* baginst = GetItem(parentSlot); // Get parent bag + parentSlot = InventoryProfile::CalcSlotId(slot_id); + ItemInstance* baginst = GetItem(parentSlot); // Get parent bag if (baginst && baginst->IsClassBag()) { - baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); + baginst->_PutItem(InventoryProfile::CalcBagIdx(slot_id), inst); result = slot_id; } } if (result == INVALID_INDEX) { - Log.Out(Logs::General, Logs::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); - Inventory::MarkDirty(inst); // Slot not found, clean up + Log.Out(Logs::General, Logs::Error, "InventoryProfile::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + InventoryProfile::MarkDirty(inst); // Slot not found, clean up } return result; } // Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) +int16 EQEmu::InventoryProfile::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) { uint32 quantity_found = 0; @@ -1191,9 +1191,9 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 return iter->first; } - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } if (!inst->IsClassBag()) { continue; } @@ -1205,12 +1205,12 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 if (bag_inst->GetID() == item_id) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(iter->first, bag_iter->first); + return InventoryProfile::CalcSlotId(iter->first, bag_iter->first); } - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } } } @@ -1219,7 +1219,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 } // Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) +int16 EQEmu::InventoryProfile::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) { // The downfall of this (these) queue procedure is that callers presume that when an item is // found, it is presented as being available on the cursor. In cases of a parity check, this @@ -1236,12 +1236,12 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) if (inst->GetID() == item_id) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return EQEmu::inventory::slotCursor; + return inventory::slotCursor; } - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } if (!inst->IsClassBag()) { continue; } @@ -1253,12 +1253,12 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) if (bag_inst->GetID() == item_id) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); + return InventoryProfile::CalcSlotId(inventory::slotCursor, bag_iter->first); } - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } } @@ -1270,7 +1270,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) } // Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) +int16 EQEmu::InventoryProfile::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) { uint32 quantity_found = 0; @@ -1293,7 +1293,7 @@ int16 Inventory::_HasItemByUse(std::map& bucket, ui if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(iter->first, bag_iter->first); + return InventoryProfile::CalcSlotId(iter->first, bag_iter->first); } } } @@ -1302,7 +1302,7 @@ int16 Inventory::_HasItemByUse(std::map& bucket, ui } // Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) +int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) { uint32 quantity_found = 0; @@ -1313,7 +1313,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (inst->IsClassCommon() && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return EQEmu::inventory::slotCursor; + return inventory::slotCursor; } if (!inst->IsClassBag()) { continue; } @@ -1325,7 +1325,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (bag_inst->IsClassCommon() && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); + return InventoryProfile::CalcSlotId(inventory::slotCursor, bag_iter->first); } } @@ -1336,7 +1336,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) return INVALID_INDEX; } -int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) +int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) { for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { auto inst = iter->second; @@ -1345,12 +1345,12 @@ int16 Inventory::_HasItemByLoreGroup(std::map& buck if (inst->GetItem()->LoreGroup == loregroup) return iter->first; - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { auto aug_inst = inst->GetAugment(index); if (aug_inst == nullptr) { continue; } if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } if (!inst->IsClassBag()) { continue; } @@ -1360,14 +1360,14 @@ int16 Inventory::_HasItemByLoreGroup(std::map& buck if (bag_inst == nullptr) { continue; } if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(iter->first, bag_iter->first); + return InventoryProfile::CalcSlotId(iter->first, bag_iter->first); - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { auto aug_inst = bag_inst->GetAugment(index); if (aug_inst == nullptr) { continue; } if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } } } @@ -1376,21 +1376,21 @@ int16 Inventory::_HasItemByLoreGroup(std::map& buck } // Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) +int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) { for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { auto inst = *iter; if (inst == nullptr) { continue; } if (inst->GetItem()->LoreGroup == loregroup) - return EQEmu::inventory::slotCursor; + return inventory::slotCursor; - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { auto aug_inst = inst->GetAugment(index); if (aug_inst == nullptr) { continue; } if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } if (!inst->IsClassBag()) { continue; } @@ -1400,14 +1400,14 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) if (bag_inst == nullptr) { continue; } if (bag_inst->IsClassCommon() && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(EQEmu::inventory::slotCursor, bag_iter->first); + return InventoryProfile::CalcSlotId(inventory::slotCursor, bag_iter->first); - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { auto aug_inst = bag_inst->GetAugment(index); if (aug_inst == nullptr) { continue; } if (aug_inst->GetItem()->LoreGroup == loregroup) - return EQEmu::legacy::SLOT_AUGMENT; + return legacy::SLOT_AUGMENT; } } diff --git a/common/inventory_profile.h b/common/inventory_profile.h index 3903f9812..0f90fdea2 100644 --- a/common/inventory_profile.h +++ b/common/inventory_profile.h @@ -73,156 +73,159 @@ protected: }; // ######################################## -// Class: Inventory +// Class: EQEmu::InventoryProfile // Character inventory -class Inventory +namespace EQEmu { - friend class EQEmu::ItemInstance; -public: - /////////////////////////////// - // Public Methods - /////////////////////////////// - - Inventory() { m_inventory_version = EQEmu::versions::InventoryVersion::Unknown; m_inventory_version_set = false; } - ~Inventory(); + class InventoryProfile + { + friend class ItemInstance; + public: + /////////////////////////////// + // Public Methods + /////////////////////////////// - // inv2 creep - bool SetInventoryVersion(EQEmu::versions::InventoryVersion inventory_version) { - if (!m_inventory_version_set) { - m_inventory_version = EQEmu::versions::ValidateInventoryVersion(inventory_version); - return (m_inventory_version_set = true); + InventoryProfile() { m_inventory_version = versions::InventoryVersion::Unknown; m_inventory_version_set = false; } + ~InventoryProfile(); + + // inv2 creep + bool SetInventoryVersion(versions::InventoryVersion inventory_version) { + if (!m_inventory_version_set) { + m_inventory_version = versions::ValidateInventoryVersion(inventory_version); + return (m_inventory_version_set = true); + } + else { + return false; + } } - else { - return false; - } - } - bool SetInventoryVersion(EQEmu::versions::ClientVersion client_version) { return SetInventoryVersion(EQEmu::versions::ConvertClientVersionToInventoryVersion(client_version)); } + bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToInventoryVersion(client_version)); } - EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; } + versions::InventoryVersion InventoryVersion() { return m_inventory_version; } - static void CleanDirty(); - static void MarkDirty(EQEmu::ItemInstance *inst); + static void CleanDirty(); + static void MarkDirty(ItemInstance *inst); - // Retrieve a writeable item at specified slot - EQEmu::ItemInstance* GetItem(int16 slot_id) const; - EQEmu::ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const; + // Retrieve a writeable item at specified slot + ItemInstance* GetItem(int16 slot_id) const; + ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const; - inline std::list::const_iterator cursor_cbegin() { return m_cursor.cbegin(); } - inline std::list::const_iterator cursor_cend() { return m_cursor.cend(); } + inline std::list::const_iterator cursor_cbegin() { return m_cursor.cbegin(); } + inline std::list::const_iterator cursor_cend() { return m_cursor.cend(); } - inline int CursorSize() { return m_cursor.size(); } - inline bool CursorEmpty() { return m_cursor.empty(); } + inline int CursorSize() { return m_cursor.size(); } + inline bool CursorEmpty() { return m_cursor.empty(); } - // Retrieve a read-only item from inventory - inline const EQEmu::ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); } + // Retrieve a read-only item from inventory + inline const ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); } - // Add item to inventory - int16 PutItem(int16 slot_id, const EQEmu::ItemInstance& inst); + // Add item to inventory + int16 PutItem(int16 slot_id, const ItemInstance& inst); - // Add item to cursor queue - int16 PushCursor(const EQEmu::ItemInstance& inst); + // Add item to cursor queue + int16 PushCursor(const ItemInstance& inst); - // Get cursor item in front of queue - EQEmu::ItemInstance* GetCursorItem(); + // Get cursor item in front of queue + ItemInstance* GetCursorItem(); - // Swap items in inventory - bool SwapItem(int16 slot_a, int16 slot_b); + // Swap items in inventory + bool SwapItem(int16 slot_a, int16 slot_b); - // Remove item from inventory - bool DeleteItem(int16 slot_id, uint8 quantity=0); + // Remove item from inventory + bool DeleteItem(int16 slot_id, uint8 quantity = 0); - // Checks All items in a bag for No Drop - bool CheckNoDrop(int16 slot_id); + // Checks All items in a bag for No Drop + bool CheckNoDrop(int16 slot_id); - // Remove item from inventory (and take control of memory) - EQEmu::ItemInstance* PopItem(int16 slot_id); + // Remove item from inventory (and take control of memory) + ItemInstance* PopItem(int16 slot_id); - // Check whether there is space for the specified number of the specified item. - bool HasSpaceForItem(const EQEmu::ItemData *ItemToTry, int16 Quantity); + // Check whether there is space for the specified number of the specified item. + bool HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity); - // Check whether item exists in inventory - // where argument specifies OR'd list of invWhere constants to look - int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF); + // Check whether item exists in inventory + // where argument specifies OR'd list of invWhere constants to look + int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF); - // Check whether item exists in inventory - // where argument specifies OR'd list of invWhere constants to look - int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF); + // Check whether item exists in inventory + // where argument specifies OR'd list of invWhere constants to look + int16 HasItemByUse(uint8 use, uint8 quantity = 0, uint8 where = 0xFF); - // Check whether item exists in inventory - // where argument specifies OR'd list of invWhere constants to look - int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF); + // Check whether item exists in inventory + // where argument specifies OR'd list of invWhere constants to look + int16 HasItemByLoreGroup(uint32 loregroup, uint8 where = 0xFF); - // Locate an available inventory slot - int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); - int16 FindFreeSlotForTradeItem(const EQEmu::ItemInstance* inst); + // Locate an available inventory slot + int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false); + int16 FindFreeSlotForTradeItem(const ItemInstance* inst); - // Calculate slot_id for an item within a bag - static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id - static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag - static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id - static int16 CalcSlotFromMaterial(uint8 material); - static uint8 CalcMaterialFromSlot(int16 equipslot); + // Calculate slot_id for an item within a bag + static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id + static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag + static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id + static int16 CalcSlotFromMaterial(uint8 material); + static uint8 CalcMaterialFromSlot(int16 equipslot); - static bool CanItemFitInContainer(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container); + static bool CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container); - // Test for valid inventory casting slot - bool SupportsClickCasting(int16 slot_id); - bool SupportsPotionBeltCasting(int16 slot_id); + // Test for valid inventory casting slot + bool SupportsClickCasting(int16 slot_id); + bool SupportsPotionBeltCasting(int16 slot_id); - // Test whether a given slot can support a container item - static bool SupportsContainers(int16 slot_id); + // Test whether a given slot can support a container item + static bool SupportsContainers(int16 slot_id); - int GetSlotByItemInst(EQEmu::ItemInstance *inst); + int GetSlotByItemInst(ItemInstance *inst); - uint8 FindBrightestLightType(); + uint8 FindBrightestLightType(); - void dumpEntireInventory(); - void dumpWornItems(); - void dumpInventory(); - void dumpBankItems(); - void dumpSharedBankItems(); + void dumpEntireInventory(); + void dumpWornItems(); + void dumpInventory(); + void dumpBankItems(); + void dumpSharedBankItems(); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value); - void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value); - std::string GetCustomItemData(int16 slot_id, std::string identifier); -protected: - /////////////////////////////// - // Protected Methods - /////////////////////////////// + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value); + void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value); + std::string GetCustomItemData(int16 slot_id, std::string identifier); + protected: + /////////////////////////////// + // Protected Methods + /////////////////////////////// - int GetSlotByItemInstCollection(const std::map &collection, EQEmu::ItemInstance *inst); - void dumpItemCollection(const std::map &collection); - void dumpBagContents(EQEmu::ItemInstance *inst, std::map::const_iterator *it); + int GetSlotByItemInstCollection(const std::map &collection, ItemInstance *inst); + void dumpItemCollection(const std::map &collection); + void dumpBagContents(ItemInstance *inst, std::map::const_iterator *it); - // Retrieves item within an inventory bucket - EQEmu::ItemInstance* _GetItem(const std::map& bucket, int16 slot_id) const; + // Retrieves item within an inventory bucket + ItemInstance* _GetItem(const std::map& bucket, int16 slot_id) const; - // Private "put" item into bucket, without regard for what is currently in bucket - int16 _PutItem(int16 slot_id, EQEmu::ItemInstance* inst); + // Private "put" item into bucket, without regard for what is currently in bucket + int16 _PutItem(int16 slot_id, ItemInstance* inst); - // Checks an inventory bucket for a particular item - int16 _HasItem(std::map& bucket, uint32 item_id, uint8 quantity); - int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); - int16 _HasItemByUse(std::map& bucket, uint8 use, uint8 quantity); - int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); - int16 _HasItemByLoreGroup(std::map& bucket, uint32 loregroup); - int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); + // Checks an inventory bucket for a particular item + int16 _HasItem(std::map& bucket, uint32 item_id, uint8 quantity); + int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity); + int16 _HasItemByUse(std::map& bucket, uint8 use, uint8 quantity); + int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity); + int16 _HasItemByLoreGroup(std::map& bucket, uint32 loregroup); + int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup); - // Player inventory - std::map m_worn; // Items worn by character - std::map m_inv; // Items in character personal inventory - std::map m_bank; // Items in character bank - std::map m_shbank; // Items in character shared bank - std::map m_trade; // Items in a trade session - ItemInstQueue m_cursor; // Items on cursor: FIFO + // Player inventory + std::map m_worn; // Items worn by character + std::map m_inv; // Items in character personal inventory + std::map m_bank; // Items in character bank + std::map m_shbank; // Items in character shared bank + std::map m_trade; // Items in a trade session + ::ItemInstQueue m_cursor; // Items on cursor: FIFO -private: - // Active inventory version - EQEmu::versions::InventoryVersion m_inventory_version; - bool m_inventory_version_set; -}; + private: + // Active inventory version + versions::InventoryVersion m_inventory_version; + bool m_inventory_version_set; + }; +} #endif /*COMMON_INVENTORY_PROFILE_H*/ diff --git a/common/item_instance.cpp b/common/item_instance.cpp index de01c0893..61b9d3243 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -207,12 +207,12 @@ EQEmu::ItemInstance::~ItemInstance() } // Query item type -bool EQEmu::ItemInstance::IsType(EQEmu::item::ItemClass item_class) const +bool EQEmu::ItemInstance::IsType(item::ItemClass item_class) const { // IsType() does not protect against 'm_item = nullptr' // Check usage type - if ((m_use_type == ItemInstWorldContainer) && (item_class == EQEmu::item::ItemClassBag)) + if ((m_use_type == ItemInstWorldContainer) && (item_class == item::ItemClassBag)) return true; if (!m_item) @@ -273,8 +273,8 @@ bool EQEmu::ItemInstance::IsEquipable(int16 slot_id) const // another "shouldn't do" fix..will be fixed in future updates (requires code and database work) int16 use_slot = INVALID_INDEX; - if (slot_id == EQEmu::inventory::slotPowerSource) { use_slot = EQEmu::inventory::slotGeneral1; } - if ((uint16)slot_id <= EQEmu::legacy::EQUIPMENT_END) { use_slot = slot_id; } + if (slot_id == inventory::slotPowerSource) { use_slot = inventory::slotGeneral1; } + if ((uint16)slot_id <= legacy::EQUIPMENT_END) { use_slot = slot_id; } if (use_slot != INVALID_INDEX) { if (m_item->Slots & (1 << use_slot)) @@ -289,7 +289,7 @@ bool EQEmu::ItemInstance::IsAugmentable() const if (!m_item) return false; - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { if (m_item->AugSlotType[index] != 0) return true; } @@ -303,8 +303,8 @@ bool EQEmu::ItemInstance::AvailableWearSlot(uint32 aug_wear_slots) const { if (!m_item || !m_item->IsClassCommon()) return false; - int index = EQEmu::legacy::EQUIPMENT_BEGIN; - for (; index <= EQEmu::inventory::slotGeneral1; ++index) { // MainGeneral1 should be EQEmu::legacy::EQUIPMENT_END + int index = legacy::EQUIPMENT_BEGIN; + for (; index <= inventory::slotGeneral1; ++index) { // MainGeneral1 should be legacy::EQUIPMENT_END if (m_item->Slots & (1 << index)) { if (aug_wear_slots & (1 << index)) break; @@ -319,14 +319,14 @@ int8 EQEmu::ItemInstance::AvailableAugmentSlot(int32 augtype) const if (!m_item || !m_item->IsClassCommon()) return INVALID_INDEX; - int index = EQEmu::inventory::socketBegin; - for (; index < EQEmu::inventory::SocketCount; ++index) { + int index = inventory::socketBegin; + for (; index < inventory::SocketCount; ++index) { if (GetItem(index)) { continue; } if (augtype == -1 || (m_item->AugSlotType[index] && ((1 << (m_item->AugSlotType[index] - 1)) & augtype))) break; } - return (index < EQEmu::inventory::SocketCount) ? index : INVALID_INDEX; + return (index < inventory::SocketCount) ? index : INVALID_INDEX; } bool EQEmu::ItemInstance::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const @@ -416,7 +416,7 @@ void EQEmu::ItemInstance::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is continue; } - const EQEmu::ItemData* item = inst->GetItem(); + const ItemData* item = inst->GetItem(); if (item == nullptr) { cur = m_contents.erase(cur); continue; @@ -469,7 +469,7 @@ uint8 EQEmu::ItemInstance::FirstOpenSlot() const return INVALID_INDEX; uint8 slots = m_item->BagSlots, i; - for (i = EQEmu::inventory::containerBegin; i < slots; i++) { + for (i = inventory::containerBegin; i < slots; i++) { if (!GetItem(i)) break; } @@ -486,7 +486,7 @@ uint8 EQEmu::ItemInstance::GetTotalItemCount() const if (m_item && !m_item->IsClassBag()) { return item_count; } - for (int index = EQEmu::inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } + for (int index = inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } return item_count; } @@ -496,7 +496,7 @@ bool EQEmu::ItemInstance::IsNoneEmptyContainer() if (!m_item || !m_item->IsClassBag()) return false; - for (int index = EQEmu::inventory::containerBegin; index < m_item->BagSlots; ++index) { + for (int index = inventory::containerBegin; index < m_item->BagSlots; ++index) { if (GetItem(index)) return true; } @@ -518,7 +518,7 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::GetOrnamentationAug(int32 ornamentatio if (!m_item || !m_item->IsClassCommon()) { return nullptr; } if (ornamentationAugtype == 0) { return nullptr; } - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) + for (int i = inventory::socketBegin; i < inventory::SocketCount; i++) { if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) { @@ -587,10 +587,10 @@ bool EQEmu::ItemInstance::UpdateOrnamentationInfo() { return ornamentSet; } -bool EQEmu::ItemInstance::CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll) { +bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll) { if (!ItemToTry || !Container) return false; - if (ItemToTry->ItemType == EQEmu::item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) + if (ItemToTry->ItemType == item::ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) return false; if (AllowAll && strncasecmp(Container->CharmFile, "ITEMTRANSFIGSHIELD", 18) && strncasecmp(Container->CharmFile, "ITEMTransfigBow", 15)) { @@ -685,7 +685,7 @@ bool EQEmu::ItemInstance::IsAugmented() if (!m_item || !m_item->IsClassCommon()) return false; - for (int index = EQEmu::inventory::socketBegin; index < EQEmu::inventory::SocketCount; ++index) { + for (int index = inventory::socketBegin; index < inventory::SocketCount; ++index) { if (GetAugmentItemID(index)) return true; } @@ -699,7 +699,7 @@ bool EQEmu::ItemInstance::IsWeapon() const if (!m_item || !m_item->IsClassCommon()) return false; - if (m_item->ItemType == EQEmu::item::ItemTypeArrow && m_item->Damage != 0) + if (m_item->ItemType == item::ItemTypeArrow && m_item->Damage != 0) return true; else return ((m_item->Damage != 0) && (m_item->Delay != 0)); @@ -710,9 +710,9 @@ bool EQEmu::ItemInstance::IsAmmo() const if (!m_item) return false; - if ((m_item->ItemType == EQEmu::item::ItemTypeArrow) || - (m_item->ItemType == EQEmu::item::ItemTypeLargeThrowing) || - (m_item->ItemType == EQEmu::item::ItemTypeSmallThrowing) + if ((m_item->ItemType == item::ItemTypeArrow) || + (m_item->ItemType == item::ItemTypeLargeThrowing) || + (m_item->ItemType == item::ItemTypeSmallThrowing) ) { return true; } @@ -811,10 +811,10 @@ EQEmu::ItemInstance* EQEmu::ItemInstance::Clone() const bool EQEmu::ItemInstance::IsSlotAllowed(int16 slot_id) const { // 'SupportsContainers' and 'slot_id > 21' previously saw the reassigned PowerSource slot (9999 to 22) as valid if (!m_item) { return false; } - else if (Inventory::SupportsContainers(slot_id)) { return true; } + else if (InventoryProfile::SupportsContainers(slot_id)) { return true; } else if (m_item->Slots & (1 << slot_id)) { return true; } - else if (slot_id == EQEmu::inventory::slotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... - else if (slot_id != EQEmu::inventory::slotPowerSource && slot_id > EQEmu::legacy::EQUIPMENT_END) { return true; } + else if (slot_id == inventory::slotPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... + else if (slot_id != inventory::slotPowerSource && slot_id > legacy::EQUIPMENT_END) { return true; } else { return false; } } @@ -966,7 +966,7 @@ int EQEmu::ItemInstance::GetItemArmorClass(bool augments) const if (item) { ac = item->AC; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) ac += GetAugment(i)->GetItemArmorClass(); } @@ -1008,7 +1008,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(int &magic, int &fire, int &cold } if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) GetAugment(i)->GetItemElementalDamage(magic, fire, cold, poison, disease, chromatic, prismatic, physical, corruption); } @@ -1025,7 +1025,7 @@ int EQEmu::ItemInstance::GetItemElementalFlag(bool augments) const return flag; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { if (GetAugment(i)) flag = GetAugment(i)->GetItemElementalFlag(); if (flag) @@ -1046,7 +1046,7 @@ int EQEmu::ItemInstance::GetItemElementalDamage(bool augments) const return damage; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { if (GetAugment(i)) damage = GetAugment(i)->GetItemElementalDamage(); if (damage) @@ -1065,7 +1065,7 @@ int EQEmu::ItemInstance::GetItemRecommendedLevel(bool augments) const level = item->RecLevel; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { int temp = 0; if (GetAugment(i)) { temp = GetAugment(i)->GetItemRecommendedLevel(); @@ -1087,7 +1087,7 @@ int EQEmu::ItemInstance::GetItemRequiredLevel(bool augments) const level = item->ReqLevel; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) { + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) { int temp = 0; if (GetAugment(i)) { temp = GetAugment(i)->GetItemRequiredLevel(); @@ -1109,7 +1109,7 @@ int EQEmu::ItemInstance::GetItemWeaponDamage(bool augments) const damage = item->Damage; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemWeaponDamage(); } @@ -1125,7 +1125,7 @@ int EQEmu::ItemInstance::GetItemBackstabDamage(bool augments) const damage = item->BackstabDmg; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBackstabDamage(); } @@ -1143,7 +1143,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bool augments) const return body; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) { body = GetAugment(i)->GetItemBaneDamageBody(); if (body) @@ -1164,7 +1164,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(bool augments) const return race; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) { race = GetAugment(i)->GetItemBaneDamageRace(); if (race) @@ -1184,7 +1184,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageBody(bodyType against, bool augments) damage += item->BaneDmgAmt; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBaneDamageBody(against); } @@ -1201,7 +1201,7 @@ int EQEmu::ItemInstance::GetItemBaneDamageRace(uint16 against, bool augments) co damage += item->BaneDmgRaceAmt; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) damage += GetAugment(i)->GetItemBaneDamageRace(against); } @@ -1217,7 +1217,7 @@ int EQEmu::ItemInstance::GetItemMagical(bool augments) const return 1; if (augments) { - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i) && GetAugment(i)->GetItemMagical()) return 1; } @@ -1232,7 +1232,7 @@ int EQEmu::ItemInstance::GetItemHP(bool augments) const if (item) { hp = item->HP; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) hp += GetAugment(i)->GetItemHP(); } @@ -1246,7 +1246,7 @@ int EQEmu::ItemInstance::GetItemMana(bool augments) const if (item) { mana = item->Mana; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) mana += GetAugment(i)->GetItemMana(); } @@ -1260,7 +1260,7 @@ int EQEmu::ItemInstance::GetItemEndur(bool augments) const if (item) { endur = item->Endur; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) endur += GetAugment(i)->GetItemEndur(); } @@ -1274,7 +1274,7 @@ int EQEmu::ItemInstance::GetItemAttack(bool augments) const if (item) { atk = item->Attack; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) atk += GetAugment(i)->GetItemAttack(); } @@ -1288,7 +1288,7 @@ int EQEmu::ItemInstance::GetItemStr(bool augments) const if (item) { str = item->AStr; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) str += GetAugment(i)->GetItemStr(); } @@ -1302,7 +1302,7 @@ int EQEmu::ItemInstance::GetItemSta(bool augments) const if (item) { sta = item->ASta; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) sta += GetAugment(i)->GetItemSta(); } @@ -1316,7 +1316,7 @@ int EQEmu::ItemInstance::GetItemDex(bool augments) const if (item) { total = item->ADex; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemDex(); } @@ -1330,7 +1330,7 @@ int EQEmu::ItemInstance::GetItemAgi(bool augments) const if (item) { total = item->AAgi; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemAgi(); } @@ -1344,7 +1344,7 @@ int EQEmu::ItemInstance::GetItemInt(bool augments) const if (item) { total = item->AInt; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemInt(); } @@ -1358,7 +1358,7 @@ int EQEmu::ItemInstance::GetItemWis(bool augments) const if (item) { total = item->AWis; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemWis(); } @@ -1372,7 +1372,7 @@ int EQEmu::ItemInstance::GetItemCha(bool augments) const if (item) { total = item->ACha; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCha(); } @@ -1386,7 +1386,7 @@ int EQEmu::ItemInstance::GetItemMR(bool augments) const if (item) { total = item->MR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemMR(); } @@ -1400,7 +1400,7 @@ int EQEmu::ItemInstance::GetItemFR(bool augments) const if (item) { total = item->FR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemFR(); } @@ -1414,7 +1414,7 @@ int EQEmu::ItemInstance::GetItemCR(bool augments) const if (item) { total = item->CR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCR(); } @@ -1428,7 +1428,7 @@ int EQEmu::ItemInstance::GetItemPR(bool augments) const if (item) { total = item->PR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemPR(); } @@ -1442,7 +1442,7 @@ int EQEmu::ItemInstance::GetItemDR(bool augments) const if (item) { total = item->DR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemDR(); } @@ -1456,7 +1456,7 @@ int EQEmu::ItemInstance::GetItemCorrup(bool augments) const if (item) { total = item->SVCorruption; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemCorrup(); } @@ -1470,7 +1470,7 @@ int EQEmu::ItemInstance::GetItemHeroicStr(bool augments) const if (item) { total = item->HeroicStr; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicStr(); } @@ -1484,7 +1484,7 @@ int EQEmu::ItemInstance::GetItemHeroicSta(bool augments) const if (item) { total = item->HeroicSta; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicSta(); } @@ -1498,7 +1498,7 @@ int EQEmu::ItemInstance::GetItemHeroicDex(bool augments) const if (item) { total = item->HeroicDex; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicDex(); } @@ -1512,7 +1512,7 @@ int EQEmu::ItemInstance::GetItemHeroicAgi(bool augments) const if (item) { total = item->HeroicAgi; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicAgi(); } @@ -1526,7 +1526,7 @@ int EQEmu::ItemInstance::GetItemHeroicInt(bool augments) const if (item) { total = item->HeroicInt; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicInt(); } @@ -1540,7 +1540,7 @@ int EQEmu::ItemInstance::GetItemHeroicWis(bool augments) const if (item) { total = item->HeroicWis; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicWis(); } @@ -1554,7 +1554,7 @@ int EQEmu::ItemInstance::GetItemHeroicCha(bool augments) const if (item) { total = item->HeroicCha; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCha(); } @@ -1568,7 +1568,7 @@ int EQEmu::ItemInstance::GetItemHeroicMR(bool augments) const if (item) { total = item->HeroicMR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicMR(); } @@ -1582,7 +1582,7 @@ int EQEmu::ItemInstance::GetItemHeroicFR(bool augments) const if (item) { total = item->HeroicFR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicFR(); } @@ -1596,7 +1596,7 @@ int EQEmu::ItemInstance::GetItemHeroicCR(bool augments) const if (item) { total = item->HeroicCR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCR(); } @@ -1610,7 +1610,7 @@ int EQEmu::ItemInstance::GetItemHeroicPR(bool augments) const if (item) { total = item->HeroicPR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicPR(); } @@ -1624,7 +1624,7 @@ int EQEmu::ItemInstance::GetItemHeroicDR(bool augments) const if (item) { total = item->HeroicDR; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicDR(); } @@ -1638,7 +1638,7 @@ int EQEmu::ItemInstance::GetItemHeroicCorrup(bool augments) const if (item) { total = item->HeroicSVCorrup; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) total += GetAugment(i)->GetItemHeroicCorrup(); } @@ -1652,7 +1652,7 @@ int EQEmu::ItemInstance::GetItemHaste(bool augments) const if (item) { total = item->Haste; if (augments) - for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; ++i) + for (int i = inventory::socketBegin; i < inventory::SocketCount; ++i) if (GetAugment(i)) { int temp = GetAugment(i)->GetItemHaste(); if (temp > total) diff --git a/common/item_instance.h b/common/item_instance.h index 2a4afdca1..90dd1403f 100644 --- a/common/item_instance.h +++ b/common/item_instance.h @@ -52,7 +52,6 @@ typedef enum { } byFlagSetting; class SharedDatabase; -class Inventory; // ######################################## // Class: EQEmu::ItemInstance @@ -61,6 +60,8 @@ class Inventory; // to an item instance (includes dye, augments, charges, etc) namespace EQEmu { + class InventoryProfile; + class ItemInstance { public: ///////////////////////// @@ -79,7 +80,7 @@ namespace EQEmu ~ItemInstance(); // Query item type - bool IsType(EQEmu::item::ItemClass item_class) const; + bool IsType(item::ItemClass item_class) const; bool IsClassCommon() const; bool IsClassBag() const; @@ -102,7 +103,7 @@ namespace EQEmu bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : 0); } - inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); } + inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == item::ItemEffectExpendable) || (m_item->ItemType == item::ItemTypePotion)) : false); } // // Contents @@ -133,7 +134,7 @@ namespace EQEmu bool IsAugmented(); ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const; bool UpdateOrnamentationInfo(); - static bool CanTransform(const EQEmu::ItemData *ItemToTry, const EQEmu::ItemData *Container, bool AllowAll = false); + static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false); // Has attack/delay? bool IsWeapon() const; @@ -211,8 +212,8 @@ namespace EQEmu int8 GetMaxEvolveLvl() const; uint32 GetKillsNeeded(uint8 currentlevel); - std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; } - void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); } + std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; } + void Serialize(OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); } inline int32 GetSerialNumber() const { return m_SerialNumber; } inline void SetSerialNumber(int32 id) { m_SerialNumber = id; } @@ -278,7 +279,7 @@ namespace EQEmu ////////////////////////// // Protected Members ////////////////////////// - friend class ::Inventory; + friend class InventoryProfile; std::map::const_iterator _cbegin() { return m_contents.cbegin(); } std::map::const_iterator _cend() { return m_contents.cend(); } @@ -299,7 +300,7 @@ namespace EQEmu int8 m_evolveLvl; bool m_activated; ItemData* m_scaledItem; - EvolveInfo* m_evolveInfo; + ::EvolveInfo* m_evolveInfo; bool m_scaling; uint32 m_ornamenticon; uint32 m_ornamentidfile; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index cc1744a31..6d13bb338 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5264,7 +5264,7 @@ namespace RoF if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { ornaIcon = inst->GetOrnamentationIcon(); - heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in)); + heroModel = inst->GetOrnamentHeroModel(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id_in)); char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index aadd0a90b..14fcdc2e6 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5555,7 +5555,7 @@ namespace RoF2 if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { ornaIcon = inst->GetOrnamentationIcon(); - heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in)); + heroModel = inst->GetOrnamentHeroModel(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id_in)); char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 8cd62f164..fd55b3766 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -184,7 +184,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* in else { // Needed to clear out bag slots that 'REPLACE' in UpdateSharedBankSlot does not overwrite..otherwise, duplication occurs // (This requires that parent then child items be sent..which should be how they are currently passed) - if (Inventory::SupportsContainers(slot_id)) + if (EQEmu::InventoryProfile::SupportsContainers(slot_id)) DeleteSharedBankSlot(char_id, slot_id); return UpdateSharedBankSlot(char_id, inst, slot_id); } @@ -195,7 +195,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* in // Needed to clear out bag slots that 'REPLACE' in UpdateInventorySlot does not overwrite..otherwise, duplication occurs // (This requires that parent then child items be sent..which should be how they are currently passed) - if (Inventory::SupportsContainers(slot_id)) + if (EQEmu::InventoryProfile::SupportsContainers(slot_id)) DeleteInventorySlot(char_id, slot_id); return UpdateInventorySlot(char_id, inst, slot_id); } @@ -232,12 +232,12 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstan auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) + if (inst->IsClassBag() && EQEmu::InventoryProfile::SupportsContainers(slot_id)) // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) for (uint8 idx = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = inst->GetItem(idx); - SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); + SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx)); } if (!results.Success()) { @@ -278,12 +278,12 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInsta auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) { + if (inst->IsClassBag() && EQEmu::InventoryProfile::SupportsContainers(slot_id)) { // Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID' // messages through attrition (and the modded code in SaveInventory) for (uint8 idx = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = inst->GetItem(idx); - SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); + SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx)); } } @@ -304,10 +304,10 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { } // Delete bag slots, if need be - if (!Inventory::SupportsContainers(slot_id)) + if (!EQEmu::InventoryProfile::SupportsContainers(slot_id)) return true; - int16 base_slot_id = Inventory::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); + int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i", char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); @@ -330,10 +330,10 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { } // Delete bag slots, if need be - if (!Inventory::SupportsContainers(slot_id)) + if (!EQEmu::InventoryProfile::SupportsContainers(slot_id)) return true; - int16 base_slot_id = Inventory::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); + int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin); query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i " "AND slotid >= %i AND slotid < %i", account_id, base_slot_id, (base_slot_id+10)); @@ -373,7 +373,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { return true; } -bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { +bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { const EQEmu::ItemData* myitem; @@ -410,7 +410,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, // Retrieve shared bank inventory based on either account or character -bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) +bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool is_charid) { std::string query; @@ -511,7 +511,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) } // Overloaded: Retrieve character inventory based on character id -bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) +bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) { // Retrieve character inventory std::string query = @@ -653,7 +653,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) } // Overloaded: Retrieve character inventory based on account_id and character name -bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) +bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv) { // Retrieve character inventory std::string query = diff --git a/common/shareddb.h b/common/shareddb.h index 42dfcf4ce..b58d1f138 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -33,7 +33,6 @@ #include class EvolveInfo; -class Inventory; struct BaseDataStruct; struct InspectMessage_Struct; struct PlayerProfile_Struct; @@ -46,6 +45,7 @@ namespace EQEmu { struct ItemData; class ItemInstance; + class InventoryProfile; class MemoryMappedFile; } @@ -74,7 +74,7 @@ class SharedDatabase : public Database uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID); /* - Character Inventory + Character InventoryProfile */ bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); bool SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id); @@ -83,15 +83,15 @@ class SharedDatabase : public Database bool UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id); bool UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id); bool VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst); - bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid); + bool GetSharedBank(uint32 id, EQEmu::InventoryProfile* inv, bool is_charid); int32 GetSharedPlatinum(uint32 account_id); bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); - bool GetInventory(uint32 char_id, Inventory* inv); - bool GetInventory(uint32 account_id, char* name, Inventory* inv); + bool GetInventory(uint32 char_id, EQEmu::InventoryProfile* inv); + bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv); std::map GetItemRecastTimestamps(uint32 char_id); uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type); void ClearOldRecastTimestamps(uint32 char_id); - bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); + bool SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); std::string GetBook(const char *txtfile); diff --git a/world/client.cpp b/world/client.cpp index 5614d6317..29abc5b9d 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1399,7 +1399,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { PlayerProfile_Struct pp; ExtendedProfile_Struct ext; - Inventory inv; + EQEmu::InventoryProfile inv; time_t bday = time(nullptr); char startzone[50]={0}; uint32 i; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 65476190e..5cac4b648 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -96,7 +96,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou for (auto row = results.begin(); row != results.end(); ++row) { CharacterSelectEntry_Struct *cse = (CharacterSelectEntry_Struct *)buff_ptr; PlayerProfile_Struct pp; - Inventory inv; + EQEmu::InventoryProfile inv; uint32 character_id = (uint32)atoi(row[0]); uint8 has_home = 0; uint8 has_bind = 0; @@ -249,7 +249,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou int16 invslot = 0; for (uint32 matslot = EQEmu::textures::textureBegin; matslot < EQEmu::textures::materialCount; matslot++) { - invslot = Inventory::CalcSlotFromMaterial(matslot); + invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(matslot); if (invslot == INVALID_INDEX) { continue; } inst = inv.GetItem(invslot); if (inst == nullptr) { continue; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 4ff4fbabe..760ca52dc 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -3325,7 +3325,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) { - EQEmu::ItemInstance* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); + EQEmu::ItemInstance* parent_item = m_inv.GetItem(EQEmu::InventoryProfile::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; } @@ -3418,7 +3418,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) { - EQEmu::ItemInstance* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); + EQEmu::ItemInstance* parent_item = m_inv.GetItem(EQEmu::InventoryProfile::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; } diff --git a/zone/bot.cpp b/zone/bot.cpp index 03ba04dfd..1629580bf 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2875,7 +2875,7 @@ void Bot::Spawn(Client* botCharacterOwner) { for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { itemID = GetBotItemBySlot(i); if(itemID != 0) { - materialFromSlot = Inventory::CalcMaterialFromSlot(i); + materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(i); if(materialFromSlot != 0xFF) this->SendWearChange(materialFromSlot); } @@ -2897,7 +2897,7 @@ void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage) } // Retrieves all the inventory records from the database for this bot. -void Bot::GetBotItems(Inventory &inv, std::string* errorMessage) +void Bot::GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage) { if(!GetBotID()) return; @@ -3235,7 +3235,7 @@ EQEmu::ItemInstance* Bot::GetBotItem(uint32 slotID) { // Adds the specified item it bot to the NPC equipment array and to the bot inventory collection. void Bot::BotAddEquipItem(int slot, uint32 id) { if(slot > 0 && id > 0) { - uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot); + uint8 materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(slot); if (materialFromSlot != EQEmu::textures::materialInvalid) { equipment[slot] = id; // npc has more than just material slots. Valid material should mean valid inventory index @@ -3251,7 +3251,7 @@ void Bot::BotAddEquipItem(int slot, uint32 id) { // Erases the specified item from bot the NPC equipment array and from the bot inventory collection. void Bot::BotRemoveEquipItem(int slot) { if(slot > 0) { - uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot); + uint8 materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(slot); if (materialFromSlot != EQEmu::textures::materialInvalid) { equipment[slot] = 0; // npc has more than just material slots. Valid material should mean valid inventory index @@ -3382,7 +3382,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli bool UpdateClient = false; bool already_returned = false; - Inventory& clientInventory = client->GetInv(); + EQEmu::InventoryProfile& clientInventory = client->GetInv(); const EQEmu::ItemInstance* inst = clientInventory[i]; if(inst) { items[i] = inst->GetItem()->ID; @@ -8434,7 +8434,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag) return false; for (uint8 i = EQEmu::textures::textureBegin; i < EQEmu::textures::weaponPrimary; ++i) { - uint8 inv_slot = Inventory::CalcSlotFromMaterial(i); + uint8 inv_slot = EQEmu::InventoryProfile::CalcSlotFromMaterial(i); EQEmu::ItemInstance* inst = m_inv.GetItem(inv_slot); if (!inst) continue; @@ -8444,7 +8444,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag) } } else { - uint8 mat_slot = Inventory::CalcMaterialFromSlot(slot_id); + uint8 mat_slot = EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id); if (mat_slot == EQEmu::textures::materialInvalid || mat_slot >= EQEmu::textures::weaponPrimary) return false; diff --git a/zone/bot.h b/zone/bot.h index 96ca86eec..736a464ab 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -647,7 +647,7 @@ private: bool _petChooser; uint8 _petChooserID; bool berserk; - Inventory m_inv; + EQEmu::InventoryProfile m_inv; double _lastTotalPlayTime; time_t _startTotalPlayTime; Mob* _previousTarget; @@ -711,7 +711,7 @@ private: void SetBotID(uint32 botID); // Private "Inventory" Methods - void GetBotItems(Inventory &inv, std::string* errorMessage); + void GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage); void BotAddEquipItem(int slot, uint32 id); uint32 GetBotItemBySlot(uint32 slotID); diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 57dd2d418..72ac6cae4 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -4375,7 +4375,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep) bool dye_all = (sep->arg[1][0] == '*'); if (!dye_all) { material_slot = atoi(sep->arg[1]); - slot_id = Inventory::CalcSlotFromMaterial(material_slot); + slot_id = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQEmu::textures::LastTintableTexture) { c->Message(m_fail, "Valid [mat_slot]s for this command are:"); diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 259df1d63..04ce5b281 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1023,7 +1023,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count) return true; } -bool BotDatabase::LoadItems(const uint32 bot_id, Inventory& inventory_inst) +bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& inventory_inst) { if (!bot_id) return false; @@ -1279,7 +1279,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s if (!bot_id) return false; - int16 slot_id = Inventory::CalcSlotFromMaterial(material_slot_id); + int16 slot_id = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot_id); if (slot_id == INVALID_INDEX) return false; diff --git a/zone/bot_database.h b/zone/bot_database.h index 3eaaf21d9..b7245306f 100644 --- a/zone/bot_database.h +++ b/zone/bot_database.h @@ -31,12 +31,12 @@ class Bot; -class Inventory; struct BotsAvailableList; namespace EQEmu { class ItemInstance; + class InventoryProfile; } @@ -89,7 +89,7 @@ public: /* Bot inventory functions */ bool QueryInventoryCount(const uint32 bot_id, uint32& item_count); - bool LoadItems(const uint32 bot_id, Inventory &inventory_inst); + bool LoadItems(const uint32 bot_id, EQEmu::InventoryProfile &inventory_inst); bool SaveItems(Bot* bot_inst); bool DeleteItems(const uint32 bot_id); diff --git a/zone/client.cpp b/zone/client.cpp index 09f843616..3f914d1ae 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2799,7 +2799,7 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { const EQEmu::ItemData* item = database.GetItem(item_id); if (item && item->IsClassCommon()) { - uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); + uint8 matslot = EQEmu::InventoryProfile::CalcMaterialFromSlot(in_slot); if (matslot != EQEmu::textures::materialInvalid) { m_pp.item_material.Slot[matslot].Material = GetEquipmentMaterial(matslot); @@ -3141,7 +3141,7 @@ void Client::SetTint(int16 in_slot, uint32 color) { // Still need to reconcile bracer01 versus bracer02 void Client::SetTint(int16 in_slot, EQEmu::textures::Tint_Struct& color) { - uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); + uint8 matslot = EQEmu::InventoryProfile::CalcMaterialFromSlot(in_slot); if (matslot != EQEmu::textures::materialInvalid) { m_pp.item_tint.Slot[matslot].Color = color.Color; diff --git a/zone/client.h b/zone/client.h index 82ee442d2..c7973de18 100644 --- a/zone/client.h +++ b/zone/client.h @@ -340,8 +340,8 @@ public: inline uint8 GetAnon() const { return m_pp.anon; } inline PlayerProfile_Struct& GetPP() { return m_pp; } inline ExtendedProfile_Struct& GetEPP() { return m_epp; } - inline Inventory& GetInv() { return m_inv; } - inline const Inventory& GetInv() const { return m_inv; } + inline EQEmu::InventoryProfile& GetInv() { return m_inv; } + inline const EQEmu::InventoryProfile& GetInv() const { return m_inv; } inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } @@ -1395,7 +1395,7 @@ private: PlayerProfile_Struct m_pp; ExtendedProfile_Struct m_epp; - Inventory m_inv; + EQEmu::InventoryProfile m_inv; Object* m_tradeskill_object; PetInfo m_petinfo; // current pet data, used while loading from and saving to DB PetInfo m_suspendedminion; // pet data for our suspended minion. diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a537c1db2..0b6221c2a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2939,11 +2939,11 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) // in_augment->container_slot, in_augment->augment_slot, in_augment->container_index, in_augment->augment_index, in_augment->augment_action, in_augment->dest_inst_id); EQEmu::ItemInstance *tobe_auged = nullptr, *old_aug = nullptr, *new_aug = nullptr, *aug = nullptr, *solvent = nullptr; - Inventory& user_inv = GetInv(); + EQEmu::InventoryProfile& user_inv = GetInv(); uint16 item_slot = in_augment->container_slot; uint16 solvent_slot = in_augment->augment_slot; - uint8 mat = Inventory::CalcMaterialFromSlot(item_slot); // for when player is augging a piece of equipment while they're wearing it + uint8 mat = EQEmu::InventoryProfile::CalcMaterialFromSlot(item_slot); // for when player is augging a piece of equipment while they're wearing it if (item_slot == INVALID_INDEX || solvent_slot == INVALID_INDEX) { diff --git a/zone/command.cpp b/zone/command.cpp index 487e25286..d75dec901 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2596,7 +2596,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2630,7 +2630,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(EQEmu::inventory::slotCursor, indexSub), EQEmu::inventory::slotCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + EQEmu::InventoryProfile::CalcSlotId(EQEmu::inventory::slotCursor, indexSub), EQEmu::inventory::slotCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } } @@ -2667,7 +2667,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2689,7 +2689,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2712,7 +2712,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 57a85aff9..3b9c15214 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -408,7 +408,7 @@ void Corpse::MoveItemToCorpse(Client *client, EQEmu::ItemInstance *inst, int16 e if (equipSlot < EQEmu::legacy::GENERAL_BEGIN || equipSlot > EQEmu::inventory::slotCursor) { break; } for (int16 sub_index = EQEmu::inventory::containerBegin; sub_index < EQEmu::inventory::ContainerCount; ++sub_index) { - int16 real_bag_slot = Inventory::CalcSlotId(equipSlot, sub_index); + int16 real_bag_slot = EQEmu::InventoryProfile::CalcSlotId(equipSlot, sub_index); auto bag_inst = client->GetInv().GetItem(real_bag_slot); if (bag_inst == nullptr) { continue; } @@ -684,8 +684,8 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } } - if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot)) { - int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, EQEmu::inventory::containerBegin); + if (sitem && bag_item_data && EQEmu::InventoryProfile::SupportsContainers(sitem->equip_slot)) { + int16 bagstart = EQEmu::InventoryProfile::CalcSlotId(sitem->equip_slot, EQEmu::inventory::containerBegin); cur = itemlist.begin(); end = itemlist.end(); @@ -739,7 +739,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data) is_corpse_changed = true; itemlist.erase(iter); - uint8 material = Inventory::CalcMaterialFromSlot(sitem->equip_slot); // autos to unsigned char + uint8 material = EQEmu::InventoryProfile::CalcMaterialFromSlot(sitem->equip_slot); // autos to unsigned char if (material != EQEmu::textures::materialInvalid) SendWearChange(material); @@ -1406,7 +1406,7 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const { return 0; } - invslot = Inventory::CalcSlotFromMaterial(material_slot); + invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if(invslot == INVALID_INDEX) // GetWornItem() should be returning a 0 for any invalid index... return 0; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index c89879610..c5d7de0fe 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -767,7 +767,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd EQEmu::ItemInstance* bagitem = m_inv[slot_id]->GetItem(bag_idx); if(bagitem) { - int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx); + int16 bagslot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, bag_idx); qsaudit->items[++parent_offset].char_slot = bagslot_id; qsaudit->items[parent_offset].item_id = bagitem->GetID(); @@ -866,7 +866,7 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst, if (client_update) { SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::inventory::slotCursor) ? ItemPacketLimbo : ItemPacketTrade)); - //SendWearChange(Inventory::CalcMaterialFromSlot(slot_id)); + //SendWearChange(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id)); } if (slot_id == EQEmu::inventory::slotCursor) { @@ -934,7 +934,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst, PutLootInInventory(EQEmu::inventory::slotCursor, *bagitem); } else { - auto bag_slot = Inventory::CalcSlotId(slot_id, index); + auto bag_slot = EQEmu::InventoryProfile::CalcSlotId(slot_id, index); Log.Out(Logs::Detail, Logs::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", @@ -966,7 +966,7 @@ bool Client::TryStacking(EQEmu::ItemInstance* item, uint8 type, bool try_worn, b } for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) { for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) { - uint16 slotid = Inventory::CalcSlotId(i, j); + uint16 slotid = EQEmu::InventoryProfile::CalcSlotId(i, j); EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(slotid); if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) { @@ -1018,7 +1018,7 @@ bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bo if (inst.IsEquipable(i)) { // Equippable at this slot? //send worn to everyone... PutLootInInventory(i, inst); - uint8 worn_slot_material = Inventory::CalcMaterialFromSlot(i); + uint8 worn_slot_material = EQEmu::InventoryProfile::CalcMaterialFromSlot(i); if (worn_slot_material != EQEmu::textures::materialInvalid) { SendWearChange(worn_slot_material); } @@ -1518,8 +1518,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_END && src_inst->IsClassBag()){ for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = src_inst->GetItem(idx); - if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){ - DeleteItemInInventory(Inventory::CalcSlotId(src_slot_id, idx),0,false); + if (baginst && !database.VerifyInventory(account_id, EQEmu::InventoryProfile::CalcSlotId(src_slot_id, idx), baginst)){ + DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(src_slot_id, idx), 0, false); } } } @@ -1533,8 +1533,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_END && dst_inst->IsClassBag()){ for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) { const EQEmu::ItemInstance* baginst = dst_inst->GetItem(idx); - if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){ - DeleteItemInInventory(Inventory::CalcSlotId(dst_slot_id, idx),0,false); + if (baginst && !database.VerifyInventory(account_id, EQEmu::InventoryProfile::CalcSlotId(dst_slot_id, idx), baginst)){ + DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(dst_slot_id, idx), 0, false); } } } @@ -1576,7 +1576,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(m_tradeskill_object != nullptr) { if (src_slot_id >= EQEmu::legacy::WORLD_BEGIN && src_slot_id <= EQEmu::legacy::WORLD_END) { // Picking up item from world container - EQEmu::ItemInstance* inst = m_tradeskill_object->PopItem(Inventory::CalcBagIdx(src_slot_id)); + EQEmu::ItemInstance* inst = m_tradeskill_object->PopItem(EQEmu::InventoryProfile::CalcBagIdx(src_slot_id)); if (inst) { PutItemInInventory(dst_slot_id, *inst, false); safe_delete(inst); @@ -1588,7 +1588,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } else if (dst_slot_id >= EQEmu::legacy::WORLD_BEGIN && dst_slot_id <= EQEmu::legacy::WORLD_END) { // Putting item into world container, which may swap (or pile onto) with existing item - uint8 world_idx = Inventory::CalcBagIdx(dst_slot_id); + uint8 world_idx = EQEmu::InventoryProfile::CalcBagIdx(dst_slot_id); EQEmu::ItemInstance* world_inst = m_tradeskill_object->PopItem(world_idx); // Case 1: No item in container, unidirectional "Put" @@ -1835,7 +1835,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { Message(15, "Inventory Desyncronization detected: Resending slot data..."); if ((move_slots->from_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::inventory::slotPowerSource) { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); + int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { // This prevents the client from crashing when closing any 'phantom' bags const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1860,7 +1860,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); } } else { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); + int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1878,7 +1878,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { } if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::inventory::slotPowerSource) { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); + int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' EQEmu::ItemInstance* token_inst = database.CreateItem(token_struct, 1); @@ -1902,7 +1902,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); } } else { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); + int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1963,8 +1963,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { const EQEmu::ItemInstance* from_baginst = from_inst->GetItem(bag_idx); if(from_baginst) { - qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); - qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); + qsaudit->items[move_count].from_slot = EQEmu::InventoryProfile::CalcSlotId(from_slot_id, bag_idx); + qsaudit->items[move_count].to_slot = EQEmu::InventoryProfile::CalcSlotId(to_slot_id, bag_idx); qsaudit->items[move_count].item_id = from_baginst->GetID(); qsaudit->items[move_count].charges = from_baginst->GetCharges(); qsaudit->items[move_count].aug_1 = from_baginst->GetAugmentItemID(1); @@ -1996,8 +1996,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { const EQEmu::ItemInstance* to_baginst = to_inst->GetItem(bag_idx); if(to_baginst) { - qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); - qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); + qsaudit->items[move_count].from_slot = EQEmu::InventoryProfile::CalcSlotId(to_slot_id, bag_idx); + qsaudit->items[move_count].to_slot = EQEmu::InventoryProfile::CalcSlotId(from_slot_id, bag_idx); qsaudit->items[move_count].item_id = to_baginst->GetID(); qsaudit->items[move_count].charges = to_baginst->GetCharges(); qsaudit->items[move_count].aug_1 = to_baginst->GetAugmentItemID(1); @@ -2598,7 +2598,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const return 0; } - invslot = Inventory::CalcSlotFromMaterial(material_slot); + invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) { return 0; @@ -2956,7 +2956,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC // if (InvItem && InvItem->IsClassBag()) { - int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::inventory::containerBegin); uint8 BagSize=InvItem->GetItem()->BagSlots; @@ -3006,9 +3006,9 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC return true; } - if (InvItem->IsClassBag() && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { + if (InvItem->IsClassBag() && EQEmu::InventoryProfile::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { - int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin); + int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::inventory::containerBegin); uint8 BagSize=InvItem->GetItem()->BagSlots; @@ -3272,7 +3272,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It return false; } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { +void EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3280,7 +3280,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) { +void EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) { EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3288,7 +3288,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) { +void EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) { EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3296,7 +3296,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) { +void EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) { EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3304,7 +3304,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier) { +std::string EQEmu::InventoryProfile::GetCustomItemData(int16 slot_id, std::string identifier) { EQEmu::ItemInstance *inst = GetItem(slot_id); if(inst) { return inst->GetCustomData(identifier); diff --git a/zone/lua_inventory.h b/zone/lua_inventory.h index ca49a55e6..baaa5d10f 100644 --- a/zone/lua_inventory.h +++ b/zone/lua_inventory.h @@ -4,26 +4,30 @@ #include "lua_ptr.h" -class Inventory; class Lua_ItemInst; class Lua_Item; +namespace EQEmu +{ + class InventoryProfile; +} + namespace luabind { struct scope; } luabind::scope lua_register_inventory(); -class Lua_Inventory : public Lua_Ptr +class Lua_Inventory : public Lua_Ptr { - typedef Inventory NativeType; + typedef EQEmu::InventoryProfile NativeType; public: Lua_Inventory() : Lua_Ptr(nullptr) { } - Lua_Inventory(Inventory *d) : Lua_Ptr(d) { } + Lua_Inventory(EQEmu::InventoryProfile *d) : Lua_Ptr(d) { } virtual ~Lua_Inventory() { } - operator Inventory*() { - return reinterpret_cast(GetLuaPtrData()); + operator EQEmu::InventoryProfile*() { + return reinterpret_cast(GetLuaPtrData()); } Lua_ItemInst GetItem(int slot_id); diff --git a/zone/merc.cpp b/zone/merc.cpp index c45d0c268..6dc00836b 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5050,7 +5050,7 @@ void Merc::UpdateMercAppearance() { for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) { itemID = equipment[i]; if(itemID != 0) { - materialFromSlot = Inventory::CalcMaterialFromSlot(i); + materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(i); if (materialFromSlot != EQEmu::textures::materialInvalid) this->SendWearChange(materialFromSlot); } diff --git a/zone/merc.h b/zone/merc.h index ad219a2ec..b563775b0 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -386,7 +386,7 @@ private: uint8 _OwnerClientVersion; uint32 _currentStance; - Inventory m_inv; + EQEmu::InventoryProfile m_inv; int32 max_end; int32 cur_end; bool _medding; diff --git a/zone/mob.cpp b/zone/mob.cpp index dcb9792f2..368d34e1f 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2728,7 +2728,7 @@ uint32 NPC::GetEquipment(uint8 material_slot) const { if(material_slot > 8) return 0; - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) return 0; return equipment[invslot]; @@ -2862,7 +2862,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { if (this->IsClient()) { - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) { return 0; @@ -2907,7 +2907,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); const EQEmu::ItemData *item; item = database.GetItem(GetEquipment(material_slot)); - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if (item != 0 && invslot != INVALID_INDEX) { diff --git a/zone/npc.cpp b/zone/npc.cpp index 166cd33fc..f6e080a26 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -489,7 +489,7 @@ void NPC::CheckMinMaxLevel(Mob *them) if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level) { - material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot); + material = EQEmu::InventoryProfile::CalcMaterialFromSlot((*cur)->equip_slot); if (material != EQEmu::textures::materialInvalid) SendWearChange(material); @@ -1381,7 +1381,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const if (material_slot >= EQEmu::textures::materialCount) return 0; - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) return 0; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 8db24d81e..4c8dfdeaf 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -55,7 +55,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme else { // Check to see if they have an inventory container type 53 that is used for this. - Inventory& user_inv = user->GetInv(); + EQEmu::InventoryProfile& user_inv = user->GetInv(); EQEmu::ItemInstance* inst = nullptr; inst = user_inv.GetItem(in_augment->container_slot); @@ -227,7 +227,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { - user->DeleteItemInInventory(Inventory::CalcSlotId(in_augment->container_slot,i),0,true); + user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_augment->container_slot, i), 0, true); } } // Explicitly mark container as cleared. @@ -256,7 +256,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob return; } - Inventory& user_inv = user->GetInv(); + EQEmu::InventoryProfile& user_inv = user->GetInv(); PlayerProfile_Struct& user_pp = user->GetPP(); EQEmu::ItemInstance* container = nullptr; EQEmu::ItemInstance* inst = nullptr; @@ -295,7 +295,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); if (inst && EQEmu::ItemInstance::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { const EQEmu::ItemData* new_weapon = inst->GetItem(); - user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); + user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::inventory::slotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); @@ -315,7 +315,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const EQEmu::ItemInstance* inst = container->GetItem(0); if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) { const EQEmu::ItemData* new_weapon = inst->GetItem(); - user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); + user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), EQEmu::inventory::slotCursor, 0, 0); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); @@ -404,7 +404,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) { const EQEmu::ItemInstance* inst = container->GetItem(i); if (inst) { - user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot,i),0,true); + user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_combine->container_slot, i), 0, true); } } container->Clear(); @@ -501,7 +501,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac memset(counts, 0, sizeof(counts)); //search for all the items in their inventory - Inventory& user_inv = user->GetInv(); + EQEmu::InventoryProfile& user_inv = user->GetInv(); uint8 count = 0; uint8 needcount = 0; diff --git a/zone/trading.cpp b/zone/trading.cpp index 9d9738ffc..e150ceb12 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -174,7 +174,7 @@ void Trade::SendItemData(const EQEmu::ItemInstance* inst, int16 dest_slot_id) with->SendItemPacket(dest_slot_id - EQEmu::legacy::TRADE_BEGIN, inst, ItemPacketTradeView); if (inst->GetItem()->ItemClass == 1) { for (uint16 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) { - uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i); + uint16 bagslot_id = EQEmu::InventoryProfile::CalcSlotId(dest_slot_id, i); const EQEmu::ItemInstance* bagitem = trader->GetInv().GetItem(bagslot_id); if (bagitem) { with->SendItemPacket(bagslot_id - EQEmu::legacy::TRADE_BEGIN, bagitem, ItemPacketTradeView); @@ -317,7 +317,7 @@ void Trade::DumpTrade() if (inst) { Log.Out(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), - Inventory::CalcSlotId(i, j)); + EQEmu::InventoryProfile::CalcSlotId(i, j)); } } } @@ -530,9 +530,9 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st detail = new QSTradeItems_Struct; detail->from_id = this->character_id; - detail->from_slot = Inventory::CalcSlotId(trade_slot, sub_slot); + detail->from_slot = EQEmu::InventoryProfile::CalcSlotId(trade_slot, sub_slot); detail->to_id = other->CharacterID(); - detail->to_slot = Inventory::CalcSlotId(free_slot, sub_slot); + detail->to_slot = EQEmu::InventoryProfile::CalcSlotId(free_slot, sub_slot); detail->item_id = bag_inst->GetID(); detail->charges = (!bag_inst->IsStackable() ? 1 : bag_inst->GetCharges()); detail->aug_1 = bag_inst->GetAugmentItemID(1); @@ -849,7 +849,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st strcpy(detail->action_type, "HANDIN"); - detail->char_slot = Inventory::CalcSlotId(trade_slot, sub_slot); + detail->char_slot = EQEmu::InventoryProfile::CalcSlotId(trade_slot, sub_slot); detail->item_id = trade_baginst->GetID(); detail->charges = (!trade_inst->IsStackable() ? 1 : trade_inst->GetCharges()); detail->aug_1 = trade_baginst->GetAugmentItemID(1); @@ -1237,7 +1237,7 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) { if (item && item->GetItem()->ID == 17899){ //Traders Satchel for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? - SlotID = Inventory::CalcSlotId(i, x); + SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); if (item) { if (item->GetID() == ItemID) @@ -1260,7 +1260,7 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ if(item && item->GetItem()->ID == 17899){ //Traders Satchel for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? - SlotID = Inventory::CalcSlotId(i, x); + SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); if(item) { if(item->GetSerialNumber() == SerialNumber) @@ -1290,7 +1290,7 @@ GetItems_Struct* Client::GetTraderItems(){ item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) { - SlotID = Inventory::CalcSlotId(i, x); + SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1314,7 +1314,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++){ - SlotID = Inventory::CalcSlotId(i, x); + SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); diff --git a/zone/zone.cpp b/zone/zone.cpp index 9391b47bb..ab0a9b6e4 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1167,7 +1167,7 @@ bool Zone::Process() { if(spawn2_timer.Check()) { LinkedListIterator iterator(spawn2_list); - Inventory::CleanDirty(); + EQEmu::InventoryProfile::CleanDirty(); iterator.Reset(); while (iterator.MoreElements()) { From 101002d635dbf3ba52ff6951f635be506e797b1d Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 17 Oct 2016 06:32:51 -0400 Subject: [PATCH 28/65] Renamed enum class InventoryVersion to MobVersion --- changelog.txt | 1 + common/emu_versions.cpp | 226 ++++----- common/emu_versions.h | 56 ++- common/eq_limits.cpp | 912 ++++++++++++++++++++++++++++------- common/eq_limits.h | 4 +- common/inventory_profile.cpp | 2 +- common/inventory_profile.h | 21 +- zone/client_mods.cpp | 2 +- zone/corpse.cpp | 4 +- 9 files changed, 886 insertions(+), 342 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1ac1ec731..4b2d029d5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Uleat: Moved namespace ItemField from item_instance.h to shareddb.cpp - the only place it is used Uleat: Separated class Inventory from item_instance files into inventory_profile files Uleat: Renamed class Inventory to EQEmu::InventoryProfile +Uleat: Renamed enum class InventoryVersion to MobVersion == 10/16/2016 == Uleat: Renamed struct EQEmu::ItemBase to EQEmu::ItemData and class ItemInst to EQEmu::ItemInstance diff --git a/common/emu_versions.cpp b/common/emu_versions.cpp index 92766e407..ee4970638 100644 --- a/common/emu_versions.cpp +++ b/common/emu_versions.cpp @@ -127,244 +127,244 @@ uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_ver } } -bool EQEmu::versions::IsValidInventoryVersion(InventoryVersion inventory_version) +bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version) { - if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion) + if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion) return false; return true; } -bool EQEmu::versions::IsValidPCInventoryVersion(InventoryVersion inventory_version) +bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version) { - if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion) + if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion) return false; return true; } -bool EQEmu::versions::IsValidNonPCInventoryVersion(InventoryVersion inventory_version) +bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version) { - if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion) + if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion) return false; return true; } -bool EQEmu::versions::IsValidOfflinePCInventoryVersion(InventoryVersion inventory_version) +bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version) { - if (inventory_version <= LastNonPCInventoryVersion || inventory_version > LastOfflinePCInventoryVersion) + if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion) return false; return true; } -EQEmu::versions::InventoryVersion EQEmu::versions::ValidateInventoryVersion(InventoryVersion inventory_version) +EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version) { - if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion) - return InventoryVersion::Unknown; + if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion) + return MobVersion::Unknown; - return inventory_version; + return mob_version; } -EQEmu::versions::InventoryVersion EQEmu::versions::ValidatePCInventoryVersion(InventoryVersion inventory_version) +EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version) { - if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion) - return InventoryVersion::Unknown; + if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion) + return MobVersion::Unknown; - return inventory_version; + return mob_version; } -EQEmu::versions::InventoryVersion EQEmu::versions::ValidateNonPCInventoryVersion(InventoryVersion inventory_version) +EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version) { - if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion) - return InventoryVersion::Unknown; + if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion) + return MobVersion::Unknown; - return inventory_version; + return mob_version; } -EQEmu::versions::InventoryVersion EQEmu::versions::ValidateOfflinePCInventoryVersion(InventoryVersion inventory_version) +EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version) { - if (inventory_version <= LastNonPCInventoryVersion || inventory_version > LastOfflinePCInventoryVersion) - return InventoryVersion::Unknown; + if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion) + return MobVersion::Unknown; - return inventory_version; + return mob_version; } -const char* EQEmu::versions::InventoryVersionName(InventoryVersion inventory_version) +const char* EQEmu::versions::MobVersionName(MobVersion mob_version) { - switch (inventory_version) { - case InventoryVersion::Unknown: + switch (mob_version) { + case MobVersion::Unknown: return "Unknown Version"; - case InventoryVersion::Client62: + case MobVersion::Client62: return "Client 6.2"; - case InventoryVersion::Titanium: + case MobVersion::Titanium: return "Titanium"; - case InventoryVersion::SoF: + case MobVersion::SoF: return "SoF"; - case InventoryVersion::SoD: + case MobVersion::SoD: return "SoD"; - case InventoryVersion::UF: + case MobVersion::UF: return "UF"; - case InventoryVersion::RoF: + case MobVersion::RoF: return "RoF"; - case InventoryVersion::RoF2: + case MobVersion::RoF2: return "RoF2"; - case InventoryVersion::NPC: + case MobVersion::NPC: return "NPC"; - case InventoryVersion::NPCMerchant: + case MobVersion::NPCMerchant: return "NPC Merchant"; - case InventoryVersion::Merc: + case MobVersion::Merc: return "Merc"; - case InventoryVersion::Bot: + case MobVersion::Bot: return "Bot"; - case InventoryVersion::ClientPet: + case MobVersion::ClientPet: return "Client Pet"; - case InventoryVersion::NPCPet: + case MobVersion::NPCPet: return "NPC Pet"; - case InventoryVersion::MercPet: + case MobVersion::MercPet: return "Merc Pet"; - case InventoryVersion::BotPet: + case MobVersion::BotPet: return "Bot Pet"; - case InventoryVersion::OfflineTitanium: + case MobVersion::OfflineTitanium: return "Offline Titanium"; - case InventoryVersion::OfflineSoF: + case MobVersion::OfflineSoF: return "Offline SoF"; - case InventoryVersion::OfflineSoD: + case MobVersion::OfflineSoD: return "Offline SoD"; - case InventoryVersion::OfflineUF: + case MobVersion::OfflineUF: return "Offline UF"; - case InventoryVersion::OfflineRoF: + case MobVersion::OfflineRoF: return "Offline RoF"; - case InventoryVersion::OfflineRoF2: + case MobVersion::OfflineRoF2: return "Offline RoF2"; default: return "Invalid Version"; }; } -EQEmu::versions::ClientVersion EQEmu::versions::ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version) +EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version) { - switch (inventory_version) { - case InventoryVersion::Unknown: - case InventoryVersion::Client62: + switch (mob_version) { + case MobVersion::Unknown: + case MobVersion::Client62: return ClientVersion::Unknown; - case InventoryVersion::Titanium: + case MobVersion::Titanium: return ClientVersion::Titanium; - case InventoryVersion::SoF: + case MobVersion::SoF: return ClientVersion::SoF; - case InventoryVersion::SoD: + case MobVersion::SoD: return ClientVersion::SoD; - case InventoryVersion::UF: + case MobVersion::UF: return ClientVersion::UF; - case InventoryVersion::RoF: + case MobVersion::RoF: return ClientVersion::RoF; - case InventoryVersion::RoF2: + case MobVersion::RoF2: return ClientVersion::RoF2; default: return ClientVersion::Unknown; } } -EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToInventoryVersion(ClientVersion client_version) +EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version) { switch (client_version) { case ClientVersion::Unknown: case ClientVersion::Client62: - return InventoryVersion::Unknown; + return MobVersion::Unknown; case ClientVersion::Titanium: - return InventoryVersion::Titanium; + return MobVersion::Titanium; case ClientVersion::SoF: - return InventoryVersion::SoF; + return MobVersion::SoF; case ClientVersion::SoD: - return InventoryVersion::SoD; + return MobVersion::SoD; case ClientVersion::UF: - return InventoryVersion::UF; + return MobVersion::UF; case ClientVersion::RoF: - return InventoryVersion::RoF; + return MobVersion::RoF; case ClientVersion::RoF2: - return InventoryVersion::RoF2; + return MobVersion::RoF2; default: - return InventoryVersion::Unknown; + return MobVersion::Unknown; } } -EQEmu::versions::InventoryVersion EQEmu::versions::ConvertPCInventoryVersionToOfflinePCInventoryVersion(InventoryVersion inventory_version) +EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version) { - switch (inventory_version) { - case InventoryVersion::Titanium: - return InventoryVersion::OfflineTitanium; - case InventoryVersion::SoF: - return InventoryVersion::OfflineSoF; - case InventoryVersion::SoD: - return InventoryVersion::OfflineSoD; - case InventoryVersion::UF: - return InventoryVersion::OfflineUF; - case InventoryVersion::RoF: - return InventoryVersion::OfflineRoF; - case InventoryVersion::RoF2: - return InventoryVersion::OfflineRoF2; + switch (mob_version) { + case MobVersion::Titanium: + return MobVersion::OfflineTitanium; + case MobVersion::SoF: + return MobVersion::OfflineSoF; + case MobVersion::SoD: + return MobVersion::OfflineSoD; + case MobVersion::UF: + return MobVersion::OfflineUF; + case MobVersion::RoF: + return MobVersion::OfflineRoF; + case MobVersion::RoF2: + return MobVersion::OfflineRoF2; default: - return InventoryVersion::Unknown; + return MobVersion::Unknown; } } -EQEmu::versions::InventoryVersion EQEmu::versions::ConvertOfflinePCInventoryVersionToPCInventoryVersion(InventoryVersion inventory_version) +EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version) { - switch (inventory_version) { - case InventoryVersion::OfflineTitanium: - return InventoryVersion::Titanium; - case InventoryVersion::OfflineSoF: - return InventoryVersion::SoF; - case InventoryVersion::OfflineSoD: - return InventoryVersion::SoD; - case InventoryVersion::OfflineUF: - return InventoryVersion::UF; - case InventoryVersion::OfflineRoF: - return InventoryVersion::RoF; - case InventoryVersion::OfflineRoF2: - return InventoryVersion::RoF2; + switch (mob_version) { + case MobVersion::OfflineTitanium: + return MobVersion::Titanium; + case MobVersion::OfflineSoF: + return MobVersion::SoF; + case MobVersion::OfflineSoD: + return MobVersion::SoD; + case MobVersion::OfflineUF: + return MobVersion::UF; + case MobVersion::OfflineRoF: + return MobVersion::RoF; + case MobVersion::OfflineRoF2: + return MobVersion::RoF2; default: - return InventoryVersion::Unknown; + return MobVersion::Unknown; } } -EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCInventoryVersionToClientVersion(InventoryVersion inventory_version) +EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version) { - switch (inventory_version) { - case InventoryVersion::OfflineTitanium: + switch (mob_version) { + case MobVersion::OfflineTitanium: return ClientVersion::Titanium; - case InventoryVersion::OfflineSoF: + case MobVersion::OfflineSoF: return ClientVersion::SoF; - case InventoryVersion::OfflineSoD: + case MobVersion::OfflineSoD: return ClientVersion::SoD; - case InventoryVersion::OfflineUF: + case MobVersion::OfflineUF: return ClientVersion::UF; - case InventoryVersion::OfflineRoF: + case MobVersion::OfflineRoF: return ClientVersion::RoF; - case InventoryVersion::OfflineRoF2: + case MobVersion::OfflineRoF2: return ClientVersion::RoF2; default: return ClientVersion::Unknown; } } -EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToOfflinePCInventoryVersion(ClientVersion client_version) +EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version) { switch (client_version) { case ClientVersion::Titanium: - return InventoryVersion::OfflineTitanium; + return MobVersion::OfflineTitanium; case ClientVersion::SoF: - return InventoryVersion::OfflineSoF; + return MobVersion::OfflineSoF; case ClientVersion::SoD: - return InventoryVersion::OfflineSoD; + return MobVersion::OfflineSoD; case ClientVersion::UF: - return InventoryVersion::OfflineUF; + return MobVersion::OfflineUF; case ClientVersion::RoF: - return InventoryVersion::OfflineRoF; + return MobVersion::OfflineRoF; case ClientVersion::RoF2: - return InventoryVersion::OfflineRoF2; + return MobVersion::OfflineRoF2; default: - return InventoryVersion::Unknown; + return MobVersion::Unknown; } } diff --git a/common/emu_versions.h b/common/emu_versions.h index 8a806e8fc..9d9e1f580 100644 --- a/common/emu_versions.h +++ b/common/emu_versions.h @@ -64,17 +64,15 @@ namespace EQEmu const ClientVersion LastClientVersion = ClientVersion::RoF2; const size_t ClientVersionCount = (static_cast(LastClientVersion) + 1); - extern bool IsValidClientVersion(ClientVersion client_version); - extern ClientVersion ValidateClientVersion(ClientVersion client_version); - extern const char* ClientVersionName(ClientVersion client_version); - extern uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version); - extern ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit); - extern uint32 ConvertClientVersionToExpansion(ClientVersion client_version); + bool IsValidClientVersion(ClientVersion client_version); + ClientVersion ValidateClientVersion(ClientVersion client_version); + const char* ClientVersionName(ClientVersion client_version); + uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version); + ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit); + uint32 ConvertClientVersionToExpansion(ClientVersion client_version); - } /*versions*/ - namespace versions { - enum class InventoryVersion { + enum class MobVersion { Unknown = 0, Client62, Titanium, @@ -99,29 +97,29 @@ namespace EQEmu OfflineRoF2 }; - const InventoryVersion LastInventoryVersion = InventoryVersion::OfflineRoF2; - const InventoryVersion LastPCInventoryVersion = InventoryVersion::RoF2; - const InventoryVersion LastNonPCInventoryVersion = InventoryVersion::BotPet; - const InventoryVersion LastOfflinePCInventoryVersion = InventoryVersion::OfflineRoF2; - const size_t InventoryVersionCount = (static_cast(LastInventoryVersion) + 1); + const MobVersion LastMobVersion = MobVersion::OfflineRoF2; + const MobVersion LastPCMobVersion = MobVersion::RoF2; + const MobVersion LastNonPCMobVersion = MobVersion::BotPet; + const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineRoF2; + const size_t MobVersionCount = (static_cast(LastMobVersion) + 1); - extern bool IsValidInventoryVersion(InventoryVersion inventory_version); - extern bool IsValidPCInventoryVersion(InventoryVersion inventory_version); - extern bool IsValidNonPCInventoryVersion(InventoryVersion inventory_version); - extern bool IsValidOfflinePCInventoryVersion(InventoryVersion inventory_version); + bool IsValidMobVersion(MobVersion mob_version); + bool IsValidPCMobVersion(MobVersion mob_version); + bool IsValidNonPCMobVersion(MobVersion mob_version); + bool IsValidOfflinePCMobVersion(MobVersion mob_version); - extern InventoryVersion ValidateInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ValidatePCInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ValidateNonPCInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ValidateOfflinePCInventoryVersion(InventoryVersion inventory_version); + MobVersion ValidateMobVersion(MobVersion mob_version); + MobVersion ValidatePCMobVersion(MobVersion mob_version); + MobVersion ValidateNonPCMobVersion(MobVersion mob_version); + MobVersion ValidateOfflinePCMobVersion(MobVersion mob_version); - extern const char* InventoryVersionName(InventoryVersion inventory_version); - extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version); - extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version); - extern InventoryVersion ConvertPCInventoryVersionToOfflinePCInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ConvertOfflinePCInventoryVersionToPCInventoryVersion(InventoryVersion inventory_version); - extern ClientVersion ConvertOfflinePCInventoryVersionToClientVersion(InventoryVersion inventory_version); - extern InventoryVersion ConvertClientVersionToOfflinePCInventoryVersion(ClientVersion client_version); + const char* MobVersionName(MobVersion mob_version); + ClientVersion ConvertMobVersionToClientVersion(MobVersion mob_version); + MobVersion ConvertClientVersionToMobVersion(ClientVersion client_version); + MobVersion ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version); + MobVersion ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version); + ClientVersion ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version); + MobVersion ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version); } /*versions*/ diff --git a/common/eq_limits.cpp b/common/eq_limits.cpp index 9f960557c..1c0140811 100644 --- a/common/eq_limits.cpp +++ b/common/eq_limits.cpp @@ -23,28 +23,28 @@ static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versions::ClientVersionCount] = { - { // Unknown + { ClientUnknown::Null }, - { // Client62 + { Client62::Null }, - { // Titanium + { Titanium::constants::CharacterCreationLimit }, - { // SoF + { SoF::constants::CharacterCreationLimit }, - { // SoD + { SoD::constants::CharacterCreationLimit }, - { // UF + { UF::constants::CharacterCreationLimit }, - { // RoF + { RoF::constants::CharacterCreationLimit }, - { // RoF2 + { RoF2::constants::CharacterCreationLimit } }; @@ -54,258 +54,804 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::Lookup(versions::ClientVe return &constants_lookup_entries[static_cast(versions::ValidateClientVersion(client_version))]; } -static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versions::InventoryVersionCount] = +static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versions::MobVersionCount] = { - { // Unknown - ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, - ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, - ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, - ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, - ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, + { + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, - ClientUnknown::Null, ClientUnknown::Null, ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, - ClientUnknown::False, ClientUnknown::False, ClientUnknown::False, ClientUnknown::False + ClientUnknown::False, + ClientUnknown::False, + ClientUnknown::False, + ClientUnknown::False }, - { // Client62 - Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null, - Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null, - Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null, - Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null, - Client62::Null, Client62::Null, Client62::Null, Client62::Null, Client62::Null, + { + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, - Client62::Null, Client62::Null, Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, - Client62::False, Client62::False, Client62::False, Client62::False + Client62::False, + Client62::False, + Client62::False, + Client62::False }, - { // Titanium - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*Titanium::invtype::InvTypePossessionsSize,*/ Titanium::invtype::InvTypeBankSize, Titanium::invtype::InvTypeSharedBankSize, Titanium::invtype::InvTypeTradeSize, Titanium::invtype::InvTypeWorldSize, - Titanium::invtype::InvTypeLimboSize, Titanium::invtype::InvTypeTributeSize, Titanium::Null, Titanium::Null, /*Titanium::invtype::InvTypeGuildTributeSize,*/ Titanium::invtype::InvTypeMerchantSize, - Titanium::Null, Titanium::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*Titanium::invtype::InvTypeBazaarSize,*/ Titanium::invtype::InvTypeInspectSize, Titanium::Null, - Titanium::invtype::InvTypeViewMODPCSize, Titanium::invtype::InvTypeViewMODBankSize, Titanium::invtype::InvTypeViewMODSharedBankSize, Titanium::invtype::InvTypeViewMODLimboSize, Titanium::invtype::InvTypeAltStorageSize, - Titanium::invtype::InvTypeArchivedSize, Titanium::Null, Titanium::Null, Titanium::Null, Titanium::invtype::InvTypeOtherSize, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*Titanium::invtype::InvTypePossessionsSize,*/ + Titanium::invtype::InvTypeBankSize, + Titanium::invtype::InvTypeSharedBankSize, + Titanium::invtype::InvTypeTradeSize, + Titanium::invtype::InvTypeWorldSize, + Titanium::invtype::InvTypeLimboSize, + Titanium::invtype::InvTypeTributeSize, + Titanium::Null, + Titanium::Null, /*Titanium::invtype::InvTypeGuildTributeSize,*/ + Titanium::invtype::InvTypeMerchantSize, + Titanium::Null, + Titanium::invtype::InvTypeCorpseSize, + EQEmu::legacy::TYPE_BAZAAR_SIZE, /*Titanium::invtype::InvTypeBazaarSize,*/ + Titanium::invtype::InvTypeInspectSize, + Titanium::Null, + Titanium::invtype::InvTypeViewMODPCSize, + Titanium::invtype::InvTypeViewMODBankSize, + Titanium::invtype::InvTypeViewMODSharedBankSize, + Titanium::invtype::InvTypeViewMODLimboSize, + Titanium::invtype::InvTypeAltStorageSize, + Titanium::invtype::InvTypeArchivedSize, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::invtype::InvTypeOtherSize, - Titanium::Null, /*0x000000027FDFFFFF,*/ EQEmu::inventory::ContainerCount, /*Titanium::invbag::ItemBagSize,*/ EQEmu::inventory::SocketCount, /*Titanium::invaug::ItemAugSize,*/ + Titanium::Null, /*0x000000027FDFFFFF,*/ + EQEmu::inventory::ContainerCount, /*Titanium::invbag::ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*Titanium::invaug::ItemAugSize,*/ - Titanium::inventory::AllowEmptyBagInBag, Titanium::inventory::AllowClickCastFromBag, Titanium::inventory::ConcatenateInvTypeLimbo, Titanium::inventory::AllowOverLevelEquipment + Titanium::inventory::AllowEmptyBagInBag, + Titanium::inventory::AllowClickCastFromBag, + Titanium::inventory::ConcatenateInvTypeLimbo, + Titanium::inventory::AllowOverLevelEquipment }, - { // SoF - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoF::invtype::InvTypePossessionsSize,*/ SoF::invtype::InvTypeBankSize, SoF::invtype::InvTypeSharedBankSize, SoF::invtype::InvTypeTradeSize, SoF::invtype::InvTypeWorldSize, - SoF::invtype::InvTypeLimboSize, SoF::invtype::InvTypeTributeSize, SoF::Null, SoF::Null, /*SoF::invtype::InvTypeGuildTributeSize,*/ SoF::invtype::InvTypeMerchantSize, - SoF::Null, SoF::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoF::invtype::InvTypeBazaarSize,*/ SoF::invtype::InvTypeInspectSize, SoF::Null, - SoF::invtype::InvTypeViewMODPCSize, SoF::invtype::InvTypeViewMODBankSize, SoF::invtype::InvTypeViewMODSharedBankSize, SoF::invtype::InvTypeViewMODLimboSize, SoF::invtype::InvTypeAltStorageSize, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoF::invtype::InvTypePossessionsSize,*/ + SoF::invtype::InvTypeBankSize, + SoF::invtype::InvTypeSharedBankSize, + SoF::invtype::InvTypeTradeSize, + SoF::invtype::InvTypeWorldSize, + SoF::invtype::InvTypeLimboSize, + SoF::invtype::InvTypeTributeSize, + SoF::Null, + SoF::Null, /*SoF::invtype::InvTypeGuildTributeSize,*/ + SoF::invtype::InvTypeMerchantSize, + SoF::Null, + SoF::invtype::InvTypeCorpseSize, + EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoF::invtype::InvTypeBazaarSize,*/ + SoF::invtype::InvTypeInspectSize, + SoF::Null, + SoF::invtype::InvTypeViewMODPCSize, + SoF::invtype::InvTypeViewMODBankSize, + SoF::invtype::InvTypeViewMODSharedBankSize, + SoF::invtype::InvTypeViewMODLimboSize, + SoF::invtype::InvTypeAltStorageSize, SoF::invtype::InvTypeArchivedSize, SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeOtherSize, - SoF::Null, /*0x000000027FFFFFFF,*/ EQEmu::inventory::ContainerCount, /*SoF::invbag::ItemBagSize,*/ EQEmu::inventory::SocketCount, /*SoF::invaug::ItemAugSize,*/ + SoF::Null, /*0x000000027FFFFFFF,*/ + EQEmu::inventory::ContainerCount, /*SoF::invbag::ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*SoF::invaug::ItemAugSize,*/ - SoF::inventory::AllowEmptyBagInBag, SoF::inventory::AllowClickCastFromBag, SoF::inventory::ConcatenateInvTypeLimbo, SoF::inventory::AllowOverLevelEquipment + SoF::inventory::AllowEmptyBagInBag, + SoF::inventory::AllowClickCastFromBag, + SoF::inventory::ConcatenateInvTypeLimbo, + SoF::inventory::AllowOverLevelEquipment }, - { // SoD - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoD::invtype::InvTypePossessionsSize,*/ SoD::invtype::InvTypeBankSize, SoD::invtype::InvTypeSharedBankSize, SoD::invtype::InvTypeTradeSize, SoD::invtype::InvTypeWorldSize, - SoD::invtype::InvTypeLimboSize, SoD::invtype::InvTypeTributeSize, SoD::Null, SoD::Null, /*SoD::invtype::InvTypeGuildTributeSize,*/ SoD::invtype::InvTypeMerchantSize, - SoD::Null, SoD::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoD::invtype::InvTypeBazaarSize,*/ SoD::invtype::InvTypeInspectSize, SoD::Null, - SoD::invtype::InvTypeViewMODPCSize, SoD::invtype::InvTypeViewMODBankSize, SoD::invtype::InvTypeViewMODSharedBankSize, SoD::invtype::InvTypeViewMODLimboSize, SoD::invtype::InvTypeAltStorageSize, - SoD::invtype::InvTypeArchivedSize, SoD::Null, SoD::Null, SoD::Null, SoD::invtype::InvTypeOtherSize, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoD::invtype::InvTypePossessionsSize,*/ + SoD::invtype::InvTypeBankSize, + SoD::invtype::InvTypeSharedBankSize, + SoD::invtype::InvTypeTradeSize, + SoD::invtype::InvTypeWorldSize, + SoD::invtype::InvTypeLimboSize, + SoD::invtype::InvTypeTributeSize, + SoD::Null, + SoD::Null, /*SoD::invtype::InvTypeGuildTributeSize,*/ + SoD::invtype::InvTypeMerchantSize, + SoD::Null, + SoD::invtype::InvTypeCorpseSize, + EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoD::invtype::InvTypeBazaarSize,*/ + SoD::invtype::InvTypeInspectSize, + SoD::Null, + SoD::invtype::InvTypeViewMODPCSize, + SoD::invtype::InvTypeViewMODBankSize, + SoD::invtype::InvTypeViewMODSharedBankSize, + SoD::invtype::InvTypeViewMODLimboSize, + SoD::invtype::InvTypeAltStorageSize, + SoD::invtype::InvTypeArchivedSize, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::invtype::InvTypeOtherSize, - SoD::Null, /*0x000000027FFFFFFF,*/ EQEmu::inventory::ContainerCount, /*SoD::invbag::ItemBagSize,*/ EQEmu::inventory::SocketCount, /*SoD::invaug::ItemAugSize,*/ + SoD::Null, /*0x000000027FFFFFFF,*/ + EQEmu::inventory::ContainerCount, /*SoD::invbag::ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*SoD::invaug::ItemAugSize,*/ - SoD::inventory::AllowEmptyBagInBag, SoD::inventory::AllowClickCastFromBag, SoD::inventory::ConcatenateInvTypeLimbo, SoD::inventory::AllowOverLevelEquipment + SoD::inventory::AllowEmptyBagInBag, + SoD::inventory::AllowClickCastFromBag, + SoD::inventory::ConcatenateInvTypeLimbo, + SoD::inventory::AllowOverLevelEquipment }, - { // UF - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*UF::invtype::InvTypePossessionsSize,*/ UF::invtype::InvTypeBankSize, UF::invtype::InvTypeSharedBankSize, UF::invtype::InvTypeTradeSize, UF::invtype::InvTypeWorldSize, - UF::invtype::InvTypeLimboSize, UF::invtype::InvTypeTributeSize, UF::Null, UF::Null, /*UF::invtype::InvTypeGuildTributeSize,*/ UF::invtype::InvTypeMerchantSize, - UF::Null, UF::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*UF::invtype::InvTypeBazaarSize,*/ UF::invtype::InvTypeInspectSize, UF::Null, - UF::invtype::InvTypeViewMODPCSize, UF::invtype::InvTypeViewMODBankSize, UF::invtype::InvTypeViewMODSharedBankSize, UF::invtype::InvTypeViewMODLimboSize, UF::invtype::InvTypeAltStorageSize, - UF::invtype::InvTypeArchivedSize, UF::Null, UF::Null, UF::Null, UF::invtype::InvTypeOtherSize, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*UF::invtype::InvTypePossessionsSize,*/ + UF::invtype::InvTypeBankSize, + UF::invtype::InvTypeSharedBankSize, + UF::invtype::InvTypeTradeSize, + UF::invtype::InvTypeWorldSize, + UF::invtype::InvTypeLimboSize, + UF::invtype::InvTypeTributeSize, + UF::Null, + UF::Null, /*UF::invtype::InvTypeGuildTributeSize,*/ + UF::invtype::InvTypeMerchantSize, + UF::Null, + UF::invtype::InvTypeCorpseSize, + EQEmu::legacy::TYPE_BAZAAR_SIZE, /*UF::invtype::InvTypeBazaarSize,*/ + UF::invtype::InvTypeInspectSize, + UF::Null, + UF::invtype::InvTypeViewMODPCSize, + UF::invtype::InvTypeViewMODBankSize, + UF::invtype::InvTypeViewMODSharedBankSize, + UF::invtype::InvTypeViewMODLimboSize, + UF::invtype::InvTypeAltStorageSize, + UF::invtype::InvTypeArchivedSize, + UF::Null, + UF::Null, + UF::Null, + UF::invtype::InvTypeOtherSize, - UF::Null, /*0x000000027FFFFFFF,*/ EQEmu::inventory::ContainerCount, /*UF::invbag::ItemBagSize,*/ EQEmu::inventory::SocketCount, /*UF::invaug::ItemAugSize,*/ + UF::Null, /*0x000000027FFFFFFF,*/ + EQEmu::inventory::ContainerCount, /*UF::invbag::ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*UF::invaug::ItemAugSize,*/ - UF::inventory::AllowEmptyBagInBag, UF::inventory::AllowClickCastFromBag, UF::inventory::ConcatenateInvTypeLimbo, UF::inventory::AllowOverLevelEquipment + UF::inventory::AllowEmptyBagInBag, + UF::inventory::AllowClickCastFromBag, + UF::inventory::ConcatenateInvTypeLimbo, + UF::inventory::AllowOverLevelEquipment }, - { // RoF - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF::invtype::InvTypePossessionsSize,*/ RoF::invtype::InvTypeBankSize, RoF::invtype::InvTypeSharedBankSize, RoF::invtype::InvTypeTradeSize, RoF::invtype::InvTypeWorldSize, - RoF::invtype::InvTypeLimboSize, RoF::invtype::InvTypeTributeSize, RoF::Null, /*RoF::invtype::InvTypeTrophyTributeSize,*/ RoF::Null, /*RoF::invtype::InvTypeGuildTributeSize,*/ RoF::invtype::InvTypeMerchantSize, - RoF::Null, /*RoF::invtype::InvTypeDeletedSize,*/ RoF::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF::invtype::InvTypeBazaarSize,*/ RoF::invtype::InvTypeInspectSize, RoF::Null, /*RoF::invtype::InvTypeRealEstateSize,*/ - RoF::invtype::InvTypeViewMODPCSize, RoF::invtype::InvTypeViewMODBankSize, RoF::invtype::InvTypeViewMODSharedBankSize, RoF::invtype::InvTypeViewMODLimboSize, RoF::invtype::InvTypeAltStorageSize, - RoF::invtype::InvTypeArchivedSize, RoF::invtype::InvTypeMailSize, RoF::invtype::InvTypeGuildTrophyTributeSize, RoF::Null, RoF::invtype::InvTypeOtherSize, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF::invtype::InvTypePossessionsSize,*/ + RoF::invtype::InvTypeBankSize, + RoF::invtype::InvTypeSharedBankSize, + RoF::invtype::InvTypeTradeSize, + RoF::invtype::InvTypeWorldSize, + RoF::invtype::InvTypeLimboSize, + RoF::invtype::InvTypeTributeSize, + RoF::Null, /*RoF::invtype::InvTypeTrophyTributeSize,*/ + RoF::Null, /*RoF::invtype::InvTypeGuildTributeSize,*/ + RoF::invtype::InvTypeMerchantSize, + RoF::Null, /*RoF::invtype::InvTypeDeletedSize,*/ + RoF::invtype::InvTypeCorpseSize, + EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF::invtype::InvTypeBazaarSize,*/ + RoF::invtype::InvTypeInspectSize, + RoF::Null, /*RoF::invtype::InvTypeRealEstateSize,*/ + RoF::invtype::InvTypeViewMODPCSize, + RoF::invtype::InvTypeViewMODBankSize, + RoF::invtype::InvTypeViewMODSharedBankSize, + RoF::invtype::InvTypeViewMODLimboSize, + RoF::invtype::InvTypeAltStorageSize, + RoF::invtype::InvTypeArchivedSize, + RoF::invtype::InvTypeMailSize, + RoF::invtype::InvTypeGuildTrophyTributeSize, + RoF::Null, + RoF::invtype::InvTypeOtherSize, - RoF::Null, /*0x00000003FFFFFFFF,*/ EQEmu::inventory::ContainerCount, /*RoF::invbag::ItemBagSize,*/ EQEmu::inventory::SocketCount, /*RoF::invaug::ItemAugSize,*/ + RoF::Null, /*0x00000003FFFFFFFF,*/ + EQEmu::inventory::ContainerCount, /*RoF::invbag::ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*RoF::invaug::ItemAugSize,*/ - RoF::False, /*RoF::inventory::AllowEmptyBagInBag,*/ RoF::inventory::AllowClickCastFromBag, RoF::inventory::ConcatenateInvTypeLimbo, RoF::inventory::AllowOverLevelEquipment + RoF::False, /*RoF::inventory::AllowEmptyBagInBag,*/ + RoF::inventory::AllowClickCastFromBag, + RoF::inventory::ConcatenateInvTypeLimbo, + RoF::inventory::AllowOverLevelEquipment }, - { // RoF2 - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF2::invtype::InvTypePossessionsSize,*/ RoF2::invtype::InvTypeBankSize, RoF2::invtype::InvTypeSharedBankSize, RoF2::invtype::InvTypeTradeSize, RoF2::invtype::InvTypeWorldSize, - RoF2::invtype::InvTypeLimboSize, RoF2::invtype::InvTypeTributeSize, RoF2::Null, /*RoF2::invtype::InvTypeTrophyTributeSize,*/ RoF2::Null, /*RoF2::invtype::InvTypeGuildTributeSize,*/ RoF2::invtype::InvTypeMerchantSize, - RoF2::Null, /*RoF2::invtype::InvTypeDeletedSize,*/ RoF2::invtype::InvTypeCorpseSize, EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF2::invtype::InvTypeBazaarSize,*/ RoF2::invtype::InvTypeInspectSize, RoF2::Null, /*RoF2::invtype::InvTypeRealEstateSize*/ - RoF2::invtype::InvTypeViewMODPCSize, RoF2::invtype::InvTypeViewMODBankSize, RoF2::invtype::InvTypeViewMODSharedBankSize, RoF2::invtype::InvTypeViewMODLimboSize, RoF2::invtype::InvTypeAltStorageSize, - RoF2::invtype::InvTypeArchivedSize, RoF2::invtype::InvTypeMailSize, RoF2::invtype::InvTypeGuildTrophyTributeSize, RoF2::invtype::InvTypeKronoSize, RoF2::invtype::InvTypeOtherSize, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF2::invtype::InvTypePossessionsSize,*/ + RoF2::invtype::InvTypeBankSize, + RoF2::invtype::InvTypeSharedBankSize, + RoF2::invtype::InvTypeTradeSize, + RoF2::invtype::InvTypeWorldSize, + RoF2::invtype::InvTypeLimboSize, + RoF2::invtype::InvTypeTributeSize, + RoF2::Null, /*RoF2::invtype::InvTypeTrophyTributeSize,*/ + RoF2::Null, /*RoF2::invtype::InvTypeGuildTributeSize,*/ + RoF2::invtype::InvTypeMerchantSize, + RoF2::Null, /*RoF2::invtype::InvTypeDeletedSize,*/ + RoF2::invtype::InvTypeCorpseSize, + EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF2::invtype::InvTypeBazaarSize,*/ + RoF2::invtype::InvTypeInspectSize, + RoF2::Null, /*RoF2::invtype::InvTypeRealEstateSize*/ + RoF2::invtype::InvTypeViewMODPCSize, + RoF2::invtype::InvTypeViewMODBankSize, + RoF2::invtype::InvTypeViewMODSharedBankSize, + RoF2::invtype::InvTypeViewMODLimboSize, + RoF2::invtype::InvTypeAltStorageSize, + RoF2::invtype::InvTypeArchivedSize, + RoF2::invtype::InvTypeMailSize, + RoF2::invtype::InvTypeGuildTrophyTributeSize, + RoF2::invtype::InvTypeKronoSize, + RoF2::invtype::InvTypeOtherSize, - RoF2::Null, /*0x00000003FFFFFFFF,*/ EQEmu::inventory::ContainerCount, /*RoF2::invbag::ItemBagSize,*/ EQEmu::inventory::SocketCount, /*RoF2::invaug::ItemAugSize,*/ + RoF2::Null, /*0x00000003FFFFFFFF,*/ + EQEmu::inventory::ContainerCount, /*RoF2::invbag::ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*RoF2::invaug::ItemAugSize,*/ - RoF2::False, /*RoF2::inventory::AllowEmptyBagInBag,*/ RoF2::inventory::AllowClickCastFromBag, RoF2::inventory::ConcatenateInvTypeLimbo, RoF2::inventory::AllowOverLevelEquipment + RoF2::False, /*RoF2::inventory::AllowEmptyBagInBag,*/ + RoF2::inventory::AllowClickCastFromBag, + RoF2::inventory::ConcatenateInvTypeLimbo, + RoF2::inventory::AllowOverLevelEquipment }, - { // NPC - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::InvTypeTradeSize, EntityLimits::NPC::Null, - EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, - EntityLimits::NPC::Null, EntityLimits::NPC::Null, /*InvTypeCorpseSize,*/ EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, - EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, - EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, EntityLimits::NPC::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::InvTypeTradeSize, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, /*InvTypeCorpseSize,*/ + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, + EntityLimits::NPC::Null, - EntityLimits::NPC::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::NPC::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::NPC::False, EntityLimits::NPC::False, EntityLimits::NPC::False, EntityLimits::NPC::False + EntityLimits::NPC::False, + EntityLimits::NPC::False, + EntityLimits::NPC::False, + EntityLimits::NPC::False }, - { // NPCMerchant - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::InvTypeTradeSize, EntityLimits::NPCMerchant::Null, - EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, - EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, /*InvTypeCorpseSize,*/ EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, - EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, - EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, EntityLimits::NPCMerchant::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::InvTypeTradeSize, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, /*InvTypeCorpseSize,*/ + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, + EntityLimits::NPCMerchant::Null, - EntityLimits::NPCMerchant::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::NPCMerchant::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::NPCMerchant::False, EntityLimits::NPCMerchant::False, EntityLimits::NPCMerchant::False, EntityLimits::NPCMerchant::False + EntityLimits::NPCMerchant::False, + EntityLimits::NPCMerchant::False, + EntityLimits::NPCMerchant::False, + EntityLimits::NPCMerchant::False }, - { // Merc - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::InvTypeTradeSize, EntityLimits::Merc::Null, - EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, - EntityLimits::Merc::Null, EntityLimits::Merc::Null, /*InvTypeCorpseSize,*/ EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, - EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, - EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, EntityLimits::Merc::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::InvTypeTradeSize, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, /*InvTypeCorpseSize,*/ + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, + EntityLimits::Merc::Null, - EntityLimits::Merc::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::Merc::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::Merc::False, EntityLimits::Merc::False, EntityLimits::Merc::False, EntityLimits::Merc::False + EntityLimits::Merc::False, + EntityLimits::Merc::False, + EntityLimits::Merc::False, + EntityLimits::Merc::False }, - { // Bot - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::InvTypeTradeSize, EntityLimits::Bot::Null, - EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, - EntityLimits::Bot::Null, EntityLimits::Bot::Null, /*InvTypeCorpseSize,*/ EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, - EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, - EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, EntityLimits::Bot::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::InvTypeTradeSize, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, /*InvTypeCorpseSize,*/ + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, + EntityLimits::Bot::Null, - EntityLimits::Bot::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::Bot::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::Bot::False, EntityLimits::Bot::False, EntityLimits::Bot::False, EntityLimits::Bot::False + EntityLimits::Bot::False, + EntityLimits::Bot::False, + EntityLimits::Bot::False, + EntityLimits::Bot::False }, - { // ClientPet - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::InvTypeTradeSize, EntityLimits::ClientPet::Null, - EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, - EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, - EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, - EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, EntityLimits::ClientPet::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::InvTypeTradeSize, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, /*InvTypeCorpseSize,*/ + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, + EntityLimits::ClientPet::Null, - EntityLimits::ClientPet::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::ClientPet::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::ClientPet::False, EntityLimits::ClientPet::False, EntityLimits::ClientPet::False, EntityLimits::ClientPet::False + EntityLimits::ClientPet::False, + EntityLimits::ClientPet::False, + EntityLimits::ClientPet::False, + EntityLimits::ClientPet::False }, - { // NPCPet - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::InvTypeTradeSize, EntityLimits::NPCPet::Null, - EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, - EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, - EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, - EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, EntityLimits::NPCPet::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::InvTypeTradeSize, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, /*InvTypeCorpseSize,*/ + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, + EntityLimits::NPCPet::Null, - EntityLimits::NPCPet::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::NPCPet::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::NPCPet::False, EntityLimits::NPCPet::False, EntityLimits::NPCPet::False, EntityLimits::NPCPet::False + EntityLimits::NPCPet::False, + EntityLimits::NPCPet::False, + EntityLimits::NPCPet::False, + EntityLimits::NPCPet::False }, - { // MercPet - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::InvTypeTradeSize, EntityLimits::MercPet::Null, - EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, - EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, - EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, - EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, EntityLimits::MercPet::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::InvTypeTradeSize, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, /*InvTypeCorpseSize,*/ + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, + EntityLimits::MercPet::Null, - EntityLimits::MercPet::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::MercPet::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::MercPet::False, EntityLimits::MercPet::False, EntityLimits::MercPet::False, EntityLimits::MercPet::False + EntityLimits::MercPet::False, + EntityLimits::MercPet::False, + EntityLimits::MercPet::False, + EntityLimits::MercPet::False }, - { // BotPet - EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::InvTypeTradeSize, EntityLimits::BotPet::Null, - EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, - EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, /*InvTypeCorpseSize,*/ EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, - EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, - EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, EntityLimits::BotPet::Null, + { + EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/ + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::InvTypeTradeSize, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, /*InvTypeCorpseSize,*/ + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, + EntityLimits::BotPet::Null, - EntityLimits::BotPet::Null, EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ EQEmu::inventory::SocketCount, /*ItemAugSize,*/ + EntityLimits::BotPet::Null, + EQEmu::inventory::ContainerCount, /*ItemBagSize,*/ + EQEmu::inventory::SocketCount, /*ItemAugSize,*/ - EntityLimits::BotPet::False, EntityLimits::BotPet::False, EntityLimits::BotPet::False, EntityLimits::BotPet::False + EntityLimits::BotPet::False, + EntityLimits::BotPet::False, + EntityLimits::BotPet::False, + EntityLimits::BotPet::False }, { // OfflineTitanium - Titanium::Null, Titanium::Null, Titanium::Null, Titanium::invtype::InvTypeTradeSize, Titanium::Null, - Titanium::Null, Titanium::Null, Titanium::Null, Titanium::Null, Titanium::invtype::InvTypeMerchantSize, - Titanium::Null, Titanium::Null, Titanium::Null, /*Titanium::invtype::InvTypeBazaarSize,*/ Titanium::invtype::InvTypeInspectSize, Titanium::Null, - Titanium::invtype::InvTypeViewMODPCSize, Titanium::invtype::InvTypeViewMODBankSize, Titanium::invtype::InvTypeViewMODSharedBankSize, Titanium::invtype::InvTypeViewMODLimboSize, Titanium::Null, - Titanium::Null, Titanium::Null, Titanium::Null, Titanium::Null, Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::invtype::InvTypeTradeSize, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::invtype::InvTypeMerchantSize, + Titanium::Null, + Titanium::Null, + Titanium::Null, /*Titanium::invtype::InvTypeBazaarSize,*/ + Titanium::invtype::InvTypeInspectSize, + Titanium::Null, + Titanium::invtype::InvTypeViewMODPCSize, + Titanium::invtype::InvTypeViewMODBankSize, + Titanium::invtype::InvTypeViewMODSharedBankSize, + Titanium::invtype::InvTypeViewMODLimboSize, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::Null, + Titanium::Null, - Titanium::Null, EQEmu::inventory::ContainerCount, /*Titanium::Null,*/ Titanium::Null, + Titanium::Null, + EQEmu::inventory::ContainerCount, /*Titanium::Null,*/ + Titanium::Null, - Titanium::False, Titanium::False, Titanium::False, Titanium::False + Titanium::False, + Titanium::False, + Titanium::False, + Titanium::False }, { // OfflineSoF - SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeTradeSize, SoF::Null, - SoF::Null, SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeMerchantSize, - SoF::Null, SoF::Null, SoF::Null, /*SoF::invtype::InvTypeBazaarSize,*/ SoF::invtype::InvTypeInspectSize, SoF::Null, - SoF::invtype::InvTypeViewMODPCSize, SoF::invtype::InvTypeViewMODBankSize, SoF::invtype::InvTypeViewMODSharedBankSize, SoF::invtype::InvTypeViewMODLimboSize, SoF::Null, - SoF::Null, SoF::Null, SoF::Null, SoF::Null, SoF::Null, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::invtype::InvTypeTradeSize, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::invtype::InvTypeMerchantSize, + SoF::Null, + SoF::Null, + SoF::Null, /*SoF::invtype::InvTypeBazaarSize,*/ + SoF::invtype::InvTypeInspectSize, + SoF::Null, + SoF::invtype::InvTypeViewMODPCSize, + SoF::invtype::InvTypeViewMODBankSize, + SoF::invtype::InvTypeViewMODSharedBankSize, + SoF::invtype::InvTypeViewMODLimboSize, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::Null, + SoF::Null, - SoF::Null, EQEmu::inventory::ContainerCount, /*SoF::Null,*/ SoF::Null, + SoF::Null, + EQEmu::inventory::ContainerCount, /*SoF::Null,*/ + SoF::Null, - SoF::False, SoF::False, SoF::False, SoF::False + SoF::False, + SoF::False, + SoF::False, + SoF::False }, { // OfflineSoD - SoD::Null, SoD::Null, SoD::Null, SoD::invtype::InvTypeTradeSize, SoD::Null, - SoD::Null, SoD::Null, SoD::Null, SoD::Null, SoD::invtype::InvTypeMerchantSize, - SoD::Null, SoD::Null, SoD::Null, /*SoD::invtype::InvTypeBazaarSize,*/ SoD::invtype::InvTypeInspectSize, SoD::Null, - SoD::invtype::InvTypeViewMODPCSize, SoD::invtype::InvTypeViewMODBankSize, SoD::invtype::InvTypeViewMODSharedBankSize, SoD::invtype::InvTypeViewMODLimboSize, SoD::Null, - SoD::Null, SoD::Null, SoD::Null, SoD::Null, SoD::Null, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::invtype::InvTypeTradeSize, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::invtype::InvTypeMerchantSize, + SoD::Null, + SoD::Null, + SoD::Null, /*SoD::invtype::InvTypeBazaarSize,*/ + SoD::invtype::InvTypeInspectSize, + SoD::Null, + SoD::invtype::InvTypeViewMODPCSize, + SoD::invtype::InvTypeViewMODBankSize, + SoD::invtype::InvTypeViewMODSharedBankSize, + SoD::invtype::InvTypeViewMODLimboSize, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::Null, + SoD::Null, - SoD::Null, EQEmu::inventory::ContainerCount, /*SoD::Null,*/ SoD::Null, + SoD::Null, + EQEmu::inventory::ContainerCount, /*SoD::Null,*/ + SoD::Null, - SoD::False, SoD::False, SoD::False, SoD::False + SoD::False, + SoD::False, + SoD::False, + SoD::False }, { // OfflineUF - UF::Null, UF::Null, UF::Null, UF::invtype::InvTypeTradeSize, UF::Null, - UF::Null, UF::Null, UF::Null, UF::Null, UF::invtype::InvTypeMerchantSize, - UF::Null, UF::Null, UF::Null, /*UF::invtype::InvTypeBazaarSize,*/ UF::invtype::InvTypeInspectSize, UF::Null, - UF::invtype::InvTypeViewMODPCSize, UF::invtype::InvTypeViewMODBankSize, UF::invtype::InvTypeViewMODSharedBankSize, UF::invtype::InvTypeViewMODLimboSize, UF::Null, - UF::Null, UF::Null, UF::Null, UF::Null, UF::Null, + UF::Null, + UF::Null, + UF::Null, + UF::invtype::InvTypeTradeSize, + UF::Null, + UF::Null, + UF::Null, + UF::Null, + UF::Null, + UF::invtype::InvTypeMerchantSize, + UF::Null, + UF::Null, + UF::Null, /*UF::invtype::InvTypeBazaarSize,*/ + UF::invtype::InvTypeInspectSize, + UF::Null, + UF::invtype::InvTypeViewMODPCSize, + UF::invtype::InvTypeViewMODBankSize, + UF::invtype::InvTypeViewMODSharedBankSize, + UF::invtype::InvTypeViewMODLimboSize, + UF::Null, + UF::Null, + UF::Null, + UF::Null, + UF::Null, + UF::Null, - UF::Null, EQEmu::inventory::ContainerCount, /*UF::Null,*/ UF::Null, + UF::Null, + EQEmu::inventory::ContainerCount, /*UF::Null,*/ + UF::Null, - UF::False, UF::False, UF::False, UF::False + UF::False, + UF::False, + UF::False, + UF::False }, { // OfflineRoF - RoF::Null, RoF::Null, RoF::Null, RoF::invtype::InvTypeTradeSize, RoF::Null, - RoF::Null, RoF::Null, RoF::Null, RoF::Null, RoF::invtype::InvTypeMerchantSize, - RoF::Null, RoF::Null, RoF::Null, /*RoF::invtype::InvTypeBazaarSize,*/ RoF::invtype::InvTypeInspectSize, RoF::Null, - RoF::invtype::InvTypeViewMODPCSize, RoF::invtype::InvTypeViewMODBankSize, RoF::invtype::InvTypeViewMODSharedBankSize, RoF::invtype::InvTypeViewMODLimboSize, RoF::Null, - RoF::Null, RoF::Null, RoF::Null, RoF::Null, RoF::Null, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::invtype::InvTypeTradeSize, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::invtype::InvTypeMerchantSize, + RoF::Null, + RoF::Null, + RoF::Null, /*RoF::invtype::InvTypeBazaarSize,*/ + RoF::invtype::InvTypeInspectSize, + RoF::Null, + RoF::invtype::InvTypeViewMODPCSize, + RoF::invtype::InvTypeViewMODBankSize, + RoF::invtype::InvTypeViewMODSharedBankSize, + RoF::invtype::InvTypeViewMODLimboSize, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::Null, + RoF::Null, - RoF::Null, EQEmu::inventory::ContainerCount, /*RoF::Null,*/ RoF::Null, + RoF::Null, + EQEmu::inventory::ContainerCount, /*RoF::Null,*/ + RoF::Null, - RoF::False, RoF::False, RoF::False, RoF::False + RoF::False, + RoF::False, + RoF::False, + RoF::False }, { // OfflineRoF2 - RoF2::Null, RoF2::Null, RoF2::Null, RoF2::invtype::InvTypeTradeSize, RoF2::Null, - RoF2::Null, RoF2::Null, RoF2::Null, RoF2::Null, RoF2::invtype::InvTypeMerchantSize, - RoF2::Null, RoF2::Null, RoF2::Null, /*RoF2::invtype::InvTypeBazaarSize,*/ RoF2::invtype::InvTypeInspectSize, RoF2::Null, - RoF2::invtype::InvTypeViewMODPCSize, RoF2::invtype::InvTypeViewMODBankSize, RoF2::invtype::InvTypeViewMODSharedBankSize, RoF2::invtype::InvTypeViewMODLimboSize, RoF2::Null, - RoF2::Null, RoF2::Null, RoF2::Null, RoF2::Null, RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::invtype::InvTypeTradeSize, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::invtype::InvTypeMerchantSize, + RoF2::Null, + RoF2::Null, + RoF2::Null, /*RoF2::invtype::InvTypeBazaarSize,*/ + RoF2::invtype::InvTypeInspectSize, + RoF2::Null, + RoF2::invtype::InvTypeViewMODPCSize, + RoF2::invtype::InvTypeViewMODBankSize, + RoF2::invtype::InvTypeViewMODSharedBankSize, + RoF2::invtype::InvTypeViewMODLimboSize, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::Null, + RoF2::Null, - RoF2::Null, EQEmu::inventory::ContainerCount, /*RoF2::Null,*/ RoF2::Null, + RoF2::Null, + EQEmu::inventory::ContainerCount, /*RoF2::Null,*/ + RoF2::Null, - RoF2::False, RoF2::False, RoF2::False, RoF2::False + RoF2::False, + RoF2::False, + RoF2::False, + RoF2::False } }; -const EQEmu::inventory::LookupEntry* EQEmu::inventory::Lookup(versions::InventoryVersion inventory_version) +const EQEmu::inventory::LookupEntry* EQEmu::inventory::Lookup(versions::MobVersion mob_version) { - return &inventory_lookup_entries[static_cast(versions::ValidateInventoryVersion(inventory_version))]; + return &inventory_lookup_entries[static_cast(versions::ValidateMobVersion(mob_version))]; } -static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::versions::InventoryVersionCount] = +static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::versions::MobVersionCount] = { { // Unknown ClientUnknown::True @@ -375,7 +921,7 @@ static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::version } }; -const EQEmu::behavior::LookupEntry* EQEmu::behavior::Lookup(versions::InventoryVersion inventory_version) +const EQEmu::behavior::LookupEntry* EQEmu::behavior::Lookup(versions::MobVersion mob_version) { - return &behavior_lookup_entries[static_cast(versions::ValidateInventoryVersion(inventory_version))]; + return &behavior_lookup_entries[static_cast(versions::ValidateMobVersion(mob_version))]; } diff --git a/common/eq_limits.h b/common/eq_limits.h index da1df17db..72d710998 100644 --- a/common/eq_limits.h +++ b/common/eq_limits.h @@ -59,7 +59,7 @@ namespace EQEmu bool AllowOverLevelEquipment; }; - const LookupEntry* Lookup(versions::InventoryVersion inventory_version); + const LookupEntry* Lookup(versions::MobVersion mob_version); } /*inventory*/ @@ -69,7 +69,7 @@ namespace EQEmu bool CoinHasWeight; }; - const LookupEntry* Lookup(versions::InventoryVersion inventory_version); + const LookupEntry* Lookup(versions::MobVersion mob_version); } /*behavior*/ diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp index c952392b1..03b1df4e0 100644 --- a/common/inventory_profile.cpp +++ b/common/inventory_profile.cpp @@ -911,7 +911,7 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id) } else if (slot_id >= legacy::GENERAL_BAGS_BEGIN && slot_id <= legacy::GENERAL_BAGS_END) { - if (inventory::Lookup(m_inventory_version)->AllowClickCastFromBag) + if (inventory::Lookup(m_mob_version)->AllowClickCastFromBag) return true; } diff --git a/common/inventory_profile.h b/common/inventory_profile.h index 0f90fdea2..336bb47d8 100644 --- a/common/inventory_profile.h +++ b/common/inventory_profile.h @@ -85,22 +85,21 @@ namespace EQEmu // Public Methods /////////////////////////////// - InventoryProfile() { m_inventory_version = versions::InventoryVersion::Unknown; m_inventory_version_set = false; } + InventoryProfile() { m_mob_version = versions::MobVersion::Unknown; m_mob_version_set = false; } ~InventoryProfile(); - // inv2 creep - bool SetInventoryVersion(versions::InventoryVersion inventory_version) { - if (!m_inventory_version_set) { - m_inventory_version = versions::ValidateInventoryVersion(inventory_version); - return (m_inventory_version_set = true); + bool SetInventoryVersion(versions::MobVersion inventory_version) { + if (!m_mob_version_set) { + m_mob_version = versions::ValidateMobVersion(inventory_version); + return (m_mob_version_set = true); } else { return false; } } - bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToInventoryVersion(client_version)); } + bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToMobVersion(client_version)); } - versions::InventoryVersion InventoryVersion() { return m_inventory_version; } + versions::MobVersion InventoryVersion() { return m_mob_version; } static void CleanDirty(); static void MarkDirty(ItemInstance *inst); @@ -222,9 +221,9 @@ namespace EQEmu ::ItemInstQueue m_cursor; // Items on cursor: FIFO private: - // Active inventory version - versions::InventoryVersion m_inventory_version; - bool m_inventory_version_set; + // Active mob version + versions::MobVersion m_mob_version; + bool m_mob_version_set; }; } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index f2205aabd..d9914fb26 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1369,7 +1369,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::behavior::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(ClientVersion()))->CoinHasWeight) { + if (EQEmu::behavior::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion()))->CoinHasWeight) { 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; diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 3b9c15214..34a2191b2 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -999,7 +999,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(client->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; + int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(client->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; @@ -1294,7 +1294,7 @@ void Corpse::QueryLoot(Client* to) { cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToInventoryVersion(to->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; + int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(to->ClientVersion()))->InventoryTypeSize[EQEmu::inventory::typeCorpse]; for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; From ec548874cc0d98971daa42a2924a24f9ea83908b Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 17 Oct 2016 11:06:16 -0400 Subject: [PATCH 29/65] Another windows laxity... --- common/item_instance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/item_instance.cpp b/common/item_instance.cpp index 61b9d3243..ab109bb41 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -27,7 +27,7 @@ //#include "../common/light_source.h" -//#include +#include //#include From d62ceaefcc1f9fb929027b1747d8021c94b57a8f Mon Sep 17 00:00:00 2001 From: Kurt Gilpin Date: Mon, 17 Oct 2016 18:57:35 -0500 Subject: [PATCH 30/65] Rule to grant HoTT ability on character create --- common/database.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 66ac8495b..423bbac58 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -638,6 +638,13 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4 ); results = QueryDatabase(query); + /* HoTT Ability */ + if(RuleB(Character, GrantHoTTOnCreate)) + { + query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, rank) VALUES (%u, %i, %i)", character_id, 14, 1); + results = QueryDatabase(query); + } + /* Save Skills */ int firstquery = 0; for (int i = 0; i < MAX_PP_SKILL; i++){ @@ -2159,4 +2166,4 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) { } return 0; -} \ No newline at end of file +} From d1f7448b25bda0c3340404c58e2a70eef7fd766d Mon Sep 17 00:00:00 2001 From: Kurt Gilpin Date: Mon, 17 Oct 2016 18:58:52 -0500 Subject: [PATCH 31/65] Rule for HoTT grant. Defaults to false --- common/ruletypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index bf35d03e8..3b3816201 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -147,7 +147,7 @@ RULE_BOOL(Character, EnableAvoidanceCap, false) RULE_INT(Character, AvoidanceCap, 750) // 750 Is a pretty good value, seen people dodge all attacks beyond 1,000 Avoidance RULE_BOOL(Character, AllowMQTarget, false) // Disables putting players in the 'hackers' list for targeting beyond the clip plane or attempting to target something untargetable RULE_BOOL(Character, UseOldBindWound, false) // Uses the original bind wound behavior - +RULE_BOOL(Character, GrantHoTTOnCreate, false) // Grant Health of Target's Target leadership AA on character creation RULE_CATEGORY_END() RULE_CATEGORY(Mercs) From e3e20a947bed9a199830e093b66d58d945074946 Mon Sep 17 00:00:00 2001 From: Kurt Gilpin Date: Mon, 17 Oct 2016 19:00:08 -0500 Subject: [PATCH 32/65] Create 2016_10_17_GrantHoTTOnCharacterCreate.sql --- utils/sql/git/optional/2016_10_17_GrantHoTTOnCharacterCreate.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 utils/sql/git/optional/2016_10_17_GrantHoTTOnCharacterCreate.sql diff --git a/utils/sql/git/optional/2016_10_17_GrantHoTTOnCharacterCreate.sql b/utils/sql/git/optional/2016_10_17_GrantHoTTOnCharacterCreate.sql new file mode 100644 index 000000000..eeb73c293 --- /dev/null +++ b/utils/sql/git/optional/2016_10_17_GrantHoTTOnCharacterCreate.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Character:GrantHoTTOnCreate', 'false', 'Grant Health of Target\'s Target leadership AA on character creation'); From 16fa32e65bf7dcecc4a90cbc449a9195f4cb8039 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 18 Oct 2016 14:16:53 -0500 Subject: [PATCH 33/65] Update eqemu_server.pl [skip ci] --- utils/scripts/eqemu_server.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index 4fd6bb796..c39ddd37e 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -939,18 +939,18 @@ sub check_db_version_table{ sub get_mysql_result{ my $run_query = $_[0]; if(!$db){ return; } - if($OS eq "Windows"){ return `"$path" --host $host --user $user --password="$pass" $db -N -B -e "$run_query"`; } + if($OS eq "Windows"){ return `"$path" --host "$host" --user "$user" --password="$pass" $db -N -B -e "$run_query"`; } if($OS eq "Linux"){ $run_query =~s/`//g; - return `$path --user="$user" --host $host --password="$pass" $db -N -B -e "$run_query"`; + return `$path --user="$user" --host "$host" --password="$pass" $db -N -B -e "$run_query"`; } } sub get_mysql_result_from_file{ my $update_file = $_[0]; if(!$db){ return; } - if($OS eq "Windows"){ return `"$path" --host $host --user $user --password="$pass" --force $db < $update_file`; } - if($OS eq "Linux"){ return `"$path" --host $host --user $user --password="$pass" --force $db < $update_file`; } + if($OS eq "Windows"){ return `"$path" --host "$host" --user "$user" --password="$pass" --force $db < $update_file`; } + if($OS eq "Linux"){ return `"$path" --host "$host" --user "$user" --password="$pass" --force $db < $update_file`; } } #::: Gets Remote File based on request_url (1st Arg), and saves to destination file (2nd Arg) From 6e0cba566fedac2f8ccb425cb77cb6d681d30792 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 18 Oct 2016 17:09:07 -0400 Subject: [PATCH 34/65] Added 'sow' argument to bot_command_movement_speed --- zone/bot_command.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 72ac6cae4..17182451f 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -3397,15 +3397,18 @@ void bot_command_movement_speed(Client *c, const Seperator *sep) if (helper_spell_list_fail(c, local_list, BCEnum::SpT_MovementSpeed) || helper_command_alias_fail(c, "bot_command_movement_speed", sep->arg[0], "movementspeed")) return; if (helper_is_help_or_usage(sep->arg[1])) { - c->Message(m_usage, "usage: () %s ([group])", sep->arg[0]); + c->Message(m_usage, "usage: () %s ([group | sow])", sep->arg[0]); helper_send_usage_required_bots(c, BCEnum::SpT_MovementSpeed); return; } bool group = false; - std::string group_arg = sep->arg[1]; - if (!group_arg.compare("group")) + bool sow = false; + std::string arg1 = sep->arg[1]; + if (!arg1.compare("group")) group = true; + else if (!arg1.compare("sow")) + sow = true; ActionableTarget::Types actionable_targets; Bot* my_bot = nullptr; @@ -3417,7 +3420,9 @@ void bot_command_movement_speed(Client *c, const Seperator *sep) auto local_entry = list_iter->SafeCastToMovementSpeed(); if (helper_spell_check_fail(local_entry)) continue; - if (local_entry->group != group) + if (!sow && (local_entry->group != group)) + continue; + if (sow && (local_entry->spell_id != 278)) // '278' = single-target "Spirit of Wolf" continue; auto target_mob = actionable_targets.Select(c, local_entry->target_type, FRIENDLY); From fe968f83a33695e7cfbb365daa4f5facbe54e2cf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 18 Oct 2016 16:21:21 -0500 Subject: [PATCH 35/65] Update eqemu_server.pl [skip ci] - undo previous quote commit --- utils/scripts/eqemu_server.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index c39ddd37e..4fd6bb796 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -939,18 +939,18 @@ sub check_db_version_table{ sub get_mysql_result{ my $run_query = $_[0]; if(!$db){ return; } - if($OS eq "Windows"){ return `"$path" --host "$host" --user "$user" --password="$pass" $db -N -B -e "$run_query"`; } + if($OS eq "Windows"){ return `"$path" --host $host --user $user --password="$pass" $db -N -B -e "$run_query"`; } if($OS eq "Linux"){ $run_query =~s/`//g; - return `$path --user="$user" --host "$host" --password="$pass" $db -N -B -e "$run_query"`; + return `$path --user="$user" --host $host --password="$pass" $db -N -B -e "$run_query"`; } } sub get_mysql_result_from_file{ my $update_file = $_[0]; if(!$db){ return; } - if($OS eq "Windows"){ return `"$path" --host "$host" --user "$user" --password="$pass" --force $db < $update_file`; } - if($OS eq "Linux"){ return `"$path" --host "$host" --user "$user" --password="$pass" --force $db < $update_file`; } + if($OS eq "Windows"){ return `"$path" --host $host --user $user --password="$pass" --force $db < $update_file`; } + if($OS eq "Linux"){ return `"$path" --host $host --user $user --password="$pass" --force $db < $update_file`; } } #::: Gets Remote File based on request_url (1st Arg), and saves to destination file (2nd Arg) From 97999a63b7a0bdecaabab534e1cb4e37d31e960e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 18 Oct 2016 16:49:47 -0500 Subject: [PATCH 36/65] Update eqemu_server.pl [skip ci] - Fix eqemu_config.xml tag parsing scenarios --- utils/scripts/eqemu_server.pl | 80 ++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index 4fd6bb796..b27aac310 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -1063,46 +1063,50 @@ sub trim { } sub read_eqemu_config_xml { - open (CONFIG, "eqemu_config.xml"); - while (){ - chomp; - $o = $_; + open (CONFIG, "eqemu_config.xml"); + while (){ + chomp; + $o = $_; - if($o=~/\<\!--/i){ - next; - } + if($o=~/\<\!--/i){ + next; + } + + if($o=~/database/i && $o=~/\<\//i){ + $in_database_tag = 0; + } + if($o=~//i){ + print "IN DATABASE TAG\n" if $debug; + $in_database_tag = 1; + } + if($o=~//i){ + ($long_name) = $o =~ /(.*)<\/longname>/; + print "Long Name: '" . $long_name . "'\n" if $debug; + } + if($in_database_tag == 1){ + @left = split (">", $o); + @right = split("<", $left[1]); + $tag_data = trim($right[0]); - if($o=~/database/i && $o=~/\<\//i){ - $in_database_tag = 0; - } - if($o=~/\/i){ - print "IN DATABASE TAG\n" if $debug; - $in_database_tag = 1; - } - if($o=~/\/i){ - ($long_name) = $o =~ /(.*)<\/longname>/; - print "Long Name: " . $long_name . "\n" if $debug; - } - if($in_database_tag == 1){ - if($o=~/\/i && $in_database_tag){ - ($user) = $o =~ />(\w+)/i && $in_database_tag){ - ($pass) = $o =~ />(\w+)/i){ - ($db) = $o =~ />(\w+)/i){ - ($host) = $o =~ />(\w+)/i && $in_database_tag){ + $user = $tag_data; + print "Database User: '" . $user . "'\n" if $debug; + } + if($o=~//i && $in_database_tag){ + $pass = $tag_data; + print "Database Pass: '" . $pass . "'\n" if $debug; + } + if($o=~//i){ + $db = $tag_data; + print "Database Name: '" . $db . "'\n" if $debug; + } + if($o=~//i){ + $host = $tag_data; + print "Database Host: '" . $host . "'\n" if $debug; + } + } + } + close(CONFIG); } #::: Fetch Latest PEQ AA's From 409bad8108473b290d0d203b945a7afaf45fe9f6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 18 Oct 2016 16:52:51 -0500 Subject: [PATCH 37/65] Update eqemu_server.pl [skip ci] - not sure why formatting is getting thrown off --- utils/scripts/eqemu_server.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index b27aac310..dd0448ddc 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -1076,21 +1076,21 @@ sub read_eqemu_config_xml { $in_database_tag = 0; } if($o=~//i){ - print "IN DATABASE TAG\n" if $debug; - $in_database_tag = 1; + print "IN DATABASE TAG\n" if $debug; + $in_database_tag = 1; } if($o=~//i){ - ($long_name) = $o =~ /(.*)<\/longname>/; - print "Long Name: '" . $long_name . "'\n" if $debug; + ($long_name) = $o =~ /(.*)<\/longname>/; + print "Long Name: '" . $long_name . "'\n" if $debug; } if($in_database_tag == 1){ - @left = split (">", $o); - @right = split("<", $left[1]); - $tag_data = trim($right[0]); + @left = split (">", $o); + @right = split("<", $left[1]); + $tag_data = trim($right[0]); if($o=~//i && $in_database_tag){ - $user = $tag_data; - print "Database User: '" . $user . "'\n" if $debug; + $user = $tag_data; + print "Database User: '" . $user . "'\n" if $debug; } if($o=~//i && $in_database_tag){ $pass = $tag_data; @@ -1101,8 +1101,8 @@ sub read_eqemu_config_xml { print "Database Name: '" . $db . "'\n" if $debug; } if($o=~//i){ - $host = $tag_data; - print "Database Host: '" . $host . "'\n" if $debug; + $host = $tag_data; + print "Database Host: '" . $host . "'\n" if $debug; } } } From 752821f22bd20736cdb31e52d0ae0567e490b01a Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 20 Oct 2016 16:36:46 -0400 Subject: [PATCH 38/65] Added proximity data report to npcstats command --- zone/command.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index d75dec901..718feedcc 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1471,16 +1471,29 @@ void command_npcstats(Client *c, const Seperator *sep) else if (!c->GetTarget()->IsNPC()) c->Message(0, "ERROR: Target is not a NPC!"); else { + auto target_npc = c->GetTarget()->CastToNPC(); c->Message(0, "NPC Stats:"); - c->Message(0, "Name: %s NpcID: %u", c->GetTarget()->GetName(), c->GetTarget()->GetNPCTypeID()); - c->Message(0, "Race: %i Level: %i Class: %i Material: %i", c->GetTarget()->GetRace(), c->GetTarget()->GetLevel(), c->GetTarget()->GetClass(), c->GetTarget()->GetTexture()); - c->Message(0, "Current HP: %i Max HP: %i", c->GetTarget()->GetHP(), c->GetTarget()->GetMaxHP()); - //c->Message(0, "Weapon Item Number: %s", c->GetTarget()->GetWeapNo()); - c->Message(0, "Gender: %i Size: %f Bodytype: %d", c->GetTarget()->GetGender(), c->GetTarget()->GetSize(), c->GetTarget()->GetBodyType()); - c->Message(0, "Runspeed: %.3f Walkspeed: %.3f", static_cast(0.025f * c->GetTarget()->GetRunspeed()), static_cast(0.025f * c->GetTarget()->GetWalkspeed())); - c->Message(0, "Spawn Group: %i Grid: %i", c->GetTarget()->CastToNPC()->GetSp2(), c->GetTarget()->CastToNPC()->GetGrid()); - c->Message(0, "EmoteID: %i", c->GetTarget()->CastToNPC()->GetEmoteID()); - c->GetTarget()->CastToNPC()->QueryLoot(c); + c->Message(0, "Name: %s NpcID: %u", target_npc->GetName(), target_npc->GetNPCTypeID()); + c->Message(0, "Race: %i Level: %i Class: %i Material: %i", target_npc->GetRace(), target_npc->GetLevel(), target_npc->GetClass(), target_npc->GetTexture()); + c->Message(0, "Current HP: %i Max HP: %i", target_npc->GetHP(), target_npc->GetMaxHP()); + //c->Message(0, "Weapon Item Number: %s", target_npc->GetWeapNo()); + c->Message(0, "Gender: %i Size: %f Bodytype: %d", target_npc->GetGender(), target_npc->GetSize(), target_npc->GetBodyType()); + c->Message(0, "Runspeed: %.3f Walkspeed: %.3f", static_cast(0.025f * target_npc->GetRunspeed()), static_cast(0.025f * target_npc->GetWalkspeed())); + c->Message(0, "Spawn Group: %i Grid: %i", target_npc->GetSp2(), target_npc->GetGrid()); + if (target_npc->proximity) { + c->Message(0, "Proximity: Enabled"); + c->Message(0, "Cur_X: %1.3f, Cur_Y: %1.3f, Cur_Z: %1.3f", target_npc->GetX(), target_npc->GetY(), target_npc->GetZ()); + c->Message(0, "Min_X: %1.3f(%1.3f), Max_X: %1.3f(%1.3f), X_Range: %1.3f", target_npc->proximity->min_x, (target_npc->proximity->min_x - target_npc->GetX()), target_npc->proximity->max_x, (target_npc->proximity->max_x - target_npc->GetX()), (target_npc->proximity->max_x - target_npc->proximity->min_x)); + c->Message(0, "Min_Y: %1.3f(%1.3f), Max_Y: %1.3f(%1.3f), Y_Range: %1.3f", target_npc->proximity->min_y, (target_npc->proximity->min_y - target_npc->GetY()), target_npc->proximity->max_y, (target_npc->proximity->max_y - target_npc->GetY()), (target_npc->proximity->max_y - target_npc->proximity->min_y)); + c->Message(0, "Min_Z: %1.3f(%1.3f), Max_Z: %1.3f(%1.3f), Z_Range: %1.3f", target_npc->proximity->min_z, (target_npc->proximity->min_z - target_npc->GetZ()), target_npc->proximity->max_z, (target_npc->proximity->max_z - target_npc->GetZ()), (target_npc->proximity->max_z - target_npc->proximity->min_z)); + c->Message(0, "Say: %s", (target_npc->proximity->say ? "Enabled" : "Disabled")); + } + else { + c->Message(0, "Proximity: Disabled"); + } + c->Message(0, ""); + c->Message(0, "EmoteID: %i", target_npc->GetEmoteID()); + target_npc->QueryLoot(c); } } From 6abed18eb9508f702e916c6d0880df71cdb7e1c2 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Thu, 20 Oct 2016 21:10:07 -0400 Subject: [PATCH 39/65] Added augment support for NPC AddItem() and quest::addloot in Perl/Lua. This will allow you to add items to NPCs with scripts that already have augments in them. --- zone/loottables.cpp | 18 +++++++++--------- zone/lua_npc.cpp | 36 ++++++++++++++++++++++++++++++++++++ zone/lua_npc.h | 6 ++++++ zone/npc.h | 4 ++-- zone/perl_npc.cpp | 26 ++++++++++++++++++++++---- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 2 +- 7 files changed, 78 insertions(+), 18 deletions(-) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 4dae50960..03f1590b1 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -221,7 +221,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml } //if itemlist is null, just send wear changes -void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange) { +void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) { if(item2 == nullptr) return; @@ -245,12 +245,12 @@ void NPC::AddLootDrop(const EQEmu::ItemData *item2, ItemList* itemlist, int16 ch item->item_id = item2->ID; item->charges = charges; - item->aug_1 = 0; - item->aug_2 = 0; - item->aug_3 = 0; - item->aug_4 = 0; - item->aug_5 = 0; - item->aug_6 = 0; + item->aug_1 = aug1; + item->aug_2 = aug2; + item->aug_3 = aug3; + item->aug_4 = aug4; + item->aug_5 = aug5; + item->aug_6 = aug6; item->attuned = 0; item->min_level = minlevel; item->max_level = maxlevel; @@ -420,12 +420,12 @@ void NPC::AddItem(const EQEmu::ItemData* item, uint16 charges, bool equipitem) { AddLootDrop(item, &itemlist, charges, 1, 255, equipitem, equipitem); } -void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem) { +void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) { //slot isnt needed, its determined from the item. const EQEmu::ItemData * i = database.GetItem(itemid); if(i == nullptr) return; - AddLootDrop(i, &itemlist, charges, 1, 255, equipitem, equipitem); + AddLootDrop(i, &itemlist, charges, 1, 255, equipitem, equipitem, aug1, aug2, aug3, aug4, aug5, aug6); } void NPC::AddLootTable() { diff --git a/zone/lua_npc.cpp b/zone/lua_npc.cpp index 6d6c69a62..9ed705496 100644 --- a/zone/lua_npc.cpp +++ b/zone/lua_npc.cpp @@ -27,6 +27,36 @@ void Lua_NPC::AddItem(int item_id, int charges, bool equip) { self->AddItem(item_id, charges, equip); } +void Lua_NPC::AddItem(int item_id, int charges, bool equip, int aug1) { + Lua_Safe_Call_Void(); + self->AddItem(item_id, charges, equip, aug1); +} + +void Lua_NPC::AddItem(int item_id, int charges, bool equip, int aug1, int aug2) { + Lua_Safe_Call_Void(); + self->AddItem(item_id, charges, equip, aug1, aug2); +} + +void Lua_NPC::AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3) { + Lua_Safe_Call_Void(); + self->AddItem(item_id, charges, equip, aug1, aug2, aug3); +} + +void Lua_NPC::AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3, int aug4) { + Lua_Safe_Call_Void(); + self->AddItem(item_id, charges, equip, aug1, aug2, aug3, aug4); +} + +void Lua_NPC::AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3, int aug4, int aug5) { + Lua_Safe_Call_Void(); + self->AddItem(item_id, charges, equip, aug1, aug2, aug3, aug4, aug5); +} + +void Lua_NPC::AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3, int aug4, int aug5, int aug6) { + Lua_Safe_Call_Void(); + self->AddItem(item_id, charges, equip, aug1, aug2, aug3, aug4, aug5, aug6); +} + void Lua_NPC::AddLootTable() { Lua_Safe_Call_Void(); self->AddLootTable(); @@ -475,6 +505,12 @@ luabind::scope lua_register_npc() { .def("CheckNPCFactionAlly", (int(Lua_NPC::*)(int))&Lua_NPC::CheckNPCFactionAlly) .def("AddItem", (void(Lua_NPC::*)(int,int))&Lua_NPC::AddItem) .def("AddItem", (void(Lua_NPC::*)(int,int,bool))&Lua_NPC::AddItem) + .def("AddItem", (void(Lua_NPC::*)(int,int,bool,int))&Lua_NPC::AddItem) + .def("AddItem", (void(Lua_NPC::*)(int,int,bool,int,int))&Lua_NPC::AddItem) + .def("AddItem", (void(Lua_NPC::*)(int,int,bool,int,int,int))&Lua_NPC::AddItem) + .def("AddItem", (void(Lua_NPC::*)(int,int,bool,int,int,int,int))&Lua_NPC::AddItem) + .def("AddItem", (void(Lua_NPC::*)(int,int,bool,int,int,int,int,int))&Lua_NPC::AddItem) + .def("AddItem", (void(Lua_NPC::*)(int,int,bool,int,int,int,int,int,int))&Lua_NPC::AddItem) .def("AddLootTable", (void(Lua_NPC::*)(void))&Lua_NPC::AddLootTable) .def("AddLootTable", (void(Lua_NPC::*)(int))&Lua_NPC::AddLootTable) .def("RemoveItem", (void(Lua_NPC::*)(int))&Lua_NPC::RemoveItem) diff --git a/zone/lua_npc.h b/zone/lua_npc.h index f5bb4719d..e355c3e4d 100644 --- a/zone/lua_npc.h +++ b/zone/lua_npc.h @@ -31,6 +31,12 @@ public: int CheckNPCFactionAlly(int faction); void AddItem(int item_id, int charges); void AddItem(int item_id, int charges, bool equip); + void AddItem(int item_id, int charges, bool equip, int aug1); + void AddItem(int item_id, int charges, bool equip, int aug1, int aug2); + void AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3); + void AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3, int aug4); + void AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3, int aug4, int aug5); + void AddItem(int item_id, int charges, bool equip, int aug1, int aug2, int aug3, int aug4, int aug5, int aug6); void AddLootTable(); void AddLootTable(int id); void RemoveItem(int item_id); diff --git a/zone/npc.h b/zone/npc.h index ba9e93843..4b81d45a6 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -179,7 +179,7 @@ public: virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); void AddItem(const EQEmu::ItemData* item, uint16 charges, bool equipitem = true); - void AddItem(uint32 itemid, uint16 charges, bool equipitem = true); + void AddItem(uint32 itemid, uint16 charges, bool equipitem = true, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0); void AddLootTable(); void AddLootTable(uint32 ldid); void DescribeAggro(Client *towho, Mob *mob, bool verbose); @@ -270,7 +270,7 @@ public: bool IsTaunting() const { return taunting; } void PickPocket(Client* thief); void StartSwarmTimer(uint32 duration) { swarm_timer.Start(duration); } - void AddLootDrop(const EQEmu::ItemData*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); + void AddLootDrop(const EQEmu::ItemData*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0); virtual void DoClassAttacks(Mob *target); void CheckSignal(); inline bool IsNotTargetableWithHotkey() const { return no_target_hotkey; } diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 0c9cec797..64e71d82f 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -98,13 +98,19 @@ XS(XS_NPC_AddItem); /* prototype to pass -Wmissing-prototypes */ XS(XS_NPC_AddItem) { dXSARGS; - if (items < 2 || items > 4) - Perl_croak(aTHX_ "Usage: NPC::AddItem(THIS, itemid, charges = 0, equipitem = true)"); + if (items < 2 || items > 10) + Perl_croak(aTHX_ "Usage: NPC::AddItem(THIS, itemid, charges = 0, equipitem = true, aug1 = 0, aug2 = 0, aug3 = 0, aug4 = 0, aug5 = 0, aug6 = 0)"); { NPC * THIS; uint32 itemid = (uint32)SvUV(ST(1)); uint16 charges = 0; bool equipitem = true; + uint32 aug1 = 0; + uint32 aug2 = 0; + uint32 aug3 = 0; + uint32 aug4 = 0; + uint32 aug5 = 0; + uint32 aug6 = 0; if (sv_derived_from(ST(0), "NPC")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -119,8 +125,20 @@ XS(XS_NPC_AddItem) charges = (uint16)SvUV(ST(2)); if (items > 3) equipitem = (bool)SvTRUE(ST(3)); + if (items > 4) + aug1 = (uint32)SvUV(ST(4)); + if (items > 5) + aug2 = (uint32)SvUV(ST(5)); + if (items > 6) + aug3 = (uint32)SvUV(ST(6)); + if (items > 7) + aug4 = (uint32)SvUV(ST(7)); + if (items > 8) + aug5 = (uint32)SvUV(ST(8)); + if (items > 9) + aug6 = (uint32)SvUV(ST(9)); - THIS->AddItem(itemid, charges, equipitem); + THIS->AddItem(itemid, charges, equipitem, aug1, aug2, aug3, aug4, aug5, aug6); } XSRETURN_EMPTY; } @@ -2577,7 +2595,7 @@ XS(boot_NPC) newXSproto(strcpy(buf, "SignalNPC"), XS_NPC_SignalNPC, file, "$$"); newXSproto(strcpy(buf, "CheckNPCFactionAlly"), XS_NPC_CheckNPCFactionAlly, file, "$$"); - newXSproto(strcpy(buf, "AddItem"), XS_NPC_AddItem, file, "$$;$$"); + newXSproto(strcpy(buf, "AddItem"), XS_NPC_AddItem, file, "$$;$$$$$$$$"); newXSproto(strcpy(buf, "AddLootTable"), XS_NPC_AddLootTable, file, "$"); newXSproto(strcpy(buf, "RemoveItem"), XS_NPC_RemoveItem, file, "$$;$$"); newXSproto(strcpy(buf, "ClearItemList"), XS_NPC_ClearItemList, file, "$"); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 1df7492c2..4668a1bbc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -375,11 +375,11 @@ void QuestManager::selfcast(int spell_id) { initiator->SpellFinished(spell_id, initiator, EQEmu::CastingSlot::Item, 0, -1, spells[spell_id].ResistDiff); } -void QuestManager::addloot(int item_id, int charges, bool equipitem) { +void QuestManager::addloot(int item_id, int charges, bool equipitem, int aug1, int aug2, int aug3, int aug4, int aug5, int aug6) { QuestManagerCurrentQuestVars(); if(item_id != 0){ if(owner->IsNPC()) - owner->CastToNPC()->AddItem(item_id, charges, equipitem); + owner->CastToNPC()->AddItem(item_id, charges, equipitem, aug1, aug2, aug3, aug4, aug5, aug6); } } diff --git a/zone/questmgr.h b/zone/questmgr.h index 1bef4e1ee..a878de71e 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -70,7 +70,7 @@ public: void incstat(int stat, int value); void castspell(int spell_id, int target_id); void selfcast(int spell_id); - void addloot(int item_id, int charges = 0, bool equipitem = true); + void addloot(int item_id, int charges = 0, bool equipitem = true, int aug1 = 0, int aug2 = 0, int aug3 = 0, int aug4 = 0, int aug5 = 0, int aug6 = 0); void Zone(const char *zone_name); void settimer(const char *timer_name, int seconds); void settimerMS(const char *timer_name, int milliseconds); From 95064947b6832b353d754240447dc8c2d0744aee Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 21 Oct 2016 20:48:18 -0400 Subject: [PATCH 40/65] Hack to fix long recast bard songs --- zone/spells.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 649fa99c9..4c01e1340 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -985,17 +985,23 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if(GetClass() == BARD) // bard's can move when casting any spell... { if (IsBardSong(spell_id)) { - if(spells[spell_id].buffduration == 0xFFFF || spells[spell_id].recast_time != 0) { - Log.Out(Logs::Detail, Logs::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); + if(spells[spell_id].buffduration == 0xFFFF) { + Log.Out(Logs::Detail, Logs::Spells, "Bard song %d not applying bard logic because duration. dur=%d, recast=%d", spells[spell_id].buffduration); } else { - bardsong = spell_id; - bardsong_slot = slot; - //NOTE: theres a lot more target types than this to think about... - if (spell_target == nullptr || (spells[spell_id].targettype != ST_Target && spells[spell_id].targettype != ST_AETarget)) - bardsong_target_id = GetID(); - else - bardsong_target_id = spell_target->GetID(); - bardsong_timer.Start(6000); + // So long recast bard songs need special bard logic, although the effects don't repulse like other songs + // This is basically a hack to get that effect + // You can hold down the long recast spells, but you only get the effects once + // TODO fuck bards. + if (spells[spell_id].recast_time == 0) { + bardsong = spell_id; + bardsong_slot = slot; + //NOTE: theres a lot more target types than this to think about... + if (spell_target == nullptr || (spells[spell_id].targettype != ST_Target && spells[spell_id].targettype != ST_AETarget)) + bardsong_target_id = GetID(); + else + bardsong_target_id = spell_target->GetID(); + bardsong_timer.Start(6000); + } Log.Out(Logs::Detail, Logs::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); bard_song_mode = true; } From db7f0cc9776dd15d83019bf7f9e73595b5226361 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 23 Oct 2016 15:28:20 -0400 Subject: [PATCH 41/65] Fix for model glitches resulting from a recent patch --- common/patches/rof.cpp | 4 ++-- common/patches/rof2.cpp | 4 ++-- common/textures.h | 26 +++++--------------------- world/worlddb.cpp | 4 ++-- zone/bot.cpp | 2 +- zone/mob.cpp | 2 +- 6 files changed, 13 insertions(+), 29 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 6d13bb338..5793e6392 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3063,7 +3063,7 @@ namespace RoF eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; - eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroicModel; + eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HerosForgeModel; eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Unknown2; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -4109,7 +4109,7 @@ namespace RoF Equipment[k].Material = emu->equipment.Slot[k].Material; Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1; Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; - Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroicModel; + Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HerosForgeModel; Equipment[k].Material2 = emu->equipment.Slot[k].Unknown2; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 14fcdc2e6..c19203d8a 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3158,7 +3158,7 @@ namespace RoF2 eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material; eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1; eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel; - eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroicModel; + eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HerosForgeModel; eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Unknown2; eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color; } @@ -4334,7 +4334,7 @@ namespace RoF2 Equipment[k].Material = emu->equipment.Slot[k].Material; Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1; Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel; - Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroicModel; + Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HerosForgeModel; Equipment[k].Material2 = emu->equipment.Slot[k].Unknown2; } diff --git a/common/textures.h b/common/textures.h index bbf5f71c9..a39f4c007 100644 --- a/common/textures.h +++ b/common/textures.h @@ -58,27 +58,11 @@ namespace EQEmu const int8 LastTintableTexture = tintFeet; struct Texture_Struct { - union { - struct { - struct { - struct { - uint32 _material; - } _1_field; - - uint32 _unknown1; - uint32 _elite_model; - } _3_fields; - - uint32 _heroic_model; - uint32 _unknown2; - } _5_fields; - - uint32 Material; - uint32 Unknown1; - uint32 EliteModel; - uint32 HeroicModel; - uint32 Unknown2; // same as material? - }; + uint32 Material; + uint32 Unknown1; + uint32 EliteModel; + uint32 HerosForgeModel; + uint32 Unknown2; // same as material? }; struct TextureMaterial_Struct { diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 5cac4b648..2955daf50 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -120,7 +120,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou cse->Equip[matslot].Material = 0; cse->Equip[matslot].Unknown1 = 0; cse->Equip[matslot].EliteModel = 0; - cse->Equip[matslot].HeroicModel = 0; + cse->Equip[matslot].HerosForgeModel = 0; cse->Equip[matslot].Unknown2 = 0; cse->Equip[matslot].Color = 0; } @@ -288,7 +288,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou // Armor Materials/Models cse->Equip[matslot].Material = item->Material; cse->Equip[matslot].EliteModel = item->EliteMaterial; - cse->Equip[matslot].HeroicModel = inst->GetOrnamentHeroModel(matslot); + cse->Equip[matslot].HerosForgeModel = inst->GetOrnamentHeroModel(matslot); cse->Equip[matslot].Color = color; } } diff --git a/zone/bot.cpp b/zone/bot.cpp index 1629580bf..133932df7 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2963,7 +2963,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { if (item != 0) { ns->spawn.equipment.Slot[i].Material = item->Material; ns->spawn.equipment.Slot[i].EliteModel = item->EliteMaterial; - ns->spawn.equipment.Slot[i].HeroicModel = item->HerosForgeModel; + ns->spawn.equipment.Slot[i].HerosForgeModel = item->HerosForgeModel; if (armor_tint.Slot[i].Color) ns->spawn.equipment_tint.Slot[i].Color = armor_tint.Slot[i].Color; else diff --git a/zone/mob.cpp b/zone/mob.cpp index 368d34e1f..fbc82e63f 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1159,7 +1159,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.equipment.Slot[i].Material = GetEquipmentMaterial(i); ns->spawn.equipment.Slot[i].EliteModel = IsEliteMaterialItem(i); - ns->spawn.equipment.Slot[i].HeroicModel = GetHerosForgeModel(i); + ns->spawn.equipment.Slot[i].HerosForgeModel = GetHerosForgeModel(i); ns->spawn.equipment_tint.Slot[i].Color = GetEquipmentColor(i); } } From aabf7b9b5a34efdbb4ba151feb3a119c2c290cad Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 23 Oct 2016 20:51:07 -0400 Subject: [PATCH 42/65] Switched NPC::QueryLoot() from ItemData model to ServerLootItem model (allows saylinks with augments) --- zone/npc.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index f6e080a26..b2b3ff48c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -525,19 +525,22 @@ void NPC::QueryLoot(Client* to) int x = 0; for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { - const EQEmu::ItemData* item = database.GetItem((*cur)->item_id); - if (item == nullptr) { - Log.Out(Logs::General, Logs::Error, "Database error, invalid item"); + if (!(*cur)) { + Log.Out(Logs::General, Logs::Error, "NPC::QueryLoot() - ItemList error, null item"); + continue; + } + if (!(*cur)->item_id || !database.GetItem((*cur)->item_id)) { + Log.Out(Logs::General, Logs::Error, "NPC::QueryLoot() - Database error, invalid item"); continue; } EQEmu::SayLinkEngine linker; - linker.SetLinkType(EQEmu::saylink::SayLinkItemData); - linker.SetItemData(item); + linker.SetLinkType(EQEmu::saylink::SayLinkLootItem); + linker.SetLootData(*cur); auto item_link = linker.GenerateLink(); - to->Message(0, "%s, ID: %u, Level: (min: %u, max: %u)", item_link.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level); + to->Message(0, "%s, ID: %u, Level: (min: %u, max: %u)", item_link.c_str(), (*cur)->item_id, (*cur)->min_level, (*cur)->max_level); } to->Message(0, "%i items on %s.", x, GetName()); From a6f5571750b1c39d5e9a6798a9599934d023e85d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 24 Oct 2016 13:29:07 -0400 Subject: [PATCH 43/65] Fix infinite loops --- zone/spells.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 4c01e1340..95e4fed06 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5653,12 +5653,16 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) auto fac = (*iter)->GetReverseFactionCon(this); if (beneficial_targets) { // only affect mobs we would assist. - if (!(fac <= FACTION_AMIABLE)) + if (!(fac <= FACTION_AMIABLE)) { + ++iter; continue; + } } else { // affect mobs that are on our hate list, or which have bad faction with us - if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) + if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) { + ++iter; continue; + } } } @@ -5721,12 +5725,16 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) auto fac = (*iter)->GetReverseFactionCon(this); if (beneficial_targets) { // only affect mobs we would assist. - if (!(fac <= FACTION_AMIABLE)) + if (!(fac <= FACTION_AMIABLE)) { + ++iter; continue; + } } else { // affect mobs that are on our hate list, or which have bad faction with us - if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) + if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) { + ++iter; continue; + } } } From 60406ebcc1579b08d6f6ea08fc0718b5f5ca909c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 25 Oct 2016 02:52:31 -0500 Subject: [PATCH 44/65] Test build notification --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a56251c19..e1753680b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EQEmulator Core Server |Travis CI (Linux)|Appveyor (Windows) | -|:---:|:---:| +|:---:|:---:| |[![Linux CI](https://travis-ci.org/EQEmu/Server.svg?branch=master)](https://travis-ci.org/EQEmu/Server) |[![Windows CI](https://ci.appveyor.com/api/projects/status/d0cvokm7u732v8vl/branch/master?svg=true)](https://ci.appveyor.com/project/KimLS/server/branch/master) | *** From b9fefc95e82b4ae1d507c4dd75beb995cda6c331 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 25 Oct 2016 23:19:20 -0400 Subject: [PATCH 45/65] Enforce 4 sec Sneak Attack rule fixes #569 Spells flagged with SNEAK_ATTACK requires you to be hidden for about 4 seconds before you can cast them --- zone/aa.cpp | 5 +++++ zone/client_packet.cpp | 1 + zone/effects.cpp | 28 +++++++++++++++++----------- zone/mob.cpp | 3 ++- zone/mob.h | 1 + zone/spells.cpp | 5 ----- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index b1fadf5e8..f175ba9ba 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1181,6 +1181,11 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) { if (!IsCastWhileInvis(rank->spell)) CommonBreakInvisible(); + + if (spells[rank->spell].sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) { + Message_StringID(13, SNEAK_RESTRICT); + return; + } // Bards can cast instant cast AAs while they are casting another song if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) { if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), EQEmu::CastingSlot::AltAbility, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) { diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0b6221c2a..e05cc4f8c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -7911,6 +7911,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) } else hidden = true; + tmHidden = Timer::GetCurrentTime(); } if (GetClass() == ROGUE){ auto outapp = new EQApplicationPacket(OP_SimpleMessage, sizeof(SimpleMessage_Struct)); diff --git a/zone/effects.cpp b/zone/effects.cpp index e2d9d4075..53cead938 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -630,17 +630,6 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { if(r == MAX_PP_DISCIPLINES) return(false); //not found. - //Check the disc timer - pTimerType DiscTimer = pTimerDisciplineReuseStart + spells[spell_id].EndurTimerIndex; - if(!p_timers.Expired(&database, DiscTimer)) { - /*char val1[20]={0};*/ //unused - /*char val2[20]={0};*/ //unused - uint32 remain = p_timers.GetRemainingTime(DiscTimer); - //Message_StringID(0, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2)); - Message(0, "You can use this discipline in %d minutes %d seconds.", ((remain)/60), (remain%60)); - return(false); - } - //make sure we can use it.. if(!IsValidSpell(spell_id)) { Message(13, "This tome contains invalid knowledge."); @@ -667,6 +656,23 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(false); } + // sneak attack discs require you to be hidden for 4 seconds before use + if (spell.sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) { + Message_StringID(13, SNEAK_RESTRICT); + return false; + } + + //Check the disc timer + pTimerType DiscTimer = pTimerDisciplineReuseStart + spell.EndurTimerIndex; + if(!p_timers.Expired(&database, DiscTimer)) { + /*char val1[20]={0};*/ //unused + /*char val2[20]={0};*/ //unused + uint32 remain = p_timers.GetRemainingTime(DiscTimer); + //Message_StringID(0, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2)); + Message(0, "You can use this discipline in %d minutes %d seconds.", ((remain)/60), (remain%60)); + return(false); + } + if(spell.recast_time > 0) { uint32 reduced_recast = spell.recast_time / 1000; diff --git a/zone/mob.cpp b/zone/mob.cpp index fbc82e63f..a39dcfa99 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -108,7 +108,8 @@ Mob::Mob(const char* in_name, m_TargetLocation(glm::vec3()), m_TargetV(glm::vec3()), flee_timer(FLEE_CHECK_TIMER), - m_Position(position) + m_Position(position), + tmHidden(-1) { targeted = 0; tar_ndx=0; diff --git a/zone/mob.h b/zone/mob.h index 94a251394..9d874c33b 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -762,6 +762,7 @@ public: inline const bodyType GetOrigBodyType() const { return orig_bodytype; } void SetBodyType(bodyType new_body, bool overwrite_orig); + uint32 tmHidden; // timestamp of hide, only valid while hidden == true uint8 invisible, see_invis; bool invulnerable, invisible_undead, invisible_animals, sneaking, hidden, improved_hidden; bool see_invis_undead, see_hide, see_improved_hide; diff --git a/zone/spells.cpp b/zone/spells.cpp index 95e4fed06..6b875c96f 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3392,11 +3392,6 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r if(spelltar->IsClient() && spelltar->CastToClient()->IsHoveringForRespawn()) return false; - if (spells[spell_id].sneak && IsClient() && !CastToClient()->sneaking){ - Message_StringID(13, SNEAK_RESTRICT); - return false;//Fail Safe, this can cause a zone crash certain situations if you try to apply sneak effects when not sneaking. - } - if(IsDetrimentalSpell(spell_id) && !IsAttackAllowed(spelltar) && !IsResurrectionEffects(spell_id)) { if(!IsClient() || !CastToClient()->GetGM()) { Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); From cbb7090615cc65817e4aefd4aca7e5510b00c8ca Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 28 Oct 2016 20:45:05 -0400 Subject: [PATCH 46/65] Fix SNEAK_RESTRICT Message Type --- zone/aa.cpp | 2 +- zone/effects.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index f175ba9ba..0f0617393 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1183,7 +1183,7 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) { CommonBreakInvisible(); if (spells[rank->spell].sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) { - Message_StringID(13, SNEAK_RESTRICT); + Message_StringID(MT_SpellFailure, SNEAK_RESTRICT); return; } // Bards can cast instant cast AAs while they are casting another song diff --git a/zone/effects.cpp b/zone/effects.cpp index 53cead938..3e3f7a4bc 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -658,7 +658,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { // sneak attack discs require you to be hidden for 4 seconds before use if (spell.sneak && (!hidden || (hidden && (Timer::GetCurrentTime() - tmHidden) < 4000))) { - Message_StringID(13, SNEAK_RESTRICT); + Message_StringID(MT_SpellFailure, SNEAK_RESTRICT); return false; } From a15df2ec2c70d3a353eea3ca67f501003fc2e2f9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 30 Oct 2016 22:41:24 -0400 Subject: [PATCH 47/65] Switch Master Wu to modern live implementation Classic Master Wu still exists setting Combat:ClassicMasterWu to true --- common/ruletypes.h | 1 + zone/special_attacks.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index bf35d03e8..febe13e33 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -491,6 +491,7 @@ RULE_BOOL(Combat, UseLiveCombatRounds, true) // turn this false if you don't wan RULE_INT(Combat, NPCAssistCap, 5) // Maxiumium number of NPCs that will assist another NPC at once RULE_INT(Combat, NPCAssistCapTimer, 6000) // Time in milliseconds a NPC will take to clear assist aggro cap space RULE_BOOL(Combat, UseRevampHandToHand, false) // use h2h revamped dmg/delays I believe this was implemented during SoF +RULE_BOOL(Combat, ClassicMasterWu, false) // classic master wu uses a random special, modern doesn't RULE_CATEGORY_END() RULE_CATEGORY(NPC) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index d582975e9..2f43d51c9 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -349,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] = { EQEmu::skills::SkillFlyingKick, EQEmu::skills::SkillDragonPunch, EQEmu::skills::SkillEagleStrike, EQEmu::skills::SkillTigerClaw, EQEmu::skills::SkillRoundKick }; + const 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)) @@ -358,8 +358,9 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { std::string msg = StringFormat("The spirit of Master Wu fills you! You gain %d additional attack(s).", extra); // live uses 400 here -- not sure if it's the best for all clients though SendColoredText(400, msg); + auto classic = RuleB(Combat, ClassicMasterWu); while (extra) { - MonkSpecialAttack(GetTarget(), MonkSPA[zone->random.Int(0, 4)]); + MonkSpecialAttack(GetTarget(), classic ? MonkSPA[zone->random.Int(0, 4)] : ca_atk->m_skill); extra--; } } From a29177de9ef4ddc82e960f3530a2fa3c19b8f3b7 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 30 Oct 2016 22:51:50 -0400 Subject: [PATCH 48/65] Fix zone/embparser.h header guard --- zone/embparser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/embparser.h b/zone/embparser.h index 8ae3fa10e..1e4c9c391 100644 --- a/zone/embparser.h +++ b/zone/embparser.h @@ -17,7 +17,7 @@ */ #ifndef EQEMU_EMBPARSER_H -#define EQMEU_EMBPARSER_H +#define EQEMU_EMBPARSER_H #ifdef EMBPERL #include "quest_parser_collection.h" From 7f4ce3faf508974904fbd5e292462cd0c2ffcf48 Mon Sep 17 00:00:00 2001 From: zerosum0x0 Date: Sun, 30 Oct 2016 22:04:10 -0600 Subject: [PATCH 49/65] fix potential plat creation exploit --- zone/client_process.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 55843e724..4a6e0403c 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -3,7 +3,7 @@ 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. + the Free Software Foundation; version 2 of the License.f This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY except by those people which sell it, which @@ -1194,6 +1194,12 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) int32 *from_bucket = 0, *to_bucket = 0; Mob* trader = trade->With(); + // if amount < 0, client is sending a malicious packet + if (mc->amount < 0) + { + return; + } + // could just do a range, but this is clearer and explicit if ( From 66f253553aad7b7f9dba478318f9d84d15912a44 Mon Sep 17 00:00:00 2001 From: zerosum0x0 Date: Sun, 30 Oct 2016 22:12:46 -0600 Subject: [PATCH 50/65] Added an f like a dummy --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 4a6e0403c..632f953d7 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -3,7 +3,7 @@ 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.f + 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 From cbe53951f8b1ad03097ec6849901db89c34c2b5e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 2 Nov 2016 13:36:04 -0400 Subject: [PATCH 51/65] Add missing ITEMTransfig1HB --- common/item_instance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/item_instance.cpp b/common/item_instance.cpp index ab109bb41..268440dc8 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -613,6 +613,7 @@ bool EQEmu::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData types["itemtransfig2hp"] = 35; types["itemtransfig2hs"] = 1; types["itemtransfigblunt"] = 3; + types["itemtransfig1hb"] = 3; types["itemtransfigbow"] = 5; types["itemtransfighth"] = 45; types["itemtransfigshield"] = 8; From b1f97712f1feb4f8b73a74342148bf833cba9496 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 3 Nov 2016 14:31:09 -0400 Subject: [PATCH 52/65] Quick fix for bulk XTarget updates This needs to be investigated more, but a 0 here for a valid mob is bad. --- zone/client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 3f914d1ae..891591780 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7272,7 +7272,8 @@ void Client::SendXTargetUpdates() for (int i = 0; i < GetMaxXTargets(); ++i) { if (XTargets[i].dirty) { outapp->WriteUInt32(i); - outapp->WriteUInt8(0); // no idea what this is + // MQ2 checks this for valid mobs, so 0 is bad here at least ... + outapp->WriteUInt8(XTargets[i].ID ? 1 : 0); outapp->WriteUInt32(XTargets[i].ID); outapp->WriteString(XTargets[i].Name); count++; From 06e2f76c05df895cce895d0046c0e9d2b3eac1ca Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 5 Nov 2016 14:08:00 -0400 Subject: [PATCH 53/65] Implement SE_SummonToCorpse --- common/spdat.h | 2 +- zone/spell_effects.cpp | 1 + zone/worldserver.cpp | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/spdat.h b/common/spdat.h index 2734f6078..edb750f2a 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -485,7 +485,7 @@ typedef enum { #define SE_ManaAbsorbPercentDamage 329 // implemented #define SE_CriticalDamageMob 330 // implemented #define SE_Salvage 331 // implemented - chance to recover items that would be destroyed in failed tradeskill combine -//#define SE_SummonToCorpse 332 // *not implemented AA - Call of the Wild (Druid/Shaman Res spell with no exp) +#define SE_SummonToCorpse 332 // *not implemented AA - Call of the Wild (Druid/Shaman Res spell with no exp) #define SE_CastOnRuneFadeEffect 333 // implemented #define SE_BardAEDot 334 // implemented #define SE_BlockNextSpellFocus 335 // implemented - base1 chance to block next spell ie Puratus (8494) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 841457bdc..a2a66f9ae 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1650,6 +1650,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove break; } + case SE_SummonToCorpse: case SE_Revive: { #ifdef SPELL_EFFECT_SPAM diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 28f3c5ab8..84d4cb399 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -722,10 +722,12 @@ void WorldServer::Process() { Log.Out(Logs::Detail, Logs::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - Log.Out(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed."); + Log.Out(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed if needed."); // I don't know why Rezzed is not set to true in CompleteRezz(). - corpse->IsRezzed(true); - corpse->CompleteResurrection(); + if (!IsEffectInSpell(srs->rez.spellid, SE_SummonToCorpse)) { + corpse->IsRezzed(true); + corpse->CompleteResurrection(); + } } } From 4af996e359ecceb786e0729f80ad53835d0f88c2 Mon Sep 17 00:00:00 2001 From: Athrogate Date: Wed, 9 Nov 2016 04:28:57 -0800 Subject: [PATCH 54/65] Adding GetLowestLevel() --- zone/lua_group.cpp | 5 +++++ zone/lua_group.h | 1 + 2 files changed, 6 insertions(+) diff --git a/zone/lua_group.cpp b/zone/lua_group.cpp index 23c12cae6..ee85c6e64 100644 --- a/zone/lua_group.cpp +++ b/zone/lua_group.cpp @@ -82,6 +82,11 @@ int Lua_Group::GetHighestLevel() { return self->GetHighestLevel(); } +int Lua_Group::GetLowestLevel() { + Lua_Safe_Call_Int(); + return self->GetLowestLevel(); +} + void Lua_Group::TeleportGroup(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h) { Lua_Safe_Call_Void(); self->TeleportGroup(sender, zone_id, instance_id, x, y, z, h); diff --git a/zone/lua_group.h b/zone/lua_group.h index 399abbe2b..3d4020bbc 100644 --- a/zone/lua_group.h +++ b/zone/lua_group.h @@ -40,6 +40,7 @@ public: bool IsLeader(Lua_Mob leader); int GroupCount(); int GetHighestLevel(); + int GetLowestLevel(); void TeleportGroup(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h); int GetID(); Lua_Mob GetMember(int index); From 72e7465e1602103ad6f8409de65356e522a71036 Mon Sep 17 00:00:00 2001 From: Athrogate Date: Wed, 9 Nov 2016 04:41:09 -0800 Subject: [PATCH 55/65] Lua GetLowestLevel() --- zone/lua_group.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/lua_group.cpp b/zone/lua_group.cpp index ee85c6e64..fc0ce7bb5 100644 --- a/zone/lua_group.cpp +++ b/zone/lua_group.cpp @@ -126,6 +126,7 @@ luabind::scope lua_register_group() { .def("IsLeader", (bool(Lua_Group::*)(Lua_Mob))&Lua_Group::IsLeader) .def("GroupCount", (int(Lua_Group::*)(void))&Lua_Group::GroupCount) .def("GetHighestLevel", (int(Lua_Group::*)(void))&Lua_Group::GetHighestLevel) + .def("GetLowestLevel", (int(Lua_Group::*)(void))&Lua_Group::GetLowestLevel) .def("TeleportGroup", (void(Lua_Group::*)(Lua_Mob,uint32,uint32,float,float,float,float))&Lua_Group::TeleportGroup) .def("GetID", (int(Lua_Group::*)(void))&Lua_Group::GetID) .def("GetMember", (Lua_Mob(Lua_Group::*)(int))&Lua_Group::GetMember); From b3842ba72a50df28dc2a7ad7d8420d19583faf3e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 9 Nov 2016 12:14:24 -0500 Subject: [PATCH 56/65] Fix indent --- zone/lua_group.cpp | 4 ++-- zone/lua_group.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/lua_group.cpp b/zone/lua_group.cpp index fc0ce7bb5..f297d72f1 100644 --- a/zone/lua_group.cpp +++ b/zone/lua_group.cpp @@ -83,8 +83,8 @@ int Lua_Group::GetHighestLevel() { } int Lua_Group::GetLowestLevel() { - Lua_Safe_Call_Int(); - return self->GetLowestLevel(); + Lua_Safe_Call_Int(); + return self->GetLowestLevel(); } void Lua_Group::TeleportGroup(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h) { diff --git a/zone/lua_group.h b/zone/lua_group.h index 3d4020bbc..e1aa2a11d 100644 --- a/zone/lua_group.h +++ b/zone/lua_group.h @@ -40,7 +40,7 @@ public: bool IsLeader(Lua_Mob leader); int GroupCount(); int GetHighestLevel(); - int GetLowestLevel(); + int GetLowestLevel(); void TeleportGroup(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h); int GetID(); Lua_Mob GetMember(int index); From e7e379c71b39f991b467aab26ee6f1da4e6db6e8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 10 Nov 2016 11:28:06 -0600 Subject: [PATCH 57/65] Fix map loading logic so that case sensitive checks are made in the following order: maps, Maps, and if neither of those two exist, then value would take precedence. - Added some log messages for what version of map is being loaded versus MMF --- zone/map.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/zone/map.cpp b/zone/map.cpp index 29a386331..9a5ab8e10 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -268,8 +268,23 @@ bool Map::CheckLoS(glm::vec3 myloc, glm::vec3 oloc) const { return !imp->rm->raycast((const RmReal*)&myloc, (const RmReal*)&oloc, nullptr, nullptr, nullptr); } +inline bool file_exists(const std::string& name) { + std::ifstream f(name.c_str()); + return f.good(); +} + Map *Map::LoadMapFile(std::string file) { - std::string filename = Config->MapDir; + + std::string filename = ""; + if (file_exists("maps")) { + filename = "maps"; + } + else if (file_exists("Maps")) { + filename = "Maps"; + } + else { + filename = Config->MapDir; + } std::transform(file.begin(), file.end(), file.begin(), ::tolower); filename += file; filename += ".map"; @@ -287,7 +302,7 @@ Map *Map::LoadMapFile(std::string file) { bool Map::Load(std::string filename, bool force_mmf_overwrite) { if (LoadMMF(filename, force_mmf_overwrite)) { - Log.Out(Logs::General, Logs::Zone_Server, "Zone map mmf found - using it in lieu of '%s'", filename.c_str()); + Log.Out(Logs::General, Logs::Zone_Server, "Loaded .MMF Map File in place of '%s'", filename.c_str()); return true; } #else @@ -304,6 +319,7 @@ bool Map::Load(std::string filename) } if(version == 0x01000000) { + Log.Out(Logs::General, Logs::Zone_Server, "Loaded V1 Map File :: '%s'", filename.c_str()); bool v = LoadV1(f); fclose(f); @@ -314,6 +330,7 @@ bool Map::Load(std::string filename) return v; } else if(version == 0x02000000) { + Log.Out(Logs::General, Logs::Zone_Server, "Loaded V2 Map File :: '%s'", filename.c_str()); bool v = LoadV2(f); fclose(f); From 34ffb5b90827cf907c90e4a84b0c158a3f9ff847 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 10 Nov 2016 12:00:44 -0600 Subject: [PATCH 58/65] Create shared_memory directory from the config file if it doesn't exist on launch of shared_memory.exe --- common/emu_legacy.h | 1 + shared_memory/main.cpp | 38 ++++++++++++++++++++++++++++++++++++++ zone/map.cpp | 6 +++--- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/common/emu_legacy.h b/common/emu_legacy.h index b70d7143c..a624be883 100644 --- a/common/emu_legacy.h +++ b/common/emu_legacy.h @@ -176,6 +176,7 @@ namespace EQEmu static const size_t TEXT_LINK_BODY_LENGTH = 56; } + } #endif /* COMMON_EMU_LEGACY_H */ diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 79824251f..8f9ad4255 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -36,6 +36,39 @@ EQEmuLogSys Log; +#ifdef _WINDOWS +#include +#else +#include +#include +#endif + +inline bool MakeDirectory(const std::string &directory_name) +{ +#ifdef _WINDOWS + struct _stat st; + if (_stat(directory_name.c_str(), &st) == 0) { + return false; + } + else { + _mkdir(directory_name.c_str()); + return true; + } + +#else + struct stat st; + if (stat(directory_name.c_str(), &st) == 0) { + return false; + } + else { + mkdir(directory_name.c_str(), 0755); + return true; + } + +#endif + return false; +} + int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); Log.LoadLogSettingsDefaults(); @@ -62,6 +95,11 @@ int main(int argc, char **argv) { database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); + std::string shared_mem_directory = Config->SharedMemDir; + if (MakeDirectory(shared_mem_directory)) { + Log.Out(Logs::General, Logs::Status, "Shared Memory folder doesn't exist, so we created it... '%s'", shared_mem_directory.c_str()); + } + database.LoadVariables(); /* If we're running shared memory and hotfix has no custom name, we probably want to start from scratch... */ diff --git a/zone/map.cpp b/zone/map.cpp index 9a5ab8e10..b4daca584 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -302,7 +302,7 @@ Map *Map::LoadMapFile(std::string file) { bool Map::Load(std::string filename, bool force_mmf_overwrite) { if (LoadMMF(filename, force_mmf_overwrite)) { - Log.Out(Logs::General, Logs::Zone_Server, "Loaded .MMF Map File in place of '%s'", filename.c_str()); + Log.Out(Logs::General, Logs::Status, "Loaded .MMF Map File in place of '%s'", filename.c_str()); return true; } #else @@ -319,7 +319,7 @@ bool Map::Load(std::string filename) } if(version == 0x01000000) { - Log.Out(Logs::General, Logs::Zone_Server, "Loaded V1 Map File :: '%s'", filename.c_str()); + Log.Out(Logs::General, Logs::Status, "Loaded V1 Map File :: '%s'", filename.c_str()); bool v = LoadV1(f); fclose(f); @@ -330,7 +330,7 @@ bool Map::Load(std::string filename) return v; } else if(version == 0x02000000) { - Log.Out(Logs::General, Logs::Zone_Server, "Loaded V2 Map File :: '%s'", filename.c_str()); + Log.Out(Logs::General, Logs::Status, "Loaded V2 Map File :: '%s'", filename.c_str()); bool v = LoadV2(f); fclose(f); From cb1d0a0bef7d9afca83524e6a9351b74dc669010 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Thu, 10 Nov 2016 15:42:20 -0500 Subject: [PATCH 59/65] Fixed #npcspawn update. --- zone/npc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index b2b3ff48c..d1255f8aa 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1213,12 +1213,13 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char *zone, uint32 zone_ve uint32 ZoneDatabase::UpdateNPCTypeAppearance(Client *client, NPC *spawn) { std::string query = - StringFormat("UPDATE npc_types SET name = \"%s\", level = %i, race = %i, class = %i, " - "hp = %i, gender = %i, texture = %i, helmtexture = %i, size = %i, " - "loottable_id = %i, merchant_id = %i, face = %i, WHERE id = %i", + StringFormat("UPDATE npc_types SET name = '%s', level = '%i', race = '%i', class = '%i', " + "hp = '%i', gender = '%i', texture = '%i', helmtexture = '%i', size = '%i', " + "loottable_id = '%i', merchant_id = '%i', face = '%i' " + "WHERE id = '%i'", spawn->GetName(), spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), - spawn->GetLoottableID(), spawn->MerchantType, spawn->GetNPCTypeID()); + spawn->GetLoottableID(), spawn->MerchantType, spawn->GetLuclinFace(), spawn->GetNPCTypeID()); auto results = QueryDatabase(query); return results.Success() == true ? 1 : 0; } From 3447c86562f3c17381f03ff758bf1736dc3400c9 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 11 Nov 2016 18:59:47 -0500 Subject: [PATCH 60/65] Fix for windows compile (stat-use related) --- shared_memory/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 8f9ad4255..d80c22156 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -40,8 +40,8 @@ EQEmuLogSys Log; #include #else #include -#include #endif +#include inline bool MakeDirectory(const std::string &directory_name) { From e8d80a436e6d70dcea536027c5b494942b8a47a9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 11 Nov 2016 22:31:54 -0600 Subject: [PATCH 61/65] Add map debugging [skip ci] --- zone/map.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/map.cpp b/zone/map.cpp index b4daca584..691e751b2 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -289,6 +289,8 @@ Map *Map::LoadMapFile(std::string file) { filename += file; filename += ".map"; + Log.Out(Logs::General, Logs::Status, "Attempting to load Map File :: '%s'", filename.c_str()); + auto m = new Map(); if (m->Load(filename)) { return m; From 04c8fe7d2cb851f2de56c6aeef2bbcaca2762ddb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 11 Nov 2016 22:39:08 -0600 Subject: [PATCH 62/65] Fix map loading paths for both platforms --- zone/map.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/map.cpp b/zone/map.cpp index 691e751b2..ceef7894a 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -286,6 +286,7 @@ Map *Map::LoadMapFile(std::string file) { filename = Config->MapDir; } std::transform(file.begin(), file.end(), file.begin(), ::tolower); + filename += "/"; filename += file; filename += ".map"; From 3dec02881a2b272292639cf26757d63c182cd09b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 15 Nov 2016 01:37:58 -0500 Subject: [PATCH 63/65] Revamp Buff slots Server side we now have 63 total buff slots for clients They match RoF/RoF2 and are mapped as 42 long, 20 short, 1 disc The player is limited to what their clients supports, so Tit players can have 25 buffs and 12 songs, while other can have more When you log in, we only load up to the max your client supports, the rest of the buffs are thrown away Also changed is the default Max Buff slots for NPCs, they now match Tit (60) If you are thinking about raising that, here are what some other clients support Tit - SoF 60, SoD - UF 85, RoF - RoF2 97 (although UI only has 85 slots, you can edit it if you want more) Also SoD+ the pet limits match the NPC limits. This will increase memory usage a bit, but I don't see a solution to that Plus I think most people want this. --- common/emu_constants.h | 8 ++++ common/eq_limits.cpp | 68 +++++++++++++++++++++++++++++--- common/eq_limits.h | 7 ++++ common/patches/rof.cpp | 60 +++++++++++++++++----------- common/patches/rof2.cpp | 67 +++++++++++++++++-------------- common/patches/rof2_limits.h | 8 ++++ common/patches/rof_limits.h | 8 ++++ common/patches/sod.cpp | 35 ++++++++++++++-- common/patches/sod_limits.h | 8 ++++ common/patches/sof.cpp | 33 +++++++++++++++- common/patches/sof_limits.h | 8 ++++ common/patches/titanium.cpp | 33 +++++++++++++++- common/patches/titanium_limits.h | 8 ++++ common/patches/uf.cpp | 55 ++++++++++++++++---------- common/patches/uf_limits.h | 40 +++++++++++-------- common/ruletypes.h | 10 ++--- zone/client.h | 8 ++-- zone/spells.cpp | 4 +- zone/zonedb.cpp | 3 +- 19 files changed, 358 insertions(+), 113 deletions(-) diff --git a/common/emu_constants.h b/common/emu_constants.h index 9e44976a8..e156fe98a 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -116,6 +116,14 @@ namespace EQEmu const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize; + const int LongBuffs = RoF2::constants::LongBuffs; + const int ShortBuffs = RoF2::constants::ShortBuffs; + const int DiscBuffs = RoF2::constants::DiscBuffs; + const int TotalBuffs = RoF2::constants::TotalBuffs; + const int NPCBuffs = RoF2::constants::NPCBuffs; + const int PetBuffs = RoF2::constants::PetBuffs; + const int MercBuffs = RoF2::constants::MercBuffs; + } /*constants*/ enum class CastingSlot : uint32 { diff --git a/common/eq_limits.cpp b/common/eq_limits.cpp index 1c0140811..ce94c4359 100644 --- a/common/eq_limits.cpp +++ b/common/eq_limits.cpp @@ -24,28 +24,84 @@ static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versions::ClientVersionCount] = { { + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, + ClientUnknown::Null, ClientUnknown::Null }, { + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, + Client62::Null, Client62::Null }, { - Titanium::constants::CharacterCreationLimit + Titanium::constants::CharacterCreationLimit, + Titanium::constants::LongBuffs, + Titanium::constants::ShortBuffs, + Titanium::constants::DiscBuffs, + Titanium::constants::TotalBuffs, + Titanium::constants::NPCBuffs, + Titanium::constants::PetBuffs, + Titanium::constants::MercBuffs }, { - SoF::constants::CharacterCreationLimit + SoF::constants::CharacterCreationLimit, + SoF::constants::LongBuffs, + SoF::constants::ShortBuffs, + SoF::constants::DiscBuffs, + SoF::constants::TotalBuffs, + SoF::constants::NPCBuffs, + SoF::constants::PetBuffs, + SoF::constants::MercBuffs }, { - SoD::constants::CharacterCreationLimit + SoD::constants::CharacterCreationLimit, + SoD::constants::LongBuffs, + SoD::constants::ShortBuffs, + SoD::constants::DiscBuffs, + SoD::constants::TotalBuffs, + SoD::constants::NPCBuffs, + SoD::constants::PetBuffs, + SoD::constants::MercBuffs }, { - UF::constants::CharacterCreationLimit + UF::constants::CharacterCreationLimit, + UF::constants::LongBuffs, + UF::constants::ShortBuffs, + UF::constants::DiscBuffs, + UF::constants::TotalBuffs, + UF::constants::NPCBuffs, + UF::constants::PetBuffs, + UF::constants::MercBuffs }, { - RoF::constants::CharacterCreationLimit + RoF::constants::CharacterCreationLimit, + RoF::constants::LongBuffs, + RoF::constants::ShortBuffs, + RoF::constants::DiscBuffs, + RoF::constants::TotalBuffs, + RoF::constants::NPCBuffs, + RoF::constants::PetBuffs, + RoF::constants::MercBuffs }, { - RoF2::constants::CharacterCreationLimit + RoF2::constants::CharacterCreationLimit, + RoF2::constants::LongBuffs, + RoF2::constants::ShortBuffs, + RoF2::constants::DiscBuffs, + RoF2::constants::TotalBuffs, + RoF2::constants::NPCBuffs, + RoF2::constants::PetBuffs, + RoF2::constants::MercBuffs } }; diff --git a/common/eq_limits.h b/common/eq_limits.h index 72d710998..252d23053 100644 --- a/common/eq_limits.h +++ b/common/eq_limits.h @@ -38,6 +38,13 @@ namespace EQEmu class LookupEntry { public: size_t CharacterCreationLimit; + int LongBuffs; + int ShortBuffs; + int DiscBuffs; + int TotalBuffs; + int NPCBuffs; + int PetBuffs; + int MercBuffs; }; const LookupEntry* Lookup(versions::ClientVersion client_version); diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 5793e6392..980a4f4ed 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -66,6 +66,9 @@ namespace RoF static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot); static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot); + static inline int ServerToRoFBuffSlot(int index); + static inline int RoFToServerBuffSlot(int index); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -423,15 +426,8 @@ namespace RoF OUT(buff.y); OUT(buff.x); OUT(buff.z); - uint16 buffslot = emu->slotid; - // Not sure if this is needs amending for RoF yet. - if (buffslot >= 25) - { - buffslot += 17; - } - // TODO: implement slot_data stuff - eq->slotid = buffslot; + eq->slotid = ServerToRoFBuffSlot(emu->slotid); if (emu->bufffade == 1) eq->bufffade = 1; @@ -447,10 +443,10 @@ namespace RoF outapp->WriteUInt32(0); // tic timer outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ? outapp->WriteUInt16(1); // 1 buff in this packet - outapp->WriteUInt32(buffslot); + outapp->WriteUInt32(eq->slotid); outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove) outapp->WriteUInt32(0); // Duration - outapp->WriteUInt32(0); // ? + outapp->WriteUInt32(0); // numhits outapp->WriteUInt8(0); // Caster name outapp->WriteUInt8(0); // Type } @@ -474,17 +470,9 @@ namespace RoF __packet->WriteUInt8(emu->all_buffs); // 1 indicates all buffs on the player (0 to add or remove a single buff) __packet->WriteUInt16(emu->count); - for (uint16 i = 0; i < emu->count; ++i) + for (int i = 0; i < emu->count; ++i) { - uint16 buffslot = emu->entries[i].buff_slot; - if (emu->type == 0) { // only correct for self packets - if (emu->entries[i].buff_slot >= 25) - buffslot += 17; - if (buffslot == 54) - buffslot = 62; - } - - __packet->WriteUInt32(buffslot); + __packet->WriteUInt32(emu->type == 0 ? ServerToRoFBuffSlot(emu->entries[i].buff_slot) : emu->entries[i].buff_slot); __packet->WriteUInt32(emu->entries[i].spell_id); __packet->WriteUInt32(emu->entries[i].tics_remaining); __packet->WriteUInt32(emu->entries[i].num_hits); // Unknown @@ -4312,7 +4300,7 @@ namespace RoF IN(buff.unknown003); IN(buff.spellid); IN(buff.duration); - IN(slotid); + emu->slotid = RoFToServerBuffSlot(eq->slotid); IN(bufffade); FINISH_DIRECT_DECODE(); @@ -4325,7 +4313,7 @@ namespace RoF DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct); SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct); - emu->SlotID = (eq->SlotID < 42) ? eq->SlotID : (eq->SlotID - 17); + emu->SlotID = RoFToServerBuffSlot(eq->SlotID); IN(EntityID); @@ -6084,4 +6072,32 @@ namespace RoF return EQEmu::CastingSlot::Discipline; } } + + // these should be optimized out for RoF since they should all boil down to return index :P + // but lets leave it here for future proofing + static inline int ServerToRoFBuffSlot(int index) + { + // we're a disc + if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + + constants::LongBuffs + constants::ShortBuffs; + // we're a song + if (index >= EQEmu::constants::LongBuffs) + return index - EQEmu::constants::LongBuffs + constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } + + static inline int RoFToServerBuffSlot(int index) + { + // we're a disc + if (index >= constants::LongBuffs + constants::ShortBuffs) + return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs + + EQEmu::constants::ShortBuffs; + // we're a song + if (index >= constants::LongBuffs) + return index - constants::LongBuffs + EQEmu::constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } } /*RoF*/ diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index c19203d8a..d14008e93 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -66,6 +66,9 @@ namespace RoF2 static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot); static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot); + static inline int ServerToRoF2BuffSlot(int index); + static inline int RoF2ToServerBuffSlot(int index); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -492,18 +495,7 @@ namespace RoF2 OUT(buff.y); OUT(buff.x); OUT(buff.z); - uint16 buffslot = emu->slotid; - // Not sure if this is needs amending for RoF2 yet. - if (buffslot >= 25) - { - buffslot += 17; - } - // TODO: We should really just deal with these "server side" - // so we can have clients not limited to other clients. - // This fixes discs, songs were changed to 20 - if (buffslot == 54) - buffslot = 62; - eq->slotid = buffslot; + eq->slotid = ServerToRoF2BuffSlot(emu->slotid); // TODO: implement slot_data stuff if (emu->bufffade == 1) eq->bufffade = 1; @@ -519,10 +511,10 @@ namespace RoF2 outapp->WriteUInt32(0); // tic timer outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ? outapp->WriteUInt16(1); // 1 buff in this packet - outapp->WriteUInt32(buffslot); + outapp->WriteUInt32(eq->slotid); outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove) outapp->WriteUInt32(0); // Duration - outapp->WriteUInt32(0); // ? + outapp->WriteUInt32(0); // numhits outapp->WriteUInt8(0); // Caster name outapp->WriteUInt8(0); // Type } @@ -546,20 +538,9 @@ namespace RoF2 __packet->WriteUInt8(emu->all_buffs); // 1 indicates all buffs on the player (0 to add or remove a single buff) __packet->WriteUInt16(emu->count); - for (uint16 i = 0; i < emu->count; ++i) + for (int i = 0; i < emu->count; ++i) { - uint16 buffslot = emu->entries[i].buff_slot; - if (emu->type == 0) { // only correct for self packets - if (emu->entries[i].buff_slot >= 25) - buffslot += 17; - // TODO: We should really just deal with these "server side" - // so we can have clients not limited to other clients. - // This fixes discs, songs were changed to 20 - if (buffslot == 54) - buffslot = 62; - } - - __packet->WriteUInt32(buffslot); + __packet->WriteUInt32(emu->type == 0 ? ServerToRoF2BuffSlot(emu->entries[i].buff_slot) : emu->entries[i].buff_slot); __packet->WriteUInt32(emu->entries[i].spell_id); __packet->WriteUInt32(emu->entries[i].tics_remaining); __packet->WriteUInt32(emu->entries[i].num_hits); // Unknown @@ -4550,7 +4531,7 @@ namespace RoF2 IN(buff.unknown003); IN(buff.spellid); IN(buff.duration); - IN(slotid); + emu->slotid = RoF2ToServerBuffSlot(eq->slotid); IN(bufffade); FINISH_DIRECT_DECODE(); @@ -4563,7 +4544,7 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct); SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct); - emu->SlotID = (eq->SlotID < 42) ? eq->SlotID : (eq->SlotID - 17); + emu->SlotID = RoF2ToServerBuffSlot(eq->SlotID); IN(EntityID); @@ -6388,4 +6369,32 @@ namespace RoF2 return EQEmu::CastingSlot::Discipline; } } + + // these should be optimized out for RoF2 since they should all boil down to return index :P + // but lets leave it here for future proofing + static inline int ServerToRoF2BuffSlot(int index) + { + // we're a disc + if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + + constants::LongBuffs + constants::ShortBuffs; + // we're a song + if (index >= EQEmu::constants::LongBuffs) + return index - EQEmu::constants::LongBuffs + constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } + + static inline int RoF2ToServerBuffSlot(int index) + { + // we're a disc + if (index >= constants::LongBuffs + constants::ShortBuffs) + return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs + + EQEmu::constants::ShortBuffs; + // we're a song + if (index >= constants::LongBuffs) + return index - constants::LongBuffs + EQEmu::constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } } /*RoF2*/ diff --git a/common/patches/rof2_limits.h b/common/patches/rof2_limits.h index fb2f997ca..6f4e649ff 100644 --- a/common/patches/rof2_limits.h +++ b/common/patches/rof2_limits.h @@ -277,6 +277,14 @@ namespace RoF2 const size_t SayLinkBodySize = 56; + const int LongBuffs = 42; + const int ShortBuffs = 20; + const int DiscBuffs = 1; + const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs; + const int NPCBuffs = 97; + const int PetBuffs = NPCBuffs; + const int MercBuffs = LongBuffs; + } /*constants*/ namespace behavior { diff --git a/common/patches/rof_limits.h b/common/patches/rof_limits.h index ed0b9a6d0..952d14b20 100644 --- a/common/patches/rof_limits.h +++ b/common/patches/rof_limits.h @@ -268,6 +268,14 @@ namespace RoF const size_t SayLinkBodySize = 55; + const int LongBuffs = 42; + const int ShortBuffs = 20; + const int DiscBuffs = 1; + const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs; + const int NPCBuffs = 97; + const int PetBuffs = NPCBuffs; + const int MercBuffs = LongBuffs; + } /*constants*/ namespace behavior { diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 330f7ee20..a3872e9c9 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -62,6 +62,9 @@ namespace SoD static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot); static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot); + static inline int ServerToSoDBuffSlot(int index); + static inline int SoDToServerBuffSlot(int index); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -315,7 +318,7 @@ namespace SoD OUT(buff.duration); OUT(buff.counters); OUT(buff.player_id); - OUT(slotid); + eq->slotid = ServerToSoDBuffSlot(emu->slotid); OUT(bufffade); FINISH_ENCODE(); @@ -2921,8 +2924,8 @@ namespace SoD IN(buff.bard_modifier); IN(buff.spellid); IN(buff.duration); - IN(buff.counters) - IN(slotid); + IN(buff.counters); + emu->slotid = SoDToServerBuffSlot(eq->slotid); IN(bufffade); FINISH_DIRECT_DECODE(); @@ -4088,4 +4091,30 @@ namespace SoD return EQEmu::CastingSlot::Discipline; } } + + static inline int ServerToSoDBuffSlot(int index) + { + // we're a disc + if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + + constants::LongBuffs + constants::ShortBuffs; + // we're a song + if (index >= EQEmu::constants::LongBuffs) + return index - EQEmu::constants::LongBuffs + constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } + + static inline int SoDToServerBuffSlot(int index) + { + // we're a disc + if (index >= constants::LongBuffs + constants::ShortBuffs) + return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs + + EQEmu::constants::ShortBuffs; + // we're a song + if (index >= constants::LongBuffs) + return index - constants::LongBuffs + EQEmu::constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } } /*SoD*/ diff --git a/common/patches/sod_limits.h b/common/patches/sod_limits.h index fa2c29317..8f8031a3d 100644 --- a/common/patches/sod_limits.h +++ b/common/patches/sod_limits.h @@ -295,6 +295,14 @@ namespace SoD const size_t SayLinkBodySize = 50; + const int LongBuffs = 25; + const int ShortBuffs = 15; + const int DiscBuffs = 1; + const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs; + const int NPCBuffs = 85; + const int PetBuffs = NPCBuffs; + const int MercBuffs = LongBuffs; + } /*constants*/ namespace behavior { diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 59e0edb5f..9009979ef 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -62,6 +62,9 @@ namespace SoF static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot); static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation); + static inline int ServerToSoFBuffSlot(int index); + static inline int SoFToServerBuffSlot(int index); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -297,7 +300,7 @@ namespace SoF OUT(buff.duration); OUT(buff.counters); OUT(buff.player_id); - OUT(slotid); + eq->slotid = ServerToSoFBuffSlot(emu->slotid); OUT(bufffade); FINISH_ENCODE(); @@ -2375,7 +2378,7 @@ namespace SoF IN(buff.duration); IN(buff.counters); IN(buff.player_id); - IN(slotid); + emu->slotid = SoFToServerBuffSlot(eq->slotid); IN(bufffade); FINISH_DIRECT_DECODE(); @@ -3461,4 +3464,30 @@ namespace SoF return EQEmu::CastingSlot::Discipline; } } + + static inline int ServerToSoFBuffSlot(int index) + { + // we're a disc + if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + + constants::LongBuffs + constants::ShortBuffs; + // we're a song + if (index >= EQEmu::constants::LongBuffs) + return index - EQEmu::constants::LongBuffs + constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } + + static inline int SoFToServerBuffSlot(int index) + { + // we're a disc + if (index >= constants::LongBuffs + constants::ShortBuffs) + return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs + + EQEmu::constants::ShortBuffs; + // we're a song + if (index >= constants::LongBuffs) + return index - constants::LongBuffs + EQEmu::constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } } /*SoF*/ diff --git a/common/patches/sof_limits.h b/common/patches/sof_limits.h index 575df39ba..d34197a90 100644 --- a/common/patches/sof_limits.h +++ b/common/patches/sof_limits.h @@ -295,6 +295,14 @@ namespace SoF const size_t SayLinkBodySize = 50; + const int LongBuffs = 25; + const int ShortBuffs = 15; + const int DiscBuffs = 1; + const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs; + const int NPCBuffs = 60; + const int PetBuffs = 30; + const int MercBuffs = 0; + } /*constants*/ namespace behavior { diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 286d09d1b..1c7033186 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -61,6 +61,9 @@ namespace Titanium static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot); static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation); + static inline int ServerToTitaniumBuffSlot(int index); + static inline int TitaniumToServerBuffSlot(int index); + void Register(EQStreamIdentifier &into) { auto Config = EQEmuConfig::get(); @@ -270,7 +273,7 @@ namespace Titanium OUT(buff.duration); OUT(buff.counters); OUT(buff.player_id); - OUT(slotid); + eq->slotid = ServerToTitaniumBuffSlot(emu->slotid); OUT(bufffade); FINISH_ENCODE(); @@ -1779,7 +1782,7 @@ namespace Titanium IN(buff.duration); IN(buff.counters); IN(buff.player_id); - IN(slotid); + emu->slotid = TitaniumToServerBuffSlot(eq->slotid); IN(bufffade); FINISH_DIRECT_DECODE(); @@ -2632,4 +2635,30 @@ namespace Titanium return EQEmu::CastingSlot::Discipline; } } + + static inline int ServerToTitaniumBuffSlot(int index) + { + // we're a disc + if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + + constants::LongBuffs + constants::ShortBuffs; + // we're a song + if (index >= EQEmu::constants::LongBuffs) + return index - EQEmu::constants::LongBuffs + constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } + + static inline int TitaniumToServerBuffSlot(int index) + { + // we're a disc + if (index >= constants::LongBuffs + constants::ShortBuffs) + return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs + + EQEmu::constants::ShortBuffs; + // we're a song + if (index >= constants::LongBuffs) + return index - constants::LongBuffs + EQEmu::constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } } /*Titanium*/ diff --git a/common/patches/titanium_limits.h b/common/patches/titanium_limits.h index e631f8492..3266ade6f 100644 --- a/common/patches/titanium_limits.h +++ b/common/patches/titanium_limits.h @@ -294,6 +294,14 @@ namespace Titanium const size_t SayLinkBodySize = 45; + const int LongBuffs = 25; + const int ShortBuffs = 12; + const int DiscBuffs = 1; + const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs; + const int NPCBuffs = 60; + const int PetBuffs = 30; + const int MercBuffs = 0; + } /*constants*/ namespace behavior { diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 92be237b1..061444bea 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -62,6 +62,9 @@ namespace UF static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot); static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot); + static inline int ServerToUFBuffSlot(int index); + static inline int UFToServerBuffSlot(int index); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -377,17 +380,8 @@ namespace UF OUT(buff.spellid); OUT(buff.duration); OUT(buff.num_hits); - uint16 buffslot = emu->slotid; - if (buffslot >= 25 && buffslot < 37) - { - buffslot += 5; - } - else if (buffslot >= 37) - { - buffslot += 14; - } // TODO: implement slot_data stuff - eq->slotid = buffslot; + eq->slotid = ServerToUFBuffSlot(emu->slotid); OUT(bufffade); // Live (October 2011) sends a 2 rather than 0 when a buff is created, but it doesn't seem to matter. FINISH_ENCODE(); @@ -407,17 +401,9 @@ namespace UF __packet->WriteUInt8(emu->all_buffs); // 1 = all buffs, 0 = 1 buff __packet->WriteUInt16(emu->count); - for (uint16 i = 0; i < emu->count; ++i) + for (int i = 0; i < emu->count; ++i) { - uint16 buffslot = emu->entries[i].buff_slot; - if (emu->type == 0) { // only correct for self packets - if (emu->entries[i].buff_slot >= 25 && emu->entries[i].buff_slot < 37) - buffslot += 5; - else if (emu->entries[i].buff_slot >= 37) - buffslot += 14; - } - - __packet->WriteUInt32(buffslot); + __packet->WriteUInt32(emu->type == 0 ? ServerToUFBuffSlot(emu->entries[i].buff_slot) : emu->entries[i].buff_slot); __packet->WriteUInt32(emu->entries[i].spell_id); __packet->WriteUInt32(emu->entries[i].tics_remaining); __packet->WriteUInt32(emu->entries[i].num_hits); @@ -3236,6 +3222,7 @@ namespace UF IN(buff.unknown003); IN(buff.spellid); IN(buff.duration); + emu->slotid = UFToServerBuffSlot(eq->slotid); IN(slotid); IN(bufffade); @@ -3249,7 +3236,7 @@ namespace UF DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct); SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct); - emu->SlotID = (eq->SlotID < 30) ? eq->SlotID : (eq->SlotID - 5); + emu->SlotID = UFToServerBuffSlot(eq->SlotID); IN(EntityID); @@ -4453,4 +4440,30 @@ namespace UF return EQEmu::CastingSlot::Discipline; } } + + static inline int ServerToUFBuffSlot(int index) + { + // we're a disc + if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + + constants::LongBuffs + constants::ShortBuffs; + // we're a song + if (index >= EQEmu::constants::LongBuffs) + return index - EQEmu::constants::LongBuffs + constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } + + static inline int UFToServerBuffSlot(int index) + { + // we're a disc + if (index >= constants::LongBuffs + constants::ShortBuffs) + return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs + + EQEmu::constants::ShortBuffs; + // we're a song + if (index >= constants::LongBuffs) + return index - constants::LongBuffs + EQEmu::constants::LongBuffs; + // we're a normal buff + return index; // as long as we guard against bad slots server side, we should be fine + } } /*UF*/ diff --git a/common/patches/uf_limits.h b/common/patches/uf_limits.h index 2e799ac0c..719fcc394 100644 --- a/common/patches/uf_limits.h +++ b/common/patches/uf_limits.h @@ -64,7 +64,7 @@ namespace UF InvTypeOther, InvTypeCount }; - + } /*invtype*/ namespace invslot { @@ -115,21 +115,21 @@ namespace UF const int GeneralBegin = PossessionsGeneral1; const int GeneralEnd = PossessionsGeneral8; const int GeneralCount = (GeneralEnd - GeneralBegin + 1); - + } /*invslot*/ namespace invbag { inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::UF; } enum : int { InvBagInvalid = -1, InvBagBegin }; - + } /*invbag*/ namespace invaug { inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::UF; } enum : int { InvAugInvalid = -1, InvAugBegin }; - + } /*invaug*/ namespace item { @@ -148,27 +148,27 @@ namespace UF ItemPacketCharmUpdate = 110, ItemPacket11 = 111 }; - + } /*item*/ namespace profile { inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::UF; } - + } /*profile*/ namespace constants { inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::UF; } - + } /*constants*/ namespace behavior { inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::UF; } - + } /*behavior*/ namespace skills { inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::UF; } - + } /*skills*/ @@ -208,7 +208,7 @@ namespace UF extern const char* GetInvTypeName(int inv_type); extern bool IsInvTypePersistent(int inv_type); - + } /*invtype*/ namespace invslot { @@ -237,7 +237,7 @@ namespace UF extern const char* GetInvPossessionsSlotName(int inv_slot); extern const char* GetInvCorpseSlotName(int inv_slot); extern const char* GetInvSlotName(int inv_type, int inv_slot); - + } /*invslot*/ namespace invbag { @@ -264,7 +264,7 @@ namespace UF const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1; extern const char* GetInvBagIndexName(int bag_index); - + } /*invbag*/ namespace invaug { @@ -288,24 +288,32 @@ namespace UF const size_t PotionBeltSize = 5; const size_t SkillArraySize = 100; - + } /*profile*/ namespace constants { const size_t CharacterCreationLimit = 12; const size_t SayLinkBodySize = 50; - + + const int LongBuffs = 30; + const int ShortBuffs = 20; + const int DiscBuffs = 1; + const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs; + const int NPCBuffs = 85; + const int PetBuffs = NPCBuffs; + const int MercBuffs = LongBuffs; + } /*constants*/ namespace behavior { const bool CoinHasWeight = false; - + } /*behavior*/ namespace skills { const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack; - + } /*skills*/ }; /*UF*/ diff --git a/common/ruletypes.h b/common/ruletypes.h index 0f424072d..9a18ff063 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -333,11 +333,11 @@ RULE_INT(Spells, SacrificeMinLevel, 46) //first level Sacrifice will work on RULE_INT(Spells, SacrificeMaxLevel, 69) //last level Sacrifice will work on RULE_INT(Spells, SacrificeItemID, 9963) //Item ID of the item Sacrifice will return (defaults to an EE) RULE_BOOL(Spells, EnableSpellGlobals, false) // If Enabled, spells check the spell_globals table and compare character data from the quest globals before allowing that spell to scribe with scribespells -RULE_INT(Spells, MaxBuffSlotsNPC, 25) -RULE_INT(Spells, MaxSongSlotsNPC, 10) -RULE_INT(Spells, MaxDiscSlotsNPC, 1) -RULE_INT(Spells, MaxTotalSlotsNPC, 36) -RULE_INT(Spells, MaxTotalSlotsPET, 30) // do not set this higher than 25 until the player profile is removed from the blob +RULE_INT(Spells, MaxBuffSlotsNPC, 60) // default to Tit's limit +RULE_INT(Spells, MaxSongSlotsNPC, 0) // NPCs don't have songs ... +RULE_INT(Spells, MaxDiscSlotsNPC, 0) // NPCs don't have discs ... +RULE_INT(Spells, MaxTotalSlotsNPC, 60) // default to Tit's limit +RULE_INT(Spells, MaxTotalSlotsPET, 30) // default to Tit's limit RULE_BOOL (Spells, EnableBlockedBuffs, true) RULE_INT(Spells, ReflectType, 1) //0 = disabled, 1 = single target player spells only, 2 = all player spells, 3 = all single target spells, 4 = all spells RULE_INT(Spells, VirusSpreadDistance, 30) // The distance a viral spell will jump to its next victim diff --git a/zone/client.h b/zone/client.h index c7973de18..5b2c0a939 100644 --- a/zone/client.h +++ b/zone/client.h @@ -509,10 +509,10 @@ public: virtual int GetCurrentBuffSlots() const; virtual int GetCurrentSongSlots() const; virtual int GetCurrentDiscSlots() const { return 1; } - virtual int GetMaxBuffSlots() const { return 25; } - virtual int GetMaxSongSlots() const { return 12; } - virtual int GetMaxDiscSlots() const { return 1; } - virtual int GetMaxTotalSlots() const { return 38; } + virtual int GetMaxBuffSlots() const { return EQEmu::constants::LongBuffs; } + virtual int GetMaxSongSlots() const { return EQEmu::constants::ShortBuffs; } + virtual int GetMaxDiscSlots() const { return EQEmu::constants::DiscBuffs; } + virtual int GetMaxTotalSlots() const { return EQEmu::constants::TotalBuffs; } virtual uint32 GetFirstBuffSlot(bool disc, bool song); virtual uint32 GetLastBuffSlot(bool disc, bool song); virtual void InitializeBuffSlots(); diff --git a/zone/spells.cpp b/zone/spells.cpp index 6b875c96f..3b232f9cd 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5534,12 +5534,12 @@ int Client::GetCurrentBuffSlots() const numbuffs++; if (GetLevel() > 74) numbuffs++; - return EQEmu::ClampUpper(numbuffs, GetMaxBuffSlots()); + return EQEmu::ClampUpper(numbuffs, EQEmu::constants::Lookup(m_ClientVersion)->LongBuffs); } int Client::GetCurrentSongSlots() const { - return 12; // AAs dont affect this + return EQEmu::constants::Lookup(m_ClientVersion)->ShortBuffs; // AAs dont affect this } void Client::InitializeBuffSlots() diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8bf2e4d31..c4fcfc55f 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3122,7 +3122,8 @@ void ZoneDatabase::LoadBuffs(Client *client) buffs[slot_id].instrument_mod = instrument_mod; } - max_slots = client->GetMaxBuffSlots(); + // We load up to the most our client supports + max_slots = EQEmu::constants::Lookup(client->ClientVersion())->LongBuffs; for (int index = 0; index < max_slots; ++index) { if (!IsValidSpell(buffs[index].spellid)) continue; From 5a08e0ffd975d2ed27d28c282cb2f22c73f7ec62 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 16 Nov 2016 02:36:20 -0500 Subject: [PATCH 64/65] Adjust Rogue Evade drop Live seems to be inconsistent with how much hate is dropped, but I parsed ~69% drop on the highest and ~39% for the lowest. So round to 70 and 40. It was also fairly obvious there was a min hate it could drop you to, which parsed out to ~100 hate. --- zone/aggro.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index d50c1d43e..9533fbbff 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -1343,8 +1343,8 @@ bool Mob::PassCharismaCheck(Mob* caster, uint16 spell_id) { void Mob::RogueEvade(Mob *other) { - int amount = other->GetHateAmount(this) - (GetLevel() * 13); - other->SetHateAmountOnEnt(this, std::max(1, amount)); + int amount = other->GetHateAmount(this) * zone->random.Int(40, 70) / 100; + other->SetHateAmountOnEnt(this, std::max(100, amount)); return; } From bbd2796ea44ad36ca3233a1fe56026b8a8cac920 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 18 Nov 2016 13:55:04 -0500 Subject: [PATCH 65/65] Add ParticlePoint enum for OP_LevelAppearance --- common/eq_packet_structs.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 5e83a467f..1d25e4d66 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -3517,6 +3517,20 @@ struct RecipeAutoCombine_Struct { // f5 ff ff ff in 'you dont have all the stuff' reply }; +// this is the "value#a" data +enum EParticlePoint { + eDefault, + eChest, + eHead, + eLeftHand, + eRigthHand, + eLeftFoot, + eRightFood, + eLeftEye, + eRightEye, + eMouth +}; + struct LevelAppearance_Struct { //Sends a little graphic on level up uint32 spawn_id; uint32 parm1;