Skip to content

Commit

Permalink
Load: Add Hardcode and Season of Discovery load options for Classic
Browse files Browse the repository at this point in the history
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: WeakAuras#5533
  • Loading branch information
InfusOnWoW committed Nov 24, 2024
1 parent 56fc565 commit 47dedfb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
10 changes: 8 additions & 2 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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)
Expand Down

0 comments on commit 47dedfb

Please sign in to comment.