Skip to content

Commit

Permalink
Merge pull request #731 from DakJaniels/master
Browse files Browse the repository at this point in the history
Update for 11.0.2
  • Loading branch information
rdw-software authored Jul 24, 2024
2 parents a03059e + 1133309 commit 4ebfa75
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ globals = {
"READY_CHECK_WAITING_TEXTURE",

-- FrameXML (Blizzard interface)
"C_AddOns",
"C_Container",
"C_Item",
"Settings",

"AuraUtil",
"BackdropTemplateMixin",
"ChatFontNormal",
Expand Down
2 changes: 1 addition & 1 deletion Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ local UnitIsDead = _G.UnitIsDead
local GetNumLootItems = _G.GetNumLootItems
local GetLootSlotInfo = _G.GetLootSlotInfo
local GetLootSlotLink = _G.GetLootSlotLink
local GetItemInfo_Blizzard = _G.GetItemInfo
local GetItemInfo_Blizzard = _G.C_Item.GetItemInfo
local GetItemInfo = function(id)
return R:GetItemInfo(id)
end
Expand Down
3 changes: 3 additions & 0 deletions Core/Announcements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ local Output = Rarity.Output
-- Upvalues
local CONSTANTS = addonTable.constants

--- WoW API
local GetItemInfo = _G.C_Item.GetItemInfo

function Announcements:AnnounceAttemptForItem(item)
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice =
GetItemInfo(item.itemId)
Expand Down
10 changes: 4 additions & 6 deletions Core/EventHandlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local format = _G.format
local GetCurrencyInfo = _G.C_CurrencyInfo.GetCurrencyInfo
local CombatLogGetCurrentEventInfo = _G.CombatLogGetCurrentEventInfo
local UnitGUID = UnitGUID
local LoadAddOn = LoadAddOn
local LoadAddOn = _G.C_AddOns.LoadAddOn
local GetBestMapForUnit = _G.C_Map.GetBestMapForUnit
local GetMapInfo = _G.C_Map.GetMapInfo
local IsQuestFlaggedCompleted = C_QuestLog.IsQuestFlaggedCompleted
Expand All @@ -34,7 +34,7 @@ local UnitIsDead = _G.UnitIsDead
local GetNumLootItems = _G.GetNumLootItems
local GetLootSlotInfo = _G.GetLootSlotInfo
local GetLootSlotLink = _G.GetLootSlotLink
local GetItemInfo_Blizzard = _G.GetItemInfo
local GetItemInfo_Blizzard = _G.C_Item.GetItemInfo
local GetItemInfo = function(id)
return R:GetItemInfo(id)
end
Expand Down Expand Up @@ -178,7 +178,7 @@ local TYPE_IDENTIFIER_ITEM = "item" -- What others do they have? currency? gold?

-- Upvalues
--- WOW API
local GetItemInfoInstant = GetItemInfoInstant
local GetItemInfoInstant = _G.C_Item.GetItemInfoInstant

function R:OnShowLootToast(
event,
Expand Down Expand Up @@ -746,9 +746,7 @@ function R:OnChatCommand(input)
else
LoadAddOn("Rarity_Options")
if R.optionsFrame then
-- Thanks, Blizzard (https://www.wowinterface.com/forums/showthread.php?t=54599)
InterfaceOptionsFrame_OpenToCategory(R.optionsFrame)
InterfaceOptionsFrame_OpenToCategory(R.optionsFrame)
Settings.OpenToCategory("Rarity")
else
self:Print(L["The Rarity Options module has been disabled. Log out and enable it from your add-ons menu."])
end
Expand Down
6 changes: 3 additions & 3 deletions Core/GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ local date = date
local time = time

-- WOW APIs
local GetItemInfo = GetItemInfo
local GetItemInfo = C_Item.GetItemInfo
local IsShiftKeyDown = IsShiftKeyDown
local IsControlKeyDown = IsControlKeyDown
local LoadAddOn = LoadAddOn
local LoadAddOn = C_AddOns.LoadAddOn
local UnitClass = UnitClass
local GetMapInfo = C_Map.GetMapInfo
local GetTime = GetTime
Expand All @@ -45,7 +45,7 @@ local UnitIsPVP = UnitIsPVP
local GetAchievementLink = GetAchievementLink
local GetRealZoneText = GetRealZoneText
local GetSubZoneText = GetSubZoneText
local GetContainerItemID = GetContainerItemID
local GetContainerItemID = C_Container.GetContainerItemID
local RequestRaidInfo = RequestRaidInfo
local RequestLFDPlayerLockInfo = RequestLFDPlayerLockInfo

Expand Down
8 changes: 5 additions & 3 deletions Core/GUI/DataBrokerDisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ local R = Rarity
local GUI = Rarity.GUI
local CONSTANTS = addonTable.constants

--- WoW API
local GetItemInfo = _G.C_Item.GetItemInfo
local LoadAddOn = _G.C_AddOns.LoadAddOn

local dataobj = ldb:NewDataObject("Rarity", {
type = "data source",
text = L["Loading"],
Expand Down Expand Up @@ -60,9 +64,7 @@ function dataobj:OnClick(button)
Rarity:Debug("Loading Rarity_Options addon")
LoadAddOn("Rarity_Options")
if R.optionsFrame then
-- Thanks, Blizzard (https://www.wowinterface.com/forums/showthread.php?t=54599)
InterfaceOptionsFrame_OpenToCategory(R.optionsFrame)
InterfaceOptionsFrame_OpenToCategory(R.optionsFrame)
Settings.OpenToCategory("Rarity")
else
R:Print(L["The Rarity Options module has been disabled. Log out and enable it from your add-ons menu."])
end
Expand Down
1 change: 1 addition & 0 deletions Core/GUI/FauxAchievementPopup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local _, addonTable = ...
local CONSTANTS = addonTable.constants

-- WOW API
local GetItemInfo = _G.C_Item.GetItemInfo
local TextureKitConstants = _G.TextureKitConstants
local GetAchievementInfo = _G.GetAchievementInfo

Expand Down
1 change: 1 addition & 0 deletions Core/GUI/GameTooltipHooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local lbz = LibStub("LibBabble-Zone-3.0"):GetUnstrictLookupTable()
local GetBestMapForUnit = _G.C_Map.GetBestMapForUnit
local IsQuestFlaggedCompleted = _G.C_QuestLog.IsQuestFlaggedCompleted
local UnitFactionGroup = _G.UnitFactionGroup
local GetItemInfo = _G.C_Item.GetItemInfo
--- Addon API
local CONSTANTS = addonTable.constants
local colorize = Rarity.Utils.String.Colorize
Expand Down
2 changes: 2 additions & 0 deletions Core/GUI/MainWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ local R = Rarity
local GUI = Rarity.GUI
local CONSTANTS = addonTable.constants

--- WoW API
local GetItemInfo = _G.C_Item.GetItemInfo
local GetBestMapForUnit = C_Map.GetBestMapForUnit
local IsWorldQuestActive = C_TaskQuest.IsActive
local IsQuestFlaggedCompleted = _G.C_QuestLog.IsQuestFlaggedCompleted
Expand Down
5 changes: 4 additions & 1 deletion Core/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Rarity = LibStub("AceAddon-3.0"):NewAddon(
"AceSerializer-3.0"
)
-- Rarity.MINOR_VERSION = tonumber(("$Revision: 650 $"):match("%d+")) -- Disabled after switching entirely to Git (from SVN)
local projectVersion, noReplacements = (GetAddOnMetadata("Rarity", "Version"):match("r%d+") or "r0"):gsub("r", "") -- e.g., r654 1 (the second value can be discarded)
local projectVersion, noReplacements = (C_AddOns.GetAddOnMetadata("Rarity", "Version"):match("r%d+") or "r0"):gsub(
"r",
""
) -- e.g., r654 1 (the second value can be discarded)
Rarity.MINOR_VERSION = tonumber(projectVersion)

-- Set up modules
Expand Down
7 changes: 4 additions & 3 deletions Core/Interoperability/Blizzard/AddonCompartment.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
local L = LibStub("AceLocale-3.0"):GetLocale("Rarity")

--- WoW API
local LoadAddOn = _G.C_AddOns.LoadAddOn

local AddonCompartment = {}

function AddonCompartment.OnClick()
-- Should behave the same as the default /rarity slash command (copy/pasted for now) - improve UX later?
LoadAddOn("Rarity_Options")
if Rarity.optionsFrame then
-- Thanks, Blizzard (https://www.wowinterface.com/forums/showthread.php?t=54599)
InterfaceOptionsFrame_OpenToCategory(Rarity.optionsFrame)
InterfaceOptionsFrame_OpenToCategory(Rarity.optionsFrame)
Settings.OpenToCategory("Rarity")
else
Rarity:Print(L["The Rarity Options module has been disabled. Log out and enable it from your add-ons menu."])
end
Expand Down
4 changes: 2 additions & 2 deletions Core/Interoperability/TradeSkillMaster/AuctionDB.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ local AuctionDB = {}
-- Lua APIs
local format = string.format

-- WOW APIs
local GetItemInfo = GetItemInfo
--- WoW API
local GetItemInfo = _G.C_Item.GetItemInfo

--- Attempts to determine whether or not the TSM_API can safely be used (it's probably not perfect)
-- @return True if the required functionality appears to be loaded; false (nil) otherwise
Expand Down
4 changes: 2 additions & 2 deletions Core/Interoperability/WoWUnit/Testing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ local Testing = {
--- Externals
local L = LibStub("AceLocale-3.0"):GetLocale("Rarity", false)
--- WOW API
local IsAddOnLoaded = IsAddOnLoaded
local LoadAddOn = LoadAddOn
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded
local LoadAddOn = C_AddOns.LoadAddOn

function Testing:RunIntegrationTests()
Rarity:Debug("Attempting to run the full integration test suite")
Expand Down
4 changes: 2 additions & 2 deletions Core/Profiling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ local _, addonTable = ...

-- Upvalues
--- WOW API
local IsAddOnLoaded = IsAddOnLoaded
local LoadAddOn = LoadAddOn
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded
local LoadAddOn = C_AddOns.LoadAddOn
--- Lua API
local table_wipe = table.wipe
local pairs = pairs
Expand Down
2 changes: 1 addition & 1 deletion Core/Session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local R = Rarity
local FormatTime = Rarity.Utils.PrettyPrint.FormatTime -- Utils are loaded before Core modules, so this should be fine
local GetDate = Rarity.Utils.Time.GetDate
-- WOW APIs
local GetItemInfo = GetItemInfo
local GetItemInfo = C_Item.GetItemInfo
local GetTime = GetTime
local C_Timer = C_Timer

Expand Down

0 comments on commit 4ebfa75

Please sign in to comment.