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

Go to the source code of this file.

Macros

#define MAXITEMLEN   300
 

Functions

static int check_container (object *pl, object *con)
 
unsigned int query_flags (object *op)
 
void add_object_to_packet (struct packet_struct *packet, object *op, object *pl, uint8_t apply_action, uint32_t flags, int level)
 
static void esrv_draw_look_rec (object *pl, packet_struct *packet, object *op, int level)
 
void esrv_draw_look (object *pl)
 
void esrv_close_container (object *pl, 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 *op)
 
static void esrv_send_item_send (object *pl, object *op)
 
void esrv_send_item (object *op)
 
static void esrv_del_item_send (object *pl, object *op)
 
void esrv_del_item (object *op)
 
static objectget_ob_from_count_rec (object *pl, object *where, tag_t count)
 
objectesrv_get_ob_from_count (object *pl, tag_t count)
 
void socket_command_item_examine (socket_struct *ns, player *pl, uint8_t *data, size_t len, size_t pos)
 
void send_quickslots (player *pl)
 
void socket_command_quickslot (socket_struct *ns, player *pl, uint8_t *data, size_t len, size_t pos)
 
void socket_command_item_apply (socket_struct *ns, player *pl, uint8_t *data, size_t len, size_t pos)
 
void socket_command_item_lock (socket_struct *ns, player *pl, uint8_t *data, size_t len, size_t pos)
 
void socket_command_item_mark (socket_struct *ns, player *pl, uint8_t *data, size_t len, size_t pos)
 
void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof)
 

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.

Macro Definition Documentation

#define MAXITEMLEN   300

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

Definition at line 41 of file item.c.

Function Documentation

void add_object_to_packet ( struct packet_struct *  packet,
object op,
object pl,
uint8_t  apply_action,
uint32_t  flags,
int  level 
)

Add data about object to a packet.

Parameters
packetPacket to append to.
opObject to add information about.
plPlayer that will receive the data.
apply_actionOne of CMD_APPLY_ACTION_xxx.
flagsCombination of UPD_XXX.
levelInventory level.

Definition at line 109 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 1126 of file item.c.

void esrv_close_container ( object pl,
object op 
)

Close a container.

Parameters
plPlayer to close container of.
opThe container.

Definition at line 524 of file item.c.

void esrv_del_item ( object op)

Informs involved clients about item deletion.

Parameters
opThe item that was deleted.

Definition at line 755 of file item.c.

static void esrv_del_item_send ( object pl,
object op 
)
static

Informs a client about item deletion.

Parameters
plPlayer.
opThe item that was deleted.

Definition at line 730 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 396 of file item.c.

static void esrv_draw_look_rec ( object pl,
packet_struct *  packet,
object op,
int  level 
)
static

Recursively draw inventory of an object for DMs.

Parameters
plDM.
packetPacket to append to.
opObject of which inventory is going to be sent.
levelInventory level.

Definition at line 313 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 814 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 1039 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 557 of file item.c.

void esrv_send_item ( object op)

Informs all involved clients about the specified object.

Parameters
opObject to send information of.

Definition at line 703 of file item.c.

static void esrv_send_item_send ( object pl,
object op 
)
static

Informs a client about the specified object.

Parameters
plThe player.
opObject to send information of.

Definition at line 663 of file item.c.

void esrv_update_item ( int  flags,
object op 
)

Updates specified data about the specified object for all involved clients.

Parameters
flagsList of values to update.
opThe object to update.

Definition at line 639 of file item.c.

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

Informs client about new object data.

Parameters
flagsList of values to update.
plThe player.
opThe object to update.

Definition at line 610 of file item.c.

static object* get_ob_from_count_rec ( object pl,
object where,
tag_t  count 
)
static

Recursive part of esrv_get_ob_from_count().

Definition at line 776 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 51 of file item.c.

void send_quickslots ( player pl)

Send quickslots to player.

Parameters
plPlayer to send the quickslots to.

Definition at line 870 of file item.c.