-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebuffs.lua
More file actions
234 lines (208 loc) · 7.5 KB
/
Debuffs.lua
File metadata and controls
234 lines (208 loc) · 7.5 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
--[[--------------------------------------------------------------------
PhanxBuffs
Replacement player buff, debuff, and temporary enchant frames.
Copyright (c) 2010-2018 Phanx <addons@phanx.net>. All rights reserved.
https://github.com/Phanx/PhanxBuffs
https://www.curseforge.com/wow/addons/phanxbuffs
https://www.wowinterface.com/downloads/info16874-PhanxBuffs.html
----------------------------------------------------------------------]]
local _, ns = ...
local PhanxDebuffFrame = ns.CreateAuraFrame("PhanxDebuffFrame")
PhanxDebuffFrame.filter = "HARMFUL"
PhanxDebuffFrame.max = 40
PhanxDebuffFrame.unit = "player"
local newTable = ns.newTable
local remTable = ns.remTable
local GetFontFile = ns.GetFontFile
local ceil, floor, next, pairs, sort, tremove, type = math.ceil, math.floor, next, pairs, table.sort, table.remove, type -- Lua
local UnitAura = UnitAura -- WoW
local DebuffTypeSymbol = DebuffTypeSymbol -- FrameXML
local db
local DebuffTypeColor = {
["Curse"] = { 0.6, 0.0, 1 },
["Disease"] = { 0.6, 0.4, 0 },
["Magic"] = { 0.2, 0.6, 1 },
["Poison"] = { 0.0, 0.6, 0 },
}
------------------------------------------------------------------------
function PhanxDebuffFrame:PostInitialize()
db = PhanxBuffsDB
self.ignoreList = PhanxBuffsIgnoreDB.debuffs
end
function PhanxDebuffFrame:ApplySettings()
self.anchorH = db.debuffAnchorH
self.anchorV = db.debuffAnchorV
self.size = db.debuffSize
self.spacing = db.debuffSpacing
self.columns = db.debuffColumns
end
------------------------------------------------------------------------
local GetDispelMacro
do
local _, class = UnitClass("player")
if class == "DRUID" then
function GetDispelMacro(dispelType)
if IsPlayerSpell(88423) then
-- Nature's Cure (Restoration)
if dispelType == "Curse" or dispelType == "Poison" or dispelType == "Magic" then
return "/cast [@player] " .. GetSpellInfo(88423)
end
elseif IsPlayerSpell(2782) then
-- Remove Corruption (Balance, Feral, Guardian)
if dispelType == "Curse" or dispelType == "Poison" then
return "/cast [@player] " .. GetSpellInfo(2782)
end
end
end
elseif class == "MONK" then
function GetDispelMacro(dispelType)
if IsPlayerSpell(115450) then
-- Detox (Mistweaver)
if dispelType == "Disease" or dispelType == "Poison" or dispelType == "Magic" then
return "/cast [@player] " .. GetSpellInfo(115450)
end
elseif IsPlayerSpell(218164) then
-- Detox (Brewmaster, Windwalker)
if dispelType == "Disease" or dispelType == "Poison" then
return "/cast [@player] " .. GetSpellInfo(218164)
end
end
end
elseif class == "PALADIN" then
function GetDispelMacro(dispelType)
if IsPlayerSpell(4987) then
-- Cleanse (Holy)
if dispelType == "Disease" or dispelType == "Poison" or dispelType == "Magic" then
return "/cast [@player] " .. GetSpellInfo(4987)
end
elseif IsPlayerSpell(213644) then
-- Cleanse Toxins (Protection, Retribution)
if dispelType == "Disease" or dispelType == "Poison" then
return "/cast [@player] " .. GetSpellInfo(213644)
end
end
end
elseif class == "PRIEST" then
function GetDispelMacro(dispelType)
if IsPlayerSpell(527) then
-- Purify (Discipline, Holy)
if dispelType == "Disease" or dispelType == "Magic" then
return "/cast [@player] " .. GetSpellInfo(527)
end
elseif IsPlayerSpell(213634) then
-- Purify Disease (Shadow)
if dispelType == "Disease" then
return "/cast [@player] " .. GetSpellInfo(213634)
end
end
end
elseif class == "SHAMAN" then
function GetDispelMacro(dispelType)
if IsPlayerSpell(77130) then
-- Purify Spirit (Restoration)
if dispelType == "Curse" or dispelType == "Magic" then
return "/cast [@player] " .. GetSpellInfo(77130)
end
elseif IsPlayerSpell(51886) then
-- Cleanse Spirit (Elemental, Enhancement)
if dispelType == "Curse" then
return "/cast [@player] " .. GetSpellInfo(51886)
end
end
end
elseif class == "WARLOCK" then
function GetDispelMacro(dispelType)
if dispelType == "Magic" then
if IsPlayerSpell(115276, true) then
-- Sear Magic (Fel Imp)
return "/cast [@player] " .. GetSpellInfo(115276)
elseif IsPlayerSpell(89808, true) then
-- Singe Magic (Imp)
return "/cast [@player] " .. GetSpellInfo(89808)
end
end
end
end
end
local function AuraButton_OnEnter(self)
if not self.index then return end
GameTooltip:SetOwner(self, "ANCHOR_" .. (db.debuffAnchorV == "TOP" and "BOTTOM" or "TOP") .. (db.debuffAnchorH == "RIGHT" and "LEFT" or "RIGHT"))
GameTooltip:SetUnitAura(self.owner.unit, self.index, self.owner.filter)
if not InCombatLockdown() and (PhanxBuffsCancelButton.owner ~= self) then
local macro = GetDispelMacro and GetDispelMacro(self.dispelType)
if macro then
PhanxBuffsCancelButton:SetMacro(self, macro)
end
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 debuff:"], self.name))
self.owner:Update()
end
end
local function AuraButton_SetBorderColor(self, ...)
return self.border:SetVertexColor(...)
end
function PhanxDebuffFrame:PostCreateAuraButton(button)
button:SetScript("OnEnter", AuraButton_OnEnter)
button:SetScript("OnClick", AuraButton_OnClick)
button.symbol = button:CreateFontString(nil, "OVERLAY")
button.symbol:SetPoint("BOTTOMRIGHT", button)
button.symbol:SetShadowOffset(1, -1)
local file, scale, outline = GetFontFile(), db.fontScale, db.fontOutline
button.symbol:SetFont(file, ns.SYMBOL_SIZE * scale, outline)
if not PhanxBorder or (IsAddOnLoaded("Masque") and not db.noMasque) then
button.border = button:CreateTexture(nil, "BORDER")
button.border:SetPoint("TOPLEFT", button, -3, 2)
button.border:SetPoint("BOTTOMRIGHT", button, 2, -2)
button.border:SetTexture("Interface\\Buttons\\UI-Debuff-Overlays")
button.border:SetTexCoord(0.296875, 0.5703125, 0, 0.515625)
button.SetBorderColor = AuraButton_SetBorderColor
end
end
------------------------------------------------------------------------
function PhanxDebuffFrame:PostUpdateAuraButton(button, isShown)
if isShown then
local color = DebuffTypeColor[button.dispelType]
if color then
button:SetBorderColor(color[1], color[2], color[3], 1)
if ENABLE_COLORBLIND_MODE == "0" then
button.symbol:Hide()
else
button.symbol:SetText(DebuffTypeSymbol[button.dispelType])
button.symbol:Show()
end
else
button:SetBorderColor(1, 0, 0, 1)
button.symbol:Hide()
end
else
button:SetBorderColor(1, 0, 0, 1)
button.symbol:Hide()
button.symbol:SetText()
end
end
------------------------------------------------------------------------
function PhanxDebuffFrame:PostUpdateLayout()
local fontFace = GetFontFile(db.fontFace)
local fontScale = db.fontScale
local fontOutline = db.fontOutline
for i = 1, #self.buttons do
local button = self.buttons[i]
button.symbol:SetFont(fontFace, 16 * fontScale, fontOutline == "THICKOUTLINE" and fontOutline or "OUTLINE")
if fontOutline == "THICKOUTLINE" then
button.symbol:SetPoint("BOTTOMRIGHT", 2, 0)
elseif fontOutline == "OUTLINE" then
button.symbol:SetPoint("BOTTOMRIGHT", 0, 0)
else
button.symbol:SetPoint("BOTTOMRIGHT", 0, 0)
end
end
if db.debuffPoint and db.debuffX and db.debuffY then
self:SetPoint(db.debuffPoint, UIParent, db.debuffX, db.debuffY + 0.5)
else
self:SetPoint("BOTTOMRIGHT", UIParent, -70 - floor(Minimap:GetWidth() + 0.5), floor(UIParent:GetHeight() + 0.5) - floor(Minimap:GetHeight() + 0.5) - 62)
end
end