Fixing stuff from latest alpha and more development

This commit is contained in:
Tercio Jose
2023-05-30 15:45:50 -03:00
parent 0cdfa2b900
commit 9021a4de4d
31 changed files with 1549 additions and 1873 deletions
+135 -104
View File
@@ -20,7 +20,7 @@
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
Details.realversion = 152 --core version, this is used to check API version for scripts and plugins (see alias below)
Details.realversion = 153 --core version, this is used to check API version for scripts and plugins (see alias below)
Details.APIVersion = Details.realversion --core version
Details.version = Details.userversion .. " (core " .. Details.realversion .. ")" --simple stirng to show to players
@@ -67,6 +67,7 @@
Details222.PlayerBreakdown = {
DamageSpellsCache = {}
}
--namespace color
Details222.ColorScheme = {
["gradient-background"] = {0.1215, 0.1176, 0.1294, 0.8},
@@ -74,6 +75,7 @@
function Details222.ColorScheme.GetColorFor(colorScheme)
return Details222.ColorScheme[colorScheme]
end
--namespace for damage spells (spellTable)
Details222.DamageSpells = {}
--namespace for texture
@@ -93,6 +95,20 @@
Details222.BreakdownWindow = {}
Details222.PlayerStats = {}
Details222.LoadSavedVariables = {}
Details222.SaveVariables = {}
Details222.Date = {
GetDateForLogs = function()
return _G.date("%Y-%m-%d %H:%M:%S")
end,
}
Details222.ClassCache = {}
Details222.ClassCache.ByName = {}
Details222.ClassCache.ByGUID = {}
Details222.UnitIdCache = {}
Details222.Actors = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
@@ -1074,27 +1090,26 @@ do
_G ["BINDING_NAME_DETAILS_SCROLL_UP"] = Loc ["STRING_KEYBIND_SCROLL_UP"]
_G ["BINDING_NAME_DETAILS_SCROLL_DOWN"] = Loc ["STRING_KEYBIND_SCROLL_DOWN"]
_G ["BINDING_NAME_DETAILS_REPORT_WINDOW1"] = format(Loc ["STRING_KEYBIND_WINDOW_REPORT"], 1)
_G ["BINDING_NAME_DETAILS_REPORT_WINDOW2"] = format(Loc ["STRING_KEYBIND_WINDOW_REPORT"], 2)
_G ["BINDING_NAME_DETAILS_REPORT_WINDOW1"] = string.format(Loc ["STRING_KEYBIND_WINDOW_REPORT"], 1)
_G ["BINDING_NAME_DETAILS_REPORT_WINDOW2"] = string.format(Loc ["STRING_KEYBIND_WINDOW_REPORT"], 2)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW1"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 1)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW2"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 2)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW3"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 3)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW4"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 4)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW5"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 5)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW1"] = string.format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 1)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW2"] = string.format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 2)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW3"] = string.format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 3)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW4"] = string.format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 4)
_G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW5"] = string.format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 5)
_G ["BINDING_NAME_DETAILS_BOOKMARK1"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 1)
_G ["BINDING_NAME_DETAILS_BOOKMARK2"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 2)
_G ["BINDING_NAME_DETAILS_BOOKMARK3"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 3)
_G ["BINDING_NAME_DETAILS_BOOKMARK4"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 4)
_G ["BINDING_NAME_DETAILS_BOOKMARK5"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 5)
_G ["BINDING_NAME_DETAILS_BOOKMARK6"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 6)
_G ["BINDING_NAME_DETAILS_BOOKMARK7"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 7)
_G ["BINDING_NAME_DETAILS_BOOKMARK8"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 8)
_G ["BINDING_NAME_DETAILS_BOOKMARK9"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 9)
_G ["BINDING_NAME_DETAILS_BOOKMARK10"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 10)
_G ["BINDING_NAME_DETAILS_BOOKMARK1"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 1)
_G ["BINDING_NAME_DETAILS_BOOKMARK2"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 2)
_G ["BINDING_NAME_DETAILS_BOOKMARK3"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 3)
_G ["BINDING_NAME_DETAILS_BOOKMARK4"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 4)
_G ["BINDING_NAME_DETAILS_BOOKMARK5"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 5)
_G ["BINDING_NAME_DETAILS_BOOKMARK6"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 6)
_G ["BINDING_NAME_DETAILS_BOOKMARK7"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 7)
_G ["BINDING_NAME_DETAILS_BOOKMARK8"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 8)
_G ["BINDING_NAME_DETAILS_BOOKMARK9"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 9)
_G ["BINDING_NAME_DETAILS_BOOKMARK10"] = string.format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 10)
--]=]
end
if (select(4, GetBuildInfo()) >= 100000) then
@@ -1109,10 +1124,6 @@ if (select(4, GetBuildInfo()) >= 100000) then
end)
end
Details222.ClassCache = {}
Details222.ClassCache.ByName = {}
Details222.ClassCache.ByGUID = {}
function Details222.ClassCache.GetClass(value)
local className = Details222.ClassCache.ByName[value] or Details222.ClassCache.ByGUID[value]
if (className) then
@@ -1138,7 +1149,6 @@ function Details222.ClassCache.MakeCache()
end
end
Details222.UnitIdCache = {}
Details222.UnitIdCache.Raid = {
[1] = "raid1",
[2] = "raid2",
@@ -1238,6 +1248,17 @@ function Details:Destroy(object, key)
end
end
function Details:DestroyCombat(combatObject)
setmetatable(combatObject, nil)
combatObject.__index = nil
combatObject.__newindex = nil
combatObject.__call = nil
Details:Destroy(combatObject)
--leave a trace that the actor has been deleted
combatObject.__destroyed = true
combatObject.__destroyedBy = debugstack(2, 1, 0)
end
---destroy the actor, also calls container:RemoveActor(actor)
---@param self details
---@param actorObject actor
@@ -1248,109 +1269,119 @@ function Details:DestroyActor(actorObject, actorContainer, combatObject)
local combatTotalsTable = combatObject.totals[containerType] --without group
local combatTotalsTableInGroup = combatObject.totals_grupo[containerType] --with group
if (containerType == 1 or containerType == 2) then --damage|healing done
combatTotalsTable = combatTotalsTable - actorObject.total
if (actorObject.grupo) then
combatTotalsTableInGroup = combatTotalsTableInGroup - actorObject.total
end
if (not actorObject.ownerName) then --not a pet
if (containerType == 1 or containerType == 2) then --damage|healing done
combatTotalsTable = combatTotalsTable - actorObject.total
if (actorObject.grupo) then
combatTotalsTableInGroup = combatTotalsTableInGroup - actorObject.total
end
elseif (containerType == 3) then
if (actorObject.total and actorObject.total > 0) then
if (actorObject.powertype) then
combatTotalsTable[actorObject.powertype] = combatTotalsTable[actorObject.powertype] - actorObject.total
combatTotalsTableInGroup[actorObject.powertype] = combatTotalsTableInGroup[actorObject.powertype] - actorObject.total
elseif (containerType == 3) then
---@cast actorObject actorresource
if (actorObject.total and actorObject.total > 0) then
if (actorObject.powertype) then
combatTotalsTable[actorObject.powertype] = combatTotalsTable[actorObject.powertype] - actorObject.total
combatTotalsTableInGroup[actorObject.powertype] = combatTotalsTableInGroup[actorObject.powertype] - actorObject.total
end
end
if (actorObject.alternatepower and actorObject.alternatepower > 0) then
combatTotalsTable.alternatepower = combatTotalsTable.alternatepower - actorObject.alternatepower
combatTotalsTableInGroup.alternatepower = combatTotalsTableInGroup.alternatepower - actorObject.alternatepower
end
end
if (actorObject.alternatepower and actorObject.alternatepower > 0) then
combatTotalsTable.alternatepower = combatTotalsTable.alternatepower - actorObject.alternatepower
combatTotalsTableInGroup.alternatepower = combatTotalsTableInGroup.alternatepower - actorObject.alternatepower
end
elseif (containerType == 4) then
--decrease the amount of CC break from the combat totals
if (actorObject.cc_break and actorObject.cc_break > 0) then
if (combatTotalsTable.cc_break) then
combatTotalsTable.cc_break = combatTotalsTable.cc_break - actorObject.cc_break
elseif (containerType == 4) then
---@cast actorObject actorutility
--decrease the amount of CC break from the combat totals
if (actorObject.cc_break and actorObject.cc_break > 0) then
if (combatTotalsTable.cc_break) then
combatTotalsTable.cc_break = combatTotalsTable.cc_break - actorObject.cc_break
end
if (combatTotalsTableInGroup.cc_break) then
combatTotalsTableInGroup.cc_break = combatTotalsTableInGroup.cc_break - actorObject.cc_break
end
end
if (combatTotalsTableInGroup.cc_break) then
combatTotalsTableInGroup.cc_break = combatTotalsTableInGroup.cc_break - actorObject.cc_break
end
end
--decrease the amount of dispell from the combat totals
if (actorObject.dispell and actorObject.dispell > 0) then
if (combatTotalsTable.dispell) then
combatTotalsTable.dispell = combatTotalsTable.dispell - actorObject.dispell
--decrease the amount of dispell from the combat totals
if (actorObject.dispell and actorObject.dispell > 0) then
if (combatTotalsTable.dispell) then
combatTotalsTable.dispell = combatTotalsTable.dispell - actorObject.dispell
end
if (combatTotalsTableInGroup.dispell) then
combatTotalsTableInGroup.dispell = combatTotalsTableInGroup.dispell - actorObject.dispell
end
end
if (combatTotalsTableInGroup.dispell) then
combatTotalsTableInGroup.dispell = combatTotalsTableInGroup.dispell - actorObject.dispell
end
end
--decrease the amount of interrupt from the combat totals
if (actorObject.interrupt and actorObject.interrupt > 0) then
if (combatTotalsTable.interrupt) then
combatTotalsTable.interrupt = combatTotalsTable.interrupt - actorObject.interrupt
--decrease the amount of interrupt from the combat totals
if (actorObject.interrupt and actorObject.interrupt > 0) then
if (combatTotalsTable.interrupt) then
combatTotalsTable.interrupt = combatTotalsTable.interrupt - actorObject.interrupt
end
if (combatTotalsTableInGroup.interrupt) then
combatTotalsTableInGroup.interrupt = combatTotalsTableInGroup.interrupt - actorObject.interrupt
end
end
if (combatTotalsTableInGroup.interrupt) then
combatTotalsTableInGroup.interrupt = combatTotalsTableInGroup.interrupt - actorObject.interrupt
end
end
--decrease the amount of ress from the combat totals
if (actorObject.ress and actorObject.ress > 0) then
if (combatTotalsTable.ress) then
combatTotalsTable.ress = combatTotalsTable.ress - actorObject.ress
--decrease the amount of ress from the combat totals
if (actorObject.ress and actorObject.ress > 0) then
if (combatTotalsTable.ress) then
combatTotalsTable.ress = combatTotalsTable.ress - actorObject.ress
end
if (combatTotalsTableInGroup.ress) then
combatTotalsTableInGroup.ress = combatTotalsTableInGroup.ress - actorObject.ress
end
end
if (combatTotalsTableInGroup.ress) then
combatTotalsTableInGroup.ress = combatTotalsTableInGroup.ress - actorObject.ress
end
end
--decrease the amount of dead from the combat totals
if (actorObject.dead and actorObject.dead > 0) then
if (combatTotalsTable.dead) then
combatTotalsTable.dead = combatTotalsTable.dead - actorObject.dead
--decrease the amount of dead from the combat totals
if (actorObject.dead and actorObject.dead > 0) then
if (combatTotalsTable.dead) then
combatTotalsTable.dead = combatTotalsTable.dead - actorObject.dead
end
if (combatTotalsTableInGroup.dead) then
combatTotalsTableInGroup.dead = combatTotalsTableInGroup.dead - actorObject.dead
end
end
if (combatTotalsTableInGroup.dead) then
combatTotalsTableInGroup.dead = combatTotalsTableInGroup.dead - actorObject.dead
end
end
--decreate the amount of cooldowns used from the combat totals
if (actorObject.cooldowns_defensive and actorObject.cooldowns_defensive > 0) then
if (combatTotalsTable.cooldowns_defensive) then
combatTotalsTable.cooldowns_defensive = combatTotalsTable.cooldowns_defensive - actorObject.cooldowns_defensive
--decreate the amount of cooldowns used from the combat totals
if (actorObject.cooldowns_defensive and actorObject.cooldowns_defensive > 0) then
if (combatTotalsTable.cooldowns_defensive) then
combatTotalsTable.cooldowns_defensive = combatTotalsTable.cooldowns_defensive - actorObject.cooldowns_defensive
end
if (combatTotalsTableInGroup.cooldowns_defensive) then
combatTotalsTableInGroup.cooldowns_defensive = combatTotalsTableInGroup.cooldowns_defensive - actorObject.cooldowns_defensive
end
end
if (combatTotalsTableInGroup.cooldowns_defensive) then
combatTotalsTableInGroup.cooldowns_defensive = combatTotalsTableInGroup.cooldowns_defensive - actorObject.cooldowns_defensive
end
end
--decrease the amount of buff uptime from the combat totals
if (actorObject.buff_uptime and actorObject.buff_uptime > 0) then
if (combatTotalsTable.buff_uptime) then
combatTotalsTable.buff_uptime = combatTotalsTable.buff_uptime - actorObject.buff_uptime
--decrease the amount of buff uptime from the combat totals
if (actorObject.buff_uptime and actorObject.buff_uptime > 0) then
if (combatTotalsTable.buff_uptime) then
combatTotalsTable.buff_uptime = combatTotalsTable.buff_uptime - actorObject.buff_uptime
end
if (combatTotalsTableInGroup.buff_uptime) then
combatTotalsTableInGroup.buff_uptime = combatTotalsTableInGroup.buff_uptime - actorObject.buff_uptime
end
end
if (combatTotalsTableInGroup.buff_uptime) then
combatTotalsTableInGroup.buff_uptime = combatTotalsTableInGroup.buff_uptime - actorObject.buff_uptime
end
end
--decrease the amount of debuff uptime from the combat totals
if (actorObject.debuff_uptime and actorObject.debuff_uptime > 0) then
if (combatTotalsTable.debuff_uptime) then
combatTotalsTable.debuff_uptime = combatTotalsTable.debuff_uptime - actorObject.debuff_uptime
end
if (combatTotalsTableInGroup.debuff_uptime) then
combatTotalsTableInGroup.debuff_uptime = combatTotalsTableInGroup.debuff_uptime - actorObject.debuff_uptime
--decrease the amount of debuff uptime from the combat totals
if (actorObject.debuff_uptime and actorObject.debuff_uptime > 0) then
if (combatTotalsTable.debuff_uptime) then
combatTotalsTable.debuff_uptime = combatTotalsTable.debuff_uptime - actorObject.debuff_uptime
end
if (combatTotalsTableInGroup.debuff_uptime) then
combatTotalsTableInGroup.debuff_uptime = combatTotalsTableInGroup.debuff_uptime - actorObject.debuff_uptime
end
end
end
end
local actorName = actorObject:Name()
combatObject:RemoveActorFromSpellCastTable(actorName)
setmetatable(actorObject, nil)
actorObject.__index = nil
actorObject.__newindex = nil
actorContainer:RemoveActor(actorObject)
Details:Destroy(actorObject)
--leave a trace that the actor has been deleted
actorObject.__destroyed = true
actorObject.__destroyedBy = debugstack(2, 1, 0)
end