Commit f35c6cac authored by Simpy's avatar Simpy 🐹

clean some files.. this took one hour.. x~x

parent d864d6d6
......@@ -6,7 +6,7 @@ local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, Private
--Lua functions
local random = random
local tremove = tremove
-----
--WoW API / Variables
function E:SetUpAnimGroup(object, type, ...)
if not type then type = 'Flash' end
......
......@@ -24,7 +24,7 @@ local Masque = E.Libs.Masque
--Lua functions
local _G = _G
local tonumber, pairs, ipairs, error, unpack, select, tostring = tonumber, pairs, ipairs, error, unpack, select, tostring
local assert, type, pcall, date = assert, type, pcall, date
local assert, type, pcall, date, print = assert, type, pcall, date, print
local twipe, tinsert, tremove, next = wipe, tinsert, tremove, next
local gsub, strmatch, strjoin = gsub, match, strjoin
local format, find, strrep, len, sub = format, strfind, strrep, strlen, strsub
......@@ -43,7 +43,6 @@ local IsAddOnLoaded = IsAddOnLoaded
local IsInInstance, IsInGuild = IsInInstance, IsInGuild
local IsInRaid, IsInGroup = IsInRaid, IsInGroup
local JoinChannelByName = JoinChannelByName
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local RequestBattlefieldScoreData = RequestBattlefieldScoreData
local UnitFactionGroup = UnitFactionGroup
local UnitGUID = UnitGUID
......@@ -246,9 +245,9 @@ end
function E:CheckClassColor(r, g, b)
r, g, b = E:GrabColorPickerValues(r, g, b)
local matchFound = false
for class in pairs(RAID_CLASS_COLORS) do
for class in pairs(_G.RAID_CLASS_COLORS) do
if class ~= E.myclass then
local colorTable = class == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class])
local colorTable = class == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[class] or _G.RAID_CLASS_COLORS[class])
local red, green, blue = E:GrabColorPickerValues(colorTable.r, colorTable.g, colorTable.b)
if red == r and green == g and blue == b then
matchFound = true
......@@ -322,7 +321,7 @@ function E:UpdateMedia()
--Border Color
local border = E.db.general.bordercolor
if self:CheckClassColor(border.r, border.g, border.b) then
local classColor = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
local classColor = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or _G.RAID_CLASS_COLORS[E.myclass])
E.db.general.bordercolor.r = classColor.r
E.db.general.bordercolor.g = classColor.g
E.db.general.bordercolor.b = classColor.b
......@@ -333,7 +332,7 @@ function E:UpdateMedia()
--UnitFrame Border Color
border = E.db.unitframe.colors.borderColor
if self:CheckClassColor(border.r, border.g, border.b) then
local classColor = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
local classColor = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or _G.RAID_CLASS_COLORS[E.myclass])
E.db.unitframe.colors.borderColor.r = classColor.r
E.db.unitframe.colors.borderColor.g = classColor.g
E.db.unitframe.colors.borderColor.b = classColor.b
......@@ -350,7 +349,7 @@ function E:UpdateMedia()
local value = self.db.general.valuecolor
if self:CheckClassColor(value.r, value.g, value.b) then
value = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
value = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or _G.RAID_CLASS_COLORS[E.myclass])
self.db.general.valuecolor.r = value.r
self.db.general.valuecolor.g = value.g
self.db.general.valuecolor.b = value.b
......
......@@ -33,7 +33,6 @@ local CLASS, CONTINUE, PREVIOUS = CLASS, CONTINUE, PREVIOUS
local NUM_CHAT_WINDOWS = NUM_CHAT_WINDOWS
local LOOT, GENERAL, TRADE = LOOT, GENERAL, TRADE
local GUILD_EVENT_LOG = GUILD_EVENT_LOG
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
-- GLOBALS: ElvUIInstallFrame
local CURRENT_PAGE = 0
......@@ -180,7 +179,7 @@ function E:SetupTheme(theme, noDisplayMsg)
E.db.unitframe.colors.castColor = E:GetColor(.31, .31, .31)
E.db.unitframe.colors.castClassColor = false
elseif theme == "class" then
classColor = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
classColor = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or _G.RAID_CLASS_COLORS[E.myclass])
E.db.general.bordercolor = (E.PixelMode and E:GetColor(0, 0, 0) or E:GetColor(.31, .31, .31))
E.db.general.backdropcolor = E:GetColor(.1, .1, .1)
......
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
--Lua functions
local _G = _G
local format = format
local tinsert = tinsert
local select, tonumber = select, tonumber
local next, max, wipe = next, max, wipe
--WoW API / Variables
local UnitIsUnit = UnitIsUnit
local GetCVarBool = GetCVarBool
local GetItemInfo = GetItemInfo
......
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
--Lua functions
local select = select
local pairs = pairs
--WoW API / Variables
......
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
--Lua functions
local tinsert, tremove, next = tinsert, tremove, next
local select, tonumber, assert, type, unpack = select, tonumber, assert, type, unpack
local atan2, modf, ceil, floor, abs, sqrt, mod = math.atan2, math.modf, math.ceil, math.floor, math.abs, math.sqrt, mod
local format, strfind, strsub, strupper, gsub, gmatch, utf8sub = format, strfind, strsub, strupper, gsub, gmatch, string.utf8sub
--WoW API / Variables
local CreateFrame = CreateFrame
local UnitPosition = UnitPosition
......
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local MC = E:GetModule('ModuleCopy')
--Lua functions
local pairs, next, type = pairs, next, type
local format, error = format, error
--WoW API / Variables
-- GLOBALS: ElvDB
--This table to reserve settings names in E.global.profileCopy. Used in export/imports functions
......
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
--Lua functions
local _G = _G
local min, max, abs, floor = min, max, abs, floor
local format, tonumber = format, tonumber
--WoW API / Variables
function E:IsEyefinity(width, height)
if E.global.general.eyefinity and width >= 3840 then
......
......@@ -63,8 +63,6 @@ local PlaySoundFile = PlaySoundFile
local UIFrameFadeOut = UIFrameFadeOut
local CreateAnimationGroup = CreateAnimationGroup
local CONTINUE, PREVIOUS, UNKNOWN = CONTINUE, PREVIOUS, UNKNOWN
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: PluginInstallFrame
--Installation Functions
......
......@@ -7,8 +7,6 @@ local unpack, type, select, getmetatable, assert, pairs = unpack, type, select,
--WoW API / Variables
local CreateFrame = CreateFrame
local hooksecurefunc = hooksecurefunc
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
-- GLOBALS: CUSTOM_CLASS_COLORS
local backdropr, backdropg, backdropb, backdropa, borderr, borderg, borderb = 0, 0, 0, 1, 0, 0, 0
......@@ -140,7 +138,7 @@ local function GetTemplate(t, isUnitFrameElement)
backdropa = 1
if t == 'ClassColor' then
local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass]
local color = _G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or _G.RAID_CLASS_COLORS[E.myclass]
borderr, borderg, borderb = color.r, color.g, color.b
backdropr, backdropg, backdropb = unpack(E.media.backdropcolor)
elseif t == 'Transparent' then
......
......@@ -3,13 +3,10 @@ local Skins = E:GetModule('Skins')
--Lua functions
local _G = _G
--WoW API / Variables
local CreateFrame = CreateFrame
local DISABLE = DISABLE
local HIDE = HIDE
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: ElvUITutorialWindow
E.TutorialList = {
......
......@@ -9,10 +9,8 @@ local GetMouseFocus = GetMouseFocus
local IsAddOnLoaded = IsAddOnLoaded
local GetAddOnInfo = GetAddOnInfo
local LoadAddOn = LoadAddOn
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: SLASH_FRAME1, SLASH_FRAMELIST1, SLASH_TEXLIST1, FRAME
-- GLOBALS: SLASH_GETPOINT1, SLASH_DEV1, ElvUIDev, ElvUI
local SlashCmdList = SlashCmdList
-- GLOBALS: ElvUIDev, ElvUI, FRAME, SLASH_FRAME1, SLASH_FRAMELIST1, SLASH_TEXLIST1, SLASH_GETPOINT1, SLASH_DEV1
local me = UnitName('player')
local IsDebugDisabled = function()
......
--Lua functions
--WoW API / Variables
local SlashCmdList = SlashCmdList
-- GLOBALS: SLASH_RELOADUI1, SLASH_RELOADUI2
SLASH_RELOADUI1 = "/rl"
......
--Lua functions
local _G = _G
local select = select
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local IsAddOnLoaded = IsAddOnLoaded
local CreateFrame = CreateFrame
......
--Lua functions
local pairs, type, table = pairs, type, table
local setmetatable, getmetatable = setmetatable, getmetatable
local pairs, type = pairs, type
local table = table
--WoW API / Variables
function table.copy(t, deep, seen)
seen = seen or {}
......
......@@ -15,7 +15,6 @@ local LE_PARTY_CATEGORY_HOME = LE_PARTY_CATEGORY_HOME
local LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_INSTANCE
local C_ChatInfo_RegisterAddonMessagePrefix = C_ChatInfo.RegisterAddonMessagePrefix
local C_ChatInfo_SendAddonMessage = C_ChatInfo.SendAddonMessage
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: ElvUI
lib.plugins = {}
......
......@@ -30,11 +30,7 @@ local GameTooltip_Hide = GameTooltip_Hide
local MAX_ACCOUNT_MACROS = MAX_ACCOUNT_MACROS
local CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP = CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP
local CHARACTER_SPECIFIC_KEYBINDINGS = CHARACTER_SPECIFIC_KEYBINDINGS
--Global variables that we don't cache, list them here for mikk's FindGlobals script
-- GLOBALS: UIParent, ElvUIBindPopupWindow, GameTooltip, StanceButton1, PetActionButton1
-- GLOBALS: ShoppingTooltip1, SpellBookFrame, MacroFrameTab1Text, SpellFlyout
-- GLOBALS: ElvUIBindPopupWindowCheckButton
-- GLOBALS: ElvUIBindPopupWindow, ElvUIBindPopupWindowCheckButton
local bind = CreateFrame("Frame", "ElvUI_KeyBinder", E.UIParent);
......@@ -67,8 +63,8 @@ end
function AB:BindHide()
bind:ClearAllPoints();
bind:Hide();
if not GameTooltip:IsForbidden() then
GameTooltip:Hide();
if not _G.GameTooltip:IsForbidden() then
_G.GameTooltip:Hide();
end
end
......@@ -83,8 +79,8 @@ function AB:BindListener(key)
end
E:Print(format(L["All keybindings cleared for |cff00ff00%s|r."], bind.button.name));
self:BindUpdate(bind.button, bind.spellmacro);
if bind.spellmacro~="MACRO" and not GameTooltip:IsForbidden() then
GameTooltip:Hide();
if bind.spellmacro~="MACRO" and not _G.GameTooltip:IsForbidden() then
_G.GameTooltip:Hide();
end
return;
end
......@@ -129,13 +125,14 @@ function AB:BindListener(key)
E:Print(alt..ctrl..shift..key..L[" |cff00ff00bound to |r"]..bind.button.name..".");
end
self:BindUpdate(bind.button, bind.spellmacro);
if bind.spellmacro~="MACRO" and bind.spellmacro~="FLYOUT" and not GameTooltip:IsForbidden() then
GameTooltip:Hide();
if bind.spellmacro~="MACRO" and bind.spellmacro~="FLYOUT" and not _G.GameTooltip:IsForbidden() then
_G.GameTooltip:Hide();
end
end
function AB:BindUpdate(button, spellmacro)
if not bind.active or InCombatLockdown() then return; end
local GameTooltip = _G.GameTooltip
bind.button = button;
bind.spellmacro = spellmacro;
......@@ -144,7 +141,7 @@ function AB:BindUpdate(button, spellmacro)
bind:SetAllPoints(button);
bind:Show();
ShoppingTooltip1:Hide();
_G.ShoppingTooltip1:Hide();
if spellmacro == "FLYOUT" then
bind.button.name = GetSpellInfo(button.spellID);
......@@ -166,7 +163,7 @@ function AB:BindUpdate(button, spellmacro)
elseif spellmacro == "SPELL" then
bind.button.id = SpellBook_GetSpellBookSlot(bind.button);
bind.button.name = GetSpellBookItemName(bind.button.id, SpellBookFrame.bookType);
bind.button.name = GetSpellBookItemName(bind.button.id, _G.SpellBookFrame.bookType);
GameTooltip:AddLine(L["Trigger"]);
GameTooltip:Show();
......@@ -189,7 +186,7 @@ function AB:BindUpdate(button, spellmacro)
elseif spellmacro == "MACRO" then
bind.button.id = bind.button:GetID();
if floor(.5+select(2,MacroFrameTab1Text:GetTextColor())*10)/10==.8 then bind.button.id = bind.button.id + MAX_ACCOUNT_MACROS; end
if floor(.5+select(2,_G.MacroFrameTab1Text:GetTextColor())*10)/10==.8 then bind.button.id = bind.button.id + MAX_ACCOUNT_MACROS; end
bind.button.name = GetMacroInfo(bind.button.id);
......@@ -285,19 +282,19 @@ function AB:BindUpdate(button, spellmacro)
end
function AB:RegisterButton(b, override)
local stance = StanceButton1:GetScript("OnClick");
local pet = PetActionButton1:GetScript("OnClick");
local stance = _G.StanceButton1:GetScript("OnClick");
local pet = _G.PetActionButton1:GetScript("OnClick");
local button = SecureActionButton_OnClick;
if b.IsProtected and b.IsObjectType and b.GetScript and b:IsObjectType('CheckButton') and b:IsProtected() then
local script = b:GetScript("OnClick");
if override then
b:HookScript("OnEnter", function(b) self:BindUpdate(b); end);
b:HookScript("OnEnter", function(s) self:BindUpdate(s); end);
elseif script==pet then
b:HookScript("OnEnter", function(b) self:BindUpdate(b, "PET"); end);
b:HookScript("OnEnter", function(s) self:BindUpdate(s, "PET"); end);
elseif script==stance then
b:HookScript("OnEnter", function(b) self:BindUpdate(b, "STANCE"); end);
b:HookScript("OnEnter", function(s) self:BindUpdate(s, "STANCE"); end);
elseif (script==button) then
b:HookScript("OnEnter", function(b) self:BindUpdate(b); end);
b:HookScript("OnEnter", function(s) self:BindUpdate(s); end);
end
end
end
......@@ -326,7 +323,7 @@ function AB:UpdateFlyouts()
if (isKnown) then
for k=1, numSlots do
local b = _G["SpellFlyoutButton"..k]
if SpellFlyout:IsShown() and b and b:IsShown() then
if _G.SpellFlyout:IsShown() and b and b:IsShown() then
if not b.hookedFlyout then
b:HookScript("OnEnter", function(b) AB:BindUpdate(b, "FLYOUT"); end);
b.hookedFlyout = true
......@@ -347,7 +344,7 @@ function AB:RegisterMacro(addon)
end
function AB:ChangeBindingProfile()
if ( ElvUIBindPopupWindowCheckButton:GetChecked() ) then
if ElvUIBindPopupWindowCheckButton:GetChecked() then
LoadBindings(2);
SaveBindings(2);
else
......@@ -367,22 +364,22 @@ function AB:LoadKeyBinder()
bind.texture:SetColorTexture(0, 0, 0, .25);
bind:Hide();
self:SecureHookScript(GameTooltip, "OnUpdate", "Tooltip_OnUpdate")
hooksecurefunc(GameTooltip, "Hide", function(tooltip)
self:SecureHookScript(_G.GameTooltip, "OnUpdate", "Tooltip_OnUpdate")
hooksecurefunc(_G.GameTooltip, "Hide", function(tooltip)
if not tooltip:IsForbidden() then
for _, tt in pairs(tooltip.shoppingTooltips) do tt:Hide() end
end
end)
bind:SetScript('OnEnter', function(self) local db = self.button:GetParent().db if db and db.mouseover then AB:Button_OnEnter(self.button) end end)
bind:SetScript("OnLeave", function(self) AB:BindHide(); local db = self.button:GetParent().db if db and db.mouseover then AB:Button_OnLeave(self.button) end end)
bind:SetScript('OnEnter', function(b) local db = b.button:GetParent().db if db and db.mouseover then AB:Button_OnEnter(b.button) end end)
bind:SetScript("OnLeave", function(b) AB:BindHide(); local db = b.button:GetParent().db if db and db.mouseover then AB:Button_OnLeave(b.button) end end)
bind:SetScript("OnKeyUp", function(_, key) self:BindListener(key) end);
bind:SetScript("OnMouseUp", function(_, key) self:BindListener(key) end);
bind:SetScript("OnMouseWheel", function(_, delta) if delta>0 then self:BindListener("MOUSEWHEELUP") else self:BindListener("MOUSEWHEELDOWN"); end end);
for i = 1, 12 do
local b = _G["SpellButton"..i];
b:HookScript("OnEnter", function(b) AB:BindUpdate(b, "SPELL"); end);
b:HookScript("OnEnter", function(s) AB:BindUpdate(s, "SPELL"); end);
end
for b in pairs(self.handledbuttons) do
......@@ -399,7 +396,7 @@ function AB:LoadKeyBinder()
self:UpdateFlyouts()
--Special Popup
local f = CreateFrame("Frame", "ElvUIBindPopupWindow", UIParent)
local f = CreateFrame("Frame", "ElvUIBindPopupWindow", _G.UIParent)
f:SetFrameStrata("DIALOG")
f:SetToplevel(true)
f:EnableMouse(true)
......@@ -450,8 +447,8 @@ function AB:LoadKeyBinder()
end)
perCharCheck:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText(CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP, nil, nil, nil, nil, 1);
_G.GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
_G.GameTooltip:SetText(CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP, nil, nil, nil, nil, 1);
end)
perCharCheck:SetScript("OnLeave", GameTooltip_Hide)
......
......@@ -9,9 +9,6 @@ local CreateFrame = CreateFrame
local GetActionCooldown = GetActionCooldown
local HasExtraActionBar = HasExtraActionBar
--Global variables that we don't cache, list them here for mikk's FindGlobals script
-- GLOBALS: ExtraActionBarFrame, ZoneAbilityFrame
local ExtraActionBarHolder, ZoneAbilityHolder
local function FixExtraActionCD(cd)
......@@ -23,14 +20,14 @@ function AB:Extra_SetAlpha()
if not E.private.actionbar.enable then return; end
local alpha = E.db.actionbar.extraActionButton.alpha
for i=1, ExtraActionBarFrame:GetNumChildren() do
for i=1, _G.ExtraActionBarFrame:GetNumChildren() do
local button = _G["ExtraActionButton"..i]
if button then
button:SetAlpha(alpha)
end
end
local button = ZoneAbilityFrame.SpellButton
local button = _G.ZoneAbilityFrame.SpellButton
if button then
button:SetAlpha(alpha)
end
......@@ -40,18 +37,21 @@ function AB:Extra_SetScale()
if not E.private.actionbar.enable then return; end
local scale = E.db.actionbar.extraActionButton.scale
if ExtraActionBarFrame then
ExtraActionBarFrame:SetScale(scale)
ExtraActionBarHolder:Size(ExtraActionBarFrame:GetWidth() * scale)
if _G.ExtraActionBarFrame then
_G.ExtraActionBarFrame:SetScale(scale)
ExtraActionBarHolder:Size(_G.ExtraActionBarFrame:GetWidth() * scale)
end
if ZoneAbilityFrame then
ZoneAbilityFrame:SetScale(scale)
ZoneAbilityHolder:Size(ZoneAbilityFrame:GetWidth() * scale)
if _G.ZoneAbilityFrame then
_G.ZoneAbilityFrame:SetScale(scale)
ZoneAbilityHolder:Size(_G.ZoneAbilityFrame:GetWidth() * scale)
end
end
function AB:SetupExtraButton()
local ExtraActionBarFrame = _G.ExtraActionBarFrame
local ZoneAbilityFrame = _G.ZoneAbilityFrame
ExtraActionBarHolder = CreateFrame('Frame', nil, E.UIParent)
ExtraActionBarHolder:Point('BOTTOM', E.UIParent, 'BOTTOM', 0, 150)
ExtraActionBarHolder:Size(ExtraActionBarFrame:GetSize())
......
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule('Blizzard')
--Lua functions
local _G = _G
local floor = math.floor
local format = string.format
--WoW API / Variables
local CreateFrame = CreateFrame
local hooksecurefunc = hooksecurefunc
local UnitAlternatePowerInfo = UnitAlternatePowerInfo
local UnitPowerMax = UnitPowerMax
local UnitPower = UnitPower
-- GLOBALS: CreateFrame, PlayerPowerBarAlt, ALTERNATE_POWER_INDEX, hooksecurefunc
-- GLOBALS: GameTooltip, GameTooltip_SetDefaultAnchor, ElvUI_AltPowerBar, AltPowerBarHolder
-- GLOBALS: AltPowerBarHolder
local function updateTooltip(self)
if GameTooltip:IsForbidden() then return end
if _G.GameTooltip:IsForbidden() then return end
if self.powerName and self.powerTooltip then
GameTooltip:SetText(self.powerName, 1, 1, 1)
GameTooltip:AddLine(self.powerTooltip, nil, nil, nil, 1)
GameTooltip:Show()
_G.GameTooltip:SetText(self.powerName, 1, 1, 1)
_G.GameTooltip:AddLine(self.powerTooltip, nil, nil, nil, 1)
_G.GameTooltip:Show()
end
end
local function onEnter(self)
if not self:IsVisible() then return end
GameTooltip_SetDefaultAnchor(GameTooltip, self)
_G.GameTooltip_SetDefaultAnchor(_G.GameTooltip, self)
updateTooltip(self)
end
local function onLeave()
GameTooltip:Hide()
_G.GameTooltip:Hide()
end
function B:SetAltPowerBarText(name, value, max, percent)
......@@ -57,22 +61,22 @@ function B:PositionAltPowerBar()
holder:Point('TOP', E.UIParent, 'TOP', 0, -18)
holder:Size(128, 50)
PlayerPowerBarAlt:ClearAllPoints()
PlayerPowerBarAlt:Point('CENTER', holder, 'CENTER')
PlayerPowerBarAlt:SetParent(holder)
PlayerPowerBarAlt.ignoreFramePositionManager = true
_G.PlayerPowerBarAlt:ClearAllPoints()
_G.PlayerPowerBarAlt:Point('CENTER', holder, 'CENTER')
_G.PlayerPowerBarAlt:SetParent(holder)
_G.PlayerPowerBarAlt.ignoreFramePositionManager = true
--The Blizzard function FramePositionDelegate:UIParentManageFramePositions()
--calls :ClearAllPoints on PlayerPowerBarAlt under certain conditions.
--Doing ".ClearAllPoints = E.noop" causes error when you enter combat.
local function Position(bar) bar:Point('CENTER', AltPowerBarHolder, 'CENTER') end
hooksecurefunc(PlayerPowerBarAlt, "ClearAllPoints", Position)
hooksecurefunc(_G.PlayerPowerBarAlt, "ClearAllPoints", Position)
E:CreateMover(holder, 'AltPowerBarMover', L["Alternative Power"], nil, nil, nil, nil, nil, 'general,alternativePowerGroup')
end
function B:UpdateAltPowerBarColors()
local bar = ElvUI_AltPowerBar
local bar = _G.ElvUI_AltPowerBar
if E.db.general.altPowerBar.statusBarColorGradient then
if bar.colorGradientR and bar.colorGradientG and bar.colorGradientB then
......@@ -96,7 +100,7 @@ function B:UpdateAltPowerBarColors()
end
function B:UpdateAltPowerBarSettings()
local bar = ElvUI_AltPowerBar
local bar = _G.ElvUI_AltPowerBar
local db = E.db.general.altPowerBar
bar:Size(db.width or 250, db.height or 20)
......@@ -141,8 +145,8 @@ function B:SkinAltPowerBar()
powerbar:RegisterEvent("UNIT_POWER_BAR_HIDE")
powerbar:RegisterEvent("PLAYER_ENTERING_WORLD")
powerbar:SetScript("OnEvent", function(bar)
PlayerPowerBarAlt:UnregisterAllEvents()
PlayerPowerBarAlt:Hide()
_G.PlayerPowerBarAlt:UnregisterAllEvents()
_G.PlayerPowerBarAlt:Hide()
local barType, min, _, _, _, _, _, _, _, _, powerName, powerTooltip = UnitAlternatePowerInfo('player')
if not barType then
......@@ -153,8 +157,8 @@ function B:SkinAltPowerBar()
bar.powerTooltip = powerTooltip
if barType then
local power = UnitPower("player", ALTERNATE_POWER_INDEX)
local maxPower = UnitPowerMax("player", ALTERNATE_POWER_INDEX) or 0
local power = UnitPower("player", _G.ALTERNATE_POWER_INDEX)
local maxPower = UnitPowerMax("player", _G.ALTERNATE_POWER_INDEX) or 0
local perc = (maxPower > 0 and floor(power / maxPower * 100)) or 0
bar.powerValue = power
......
......@@ -14,7 +14,6 @@ local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local IsControlKeyDown = IsControlKeyDown
local IsModifierKeyDown = IsModifierKeyDown
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local CALENDAR_COPY_EVENT, CALENDAR_PASTE_EVENT = CALENDAR_COPY_EVENT, CALENDAR_PASTE_EVENT
local CLASS, DEFAULT = CLASS, DEFAULT
......@@ -246,7 +245,7 @@ function B:EnhanceColorPicker()
b:Point("TOP", "ColorPPCopy", "BOTTOMRIGHT", 0, -7)
b:SetScript('OnClick', function()
local color = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass]);
local color = E.myclass == 'PRIEST' and E.PriestColors or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[E.myclass] or _G.RAID_CLASS_COLORS[E.myclass]);
_G.ColorPickerFrame:SetColorRGB(color.r, color.g, color.b)
_G.ColorSwatch:SetColorTexture(color.r, color.g, color.b)
if _G.ColorPickerFrame.hasOpacity then
......
......@@ -19,9 +19,6 @@ local WAR_CAMPAIGN = WAR_CAMPAIGN
local GARRISON_LANDING_PAGE_TITLE = GARRISON_LANDING_PAGE_TITLE
local ORDER_HALL_LANDING_PAGE_TITLE = ORDER_HALL_LANDING_PAGE_TITLE
--No point caching anything else here, but list them here for mikk's FindGlobals script
-- GLOBALS: GarrisonLandingPage, DropDownList1
function B:GarrisonDropDown()
-- Right click Menu for Garrision Button all Credits to Foxlit (WarPlan)
if IsAddOnLoaded("WarPlan") then return; end
......@@ -37,16 +34,16 @@ function B:GarrisonDropDown()
local landingChoiceMenu, landingChoices
_G.GarrisonLandingPageMinimapButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
_G.GarrisonLandingPageMinimapButton:HookScript("PreClick", function(self, b)
self.landingVisiblePriorToClick = _G.GarrisonLandingPage and _G.GarrisonLandingPage:IsVisible() and _G.GarrisonLandingPage.garrTypeID
_G.GarrisonLandingPageMinimapButton:HookScript("PreClick", function(btn, b)
btn.landingVisiblePriorToClick = _G.GarrisonLandingPage and _G.GarrisonLandingPage:IsVisible() and _G.GarrisonLandingPage.garrTypeID
if b == "RightButton" then
local openOK, openID = PlaySound(SOUNDKIT_UI_GARRISON_GARRISON_REPORT_OPEN)
local closeOK, closeID = PlaySound(SOUNDKIT_UI_GARRISON_GARRISON_REPORT_CLOSE)
self.openSoundID = openOK and openID
self.closeSoundID = closeOK and closeID
btn.openSoundID = openOK and openID
btn.closeSoundID = closeOK and closeID
end
end)
_G.GarrisonLandingPageMinimapButton:HookScript("OnClick", function(self, b)
_G.GarrisonLandingPageMinimapButton:HookScript("OnClick", function(btn, b)
if b == "LeftButton" then
if _G.GarrisonLandingPage.garrTypeID ~= C_Garrison_GetLandingPageGarrisonType() then
ShowLanding(C_Garrison_GetLandingPageGarrisonType())
......@@ -54,13 +51,13 @@ function B:GarrisonDropDown()
return
elseif b == "RightButton" then
if (C_Garrison_GetLandingPageGarrisonType() or 0) > 3 then
if self.landingVisiblePriorToClick then
ShowLanding(self.landingVisiblePriorToClick)
if btn.landingVisiblePriorToClick then
ShowLanding(btn.landingVisiblePriorToClick)
else
HideUIPanel(_G.GarrisonLandingPage)
end
MaybeStopSound(self.openSoundID)
MaybeStopSound(self.closeSoundID)
MaybeStopSound(btn.openSoundID)
MaybeStopSound(btn.closeSoundID)
if not landingChoiceMenu then
landingChoiceMenu = CreateFrame("Frame", "ElvUI_LandingChoicesDropdown", E.UIParent, "UIDropDownMenuTemplate")
local function ShowLanding_(_, ...)
......@@ -73,15 +70,15 @@ function B:GarrisonDropDown()
}
end
_G.EasyMenu(landingChoices, landingChoiceMenu, "cursor", 0, 0, "MENU", 4)
DropDownList1:ClearAllPoints()
DropDownList1:Point("TOPRIGHT", self, "TOPLEFT", 10, -4)
elseif GarrisonLandingPage.garrTypeID == 3 then
_G.DropDownList1:ClearAllPoints()
_G.DropDownList1:Point("TOPRIGHT", btn, "TOPLEFT", 10, -4)
elseif _G.GarrisonLandingPage.garrTypeID == 3 then
ShowLanding(2)
MaybeStopSound(self.closeSoundID)
MaybeStopSound(btn.closeSoundID)
end
end
end)
_G.GarrisonLandingPageMinimapButton:HookScript("PostClick", function(self)
self.closeSoundID, self.openSoundID = nil, nil
_G.GarrisonLandingPageMinimapButton:HookScript("PostClick", function(btn)
btn.closeSoundID, btn.openSoundID = nil, nil
end)
end
......@@ -6,7 +6,6 @@ local _G = _G
--WoW-Api
local CreateFrame = CreateFrame
local hooksecurefunc = hooksecurefunc
--Global variables that we don't cache, list them here for mikk's FindGlobals script
local function topCenterPosition(self, _, b)
local holder = _G.TopCenterContainerHolder
......
......@@ -102,7 +102,6 @@ local GetPlayerCommunityLink = GetPlayerCommunityLink
local LE_REALM_RELATION_SAME = LE_REALM_RELATION_SAME
local LFG_LIST_AND_MORE = LFG_LIST_AND_MORE
local NUM_CHAT_WINDOWS = NUM_CHAT_WINDOWS
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local SOCIAL_QUEUE_QUEUED_FOR = gsub(SOCIAL_QUEUE_QUEUED_FOR, ':%s?$', '') --some language have `:` on end
local SocialQueueUtil_GetRelationshipInfo = SocialQueueUtil_GetRelationshipInfo
local SOUNDKIT = SOUNDKIT