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("blizzuf") |
||
14 | Plugin.fullname = "Blizzard Unit Frames" |
||
15 | |||
16 | local frames = { |
||
17 | ["PlayerFrame"] = "player", |
||
18 | ["PetFrame"] = "pet", |
||
19 | ["TargetFrame"] = "target", |
||
20 | ["TargetofTargetFrame"] = "targettarget", |
||
21 | ["PartyMemberFrame1"] = "party1", |
||
22 | ["PartyMemberFrame2"] = "party2", |
||
23 | ["PartyMemberFrame3"] = "party3", |
||
24 | ["PartyMemberFrame4"] = "party4", |
||
25 | ["PartyMemberFrame1PetFrame"] = "party1", |
||
26 | ["PartyMemberFrame2PetFrame"] = "party2", |
||
27 | ["PartyMemberFrame3PetFrame"] = "party3", |
||
28 | ["PartyMemberFrame4PetFrame"] = "party4", |
||
29 | } |
||
30 | |||
31 | -- Plugin:OnEnable() is called if Plugin:Test() is true, and the mod hasn't been explicitly |
||
32 | -- disabled. This is where you should handle all your hooks, etc. |
||
33 | function Plugin:OnEnable() |
||
34 | for frame,unit in pairs(frames) do |
||
35 | local button = getglobal(frame) |
||
36 | |||
37 | button.unit = unit |
||
38 | button:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp", "Button4Up", "Button5Up") |
||
39 | self:HookScript(button, "OnClick") |
||
40 | end |
||
41 | end |
||
42 | |||
43 | function Plugin:OnClick() |
||
44 | local button = arg1 |
||
45 | local unit = this.unit |
||
46 | if not Clique:OnClick(button, unit) then |
||
47 | self.hooks[this].OnClick.orig(this) |
||
48 | end |
||
49 | end |