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

View File

@ -7109,6 +7109,17 @@ ALTER TABLE `npc_types`
ALTER TABLE `character_data` ALTER TABLE `character_data`
CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`, CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`,
ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`; ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`;
)",
.content_schema_update = false
},
ManifestEntry{
.version = 9324,
.description = "2025_05_17_keyring_index.sql",
.check = "SHOW CREATE TABLE keyring",
.condition = "missing",
.match = "idx_charid_itemid",
.sql = R"(
ALTER TABLE keyring ADD INDEX idx_charid_itemid (char_id, item_id);
)", )",
.content_schema_update = false .content_schema_update = false
}, },

View File

@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/ */
#define CURRENT_BINARY_DATABASE_VERSION 9323 #define CURRENT_BINARY_DATABASE_VERSION 9324
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
#define CUSTOM_BINARY_DATABASE_VERSION 0 #define CUSTOM_BINARY_DATABASE_VERSION 0

View File

@ -1553,10 +1553,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
} }
if (SPDAT_RECORDS > 0) { if (SPDAT_RECORDS > 0) {
for (uint32 z = 0; z < EQ::spells::SPELL_GEM_COUNT; z++) { UnmemSpellAll(false);
if (m_pp.mem_spells[z] >= (uint32)SPDAT_RECORDS)
UnmemSpell(z, false);
}
database.LoadBuffs(this); database.LoadBuffs(this);
uint32 max_slots = GetMaxBuffSlots(); 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); printf("Wrong size of LoadSpellSet_Struct! Expected: %zu, Got: %i\n", sizeof(LoadSpellSet_Struct), app->size);
return; return;
} }
int i; LoadSpellSet_Struct *ss = (LoadSpellSet_Struct *) app->pBuffer;
LoadSpellSet_Struct* ss = (LoadSpellSet_Struct*)app->pBuffer; for (int i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) {
for (i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) { if (ss->spell[i] != 0xFFFFFFFF) {
if (ss->spell[i] != 0xFFFFFFFF)
UnmemSpell(i, true); UnmemSpell(i, true);
}
} }
} }

View File

@ -78,6 +78,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/misc_functions.h" #include "../common/misc_functions.h"
#include "../common/events/player_event_logs.h" #include "../common/events/player_event_logs.h"
#include "../common/repositories/character_corpses_repository.h" #include "../common/repositories/character_corpses_repository.h"
#include "../common/repositories/character_memmed_spells_repository.h"
#include "../common/repositories/spell_buckets_repository.h" #include "../common/repositories/spell_buckets_repository.h"
#include "data_bucket.h" #include "data_bucket.h"
@ -5953,11 +5954,30 @@ void Client::UnmemSpellBySpellID(int32 spell_id)
void Client::UnmemSpellAll(bool update_client) void Client::UnmemSpellAll(bool update_client)
{ {
for (int spell_gem = 0; spell_gem < EQ::spells::SPELL_GEM_COUNT; spell_gem++) { bool has_spells = false;
if (IsValidSpell(m_pp.mem_spells[spell_gem])) { for (int slot = 0; slot < EQ::spells::SPELL_GEM_COUNT; slot++) {
UnmemSpell(spell_gem, update_client); 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) { uint32 Client::GetSpellIDByBookSlot(int book_slot) {

View File

@ -3027,14 +3027,14 @@ void ZoneDatabase::LoadBuffs(Client *client)
void ZoneDatabase::SaveAuras(Client *c) void ZoneDatabase::SaveAuras(Client *c)
{ {
CharacterAurasRepository::DeleteOne(database, c->CharacterID()); const auto& auras = c->GetAuraMgr();
if (!auras.count) {
return;
}
std::vector<CharacterAurasRepository::CharacterAuras> v; std::vector<CharacterAurasRepository::CharacterAuras> v;
CharacterAurasRepository::DeleteOne(database, c->CharacterID());
auto e = CharacterAurasRepository::NewEntity(); auto e = CharacterAurasRepository::NewEntity();
const auto& auras = c->GetAuraMgr();
for (int slot_id = 0; slot_id < auras.count; ++slot_id) { for (int slot_id = 0; slot_id < auras.count; ++slot_id) {
Aura* a = auras.auras[slot_id].aura; Aura* a = auras.auras[slot_id].aura;
if (a && a->AuraZones()) { if (a && a->AuraZones()) {