Advertisement
Guest User

Clique_LunaUnitFrames.lua

a guest
Dec 17th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. --[[---------------------------------------------------------------------------------
  2.   This is a template for the plugin/module system for Clique.
  3.  
  4.   Plugins are typically used to tie Clique to a specific set of unit frames, but
  5.   can also be used to add functionality to the system through a manner of hooks.
  6.  
  7.   Plugins are registered with Clique with a shortname that is used for all slash
  8.   commands.  In addition they are required to have a fullname parameter that is
  9.   used in all display messages
  10. ----------------------------------------------------------------------------------]]
  11.  
  12. -- Create a new plugin for Clique, with the shortname "test"
  13. local Plugin = Clique:NewModule("luf")
  14. Plugin.fullname = "LunaUnitFrames"
  15. Plugin.url = "http://www.google.com"
  16.  
  17. -- Plugin:Test() is called anytime the mod tries to enable.  It is optional
  18. -- but it will be checked if it exists.  Will typically be based off some global
  19. -- or the state of the addon itself.
  20. function Plugin:Test()
  21.     -- return IsAddOnLoaded("LunaUnitFrames")
  22.     return Luna_OnClick
  23. end
  24.  
  25. -- Plugin:OnEnable() is called if Plugin:Test() is true, and the mod hasn't been explicitly
  26. -- disabled.  This is where you should handle all your hooks, etc.
  27. function Plugin:OnEnable()
  28.  
  29.     -- Standard hooks do not work ...
  30.     -- Set new handlers directly on the frames ...
  31.  
  32.     -- Single frames ...
  33.     LunaPlayerFrame:SetScript("OnClick", Plugin.LUFClick)
  34.     LunaPetFrame:SetScript("OnClick", Plugin.LUFClick)
  35.     LunaTargetFrame:SetScript("OnClick", Plugin.LUFClick)
  36.     LunaTargetTargetFrame:SetScript("OnClick", Plugin.LUFClick)
  37.     LunaTargetTargetTargetFrame:SetScript("OnClick", Plugin.LUFClick)
  38.  
  39.     -- Party frames ...
  40.     local i = 0
  41.     for i=1, 4 do
  42.         LunaPartyFrames[i]:SetScript("OnClick", Plugin.LUFClick)
  43.         LunaPartyPetFrames[i]:SetScript("OnClick", Plugin.LUFClick)
  44.         LunaPartyTargetFrames[i]:SetScript("OnClick", Plugin.LUFClick)
  45.     end
  46.  
  47.     -- Raid frames ...
  48.     for i=1, 80 do
  49.         LunaUnitFrames.frames.members[i]:SetScript("OnClick", Plugin.LUFClick_Raid)
  50.     end
  51. end
  52.  
  53. function Plugin:LUFClick()
  54.  
  55.     local button = arg1
  56.     local unit = this.unit
  57.  
  58.     if not Clique:OnClick(button, unit) then
  59.         Luna_OnClick()
  60.     end
  61.  
  62. end
  63.  
  64. function Plugin:LUFClick_Raid()
  65.  
  66.     local button = arg1
  67.     local unit = this.unit
  68.  
  69.     if not Clique:OnClick(button, unit) then
  70.         if Luna_Raid_OnClick then
  71.             Luna_Raid_OnClick()
  72.         else
  73.             Luna_OnClick()
  74.         end
  75.     end
  76.  
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement