From 10936adf714627097b0629629d053df98a2a72e7 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 3 Apr 2021 18:40:01 -0300 Subject: [PATCH] changes --- Details.toc | 1 + Libs/DF/DFPixelUtil.lua | 66 +++++++++++++++ Libs/DF/cooltip.lua | 2 + Libs/DF/fw.lua | 19 ++++- Libs/DF/load.xml | 1 + Libs/DF/panel.lua | 77 +++++++++++------ Libs/LibRaidStatus/LibRaidStatus.lua | 34 ++++++-- classes/class_damage.lua | 2 +- classes/container_actors.lua | 1 - core/gears.lua | 4 +- core/network.lua | 2 +- core/parser.lua | 83 +++++++++++++------ core/parser_timewalk.lua | 3 + core/plugins.lua | 3 +- frames/window_main.lua | 6 +- frames/window_playerbreakdown.lua | 7 +- frames/window_report.lua | 22 ++--- functions/autorun.lua | 2 +- functions/mythicdungeon.lua | 2 +- functions/profiles.lua | 2 +- functions/spellcache.lua | 66 ++++++++++++++- .../Details_EncounterDetails.lua | 2 +- .../Details_RaidCheck/Details_RaidCheck.lua | 2 +- plugins/Details_Vanguard/Details_Vanguard.lua | 2 +- startup.lua | 32 ++++--- 25 files changed, 344 insertions(+), 99 deletions(-) create mode 100644 Libs/DF/DFPixelUtil.lua create mode 100644 core/parser_timewalk.lua diff --git a/Details.toc b/Details.toc index db2e4884..841c2e4d 100644 --- a/Details.toc +++ b/Details.toc @@ -128,6 +128,7 @@ core\meta.lua core\network.lua core\parser.lua +#core\parser_timewalk.lua functions\loaddata.lua diff --git a/Libs/DF/DFPixelUtil.lua b/Libs/DF/DFPixelUtil.lua new file mode 100644 index 00000000..2ec40108 --- /dev/null +++ b/Libs/DF/DFPixelUtil.lua @@ -0,0 +1,66 @@ +DFPixelUtil = {}; + +function DFPixelUtil.GetPixelToUIUnitFactor() + local physicalWidth, physicalHeight = GetPhysicalScreenSize(); + return 768.0 / physicalHeight; +end + +function DFPixelUtil.GetNearestPixelSize(uiUnitSize, layoutScale, minPixels) + if uiUnitSize == 0 and (not minPixels or minPixels == 0) then + return 0; + end + + local uiUnitFactor = DFPixelUtil.GetPixelToUIUnitFactor(); + local numPixels = Round((uiUnitSize * layoutScale) / uiUnitFactor); + local rawNumPixels = numPixels; + if minPixels then + if uiUnitSize < 0.0 then + if numPixels > -minPixels then + numPixels = -minPixels; + end + else + if numPixels < minPixels then + numPixels = minPixels; + end + end + end + + return numPixels * uiUnitFactor / layoutScale; +end + +function DFPixelUtil.SetWidth(region, width, minPixels) + region:SetWidth(DFPixelUtil.GetNearestPixelSize(width, region:GetEffectiveScale(), minPixels)); +end + +function DFPixelUtil.SetHeight(region, height, minPixels) + region:SetHeight(DFPixelUtil.GetNearestPixelSize(height, region:GetEffectiveScale(), minPixels)); +end + +function DFPixelUtil.SetSize(region, width, height, minWidthPixels, minHeightPixels) + DFPixelUtil.SetWidth(region, width, minWidthPixels); + DFPixelUtil.SetHeight(region, height, minHeightPixels); +end + +function DFPixelUtil.SetPoint(region, point, relativeTo, relativePoint, offsetX, offsetY, minOffsetXPixels, minOffsetYPixels) + region:SetPoint(point, relativeTo, relativePoint, + DFPixelUtil.GetNearestPixelSize(offsetX, region:GetEffectiveScale(), minOffsetXPixels), + DFPixelUtil.GetNearestPixelSize(offsetY, region:GetEffectiveScale(), minOffsetYPixels) + ); +end + +function DFPixelUtil.SetStatusBarValue(statusBar, value) + local width = statusBar:GetWidth(); + if width and width > 0.0 then + local min, max = statusBar:GetMinMaxValues(); + local percent = ClampedPercentageBetween(value, min, max); + if percent == 0.0 or percent == 1.0 then + statusBar:SetValue(value); + else + local numPixels = DFPixelUtil.GetNearestPixelSize(statusBar:GetWidth() * percent, statusBar:GetEffectiveScale()); + local roundedValue = Lerp(min, max, numPixels / width); + statusBar:SetValue(roundedValue); + end + else + statusBar:SetValue(value); + end +end \ No newline at end of file diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 28952c02..d3b49b03 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -22,6 +22,8 @@ local _GetScreenHeight = GetScreenHeight local _UIParent = UIParent local _CreateFrame = CreateFrame +local PixelUtil = PixelUtil or DFPixelUtil + local version = 2 function DF:CreateCoolTip() diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 4a1228ad..389d5ce3 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 238 +local dversion = 241 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -35,10 +35,11 @@ DF.AuthorInfo = { Discord = "https://discord.gg/AGSzAZX", } +local PixelUtil = PixelUtil or DFPixelUtil if (not PixelUtil) then - --check if is in classic wow, if it is, build a replacement for PixelUtil + --check if is in classic or TBC wow, if it is, build a replacement for PixelUtil local gameVersion = GetBuildInfo() - if (gameVersion:match("%d") == "1") then + if (gameVersion:match("%d") == "1" or gameVersion:match("%d") == "2") then PixelUtil = { SetWidth = function (self, width) self:SetWidth (width) end, SetHeight = function (self, height) self:SetHeight (height) end, @@ -48,6 +49,10 @@ if (not PixelUtil) then end end +function DF.IsTimewalkWoW() + return DF.IsClassicWow() or DF.IsTBCWow() +end + function DF.IsClassicWow() local gameVersion = GetBuildInfo() if (gameVersion:match ("%d") == "1") then @@ -56,6 +61,14 @@ function DF.IsClassicWow() return false end +function DF.IsTBCWow() + local gameVersion = GetBuildInfo() + if (gameVersion:match ("%d") == "2") then + return true + end + return false +end + function DF.UnitGroupRolesAssigned (unitId) if (UnitGroupRolesAssigned) then return UnitGroupRolesAssigned (unitId) diff --git a/Libs/DF/load.xml b/Libs/DF/load.xml index 0097e76d..49f07656 100644 --- a/Libs/DF/load.xml +++ b/Libs/DF/load.xml @@ -1,5 +1,6 @@ +