Polishing the segments menu

This commit is contained in:
Tercio Jose
2024-03-02 21:52:58 -03:00
parent 8ab122bf4f
commit ca192bb646
12 changed files with 376 additions and 94 deletions
+26 -13
View File
@@ -63,6 +63,25 @@
end
local currentCombat = Details:GetCurrentCombat()
local playerActorObject = currentCombat:GetActor(DETAILS_ATTRIBUTE_DAMAGE, Details.playername)
if (playerActorObject) then
local targets = playerActorObject.targets
--make an array of targets {{targetName, amount}}
local targetsArray = {}
for targetName, amount in pairs(targets) do
table.insert(targetsArray, {targetName, amount})
end
--sort the array by amount
table.sort(targetsArray, Details.Sort2)
local targetName = targetsArray[1][1]
if (targetName) then
return targetName
end
end
for _, actor in ipairs(currentCombat[attributeDamage]._ActorTable) do
if (not actor.grupo and not actor.owner and not actor.nome:find("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction
@@ -526,17 +545,12 @@
end
end
Details:OnCombatPhaseChanged()
if (currentCombat.bossFunction) then
Details:CancelTimer(currentCombat.bossFunction)
currentCombat.bossFunction = nil
end
if (currentCombat.is_challenge or Details.debug) then
--Details222.AuraScan.Stop() --combat ended (m+ active)
end
Details:OnCombatPhaseChanged()
--stop combat ticker
Details:StopCombatTicker()
@@ -548,7 +562,6 @@
Details:CloseShields(currentCombat)
end
--salva hora, minuto, segundo do fim da luta
local bSetStartTime = false
local bSetEndTime = true
currentCombat:SetDateToNow(bSetStartTime, bSetEndTime)
@@ -632,7 +645,7 @@
currentCombat.enemy = "[" .. ARENA .. "] " .. currentCombat.is_arena.name
end
--check if the player is in a instance
--check if the player is in an instance
local bInInstance = IsInInstance() --garrison returns party as instance type.
if ((instanceType == "party" or instanceType == "raid") and bInInstance) then
--if is not boss and inside a instance of type party or raid: mark the combat as trash
@@ -647,12 +660,12 @@
end
end
if (not currentCombat.enemy) then
local enemy = Details:FindEnemy()
currentCombat.enemy = enemy
if (not currentCombat.enemy or currentCombat.enemy == Details222.Unknown) then
local enemyName = currentCombat:FindEnemyName()
currentCombat.enemy = enemyName
end
Details:FlagActorsOnCommonFight() --fight_component
Details:FlagActorsOnCommonFight()
else
--combat is boss encounter
--calling here without checking for combat since the does not ran too long for scripts
+7 -6
View File
@@ -1,4 +1,5 @@
---@type details
local Details = _G.Details
local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" )
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
@@ -625,15 +626,15 @@ do
--still a little buggy, working on
function Details:PluginDpsUpdate(child)
--showing is the combat table which is current shown on instance
if (child.instance.showing and not child.instance.showing.__destroyed) then
if (child.instance:GetCombat() and not child.instance:GetCombat().__destroyed) then
--GetCombatTime() return the time length of combat
local combatTime = child.instance.showing:GetCombatTime()
local combatTime = child.instance:GetCombat():GetCombatTime()
if (combatTime < 1) then
return child.text:SetText("0")
end
--GetTotal(attribute, sub attribute, onlyGroup) return the total of requested attribute
local total = child.instance.showing:GetTotal(child.instance.atributo, child.instance.sub_atributo, true)
local total = child.instance:GetCombat():GetTotal(child.instance.atributo, child.instance.sub_atributo, true)
local dps = math.floor(total / combatTime)
@@ -711,7 +712,7 @@ do
if (child.enabled and child.instance:IsEnabled()) then
child.options.segmentType = child.options.segmentType or 2
if (not child.instance.showing) then
if (not child.instance:GetCombat()) then
return child.text:SetText(Loc ["STRING_EMPTY_SEGMENT"])
end
@@ -722,7 +723,7 @@ do
if (child.options.segmentType == 1) then
child.text:SetText(Loc ["STRING_CURRENT"])
else
local combatName = Details.tabela_vigente:GetCombatName(false, true)
local combatName = Details:GetCurrentCombat():GetCombatName(false, true)
if (combatName and combatName ~= Loc ["STRING_UNKNOW"]) then
if (child.options.segmentType == 2) then
@@ -746,7 +747,7 @@ do
child.text:SetText(Loc ["STRING_FIGHTNUMBER"] .. child.instance:GetSegmentId())
else
local combatName = child.instance.showing:GetCombatName(false, true)
local combatName = child.instance:GetCombat():GetCombatName(false, true)
if (combatName ~= Loc ["STRING_UNKNOW"]) then
if (child.options.segmentType == 2) then
child.text:SetText(combatName)
+7
View File
@@ -1251,6 +1251,13 @@ end
Details:BrokerTick()
Details:HealthTick()
local currentCombat = Details:GetCurrentCombat()
if (Details.encounter_table.start and not Details.encounter_table["end"] and currentCombat.is_boss) then
local encounterHealth = UnitHealth("boss1") or 0
local encounterMaxHealth = UnitHealthMax("boss1") or 1
currentCombat.boss_hp = encounterHealth / encounterMaxHealth
end
local zoneName, zoneType = GetInstanceInfo()
if (Details.Coach.Server.IsEnabled()) then