Using portrait for enemy faces

This commit is contained in:
Tercio Jose
2022-12-02 19:32:51 -03:00
parent f17f8642b7
commit 5571749ef6
12 changed files with 328 additions and 224 deletions
+1
View File
@@ -61,6 +61,7 @@ functions\macros.lua
functions\testbars.lua
functions\editmode.lua
functions\warcraftlogs.lua
functions\textures.lua
core\timemachine.lua
-141
View File
@@ -1,141 +0,0 @@
## Interface: 20504
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## SavedVariables: _detalhes_global
## SavedVariablesPerCharacter: _detalhes_database
## OptionalDeps: Ace3, LibSharedMedia-3.0, LibWindow-1.1, LibDBIcon-1.0, NickTag-1.0, LibDataBroker-1.1, LibItemUpgradeInfo-1.0, LibGroupInSpecT-1.1, LibCompress, LibGraph-2.0
#@no-lib-strip@
Libs\libs.xml
#@end-no-lib-strip@
locales\Details-enUS.lua
locales\Details-deDE.lua
locales\Details-esES.lua
locales\Details-esMX.lua
locales\Details-frFR.lua
locales\Details-itIT.lua
locales\Details-koKR.lua
locales\Details-ptBR.lua
locales\Details-ruRU.lua
locales\Details-zhCN.lua
locales\Details-zhTW.lua
boot.lua
indent.lua
core\util.lua
API.lua
functions\private.lua
functions\profiles.lua
functions\hooks.lua
functions\bossmods.lua
functions\coach.lua
functions\skins.lua
functions\boss.lua
functions\spells.lua
functions\events.lua
functions\classes.lua
functions\buff.lua
functions\spellcache.lua
functions\attributes.lua
functions\savedata.lua
functions\slash.lua
functions\playerclass.lua
functions\timedata.lua
functions\currentdps.lua
functions\report.lua
functions\rowanimation.lua
functions\raidinfo.lua
functions\dungeon.lua
functions\pack.lua
functions\mythicdungeon.lua
functions\immersion.lua
functions\schedules.lua
functions\autorun.lua
functions\deathrecap.lua
functions\plater.lua
functions\deathmenu.lua
functions\macros.lua
functions\testbars.lua
functions\warcraftlogs.lua
core\timemachine.lua
frames\anime.lua
frames\anime.xml
frames\fw_mods.lua
frames\toolbar_button.xml
frames\window_copy.lua
frames\window_options2.lua
frames\window_options2_sections.lua
frames\window_api.lua
frames\window_cdtracker.lua
frames\window_playerbreakdown.lua
frames\window_playerbreakdown_list.lua
frames\window_report.lua
frames\window_main.lua
frames\window_custom.lua
frames\window_welcome.lua
frames\window_news.lua
frames\window_wa.lua
frames\window_spellcategory.lua
frames\window_forge.lua
frames\window_switch.lua
frames\window_scrolldamage.lua
frames\window_dump.lua
frames\window_eventtracker.lua
frames\window_currentdps.lua
frames\window_benchmark.lua
frames\window_runcode.lua
frames\window_plater.lua
frames\window_macros.lua
frames\window_profiler.lua
frames\window_rowtexteditor.lua
frames\window_brokertexteditor.lua
frames\window_bookmark.lua
frames\window_classcolor.lua
frames\window_statistics.lua
classes\class_error.lua
classes\class_combat.lua
classes\class_damage.lua
classes\class_spelldamage.lua
classes\class_heal.lua
classes\class_spellhealing.lua
classes\class_resources.lua
classes\class_spellresources.lua
classes\class_utility.lua
classes\class_spellutility.lua
classes\include_instance.lua
classes\class_instance.lua
classes\class_custom.lua
classes\custom_damagedone.lua
classes\custom_healingdone.lua
core\control.lua
classes\container_actors.lua
classes\container_spells.lua
classes\container_segments.lua
classes\container_pets.lua
core\plugins.lua
core\plugins_toolbar.lua
core\plugins_statusbar.lua
core\plugins_raid.lua
core\plugins_solo.lua
core\gears.lua
core\windows.lua
core\meta.lua
core\network.lua
core\parser.lua
#core\parser_timewalk.lua
functions\loaddata.lua
startup.lua
functions\api2.lua
+1
View File
@@ -58,6 +58,7 @@ functions\deathmenu.lua
functions\macros.lua
functions\testbars.lua
functions\warcraftlogs.lua
functions\textures.lua
core\timemachine.lua
+112 -15
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 7
local version = 8
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -1069,30 +1069,91 @@ function DF:CreateCoolTip()
--left icon
if (leftIconSettings and leftIconSettings[1]) then
menuButton.leftIcon:SetTexture(leftIconSettings[1])
menuButton.leftIcon:SetWidth(leftIconSettings[2])
menuButton.leftIcon:SetHeight(leftIconSettings[3])
menuButton.leftIcon:SetTexCoord(leftIconSettings[4], leftIconSettings[5], leftIconSettings[6], leftIconSettings[7])
local textureObject = menuButton.leftIcon
local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(leftIconSettings[8])
menuButton.leftIcon:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha)
--check if the texture passed is a texture object
if (type(leftIconSettings[1]) == "table" and leftIconSettings[1].GetObjectType and leftIconSettings[1]:GetObjectType() == "Texture") then
menuButton.leftIcon:SetSize(leftIconSettings[2], leftIconSettings[3])
menuButton.leftIcon:SetColorTexture(0.0156, 0.047, 0.1215, 1)
textureObject = leftIconSettings[1]
textureObject:SetParent(menuButton.leftIcon:GetParent())
textureObject:ClearAllPoints()
textureObject:SetDrawLayer("overlay", 7)
textureObject:Show()
if (gameCooltip.OptionsTable.IconBlendMode) then
menuButton.leftIcon:SetBlendMode(gameCooltip.OptionsTable.IconBlendMode)
for i = 1, menuButton.leftIcon:GetNumPoints() do
local anchor1, anchorFrame, anchor2, x, y = menuButton.leftIcon:GetPoint(i)
textureObject:SetPoint(anchor1, anchorFrame, anchor2, x, y)
end
menuButton.customLeftTexture = textureObject
else
menuButton.leftIcon:SetBlendMode("BLEND")
if (menuButton.customLeftTexture) then
menuButton.customLeftTexture:Hide()
menuButton.customLeftTexture = nil
end
menuButton.leftIcon:Show()
menuButton.leftIcon:SetTexture(leftIconSettings[1])
end
menuButton.leftIcon:SetDesaturated(leftIconSettings[9])
textureObject:SetWidth(leftIconSettings[2])
textureObject:SetHeight(leftIconSettings[3])
textureObject:SetTexCoord(leftIconSettings[4], leftIconSettings[5], leftIconSettings[6], leftIconSettings[7])
local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(leftIconSettings[8])
textureObject:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha)
if (gameCooltip.OptionsTable.IconBlendMode) then
textureObject:SetBlendMode(gameCooltip.OptionsTable.IconBlendMode)
else
textureObject:SetBlendMode("BLEND")
end
textureObject:SetDesaturated(leftIconSettings[9])
else
menuButton.leftIcon:SetTexture("")
menuButton.leftIcon:SetWidth(1)
menuButton.leftIcon:SetHeight(1)
local textureObject = menuButton.leftIcon
textureObject:SetTexture("")
textureObject:SetWidth(1)
textureObject:SetHeight(1)
if (menuButton.customLeftTexture) then
menuButton.customLeftTexture:Hide()
menuButton.customLeftTexture = nil
end
end
--right icon
if (rightIconSettings and rightIconSettings[1]) then
menuButton.rightIcon:SetTexture(rightIconSettings[1])
local textureObject = menuButton.rightIcon
--check if the texture passed is a texture object
if (type(rightIconSettings[1]) == "table" and rightIconSettings[1].GetObjectType and rightIconSettings[1]:GetObjectType() == "Texture") then
menuButton.rightIcon:SetSize(leftIconSettings[2], leftIconSettings[3])
menuButton.rightIcon:SetColorTexture(0.0156, 0.047, 0.1215, 1)
textureObject = rightIconSettings[1]
textureObject:SetParent(menuButton)
textureObject:ClearAllPoints()
textureObject:SetDrawLayer("overlay", 7)
textureObject:Show()
for i = 1, menuButton.rightIcon:GetNumPoints() do
local anchor1, anchorFrame, anchor2, x, y = menuButton.rightIcon:GetPoint(i)
textureObject:SetPoint(anchor1, anchorFrame, anchor2, x, y)
end
menuButton.customRightTexture = textureObject
else
if (menuButton.customRightTexture) then
menuButton.customRightTexture:Hide()
menuButton.customRightTexture = nil
end
menuButton.rightIcon:Show()
menuButton.rightIcon:SetTexture(rightIconSettings[1])
end
menuButton.rightIcon:SetWidth(rightIconSettings[2])
menuButton.rightIcon:SetHeight(rightIconSettings[3])
menuButton.rightIcon:SetTexCoord(rightIconSettings[4], rightIconSettings[5], rightIconSettings[6], rightIconSettings[7])
@@ -1111,6 +1172,11 @@ function DF:CreateCoolTip()
menuButton.rightIcon:SetTexture("")
menuButton.rightIcon:SetWidth(1)
menuButton.rightIcon:SetHeight(1)
if (menuButton.customRightTexture) then
menuButton.customRightTexture:Hide()
menuButton.customRightTexture = nil
end
end
--overwrite icon size
@@ -3048,6 +3114,37 @@ function DF:CreateCoolTip()
gameCooltip.Host = nil
DF:FadeFrame(frame1, 1)
DF:FadeFrame(frame2, 1)
--release custom icon texture objects, these are TextureObject passed with AddIcon() instead of a texture path or textureId
for i = 1, #frame1.Lines do
local menuButton = frame1.Lines[i]
--relase custom icon texture if any
if (menuButton.customLeftTexture) then
menuButton.customLeftTexture:ClearAllPoints()
menuButton.customLeftTexture = nil
end
if (menuButton.customRightTexture) then
menuButton.customRightTexture:ClearAllPoints()
menuButton.customRightTexture = nil
end
end
for i = 1, #frame2.Lines do
local menuButton = frame2.Lines[i]
--relase custom icon texture if any
if (menuButton.customLeftTexture) then
menuButton.customLeftTexture:ClearAllPoints()
menuButton.customLeftTexture = nil
end
if (menuButton.customRightTexture) then
menuButton.customRightTexture:ClearAllPoints()
menuButton.customRightTexture = nil
end
end
end
--old function call
+9 -2
View File
@@ -1,6 +1,6 @@
local dversion = 399
local dversion = 401
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -100,6 +100,13 @@ function DF.IsWotLKWow()
end
end
function DF.IsWotLKWowWithRetailAPI()
local _, _, _, buildInfo = GetBuildInfo()
if (buildInfo < 40000 and buildInfo >= 30401) then
return true
end
end
function DF.IsShadowlandsWow()
local _, _, _, buildInfo = GetBuildInfo()
if (buildInfo < 100000 and buildInfo >= 90000) then
@@ -2995,7 +3002,7 @@ function DF:CreateAnimation(animation, animationType, order, duration, arg1, arg
anim:SetToAlpha(arg2)
elseif (animationType == "SCALE") then
if (DF.IsDragonflight()) then
if (DF.IsDragonflight() or DF.IsWotLKWowWithRetailAPI()) then
anim:SetScaleFrom(arg1, arg2)
anim:SetScaleTo(arg3, arg4)
else
+7 -2
View File
@@ -11,7 +11,7 @@
_detalhes.dont_open_news = true
_detalhes.game_version = version
_detalhes.userversion = version .. " " .. _detalhes.build_counter
_detalhes.realversion = 147 --core version, this is used to check API version for scripts and plugins (see alias below)
_detalhes.realversion = 148 --core version, this is used to check API version for scripts and plugins (see alias below)
_detalhes.APIVersion = _detalhes.realversion --core version
_detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" --simple stirng to show to players
@@ -58,7 +58,7 @@
DamageSpellsCache = {}
}
--color namespace
--namespace color
Details222.ColorScheme = {
["gradient-background"] = {0.1215, 0.1176, 0.1294, 0.8},
}
@@ -67,8 +67,13 @@
return Details222.ColorScheme[colorScheme]
end
--namespace for damage spells (spellTable)
Details222.DamageSpells = {}
--namespace for texture
Details222.Textures = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
local _
+83 -64
View File
@@ -3174,6 +3174,8 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown)
r, g, b = unpack(Details.class_colors [self.classe])
end
local combatObject = instancia:GetShowingCombat()
--habilidades
local icon_size = Details.tooltip.icon_size
local icon_border = Details.tooltip.icon_border_texcoord
@@ -3219,18 +3221,21 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown)
end
end
--sort
_table_sort(ActorSkillsSortTable, Details.Sort2)
table.sort(ActorSkillsSortTable, Details.Sort2)
--TOP INIMIGOS
--get variables
local ActorTargetsSortTable = {}
--add
for target_name, amount in pairs(self.targets) do
ActorTargetsSortTable [#ActorTargetsSortTable+1] = {target_name, amount}
for targetName, amount in pairs(self.targets) do
local targetActorObject = combatObject(DETAILS_ATTRIBUTE_DAMAGE, targetName)
local npcId = targetActorObject and targetActorObject.aID
npcId = tonumber(npcId or 0)
ActorTargetsSortTable[#ActorTargetsSortTable+1] = {targetName, amount, npcId}
end
--sort
_table_sort(ActorTargetsSortTable, Details.Sort2)
table.sort(ActorTargetsSortTable, Details.Sort2)
--tooltip stuff
local tooltip_max_abilities = Details.tooltip.tooltip_max_abilities
@@ -3316,13 +3321,12 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown)
end
--MOSTRA INIMIGOS
local topEnemy = ActorTargetsSortTable [1] and ActorTargetsSortTable [1][2] or 0
local topEnemy = ActorTargetsSortTable[1] and ActorTargetsSortTable[1][2] or 0
if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then
--small blank space
Details:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true)
Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true)
Details:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #ActorTargetsSortTable, [[Interface\Addons\Details\images\icons]], 0, 0.03125, 0.126953125, 0.15625)
Details:AddTooltipSpellHeaderText(Loc ["STRING_TARGETS"], headerColor, #ActorTargetsSortTable, [[Interface\Addons\Details\images\icons]], 0, 0.03125, 0.126953125, 0.15625)
local max_targets = Details.tooltip.tooltip_max_targets
local is_maximized = false
@@ -3333,18 +3337,25 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown)
if (is_maximized) then
--highlight
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
Details:AddTooltipHeaderStatusbar (r, g, b, 1)
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
Details:AddTooltipHeaderStatusbar(r, g, b, 1)
else
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
Details:AddTooltipHeaderStatusbar (r, g, b, barAlha)
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
end
for i = 1, _math_min(max_targets, #ActorTargetsSortTable) do
local este_inimigo = ActorTargetsSortTable [i]
GameCooltip:AddLine(este_inimigo[1], FormatTooltipNumber (_, este_inimigo[2]) .." ("..format("%.1f", este_inimigo[2]/ActorDamageWithPet*100).."%)")
GameCooltip:AddIcon ([[Interface\PetBattles\PetBattle-StatIcons]], nil, nil, icon_size.W, icon_size.H, 0, 0.5, 0, 0.5, {.7, .7, .7, 1}, nil, true)
Details:AddTooltipBackgroundStatusbar (false, este_inimigo[2] / topEnemy * 100)
for i = 1, math.min(max_targets, #ActorTargetsSortTable) do
local enemyTable = ActorTargetsSortTable[i]
GameCooltip:AddLine(enemyTable[1], FormatTooltipNumber(_, enemyTable[2]) .." ("..format("%.1f", enemyTable[2] / ActorDamageWithPet * 100).."%)")
local portraitTexture = Details222.Textures.GetPortraitTextureForNpcID(enemyTable[3])
if (portraitTexture) then
GameCooltip:AddIcon(portraitTexture, 1, 1, icon_size.W, icon_size.H)
else
GameCooltip:AddIcon([[Interface\PetBattles\PetBattle-StatIcons]], nil, nil, icon_size.W, icon_size.H, 0, 0.5, 0, 0.5, {.7, .7, .7, 1}, nil, true)
end
Details:AddTooltipBackgroundStatusbar(false, enemyTable[2] / topEnemy * 100)
end
end
end
@@ -4525,42 +4536,42 @@ function atributo_damage:MontaInfoDamageDone()
self:FocusLock(barra, tabela[1])
end
--TOP INIMIGOS
if (instance.sub_atributo == 6) then
local damage_taken = self.damage_taken
local agressores = self.damage_from
local tabela_do_combate = instance.showing
local showing = tabela_do_combate [class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable
--targets
if (instance.sub_atributo == DETAILS_SUBATTRIBUTE_ENEMIES) then
local totalDamageTaken = self.damage_taken
local damageTakenFrom = self.damage_from
local combatObject = instance:GetShowingCombat()
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local barras = info.barras2
local meus_agressores = {}
local enemyTable = {}
local targetName = self:Name()
local este_agressor
for nome, _ in pairs(agressores) do
este_agressor = showing._ActorTable[showing._NameIndexTable[nome]]
if (este_agressor) then
local este_alvo = este_agressor.targets [self.nome]
if (este_alvo) then
meus_agressores [#meus_agressores+1] = {nome, este_alvo, este_alvo/damage_taken*100, este_agressor.classe}
local enemyActorObject
for enemyName in pairs(damageTakenFrom) do
enemyActorObject = damageContainer:GetActor(enemyName)
if (enemyActorObject) then
local damageDoneToTarget = enemyActorObject.targets[targetName]
if (damageDoneToTarget) then
local npcId = DetailsFramework:GetNpcIdFromGuid(enemyActorObject:GetGUID())
enemyTable[#enemyTable+1] = {enemyName, damageDoneToTarget, damageDoneToTarget / totalDamageTaken * 100, enemyActorObject:Class(), npcId}
end
end
end
local amt = #meus_agressores
local enemyAmount = #enemyTable
if (amt < 1) then --caso houve apenas friendly fire
if (enemyAmount < 1) then
return true
end
gump:JI_AtualizaContainerAlvos (amt)
gump:JI_AtualizaContainerAlvos(enemyAmount)
--_table_sort(meus_agressores, function(a, b) return a[2] > b[2] end)
_table_sort(meus_agressores, Details.Sort2)
table.sort(enemyTable, Details.Sort2)
local max_ = meus_agressores[1] and meus_agressores[1][2] or 0 --dano que a primeiro magia vez
local topDamage = enemyTable[1] and enemyTable[1][2] or 0
local barra
for index, tabela in ipairs(meus_agressores) do
for index, tabela in ipairs(enemyTable) do
barra = barras [index]
if (not barra) then --se a barra no existir, criar ela ento
@@ -4571,7 +4582,7 @@ function atributo_damage:MontaInfoDamageDone()
if (index == 1) then
barra.textura:SetValue(100)
else
barra.textura:SetValue(tabela[2]/max_*100)
barra.textura:SetValue(tabela[2] / topDamage * 100)
end
barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(tabela[1])) --seta o texto da esqueda
@@ -4614,45 +4625,53 @@ function atributo_damage:MontaInfoDamageDone()
barra:Show() --mostra a barra
end
else
local meus_inimigos = {}
local combatObject = instance:GetShowingCombat()
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local allActorTargets = {}
--my target container
conteudo = self.targets --warning: global
for target_name, amount in pairs(conteudo) do
tinsert(meus_inimigos, {target_name, amount, amount/totalDamageWithoutPet*100})
--table with actor names and damage done which the player caused damage to
local targetsTable = self.targets
for targetName, damageDone in pairs(targetsTable) do
tinsert(allActorTargets, {targetName, damageDone, damageDone / totalDamageWithoutPet * 100})
end
--sort
_table_sort(meus_inimigos, Details.Sort2)
table.sort(allActorTargets, Details.Sort2)
local amt_alvos = #meus_inimigos
if (amt_alvos < 1) then
local enemyAmount = #allActorTargets
if (enemyAmount < 1) then
return
end
gump:JI_AtualizaContainerAlvos (amt_alvos)
gump:JI_AtualizaContainerAlvos(enemyAmount)
local max_inimigos = meus_inimigos[1] and meus_inimigos[1][2] or 0
local topDamage = allActorTargets[1] and allActorTargets[1][2] or 0
local barra
for index, tabela in ipairs(meus_inimigos) do
barra = info.barras2 [index]
for index, targetTable in ipairs(allActorTargets) do
barra = info.barras2[index]
if (not barra) then
barra = gump:CriaNovaBarraInfo2 (instance, index)
barra = gump:CriaNovaBarraInfo2(instance, index)
barra.textura:SetStatusBarColor(1, 1, 1, 1)
end
if (index == 1) then
barra.textura:SetValue(100)
else
barra.textura:SetValue(tabela[2]/max_inimigos*100)
barra.textura:SetValue(targetTable[2] / topDamage * 100)
end
local target_actor = instance.showing (1, tabela[1])
if (target_actor) then
target_actor:SetClassIcon(barra.icone, instance, target_actor.classe)
local targetName = targetTable[1]
local targetActorObject = damageContainer:GetActor(targetName)
local npcId = DetailsFramework:GetNpcIdFromGuid(targetActorObject:GetGUID())
if (targetActorObject) then
local portraitTexture = Details222.Textures.GetPortraitTextureForNpcID(npcId)
if (portraitTexture) then
Details222.Textures.FormatPortraitAsTexture(portraitTexture, barra.icone)
else
targetActorObject:SetClassIcon(barra.icone, instance, targetActorObject.classe)
end
else
barra.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --CLASSE
local texCoords = Details.class_coords ["ENEMY"]
@@ -4662,12 +4681,12 @@ function atributo_damage:MontaInfoDamageDone()
barra.textura:SetStatusBarColor(1, 0.8, 0.8)
barra.textura:SetStatusBarColor(1, 1, 1, 1)
barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(tabela[1]))
barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(targetName))
if (info.sub_atributo == 2) then
barra.lineText4:SetText(Details:comma_value ( _math_floor(tabela[2]/actorCombatTime)) .. " (" .. format("%.1f", tabela[3]) .. "%)")
barra.lineText4:SetText(Details:comma_value ( _math_floor(targetTable[2]/actorCombatTime)) .. " (" .. format("%.1f", targetTable[3]) .. "%)")
else
barra.lineText4:SetText(SelectedToKFunction(_, tabela[2]) .." (" .. format("%.1f", tabela[3]) .. "%)")
barra.lineText4:SetText(SelectedToKFunction(_, targetTable[2]) .." (" .. format("%.1f", targetTable[3]) .. "%)")
end
if (barra.mouse_over) then --atualizar o tooltip
@@ -4682,10 +4701,10 @@ function atributo_damage:MontaInfoDamageDone()
end
barra.minha_tabela = self --grava o jogador na tabela
barra.nome_inimigo = tabela [1] --salva o nome do inimigo na barra --isso necessrio?
barra.nome_inimigo = targetTable [1] --salva o nome do inimigo na barra --isso necessrio?
-- no rank do spell id colocar o que?
barra.spellid = tabela[5]
barra.spellid = targetTable[5]
barra:Show()
end
end
+4
View File
@@ -6017,6 +6017,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes:SchedulePetUpdate(5)
end
function Details.parser_functions:PLAYER_TARGET_CHANGED(...)
Details:SendEvent("PLAYER_TARGET")
end
local parser_functions = _detalhes.parser_functions
function _detalhes:OnEvent(event, ...)
+2
View File
@@ -25,6 +25,7 @@
["DETAILS_OPTIONS_MODIFIED"] = {},
["UNIT_SPEC"] = {},
["UNIT_TALENTS"] = {},
["PLAYER_TARGET"] = {},
--data
["DETAILS_DATA_RESET"] = {},
@@ -121,6 +122,7 @@ local common_events = {
["COMM_EVENT_SENT"] = true,
["UNIT_SPEC"] = true,
["UNIT_TALENTS"] = true,
["PLAYER_TARGET"] = true,
}
+107
View File
@@ -0,0 +1,107 @@
local Details = _G.Details
local detailsFramework = _G.DetailsFramework
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
local addonName, Details222 = ...
--frame to create textures
local frame33 = CreateFrame("frame")
--store portrait textures for enemy actors
local portraitPool = {
inUse = {},
available = {},
npcIdToTexture = {},
}
local getTextureForPortraitPool = function()
local texture = tremove(portraitPool.available, 1)
if (not texture) then
texture = frame33:CreateTexture(nil, "overlay")
end
table.insert(portraitPool.inUse, texture)
return texture
end
local releaseTextureForPortraitPool = function(texture)
pcall(function() table.remove(portraitPool.inUse, detailsFramework.table.find(portraitPool.inUse, texture)) end)
table.insert(portraitPool.available, texture)
end
local savePortraitTextureForNpcId = function(texture, npcId)
portraitPool.npcIdToTexture[npcId] = texture
end
--get a portrait texture and set all its attributes to mimic some other texture
--@texture: the texture from GetPortraitTextureForNpcID()
--@fromTexture: any other texture
function Details222.Textures.FormatPortraitAsTexture(texture, fromTexture)
texture:SetDrawLayer("overlay", 7)
texture:SetParent(fromTexture:GetParent())
texture:SetSize(fromTexture:GetSize())
texture:ClearAllPoints()
texture:Show()
for i = 1, fromTexture:GetNumPoints() do
local anchor1, anchorFrame, anchor2, x, y = fromTexture:GetPoint(i)
texture:SetPoint(anchor1, anchorFrame, anchor2, x, y)
end
fromTexture:SetColorTexture(0.0156, 0.047, 0.1215, 1)
end
function Details222.Textures.SavePortraitTextureForUnitID(unitId)
local npcId = detailsFramework:GetNpcIdFromGuid(UnitGUID(unitId) or "")
if (npcId and not Details222.Textures.GetPortraitTextureForNpcID(npcId)) then
local texture = getTextureForPortraitPool()
SetPortraitTexture(texture, unitId)
savePortraitTextureForNpcId(texture, npcId)
end
end
--value
function Details222.Textures.GetPortraitTextureForNpcID(npcId)
return portraitPool.npcIdToTexture[npcId]
end
local eventListener = Details:CreateEventListener()
eventListener:RegisterEvent("DETAILS_DATA_RESET", function()
--> on reset data, release all textures:
for i = 1, #portraitPool.inUse do
local texture = portraitPool.inUse[i]
releaseTextureForPortraitPool(texture)
end
table.wipe(portraitPool.npcIdToTexture)
end)
eventListener:RegisterEvent("COMBAT_ENCOUNTER_START", function()
--> save a portrait texture for each boss in the boss list
for i = 1, 9 do
local unitId = "boss" .. i
if (UnitExists(unitId)) then
Details222.Textures.SavePortraitTextureForUnitID(unitId)
end
end
end)
eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", function()
if (UnitExists("target")) then
Details222.Textures.SavePortraitTextureForUnitID("target")
end
end)
eventListener:RegisterEvent("PLAYER_TARGET", function()
if (Details.in_combat) then
if (UnitExists("target")) then
Details222.Textures.SavePortraitTextureForUnitID("target")
end
if (UnitExists("focus")) then
Details222.Textures.SavePortraitTextureForUnitID("focus")
end
end
end)
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+2
View File
@@ -261,6 +261,8 @@ function Details:StartMeUp() --I'll never stop!
self.listener:RegisterEvent("UNIT_FACTION")
self.listener:RegisterEvent("PLAYER_TARGET_CHANGED")
if (not DetailsFramework.IsTimewalkWoW()) then
self.listener:RegisterEvent("PET_BATTLE_OPENING_START")
self.listener:RegisterEvent("PET_BATTLE_CLOSE")