Packr Utility on Coach mode and Vanguard massive update
This commit is contained in:
+779
-2
@@ -27,6 +27,7 @@ local actorInformation = {}
|
||||
local actorInformationIndexes = {}
|
||||
local actorDamageInfo = {}
|
||||
local actorHealInfo = {}
|
||||
local actorUtilityInfo = {}
|
||||
|
||||
--flags
|
||||
local REACTION_HOSTILE = 0x00000040
|
||||
@@ -55,7 +56,8 @@ local isDebugging = false
|
||||
|
||||
function Details.packFunctions.GetAllData()
|
||||
local combat = Details:GetCurrentCombat()
|
||||
local packedData = Details.packFunctions.PackCombatData(combat, 0x13)
|
||||
local packedData = Details.packFunctions.PackCombatData(combat, 0x1B)
|
||||
--local packedData = Details.packFunctions.PackCombatData(combat, 0x13)
|
||||
return packedData
|
||||
end
|
||||
|
||||
@@ -81,6 +83,7 @@ function Details.packFunctions.PackCombatData(combatObject, flags)
|
||||
table.wipe(actorInformationIndexes)
|
||||
table.wipe(actorDamageInfo)
|
||||
table.wipe(actorHealInfo)
|
||||
table.wipe(actorUtilityInfo)
|
||||
|
||||
--reset the serial counter
|
||||
entitySerialCounter = 0
|
||||
@@ -104,13 +107,20 @@ function Details.packFunctions.PackCombatData(combatObject, flags)
|
||||
end
|
||||
|
||||
if (bit.band(flags, 0x1) ~= 0) then
|
||||
print("pack damage")
|
||||
Details.packFunctions.PackDamage(combatObject)
|
||||
end
|
||||
|
||||
if (bit.band(flags, 0x2) ~= 0) then
|
||||
print("pack heal")
|
||||
Details.packFunctions.PackHeal(combatObject)
|
||||
end
|
||||
|
||||
if (bit.band(flags, 0x8) ~= 0) then
|
||||
print("pack utility")
|
||||
Details.packFunctions.PackUtility(combatObject)
|
||||
end
|
||||
|
||||
--> prepare data to send over network
|
||||
local exportedString = flags .. ","
|
||||
|
||||
@@ -142,6 +152,14 @@ function Details.packFunctions.PackCombatData(combatObject, flags)
|
||||
end
|
||||
end
|
||||
|
||||
--add the utility actors data
|
||||
if (bit.band(flags, 0x8) ~= 0) then
|
||||
exportedString = exportedString .. "!U" .. ","
|
||||
for index, data in ipairs(actorUtilityInfo) do
|
||||
exportedString = exportedString .. data .. ","
|
||||
end
|
||||
end
|
||||
|
||||
--main stuff
|
||||
--print("finished export (debug):", exportedString) --debug
|
||||
--print("uncompressed (debug):", format("%.2f", #exportedString/1024), "KBytes")
|
||||
@@ -154,13 +172,15 @@ function Details.packFunctions.PackCombatData(combatObject, flags)
|
||||
|
||||
--Details:Dump({exportedString})
|
||||
|
||||
print("EXPORTING STRING FINAL:", exportedString)
|
||||
|
||||
--compress
|
||||
local LibDeflate = _G.LibStub:GetLibrary("LibDeflate")
|
||||
local dataCompressed = LibDeflate:CompressDeflate(exportedString, {level = 9})
|
||||
local dataEncoded = LibDeflate:EncodeForWoWAddonChannel(dataCompressed)
|
||||
|
||||
--print("encoded for WowAddonChannel (debug):", format("%.2f", #dataEncoded/1024), "KBytes")
|
||||
|
||||
|
||||
return dataEncoded
|
||||
end
|
||||
|
||||
@@ -895,6 +915,746 @@ function Details.packFunctions.UnPackHeal(currentCombat, combatData, tablePositi
|
||||
return tablePosition
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------------------------
|
||||
--> pack utility data
|
||||
|
||||
--pack utility passes the player utility info + pets the player own
|
||||
--each player will also send an enemy, the enemy will be in order of raidIndex of the player
|
||||
function Details.packFunctions.PackUtility(combatObject)
|
||||
|
||||
if (isDebugging) then
|
||||
print("PackUtility(): start.")
|
||||
end
|
||||
|
||||
--store actorObjects to pack
|
||||
local actorsToPack = {}
|
||||
|
||||
--get the player object from the combat > utility container
|
||||
local playerName = UnitName("player")
|
||||
local playerObject = combatObject:GetActor(DETAILS_ATTRIBUTE_MISC, playerName)
|
||||
if (not playerObject) then
|
||||
if (isDebugging) then
|
||||
print("PackUtility(): return | no player object.")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
tinsert(actorsToPack, playerObject)
|
||||
|
||||
--get the list of pets the player own
|
||||
local playerPets = playerObject.pets
|
||||
for _, petName in ipairs(playerPets) do
|
||||
local petObject = combatObject:GetActor(DETAILS_ATTRIBUTE_MISC, petName)
|
||||
if (petObject) then
|
||||
tinsert(actorsToPack, petObject)
|
||||
end
|
||||
end
|
||||
|
||||
local playerIndex = _G.UnitInRaid("player")
|
||||
|
||||
if (not playerIndex) then --no player index
|
||||
if (isDebugging) then
|
||||
print("PackUtility(): return | no player index found.")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
--get all npc enemies and sort them by their respaw id
|
||||
local allActors = combatObject[DETAILS_ATTRIBUTE_MISC]._ActorTable
|
||||
local allEnemies = {} --this have subtables, format: {actorObject, spawnId}
|
||||
|
||||
for i = 1, #allActors do
|
||||
--get the actor object
|
||||
local actor = allActors[i]
|
||||
--check if is an enemy or neutral
|
||||
if (actor:IsNeutralOrEnemy()) then
|
||||
--get the spawnId
|
||||
local spawnId = select(7, strsplit("-", actor.serial))
|
||||
if (spawnId) then
|
||||
--convert hex to number
|
||||
spawnId = tonumber(spawnId:sub(1, 10), 16)
|
||||
if (spawnId) then
|
||||
--first index is the actorObject, the second index is the spawnId to sort enemies
|
||||
tinsert(allEnemies, {actor, spawnId})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--sort enemies by their spawnId
|
||||
table.sort(allEnemies, Details.Sort2)
|
||||
|
||||
local allPlayerNames = {}
|
||||
for i = 1, 20 do
|
||||
local name, _, subgroup = GetRaidRosterInfo(i)
|
||||
if (name) then --maybe the group has less than 20 players
|
||||
name = _G.Ambiguate(name, "none")
|
||||
if (name and subgroup <= 4) then
|
||||
tinsert(allPlayerNames, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(allPlayerNames, function(t1, t2) return t1 < t2 end)
|
||||
|
||||
local playerName = UnitName("player")
|
||||
for i = 1, #allPlayerNames do
|
||||
if (playerName == allPlayerNames[i]) then
|
||||
playerIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
--this is the enemy that this player has to send
|
||||
local enemyObjectToSend = allEnemies[playerIndex] and allEnemies[playerIndex][1]
|
||||
if (enemyObjectToSend) then
|
||||
tinsert(actorsToPack, enemyObjectToSend)
|
||||
end
|
||||
|
||||
--add the actors to actor information table
|
||||
for _, actorObject in ipairs(actorsToPack) do
|
||||
--check if already has the actor information
|
||||
local indexToActorInfo = actorInformationIndexes[actorObject.nome] --actor name
|
||||
if (not indexToActorInfo) then
|
||||
--need to add the actor general information into the actor information table
|
||||
indexToActorInfo = Details.packFunctions.AddActorInformation(actorObject)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #actorsToPack do
|
||||
--get the actor object
|
||||
local actor = actorsToPack[i]
|
||||
local indexToActorInfo = actorInformationIndexes[actor.nome]
|
||||
|
||||
--where the information of this actor starts
|
||||
local currentIndex = #actorUtilityInfo + 1
|
||||
|
||||
--[1] index where is stored the actor info like name, class, spec, etc
|
||||
actorUtilityInfo[currentIndex] = indexToActorInfo --[1]
|
||||
|
||||
--[=[
|
||||
interrupt_spells._ActorTable [spellId] = {
|
||||
[2139] = {
|
||||
["id"] = 2139,
|
||||
["interrompeu_oque"] = {
|
||||
[337110] = 1,
|
||||
},
|
||||
["targets"] = {
|
||||
["Baroness Frieda"] = 1,
|
||||
},
|
||||
["counter"] = 1,
|
||||
},
|
||||
}
|
||||
|
||||
cooldowns_defensive
|
||||
cooldowns_defensive_targets
|
||||
["cooldowns_defensive_spells"] = {
|
||||
["_ActorTable"] = {
|
||||
[45438] = {
|
||||
["id"] = 45438,
|
||||
["targets"] = {
|
||||
["Relune-Tichondrius"] = 1,
|
||||
},
|
||||
["counter"] = 1,
|
||||
},
|
||||
},
|
||||
["tipo"] = 9,
|
||||
},
|
||||
|
||||
cc_break
|
||||
cc_break_oque
|
||||
cc_break_targets
|
||||
["cc_break_spells"] = {
|
||||
["_ActorTable"] = {
|
||||
[42223] = {
|
||||
["cc_break_oque"] = {
|
||||
[197214] = 2,
|
||||
},
|
||||
["id"] = 42223,
|
||||
["targets"] = {
|
||||
["Castellan Niklaus"] = 1,
|
||||
["Baroness Frieda"] = 1,
|
||||
},
|
||||
["cc_break"] = 2,
|
||||
["counter"] = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
["cc_done_spells"] = {
|
||||
["_ActorTable"] = {
|
||||
[127797] = {
|
||||
["id"] = 127797,
|
||||
["targets"] = {
|
||||
["Castellan Niklaus"] = 1,
|
||||
["Lord Stavros"] = 1,
|
||||
["Baroness Frieda"] = 1,
|
||||
},
|
||||
["counter"] = 3,
|
||||
},
|
||||
},
|
||||
["tipo"] = 9,
|
||||
},
|
||||
|
||||
["dispell_spells"] = {
|
||||
["_ActorTable"] = {
|
||||
[77130] = {
|
||||
["targets"] = {
|
||||
["Magicgreenie-BleedingHollow"] = 1,
|
||||
},
|
||||
["id"] = 77130,
|
||||
["dispell_oque"] = {
|
||||
[337110] = 1,
|
||||
},
|
||||
["dispell"] = 1,
|
||||
["counter"] = 0,
|
||||
},
|
||||
},
|
||||
["tipo"] = 9,
|
||||
},
|
||||
|
||||
ress
|
||||
ress_targets
|
||||
["ress_spells"] = {
|
||||
["_ActorTable"] = {
|
||||
[212048] = {
|
||||
["id"] = 212048,
|
||||
["ress"] = 7,
|
||||
["targets"] = {
|
||||
["Freezerbeef-Illidan"] = 1,
|
||||
["Jilkari-ThoriumBrotherhood"] = 1,
|
||||
["Ditador"] = 1,
|
||||
["Caller-Thrall"] = 1,
|
||||
["Thebappo-Tichondrius"] = 1,
|
||||
["Superskourge-Area52"] = 1,
|
||||
["Rorschak-Area52"] = 1,
|
||||
},
|
||||
["counter"] = 0,
|
||||
},
|
||||
},
|
||||
["tipo"] = 9,
|
||||
},
|
||||
|
||||
--]=]
|
||||
|
||||
--> cooldowns, pack player cooldowns used
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = "C"
|
||||
local cooldownContainer = actor.cooldowns_defensive_spells and actor.cooldowns_defensive_spells._ActorTable
|
||||
local totalSpellIndexes = 0
|
||||
|
||||
if (cooldownContainer) then
|
||||
--reserve an index to tell the length of spells
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
local reservedSpellSizeIndex = #actorUtilityInfo
|
||||
|
||||
for spellId, spellInfo in pairs(cooldownContainer) do
|
||||
local spellCounter = spellInfo.counter
|
||||
local spellTargets = spellInfo.targets
|
||||
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellId)
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellCounter)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
|
||||
--build targets
|
||||
local targetsSize = Details.packFunctions.CountTableEntriesValid(spellTargets) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = targetsSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for actorName, totalDone in pairs(spellTargets) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = actorName
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
end
|
||||
|
||||
--amount of indexes spells are using
|
||||
actorUtilityInfo[reservedSpellSizeIndex] = totalSpellIndexes
|
||||
else
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
end
|
||||
|
||||
--> interrupts, pack player interrupts
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = "I"
|
||||
local interruptsContainer = actor.interrupt_spells and actor.interrupt_spells._ActorTable
|
||||
local totalSpellIndexes = 0
|
||||
|
||||
if (interruptsContainer) then
|
||||
--reserve an index to tell the length of spells
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
local reservedSpellSizeIndex = #actorUtilityInfo
|
||||
|
||||
for spellId, spellInfo in pairs(interruptsContainer) do
|
||||
local spellCounter = spellInfo.counter
|
||||
local spellTargets = spellInfo.targets
|
||||
local whatGotInterrupted = spellInfo.interrompeu_oque
|
||||
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellId)
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellCounter) --spellCounter is nil
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
|
||||
--build targets
|
||||
local targetsSize = Details.packFunctions.CountTableEntriesValid(spellTargets) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = targetsSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for actorName, totalDone in pairs(spellTargets) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = actorName
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
|
||||
--build what was interrupted by the spell
|
||||
local interruptedSize = Details.packFunctions.CountTableEntriesValid(whatGotInterrupted) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = interruptedSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for spellId, totalDone in pairs(whatGotInterrupted) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = spellId
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
end
|
||||
|
||||
--amount of indexes spells are using
|
||||
actorUtilityInfo[reservedSpellSizeIndex] = totalSpellIndexes
|
||||
else
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
end
|
||||
|
||||
--> cc break, pack player crowd control breaks
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = "B"
|
||||
local ccBreakContainer = actor.cc_break_spells and actor.cc_break_spells._ActorTable
|
||||
local totalSpellIndexes = 0
|
||||
|
||||
if (ccBreakContainer) then
|
||||
--reserve an index to tell the length of spells
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
local reservedSpellSizeIndex = #actorUtilityInfo
|
||||
|
||||
for spellId, spellInfo in pairs(ccBreakContainer) do
|
||||
local spellCounter = spellInfo.cc_break
|
||||
local spellTargets = spellInfo.targets
|
||||
local whatGotCCBroken = spellInfo.cc_break_oque
|
||||
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellId)
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellCounter)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
|
||||
--build targets
|
||||
local targetsSize = Details.packFunctions.CountTableEntriesValid(spellTargets) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = targetsSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for actorName, totalDone in pairs(spellTargets) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = actorName
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
|
||||
--build what was interrupted by the spell
|
||||
local ccBrokenSize = Details.packFunctions.CountTableEntriesValid(whatGotCCBroken) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = ccBrokenSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for spellId, totalDone in pairs(whatGotCCBroken) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = spellId
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
end
|
||||
|
||||
--amount of indexes spells are using
|
||||
actorUtilityInfo[reservedSpellSizeIndex] = totalSpellIndexes
|
||||
else
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
end
|
||||
|
||||
--> dispel, pack player dispels done
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = "D"
|
||||
local dispelsContainer = actor.dispell_spells and actor.dispell_spells._ActorTable
|
||||
local totalSpellIndexes = 0
|
||||
|
||||
if (dispelsContainer) then
|
||||
--reserve an index to tell the length of spells
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
local reservedSpellSizeIndex = #actorUtilityInfo
|
||||
|
||||
for spellId, spellInfo in pairs(dispelsContainer) do
|
||||
local spellTotal = spellInfo.dispell
|
||||
local spellTargets = spellInfo.targets
|
||||
local whatGotDispelled = spellInfo.dispell_oque
|
||||
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellId)
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellTotal)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
|
||||
--build targets
|
||||
local targetsSize = Details.packFunctions.CountTableEntriesValid(spellTargets) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = targetsSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for actorName, totalDone in pairs(spellTargets) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = actorName
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
|
||||
--build what was dispelled by the spell
|
||||
local dispelsSize = Details.packFunctions.CountTableEntriesValid(whatGotDispelled) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = dispelsSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for spellId, totalDone in pairs(whatGotDispelled) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = spellId
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
end
|
||||
|
||||
--amount of indexes spells are using
|
||||
actorUtilityInfo[reservedSpellSizeIndex] = totalSpellIndexes
|
||||
else
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
end
|
||||
|
||||
--> ress, pack player ress performed
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = "R"
|
||||
local ressContainer = actor.ress_spells and actor.ress_spells._ActorTable
|
||||
local totalSpellIndexes = 0
|
||||
|
||||
if (ressContainer) then
|
||||
--reserve an index to tell the length of spells
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
local reservedSpellSizeIndex = #actorUtilityInfo
|
||||
|
||||
for spellId, spellInfo in pairs(ressContainer) do
|
||||
local spellTotal = spellInfo.ress
|
||||
local spellTargets = spellInfo.targets
|
||||
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellId)
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(spellTotal)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
|
||||
--build targets
|
||||
local targetsSize = Details.packFunctions.CountTableEntriesValid(spellTargets) * 2
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = targetsSize
|
||||
totalSpellIndexes = totalSpellIndexes + 1
|
||||
|
||||
for actorName, totalDone in pairs(spellTargets) do
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = actorName
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = floor(totalDone)
|
||||
totalSpellIndexes = totalSpellIndexes + 2
|
||||
end
|
||||
end
|
||||
|
||||
--amount of indexes spells are using
|
||||
actorUtilityInfo[reservedSpellSizeIndex] = totalSpellIndexes
|
||||
else
|
||||
actorUtilityInfo [#actorUtilityInfo + 1] = 0
|
||||
end
|
||||
end
|
||||
|
||||
if (isDebugging) then
|
||||
print("PackUtility(): done.")
|
||||
end
|
||||
end
|
||||
|
||||
function Details.packFunctions.UnPackUtility(currentCombat, combatData, tablePosition)
|
||||
if (isDebugging) then
|
||||
print("UnPackUtility(): start.")
|
||||
end
|
||||
|
||||
--get the utility container
|
||||
local utilityContainer = currentCombat[DETAILS_ATTRIBUTE_MISC]
|
||||
|
||||
--loop from 1 to 199, the amount of actors store is unknown
|
||||
--todo: it's only unpacking the first actor from the table, e.g. theres izimode and eye of corruption, after export it only shows the eye of corruption
|
||||
--table position does not move forward
|
||||
for i = 1, 199 do
|
||||
--actor information index in the combatData table
|
||||
--this index gives the position where the actor name, class, spec are stored
|
||||
local actorReference = tonumber(combatData[tablePosition]) --[1]
|
||||
local actorName, actorFlag, serialNumber, class, spec = Details.packFunctions.RetriveActorInformation(combatData, actorReference)
|
||||
|
||||
if (isDebugging) then
|
||||
print("UnPackUtility(): Retrivied Data From " .. (actorReference or "nil") .. ":", actorName, actorFlag, serialNumber, class, spec)
|
||||
end
|
||||
|
||||
--check if all utility actors has been processed
|
||||
--if there's no actor name it means it reached the end
|
||||
if (not actorName) then
|
||||
if (isDebugging) then
|
||||
print("UnPackUtiliyu(): break | Utility loop has been stopped", "index:", i, "tablePosition:", tablePosition, "value:", combatData[tablePosition])
|
||||
end
|
||||
break
|
||||
end
|
||||
|
||||
--get or create the actor object
|
||||
local actorObject = utilityContainer:GetOrCreateActor(serialNumber, actorName, actorFlag, true)
|
||||
|
||||
--set the actor class, spec and group
|
||||
actorObject.classe = class
|
||||
actorObject.spec = spec
|
||||
actorObject.grupo = isActorInGroup(class, actorFlag)
|
||||
actorObject.flag_original = actorFlag
|
||||
--finished utility actor setup
|
||||
--C - cooldowns
|
||||
--I - interrupts
|
||||
--B - cc break
|
||||
--D - dispels
|
||||
--R - ress
|
||||
|
||||
--> copy back the actor cooldowns spells
|
||||
tablePosition = tablePosition + 1
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
--amount of indexes used to store cooldowns spells for this actor
|
||||
local spellsSize = tonumber(combatData[tablePosition]) --[7]
|
||||
if (isDebugging) then
|
||||
print("cooldowns size unpack:", spellsSize)
|
||||
end
|
||||
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
--check if there's cooldown data
|
||||
if (spellsSize > 0) then
|
||||
local newTotal = 0
|
||||
local newTargetsTable = {}
|
||||
|
||||
local spellIndex = tablePosition
|
||||
while(spellIndex < tablePosition + spellsSize) do
|
||||
local spellId = tonumber(combatData[spellIndex]) --[1]
|
||||
local spellTotal = tonumber(combatData[spellIndex+1]) --[2]
|
||||
local targetsSize = tonumber(combatData[spellIndex+2]) --[3]
|
||||
|
||||
local targetTable = Details.packFunctions.UnpackTable(combatData, spellIndex+2, true)
|
||||
local spellObject = actorObject.cooldowns_defensive_spells:GetOrCreateSpell(spellId, true)
|
||||
|
||||
spellObject.counter = spellTotal
|
||||
spellObject.targets = targetTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.targets) do
|
||||
newTargetsTable[targetName] = (newTargetsTable[targetName] or 0) + amount
|
||||
newTotal = newTotal + amount
|
||||
end
|
||||
|
||||
spellIndex = spellIndex + targetsSize + 3
|
||||
end
|
||||
|
||||
actorObject.cooldowns_defensive = newTotal
|
||||
actorObject.cooldowns_defensive_targets = newTargetsTable
|
||||
tablePosition = tablePosition + spellsSize --increase table position
|
||||
end
|
||||
|
||||
--> copy back the actor interrupts spells
|
||||
--tablePosition = tablePosition + 1
|
||||
local startInterrupt = combatData[tablePosition]
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
--amount of indexes used to store interrupt spells for this actor
|
||||
local spellsSize = tonumber(combatData[tablePosition]) --[7]
|
||||
if (isDebugging) then
|
||||
print("interrupt size unpack:", spellsSize)
|
||||
end
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
if (spellsSize > 0) then
|
||||
local newTotal = 0
|
||||
local newTargetsTable = {}
|
||||
local newTargetWhatTable = {}
|
||||
|
||||
local spellIndex = tablePosition
|
||||
while(spellIndex < tablePosition + spellsSize) do
|
||||
local spellId = tonumber(combatData[spellIndex]) --[1]
|
||||
local spellTotal = tonumber(combatData[spellIndex+1]) --[2]
|
||||
local targetsSize = tonumber(combatData[spellIndex+2]) --[3]
|
||||
|
||||
local targetTable = Details.packFunctions.UnpackTable(combatData, spellIndex+2, true)
|
||||
local spellObject = actorObject.interrupt_spells:GetOrCreateSpell(spellId, true)
|
||||
|
||||
spellObject.counter = spellTotal
|
||||
spellObject.targets = targetTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.targets) do
|
||||
newTargetsTable[targetName] = (newTargetsTable[targetName] or 0) + amount
|
||||
newTotal = newTotal + amount
|
||||
end
|
||||
|
||||
--interrupt what
|
||||
spellIndex = spellIndex + targetsSize + 3
|
||||
local interruptWhatTableSize = combatData[spellIndex]
|
||||
local interruptWhatTable = Details.packFunctions.UnpackTable(combatData, spellIndex, true) --table[index] is nil
|
||||
spellObject.interrompeu_oque = interruptWhatTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.targets) do
|
||||
newTargetWhatTable[targetName] = (newTargetWhatTable[targetName] or 0) + amount
|
||||
end
|
||||
|
||||
spellIndex = spellIndex + interruptWhatTableSize + 1
|
||||
end
|
||||
|
||||
actorObject.interrupt = newTotal
|
||||
actorObject.interrupt_targets = newTargetsTable
|
||||
actorObject.interrompeu_oque = newTargetWhatTable
|
||||
tablePosition = tablePosition + spellsSize --increase table position
|
||||
end
|
||||
|
||||
--> copy back the actor cc break spells
|
||||
--tablePosition = tablePosition + 1
|
||||
local startCCBreak = combatData[tablePosition]
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
--amount of indexes used to store cc break spells for this actor
|
||||
local spellsSize = tonumber(combatData[tablePosition]) --[7]
|
||||
if (isDebugging) then
|
||||
print("cc break size unpack:", spellsSize)
|
||||
end
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
if (spellsSize > 0) then
|
||||
local newTotal = 0
|
||||
local newTargetsTable = {}
|
||||
local newTargetWhatTable = {}
|
||||
|
||||
local spellIndex = tablePosition
|
||||
while(spellIndex < tablePosition + spellsSize) do
|
||||
local spellId = tonumber(combatData[spellIndex]) --[1]
|
||||
local spellTotal = tonumber(combatData[spellIndex+1]) --[2]
|
||||
local targetsSize = tonumber(combatData[spellIndex+2]) --[3]
|
||||
|
||||
local targetTable = Details.packFunctions.UnpackTable(combatData, spellIndex+2, true)
|
||||
local spellObject = actorObject.cc_break_spells:GetOrCreateSpell(spellId, true)
|
||||
|
||||
spellObject.cc_break = spellTotal
|
||||
spellObject.targets = targetTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.targets) do
|
||||
newTargetsTable[targetName] = (newTargetsTable[targetName] or 0) + amount
|
||||
newTotal = newTotal + amount
|
||||
end
|
||||
|
||||
--cc broke what
|
||||
spellIndex = spellIndex + targetsSize + 3
|
||||
local ccBrokeWhatTableSize = combatData[spellIndex]
|
||||
|
||||
local ccBrokeWhatTable = Details.packFunctions.UnpackTable(combatData, spellIndex, true)
|
||||
spellObject.cc_break_oque = ccBrokeWhatTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.cc_break_oque) do
|
||||
newTargetWhatTable[targetName] = (newTargetWhatTable[targetName] or 0) + amount
|
||||
end
|
||||
|
||||
spellIndex = spellIndex + ccBrokeWhatTableSize + 1
|
||||
end
|
||||
|
||||
actorObject.cc_break = newTotal
|
||||
actorObject.cc_break_targets = newTargetsTable
|
||||
actorObject.cc_break_oque = newTargetWhatTable
|
||||
tablePosition = tablePosition + spellsSize --increase table position
|
||||
end
|
||||
|
||||
--> copy back the actor dispel spells
|
||||
--tablePosition = tablePosition + 1
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
--amount of indexes used to store dispel spells for this actor
|
||||
local spellsSize = tonumber(combatData[tablePosition]) --[7]
|
||||
if (isDebugging) then
|
||||
print("dispel size unpack:", spellsSize)
|
||||
end
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
if (spellsSize > 0) then
|
||||
local newTotal = 0
|
||||
local newTargetsTable = {}
|
||||
local newTargetWhatTable = {}
|
||||
|
||||
local spellIndex = tablePosition
|
||||
while(spellIndex < tablePosition + spellsSize) do
|
||||
local spellId = tonumber(combatData[spellIndex]) --[1]
|
||||
local spellTotal = tonumber(combatData[spellIndex+1]) --[2]
|
||||
local targetsSize = tonumber(combatData[spellIndex+2]) --[3]
|
||||
|
||||
local targetTable = Details.packFunctions.UnpackTable(combatData, spellIndex+2, true)
|
||||
local spellObject = actorObject.dispell_spells:GetOrCreateSpell(spellId, true)
|
||||
|
||||
spellObject.dispell = spellTotal
|
||||
spellObject.targets = targetTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.targets) do
|
||||
newTargetsTable[targetName] = (newTargetsTable[targetName] or 0) + amount
|
||||
newTotal = newTotal + amount
|
||||
end
|
||||
spellIndex = spellIndex + targetsSize + 3
|
||||
|
||||
--dispel what
|
||||
local dispelWhatTableSize = combatData[spellIndex]
|
||||
local dispelWhatTable = Details.packFunctions.UnpackTable(combatData, spellIndex, true)
|
||||
spellObject.dispell_oque = dispelWhatTable
|
||||
|
||||
for spellId, amount in pairs (spellObject.dispell_oque) do
|
||||
newTargetWhatTable[spellId] = (newTargetWhatTable[spellId] or 0) + amount
|
||||
end
|
||||
|
||||
spellIndex = spellIndex + dispelWhatTableSize + 1
|
||||
end
|
||||
|
||||
actorObject.dispell = newTotal
|
||||
actorObject.dispell_targets = newTargetsTable
|
||||
actorObject.dispell_oque = newTargetWhatTable
|
||||
tablePosition = tablePosition + spellsSize --increase table position
|
||||
end
|
||||
|
||||
--ress
|
||||
--ress_targets
|
||||
--ress_spells
|
||||
--> copy back the actor ress spells
|
||||
--tablePosition = tablePosition + 1
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
--amount of indexes used to store ress spells for this actor
|
||||
local spellsSize = tonumber(combatData[tablePosition]) --[7]
|
||||
if (isDebugging) then
|
||||
print("ress size unpack:", spellsSize)
|
||||
end
|
||||
tablePosition = tablePosition + 1
|
||||
|
||||
if (spellsSize > 0) then
|
||||
local newTotal = 0
|
||||
local newTargetsTable = {}
|
||||
|
||||
local spellIndex = tablePosition
|
||||
while(spellIndex < tablePosition + spellsSize) do
|
||||
local spellId = tonumber(combatData[spellIndex]) --[1]
|
||||
local spellTotal = tonumber(combatData[spellIndex+1]) --[2]
|
||||
local targetsSize = tonumber(combatData[spellIndex+2]) --[3]
|
||||
|
||||
local targetTable = Details.packFunctions.UnpackTable(combatData, spellIndex+2, true)
|
||||
local spellObject = actorObject.ress_spells:GetOrCreateSpell(spellId, true)
|
||||
|
||||
spellObject.ress = spellTotal
|
||||
spellObject.targets = targetTable
|
||||
|
||||
for targetName, amount in pairs (spellObject.targets) do
|
||||
newTargetsTable[targetName] = (newTargetsTable[targetName] or 0) + amount
|
||||
newTotal = newTotal + amount
|
||||
end
|
||||
|
||||
spellIndex = spellIndex + targetsSize + 3
|
||||
end
|
||||
|
||||
actorObject.ress = newTotal
|
||||
actorObject.ress_targets = newTargetsTable
|
||||
tablePosition = tablePosition + spellsSize --increase table position
|
||||
end
|
||||
end
|
||||
|
||||
if (isDebugging) then
|
||||
print("UnPackUtility(): done.")
|
||||
end
|
||||
|
||||
return tablePosition
|
||||
end
|
||||
|
||||
|
||||
--this function does the same as the function above but does not create a new combat, it just add new information
|
||||
function Details.packFunctions.DeployPackedCombatData(packedCombatData)
|
||||
if (isDebugging) then
|
||||
@@ -982,6 +1742,23 @@ function Details.packFunctions.DeployPackedCombatData(packedCombatData)
|
||||
Details.packFunctions.UnPackHeal(currentCombat, combatData, tablePosition)
|
||||
end
|
||||
|
||||
if (bit.band(flags, 0x8) ~= 0) then
|
||||
--find the index where the utility information start
|
||||
for i = tablePosition, #combatData do
|
||||
if (combatData[i] == "!U") then
|
||||
tablePosition = i + 1
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (isDebugging) then
|
||||
print("DeployPackedCombatData(): data has utility info, Utility Index:", tablePosition)
|
||||
end
|
||||
|
||||
--unpack utility
|
||||
Details.packFunctions.UnPackUtility(currentCombat, combatData, tablePosition)
|
||||
end
|
||||
|
||||
if (bit.band(flags, 0x10) == 0) then
|
||||
--set the start and end of combat time and date
|
||||
currentCombat:SetStartTime(combatData[INDEX_COMBAT_START_TIME])
|
||||
|
||||
Reference in New Issue
Block a user