Skip to content

Commit

Permalink
1-2-7c
Browse files Browse the repository at this point in the history
config: added setting cooldown timer and aura border color
Anchor for Focus frame
Anchor for Focus buffs/debbufs
Added option to disable cooldown and castbar module
Added support for new portraits for the Arena
Anchor for Death Knight Rune Bar
anchor: add backlight for parent frames
  • Loading branch information
s0h2x authored Jul 7, 2022
1 parent f5ad663 commit 188a523
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 64 deletions.
16 changes: 10 additions & 6 deletions core/anchor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ end

-- /* create mover elements */
local anchorlist, backup, f = {}, {}
local function create_anchor(self, text, value, anchor, width, height)
local function create_anchor(self, text, value, anchor, width, height, parent)
local key = 'elements_anchor'
if not _appdata[key] then _appdata[key] = {} end

Expand All @@ -93,7 +93,13 @@ local function create_anchor(self, text, value, anchor, width, height)
mover:SetWidth(width or self:GetWidth())
mover:SetHeight(height or self:GetHeight())
mover:SetBackdrop(addon.backdrop)
mover:SetBackdropColor(0.67058823529, 0.80392156862, 0.93725490196, .65)
local color
if not parent then
color = {.67058823529,.80392156862,.93725490196,.65}
else
color = {1,.56470588235,.25098039215,.55}
end
mover:SetBackdropColor(unpack(color))
mover:SetBackdropBorderColor(0, 1, .62, .5)

-- setup name
Expand Down Expand Up @@ -215,7 +221,7 @@ local function createconsole()
end

-- create lock button
bu[1]:SetScript('OnClick', lock_elements)
bu[1]:SetScript('OnClick', addon.toggle_anchors)

