mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
Added dynamic entries to eqdictionary
This commit is contained in:
parent
7857bc45fb
commit
bcf271c30f
@ -131,6 +131,9 @@ namespace EQEmu
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = CORPSE_BEGIN + invslot::slotCursor;
|
||||
|
||||
using RoF2::invslot::EQUIPMENT_BITMASK;
|
||||
using RoF2::invslot::GENERAL_BITMASK;
|
||||
using RoF2::invslot::CURSOR_BITMASK;
|
||||
using RoF2::invslot::POSSESSIONS_BITMASK;
|
||||
using RoF2::invslot::CORPSE_BITMASK;
|
||||
|
||||
|
||||
@ -70,7 +70,10 @@ namespace EntityLimits
|
||||
} // namespace invtype
|
||||
|
||||
namespace invslot {
|
||||
const uint64 POSSESSIONS_BITMASK = 0x00000000007FFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x0000000000000000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000000000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
|
||||
} // namespace invslot
|
||||
|
||||
|
||||
@ -19,9 +19,25 @@
|
||||
|
||||
#include "emu_constants.h"
|
||||
#include "emu_limits.h"
|
||||
#include "rulesys.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versions::ClientVersionCount] =
|
||||
static bool global_dictionary_init = false;
|
||||
void EQEmu::InitializeDynamicLookups() {
|
||||
if (global_dictionary_init == true)
|
||||
return;
|
||||
|
||||
constants::InitializeDynamicLookups();
|
||||
inventory::InitializeDynamicLookups();
|
||||
behavior::InitializeDynamicLookups();
|
||||
|
||||
global_dictionary_init = true;
|
||||
}
|
||||
|
||||
static std::unique_ptr<EQEmu::constants::LookupEntry> constants_dynamic_lookup_entries[EQEmu::versions::ClientVersionCount];
|
||||
static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu::versions::ClientVersionCount] =
|
||||
{
|
||||
/*[ClientVersion::Unknown] =*/
|
||||
EQEmu::constants::LookupEntry(
|
||||
@ -145,12 +161,34 @@ static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versi
|
||||
)
|
||||
};
|
||||
|
||||
const EQEmu::constants::LookupEntry* EQEmu::constants::Lookup(versions::ClientVersion client_version)
|
||||
{
|
||||
return &constants_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
|
||||
static bool constants_dictionary_init = false;
|
||||
void EQEmu::constants::InitializeDynamicLookups() {
|
||||
if (constants_dictionary_init == true)
|
||||
return;
|
||||
constants_dictionary_init = true;
|
||||
|
||||
if (RuleB(World, UseClientBasedExpansionSettings))
|
||||
return;
|
||||
|
||||
// use static references for now
|
||||
}
|
||||
|
||||
static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
const EQEmu::constants::LookupEntry* EQEmu::constants::DynamicLookup(versions::ClientVersion client_version)
|
||||
{
|
||||
client_version = versions::ValidateClientVersion(client_version);
|
||||
if (constants_dynamic_lookup_entries[static_cast<int>(client_version)])
|
||||
return constants_dynamic_lookup_entries[static_cast<int>(client_version)].get();
|
||||
|
||||
return &constants_static_lookup_entries[static_cast<int>(client_version)];
|
||||
}
|
||||
|
||||
const EQEmu::constants::LookupEntry* EQEmu::constants::StaticLookup(versions::ClientVersion client_version)
|
||||
{
|
||||
return &constants_static_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
|
||||
}
|
||||
|
||||
static std::unique_ptr<EQEmu::inventory::LookupEntry> inventory_dynamic_lookup_entries[EQEmu::versions::MobVersionCount];
|
||||
static const EQEmu::inventory::LookupEntry inventory_static_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
{
|
||||
/*[MobVersion::Unknown] =*/
|
||||
EQEmu::inventory::LookupEntry(
|
||||
@ -166,6 +204,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
ClientUnknown::INULL
|
||||
),
|
||||
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
@ -190,6 +231,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
Client62::INULL
|
||||
),
|
||||
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
@ -214,6 +258,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
Titanium::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
Titanium::invslot::EQUIPMENT_BITMASK,
|
||||
Titanium::invslot::GENERAL_BITMASK,
|
||||
Titanium::invslot::CURSOR_BITMASK,
|
||||
Titanium::invslot::POSSESSIONS_BITMASK,
|
||||
Titanium::invslot::CORPSE_BITMASK,
|
||||
Titanium::invbag::SLOT_COUNT,
|
||||
@ -238,6 +285,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
SoF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
SoF::invslot::EQUIPMENT_BITMASK,
|
||||
SoF::invslot::GENERAL_BITMASK,
|
||||
SoF::invslot::CURSOR_BITMASK,
|
||||
SoF::invslot::POSSESSIONS_BITMASK,
|
||||
SoF::invslot::CORPSE_BITMASK,
|
||||
SoF::invbag::SLOT_COUNT,
|
||||
@ -262,6 +312,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
SoD::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
SoD::invslot::EQUIPMENT_BITMASK,
|
||||
SoD::invslot::GENERAL_BITMASK,
|
||||
SoD::invslot::CURSOR_BITMASK,
|
||||
SoD::invslot::POSSESSIONS_BITMASK,
|
||||
SoD::invslot::CORPSE_BITMASK,
|
||||
SoD::invbag::SLOT_COUNT,
|
||||
@ -286,6 +339,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
UF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
UF::invslot::EQUIPMENT_BITMASK,
|
||||
UF::invslot::GENERAL_BITMASK,
|
||||
UF::invslot::CURSOR_BITMASK,
|
||||
UF::invslot::POSSESSIONS_BITMASK,
|
||||
UF::invslot::CORPSE_BITMASK,
|
||||
UF::invbag::SLOT_COUNT,
|
||||
@ -310,6 +366,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
RoF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
RoF::invslot::EQUIPMENT_BITMASK,
|
||||
RoF::invslot::GENERAL_BITMASK,
|
||||
RoF::invslot::CURSOR_BITMASK,
|
||||
RoF::invslot::POSSESSIONS_BITMASK,
|
||||
RoF::invslot::CORPSE_BITMASK,
|
||||
RoF::invbag::SLOT_COUNT,
|
||||
@ -334,6 +393,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
RoF2::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
||||
RoF2::invslot::GENERAL_BITMASK,
|
||||
RoF2::invslot::CURSOR_BITMASK,
|
||||
RoF2::invslot::POSSESSIONS_BITMASK,
|
||||
RoF2::invslot::CORPSE_BITMASK,
|
||||
RoF2::invbag::SLOT_COUNT,
|
||||
@ -358,6 +420,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::NPC::INULL
|
||||
),
|
||||
|
||||
EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -382,6 +447,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::NPCMerchant::INULL
|
||||
),
|
||||
|
||||
EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -406,6 +474,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::Merc::INULL
|
||||
),
|
||||
|
||||
EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -430,6 +501,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::Bot::INULL
|
||||
),
|
||||
|
||||
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
||||
EntityLimits::Bot::invslot::GENERAL_BITMASK,
|
||||
EntityLimits::Bot::invslot::CURSOR_BITMASK,
|
||||
EntityLimits::Bot::invslot::POSSESSIONS_BITMASK,
|
||||
EntityLimits::Bot::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -454,6 +528,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::ClientPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -478,6 +555,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::NPCPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -502,6 +582,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::MercPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -526,6 +609,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
EntityLimits::BotPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL,
|
||||
0, //EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
@ -550,6 +636,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
Titanium::INULL
|
||||
),
|
||||
|
||||
Titanium::INULL,
|
||||
Titanium::INULL,
|
||||
Titanium::INULL,
|
||||
Titanium::INULL,
|
||||
Titanium::INULL,
|
||||
Titanium::invbag::SLOT_COUNT,
|
||||
@ -574,6 +663,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
SoF::INULL
|
||||
),
|
||||
|
||||
SoF::INULL,
|
||||
SoF::INULL,
|
||||
SoF::INULL,
|
||||
SoF::INULL,
|
||||
SoF::INULL,
|
||||
SoF::invbag::SLOT_COUNT,
|
||||
@ -598,6 +690,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
SoD::INULL
|
||||
),
|
||||
|
||||
SoD::INULL,
|
||||
SoD::INULL,
|
||||
SoD::INULL,
|
||||
SoD::INULL,
|
||||
SoD::INULL,
|
||||
SoD::invbag::SLOT_COUNT,
|
||||
@ -622,6 +717,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
UF::INULL
|
||||
),
|
||||
|
||||
UF::INULL,
|
||||
UF::INULL,
|
||||
UF::INULL,
|
||||
UF::INULL,
|
||||
UF::INULL,
|
||||
UF::invbag::SLOT_COUNT,
|
||||
@ -646,6 +744,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
RoF::INULL
|
||||
),
|
||||
|
||||
RoF::INULL,
|
||||
RoF::INULL,
|
||||
RoF::INULL,
|
||||
RoF::INULL,
|
||||
RoF::INULL,
|
||||
RoF::invbag::SLOT_COUNT,
|
||||
@ -670,6 +771,9 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
RoF2::INULL
|
||||
),
|
||||
|
||||
RoF2::INULL,
|
||||
RoF2::INULL,
|
||||
RoF2::INULL,
|
||||
RoF2::INULL,
|
||||
RoF2::INULL,
|
||||
RoF2::invbag::SLOT_COUNT,
|
||||
@ -682,12 +786,101 @@ static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versi
|
||||
)
|
||||
};
|
||||
|
||||
const EQEmu::inventory::LookupEntry* EQEmu::inventory::Lookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &inventory_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
static bool inventory_dictionary_init = false;
|
||||
void EQEmu::inventory::InitializeDynamicLookups() {
|
||||
if (inventory_dictionary_init == true)
|
||||
return;
|
||||
inventory_dictionary_init = true;
|
||||
|
||||
// server is configured for static definitions
|
||||
if (RuleB(World, UseClientBasedExpansionSettings))
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
// if all of the above expansion bits are present, then static references will suffice
|
||||
if ((current_expansions & dynamic_check_mask) == dynamic_check_mask)
|
||||
return;
|
||||
|
||||
for (uint32 iter = static_cast<uint32>(EQEmu::versions::ClientVersion::Unknown); iter <= static_cast<uint32>(EQEmu::versions::LastClientVersion); ++iter) {
|
||||
// no need to dynamic this condition since it is the lowest compatibility standard at this time
|
||||
if (iter <= static_cast<uint32>(EQEmu::versions::ClientVersion::Titanium))
|
||||
continue;
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<client> == (int)MobVersion::<client>
|
||||
inventory_dynamic_lookup_entries[iter] = std::make_unique<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
|
||||
// clamp affected fields to the lowest standard
|
||||
inventory_dynamic_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
|
||||
inventory_dynamic_lookup_entries[iter]->EquipmentBitmask = Titanium::invslot::EQUIPMENT_BITMASK; // power source
|
||||
inventory_dynamic_lookup_entries[iter]->GeneralBitmask = Titanium::invslot::GENERAL_BITMASK; // general size
|
||||
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) {
|
||||
// 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) {
|
||||
// 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) {
|
||||
// update general size
|
||||
if (constants_static_lookup_entries[iter].ExpansionsMask & EQEmu::expansions::bitHoT)
|
||||
inventory_dynamic_lookup_entries[iter]->GeneralBitmask = RoF::invslot::GENERAL_BITMASK;
|
||||
}
|
||||
|
||||
// fixup possessions bitmask
|
||||
inventory_dynamic_lookup_entries[iter]->PossessionsBitmask =
|
||||
(
|
||||
inventory_dynamic_lookup_entries[iter]->EquipmentBitmask |
|
||||
inventory_dynamic_lookup_entries[iter]->GeneralBitmask |
|
||||
inventory_dynamic_lookup_entries[iter]->CursorBitmask
|
||||
);
|
||||
|
||||
// fixup corpse bitmask
|
||||
inventory_dynamic_lookup_entries[iter]->CorpseBitmask =
|
||||
(
|
||||
inventory_dynamic_lookup_entries[iter]->GeneralBitmask |
|
||||
inventory_dynamic_lookup_entries[iter]->CursorBitmask |
|
||||
(inventory_dynamic_lookup_entries[iter]->EquipmentBitmask << 34)
|
||||
);
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
const EQEmu::inventory::LookupEntry* EQEmu::inventory::DynamicLookup(versions::MobVersion mob_version)
|
||||
{
|
||||
mob_version = versions::ValidateMobVersion(mob_version);
|
||||
if (inventory_dynamic_lookup_entries[static_cast<int>(mob_version)])
|
||||
return inventory_dynamic_lookup_entries[static_cast<int>(mob_version)].get();
|
||||
|
||||
return &inventory_static_lookup_entries[static_cast<int>(mob_version)];
|
||||
}
|
||||
|
||||
const EQEmu::inventory::LookupEntry* EQEmu::inventory::StaticLookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &inventory_static_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
}
|
||||
|
||||
static std::unique_ptr<EQEmu::behavior::LookupEntry> behavior_dynamic_lookup_entries[EQEmu::versions::MobVersionCount];
|
||||
static const EQEmu::behavior::LookupEntry behavior_static_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
{
|
||||
/*[MobVersion::Unknown] =*/
|
||||
EQEmu::behavior::LookupEntry(
|
||||
@ -779,7 +972,28 @@ static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::version
|
||||
)
|
||||
};
|
||||
|
||||
const EQEmu::behavior::LookupEntry* EQEmu::behavior::Lookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &behavior_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
static bool behavior_dictionary_init = false;
|
||||
void EQEmu::behavior::InitializeDynamicLookups() {
|
||||
if (behavior_dictionary_init == true)
|
||||
return;
|
||||
behavior_dictionary_init = true;
|
||||
|
||||
if (RuleB(World, UseClientBasedExpansionSettings))
|
||||
return;
|
||||
|
||||
// use static references for now
|
||||
}
|
||||
|
||||
const EQEmu::behavior::LookupEntry* EQEmu::behavior::DynamicLookup(versions::MobVersion mob_version)
|
||||
{
|
||||
mob_version = versions::ValidateMobVersion(mob_version);
|
||||
if (behavior_dynamic_lookup_entries[static_cast<int>(mob_version)])
|
||||
return behavior_dynamic_lookup_entries[static_cast<int>(mob_version)].get();
|
||||
|
||||
return &behavior_static_lookup_entries[static_cast<int>(mob_version)];
|
||||
}
|
||||
|
||||
const EQEmu::behavior::LookupEntry* EQEmu::behavior::StaticLookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &behavior_static_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
void InitializeDynamicLookups();
|
||||
|
||||
namespace constants {
|
||||
struct LookupEntry {
|
||||
EQEmu::expansions::Expansion Expansion;
|
||||
@ -48,6 +50,7 @@ namespace EQEmu
|
||||
int PetBuffs;
|
||||
int MercBuffs;
|
||||
|
||||
LookupEntry(const LookupEntry *lookup_entry) { }
|
||||
LookupEntry(
|
||||
EQEmu::expansions::Expansion Expansion,
|
||||
uint32 ExpansionBit,
|
||||
@ -77,7 +80,10 @@ namespace EQEmu
|
||||
{ }
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::ClientVersion client_version);
|
||||
void InitializeDynamicLookups();
|
||||
|
||||
const LookupEntry* DynamicLookup(versions::ClientVersion client_version);
|
||||
const LookupEntry* StaticLookup(versions::ClientVersion client_version);
|
||||
|
||||
} /*constants*/
|
||||
|
||||
@ -127,6 +133,9 @@ namespace EQEmu
|
||||
int16 InventoryTypeSizeArray[25]; // should reflect EQEmu::invtype::TYPE_COUNT referenced in emu_constants.h
|
||||
};
|
||||
|
||||
uint64 EquipmentBitmask;
|
||||
uint64 GeneralBitmask;
|
||||
uint64 CursorBitmask;
|
||||
uint64 PossessionsBitmask;
|
||||
uint64 CorpseBitmask;
|
||||
int16 BagSlotCount;
|
||||
@ -137,8 +146,12 @@ namespace EQEmu
|
||||
bool ConcatenateInvTypeLimbo;
|
||||
bool AllowOverLevelEquipment;
|
||||
|
||||
LookupEntry(const LookupEntry *lookup_entry) { }
|
||||
LookupEntry(
|
||||
InventoryTypeSize_Struct InventoryTypeSize,
|
||||
uint64 EquipmentBitmask,
|
||||
uint64 GeneralBitmask,
|
||||
uint64 CursorBitmask,
|
||||
uint64 PossessionsBitmask,
|
||||
uint64 CorpseBitmask,
|
||||
int16 BagSlotCount,
|
||||
@ -149,6 +162,9 @@ namespace EQEmu
|
||||
bool AllowOverLevelEquipment
|
||||
) :
|
||||
InventoryTypeSize(InventoryTypeSize),
|
||||
EquipmentBitmask(EquipmentBitmask),
|
||||
GeneralBitmask(GeneralBitmask),
|
||||
CursorBitmask(CursorBitmask),
|
||||
PossessionsBitmask(PossessionsBitmask),
|
||||
CorpseBitmask(CorpseBitmask),
|
||||
BagSlotCount(BagSlotCount),
|
||||
@ -160,7 +176,10 @@ namespace EQEmu
|
||||
{ }
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||
void InitializeDynamicLookups();
|
||||
|
||||
const LookupEntry* DynamicLookup(versions::MobVersion mob_version);
|
||||
const LookupEntry* StaticLookup(versions::MobVersion mob_version);
|
||||
|
||||
} /*inventory*/
|
||||
|
||||
@ -168,6 +187,7 @@ namespace EQEmu
|
||||
struct LookupEntry {
|
||||
bool CoinHasWeight;
|
||||
|
||||
LookupEntry(const LookupEntry *lookup_entry) { }
|
||||
LookupEntry(
|
||||
bool CoinHasWeight
|
||||
) :
|
||||
@ -175,7 +195,10 @@ namespace EQEmu
|
||||
{ }
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||
void InitializeDynamicLookups();
|
||||
|
||||
const LookupEntry* DynamicLookup(versions::MobVersion mob_version);
|
||||
const LookupEntry* StaticLookup(versions::MobVersion mob_version);
|
||||
|
||||
} /*behavior*/
|
||||
|
||||
|
||||
@ -122,12 +122,12 @@ EQEmu::InventoryProfile::~InventoryProfile()
|
||||
bool EQEmu::InventoryProfile::SetInventoryVersion(versions::MobVersion inventory_version) {
|
||||
if (!m_mob_version_set) {
|
||||
m_mob_version = versions::ValidateMobVersion(inventory_version);
|
||||
m_lookup = inventory::Lookup(m_mob_version);
|
||||
m_lookup = inventory::StaticLookup(m_mob_version);
|
||||
m_mob_version_set = true;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
m_lookup = inventory::Lookup(versions::MobVersion::Unknown);
|
||||
m_lookup = inventory::StaticLookup(versions::MobVersion::Unknown);
|
||||
Log(Logs::General, Logs::Error, "InventoryVersion set request after initial set (old: %u, new: %u)",
|
||||
static_cast<uint32>(m_mob_version), static_cast<uint32>(inventory_version));
|
||||
return false;
|
||||
@ -1092,7 +1092,7 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
if (inventory::Lookup(m_mob_version)->AllowClickCastFromBag)
|
||||
if (inventory::StaticLookup(m_mob_version)->AllowClickCastFromBag)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ namespace EQEmu
|
||||
InventoryProfile() {
|
||||
m_mob_version = versions::MobVersion::Unknown;
|
||||
m_mob_version_set = false;
|
||||
m_lookup = inventory::Lookup(versions::MobVersion::Unknown);
|
||||
m_lookup = inventory::StaticLookup(versions::MobVersion::Unknown);
|
||||
}
|
||||
~InventoryProfile();
|
||||
|
||||
|
||||
@ -183,8 +183,12 @@ namespace RoF2
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
||||
|
||||
const uint64 POSSESSIONS_BITMASK = 0x00000003FFFFFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = 0x01FFFFFFFF800000; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x00000001FF800000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
||||
|
||||
|
||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
||||
const char* GetInvSlotName(int16 inv_type, int16 inv_slot);
|
||||
|
||||
@ -181,8 +181,12 @@ namespace RoF
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
||||
|
||||
const uint64 POSSESSIONS_BITMASK = 0x00000003FFFFFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = 0x01FFFFFFFF800000; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x00000001FF800000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
||||
|
||||
|
||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
||||
const char* GetInvSlotName(int16 inv_type, int16 inv_slot);
|
||||
|
||||
@ -191,8 +191,12 @@ namespace SoD
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
||||
|
||||
const uint64 POSSESSIONS_BITMASK = 0x000000027FFFFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = 0x01FFFFFE7F800000; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x000000007F800000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
||||
|
||||
|
||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
||||
const char* GetInvCorpseSlotName(int16 inv_slot);
|
||||
|
||||
@ -191,8 +191,12 @@ namespace SoF
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
||||
|
||||
const uint64 POSSESSIONS_BITMASK = 0x000000027FFFFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = 0x01FFFFFE7F800000; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x000000007F800000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
||||
|
||||
|
||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
||||
const char* GetInvCorpseSlotName(int16 inv_slot);
|
||||
|
||||
@ -190,8 +190,12 @@ namespace Titanium
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
||||
|
||||
const uint64 POSSESSIONS_BITMASK = 0x000000027FDFFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = 0x017FFFFE7F800000; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000005FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x000000007F800000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
||||
|
||||
|
||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
||||
const char* GetInvCorpseSlotName(int16 inv_slot);
|
||||
@ -276,9 +280,9 @@ namespace Titanium
|
||||
namespace constants {
|
||||
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::Titanium; }
|
||||
|
||||
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::PoR;
|
||||
const uint32 EXPANSION_BIT = EQEmu::expansions::bitPoR;
|
||||
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskPoR;
|
||||
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::DoD; // Someone had this as PoR in another section...
|
||||
const uint32 EXPANSION_BIT = EQEmu::expansions::bitDoD;
|
||||
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskDoD;
|
||||
|
||||
const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER
|
||||
|
||||
|
||||
@ -191,8 +191,12 @@ namespace UF
|
||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
||||
|
||||
const uint64 POSSESSIONS_BITMASK = 0x000000027FFFFFFF; // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = 0x01FFFFFE7F800000; // based on 34-slot count (RoF+)
|
||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
||||
const uint64 GENERAL_BITMASK = 0x000000007F800000;
|
||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
||||
|
||||
|
||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
||||
const char* GetInvCorpseSlotName(int16 inv_slot);
|
||||
|
||||
@ -116,6 +116,9 @@ int main() {
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
Log(Logs::General, Logs::UCS_Server, "Initialized dynamic dictionary entries");
|
||||
|
||||
database.ExpireMail();
|
||||
|
||||
if(Config->ChatPort != Config->MailPort)
|
||||
|
||||
@ -211,7 +211,7 @@ void Client::SendMaxCharCreate() {
|
||||
auto outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct));
|
||||
MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer;
|
||||
|
||||
mc->max_chars = EQEmu::constants::Lookup(m_ClientVersion)->CharacterCreationLimit;
|
||||
mc->max_chars = EQEmu::constants::StaticLookup(m_ClientVersion)->CharacterCreationLimit;
|
||||
if (mc->max_chars > EQEmu::constants::CHARACTER_CREATION_LIMIT)
|
||||
mc->max_chars = EQEmu::constants::CHARACTER_CREATION_LIMIT;
|
||||
|
||||
@ -765,7 +765,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
// This can probably be moved outside and have another method return requested info (don't forget to remove the #include "../common/shareddb.h" above)
|
||||
// (This is a literal translation of the original process..I don't see why it can't be changed to a single-target query over account iteration)
|
||||
if (!is_player_zoning) {
|
||||
size_t character_limit = EQEmu::constants::Lookup(eqs->ClientVersion())->CharacterCreationLimit;
|
||||
size_t character_limit = EQEmu::constants::StaticLookup(eqs->ClientVersion())->CharacterCreationLimit;
|
||||
if (character_limit > EQEmu::constants::CHARACTER_CREATION_LIMIT) { character_limit = EQEmu::constants::CHARACTER_CREATION_LIMIT; }
|
||||
if (eqs->ClientVersion() == EQEmu::versions::ClientVersion::Titanium) { character_limit = Titanium::constants::CHARACTER_CREATION_LIMIT; }
|
||||
|
||||
|
||||
@ -348,6 +348,9 @@ int main(int argc, char** argv) {
|
||||
Log(Logs::General, Logs::World_Server, "Loaded default rule set 'default'", tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
Log(Logs::General, Logs::World_Server, "Initialized dynamic dictionary entries");
|
||||
}
|
||||
|
||||
if (RuleB(World, ClearTempMerchantlist)) {
|
||||
|
||||
@ -36,7 +36,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 accountID, EQApplicationPacket **ou
|
||||
{
|
||||
/* Set Character Creation Limit */
|
||||
EQEmu::versions::ClientVersion client_version = EQEmu::versions::ConvertClientVersionBitToClientVersion(clientVersionBit);
|
||||
size_t character_limit = EQEmu::constants::Lookup(client_version)->CharacterCreationLimit;
|
||||
size_t character_limit = EQEmu::constants::StaticLookup(client_version)->CharacterCreationLimit;
|
||||
|
||||
// Validate against absolute server max
|
||||
if (character_limit > EQEmu::constants::CHARACTER_CREATION_LIMIT)
|
||||
|
||||
@ -838,7 +838,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::ConvertClientVersionToMobVersion(ClientVersion()))->CoinHasWeight) {
|
||||
if (EQEmu::behavior::StaticLookup(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;
|
||||
|
||||
@ -1374,7 +1374,7 @@ void Corpse::QueryLoot(Client* to) {
|
||||
cur = itemlist.begin();
|
||||
end = itemlist.end();
|
||||
|
||||
int corpselootlimit = EQEmu::inventory::Lookup(EQEmu::versions::ConvertClientVersionToMobVersion(to->ClientVersion()))->InventoryTypeSize.Corpse;
|
||||
int corpselootlimit = EQEmu::inventory::StaticLookup(EQEmu::versions::ConvertClientVersionToMobVersion(to->ClientVersion()))->InventoryTypeSize.Corpse;
|
||||
|
||||
for(; cur != end; ++cur) {
|
||||
ServerLootItem_Struct* sitem = *cur;
|
||||
|
||||
@ -374,6 +374,9 @@ int main(int argc, char** argv) {
|
||||
Log(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::InitializeDynamicLookups();
|
||||
Log(Logs::General, Logs::Zone_Server, "Initialized dynamic dictionary entries");
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
|
||||
@ -5619,12 +5619,12 @@ int Client::GetCurrentBuffSlots() const
|
||||
numbuffs++;
|
||||
if (GetLevel() > 74)
|
||||
numbuffs++;
|
||||
return EQEmu::ClampUpper(numbuffs, EQEmu::constants::Lookup(m_ClientVersion)->LongBuffs);
|
||||
return EQEmu::ClampUpper(numbuffs, EQEmu::constants::StaticLookup(m_ClientVersion)->LongBuffs);
|
||||
}
|
||||
|
||||
int Client::GetCurrentSongSlots() const
|
||||
{
|
||||
return EQEmu::constants::Lookup(m_ClientVersion)->ShortBuffs; // AAs dont affect this
|
||||
return EQEmu::constants::StaticLookup(m_ClientVersion)->ShortBuffs; // AAs dont affect this
|
||||
}
|
||||
|
||||
void Client::InitializeBuffSlots()
|
||||
|
||||
@ -3646,7 +3646,7 @@ void ZoneDatabase::LoadBuffs(Client *client)
|
||||
}
|
||||
|
||||
// We load up to the most our client supports
|
||||
max_slots = EQEmu::constants::Lookup(client->ClientVersion())->LongBuffs;
|
||||
max_slots = EQEmu::constants::StaticLookup(client->ClientVersion())->LongBuffs;
|
||||
for (int index = 0; index < max_slots; ++index) {
|
||||
if (!IsValidSpell(buffs[index].spellid))
|
||||
continue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user