Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
Robin Hüskes | 050f77bc1d | |
Robin Hüskes | 70ef3cfde1 | |
Robin Hüskes | 5a826dada9 | |
Robin Hüskes | d808ff9cd3 | |
Robin Hüskes | b711bb8fc4 | |
Robin Hüskes | ef759c0ed1 | |
Robin Hüskes | 42fdfd738f | |
Robin Hüskes | f42cfe02e2 |
|
@ -1,5 +1,5 @@
|
||||||
--[[ $Id: CallbackHandler-1.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]
|
--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]]
|
||||||
local MAJOR, MINOR = "CallbackHandler-1.0", 7
|
local MAJOR, MINOR = "CallbackHandler-1.0", 8
|
||||||
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
|
|
||||||
if not CallbackHandler then return end -- No upgrade needed
|
if not CallbackHandler then return end -- No upgrade needed
|
||||||
|
@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
|
||||||
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
|
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local error = error
|
local securecallfunction, error = securecallfunction, error
|
||||||
local setmetatable, rawget = setmetatable, rawget
|
local setmetatable, rawget = setmetatable, rawget
|
||||||
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
|
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
|
||||||
|
|
||||||
local xpcall = xpcall
|
|
||||||
|
|
||||||
local function errorhandler(err)
|
|
||||||
return geterrorhandler()(err)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function Dispatch(handlers, ...)
|
local function Dispatch(handlers, ...)
|
||||||
local index, method = next(handlers)
|
local index, method = next(handlers)
|
||||||
if not method then return end
|
if not method then return end
|
||||||
repeat
|
repeat
|
||||||
xpcall(method, errorhandler, ...)
|
securecallfunction(method, ...)
|
||||||
index, method = next(handlers, index)
|
index, method = next(handlers, index)
|
||||||
until not method
|
until not method
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,14 +9,44 @@ local modul = {
|
||||||
}
|
}
|
||||||
local db
|
local db
|
||||||
local desc = format('%sCount', modulname)
|
local desc = format('%sCount', modulname)
|
||||||
|
local GetContainerItemInfo = GetContainerItemInfo
|
||||||
|
if(C_Container and C_Container.GetContainerItemInfo) then
|
||||||
|
GetContainerItemInfo2 = C_Container.GetContainerItemInfo
|
||||||
|
else
|
||||||
|
GetContainerItemInfo2 = function(bag, slot)
|
||||||
|
local icon, itemCount, locked, quality, readable, lootable, itemLink, isFiltered, noValue, itemID, isBound = GetContainerItemInfo(bag, slot)
|
||||||
|
if(icon) then
|
||||||
|
return {
|
||||||
|
['iconFileID'] = icon,
|
||||||
|
['stackCount'] = itemCount,
|
||||||
|
['isLocked'] = locked,
|
||||||
|
['quality'] = quality,
|
||||||
|
['isReadable'] = readable,
|
||||||
|
['hasLoot'] = lootable,
|
||||||
|
['hyperlink'] = itemLink,
|
||||||
|
['isFiltered'] = isFiltered,
|
||||||
|
['hasNoValue'] = noValue,
|
||||||
|
['itemID'] = itemID,
|
||||||
|
['isBound'] = isBound
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function GetContainerNumSlots2(bag, slot)
|
||||||
|
if(C_Container and C_Container.GetContainerNumSlots) then
|
||||||
|
return C_Container.GetContainerNumSlots(bag, slot)
|
||||||
|
end
|
||||||
|
return GetContainerNumSlots(bag, slot)
|
||||||
|
end
|
||||||
function child:scanBag(bag)
|
function child:scanBag(bag)
|
||||||
local slot = 1
|
local slot = 1
|
||||||
local itemlist = {}
|
local itemlist = {}
|
||||||
local empty = true
|
local empty = true
|
||||||
while(slot<=C_Container.GetContainerNumSlots(bag)) do
|
while(slot<=GetContainerNumSlots2(bag)) do
|
||||||
local item = Item:CreateFromBagAndSlot(bag, slot)
|
local item = Item:CreateFromBagAndSlot(bag, slot)
|
||||||
if(item) then
|
if(item) then
|
||||||
local itemInfo = C_Container.GetContainerItemInfo(bag, slot)
|
local itemInfo = GetContainerItemInfo2(bag, slot)
|
||||||
local id = item:GetItemID()
|
local id = item:GetItemID()
|
||||||
if(itemInfo and id) then
|
if(itemInfo and id) then
|
||||||
empty = false
|
empty = false
|
||||||
|
@ -30,16 +60,25 @@ function child:scanBag(bag)
|
||||||
end
|
end
|
||||||
return empty and nil or itemlist
|
return empty and nil or itemlist
|
||||||
end
|
end
|
||||||
|
local startbag, endbag
|
||||||
|
if(Enum and Enum.BagIndex) then
|
||||||
|
startbag = Enum.BagIndex.Backpack
|
||||||
|
endbag = Enum.BagIndex.ReagentBag
|
||||||
|
else
|
||||||
|
startbag = BACKPACK_CONTAINER
|
||||||
|
endbag = NUM_BAG_SLOTS
|
||||||
|
end
|
||||||
local function scanAllBags(delayed)
|
local function scanAllBags(delayed)
|
||||||
if(not child:funcSync(scanAllBags, delayed)) then return end
|
if(not child:funcSync(scanAllBags, delayed)) then return end
|
||||||
local playerID = child.getPID()
|
local playerID = child.getPID()
|
||||||
if(playerID) then
|
if(playerID) then
|
||||||
local tab = modul['db'][playerID]
|
local tab = modul['db'][playerID]
|
||||||
for bag=Enum.BagIndex.Backpack ,Enum.BagIndex.ReagentBag do
|
print()
|
||||||
|
for bag=startbag ,endbag do
|
||||||
tab[bag] = child:scanBag(bag) -- loop all bought bags
|
tab[bag] = child:scanBag(bag) -- loop all bought bags
|
||||||
end
|
end
|
||||||
for k,v in pairs(modul['db'][playerID]) do
|
for k,v in pairs(modul['db'][playerID]) do
|
||||||
if(k<Enum.BagIndex.Backpack or k>Enum.BagIndex.ReagentBag) then
|
if(k < startbag or k > endbag) then
|
||||||
tab[k] = nil -- prevent bogus bags
|
tab[k] = nil -- prevent bogus bags
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,20 @@ local db
|
||||||
local desc = format('%sCount', modulname)
|
local desc = format('%sCount', modulname)
|
||||||
local desc2 = 'reagentCount'
|
local desc2 = 'reagentCount'
|
||||||
local BankIsOpen = false
|
local BankIsOpen = false
|
||||||
|
local startbag, endbag, bankbag, reagentbankbag = 0, 4, -1, -3
|
||||||
|
if(Enum and Enum.BagIndex) then
|
||||||
|
startbag = Enum.BagIndex.Backpack
|
||||||
|
endbag = Enum.BagIndex.ReagentBag
|
||||||
|
bankbag = Enum.BagIndex.Bank
|
||||||
|
reagentbankbag = Enum.BagIndex.Reagentbank
|
||||||
|
reagentbag = Enum.BagIndex.ReagentBag
|
||||||
|
else
|
||||||
|
startbag = 6
|
||||||
|
endbag = startbag + GetNumBankSlots()
|
||||||
|
bankbag = BANK_CONTAINER
|
||||||
|
reagentbankbag = -3
|
||||||
|
reagentbag = BACKPACK_CONTAINER + NUM_BAG_SLOTS + 1
|
||||||
|
end
|
||||||
function modul.Guess(id)
|
function modul.Guess(id)
|
||||||
local dbcount = modul.Get(id)
|
local dbcount = modul.Get(id)
|
||||||
local count = GetItemCount(id,true)
|
local count = GetItemCount(id,true)
|
||||||
|
@ -20,7 +34,7 @@ function modul.Guess(id)
|
||||||
local dif = dbcount - count
|
local dif = dbcount - count
|
||||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||||
local tab = modul['db'][playerID]
|
local tab = modul['db'][playerID]
|
||||||
for bag = Enum.BagIndex.BankBag_1 ,Enum.BagIndex.BankBag_1 + GetNumBankSlots() - 1 do
|
for bag = startbag ,endbag - 1 do
|
||||||
local btab = tab[bag]
|
local btab = tab[bag]
|
||||||
if(btab and btab[id] and btab[id]['count'] > 0) then
|
if(btab and btab[id] and btab[id]['count'] > 0) then
|
||||||
while(dif > 0 and btab[id]['count'] > 0) do
|
while(dif > 0 and btab[id]['count'] > 0) do
|
||||||
|
@ -54,7 +68,7 @@ local function scanAllBankBags(delayed)
|
||||||
if(playerID) then
|
if(playerID) then
|
||||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||||
local tab = modul['db'][playerID]
|
local tab = modul['db'][playerID]
|
||||||
for bag = Enum.BagIndex.BankBag_1 ,Enum.BagIndex.BankBag_1 + GetNumBankSlots() - 1 do
|
for bag = startbag ,endbag - 1 do
|
||||||
tab[bag] = tab[bag] or {}
|
tab[bag] = tab[bag] or {}
|
||||||
if(BankIsOpen) then
|
if(BankIsOpen) then
|
||||||
tab[bag] = child:scanBag(bag) -- loop all bought bankbags
|
tab[bag] = child:scanBag(bag) -- loop all bought bankbags
|
||||||
|
@ -63,17 +77,17 @@ local function scanAllBankBags(delayed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(BankIsOpen) then
|
if(BankIsOpen) then
|
||||||
tab[Enum.BagIndex.Bank] = child:scanBag(Enum.BagIndex.Bank) -- Main bankbag
|
tab[bankbag] = child:scanBag(bankbag) -- Main bankbag
|
||||||
else
|
else
|
||||||
guess(tab[Enum.BagIndex.Bank])
|
guess(tab[bankbag])
|
||||||
end
|
end
|
||||||
if(BankIsOpen) then
|
if(BankIsOpen) then
|
||||||
tab[Enum.BagIndex.Reagentbank] = child:scanBag(Enum.BagIndex.Reagentbank) -- Main reagentbag
|
tab[reagentbankbag] = child:scanBag(reagentbankbag) -- Main reagentbag
|
||||||
else
|
else
|
||||||
guess(tab[Enum.BagIndex.Reagentbank])
|
guess(tab[reagentbankbag])
|
||||||
end
|
end
|
||||||
for k,v in pairs(modul['db'][playerID]) do
|
for k,v in pairs(modul['db'][playerID]) do
|
||||||
if(not(k == Enum.BagIndex.Bank) and not(k == Enum.BagIndex.Reagentbank) and not(k > Enum.BagIndex.ReagentBag and k <= GetNumBankSlots() + Enum.BagIndex.ReagentBag)) then
|
if(not(k == bankbag) and not(k == reagentbankbag) and not(k > reagentbag and k <= GetNumBankSlots() + reagentbag)) then
|
||||||
tab[k] = nil -- prevent bogus bankbags
|
tab[k] = nil -- prevent bogus bankbags
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -89,7 +103,7 @@ local function bagLoop(id, res)
|
||||||
if(playerID and units[k]['faction'] == units[playerID]['faction']) then
|
if(playerID and units[k]['faction'] == units[playerID]['faction']) then
|
||||||
local unitname = units[k]['name']
|
local unitname = units[k]['name']
|
||||||
for bag, list in pairs(v) do
|
for bag, list in pairs(v) do
|
||||||
dName = (bag == Enum.BagIndex.Reagentbank) and desc2 or desc
|
dName = (bag == reagentbankbag) and desc2 or desc
|
||||||
for a, b in pairs(list) do
|
for a, b in pairs(list) do
|
||||||
if(a == id) then
|
if(a == id) then
|
||||||
res[unitname] = res[unitname] or {
|
res[unitname] = res[unitname] or {
|
||||||
|
@ -124,18 +138,20 @@ function modul.Get(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- function events:BANKFRAME_OPENED()
|
function events:BANKFRAME_OPENED()
|
||||||
-- BankIsOpen = true
|
BankIsOpen = true
|
||||||
-- scanAllBankBags()
|
scanAllBankBags()
|
||||||
-- end
|
end
|
||||||
-- function events:BANKFRAME_CLOSED()
|
function events:BANKFRAME_CLOSED()
|
||||||
-- BankIsOpen = false
|
BankIsOpen = false
|
||||||
-- end
|
end
|
||||||
function events:PLAYERBANKBAGSLOTS_CHANGED(...)
|
function events:PLAYERBANKBAGSLOTS_CHANGED(...)
|
||||||
scanAllBankBags()
|
scanAllBankBags()
|
||||||
end
|
end
|
||||||
events.PLAYERBANKSLOTS_CHANGED = events.PLAYERBANKBAGSLOTS_CHANGED
|
events.PLAYERBANKSLOTS_CHANGED = events.PLAYERBANKBAGSLOTS_CHANGED
|
||||||
events.PLAYERREAGENTBANKSLOTS_CHANGED = events.PLAYERBANKBAGSLOTS_CHANGED
|
if(BuyReagentBank) then
|
||||||
|
events.PLAYERREAGENTBANKSLOTS_CHANGED = events.PLAYERBANKBAGSLOTS_CHANGED
|
||||||
|
end
|
||||||
events.ITEM_UNLOCKED = events.PLAYERBANKBAGSLOTS_CHANGED
|
events.ITEM_UNLOCKED = events.PLAYERBANKBAGSLOTS_CHANGED
|
||||||
events.BAG_UPDATE_DELAYED = events.PLAYERBANKBAGSLOTS_CHANGED
|
events.BAG_UPDATE_DELAYED = events.PLAYERBANKBAGSLOTS_CHANGED
|
||||||
local function OnEvent(self, event, ...)
|
local function OnEvent(self, event, ...)
|
||||||
|
@ -172,12 +188,11 @@ function modul:Delete(id, typ)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local skip = {}
|
local skip = {}
|
||||||
local function MFOpen()
|
if(WOW_PROJECT_MAINLINE) then
|
||||||
BankIsOpen = true
|
skip[WOW_PROJECT_MAINLINE] = {
|
||||||
scanAllBankBags()
|
['BANKFRAME_OPENED'] = true,
|
||||||
end
|
['BANKFRAME_CLOSED'] = true
|
||||||
local function MFClose()
|
}
|
||||||
BankIsOpen = false
|
|
||||||
end
|
end
|
||||||
function modul:Enable()
|
function modul:Enable()
|
||||||
self['status'] = true
|
self['status'] = true
|
||||||
|
@ -191,8 +206,10 @@ function modul:Enable()
|
||||||
self['frame']:RegisterEvent(list[i])
|
self['frame']:RegisterEvent(list[i])
|
||||||
end
|
end
|
||||||
self['frame']:SetScript("OnEvent", OnEvent)
|
self['frame']:SetScript("OnEvent", OnEvent)
|
||||||
child:RegisterOpen(8, MFOpen)
|
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||||
child:RegisterClose(8, MFClose)
|
child:RegisterOpen(8, events.BANKFRAME_OPENED)
|
||||||
|
child:RegisterClose(8, events.BANKFRAME_CLOSED)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function modul:Disable()
|
function modul:Disable()
|
||||||
self['status'] = false
|
self['status'] = false
|
||||||
|
|
|
@ -126,6 +126,7 @@ function modul:Enable()
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
self['frame']:RegisterEvent(list[i])
|
self['frame']:RegisterEvent(list[i])
|
||||||
end
|
end
|
||||||
|
self['frame']:SetScript("OnEvent", OnEvent)
|
||||||
OnEvent(child, "PLAYER_EQUIPMENT_CHANGED")
|
OnEvent(child, "PLAYER_EQUIPMENT_CHANGED")
|
||||||
end
|
end
|
||||||
function modul:Disable()
|
function modul:Disable()
|
||||||
|
@ -133,6 +134,7 @@ function modul:Disable()
|
||||||
for event, func in pairs(events) do
|
for event, func in pairs(events) do
|
||||||
self['frame']:UnregisterEvent(event)
|
self['frame']:UnregisterEvent(event)
|
||||||
end
|
end
|
||||||
|
self['frame']:SetScript("OnEvent", nil)
|
||||||
end
|
end
|
||||||
local init = {
|
local init = {
|
||||||
Setup = function(self)
|
Setup = function(self)
|
||||||
|
|
|
@ -172,11 +172,6 @@ local skip = {
|
||||||
['CURRENCY_DISPLAY_UPDATE'] = true
|
['CURRENCY_DISPLAY_UPDATE'] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then
|
|
||||||
skip[WOW_PROJECT_BURNING_CRUSADE_CLASSIC] = {
|
|
||||||
['PLAYERREAGENTBANKSLOTS_CHANGED'] = true
|
|
||||||
}
|
|
||||||
end
|
|
||||||
function modul:Enable()
|
function modul:Enable()
|
||||||
if(child:IsRetail()) then
|
if(child:IsRetail()) then
|
||||||
self.status = true
|
self.status = true
|
||||||
|
@ -206,8 +201,9 @@ function modul:Disable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
child:IgnoreClassic(modulname)
|
if(not LE_EXPANSION_WRATH_OF_THE_LICH_KING or LE_EXPANSION_LEVEL_CURRENT<LE_EXPANSION_WRATH_OF_THE_LICH_KING or not _G['GetCurrencyListInfo']) then
|
||||||
child:IgnoreBCC(modulname)
|
child:addIgnore(WOW_PROJECT_ID, modulname)
|
||||||
|
end
|
||||||
local init = {
|
local init = {
|
||||||
Setup = function(self)
|
Setup = function(self)
|
||||||
modul.db, modul.status = child:RegisterModul(modul, modulname)
|
modul.db, modul.status = child:RegisterModul(modul, modulname)
|
||||||
|
|
|
@ -130,12 +130,12 @@ function events:GUILDBANKBAGSLOTS_CHANGED()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- function events:GUILDBANKFRAME_CLOSED()
|
function events:GUILDBANKFRAME_CLOSED()
|
||||||
-- GuildBankIsOpen = false
|
GuildBankIsOpen = false
|
||||||
-- end
|
end
|
||||||
-- function events:GUILDBANKFRAME_OPENED()
|
function events:GUILDBANKFRAME_OPENED()
|
||||||
-- GuildBankIsOpen = true
|
GuildBankIsOpen = true
|
||||||
-- end
|
end
|
||||||
local function OnEvent(self, event, ...)
|
local function OnEvent(self, event, ...)
|
||||||
local guildID = child.getGID()
|
local guildID = child.getGID()
|
||||||
if(guildID and type(events[event])=='function') then
|
if(guildID and type(events[event])=='function') then
|
||||||
|
@ -183,6 +183,12 @@ end
|
||||||
local function MFClose()
|
local function MFClose()
|
||||||
GuildBankIsOpen = false
|
GuildBankIsOpen = false
|
||||||
end
|
end
|
||||||
|
local skip = {
|
||||||
|
[WOW_PROJECT_MAINLINE] = {
|
||||||
|
['GUILDBANKFRAME_OPENED'] = true,
|
||||||
|
['GUILDBANKFRAME_CLOSED'] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
function modul:Enable()
|
function modul:Enable()
|
||||||
self.status = true
|
self.status = true
|
||||||
local list = {}
|
local list = {}
|
||||||
|
@ -194,11 +200,15 @@ function modul:Enable()
|
||||||
lgbc.RegisterCallback(self, "GuildBankComm_PageUpdate", "OnPageSync")
|
lgbc.RegisterCallback(self, "GuildBankComm_PageUpdate", "OnPageSync")
|
||||||
end
|
end
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
self['frame']:RegisterEvent(list[i])
|
if(not skip[WOW_PROJECT_ID] or not skip[WOW_PROJECT_ID][event]) then
|
||||||
|
self['frame']:RegisterEvent(list[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self['frame']:SetScript("OnEvent", OnEvent)
|
self['frame']:SetScript("OnEvent", OnEvent)
|
||||||
child:RegisterOpen(10, MFOpen)
|
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||||
child:RegisterClose(10, MFClose)
|
child:RegisterOpen(10, MFOpen)
|
||||||
|
child:RegisterClose(10, MFClose)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function modul:Disable()
|
function modul:Disable()
|
||||||
self.status = false
|
self.status = false
|
||||||
|
@ -211,6 +221,9 @@ function modul:Disable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if(LE_EXPANSION_LEVEL_CURRENT<LE_EXPANSION_BURNING_CRUSADE or not GetGuildBankItemInfo) then
|
||||||
|
child:addIgnore(WOW_PROJECT_ID, modulname)
|
||||||
|
end
|
||||||
local init = {
|
local init = {
|
||||||
Setup = function(self)
|
Setup = function(self)
|
||||||
db = child['db']
|
db = child['db']
|
||||||
|
|
|
@ -10,34 +10,16 @@ local modul = {
|
||||||
local desc = format('%sCount', modulname)
|
local desc = format('%sCount', modulname)
|
||||||
local mailOpen = false
|
local mailOpen = false
|
||||||
local db
|
local db
|
||||||
--[[CLOSE_INBOX_ITEM: mailIndex
|
|
||||||
MAIL_CLOSED
|
|
||||||
MAIL_FAILED: itemID
|
|
||||||
MAIL_INBOX_UPDATE
|
|
||||||
MAIL_LOCK_SEND_ITEMS: attachSlot, itemLink
|
|
||||||
MAIL_SEND_INFO_UPDATE
|
|
||||||
MAIL_SEND_SUCCESS
|
|
||||||
MAIL_SHOW
|
|
||||||
MAIL_SUCCESS: itemID
|
|
||||||
MAIL_UNLOCK_SEND_ITEMS
|
|
||||||
SEND_MAIL_COD_CHANGED
|
|
||||||
SEND_MAIL_MONEY_CHANGED
|
|
||||||
UPDATE_PENDING_MAIL
|
|
||||||
]]
|
|
||||||
local function scan()
|
local function scan()
|
||||||
if(not mailOpen) then return end
|
if(not mailOpen) then return end
|
||||||
local numItems, totalItems = GetInboxNumItems()
|
local numItems, totalItems = GetInboxNumItems()
|
||||||
-- print("Found",numItems, totalItems)
|
|
||||||
local playerID = child.getPID()
|
local playerID = child.getPID()
|
||||||
local db = modul['db'][playerID]
|
local db = modul['db'][playerID]
|
||||||
db[1] = {}
|
db[1] = {}
|
||||||
for index = 1, numItems do
|
for index = 1, numItems do
|
||||||
local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned,
|
local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned,
|
||||||
textCreated, canReply, isGM = GetInboxHeaderInfo(index)
|
textCreated, canReply, isGM = GetInboxHeaderInfo(index)
|
||||||
-- print("Index", index, hasItem)
|
|
||||||
if(hasItem) then
|
if(hasItem) then
|
||||||
|
|
||||||
-- print("Mail has item", index)
|
|
||||||
for itemIndex = 1, ATTACHMENTS_MAX_RECEIVE do
|
for itemIndex = 1, ATTACHMENTS_MAX_RECEIVE do
|
||||||
local name, itemID, texture, count, quality, canUse = GetInboxItem(index, itemIndex)
|
local name, itemID, texture, count, quality, canUse = GetInboxItem(index, itemIndex)
|
||||||
if(name) then
|
if(name) then
|
||||||
|
@ -51,48 +33,19 @@ local function scan()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function events:MAIL_INBOX_UPDATE()
|
function events:MAIL_INBOX_UPDATE()
|
||||||
-- print("MIU")
|
|
||||||
scan()
|
scan()
|
||||||
end
|
end
|
||||||
function events:MAIL_FAILED()
|
function events:MAIL_SHOW()
|
||||||
-- print('failed')
|
mailOpen = true
|
||||||
end
|
end
|
||||||
-- function events:MAIL_CLOSED()
|
function events:MAIL_CLOSED()
|
||||||
-- -- print('closed')
|
mailOpen = false
|
||||||
-- mailOpen = false
|
|
||||||
-- end
|
|
||||||
function events:MAIL_SEND_SUCCESS()
|
|
||||||
-- print("mail_send_success")
|
|
||||||
end
|
end
|
||||||
function events:MAIL_SUCCESS(event, itemID) --fires along with MAIL_SEND_SUCCESS, itemID always nil, fires when deleting mail
|
function events:MAIL_SUCCESS(event, itemID) --fires along with MAIL_SEND_SUCCESS, itemID always nil, fires when deleting mail
|
||||||
scan()
|
scan()
|
||||||
end
|
end
|
||||||
function events:MAIL_SEND_INFO_UPDATE() -- item changed
|
|
||||||
-- print("update")
|
|
||||||
for index = 1, ATTACHMENTS_MAX_SEND do
|
|
||||||
local name, itemID, texture, count, quality = GetSendMailItem(index)
|
|
||||||
if name then
|
|
||||||
-- print("You are sending", name, "x", count)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
--[[function events:SEND_MAIL_COD_CHANGED() -- price added
|
|
||||||
print("cod changed")
|
|
||||||
end]]
|
|
||||||
function events:MAIL_LOCK_SEND_ITEMS(event, attachSlot, itemLink)
|
|
||||||
-- print(event, attachSlot, itemLink)
|
|
||||||
end
|
|
||||||
function events:UPDATE_PENDING_MAIL()
|
|
||||||
-- print("Update pending mail")
|
|
||||||
end
|
|
||||||
-- function events:MAIL_SHOW()
|
|
||||||
-- -- print("Mail show")
|
|
||||||
-- mailOpen = true
|
|
||||||
-- end
|
|
||||||
local function OnEvent(self, event, ...)
|
local function OnEvent(self, event, ...)
|
||||||
local playerID = child.getPID()
|
local playerID = child.getPID()
|
||||||
-- print(modulname, event, ...)
|
|
||||||
if(playerID and type(events[event])=='function') then
|
if(playerID and type(events[event])=='function') then
|
||||||
modul['db'] = child:GetNamespace(modul.name)
|
modul['db'] = child:GetNamespace(modul.name)
|
||||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||||
|
@ -149,6 +102,12 @@ end
|
||||||
local function MFClose()
|
local function MFClose()
|
||||||
mailOpen = false
|
mailOpen = false
|
||||||
end
|
end
|
||||||
|
local skip = {
|
||||||
|
[WOW_PROJECT_MAINLINE] = {
|
||||||
|
['MAIL_SHOW'] = true,
|
||||||
|
['MAIL_CLOSED'] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
function modul:Enable()
|
function modul:Enable()
|
||||||
self['status'] = true
|
self['status'] = true
|
||||||
local list = {}
|
local list = {}
|
||||||
|
@ -156,11 +115,15 @@ function modul:Enable()
|
||||||
list[#list+1] = event
|
list[#list+1] = event
|
||||||
end
|
end
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
self['frame']:RegisterEvent(list[i])
|
if(not skip[WOW_PROJECT_ID] or not skip[WOW_PROJECT_ID][event]) then
|
||||||
|
self['frame']:RegisterEvent(list[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self['frame']:SetScript("OnEvent", OnEvent)
|
self['frame']:SetScript("OnEvent", OnEvent)
|
||||||
child:RegisterOpen(17, MFOpen)
|
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||||
child:RegisterClose(17, MFClose)
|
child:RegisterOpen(17, MFOpen)
|
||||||
|
child:RegisterClose(17, MFClose)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function modul:Disable()
|
function modul:Disable()
|
||||||
self['status'] = false
|
self['status'] = false
|
||||||
|
|
|
@ -79,13 +79,13 @@ function modul.Output(input, sum, b)
|
||||||
end
|
end
|
||||||
return input, sum
|
return input, sum
|
||||||
end
|
end
|
||||||
-- function events:VOID_STORAGE_CLOSE()
|
function events:VOID_STORAGE_CLOSE()
|
||||||
-- voidOpen = false
|
voidOpen = false
|
||||||
-- end
|
end
|
||||||
-- function events:VOID_STORAGE_OPEN()
|
function events:VOID_STORAGE_OPEN()
|
||||||
-- voidOpen = true
|
voidOpen = true
|
||||||
-- scanVoid()
|
scanVoid()
|
||||||
-- end
|
end
|
||||||
events.VOID_STORAGE_CONTENTS_UPDATE = scanVoid
|
events.VOID_STORAGE_CONTENTS_UPDATE = scanVoid
|
||||||
events.VOID_STORAGE_DEPOSIT_UPDATE = scanVoid
|
events.VOID_STORAGE_DEPOSIT_UPDATE = scanVoid
|
||||||
events.ITEM_UNLOCKED = scanVoid
|
events.ITEM_UNLOCKED = scanVoid
|
||||||
|
@ -111,6 +111,19 @@ end
|
||||||
local function MFClose()
|
local function MFClose()
|
||||||
voidOpen = false
|
voidOpen = false
|
||||||
end
|
end
|
||||||
|
local skip = {}
|
||||||
|
if(WOW_PROJECT_MAINLINE) then
|
||||||
|
skip[WOW_PROJECT_MAINLINE] = {
|
||||||
|
['VOID_STORAGE_CLOSE'] = true,
|
||||||
|
['VOID_STORAGE_OPEN'] = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if(WOW_PROJECT_WRATH_CLASSIC) then
|
||||||
|
skip[WOW_PROJECT_WRATH_CLASSIC] = {
|
||||||
|
['VOID_STORAGE_CLOSE'] = true,
|
||||||
|
['VOID_STORAGE_OPEN'] = true
|
||||||
|
}
|
||||||
|
end
|
||||||
function modul:Enable()
|
function modul:Enable()
|
||||||
self['status'] = true
|
self['status'] = true
|
||||||
local list = {}
|
local list = {}
|
||||||
|
@ -118,11 +131,15 @@ function modul:Enable()
|
||||||
list[#list+1] = event
|
list[#list+1] = event
|
||||||
end
|
end
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
self['frame']:RegisterEvent(list[i])
|
if(not skip[WOW_PROJECT_ID] or not skip[WOW_PROJECT_ID][list[i]]) then
|
||||||
|
self['frame']:RegisterEvent(list[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self['frame']:SetScript("OnEvent", OnEvent)
|
self['frame']:SetScript("OnEvent", OnEvent)
|
||||||
child:RegisterOpen(26, MFOpen)
|
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
|
||||||
child:RegisterClose(26, MFClose)
|
child:RegisterOpen(26, MFOpen)
|
||||||
|
child:RegisterClose(26, MFClose)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function modul:Disable()
|
function modul:Disable()
|
||||||
self['status'] = false
|
self['status'] = false
|
||||||
|
@ -130,8 +147,9 @@ function modul:Disable()
|
||||||
self['frame']:UnregisterEvent(event)
|
self['frame']:UnregisterEvent(event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
child:IgnoreClassic(modulname)
|
if(not LE_EXPANSION_CATACLYSM or LE_EXPANSION_LEVEL_CURRENT<LE_EXPANSION_CATACLYSM or not _G['GetVoidItemInfo']) then
|
||||||
child:IgnoreBCC(modulname)
|
child:addIgnore(WOW_PROJECT_ID, modulname)
|
||||||
|
end
|
||||||
local init = {
|
local init = {
|
||||||
Setup = function(self)
|
Setup = function(self)
|
||||||
db = child['db']
|
db = child['db']
|
||||||
|
|
15
moduls.lua
15
moduls.lua
|
@ -7,9 +7,6 @@ local db
|
||||||
local skip = {
|
local skip = {
|
||||||
[WOW_PROJECT_CLASSIC] = {}
|
[WOW_PROJECT_CLASSIC] = {}
|
||||||
}
|
}
|
||||||
if(WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then
|
|
||||||
skip[WOW_PROJECT_BURNING_CRUSADE_CLASSIC] = {}
|
|
||||||
end
|
|
||||||
function child:GetModul(modName)
|
function child:GetModul(modName)
|
||||||
for k,modul in pairs(moduls) do
|
for k,modul in pairs(moduls) do
|
||||||
if(modul.name==modName) then
|
if(modul.name==modName) then
|
||||||
|
@ -17,12 +14,12 @@ function child:GetModul(modName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function child:IgnoreClassic(ign)
|
function child:addIgnore(pid, ign)
|
||||||
skip[WOW_PROJECT_CLASSIC][ign] = true
|
if(pid) then
|
||||||
end
|
if(ign) then
|
||||||
function child:IgnoreBCC(ign)
|
skip[pid] = skip[pid] or {}
|
||||||
if(WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then
|
skip[pid][ign] = true
|
||||||
skip[WOW_PROJECT_BURNING_CRUSADE_CLASSIC][ign] = true
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function child:RegisterModul(modul, namespace)
|
function child:RegisterModul(modul, namespace)
|
||||||
|
|
50
tooltip.lua
50
tooltip.lua
|
@ -75,36 +75,36 @@ local function GameTooltip_OnTooltipSetItem(tooltip)
|
||||||
tooltip:Show()
|
tooltip:Show()
|
||||||
end
|
end
|
||||||
local function GameTooltip_OnTooltipSetItem2(tooltip, tooltipData)
|
local function GameTooltip_OnTooltipSetItem2(tooltip, tooltipData)
|
||||||
-- local tooltipData = tooltip:GetTooltipData()
|
-- local tooltipData = tooltip:GetTooltipData()
|
||||||
if(tooltipData and tooltipData.id and tooltipData.type == 0) then -- type -> 0 = item, 1 = spell
|
if(tooltipData and tooltipData.id and tooltipData.type == 0) then -- type -> 0 = item, 1 = spell
|
||||||
curItem = tooltipData.id
|
curItem = tooltipData.id
|
||||||
tooltip.zzInfo = true
|
tooltip.zzInfo = true
|
||||||
child:setTT(curItem,tooltip)
|
child:setTT(curItem,tooltip)
|
||||||
tooltip:AddLine()
|
tooltip:AddLine()
|
||||||
for name,b in pairs(child:Search(curItem)) do
|
for name,b in pairs(child:Search(curItem)) do
|
||||||
local dname, drealm = strsplit(" - ",name)
|
local dname, drealm = strsplit(" - ",name)
|
||||||
local input,sum = child:output(b)
|
local input,sum = child:output(b)
|
||||||
if(sum>0) then
|
if(sum>0) then
|
||||||
tooltip:AddLine(format(L['tooltip_main_string'],child:getIcon(curItem),dname,sum,child:colorize(table.concat(input,', '),"ffffff")))
|
tooltip:AddLine(format(L['tooltip_main_string'],child:getIcon(curItem),dname,sum,child:colorize(table.concat(input,', '),"ffffff")))
|
||||||
end
|
|
||||||
input = nil
|
|
||||||
end
|
end
|
||||||
child:specialoutput(tooltip, curItem)
|
input = nil
|
||||||
if(db['showID']) then
|
|
||||||
tooltip:AddLine(format(L['tooltip_id_string'],curItem))
|
|
||||||
end
|
|
||||||
GameTooltip_CalculatePadding(tooltip)
|
|
||||||
-- tooltip:Show()
|
|
||||||
elseif(tooltipData) then
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
child:specialoutput(tooltip, curItem)
|
||||||
|
if(db['showID']) then
|
||||||
|
tooltip:AddLine(format(L['tooltip_id_string'],curItem))
|
||||||
|
end
|
||||||
|
GameTooltip_CalculatePadding(tooltip)
|
||||||
|
-- tooltip:Show()
|
||||||
|
elseif(tooltipData) then
|
||||||
|
|
||||||
end
|
end
|
||||||
if(GameTooltip.OnTooltipSetItem) then
|
end
|
||||||
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem
|
if(TooltipDataProcessor) then
|
||||||
GameTooltip:HookScript("OnTooltipSetItem", GameTooltip_OnTooltipSetItem)
|
|
||||||
else
|
|
||||||
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem2
|
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem2
|
||||||
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, GameTooltip_OnTooltipSetItem2)
|
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, GameTooltip_OnTooltipSetItem2)
|
||||||
|
else
|
||||||
|
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem
|
||||||
|
GameTooltip:HookScript("OnTooltipSetItem", GameTooltip_OnTooltipSetItem)
|
||||||
end
|
end
|
||||||
function events:TRADE_SKILL_LIST_UPDATE(event)
|
function events:TRADE_SKILL_LIST_UPDATE(event)
|
||||||
child:updateTT()
|
child:updateTT()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## Interface: 100002
|
## Interface: 100005
|
||||||
## Title: itemsdb
|
## Title: itemsdb
|
||||||
## X-Curse-Project-ID: 290291
|
## X-Curse-Project-ID: 290291
|
||||||
## X-WoWI-ID: 24579
|
## X-WoWI-ID: 24579
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
## Interface: 11403
|
||||||
|
## Title: itemsdb
|
||||||
|
## X-Curse-Project-ID: 290291
|
||||||
|
## X-WoWI-ID: 24579
|
||||||
|
## X-Repository: https://git.grml.de/rilgamon/zz_itemsdb.git
|
||||||
|
## OptionalDeps: zzLib, Ace3, BrokerPack
|
||||||
|
## SavedVariables: zz_itemsdbDB
|
||||||
|
Libs\embeds.xml
|
||||||
|
pack.xml
|
|
@ -0,0 +1,9 @@
|
||||||
|
## Interface: 30401
|
||||||
|
## Title: itemsdb
|
||||||
|
## X-Curse-Project-ID: 290291
|
||||||
|
## X-WoWI-ID: 24579
|
||||||
|
## X-Repository: https://git.grml.de/rilgamon/zz_itemsdb.git
|
||||||
|
## OptionalDeps: zzLib, Ace3, BrokerPack
|
||||||
|
## SavedVariables: zz_itemsdbDB
|
||||||
|
Libs\embeds.xml
|
||||||
|
pack.xml
|
Loading…
Reference in New Issue