Restore Wrath compatibility

This commit is contained in:
Robin Hüskes 2023-01-22 07:54:12 +01:00
parent 42fdfd738f
commit ef759c0ed1
7 changed files with 120 additions and 133 deletions

View File

@ -124,13 +124,13 @@ function modul.Get(id)
end
-- function events:BANKFRAME_OPENED()
-- BankIsOpen = true
-- scanAllBankBags()
-- end
-- function events:BANKFRAME_CLOSED()
-- BankIsOpen = false
-- end
function events:BANKFRAME_OPENED()
BankIsOpen = true
scanAllBankBags()
end
function events:BANKFRAME_CLOSED()
BankIsOpen = false
end
function events:PLAYERBANKBAGSLOTS_CHANGED(...)
scanAllBankBags()
end
@ -171,14 +171,15 @@ function modul:Delete(id, typ)
self['db'][id] = nil
end
end
local skip = {}
local function MFOpen()
BankIsOpen = true
scanAllBankBags()
end
local function MFClose()
BankIsOpen = false
end
local skip = {
[WOW_PROJECT_WRATH_CLASSIC] = {
['PLAYERREAGENTBANKSLOTS_CHANGED'] = true
},
[WOW_PROJECT_MAINLINE] = {
['BANKFRAME_OPENED'] = true,
['BANKFRAME_CLOSED'] = true
}
}
function modul:Enable()
self['status'] = true
local list = {}
@ -191,8 +192,10 @@ function modul:Enable()
self['frame']:RegisterEvent(list[i])
end
self['frame']:SetScript("OnEvent", OnEvent)
child:RegisterOpen(8, MFOpen)
child:RegisterClose(8, MFClose)
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
child:RegisterOpen(8, events.BANKFRAME_OPENED)
child:RegisterClose(8, events.BANKFRAME_CLOSED)
end
end
function modul:Disable()
self['status'] = false

View File

