diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index f8862615a7..5b279b8d21 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -3561,9 +3561,20 @@ namespace LuaPlayer uint32 glyphId = ALE::CHECKVAL(L, 2); uint32 slotIndex = ALE::CHECKVAL(L, 3); + // Remove the effect of the old glyph if it exists + uint32 oldGlyphId = player->GetGlyph(slotIndex); + if (oldGlyphId) + if (GlyphPropertiesEntry const* oldEntry = sGlyphPropertiesStore.LookupEntry(oldGlyphId)) + player->RemoveAurasDueToSpell(oldEntry->SpellId); + player->SetGlyph(slotIndex, glyphId, true); player->SendTalentsInfoData(false); // Also handles GlyphData + // Apply the effect of the new glyph if it exists + if (glyphId) + if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId)) + player->CastSpell(player, glyphEntry->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK & ~(TRIGGERED_IGNORE_SHAPESHIFT | TRIGGERED_IGNORE_CASTER_AURASTATE))); + return 0; }