Skip to content

Instantly share code, notes, and snippets.

@Zod-
Created September 19, 2016 16:18
Show Gist options
  • Save Zod-/5a591aebcd70681efeb39477db78b41c to your computer and use it in GitHub Desktop.
Save Zod-/5a591aebcd70681efeb39477db78b41c to your computer and use it in GitHub Desktop.
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