Skip to content

Commit

Permalink
Classic: The format of the RWP and AWP fields is now consistent with …
Browse files Browse the repository at this point in the history
…the way it was, please stop sending me DMs about it. lol
  • Loading branch information
DFortun81 committed Mar 3, 2024
1 parent 04471a2 commit aa08999
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
5 changes: 4 additions & 1 deletion locales/Default Locale.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ L.SETTINGS_MENU = {
-- Interface: Information Page
ACHIEVEMENT_ID = "Achievement ID";
ACHIEVEMENT_CATEGORY_ID = "Achievement Category ID";

ADDED_WITH_PATCH_CLASSIC_FORMAT = "This gets added with patch %s";
READDED_WITH_PATCH_CLASSIC_FORMAT = "This gets readded with patch %s";
REMOVED_WITH_PATCH_CLASSIC_FORMAT = "This gets removed with patch %s";
WAS_ADDED_WITH_PATCH_CLASSIC_FORMAT = "This was added with patch %s";

-- Features Page
FEATURES_PAGE = FEATURES_LABEL;
Expand Down
5 changes: 2 additions & 3 deletions src/Settings/Classic Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ settings.Collectibles = {
Quests = true,
Recipes = true,
Reputations = true,
RWP = true,
Titles = true,
Toys = true,
Transmog = true,
Expand All @@ -58,7 +57,7 @@ settings.RequiredForInsaneMode = {
Reputations = true,
Titles = true,
Toys = true,
Transmog = true,
Transmog = app.GameBuildVersion >= 40000,
}

-- Settings Class
Expand Down Expand Up @@ -125,7 +124,7 @@ local GeneralSettingsBase = {
["Thing:Reputations"] = true,
["Thing:Titles"] = true,
["Thing:Toys"] = true,
["Thing:Transmog"] = true,
["Thing:Transmog"] = app.GameBuildVersion >= 40000,
["Only:RWP"] = app.GameBuildVersion < 40000,
["Skip:AutoRefresh"] = false,
["Show:CompletedGroups"] = false,
Expand Down
33 changes: 27 additions & 6 deletions src/Settings/Pages/Interface - Information.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ end
local function GetCoordString(x, y)
return GetNumberWithZeros(math_floor(x * 10) * 0.1, 1) .. ", " .. GetNumberWithZeros(math_floor(y * 10) * 0.1, 1);
end
local function GetPatchString(patch, color)
local function GetPatchString(patch)
patch = tonumber(patch)
return patch and Colorize(math_floor(patch / 10000) .. "." .. (math_floor(patch / 100) % 10) .. "." .. (patch % 10), color)
return patch and (math_floor(patch / 10000) .. "." .. (math_floor(patch / 100) % 10) .. "." .. (patch % 10))
end
local DefaultConversionMethod = function(value)
return value;
Expand All @@ -47,8 +47,8 @@ local ConversionMethods = setmetatable({
end
return questID
end,
awp = function(val) return GetPatchString(val, app.Colors.AddedWithPatch) end,
rwp = function(val) return GetPatchString(val, app.Colors.RemovedWithPatch) end,
awp = function(val) return Colorize(GetPatchString(val), app.Colors.AddedWithPatch) end,
rwp = function(val) return Colorize(GetPatchString(val), app.Colors.RemovedWithPatch) end,
spellID = function(spellID, reference)
if app.Settings:GetTooltipSetting("spellName") then
return tostring(spellID) .. " (" .. (app.GetSpellName(spellID, reference.rank) or "??") .. ")";
Expand Down Expand Up @@ -523,8 +523,29 @@ local InformationTypes = {
});

-- Regular fields (sorted by priority for clarity of how it will appear in the tooltip)
CreateInformationType("awp", { text = L.ADDED_WITH_PATCH, isRecursive = true, priority = 3 }),
CreateInformationType("rwp", { text = L.REMOVED_WITH_PATCH, isRecursive = true, priority = 3 }),
CreateInformationType("awp", { text = L.ADDED_WITH_PATCH, isRecursive = true, priority = 3,
Process = app.IsRetail and ProcessInformationType or function(t, reference, tooltipInfo)
local awp = t.GetValue(t, reference);
if awp then
local formatter = L.WAS_ADDED_WITH_PATCH_CLASSIC_FORMAT;
if awp >= app.GameBuildVersion then
-- Current build is before the awp.
local rwp = reference.rwp;
formatter = (rwp and rwp < awp and L.READDED_WITH_PATCH_CLASSIC_FORMAT) or L.ADDED_WITH_PATCH_CLASSIC_FORMAT;
end
tinsert(tooltipInfo, { left = Colorize(formatter:format(GetPatchString(awp)), app.Colors.AddedWithPatch)});
end
end,
}),
CreateInformationType("rwp", { text = L.REMOVED_WITH_PATCH, isRecursive = true, priority = 3,
-- CRIEVE NOTE: Recursive is actually not true, some items get new sources later. The distinction for pre-Cata being non-recursive might be necessary, but since we're overriding the process function it should be fine this way.
Process = app.IsRetail and ProcessInformationType or function(t, reference, tooltipInfo)
local rwp = reference.rwp; -- NOTE: For Retail, namely pre-Cata, this can't be recursive!
if rwp then
tinsert(tooltipInfo, { left = Colorize(L.REMOVED_WITH_PATCH_CLASSIC_FORMAT:format(GetPatchString(rwp)), app.Colors.RemovedWithPatch)});
end
end,
}),
CreateInformationType("filterID", { text = L.FILTER_ID, priority = 4,
Process = function(t, reference, tooltipInfo)
local f = reference.filterID or reference.f;
Expand Down

0 comments on commit aa08999

Please sign in to comment.