[9404] Fixed glyph apply with with specs.

This resolve problem when glyph rejetect applied
at some spec if it applied already at another spec.
This commit is contained in:
VladimirMangos 2010-02-18 00:53:51 +03:00
parent 7c555add76
commit e74f62ea31
5 changed files with 30 additions and 31 deletions

View file

@ -1129,14 +1129,11 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data )
return; return;
} }
if(uint32 glyph = _player->GetGlyph(slot)) if(_player->GetGlyph(slot))
{ {
if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) _player->ApplyGlyph(slot, false);
{ _player->SetGlyph(slot, 0);
_player->RemoveAurasDueToSpell(gp->SpellId); _player->SendTalentsInfoData(false);
_player->SetGlyph(slot, 0);
_player->SendTalentsInfoData(false);
}
} }
} }

View file

@ -15018,7 +15018,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadGlyphs(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGLYPHS)); _LoadGlyphs(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));
_LoadAuras(holder->GetResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff); _LoadAuras(holder->GetResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff);
ApplyGlyphAuras(true); ApplyGlyphs(true);
// add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura) // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
if( HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) ) if( HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) )
@ -20223,23 +20223,32 @@ void Player::InitGlyphsForLevel()
SetUInt32Value(PLAYER_GLYPHS_ENABLED, value); SetUInt32Value(PLAYER_GLYPHS_ENABLED, value);
} }
void Player::ApplyGlyphAuras(bool apply) void Player::ApplyGlyph(uint8 slot, bool apply)
{ {
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) if (uint32 glyph = GetGlyph(slot))
{ {
if (uint32 glyph = GetGlyph(i)) if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{ {
if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) if(apply)
{ {
if(apply) CastSpell(this, gp->SpellId, true);
CastSpell(this, gp->SpellId, true); SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph);
else }
RemoveAurasDueToSpell(gp->SpellId); else
{
RemoveAurasDueToSpell(gp->SpellId);
SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, 0);
} }
} }
} }
} }
void Player::ApplyGlyphs(bool apply)
{
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
ApplyGlyph(i,apply);
}
void Player::EnterVehicle(Vehicle *vehicle) void Player::EnterVehicle(Vehicle *vehicle)
{ {
VehicleEntry const *ve = sVehicleStore.LookupEntry(vehicle->GetVehicleId()); VehicleEntry const *ve = sVehicleStore.LookupEntry(vehicle->GetVehicleId());
@ -21390,7 +21399,7 @@ void Player::ActivateSpec(uint8 specNum)
// unlearn GetActiveSpec() talents (not learned in specNum); // unlearn GetActiveSpec() talents (not learned in specNum);
// learn specNum talents // learn specNum talents
ApplyGlyphAuras(false); ApplyGlyphs(false);
SetActiveSpec(specNum); SetActiveSpec(specNum);
@ -21402,7 +21411,7 @@ void Player::ActivateSpec(uint8 specNum)
if (!IsActionButtonDataValid(itr->first,itr->second.GetAction(),itr->second.GetType(), this, false)) if (!IsActionButtonDataValid(itr->first,itr->second.GetAction(),itr->second.GetType(), this, false))
removeActionButton(m_activeSpec,itr->first); removeActionButton(m_activeSpec,itr->first);
ApplyGlyphAuras(true); ApplyGlyphs(true);
SendInitialActionButtons(); SendInitialActionButtons();

View file

@ -1581,9 +1581,10 @@ class MANGOS_DLL_SPEC Player : public Unit
void InitGlyphsForLevel(); void InitGlyphsForLevel();
void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); } void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); } uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); }
void SetGlyph(uint8 slot, uint32 glyph) { m_glyphs[m_activeSpec][slot].SetId(glyph); SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph); } void SetGlyph(uint8 slot, uint32 glyph) { m_glyphs[m_activeSpec][slot].SetId(glyph); }
uint32 GetGlyph(uint8 slot) { return m_glyphs[m_activeSpec][slot].GetId(); } uint32 GetGlyph(uint8 slot) { return m_glyphs[m_activeSpec][slot].GetId(); }
void ApplyGlyphAuras(bool apply); void ApplyGlyph(uint8 slot, bool apply);
void ApplyGlyphs(bool apply);
uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); } uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); }
void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); } void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); }

View file

@ -5951,17 +5951,9 @@ void Spell::EffectApplyGlyph(uint32 i)
} }
// remove old glyph // remove old glyph
if(uint32 oldglyph = player->GetGlyph(m_glyphIndex)) player->ApplyGlyph(m_glyphIndex, false);
{
if(GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph))
{
player->RemoveAurasDueToSpell(old_gp->SpellId);
player->SetGlyph(m_glyphIndex, 0);
}
}
player->CastSpell(m_caster, gp->SpellId, true);
player->SetGlyph(m_glyphIndex, glyph); player->SetGlyph(m_glyphIndex, glyph);
player->ApplyGlyph(m_glyphIndex, true);
player->SendTalentsInfoData(false); player->SendTalentsInfoData(false);
} }
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9403" #define REVISION_NR "9404"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__