vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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("xraid") |
||
14 | Plugin.fullname = "XRaid Frames" |
||
15 | Plugin.url = "http://www.wowinterface.com/downloads/fileinfo.php?id=4663" |
||
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 XRaid |
||
22 | end |
||
23 | |||
24 | -- Plugin:OnEnable() is called if Plugin:Test() is true, and the mod hasn't been explicitly |
||
25 | -- disabled. This is where you should handle all your hooks, etc. |
||
26 | function Plugin:OnEnable() |
||
27 | self:Hook(XRaid, "OnClick") |
||
28 | self:Hook(XRaid, "MouseUp") |
||
29 | end |
||
30 | |||
31 | function Plugin:OnClick(obj, button) |
||
32 | local unit = "raid"..this:GetID() |
||
33 | if not Clique:OnClick(button, unit) then |
||
34 | if button == "LeftButton" then |
||
35 | TargetUnit(unit) |
||
36 | elseif button == "RightButton" then |
||
37 | Clique:UnitMenu(unit) |
||
38 | end |
||
39 | end |
||
40 | end |
||
41 | |||
42 | function Plugin:MouseUp(obj, button) |
||
43 | if button == "LeftButton" and IsControlKeyDown() then |
||
44 | return self.hooks[obj].MouseUp.orig(obj, button) |
||
45 | elseif button == "RightButton" and IsControlKeyDown() then |
||
46 | return self.hooks[obj].MouseUp.orig(obj, button) |
||
47 | end |
||
48 | end |