Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create a new plugin for Clique, with the shortname "test"
- local Plugin = CM:NewModule("Luna")
- Plugin.fullname = "Luna Unit Frames"
- -- Plugin:Test() is called anytime the mod tries to enable. It is optional
- -- but it will be checked if it exists. Will typically be based off some global
- -- or the state of the addon itself.
- function Plugin:Test() return LunaUF end
- -- Plugin:OnEnable() is called if Plugin:Test() is true, and the mod hasn't been explicitly
- -- disabled. This is where you should handle all your hooks, etc.
- function Plugin:OnEnable()
- for _, f in ipairs(LunaUF.Units.frameList) do
- self:HookButton(f)
- end
- self.LunaUF_CreateUnit = LunaUF.Units.CreateUnit
- self:Hook(LunaUF.Units, "CreateUnit", "CreateUnit")
- end
- function Plugin:HookButton(button)
- -- DEFAULT_CHAT_FRAME:AddMessage("hook: " .. button:GetName())
- self:HookScript(button, "OnEnter")
- self:HookScript(button, "OnLeave")
- end
- function Plugin:CreateUnit(obj, a1, a2, a3, a4)
- local button = self.LunaUF_CreateUnit(obj, a1, a2, a3, a4)
- self:HookButton(button)
- return button
- end
- function Plugin:OnEnter(obj)
- CM.currentUnit = this.unit
- return self.hooks[obj]["OnEnter"].orig()
- end
- function Plugin:OnLeave(obj)
- CM.currentUnit = nil
- return self.hooks[obj]["OnLeave"].orig()
- end
Advertisement
Add Comment
Please, Sign In to add comment