Crossfire Server, Trunk
events.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EVENT_APPLY   1
 
#define EVENT_ATTACKED   2
 
#define EVENT_ATTACKS   33
 
#define EVENT_BORN   14
 
#define EVENT_BOUGHT   34
 
#define EVENT_CLOCK   15
 
#define EVENT_CLOSE   11
 
#define EVENT_CRASH   16
 
#define EVENT_DEATH   3
 
#define EVENT_DESTROY   13
 
#define EVENT_DROP   4
 
#define EVENT_GKILL   18
 
#define EVENT_KICK   28
 
#define EVENT_LOGIN   19
 
#define EVENT_LOGOUT   20
 
#define EVENT_MAPENTER   21
 
#define EVENT_MAPLEAVE   22
 
#define EVENT_MAPLOAD   30
 
#define EVENT_MAPRESET   23
 
#define EVENT_MAPUNLOAD   29
 
#define EVENT_MUZZLE   27
 
#define EVENT_NONE   0
 
#define EVENT_PICKUP   5
 
#define EVENT_PLAYER_DEATH   17
 
#define EVENT_REMOVE   24
 
#define EVENT_SAY   6
 
#define EVENT_SELLING   32
 
#define EVENT_SHOUT   25
 
#define EVENT_STOP   7
 
#define EVENT_TELL   26
 
#define EVENT_THROW   9
 
#define EVENT_TIME   8
 
#define EVENT_TIMER   12
 
#define EVENT_TRIGGER   10
 
#define EVENT_USER   31
 
#define NR_EVENTS   35
 

Typedefs

typedef unsigned long event_registration
 
typedef int(* f_plug_event) (int *type,...)
 

Functions

void events_execute_global_event (int eventcode,...)
 
int events_execute_object_event (object *op, int eventcode, object *activator, object *third, const char *message, int fix)
 
int events_execute_object_say (object *npc, talk_info *talk)
 
int events_execute_object_user (object *op, object *activator, object *third, const char *message, int fix)
 
event_registration events_register_global_handler (int eventcode, f_plug_event hook)
 
void events_register_object_handler (const char *id, f_plug_event handler)
 
void events_unregister_global_handler (int eventcode, event_registration id)
 
void events_unregister_object_handler (const char *id)
 

Macro Definition Documentation

◆ EVENT_APPLY

#define EVENT_APPLY   1

Object applied-unapplied.

Definition at line 19 of file events.h.

◆ EVENT_ATTACKED

#define EVENT_ATTACKED   2

Object attacked, with weapon or spell.

Definition at line 20 of file events.h.

◆ EVENT_ATTACKS

#define EVENT_ATTACKS   33

Weapon or arrow hitting something.

Definition at line 21 of file events.h.

◆ EVENT_BORN

#define EVENT_BORN   14

A new character has been created.

Definition at line 38 of file events.h.

◆ EVENT_BOUGHT

#define EVENT_BOUGHT   34

Object is being bought by player.

Definition at line 22 of file events.h.

◆ EVENT_CLOCK

#define EVENT_CLOCK   15

Global time event.

Definition at line 39 of file events.h.

◆ EVENT_CLOSE

#define EVENT_CLOSE   11

Container closed.

Definition at line 23 of file events.h.

◆ EVENT_CRASH

#define EVENT_CRASH   16

Triggered when the server crashes. Not recursive

Definition at line 40 of file events.h.

◆ EVENT_DEATH

#define EVENT_DEATH   3

Player or monster dead.

Definition at line 24 of file events.h.

◆ EVENT_DESTROY

#define EVENT_DESTROY   13

Object destroyed (includes map reset/swapout)

Definition at line 25 of file events.h.

◆ EVENT_DROP

#define EVENT_DROP   4

Object dropped on the floor.

Definition at line 26 of file events.h.

◆ EVENT_GKILL

#define EVENT_GKILL   18

Triggered when anything got killed by anyone.

Definition at line 41 of file events.h.

◆ EVENT_KICK

#define EVENT_KICK   28

A player was Kicked by a DM

Definition at line 42 of file events.h.

◆ EVENT_LOGIN

#define EVENT_LOGIN   19

Player login.

Definition at line 43 of file events.h.

◆ EVENT_LOGOUT

#define EVENT_LOGOUT   20

Player logout.

Definition at line 44 of file events.h.

◆ EVENT_MAPENTER

#define EVENT_MAPENTER   21

A player entered a map.

Definition at line 45 of file events.h.

◆ EVENT_MAPLEAVE

#define EVENT_MAPLEAVE   22

A player left a map.

Definition at line 46 of file events.h.

◆ EVENT_MAPLOAD

#define EVENT_MAPLOAD   30

A map is loaded

Definition at line 47 of file events.h.

◆ EVENT_MAPRESET

#define EVENT_MAPRESET   23

A map is resetting.

Definition at line 48 of file events.h.

◆ EVENT_MAPUNLOAD

#define EVENT_MAPUNLOAD   29

A map is freed (includes swapping out)

Definition at line 49 of file events.h.

◆ EVENT_MUZZLE

#define EVENT_MUZZLE   27

A player was Muzzled (no_shout set).

Definition at line 50 of file events.h.

◆ EVENT_NONE

#define EVENT_NONE   0

No event. This exists only to reserve the "0".

Definition at line 18 of file events.h.

◆ EVENT_PICKUP

#define EVENT_PICKUP   5

Object picked up.

Definition at line 27 of file events.h.

◆ EVENT_PLAYER_DEATH

#define EVENT_PLAYER_DEATH   17

Global Death event

Definition at line 51 of file events.h.

◆ EVENT_REMOVE

#define EVENT_REMOVE   24

A Player character has been removed.

Definition at line 52 of file events.h.

◆ EVENT_SAY

#define EVENT_SAY   6

Someone speaks.

Definition at line 28 of file events.h.

◆ EVENT_SELLING

#define EVENT_SELLING   32

Object is being sold by another one.

Definition at line 29 of file events.h.

◆ EVENT_SHOUT

#define EVENT_SHOUT   25

A player 'shout' something.

Definition at line 53 of file events.h.

◆ EVENT_STOP

#define EVENT_STOP   7

Thrown object stopped.

Definition at line 30 of file events.h.

◆ EVENT_TELL

#define EVENT_TELL   26

A player 'tell' something.

Definition at line 54 of file events.h.

◆ EVENT_THROW

#define EVENT_THROW   9

Object is thrown.

Definition at line 32 of file events.h.

◆ EVENT_TIME

#define EVENT_TIME   8

Triggered each time the object can react/move.

Definition at line 31 of file events.h.

◆ EVENT_TIMER

#define EVENT_TIMER   12

Timer connected triggered it.

Definition at line 34 of file events.h.

◆ EVENT_TRIGGER

#define EVENT_TRIGGER   10

Button pushed, lever pulled, etc.

Definition at line 33 of file events.h.

◆ EVENT_USER

#define EVENT_USER   31

User-defined event.

Definition at line 35 of file events.h.

◆ NR_EVENTS

#define NR_EVENTS   35

Number of events, maximum code + 1.

Definition at line 57 of file events.h.

Typedef Documentation

◆ event_registration

typedef unsigned long event_registration

Registration identifier type.

Definition at line 62 of file events.h.

◆ f_plug_event

typedef int(* f_plug_event) (int *type,...)

Function to call to handle global or object-related events.

Definition at line 60 of file events.h.

Function Documentation

◆ events_execute_global_event()

◆ events_execute_object_event()

int events_execute_object_event ( object op,
int  eventcode,
object activator,
object third,
const char *  message,
int  fix 
)

Execute an event on the specified object.

Parameters
opobject to execute the event on.
eventcodeevent code to execute.
activatorobject which caused the event to be triggered.
thirdadditional object.
messagewhat the object said to trigger.
fixwhether to fix op or not.
Returns
value to return to the caller.

Definition at line 259 of file events.cpp.

References diamondslots::activator, do_execute_event(), diamondslots::message, and give::op.

Referenced by apply_container(), attack_ob_simple(), cftimer_process_event(), common_pre_ob_move_on(), do_throw(), drop_object(), events_execute_object_user(), hit_player(), hit_with_arrow(), kill_object(), kill_player(), move_teleporter(), ob_apply(), object_free(), pick_lock(), pick_up_object(), player_changer_type_process(), pray_at_altar(), process_object(), sell_item(), shop_pay_unpaid(), stop_projectile(), trigger_connected(), write_note(), and write_scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ events_execute_object_say()

int events_execute_object_say ( object npc,
talk_info talk 
)

Execute an EVENT_SAY on the specified object.

Parameters
npcobject to execute the event on.
talkdialog information, which may be altered to add replies or questions.
Returns
value to return to the caller.

Definition at line 263 of file events.cpp.

References do_execute_event(), EVENT_SAY, npc_dialog::npc, SCRIPT_FIX_ALL, talk_info::text, and talk_info::who.

Referenced by monster_talk_to_npc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ events_execute_object_user()

int events_execute_object_user ( object op,
object activator,
object third,
const char *  message,
int  fix 
)

Execute an EVENT_USER on the specified object.

Parameters
opobject to execute the event on.
activatorobject which caused the event to be triggered.
thirdadditional object.
messagewhat the object said to trigger.
fixwhether to fix op or not.
Returns
value to return to the caller.

Definition at line 267 of file events.cpp.

References diamondslots::activator, EVENT_USER, events_execute_object_event(), diamondslots::message, and give::op.

Referenced by cfapi_object_user_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ events_register_global_handler()

event_registration events_register_global_handler ( int  eventcode,
f_plug_event  hook 
)

Register a global event handler.

Parameters
eventcodeevent code to register the handler for.
hookfunction to call for the event.
Returns
registration identifier, used with events_unregister_global_handler().

Definition at line 16 of file events.cpp.

References eg, global_handlers, and next_event_registration.

Referenced by cfapi_system_register_global_event(), cfcitybell_init(), citylife_init(), and random_house_generator_init().

+ Here is the caller graph for this function:

◆ events_register_object_handler()

void events_register_object_handler ( const char *  id,
f_plug_event  handler 
)

Register an object event handler.

Parameters
idhandler identifier, must be unique and match the "title" field of the event connector.
handlerfunction to call for the event.

Definition at line 249 of file events.cpp.

References diamondslots::id, llevDebug, LOG(), and object_handlers.

Referenced by citylife_init(), and plugins_init_plugin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ events_unregister_global_handler()

void events_unregister_global_handler ( int  eventcode,
event_registration  id 
)

Remove a global event handler.

Parameters
eventcodeevent code to unregister the handler of.
idregistration identifier as returned by events_register_global_handler().

Definition at line 23 of file events.cpp.

References global_handlers.

Referenced by cfapi_system_unregister_global_event(), cfcitybell_close(), citylife_close(), plugins_remove_plugin(), and random_house_generator_close().

+ Here is the caller graph for this function:

◆ events_unregister_object_handler()

void events_unregister_object_handler ( const char *  id)

Remove an object event handler.

Parameters
idhandler identifier.

Definition at line 254 of file events.cpp.

References llevDebug, LOG(), and object_handlers.

Referenced by citylife_close(), and plugins_remove_plugin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: