 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
39 va_start(args, eventcode);
44 op = va_arg(args,
object *);
46 (*(*gh).second)(&rt, eventcode, op);
53 (*(*gh).second)(&rt, eventcode);
59 (*(*gh).second)(&rt, eventcode);
65 op = va_arg(args,
object *);
66 op2 = va_arg(args,
object *);
68 (*(*gh).second)(&rt, eventcode, op, op2);
74 op = va_arg(args,
object *);
75 op2 = va_arg(args,
object *);
77 (*(*gh).second)(&rt, eventcode, op, op2);
83 pl = va_arg(args,
player *);
84 buf = va_arg(args,
char *);
86 (*(*gh).second)(&rt, eventcode, pl,
buf);
92 pl = va_arg(args,
player *);
93 buf = va_arg(args,
char *);
95 (*(*gh).second)(&rt, eventcode, pl,
buf);
101 op = va_arg(args,
object *);
104 (*(*gh).second)(&rt, eventcode, op, map);
110 op = va_arg(args,
object *);
113 (*(*gh).second)(&rt, eventcode, op, map);
121 (*(*gh).second)(&rt, eventcode, map);
127 op = va_arg(args,
object *);
129 (*(*gh).second)(&rt, eventcode, op);
135 op = va_arg(args,
object *);
136 buf = va_arg(args,
char *);
137 i = va_arg(args,
int);
139 (*(*gh).second)(&rt, eventcode, op,
buf, i);
145 op = va_arg(args,
object *);
146 buf = va_arg(args,
const char *);
147 op2 = va_arg(args,
object *);
149 (*(*gh).second)(&rt, eventcode, op,
buf, op2);
155 op = va_arg(args,
object *);
156 buf = va_arg(args,
char *);
158 (*(*gh).second)(&rt, eventcode, op,
buf);
164 op = va_arg(args,
object *);
165 buf = va_arg(args,
char *);
167 (*(*gh).second)(&rt, eventcode, op,
buf);
175 (*(*gh).second)(&rt, eventcode, map);
183 (*(*gh).second)(&rt, eventcode, map);
191 (*(*gh).second)(&rt, eventcode, map);
199 op = va_arg(args,
object *);
200 op2 = va_arg(args,
object *);
201 uint64_t price = va_arg(args, uint64_t);
203 (*(*gh).second)(&rt, eventcode, op, op2, price);
216 object *inv = op->
inv;
228 bool debug_events = (getenv(
"CF_DEBUG_EVENTS") != NULL);
238 LOG(
llevDebug,
"********** EVENT HANDLER **********\n");
240 if (activator != NULL)
245 if (tmp->title != NULL)
247 if (tmp->slaying != NULL)
249 if (tmp->name != NULL)
253 if (tmp->title == NULL) {
255 LOG(
llevError,
"Event object without title at %d/%d in map %s\n",
env->x,
env->y,
env->map ?
env->map->name :
"(null map)");
258 }
else if (tmp->slaying == NULL) {
260 LOG(
llevError,
"Event object without slaying at %d/%d in map %s\n",
env->x,
env->y,
env->map ?
env->map->name :
"(null map)");
267 LOG(
llevError,
"The requested handler doesn't exist: %s at %d/%d in map %s\n", tmp->title,
env->x,
env->y,
env->map ?
env->map->name :
"(null map)");
275 rv = (*(*handler).second)(&rvt, op, activator, third,
message, fix, tmp, talk);
281 LOG(
llevDebug,
"Removing unique event %s\n", tmp->slaying);
301 LOG(
llevDebug,
"events: registered object handler %s\n",
id);
306 LOG(
llevDebug,
"events: unregistered object handler %s\n",
id);
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
#define EVENT_REMOVE
A Player character has been removed.
#define EVENT_GBOUGHT
Player bought object in shop, but global.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
#define EVENT_LOGOUT
Player logout.
object * object_get_env_recursive(object *op)
Utility function.
@ llevError
Error, serious thing.
@ EVENT_CONNECTOR
Lauwenmark: an invisible object holding a plugin event hook.
#define EVENT_MAPUNLOAD
A map is freed (includes swapping out)
#define NR_EVENTS
Number of events, maximum code + 1.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
object * inv
Pointer to the first object in the inventory.
#define QUERY_FLAG(xyz, p)
#define BITMASK_EVENT(evt)
Convert an event to its bit.
void events_unregister_object_handler(const char *id)
Remove an object event handler.
#define FLAG_UNIQUE
Item is really unique (UNIQUE_ITEMS)
tag_t count
Unique object number for this object.
#define EVENT_LOGIN
Player login.
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.
#define EVENT_KICK
A player was Kicked by a DM
event_registration events_register_global_handler(int eventcode, f_plug_event hook)
Register a global event handler.
void events_register_object_handler(const char *id, f_plug_event handler)
Register an object event handler.
#define EVENT_CRASH
Triggered when the server crashes.
uint8_t subtype
Subtype of object.
static event_registration next_event_registration
void events_unregister_global_handler(int eventcode, event_registration id)
Remove a global event handler.
#define EVENT_GKILL
Triggered when anything got killed by anyone.
object * below
Pointer to the object stacked below this one.
uint64_t event_bitmask
Bitmask of events this object has a handler for, see events.h.
#define EVENT_USER
User-defined event.
int events_execute_object_user(object *op, object *activator, object *third, const char *message, int fix)
Execute an EVENT_USER on the specified object.
uint8_t type
PLAYER, BULLET, etc.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your message
#define EVENT_CLOCK
Global time event.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define EVENT_MAPRESET
A map is resetting.
static void ensure_bitmask(object *op)
uint32_t tag_t
Object tag, unique during the whole game.
#define EVENT_PLAYER_DEATH
Global Death event
#define EVENT_BORN
A new character has been created.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define EVENT_MAPREADY
A map is ready, either first load or after reload.
#define EVENT_MAPLEAVE
A player left a map.
static event_registration eg
const char * text
What the player actually said.
#define EVENT_GSOLD
Player sold object in shop, but global.
#define EVENT_SAY
Someone speaks.
#define EVENT_TELL
A player 'tell' something.
#define BITMASK_VALID
Bit indicating if the event bitmask is valid or not.
sstring name
The name of the object, obviously...
unsigned long event_registration
Registration identifier type.
static std::map< event_registration, f_plug_event > global_handlers[NR_EVENTS]
To turn on verbose messages about events in the debug log, set the CF_DEBUG_EVENTS environment variab...
int(* f_plug_event)(int *type,...)
Function to call to handle global or object-related events.
#define EVENT_MAPENTER
A player entered a map.
Structure used to build up dialog information when a player says something.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
#define EVENT_MAPLOAD
A map is loaded (pristine state)
#define EVENT_MUZZLE
A player was Muzzled (no_shout set).
static int do_execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix, talk_info *talk)
#define EVENT_SHOUT
A player 'shout' something.
int events_execute_object_say(object *npc, talk_info *talk)
Execute an EVENT_SAY on the specified object.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void events_execute_global_event(int eventcode,...)
Execute a global event.
@ llevDebug
Only for debugging purposes.
struct object * who
Player saying something.
static std::map< std::string, f_plug_event > object_handlers