Skip to content

Commit

Permalink
Tweak season checking code
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Nov 24, 2024
1 parent 0c90f40 commit f8b0ae7
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 30 deletions.
5 changes: 0 additions & 5 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ files["**/Loader.lua"].ignore = {
"11[23]/SlashCmdList",
"11[23]/hash_SlashCmdList",
}
files["**/API.lua"].ignore = {
"113/geterrorhandler",
}
files["**/AutoRole.lua"].ignore = {
"113/RolePollPopup",
"113/UnitGroupRolesAssigned",
Expand All @@ -68,7 +65,6 @@ files["**/AutoRole.lua"].ignore = {
files["**/Core/BossPrototype.lua"].ignore = {
"113/C_Item",
"113/C_NamePlate",
"113/C_Seasons",
"113/C_UIWidgetManager",
"113/C_UnitAuras",
"113/GetNumGroupMembers",
Expand All @@ -81,7 +77,6 @@ files["**/Core/BossPrototype.lua"].ignore = {
files["**/Core/BossPrototype_Classic.lua"].ignore = {
"113/C_Item",
"113/C_NamePlate",
"113/C_Seasons",
"113/C_UIWidgetManager",
"113/C_UnitAuras",
"113/GetNumGroupMembers",
Expand Down
17 changes: 5 additions & 12 deletions Core/BossPrototype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local BigWigsAPI = BigWigsAPI
local L = BigWigsAPI:GetLocale("BigWigs: Common")
local LibSpec = LibStub("LibSpecialization", true)
local loader = BigWigsLoader
local isClassic, isRetail, isClassicEra, isCata = loader.isClassic, loader.isRetail, loader.isVanilla, loader.isCata
local isClassic, isRetail, isClassicEra, isCata, season = loader.isClassic, loader.isRetail, loader.isVanilla, loader.isCata, loader.season
local C_EncounterJournal_GetSectionInfo = isCata and function(key)
return C_EncounterJournal.GetSectionInfo(key) or BigWigsAPI:GetLocale("BigWigs: Encounter Info")[key]
end or isRetail and C_EncounterJournal.GetSectionInfo or function(key)
Expand Down Expand Up @@ -1615,17 +1615,10 @@ function boss:Vanilla()
return isClassicEra
end

do
local GetActiveSeason = C_Seasons and C_Seasons.GetActiveSeason
local season = 0
if GetActiveSeason then
season = GetActiveSeason() or 0
end
--- Get the current season.
-- @return number
function boss:GetSeason()
return season
end
--- Get the current season.
-- @return number
function boss:GetSeason()
return season
end

--- Get the mob/npc id from a GUID.
Expand Down
17 changes: 5 additions & 12 deletions Core/BossPrototype_Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local BigWigsAPI = BigWigsAPI
local L = BigWigsAPI:GetLocale("BigWigs: Common")
local LibSpec = LibStub("LibSpecialization", true)
local loader = BigWigsLoader
local isClassic, isRetail, isClassicEra, isCata = loader.isClassic, loader.isRetail, loader.isVanilla, loader.isCata
local isClassic, isRetail, isClassicEra, isCata, season = loader.isClassic, loader.isRetail, loader.isVanilla, loader.isCata, loader.season
local C_EncounterJournal_GetSectionInfo = isCata and function(key)
return C_EncounterJournal.GetSectionInfo(key) or BigWigsAPI:GetLocale("BigWigs: Encounter Info")[key]
end or isRetail and C_EncounterJournal.GetSectionInfo or function(key)
Expand Down Expand Up @@ -1688,17 +1688,10 @@ function boss:Vanilla()
return isClassicEra
end

do
local GetActiveSeason = C_Seasons and C_Seasons.GetActiveSeason
local season = 0
if GetActiveSeason then
season = GetActiveSeason() or 0
end
--- Get the current season.
-- @return number
function boss:GetSeason()
return season
end
--- Get the current season.
-- @return number
function boss:GetSeason()
return season
end

--- Get the mob/npc id from a GUID.
Expand Down
1 change: 1 addition & 0 deletions Init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

local _, tbl = ...
tbl.isRetail = true
tbl.season = 0
1 change: 1 addition & 0 deletions Init_Cata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
local _, tbl = ...
tbl.isClassic = true
tbl.isCata = true
tbl.season = 0
1 change: 1 addition & 0 deletions Init_TBC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
local _, tbl = ...
tbl.isClassic = true
tbl.isTBC = true
tbl.season = 0
3 changes: 2 additions & 1 deletion Init_Vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
local _, tbl = ...
tbl.isClassic = true
tbl.isVanilla = true
tbl.isSeasonOfDiscovery = C_Seasons.GetActiveSeason() == 2
tbl.season = C_Seasons and C_Seasons.GetActiveSeason() or 0
tbl.isSeasonOfDiscovery = tbl.season == 2
1 change: 1 addition & 0 deletions Init_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
local _, tbl = ...
tbl.isClassic = true
tbl.isWrath = true
tbl.season = 0
1 change: 1 addition & 0 deletions Loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ do
public.isRetail = tbl.isRetail
public.isClassic = tbl.isClassic
public.isVanilla = tbl.isVanilla
public.season = tbl.season
public.isSeasonOfDiscovery = tbl.isSeasonOfDiscovery
public.isTBC = tbl.isTBC
public.isWrath = tbl.isWrath
Expand Down

0 comments on commit f8b0ae7

Please sign in to comment.