Atrinik Client 2.5
Functions
client/commands.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

void BookCmd (unsigned char *data, int len)
void SetupCmd (char *buf, int len)
void AddMeFail (unsigned char *data, int len)
void AddMeSuccess (unsigned char *data, int len)
void AnimCmd (unsigned char *data, int len)
void ImageCmd (unsigned char *data, int len)
void SkillRdyCmd (char *data, int len)
void DrawInfoCmd (unsigned char *data)
void DrawInfoCmd2 (unsigned char *data, int len)
void TargetObject (unsigned char *data, int len)
void StatsCmd (unsigned char *data, int len)
void PreParseInfoStat (char *cmd)
void handle_query (char *data)
void send_reply (char *text)
void PlayerCmd (unsigned char *data, int len)
void ItemXCmd (unsigned char *data, int len)
void ItemYCmd (unsigned char *data, int len)
void UpdateItemCmd (unsigned char *data, int len)
void DeleteItem (unsigned char *data, int len)
void DeleteInventory (unsigned char *data)
static void map_play_footstep ()
void MapStatsCmd (unsigned char *data, int len)
void Map2Cmd (unsigned char *data, int len)
void MagicMapCmd (unsigned char *data, int len)
void VersionCmd (char *data)
void SendVersion ()
void RequestFile (int idx)
void SendAddMe ()
void NewCharCmd ()
void DataCmd (unsigned char *data, int len)
void ShopCmd (unsigned char *data, int len)
void QuestListCmd (unsigned char *data, int len)
void ReadyCmd (unsigned char *data, int len)

Detailed Description

Handles commands received by the server. This does not necessarily handle all commands - some might be in other files (like main.c)

This file handles commans from the server->client. See player.c for client->server commands.

this file contains most of the commands for the dispatch loop most of the functions are self-explanatory, the pixmap/bitmap commands receive the picture, and display it. The drawinfo command draws a string in the info window, the stats command updates the local copy of the stats and displays it. handle_query prompts the user for input. send_reply sends off the reply for the input. player command gets the player information. MapScroll scrolls the map on the client by some amount MapCmd displays the map either with layer packing or stack packing. packing/unpacking is best understood by looking at the server code (server/ericserver.c) stack packing is easy, for every map entry that changed, we pack 1 byte for the x/y location, 1 byte for the count, and 2 bytes per face in the stack. layer packing is harder, but I seem to remember more efficient: first we pack in a list of all map cells that changed and are now empty. The end of this list is a 255, which is bigger that 121, the maximum packed map location. For each changed location we also pack in a list of all the faces and X/Y coordinates by layer, where the layer is the depth in the map. This essentially takes slices through the map rather than stacks. Then for each layer, (max is MAXMAPCELLFACES, a bad name) we start packing the layer into the message. First we pack in a face, then for each place on the layer with the same face, we pack in the x/y location. We mark the last x/y location with the high bit on (11*11 = 121 < 128). We then continue on with the next face, which is why the code marks the faces as -1 if they are finished. Finally we mark the last face in the layer again with the high bit, clearly limiting the total number of faces to 32767, the code comments it's 16384, I'm not clear why, but the second bit may be used somewhere else as well. The unpacking routines basically perform the opposite operations.

Definition in file commands.c.


Function Documentation

void AddMeFail ( unsigned char *  data,
int  len 
)

Handles when the server says we can't be added. In reality, we need to close the connection and quit out, because the client is going to close us down anyways.

Definition at line 184 of file commands.c.

void AddMeSuccess ( unsigned char *  data,
int  len 
)

This is really a throwaway command - there really isn't any reason to send addme_success commands.

Definition at line 196 of file commands.c.

void AnimCmd ( unsigned char *  data,
int  len 
)

Animation command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 208 of file commands.c.

void BookCmd ( unsigned char *  data,
int  len 
)

Book command, used to initialize the book interface.

Parameters:
dataData of the book
lenLength of the data

Definition at line 73 of file commands.c.

void DataCmd ( unsigned char *  data,
int  len 
)

Data command. Used when server sends us block of data, like new srv file.

Parameters:
dataIncoming data
lenLength of the data

Definition at line 1648 of file commands.c.

void DeleteInventory ( unsigned char *  data)

Delete inventory command.

