-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPostal.lua
More file actions
executable file
·45 lines (36 loc) · 1017 Bytes
/
Postal.lua
File metadata and controls
executable file
·45 lines (36 loc) · 1017 Bytes
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
local addonName, ATOM = ...
local Module = ATOM:NewModule('Postal')
local CollectableItem, CheckMailbox
function Module:OnEnable()
self:RegisterEvent('MAIL_SHOW')
end
function Module:OnDisable()
self:UnregisterEvent('MAIL_SHOW')
end
function Module:MAIL_SHOW()
if not _G['ZygorGuidesViewer'] then
ATOM:Wait(function()
CheckMailbox(GetInboxNumItems())
end)
end
end
function CollectableItem(index)
local _, _, _, _, money, CODAmount, _, itemCount = GetInboxHeaderInfo(index)
if money > 0 or (itemCount and itemCount > 0) and CODAmount <= 0 then
return index
end
end
function CheckMailbox(index)
if not InboxFrame:IsVisible() or index <= 0 then
if select(2, GetInboxNumItems()) == 0 then
-- MiniMapMailFrame:Hide()
end
return
end
if CollectableItem(index) then
AutoLootMailItem(index)
end
ATOM:Wait(function()
CheckMailbox(CollectableItem(index) or (index - 1))
end)
end