Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nCore: Print total money collected from mailbox.

  • Loading branch information...
commit 3d44ba6162ba4043d5d508acc6c865e207f54399 1 parent 61139c9
@renstrom authored
Showing with 29 additions and 22 deletions.
  1. +29 −22 Interface/AddOns/nCore/modules/mail.lua
View
51 Interface/AddOns/nCore/modules/mail.lua
@@ -6,31 +6,38 @@ f:SetText(OPENMAIL)
local processing = false
local function OnEvent()
- if (not MailFrame:IsShown()) then
+ if (not MailFrame:IsShown()) then
return
end
- local num = GetInboxNumItems()
- if (processing) then
- if (num == 0) then
- MiniMapMailFrame:Hide()
- processing = false
- return
- end
-
- for i = num, 1, -1 do
- local _, _, _, _, money, COD, _, item = GetInboxHeaderInfo(i)
- if (item and COD < 1) then
- TakeInboxItem(i)
- return
- end
-
- if (money > 0) then
- TakeInboxMoney(i)
- return
- end
- end
- end
+ local num = GetInboxNumItems()
+ if (processing) then
+ if (num == 0) then
+ MiniMapMailFrame:Hide()
+ processing = false
+ return
+ end
+
+ local totalMoney = 0
+ for i = num, 1, -1 do
+ local _, _, _, _, money, COD, _, item = GetInboxHeaderInfo(i)
+ if (item and COD < 1) then
+ TakeInboxItem(i)
+ return
+ end
+
+ if (money > 0) then
+ totalMoney = totalMoney + money
+ TakeInboxMoney(i)
+ return
+ end
+ end
+
+ if (totalMoney > 0) then
+ local chatWindowFontSize = select(2, GetChatWindowInfo(1))
+ DEFAULT_CHAT_FRAME:AddMessage('Total money collected from mailbox was '..GetCoinTextureString(totalMoney, chatWindowFontSize)..'.')
+ end
+ end
end
f:RegisterEvent('MAIL_INBOX_UPDATE')
Please sign in to comment.
Something went wrong with that request. Please try again.