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("marsraid") |
||
14 | Plugin.fullname = "Mars Raid Frames" |
||
15 | |||
16 | -- Plugin:Test() is called anytime the mod tries to enable. It is optional |
||
17 | -- but it will be checked if it exists. Will typically be based off some global |
||
18 | -- or the state of the addon itself. |
||
19 | function Plugin:Test() |
||
20 | return IsAddOnLoaded("MarsRaid") |
||
21 | end |
||
22 | |||
23 | -- Plugin:OnEnable() is called if Plugin:Test() is true, and the mod hasn't been explicitly |
||
24 | -- disabled. This is where you should handle all your hooks, etc. |
||
25 | function Plugin:OnEnable() |
||
26 | self:Hook("MarsRaidFrame_OnClick", "OnClick") |
||
27 | end |
||
28 | |||
29 | -- Only unassigned clicks get sent here, so make sure they are unassigned in the |
||
30 | -- Click Template Editor |
||
31 | function Plugin:OnClick() |
||
32 | local button = arg1 |
||
33 | local unit = this.unit |
||
34 | |||
35 | if not Clique:OnClick(button, unit) then |
||
36 | if button == "LeftButton" then |
||
37 | TargetUnit(unit) |
||
38 | elseif button == "RightButton" then |
||
39 | Clique:UnitMenu(unit) |
||
40 | end |
||
41 | end |
||
42 | end |