File: plugins

package info (click to toggle)
crossfire 1.1.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 11,776 kB
  • ctags: 5,507
  • sloc: ansic: 55,776; sh: 2,694; lex: 1,778; perl: 1,710; makefile: 1,518
file content (133 lines) | stat: -rw-r--r-- 3,933 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
(This is a quick-and-dirty documentation for the plugin interface - expect a better one soon).

List of supported events.
=========================

Local events
------------
Those can be attached to a specific object in the game.

APPLY
Tag: event_apply
This event is generated whenever the object is applied or unapplied.

ATTACK
Tag: event_attack
This event is used in two cases:
- bound to a weapon, it is triggered each time the weapon is used to slay
  something; this can typically be used to generate special effects when
  you hit a monster;
- bound to a monster, it is triggered when the monster is attacked.

CLOSE
Tag: event_close
Generated when a container is closed.

DEATH
Tag: event_death
Generated when the object dies.

DROP
Tag: event_drop
Generated when the object is dropped, either on the floor or in a container.

PICKUP
Tag: event_pickup
Generated when the object is picked up.

SAY
Tag: event_say
Generated when someone says something around the object.

STOP
Tag: event_stop
Generated for a thrown object, when the object is stopped for some reason.

TIME
Tag: event_time
Generated each time the object gets an opportunity to move.

THROW
Tag: event_throw
Generated when the object is thrown.

TRIGGER
Tag: event_trigger
Used for various objects, like traps, teleporters or triggers. Generated when
those objects are used (for example, when a player passes through a teleporter)

Global events
-------------
Those concern the game as a whole or can't be bound to a specific object.
Those events may be "registered" by a plugin (it means that the plugin requests
to get a message each time one of those events happens).

BORN
Generated when a new character is created.

CLOCK
Generated at each game loop.
Warning: When no player is logged, the loop "stops", meaning that clock events
are not generated anymore !

CRASH
Generated when a server crash does occur. It is not a recursive event, so if a
crash occur from *inside* the crash event handling, it is not called a second
time, preventing infinite loops to occur.
Note: This event is not implemented for now.

GDEATH
Generated whenever someone dies.

GKILL
Generated whenever something/someone is killed.

LOGIN
Generated whenever a player logs into the game.

LOGOUT
Generated whenever a player logs out the game.

MAPENTER
Generated whenever someone enters a map.

MAPLEAVE
Generated whenever someone leaves a map.

MAPRESET
Generated each time a map is reset.

REMOVE
Generated when a player character is removed from the game ("quit" command).

SHOUT
Generated whenever someone shouts something.

The case of Python
==================

Here is how CFPython handles events:
- local events are managed using the event_... tags. The event_..._plugin tag
  should be Python. the event_... specifies the name of the Python script to
  run. This path is relative to the crossfire map subdirectory.

- global events are all registered by CFPython. If you want to react to one of
  them, you need to create script files in a python/ subdirectory of your
  crossfire map directory. Those files should be called:
  python_shout.py : for the shout global event;
  python_mapenter.py : for the mapenter global event;
  python_remove.py : for the remove global event;
  and so on.
  Some special values are also passed to CFPython for each global event. Those
  are:
  BORN : WhoIsActivator = The object representing the new character.
  LOGIN: WhoAmI and WhoIsActivator = the object representing the character.
         WhatIsMessage = The IP address of the player.
  LOGOUT: Same as for LOGIN.
  REMOVE: WhoIsActivator = The object representing the deleted char.
  SHOUT: WhoIsActivator = The object that shouted something.
         WhatIsMessage = The message shout.
  MAPENTER: WhoIsActivator = The object that entered the new map.
  MAPLEAVE: WhoIsActivator = The object that is leaving the map.
  MAPRESET: WhatIsMessage = The path name of the map reset.