Arena plugin

Data Structures

struct  arena_map_players
struct  arena_maps_struct

Modules

 Arena map flags

Files

file  plugin_arena.c

Defines

#define MODULEAPI
#define PLUGIN_NAME   "Arena"
#define PLUGIN_VERSION   "Arena plugin 1.0"
#define LOG   hooks->LOG

Functions

MODULEAPI void initPlugin (struct plugin_hooklist *hooklist)
MODULEAPI void * getPluginProperty (int *type,...)
MODULEAPI void postinitPlugin ()
static int check_arena_player (object *op, arena_map_players *player_list)
static void remove_arena_player (object *op, arena_map_players **player_list)
static void arena_map_parse_line (arena_maps_struct *arena_map, const char *line)
static void arena_map_parse_script (const char *arena_script, object *exit, arena_maps_struct *arena_map)
static int arena_full (arena_maps_struct *arena_map)
int arena_enter (object *who, object *exit, const char *arena_script)
int arena_sign (object *who, const char *path)
static int arena_event (object *who, object *exit, const char *event_options, const char *arena_script)
static int arena_leave (object *who)
MODULEAPI void * triggerEvent (int *type,...)

Variables

arena_maps_structarena_maps
struct plugin_hooklisthooks

Detailed Description

This plugin is used to control arena map exits, teleporters, triggers, etc.

It stores a linked list of arena maps and number of players inside. If player attempts to enter the arena and the limit is reached, the entrance will not work for that player. For validation purposes, it also stores a linked list of player objects on the arena map. When decreasing the amount of players on the arena map, this list is checked to see if the player is really on that arena map. If not, no decreasing of the count is made.

The plugin also supports party arenas, which is similar to limiting maximum number of players allowed, but will limit the number of different parties to enter.

The plugin has an own configuration script files to determine maximum number of players, parties, etc. Those files generally have ".arena" extension, but any other will work as well. In the future this might be limited to ".arena" files, however. The supported syntax can be used:

To determine when to decrease number of players or parties in the arena, it uses MAPLEAVE, LOGOUT and GDEATH global events.

The arena map MUST have a map event object with plugin name "Arena" and event set to "player leaves".

It is also possible to make arena signs. These signs can be places ANYWHERE and still work. They are simply created by placing any object (preferably a sign) on a map, and attaching APPLY or TRIGGER event to it. The event must have plugin name "Arena" and a script name "Arena" or anything else, the script name doesn't matter.

Give the sign event's options like this:

sign|/arena/arena

The above will show players currently in the /arena/arena arena map. The "sign|" part is necessary for the sign to work.


Define Documentation

#define PLUGIN_NAME   "Arena"

Plugin name

Definition at line 103 of file plugin_arena.c.

#define PLUGIN_VERSION   "Arena plugin 1.0"

Plugin version

Definition at line 106 of file plugin_arena.c.


Function Documentation

int arena_enter ( object who,
object exit,
const char *  arena_script 
)

Enter an arena entrance.

Parameters:
who The object entering this arena entrance.
exit The entrance object.
arena_script Configuration script for this arena.
Returns:
0 to operate the entrance (teleport the player), 1 otherwise.

Definition at line 403 of file plugin_arena.c.

static int arena_event ( object who,
object exit,
const char *  event_options,
const char *  arena_script 
) [static]

Handles APPLY and TRIGGER events for the Arena.

Returns:
1 to stop normal execution of the object, 0 to continue.

Definition at line 573 of file plugin_arena.c.

static int arena_full ( arena_maps_struct arena_map  )  [static]

Check if an arena map is full or not.

Does checking for party arena, party player arenas, etc.

Parameters:
arena_map The arena map structure.
Returns:
1 if the arena is full, 0 otherwise.

Definition at line 371 of file plugin_arena.c.

static int arena_leave ( object who  )  [static]

Leave arena map. Decreases number of players for the arena map, but first validates that the player is in the list of that arena map's players.

Returns:
Always returns 0.

Definition at line 593 of file plugin_arena.c.

static void arena_map_parse_line ( arena_maps_struct arena_map,
const char *  line 
) [static]

Parse a single line inside an .arena config script.

Parameters:
arena_map The arena map structure.
line The line to parse.

Definition at line 271 of file plugin_arena.c.

static void arena_map_parse_script ( const char *  arena_script,
object exit,
arena_maps_struct arena_map 
) [static]

Parse an .arena script for the arena map.

Parameters:
arena_script The script path
exit The exit object used to trigger the event
arena_map The arena map structure

Definition at line 320 of file plugin_arena.c.

int arena_sign ( object who,
const char *  path 
)

Apply or trigger an arena sign.

Parameters:
who The object applying this sign.
path The map path of the arena.
Returns:
Always returns 1, to never output sign message.

Definition at line 527 of file plugin_arena.c.

static int check_arena_player ( object op,
arena_map_players player_list 
) [static]

Check a player list to see if player is in it.

Parameters:
op The player object to check for.
player_list Player list to check.
Returns:
1 if the player is in the list, 0 otherwise.

Definition at line 224 of file plugin_arena.c.

MODULEAPI void* getPluginProperty ( int *  type,
  ... 
)

Called to ask various informations about the plugin.

Parameters:
type Integer pointer for va_start().
Returns:
Return value depends on the type of information requested. Can be NULL.

Definition at line 181 of file plugin_arena.c.

MODULEAPI void initPlugin ( struct plugin_hooklist hooklist  ) 

Called when the plugin initialization process starts.

Parameters:
hooklist Plugin hooklist to register.

Definition at line 173 of file plugin_arena.c.

MODULEAPI void postinitPlugin (  ) 

Called by the server when the plugin loading is completed.

Definition at line 212 of file plugin_arena.c.

static void remove_arena_player ( object op,
arena_map_players **  player_list 
) [static]

Remove player from arena map's list of players.

Parameters:
op The player object to find and remove.
player_list The player list from where to remove.

Definition at line 244 of file plugin_arena.c.

MODULEAPI void* triggerEvent ( int *  type,
  ... 
)

Called whenever an event occurs.

Parameters:
type Integer pointer for va_start().
Returns:
Integer containing the event's return value.

Definition at line 645 of file plugin_arena.c.


Variable Documentation

The arena maps.

Definition at line 165 of file plugin_arena.c.

Hooks.

Definition at line 168 of file plugin_arena.c.


Generated by  doxygen 1.6.2