Pre-Update for new features

This commit is contained in:
Tercio Jose
2023-02-07 13:46:35 -03:00
parent 133b0794db
commit 7cd1839f82
9 changed files with 144 additions and 104 deletions
+21 -4
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 13
local version = 14
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -1649,8 +1649,8 @@ function DF:CreateCoolTip()
frame2:EnableMouse(false)
--width
if (gameCooltip.OptionsTable.FixedWidth) then
frame2:SetWidth(gameCooltip.OptionsTable.FixedWidth)
if (gameCooltip.OptionsTable.FixedWidthSub) then
frame2:SetWidth(gameCooltip.OptionsTable.FixedWidthSub)
end
frame2.w = gameCooltip.OptionsTable.FixedWidth or 0
@@ -1731,7 +1731,7 @@ function DF:CreateCoolTip()
menuButton:EnableMouse(false)
end
if (not gameCooltip.OptionsTable.FixedWidth) then
if (not gameCooltip.OptionsTable.FixedWidthSub) then
if (gameCooltip.Type == 2) then --with bars
if (gameCooltip.OptionsTable.MinWidth) then
local width = frame2.w + 34
@@ -1787,6 +1787,23 @@ function DF:CreateCoolTip()
gameCooltip:RefreshSpark(menuButton)
end
end
--hole in the code: the sub-tooltip point should be handled by the sabe function that handle the sub-menu point
local frame2CenterX = frame2:GetCenter()
if (frame2CenterX) then
local frame2HalfWidth = frame2:GetWidth() / 2
local frame1CenterX = frame1:GetCenter()
if (frame1CenterX) then
local frame1HalfWidth = frame1:GetWidth() / 2
local frame1EndPoint = frame1CenterX + frame1HalfWidth - 3
local frame2StartPoint = frame2CenterX - frame2HalfWidth
if (frame2StartPoint < frame1EndPoint) then
frame2:ClearAllPoints()
frame2:SetPoint("bottomright", frame1, "bottomleft", -4, 0)
end
end
end
end
--~inicio ~start ~tooltip
-1
View File
@@ -7316,7 +7316,6 @@ detailsFramework.StatusBarFunctions = {
self:UpdateHealPrediction()
end
-- ~healthbar
function detailsFramework:CreateHealthBar (parent, name, settingsOverride)
+11 -2
View File
@@ -301,20 +301,29 @@ end
--return an integer between zero and one hundret indicating the player gear durability
function openRaidLib.GearManager.GetPlayerGearDurability()
local durabilityTotalPercent, totalItems = 0, 0
--hold the lowest item durability of all the player gear
--this prevent the case where the player has an average of 80% durability but an item with 15% durability
local lowestGearDurability = 100
for i = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do
local durability, maxDurability = GetInventoryItemDurability(i)
if (durability and maxDurability) then
local itemDurability = durability / maxDurability * 100
if (itemDurability < lowestGearDurability) then
lowestGearDurability = itemDurability
end
durabilityTotalPercent = durabilityTotalPercent + itemDurability
totalItems = totalItems + 1
end
end
if (totalItems == 0) then
return 100
return 100, lowestGearDurability
end
return floor(durabilityTotalPercent / totalItems)
return floor(durabilityTotalPercent / totalItems), lowestGearDurability
end
function openRaidLib.GearManager.GetPlayerWeaponEnchant()
+16 -7
View File
@@ -1555,9 +1555,9 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI
--send only the gear durability
function openRaidLib.GearManager.SendDurability()
local dataToSend = "" .. CONST_COMM_GEARINFO_DURABILITY_PREFIX .. ","
local playerGearDurability = openRaidLib.GearManager.GetPlayerGearDurability()
local averageGearDurability, lowestDurability = openRaidLib.GearManager.GetPlayerGearDurability()
dataToSend = dataToSend .. playerGearDurability
dataToSend = dataToSend .. averageGearDurability
--send the data
openRaidLib.commHandler.SendCommData(dataToSend)
@@ -1937,13 +1937,22 @@ end
return calculatePercent(timeOffset, duration, updateTime, charges)
end
--return the values to be use on a progress bar or cooldown frame
--require the cooldownInfo table
--values returned: isReady, timeLeft, charges, normalized percent, minValue, maxValue, currentValue
--values are in the GetTime() format
--GetPercentFromCooldownInfo
---return the values to be use on a progress bar or cooldown frame
---values returned: bIsReady, percent, timeLeft, charges, minValue, maxValue, currentValue, duration
---@param cooldownInfo table
---@return boolean bIsReady
---@return number percent
---@return number timeLeft
---@return number charges
---@return number minValue
---@return number maxValue
---@return number currentValue
---@return number duration
function openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
local timeLeft, charges, timeOffset, duration, updateTime, auraDuration = openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo)
if (not timeOffset) then
return false, 0, 0, 0, 0, 0, 0, 0
end
return calculatePercent(timeOffset, duration, updateTime, charges)
end