Skip to content

Commit

Permalink
fix: remove lots of incorrect globals
Browse files Browse the repository at this point in the history
  • Loading branch information
nulian committed Jul 23, 2024
1 parent c4dd428 commit 9a5a0f2
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 264 deletions.
30 changes: 15 additions & 15 deletions Outfitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2934,7 +2934,7 @@ function Outfitter:FindOutfitItemIndex(pOutfit)
end

function Outfitter:WearOutfitByName(pOutfitName, pLayerID)
vOutfit = self:FindOutfitByName(pOutfitName)
local vOutfit = self:FindOutfitByName(pOutfitName)

if not vOutfit then
self:ErrorMessage("Couldn't find outfit named %s", pOutfitName)
Expand All @@ -2945,7 +2945,7 @@ function Outfitter:WearOutfitByName(pOutfitName, pLayerID)
end

function Outfitter:RemoveOutfitByName(pOutfitName, pLayerID)
vOutfit = self:FindOutfitByName(pOutfitName)
local vOutfit = self:FindOutfitByName(pOutfitName)

if not vOutfit then
self:ErrorMessage("Couldn't find outfit named %s", pOutfitName)
Expand Down Expand Up @@ -3297,7 +3297,7 @@ function Outfitter:WearBoundOutfit(pBindingIndex)
UIErrorsFrame:AddMessage(format(self.cEquipOutfitMessageFormat, vOutfit:GetName()), self.OUTFIT_MESSAGE_COLOR.r, self.OUTFIT_MESSAGE_COLOR.g, self.OUTFIT_MESSAGE_COLOR.b)
end
else
local vEquipped = self:ToggleOutfitNow(vOutfit, vCategoryID)
local vEquipped = self:ToggleOutfitNow(vOutfit)

if not self.Settings.Options.DisableHotkeyMessages then
if vEquipped then
Expand Down Expand Up @@ -4621,7 +4621,7 @@ function Outfitter:FindMultipleItemLocation(pItems, pInventoryCache)
end

function Outfitter:FindAndAddItemsToOutfit(pOutfit, pSlotName, pItems, pInventoryCache)
vItemLocation, vItem = self:FindMultipleItemLocation(pItems, pInventoryCache)
local vItemLocation, vItem = self:FindMultipleItemLocation(pItems, pInventoryCache)

if vItemLocation then
local vInventorySlot = pSlotName
Expand Down Expand Up @@ -5150,7 +5150,7 @@ end

function Outfitter:CreateEmptySpecialOccasionOutfit(pScriptID, pName, pAllowDuplicates)
-- Return the existing outfit if duplicates aren't allowed
vOutfit = self:GetOutfitByName(pName)
local vOutfit = self:GetOutfitByName(pName)
if vOutfit and not pAllowDuplicates then
-- Assign the script to the existing outfit if there isn't one already
if not vOutfit.ScriptID then
Expand Down Expand Up @@ -5631,7 +5631,7 @@ function Outfitter._NameOutfitDialog:Update(pCheckForStatOutfit)

if vStat
and not vStat.Complex then -- Don't attempt to test for iterative outfits
vOutfit = Outfitter:GenerateSmartOutfit("temp outfit", vStat, Outfitter:GetInventoryCache())
local vOutfit = Outfitter:GenerateSmartOutfit("temp outfit", vStat, Outfitter:GetInventoryCache())
if not vOutfit
or vOutfit:IsEmpty() then
vErrorMessage = Outfitter.cNoItemsWithStatError
Expand Down Expand Up @@ -5778,7 +5778,7 @@ function Outfitter._RebuildOutfitDialog:Update(pCheckForStatOutfit)

if vStat
and not vStat.Complex then -- Don't attempt to test for iterative outfits
vOutfit = Outfitter:GenerateSmartOutfit("temp outfit", vStat, Outfitter:GetInventoryCache())
local vOutfit = Outfitter:GenerateSmartOutfit("temp outfit", vStat, Outfitter:GetInventoryCache())
if not vOutfit
or vOutfit:IsEmpty() then
vErrorMessage = Outfitter.cNoItemsWithStatError
Expand Down Expand Up @@ -6034,7 +6034,7 @@ function Outfitter.OutfitItemSelected(dropdown, item)
local outfit = Outfitter:GetOutfitFromDropdown(dropdown)

if not outfit then
Outfitter:ErrorMessage("Outfit for menu item "..tostring(pItem.name).." not found")
Outfitter:ErrorMessage("Outfit for menu item "..tostring(item.name).." not found")
return
end

Expand Down Expand Up @@ -6373,7 +6373,7 @@ function Outfitter:DepositOutfit(pOutfit, pUniqueItemsOnly)
local vNumChanges = #vEquipmentChangeList

while vChangeIndex <= vNumChanges do
vEquipmentChange = vEquipmentChangeList[vChangeIndex]
local vEquipmentChange = vEquipmentChangeList[vChangeIndex]

if self:IsBankBagIndex(vEquipmentChange.FromLocation.BagIndex) then
table.remove(vEquipmentChangeList, vChangeIndex)
Expand Down Expand Up @@ -6470,7 +6470,7 @@ function Outfitter:WithdrawOutfit(pOutfit)
local vNumChanges = #vEquipmentChangeList

