[Performance] Move Discipline Loading to Client::CompleteConnect() (#4466)

* [Performance] Move Character Discipline Loading

* Push

* Final
This commit is contained in:
Alex King 2024-09-09 19:20:12 -04:00 committed by GitHub
parent b1646381b0
commit 40fecbfaf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 7 deletions

View File

@ -934,6 +934,7 @@ void Client::CompleteConnect()
}
database.LoadAuras(this); // this ends up spawning them so probably safer to load this later (here)
database.LoadCharacterDisciplines(this);
entity_list.RefreshClientXTargets(this);
@ -1318,7 +1319,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
database.LoadCharacterInspectMessage(cid, &m_inspect_message); /* Load Character Inspect Message */
database.LoadCharacterSpellBook(cid, &m_pp); /* Load Character Spell Book */
database.LoadCharacterMemmedSpells(cid, &m_pp); /* Load Character Memorized Spells */
database.LoadCharacterDisciplines(cid, &m_pp); /* Load Character Disciplines */
database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */
database.LoadCharacterLeadershipAbilities(cid, &m_pp); /* Load Character Leadership AA's */
database.LoadCharacterTribute(this); /* Load CharacterTribute */

View File

@ -671,12 +671,16 @@ bool ZoneDatabase::LoadCharacterLeadershipAbilities(uint32 character_id, PlayerP
return true;
}
bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp){
bool ZoneDatabase::LoadCharacterDisciplines(Client* c)
{
if (!c) {
return false;
}
const auto& l = CharacterDisciplinesRepository::GetWhere(
database, fmt::format(
"`id` = {} ORDER BY `slot_id`",
character_id
c->CharacterID()
)
);
@ -684,16 +688,18 @@ bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_S
return false;
}
for (int slot_id = 0; slot_id < MAX_PP_DISCIPLINES; slot_id++) { // Initialize Disciplines
pp->disciplines.values[slot_id] = 0;
for (int slot_id = 0; slot_id < MAX_PP_DISCIPLINES; slot_id++) {
c->GetPP().disciplines.values[slot_id] = 0;
}
for (const auto& e : l) {
if (IsValidSpell(e.disc_id) && e.slot_id < MAX_PP_DISCIPLINES) {
pp->disciplines.values[e.slot_id] = e.disc_id;
c->GetPP().disciplines.values[e.slot_id] = e.disc_id;
}
}
c->SendDisciplineUpdate();
return true;
}

View File

@ -436,7 +436,7 @@ public:
bool LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp);
bool LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterDisciplines(Client* c);
bool LoadCharacterFactionValues(uint32 character_id, faction_map & val_list);
bool LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterLeadershipAbilities(uint32 character_id, PlayerProfile_Struct* pp);