Guest User

Untitled

a guest
May 6th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. -- Create a new plugin for Clique, with the shortname "test"
  2. local Plugin = CM:NewModule("Luna")
  3. Plugin.fullname = "Luna Unit Frames"
  4.  
  5. -- Plugin:Test() is called anytime the mod tries to enable.  It is optional
  6. -- but it will be checked if it exists.  Will typically be based off some global
  7. -- or the state of the addon itself.
  8. function Plugin:Test() return LunaUF end
  9.  
  10. -- Plugin:OnEnable() is called if Plugin:Test() is true, and the mod hasn't been explicitly
  11. -- disabled.  This is where you should handle all your hooks, etc.
  12. function Plugin:OnEnable()
  13.  
  14.     for _, f in ipairs(LunaUF.Units.frameList) do
  15.         self:HookButton(f)
  16.     end
  17.  
  18.     self.LunaUF_CreateUnit = LunaUF.Units.CreateUnit
  19.     self:Hook(LunaUF.Units, "CreateUnit", "CreateUnit")
  20.  
  21. end
  22.  
  23. function Plugin:HookButton(button)
  24.     -- DEFAULT_CHAT_FRAME:AddMessage("hook: " .. button:GetName())
  25.  
  26.     self:HookScript(button, "OnEnter")
  27.     self:HookScript(button, "OnLeave")
  28. end
  29.  
  30. function Plugin:CreateUnit(obj, a1, a2, a3, a4)
  31.     local button = self.LunaUF_CreateUnit(obj, a1, a2, a3, a4)
  32.     self:HookButton(button)
  33.     return button
  34. end
  35.  
  36. function Plugin:OnEnter(obj)
  37.     CM.currentUnit = this.unit
  38.     return self.hooks[obj]["OnEnter"].orig()
  39. end
  40.  
  41. function Plugin:OnLeave(obj)
  42.     CM.currentUnit = nil
  43.     return self.hooks[obj]["OnLeave"].orig()
  44. end
Advertisement
Add Comment
Please, Sign In to add comment