Api update with Details:GetActorFromCache(unitName or GUID) only work during combat, very fast way to get a danage actorObject
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local dversion = 408
|
||||
local dversion = 409
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary(major, minor)
|
||||
|
||||
|
||||
+3
-1
@@ -6838,8 +6838,10 @@ detailsFramework.StatusBarFunctions = {
|
||||
self.barTextureMask:SetTexture([[Interface\CHATFRAME\CHATFRAMEBACKGROUND]])
|
||||
|
||||
--border texture
|
||||
self.barBorderTextureForMask = self:CreateTexture(nil, "artwork", nil, 7)
|
||||
self.barBorderTextureForMask = self:CreateTexture(nil, "overlay", nil, 7)
|
||||
self.barBorderTextureForMask:SetAllPoints()
|
||||
--self.barBorderTextureForMask:SetPoint("topleft", self, "topleft", -1, 1)
|
||||
--self.barBorderTextureForMask:SetPoint("bottomright", self, "bottomright", 1, -1)
|
||||
self.barBorderTextureForMask:Hide()
|
||||
|
||||
barTexture:AddMaskTexture(self.barTextureMask)
|
||||
|
||||
@@ -73,38 +73,60 @@
|
||||
|
||||
local debugPetname = false
|
||||
|
||||
local KirinTor = GetFactionInfoByID (1090) or "1"
|
||||
local Valarjar = GetFactionInfoByID (1948) or "1"
|
||||
local HighmountainTribe = GetFactionInfoByID (1828) or "1"
|
||||
local CourtofFarondis = GetFactionInfoByID (1900) or "1"
|
||||
local Dreamweavers = GetFactionInfoByID (1883) or "1"
|
||||
local TheNightfallen = GetFactionInfoByID (1859) or "1"
|
||||
local TheWardens = GetFactionInfoByID (1894) or "1"
|
||||
|
||||
local SPELLID_SANGUINE_HEAL = 226510
|
||||
local sanguineActorName = GetSpellInfo(SPELLID_SANGUINE_HEAL)
|
||||
|
||||
local IsFactionNpc = {
|
||||
[KirinTor] = true,
|
||||
[Valarjar] = true,
|
||||
[HighmountainTribe] = true,
|
||||
[CourtofFarondis] = true,
|
||||
[Dreamweavers] = true,
|
||||
[TheNightfallen] = true,
|
||||
[TheWardens] = true,
|
||||
}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--api functions
|
||||
|
||||
---attempt to the owner of a pet using tooltip scan, if the owner isn't found, return nil
|
||||
---@param petGUID string
|
||||
---@param petName string
|
||||
---@return string|nil ownerName
|
||||
---@return string|nil ownerGUID
|
||||
---@return integer|nil ownerFlags
|
||||
function Details222.Pets.GetPetOwner(petGUID, petName)
|
||||
pet_tooltip_frame:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
pet_tooltip_frame:SetHyperlink(("unit:" .. petGUID) or "")
|
||||
|
||||
if (bIsDragonflight) then
|
||||
local tooltipData = pet_tooltip_frame:GetTooltipData()
|
||||
if (tooltipData and tooltipData.lines[1]) then
|
||||
if (tooltipData.lines[1].leftText == petName) then
|
||||
local tooltipData = pet_tooltip_frame:GetTooltipData() --is pet tooltip reliable with the new tooltips changes?
|
||||
if (tooltipData) then
|
||||
local tooltipLines = tooltipData.lines
|
||||
for lineIndex = 1, #tooltipLines do
|
||||
local thisLine = tooltipLines[lineIndex]
|
||||
--get the type of information this line is showing
|
||||
local lineType = thisLine.type --type 0 = 'friendly' type 2 = 'name' type 16 = controller guid
|
||||
|
||||
--parse the different types of information
|
||||
if (lineType == 2) then --unit name
|
||||
if (thisLine.leftText ~= petName) then
|
||||
--tooltip isn't showing our pet
|
||||
return
|
||||
end
|
||||
|
||||
elseif (lineType == 16) then --controller guid
|
||||
--assuming the unit name always comes before the controller guid
|
||||
local GUID = thisLine.guid
|
||||
--very fast way to get an actorObject, this cache only lives while in combat
|
||||
local actorObject = Details:GetActorFromCache(GUID)
|
||||
if (actorObject) then
|
||||
--Details:Msg("(debug) pet found (1)", petName, "owner:", actorObject.nome)
|
||||
return actorObject.nome, GUID, actorObject.flag_original
|
||||
else
|
||||
--return the actor name for a guid, this cache lives for current combat until next segment
|
||||
local guidCache = Details:GetParserPlayerCache()
|
||||
local ownerName = guidCache[GUID]
|
||||
if (ownerName) then
|
||||
--Details:Msg("(debug) pet found (2)", petName, "owner:", ownerName)
|
||||
return ownerName, GUID, 0x514
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[=[
|
||||
if (tooltipData.lines[1].leftText == petName) then --should rely on the first line carrying the pet name?
|
||||
for i = 2, #tooltipData.lines do
|
||||
local tooltipLine = tooltipData.lines[i]
|
||||
local args = tooltipLine.args
|
||||
@@ -114,12 +136,13 @@
|
||||
local guidCache = Details:GetParserPlayerCache()
|
||||
local ownerName = guidCache[ownerGUID]
|
||||
if (ownerName) then
|
||||
return ownerName, ownerGUID
|
||||
return ownerName, ownerGUID, 0x514
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--]=]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6340,6 +6340,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
container_pets = _detalhes.tabela_pets.pets
|
||||
end
|
||||
|
||||
function Details:GetActorFromCache(value)
|
||||
return damage_cache[value] or damage_cache_pets[value] or damage_cache_petsOwners[value]
|
||||
end
|
||||
|
||||
function _detalhes:PrintParserCacheIndexes()
|
||||
local amount = 0
|
||||
for n, nn in pairs(damage_cache) do
|
||||
|
||||
Reference in New Issue
Block a user