-- create cancel button
bu[2]:SetScript('OnClick', function()
Expand Down Expand Up @@ -266,9 +272,7 @@ function addon:toggle_anchors(forcelock)
return secure
end

SlashCmdList['PRETTY_MOVER'] = function(...)
addon:toggle_anchors()
end
SlashCmdList['PRETTY_MOVER'] = function(...) addon:toggle_anchors() end
SLASH_PRETTY_MOVER1 = '/mover'

addon.c_anchor = create_anchor
39 changes: 22 additions & 17 deletions core/config.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local addon = select(2,...);
local path = [[Interface\AddOns\pw_unitframes\assets\]]
local path = [[Interface\AddOns\pw_unitframes\assets\]];

--[[
/**
* general config
* default settings of pretty light UF
* config
* contains main settings of addon
* https://github.com/s0h2x/
* (c) 2022, s0h2x
*
Expand All @@ -18,8 +18,9 @@ local config = {
global = {
classportraits = true, -- enable portraits by class
prettyportraits = true, -- display custom portraits
combaticon = true, -- display combat state
framecolors = {.22, .22, .22, 1}, -- main colors theme of frames
combaticon = true, -- display combat state
castbar_show = true, -- enable castbar style
castbar_scale = 1.2, -- castbar scale
castbar_offset = 2, -- castbar offset by x-axis
FFA = true, -- show FFA status icon for all frames
Expand All @@ -29,30 +30,38 @@ local config = {
auras = {
-- size:
aura_size = 26, -- aura size
minscale = .5, -- minimum scale we want to show cooldown counts at, anything below this will be hidden
minduration = 3, -- minimum duration to show cooldown text
icon_size = 20, -- normal size for an icon (don't change this)
font_size = 14, -- base font size
threshold = 6.5, -- last seconds
duration_color = {1, .7, 0}, -- text color of duration > threshold
threshold_color = {1, 0, 0}, -- text color of duration < threshold
buffs_scale = 1.16, -- buffs scale
debuffs_scale = 1.16, -- debuffs scale

-- cooldown timer:
cooldown_show = true, -- show cooldown timer text
cooldown_module = true, -- enable cooldown module (its global)
minscale = .6, -- get optimal UIScale for showing cooldown (if UIScale < minscale = hide cooldown text)
minduration = 3, -- minimum duration to show cooldown text (trigger)
threshold = 6.5, -- last seconds (red)
duration_color = {1, .7, 0}, -- text color of duration > threshold (yellow by default)
threshold_color = {1, 0, 0}, -- text color of duration < threshold (red by default)
timer_y = 4, -- cooldown text position by y-axis (TOP by default)

-- position:
start_x = 7, -- auras start position by x-axis (buffs)
start_y = 26, -- auras start position by y-axis (buffs)
offset_x = 1.3, -- spacing between auras by x-axis
offset_y = 3, -- spacing between auras by y-axis
numrow = 4, -- how many auras to show in one row
numrowtot = 3, -- how many auras to show in one (first) row on target if target has target of target (whut?)
numrow = 5, -- how many auras to show in one row (second line) 5 = 4x4x4
numrowtot = 2, -- space in buffs row, if target has of target (4 = only first row, 5 = first and second row)
debuffs_vertical = true, -- vertical growth (from bottom to top)
debuffs_offset_y = 5, -- vertical growth offset between debuffs
e_debuffs_offset_y = 30, -- vertical growth offset between debuffs on enemy frame

-- maximum number of buffs/debuffs:
target_maxbuffs = 12, -- max buffs show, recommended to set value between 8-16
target_maxdebuffs = 12, -- default: 16, recommended to set value between 8-16

-- misc:
dispelable = true, -- glowing dispelable buffs
border_color = {.3, .3, .3, 1}, -- border colors for buffs and some debuffs (R, G, B, Alpha)
},

-- player frame:
Expand All @@ -64,6 +73,7 @@ local config = {
name = true, -- show player name
petname = false, -- show pet name
runescale = 1, -- deathknight rune orbs scale
runeanchor = {'TOP',PlayerFrameManaBar,'BOTTOM',12,-10},
},

-- target frame:
Expand Down Expand Up @@ -123,11 +133,6 @@ local config = {
partytarget_scale = 0.9, -- party target scale
arenatarget_scale = 0.6, -- arena target scale
},

-- default and backup for restore:
position = {
['runebar'] = {'TOP', PlayerFrameManaBar, 'BOTTOM', 12, -10},
},

media = {
-- assets:
Expand Down
11 changes: 9 additions & 2 deletions modules/arena.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ local function frame_style_arena()
frame.texture:SetVertexColor(unpack(config.global.framecolors))
frame.texture:SetTexCoord(0.09375, 1.0, 0, 0.78125)

-- pet setup:
frame.pet = _G[frame:GetName()..'PetFrame']
frame.pet:SetScale(.74)
frame.pet:ClearAllPoints();
frame.pet:SetPoint('TOPLEFT', frame, 'TOPLEFT', 2, -38)

frame.pettexture = _G[frame.pet:GetName()..'Texture']
frame.pettexture:SetVertexColor(unpack(config.global.framecolors))
frame.petportrait = _G[frame.pet:GetName()..'Portrait']
frame.petportrait:SetAllPoints()

frame.bg = _G[frame:GetName()..'Background']
frame.bg:SetSize(62, 20)
Expand Down Expand Up @@ -85,6 +87,10 @@ local function frame_style_arena()
frame.classPortrait:SetSize(34, 34);
frame.classPortrait:ClearAllPoints();
frame.classPortrait:SetPoint('RIGHT', frame, 'RIGHT', -4, -2);

if config.global.prettyportraits then
frame.classPortrait:SetTexture(src.portraits);
end

-- castbar setup:
castbar = _G[frame:GetName()..'CastingBar']
Expand Down Expand Up @@ -127,4 +133,5 @@ local function frame_style_arena()
castbar.update = 0.1
end
end
hooksecurefunc('Arena_LoadUI',frame_style_arena);
frame_style_arena()
-- hooksecurefunc('Arena_LoadUI',frame_style_arena);
31 changes: 18 additions & 13 deletions modules/elements/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ local NUM_TOT_AURA_ROWS = config.numrowtot
local DEBUFFS_VERTICAL = config.debuffs_vertical
local DEBUFFS_OFFSET_Y = config.debuffs_offset_y
local E_DEBUFFS_OFFSET_Y = config.e_debuffs_offset_y
local BORDER_OFFSET = config.border_offset
local partybuffs = addon.config.party
local MAX_PARTY_BUFFS = partybuffs.maxbuffs
local MAX_PARTY_DEBUFFS = 4
Expand All @@ -69,6 +70,11 @@ local t_debuffs = CreateFrame('Frame', 'TargetDebuffs', UIParent)
t_buffs:SetSize(146, 28)
t_debuffs:SetSize(146, 28)

local f_buffs = CreateFrame('Frame', 'FocusBuffs', UIParent)
local f_debuffs = CreateFrame('Frame', 'FocusDebuffs', UIParent)
f_buffs:SetSize(146, 28)
f_debuffs:SetSize(146, 28)

-- /* create dispelable buffs border */
function __TargetFrame_UpdateAurasDispel(self)
for i=1, MAX_TARGET_BUFFS do
Expand Down Expand Up @@ -111,9 +117,9 @@ function __TargetFrame_UpdateAuras(self)
-- border:
local bo = frame:CreateTexture(nil, 'OVERLAY')
if bo then
bo:SetAllPoints()
bo:SetTexture(src.border)
bo:SetPoint('TOPRIGHT', frameIcon, 3.4, 3.4)
bo:SetPoint('BOTTOMLEFT', frameIcon, -3.4, -3.4)
bo:SetVertexColor(unpack(config.border_color))
end
-- count:
frameCount = _G[self:GetName()..'Buff'..i..'Count']
Expand Down Expand Up @@ -152,8 +158,7 @@ function __TargetFrame_UpdateAuras(self)
local bo = frame:CreateTexture(nil, 'OVERLAY', nil, 7)
if bo then
bo:SetTexture(src.border)
bo:SetPoint('TOPRIGHT', frameIcon, 3.4, 3.4)
bo:SetPoint('BOTTOMLEFT', frameIcon, -3.4, -3.4)
bo:SetAllPoints()
end
-- color:
local debuffName = UnitDebuff(self.unit, i)
Expand All @@ -166,7 +171,7 @@ function __TargetFrame_UpdateAuras(self)
bo:SetVertexColor(color.r, color.g, color.b)
end
else
bo:SetVertexColor(1, 1, 1, 1)
bo:SetVertexColor(unpack(config.border_color))
end
-- count:
frameCount = _G[self:GetName()..'Debuff'..i..'Count']
Expand Down Expand Up @@ -248,6 +253,9 @@ function __UpdateBuffAnchor(self, buffName, index, numDebuffs, anchorIndex, size
if (self.unit == 'target') then
buff:ClearAllPoints()
buff:SetPoint(point..'LEFT', t_buffs, relativePoint..'LEFT', AURA_START_X, startY)
elseif (self.unit == 'focus') then
buff:ClearAllPoints()
buff:SetPoint(point..'LEFT', f_buffs, relativePoint..'LEFT', AURA_START_X, startY)
else
buff:SetPoint(point..'LEFT', self, relativePoint..'LEFT', AURA_START_X, startY)
end
Expand Down Expand Up @@ -295,6 +303,8 @@ function __UpdateDebuffAnchor(self, debuffName, index, numBuffs, anchorIndex, si
-- unit is friendly and there are buffs...debuffs start on bottom
if (self.unit == 'target') then
buff:SetPoint(point..'LEFT', t_debuffs, relativePoint..'LEFT', AURA_START_X, startY);
elseif (self.unit == 'focus') then
buff:SetPoint(point..'LEFT', f_debuffs, relativePoint..'LEFT', AURA_START_X, startY);
else
buff:SetPoint(point..'LEFT', self, relativePoint..'LEFT', AURA_START_X, startY);
end
Expand Down Expand Up @@ -389,14 +399,11 @@ local function CreatePartyAuras()
bo = buffs:CreateTexture(nil, 'OVERLAY', nil, 7)
if bo then
bo:SetTexture(src.border)
bo:SetPoint('TOPRIGHT', icn, 1.6, 1.6)
bo:SetPoint('BOTTOMLEFT', icn, -1.6, -1.6)
bo:SetAllPoints()
bo:SetVertexColor(unpack(config.border_color))
end
buffs.styled = true
end
-- if j == MAX_PARTY_BUFFS then
-- maxshows = true
-- end
end

-- debuffs first row:
Expand All @@ -421,16 +428,14 @@ local function CreatePartyAuras()
bo = debuffs:CreateTexture(nil, 'OVERLAY', nil, 7)
if bo then
bo:SetTexture(src.border)
bo:SetPoint('TOPRIGHT', icn, 1.6, 1.6)
bo:SetPoint('BOTTOMLEFT', icn, -1.6, -1.6)
bo:SetAllPoints()
end
-- color:
oldborder = _G[debuffs:GetName()..'Border']
oldborder:Hide()
bo:SetVertexColor(1, 0, 0)
debuffs.styled = true
end
-- if (k == 4) then maxshows = true end
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion modules/elements/castbar.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local addon = select(2,...);
local config = addon.config;
local own, src = config.global, config.media
local own, src = config.global, config.media;
if not own.castbar_show then return end;

--[[
/**
Expand Down
7 changes: 4 additions & 3 deletions modules/elements/cooldown.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local addon = select(2,...);
local config = addon.config.auras;
if not config.cooldown_module then return end;

-- /* lua lib */
local getmetatable = getmetatable
Expand Down Expand Up @@ -66,12 +67,12 @@ local function update(self, elapsed)
end

local function createtext(self)
local scale = min(self:GetParent():GetWidth()/config.icon_size, 1)
if scale < config.minscale then
local scale = min(self:GetParent():GetWidth()/config.aura_size, 1)
if not config.cooldown_show then
self.noOCC = true
else
local text = self:GetParent():CreateFontString(nil, 'OVERLAY', 'pUiFont_Auras')
text:SetPoint('TOP', 0, 4)
text:SetPoint('TOP', 0, config.timer_y)
self:SetScript('OnUpdate', update)
self:SetAlpha(1)
self.text = text
Expand Down
3 changes: 1 addition & 2 deletions modules/elements/trinkets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,5 @@ local function styletrinkets()
trinket:SetScript('OnEvent', ArenaTrinkets_OnEvent)
end
end

if not IsAddOnLoaded('Blizzard_ArenaUI') then LoadAddOn('Blizzard_ArenaUI') end
styletrinkets()
styletrinkets()
19 changes: 11 additions & 8 deletions modules/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ local xofs,yofs = config.auras.start_x,config.auras.start_y

-- /* anchor table */
local config_anchor = setmetatable({
PlayerFrame = {pos={a='CENTER', p=UIParent, a2='CENTER', x=-290, y=-100},siz={w=140, h=40}},
TargetFrame = {pos={a='CENTER', p=UIParent, a2='CENTER', x=290, y=-100},siz={w=140, h=40}},
PetFrame = {pos={a='TOPLEFT', p=PlayerFrame, a2='TOPLEFT', x=98, y=-84},siz={w=120, h=36}},
PartyMemberFrame1 = {pos={a='LEFT', p=UIParent, a2='LEFT', x=120, y=125},siz={w=150, h=144}},
ArenaEnemyFrame1 = {pos={a='RIGHT', p=UIParent, a2='RIGHT', x=-120, y=125},siz={w=150, h=144}},
PlayerFrame = {pos={a='CENTER', p=UIParent, a2='CENTER', x=-290, y=-100},siz={w=140, h=40},par=true},
TargetFrame = {pos={a='CENTER', p=UIParent, a2='CENTER', x=290, y=-100},siz={w=140, h=40},par=true},
FocusFrame = {pos={a='TOPLEFT', p=UIParent, a2='TOPLEFT', x=250, y=-240},siz={w=140, h=40},par=true},
PetFrame = {pos={a='TOPLEFT', p=PlayerFrame, a2='TOPLEFT', x=98, y=-84},siz={w=124, h=46}},
PartyMemberFrame1 = {pos={a='LEFT', p=UIParent, a2='LEFT', x=120, y=125},siz={w=150, h=144},par=true},
ArenaEnemyFrame1 = {pos={a='RIGHT', p=UIParent, a2='RIGHT', x=-120, y=125},siz={w=150, h=144},par=true},
PartyTargetFrame1 = {pos={a='TOPLEFT', p=PartyMemberFrame1, a2='TOPLEFT', x=-62, y=0},siz={w=50, h=70}},
ArenaTargetFrame1 = {pos={a='TOPRIGHT', p=ArenaEnemyFrame1, a2='TOPRIGHT',x=62, y=0},siz={w=50, h=70}},
TargetFrameToT = {pos={a='TOPLEFT', p=TargetFrame, a2='BOTTOMRIGHT', x=sqr and -20 or -116, y=sqr and 87 or 20},siz={w=90, h=40}},
Expand All @@ -48,6 +49,8 @@ local config_anchor = setmetatable({
PartyCastingBar1 = {pos={a='TOPLEFT', p=PartyMemberFrame1, a2='TOPRIGHT', x=-2, y=-18},siz={w =174, h=42}},
TargetBuffs = {pos={a='TOPLEFT', p=TargetFrame, a2='BOTTOMLEFT', x=xofs, y=yofs},siz={w=124, h=30}},
TargetDebuffs = {pos={a='LEFT', p=TargetFrame, a2='LEFT', x=xofs, y=yofs +6},siz={w=124, h=30}},
FocusBuffs = {pos={a='TOPLEFT', p=FocusFrame, a2='BOTTOMLEFT', x=xofs, y=yofs},siz={w=124, h=30}},
FocusDebuffs = {pos={a='LEFT', p=FocusFrame, a2='LEFT', x=xofs, y=yofs +6},siz={w=124, h=30}},
},{
__index = function(t,k)
local _,_,v = k:GetName()
Expand Down Expand Up @@ -83,7 +86,7 @@ local strings = {
local nextframes = {
PlayerFrame,TargetFrame,PartyMemberFrame1,ArenaEnemyFrame1,PartyTargetFrame1,TargetFrameToT,FocusFrameToT,
CastingBarFrame,TargetFrameSpellBar,FocusFrameSpellBar,PartyCastingBar1,TargetBuffs,TargetDebuffs,
ArenaTargetFrame1,PetFrame
ArenaTargetFrame1,PetFrame,FocusFrame,FocusBuffs,FocusDebuffs
}

-- /* make frames cleaner */
Expand All @@ -106,13 +109,13 @@ function addon:setup_anchor()
PlayerFrame:SetScale(config.player.scale)
TargetFrame:SetScale(config.target.scale)
FocusFrame:SetScale(config.focus.scale)

FocusFrame:SetMovable(false)
-- create anchor:
for _,frame in pairs(nextframes) do
local data = config_anchor[frame:GetName()]
local position = {data.pos.a, data.pos.p, data.pos.a2, data.pos.x, data.pos.y}
frame:ClearAllPoints()
frame.anchor = c_anchor(frame, frame:GetName(), frame:GetName(), position, data.siz.w, data.siz.h)
frame.anchor = c_anchor(frame,frame:GetName(),frame:GetName(),position,data.siz.w,data.siz.h,data.par or false)
frame.SetPoint = noop
end
end
Expand Down
1 change: 0 additions & 1 deletion modules/partytarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ end

-- /* setup arena target */
if uconfig.arenatargets and e_arena then
if not IsAddOnLoaded('Blizzard_ArenaUI') then LoadAddOn('Blizzard_ArenaUI') end
for i=1, MAX_ARENA_ENEMIES do
c_target(i, 'ArenaEnemyFrame', 'arena', 'ArenaTargetFrame')
local arenatarget = _G['ArenaTargetFrame'..i]
Expand Down
Loading

0 comments on commit 188a523

Please sign in to comment.