Skip to content

Commit

Permalink
Use different minimum version in different expansions
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Mar 28, 2024
1 parent 13a9960 commit 3f70e3d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions LootReserve.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
local addon, ns = ...;

LootReserve = LibStub("AceAddon-3.0"):NewAddon("LootReserve", "AceComm-3.0");
LootReserve.Version = GetAddOnMetadata(addon, "Version");
LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, "X-Min-Allowed-Version");
LootReserve.LatestKnownVersion = LootReserve.Version;
LootReserve.Enabled = true;

LootReserve.EventFrame = CreateFrame("Frame", nil, UIParent);
Expand Down Expand Up @@ -81,6 +78,17 @@ function SlashCmdList.LOOTRESERVE(command)
end
end

function LootReserve:GetCurrentExpansion()
local version = GetBuildInfo();
local expansion, major, minor = strsplit(".", version);
return tonumber(expansion) - 1;
end

LootReserve.Version = GetAddOnMetadata(addon, "Version");
LootReserve.MinAllowedVersion = GetAddOnMetadata(addon, LootReserve:GetCurrentExpansion() == 0 and "X-Min-Allowed-Version-Era" or "X-Min-Allowed-Version-Classic");
LootReserve.LatestKnownVersion = LootReserve.Version;


local pendingToggleServerWindow = nil;
local pendingLockdownHooked = nil;
function LootReserve:ToggleServerWindow(state, rolls)
Expand Down Expand Up @@ -446,12 +454,6 @@ function LootReserve:SendChatMessage(text, channel, target)
end
end

function LootReserve:GetCurrentExpansion()
local version = GetBuildInfo();
local expansion, major, minor = strsplit(".", version);
return tonumber(expansion) - 1;
end

function LootReserve:IsCrossRealm()
return self:GetCurrentExpansion() == 0 and not C_Seasons.HasActiveSeason();
-- This doesn't really work, because even in non-connected realms UnitFullName ends up returning your realm name,
Expand Down

0 comments on commit 3f70e3d

Please sign in to comment.