Atrinik Server  4.0
Modules | Files | Data Structures | Macros | Typedefs | Functions | Variables
Arena plugin

Modules

 Arena map flags
 

Files

file  plugin_arena.c
 

Data Structures

struct  arena_map_players
 
struct  arena_maps_struct
 

Macros

#define GLOBAL_NO_PROTOTYPES
 
#define PLUGIN_NAME   "Arena"
 
#define PLUGIN_VERSION   "Arena plugin 1.0"
 
#define logger_print   hooks->logger_print
 

Typedefs

typedef struct arena_map_players arena_map_players
 
typedef struct arena_maps_struct arena_maps_struct
 

Functions

MODULEAPI void initPlugin (struct plugin_hooklist *hooklist)
 
MODULEAPI void closePlugin (void)
 
MODULEAPI void getPluginProperty (int *type,...)
 
MODULEAPI void postinitPlugin (void)
 
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_ob, arena_maps_struct *arena_map)
 
static int arena_full (arena_maps_struct *arena_map)
 
static int arena_enter (object *who, object *exit_ob, const char *arena_script)
 
static int arena_sign (object *who, const char *path)
 
static int arena_event (object *who, object *exit_ob, 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_hooklist * hooks
 

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.

Macro Definition Documentation

#define PLUGIN_NAME   "Arena"

Plugin name

Definition at line 95 of file plugin_arena.c.

#define PLUGIN_VERSION   "Arena plugin 1.0"

Plugin version

Definition at line 98 of file plugin_arena.c.

Typedef Documentation

Players currently in an arena map

Arena maps linked list

Function Documentation

static int arena_enter ( object who,
object exit_ob,
const char *  arena_script 
)
static

Enter an arena entrance.

Parameters
whoThe object entering this arena entrance.
exit_obThe entrance object.
arena_scriptConfiguration script for this arena.
Returns
0 to operate the entrance (teleport the player), 1 otherwise.

Definition at line 378 of file plugin_arena.c.

static int arena_event ( object who,
object exit_ob,
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 539 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_mapThe arena map structure.
Returns
1 if the arena is full, 0 otherwise.

Definition at line 344 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 558 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_mapThe arena map structure.
lineThe line to parse.

Definition at line 256 of file plugin_arena.c.

static void arena_map_parse_script ( const char *  arena_script,
object exit_ob,
arena_maps_struct arena_map 
)
static

Parse an .arena script for the arena map.

Parameters
arena_scriptThe script path
exit_obThe exit object used to trigger the event
arena_mapThe arena map structure

Definition at line 296 of file plugin_arena.c.

static int arena_sign ( object who,
const char *  path 
)
static

Apply or trigger an arena sign.

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

Definition at line 497 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
opThe player object to check for.
player_listPlayer list to check.
Returns
1 if the player is in the list, 0 otherwise.

Definition at line 210 of file plugin_arena.c.

MODULEAPI void closePlugin ( void  )

Called when the plugin is about to be unloaded.

Definition at line 167 of file plugin_arena.c.

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

Called to ask various information about the plugin.

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

Definition at line 171 of file plugin_arena.c.

MODULEAPI void initPlugin ( struct plugin_hooklist *  hooklist)

Called when the plugin initialization process starts.

Parameters
hooklistPlugin hooklist to register.

Definition at line 162 of file plugin_arena.c.

MODULEAPI void postinitPlugin ( void  )

Called by the server when the plugin loading is completed.

Definition at line 196 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
opThe player object to find and remove.
player_listThe player list from where to remove.

Definition at line 231 of file plugin_arena.c.

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

Called whenever an event occurs.

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

Definition at line 605 of file plugin_arena.c.

Variable Documentation

arena_maps_struct* arena_maps

The arena maps.

Definition at line 157 of file plugin_arena.c.

struct plugin_hooklist* hooks

Hooks.

Definition at line 160 of file plugin_arena.c.