From ae9d5b04c7ee81ac5d0e745ada9760a57440b51b Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Sat, 5 Mar 2011 19:20:45 -0600 Subject: [PATCH] Cleanup and consistency changes. --- Constants.lua | 40 ++++++++++++++++++++++------------------ Interface/FilterMenus.lua | 35 +++++++++++++++-------------------- Player.lua | 25 +++++++++++-------------- 3 files changed, 48 insertions(+), 52 deletions(-) diff --git a/Constants.lua b/Constants.lua index 689b78b..fb072f4 100644 --- a/Constants.lua +++ b/Constants.lua @@ -12,36 +12,41 @@ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- +-- Upvalued Lua API +------------------------------------------------------------------------------- +local _G = getfenv(0) + +------------------------------------------------------------------------------- -- AddOn namespace. ------------------------------------------------------------------------------- -local LibStub = LibStub +local LibStub = _G.LibStub local MODNAME = "Ackis Recipe List" local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME) -local private = select(2, ...) +local private = _G.select(2, ...) ------------------------------------------------------------------------------- -- Profession data. ------------------------------------------------------------------------------- -- Needed for Smelting kludge. -private.mining_name = GetSpellInfo(32606) +private.mining_name = _G.GetSpellInfo(32606) -- This is needed because the French translation is non-conformant. -private.runeforging_name = GetLocale() == "frFR" and "Runeforger" or GetSpellInfo(53428) +private.runeforging_name = _G.GetLocale() == "frFR" and "Runeforger" or _G.GetSpellInfo(53428) private.professions = { - ["Alchemy"] = GetSpellInfo(51304), - ["Blacksmithing"] = GetSpellInfo(51300), - ["Cooking"] = GetSpellInfo(51296), - ["Enchanting"] = GetSpellInfo(51313), - ["Engineering"] = GetSpellInfo(51306), - ["FirstAid"] = GetSpellInfo(45542), - ["Inscription"] = GetSpellInfo(45363), - ["Jewelcrafting"] = GetSpellInfo(51311), - ["Leatherworking"] = GetSpellInfo(51302), + ["Alchemy"] = _G.GetSpellInfo(51304), + ["Blacksmithing"] = _G.GetSpellInfo(51300), + ["Cooking"] = _G.GetSpellInfo(51296), + ["Enchanting"] = _G.GetSpellInfo(51313), + ["Engineering"] = _G.GetSpellInfo(51306), + ["FirstAid"] = _G.GetSpellInfo(45542), + ["Inscription"] = _G.GetSpellInfo(45363), + ["Jewelcrafting"] = _G.GetSpellInfo(51311), + ["Leatherworking"] = _G.GetSpellInfo(51302), ["Runeforging"] = private.runeforging_name, - ["Smelting"] = GetSpellInfo(2656), - ["Tailoring"] = GetSpellInfo(51309), + ["Smelting"] = _G.GetSpellInfo(2656), + ["Tailoring"] = _G.GetSpellInfo(51309), } private.ordered_professions = { @@ -56,7 +61,7 @@ private.ordered_professions = { private.professions.Leatherworking, -- 9 private.professions.Runeforging, -- 10 private.professions.Smelting, -- 11 - private.professions.Tailoring, -- 12 + private.professions.Tailoring, -- 12 } private.profession_textures = { @@ -500,7 +505,7 @@ private.faction_strings = { -- Colors. ------------------------------------------------------------------------------- local function RGBtoHEX(r, g, b) - return string.format("%02x%02x%02x", r * 255, g * 255, b * 255) + return ("%02x%02x%02x"):format(r * 255, g * 255, b * 255) end local function GetColorsFromTable(dict) @@ -564,7 +569,6 @@ private.spell_overwrite_map = { ------------------------------------------------------------------------------- [75175] = 55769, [75172] = 55642, [75178] = 55777, [75154] = 56034, [75155] = 56039, - } ------------------------------------------------------------------------------- diff --git a/Interface/FilterMenus.lua b/Interface/FilterMenus.lua index 30f775f..57bb70b 100644 --- a/Interface/FilterMenus.lua +++ b/Interface/FilterMenus.lua @@ -666,29 +666,24 @@ function private.InitializeFilterPanel() end) local iconTex = cButton:CreateTexture(nil, "BORDER") - - if texture == "wotlk_logo" then - iconTex:SetTexture("Interface\\Addons\\AckisRecipeList\\img\\" .. texture) - else - iconTex:SetTexture("Interface/Glues/Common/" .. texture) - end + iconTex:SetTexture(([[Interface\Glues\Common\%s]]):format(texture)) iconTex:SetWidth(100) iconTex:SetHeight(46) iconTex:SetAllPoints(cButton) local pushedTexture = cButton:CreateTexture(nil, "ARTWORK") - pushedTexture:SetTexture("Interface/Buttons/UI-Quickslot-Depress") + pushedTexture:SetTexture([[Interface\Buttons\UI-Quickslot-Depress]]) pushedTexture:SetAllPoints(cButton) cButton:SetPushedTexture(pushedTexture) local highlightTexture = cButton:CreateTexture() - highlightTexture:SetTexture("Interface/Buttons/ButtonHilight-Square") + highlightTexture:SetTexture([[Interface\Buttons\ButtonHilight-Square]]) highlightTexture:SetAllPoints(cButton) highlightTexture:SetBlendMode("ADD") cButton:SetHighlightTexture(highlightTexture) local checkedTexture = cButton:CreateTexture() - checkedTexture:SetTexture("Interface/Buttons/CheckButtonHilight") + checkedTexture:SetTexture([[Interface\Buttons\CheckButtonHilight]]) checkedTexture:SetAllPoints(cButton) checkedTexture:SetBlendMode("ADD") cButton:SetCheckedTexture(checkedTexture) @@ -786,7 +781,7 @@ function private.InitializeFilterPanel() local expansion0_toggle = GenericCreateButton(nil, expansion0_frame, 15, 120, "GameFontHighlight", _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0) expansion0_toggle:SetPoint("TOPLEFT", expansion0_frame, "TOPLEFT", -2, -4) - expansion0_toggle:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight") + expansion0_toggle:SetHighlightTexture([[Interface\Buttons\UI-PlusButton-Hilight]]) expansion0_toggle:RegisterForClicks("LeftButtonUp", "RightButtonUp") expansion0_toggle.buttons = expansion0_buttons @@ -833,7 +828,7 @@ function private.InitializeFilterPanel() local expansion1_toggle = GenericCreateButton(nil, expansion1_frame, 15, 120, "GameFontHighlight", _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0) expansion1_toggle:SetPoint("TOPLEFT", expansion1_frame, "TOPLEFT", -2, -4) - expansion1_toggle:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight") + expansion1_toggle:SetHighlightTexture([[Interface\Buttons\UI-PlusButton-Hilight]]) expansion1_toggle:RegisterForClicks("LeftButtonUp", "RightButtonUp") expansion1_toggle.buttons = expansion1_buttons @@ -890,7 +885,7 @@ function private.InitializeFilterPanel() local expansion2_toggle = GenericCreateButton(nil, expansion2_frame, 15, 120, "GameFontHighlight", _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0) expansion2_toggle:SetPoint("TOPLEFT", expansion2_frame, "TOPLEFT", -2, -4) - expansion2_toggle:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight") + expansion2_toggle:SetHighlightTexture([[Interface\Buttons\UI-PlusButton-Hilight]]) expansion2_toggle:RegisterForClicks("LeftButtonUp", "RightButtonUp") expansion2_toggle.buttons = expansion2_buttons @@ -922,11 +917,11 @@ function private.InitializeFilterPanel() end local expansion3_buttons = { - ["catacommon1"] = { tt = ReputationDesc(Wildhammer_Dragonmaw), text = DisabledText(Wildhammer_Dragonmaw), row = 2, col = 1 }, + ["catacommon1"] = { tt = ReputationDesc(Wildhammer_Dragonmaw), text = DisabledText(Wildhammer_Dragonmaw), row = 2, col = 1 }, ["catacommon2"] = { tt = ReputationDesc(Tol_Barad), text = DisabledText(Tol_Barad), row = 3, col = 1 }, ["guardiansofhyjal"] = { tt = ReputationDesc(BFAC["Guardians of Hyjal"]), text = DisabledText(BFAC["Guardians of Hyjal"]), row = 4, col = 1 }, - ["ramkahen"] = { tt = ReputationDesc(BFAC["Ramkahen"]), text = DisabledText(BFAC["Ramkahen"]), row = 5, col = 1 }, - ["earthenring"] = { tt = ReputationDesc(BFAC["The Earthen Ring"]), text = DisabledText(BFAC["The Earthen Ring"]), row = 6, col = 1 }, + ["ramkahen"] = { tt = ReputationDesc(BFAC["Ramkahen"]), text = DisabledText(BFAC["Ramkahen"]), row = 5, col = 1 }, + ["earthenring"] = { tt = ReputationDesc(BFAC["The Earthen Ring"]), text = DisabledText(BFAC["The Earthen Ring"]), row = 6, col = 1 }, ["therazane"] = { tt = ReputationDesc(BFAC["Therazane"]), text = DisabledText(BFAC["Therazane"]), row = 7, col = 1 }, } GenerateCheckBoxes(expansion3_frame, expansion3_buttons) @@ -941,7 +936,7 @@ function private.InitializeFilterPanel() local expansion3_toggle = GenericCreateButton(nil, expansion3_frame, 15, 120, "GameFontHighlight", _G.REPUTATION .. ":", "LEFT", L["REP_TEXT_DESC"], 0) expansion3_toggle:SetPoint("TOPLEFT", expansion3_frame, "TOPLEFT", -2, -4) - expansion3_toggle:SetHighlightTexture("Interface\\Buttons\\UI-PlusButton-Hilight") + expansion3_toggle:SetHighlightTexture([[Interface\Buttons\UI-PlusButton-Hilight]]) expansion3_toggle:RegisterForClicks("LeftButtonUp", "RightButtonUp") expansion3_toggle.buttons = expansion3_buttons @@ -973,10 +968,10 @@ function private.InitializeFilterPanel() ARL_MiscAltBtn:SetPoint("LEFT", ARL_MiscAltText, "RIGHT") ARL_MiscAltBtn:SetHeight(22) ARL_MiscAltBtn:SetWidth(22) - ARL_MiscAltBtn:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up") - ARL_MiscAltBtn:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down") - ARL_MiscAltBtn:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled") - ARL_MiscAltBtn:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight") + ARL_MiscAltBtn:SetNormalTexture([[Interface\Buttons\UI-SpellbookIcon-NextPage-Up]]) + ARL_MiscAltBtn:SetPushedTexture([[Interface\Buttons\UI-SpellbookIcon-NextPage-Down]]) + ARL_MiscAltBtn:SetDisabledTexture([[Interface\Buttons\UI-SpellbookIcon-NextPage-Disabled]]) + ARL_MiscAltBtn:SetHighlightTexture([[Interface\Buttons\UI-Common-MouseHilight]]) SetTooltipScripts(ARL_MiscAltBtn, L["ALT_TRADESKILL_DESC"], 1) diff --git a/Player.lua b/Player.lua index 251807e..d98be30 100644 --- a/Player.lua +++ b/Player.lua @@ -30,17 +30,17 @@ local pairs = _G.pairs ------------------------------------------------------------------------------- -- AddOn namespace. ------------------------------------------------------------------------------- -local LibStub = LibStub +local LibStub = _G.LibStub -local MODNAME = "Ackis Recipe List" -local addon = LibStub("AceAddon-3.0"):GetAddon(MODNAME) +local MODNAME = "Ackis Recipe List" +local addon = LibStub("AceAddon-3.0"):GetAddon(MODNAME) -local BFAC = LibStub("LibBabble-Faction-3.0"):GetLookupTable() -local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME) +local BFAC = LibStub("LibBabble-Faction-3.0"):GetLookupTable() +local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME) -local private = select(2, ...) +local private = _G.select(2, ...) -local Player = private.Player +local Player = private.Player ------------------------------------------------------------------------------- -- Constants @@ -96,7 +96,7 @@ do local known_professions = { ["prof1"] = false, ["prof2"] = false, - --["archaeology"] = false, -- return value for GetProfessions(), it's just not used in arl + ["archaeology"] = false, ["fishing"] = false, ["cooking"] = false, ["firstaid"] = false, @@ -111,19 +111,16 @@ do end local known = known_professions - known.prof1, known.prof2, known.archaeology, known.fishing, known.cooking, known.firstaid = GetProfessions() + known.prof1, known.prof2, known.archaeology, known.fishing, known.cooking, known.firstaid = _G.GetProfessions() for profession, index in pairs(known_professions) do if index then - local name, icon, rank, maxrank, numspells, spelloffset, skillline = GetProfessionInfo(index) + local name, icon, rank, maxrank, numspells, spelloffset, skillline = _G.GetProfessionInfo(index) if name == private.mining_name then name = private.professions["Smelting"] end - - if profession_list[name] == false then - profession_list[name] = true - end + profession_list[name] = true end end end -- 1.7.9.5