Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] remove stack indication from effect name in order to display correct … #1253

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ed49719
remove stack indication from effect name in order to display correct …
pepopo978 Jan 25, 2024
e4ce74a
Refresh fire vulnerability properly at 5 stacks
pepopo978 Jan 26, 2024
0cbb976
Merge branch 'shagu:master' into master
pepopo978 Mar 18, 2024
8fd8854
Merge branch 'master' of github.com:shagu/pfUI
pepopo978 Apr 16, 2024
ce46887
rearrange
pepopo978 Apr 25, 2024
da1e43f
Merge branch 'master' of github.com:shagu/pfUI
pepopo978 May 9, 2024
c67ee61
Merge branch 'master' of github.com:shagu/pfUI
pepopo978 May 10, 2024
b19eccf
make focus use guid
pepopo978 May 11, 2024
1a230bf
remove old swap logic
pepopo978 May 11, 2024
593fe29
Merge branch 'master' of github.com:shagu/pfUI
pepopo978 May 11, 2024
f570cf3
reduce update frequency on a bunch of stuff
pepopo978 May 13, 2024
da013f5
improve cooldown frame update
pepopo978 May 14, 2024
f9148af
Merge branch 'master' of github.com:shagu/pfUI
pepopo978 May 14, 2024
cb2408d
revert some of the reduced updated changes
pepopo978 May 19, 2024
58a2002
Merge branch 'master' of github.com:shagu/pfUI
pepopo978 May 19, 2024
ac0ca01
revert other onupdate changes
pepopo978 May 19, 2024
0b68239
fix castfocus
pepopo978 May 21, 2024
41f5f22
Merge branch 'shagu:master' into master
pepopo978 Aug 13, 2024
1d8dacd
nameplates: combat state border colors
shagu Sep 2, 2024
44a95b7
nameplates: abbreviate unit names if option is set
shagu Sep 3, 2024
25ca2be
bags: make sure bag slot frame is initialized
shagu Sep 18, 2024
3bbac09
bags: add option to anchor bags above chat
bhhandley Sep 23, 2024
5a26d36
unitframes: add option for text offsets for hp & power bars
dbulatovicx32 Sep 23, 2024
1a9670d
unitframes: use correct text anchor on power bars
shagu Sep 23, 2024
349500d
loot: only close the proper dialog window
shagu Sep 23, 2024
b9b1e09
bags: remove regex workaround for bag searches
shagu Sep 23, 2024
8362027
nameplates: keep target nameplate above others
shagu Sep 28, 2024
644017e
toc: bump version to 5.4.7
shagu Sep 28, 2024
7e7d414
panel: add total line to gold info panel
bhhandley Oct 6, 2024
619c381
turtle-wow: rearrange profession elements
Zebouski Oct 31, 2024
4795be3
turtle-wow: only change position if skin is enabled
shagu Oct 31, 2024
4b3c5c2
turtle-wow: skin proffession buttons and edit box
shagu Nov 2, 2024
85aa146
panel: refresh ammo slots on bag update
shagu Nov 2, 2024
cb065ed
minimap: don't overwrite minimap strata
shagu Nov 2, 2024
52478a3
nameplates: add option for vertical offset
shagu Nov 3, 2024
c7cc284
nameplates: only change parent sizing when required
shagu Nov 3, 2024
440ca2b
env: update translations
shagu Nov 3, 2024
d830ba3
nameplates: use superwow unit guid as unitstr
shagu Nov 3, 2024
c387692
turtle-wow: remove obsolete trueshot castbar entries
shagu Nov 3, 2024
33440f8
nameplates: use single event listener for all plates
shagu Nov 3, 2024
9c193f5
toc: bump version to 5.4.8
shagu Nov 3, 2024
cf48a1e
addoncompat: add prat to the softconflict list
shagu Nov 3, 2024
60f37a1
Merge branch 'master' of https://github.com/shagu/pfUI
pepopo978 Nov 4, 2024
2f01980
merge shagu changes
pepopo978 Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions api/unitframes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,9 @@ function pfUI.uf.OnLeave()
end

