Skip to content

Commit

Permalink
v1.9.0 (#193)
Browse files Browse the repository at this point in the history
* Close #185: Add total item count to item loot rows
* Close #186: Show Brann's level and XP progress
* Close #188: Profession Skill Ups
* Close #161: Highlight notable loot
* Close #13: Highlight Better Than Equipped
* Close #20: Add TSM and Auctionator integration
  • Loading branch information
Mctalian committed Nov 26, 2024
1 parent 2224cb3 commit a9716e4
Show file tree
Hide file tree
Showing 73 changed files with 3,905 additions and 1,074 deletions.
3 changes: 3 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ include = {
"^BlizzOverrides/", -- Include all files in BlizzOverrides/
"^config/", -- Include all files in config/
"^Features/", -- Include all files in Features/
"^GameTesting/", -- Include all files in GameTesting/
"^LootDisplay/", -- Include all files in LootDisplay/
"^utils/", -- Include all files in utils/
"^[^/]+$" -- Include all Lua files in the repo root
}
7 changes: 4 additions & 3 deletions .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ externals:
Libs/LibStub: https://repos.wowace.com/wow/ace3/trunk/LibStub
Libs/CallbackHandler-1.0: https://repos.wowace.com/wow/ace3/trunk/CallbackHandler-1.0
Libs/AceAddon-3.0: https://repos.wowace.com/wow/ace3/trunk/AceAddon-3.0
Libs/AceBucket-3.0: https://repos.wowace.com/wow/ace3/trunk/AceBucket-3.0
Libs/AceEvent-3.0: https://repos.wowace.com/wow/ace3/trunk/AceEvent-3.0
Libs/AceDB-3.0: https://repos.wowace.com/wow/ace3/trunk/AceDB-3.0
Libs/AceConsole-3.0: https://repos.wowace.com/wow/ace3/trunk/AceConsole-3.0
Expand All @@ -19,8 +20,8 @@ ignore:
- spec/*
- Makefile
- trunk
- *.ps1
- *.md
- *.rockspec
- "*.ps1"
- "*.md"
- "*.rockspec"
- requirements.txt

1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
1 change: 1 addition & 0 deletions .scripts/hardcode_string_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def scan_directory(directory, ignore_files=None, ignore_dirs=None):

def main():
ignore_files = [
"IntegrationTest.lua",
"SmokeTest.lua",
]
ignore_dirs = [
Expand Down
23 changes: 11 additions & 12 deletions BlizzOverrides/BossBanner.lua
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
local addonName, G_RLF = ...

local RLF = G_RLF.RLF
local BossBannerOverride = G_RLF.RLF:NewModule("BossBanner", "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0")

local bossBannerAttempts = 0
function BossBannerOverride:OnInitialize()
self:RegisterEvent("PLAYER_ENTERING_WORLD", "BossBannerHook")
end

function RLF:BossBannerHook()
local bossBannerAttempts = 0
function BossBannerOverride:BossBannerHook()
if self:IsHooked(BossBanner, "OnEvent") then
return
end
if BossBanner then
self:RawHookScript(BossBanner, "OnEvent", "InterceptBossBannerAlert", true)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
else
if bossBannerAttempts <= 30 then
bossBannerAttempts = bossBannerAttempts + 1
-- Keep checking until it's available
self:ScheduleTimer("BossBannerHook", 1)
else
self:Print(G_RLF.L["BossBannerAlertUnavailable"])
self:Print(G_RLF.L["Issues"])
end
bossBannerAttempts = G_RLF.retryHook(self, "BossBannerHook", bossBannerAttempts, "BossBannerAlertUnavailable")
end
end

function RLF:InterceptBossBannerAlert(s, event, ...)
function BossBannerOverride:InterceptBossBannerAlert(s, event, ...)
if G_RLF.db.global.bossBannerConfig == G_RLF.DisableBossBanner.FULLY_DISABLE then
return
end
Expand Down Expand Up @@ -55,3 +52,5 @@ function RLF:InterceptBossBannerAlert(s, event, ...)
-- Call the original AddAlert function if not blocked
self.hooks[BossBanner].OnEvent(s, event, ...)
end

return BossBannerOverride
28 changes: 14 additions & 14 deletions BlizzOverrides/LootToasts.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
local addonName, G_RLF = ...

local RLF = G_RLF.RLF
local LootToastOverride = G_RLF.RLF:NewModule("LootToasts", "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0")

function LootToastOverride:OnInitialize()
self:RegisterEvent("PLAYER_ENTERING_WORLD", "LootToastHook")
end

local lootAlertAttempts = 0
function RLF:LootToastHook()
if RLF:IsHooked(LootAlertSystem, "AddAlert") then
function LootToastOverride:LootToastHook()
if self:IsHooked(LootAlertSystem, "AddAlert") then
return
end
if LootAlertSystem and LootAlertSystem.AddAlert then
RLF:RawHook(LootAlertSystem, "AddAlert", "InterceptAddAlert", true)
self:RawHook(LootAlertSystem, "AddAlert", "InterceptAddAlert", true)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
else
if lootAlertAttempts <= 30 then
lootAlertAttempts = lootAlertAttempts + 1
-- Keep checking until it's available
RLF:ScheduleTimer("LootToastHook", 1)
else
RLF:Print(G_RLF.L["AddLootAlertUnavailable"])
RLF:Print(G_RLF.L["Issues"])
end
lootAlertAttempts = G_RLF.retryHook(self, "LootToastHook", lootAlertAttempts, "AddLootAlertUnavailable")
end
end

function RLF:InterceptAddAlert(frame, ...)
function LootToastOverride:InterceptAddAlert(frame, ...)
if G_RLF.db.global.disableBlizzLootToasts then
return
end
-- Call the original AddAlert function if not blocked
RLF.hooks[LootAlertSystem].AddAlert(frame, ...)
self.hooks[LootAlertSystem].AddAlert(frame, ...)
end

return LootToastOverride
28 changes: 14 additions & 14 deletions BlizzOverrides/MoneyAlerts.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
local addonName, G_RLF = ...

local RLF = G_RLF.RLF
local MoneyAlertOverride = G_RLF.RLF:NewModule("MoneyAlerts", "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0")

function MoneyAlertOverride:OnInitialize()
self:RegisterEvent("PLAYER_ENTERING_WORLD", "MoneyAlertHook")
end

local moneyAlertAttempts = 0
function RLF:MoneyAlertHook()
if RLF:IsHooked(MoneyWonAlertSystem, "AddAlert") then
function MoneyAlertOverride:MoneyAlertHook()
if self:IsHooked(MoneyWonAlertSystem, "AddAlert") then
return
end
if MoneyWonAlertSystem and MoneyWonAlertSystem.AddAlert then
RLF:RawHook(MoneyWonAlertSystem, "AddAlert", "InterceptMoneyAddAlert", true)
self:RawHook(MoneyWonAlertSystem, "AddAlert", "InterceptMoneyAddAlert", true)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
else
if moneyAlertAttempts <= 30 then
moneyAlertAttempts = moneyAlertAttempts + 1
-- Keep checking until it's available
RLF:ScheduleTimer("MoneyAlertHook", 1)
else
RLF:Print(G_RLF.L["AddMoneyAlertUnavailable"])
RLF:Print(G_RLF.L["Issues"])
end
moneyAlertAttempts = G_RLF.retryHook(self, "MoneyAlertHook", moneyAlertAttempts, "AddMoneyAlertUnavailable")
end
end

function RLF:InterceptMoneyAddAlert(frame, ...)
function MoneyAlertOverride:InterceptMoneyAddAlert(frame, ...)
if G_RLF.db.global.disableBlizzMoneyAlerts then
return
end
-- Call the original AddAlert function if not blocked
RLF.hooks[MoneyWonAlertSystem].AddAlert(frame, ...)
self.hooks[MoneyWonAlertSystem].AddAlert(frame, ...)
end

return MoneyAlertOverride
1 change: 1 addition & 0 deletions BlizzOverrides/overrides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="retryHook.lua"/>
<Script file="BossBanner.lua"/>
<Script file="LootToasts.lua"/>
<Script file="MoneyAlerts.lua"/>
Expand Down
16 changes: 16 additions & 0 deletions BlizzOverrides/retryHook.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local addonName, G_RLF = ...

G_RLF.retryHook = function(module, previousAttempts, hookFunctionName, localeKey)
local attempts = previousAttempts

if attempts < 30 then
attempts = attempts + 1
-- Keep checking until it's available
module:ScheduleTimer(hookFunctionName, 1)
else
G_RLF:Print(G_RLF.L[localeKey])
G_RLF:Print(G_RLF.L["Issues"])
end

return attempts
end
177 changes: 93 additions & 84 deletions Core.lua
Original file line number Diff line number Diff line change
@@ -1,105 +1,114 @@
local addonName, G_RLF = ...

-- Define the global scope early so that the whole addon can use it
local dbName = addonName .. "DB"
local localeName = addonName .. "Locale"

local xpcall = xpcall

local function errorhandler(err)
local suffix = "\n\n==== Addon Info " .. addonName .. " " .. G_RLF.addonVersion .. " ====\n\n"
suffix = suffix .. G_RLF.L["Issues"] .. "\n\n"

return geterrorhandler()(err .. suffix)
end

function G_RLF:fn(func, ...)
-- Borrowed from AceAddon-3.0
if type(func) == "function" then
return xpcall(func, errorhandler, ...)
end
end
G_RLF.addonVersion = "@project-version@-@project-revision@-@project-abbreviated-hash@"

G_RLF.RLF = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0")
G_RLF.RLF:SetDefaultModuleState(true)
G_RLF.RLF:SetDefaultModulePrototype({
getLogger = function(self)
return G_RLF.RLF:GetModule("Logger")
end,
local RLF = LibStub("AceAddon-3.0"):NewAddon(addonName, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0")
RLF:SetDefaultModuleState(true)
RLF:SetDefaultModulePrototype({
fn = function(s, func, ...)
local function errorhandler(err)
local suffix = "\n\n==== Addon Info " .. addonName .. " " .. G_RLF.addonVersion .. " ====\n\n"
local status, trace = pcall(function()
return s:getLogger():Trace(s.moduleName)
end)
if status then
suffix = suffix .. "Log traces related to " .. s.moduleName .. "\n"
suffix = suffix .. "-------------------------------------------------\n"
suffix = suffix .. trace
suffix = suffix .. "-------------------------------------------------\n\n"
end
suffix = suffix .. G_RLF.L["Issues"] .. "\n\n"

return geterrorhandler()(err .. suffix)
end

-- Borrowed from AceAddon-3.0
if type(func) == "function" then
return xpcall(func, errorhandler, ...)
end
return G_RLF.fn(s, func, ...)
end,
})
G_RLF.dbName = dbName
G_RLF.localeName = localeName
G_RLF.addonVersion = "@project-version@-@project-revision@-@project-abbreviated-hash@"
G_RLF.DisableBossBanner = {
ENABLED = 0,
FULLY_DISABLE = 1,
DISABLE_LOOT = 2,
DISABLE_MY_LOOT = 3,
DISABLE_GROUP_LOOT = 4,
}

G_RLF.localeName = addonName .. "Locale"
G_RLF.lsm = LibStub("LibSharedMedia-3.0")
G_RLF.Masque = LibStub and LibStub("Masque", true)
G_RLF.iconGroup = Masque and Masque:Group(addonName)
local dbName = addonName .. "DB"
local acd = LibStub("AceConfigDialog-3.0")
local TestMode
function RLF:OnInitialize()
G_RLF.db = LibStub("AceDB-3.0"):New(dbName, G_RLF.defaults, true)
LibStub("AceConfig-3.0"):RegisterOptionsTable(addonName, G_RLF.options)
local lsm = G_RLF.lsm
lsm:Register(lsm.MediaType.FONT, "BAR SADY Regular", "Interface\\AddOns\\RPGLootFeed\\Fonts\\BAR_SADY_Variable.ttf")
self:Hook(acd, "Open", "OnOptionsOpen")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterChatCommand("rlf", "SlashCommand")
self:RegisterChatCommand("RLF", "SlashCommand")
self:RegisterChatCommand("rpglootfeed", "SlashCommand")
self:RegisterChatCommand("rpgLootFeed", "SlashCommand")

if EditModeManagerFrame then
EventRegistry:RegisterCallback("EditMode.Enter", function()
G_RLF.LootDisplay:SetBoundingBoxVisibility(true)
end)
EventRegistry:RegisterCallback("EditMode.Exit", function()
G_RLF.LootDisplay:SetBoundingBoxVisibility(false)
end)
end

local acr = LibStub("AceConfigRegistry-3.0")

function G_RLF:NotifyChange(...)
acr:NotifyChange(...)
end

function G_RLF:SendMessage(...)
G_RLF.RLF:SendMessage(...)
TestMode = self:GetModule("TestMode")
end

function G_RLF:Print(...)
G_RLF.RLF:Print(...)
function RLF:SlashCommand(msg, editBox)
G_RLF:fn(function()
if msg == "test" then
TestMode:ToggleTestMode()
--@alpha@
elseif msg == "i" then
TestMode:IntegrationTest()
--@end-alpha@
elseif msg == "clear" then
G_RLF.LootDisplay:HideLoot()
elseif msg == "log" then
self:GetModule("Logger"):Show()
else
acd:Open(addonName)
end
end)
end

function G_RLF:RGBAToHexFormat(r, g, b, a)
local red = string.format("%02X", math.floor(r * 255))
local green = string.format("%02X", math.floor(g * 255))
local blue = string.format("%02X", math.floor(b * 255))
local alpha = string.format("%02X", math.floor((a or 1) * 255)) -- Default alpha to 1 if not provided
local currentVersion = "@project-version@"
function RLF:PLAYER_ENTERING_WORLD(event, isLogin, isReload)
if self.optionsFrame == nil then
self.optionsFrame = acd:AddToBlizOptions(addonName, addonName)
end

-- Return in WoW format with |c prefix
return "|c" .. alpha .. red .. green .. blue
local isNewVersion = currentVersion ~= G_RLF.db.global.lastVersionLoaded
if isLogin and isReload == false and isNewVersion then
G_RLF.db.global.lastVersionLoaded = currentVersion
self:Print(G_RLF.L["Welcome"] .. " (" .. currentVersion .. ")")
if G_RLF.db.global.enableAutoLoot then
C_CVar.SetCVar("autoLootDefault", "1")
end
end
G_RLF.AuctionIntegrations:Init()
end

--@alpha@
function G_RLF:ProfileFunction(func, funcName)
return function(...)
local startTime = debugprofilestop()
local result = { func(...) }
local endTime = debugprofilestop()
local duration = endTime - startTime
if duration > 0.3 then
G_RLF:Print(string.format("%s took %.2f ms", funcName, endTime - startTime))
local optionsFrame
local isOpen = false
function RLF:OnOptionsOpen(...)
local _, name, container, path = ...
G_RLF:fn(function()
if container then
return
end
if name == addonName and not isOpen then
isOpen = true
G_RLF.LootDisplay:SetBoundingBoxVisibility(true)
self:ScheduleTimer(function()
optionsFrame = acd.OpenFrames[name]
if self:IsHooked(optionsFrame, "Hide") then
self:Unhook(optionsFrame, "Hide")
end
if optionsFrame and optionsFrame.Hide then
self:Hook(optionsFrame, "Hide", "OnOptionsClose", true)
end
end, 0.25)
end
end)
end

return unpack(result)
end
function RLF:OnOptionsClose(...)
G_RLF:fn(function()
isOpen = false
G_RLF.LootDisplay:SetBoundingBoxVisibility(false)
self:Unhook(optionsFrame, "Hide")
optionsFrame = nil
end)
end
--@end-alpha@

G_RLF.RLF = RLF

return RLF
Loading

0 comments on commit a9716e4

Please sign in to comment.