increased icon size for the skills frame

This commit is contained in:
telkar-rg
2024-09-29 07:39:10 +02:00
parent 1dc8df6532
commit 7cd6a6e298
2 changed files with 81 additions and 14 deletions
+29 -2
View File
@@ -488,11 +488,38 @@ function addon:SetItemButtonTexture(button, texture, width, height)
SetItemButtonTexture(_G[button], texture) SetItemButtonTexture(_G[button], texture)
end end
function addon:TextureToFontstring(name, width, height) function addon:TextureToFontstring(name, height, width)
return format("|T%s:%s:%s|t", name, width, height) return format("|T%s:%s:%s|t", name, height, width)
end
function addon:TextureToFontstring2(name, height, width, insetLeft, insetRight, insetTop, insetBottom)
local w = width + insetLeft + insetRight
local h = height + insetTop + insetBottom
local coordx2 = width + insetLeft
local coordy2 = height + insetTop
-- |TTexturePath:size1:size2:xoffset:yoffset:dimx:dimy:coordx1:coordx2:coordy1:coordy2|t
return format("|T%s:%s:%s:0:0:%s:%s:%s:%s:%s:%s|t", name, height, width, w, h, insetLeft, coordx2, insetTop, coordy2)
end
function addon:TextureToFontstringCut(name, heightOrig, widthOrig, insetLeft, insetRight, insetTop, insetBottom)
local h = heightOrig - insetTop - insetBottom
local w = widthOrig - insetLeft - insetRight
local coordy1 = insetTop
local coordy2 = h - insetBottom
local coordx1 = insetLeft
local coordx2 = w - insetRight
-- |TTexturePath:height:width:xoffset:yoffset:dimx:dimy:coordx1:coordx2:coordy1:coordy2|t
return format("|T%s:%s:%s:0:0:%s:%s:%s:%s:%s:%s|t", name, h, w, widthOrig, heightOrig, coordx1, coordx2, coordy1, coordy2)
end end
function addon:GetSpellIcon(spellID) function addon:GetSpellIcon(spellID)
if spellID == 13614 then -- Herbalism
spellID = 2383 -- Find Herbs
end
return select(3, GetSpellInfo(spellID)) return select(3, GetSpellInfo(spellID))
end end
+52 -12
View File
@@ -25,6 +25,9 @@ local ICON_FACTION_ALLIANCE = "Interface\\Icons\\INV_BannerPVP_02"
local ns = addon.TradeSkills -- ns = namespace local ns = addon.TradeSkills -- ns = namespace
local Characters = addon.Characters local Characters = addon.Characters
local size = 22
local inset = 2
function ns:Update() function ns:Update()
local VisibleLines = 14 local VisibleLines = 14
local frame = "AltoholicFrameSkills" local frame = "AltoholicFrameSkills"
@@ -95,9 +98,11 @@ function ns:Update()
local icon local icon
if DS:GetCharacterFaction(character) == "Alliance" then if DS:GetCharacterFaction(character) == "Alliance" then
icon = addon:TextureToFontstring(ICON_FACTION_ALLIANCE, 18, 18) .. " " -- icon = addon:TextureToFontstring(ICON_FACTION_ALLIANCE, size, size) .. " "
icon = addon:TextureToFontstring2(ICON_FACTION_ALLIANCE, size, size, inset, inset, inset, inset) .. " "
else else
icon = addon:TextureToFontstring(ICON_FACTION_HORDE, 18, 18) .. " " -- icon = addon:TextureToFontstring(ICON_FACTION_HORDE, size, size) .. " "
icon = addon:TextureToFontstring2(ICON_FACTION_HORDE, size, size, inset, inset, inset, inset) .. " "
end end
_G[entry..i.."Collapse"]:Hide() _G[entry..i.."Collapse"]:Hide()
@@ -106,11 +111,12 @@ function ns:Update()
_G[entry..i.."NameNormalText"]:SetWidth(170) _G[entry..i.."NameNormalText"]:SetWidth(170)
_G[entry..i.."NameNormalText"]:SetText(icon .. format("%s (%s)", DS:GetColoredCharacterName(character), DS:GetCharacterClass(character))) _G[entry..i.."NameNormalText"]:SetText(icon .. format("%s (%s)", DS:GetColoredCharacterName(character), DS:GetCharacterClass(character)))
_G[entry..i.."Level"]:SetText(GREEN .. DS:GetCharacterLevel(character)) _G[entry..i.."Level"]:SetText(GREEN .. DS:GetCharacterLevel(character))
-- profession 1 -- profession 1
local field = Characters:GetField(line, "spellID1") local field = Characters:GetField(line, "spellID1")
if field then if field then
icon = addon:TextureToFontstring(addon:GetSpellIcon(field), 18, 18) .. " " -- icon = addon:TextureToFontstring(addon:GetSpellIcon(field), size, size) .. " "
icon = addon:TextureToFontstring2(addon:GetSpellIcon(field), size, size, inset, inset, inset, inset) .. " "
else else
icon = "" icon = ""
end end
@@ -120,7 +126,8 @@ function ns:Update()
-- profession 2 -- profession 2
field = Characters:GetField(line, "spellID2") field = Characters:GetField(line, "spellID2")
if field then if field then
icon = addon:TextureToFontstring(addon:GetSpellIcon(field), 18, 18) .. " " -- icon = addon:TextureToFontstring(addon:GetSpellIcon(field), size, size) .. " "
icon = addon:TextureToFontstring2(addon:GetSpellIcon(field), size, size, inset, inset, inset, inset) .. " "
else else
icon = "" icon = ""
end end
@@ -128,29 +135,62 @@ function ns:Update()
_G[entry..i.."Skill2NormalText"]:SetText(icon .. ns:GetColor(field) .. field) _G[entry..i.."Skill2NormalText"]:SetText(icon .. ns:GetColor(field) .. field)
-- cooking -- cooking
icon = addon:TextureToFontstring(addon:GetSpellIcon(2550), 18, 18) .. " " -- icon = addon:TextureToFontstring(addon:GetSpellIcon(2550), size, size) .. " "
icon = addon:TextureToFontstring2(addon:GetSpellIcon(2550), size, size, inset, inset, inset, inset) .. " "
field = Characters:GetField(line, "cooking") field = Characters:GetField(line, "cooking")
_G[entry..i.."CookingNormalText"]:SetText(icon .. ns:GetColor(field) .. field) _G[entry..i.."CookingNormalText"]:SetText(icon .. ns:GetColor(field) .. field)
-- first aid -- first aid
icon = addon:TextureToFontstring(addon:GetSpellIcon(3273), 18, 18) .. " " -- icon = addon:TextureToFontstring(addon:GetSpellIcon(3273), size, size) .. " "
icon = addon:TextureToFontstring2(addon:GetSpellIcon(3273), size, size, inset, inset, inset, inset) .. " "
field = Characters:GetField(line, "firstaid") field = Characters:GetField(line, "firstaid")
_G[entry..i.."FirstAidNormalText"]:SetText(icon .. ns:GetColor(field) .. field) _G[entry..i.."FirstAidNormalText"]:SetText(icon .. ns:GetColor(field) .. field)
-- fishing -- fishing
icon = addon:TextureToFontstring(addon:GetSpellIcon(7733), 18, 18) .. " " -- icon = addon:TextureToFontstring(addon:GetSpellIcon(7733), size, size) .. " "
icon = addon:TextureToFontstring2(addon:GetSpellIcon(7733), size, size, inset, inset, inset, inset) .. " "
field = Characters:GetField(line, "fishing") field = Characters:GetField(line, "fishing")
_G[entry..i.."FishingNormalText"]:SetText(icon .. ns:GetColor(field) .. field) _G[entry..i.."FishingNormalText"]:SetText(icon .. ns:GetColor(field) .. field)
-- riding -- riding
field = Characters:GetField(line, "riding") field = Characters:GetField(line, "riding")
if DS:IsSpellKnown(character, 54197) then if field >= 300 then
icon = addon:TextureToFontstring(addon:GetSpellIcon(54197), 18, 18) .. " " -- icon = addon:TextureToFontstring("Interface\\Icons\\Ability_Mount_Gryphon_01", size, size) .. " "
icon = addon:TextureToFontstring2("Interface\\Icons\\ability_mount_drake_bronze", size, size, inset, inset, inset, inset)
for _,spId in pairs({63956, 63963, 60024, 72808, 72807, 63796, 40192, 69395, 60021, 59976, 64927, 67336, 65439, 49193, 71810, 44317, 44744, 58615, 37015, 3363, 32345}) do
-- IsPetKnown(character, companionType, spellID)
if DS:IsPetKnown(character, "MOUNT", spId) then
icon = addon:TextureToFontstring2("Interface\\Icons\\inv_misc_enggizmos_03", size, size, inset, inset, inset, inset)
break
end
end
elseif field >= 225 then elseif field >= 225 then
icon = addon:TextureToFontstring("Interface\\Icons\\Ability_Mount_Gryphon_01", 18, 18) .. " " icon = addon:TextureToFontstring2("Interface\\Icons\\ability_mount_goldengryphon", size, size, inset, inset, inset, inset)
elseif field >= 150 then
icon = addon:TextureToFontstring2("Interface\\Icons\\ability_mount_charger", size, size, inset, inset, inset, inset)
elseif field >= 75 then
icon = addon:TextureToFontstring2("Interface\\Icons\\spell_nature_swiftness", size, size, inset, inset, inset, inset)
else else
icon = addon:TextureToFontstring("Interface\\Icons\\Ability_Mount_RidingHorse", 18, 18) .. " " icon = addon:TextureToFontstring2("Interface\\Icons\\inv_boots_03", size, size, inset, inset, inset, inset)
end end
if DS:IsSpellKnown(character, 54197) then -- KNOWS [Cold Weather Flying]
-- Interface\Icons\Spell_Frost_FrostShock
-- icon = addon:TextureToFontstring(addon:GetSpellIcon(54197), size, size) .. " "
-- TextureToFontstringHalfSquare(name, side, inset, isRight)
-- icon = addon:TextureToFontstringHalfSquare(addon:GetSpellIcon(54197), size, inset, true) .. " "
-- icon = icon .. addon:TextureToFontstringHalfSquare(addon:GetSpellIcon(54197), size, inset, 0.7, 1.0) .. " "
-- TextureToFontstringCut(name, heightOrig, widthOrig, insetLeft, insetRight, insetTop, insetBottom)
-- local sTemp = size+2*inset
-- icon = icon .. addon:TextureToFontstringCut(addon:GetSpellIcon(54197), sTemp, sTemp, floor(0.7*sTemp), floor(0.1*sTemp), inset, inset) .. " "
icon = addon:TextureToFontstring(addon:GetSpellIcon(54197), size, size) .. " " .. icon .. " "
else -- DOES NOT KNOW [Cold Weather Flying]
icon = format("|T%s:%s:%s:0:0:%s:%s:%s:%s:%s:%s|t", addon:GetSpellIcon(54197), size, size, size, size, 0, 0, 0, 0) .. " " .. icon .. " "
end
_G[entry..i.."RidingNormalText"]:SetText(icon .. ns:GetColor(field, 300) .. field) _G[entry..i.."RidingNormalText"]:SetText(icon .. ns:GetColor(field, 300) .. field)
elseif (lineType == INFO_TOTAL_LINE) then elseif (lineType == INFO_TOTAL_LINE) then
_G[entry..i.."Collapse"]:Hide() _G[entry..i.."Collapse"]:Hide()