Pre-Update for new features
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user