Skip to content

Commit

Permalink
Using portrait for enemy faces
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Dec 2, 2022
1 parent f17f864 commit 5571749
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 223 deletions.
1 change: 1 addition & 0 deletions Details.toc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ functions\macros.lua
functions\testbars.lua
functions\editmode.lua
functions\warcraftlogs.lua
functions\textures.lua

core\timemachine.lua

Expand Down
141 changes: 0 additions & 141 deletions Details_TBC.toc

This file was deleted.

1 change: 1 addition & 0 deletions Details_Wrath.toc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ functions\deathmenu.lua
functions\macros.lua
functions\testbars.lua
functions\warcraftlogs.lua
functions\textures.lua

core\timemachine.lua

Expand Down
123 changes: 110 additions & 13 deletions Libs/DF/cooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

--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()

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
if (menuButton.customLeftTexture) then
menuButton.customLeftTexture:Hide()
menuButton.customLeftTexture = nil
end

menuButton.leftIcon:Show()
menuButton.leftIcon:SetTexture(leftIconSettings[1])
end

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])
menuButton.leftIcon:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha)
textureObject:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha)

if (gameCooltip.OptionsTable.IconBlendMode) then
menuButton.leftIcon:SetBlendMode(gameCooltip.OptionsTable.IconBlendMode)
textureObject:SetBlendMode(gameCooltip.OptionsTable.IconBlendMode)
else
menuButton.leftIcon:SetBlendMode("BLEND")
textureObject:SetBlendMode("BLEND")
end

menuButton.leftIcon:SetDesaturated(leftIconSettings[9])
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])
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 399
local dversion = 401
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -58,7 +58,7 @@
DamageSpellsCache = {}
}

--color namespace
--namespace color
Details222.ColorScheme = {
["gradient-background"] = {0.1215, 0.1176, 0.1294, 0.8},
}
Expand All @@ -67,8 +67,13 @@
return Details222.ColorScheme[colorScheme]
end

--namespace for damage spells (spellTable)
Details222.DamageSpells = {}


--namespace for texture
Details222.Textures = {}

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
local _
Expand Down
Loading

0 comments on commit 5571749

Please sign in to comment.