Keyring, Unmem, Auras

This commit is contained in:
Chris Miles
2025-05-17 14:35:42 -05:00
parent eb366e67b7
commit 36fc7b6e7f
5 changed files with 45 additions and 17 deletions
+5 -8
View File
@@ -1553,10 +1553,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
}
if (SPDAT_RECORDS > 0) {
for (uint32 z = 0; z < EQ::spells::SPELL_GEM_COUNT; z++) {
if (m_pp.mem_spells[z] >= (uint32)SPDAT_RECORDS)
UnmemSpell(z, false);
}
UnmemSpellAll(false);
database.LoadBuffs(this);
uint32 max_slots = GetMaxBuffSlots();
@@ -10241,11 +10238,11 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app)
printf("Wrong size of LoadSpellSet_Struct! Expected: %zu, Got: %i\n", sizeof(LoadSpellSet_Struct), app->size);
return;
}
int i;
LoadSpellSet_Struct* ss = (LoadSpellSet_Struct*)app->pBuffer;
for (i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) {
if (ss->spell[i] != 0xFFFFFFFF)
LoadSpellSet_Struct *ss = (LoadSpellSet_Struct *) app->pBuffer;
for (int i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) {
if (ss->spell[i] != 0xFFFFFFFF) {
UnmemSpell(i, true);
}
}
}
+23 -3
View File
@@ -78,6 +78,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/misc_functions.h"
#include "../common/events/player_event_logs.h"
#include "../common/repositories/character_corpses_repository.h"
#include "../common/repositories/character_memmed_spells_repository.h"
#include "../common/repositories/spell_buckets_repository.h"
#include "data_bucket.h"
@@ -5953,11 +5954,30 @@ void Client::UnmemSpellBySpellID(int32 spell_id)
void Client::UnmemSpellAll(bool update_client)
{
for (int spell_gem = 0; spell_gem < EQ::spells::SPELL_GEM_COUNT; spell_gem++) {
if (IsValidSpell(m_pp.mem_spells[spell_gem])) {
UnmemSpell(spell_gem, update_client);
bool has_spells = false;
for (int slot = 0; slot < EQ::spells::SPELL_GEM_COUNT; slot++) {
if (IsValidSpell(m_pp.mem_spells[slot])) {
if (slot >= EQ::spells::SPELL_GEM_COUNT || slot < 0) {
return;
}
LogSpells("Spell [{}] forgotten from slot [{}]", m_pp.mem_spells[slot], slot);
if (update_client) {
MemorizeSpell(slot, m_pp.mem_spells[slot], memSpellForget);
}
m_pp.mem_spells[slot] = UINT32_MAX;
has_spells = true;
}
}
if (has_spells) {
CharacterMemmedSpellsRepository::DeleteWhere(
database,
fmt::format("`id` = {}", character_id)
);
}
}
uint32 Client::GetSpellIDByBookSlot(int book_slot) {
+5 -5
View File
@@ -3027,14 +3027,14 @@ void ZoneDatabase::LoadBuffs(Client *client)
void ZoneDatabase::SaveAuras(Client *c)
{
CharacterAurasRepository::DeleteOne(database, c->CharacterID());
const auto& auras = c->GetAuraMgr();
if (!auras.count) {
return;
}
std::vector<CharacterAurasRepository::CharacterAuras> v;
CharacterAurasRepository::DeleteOne(database, c->CharacterID());
auto e = CharacterAurasRepository::NewEntity();
const auto& auras = c->GetAuraMgr();
for (int slot_id = 0; slot_id < auras.count; ++slot_id) {
Aura* a = auras.auras[slot_id].aura;
if (a && a->AuraZones()) {