diff --git a/Blinkiis_Portraits/defaults.lua b/Blinkiis_Portraits/defaults.lua index 9dc40d0..b5f6a09 100644 --- a/Blinkiis_Portraits/defaults.lua +++ b/Blinkiis_Portraits/defaults.lua @@ -12,6 +12,20 @@ BLINKIISPORTRAITS.defaults.profile.misc = { zoom = 0, } +BLINKIISPORTRAITS.defaults.profile.custom = { + enable = false, + extra = false, + rare = "", + elite = "", + rareelite = "", + boss = "", + player = "", + texture = "", + mask = "", + extra_mask = "", + +} + BLINKIISPORTRAITS.defaults.profile.player = { cast = false, enable = true, diff --git a/Blinkiis_Portraits/options.lua b/Blinkiis_Portraits/options.lua index 9076da6..6b5c9ab 100644 --- a/Blinkiis_Portraits/options.lua +++ b/Blinkiis_Portraits/options.lua @@ -113,6 +113,178 @@ BLINKIISPORTRAITS.options = { }, }, }, + custom_textures_group = { + order = 2, + type = "group", + inline = true, + name = "Custom Textures", + args = { + enable_custom_textures_toggle = { + order = 1, + type = "toggle", + name = "Enable", + desc = "Enable Custom Textures for Portrait.", + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.enable + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.enable = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + description = { + order = 2, + type = "description", + name = "Put your custom textures in the Addon folder and add the path here (example MyMediaFolder\\MyTexture.tga).", + }, + texture_input = { + order = 3, + name = "Texture", + type = "input", + width = "smal", + disabled = function() + return not BLINKIISPORTRAITS.db.profile.custom.enable + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.texture + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.texture = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + mask_input = { + order = 4, + name = "Mask", + type = "input", + width = "smal", + disabled = function() + return not BLINKIISPORTRAITS.db.profile.custom.enable + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.mask + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.mask = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + extra_mask_input = { + order = 5, + name = "Extra Mask", + type = "input", + width = "smal", + disabled = function() + return not BLINKIISPORTRAITS.db.profile.custom.enable + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.extra_mask + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.extra_mask = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + space_description = { + order = 6, + type = "description", + name = "\n\n", + }, + enable_custom_extra_toggle = { + order = 7, + type = "toggle", + name = "Custom Extra Texture", + desc = "Enable Custom extra Textures for Portrait.", + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.extra + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.extra = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + rare_input = { + order = 8, + name = "Rare", + type = "input", + width = "smal", + disabled = function() + return not (BLINKIISPORTRAITS.db.profile.custom.enable and BLINKIISPORTRAITS.db.profile.custom.extra) + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.rare + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.rare = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + elite_input = { + order = 9, + name = "Elite", + type = "input", + width = "smal", + disabled = function() + return not (BLINKIISPORTRAITS.db.profile.custom.enable and BLINKIISPORTRAITS.db.profile.custom.extra) + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.elite + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.elite = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + rareelite_input = { + order = 10, + name = "Rare Elite", + type = "input", + width = "smal", + disabled = function() + return not (BLINKIISPORTRAITS.db.profile.custom.enable and BLINKIISPORTRAITS.db.profile.custom.extra) + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.rareelite + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.rareelite = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + boss_input = { + order = 11, + name = "Boss", + type = "input", + width = "smal", + disabled = function() + return not (BLINKIISPORTRAITS.db.profile.custom.enable and BLINKIISPORTRAITS.db.profile.custom.extra) + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.boss + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.boss = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + player_input = { + order = 12, + name = "Player", + type = "input", + width = "smal", + disabled = function() + return not (BLINKIISPORTRAITS.db.profile.custom.enable and BLINKIISPORTRAITS.db.profile.custom.extra) + end, + get = function(info) + return BLINKIISPORTRAITS.db.profile.custom.player + end, + set = function(info, value) + BLINKIISPORTRAITS.db.profile.custom.player = value + BLINKIISPORTRAITS:LoadPortraits() + end, + }, + }, + }, }, }, player_group = { diff --git a/Blinkiis_Portraits/portraits/functions.lua b/Blinkiis_Portraits/portraits/functions.lua index f156533..1eaa7dc 100644 --- a/Blinkiis_Portraits/portraits/functions.lua +++ b/Blinkiis_Portraits/portraits/functions.lua @@ -168,17 +168,48 @@ end function BLINKIISPORTRAITS:UpdateTexturesFiles(portrait, settings) local dbMisc = BLINKIISPORTRAITS.db.profile.misc + local dbCustom = BLINKIISPORTRAITS.db.profile.custom local media = mediaPortraits[settings.texture] portrait.bgFile = "Interface\\Addons\\Blinkiis_Portraits\\media\\blank.tga" - portrait.bossFile = mediaExtra[dbMisc.boss] - portrait.eliteFile = mediaExtra[dbMisc.elite] - portrait.extraMaskFile = (settings.mirror and media.extra_mirror) and media.extra_mirror or media.extra - portrait.maskFile = (settings.mirror and media.mask_mirror) and media.mask_mirror or media.mask - portrait.playerFile = mediaExtra[dbMisc.player] - portrait.rareFile = mediaExtra[dbMisc.rare] - portrait.rareeliteFile = mediaExtra[dbMisc.rareelite] - portrait.textureFile = media.texture + + print("ssss", dbCustom.enable) + if dbCustom.enable then + print("custom") + portrait.textureFile = "Interface\\Addons\\" .. dbCustom.texture + portrait.maskFile = "Interface\\Addons\\" .. dbCustom.mask + + portrait.extraMaskFile = "Interface\\Addons\\" .. dbCustom.extra_mask + + if dbCustom.extra then + print("custom extra") + portrait.playerFile = "Interface\\Addons\\" .. dbCustom.player + + portrait.rareFile = "Interface\\Addons\\" .. dbCustom.rare + portrait.eliteFile = "Interface\\Addons\\" .. dbCustom.elite + portrait.rareeliteFile = "Interface\\Addons\\" .. dbCustom.rareelite + portrait.bossFile = "Interface\\Addons\\" .. dbCustom.boss + else + portrait.playerFile = mediaExtra[dbMisc.player] + + portrait.rareFile = mediaExtra[dbMisc.rare] + portrait.eliteFile = mediaExtra[dbMisc.elite] + portrait.rareeliteFile = mediaExtra[dbMisc.rareelite] + portrait.bossFile = mediaExtra[dbMisc.boss] + end + else + portrait.textureFile = media.texture + portrait.maskFile = (settings.mirror and media.mask_mirror) and media.mask_mirror or media.mask + + portrait.extraMaskFile = (settings.mirror and media.extra_mirror) and media.extra_mirror or media.extra + + portrait.playerFile = mediaExtra[dbMisc.player] + + portrait.rareFile = mediaExtra[dbMisc.rare] + portrait.eliteFile = mediaExtra[dbMisc.elite] + portrait.rareeliteFile = mediaExtra[dbMisc.rareelite] + portrait.bossFile = mediaExtra[dbMisc.boss] + end end function BLINKIISPORTRAITS:UpdateSize(portrait, size, point) @@ -217,7 +248,7 @@ function BLINKIISPORTRAITS:CreatePortrait(name, parent) -- rare/elite/boss local extraOnTop = BLINKIISPORTRAITS.db.profile.misc.extratop print(extraOnTop) - portrait.extra = portrait:CreateTexture("BP_extra-" .. name, "OVERLAY", nil, extraOnTop and 7 or 1) + portrait.extra = portrait:CreateTexture("BP_extra-" .. name, "OVERLAY", nil, extraOnTop and 7 or 1) portrait.extra:SetAllPoints(portrait) -- extra mask