From 703cbc6727c1dd57760754980b839acb7c3641ee Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 15 Jan 2019 00:50:58 -0500 Subject: [PATCH] Activated per-expansion support for active inventory slot addressing --- changelog.txt | 5 ++ common/eq_limits.cpp | 158 +++++++++++++++++++++++++++++++---- common/eq_limits.h | 3 + common/inventory_profile.cpp | 25 +++--- common/inventory_profile.h | 13 +-- common/patches/rof.cpp | 3 +- common/shareddb.cpp | 9 +- world/client.cpp | 12 ++- world/worlddb.cpp | 3 + zone/bot.cpp | 2 + zone/client.cpp | 1 + zone/client_packet.cpp | 18 +++- zone/corpse.cpp | 2 +- 13 files changed, 209 insertions(+), 45 deletions(-) diff --git a/changelog.txt b/changelog.txt index 51b8821a0..52e6b59de 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 1/15/2019 == +Uleat: Activated per-expansion support for active inventory slot addressing + - Server honors expansions that alter bank size and power source, general9 and general10 slots + - Server honors gm flag behaviors for the active inventory slots of each client + == 1/11/2019 == Uleat: Modified rules system to ignore all runtime modifications of 'World:ExpansionSettings' and 'World:UseClientBasedExpansionSettings' fields. - These fields are no longer allowed to be changed during server runtime through the command system diff --git a/common/eq_limits.cpp b/common/eq_limits.cpp index e5aee9c17..299e504a9 100644 --- a/common/eq_limits.cpp +++ b/common/eq_limits.cpp @@ -36,6 +36,7 @@ void EQEmu::InitializeDynamicLookups() { global_dictionary_init = true; } +static std::unique_ptr constants_dynamic_gm_lookup_entries[EQEmu::versions::ClientVersionCount]; static std::unique_ptr constants_dynamic_lookup_entries[EQEmu::versions::ClientVersionCount]; static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu::versions::ClientVersionCount] = { @@ -173,6 +174,15 @@ void EQEmu::constants::InitializeDynamicLookups() { // use static references for now } +const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicGMLookup(versions::ClientVersion client_version) +{ + client_version = versions::ValidateClientVersion(client_version); + if (constants_dynamic_gm_lookup_entries[static_cast(client_version)]) + return constants_dynamic_gm_lookup_entries[static_cast(client_version)].get(); + + return &constants_static_lookup_entries[static_cast(client_version)]; +} + const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::ClientVersion client_version) { client_version = versions::ValidateClientVersion(client_version); @@ -187,6 +197,7 @@ const EQEmu::constants::LookupEntry* EQEmu::constants::StaticLookup(versions::Cl return &constants_static_lookup_entries[static_cast(versions::ValidateClientVersion(client_version))]; } +static std::unique_ptr inventory_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount]; static std::unique_ptr inventory_dynamic_lookup_entries[EQEmu::versions::MobVersionCount]; static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu::versions::MobVersionCount] = { @@ -797,25 +808,123 @@ void EQEmu::inventory::InitializeDynamicLookups() { return; // Notes: - // Currently, there are only 3 known expansions that affect inventory-related settings in the clients.. - // - Expansion::PoR "Prophecy of Ro" - toggles between 24 (set) and 16 (clear) bank slots - // - Expansion::TBS "The Buried Sea" - toggles slotPowerSource enabled (set) and disabled (clear) - // - Expansion::HoT "House of Thule" - toggles slotGeneral9/slotGeneral10 enabled (set) and disabled (clear) - // Obviously, the client must support the expansion to allow any (set) condition + // - Currently, there are only 3 known expansions that affect inventory-related settings in the clients.. + // -- Expansion::PoR "Prophecy of Ro" - toggles between 24 (set) and 16 (clear) bank slots + // -- Expansion::TBS "The Buried Sea" - toggles slotPowerSource activated (set) and deactivated (clear) + // -- Expansion::HoT "House of Thule" - toggles slotGeneral9/slotGeneral10 activated (set) and deactivated (clear) + // - Corspe size does not appear to reflect loss of active possessions slots + // - Inspect size does not appear to reflect loss of active equipment slots + // - Bank size is not overridden by GM flag when expansion bit is (clear) + // - Power Source slot is enabled, but not activated, by GM flag when expansion bit is (clear) + // - General9 and General10 slots are activated by GM flag when expansion bit is (clear) + // - Obviously, the client must support the expansion to allow any (set) or override condition - const uint32 current_expansions = RuleI(World, ExpansionSettings); - const uint32 dynamic_check_mask = (EQEmu::expansions::bitPoR | EQEmu::expansions::bitTBS | EQEmu::expansions::bitHoT); // the only known expansions that affect inventory + const uint32 dynamic_check_mask = + ( + EQEmu::expansions::bitPoR | + EQEmu::expansions::bitTBS | + EQEmu::expansions::bitHoT + ); // if all of the above expansion bits are present, then static references will suffice - if ((current_expansions & dynamic_check_mask) == dynamic_check_mask) + if ((dynamic_check_mask & RuleI(World, ExpansionSettings)) == dynamic_check_mask) return; - for (uint32 iter = static_cast(EQEmu::versions::ClientVersion::Unknown); iter <= static_cast(EQEmu::versions::LastClientVersion); ++iter) { - // no need to dynamic this condition since it is the lowest compatibility standard at this time - if (iter <= static_cast(EQEmu::versions::ClientVersion::Titanium)) + // Dynamic GM Lookups (demotive methodology) (client-linked mob versions only) + for (uint32 iter = static_cast(EQEmu::versions::MobVersion::Unknown); iter <= static_cast(EQEmu::versions::LastPCMobVersion); ++iter) { + // no need to dynamic this condition since it is the lowest compatibility standard + if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask) continue; + // only client versions whose supported expansions are affected need to be considered + if ((constants_static_lookup_entries[iter].ExpansionsMask & RuleI(World, ExpansionSettings)) == constants_static_lookup_entries[iter].ExpansionsMask) + continue; + + // special case gm exclusions based on known behaviors + switch (iter) { + case static_cast(versions::MobVersion::RoF2) : + case static_cast(versions::MobVersion::RoF) : + // if bank size is not altered on these clients, then static will suffice + // (we already know these clients support this expansion...) + if (RuleI(World, ExpansionSettings) & expansions::bitPoR) + continue; + break; + default: + break; + } + // direct manipulation of lookup indices is safe so long as (int)ClientVersion:: == (int)MobVersion:: + inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr(new LookupEntry(inventory_static_lookup_entries[iter])); + + inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later + inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later + + if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) { + // update bank size + if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitPoR) + inventory_dynamic_gm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; + } + + if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) { + // update power source + switch (iter) { + case versions::bitUF: + case versions::bitSoD: + case versions::bitSoF: + // gm flag does not override expansion-based behavior + // (we already know that only these clients support this behavior) + inventory_dynamic_gm_lookup_entries[iter]->EquipmentBitmask = Titanium::invslot::EQUIPMENT_BITMASK; + break; + default: + break; + } + } + + if (~RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) { + // update general size + switch (iter) { + case versions::bitUF: + case versions::bitSoD: + case versions::bitSoF: + // gm flag does not override expansion-based behavior + // (we already know that only these clients support this behavior) + inventory_dynamic_gm_lookup_entries[iter]->GeneralBitmask = Titanium::invslot::GENERAL_BITMASK; + break; + default: + break; + } + } + + // fixup possessions bitmask + inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = + ( + inventory_dynamic_gm_lookup_entries[iter]->EquipmentBitmask | + inventory_dynamic_gm_lookup_entries[iter]->GeneralBitmask | + inventory_dynamic_gm_lookup_entries[iter]->CursorBitmask + ); + + // fixup corpse bitmask + inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = + ( + inventory_dynamic_gm_lookup_entries[iter]->GeneralBitmask | + inventory_dynamic_gm_lookup_entries[iter]->CursorBitmask | + (inventory_dynamic_gm_lookup_entries[iter]->EquipmentBitmask << 34) + ); + + // expansion-related fields are now updated and all other fields reflect the static entry values + } + + // Dynamic Lookups (promotive methodology) (all mob versions allowed) + for (uint32 iter = static_cast(EQEmu::versions::MobVersion::Unknown); iter <= static_cast(EQEmu::versions::LastPCMobVersion); ++iter) { + // no need to dynamic this condition since it is the lowest compatibility standard + if ((dynamic_check_mask & ~constants_static_lookup_entries[iter].ExpansionsMask) == dynamic_check_mask) + continue; + + // only client versions whose supported expansions are affected need to be considered + if ((constants_static_lookup_entries[iter].ExpansionsMask & RuleI(World, ExpansionSettings)) == constants_static_lookup_entries[iter].ExpansionsMask) + continue; + + // direct manipulation of lookup indices is safe so long as (int)ClientVersion:: == (int)MobVersion:: inventory_dynamic_lookup_entries[iter] = std::unique_ptr(new LookupEntry(inventory_static_lookup_entries[iter])); // clamp affected fields to the lowest standard @@ -825,19 +934,19 @@ void EQEmu::inventory::InitializeDynamicLookups() { inventory_dynamic_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later inventory_dynamic_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later - if (current_expansions & EQEmu::expansions::bitPoR) { + if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitPoR) { // update bank size if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitPoR) inventory_dynamic_lookup_entries[iter]->InventoryTypeSize.Bank = SoF::invtype::BANK_SIZE; } - if (current_expansions & EQEmu::expansions::bitTBS) { + if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitTBS) { // update power source if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitTBS) inventory_dynamic_lookup_entries[iter]->EquipmentBitmask = SoF::invslot::EQUIPMENT_BITMASK; } - if (current_expansions & EQEmu::expansions::bitHoT) { + if (RuleI(World, ExpansionSettings) & EQEmu::expansions::bitHoT) { // update general size if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitHoT) inventory_dynamic_lookup_entries[iter]->GeneralBitmask = RoF::invslot::GENERAL_BITMASK; @@ -862,7 +971,16 @@ void EQEmu::inventory::InitializeDynamicLookups() { // expansion-related fields are now updated and all other fields reflect the static entry values } - // only client versions that require a change from their static definitions have been given a dynamic lookup entry + // only client versions that require a change from their static definitions have been given a dynamic (gm) lookup entry +} + +const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicGMLookup(versions::MobVersion mob_version) +{ + mob_version = versions::ValidateMobVersion(mob_version); + if (inventory_dynamic_gm_lookup_entries[static_cast(mob_version)]) + return inventory_dynamic_gm_lookup_entries[static_cast(mob_version)].get(); + + return &inventory_static_lookup_entries[static_cast(mob_version)]; } const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::MobVersion mob_version) @@ -879,6 +997,7 @@ const EQEmu::inventory::LookupEntry* EQEmu::inventory::StaticLookup(versions::Mo return &inventory_static_lookup_entries[static_cast(versions::ValidateMobVersion(mob_version))]; } +static std::unique_ptr behavior_dynamic_gm_lookup_entries[EQEmu::versions::MobVersionCount]; static std::unique_ptr behavior_dynamic_lookup_entries[EQEmu::versions::MobVersionCount]; static const EQEmu::behavior::LookupEntry behavior_static_lookup_entries[EQEmu::versions::MobVersionCount] = { @@ -984,6 +1103,15 @@ void EQEmu::behavior::InitializeDynamicLookups() { // use static references for now } +const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicGMLookup(versions::MobVersion mob_version) +{ + mob_version = versions::ValidateMobVersion(mob_version); + if (behavior_dynamic_gm_lookup_entries[static_cast(mob_version)]) + return behavior_dynamic_gm_lookup_entries[static_cast(mob_version)].get(); + + return &behavior_static_lookup_entries[static_cast(mob_version)]; +} + const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::MobVersion mob_version) { mob_version = versions::ValidateMobVersion(mob_version); diff --git a/common/eq_limits.h b/common/eq_limits.h index 117b529c4..5a37917cc 100644 --- a/common/eq_limits.h +++ b/common/eq_limits.h @@ -82,6 +82,7 @@ namespace EQEmu void InitializeDynamicLookups(); + const LookupEntry* DynamicGMLookup(versions::ClientVersion client_version); const LookupEntry* DynamicLookup(versions::ClientVersion client_version); const LookupEntry* StaticLookup(versions::ClientVersion client_version); @@ -178,6 +179,7 @@ namespace EQEmu void InitializeDynamicLookups(); + const LookupEntry* DynamicGMLookup(versions::MobVersion mob_version); const LookupEntry* DynamicLookup(versions::MobVersion mob_version); const LookupEntry* StaticLookup(versions::MobVersion mob_version); @@ -197,6 +199,7 @@ namespace EQEmu void InitializeDynamicLookups(); + const LookupEntry* DynamicGMLookup(versions::MobVersion mob_version); const LookupEntry* DynamicLookup(versions::MobVersion mob_version); const LookupEntry* StaticLookup(versions::MobVersion mob_version); diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp index 4f9a49448..2fe73ee19 100644 --- a/common/inventory_profile.cpp +++ b/common/inventory_profile.cpp @@ -119,19 +119,18 @@ EQEmu::InventoryProfile::~InventoryProfile() m_trade.clear(); } -bool EQEmu::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) { - if (!m_mob_version_set) { - m_mob_version = versions::ValidateMobVersion(inventory_version); - m_lookup = inventory::StaticLookup(m_mob_version); - m_mob_version_set = true; - return true; - } - else { - m_lookup = inventory::StaticLookup(versions::MobVersion::Unknown); - Log(Logs::General, Logs::Error, "InventoryVersion set request after initial set (old: %u, new: %u)", - static_cast(m_mob_version), static_cast(inventory_version)); - return false; - } +void EQEmu::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) { + m_mob_version = versions::ValidateMobVersion(inventory_version); + SetGMInventory(m_gm_inventory); +} + +void EQEmu::InventoryProfile::SetGMInventory(bool gmi_flag) { + m_gm_inventory = gmi_flag; + + if (m_gm_inventory) + m_lookup = inventory::DynamicGMLookup(m_mob_version); + else + m_lookup = inventory::DynamicLookup(m_mob_version); } void EQEmu::InventoryProfile::CleanDirty() { diff --git a/common/inventory_profile.h b/common/inventory_profile.h index 36cb2b38b..5a19a2550 100644 --- a/common/inventory_profile.h +++ b/common/inventory_profile.h @@ -87,15 +87,18 @@ namespace EQEmu InventoryProfile() { m_mob_version = versions::MobVersion::Unknown; - m_mob_version_set = false; + m_gm_inventory = false; m_lookup = inventory::StaticLookup(versions::MobVersion::Unknown); } ~InventoryProfile(); - bool SetInventoryVersion(versions::MobVersion inventory_version); - bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToMobVersion(client_version)); } + void SetInventoryVersion(versions::MobVersion inventory_version); + void SetInventoryVersion(versions::ClientVersion client_version) { SetInventoryVersion(versions::ConvertClientVersionToMobVersion(client_version)); } - versions::MobVersion InventoryVersion() { return m_mob_version; } + void SetGMInventory(bool gmi_flag); + bool GMInventory() const { return m_gm_inventory; } + + versions::MobVersion InventoryVersion() const { return m_mob_version; } const inventory::LookupEntry* GetLookup() const { return m_lookup; } @@ -222,7 +225,7 @@ namespace EQEmu private: // Active mob version versions::MobVersion m_mob_version; - bool m_mob_version_set; + bool m_gm_inventory; const inventory::LookupEntry* m_lookup; }; } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d0fa44773..8d9f5f641 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2334,7 +2334,8 @@ namespace RoF outapp->WriteUInt32(emu->lastlogin); outapp->WriteUInt32(emu->timePlayedMin); outapp->WriteUInt32(emu->timeentitledonaccount); - outapp->WriteUInt32(0x0007ffff); // Expansion bitmask + outapp->WriteUInt32(emu->expansions); + //outapp->WriteUInt32(0x0007ffff); // Expansion bitmask outapp->WriteUInt32(structs::MAX_PP_LANGUAGE); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 97a071448..46e3a7512 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -720,9 +720,12 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) if (cv_conflict) { char char_name[64] = ""; GetCharName(char_id, char_name); - Log(Logs::Moderate, Logs::Client_Login, - "ClientVersion conflict during inventory load at zone entry for '%s' (charid: %u, inver: %s)", - char_name, char_id, EQEmu::versions::MobVersionName(inv->InventoryVersion()) + Log(Logs::General, Logs::Error, + "ClientVersion/Expansion conflict during inventory load at zone entry for '%s' (charid: %u, inver: %s, gmi: %s)", + char_name, + char_id, + EQEmu::versions::MobVersionName(inv->InventoryVersion()), + (inv->GMInventory() ? "true" : "false") ); } diff --git a/world/client.cpp b/world/client.cpp index d439758cf..30c57db5d 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -171,10 +171,13 @@ void Client::SendEnterWorld(std::string name) void Client::SendExpansionInfo() { auto outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct)); ExpansionInfo_Struct *eis = (ExpansionInfo_Struct*)outapp->pBuffer; - if(RuleB(World, UseClientBasedExpansionSettings)) { + + // need to rework .. not until full scope of change is accounted for, though + if (RuleB(World, UseClientBasedExpansionSettings)) { eis->Expansions = EQEmu::expansions::ConvertClientVersionToExpansionMask(eqs->ClientVersion()); - } else { - eis->Expansions = (RuleI(World, ExpansionSettings)); + } + else { + eis->Expansions = RuleI(World, ExpansionSettings); } QueuePacket(outapp); @@ -1442,7 +1445,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) PlayerProfile_Struct pp; ExtendedProfile_Struct ext; EQEmu::InventoryProfile inv; + inv.SetInventoryVersion(EQEmu::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit)); + inv.SetGMInventory(false); // character cannot have gm flag at this point + time_t bday = time(nullptr); char startzone[50]={0}; uint32 i; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 59cbb188a..4daa7fa77 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -97,7 +97,10 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou CharacterSelectEntry_Struct *cse = (CharacterSelectEntry_Struct *)buff_ptr; PlayerProfile_Struct pp; EQEmu::InventoryProfile inv; + inv.SetInventoryVersion(client_version); + inv.SetGMInventory(true); // charsel can not interact with items..but, no harm in setting to full expansion support + uint32 character_id = (uint32)atoi(row[0]); uint8 has_home = 0; uint8 has_bind = 0; diff --git a/zone/bot.cpp b/zone/bot.cpp index 5876ebed3..125d933b1 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -39,6 +39,7 @@ Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm } m_inv.SetInventoryVersion(EQEmu::versions::MobVersion::Bot); + m_inv.SetGMInventory(false); // bot expansions are not currently implemented (defaults to static) _guildRank = 0; _guildId = 0; @@ -113,6 +114,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to auto bot_owner = GetBotOwner(); m_inv.SetInventoryVersion(EQEmu::versions::MobVersion::Bot); + m_inv.SetGMInventory(false); // bot expansions are not currently implemented (defaults to static) _guildRank = 0; _guildId = 0; diff --git a/zone/client.cpp b/zone/client.cpp index 3327f2633..da5430ff7 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2077,6 +2077,7 @@ bool Client::ChangeFirstName(const char* in_firstname, const char* gmname) void Client::SetGM(bool toggle) { m_pp.gm = toggle ? 1 : 0; + m_inv.SetGMInventory((bool)m_pp.gm); Message(13, "You are %s a GM.", m_pp.gm ? "now" : "no longer"); SendAppearancePacket(AT_GM, m_pp.gm); Save(); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7dc36771f..541eb2e81 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1144,8 +1144,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) SetClientVersion(Connection()->ClientVersion()); m_ClientVersionBit = EQEmu::versions::ConvertClientVersionToClientVersionBit(Connection()->ClientVersion()); - bool siv = m_inv.SetInventoryVersion(m_ClientVersion); - Log(Logs::General, Logs::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(m_ClientVersion), m_ClientVersion); + m_inv.SetInventoryVersion(m_ClientVersion); /* Antighost code tmp var is so the search doesnt find this object @@ -1185,7 +1184,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) uint32 cid = CharacterID(); character_id = cid; /* Global character_id reference */ - /* Flush and reload factions */ + /* Flush and reload factions */ database.RemoveTempFactions(this); database.LoadCharacterFactionValues(cid, factionvalues); @@ -1222,6 +1221,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) m_pp.platinum_shared = database.GetSharedPlatinum(this->AccountID()); database.ClearOldRecastTimestamps(cid); /* Clear out our old recast timestamps to keep the DB clean */ + // set to full support in case they're a gm with items in disabled expansion slots..but, have their gm flag off... + // item loss will occur when they use the 'empty' slots, if this is not done + m_inv.SetGMInventory(true); loaditems = database.GetInventory(cid, &m_inv); /* Load Character Inventory */ database.LoadCharacterBandolier(cid, &m_pp); /* Load Character Bandolier */ database.LoadCharacterBindPoint(cid, &m_pp); /* Load Character Bind */ @@ -1238,7 +1240,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) database.LoadCharacterLeadershipAA(cid, &m_pp); /* Load Character Leadership AA's */ database.LoadCharacterTribute(cid, &m_pp); /* Load CharacterTribute */ - /* Load AdventureStats */ + /* Load AdventureStats */ AdventureStats_Struct as; if (database.GetAdventureStats(cid, &as)) { @@ -1397,6 +1399,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (m_pp.ldon_points_tak < 0 || m_pp.ldon_points_tak > 2000000000) { m_pp.ldon_points_tak = 0; } if (m_pp.ldon_points_available < 0 || m_pp.ldon_points_available > 2000000000) { m_pp.ldon_points_available = 0; } + // need to rework .. not until full scope of change is accounted for, though if (RuleB(World, UseClientBasedExpansionSettings)) { m_pp.expansions = EQEmu::expansions::ConvertClientVersionToExpansionMask(ClientVersion()); } @@ -1516,6 +1519,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) Bot::LoadAndSpawnAllZonedBots(this); #endif + m_inv.SetGMInventory((bool)m_pp.gm); // set to current gm state for calc CalcBonuses(); if (RuleB(Zone, EnableLoggedOffReplenishments) && time(nullptr) - m_pp.lastlogin >= RuleI(Zone, MinOfflineTimeToReplenishments)) { @@ -1639,6 +1643,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) this is not quite where live sends inventory, they do it after tribute */ if (loaditems) { /* Dont load if a length error occurs */ + if (admin >= minStatusToBeGM) + m_inv.SetGMInventory(true); // set to true to allow expansion-restricted packets through + BulkSendInventoryItems(); /* Send stuff on the cursor which isnt sent in bulk */ for (auto iter = m_inv.cursor_cbegin(); iter != m_inv.cursor_cend(); ++iter) { @@ -1648,6 +1655,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) const EQEmu::ItemInstance *inst = *iter; SendItemPacket(EQEmu::invslot::slotCursor, inst, ItemPacketLimbo); } + + // this is kinda hackish atm..this process needs to be realigned to allow a contiguous flow + m_inv.SetGMInventory((bool)m_pp.gm); // reset back to current gm state } /* Task Packets */ diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 5ceaa8019..fbb319cb5 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1374,7 +1374,7 @@ void Corpse::QueryLoot(Client* to) { cur = itemlist.begin(); end = itemlist.end(); - int corpselootlimit = EQEmu::inventory::StaticLookup(EQEmu::versions::ConvertClientVersionToMobVersion(to->ClientVersion()))->InventoryTypeSize.Corpse; + int corpselootlimit = to->GetInv().GetLookup()->InventoryTypeSize.Corpse; for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur;