From 47dedfb490fa55280a45cfb5d2e18376c97b4220 Mon Sep 17 00:00:00 2001 From: Infus Date: Sat, 23 Nov 2024 18:53:59 +0100 Subject: [PATCH] Load: Add Hardcode and Season of Discovery load options for Classic Season of Discovery is different enough that having a load option for it feels warranted. And hopefully this won't be the last time for that api. Fixes: #5533 --- .luacheckrc | 2 ++ WeakAuras/Prototypes.lua | 18 ++++++++++++++++++ WeakAuras/WeakAuras.lua | 10 ++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 7a107dac47..ae10dff0c8 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -499,11 +499,13 @@ globals = { "C_CurrencyInfo", "C_CVar", "C_EncounterJournal", + "C_Engraving", "C_EquipmentSet", "C_EquipmentSet.GetEquipmentSetIDs", "C_EquipmentSet.GetEquipmentSetInfo", "C_EquipmentSet.GetNumEquipmentSets", "C_GamePad", + "C_GameRules", "C_Garrison", "C_Garrison.AddFollowerToMission", "C_Garrison.AllowMissionStartAboveSoftCap", diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index f3987a3019..7d9e7e2ff6 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -1396,6 +1396,24 @@ Private.load_prototype = { optional = true, events = {"PLAYER_MOUNT_DISPLAY_CHANGED"} }, + { + name = "hardcore", + display = L["Hardcore"], + type = "tristate", + init = WeakAuras.IsClassicEra() and "arg" or nil, + width = WeakAuras.normalWidth, + enable = WeakAuras.IsClassicEra(), + hidden = not WeakAuras.IsClassicEra(), + }, + { + name = "engraving", + display = L["Season of Discovery"], + type = "tristate", + init = WeakAuras.IsClassicEra() and "arg" or nil, + width = WeakAuras.normalWidth, + enable = WeakAuras.IsClassicEra(), + hidden = not WeakAuras.IsClassicEra(), + }, { name ="playerTitle", display = L["Player"], diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index af9580b7da..58e37a8262 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -1756,6 +1756,12 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) warmodeActive = C_PvP.IsWarModeDesired(); end + local hardcore, runeEngraving = false, false + if WeakAuras.IsClassicEra() then + hardcore = C_GameRules.IsHardcoreActive() + runeEngraving = C_Engraving.IsEngravingEnabled() + end + local changed = 0; local shouldBeLoaded, couldBeLoaded; local parentsToCheck = {} @@ -1768,8 +1774,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) local loadFunc = loadFuncs[id]; local loadOpt = loadFuncsForOptions[id]; if WeakAuras.IsClassicEra() then - shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, mounted, class, player, realm, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size) - couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, mounted, class, player, realm, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size) + shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, mounted, hardcore, runeEngraving, class, player, realm, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size) + couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, mounted, hardcore, runeEngraving, class, player, realm, race, faction, playerLevel, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size) elseif WeakAuras.IsCataClassic() then shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, vehicleUi, mounted, class, specId, player, realm, race, faction, playerLevel, role, position, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex) couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, inEncounter, vehicle, vehicleUi, mounted, class, specId, player, realm, race, faction, playerLevel, role, position, raidRole, group, groupSize, raidMemberType, zone, zoneId, zonegroupId, instanceId, minimapText, encounter_id, size, difficulty, difficultyIndex)