From 1502b17ce57da1e6345b9bd6323ed8831a16d7a6 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 31 Dec 2022 14:21:24 -0300 Subject: [PATCH] Akaaris soul fix --- classes/container_actors.lua | 61 ++++++++++++++++++++++++++++++++++++ core/parser.lua | 38 ++++++++++++++++++---- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/classes/container_actors.lua b/classes/container_actors.lua index 41eca095..c83c20bb 100644 --- a/classes/container_actors.lua +++ b/classes/container_actors.lua @@ -79,6 +79,58 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --api functions +--[=[ +["AzeriteItemPowerDescription"] = 9, +["SellPrice"] = 11, +["CurrencyTotal"] = 14, +["GemSocket"] = 3, +["QuestObjective"] = 8, +["UnitName"] = 2, +["SpellName"] = 13, +["ItemEnchantmentPermanent"] = 15, +["RuneforgeLegendaryPowerDescription"] = 10, +["QuestPlayer"] = 18, +["Blank"] = 1, +["UnitOwner"] = 16, +["LearnableSpell"] = 6, +["ProfessionCraftingQuality"] = 12, +["UnitThreat"] = 7, +["QuestTitle"] = 17, +["ItemBinding"] = 20, +["NestedBlock"] = 19, +["AzeriteEssencePower"] = 5, +["AzeriteEssenceSlot"] = 4, +["None"] = 0, +--]=] + +--attempt to get the owner of rogue's Akaari's Soul from Secrect Technique +function Details222.Pets.AkaarisSoulOwner(petGUID, petName) + local tooltipData = C_TooltipInfo.GetHyperlink("unit:" .. petGUID) + local args = tooltipData.args + + local playerGUID + --iteragfe among args and find into the value field == guid and it must have guidVal + for i = 1, #args do + local arg = args[i] + if (arg.field == "guid") then + playerGUID = arg.guidVal + break + end + end + + if (playerGUID) then + local actorObject = Details:GetActorFromCache(playerGUID) --quick cache only exists during conbat + if (actorObject) then + return actorObject.nome, playerGUID, actorObject.flag_original + end + local guidCache = Details:GetParserPlayerCache() --cahe exists until the next combat starts + local ownerName = guidCache[playerGUID] + if (ownerName) then + return ownerName, playerGUID, 0x514 + end + end +end + ---attempt to the owner of a pet using tooltip scan, if the owner isn't found, return nil ---@param petGUID string ---@param petName string @@ -89,9 +141,15 @@ pet_tooltip_frame:SetOwner(WorldFrame, "ANCHOR_NONE") pet_tooltip_frame:SetHyperlink(("unit:" .. petGUID) or "") + --C_TooltipInfo.GetHyperlink + if (bIsDragonflight) then local tooltipData = pet_tooltip_frame:GetTooltipData() --is pet tooltip reliable with the new tooltips changes? if (tooltipData) then + + print("new pet debug", petGUID, petName) + dumpt(tooltipData) + local tooltipLines = tooltipData.lines for lineIndex = 1, #tooltipLines do local thisLine = tooltipLines[lineIndex] @@ -101,10 +159,13 @@ --parse the different types of information if (lineType == 2) then --unit name if (thisLine.leftText ~= petName) then + print("return tooltip isn't from the pet") --tooltip isn't showing our pet return end + print("pet scanned:", thisLine.leftText:GetText()) + elseif (lineType == 16) then --controller guid --assuming the unit name always comes before the controller guid local GUID = thisLine.guid diff --git a/core/parser.lua b/core/parser.lua index f95a1f08..ebbf990a 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -743,13 +743,39 @@ --print(time, spellid, spellname, who_serial, who_name, who_flags) --end - --secret technique + --secret technique | when akari's soul gives damage if (spellid == 282449) then - local ownerName, ownerGUID, ownerFlags = Details222.Pets.GetPetOwner(who_serial, who_name) - if (ownerName and ownerGUID) then - who_serial = ownerGUID - who_name = ownerName - who_flags = ownerFlags + + --[=[ + ["1"] = "SPELL_DAMAGE", + ["2"] = 1672504648.022, + ["3"] = "Creature-0-4230-1-26993-144961-0000B06548", + ["4"] = "Akaari's Soul", + ["5"] = 8472, + ["6"] = "Creature-0-4230-1-26993-153285-00012DCA2F", + ["7"] = "Training Dummy", + ["8"] = 68136, + ["9"] = 0, + ["10"] = 282449, + ["11"] = "Secret Technique", + ["12"] = 32, + ["13"] = 13471, + ["14"] = -1, + ["15"] = 32, + ["19"] = false, + ["20"] = false, + ["21"] = false, + --]=] + + --npcID + local npcId = Details:GetNpcIdFromGuid(who_serial) + if (npcId == 144961) then + local ownerName, ownerGUID, ownerFlags = Details222.Pets.AkaarisSoulOwner(who_serial, who_name) + if (ownerName and ownerGUID) then + who_serial = ownerGUID + who_name = ownerName + who_flags = ownerFlags + end end end