この比較の残りの部分を読み込んでいます。

Untitled diff

作成日 差分は期限切れになりません
59 削除
737 行
70 追加
748 行
BulkMailInbox = LibStub("AceAddon-3.0"):NewAddon("BulkMailInbox", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceHook-3.0")
BulkMailInbox = LibStub("AceAddon-3.0"):NewAddon("BulkMailInbox", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceHook-3.0")


local mod, self, BulkMailInbox = BulkMailInbox, BulkMailInbox, BulkMailInbox
local mod, self, BulkMailInbox = BulkMailInbox, BulkMailInbox, BulkMailInbox


local VERSION = "7.0.0"
local VERSION = "7.0.0"
local LibStub = LibStub
local LibStub = LibStub


local L = LibStub("AceLocale-3.0"):GetLocale("BulkMailInbox", false)
local L = LibStub("AceLocale-3.0"):GetLocale("BulkMailInbox", false)


BulkMailInbox.L = L
BulkMailInbox.L = L


local media = LibStub("LibSharedMedia-3.0")
local media = LibStub("LibSharedMedia-3.0")
local abacus = LibStub("LibAbacus-3.0")
local abacus = LibStub("LibAbacus-3.0")
local QTIP = LibStub("LibQTip-1.0")
local QTIP = LibStub("LibQTip-1.0")
local AC = LibStub("AceConfig-3.0")
local AC = LibStub("AceConfig-3.0")
local ACD = LibStub("AceConfigDialog-3.0")
local ACD = LibStub("AceConfigDialog-3.0")
local DB = LibStub("AceDB-3.0")
local DB = LibStub("AceDB-3.0")
local LDB = LibStub("LibDataBroker-1.1", true)
local LDB = LibStub("LibDataBroker-1.1", true)
local LD = LibStub("LibDropdown-1.0")
local LD = LibStub("LibDropdown-1.0")




local _G = _G
local _G = _G
local fmt = string.format
local fmt = string.format
local lower = string.lower
local lower = string.lower


local sortFields, markTable -- tables
local sortFields, markTable -- tables
local ibIndex, ibAttachIndex, numInboxItems, inboxCash, cleanPass, cashOnly, markOnly, takeAllInProgress, invFull, filterText -- variables
local ibIndex, ibAttachIndex, numInboxItems, inboxCash, cleanPass, cashOnly, markOnly, takeAllInProgress, invFull, filterText -- variables
local spinnerText = { "Working ", "Working. ", "Working.. ", "Working..." }
local spinnerText = { "Working ", "Working. ", "Working.. ", "Working..." }
--[[----------------------------------------------------------------------------
--[[----------------------------------------------------------------------------
Table Handling
Table Handling
------------------------------------------------------------------------------]]
------------------------------------------------------------------------------]]
local newHash, del
local newHash, del
do
do
local list = setmetatable({}, {__mode='k'})
local list = setmetatable({}, {__mode='k'})
function newHash(...)
function newHash(...)
local t = next(list)
local t = next(list)
if t then
if t then
list[t] = nil
list[t] = nil
else
else
t = {}
t = {}
end
end
for i = 1, select('#', ...), 2 do
for i = 1, select('#', ...), 2 do
t[select(i, ...)] = select(i+1, ...)
t[select(i, ...)] = select(i+1, ...)
end
end
return t
return t
end
end
function del(t)
function del(t)
for k in pairs(t) do
for k in pairs(t) do
t[k] = nil
t[k] = nil
end
end
list[t] = true
list[t] = true
return nil
return nil
end
end
end
end


--[[----------------------------------------------------------------------------
--[[----------------------------------------------------------------------------
Local Processing
Local Processing
------------------------------------------------------------------------------]]
------------------------------------------------------------------------------]]
-- Build a table with info about all items and money in the Inbox
-- Build a table with info about all items and money in the Inbox
local inboxCache = {}
local inboxCache = {}
local function _sortInboxFunc(a,b)
local function _sortInboxFunc(a,b)
local sf = sortFields[BulkMailInbox.db.char.sortField]
local sf = sortFields[BulkMailInbox.db.char.sortField]
if a and b then
if a and b then
a, b = a[sf], b[sf]
a, b = a[sf], b[sf]
if sf == 'itemLink' then
if sf == 'itemLink' then
a = a and GetItemInfo(a) or a
local rarityA, itemIDAstring, _ = strsplit(":", a, 3)
b = b and GetItemInfo(b) or b
local rarityB, itemIDBstring, _ = strsplit(":", b, 3)
if rarityA..":" == ITEM_SOLD_COLON or rarityA == "Cash" then
numberA = 999999999
else
local itemIDA = tonumber(itemIDAstring)
local _, _, rarityANumber = GetItemInfo(itemIDA)
numberA = rarityANumber*10000000 + itemIDA
end
if rarityB..":" == ITEM_SOLD_COLON or rarityB == "Cash" then
numberB = 999999999
else
local itemIDB = tonumber(itemIDBstring)
local _, _, rarityBNumber = GetItemInfo(itemIDB)
numberB = rarityBNumber*10000000 + itemIDB
end
if mod.db.char.sortReversed then
if numberA > numberB then return true end
else
if numberA < numberB then return true end
end
end
else
a = type(a) == "nil" and 0 or type(a) == "boolean" and tostring(a) or a
a = type(a) == "nil" and 0 or type(a) == "boolean" and tostring(a) or a
b = type(b) == "nil" and 0 or type(b) == "boolean" and tostring(b) or b
b = type(b) == "nil" and 0 or type(b) == "boolean" and tostring(b) or b
if mod.db.char.sortReversed then
if mod.db.char.sortReversed then
if a > b then return true end
if a > b then return true end
else
else
if a < b then return true end
if a < b then return true end
end
end
end
end
end
end
end


-- These are the patterns that indicate that the item was received from the AH
-- These are the patterns that indicate that the item was received from the AH
-- In that case the items are not returnable
-- In that case the items are not returnable
local AHReceivedPatterns = {
local AHReceivedPatterns = {
(gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*")),
(gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*")),
(gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*")),
(gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*")),
(gsub(AUCTION_WON_MAIL_SUBJECT, "%%s", ".*"))
(gsub(AUCTION_WON_MAIL_SUBJECT, "%%s", ".*"))
}
}


local function _isAHSentMail(subject)
local function _isAHSentMail(subject)
if subject then
if subject then
for key,pattern in ipairs(AHReceivedPatterns) do
for key,pattern in ipairs(AHReceivedPatterns) do
if subject:find(pattern) ~= nil then
if subject:find(pattern) ~= nil then
return true
return true
end
end
end
end
end
end
end
end


local function _matchesFilter(text)
local function _matchesFilter(text)
if not filterText or filterText:len() == 0 then
if not filterText or filterText:len() == 0 then
return true
return true
end
end
return text:lower():find(filterText, 1, true) ~= nil
return text:lower():find(filterText, 1, true) ~= nil
end
end


local function inboxCacheBuild()
local function inboxCacheBuild()
local start = GetTime()
local start = GetTime()
for k in ipairs(inboxCache) do inboxCache[k] = del(inboxCache[k]) end
for k in ipairs(inboxCache) do inboxCache[k] = del(inboxCache[k]) end
inboxCash, numInboxItems = 0, 0
inboxCash, numInboxItems = 0, 0
for i = 1, GetInboxNumItems() do
for i = 1, GetInboxNumItems() do
local _, _, sender, subject, money, cod, daysLeft, numItems, _, wasReturned, _, canReply, isGM = GetInboxHeaderInfo(i)
local _, _, sender, subject, money, cod, daysLeft, numItems, _, wasReturned, _, canReply, isGM = GetInboxHeaderInfo(i)
if money > 0 then
if money > 0 then
local _, itemName = GetInboxInvoiceInfo(i)
local _, itemName = GetInboxInvoiceInfo(i)
local title = itemName and ITEM_SOLD_COLON..' '..itemName or L["Cash"]
local title = itemName and ITEM_SOLD_COLON..' '..itemName or L["Cash"]
if _matchesFilter(title) then
if _matchesFilter(title) then
-- Contributed by Scott Centoni
-- Contributed by Scott Centoni
table.insert(inboxCache, newHash(
table.insert(inboxCache, newHash(
'index', i, 'sender', sender, 'bmid', daysLeft..subject..0, 'returnable', not wasReturned, 'cod', cod,
'index', i, 'sender', sender, 'bmid', daysLeft..subject..0, 'returnable', not wasReturned, 'cod', cod,
'daysLeft', daysLeft, 'itemLink', title, 'money', money, 'texture', "Interface\\Icons\\INV_Misc_Coin_01"
'daysLeft', daysLeft, 'itemLink', title, 'money', money, 'texture', "Interface\\Icons\\INV_Misc_Coin_01"
))
))
inboxCash = inboxCash + money
inboxCash = inboxCash + money
end
end
end
end
if numItems then
if numItems then
local canReturnItem = not wasReturned
local canReturnItem = not wasReturned
if isGM or not canReply or _isAHSentMail(subject) then
if isGM or not canReply or _isAHSentMail(subject) then
canReturnItem = false
canReturnItem = false
end
end
for j=1, ATTACHMENTS_MAX_SEND do
for j=1, ATTACHMENTS_MAX_SEND do
if GetInboxItem(i,j) and _matchesFilter(GetInboxItem(i, j)) then
if GetInboxItem(i,j) and _matchesFilter(GetInboxItem(i, j)) then
table.insert(inboxCache, newHash(
table.insert(inboxCache, newHash(
'index', i, 'attachment', j, 'sender', sender, 'bmid', daysLeft..subject..j, 'returnable', canReturnItem, 'cod', cod,
'index', i, 'attachment', j, 'sender', sender, 'bmid', daysLeft..subject..j, 'returnable', canReturnItem, 'cod', cod,
'daysLeft', daysLeft, 'itemLink', GetInboxItemLink(i,j), 'qty', select(4, GetInboxItem(i,j)), 'texture', (select(3, GetInboxItem(i,j)))
'daysLeft', daysLeft, 'itemLink', GetInboxItemLink(i,j), 'qty', select(4, GetInboxItem(i,j)), 'texture', (select(3, GetInboxItem(i,j)))
))
))
numInboxItems = numInboxItems + 1
numInboxItems = numInboxItems + 1
end
end
end
end
end
end
end
end
table.sort(inboxCache, _sortInboxFunc)
table.sort(inboxCache, _sortInboxFunc)
end
end


local function takeAll(cash, mark)
local function takeAll(cash, mark)
-- Ace3 timers only allow one arg so support that hack
-- Ace3 timers only allow one arg so support that hack
if type(cash) == "table" then
if type(cash) == "table" then