api: replace getglobal

This commit is contained in:
shagu
2017-02-26 20:19:22 +01:00
parent 5a10f4ca6b
commit 5a60812786
9 changed files with 82 additions and 82 deletions
+29 -29
View File
@@ -231,8 +231,8 @@ pfUI:RegisterModule("chat", function ()
end
for i=1, NUM_CHAT_WINDOWS do
local frame = getglobal("ChatFrame"..i)
local tab = getglobal("ChatFrame"..i.."Tab")
local frame = _G["ChatFrame"..i]
local tab = _G["ChatFrame"..i.."Tab"]
if pfUI_config.chat.global.fadeout == "1" then
@@ -263,21 +263,21 @@ pfUI:RegisterModule("chat", function ()
v:SetHeight(pfUI_config.global.font_size+default_border*2)
end
getglobal("ChatFrame" .. i .. "ResizeBottom"):Hide()
getglobal("ChatFrame" .. i .. "TabText"):SetJustifyV("CENTER")
getglobal("ChatFrame" .. i .. "TabText"):SetHeight(pfUI_config.global.font_size+default_border*2)
getglobal("ChatFrame" .. i .. "TabText"):SetPoint("BOTTOM", 0, default_border)
getglobal("ChatFrame" .. i .. "TabLeft"):SetAlpha(0)
getglobal("ChatFrame" .. i .. "TabMiddle"):SetAlpha(0)
getglobal("ChatFrame" .. i .. "TabRight"):SetAlpha(0)
getglobal("ChatFrame" .. i .. "TabFlash"):SetAlpha(0)
_G["ChatFrame" .. i .. "ResizeBottom"]:Hide()
_G["ChatFrame" .. i .. "TabText"]:SetJustifyV("CENTER")
_G["ChatFrame" .. i .. "TabText"]:SetHeight(pfUI_config.global.font_size+default_border*2)
_G["ChatFrame" .. i .. "TabText"]:SetPoint("BOTTOM", 0, default_border)
_G["ChatFrame" .. i .. "TabLeft"]:SetAlpha(0)
_G["ChatFrame" .. i .. "TabMiddle"]:SetAlpha(0)
_G["ChatFrame" .. i .. "TabRight"]:SetAlpha(0)
_G["ChatFrame" .. i .. "TabFlash"]:SetAlpha(0)
local _, class = UnitClass("player")
getglobal("ChatFrame" .. i .. "TabText"):SetTextColor(RAID_CLASS_COLORS[class].r + .3 * .5, RAID_CLASS_COLORS[class].g + .3 * .5, RAID_CLASS_COLORS[class].b + .3 * .5, 1)
getglobal("ChatFrame" .. i .. "TabText"):SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
_G["ChatFrame" .. i .. "TabText"]:SetTextColor(RAID_CLASS_COLORS[class].r + .3 * .5, RAID_CLASS_COLORS[class].g + .3 * .5, RAID_CLASS_COLORS[class].b + .3 * .5, 1)
_G["ChatFrame" .. i .. "TabText"]:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
if getglobal("ChatFrame" .. i).isDocked or getglobal("ChatFrame" .. i):IsVisible() then
getglobal("ChatFrame" .. i .. "Tab"):Show()
if _G["ChatFrame" .. i].isDocked or _G["ChatFrame" .. i]:IsVisible() then
_G["ChatFrame" .. i .. "Tab"]:Show()
end
frame:EnableMouseWheel(true)
@@ -312,7 +312,7 @@ pfUI:RegisterModule("chat", function ()
function pfUI.chat.SetupPositions()
-- close all chat windows
for i=1, NUM_CHAT_WINDOWS do
FCF_Close(getglobal("ChatFrame"..i))
FCF_Close(_G["ChatFrame"..i])
FCF_DockUpdate()
end
@@ -458,12 +458,12 @@ pfUI:RegisterModule("chat", function ()
end)
for i=1, NUM_CHAT_WINDOWS do
getglobal("ChatFrame" .. i .. "UpButton"):Hide()
getglobal("ChatFrame" .. i .. "UpButton").Show = function() return end
getglobal("ChatFrame" .. i .. "DownButton"):Hide()
getglobal("ChatFrame" .. i .. "DownButton").Show = function() return end
getglobal("ChatFrame" .. i .. "BottomButton"):Hide()
getglobal("ChatFrame" .. i .. "BottomButton").Show = function() return end
_G["ChatFrame" .. i .. "UpButton"]:Hide()
_G["ChatFrame" .. i .. "UpButton"].Show = function() return end
_G["ChatFrame" .. i .. "DownButton"]:Hide()
_G["ChatFrame" .. i .. "DownButton"].Show = function() return end
_G["ChatFrame" .. i .. "BottomButton"]:Hide()
_G["ChatFrame" .. i .. "BottomButton"].Show = function() return end
end
-- orig. function but removed flashing
@@ -471,14 +471,14 @@ pfUI:RegisterModule("chat", function ()
-- Need to draw the dock regions for a frame to define their rects
if ( not ChatFrame1.init ) then
for i=1, NUM_CHAT_WINDOWS do
getglobal("ChatFrame"..i.."TabDockRegion"):Show()
FCF_UpdateButtonSide(getglobal("ChatFrame"..i))
_G["ChatFrame"..i.."TabDockRegion"]:Show()
FCF_UpdateButtonSide(_G["ChatFrame"..i])
end
ChatFrame1.init = 1
return
elseif ( ChatFrame1.init == 1 ) then
for i=1, NUM_CHAT_WINDOWS do
getglobal("ChatFrame"..i.."TabDockRegion"):Hide()
_G["ChatFrame"..i.."TabDockRegion"]:Hide()
end
ChatFrame1.init = 2
end
@@ -499,7 +499,7 @@ pfUI:RegisterModule("chat", function ()
FCF_UpdateButtonSide(value)
end
dockRegion = getglobal(value:GetName().."TabDockRegion")
dockRegion = _G[value:GetName().."TabDockRegion"]
if ( MouseIsOver(dockRegion) and MOVING_CHATFRAME ~= DEFAULT_CHAT_FRAME ) then
dockRegion:Show()
else
@@ -589,10 +589,10 @@ pfUI:RegisterModule("chat", function ()
CHAT_YELL_GET = '[Y]' .. default
for i=1,NUM_CHAT_WINDOWS do
if not getglobal("ChatFrame"..i).HookAddMessage then
getglobal("ChatFrame"..i).HookAddMessage = getglobal("ChatFrame"..i).AddMessage
if not _G["ChatFrame"..i].HookAddMessage then
_G["ChatFrame"..i].HookAddMessage = _G["ChatFrame"..i].AddMessage
end
getglobal("ChatFrame"..i).AddMessage = function (frame, text, ...)
_G["ChatFrame"..i].AddMessage = function (frame, text, ...)
if text then
if pfUI_config.chat.text.classcolor == "1" then
@@ -636,7 +636,7 @@ pfUI:RegisterModule("chat", function ()
text = "|c" .. chex .. left .. date(pfUI_config.chat.text.timeformat) .. right .. "|r " .. text
end
getglobal("ChatFrame"..i).HookAddMessage(frame, text, unpack(arg))
_G["ChatFrame"..i].HookAddMessage(frame, text, unpack(arg))
end
end
end
+2 -2
View File
@@ -13,8 +13,8 @@ pfUI:RegisterModule("cooldown", function ()
this:Hide()
end
if this:GetParent() and this:GetParent():GetName() and getglobal(this:GetParent():GetName() .. "Cooldown") then
if not getglobal(this:GetParent():GetName() .. "Cooldown"):IsShown() then
if this:GetParent() and this:GetParent():GetName() and _G[this:GetParent():GetName() .. "Cooldown"] then
if not _G[this:GetParent():GetName() .. "Cooldown"]:IsShown() then
this:Hide()
end
end
+1 -1
View File
@@ -50,7 +50,7 @@ pfUI:RegisterModule("eqcompare", function ()
local border = tonumber(pfUI_config.appearance.border.default)
for i=1,GameTooltip:NumLines() do
local tmpText = getglobal("GameTooltipTextLeft"..i)
local tmpText = _G["GameTooltipTextLeft"..i]
for slotType, slotName in pairs(pfUI.slotTable) do
if tmpText:GetText() == slotType then
+3 -3
View File
@@ -11,9 +11,9 @@ pfUI:RegisterModule("group", function ()
-- hide blizzard group frames
for i=1, 4 do
if getglobal("PartyMemberFrame" .. i) then
getglobal("PartyMemberFrame" .. i):Hide()
getglobal("PartyMemberFrame" .. i).Show = function () return end
if _G["PartyMemberFrame" .. i] then
_G["PartyMemberFrame" .. i]:Hide()
_G["PartyMemberFrame" .. i].Show = function () return end
end
end
+10 -10
View File
@@ -132,7 +132,7 @@ pfUI:RegisterModule("gui", function ()
end
for _,frame in pairs(pfUI.movables) do
local frame = getglobal(frame)
local frame = _G[frame]
if frame then
if not frame:IsShown() then
@@ -164,17 +164,17 @@ pfUI:RegisterModule("gui", function ()
if IsShiftKeyDown() and strsub(frame:GetName(),0,6) == "pfRaid" then
for i=1,40 do
local frame = getglobal("pfRaid" .. i)
local frame = _G["pfRaid" .. i]
pfUI.gui:SaveScale(frame, scale)
end
elseif IsShiftKeyDown() and strsub(frame:GetName(),0,7) == "pfGroup" then
for i=1,4 do
local frame = getglobal("pfGroup" .. i)
local frame = _G["pfGroup" .. i]
pfUI.gui:SaveScale(frame, scale)
end
elseif IsShiftKeyDown() and strsub(frame:GetName(),0,15) == "pfLootRollFrame" then
for i=1,4 do
local frame = getglobal("pfLootRollFrame" .. i)
local frame = _G["pfLootRollFrame" .. i]
pfUI.gui:SaveScale(frame, scale)
end
else
@@ -195,7 +195,7 @@ pfUI:RegisterModule("gui", function ()
if IsShiftKeyDown() then
if strsub(frame:GetName(),0,6) == "pfRaid" then
for i=1,40 do
local cframe = getglobal("pfRaid" .. i)
local cframe = _G["pfRaid" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
@@ -203,7 +203,7 @@ pfUI:RegisterModule("gui", function ()
end
if strsub(frame:GetName(),0,7) == "pfGroup" then
for i=1,4 do
local cframe = getglobal("pfGroup" .. i)
local cframe = _G["pfGroup" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
@@ -211,7 +211,7 @@ pfUI:RegisterModule("gui", function ()
end
if strsub(frame:GetName(),0,15) == "pfLootRollFrame" then
for i=1,4 do
local cframe = getglobal("pfLootRollFrame" .. i)
local cframe = _G["pfLootRollFrame" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
@@ -238,7 +238,7 @@ pfUI:RegisterModule("gui", function ()
if strsub(frame:GetName(),0,6) == "pfRaid" then
for i=1,40 do
local cframe = getglobal("pfRaid" .. i)
local cframe = _G["pfRaid" .. i]
cframe.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
if cframe:GetName() ~= frame:GetName() then
local _, _, _, xpos, ypos = cframe:GetPoint()
@@ -256,7 +256,7 @@ pfUI:RegisterModule("gui", function ()
end
elseif strsub(frame:GetName(),0,7) == "pfGroup" then
for i=1,4 do
local cframe = getglobal("pfGroup" .. i)
local cframe = _G["pfGroup" .. i]
cframe.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
if cframe:GetName() ~= frame:GetName() then
local _, _, _, xpos, ypos = cframe:GetPoint()
@@ -274,7 +274,7 @@ pfUI:RegisterModule("gui", function ()
end
elseif strsub(frame:GetName(),0,15) == "pfLootRollFrame" then
for i=1,4 do
local cframe = getglobal("pfLootRollFrame" .. i)
local cframe = _G["pfLootRollFrame" .. i]
cframe.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
if cframe:GetName() ~= frame:GetName() then
local _, _, _, xpos, ypos = cframe:GetPoint()
+1 -1
View File
@@ -82,7 +82,7 @@ pfUI:RegisterModule("infight", function ()
if pfUI_config.appearance.infight.group == "1" then
for i=1,4 do
pfUI.infight:CreateGlow("party" .. i, getglobal("pfGroup" .. i))
pfUI.infight:CreateGlow("party" .. i, _G["pfGroup" .. i])
end
end
end)
+3 -3
View File
@@ -296,7 +296,7 @@ pfUI:RegisterModule("panel", function ()
repairToolTip:ClearLines()
else
for i=1, 30, 1 do
local tmpText = getglobal("repairToolTipTextLeft"..i)
local tmpText = _G["repairToolTipTextLeft"..i]
if (tmpText ~= nil) and (tmpText:GetText()) then
local searchstr = string.gsub(DURABILITY_TEMPLATE, "%%[^%s]+", "(.+)")
local _, _, lval, rval = string.find(tmpText:GetText(), searchstr, 1)
@@ -569,8 +569,8 @@ pfUI:RegisterModule("panel", function ()
}
for i=1,table.getn(MICRO_BUTTONS) do
local anchor = getglobal(MICRO_BUTTONS[i-1]) or pfUI.panel.microbutton
local button = getglobal(MICRO_BUTTONS[i])
local anchor = _G[MICRO_BUTTONS[i-1]] or pfUI.panel.microbutton
local button = _G[MICRO_BUTTONS[i]]
button:ClearAllPoints()
button:SetParent(pfUI.panel.microbutton)
if i == 1 then
+1 -1
View File
@@ -13,7 +13,7 @@ pfUI:RegisterModule("sellvalue", function ()
local _, _, itemLink = string.find(itemLink, "(item:%d+:%d+:%d+:%d+)");
local itemName = GetItemInfo(itemLink)
if pfSellData[tonumber(iid)] and itemName == getglobal("GameTooltipTextLeft1"):GetText() then
if pfSellData[tonumber(iid)] and itemName == _G["GameTooltipTextLeft1"]:GetText() then
local _, _, sell, buy = strfind(pfSellData[tonumber(iid)], "(.*),(.*)")
sell = tonumber(sell)
buy = tonumber(buy)
+32 -32
View File
@@ -97,56 +97,56 @@ pfUI:RegisterModule("thirdparty", function ()
pfUIhookWIM_PostMessage = _G.WIM_PostMessage
_G.WIM_PostMessage = function(user, msg, ttype, from, raw_msg)
pfUIhookWIM_PostMessage(user, msg, ttype, from, raw_msg)
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user), nil, nil, .8)
getglobal("WIM_msgFrame" .. user .. "From"):ClearAllPoints()
getglobal("WIM_msgFrame" .. user .. "From"):SetPoint("TOP", 0, -10)
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user], nil, nil, .8)
_G["WIM_msgFrame" .. user .. "From"]:ClearAllPoints()
_G["WIM_msgFrame" .. user .. "From"]:SetPoint("TOP", 0, -10)
getglobal("WIM_msgFrame" .. user).avatar = CreateFrame("Frame", nil, getglobal("WIM_msgFrame" .. user))
getglobal("WIM_msgFrame" .. user).avatar:SetAllPoints(getglobal("WIM_msgFrame" .. user))
getglobal("WIM_msgFrame" .. user .. "ClassIcon"):SetTexCoord(.3, .7, .3, .7)
getglobal("WIM_msgFrame" .. user .. "ClassIcon"):SetParent(getglobal("WIM_msgFrame" .. user).avatar)
getglobal("WIM_msgFrame" .. user .. "ClassIcon"):ClearAllPoints()
getglobal("WIM_msgFrame" .. user .. "ClassIcon"):SetPoint("TOPLEFT", 10 , -10)
getglobal("WIM_msgFrame" .. user .. "ClassIcon"):SetWidth(26)
getglobal("WIM_msgFrame" .. user .. "ClassIcon"):SetHeight(26)
_G["WIM_msgFrame" .. user].avatar = CreateFrame("Frame", nil, _G["WIM_msgFrame" .. user])
_G["WIM_msgFrame" .. user].avatar:SetAllPoints(_G["WIM_msgFrame" .. user])
_G["WIM_msgFrame" .. user .. "ClassIcon"]:SetTexCoord(.3, .7, .3, .7)
_G["WIM_msgFrame" .. user .. "ClassIcon"]:SetParent(_G["WIM_msgFrame" .. user].avatar)
_G["WIM_msgFrame" .. user .. "ClassIcon"]:ClearAllPoints()
_G["WIM_msgFrame" .. user .. "ClassIcon"]:SetPoint("TOPLEFT", 10 , -10)
_G["WIM_msgFrame" .. user .. "ClassIcon"]:SetWidth(26)
_G["WIM_msgFrame" .. user .. "ClassIcon"]:SetHeight(26)
getglobal("WIM_msgFrame" .. user .. "ScrollingMessageFrame"):SetPoint("TOPLEFT", getglobal("WIM_msgFrame" .. user), "TOPLEFT", 10, -45)
getglobal("WIM_msgFrame" .. user .. "ScrollingMessageFrame"):SetPoint("BOTTOMRIGHT", getglobal("WIM_msgFrame" .. user), "BOTTOMRIGHT", -32, 32)
getglobal("WIM_msgFrame" .. user .. "ScrollingMessageFrame"):SetFont(STANDARD_TEXT_FONT, 12)
_G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"]:SetPoint("TOPLEFT", _G["WIM_msgFrame" .. user], "TOPLEFT", 10, -45)
_G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"]:SetPoint("BOTTOMRIGHT", _G["WIM_msgFrame" .. user], "BOTTOMRIGHT", -32, 32)
_G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"]:SetFont(STANDARD_TEXT_FONT, 12)
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user .. "MsgBox"))
getglobal("WIM_msgFrame" .. user .. "MsgBox"):ClearAllPoints()
getglobal("WIM_msgFrame" .. user .. "MsgBox"):SetPoint("TOPLEFT", getglobal("WIM_msgFrame" .. user .. "ScrollingMessageFrame"), "BOTTOMLEFT", 0, -5)
getglobal("WIM_msgFrame" .. user .. "MsgBox"):SetPoint("TOPRIGHT", getglobal("WIM_msgFrame" .. user .. "ScrollingMessageFrame"), "BOTTOMRIGHT", 0, -5)
getglobal("WIM_msgFrame" .. user .. "MsgBox"):SetTextInsets(5, 5, 5, 5)
getglobal("WIM_msgFrame" .. user .. "MsgBox"):SetHeight(20)
for i,v in ipairs({getglobal("WIM_msgFrame" .. user .. "MsgBox"):GetRegions()}) do
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "MsgBox"])
_G["WIM_msgFrame" .. user .. "MsgBox"]:ClearAllPoints()
_G["WIM_msgFrame" .. user .. "MsgBox"]:SetPoint("TOPLEFT", _G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"], "BOTTOMLEFT", 0, -5)
_G["WIM_msgFrame" .. user .. "MsgBox"]:SetPoint("TOPRIGHT", _G["WIM_msgFrame" .. user .. "ScrollingMessageFrame"], "BOTTOMRIGHT", 0, -5)
_G["WIM_msgFrame" .. user .. "MsgBox"]:SetTextInsets(5, 5, 5, 5)
_G["WIM_msgFrame" .. user .. "MsgBox"]:SetHeight(20)
for i,v in ipairs({_G["WIM_msgFrame" .. user .. "MsgBox"]:GetRegions()}) do
if i==6 then v:SetTexture(.1,.1,.1,.5) end
end
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton1"))
for i,v in ipairs({getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton1"):GetRegions()}) do
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton1"])
for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton1"]:GetRegions()}) do
if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end
end
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton2"))
for i,v in ipairs({getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton2"):GetRegions()}) do
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton2"])
for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton2"]:GetRegions()}) do
if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end
end
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton3"))
for i,v in ipairs({getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton3"):GetRegions()}) do
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton3"])
for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton3"]:GetRegions()}) do
if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end
end
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton4"))
for i,v in ipairs({getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton4"):GetRegions()}) do
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton4"])
for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton4"]:GetRegions()}) do
if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end
end
pfUI.api:CreateBackdrop(getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton5"))
for i,v in ipairs({getglobal("WIM_msgFrame" .. user .. "ShortcutFrameButton5"):GetRegions()}) do
pfUI.api:CreateBackdrop(_G["WIM_msgFrame" .. user .. "ShortcutFrameButton5"])
for i,v in ipairs({_G["WIM_msgFrame" .. user .. "ShortcutFrameButton5"]:GetRegions()}) do
if i >= 2 and i < 7 then v:SetTexture(.1,.1,.1,0) end
end
end
@@ -425,7 +425,7 @@ pfUI:RegisterModule("thirdparty", function ()
"KLHTM_TitleFrameMasterTarget", "KLHTM_SelfFrameBottomReset" }
for i, button in pairs(buttons) do
local b = getglobal(button)
local b = _G[button]
if not b then return end
pfUI.api:SkinButton(b)
b:SetScale(.8)