Changed the health on death logs to be live percent (health % at hit moment), was before health amount divided by default character life amount

This commit is contained in:
Tercio Jose
2024-07-29 17:42:33 -03:00
committed by andrew6180
parent 41a347e606
commit beca97a948
14 changed files with 451 additions and 76 deletions
+1 -1
View File
@@ -521,7 +521,7 @@
currentCombat:SetDateToNow(bSetStartTime, bSetEndTime)
currentCombat:SetEndTime(GetTime())
--drop last events table to garbage collector
--drop player last events table to garbage collector
currentCombat.player_last_events = {}
--flag instance type
+23
View File
@@ -2724,6 +2724,29 @@ function Details.FillTableWithPlayerSpells(completeListOfSpells)
end
end
end
local getNumPetSpells = function()
--'HasPetSpells' contradicts the name and return the amount of pet spells available instead of a boolean
return HasPetSpells()
end
--get pet spells from the pet spellbook
local numPetSpells = getNumPetSpells()
if (numPetSpells) then
for i = 1, numPetSpells do
local spellName, _, unmaskedSpellId = GetSpellBookItemName(i, spellBookPetEnum)
if (unmaskedSpellId) then
unmaskedSpellId = GetOverrideSpell(unmaskedSpellId)
local bIsPassive = IsPassiveSpell(i, spellBookPetEnum)
if (spellName and not bIsPassive) then
completeListOfSpells[unmaskedSpellId] = true
end
end
end
end
--dumpt(completeListOfSpells)
return completeListOfSpells
end
function Details.SavePlayTimeOnClass()
+25 -25
View File
@@ -847,15 +847,15 @@
end
--record death log
local t = last_events_cache[targetName]
local actorLatestEvents = last_events_cache[targetName]
if (not t) then
t = _current_combat:CreateLastEventsTable(targetName)
if (not actorLatestEvents) then
actorLatestEvents = _current_combat:CreateLastEventsTable(targetName)
end
local i = t.n
local i = actorLatestEvents.n
local thisEvent = t [i]
local thisEvent = actorLatestEvents[i]
thisEvent[1] = true --true if this is a damage || false for healing
thisEvent[2] = spellId --spellid || false if this is a battle ress line
thisEvent[3] = amount --amount of damage or healing
@@ -869,14 +869,14 @@
unitId = Details:GuessArenaEnemyUnitId(targetName)
end
if (unitId) then
thisEvent[5] = UnitHealth(unitId)
thisEvent[5] = UnitHealth(unitId) / UnitHealthMax(unitId)
else
thisEvent[5] = cacheAnything.arenaHealth[targetName] or 100000
end
cacheAnything.arenaHealth[targetName] = thisEvent[5]
else
thisEvent[5] = UnitHealth(targetName)
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName)
end
thisEvent[6] = sourceName --source name
@@ -890,9 +890,9 @@
i = i + 1
if (i == _amount_of_last_events + 1) then
t.n = 1
actorLatestEvents.n = 1
else
t.n = i
actorLatestEvents.n = i
end
end
@@ -977,7 +977,7 @@
thisEvent[2] = spellId --spellid || false if this is a battle ress line
thisEvent[3] = amount --amount of damage or healing
thisEvent[4] = time --parser time
thisEvent[5] = UnitHealth(targetName) --current unit heal
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName) --current unit heal
thisEvent[6] = sourceName --source name
thisEvent[7] = absorbed
thisEvent[8] = spellType or school
@@ -1223,7 +1223,7 @@
this_event [2] = spellId --spellid || false if this is a battle ress line
this_event [3] = amount --amount of damage or healing
this_event [4] = time --parser time
this_event [5] = UnitHealth(sourceName) --current unit heal
this_event [5] = UnitHealth(sourceName) / UnitHealthMax(sourceName) --current unit heal
this_event [6] = sourceName --source name
this_event [7] = absorbed
this_event [8] = school
@@ -1318,7 +1318,7 @@
this_event [2] = spellid --spellid || false if this is a battle ress line
this_event [3] = amount --amount of damage or healing
this_event [4] = time --parser time
this_event [5] = UnitHealth(who_name) --current unit heal
this_event [5] = UnitHealth(who_name) / UnitHealthMax(who_name) --current unit heal
this_event [6] = who_name --source name
this_event [7] = absorbed
this_event [8] = school
@@ -1438,7 +1438,7 @@
this_event [2] = spellid --spellid || false if this is a battle ress line
this_event [3] = amount --amount of damage or healing
this_event [4] = time --parser time
this_event [5] = UnitHealth(alvo_name) --current unit heal
this_event [5] = UnitHealth(alvo_name) / UnitHealthMax(alvo_name) --current unit heal
this_event [6] = who_name --source name
this_event [7] = absorbed
this_event [8] = spelltype or school
@@ -1748,7 +1748,7 @@
end
-----------------------------------------------------------------------------------------------------------------------------------------
--HEALING serach key: ~healing |
--HEALING serach key: ~healing ~heal |
-----------------------------------------------------------------------------------------------------------------------------------------
-- https://github.com/TrinityCore/TrinityCore/blob/d81a9e5bc3b3e13b47332b3e7817bd0a0b228cbc/src/server/game/Spells/Auras/SpellAuraEffects.h#L313-L367
@@ -2139,7 +2139,7 @@
end
previousEvent[7] = previousEvent[7] or bIsShield
previousEvent[1] = false --true if this is a damage || false for healing
previousEvent[5] = UnitHealth(targetName)
previousEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName)
previousEvent[11] = (previousEvent[11] or 0) + 1 --attempt to perform arithmetic on a boolean value (during battlegrounds - fix 02 Nov 2023)
else
local thisEvent = t[i]
@@ -2158,12 +2158,12 @@
unitId = Details:GuessArenaEnemyUnitId(targetName)
end
if (unitId) then
thisEvent[5] = UnitHealth(unitId)
thisEvent[5] = UnitHealth(unitId) / UnitHealthMax(unitId)
else
thisEvent[5] = 0
end
else
thisEvent[5] = UnitHealth(targetName)
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName)
end
thisEvent[6] = sourceName
@@ -2304,7 +2304,7 @@
this_event [2] = spellid --spellid || false if this is a battle ress line
this_event [3] = amount --amount of damage or healing
this_event [4] = time --parser time
this_event [5] = UnitHealth(alvo_name) --current unit heal
this_event [5] = UnitHealth(alvo_name) / UnitHealthMax(alvo_name) --current unit heal
this_event [6] = who_name --source name
this_event [7] = is_shield
this_event [8] = absorbed
@@ -2409,7 +2409,7 @@
thisEvent[2] = spellId --spellid
thisEvent[3] = 1
thisEvent[4] = time --parser time
thisEvent[5] = UnitHealth(targetName) --current unit heal
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName) --current unit heal
thisEvent[6] = sourceName --source name
thisEvent[7] = false
thisEvent[8] = false
@@ -2890,7 +2890,7 @@
thisEvent[2] = spellId --spellid
thisEvent[3] = 1
thisEvent[4] = time --parser time
thisEvent[5] = UnitHealth(targetName) --current unit heal
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName) --current unit heal
thisEvent[6] = sourceName --source name
thisEvent[7] = false
thisEvent[8] = false
@@ -2950,7 +2950,7 @@
thisEvent[2] = spellId --spellid
thisEvent[3] = stackSize or 1
thisEvent[4] = time --parser time
thisEvent[5] = UnitHealth(targetName) --current unit heal
thisEvent[5] = UnitHealth(targetName) / UnitHealthMax(targetName) --current unit heal
thisEvent[6] = sourceName --source name
thisEvent[7] = false
thisEvent[8] = false
@@ -3425,7 +3425,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
thisEvent[2] = spellId --spellid || false if this is a battle ress line
thisEvent[3] = 1 --amount of damage or healing
thisEvent[4] = time
thisEvent[5] = UnitHealth(sourceName)
thisEvent[5] = UnitHealth(sourceName) / UnitHealthMax(sourceName)
thisEvent[6] = sourceName
i = i + 1
@@ -3888,7 +3888,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
spellId,
1,
time,
UnitHealth(targetName),
UnitHealth(targetName) / UnitHealthMax(targetName),
sourceName
})
break
@@ -4099,6 +4099,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--get the index of the last event recorded
local lastIndex = recordedEvents.n
--first, remove all healing events where the player was at full health
--here the event log gets reordered as in the parser it work with index recycling
if (lastIndex < _amount_of_last_events+1 and not recordedEvents[lastIndex][4]) then
--the last events table amount of indexes is less than the amount of events to store
@@ -4223,8 +4225,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
eventsBeforePlayerDeath[#eventsBeforePlayerDeath+1] = eventTable
end
local maxHealth
if (thisPlayer.arena_enemy) then
--this is an arena enemy, get the heal with the unit Id