diff --git a/Constants.lua b/Constants.lua index 93b75a5..0a0aca0 100644 --- a/Constants.lua +++ b/Constants.lua @@ -188,7 +188,7 @@ LootReserve.Constants.Colors = { -- Size10 = "b1fc99", Size10 = "ffff00", Size20Tiny = "8cffdb", - Size20 = LootReserve:GetCurrentSeason() == 2 and "f87217" or "8ab9f1", + Size20 = LootReserve.SeasonID == Enum.SeasonID.SeasonofDiscovery and "f87217" or "8ab9f1", Size25Tiny = "b7b2ff", -- Size25 = "ffff00", Size25 = "f87217", diff --git a/Data.lua b/Data.lua index d96e0f5..32d83b2 100644 --- a/Data.lua +++ b/Data.lua @@ -46,15 +46,14 @@ Cata: 4.?: Alizabal added to Baradin Hold --]] -local SEASON_NUMBER = ((C_Seasons or {}).GetActiveSeason or nop)() or 0; -local SEASONS = { - MASTERY = 1, - DISCOVERY = 2, -}; + +local IS_SOD = LootReserve.SeasonID == Enum.SeasonID.SeasonofDiscovery local EXPANSION_PHASE if LootReserve:GetCurrentExpansion() == 0 then - if SEASON_NUMBER == SEASONS.DISCOVERY then + if IS_SOD then EXPANSION_PHASE = 1.5; -- Season of Discovery + elseif LootReserve.SeasonID == Enum.SeasonID.Fresh or LootReserve.SeasonID == Enum.SeasonID.FreshHardcore then + EXPANSION_PHASE = 1.0; -- Fresh else EXPANSION_PHASE = 1.5; -- Classic Era end @@ -124,7 +123,7 @@ LootReserve.Data = -- Season of Discovery - [910] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [910] = ShortCircuit(IS_SOD, { Name = "Blackfathom Deeps", ButtonName = "[10] Blackfathom Deeps", NameShort = "BFD", @@ -220,7 +219,7 @@ LootReserve.Data = }, }, }), - [920] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [920] = ShortCircuit(IS_SOD, { Name = "Gnomeregan", ButtonName = "[10] Gnomeregan", NameShort = "Gnomer", @@ -323,7 +322,7 @@ LootReserve.Data = }, }, }), - [925] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [925] = ShortCircuit(IS_SOD, { Name = "Temple of Atal'Hakkar", ButtonName = "[20] Temple of Atal'Hakkar", NameShort = "ST", @@ -457,7 +456,7 @@ LootReserve.Data = }, }), - [930] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [930] = ShortCircuit(IS_SOD, { Name = "Storm Cliffs", ButtonName = "[20] Storm Cliffs", NameShort = "Azuregos", @@ -478,7 +477,7 @@ LootReserve.Data = }, }, }), - [935] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [935] = ShortCircuit(IS_SOD, { Name = "The Tainted Scar", ButtonName = "[20] The Tainted Scar", NameShort = "Kazzak", @@ -499,7 +498,7 @@ LootReserve.Data = }, }, }), - [936] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [936] = ShortCircuit(IS_SOD, { Name = "The Crystal Vale", ButtonName = "[20] The Crystal Vale", NameShort = "Thunderaan", @@ -554,7 +553,7 @@ LootReserve.Data = }, }), - [938] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [938] = ShortCircuit(IS_SOD, { Name = "Onyxia", ButtonName = "[20] Onyxia", NameShort = "Ony", @@ -635,7 +634,7 @@ LootReserve.Data = }, }, }), - [940] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [940] = ShortCircuit(IS_SOD, { Name = "Molten Core", ButtonName = "[20] Molten Core", NameShort = "MC", @@ -892,7 +891,7 @@ LootReserve.Data = }, }), - [942] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [942] = ShortCircuit(IS_SOD, { Name = "Blackwing Lair", ButtonName = "[20] Blackwing Lair", NameShort = "BWL", @@ -1128,7 +1127,7 @@ LootReserve.Data = }, }, }), - [944] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, { + [944] = ShortCircuit(IS_SOD, { Name = "Zul'Gurub", ButtonName = "[10] Zul'Gurub", NameShort = "ZG", @@ -1341,7 +1340,7 @@ LootReserve.Data = -- Classic - [1020] = ShortCircuit(SEASON_NUMBER ~= SEASONS.DISCOVERY, { + [1020] = ShortCircuit(not IS_SOD, { Sort = 1005, Name = "Onyxia", ButtonName = "[40] Onyxia", @@ -1374,7 +1373,7 @@ LootReserve.Data = }, }, }), - [1010] = ShortCircuit(SEASON_NUMBER ~= SEASONS.DISCOVERY, { + [1010] = ShortCircuit(not IS_SOD, { Name = "Molten Core", ButtonName = "[40] Molten Core", NameShort = "MC", @@ -1585,7 +1584,7 @@ LootReserve.Data = }, }, }), - [1030] = ShortCircuit(SEASON_NUMBER ~= SEASONS.DISCOVERY, { + [1030] = ShortCircuit(not IS_SOD, { Name = "Blackwing Lair", ButtonName = "[40] Blackwing Lair", NameShort = "BWL", @@ -1726,7 +1725,7 @@ LootReserve.Data = }, }, }), - [1040] = ShortCircuit(EXPANSION_PHASE < 4.0 and SEASON_NUMBER ~= SEASONS.DISCOVERY, { + [1040] = ShortCircuit(EXPANSION_PHASE < 4.0 and not IS_SOD, { Name = "Zul'Gurub", ButtonName = "[20] Zul'Gurub", NameShort = "ZG", @@ -10404,7 +10403,7 @@ end -- Hidden Items do - if SEASON_NUMBER == SEASONS.DISCOVERY then + if IS_SOD then -- Gnomeregan items HideItem(213427); -- Grime-Encrusted Salvage @@ -10596,7 +10595,7 @@ end -- Class Restricted Items do - if SEASON_NUMBER == SEASONS.DISCOVERY then + if IS_SOD then ApplyClassRestriction(227728, 1091); -- Eye of Sulfuras end @@ -10616,7 +10615,7 @@ end do -- SoD items - if SEASON_NUMBER == SEASONS.DISCOVERY then + if IS_SOD then -- Blackfathom Deeps -- Perfect Blackfathom Pearl @@ -11372,7 +11371,7 @@ end if LootReserve:GetCurrentExpansion() == 0 then -- SoD items - if SEASON_NUMBER == SEASONS.DISCOVERY then + if IS_SOD then -- Blackfathom Deeps ApplySingleFactionRestriction(209574, "Alliance"); -- Discarded Tenets of the Silver Hand ApplySingleFactionRestriction(209575, "Horde"); -- Carved Driftwood Idol @@ -12078,7 +12077,7 @@ do }; local IntendedItems = LootReserve.Data.IntendedItems; - if SEASON_NUMBER == SEASONS.DISCOVERY then + if IS_SOD then for eraItem, sodItem in pairs(upgrades) do IntendedItems[eraItem] = sodItem; end diff --git a/LootReserve.lua b/LootReserve.lua index b09e98f..f18d7d4 100644 --- a/LootReserve.lua +++ b/LootReserve.lua @@ -97,12 +97,23 @@ function LootReserve:GetCurrentExpansion() return tonumber(expansion) - 1; end -function LootReserve:GetCurrentSeason() - return ((C_Seasons or {}).GetActiveSeason or nop)() or 0; -end - LootReserve.Version = GetAddOnMetadata(addon, "Version"); -LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, LootReserve:GetCurrentExpansion() == 0 and LootReserve:GetCurrentSeason() == 2 and "X-Min-Allowed-Version-SoD" or "X-Min-Allowed-Version-Era" or "X-Min-Allowed-Version-Classic"); +LootReserve.SeasonID = C_Seasons.GetActiveSeason(); +if LootReserve.SeasonID then + if LootReserve.SeasonID == Enum.SeasonID.SeasonOfDiscovery then + LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, "X-Min-Allowed-Version-SoD"); + elseif LootReserve.SeasonID == Enum.SeasonID.Fresh or Enum.SeasonID.FreshHardcore then + LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, "X-Min-Allowed-Version-Fresh"); + else + LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, "X-Min-Allowed-Version-Era"); + end +else + if LootReserve:GetCurrentExpansion() == 0 then + LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, "X-Min-Allowed-Version-Era"); + else + LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, "X-Min-Allowed-Version-Classic"); + end +end LootReserve.LatestKnownVersion = LootReserve.Version; @@ -472,7 +483,7 @@ function LootReserve:SendChatMessage(text, channel, target, skipOnlineCheck) end function LootReserve:IsCrossRealm() - return self:GetCurrentExpansion() == 0 and LootReserve:GetCurrentSeason() == 0; + return self:GetCurrentExpansion() == 0 and not LootReserve.SeasonID; -- This doesn't really work, because even in non-connected realms UnitFullName ends up returning your realm name, -- and we can't use UnitName either, because that one NEVER returns a realm for "player". WTB good API, 5g. --[[ @@ -820,7 +831,7 @@ function LootReserve:IsTradeableItem(bag, slot) end function LootReserve:ShouldScanKeyring() - return LootReserve:GetCurrentExpansion() < 3 and LootReserve:GetCurrentSeason() == 2 and _G.KeyRingButtonIDToInvSlotID and true or false; + return LootReserve:GetCurrentExpansion() < 3 and LootReserve.SeasonID == 2 and _G.KeyRingButtonIDToInvSlotID and true or false; end local function CacheBagSlot(self, bag, slot, i) diff --git a/LootReserve.toc b/LootReserve.toc index f7d39ba..283b80e 100644 --- a/LootReserve.toc +++ b/LootReserve.toc @@ -4,8 +4,9 @@ ## Version: 2024-11-12 ## X-Min-Allowed-Version-Classic: 2024-11-12 -## X-Min-Allowed-Version-Era: 2024-11-06 -## X-Min-Allowed-Version-SoD: 2024-11-12 +## X-Min-Allowed-Version-Fresh: 2024-11-06 +## X-Min-Allowed-Version-Era: 2024-11-06 +## X-Min-Allowed-Version-SoD: 2024-11-12 ## X-Curse-Project-ID: 390790 ## X-Wago-ID: WL6JpyGv