1 |
Plugin support |
2 |
============== |
3 |
|
4 |
Crossfire can be extended through plugins. It's basically a library file, that gets loaded |
5 |
at server initialization. |
6 |
A plugin can be hooked to different events, either related to an object or global ones. |
7 |
(see list later on). |
8 |
|
9 |
You should always include two header files in your plugin projects: |
10 |
|
11 |
- plugin.h, which contains the declaration of most plugin-related constants and |
12 |
the required Crossfire includes; |
13 |
- plugin_common.h (from the plugins/plugin_common directory), which includes the |
14 |
necessary support for Crossfire function wrappers. |
15 |
|
16 |
All your projects should also include plugin_common.c in their build processes; |
17 |
that source file contains a lot of Crossfire function wrappers you can call. |
18 |
Do *not* call the callbacks sent by the Crossfire server directly - use what's |
19 |
provided by plugin_common.c. |
20 |
|
21 |
Important: a plugin should *never* directly call malloc, free, or any function |
22 |
manipulating memory if the memory needs to be given to server. This breaks Windows |
23 |
compatibility. Hooks are provided in case of need. |
24 |
|
25 |
List of supported events. |
26 |
========================= |
27 |
|
28 |
Local events |
29 |
------------ |
30 |
Those can be attached to a specific object in the game. |
31 |
|
32 |
APPLY |
33 |
Tag: event_apply |
34 |
This event is generated whenever the object is applied or unapplied. |
35 |
|
36 |
ATTACK |
37 |
Tag: event_attack |
38 |
This event is used in two cases: |
39 |
- bound to a weapon, it is triggered each time the weapon is used to slay |
40 |
something; this can typically be used to generate special effects when |
41 |
you hit a monster; |
42 |
- bound to a monster, it is triggered when the monster is attacked. |
43 |
|
44 |
CLOSE |
45 |
Tag: event_close |
46 |
Generated when a container is closed. |
47 |
|
48 |
DEATH |
49 |
Tag: event_death |
50 |
Generated when the object dies. |
51 |
|
52 |
DROP |
53 |
Tag: event_drop |
54 |
Generated when the object is dropped, either on the floor or in a container. |
55 |
|
56 |
PICKUP |
57 |
Tag: event_pickup |
58 |
Generated when the object is picked up. |
59 |
|
60 |
SAY |
61 |
Tag: event_say |
62 |
Generated when someone says something around the object. |
63 |
|
64 |
STOP |
65 |
Tag: event_stop |
66 |
Generated for a thrown object, when the object is stopped for some reason. |
67 |
|
68 |
TIME |
69 |
Tag: event_time |
70 |
Generated each time the object gets an opportunity to move. |
71 |
|
72 |
THROW |
73 |
Tag: event_throw |
74 |
Generated when the object is thrown. |
75 |
|
76 |
TRIGGER |
77 |
Tag: event_trigger |
78 |
Used for various objects, like traps, teleporters or triggers. Generated when |
79 |
those objects are used (for example, when a player passes through a teleporter). |
80 |
|
81 |
TIMER |
82 |
Tag: event_timer |
83 |
Generated when the timer connected triggered. |
84 |
|
85 |
Global events |
86 |
------------- |
87 |
Those concern the game as a whole or can't be bound to a specific object. |
88 |
Those events may be "registered" by a plugin (it means that the plugin requests |
89 |
to get a message each time one of those events happens). |
90 |
|
91 |
BORN |
92 |
Generated when a new character is created. |
93 |
|
94 |
CLOCK |
95 |
Generated at each game loop. |
96 |
Warning: When no player is logged, the loop "stops", meaning that clock events |
97 |
are not generated anymore! |
98 |
|
99 |
CRASH |
100 |
Generated when a server crash does occur. It is not a recursive event, so if a |
101 |
crash occur from *inside* the crash event handling, it is not called a second |
102 |
time, preventing infinite loops to occur. |
103 |
Note: This event is not implemented for now. |
104 |
|
105 |
GDEATH |
106 |
Generated whenever someone dies. |
107 |
|
108 |
GKILL |
109 |
Generated whenever something/someone is killed. |
110 |
|
111 |
LOGIN |
112 |
Generated whenever a player logs into the game. |
113 |
|
114 |
LOGOUT |
115 |
Generated whenever a player logs out the game. |
116 |
|
117 |
MAPENTER |
118 |
Generated whenever someone enters a map. |
119 |
|
120 |
MAPLEAVE |
121 |
Generated whenever someone leaves a map. |
122 |
|
123 |
MAPRESET |
124 |
Generated each time a map is reset. |
125 |
|
126 |
REMOVE |
127 |
Generated when a player character is removed from the game ("quit" command). |
128 |
|
129 |
SHOUT |
130 |
Generated whenever someone shouts something. |
131 |
|
132 |
TELL |
133 |
Generated whenever someone tells something. |
134 |
|
135 |
MUZZLE |
136 |
Generated when a player was muzzled by a DM. |
137 |
|
138 |
KICK |
139 |
Generated when a player was kicked by a DM. |