function pfUI.uf.OnClick()
if not this.label and this.unitname then
if not this.label and this.guid then
TargetUnit(this.guid)
elseif not this.label and this.unitname then
TargetByName(this.unitname, true)
else
pfUI.uf:ClickAction(arg1)
Expand Down Expand Up @@ -2027,7 +2029,13 @@ end
function pfUI.uf:ClickAction(button)
local label = this.label or ""
local id = this.id or ""
local unitstr = label .. id
local unitstr

if this.guid then
unitstr = this.guid
else
unitstr = label .. id
end
local showmenu = button == "RightButton" and true or nil
if SpellIsTargeting() and button == "RightButton" then
SpellStopTargeting()
Expand Down
41 changes: 36 additions & 5 deletions libs/libdebuff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ local scanner = libtipscan:GetScanner("libdebuff")
local _, class = UnitClass("player")
local lastspell

libdebuff.objects = {}
libdebuff.pending = {}

function libdebuff:GetDuration(effect, rank)
if L["debuffs"][effect] then
local rank = rank and tonumber((string.gsub(rank, RANK, ""))) or 0
local rank = L["debuffs"][effect][rank] and rank or libdebuff:GetMaxRank(effect)
rank = rank and tonumber((string.gsub(rank, RANK, ""))) or 0
rank = L["debuffs"][effect][rank] and rank or libdebuff:GetMaxRank(effect)
local duration = L["debuffs"][effect][rank]

if effect == L["dyndebuffs"]["Rupture"] then
Expand Down Expand Up @@ -116,6 +119,7 @@ end

function libdebuff:AddEffect(unit, unitlevel, effect, duration)
if not unit or not effect then return end
effect = string.gsub(effect, " %(%d+%)", "") -- remove stack indication from effect name in order to display correct expiration time for things like Fire Vulnerability
unitlevel = unitlevel or 0
if not libdebuff.objects[unit] then libdebuff.objects[unit] = {} end
if not libdebuff.objects[unit][unitlevel] then libdebuff.objects[unit][unitlevel] = {} end
Expand All @@ -137,6 +141,8 @@ libdebuff:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE")
libdebuff:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE")
libdebuff:RegisterEvent("CHAT_MSG_SPELL_FAILED_LOCALPLAYER")
libdebuff:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE")
libdebuff:RegisterEvent("CHAT_MSG_SPELL_PARTY_DAMAGE")
libdebuff:RegisterEvent("CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE")
libdebuff:RegisterEvent("PLAYER_TARGET_CHANGED")
libdebuff:RegisterEvent("SPELLCAST_STOP")
libdebuff:RegisterEvent("UNIT_AURA")
Expand All @@ -152,9 +158,6 @@ libdebuff.rp = { SPELLIMMUNESELFOTHER, IMMUNEDAMAGECLASSSELFOTHER,
SPELLDODGEDSELFOTHER, SPELLDEFLECTEDSELFOTHER, SPELLREFLECTSELFOTHER,
SPELLPARRIEDSELFOTHER, SPELLLOGABSORBSELFOTHER }

libdebuff.objects = {}
libdebuff.pending = {}

