Atrinik Server 2.5
Defines | Functions
socket/item.c File Reference
#include <global.h>

Go to the source code of this file.

Defines

#define MAXITEMLEN   300

Functions

static objectesrv_get_ob_from_count_DM (object *pl, tag_t count)
static int check_container (object *pl, object *con)
unsigned int query_flags (object *op)
static void add_object_to_socklist (SockList *sl, object *op, object *pl, uint32 flags)
static int esrv_draw_look_rec (object *pl, SockList *sl, object *op)
void esrv_draw_look (object *pl)
void esrv_close_container (object *op)
void esrv_send_inventory (object *pl, object *op)
static void esrv_update_item_send (int flags, object *pl, object *op)
void esrv_update_item (int flags, object *pl, object *op)
static void esrv_send_item_send (object *pl, object *op)
void esrv_send_item (object *pl, object *op)
static void esrv_del_item_send (player *pl, int tag)
void esrv_del_item (player *pl, int tag, object *cont)
objectesrv_get_ob_from_count (object *pl, tag_t count)
void ExamineCmd (char *buf, int len, player *pl)
static void remove_quickslot (uint8 slot, player *pl)
void send_quickslots (player *pl)
void QuickSlotCmd (uint8 *buf, int len, player *pl)
void ApplyCmd (char *buf, int len, player *pl)
void LockItem (uint8 *data, int len, player *pl)
void MarkItem (uint8 *data, int len, player *pl)
void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof)
void cmd_ready_send (player *pl, tag_t tag, int type)
int cmd_ready_determine (object *tmp)
void cmd_ready_clear (object *op, int type)

Detailed Description

This contains item logic for client/server. It doesn't contain the actual commands that send the data, but does contain the logic for what items should be sent.

Definition in file item.c.


Define Documentation

#define MAXITEMLEN   300

This is the maximum number of bytes we expect any item to take up.

Definition at line 38 of file item.c.


Function Documentation

static void add_object_to_socklist ( SockList sl,
object op,
object pl,
uint32  flags 
) [static]

Add data about object to a SockList instance.

Parameters:
slSockList instance to add to.
opObject to add information about.
plPlayer that will receive the data.
flagsCombination of Item update flags.

Definition at line 149 of file item.c.

void ApplyCmd ( char *  buf,
int  len,
player pl 
)

Client wants to apply an object.

Parameters:
bufBuffer, contains ID of the object to apply.
lenUnused.
plPlayer.

Definition at line 978 of file item.c.

static int check_container ( object pl,
object con 
) [static]

Check if container can be dropped.

Locked or FLAG_STARTEQUIP items cannot be dropped, so we check if the container carries one (or one of containers in that container).

Parameters:
plPlayer.
conContainer.
Returns:
0 if it can be dropped, non-zero otherwise.

Definition at line 1201 of file item.c.

void cmd_ready_clear ( object op,
int  type 
)

Look through player's inventory and unready readied object of the specified type.

Parameters:
opPlayer.
typeOne of READY_OBJ_xxx that the readied object must match.

Definition at line 1284 of file item.c.

int cmd_ready_determine ( object tmp)

Determines one of READY_OBJ_xxx for the specified object.

Parameters:
tmpThe object.
Returns:
One of READY_OBJ_xxx, -1 if not applicable to any of the defined constants.

Definition at line 1254 of file item.c.

void cmd_ready_send ( player pl,
tag_t  tag,
int  type 
)

Sends a BINARY_CMD_READY to the player's client.

Parameters:
plThe player.
tagObject UID that the client should be notified about being readied.
typeType of the object as returned by cmd_ready_determine().

Definition at line 1237 of file item.c.

void esrv_close_container ( object op)

Close a container.

Parameters:
opPlayer to close container of.

Definition at line 451 of file item.c.

void esrv_del_item ( player pl,
int  tag,
object cont 
)

Tells the client to delete an item.

Parameters:
plPlayer.
tagID of the object to delete.
contContainer.

Definition at line 673 of file item.c.

static void esrv_del_item_send ( player pl,
int  tag 
) [static]

Tells the client to delete an item.

Parameters:
plPlayer.
tagID of the object to delete.

