-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuffs.lua
More file actions
107 lines (82 loc) · 3.4 KB
/
Buffs.lua
File metadata and controls
107 lines (82 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--[[--------------------------------------------------------------------
PhanxBuffs
Replacement player buff, debuff, and temporary enchant frames.
Copyright (c) 2010-2018 Phanx <addons@phanx.net>. All rights reserved.
https://www.wowinterface.com/downloads/info16874-PhanxBuffs.html
https://www.curseforge.com/wow/addons/phanxbuffs
https://github.com/Phanx/PhanxBuffs
----------------------------------------------------------------------]]
--local function print(...) ChatFrame3:AddMessage(strjoin(" ", tostringall(...))) end
local _, ns = ...
local PhanxBuffFrame = ns.CreateAuraFrame("PhanxBuffFrame")
PhanxBuffFrame.filter = "HELPFUL"
PhanxBuffFrame.max = 40
PhanxBuffFrame.unit = "player"
local newTable = ns.newTable
local remTable = ns.remTable
local GetFontFile = ns.GetFontFile
local L = ns.L
L["Cast by |cff%02x%02x%02x%s|r"] = gsub(L["Cast by %s"], "%%s", "|cff%%02x%%02x%%02x%%s|r")
local ceil, floor, next, pairs, sort, tonumber, type = math.ceil, math.floor, next, pairs, table.sort, tonumber, type -- Lua functions
local GetSpellInfo, UnitAura = GetSpellInfo, UnitAura -- API functions
local db
------------------------------------------------------------------------
function PhanxBuffFrame:PostInitialize()
db = PhanxBuffsDB
self.ignoreList = PhanxBuffsIgnoreDB.buffs
end
function PhanxBuffFrame:ApplySettings()
self.anchorH = db.buffAnchorH
self.anchorV = db.buffAnchorV
self.size = db.buffSize
self.spacing = db.buffSpacing
self.columns = db.buffColumns
end
------------------------------------------------------------------------
local unitNames = setmetatable({}, { __index = function(t, unit)
if not unit then return end
local name = UnitName(unit)
if not name then return end
local _, class = UnitClass(unit)
if not class then return format(L["Cast by %s"], name) end
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if not color then return format(L["Cast by %s"], name) end
return format(L["Cast by |cff%02x%02x%02x%s|r"], color.r * 255, color.g * 255, color.b * 255, name)
end })
local function AuraButton_OnEnter(self)
if not self.index then return end
GameTooltip:SetOwner(self, "ANCHOR_" .. (db.buffAnchorV == "TOP" and "BOTTOM" or "TOP") .. (db.buffAnchorH == "RIGHT" and "LEFT" or "RIGHT"))
GameTooltip:SetUnitAura(self.owner.unit, self.index, self.owner.filter)
if db.showBuffSources then
local caster = unitNames[self.caster]
if caster then
GameTooltip:AddLine(caster)
GameTooltip:Show()
end
end
if not InCombatLockdown() and (PhanxBuffsCancelButton.owner ~= self) then
PhanxBuffsCancelButton:SetMacro(self, "/cancelaura " .. self.name)
end
end
local function AuraButton_OnClick(self)
if self.name and IsAltKeyDown() and IsShiftKeyDown() then
self.owner.ignoreList[self.name] = true
print("|cffffcc00PhanxBuffs:|r", format(ns.L["Now ignoring buff: %s"], self.name))
self.owner:Update()
end
end
function PhanxBuffFrame:PostCreateAuraButton(button)
button:SetScript("OnEnter", AuraButton_OnEnter)
button:SetScript("OnClick", AuraButton_OnClick)
end
------------------------------------------------------------------------
function PhanxBuffFrame:GetLayoutOffset()
return PhanxTempEnchantFrame.numEnchants
end
function PhanxBuffFrame:PostUpdateLayout()
if db.buffPoint and db.buffX and db.buffY then
self:SetPoint(db.buffPoint, UIParent, db.buffX, db.buffY)
else
self:SetPoint("TOPRIGHT", UIParent, -70 - floor(Minimap:GetWidth() + 0.5), -15)
end
end