-- Gather Data by Events
libdebuff:SetScript("OnEvent", function()
-- paladin seal refresh
Expand Down Expand Up @@ -205,6 +208,20 @@ libdebuff:SetScript("OnEvent", function()

-- Update Pending Spells
elseif event == "CHAT_MSG_SPELL_FAILED_LOCALPLAYER" or event == "CHAT_MSG_SPELL_SELF_DAMAGE" then
-- update fire vulnerability
if arg1 then
spell, unit = cmatch(arg1, SPELLLOGSELFOTHER)

if not unit then
spell, unit = cmatch(arg1, SPELLLOGCRITSELFOTHER)
end

if unit and spell == "Scorch" then
local unitlevel = UnitName("target") == unit and UnitLevel("target") or 0
libdebuff:AddEffect(unit, unitlevel, "Fire Vulnerability")
end
end

-- Remove pending spell
for _, msg in pairs(libdebuff.rp) do
local effect = cmatch(arg1, msg)
Expand All @@ -218,6 +235,20 @@ libdebuff:SetScript("OnEvent", function()
return
end
end
elseif event == "CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE" or event == "CHAT_MSG_SPELL_PARTY_DAMAGE" then
-- update fire vulnerability
if arg1 then
_, spell, unit = cmatch(arg1, SPELLLOGOTHEROTHER)

if not unit then
_, spell, unit = cmatch(arg1, SPELLLOGCRITOTHEROTHER)
end

if unit and spell == "Scorch" then
local unitlevel = UnitName("target") == unit and UnitLevel("target") or 0
libdebuff:AddEffect(unit, unitlevel, "Fire Vulnerability")
end
end
elseif event == "SPELLCAST_STOP" then
QueueFunction(libdebuff.PersistPending)
end
Expand Down
187 changes: 109 additions & 78 deletions modules/focus.lua
Original file line number Diff line number Diff line change
@@ -1,96 +1,127 @@
pfUI:RegisterModule("focus", "vanilla:tbc", function ()
-- do not go further on disabled UFs
if C.unitframes.disable == "1" then return end

pfUI.uf.focus = pfUI.uf:CreateUnitFrame("Focus", nil, C.unitframes.focus, .2)
pfUI.uf.focus:UpdateFrameSize()
pfUI.uf.focus:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 220, 220)
UpdateMovable(pfUI.uf.focus)
pfUI.uf.focus:Hide()

pfUI.uf.focustarget = pfUI.uf:CreateUnitFrame("FocusTarget", nil, C.unitframes.focustarget, .2)
pfUI.uf.focustarget:UpdateFrameSize()
pfUI.uf.focustarget:SetPoint("BOTTOMLEFT", pfUI.uf.focus, "TOP", 0, 10)
UpdateMovable(pfUI.uf.focustarget)
pfUI.uf.focustarget:Hide()
pfUI:RegisterModule("focus", "vanilla:tbc", function()
-- do not go further on disabled UFs
if C.unitframes.disable == "1" then
return
end

pfUI.uf.focus = pfUI.uf:CreateUnitFrame("Focus", nil, C.unitframes.focus, .2)
pfUI.uf.focus:UpdateFrameSize()
pfUI.uf.focus:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 220, 220)
UpdateMovable(pfUI.uf.focus)
pfUI.uf.focus:Hide()

pfUI.uf.focustarget = pfUI.uf:CreateUnitFrame("FocusTarget", nil, C.unitframes.focustarget, .2)
pfUI.uf.focustarget:UpdateFrameSize()
pfUI.uf.focustarget:SetPoint("BOTTOMLEFT", pfUI.uf.focus, "TOP", 0, 10)
UpdateMovable(pfUI.uf.focustarget)
pfUI.uf.focustarget:Hide()
end)

-- register focus emulation commands for vanilla
if pfUI.client > 11200 then return end
if pfUI.client > 11200 then
return
end

function pfUI:SetFocus(msg)
if not pfUI.uf or not pfUI.uf.focus then
return
end

if msg ~= "" then
pfUI.uf.focus.unitname = strlower(msg)
elseif UnitName("target") then
pfUI.uf.focus.unitname = strlower(UnitName("target"))
else
pfUI.uf.focus.unitname = nil
pfUI.uf.focus.label = nil
end
local _, guid = UnitExists("target")
pfUI.uf.focus.guid = guid
end

function pfUI:SetFocusGuid(guid)
if not pfUI.uf or not pfUI.uf.focus then
return
end

pfUI.uf.focus.guid = guid
pfUI.uf.focus.unitname = strlower(UnitName(guid))
end

function pfUI:ClearFocus()
if pfUI.uf and pfUI.uf.focus then
pfUI.uf.focus.unitname = nil
pfUI.uf.focus.label = nil
end
end

function pfUI:CastFocus(msg)
if not pfUI.uf.focus or not pfUI.uf.focus:IsShown() or not pfUI.uf.focus.unitname then
UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0)
return
end

local skiptarget = false
local player = UnitIsUnit("target", "player")

if pfUI.uf.focus.guid then
CastSpellByName(msg, pfUI.uf.focus.guid)
elseif pfUI.uf.focus.label and UnitIsUnit("target", pfUI.uf.focus.label .. pfUI.uf.focus.id) then
skiptarget = true
else
pfScanActive = true
if pfUI.uf.focus.label and pfUI.uf.focus.id then
TargetUnit(pfUI.uf.focus.label .. pfUI.uf.focus.id)
else
TargetByName(pfUI.uf.focus.unitname, true)
end

if strlower(UnitName("target")) ~= strlower(pfUI.uf.focus.unitname) then
TargetLastTarget()
UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0)
return
end
pfScanActive = nil
end