Parameters:
dataThe incoming data

Definition at line 1276 of file commands.c.

void DeleteItem ( unsigned char *  data,
int  len 
)

Delete item command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 1254 of file commands.c.

void DrawInfoCmd ( unsigned char *  data)

Draw info command. Used to draw text from the server.

Parameters:
dataThe text to output.

Definition at line 319 of file commands.c.

void DrawInfoCmd2 ( unsigned char *  data,
int  len 
)

New draw info command. Used to draw text from the server with various flags, like color.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 333 of file commands.c.

void handle_query ( char *  data)

Handle server query question.

Parameters:
dataThe incoming data

Definition at line 863 of file commands.c.

void ImageCmd ( unsigned char *  data,
int  len 
)

Image command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 258 of file commands.c.

void ItemXCmd ( unsigned char *  data,
int  len 
)

ItemX command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 940 of file commands.c.

void ItemYCmd ( unsigned char *  data,
int  len 
)

ItemY command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 1043 of file commands.c.

void MagicMapCmd ( unsigned char *  data,
int  len 
)

Magic map command. Currently unused.

Definition at line 1590 of file commands.c.

void Map2Cmd ( unsigned char *  data,
int  len 
)

Map2 command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 1364 of file commands.c.

static void map_play_footstep ( ) [static]

Plays the footstep sounds when moving on the map.

Definition at line 1294 of file commands.c.

void MapStatsCmd ( unsigned char *  data,
int  len 
)

Mapstats command.

Parameters:
dataThe incoming data.
lenLength of the data.

Definition at line 1321 of file commands.c.

void NewCharCmd ( )

New char command. Used when server tells us to go to the new character creation.

Definition at line 1638 of file commands.c.

void PlayerCmd ( unsigned char *  data,
int  len 
)

This function copies relevant data from the archetype to the object. Only copies data that was not set in the object structure.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 904 of file commands.c.

void PreParseInfoStat ( char *  cmd)

Used by handle_query to open console for questions like name, password, etc.

Parameters:
cmdThe question command.

Definition at line 831 of file commands.c.

void QuestListCmd ( unsigned char *  data,
int  len 
)

Quest list command.

Uses the book GUI to show the quests.

Parameters:
dataData.
lenLength of the data.

Definition at line 1685 of file commands.c.

void ReadyCmd ( unsigned char *  data,
int  len 
)

Ready command. Marks an object with specified UID as readied (arrow, quiver, etc).

Parameters:
dataData.
lenLength of the data.

Definition at line 1698 of file commands.c.

void RequestFile ( int  idx)

Request srv file.

Parameters:
csockSocket to request from
idxSRV file ID

Definition at line 1619 of file commands.c.

void send_reply ( char *  text)

Sends a reply to the server.

Parameters:
textNull terminated string of text to send.

Definition at line 891 of file commands.c.

void SendAddMe ( )

Send an addme command to the server.

Parameters:
csockSocket to send the command to.

Definition at line 1630 of file commands.c.

void SendVersion ( )

Sends version and client name.

Parameters:
csockSocket to send this information to.

Definition at line 1607 of file commands.c.

void SetupCmd ( char *  buf,
int  len 
)

Setup command. Used to set up a new server connection, initialize necessary data, etc.

Parameters:
bufThe incoming data.
lenLength of data.

Definition at line 84 of file commands.c.

void ShopCmd ( unsigned char *  data,
int  len 
)

Shop command.

Parameters:
dataData buffer
lenLength of the buffer

Definition at line 1673 of file commands.c.

void SkillRdyCmd ( char *  data,
int  len 
)

Ready command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 293 of file commands.c.

void StatsCmd ( unsigned char *  data,
int  len 
)

Stats command. Used to update various things, like target's HP, mana regen, protections, etc

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 493 of file commands.c.

void TargetObject ( unsigned char *  data,
int  len 
)

Target object command.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 464 of file commands.c.

void UpdateItemCmd ( unsigned char *  data,
int  len 
)

Update item command. Updates some attributes of an item.

Parameters:
dataThe incoming data
lenLength of the data

Definition at line 1147 of file commands.c.

void VersionCmd ( char *  data)

Version command. Currently unused.

Parameters:
dataThe incoming data.

Definition at line 1599 of file commands.c.