 |
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 *);
202 (*(*gh).second)(&rt, eventcode, op, op2);
215 object *inv = op->
inv;
227 bool debug_events = (getenv(
"CF_DEBUG_EVENTS") != NULL);
237 LOG(
llevDebug,
"********** EVENT HANDLER **********\n");
239 if (activator != NULL)
244 if (tmp->title != NULL)
246 if (tmp->slaying != NULL)
248 if (tmp->name != NULL)
252 if (tmp->title == NULL) {
254 LOG(
llevError,
"Event object without title at %d/%d in map %s\n",
env->x,
env->y,
env->map ?
env->map->name :
"(null map)");
257 }
else if (tmp->slaying == NULL) {
259 LOG(
llevError,
"Event object without slaying at %d/%d in map %s\n",
env->x,
env->y,
env->map ?
env->map->name :
"(null map)");
266 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)");
274 rv = (*(*handler).second)(&rvt, op, activator, third,
message, fix, tmp, talk);
280 LOG(
llevDebug,
"Removing unique event %s\n", tmp->slaying);
300 LOG(
llevDebug,
"events: registered object handler %s\n",
id);
305 LOG(
llevDebug,
"events: unregistered object handler %s\n",
id);
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
#define EVENT_GSOLD
Player sold object in shop, but global.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
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 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 EVENT_GBOUGHT
Player bought object in shop, but global.
#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)
#define EVENT_MAPLOAD
A map is loaded (pristine state)
tag_t count
Unique object number for this object.
#define EVENT_LOGOUT
Player logout.
#define EVENT_SAY
Someone speaks.
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.
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_LOGIN
Player login.
uint8_t subtype
Subtype of object.
#define EVENT_CLOCK
Global time event.
#define EVENT_CRASH
Triggered when the server crashes.
static event_registration next_event_registration
void events_unregister_global_handler(int eventcode, event_registration id)
Remove a global event handler.
#define EVENT_MAPENTER
A player entered a map.
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_MAPRESET
A map is resetting.
#define EVENT_BORN
A new character has been created.
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_MAPUNLOAD
A map is freed (includes swapping out)
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().
static void ensure_bitmask(object *op)
uint32_t tag_t
Object tag, unique during the whole game.
#define EVENT_USER
User-defined event.
#define EVENT_SHOUT
A player 'shout' something.
static std::shared_ptr< inja::Environment > env
Rendering environment.
static event_registration eg
const char * text
What the player actually said.
#define EVENT_PLAYER_DEATH
Global Death event
#define BITMASK_VALID
Bit indicating if the event bitmask is valid or not.
#define EVENT_MUZZLE
A player was Muzzled (no_shout set).
#define EVENT_TELL
A player 'tell' something.
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_MAPLEAVE
A player left a map.
Structure used to build up dialog information when a player says something.
#define EVENT_REMOVE
A Player character has been removed.
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_MAPREADY
A map is ready, either first load or after reload.
static int do_execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix, talk_info *talk)
int events_execute_object_say(object *npc, talk_info *talk)
Execute an EVENT_SAY on the specified object.
#define EVENT_GKILL
Triggered when anything got killed by anyone.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
#define EVENT_KICK
A player was Kicked by a DM
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