Skip to content

Commit

Permalink
[9404] Fixed glyph apply with with specs.
Browse files Browse the repository at this point in the history
This resolve problem when glyph rejetect applied
at some spec if it applied already at another spec.
  • Loading branch information
VladimirMangos committed Feb 17, 2010
1 parent 3a0ecc0 commit 00cc0e3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 31 deletions.
11 changes: 4 additions & 7 deletions src/game/CharacterHandler.cpp
Expand Up @@ -1129,14 +1129,11 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data )
return;
}

if(uint32 glyph = _player->GetGlyph(slot))
if(_player->GetGlyph(slot))
{
if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
_player->RemoveAurasDueToSpell(gp->SpellId);
_player->SetGlyph(slot, 0);
_player->SendTalentsInfoData(false);
}
_player->ApplyGlyph(slot, false);
_player->SetGlyph(slot, 0);
_player->SendTalentsInfoData(false);
}
}

Expand Down
31 changes: 20 additions & 11 deletions src/game/Player.cpp
Expand Up @@ -15018,7 +15018,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadGlyphs(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));

_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)
if( HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) )
Expand Down Expand Up @@ -20223,23 +20223,32 @@ void Player::InitGlyphsForLevel()
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);
else
RemoveAurasDueToSpell(gp->SpellId);
CastSpell(this, gp->SpellId, true);
SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph);
}
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)
{
VehicleEntry const *ve = sVehicleStore.LookupEntry(vehicle->GetVehicleId());
Expand Down Expand Up @@ -21390,7 +21399,7 @@ void Player::ActivateSpec(uint8 specNum)
// unlearn GetActiveSpec() talents (not learned in specNum);
// learn specNum talents

ApplyGlyphAuras(false);
ApplyGlyphs(false);

SetActiveSpec(specNum);

Expand All @@ -21402,7 +21411,7 @@ void Player::ActivateSpec(uint8 specNum)
if (!IsActionButtonDataValid(itr->first,itr->second.GetAction(),itr->second.GetType(), this, false))
removeActionButton(m_activeSpec,itr->first);

ApplyGlyphAuras(true);
ApplyGlyphs(true);

SendInitialActionButtons();

Expand Down
5 changes: 3 additions & 2 deletions src/game/Player.h
Expand Up @@ -1581,9 +1581,10 @@ class MANGOS_DLL_SPEC Player : public Unit
void InitGlyphsForLevel();
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); }
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(); }
void ApplyGlyphAuras(bool apply);
void ApplyGlyph(uint8 slot, bool apply);
void ApplyGlyphs(bool apply);

uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); }
void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); }
Expand Down
12 changes: 2 additions & 10 deletions src/game/SpellEffects.cpp
Expand Up @@ -5951,17 +5951,9 @@ void Spell::EffectApplyGlyph(uint32 i)
}

// remove old glyph
if(uint32 oldglyph = player->GetGlyph(m_glyphIndex))
{
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->ApplyGlyph(m_glyphIndex, false);
player->SetGlyph(m_glyphIndex, glyph);
player->ApplyGlyph(m_glyphIndex, true);
player->SendTalentsInfoData(false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9403"
#define REVISION_NR "9404"
#endif // __REVISION_NR_H__

4 comments on commit 00cc0e3

@apop
Copy link

@apop apop commented on 00cc0e3 Feb 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. So what's left now for Dual Spec? Just the talent points moving over?

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talents is most hard part in fact.... lot more hard that all other dual functionality in sum.

@apop
Copy link

@apop apop commented on 00cc0e3 Feb 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not suprise me at all. What happens on the current build if the change-spec button is pushed? Does it just release the talent points as if the player had paid the gold for a manual re-spec or does it not function?

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gc, sorry for way how i write comment :/ I misundestand it and think that this complaint. :( I often first post and then only think :/

Please sign in to comment.