Cleanup GetBuildInfo since we dont need to check versions.

This commit is contained in:
andrew6180
2024-05-21 02:06:53 -07:00
parent 60c4c0c1c1
commit c89fc78cec
11 changed files with 38 additions and 179 deletions
+30 -81
View File
@@ -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
-13
View File
@@ -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
+2 -14
View File
@@ -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
-2
View File
@@ -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
-3
View File
@@ -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
@@ -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)
@@ -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()
@@ -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)
@@ -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)
@@ -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 = {
-4
View File
@@ -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()