Created
September 19, 2016 16:18
-
-
Save Zod-/5a591aebcd70681efeb39477db78b41c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "Window" | |
local TestBuffs = {} | |
function TestBuffs:new(o) | |
o = o or {} | |
setmetatable(o, self) | |
self.__index = self | |
return o | |
end | |
function TestBuffs:Init() | |
Apollo.RegisterAddon(self, false, "", {}) | |
end | |
function TestBuffs:OnLoad() | |
Apollo.RegisterEventHandler("BuffAdded", "OnBuffAdded", self) | |
Apollo.RegisterEventHandler("BuffUpdated", "OnBuffUpdated", self) | |
Apollo.RegisterEventHandler("BuffRemoved", "OnBuffRemoved", self) | |
end | |
function TestBuffs:Print (unit, buff, type) | |
Print(type.. ": "..unit:GetName().." "..buff.splEffect:GetName()) | |
end | |
function TestBuffs:OnBuffAdded (unit, buff) | |
if unit:IsACharacter() or not buff.splEffect:IsBeneficial() then return end | |
self:Print(unit, buff, "BuffAdded") | |
end | |
function TestBuffs:OnBuffUpdated (unit, buff) | |
if unit:IsACharacter() or not buff.splEffect:IsBeneficial() then return end | |
self:Print(unit, buff, "BuffUpdated") | |
end | |
function TestBuffs:OnBuffRemoved (unit, buff) | |
if unit:IsACharacter() or not buff.splEffect:IsBeneficial() then return end | |
self:Print(unit, buff, "BuffRemoved") | |
end | |
local TestBuffsInst = TestBuffs:new() | |
TestBuffsInst:Init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment