-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOutfitterMinimapButton.lua
83 lines (73 loc) · 2.28 KB
/
OutfitterMinimapButton.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
function Outfitter:GetMinimapDropdownItems(items)
-- Just return if not initialized yet
if not self.Initialized then
return
end
-- Add controls for the addon
items:AddCategoryTitle(self.cTitleVersion)
items:AddFunction(self.cOpenOutfitter, function ()
self:OpenUI()
end)
items:AddToggle(self.cAutoSwitch,
function ()
return self.Settings.Options.DisableAutoSwitch
end, function (menu, value)
self:SetAutoSwitch(self.Settings.Options.DisableAutoSwitch)
end)
-- Add the outfits
self:GetMinimapOutfitItems(items)
end
function Outfitter:GetMinimapOutfitItems(items)
-- Just return if not initialized yet
if not self.Initialized then
return
end
--
local inventoryCache = self:GetInventoryCache()
local categoryOrder = self:GetCategoryOrder()
for _, categoryID in ipairs(categoryOrder) do
local categoryName = self["c"..categoryID.."Outfits"]
local outfits = self:GetOutfitsByCategoryID(categoryID)
if self:HasVisibleOutfits(outfits) then
items:AddCategoryTitle(categoryName)
for vIndex, outfit in ipairs(outfits) do
if self:OutfitIsVisible(outfit) then
local wearingOutfit = Outfitter:WearingOutfit(outfit)
local missingItems, bankedItems = inventoryCache:GetMissingItems(outfit)
local itemColor = nil
if missingItems then
itemColor = RED_FONT_COLOR
elseif bankedItems then
itemColor = Outfitter.BANKED_FONT_COLOR
end
items:AddToggleWithIcon(outfit:GetName(), self.OutfitBar:GetOutfitTexture(outfit), itemColor,
function ()
return wearingOutfit
end, function (menu, value)
local categoryID = outfit.CategoryID
local doToggle = categoryID ~= "Complete"
if IsModifierKeyDown() then
self:AskSetCurrent(outfit)
elseif doToggle
and self:WearingOutfit(outfit) then
self:RemoveOutfit(outfit)
else
self:WearOutfit(outfit)
end
end)
--[[
Outfitter:AddMenuItem(
pFrame,
outfit:GetName(),
{CategoryID = categoryID, Index = vIndex},
wearingOutfit, -- Checked
nil, -- Level
itemColor, -- Color
nil, -- Disabled
{icon = Outfitter.OutfitBar:GetOutfitTexture(outfit)})
]]
end
end
end
end
end