mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Detect the relic slot via UnitHasRelicSlot instead of hardcoded classes
IsRelicSlot no longer tests playerClass against PALADIN/DRUID/SHAMAN. It now reads CleveRoids.hasRelicSlot, sampled once in PLAYER_LOGIN. Also folds PerformEquipSwap's slot-18 check into the same helper. Its class list (HUNTER/WARRIOR/ROGUE/MAGE/WARLOCK/PRIEST) was the exact complement of the relic classes, so it becomes `not IsRelicSlot(inventoryId)` and the two lists can no longer drift apart.
This commit is contained in:
@@ -261,11 +261,11 @@ local function GetInventoryIdFromSlot(slotName)
|
||||
return SLOT_TO_INVID[slotName] or GetInventorySlotInfo(slotName)
|
||||
end
|
||||
|
||||
-- Check if slot 18 is a relic (no GCD) for current player class
|
||||
-- Check if slot 18 is a relic (no GCD). Backed by CleveRoids.hasRelicSlot, cached
|
||||
-- at PLAYER_LOGIN -- see the note there on why it can't be sampled on demand.
|
||||
local function IsRelicSlot(slot)
|
||||
if slot ~= 18 then return false end
|
||||
local playerClass = CleveRoids.playerClass
|
||||
return playerClass == "PALADIN" or playerClass == "DRUID" or playerClass == "SHAMAN"
|
||||
return CleveRoids.hasRelicSlot or false
|
||||
end
|
||||
|
||||
-- PERFORMANCE: Cache GetTime() result for cooldown checks within same frame
|
||||
@@ -289,16 +289,11 @@ local function PerformEquipSwap(item, inventoryId, useQueueScript)
|
||||
if not item or not inventoryId then return false end
|
||||
|
||||
-- Check if in combat and swapping weapons
|
||||
-- Slot 18 (ranged) is only a weapon for Hunter/Warrior/Rogue/Mage/Warlock/Priest
|
||||
-- For Druid/Paladin/Shaman, slot 18 is idol/libram/totem - can swap freely
|
||||
-- Slot 18 is a ranged weapon for exactly the classes with no relic slot; for
|
||||
-- Paladin/Druid/Shaman it's an idol/libram/totem that can swap freely.
|
||||
local isWeapon = (inventoryId == 16 or inventoryId == 17)
|
||||
if inventoryId == 18 then
|
||||
-- Use cached playerClass for performance
|
||||
local playerClass = CleveRoids.playerClass
|
||||
-- Only treat slot 18 as weapon for classes that use ranged weapons
|
||||
isWeapon = (playerClass == "HUNTER" or playerClass == "WARRIOR" or
|
||||
playerClass == "ROGUE" or playerClass == "MAGE" or
|
||||
playerClass == "WARLOCK" or playerClass == "PRIEST")
|
||||
isWeapon = not IsRelicSlot(inventoryId)
|
||||
end
|
||||
|
||||
if isWeapon and UnitAffectingCombat("player") then
|
||||
@@ -4984,6 +4979,9 @@ function CleveRoids.Frame:PLAYER_LOGIN()
|
||||
if CleveRoids.disabled then return end
|
||||
|
||||
_, CleveRoids.playerClass = UnitClass("player")
|
||||
|
||||
CleveRoids.hasRelicSlot = UnitHasRelicSlot("player") and true or false
|
||||
|
||||
CleveRoids.IndexSpells()
|
||||
CleveRoids.IndexPetSpells()
|
||||
CleveRoids.initializationTimer = GetTime() + 1.5
|
||||
|
||||
Reference in New Issue
Block a user