From 1bcf5d024b437325bcb5e62e698a1aeed527be97 Mon Sep 17 00:00:00 2001 From: ApoC Date: Mon, 19 Jan 2009 02:07:04 +0100 Subject: [PATCH] [7112] Fixed glyphs apply on character load. Signed-off-by: ApoC --- src/game/CharacterHandler.cpp | 2 +- src/game/Player.cpp | 31 +++++++++++++++++++++++++++++++ src/game/Player.h | 1 + src/game/SharedDefines.h | 2 ++ src/shared/revision_nr.h | 2 +- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 42132fea2..3d04c8a26 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -1206,7 +1206,7 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data ) uint32 slot; recv_data >> slot; - if(slot > 5) + if(slot > MAX_GLYPH_SLOT_INDEX) { sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); return; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 995e4a43b..cd8fe7680 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14317,6 +14317,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) //_LoadMail(); _LoadAuras(holder->GetResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff); + _LoadGlyphAuras(); // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura) if( HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) ) @@ -14596,6 +14597,36 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) CastSpell(this,SPELL_ID_PASSIVE_BATTLE_STANCE,true); } +void Player::_LoadGlyphAuras() +{ + for (uint8 i = 0; i <= MAX_GLYPH_SLOT_INDEX; ++i) + { + if (uint32 glyph = GetGlyph(i)) + { + if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + { + if (GlyphSlotEntry const *gs = sGlyphSlotStore.LookupEntry(GetGlyphSlot(i))) + { + if(gp->TypeFlags == gs->TypeFlags) + { + CastSpell(this, gp->SpellId, true); + continue; + } + else + sLog.outError("Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags); + } + else + sLog.outError("Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); + } + else + sLog.outError("Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); + + // On any error remove glyph + SetGlyph(i, 0); + } + } +} + void Player::LoadCorpse() { if( isAlive() ) diff --git a/src/game/Player.h b/src/game/Player.h index ff844d457..732ba2498 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2234,6 +2234,7 @@ class MANGOS_DLL_SPEC Player : public Unit void _LoadActions(QueryResult *result); void _LoadAuras(QueryResult *result, uint32 timediff); + void _LoadGlyphAuras(); void _LoadBoundInstances(QueryResult *result); void _LoadInventory(QueryResult *result, uint32 timediff); void _LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 2e0ac63f4..cf4c90549 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -440,6 +440,8 @@ enum ItemQualities #define SPELL_ATTR_EX6_UNK30 0x40000000 // 30 not set in 3.0.3 #define SPELL_ATTR_EX6_UNK31 0x80000000 // 31 not set in 3.0.3 +#define MAX_GLYPH_SLOT_INDEX 5 + enum SheathTypes { SHEATHETYPE_NONE = 0, diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0dc131817..2599845fe 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7111" + #define REVISION_NR "7112" #endif // __REVISION_NR_H__ -- 2.11.4.GIT