=head1 CROSSFIRE PLUG-IN EVENTS This document briefly describes each plug-in event. It is also used to generate the event-list itself, so is always complete. Be careful wehn changing it, though. =head2 NOTATION the event description below uses a variant of the forth stack notation - an opening parenthesis followed by the type of each parameter, optionally followed by two dashes and the returning parameters. If the latter is missing, the event will be invoked but cannot change wether the event gets processed. If it is specified (even if no return values are supported), a plug-in can override (e.g. using C in Perl) event processing, basically short-circuiting it. For example, if you override from within a player BIRTH event, nothing much will happen with respect to the built-in processing, but if you override from within a player TELL event, the tell will be ignored (presumably your plug-in took care of it). =head2 GLOBAL EVENTS Global events have no relation to specific objects. =head3 clock ( ) Is invoked on every server tick, usually every 0.12 seconds. =head2 PLAYER EVENTS Player events always have a player object as first argument. =head3 reattach (player) Invoked whenever attachments/plug-ins need to get reattached to the player object. This usually happens when the player gets loaded from disk, or when the server is reloaded. =head3 birth (player) Invoked as very first thing after creating a player. =head3 quit (player) Invoked wheneever a player quits, before actually removing him/her. =head3 load (player) Invoked whenever a player has been loaded from disk, but before actual login. =head3 save (player) Invoked just before a player gets saved. =head3 login (player) Invoked whenever a player logs in. =head3 logout (player) Invoked whenever a player logs out, gets disconnected etc. =head3 death (player) Invoked whenever a player dies, before the death actually gets processed. =head3 map_change (player oldmap newmap) Invoked whenever a player moves from one map to another. =head3 extcmd (player string) Invoked whenever a client issues the C protocol command. It's argument is passed without any changes. =head3 pray_altar (player altar skill -- ) Invoked whenever the B prays over an B, using the given B. =head3 tell (player -- ) Invoked whenever the player uses the B command, before it gets processed. =head3 say (player --) Invoked whenever the player uses the B command, before it gets processed. =head3 shout (player --) Invoked whenever the player uses the B command, before it gets processed. =head2 OBJECT EVENTS Object events always relate to a specific object, which is always the first argument. Not all events get generated for every object, some are specific to an object type. =head3 instantiate (object init-args...) An archetype was instantiated into an object. This event occurs when a map is loaded for the first time, or when the object was created dynamically. The arguments are as specified in the C attribute of the object or archetype. This is useful to initialise any per-object state you might need. =head3 reattach (object) Invoked whenever attachments/plug-ins need to get reattached to the object. This usually happens when it was loaded from disk, or when the server was reloaded. This event will only be generated if the object has attachments. =head3 clone (object destination) An object with _attached extension_ is cloned, that is, a copy was made. The copy automatically has all attachments the original object had. The perl variables get copied in a shallow way (references are shared between instances). If this is not the behaviour you need, you have to adjust the B object as you see fit. =head3 destroy (object) Invoked when the crossfire object gets destroyed, and only when the object has a handler for this event. This event can occur many times, as its called when the in-memory object is destroyed, not when the object itself dies. =head3 tick (object) Invoked whenever the object "ticks", i.e. has positive B. Only during ticks should an objetc process any movement or other events. =head3 kill (object hitter -- ) Invoked whenever an object is dead and about to get removed. Overriding processing will skip removal, but to do this successfully you have to objetc from dieing, otherwise the event gets invoked again and again. =head3 apply (object who -- applytype) Invoked whenever the object is being applied in some way. The applytype is one of: =over 4 =item B<0> player or monster can't apply objects of that type =item B<1> has been applied, or there was an error applying the object =item B<2> objects of that type can't be applied if not in inventory =back =head3 use_skill (skill who part direction strignarg -- ) Invoked whenever a skill is used by somebody or something. =head3 cast_spell (spell casting_object owner direction stringarg -- ) Invoked whenever a given spell is cast by B (used by B). =head3 drop (object who -- ) Invoked whenever an item gets dropped by somebody, e.g. as a result of a drop command. =head3 drop_on (floor object who -- ) Invoked whenever some B is being dropped on the B object. =head3 listen Invoked whenever the object can hear something beign said in its vicinity. Not yet implemented. =head3 move (monster enemy -- ) Invoked whenever the B tries to move, just after B and other parameters have been determined, but before movement is actually executed. =head3 attack (object hitter -- damage) Object gets attacked by somebody - when overriden, should return the damage that has been dealt. =head3 attacks (weapon hitter victim) Invoked whenever an object is used as a B by B to attack B. =head3 inscribe_note (book pl message skill -- ) Used whenever a book gets inscribed with a message. =head3 trigger (object who -- ) Invoked whenever a lever-like B has been activated/triggered in some (manual) way. =head3 move_trigger (object victim originator -- ) Invoked whenever a trap-like B has been activated, usually by moving onto it. This includes not just traps, but also buttons, holes, signs and similar stuff. =head3 close (container -- ) Invoked whenever a container gets closed (this event is not yet reliable!). =head2 MAP EVENTS These events are generally dependent on a map and thus all have a map as first argument. =head3 instantiate (map) Original B has been loaded (e.g. on first use, or after a map reset). =head3 reattach (map) Invoked whenever attachments/plug-ins need to get reattached to the B. This usually happens when the map was loaded from disk, or when the server was reloaded. =head3 destroy (map) Invoked when the map object gets destroyed, and only when the map object has a handler for this event. This event can occur many times, as its called when the in-memory object is destroyed, not when the object itself dies. =head3 swapin (map) Invoked when a previously swapped-out temporary B has been loaded again. =head3 swapout (map) Invoked after a B has been swapped out to disk. =head3 reset (map) Invoked when a B gets reset. =head3 clean (map) Invoked when a temporary B gets deleted on-disk. =head3 enter (map player) Invoked whenever a player enters the B. This event is likely unreliable. =head3 leave (map player) Invoked whenever a player leaves the B. This event is likely unreliable. =head3 upgrade (map) (TEMPORARY EVENT) gets invoked whenever a old-style map has been upgraded.