Commit 46402281 authored by Robin Schoonover's avatar Robin Schoonover

Don't leak globals, fix a few unintentional global refs, and upvalue a few globals as well.

parent 9927bdd9
Pipeline #215 passed with stage
local addon_name, addon = ...
local format, hooksecurefunc, ipairs, select, tinsert, wipe
= format, hooksecurefunc, ipairs, select, tinsert, wipe
function addon:AddIDLine(tip, ...) -- idname, id
if tip == nil or tip._alltheid then
return
......
local addon_name, addon = ...
local CreateFrame, GetCurrentListInfo, GetCurrencyListInfo,
GetCurrencyListSize, GetCurrencyListSize, rawset, setmetatable
= CreateFrame, GetCurrentListInfo, GetCurrencyListInfo,
GetCurrencyListSize, GetCurrencyListSize, rawset, setmetatable
local function defaulttable(callable)
callable = callable or function() return nil end
return setmetatable({}, {
......
local addon_name, addon = ...
local GetCurrencyListLink, GetGlyphLink, GetLootSlotLink, tinsert, strfind,
strsplit, select, UnitAura, UnitBattlePetSpeciesID, UnitBuff, UnitDebuff,
UnitGUID, UnitIsWildBattlePet, unpack, wipe
= GetCurrencyListLink, GetGlyphLink, GetLootSlotLink, tinsert, strfind,
strsplit, select, UnitAura, UnitBattlePetSpeciesID, UnitBuff, UnitDebuff,
UnitGUID, UnitIsWildBattlePet, unpack, wipe
addon:HookTipScript("OnTooltipSetItem", function(self)
local name, link = self:GetItem()
if link then
......@@ -21,7 +28,7 @@ end)
--
local tmpSetUnit = {}
function handleUnit(tip, unitType, ...)
local function handleUnit(tip, unitType, ...)
if unitType == "Creature" or unitType == "Pet" or unitType == "Vehicle" then
local _, _, _, _, id = ...
tinsert(tmpSetUnit, "NPC")
......@@ -120,7 +127,7 @@ addon:HookTip("SetLFGDungeonReward", function(tip, dungeonID, rewardID)
end
end)
addon:HookTip("SetLootCurrency", function(self, slot)
addon:HookTip("SetLootCurrency", function(tip, slot)
local link = GetLootSlotLink(slot)
if link then
local _, _, name, id = strfind(link, "|H(%w+):(%d+)")
......
local addon_name, addon = ...
local CreateFrame, hooksecurefunc, GetFactionInfo, IsAddOnLoaded, ipairs, tinsert
= CreateFrame, hooksecurefunc, GetFactionInfo, IsAddOnLoaded, ipairs, tinsert
local event_frame = CreateFrame("FRAME")
event_frame:SetScript("OnEvent", function(frame, event, ...)
local func = frame[event]
......@@ -38,7 +41,6 @@ event_frame:RegisterEvent("ADDON_LOADED")
OnAddOnLoaded("Blizzard_Collections", function()
hooksecurefunc("MountJournal_UpdateMountDisplay", function()
MountJournal.MountDisplay.InfoButton.Lore:SetText(descriptionText)
local spellID = MountJournal.MountDisplay.lastDisplayed
if spellID then
addon:TextAppendID_NoNL(MountJournal.MountDisplay.InfoButton.Lore, "Spell", spellID)
......@@ -63,14 +65,14 @@ do
end)
local origSharedPetBattleAbilityTooltip_SetAbility = SharedPetBattleAbilityTooltip_SetAbility
SharedPetBattleAbilityTooltip_SetAbility = function(tip, abilityInfo, additionalInfo)
local origSharedPetBattleAbilityTooltip_SetAbility = _G.SharedPetBattleAbilityTooltip_SetAbility
_G.SharedPetBattleAbilityTooltip_SetAbility = function(tip, abilityInfo, additionalInfo)
local abilityID = abilityInfo:GetAbilityID()
if abilityID then
local line = addon:IDLine("Ability", abilityID)
if additionalInfo then
additionaInfo = additionalInfo.."\n"..line
additionalInfo = additionalInfo.."\n"..line
else
additionalInfo = line
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment