From c89fc78cec3c7a443884a89b5f06565c88ae1518 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Tue, 21 May 2024 02:06:53 -0700 Subject: [PATCH] Cleanup GetBuildInfo since we dont need to check versions. --- Libs/DF/panel.lua | 111 +++++------------- Libs/LibOpenRaid/LibOpenRaid.lua | 13 -- boot.lua | 16 +-- functions/classes.lua | 2 - functions/profiles.lua | 3 - .../Details_EncounterDetails.lua | 4 - .../Details_RaidCheck/Details_RaidCheck.lua | 48 +------- plugins/Details_Streamer/Details_Streamer.lua | 7 +- .../Details_TinyThreat/Details_TinyThreat.lua | 5 - plugins/Details_Vanguard/Details_Vanguard.lua | 4 - startup.lua | 4 - 11 files changed, 38 insertions(+), 179 deletions(-) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 69433728..5d318bde 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -16,7 +16,7 @@ local loadstring = loadstring --lua local local CreateFrame = CreateFrame -- TWW compatibility: -local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end +local GetSpellInfo = GetSpellInfo local GetNumSpellTabs = GetNumSpellTabs local GetSpellTabInfo = GetSpellTabInfo local GetSpellBookItemInfo = GetSpellBookItemInfo @@ -1479,92 +1479,41 @@ end ------------color pick -local _, _, _, toc = GetBuildInfo() -if ((ColorPickerFrame and ColorPickerFrame.SetupColorPickerAndShow) or toc >= 100205) then -- maybe fallback to only check CPF in the future - local color_pick_func = function(...) - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = ColorPickerFrame:GetColorAlpha() - ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe) - end +local color_pick_func = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + a = math.abs(a - 1) + ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe) +end +local color_pick_func_cancel = function() + ColorPickerFrame:SetColorRGB (unpack(ColorPickerFrame.previousValues)) + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + a = math.abs(a - 1) + ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe) +end - local color_pick_func_cancel = function() - local r, g, b, a = ColorPickerFrame.previousValues.r, ColorPickerFrame.previousValues.g, ColorPickerFrame.previousValues.b, ColorPickerFrame.previousValues.a - ColorPickerFrame.Content.ColorPicker:SetColorRGB(r, g, b) - ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe) - end +function detailsFramework:ColorPick (frame, r, g, b, alpha, callback) - function detailsFramework:ColorPick(frame, r, g, b, alpha, callback) + ColorPickerFrame:ClearAllPoints() + ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0) - ColorPickerFrame:ClearAllPoints() - ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0) + ColorPickerFrame.dcallback = callback + ColorPickerFrame.dframe = frame - ColorPickerFrame.dcallback = callback - ColorPickerFrame.dframe = frame + ColorPickerFrame.func = color_pick_func + ColorPickerFrame.opacityFunc = color_pick_func + ColorPickerFrame.cancelFunc = color_pick_func_cancel - ColorPickerFrame.func = color_pick_func - ColorPickerFrame.opacityFunc = color_pick_func - ColorPickerFrame.cancelFunc = color_pick_func_cancel + alpha = math.abs(alpha - 1) + ColorPickerFrame.opacity = alpha + ColorPickerFrame.hasOpacity = alpha and true - ColorPickerFrame.opacity = alpha - ColorPickerFrame.hasOpacity = alpha and true - - ColorPickerFrame.previousValues = {r, g, b} - ColorPickerFrame.previousAlpha = alpha - ColorPickerFrame:SetParent(UIParent) - ColorPickerFrame:SetFrameStrata("tooltip") - - local info = { - swatchFunc = color_pick_func, - hasOpacity = alpha and true, - opacityFunc = color_pick_func, - opacity = alpha, - previousValues = {r = r, g = g, b = b, a = alpha}, - cancelFunc = color_pick_func_cancel, - r = r, - g = g, - b = b, - } - --OpenColorPicker(info) - ColorPickerFrame:SetupColorPickerAndShow(info) - - end -else - local color_pick_func = function() - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = OpacitySliderFrame:GetValue() - a = math.abs(a - 1) - ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe) - end - local color_pick_func_cancel = function() - ColorPickerFrame:SetColorRGB (unpack(ColorPickerFrame.previousValues)) - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = OpacitySliderFrame:GetValue() - a = math.abs(a - 1) - ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe) - end - - function detailsFramework:ColorPick (frame, r, g, b, alpha, callback) - - ColorPickerFrame:ClearAllPoints() - ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0) - - ColorPickerFrame.dcallback = callback - ColorPickerFrame.dframe = frame - - ColorPickerFrame.func = color_pick_func - ColorPickerFrame.opacityFunc = color_pick_func - ColorPickerFrame.cancelFunc = color_pick_func_cancel - - alpha = math.abs(alpha - 1) - ColorPickerFrame.opacity = alpha - ColorPickerFrame.hasOpacity = alpha and true - - ColorPickerFrame.previousValues = {r, g, b} - ColorPickerFrame:SetParent(UIParent) - ColorPickerFrame:SetFrameStrata("tooltip") - ColorPickerFrame:SetColorRGB (r, g, b) - ColorPickerFrame:Show() - end + ColorPickerFrame.previousValues = {r, g, b} + ColorPickerFrame:SetParent(UIParent) + ColorPickerFrame:SetFrameStrata("tooltip") + ColorPickerFrame:SetColorRGB (r, g, b) + ColorPickerFrame:Show() end diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index eec1662e..6d5a47c7 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -29,19 +29,6 @@ BUGS: LIB_OPEN_RAID_CAN_LOAD = false -local versionString, revision, launchDate, gameVersion = GetBuildInfo() - -local isExpansion_Dragonflight = function() - if (gameVersion >= 100000) then - return true - end -end - ---don't load if it's not retail, emergencial patch due to classic and bcc stuff not transposed yet -if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) then - return -end - local major = "LibOpenRaid-1.0" local CONST_LIB_VERSION = 127 diff --git a/boot.lua b/boot.lua index 482c9123..fd4cd0ea 100644 --- a/boot.lua +++ b/boot.lua @@ -16,7 +16,7 @@ end local addonName, Details222 = ... - local version, build, date, tocversion = GetBuildInfo() + local version = GetBuildInfo() Details.build_counter = 12755 Details.alpha_build_counter = 12755 --if this is higher than the regular counter, use it instead @@ -40,7 +40,7 @@ Details = Details - local gameVersionPrefix = "VWD" --vanilla, wrath, dragonflight + local gameVersionPrefix = "ASC" Details.gameVersionPrefix = gameVersionPrefix @@ -1420,18 +1420,6 @@ do --]=] end -if (select(4, GetBuildInfo()) >= 100000) then - local f = CreateFrame("frame") - f:RegisterEvent("ADDON_ACTION_FORBIDDEN") - f:SetScript("OnEvent", function() - local text = StaticPopup1 and StaticPopup1.text and StaticPopup1.text:GetText() - if (text and text:find("Details")) then - --fix false-positive taints that are being attributed to random addons - StaticPopup1.button2:Click() - end - end) -end - local classCacheName = Details222.ClassCache.ByName local classCacheGUID = Details222.ClassCache.ByGUID diff --git a/functions/classes.lua b/functions/classes.lua index 0d53b3f2..685f226d 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -197,8 +197,6 @@ do end end - local _, _, _, toc = GetBuildInfo() --check game version to know which version of GetFullName to use - ---return the class file name of the unit passed local getFromCache = Details222.ClassCache.GetClassFromCache local Ambiguate = Ambiguate diff --git a/functions/profiles.lua b/functions/profiles.lua index bc1d02dc..8f5535f7 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -481,9 +481,6 @@ function Details:ApplyProfile(profileName, bNoSave, bIsCopy) --refresh broadcaster tools Details:LoadFramesForBroadcastTools() - --change the rogue spec combat icon to outlaw depending on the game version - Details:HandleRogueCombatSpecIconByGameVersion() - if (Details.initializing) then Details.profile_loaded = true end diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua index 66f13d3e..98f5ff79 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua @@ -828,10 +828,6 @@ end local installPluginFunc = function() if (Details and Details.InstallOkey and Details:InstallOkey()) then - if (DetailsFramework.IsClassicWow()) then - return - end - --create widgets CreatePluginFrames(data) diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.lua b/plugins/Details_RaidCheck/Details_RaidCheck.lua index 5b923b8c..a263b645 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.lua +++ b/plugins/Details_RaidCheck/Details_RaidCheck.lua @@ -1,9 +1,3 @@ - ---do not load if this is a classic version of the game -if (DetailsFramework.IsTBCWow() or DetailsFramework.IsWotLKWow() or DetailsFramework.IsClassicWow() or DetailsFramework.IsCataWow()) then - return -end - local UnitAura = UnitAura local UnitBuff = UnitBuff local GetSpellInfo = GetSpellInfo @@ -26,13 +20,7 @@ local runeIds = DF.RuneIDs local isDrinking = 257428 local localizedFoodDrink -local foodList = { --list for previous dragonflight expsansions - tier1 = {}, - tier2 = {}, - tier3 = {}, -} - -local foodInfoList = {} --list for dragonflight and beyond +local foodInfoList = {} local getUnitId = function(i) local unitId @@ -54,16 +42,9 @@ local getUnitId = function(i) return unitId end -local gameVersion, buildNumber, releaseData, tocNumber = GetBuildInfo() - local getCleuName = function(unitId) - if (tocNumber >= 100200) then - local cleuName = Details:GetFullName(unitId) - return cleuName - else - local cleuName = GetCLName(unitId) - return cleuName - end + local cleuName = Details:GetFullName(unitId) + return cleuName end --create the plugin object @@ -73,23 +54,8 @@ DetailsRaidCheck:SetPluginDescription(Loc ["STRING_RAIDCHECK_PLUGIN_DESC"]) local CreatePluginFrames = function() --build food tier list - if (DF.IsDragonflightAndBeyond()) then - --{tier = {[220] = 1}, status = {"haste"}, localized = {STAT_HASTE}} - for spellId, foodInfo in pairs(LIB_OPEN_RAID_FOOD_BUFF) do - foodInfoList[spellId] = foodInfo - end - else - for spellId, tier in pairs(LIB_OPEN_RAID_FOOD_BUFF) do - if (tier == 1) then - foodList.tier1[spellId] = true - - elseif (tier == 2) then - foodList.tier2[spellId] = true - - elseif (tier == 3) then - foodList.tier3[spellId] = true - end - end + for spellId, foodInfo in pairs(LIB_OPEN_RAID_FOOD_BUFF) do + foodInfoList[spellId] = foodInfo end DetailsRaidCheck.GetOnlyName = DetailsRaidCheck.GetOnlyName @@ -982,10 +948,6 @@ function DetailsRaidCheck:OnEvent(_, event, ...) local AddonName = select(1, ...) if (AddonName == "Details_RaidCheck") then if (_G.Details) then - if (DetailsFramework.IsClassicWow()) then - return - end - --create widgets CreatePluginFrames() diff --git a/plugins/Details_Streamer/Details_Streamer.lua b/plugins/Details_Streamer/Details_Streamer.lua index babdec3d..26f9eb87 100644 --- a/plugins/Details_Streamer/Details_Streamer.lua +++ b/plugins/Details_Streamer/Details_Streamer.lua @@ -2349,18 +2349,13 @@ end function StreamOverlay:OnEvent (_, event, ...) - --if (DetailsFramework and DetailsFramework.IsClassicWow()) then - -- return - --end if (event == "ADDON_LOADED") then local AddonName = select (1, ...) if (AddonName == "Details_Streamer") then local interimPlayerName, playerRealm = UnitFullName ("player") - --if(select(4, GetBuildInfo()) >= 100200) then - playerName = interimPlayerName .. '-' .. playerRealm --playerName is an upvalue from the file header - --end + playerName = interimPlayerName .. '-' .. playerRealm --playerName is an upvalue from the file header playerName = _G.Details:Ambiguate(playerName) diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index c097ad24..4fff003b 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -856,11 +856,6 @@ function ThreatMeter:OnEvent (_, event, ...) if (AddonName == "Details_TinyThreat") then if (_G.Details) then - - if (DetailsFramework.IsClassicWow()) then - --return - end - --> create widgets CreatePluginFrames (data) diff --git a/plugins/Details_Vanguard/Details_Vanguard.lua b/plugins/Details_Vanguard/Details_Vanguard.lua index 5ad5a101..0f5c7d1f 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.lua +++ b/plugins/Details_Vanguard/Details_Vanguard.lua @@ -1099,10 +1099,6 @@ function Vanguard:OnEvent (_, event, arg1, token, time, who_serial, who_name, wh if (AddonName == "Details_Vanguard") then if (_G.Details) then - - if (DetailsFramework.IsClassicWow()) then - return - end local MINIMAL_DETAILS_VERSION_REQUIRED = 1 local default_saved_table = { diff --git a/startup.lua b/startup.lua index 7fa31cdd..9403ff0b 100644 --- a/startup.lua +++ b/startup.lua @@ -599,10 +599,6 @@ function Details:StartMeUp() if (DetailsFramework:IsNearlyEqual(Details.class_coords.ROGUE[4], 0.375)) then DetailsFramework.table.copy(Details.class_coords, Details.default_profile.class_coords) end - - --shutdown the old OnDeathMenu - --cleanup: this line can be removed after the first month of dragonflight - Details.on_death_menu = false end Details.AddOnLoadFilesTime = _G.GetTime() \ No newline at end of file