Definition at line 655 of file item.c.

void esrv_draw_look ( object pl)

Draw the look window. Don't need to do animations here.

This sends all the faces to the client, not just updates. This is because object ordering would otherwise be inconsistent.

Parameters:
plPlayer to draw the look window for.

Definition at line 342 of file item.c.

static int esrv_draw_look_rec ( object pl,
SockList sl,
object op 
) [static]

Recursively draw inventory of an object for DMs.

Parameters:
plDM.
slSockList instance to append to.
opObject of which inventory is going to be sent.
Returns:
Number of items sent.

Definition at line 284 of file item.c.

object* esrv_get_ob_from_count ( object pl,
tag_t  count 
)

Looks for an object player's client requested in player's inventory and below player.

Parameters:
plPlayer.
countID of the object to look for.
Returns:
The found object, NULL if it can't be found.

Definition at line 696 of file item.c.

static object * esrv_get_ob_from_count_DM ( object pl,
tag_t  count 
) [static]

Recursive function for DMs to access to non-container inventories.

Parameters:
plPlayer.
countID of the object to look for.
Returns:
The found object, NULL if it can't be found.

Definition at line 792 of file item.c.

void esrv_move_object ( object pl,
tag_t  to,
tag_t  tag,
long  nrof 
)

Move an object to a new location.

Parameters:
plPlayer.
toID of the object to move the object. If 0, it's on ground.
tagID of the object to drop.
nrofHow many objects to drop.

Definition at line 1099 of file item.c.

void esrv_send_inventory ( object pl,
object op 
)

Sends a whole inventory of an object.

Parameters:
plPlayer to send the inventory to.
opObject to send inventory of. Can be same as 'pl' to send inventory of the player.

Definition at line 470 of file item.c.

void esrv_send_item ( object pl,
object op 
)

Sends item's info to player.

Parameters:
plThe player.
opObject to send information of.

Definition at line 627 of file item.c.

static void esrv_send_item_send ( object pl,
object op 
) [static]

Sends item's info to player. Used by esrv_send_item().

Parameters:
plThe player.
opObject to send information of.

Definition at line 588 of file item.c.

void esrv_update_item ( int  flags,
object pl,
object op 
)

Updates object for player.

Parameters:
flagsList of values to update to the client.
plThe player.
opThe object to update.

Definition at line 566 of file item.c.

static void esrv_update_item_send ( int  flags,
object pl,
object op 
) [static]

Updates object for player. Used in esrv_update_item().

Parameters:
flagsList of values to update to the client.
plThe player.
opThe object to update.

Definition at line 539 of file item.c.

void ExamineCmd ( char *  buf,
int  len,
player pl 
)

Client wants to examine some object.

Parameters:
bufBuffer, contains ID of the object to examine.
lenUnused.
plPlayer.

Definition at line 819 of file item.c.

void LockItem ( uint8 data,
int  len,
player pl 
)

Client wants to lock an object.

Parameters:
dataBuffer, contains ID of the object to lock.
lenUnused.
plPlayer.

Definition at line 1017 of file item.c.

void MarkItem ( uint8 data,
int  len,
player pl 
)

Client wants to mark an object.

Parameters:
dataBuffer, contains ID of the object to mark.
lenUnused.
plPlayer.

Definition at line 1061 of file item.c.

unsigned int query_flags ( object op)

This is a similar to query_name, but returns flags to be sent to client.

Parameters:
opObject to query the flags for.
Returns:
Flags.

Definition at line 45 of file item.c.

void QuickSlotCmd ( uint8 buf,
int  len,
player pl 
)

Quick slot command.

Parameters:
bufData.
lenLength of 'buf'.
plPlayer.

Definition at line 904 of file item.c.

static void remove_quickslot ( uint8  slot,
player pl 
) [static]

Remove any quickslots of player 'pl' matching slot 'slot'.

Parameters:
slotID of the quickslot to look for.
plInside which player to search in.

Definition at line 844 of file item.c.

void send_quickslots ( player pl)

Send quickslots to player.

Parameters:
plPlayer to send the quickslots to.

Definition at line 866 of file item.c.