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("resurrection") |
||
14 | Plugin.fullname = "Click-to-resurrect" |
||
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 | local DEAD_UNIT = "Click on Dead Unit" |
||
20 | |||
21 | function Plugin:Test() |
||
22 | local _,class = UnitClass("player") |
||
23 | return class == "SHAMAN" or class == "PALADIN" or class == "DRUID" or class == "PRIEST" |
||
24 | end |
||
25 | |||
26 | function Plugin:OnEnable() |
||
27 | Clique.db.char[DEAD_UNIT] = Clique.db.char[DEAD_UNIT] or {} |
||
28 | end |
||
29 | |||
30 | function Plugin:_OnClick(button, unit) |
||
31 | self:LevelDebug(3, "_OnClick hook being called") |
||
32 | if UnitIsDead(unit) then |
||
33 | self:LevelDebug(3, "Found that unit %s is dead.", unit) |
||
34 | Clique.set = DEAD_UNIT |
||
35 | return true |
||
36 | end |
||
37 | end |