|
179 | 179 | * index - the actual position of the aura button (number)
|
180 | 180 | ]]--
|
181 | 181 | function aura_proto:UpdateColor(button, unit, data)
|
182 |
| - -- dispel harmful effects from friendly target. |
183 |
| - -- dispell beneficial effects from enemy target. |
184 |
| - local dispelType = LibDispel:GetDispelType(data.spellId, data.dispelName) |
185 |
| - local isDispelable = LibDispel:IsDispelable(unit, data.spellId, dispelType, data.isHarmful) |
186 |
| - |
187 |
| - if (data.isHarmful and UnitCanAssist("player", unit)) or (data.isHelpful and UnitCanAttack(unit, "player")) then |
188 |
| - local color = Filger.colors[dispelType] |
189 |
| - if button.Backdrop then |
| 182 | + if button.Backdrop then |
| 183 | + if (data.isHarmful and UnitCanAssist("player", unit)) or (data.isHelpful and UnitCanAttack(unit, "player") and UnitCanAttack("player", unit)) then |
| 184 | + local color = Filger.colors[data.dispelName] |
190 | 185 | button.Backdrop:SetBackdropBorderColor(color.r, color.g, color.b, color.a or 1)
|
191 |
| - end |
192 |
| - else |
193 |
| - local color = Filger.config.general.backdrop.color |
194 |
| - if button.Backdrop then |
| 186 | + else |
| 187 | + local color = Filger.config.general.backdrop.color |
195 | 188 | button.Backdrop:SetBackdropBorderColor(color.r, color.g, color.b, color.a or 1)
|
196 | 189 | end
|
197 | 190 | end
|
198 | 191 |
|
199 |
| - if button.Icon then |
| 192 | + if button.Icon and self.desaturated == true then |
200 | 193 | button.Icon:SetDesaturated(data.isHarmful and not data.isPlayerAura and not UnitIsUnit(unit, "player"))
|
201 | 194 | end
|
202 | 195 |
|
203 | 196 | if button.Animation then
|
204 |
| - if isDispelable or data.isStealable then |
| 197 | + if data.isDispelable or data.isStealable then |
205 | 198 | button.Animation:Play()
|
206 | 199 | button.Animation.playing = true
|
207 | 200 | else
|
|
331 | 324 |
|
332 | 325 | data.isPlayerAura = data.sourceUnit and (UnitIsUnit("player", data.sourceUnit) or UnitIsOwnerOrControllerOfUnit("player", data.sourceUnit))
|
333 | 326 |
|
| 327 | + data.dispelName = LibDispel:GetDispelType(data.spellId, data.dispelName) |
| 328 | + data.isDispelable = LibDispel:IsDispelable(unit, data.spellId, data.dispelName, data.isHarmful) |
| 329 | + |
334 | 330 | local spell = self.spells[data.spellId]
|
335 |
| - data.isSpell = spell and spell.enabled or false |
| 331 | + data.enabled = spell and spell.enabled or false |
336 | 332 | data.priority = spell and spell.priority or 0
|
337 | 333 |
|
338 | 334 | return data
|
|
669 | 665 | self:UpdateCooldowns("SPELL_UPDATE_COOLDOWN", self.unit)
|
670 | 666 | end
|
671 | 667 |
|
| 668 | + -- register which spell the player cast |
672 | 669 | function cooldown_proto:UNIT_SPELLCAST_SUCCEEDED(unit, guid, spellId)
|
673 |
| - local name = GetSpellName(spellId) |
674 |
| - if name then |
675 |
| - self.casted[spellId] = true |
676 |
| - end |
| 670 | + self.casted[spellId] = true |
677 | 671 | end
|
678 | 672 | end
|
679 | 673 |
|
|
0 commit comments