Skip to content

Commit

Permalink
Support fresh realms
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Nov 28, 2024
1 parent 0b7d23c commit 1ebf3d1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
49 changes: 24 additions & 25 deletions Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -220,7 +219,7 @@ LootReserve.Data =
},
},
}),
[920] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, {
[920] = ShortCircuit(IS_SOD, {
Name = "Gnomeregan",
ButtonName = "[10] Gnomeregan",
NameShort = "Gnomer",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -554,7 +553,7 @@ LootReserve.Data =
},
}),

[938] = ShortCircuit(SEASON_NUMBER == SEASONS.DISCOVERY, {
[938] = ShortCircuit(IS_SOD, {
Name = "Onyxia",
ButtonName = "[20] Onyxia",
NameShort = "Ony",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -10616,7 +10615,7 @@ end
do

-- SoD items
if SEASON_NUMBER == SEASONS.DISCOVERY then
if IS_SOD then
-- Blackfathom Deeps

-- Perfect Blackfathom Pearl
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 18 additions & 7 deletions LootReserve.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -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.
--[[
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions LootReserve.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ebf3d1

Please sign in to comment.