forked from kemayo/wow-bankstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinventorian.lua
More file actions
44 lines (37 loc) · 1.37 KB
/
inventorian.lua
File metadata and controls
44 lines (37 loc) · 1.37 KB
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
-- Classic-only
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then return end
local core = BankStack
core:RegisterAddonHook("Inventorian", function()
local inv = LibStub("AceAddon-3.0"):GetAddon("Inventorian", true)
local sortbags = core.CommandDecorator(core.SortBags, 'bags')
local sortbank = core.CommandDecorator(core.SortBags, 'bank')
local original_FrameCreate = inv.Frame.Create
inv.Frame.Create = function(inventorianFrame, ...)
local frame = original_FrameCreate(inventorianFrame, ...)
local sort = CreateFrame("Button", nil, frame) --, "UIPanelButtonTemplate")
sort:SetSize(25, 23)
sort:SetPoint("BOTTOMLEFT", 3, 3)
sort:RegisterForClicks("anyUp")
sort:SetNormalAtlas("bags-button-autosort-up")
sort:SetPushedAtlas("bags-button-autosort-down")
sort:SetDisabledAtlas("bags-button-autosort-up", true)
sort:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]], "ADD")
sort:SetScript("OnClick", function(self, button)
if button == "LeftButton" then
PlaySound(SOUNDKIT.UI_BAG_SORTING_01)
if frame:IsBank() then
sortbank()
else
sortbags()
end
end
end)
sort:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(sort, "ANCHOR_LEFT")
GameTooltip:SetText(frame:IsBank() and BAG_CLEANUP_BANK or BAG_CLEANUP_BAGS, 1, 1, 1)
GameTooltip:Show()
end)
sort:SetScript("OnLeave", GameTooltip_Hide)
return frame
end
end)