while vChangeIndex <= vNumChanges do
vEquipmentChange = vEquipmentChangeList[vChangeIndex]
local vEquipmentChange = vEquipmentChangeList[vChangeIndex]

if not self:IsBankBagIndex(vEquipmentChange.FromLocation.BagIndex) then
table.remove(vEquipmentChangeList, vChangeIndex)
Expand All @@ -6486,7 +6486,7 @@ function Outfitter:WithdrawOutfit(pOutfit)

-- Execute the changes

vEquipmentChangeList:execute(vEmptyBagSlots, vExpectedInventoryCache)
vEquipmentChangeList:execute(vEmptyBagSlots, vInventoryCache)

self:DispatchOutfitEvent("EDIT_OUTFIT", pOutfit:GetName(), pOutfit)
end
Expand Down Expand Up @@ -7098,7 +7098,7 @@ function Outfitter:InventoryItemIsActive(pInventorySlot)
local vSlotID = self.cSlotIDs[pInventorySlot]
local vItemLink = self:GetInventorySlotIDLink(vSlotID)
local vItemCode = self:GetSlotIDLinkInfo(vSlotID)[1]
local vStartTime, vDuration, vEnable = GetItemCooldown(vItemCode)
local vStartTime, vDuration, vEnable = C_Item.GetItemCooldown(vItemCode)

if not vStartTime or vStartTime == 0 then
return false
Expand Down Expand Up @@ -7212,7 +7212,7 @@ function Outfitter:CallCompanionByName(pName)
end

function Outfitter:PlayerIsOnQuestID(pQuestID)
local vNumQuests = GetNumQuestLogEntries()
local vNumQuests = C_QuestLog.GetNumQuestLogEntries()

for vQuestIndex = 1, vNumQuests do
local vQuestLink = GetQuestLink(vQuestIndex)
Expand Down Expand Up @@ -7258,10 +7258,10 @@ function Outfitter._ExtendedCompareTooltip:Construct()
if not Outfitter.Settings.Options.DisableItemComparisons then
if OutfitterAPI.IsWoW1002 then
if TooltipUtil.ShouldDoItemComparison() then
self:ShowCompareItem(pShift)
self:ShowCompareItem()
end
else
self:ShowCompareItem(pShift)
self:ShowCompareItem()
end
end
end)
Expand Down
2 changes: 1 addition & 1 deletion OutfitterBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function Outfitter.OutfitBar:GetCursorTexture()
return
end

if vType == "spell" then
if vType == "spell" and vParam1 and vParam2 then
return GetSpellTexture(vParam1, vParam2)

elseif vType == "item" then
Expand Down
2 changes: 1 addition & 1 deletion OutfitterEquipment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ function Outfitter:UpdateEquippedItems()
vEquipmentChangeList:addChangesToEquipOutfit(vCompiledOutfit, vInventoryCache)

if vEquipmentChangeList then
-- local vExpectedInventoryCache = self:New(self._InventoryCache)
local vExpectedInventoryCache = self:New(self._InventoryCache)

if self.Debug.EquipmentChanges then
self:DebugMessage("UpdateEquippedItems: Executing change list")
Expand Down
6 changes: 3 additions & 3 deletions OutfitterInventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Outfitter:FindNextCooldownItem(pItemCodes, pIgnoreSwapCooldown)
local vStart, vDuration, vEnabled

if vItemInfo.Location.BagIndex then
vStart, vDuration, vEnabled = GetContainerItemCooldown(vItemInfo.Location.BagIndex, vItemInfo.Location.BagSlotIndex)
vStart, vDuration, vEnabled = C_Container.GetContainerItemCooldown(vItemInfo.Location.BagIndex, vItemInfo.Location.BagSlotIndex)
elseif vItemInfo.Location.SlotID then
vStart, vDuration, vEnabled = GetInventoryItemCooldown("player", vItemInfo.Location.SlotID)
end
Expand Down Expand Up @@ -114,7 +114,7 @@ function Outfitter:GetItemLocationLink(pItemLocation)
if pItemLocation.BagIndex then
return OutfitterAPI:GetContainerItemLink(pItemLocation.BagIndex, pItemLocation.BagSlotIndex)
elseif pItemLocation.SlotName then
return self:GetInventorySlotIDLink(pSlotID)
return self:GetInventorySlotIDLink(GetInventorySlotInfo(pItemLocation.SlotName))
else
self:ErrorMessage("Unknown location in GetItemLocationLink")
return
Expand Down Expand Up @@ -1004,7 +1004,7 @@ function Outfitter._InventoryCache:FindItemIndex(pOutfitItem, pAllowSubCodeWildc

-- Return the match if only one item was found

if vNumItemsFound == 1
if vNumItemsFound == 1 and vBestMatch
and not vBestMatch.IgnoreItem then
return vBestMatch, vBestMatchIndex, vItemFamily, nil
end
Expand Down
Loading

0 comments on commit 9a5a0f2

Please sign in to comment.