Atrinik Server  4.0
Functions | Variables
party.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <player.h>
#include <object.h>

Go to the source code of this file.

Functions

void party_init (void)
 
void party_deinit (void)
 
void add_party_member (party_struct *party, object *op)
 
void remove_party_member (party_struct *party, object *op)
 
static party_structmake_party (const char *name)
 
void form_party (object *op, const char *name)
 
party_structfind_party (const char *name)
 
int party_can_open_corpse (object *pl, object *corpse)
 
static void party_loot_random (object *pl, object *corpse)
 
static void party_loot_split (object *pl, object *corpse)
 
void party_handle_corpse (object *pl, object *corpse)
 
void send_party_message (party_struct *party, const char *msg, int flag, object *op, object *except)
 
void remove_party (party_struct *party)
 
void party_update_who (player *pl)
 

Variables

const char *const party_loot_modes [PARTY_LOOT_MAX]
 
const char *const party_loot_modes_help [PARTY_LOOT_MAX]
 
party_structfirst_party = NULL
 
static mempool_struct * pool_party
 

Detailed Description

This file handles party related code.

Definition in file party.c.

Function Documentation

void add_party_member ( party_struct party,
object op 
)

Add a player to party's member list.

Parameters
partyParty to add the player to.
opThe player to add.

Definition at line 84 of file party.c.

party_struct* find_party ( const char *  name)

Find a party by name.

Parameters
nameParty name to find.
Returns
Party if found, NULL otherwise.

Definition at line 208 of file party.c.

void form_party ( object op,
const char *  name 
)

Form a new party.

Parameters
opObject forming the party.
nameName of the party.

Definition at line 191 of file party.c.

static party_struct* make_party ( const char *  name)
static

Initialize a new party structure.

Parameters
nameName of the new party.
Returns
The initialized party structure.

Definition at line 172 of file party.c.

int party_can_open_corpse ( object pl,
object corpse 
)

Check if player can open a party corpse.

Parameters
plPlayer trying to open the corpse.
corpseThe corpse.
Returns
1 if we can open the corpse, 0 otherwise.

Definition at line 230 of file party.c.

void party_deinit ( void  )

Deinitialize the party API.

Definition at line 73 of file party.c.

void party_handle_corpse ( object pl,
object corpse 
)

Do any special handling after a party corpse has been opened.

Parameters
plPlayer who opened the corpse.
corpseThe corpse.

Definition at line 424 of file party.c.

void party_init ( void  )

Initialize the party API.

Definition at line 64 of file party.c.

static void party_loot_random ( object pl,
object corpse 
)
static

Randomly split corpse's loot between party's members.

Parameters
plPlayer that opened the corpse.
corpseThe corpse.

Definition at line 263 of file party.c.

static void party_loot_split ( object pl,
object corpse 
)
static

Evenly split corpse's loot between party's members.

Parameters
plPlayer that opened the corpse.
corpseThe corpse.

Definition at line 318 of file party.c.

void party_update_who ( player pl)

Update player's hp/sp/etc in the party widget of all party members.

Parameters
plPlayer.

Definition at line 530 of file party.c.

void remove_party ( party_struct party)

Remove a party.

Parameters
partyThe party to remove.

Definition at line 498 of file party.c.

void remove_party_member ( party_struct party,
object op 
)

Remove player from party's member list.

Parameters
partyParty to remove the player from.
opThe player to remove.

Definition at line 114 of file party.c.

void send_party_message ( party_struct party,
const char *  msg,
int  flag,
object op,
object except 
)

Send a message to party.

Parameters
partyParty to send the message to.
msgMessage to send.
flagOne of party message flags.
opPlayer sending the message.
exceptIf not NULL, this player will not receive the message.

Definition at line 470 of file party.c.

Variable Documentation

party_struct* first_party = NULL

The party list.

Definition at line 54 of file party.c.

const char* const party_loot_modes[PARTY_LOOT_MAX]
Initial value:
= {
"normal", "leader", "owner", "random", "split"
}

String representations of the party looting modes.

Definition at line 38 of file party.c.

const char* const party_loot_modes_help[PARTY_LOOT_MAX]
Initial value:
= {
"everyone in the party is able to loot the corpse",
"only the party leader can loot the corpse",
"only the corpse owner can loot the corpse; standard behavior when outside of a party",
"loot is randomly split between party members when the corpse is opened",
"loot is evenly split between party members when the corpse is opened"
}

Explanation of the party modes.

Definition at line 45 of file party.c.

mempool_struct* pool_party
static

Party memory pool.

Definition at line 59 of file party.c.