Testing Coach Deaths

This commit is contained in:
Tercio Jose
2020-12-17 18:30:56 -03:00
parent da6972d1c1
commit 3842c0a9f6
5 changed files with 53 additions and 19 deletions
+1
View File
@@ -486,6 +486,7 @@ function DF:GroupIterator (func, ...)
for i = 1, GetNumGroupMembers() - 1 do
DF:QuickDispatch (func, "party" .. i, ...)
end
DF:QuickDispatch (func, "player", ...)
else
DF:QuickDispatch (func, "player", ...)
+14 -1
View File
@@ -444,7 +444,20 @@
if (UnitIsGroupLeader("player")) then
if (Details.Coach.Server.IsEnabled()) then
--update the current combat with new information
Details.packFunctions.DeployPackedCombatData(data)
--this is disabled due to lack of testing
--Details.packFunctions.DeployPackedCombatData(data)
end
end
elseif (msgType == "CDD") then --Coach Death (a player in the raid sent to raid leader his death log)
if (UnitIsGroupLeader("player")) then
if (Details.Coach.Server.IsEnabled()) then
local currentCombat = Details:GetCurrentCombat()
tinsert(currentCombat.last_events_tables, data)
--tag the misc container as need refresh
currentCombat[DETAILS_ATTRIBUTE_MISC].need_refresh = true
end
end
end
+14 -16
View File
@@ -3878,21 +3878,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
if (_hook_deaths) then
--> send event to registred functions
local death_at = _GetTime() - _current_combat:GetStartTime()
local max_health = _UnitHealthMax (alvo_name)
for _, func in _ipairs (_hook_deaths_container) do
local new_death_table = table_deepcopy (esta_morte)
local successful, errortext = pcall (func, nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, new_death_table, este_jogador.last_cooldown, death_at, max_health)
if (not successful) then
_detalhes:Msg ("error occurred on a death hook function:", errortext)
end
--func (nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, new_death_table, este_jogador.last_cooldown, death_at, max_health)
end
end
--if (_detalhes.deadlog_limit and #esta_morte > _detalhes.deadlog_limit) then
-- while (#esta_morte > _detalhes.deadlog_limit) do
-- _table_remove (esta_morte, 1)
@@ -3923,9 +3908,22 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local minutos, segundos = _math_floor (decorrido/60), _math_floor (decorrido%60)
local t = {esta_morte, time, este_jogador.nome, este_jogador.classe, _UnitHealthMax (alvo_name), minutos.."m "..segundos.."s", ["dead"] = true, ["last_cooldown"] = este_jogador.last_cooldown, ["dead_at"] = decorrido}
_table_insert (_current_combat.last_events_tables, #_current_combat.last_events_tables+1, t)
if (_hook_deaths) then
--> send event to registred functions
local death_at = _GetTime() - _current_combat:GetStartTime()
local max_health = _UnitHealthMax (alvo_name)
for _, func in _ipairs (_hook_deaths_container) do
local copiedDeathTable = table_deepcopy(t)
local successful, errortext = pcall(func, nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, copiedDeathTable, este_jogador.last_cooldown, death_at, max_health)
if (not successful) then
_detalhes:Msg ("error occurred on a death hook function:", errortext)
end
end
end
--> check if this is a mythic+ run
local mythicLevel = C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo() --classic wow doesn't not have C_ChallengeMode API
if (mythicLevel and type (mythicLevel) == "number" and mythicLevel >= 2) then --several checks to be future proof
+2 -1
View File
@@ -173,7 +173,7 @@ function Details.CooldownTracking.RefreshScreenPanel()
local classColor = C_ClassColor.GetClassColor(cooldownTable[6])
bar:SetStatusBarColor(classColor.r, classColor.g, classColor.b)
local _, _, spellIcon = GetSpellInfo(cooldownTable[5])
local spellNameDebug, _, spellIcon = GetSpellInfo(cooldownTable[5])
bar:SetIcon(spellIcon, .1, .9, .1, .9)
bar:SetLeftText(DF:RemoveRealmName(cooldownTable[1]))
@@ -181,6 +181,7 @@ function Details.CooldownTracking.RefreshScreenPanel()
if (timeLeft > 0) then
bar.spellId = cooldownTable[5]
bar:SetTimer(timeLeft)
--print("timeLeft:", timeLeft, spellNameDebug)
else
bar:SetMinMaxValues(0, 100)
bar:SetValue(100)
+22 -1
View File
@@ -69,6 +69,14 @@ function Details.Coach.SendRaidCoachStartNotify()
end
end
--player send his death to the raid leader
function Details.Coach.SendDeathToRL(deathTable)
Details:SendCommMessage(_G.DETAILS_PREFIX_NETWORK, Details:Serialize(_G.DETAILS_PREFIX_COACH, UnitName("player"), GetRealmName(), Details.realversion, "CDD", deathTable), "RAID")
if (_detalhes.debug) then
Details:Msg("[|cFFAAFFAADetails! Coach|r] your death has been sent to coach.")
end
end
--send data to raid leader
function Details.Coach.Client.SendDataToRL()
if (_detalhes.debug) then
@@ -433,4 +441,17 @@ Details.Coach.EventFrame:SetScript("OnEvent", function(event, ...)
end
end
end
end)
end)
function Details.Coach.Client.SendMyDeath(_, _, _, _, _, _, playerGUID, _, _, deathTable)
if (Details.Coach.Client.enabled) then
if (Details.Coach.Client.coachName) then
if (Details.in_combat) then
if (playerGUID == UnitGUID("player")) then
Details.Coach.SendDeathToRL(deathTable)
end
end
end
end
end
Details:InstallHook("HOOK_DEATH", Details.Coach.Client.SendMyDeath)