Atrinik Server 2.5
Functions | Variables
server/plugins.c File Reference
#include <global.h>
#include <loader.h>

Go to the source code of this file.

Functions

static void register_global_event (const char *plugin_name, int event_nr)
static void unregister_global_event (const char *plugin_name, int event_nr)
static atrinik_pluginfind_plugin (const char *id)
objectget_event_object (object *op, int event_nr)
CommArray_sfind_plugin_command (const char *cmd)
void display_plugins_list (object *op)
void init_plugins ()
void init_plugin (const char *pluginfile)
void remove_plugin (const char *id)
void remove_plugins ()
void map_event_obj_init (object *ob)
void map_event_free (map_event *tmp)
void map_event_obj_deinit (object *ob)
int trigger_map_event (int event_id, mapstruct *m, object *activator, object *other, object *other2, const char *text, int parm)
void trigger_global_event (int event_type, void *parm1, void *parm2)
int trigger_event (int event_type, object *const activator, object *const me, object *const other, const char *msg, int parm1, int parm2, int parm3, int flags)

Variables

struct plugin_hooklist hooklist
static atrinik_pluginplugins_list = NULL

Detailed Description

Handles the plugins code.

Definition in file plugins.c.


Function Documentation

void display_plugins_list ( object op)

Display a list of loaded and loadable plugins in player's window.

Parameters:
opThe player to print the plugins to.

Definition at line 300 of file plugins.c.

static atrinik_plugin* find_plugin ( const char *  id) [static]

Find a plugin by its identification string.

Parameters:
idPlugin's identification string.
Returns:
Pointer to the found plugin, NULL if not found.

Definition at line 195 of file plugins.c.

CommArray_s* find_plugin_command ( const char *  cmd)

Tries to find if a given command is handled by a plugin.

Parameters:
cmdThe command name to find.
Returns:
Command array structure if found, NULL otherwise.

Definition at line 275 of file plugins.c.

object* get_event_object ( object op,
int  event_nr 
)

Browse through the inventory of an object to find first event that matches the event type of event_nr.

Parameters:
opThe object to search in.
event_nrThe event number.
Returns:
Script object matching the event type.

Definition at line 256 of file plugins.c.

void init_plugin ( const char *  pluginfile)

Initializes a plugin known by its filename.

Parameters:
pluginfileThe plugin filename.

Definition at line 398 of file plugins.c.

void init_plugins ( )

Initializes plugins. Browses the plugins directory and calls init_plugin() for each plugin file found with the extension being PLUGIN_SUFFIX.

Definition at line 342 of file plugins.c.

void map_event_free ( map_event tmp)

Free a map_event.

Parameters:
tmpWhat to free.

Definition at line 575 of file plugins.c.

void map_event_obj_deinit ( object ob)

Deinitialize map event object.

Parameters:
obWhat to deinitialize.

Definition at line 583 of file plugins.c.

void map_event_obj_init ( object ob)

Initialize map event object.

Parameters:
obWhat to initialize.

Definition at line 554 of file plugins.c.

static void register_global_event ( const char *  plugin_name,
int  event_nr 
) [static]

Register a global event.

Parameters:
plugin_namePlugin's name.
event_nrEvent ID to register.

Definition at line 219 of file plugins.c.

void remove_plugin ( const char *  id)

Removes one plugin from memory. The plugin is identified by its keyname.

Parameters:
idThe plugin keyname.

Definition at line 495 of file plugins.c.

void remove_plugins ( )

Deinitialize all plugins.

Definition at line 527 of file plugins.c.

int trigger_event ( int  event_type,
object *const  activator,
object *const  me,
object *const  other,
const char *  msg,
int  parm1,
int  parm2,
int  parm3,
int  flags 
)

Handles triggering normal events like EVENT_ATTACK, EVENT_STOP, etc.

Parameters:
event_typeThe event type.
activatorActivator object.
meObject the event object is in.
otherOther object.
msgMessage.
parm1First parameter.
parm2Second parameter.
parm3Third parameter.
flagsEvent flags.
Returns:
1 if the event returns an event value, 0 otherwise.

Definition at line 690 of file plugins.c.

void trigger_global_event ( int  event_type,
void *  parm1,
void *  parm2 
)

Handles triggering global events like EVENT_BORN, EVENT_MAPRESET, etc.

Parameters:
event_typeThe event type.
parm1First parameter.
parm2Second parameter.

Definition at line 659 of file plugins.c.

int trigger_map_event ( int  event_id,
mapstruct m,
object activator,
object other,
object other2,
const char *  text,
int  parm 
)

Triggers a map-wide event.

Parameters:
event_idEvent ID to trigger.
mMap we're working on.
activatorActivator.
otherSome other object related to this event.
other2Another object related to this event.
textString related to this event.
parmInteger related to this event.
Returns:
1 if the event returns an event value, 0 otherwise.

Definition at line 621 of file plugins.c.

static void unregister_global_event ( const char *  plugin_name,
int  event_nr 
) [static]

Unregister a global event.

Parameters:
plugin_namePlugin's name.
event_nrEvent ID to unregister.

Definition at line 237 of file plugins.c.


Variable Documentation

The actual hooklist.

Definition at line 37 of file plugins.c.

atrinik_plugin* plugins_list = NULL [static]

The list of loaded plugins.

Definition at line 189 of file plugins.c.