/
local faction,_ = UnitFactionGroup('player') |
local function mailupdate() |
-- print(db[faction][realm][character]['mail'],GetInboxNumItems() == 0) |
--print(scanned) |
if(not scanned) then |
return db[faction][realm][character]['mailunread'],db[faction][realm][character]['mail'] |
else |
-- print(GetInboxNumItems()) |
local cur,tot = GetInboxNumItems() |
db[faction][realm][character]['mail'] = tot |
return db[faction][realm][character]['mailunread'], tot |
local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned, textCreated, canReply, isGM |
local index,newunread = 0,0 |
local unread, tot = mailupdate() |
-- print("+",unread, tot) |
subject = "start" |
while(subject) do |
index = index + 1 |
if(not(db[faction][realm][character]['mail'] > 0 and GetInboxNumItems() == 0)) then |
db[faction][realm][character]['mailunread'] = newunread |
end |
-- db[faction][realm][character]['mailunread'] = unread |
-- print("-",unread, tot, newunread,not(db[faction][realm][character]['mail'] > 0 and GetInboxNumItems() == 0),db[faction][realm][character]['mailunread']) |
if(db[faction][realm][character]['newmail']) then |
if(HasNewMail() and tot == 0) then |
tot = #{GetLatestThreeSenders()} |
-- print(scanned, select(2,GetInboxNumItems())) |
if(scanned and select(2,GetInboxNumItems()) == 0) then |
tot = 0 |
end |
end |
local function updateText(self, event) |
-- print(mail()) |
db[faction][realm][character]['newmail'] = HasNewMail() |
-- print(event,MailFrame:IsVisible(),select(2,GetInboxNumItems())) |
if(MailFrame:IsVisible() and GetInboxNumItems() > 0) then |
db[faction][realm][character]['newmail'] = iterateMail() |
end |
end |
local function init() |
-- print("init",childName) |
addon['RegisterFunc']({'MAIL_SHOW',"MAIL_INBOX_UPDATE","UPDATE_PENDING_MAIL"},"OnEvent", updateText) |
options = addon['InitConfig'](addon, childName, true, { |
options = addon:InitConfig(childName, true, { |
['name'] = childName, |
['type'] = "data source", |
['OnTooltipShow'] = OnTooltip, |