From d95ff2b827e8b4cbcf8b115519941b3bebe2d792 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Fri, 10 Nov 2023 20:42:57 -0300 Subject: [PATCH] More fixes for patch 10.2 combatlog changes --- boot.lua | 4 ++-- classes/container_pets.lua | 1 - classes/custom_damagedone.lua | 1 - classes/custom_healingdone.lua | 1 - core/control.lua | 10 +++++----- core/gears.lua | 29 ++++++++++------------------- core/parser.lua | 4 ++-- functions/classes.lua | 26 ++++++++++++++++++-------- functions/spec_augmentation.lua | 2 +- 9 files changed, 38 insertions(+), 40 deletions(-) diff --git a/boot.lua b/boot.lua index 9ec709219..3a5211726 100644 --- a/boot.lua +++ b/boot.lua @@ -13,8 +13,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12029 - Details.alpha_build_counter = 12029 --if this is higher than the regular counter, use it instead + Details.build_counter = 12030 + Details.alpha_build_counter = 12030 --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/container_pets.lua b/classes/container_pets.lua index 3503d016a..1975d2164 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -6,7 +6,6 @@ local addonName, Details222 = ... local UnitGUID = _G.UnitGUID local UnitName = _G.UnitName -local GetUnitName = _G.GetUnitName local IsInRaid = _G.IsInRaid local IsInGroup = _G.IsInGroup local GetNumGroupMembers = _G.GetNumGroupMembers diff --git a/classes/custom_damagedone.lua b/classes/custom_damagedone.lua index 40a72e67e..cb43a8e28 100644 --- a/classes/custom_damagedone.lua +++ b/classes/custom_damagedone.lua @@ -38,7 +38,6 @@ local IsInGroup = IsInGroup -- api local local GetNumGroupMembers = GetNumGroupMembers -- api local local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local -local _GetUnitName = GetUnitName -- api local ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants diff --git a/classes/custom_healingdone.lua b/classes/custom_healingdone.lua index 0b225ee1d..5b95a80f4 100644 --- a/classes/custom_healingdone.lua +++ b/classes/custom_healingdone.lua @@ -31,7 +31,6 @@ local GetNumGroupMembers = GetNumGroupMembers -- api local local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local - local _GetUnitName = GetUnitName -- api local ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants diff --git a/core/control.lua b/core/control.lua index 5945d246e..a1a761d3b 100644 --- a/core/control.lua +++ b/core/control.lua @@ -953,15 +953,15 @@ for i = 1, aliados-1 do local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("party" .. i) or "DAMAGER" if (role ~= "NONE" and UnitExists("party" .. i)) then - local name = GetUnitName("party" .. i, true) - Details.arena_table [name] = {role = role} + local unitName = Details:GetFullName("party" .. i) + Details.arena_table [unitName] = {role = role} end end local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") or "DAMAGER" if (role ~= "NONE") then - local name = GetUnitName("player", true) - Details.arena_table [name] = {role = role} + local playerName = Details:GetFullName("player") + Details.arena_table [playerName] = {role = role} end --enemies @@ -969,7 +969,7 @@ Details:Destroy(_detalhes.arena_enemies) for i = 1, enemiesAmount do - local enemyName = _G.GetUnitName("arena" .. i, true) + local enemyName = Details:GetFullName("arena" .. i) if (enemyName) then _detalhes.arena_enemies[enemyName] = "arena" .. i end diff --git a/core/gears.lua b/core/gears.lua index 136a599ae..0e3c22bde 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -2,7 +2,6 @@ local _detalhes = _G.Details local addonName, Details222 = ... local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) -local UnitName = UnitName local UnitGUID = UnitGUID local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned local select = select @@ -465,7 +464,7 @@ function _detalhes:ResetSpecCache (forced) local c_combat_dmg = _detalhes.tabela_vigente [1] local c_combat_heal = _detalhes.tabela_vigente [2] for i = 1, GetNumGroupMembers(), 1 do - local name = GetUnitName("raid" .. i, true) + local name = Details:GetFullName("raid" .. i) local index = c_combat_dmg._NameIndexTable [name] if (index) then local actor = c_combat_dmg._ActorTable [index] @@ -1753,29 +1752,23 @@ function Details.Database.StoreEncounter(combat) if (UnitIsInMyGuild ("raid" .. i)) then if (role == "DAMAGER" or role == "TANK") then - local player_name, player_realm = UnitName ("raid" .. i) - if (player_realm and player_realm ~= "") then - player_name = player_name .. "-" .. player_realm - end - + local player_name = Details:GetFullName("raid" .. i) local _, _, class = Details:GetUnitClassFull(player_name) local damage_actor = damage_container_pool [damage_container_hash [player_name]] if (damage_actor) then - local guid = UnitGUID(player_name) or UnitGUID(UnitName ("raid" .. i)) + local guid = UnitGUID("raid" .. i) this_combat_data.damage [player_name] = {floor(damage_actor.total), _detalhes.item_level_pool [guid] and _detalhes.item_level_pool [guid].ilvl or 0, class or 0} end + elseif (role == "HEALER") then - local player_name, player_realm = UnitName ("raid" .. i) - if (player_realm and player_realm ~= "") then - player_name = player_name .. "-" .. player_realm - end + local player_name = Details:GetFullName("raid" .. i) local _, _, class = Details:GetUnitClassFull(player_name) local heal_actor = healing_container_pool [healing_container_hash [player_name]] if (heal_actor) then - local guid = UnitGUID(player_name) or UnitGUID(UnitName ("raid" .. i)) + local guid = UnitGUID("raid" .. i) this_combat_data.healing [player_name] = {floor(heal_actor.total), _detalhes.item_level_pool [guid] and _detalhes.item_level_pool [guid].ilvl or 0, class or 0} end end @@ -1822,7 +1815,7 @@ function Details.Database.StoreEncounter(combat) my_role = "DAMAGER" end local raid_name = GetInstanceInfo() - local func = {_detalhes.OpenRaidHistoryWindow, _detalhes, raid_name, encounter_id, diff, my_role, guildName} --, 2, UnitName ("player") + local func = {_detalhes.OpenRaidHistoryWindow, _detalhes, raid_name, encounter_id, diff, my_role, guildName} --local icon = {[[Interface\AddOns\Details\images\icons]], 16, 16, false, 434/512, 466/512, 243/512, 273/512} local icon = {[[Interface\PvPRankBadges\PvPRank08]], 16, 16, false, 0, 1, 0, 1} @@ -1966,7 +1959,6 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout) end local average = item_level / item_amount - --print(UnitName (unitid), "ILVL:", average, unitid, "items:", item_amount) --register if (average > 0) then @@ -2006,7 +1998,6 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout) if (talents [1]) then _detalhes.cached_talents [guid] = talents Details:SendEvent("UNIT_TALENTS", nil, unitid, talents, guid) - --print(UnitName (unitid), "talents:", unpack(talents)) end end -------------------------------------------------------------------------------------------------------- @@ -2103,7 +2094,7 @@ function ilvl_core:GetItemLevel (unitid, guid, is_forced, try_number) --NotifyInspect (unitid) end -local NotifyInspectHook = function(unitid) +local NotifyInspectHook = function(unitid) --not in use local unit = unitid:gsub("%d+", "") if ((IsInRaid() or IsInGroup()) and (_detalhes:GetZoneType() == "raid" or _detalhes:GetZoneType() == "party")) then @@ -2144,14 +2135,14 @@ function ilvl_core:QueryInspect (unitName, callback, param1) if (IsInRaid()) then for i = 1, GetNumGroupMembers() do - if (GetUnitName("raid" .. i, true) == unitName) then + if (Details:GetFullName("raid" .. i, "none") == unitName) then unitid = "raid" .. i break end end elseif (IsInGroup()) then for i = 1, GetNumGroupMembers()-1 do - if (GetUnitName("party" .. i, true) == unitName) then + if (Details:GetFullName("party" .. i, "none") == unitName) then unitid = "party" .. i break end diff --git a/core/parser.lua b/core/parser.lua index a94414f8c..abc1cd43a 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -7154,7 +7154,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 actor.classe = classToken or "UNKNOW" elseif (name ~= "Unknown" and type(name) == "string" and string.len(name) > 1) then - local guid = UnitGUID(name) + local guid = UnitGUID(Details:Ambiguate(name)) if (guid) then local flag if (Details.faction_id == faction) then --is from the same faction @@ -7184,7 +7184,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 actor.classe = classToken or "UNKNOW" elseif (name ~= "Unknown" and type(name) == "string" and string.len(name) > 1) then - local guid = UnitGUID(name) + local guid = UnitGUID(Details:Ambiguate(name)) if (guid) then local flag if (Details.faction_id == faction) then --is from the same faction diff --git a/functions/classes.lua b/functions/classes.lua index a5b377931..728673fa8 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -174,6 +174,8 @@ do end end + local _, _, _, toc = GetBuildInfo() --check game version to know which version of GetFullName to use + ---return the class file name of the unit passed local getFromCache = Details222.ClassCache.GetClassFromCache local Ambiguate = Ambiguate @@ -189,6 +191,13 @@ do return classFileName end + function Details:Ambiguate(unitName) + if (toc >= 100200) then + unitName = Ambiguate(unitName, "none") + end + return unitName + end + ---return the class name, class file name and class id of the unit passed function Details:GetUnitClassFull(unitId) unitId = Ambiguate(unitId, "none") @@ -196,20 +205,21 @@ do return locClassName, classFileName, classId end - function Details:GetFullName(unitId) - --playerName, realmName = UnitFullName(unitId) --realm name already has spaces removed - --return playerName .. "-" .. realmName + local UnitFullName = UnitFullName + function Details:GetFullName(unitId, ambiguateString) + --UnitFullName is guarantee to return the realm name of the unit queried + local playerName, realmName = UnitFullName(unitId) + realmName = realmName:gsub("%s", "") - local playerName, realmName = UnitName(unitId) + playerName = playerName .. "-" .. realmName - if (not realmName) then - realmName = GetRealmName():gsub("%s", "") + if (ambiguateString) then + playerName = Ambiguate(playerName, ambiguateString) end - return playerName .. "-" .. realmName + return playerName end - local _, _, _, toc = GetBuildInfo() --check game version to know which version of GetFullName to use if (toc < 100200) then Details.GetFullName = Details.GetCLName end diff --git a/functions/spec_augmentation.lua b/functions/spec_augmentation.lua index 139f44342..f669bdacc 100644 --- a/functions/spec_augmentation.lua +++ b/functions/spec_augmentation.lua @@ -11,7 +11,7 @@ local augmentationCache = Details222.SpecHelpers[1473].augmentation_cache function augmentationFunctions.BuffIn(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellschool, auraType, amount) if (spellId == 395152) then --ebom might on third parties - local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(targetName, spellId, sourceName) + local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = Details:FindBuffCastedByUnitName(Ambiguate(targetName, "none"), spellId, Ambiguate(sourceName, "none")) local attributeGained = v2 if (type(attributeGained) == "number") then