Skip to content

Instantly share code, notes, and snippets.

@Romain-P
Last active December 27, 2017 14:13
Show Gist options
  • Select an option

  • Save Romain-P/536528b4a6d287872c246ba671a85991 to your computer and use it in GitHub Desktop.

Select an option

Save Romain-P/536528b4a6d287872c246ba671a85991 to your computer and use it in GitHub Desktop.
Fix for feature <<Always-Facing>> - The character dont move anymore while being stunned
if not defined then defined = true
ewt_user = true
got_control = true -- to know if the player is stun or not
-- all pvp stun ids
StunList = {
20066,6770,8122,1776,108194,89766,113801,117526,119392,1833,44572,105593,117418,120086,47481,853,19577,24394,408,119381,22570,5211,
91797,64044,118345,163505,115001,30283,132168,46968,118905,132169,34510,131402,123420,20549,103828
}
function CheckEwtAutoFacing()
local stunned = false
for _,id in pairs(StunList) do
local spell = GetSpellInfo(id)
if spell ~= nil then
if UnitDebuff("player", spell) ~= nil then
if not stunned then
stunned = true
end
if got_control and ewt_user then
RunMacroText(".alwaysfacing")
got_control = false
end
end
end
end
if ewt_user and not stunned and not got_control then
RunMacroText(".alwaysfacing")
got_control = true
end
end
local combatFrame = CreateFrame("FRAME", nil, UIParent)
combatFrame:RegisterEvent("UNIT_AURA")
combatFrame:SetScript("OnEvent",
function(self, event, _, type, _, caster, _, _, target, _, spell)
if event == "UNIT_AURA" then
CheckEwtAutoFacing()
end
end
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment