Crossfire Server, Trunk
|
#include <stdarg.h>
#include "global.h"
#include "events.h"
#include <map>
#include <string>
#include "stats.h"
Go to the source code of this file.
Functions | |
static int | do_execute_event (object *op, int eventcode, object *activator, object *third, const char *message, int fix, talk_info *talk) |
static void | ensure_bitmask (object *op) |
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) |
Variables | |
int | events_total = 0 |
int | global_events_total = 0 |
static std::map< event_registration, f_plug_event > | global_handlers [NR_EVENTS] |
static event_registration | next_event_registration = 1 |
static std::map< std::string, f_plug_event > | object_handlers |
|
static |
Definition at line 216 of file events.cpp.
References diamondslots::activator, BITMASK_EVENT, ensure_bitmask(), env, EVENT_CONNECTOR, events_total, FLAG_UNIQUE, FOR_INV_FINISH, FOR_INV_PREPARE, FREE_OBJ_NO_DESTROY_CALLBACK, llevDebug, llevError, LOG(), diamondslots::message, object::name, object_free(), object_get_env_recursive(), object_handlers, object_remove(), object_was_destroyed, give::op, QUERY_FLAG, and Ice::tmp.
Referenced by events_execute_object_event(), and events_execute_object_say().
|
static |
Definition at line 201 of file events.cpp.
References BITMASK_EVENT, BITMASK_VALID, EVENT_CONNECTOR, commongive::inv, and give::op.
Referenced by do_execute_event().
void events_execute_global_event | ( | int | eventcode, |
... | |||
) |
Execute a global event.
eventcode | event code. |
... | additional parameters, depending on the event. |
Definition at line 32 of file events.cpp.
References make_face_from_files::args, buf, EVENT_BORN, EVENT_CLOCK, EVENT_CRASH, EVENT_GKILL, EVENT_KICK, EVENT_LOGIN, EVENT_LOGOUT, EVENT_MAPENTER, EVENT_MAPLEAVE, EVENT_MAPLOAD, EVENT_MAPREADY, EVENT_MAPRESET, EVENT_MAPUNLOAD, EVENT_MUZZLE, EVENT_PLAYER_DEATH, EVENT_REMOVE, EVENT_SHOUT, EVENT_TELL, global_events_total, global_handlers, disinfect::map, give::op, and altar_valkyrie::pl.
Referenced by apply_race_and_class(), apply_savebed(), check_login(), command_kick2(), command_tell_all(), command_toggle_shout(), do_tell(), flush_old_maps(), free_map(), key_change_class(), key_confirm_quit(), kill_object(), kill_player(), mapfile_load(), player_map_change_common(), ready_map_name(), server_main(), and swap_map().
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.
op | object to execute the event on. |
eventcode | event code to execute. |
activator | object which caused the event to be triggered. |
third | additional object. |
message | what the object said to trigger. |
fix | whether to fix op or not. |
Definition at line 299 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_callback(), stop_projectile(), trigger_connected(), write_note(), and write_scroll().
Execute an EVENT_SAY on the specified object.
npc | object to execute the event on. |
talk | dialog information, which may be altered to add replies or questions. |
Definition at line 303 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().
int events_execute_object_user | ( | object * | op, |
object * | activator, | ||
object * | third, | ||
const char * | message, | ||
int | fix | ||
) |
Execute an EVENT_USER on the specified object.
op | object to execute the event on. |
activator | object which caused the event to be triggered. |
third | additional object. |
message | what the object said to trigger. |
fix | whether to fix op or not. |
Definition at line 307 of file events.cpp.
References diamondslots::activator, EVENT_USER, events_execute_object_event(), diamondslots::message, and give::op.
Referenced by cfapi_object_user_event().
event_registration events_register_global_handler | ( | int | eventcode, |
f_plug_event | hook | ||
) |
Register a global event handler.
eventcode | event code to register the handler for. |
hook | function to call for the event. |
Definition at line 21 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().
void events_register_object_handler | ( | const char * | id, |
f_plug_event | handler | ||
) |
Register an object event handler.
id | handler identifier, must be unique and match the "title" field of the event connector. |
handler | function to call for the event. |
Definition at line 289 of file events.cpp.
References diamondslots::id, llevDebug, LOG(), and object_handlers.
Referenced by citylife_init(), and plugins_init_plugin().
void events_unregister_global_handler | ( | int | eventcode, |
event_registration | id | ||
) |
Remove a global event handler.
eventcode | event code to unregister the handler of. |
id | registration identifier as returned by events_register_global_handler(). |
Definition at line 28 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().
void events_unregister_object_handler | ( | const char * | id | ) |
Remove an object event handler.
id | handler identifier. |
Definition at line 294 of file events.cpp.
References llevDebug, LOG(), and object_handlers.
Referenced by citylife_close(), and plugins_remove_plugin().
int events_total = 0 |
Definition at line 10 of file events.cpp.
Referenced by do_execute_event().
int global_events_total = 0 |
Definition at line 9 of file events.cpp.
Referenced by events_execute_global_event().
|
static |
To turn on verbose messages about events in the debug log, set the CF_DEBUG_EVENTS environment variable.
Definition at line 17 of file events.cpp.
Referenced by events_execute_global_event(), events_register_global_handler(), and events_unregister_global_handler().
|
static |
Definition at line 18 of file events.cpp.
Referenced by events_register_global_handler().
|
static |
Definition at line 19 of file events.cpp.
Referenced by do_execute_event(), events_register_object_handler(), and events_unregister_object_handler().