10.2 always send the realm name even if the unit is from the player's realm, this patch fixes the issues caused by the change

This commit is contained in:
Tercio Jose
2023-10-28 16:03:01 -03:00
parent b304b3bbe4
commit f870036f06
8 changed files with 125 additions and 234 deletions
+10
View File
@@ -64,7 +64,17 @@
---@field key5 petname
---@field key6 guid
---@class petownerinfo : table
---@field key1 unitname owner name
---@field key2 guid owner guid
---@field key3 controlflags owner flags
---@field key4 unixtime time when the pet was created
---@field key5 boolean true if the pet is part of the player's group
---@field key6 petname pet name
---@field key7 guid pet guid
---@class details
---@field pets table<guid, petinfo> store the pet guid as the key and the petinfo as the value
---@field SpellTableMixin spelltablemixin
---@field GetInstance fun(self: details) : instance
---@field GetWindow fun(self: details) : instance this is an alias of GetInstance
+3 -3
View File
@@ -685,8 +685,8 @@ end
local petOwnerFound = function(ownerName, petGUID, petName, petFlags, self, ownerGUID)
local ownerGuid = ownerGUID or UnitGUID(ownerName)
if (ownerGuid) then
Details.tabela_pets:Adicionar(petGUID, petName, petFlags, ownerGuid, ownerName, 0x00000417)
local petNameWithOwner, ownerName, ownerGUID, ownerFlags = Details.tabela_pets:PegaDono(petGUID, petName, petFlags)
Details.tabela_pets:AddPet(petGUID, petName, petFlags, ownerGuid, ownerName, 0x00000417)
local petNameWithOwner, ownerName, ownerGUID, ownerFlags = Details.tabela_pets:GetPetOwner(petGUID, petName, petFlags)
local petOwnerActorObject
@@ -721,7 +721,7 @@ end
actorSerial = actorSerial or "ns"
if (container_pets[actorSerial]) then --this is a registered pet
local petName, ownerName, ownerGUID, ownerFlag = Details.tabela_pets:PegaDono(actorSerial, actorName, actorFlags)
local petName, ownerName, ownerGUID, ownerFlag = Details.tabela_pets:GetPetOwner(actorSerial, actorName, actorFlags)
if (petName and ownerName and ownerGUID ~= actorSerial) then
actorName = petName
petOwnerObject = self:PegarCombatente(ownerGUID, ownerName, ownerFlag, true)
+83 -100
View File
@@ -34,85 +34,75 @@ end
local OBJECT_TYPE_PET = 0x00001000
local OBJECT_IN_GROUP = 0x00000007
function container_pets:PegaDono(petGUID, petName, petFlags)
function container_pets:GetPetOwner(petGUID, petName, petFlags)
--sair se o pet estiver na ignore
if (bIsIgnored[petGUID]) then
return
end
--buscar pelo pet no container de pets
local busca = self.pets[petGUID]
if (busca) then
local petInfo = self.pets[petGUID]
if (petInfo) then
--in merging operations, make sure to not add the owner name a second time in the name
--check if the pet name already has the owner name in, if not, add it
if (not petName:find("<")) then
--get the owner name
local ownerName = busca[1]
local ownerName = petInfo[1]
--add the owner name to the pet name
petName = petName .. " <".. ownerName ..">"
end
--return busca[6] or pet_nome, busca[1], busca[2], busca[3] --busca[6] poderia estar causando problemas
return petName, busca[1], busca[2], busca[3] --[1] dono nome[2] dono serial[3] dono flag
return petName, petInfo[1], petInfo[2], petInfo[3] --petName, ownerName, ownerGUID, ownerFlags
end
--buscar pelo pet na raide
local dono_nome, dono_serial, dono_flags
local ownerName, ownerGUID, ownerFlags
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
if (petGUID == UnitGUID("raidpet"..i)) then
dono_serial = UnitGUID(unitIDRaidCache[i])
dono_flags = 0x00000417 --emulate sourceflag flag
local nome, realm = UnitName(unitIDRaidCache[i])
if (realm and realm ~= "") then
nome = nome.."-"..realm
end
dono_nome = nome
ownerGUID = UnitGUID(unitIDRaidCache[i])
ownerFlags = 0x00000417 --emulate sourceflag flag
local unitName = Details:GetFullName(unitIDRaidCache[i])
ownerName = unitName
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1 do
if (petGUID == UnitGUID("partypet"..i)) then
dono_serial = UnitGUID("party"..i)
dono_flags = 0x00000417 --emulate sourceflag flag
local nome, realm = UnitName("party"..i)
if (realm and realm ~= "") then
nome = nome.."-"..realm
end
dono_nome = nome
ownerGUID = UnitGUID("party"..i)
ownerFlags = 0x00000417 --emulate sourceflag flag
local unitName = Details:GetFullName("party"..i)
ownerName = unitName
end
end
end
if (not dono_nome) then
if (not ownerName) then
if (petGUID == UnitGUID("pet")) then
dono_nome = GetUnitName("player")
dono_serial = UnitGUID("player")
ownerName = Details:GetFullName("player")
ownerGUID = UnitGUID("player")
if (IsInGroup() or IsInRaid()) then
dono_flags = 0x00000417 --emulate sourceflag flag
ownerFlags = 0x00000417 --emulate sourceflag flag
else
dono_flags = 0x00000411 --emulate sourceflag flag
ownerFlags = 0x00000411 --emulate sourceflag flag
end
end
end
if (dono_nome) then
self.pets[petGUID] = {dono_nome, dono_serial, dono_flags, Details._tempo, true, petName, petGUID} --adicionada a flag emulada
if (ownerName) then
local foundTime = Details._tempo
self.pets[petGUID] = {ownerName, ownerGUID, ownerFlags, foundTime, true, petName, petGUID} --adicionada a flag emulada
if (not petName:find("<")) then
petName = petName .. " <".. dono_nome ..">"
petName = petName .. " <".. ownerName ..">"
end
return petName, dono_nome, dono_serial, dono_flags
return petName, ownerName, ownerGUID, ownerFlags
else
if (petFlags and bitBand(petFlags, OBJECT_TYPE_PET) ~= 0) then -- um pet
if (petFlags and bitBand(petFlags, OBJECT_TYPE_PET) ~= 0) then --is a pet
if (not Details.pets_no_owner[petGUID] and bitBand(petFlags, OBJECT_IN_GROUP) ~= 0) then
Details.pets_no_owner[petGUID] = {petName, petFlags}
Details:Msg("couldn't find the owner of the pet:", petName)
@@ -121,34 +111,35 @@ function container_pets:PegaDono(petGUID, petName, petFlags)
bIsIgnored[petGUID] = true
end
end
return
end
function container_pets:Unpet(...)
local unitid = ...
local unitId = ...
local ownerGUID = UnitGUID(unitId)
local owner_serial = UnitGUID(unitid)
if (owner_serial) then
--tira o pet existente da tabela de pets e do cache do core
local existing_pet_serial = Details.pets_players[owner_serial]
if (existing_pet_serial) then
Details.parser:RevomeActorFromCache(existing_pet_serial)
container_pets:Remover(existing_pet_serial)
Details.pets_players[owner_serial] = nil
end
--verifica se h um pet novo deste jogador
local pet_serial = UnitGUID(unitid .. "pet")
if (pet_serial) then
if (not Details.tabela_pets.pets[pet_serial]) then
local nome, realm = UnitName(unitid)
if (realm and realm ~= "") then
nome = nome.."-"..realm
end
Details.tabela_pets:Adicionar(pet_serial, UnitName(unitid .. "pet"), 0x1114, owner_serial, nome, 0x514)
if (ownerGUID) then
--remove existing pet from thecache
do
local petGUID = Details.pets_players[ownerGUID]
if (petGUID) then
Details.parser:RevomeActorFromCache(petGUID)
container_pets:Remover(petGUID)
Details.pets_players[ownerGUID] = nil
end
end
--check if the player has a new pet
do
local petGUID = UnitGUID(unitId .. "pet")
if (petGUID) then
if (not Details.tabela_pets.pets[petGUID]) then
local unitName = Details:GetFullName(unitId)
Details.tabela_pets:AddPet(petGUID, UnitName(unitId .. "pet"), 0x1114, ownerGUID, unitName, 0x514)
end
Details.parser:RevomeActorFromCache(petGUID)
container_pets:PlayerPet(ownerGUID, petGUID)
end
Details.parser:RevomeActorFromCache(pet_serial)
container_pets:PlayerPet(owner_serial, pet_serial)
end
end
end
@@ -160,66 +151,58 @@ end
function container_pets:BuscarPets()
if (IsInRaid()) then
for i = 1, GetNumGroupMembers(), 1 do
local pet_serial = UnitGUID("raidpet"..i)
if (pet_serial) then
if (not Details.tabela_pets.pets[pet_serial]) then
local nome, realm = UnitName("raid"..i)
if (realm and realm ~= "") then
nome = nome.."-"..realm
end
local owner_serial = UnitGUID("raid"..i)
Details.tabela_pets:Adicionar(pet_serial, UnitName("raidpet"..i), 0x1114, owner_serial, nome, 0x514)
Details.parser:RevomeActorFromCache(pet_serial)
container_pets:PlayerPet(owner_serial, pet_serial)
local petGUID = UnitGUID("raidpet" .. i)
if (petGUID) then
if (not Details.tabela_pets.pets[petGUID]) then
local unitName = Details:GetFullName(unitIDRaidCache[i])
local ownerGUID = UnitGUID(unitIDRaidCache[i])
Details.tabela_pets:AddPet(petGUID, UnitName("raidpet"..i), 0x1114, ownerGUID, unitName, 0x514)
Details.parser:RevomeActorFromCache(petGUID)
container_pets:PlayerPet(ownerGUID, petGUID)
end
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1, 1 do
local pet_serial = UnitGUID("partypet"..i)
if (pet_serial) then
if (not Details.tabela_pets.pets[pet_serial]) then
local nome, realm = UnitName("party"..i)
if (realm and realm ~= "") then
nome = nome.."-"..realm
end
Details.tabela_pets:Adicionar(pet_serial, UnitName("partypet"..i), 0x1114, UnitGUID("party"..i), nome, 0x514)
local petGUID = UnitGUID("partypet"..i)
if (petGUID) then
if (not Details.tabela_pets.pets[petGUID]) then
local unitName = Details:GetFullName("party"..i)
Details.tabela_pets:AddPet(petGUID, UnitName("partypet"..i), 0x1114, UnitGUID("party"..i), unitName, 0x514)
end
end
end
local pet_serial = UnitGUID("pet")
if (pet_serial) then
if (not Details.tabela_pets.pets[pet_serial]) then
Details.tabela_pets:Adicionar(pet_serial, UnitName("pet"), 0x1114, UnitGUID("player"), Details.playername, 0x514)
local petGUID = UnitGUID("pet")
if (petGUID) then
if (not Details.tabela_pets.pets[petGUID]) then
Details.tabela_pets:AddPet(petGUID, UnitName("pet"), 0x1114, UnitGUID("player"), Details.playername, 0x514)
end
end
else
local pet_serial = UnitGUID("pet")
if (pet_serial) then
if (not Details.tabela_pets.pets[pet_serial]) then
Details.tabela_pets:Adicionar(pet_serial, UnitName("pet"), 0x1114, UnitGUID("player"), Details.playername, 0x514)
local petGUID = UnitGUID("pet")
if (petGUID) then
if (not Details.tabela_pets.pets[petGUID]) then
Details.tabela_pets:AddPet(petGUID, UnitName("pet"), 0x1114, UnitGUID("player"), Details.playername, 0x514)
end
end
end
end
function container_pets:Remover(pet_serial)
if (Details.tabela_pets.pets[pet_serial]) then
Details:Destroy(Details.tabela_pets.pets[pet_serial])
function container_pets:Remover(petGUID)
if (Details.tabela_pets.pets[petGUID]) then
Details:Destroy(Details.tabela_pets.pets[petGUID])
end
Details.tabela_pets.pets[pet_serial] = nil
Details.tabela_pets.pets[petGUID] = nil
end
function container_pets:Adicionar(pet_serial, pet_nome, pet_flags, dono_serial, dono_nome, dono_flags)
if (pet_flags and bitBand(pet_flags, OBJECT_TYPE_PET) ~= 0 and bitBand(pet_flags, OBJECT_IN_GROUP) ~= 0) then
self.pets[pet_serial] = {dono_nome, dono_serial, dono_flags, Details._tempo, true, pet_nome, pet_serial}
function container_pets:AddPet(petGUID, petName, petFlags, ownerGUID, ownerName, ownerFlags)
if (petFlags and bitBand(petFlags, OBJECT_TYPE_PET) ~= 0 and bitBand(petFlags, OBJECT_IN_GROUP) ~= 0) then
self.pets[petGUID] = {ownerName, ownerGUID, ownerFlags, Details._tempo, true, petName, petGUID}
else
self.pets[pet_serial] = {dono_nome, dono_serial, dono_flags, Details._tempo, false, pet_nome, pet_serial}
self.pets[petGUID] = {ownerName, ownerGUID, ownerFlags, Details._tempo, false, petName, petGUID}
end
end
@@ -242,18 +225,18 @@ function Details222.Pets.PetContainerCleanup()
Details:UpdatePetCache()
end
local have_schedule = false
local bHasSchedule = false
function Details:UpdatePets()
have_schedule = false
bHasSchedule = false
return container_pets:BuscarPets()
end
function Details:SchedulePetUpdate(seconds)
if (have_schedule) then
if (bHasSchedule) then
return
end
have_schedule = true
bHasSchedule = true
--_detalhes:ScheduleTimer("UpdatePets", seconds or 5)
Details.Schedules.NewTimer(seconds or 5, Details.UpdatePets, Details)
end
-98
View File
@@ -1247,107 +1247,9 @@
end
function Details:MakeEqualizeOnActor (player, realm, receivedActor)
if (true) then --disabled for testing
return
end
local combat = Details:GetCombat("current")
local damage, heal, energy, misc = Details:GetAllActors("current", player)
if (not damage and not heal and not energy and not misc) then
--try adding server name
damage, heal, energy, misc = Details:GetAllActors("current", player.."-"..realm)
if (not damage and not heal and not energy and not misc) then
--not found any actor object, so we need to create
local actorName
if (realm ~= GetRealmName()) then
actorName = player.."-"..realm
else
actorName = player
end
local guid = Details:FindGUIDFromName (player)
-- 0x512 normal party
-- 0x514 normal raid
if (guid) then
damage = combat [1]:PegarCombatente (guid, actorName, 0x514, true)
heal = combat [2]:PegarCombatente (guid, actorName, 0x514, true)
energy = combat [3]:PegarCombatente (guid, actorName, 0x514, true)
misc = combat [4]:PegarCombatente (guid, actorName, 0x514, true)
if (Details.debug) then
Details:Msg("(debug) equalize received actor:", actorName, damage, heal)
end
else
if (Details.debug) then
Details:Msg("(debug) equalize couldn't get guid for player ",player)
end
end
end
end
combat[1].need_refresh = true
combat[2].need_refresh = true
combat[3].need_refresh = true
combat[4].need_refresh = true
if (damage) then
if (damage.total < receivedActor [1][1]) then
if (Details.debug) then
Details:Msg(player .. " damage before: " .. damage.total .. " damage received: " .. receivedActor [1][1])
end
damage.total = receivedActor [1][1]
end
if (damage.damage_taken < receivedActor [1][2]) then
damage.damage_taken = receivedActor [1][2]
end
if (damage.friendlyfire_total < receivedActor [1][3]) then
damage.friendlyfire_total = receivedActor [1][3]
end
end
if (heal) then
if (heal.total < receivedActor [2][1]) then
heal.total = receivedActor [2][1]
end
if (heal.totalover < receivedActor [2][2]) then
heal.totalover = receivedActor [2][2]
end
if (heal.healing_taken < receivedActor [2][3]) then
heal.healing_taken = receivedActor [2][3]
end
end
if (energy) then
if (energy.mana and (receivedActor [3][1] > 0 and energy.mana < receivedActor [3][1])) then
energy.mana = receivedActor [3][1]
end
if (energy.e_rage and (receivedActor [3][2] > 0 and energy.e_rage < receivedActor [3][2])) then
energy.e_rage = receivedActor [3][2]
end
if (energy.e_energy and (receivedActor [3][3] > 0 and energy.e_energy < receivedActor [3][3])) then
energy.e_energy = receivedActor [3][3]
end
if (energy.runepower and (receivedActor [3][4] > 0 and energy.runepower < receivedActor [3][4])) then
energy.runepower = receivedActor [3][4]
end
end
if (misc) then
if (misc.interrupt and (receivedActor [4][1] > 0 and misc.interrupt < receivedActor [4][1])) then
misc.interrupt = receivedActor [4][1]
end
if (misc.dispell and (receivedActor [4][2] > 0 and misc.dispell < receivedActor [4][2])) then
misc.dispell = receivedActor [4][2]
end
end
end
function Details:EqualizePets()
+4 -4
View File
@@ -1975,8 +1975,8 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout)
end
if (average > MIN_ILEVEL_TO_STORE) then
local name = _detalhes:GetCLName(unitid)
_detalhes.item_level_pool [guid] = {name = name, ilvl = average, time = time()}
local unitName = Details:GetFullName(unitid)
_detalhes.item_level_pool [guid] = {name = unitName, ilvl = average, time = time()}
end
end
@@ -2108,10 +2108,10 @@ local NotifyInspectHook = function(unitid)
if ((IsInRaid() or IsInGroup()) and (_detalhes:GetZoneType() == "raid" or _detalhes:GetZoneType() == "party")) then
local guid = UnitGUID(unitid)
local name = _detalhes:GetCLName(unitid)
local name = Details:GetFullName(unitid)
if (guid and name and not inspecting [guid]) then
for i = 1, GetNumGroupMembers() do
if (name == _detalhes:GetCLName(unit .. i)) then
if (name == Details:GetFullName(unit .. i)) then
unitid = unit .. i
break
end
+5 -7
View File
@@ -2196,8 +2196,6 @@
--10/30 15:34:47.249 SPELL_EMPOWER_START,Player-4184-0048EE5B,"Nezaland-Valdrakken",0x514,0x0,Player-4184-0048EE5B,"Nezaland-Valdrakken",0x514,0x0,382266,"Fire Breath",0x4
--357209 damage spell is different from the spell cast
local playerNameWithRealm = UnitName("player") .."-".. GetRealmName()
-----------------------------------------------------------------------------------------------------------------------------------------
--SUMMON serach key: ~summon |
-----------------------------------------------------------------------------------------------------------------------------------------
@@ -2224,7 +2222,7 @@
if (isWOTLK) then
if (npcId == 15439) then
Details.tabela_pets:Adicionar(petSerial:gsub("%-15439%-", "%-15438%-"), "Greater Fire Elemental", petFlags, sourceSerial, sourceName, sourceFlags)
Details.tabela_pets:AddPet(petSerial:gsub("%-15439%-", "%-15438%-"), "Greater Fire Elemental", petFlags, sourceSerial, sourceName, sourceFlags)
elseif (npcId == 15438) then
return
@@ -2242,7 +2240,7 @@
sourceName, sourceSerial, sourceFlags = petTable[1], petTable[2], petTable[3]
end
Details.tabela_pets:Adicionar(petSerial, petName, petFlags, sourceSerial, sourceName, sourceFlags)
Details.tabela_pets:AddPet(petSerial, petName, petFlags, sourceSerial, sourceName, sourceFlags)
end
-----------------------------------------------------------------------------------------------------------------------------------------
@@ -3674,7 +3672,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local onUnitPowerUpdate = function(self, event, unitID, powerType)
if (powerType == "ALTERNATE") then
local actorName = Details:GetCLName(unitID)
local actorName = Details:GetFullName(unitID)
if (actorName) then
local power = _current_combat.alternate_power[actorName]
if (not power) then
@@ -3961,7 +3959,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
if (not ownerActor) then
petName, ownerName, ownerGUID, ownerFlags = Details.tabela_pets:PegaDono(sourceSerial, sourceName, sourceFlags)
petName, ownerName, ownerGUID, ownerFlags = Details.tabela_pets:GetPetOwner(sourceSerial, sourceName, sourceFlags)
if (petName) then
ownerActor = _current_misc_container:GetOrCreateActor(ownerGUID, ownerName, ownerFlags, true)
--print("pet found:", petName, ownerName, ownerGUID, ownerFlags)
@@ -5929,7 +5927,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (serial and serial ~= UnitGUID("player") and serial:find("Player")) then
Details.duel_candidates[serial] = GetTime()
local playerName = Details:GetCLName(unit)
local playerName = Details:GetFullName(unit)
--check if the player is inside the current combat and flag the objects
if (playerName and _current_combat) then
+19
View File
@@ -101,6 +101,10 @@ do
CONTAINER_ENEMYDEBUFFTARGET_CLASS = 11
}
local UnitName = UnitName
local GetRealmName = GetRealmName
local initialSpecListOverride = {
[1455] = 251, --dk
[1456] = 577, --demon hunter
@@ -170,6 +174,21 @@ do
end
end
function Details:GetFullName(unitId)
local playerName, realmName = UnitName(unitId)
if (not realmName) then
realmName = GetRealmName()
end
return playerName .. "-" .. realmName
end
local _, _, _, toc = GetBuildInfo() --check game version to know which version of GetFullName to use
if (toc < 100200) then
Details.GetFullName = Details.GetCLName
end
function Details:Class(actor)
return self.classe or actor and actor.classe
end
+1 -22
View File
@@ -418,27 +418,6 @@ function SlashCmdList.DETAILS (msg, editbox)
end
print(nome, realm)
elseif (msg == "raid") then
local player, realm = "Ditador", "Azralon"
local actorName
if (realm ~= GetRealmName()) then
actorName = player.."-"..realm
else
actorName = player
end
print(actorName)
local guid = Details:FindGUIDFromName ("Ditador")
print(guid)
for i = 1, GetNumGroupMembers()-1, 1 do
local name, realm = UnitName ("party"..i)
print(name, " -- ", realm)
end
elseif (msg == "cacheparser") then
Details:PrintParserCacheIndexes()
elseif (msg == "parsercache") then
@@ -2221,7 +2200,7 @@ if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) then
local guildUsers = {}
local totalMembers, onlineMembers, onlineAndMobileMembers = GetNumGuildMembers()
local realmName = GetRealmName()
--create a string to use into the gsub call when removing the realm name from the player name, by default all player names returned from GetGuildRosterInfo() has PlayerName-RealmName format
local realmNameGsub = "%-.*"
local guildName = GetGuildInfo("player")