@ -172,11 +172,6 @@ local skip = {
['CURRENCY_DISPLAY_UPDATE'] = true
}
}
if(WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then
skip[WOW_PROJECT_BURNING_CRUSADE_CLASSIC] = {
['PLAYERREAGENTBANKSLOTS_CHANGED'] = true
}
end
function modul:Enable()
if(child:IsRetail()) then
self.status = true
@ -206,8 +201,9 @@ function modul:Disable()
end
end
end
child:IgnoreClassic(modulname)
child:IgnoreBCC(modulname)
if(LE_EXPANSION_LEVEL_CURRENT<LE_EXPANSION_WRATH_OF_THE_LICH_KING or not _G['GetCurrencyListInfo']) then
child:addIgnore(WOW_PROJECT_ID, modulname)
end
local init = {
Setup = function(self)
modul.db, modul.status = child:RegisterModul(modul, modulname)

View File

@ -130,12 +130,12 @@ function events:GUILDBANKBAGSLOTS_CHANGED()
end
end
end
-- function events:GUILDBANKFRAME_CLOSED()
-- GuildBankIsOpen = false
-- end
-- function events:GUILDBANKFRAME_OPENED()
-- GuildBankIsOpen = true
-- end
function events:GUILDBANKFRAME_CLOSED()
GuildBankIsOpen = false
end
function events:GUILDBANKFRAME_OPENED()
GuildBankIsOpen = true
end
local function OnEvent(self, event, ...)
local guildID = child.getGID()
if(guildID and type(events[event])=='function') then
@ -183,6 +183,12 @@ end
local function MFClose()
GuildBankIsOpen = false
end
local skip = {
[WOW_PROJECT_MAINLINE] = {
['GUILDBANKFRAME_OPENED'] = true,
['GUILDBANKFRAME_CLOSED'] = true
}
}
function modul:Enable()
self.status = true
local list = {}
@ -194,11 +200,15 @@ function modul:Enable()
lgbc.RegisterCallback(self, "GuildBankComm_PageUpdate", "OnPageSync")
end
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
self['frame']:SetScript("OnEvent", OnEvent)
child:RegisterOpen(10, MFOpen)
child:RegisterClose(10, MFClose)
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
child:RegisterOpen(10, MFOpen)
child:RegisterClose(10, MFClose)
end
end
function modul:Disable()
self.status = false
@ -211,6 +221,9 @@ function modul:Disable()
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 = {
Setup = function(self)
db = child['db']

View File

@ -10,34 +10,16 @@ local modul = {
local desc = format('%sCount', modulname)
local mailOpen = false
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()
if(not mailOpen) then return end
local numItems, totalItems = GetInboxNumItems()
-- print("Found",numItems, totalItems)
local playerID = child.getPID()
local db = modul['db'][playerID]
db[1] = {}
for index = 1, numItems do
local packageIcon, stationeryIcon, sender, subject, money, CODAmount, daysLeft, hasItem, wasRead, wasReturned,
textCreated, canReply, isGM = GetInboxHeaderInfo(index)
-- print("Index", index, hasItem)
if(hasItem) then
-- print("Mail has item", index)
for itemIndex = 1, ATTACHMENTS_MAX_RECEIVE do
local name, itemID, texture, count, quality, canUse = GetInboxItem(index, itemIndex)
if(name) then
@ -51,48 +33,19 @@ local function scan()
end
end
function events:MAIL_INBOX_UPDATE()
-- print("MIU")
scan()
end
function events:MAIL_FAILED()
-- print('failed')
function events:MAIL_SHOW()
mailOpen = true
end
-- function events:MAIL_CLOSED()
-- -- print('closed')
-- mailOpen = false
-- end
function events:MAIL_SEND_SUCCESS()
-- print("mail_send_success")
function events:MAIL_CLOSED()
mailOpen = false
end
function events:MAIL_SUCCESS(event, itemID) --fires along with MAIL_SEND_SUCCESS, itemID always nil, fires when deleting mail
scan()
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 playerID = child.getPID()
-- print(modulname, event, ...)
if(playerID and type(events[event])=='function') then
modul['db'] = child:GetNamespace(modul.name)
modul['db'][playerID] = modul['db'][playerID] or {}
@ -149,6 +102,12 @@ end
local function MFClose()
mailOpen = false
end
local skip = {
[WOW_PROJECT_MAINLINE] = {
['MAIL_SHOW'] = true,
['MAIL_CLOSED'] = true
}
}
function modul:Enable()
self['status'] = true
local list = {}
@ -156,11 +115,15 @@ function modul:Enable()
list[#list+1] = event
end
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
self['frame']:SetScript("OnEvent", OnEvent)
child:RegisterOpen(17, MFOpen)
child:RegisterClose(17, MFClose)
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
child:RegisterOpen(17, MFOpen)
child:RegisterClose(17, MFClose)
end
end
function modul:Disable()
self['status'] = false

View File

@ -79,13 +79,13 @@ function modul.Output(input, sum, b)
end
return input, sum
end
-- function events:VOID_STORAGE_CLOSE()
-- voidOpen = false
-- end
-- function events:VOID_STORAGE_OPEN()
-- voidOpen = true
-- scanVoid()
-- end
function events:VOID_STORAGE_CLOSE()
voidOpen = false
end
function events:VOID_STORAGE_OPEN()
voidOpen = true
scanVoid()
end
events.VOID_STORAGE_CONTENTS_UPDATE = scanVoid
events.VOID_STORAGE_DEPOSIT_UPDATE = scanVoid
events.ITEM_UNLOCKED = scanVoid
@ -111,6 +111,16 @@ end
local function MFClose()
voidOpen = false
end
local skip = {
[WOW_PROJECT_MAINLINE] = {
['VOID_STORAGE_CLOSE'] = true,
['VOID_STORAGE_OPEN'] = true
},
[WOW_PROJECT_WRATH_CLASSIC] = {
['VOID_STORAGE_CLOSE'] = true,
['VOID_STORAGE_OPEN'] = true
}
}
function modul:Enable()
self['status'] = true
local list = {}
@ -118,11 +128,15 @@ function modul:Enable()
list[#list+1] = event
end
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
self['frame']:SetScript("OnEvent", OnEvent)
child:RegisterOpen(26, MFOpen)
child:RegisterClose(26, MFClose)
if(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
child:RegisterOpen(26, MFOpen)
child:RegisterClose(26, MFClose)
end
end
function modul:Disable()
self['status'] = false
@ -130,8 +144,9 @@ function modul:Disable()
self['frame']:UnregisterEvent(event)
end
end
child:IgnoreClassic(modulname)
child:IgnoreBCC(modulname)
if(LE_EXPANSION_LEVEL_CURRENT<LE_EXPANSION_CATACLYSM or not _G['GetVoidItemInfo']) then
child:addIgnore(WOW_PROJECT_ID, modulname)
end
local init = {
Setup = function(self)
db = child['db']

View File

@ -7,9 +7,6 @@ local db
local skip = {
[WOW_PROJECT_CLASSIC] = {}
}
if(WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then
skip[WOW_PROJECT_BURNING_CRUSADE_CLASSIC] = {}
end
function child:GetModul(modName)
for k,modul in pairs(moduls) do
if(modul.name==modName) then
@ -17,12 +14,12 @@ function child:GetModul(modName)
end
end
end
function child:IgnoreClassic(ign)
skip[WOW_PROJECT_CLASSIC][ign] = true
end
function child:IgnoreBCC(ign)
if(WOW_PROJECT_BURNING_CRUSADE_CLASSIC) then
skip[WOW_PROJECT_BURNING_CRUSADE_CLASSIC][ign] = true
function child:addIgnore(pid, ign)
if(pid) then
if(ign) then
skip[pid] = skip[pid] or {}
skip[pid][ign] = true
end
end
end
function child:RegisterModul(modul, namespace)

View File

@ -75,36 +75,36 @@ local function GameTooltip_OnTooltipSetItem(tooltip)
tooltip:Show()
end
local function GameTooltip_OnTooltipSetItem2(tooltip, tooltipData)
-- local tooltipData = tooltip:GetTooltipData()
if(tooltipData and tooltipData.id and tooltipData.type == 0) then -- type -> 0 = item, 1 = spell
curItem = tooltipData.id
tooltip.zzInfo = true
child:setTT(curItem,tooltip)
tooltip:AddLine()
for name,b in pairs(child:Search(curItem)) do
local dname, drealm = strsplit(" - ",name)
local input,sum = child:output(b)
if(sum>0) then
tooltip:AddLine(format(L['tooltip_main_string'],child:getIcon(curItem),dname,sum,child:colorize(table.concat(input,', '),"ffffff")))
end
input = nil
-- local tooltipData = tooltip:GetTooltipData()
if(tooltipData and tooltipData.id and tooltipData.type == 0) then -- type -> 0 = item, 1 = spell
curItem = tooltipData.id
tooltip.zzInfo = true
child:setTT(curItem,tooltip)
tooltip:AddLine()
for name,b in pairs(child:Search(curItem)) do
local dname, drealm = strsplit(" - ",name)
local input,sum = child:output(b)
if(sum>0) then
tooltip:AddLine(format(L['tooltip_main_string'],child:getIcon(curItem),dname,sum,child:colorize(table.concat(input,', '),"ffffff")))
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
input = nil
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
if(GameTooltip.OnTooltipSetItem) then
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem
GameTooltip:HookScript("OnTooltipSetItem", GameTooltip_OnTooltipSetItem)
else
end
if(TooltipDataProcessor) then
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem2
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, GameTooltip_OnTooltipSetItem2)
else
child.GameTooltip_OnTooltipSetItem = GameTooltip_OnTooltipSetItem
GameTooltip:HookScript("OnTooltipSetItem", GameTooltip_OnTooltipSetItem)
end
function events:TRADE_SKILL_LIST_UPDATE(event)
child:updateTT()