if select(2, UnitClass("player")) ~= "ROGUE" then return end

local GetSpellInfo = GetSpellInfo
local IsSpellKnown = IsSpellKnown
local UnitBuff = UnitBuff
local CooldownFrame_SetTimer = CooldownFrame_SetTimer
local GetSpellCooldown = GetSpellCooldown
local InCombatLockdown = InCombatLockdown
local ClearOverrideBindings = ClearOverrideBindings
local GetBindingKey = GetBindingKey
local SetOverrideBindingClick = SetOverrideBindingClick
local GetCVarBool = GetCVarBool
local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor
local GameTooltip = GameTooltip

local SPELL_ID = 13877 -- Blade Flurry
local SPELL_NAME, _, SPELL_TEXTURE = GetSpellInfo(SPELL_ID)
local hasSpell, spellsChanged, bindingsChanged

-- Our stance button
local frame = CreateFrame("CheckButton", "BladeFlurryStanceButton", ShapeshiftButton1:GetParent(), "SecureActionButtonTemplate")
frame:SetAttribute("type", "spell")
frame:SetAttribute("spell", SPELL_NAME)
frame.icon = frame:CreateTexture(frame:GetName().."Icon", "BACKGROUND")
frame.icon:SetAllPoints(frame)
frame.icon:SetTexture(SPELL_TEXTURE)
frame.cooldown = CreateFrame("Cooldown", frame:GetName().."Cooldown", frame, "CooldownFrameTemplate")
frame.cooldown:SetAllPoints(frame)
frame:SetPushedTexture("Interface\Buttons\UI-Quickslot-Depress")
frame:SetHighlightTexture("Interface\Buttons\ButtonHilight-Square", "ADD")
frame:SetCheckedTexture("Interface\Buttons\CheckButtonHilight", "ADD")
frame:SetAllPoints(ShapeshiftButton2) -- Located at where ShapeshiftButton2 exactly is
frame:Hide()

local function UpdateCooldown()
if hasSpell then
CooldownFrame_SetTimer(frame.cooldown, GetSpellCooldown(SPELL_ID))
end
end

local function UpdateFrame()
if UnitBuff("player", SPELL_NAME) then
frame.icon:SetTexture("Interface\Icons\Ability_Warrior_Warbringer")
frame:SetChecked(true)
else
frame.icon:SetTexture(SPELL_TEXTURE)
frame:SetChecked(false)
end
end

-- Need to do combat check first!
local function UpdateFrameShowHide()
spellsChanged = nil
if hasSpell then
frame:Show()
else
frame:Hide()
end
end

-- Thing must be changed according to the player does or does not have Blade Flurry learned
local function OnSpellsChanged()
hasSpell = IsSpellKnown(SPELL_ID)
if hasSpell then
frame:RegisterEvent("UNIT_AURA")
frame:RegisterEvent("SPELL_UPDATE_COOLDOWN")
UpdateFrame()
UpdateCooldown()
else
frame:UnregisterEvent("UNIT_AURA")
frame:UnregisterEvent("SPELL_UPDATE_COOLDOWN")
end

if InCombatLockdown() then
spellsChanged = 1
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
else
UpdateFrameShowHide()
end
end

-- Copy key bindings from "SHAPESHIFTBUTTON2", it makes our frame more professional, LOL
local function OnUpdateBindings()
bindingsChanged = nil
ClearOverrideBindings(frame)
local key1, key2 = GetBindingKey("SHAPESHIFTBUTTON2")
if key1 then
SetOverrideBindingClick(frame, 1, key1, frame:GetName())
end

if key2 then
SetOverrideBindingClick(frame, 1, key2, frame:GetName())
end
end

frame:SetScript("OnShow", function(self)
UpdateFrame()
UpdateCooldown()
end)

frame:SetScript("PreClick", function(self)
UpdateFrame()
end)

-- Spell tooltip
frame:SetScript("OnEnter", function(self)
if not hasSpell then
return
end

if GetCVarBool("UberTooltips") then
GameTooltip_SetDefaultAnchor(GameTooltip, self)
else
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
end
GameTooltip:SetSpellByID(SPELL_ID)
end)

frame:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)

frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("SPELLS_CHANGED")
frame:RegisterEvent("UPDATE_BINDINGS")

frame:SetScript("OnEvent", function(self, event, unit)
if event == "PLAYER_LOGIN" or (event == "SPELLS_CHANGED" and not unit) then
OnSpellsChanged()
elseif event == "UNIT_AURA" and unit == "player" then
UpdateFrame()
elseif event == "SPELL_UPDATE_COOLDOWN" then
UpdateCooldown()
elseif event == "UPDATE_BINDINGS" then
if InCombatLockdown() then
bindingsChanged = 1
self:RegisterEvent("PLAYER_REGEN_ENABLED")
else
OnUpdateBindings()
end
elseif event == "PLAYER_REGEN_ENABLED" then
-- Something happened during last combat, update now
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
if bindingsChanged then
OnUpdateBindings()
end

if spellsChanged then
UpdateFrameShowHide()
end
end
end)

애드온이 작동이 안되는데..이거 어디가 잘못된것일까요...
능력자분 도와주세요!