diff --git a/Definitions.lua b/Definitions.lua index 32266a6a..9c56fffb 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -142,7 +142,8 @@ ---@field DefaultTooltipIconSize number default size of the icons in the tooltip, this also dictates the size of each line in the tooltip ---@field ---@field ----@field +---@field GenerateActorInfo fun(self: details, actor: actor, errorText:string, bIncludeStack:boolean) : table generates a table with the main attributes of the actor, this is mainly for debug purposes +---@field DumpActorInfo fun(self: details, actor: actor) open a window showig the main attributes of an actor, this is mainly for debug purposes ---@field GetDisplayClassByDisplayId fun(self: details, displayId: number) : table -return the class object for the given displayId (attributeId) ---@field GetTextureAtlas fun(self: details, atlasName: atlasname) : df_atlasinfo return the texture atlas data ---@field GetTextureAtlasTable fun(self: details) : table[] return the table with the texture atlas data diff --git a/boot.lua b/boot.lua index ee7f8d82..33a8be7b 100644 --- a/boot.lua +++ b/boot.lua @@ -19,8 +19,8 @@ local addonName, Details222 = ... local version = GetBuildInfo() - Details.build_counter = 12825 - Details.alpha_build_counter = 12825 --if this is higher than the regular counter, use it instead + Details.build_counter = 12826 + Details.alpha_build_counter = 12826 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 264da39a..7bd3e341 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -3365,9 +3365,17 @@ function Details:SetClassIcon(texture, instance, class) --[[exported]] --~icons end end - local localizedClass, englishClass + local englishClass if (self.serial ~= "") then - localizedClass, englishClass = GetPlayerInfoByGUID(self.serial or "") + local bResult, sResult = pcall(function() local lClass, eClass = GetPlayerInfoByGUID(self.serial or "") return eClass end) --will error with: nil, table and boolean + if (bResult) then + englishClass = sResult + else + local bIncludeStackTrace = true + --[[GLOBAL]] DETAILS_FAILED_ACTOR = Details:GenerateActorInfo(self, sResult, bIncludeStackTrace) --avoid the game gc and details gc from destroying the actor info + Details:Msg("Bug happend on GetPlayerInfoByGUID() class_damage.lua:3419. Use command '/details bug' to report.") + englishClass = "UNKNOW" + end end if (englishClass) then diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 187ce2bf..d38687af 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -603,21 +603,54 @@ local instanceMixins = { GetActorInfoFromLineIndex = function(self, index) local actor = self.barras[index] and self.barras[index].minha_tabela if (actor) then - local tableToDump = {} - for k, v in pairs(actor) do - if (type(k) == "string") then - if (type(v) == "number" or type(v) == "string") then - tableToDump[k] = v - end - end - end - dumpt(tableToDump) + Details:DumpActorInfo(actor) else Details:Msg("no actor found in line index", index) end end, } +function Details:DumpActorInfo(actor) + local tableToDump = Details:GenerateActorInfo(actor) + dumpt(tableToDump) +end + +local tablesToIgnore = { + ["pets"] = "type = table", + ["friendlyfire"] = "type = table", + ["damage_from"] = "type = table", + ["targets"] = "type = table", + ["raid_targets"] = "type = table", + ["minha_barra"] = "type = table", + ["__index"] = "type = table", + ["spells"] = "type = table", +} + +function Details:GenerateActorInfo(actor, errorText, bIncludeStack) + local tableToDump = {} + for k, v in pairs(actor) do + if (not tablesToIgnore[k]) then + if (type(k) == "string") then + if (type(v) == "number" or type(v) == "string"or type(v) == "boolean") then + tableToDump[k] = v + elseif (type(v) == "table") then + tableToDump[k] = "table{}" + end + end + end + end + + if (errorText) then + tableToDump["__ERRORTEXT"] = errorText + end + + if (bIncludeStack) then + tableToDump["__STACKCALL"] = debugstack(2) + end + + return tableToDump +end + ---get the table with all instances, these instance could be not initialized yet, some might be open, some not in use ---@return instance[] function Details:GetAllInstances() diff --git a/functions/slash.lua b/functions/slash.lua index 95e92761..a3374410 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -1539,6 +1539,9 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (msg == "generateracialslist") then Details.GenerateRacialSpellList() + elseif (msg == "bug") then + dumpt(DETAILS_FAILED_ACTOR or {"No bug to report here."}) + elseif (msg == "spellcat") then Details.Survey.OpenSurveyPanel()