local func = loadstring(msg or "")
if func then
func()
else
CastSpellByName(msg)
end
end

function pfUI:SwapFocus()
if not pfUI.uf or not pfUI.uf.focus then
return
end

local currentUnitName = strlower(UnitName("target"))
local exists, currentUnitGUID = UnitExists("target")
if exists and currentUnitName and pfUI.uf.focus.guid then
TargetUnit(pfUI.uf.focus.guid)
pfUI.uf.focus.unitname = currentUnitName
pfUI.uf.focus.guid = currentUnitGUID
end
end

SLASH_PFFOCUS1, SLASH_PFFOCUS2 = '/focus', '/pffocus'
function SlashCmdList.PFFOCUS(msg)
if not pfUI.uf or not pfUI.uf.focus then return end

if msg ~= "" then
pfUI.uf.focus.unitname = strlower(msg)
elseif UnitName("target") then
pfUI.uf.focus.unitname = strlower(UnitName("target"))
else
pfUI.uf.focus.unitname = nil
pfUI.uf.focus.label = nil
end
pfUI:SetFocus(msg)
end

SLASH_PFCLEARFOCUS1, SLASH_PFCLEARFOCUS2 = '/clearfocus', '/pfclearfocus'
function SlashCmdList.PFCLEARFOCUS(msg)
if pfUI.uf and pfUI.uf.focus then
pfUI.uf.focus.unitname = nil
pfUI.uf.focus.label = nil
end
pfUI:ClearFocus()
end

SLASH_PFCASTFOCUS1, SLASH_PFCASTFOCUS2 = '/castfocus', '/pfcastfocus'
function SlashCmdList.PFCASTFOCUS(msg)
if not pfUI.uf.focus or not pfUI.uf.focus:IsShown() or not pfUI.uf.focus.unitname then
UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0)
return
end

local skiptarget = false
local player = UnitIsUnit("target", "player")

if pfUI.uf.focus.label and UnitIsUnit("target", pfUI.uf.focus.label .. pfUI.uf.focus.id) then
skiptarget = true
else
pfScanActive = true
if pfUI.uf.focus.label and pfUI.uf.focus.id then
TargetUnit(pfUI.uf.focus.label .. pfUI.uf.focus.id)
else
TargetByName(pfUI.uf.focus.unitname, true)
end

if strlower(UnitName("target")) ~= strlower(pfUI.uf.focus.unitname) then
pfScanActive = nil
TargetLastTarget()
UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0)
return
end
end

local func = loadstring(msg or "")
if func then
func()
else
CastSpellByName(msg)
end

if skiptarget == false then
pfScanActive = nil
if player then
TargetUnit("player")
else
TargetLastTarget()
end
end
pfUI:CastFocus(msg)
end

SLASH_PFSWAPFOCUS1, SLASH_PFSWAPFOCUS2 = '/swapfocus', '/pfswapfocus'
function SlashCmdList.PFSWAPFOCUS(msg)
if not pfUI.uf or not pfUI.uf.focus then return end

local oldunit = UnitExists("target") and strlower(UnitName("target"))
if oldunit and pfUI.uf.focus.unitname then
TargetByName(pfUI.uf.focus.unitname)
pfUI.uf.focus.unitname = oldunit
end
pfUI:SwapFocus()
end