-
Posted by deltoide on Fri, 01 Aug 2014 00:49:12
Hello friends WowProgramming,
I have an addon that is with a small and simple problem, it works normally, but every time I open WoW and go into the game I need to give the command /reload for the addon to work, otherwise it is loaded but not working .
Can someone help me?
Below is the code ...
Lelex.toc
Interface: 50001
Title: Lelex
Author: Lelex
SavedVariables: Subtletydb
rotacao.lua
rotacao.lua
Subtlety = {} Subtlety.currentTarget = "" Subtlety.lastTarget = "" function FM_GetSpellNameById(spellId)
if (spellId == nil) then return nil end local spellName, rank, _, _, _, _, _, _, _ = GetSpellInfo(spellId) if rank==nil then return spellName elseif string.len(rank)>1 then return spellName.."("..rank..")" end return spellName
end local language = GetLocale(); if language == "esMX" then
Subtlety.L = { ["Garrote"] = "Garrote", ["Backstab"] = "Puñalada", ["Slice and Dice"] = "Hacer picadillo", ["Eviscerate"] = "Eviscerar", ["Rupture"] = "Ruptura", ["Recuperate"] = "Reponerse", ["Tricks of the Trade"] = "Secretos del oficio", ["Shadow Blades"] = "Paso de las Sombras", ["Hemorrhage"] = "Hemorragia", ["Ambush"] = "Emboscada", ["Vanish"] = "Esfumarse", ["Shadow Dance"] = "Danza de las Sombras", ["Premeditation"] = "Premeditación", ["Redirect"] = "Redirigir", ["Master of Subtlety"] = "Maestro de la sutileza", ["Stealth"] = "Sigilo", ["Generator"] = "Generator" }
elseif language == "frFR" then
Subtlety.L = { ["Garrote"] = "Garrot", ["Backstab"] = "Attaque sournoise", ["Slice and Dice"] = "Débiter", ["Eviscerate"] = "Eviscération", ["Rupture"] = "Rupture", ["Recuperate"] = "Conversion", ["Tricks of the Trade"] = "Ficelles du métier", ["Shadow Blades"] = "Pas de l'ombre", ["Hemorrhage"] = "Hémorragie", ["Ambush"] = "Embuscade", ["Vanish"] = "Disparition", ["Shadow Dance"] = "Danse de l'ombre", ["Premeditation"] = "Préméditation", ["Redirect"] = "Rediriger", ["Master of Subtlety"] = "Maître de la discrétion", ["Stealth"] = "Camouflage", ["Generator"] = "Generator" }
elseif language == "deDE" then
Subtlety.L = { ["Garrote"] = "Erdrosseln", ["Backstab"] = "Meucheln", ["Slice and Dice"] = "Zerhäckseln", ["Eviscerate"] = "Ausweiden", ["Rupture"] = "Blutung", ["Recuperate"] = "Gesundung", ["Tricks of the Trade"] = "Schurkenhandel", ["Shadow Blades"] = "Schattenschritt", ["Hemorrhage"] = "Blutsturz", ["Ambush"] = "Hinterhalt", ["Vanish"] = "Verschwinden", ["Shadow Dance"] = "Schattentanz", ["Premeditation"] = "Konzentration", ["Redirect"] = "Umlenken", ["Master of Subtlety"] = "Meister des hinterhältigen Angriffs", ["Stealth"] = "Verstohlenheit", ["Generator"] = "Generator" }
elseif language == "ruRU" then
Subtlety.L = { ["Garrote"] = "Гаррота", ["Backstab"] = "Удар в спину", ["Slice and Dice"] = "Мясорубка", ["Eviscerate"] = "Потрошение", ["Rupture"] = "Рваная рана", ["Recuperate"] = "Заживление ран", ["Tricks of the Trade"] = "Маленькие хитрости", ["Shadow Blades"] = "Шаг сквозь тень", ["Hemorrhage"] = "Кровоизлияние", ["Ambush"] = "Внезапный удар", ["Vanish"] = "Исчезновение", ["Shadow Dance"] = "Танец теней", ["Premeditation"] = "Умысел", ["Redirect"] = "Смена приоритетов", ["Master of Subtlety"] = "Мастер скрытности", ["Stealth"] = "Незаметность", ["Generator"] = "Generator" }
else
Subtlety.L = { ["Garrote"] = "Garrote", ["Backstab"] = "Backstab", ["Slice and Dice"] = "Slice and Dice", ["Eviscerate"] = "Eviscerate", ["Rupture"] = "Rupture", ["Recuperate"] = "Recuperate", ["Tricks of the Trade"] = "Tricks of the Trade", ["Shadow Blades"] = "Shadow Blades", ["Hemorrhage"] = "Hemorrhage", ["Ambush"] = "Ambush", ["Vanish"] = "Vanish", ["Shadow Dance"] = "Shadow Dance", ["Premeditation"] = "Premeditation", ["Redirect"] = "Redirect", ["Master of Subtlety"] = "Master of Subtlety", ["Stealth"] = "Stealth", ["Generator"] = "Generator" }
end Subtlety.L["Garrote"] = GetSpellInfo(703) Subtlety.L["Slice and Dice"] = GetSpellInfo(5171) Subtlety.L["Backstab"] = GetSpellInfo(53) Subtlety.L["Hemorrhage"] = GetSpellInfo(1752) Subtlety.L["Hemorrhage-Debuff"] = GetSpellInfo(16511) Subtlety.L["Eviscerate"] = GetSpellInfo(2098) Subtlety.L["Rupture"] = GetSpellInfo(1943) Subtlety.L["Recuperate"] = GetSpellInfo(73651) Subtlety.L["Tricks of the Trade"] = GetSpellInfo(57934) Subtlety.L["Shadow Blades"] = GetSpellInfo(121471) Subtlety.L["Shadow Dance"] = GetSpellInfo(51713) Subtlety.L["Ambush"] = GetSpellInfo(8676) Subtlety.L["Premeditation"] = GetSpellInfo(14183) Subtlety.L["Vanish"] = GetSpellInfo(1856) Subtlety.L["Redirect"] = GetSpellInfo(73981) Subtlety.timeSinceLastUpdate = 0 Subtlety.playerName = UnitName("player") Subtlety.textureList = { ["last"] = nil, ["redirect"] = nil, ["current"] = nil, ["next"] = nil, ["misc"] = nil, ["int"] = nil, ["ss"] = nil, } Subtlety.eventFrame = CreateFrame("Frame") Subtlety.eventFrame:SetScript("OnEvent", function(this, event, ...) Subtlety.eventsevent end) Subtlety.eventFrame:RegisterEvent("ADDONLOADED") Subtlety.eventFrame:RegisterEvent("PLAYERLOGIN") Subtlety.eventFrame:RegisterEvent("PLAYERALIVE") Subtlety.eventFrame:RegisterEvent("PLAYERTARGETCHANGED") Subtlety.eventFrame:RegisterEvent("PLAYERTALENTUPDATE") Subtlety.events = {} function Subtlety.events.PLAYERTALENT_UPDATE()
if GetSpecialization() == 3 then Subtlety.displayFrame:Show() else Subtlety.displayFrame:Hide() end
end function Subtlety.events.PLAYER_ALIVE()
Subtlety.eventFrame:UnregisterEvent("PLAYER_ALIVE")
end function Subtlety.events.PLAYER_LOGIN()
Subtlety.playerName = UnitName("player");
end function Subtlety.events.ADDON_LOADED(addon)
if addon ~= "Lelex" and GetSpecialization() == 3 then return end local _,playerClass = UnitClass("player") if playerClass ~= "ROGUE" then Subtlety.eventFrame:UnregisterEvent("PLAYER_ALIVE") Subtlety.eventFrame:UnregisterEvent("ADDON_LOADED") Subtlety.eventFrame:UnregisterEvent("PLAYER_LOGIN") Subtlety.eventFrame:UnregisterEvent("PLAYER_TARGET_CHANGED") Subtlety.eventFrame:UnregisterEvent("PLAYER_TALENT_UPDATE") return end if not Subtletydb then Subtletydb = {} end if not Subtletydb.scale then Subtletydb.scale = 1 end if not Subtletydb.RupturePoints then Subtletydb.RupturePoints = 5 end if not Subtletydb.RupturePriority then Subtletydb.RupturePriority = 2 end if not Subtletydb.SliceAndDicePoints then Subtletydb.SliceAndDicePoints = 5 end if not Subtletydb.SliceAndDicePriority then Subtletydb.SliceAndDicePriority = 1 end if Subtletydb.locked == nil then Subtletydb.locked = true end if not Subtletydb.x then Subtletydb.x = 100 end if not Subtletydb.y then Subtletydb.y = 100 end if not Subtletydb.SuggestVanish then Subtletydb.SuggestVanish = false end if not Subtletydb.SuggestBackstab then Subtletydb.SuggestBackstab = true end if not Subtletydb.SuggestShadowDance then Subtletydb.SuggestShadowDance = false end if not Subtletydb.SuggestTotT then Subtletydb.SuggestTotT = false end if Subtletydb.range == nil then Subtletydb.range = true end if (Subtletydb.SuggestBackstab == true) then Subtlety.L["Generator"] = Subtlety.L["Hemorrhage"] else Subtlety.L["Generator"] = Subtlety.L["Backstab"] end Subtlety:CreateGUI() Subtlety.displayFrame:SetScale(Subtletydb.scale) Subtlety:CreateOptionFrame() if Subtletydb.locked then Subtlety.displayFrame:SetScript("OnMouseDown", nil) Subtlety.displayFrame:SetScript("OnMouseUp", nil) Subtlety.displayFrame:SetScript("OnDragStop", nil) Subtlety.displayFrame:SetBackdropColor(0, 0, 0, 0) Subtlety.displayFrame:EnableMouse(false) else Subtlety.displayFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end) Subtlety.displayFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end) Subtlety.displayFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) Subtlety.displayFrame:SetBackdropColor(0, 0, 0, .4) Subtlety.displayFrame:EnableMouse(true) end Subtlety.eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") Subtlety.eventFrame:RegisterEvent("PLAYER_TARGET_CHANGED") if GetSpecialization() == 3 then Subtlety.displayFrame:Show() else Subtlety.displayFrame:Hide() end
end function Subtlety.events.COMBATLOGEVENTUNFILTERED(timestamp, event, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) end function Subtlety.events.COMBATRATINGUPDATE(unit) end function Subtlety.events.PLAYERTARGET_CHANGED(...)
Subtlety.lastTarget = Subtlety.currentTarget Subtlety.currentTarget = UnitGUID("target") if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then Subtlety.displayFrame_last:Hide() Subtlety.displayFrame_current:Hide() Subtlety.displayFrame_next:Hide() Subtlety.displayFrame_misc:Hide() Subtlety.displayFrame_int:Hide() Subtlety.displayFrame_ss:Hide() else Subtlety.displayFrame_last:Show() Subtlety.displayFrame_current:Show() Subtlety.displayFrame_next:Show() Subtlety.displayFrame_misc:Show() Subtlety.displayFrame_int:Show() Subtlety.displayFrame_ss:Show() Subtlety:DecideSpells() end
end function Subtlety:CreateGUI() local displayFrame = CreateFrame("Frame","SubtletyDisplayFrame",UIParent) displayFrame:SetFrameStrata("BACKGROUND") displayFrame:SetWidth(300) displayFrame:SetHeight(95) displayFrame:EnableMouse(true) displayFrame:SetMovable(true) displayFrame:SetClampedToScreen(true) displayFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end) displayFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end) displayFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) displayFrame:SetPoint("CENTER",-200,-200) local displayFramelast = CreateFrame("Frame","$parentlast", SubtletyDisplayFrame) local displayFramecurrent = CreateFrame("Frame","$parentcurrent", SubtletyDisplayFrame) local displayFramenext = CreateFrame("Frame","$parentnext", SubtletyDisplayFrame) local displayFramemisc = CreateFrame("Frame","$parentmisc", SubtletyDisplayFrame) local displayFrameint = CreateFrame("Frame","$parentint", SubtletyDisplayFrame) local displayFramess = CreateFrame("Frame","$parentss", SubtletyDisplayFrame) displayFramelast:SetWidth(45) displayFramecurrent:SetWidth(70) displayFramenext:SetWidth(45) displayFramemisc:SetWidth(45) displayFrameint:SetWidth(45) displayFramess:SetWidth(45) displayFramelast:SetHeight(45) displayFramecurrent:SetHeight(70) displayFramenext:SetHeight(45) displayFramemisc:SetHeight(45) displayFrameint:SetHeight(45) displayFramess:SetHeight(45) displayFramecurrent:SetPoint("TOPLEFT", 140, 40) displayFramenext:SetPoint("TOPLEFT", 150, -10) displayFramelast:SetPoint("TOPLEFT", 0, -10) displayFramemisc:SetPoint("TOPLEFT", 0, 40) displayFrameint:SetPoint("TOPLEFT", 50, 40) displayFramess:SetPoint("TOPLEFT", 50,-10) local t = displayFramelast:CreateTexture(nil,"BACKGROUND") t:SetTexture(nil) t:SetAllPoints(displayFramelast) t:SetAlpha(.8) displayFramelast.texture = t Subtlety.textureList["last"] = t t = displayFramecurrent:CreateTexture(nil,"BACKGROUND") t:SetTexture(nil) t:ClearAllPoints() t:SetAllPoints(displayFramecurrent) displayFramecurrent.texture = t Subtlety.textureList["current"] = t t = displayFramemisc:CreateTexture(nil,"BACKGROUND") t:SetTexture(nil) t:SetAllPoints(displayFramemisc) t:SetAlpha(.8) displayFramemisc.texture = t Subtlety.textureList["misc"] = t t = displayFrameint:CreateTexture(nil,"BACKGROUND") t:SetTexture(nil) t:SetAllPoints(displayFrameint) t:SetAlpha(.8) displayFrameint.texture = t Subtlety.textureList["int"] = t t = displayFramenext:CreateTexture(nil,"BACKGROUND") t:SetTexture(nil) t:SetAllPoints(displayFramenext) t:SetAlpha(.8) displayFramenext.texture = t Subtlety.textureList["next"] = t t = displayFramess:CreateTexture(nil,"BACKGROUND") t:SetTexture(nil) t:SetAllPoints(displayFramess) t:SetAlpha(.8) displayFramess.texture = t Subtlety.textureList["ss"] = t displayFrame:SetScript("OnUpdate", function(this, elapsed)
Subtlety:OnUpdate(elapsed)
end) local cooldownFrame = CreateFrame("Cooldown","$parentcooldown", SubtletyDisplayFramecurrent) cooldownFrame:SetHeight(70) cooldownFrame:SetWidth(70) cooldownFrame:ClearAllPoints() cooldownFrame:SetPoint("CENTER", displayFramecurrent, "CENTER", 0, 0) Subtlety.displayFrame = displayFrame Subtlety.displayFramelast = displayFramelast Subtlety.displayFramecurrent = displayFramecurrent Subtlety.displayFramenext = displayFramenext Subtlety.displayFramemisc = displayFramemisc Subtlety.displayFrameint = displayFrameint Subtlety.displayFramess = displayFrame_ss Subtlety.cooldownFrame = cooldownFrame end function Subtlety:OnUpdate(elapsed)
Subtlety.timeSinceLastUpdate = Subtlety.timeSinceLastUpdate + elapsed; Subtlety:DecideSpells()
end function Subtlety:Find(t, v, c) if type(t) == "table" and v then
v = (c==0 or c==2) and v:lower() or v for k, val in pairs(t) do val = (c==0 or c==2) and val:lower() or val if (c==1 or c==2) and val:find(v) or v == val then return k end end
end return nil end function Subtlety:DecideSpells()
Subtlety.timeSinceLastUpdate = 0; if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then return end Subtlety.Finisher = { { spell = "Rupture", name = "rupture", priority = Subtletydb.RupturePriority, points = Subtletydb.RupturePoints, energy = 25, expires = '0', }, { spell = "Slice and Dice", name = "slice_and_dice", priority = Subtletydb.SliceAndDicePriority, points = Subtletydb.SliceAndDicePoints, energy = 25, expires = '0', }, } function sort_func(a, b) return a.priority < b.priority; end table.sort(Subtlety.Finisher, sort_func); local guid = UnitGUID("target") local puid = UnitGUID("player") if guid == nil then Subtlety.textureList["last"]:SetTexture(nil) Subtlety.textureList["current"]:SetTexture(nil) Subtlety.textureList["next"]:SetTexture(nil) Subtlety.textureList["misc"]:SetTexture(nil) Subtlety.textureList["int"]:SetTexture(nil) Subtlety.textureList["ss"]:SetTexture(nil) return end local energy = UnitPower("player") local cp = GetComboPoints("player") local currentTime = GetTime() local spell = "" local nextspell = "" local miscspell = "" local intspell = "" local bleeds = 0 local cost = 0 local garrote = 0 local slice_and_dice = 0 local recuperate = 0 local rupture = 0 local premeditation = 0 local hemorrhage = 0 local vanish = 0 local tott = 0 local shadowblades = 0 local shadow_dance = 0 local master_of_subtlety = 0 local serrated_blades = 0 for i = 1, 2, 1 do local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitBuff("player", Subtlety.L[Subtlety.Finisher[i].spell]) currentTime = GetTime() if name ~= nil then if Subtlety.Finisher[i].name == "slice_and_dice" then Subtlety.Finisher[i]["expires"] = expirationTime - currentTime end end local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitDebuff("target", Subtlety.L[Subtlety.Finisher[i].spell]) currentTime = GetTime() if name ~= nil then if Subtlety.Finisher[i].name == "rupture" then Subtlety.Finisher[i]["expires"] = expirationTime - currentTime end end end local name, rank, icon, price, isFunnel, powerType, castTime, minRange, maxRange = GetSpellInfo(Subtlety.L["Generator"]) if name ~= nil then cost = price end local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitDebuff("target", Subtlety.L["Rupture"]) currentTime = GetTime() if name ~= nil and isMine == "player" then rupture = expirationTime - currentTime end local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitDebuff("target", Subtlety.L["Garrote"]) currentTime = GetTime() if name ~= nil and isMine == "player" then garrote = expirationTime - currentTime bleeds = 1 end local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitBuff("player", Subtlety.L["Master of Subtlety"]) currentTime = GetTime() if name ~= nil then master_of_subtlety = expirationTime - currentTime end local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitDebuff("target", Subtlety.L["Hemorrhage-Debuff"]) currentTime = GetTime() if name ~= nil and isMine == "player" then hemorrhage = expirationTime - currentTime end local start, duration, enabled = GetSpellCooldown(Subtlety.L["Tricks of the Trade"]); if duration ~= nil then tott = duration + start - currentTime else tott = 60 end local start, duration, enabled = GetSpellCooldown(Subtlety.L["Shadow Blades"]); if duration ~= nil then shadowblades = duration + start - currentTime else shadowblades = 60 end local start, duration, enabled = GetSpellCooldown(Subtlety.L["Vanish"]); if duration ~= nil then vanish = duration + start - currentTime else vanish = 60 end local start, duration, enabled = GetSpellCooldown(Subtlety.L["Shadow Dance"]); if duration ~= nil then shadow_dance = duration + start - currentTime else shadow_dance = 60 end if (UnitAura("player", Subtlety.L["Stealth"]) ~= nil or UnitBuff("player", Subtlety.L["Shadow Dance"]) ~= nil or UnitBuff("player", Subtlety.L["Vanish"]) ~= nil) then if UnitAura("player", Subtlety.L["Stealth"]) ~= nil then spell = Subtlety.L["Ambush"]; elseif (tott < 1) and (Subtletydb.SuggestTotT == true) then spell = Subtlety.L["Tricks of the Trade"]; elseif (tonumber(Subtlety.Finisher[1].expires) <= 1) and (cp >= tonumber(Subtlety.Finisher[1].points)) and (tonumber(Subtlety.Finisher[1].points) ~= 0) then if (energy >= Subtlety.Finisher[1].energy) then spell = Subtlety.L[Subtlety.Finisher[1].spell]; else nextspell = Subtlety.L[Subtlety.Finisher[1].spell]; end elseif (tonumber(Subtlety.Finisher[2].expires) <= 1) and (cp >= tonumber(Subtlety.Finisher[2].points)) and (tonumber(Subtlety.Finisher[2].points) ~= 0) then if (energy >= Subtlety.Finisher[2].energy) then spell = Subtlety.L[Subtlety.Finisher[2].spell]; else nextspell = Subtlety.L[Subtlety.Finisher[2].spell]; end elseif (cp == 5) then if (energy >= 25) then spell = Subtlety.L["Eviscerate"]; else nextspell = Subtlety.L["Eviscerate"]; end else if rupture == 0 then if (energy >= 50) then spell = Subtlety.L["Ambush"]; else nextspell = Subtlety.L["Ambush"]; end else if (energy >= 40) then spell = Subtlety.L["Ambush"]; else nextspell = Subtlety.L["Ambush"]; end end end end if (UnitAura("player", Subtlety.L["Stealth"]) == nil and UnitBuff("player", Subtlety.L["Shadow Dance"]) == nil and UnitBuff("player", Subtlety.L["Vanish"]) == nil) then if (rupture <= 5) and (cp == 5) and (rupture ~= 0) then if (energy >= 35) then spell = Subtlety.L["Eviscerate"]; else nextspell = Subtlety.L["Eviscerate"]; end elseif (tott < 1) and (Subtletydb.SuggestTotT == true) then spell = Subtlety.L["Tricks of the Trade"]; elseif (shadow_dance < 1) and (Subtletydb.SuggestShadowDance == true) then spell = Subtlety.L["Shadow Dance"]; elseif (vanish < 1) and (Subtletydb.SuggestVanish == true) and UnitAffectingCombat("player") == 1 then spell = Subtlety.L["Vanish"]; elseif (tonumber(Subtlety.Finisher[1].expires) <= 5) and (cp >= tonumber(Subtlety.Finisher[1].points)) and (tonumber(Subtlety.Finisher[1].points) ~= 0) then if (energy >= Subtlety.Finisher[1].energy) then spell = Subtlety.L[Subtlety.Finisher[1].spell]; else nextspell = Subtlety.L[Subtlety.Finisher[1].spell]; end elseif (tonumber(Subtlety.Finisher[2].expires) <= 5) and (cp >= tonumber(Subtlety.Finisher[2].points)) and (tonumber(Subtlety.Finisher[2].points) ~= 0) then if (energy >= Subtlety.Finisher[2].energy) then spell = Subtlety.L[Subtlety.Finisher[2].spell]; else nextspell = Subtlety.L[Subtlety.Finisher[2].spell]; end elseif (cp == 5) then if (energy >= 25) then spell = Subtlety.L["Eviscerate"]; else nextspell = Subtlety.L["Eviscerate"]; end else if (hemorrhage <= 5) then if (energy >= cost) then spell = Subtlety.L["Hemorrhage"]; else nextspell = Subtlety.L["Hemorrhage"]; end else if (energy >= cost) then spell = Subtlety.L["Generator"]; else nextspell = Subtlety.L["Generator"]; end end end end Subtlety.textureList["current"]:SetTexture(GetSpellBookItemTexture(spell)) Subtlety.textureList["next"]:SetTexture(GetSpellBookItemTexture(nextspell)) if shadow_dance < 1 then Subtlety.textureList["last"]:SetTexture(GetSpellBookItemTexture(Subtlety.L["Shadow Dance"])) else Subtlety.textureList["last"]:SetTexture(nil) end if tott < 1 then Subtlety.textureList["misc"]:SetTexture(GetSpellBookItemTexture(Subtlety.L["Tricks of the Trade"])) else Subtlety.textureList["misc"]:SetTexture(nil) end if (vanish < 1) then Subtlety.textureList["int"]:SetTexture(GetSpellBookItemTexture(Subtlety.L["Vanish"])) else Subtlety.textureList["int"]:SetTexture(nil) end if shadowblades < 1 then Subtlety.textureList["ss"]:SetTexture(GetSpellBookItemTexture(Subtlety.L["Shadow Blades"])) else Subtlety.textureList["ss"]:SetTexture(nil) end if spell ~= "" and spell ~= nil then local start, dur = GetSpellCooldown(spell) if dur == 0 or start == nil or dur == nil then Subtlety.cooldownFrame:SetAlpha(0) else Subtlety.cooldownFrame:SetAlpha(1) Subtlety.cooldownFrame:SetCooldown(start, dur) end end
end function Subtlety:CreateOptionFrame()
local panel = CreateFrame("FRAME", "SubtletyOptions"); panel.name = "Rotação Subterfúgio"; local fstring00 = panel:CreateFontString("SubtletyOptions_string00","OVERLAY","GameFontNormal") fstring00:SetText("Prioridade") fstring00:SetPoint("TOPLEFT", 355, -35) local fstring01 = panel:CreateFontString("SubtletyOptions_string01","OVERLAY","GameFontNormal") fstring01:SetText("Pontos de Combo") fstring01:SetPoint("TOPLEFT", 485, -35) local fstring2 = panel:CreateFontString("SubtletyOptions_string2","OVERLAY","GameFontNormal") fstring2:SetText("Ruptura") fstring2:SetPoint("TOPLEFT", 10, -70) local slider2a = CreateFrame("Slider", "$parent_s2a", panel, "OptionsSliderTemplate") slider2a:SetMinMaxValues(1, 2) slider2a:SetWidth(75) slider2a:SetValue(Subtlety:GetRupturePriority()) slider2a:SetValueStep(1) slider2a:SetScript("OnValueChanged", function(self) Subtlety:SetRupturePriority(self:GetValue()); getglobal(self:GetName() .. "Text"):SetText(self:GetValue()) end) getglobal(slider2a:GetName() .. "Low"):SetText("1") getglobal(slider2a:GetName() .. "High"):SetText("2") getglobal(slider2a:GetName() .. "Text"):SetText(Subtlety:GetRupturePriority()) slider2a:SetPoint("TOPRIGHT", -200, -70) local slider2b = CreateFrame("Slider", "$parent_s2b", panel, "OptionsSliderTemplate") slider2b:SetMinMaxValues(0, 5) slider2b:SetWidth(150) slider2b:SetValue(Subtlety:GetRupturePoints()) slider2b:SetValueStep(1) slider2b:SetScript("OnValueChanged", function(self) Subtlety:SetRupturePoints(self:GetValue()); getglobal(self:GetName() .. "Text"):SetText(self:GetValue()) end) getglobal(slider2b:GetName() .. "Low"):SetText("0") getglobal(slider2b:GetName() .. "High"):SetText("5") getglobal(slider2b:GetName() .. "Text"):SetText(Subtlety:GetRupturePoints()) slider2b:SetPoint("TOPRIGHT", -10, -70) local fstring3 = panel:CreateFontString("SubtletyOptions_string3","OVERLAY","GameFontNormal") fstring3:SetText("Retalhar") fstring3:SetPoint("TOPLEFT", 10, -100) local slider3a = CreateFrame("Slider", "$parent_s3a", panel, "OptionsSliderTemplate") slider3a:SetMinMaxValues(1, 2) slider3a:SetWidth(75) slider3a:SetValue(Subtlety:GetSliceAndDicePriority()) slider3a:SetValueStep(1) slider3a:SetScript("OnValueChanged", function(self) Subtlety:SetSliceAndDicePriority(self:GetValue()); getglobal(self:GetName() .. "Text"):SetText(self:GetValue()) end) getglobal(slider3a:GetName() .. "Low"):SetText("1") getglobal(slider3a:GetName() .. "High"):SetText("2") getglobal(slider3a:GetName() .. "Text"):SetText(Subtlety:GetSliceAndDicePriority()) slider3a:SetPoint("TOPRIGHT", -200, -100) local slider3b = CreateFrame("Slider", "$parent_s3b", panel, "OptionsSliderTemplate") slider3b:SetMinMaxValues(0, 5) slider3b:SetWidth(150) slider3b:SetValue(Subtlety:GetSliceAndDicePoints()) slider3b:SetValueStep(1) slider3b:SetScript("OnValueChanged", function(self) Subtlety:SetSliceAndDicePoints(self:GetValue()); getglobal(self:GetName() .. "Text"):SetText(self:GetValue()) end) getglobal(slider3b:GetName() .. "Low"):SetText("0") getglobal(slider3b:GetName() .. "High"):SetText("5") getglobal(slider3b:GetName() .. "Text"):SetText(Subtlety:GetSliceAndDicePoints()) slider3b:SetPoint("TOPRIGHT", -10, -100) local fstring4 = panel:CreateFontString("SubtletyOptions_string4","OVERLAY","GameFontNormal") fstring4:SetText("Sugerir Sumir na rotação") fstring4:SetPoint("TOPLEFT", 10, -150) local checkbox4 = CreateFrame("CheckButton", "$parent_cb4", panel, "OptionsCheckButtonTemplate") checkbox4:SetWidth(18) checkbox4:SetHeight(18) checkbox4:SetScript("OnClick", function() Subtlety:ToggleVanish() end) checkbox4:SetPoint("TOPRIGHT", -10, -150) checkbox4:SetChecked(Subtlety:GetVanish()) local fstring5 = panel:CreateFontString("SubtletyOptions_string4","OVERLAY","GameFontNormal") fstring5:SetText("Sugerir Hemorragia para gerar Pontos de Combo") fstring5:SetPoint("TOPLEFT", 10, -180) local checkbox5 = CreateFrame("CheckButton", "$parent_cb5", panel, "OptionsCheckButtonTemplate") checkbox5:SetWidth(18) checkbox5:SetHeight(18) checkbox5:SetScript("OnClick", function() Subtlety:ToggleBackstab() end) checkbox5:SetPoint("TOPRIGHT", -10, -180) checkbox5:SetChecked(Subtlety:GetBackstab()) local fstring6 = panel:CreateFontString("SubtletyOptions_string5","OVERLAY","GameFontNormal") fstring6:SetText("Sugerir Dança das Sombras") fstring6:SetPoint("TOPLEFT", 10, -210) local checkbox6 = CreateFrame("CheckButton", "$parent_cb6", panel, "OptionsCheckButtonTemplate") checkbox6:SetWidth(18) checkbox6:SetHeight(18) checkbox6:SetScript("OnClick", function() Subtlety:ToggleShadowDance() end) checkbox6:SetPoint("TOPRIGHT", -10, -210) checkbox6:SetChecked(Subtlety:GetShadowDance()) local fstring7 = panel:CreateFontString("SubtletyOptions_string7","OVERLAY","GameFontNormal") fstring7:SetText("Sugerir Truques do Ofício") fstring7:SetPoint("TOPLEFT", 10, -240) local checkbox7 = CreateFrame("CheckButton", "$parent_cb7", panel, "OptionsCheckButtonTemplate") checkbox7:SetWidth(18) checkbox7:SetHeight(18) checkbox7:SetScript("OnClick", function() Subtlety:ToggleTotT() end) checkbox7:SetPoint("TOPRIGHT", -10, -240) checkbox7:SetChecked(Subtlety:GetTotT()) local fstring8 = panel:CreateFontString("SubtletyOptions_string8","OVERLAY","GameFontNormal") fstring8:SetText("Escala GUI") fstring8:SetPoint("TOPLEFT", 10, -280) local slider8 = CreateFrame("Slider", "$parent_s8", panel, "OptionsSliderTemplate") slider8:SetMinMaxValues(.5, 1.5) slider8:SetValue(Subtlety:GetScale()) slider8:SetValueStep(.05) slider8:SetScript("OnValueChanged", function(self) Subtlety:SetScale(self:GetValue()); getglobal(self:GetName() .. "Text"):SetText(self:GetValue()) end) getglobal(slider8:GetName() .. "Low"):SetText("0.5") getglobal(slider8:GetName() .. "High"):SetText("1.5") getglobal(slider8:GetName() .. "Text"):SetText(Subtlety:GetScale()) slider8:SetPoint("TOPRIGHT", -10, -280) local fstring9 = panel:CreateFontString("SubtletyOptions_string1","OVERLAY","GameFontNormal") fstring9:SetText("Travar") fstring9:SetPoint("TOPLEFT", 10, -320) local checkbox9 = CreateFrame("CheckButton", "$parent_cb9", panel, "OptionsCheckButtonTemplate") checkbox9:SetWidth(18) checkbox9:SetHeight(18) checkbox9:SetScript("OnClick", function() Subtlety:ToggleLocked() end) checkbox9:SetPoint("TOPRIGHT", -10, -320) checkbox9:SetChecked(Subtlety:GetLocked()) InterfaceOptions_AddCategory(panel);
end function Subtlety:GetLocked()
return Subtletydb.locked
end function Subtlety:ToggleLocked()
if Subtletydb.locked then Subtletydb.locked = false Subtlety.displayFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end) Subtlety.displayFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end) Subtlety.displayFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) Subtlety.displayFrame:SetBackdropColor(0, 0, 0, .4) Subtlety.displayFrame:EnableMouse(true) else Subtletydb.locked = true Subtlety.displayFrame:SetScript("OnMouseDown", nil) Subtlety.displayFrame:SetScript("OnMouseUp", nil) Subtlety.displayFrame:SetScript("OnDragStop", nil) Subtlety.displayFrame:SetBackdropColor(0, 0, 0, 0) Subtlety.displayFrame:EnableMouse(false) end
end function Subtlety:GetScale()
return Subtletydb.scale
end function Subtlety:SetScale(num)
Subtletydb.scale = num Subtlety.displayFrame:SetScale(Subtletydb.scale) Subtlety.cooldownFrame:SetScale(Subtletydb.scale)
end function Subtlety.Options(msg, editBox)
if(msg == 'show') then Subtlety.displayFrame:Show() elseif(msg == 'hide') then Subtlety.displayFrame:Hide() elseif(msg == '') then InterfaceOptionsFrame_OpenToCategory(getglobal("SubtletyOptions")) else end
end function Subtlety:GetRupturePoints()
return Subtletydb.RupturePoints
end function Subtlety:SetRupturePoints(num)
Subtletydb.RupturePoints = num
end function Subtlety:GetRupturePriority()
return Subtletydb.RupturePriority
end function Subtlety:SetRupturePriority(num)
Subtletydb.RupturePriority = num
end function Subtlety:GetSliceAndDicePoints()
return Subtletydb.SliceAndDicePoints
end function Subtlety:SetSliceAndDicePoints(num)
Subtletydb.SliceAndDicePoints = num
end function Subtlety:GetSliceAndDicePriority()
return Subtletydb.SliceAndDicePriority
end function Subtlety:SetSliceAndDicePriority(num)
Subtletydb.SliceAndDicePriority = num
end function Subtlety:GetVanish()
return Subtletydb.SuggestVanish
end function Subtlety:GetShadowDance()
return Subtletydb.SuggestShadowDance
end function Subtlety:GetBackstab()
return Subtletydb.SuggestBackstab
end function Subtlety:GetTotT()
return Subtletydb.SuggestTotT
end function Subtlety:ToggleVanish()
if(Subtletydb.SuggestVanish == true) then Subtletydb.SuggestVanish = false else Subtletydb.SuggestVanish = true end
end function Subtlety:ToggleShadowDance()
if(Subtletydb.SuggestShadowDance == true) then Subtletydb.SuggestShadowDance = false else Subtletydb.SuggestShadowDance = true end
end function Subtlety:ToggleBackstab()
if(Subtletydb.SuggestBackstab == true) then Subtletydb.SuggestBackstab = false Subtlety.L["Generator"] = Subtlety.L["Backstab"] else Subtletydb.SuggestBackstab = true Subtlety.L["Generator"] = Subtlety.L["Hemorrhage"] end
end function Subtlety:ToggleTotT()
if(Subtletydb.SuggestTotT == true) then Subtletydb.SuggestTotT = false else Subtletydb.SuggestTotT = true end
end