 |
Crossfire Client, Trunk
|
Go to the documentation of this file.
76 #define ASSERT_LEN(function, curpos, buflen) \
77 if (curpos > buflen) { \
78 LOG(LOG_WARNING, function, "Data goes beyond length of buffer (%d>%d)", curpos, buflen); \
173 int pos, type, length, map_entry=-1;
188 if ((length+pos) > len) {
190 "Length of data is greater than buffer (%d>%d)", length + pos, len);
194 cp = g_malloc(length+1);
195 strncpy(cp, (
char *)data + pos, length);
213 "Could not allocate memory: %s", strerror(errno));
228 "Unknown type: %d\n", type);
275 "Length of line is greater than buffer (%d>%d)", llen, len);
282 while (olen <= len) {
283 if (!isspace(data[olen])) {
290 "Overran length of buffer (%d>%d)", olen, len);
294 cp = (
char *)data + olen;
296 while (olen <= len) {
297 if (isspace(data[olen])) {
306 "Overran length of buffer (%d>%d)", olen, len);
313 if (!g_ascii_strcasecmp(cp,
"points")) {
317 }
else if (!g_ascii_strcasecmp(cp,
"statrange")) {
320 "Unable to process statrange line (%s)", data + olen);
325 }
else if (!g_ascii_strcasecmp(cp,
"statname")) {
336 while (olen < llen) {
338 if (!g_ascii_strncasecmp((
char *)data + olen,
347 "Unable to find matching stat name (%s)", data + olen);
357 }
else if (!g_ascii_strcasecmp(cp,
"race") || !g_ascii_strcasecmp(cp,
"class")) {
358 if (g_ascii_strcasecmp((
char *)data + olen,
"requestinfo")) {
360 "Got unexpected value for %s: %s", cp, data+olen);
364 }
else if (!g_ascii_strcasecmp(cp,
"startingmap")) {
365 if (g_ascii_strcasecmp((
char *)data + olen,
"requestinfo")) {
367 "Got unexpected value for %s: %s", cp, data+olen);
375 if (datatype ==
'V' || datatype ==
'R') {
377 "Got unsupported string from server, type %c, value %s", datatype, cp);
394 "Processed all newcharinfo yet have 0 value: stat_min=%d, stat_maximum=%d, stat_points=%d",
427 for (i=0; i<num_entries; i++) {
430 if (data[i].arch_name) {
431 free(data[i].arch_name);
433 if (data[i].public_name) {
434 free(data[i].public_name);
436 if (data[i].description) {
437 free(data[i].description);
444 free(data[i].rc_choice[j].value_arch[k]);
445 free(data[i].rc_choice[j].value_desc[k]);
447 free(data[i].rc_choice[j].value_arch);
448 free(data[i].rc_choice[j].value_desc);
449 free(data[i].rc_choice[j].choice_name);
450 free(data[i].rc_choice[j].choice_desc);
470 char *cp = (
char *)data, *nl;
475 nl = strchr(cp,
'\n');
481 LOG(
LOG_WARNING,
"common::process_race_class_info",
"Did not find archetype name");
490 nl = strchr(cp,
' ');
502 if (!strcmp(cp,
"name")) {
513 (
unsigned char *)nl + namelen, data + len);
519 }
else if (!strcmp(cp,
"stats")) {
524 while (cp < (
char *)data + len && *cp != 0) {
535 "Unknown stat value: %d", cp);
543 }
else if (!strcmp(cp,
"msg")) {
551 (
unsigned char *)nl + msglen, data + len);
557 }
else if (!strcmp(cp,
"choice")) {
571 (
unsigned char *)cp + clen, data + len);
581 (
unsigned char *)cp + clen, data + len);
604 (
unsigned char *)cp + clen, data + len);
613 (
unsigned char *)cp + clen, data + len);
624 LOG(
LOG_WARNING,
"common::process_race_class_info",
"Got unknown keyword: %s", cp);
627 }
while ((
unsigned char *)cp < data + len);
663 (
int (*)(
const void *,
const void *))
rc_compar);
694 (
int (*)(
const void *,
const void *))
rc_compar);
710 LOG(
LOG_ERROR,
"common::get_exp_info",
"no max level info from server provided");
717 for (level = 1; level <=
exp_table_max && pos < len; level++) {
723 "Incomplete table sent - got %d entries, wanted %d", level,
exp_table_max);
739 nl = strchr(cp,
'\n');
744 sn = strchr(cp,
':');
746 LOG(
LOG_WARNING,
"common::get_skill_info",
"corrupt line: /%s/", cp);
757 LOG(
LOG_WARNING,
"common::get_skill_info",
"invalid skill number %d", val);
764 }
while (cp < data+len);
785 for (i = 0; i < len; i++) {
787 if (*(buf+i) ==
' ' || *(buf+i) ==
'\n') {
797 LOG(
LOG_DEBUG,
"common::ReplyInfoCmd",
"Never found a space in the replyinfo");
804 if (!strcmp((
char*)buf,
"image_info")) {
806 }
else if (!strcmp((
char*)buf,
"image_sums")) {
808 }
else if (!strcmp((
char*)buf,
"skill_info")) {
810 }
else if (!strcmp((
char*)buf,
"exp_table")) {
812 }
else if (!strcmp((
char*)buf,
"motd")) {
816 motd = g_strdup((
char *)cp);
818 }
else if (!strcmp((
char*)buf,
"news")) {
822 news = g_strdup((
char *)cp);
824 }
else if (!strcmp((
char*)buf,
"rules")) {
828 rules = g_strdup((
char *)cp);
830 }
else if (!strcmp((
char*)buf,
"race_list")) {
832 for (cp1=cp; *cp !=0; cp++) {
856 }
else if (!strcmp((
char*)buf,
"class_list")) {
858 for (cp1=cp; *cp !=0; cp++) {
882 }
else if (!strcmp((
char*)buf,
"race_info")) {
884 }
else if (!strcmp((
char*)buf,
"class_info")) {
886 }
else if (!strcmp((
char*)buf,
"newcharinfo")) {
888 }
else if (!strcmp((
char*)buf,
"startingmap")) {
922 for (; buf[s] && buf[s] !=
' '; s++)
925 while (buf[s] ==
' ') {
934 for (; buf[s] && buf[s] !=
' '; s++)
937 while (s < len && buf[s] ==
' ') {
945 if (!strcmp(cmd,
"sound2")) {
949 }
else if (!strcmp(cmd,
"sound")) {
951 }
else if (!strcmp(cmd,
"mapsize")) {
952 if (!g_ascii_strcasecmp(param,
"false")) {
954 "Server only supports standard sized maps (11x11)");
967 for (
char *cp = param; *cp != 0; cp++) {
968 if (*cp ==
'x' || *cp ==
'X') {
988 snprintf(tmpbuf,
sizeof(tmpbuf),
"Server supports a max mapsize of %d x %d - requesting a %d x %d mapsize",
1002 snprintf(tmpbuf,
sizeof(tmpbuf),
"Unable to set mapsize on server - we wanted %d x %d, server returned %d x %d",
1006 }
else if (!strcmp(cmd,
"darkness")) {
1009 if (!strcmp(param,
"FALSE")) {
1010 LOG(
LOG_WARNING,
"common::SetupCmd",
"Server returned FALSE for setup command %s", cmd);
1012 }
else if (!strcmp(cmd,
"spellmon")) {
1033 if (!strcmp(param,
"FALSE")) {
1034 LOG(
LOG_INFO,
"common::SetupCmd",
"Server returned FALSE for a %s setup command", cmd);
1038 }
else if (!strcmp(cmd,
"facecache")) {
1040 }
else if (!strcmp(cmd,
"faceset")) {
1041 if (!strcmp(param,
"FALSE")) {
1043 "Server does not support other image sets, will use default");
1046 }
else if (!strcmp(cmd,
"map2cmd")) {
1047 if (!strcmp(param,
"FALSE")) {
1049 "Server does not support map2cmd!");
1051 "This server is too old to support this client!");
1054 }
else if (!strcmp(cmd,
"want_pickup")) {
1058 }
else if (!strcmp(cmd,
"loginmethod")) {
1059 int method = atoi(param);
1068 }
else if (!strcmp(cmd,
"newmapcmd")) {
1070 }
else if (!strcmp(cmd,
"tick")) {
1074 if (!strcmp(param,
"FALSE")) {
1076 "Server does not support tick!");
1078 "This server is too old to support this client!");
1081 }
else if (!strcmp(cmd,
"extendedTextInfos")) {
1088 for (
int i = 1; i < 20; i++) {
1090 snprintf(exttext,
sizeof(exttext),
"toggleextendedtext %d", i);
1096 "Got setup for a command we don't understand: %s %s",
1115 LOG(
LOG_INFO,
"common::AddMeFail",
"addme_failed received.");
1133 LOG(
LOG_DEBUG,
"common::AddMeSuccess",
"addme_success received.");
1151 LOG(
LOG_WARNING,
"common::GoodbyeCmd",
"Received goodbye command from server - exiting");
1168 if (anum < 0 || anum >
MAXANIM) {
1169 LOG(
LOG_WARNING,
"common::AnimCmd",
"animation number invalid: %d", anum);
1176 LOG(
LOG_WARNING,
"common::AnimCmd",
"num animations invalid: %d",
1181 for (i = 4, j = 0; i < len; i += 2, j++) {
1187 "Calculated animations does not equal stored animations? (%d!=%d)",
1195 LOG(
LOG_DEBUG,
"common::AnimCmd",
"Received animation %d, %d faces", anum,
animations[anum].num_animations);
1229 int color = atoi(data);
1234 buf = strchr(data,
' ');
1255 while (current != NULL) {
1256 if (current->
type == type) {
1260 current = current->
next;
1263 current->
type = type;
1276 while (current != NULL) {
1277 if (current->
type == type) {
1280 current = current->
next;
1299 while (wordCount > 0) {
1300 while (buf[0] ==
' ') {
1304 while (buf[0] !=
' ') {
1305 if (buf[0] ==
'\0') {
1307 "common::DrawExtInfoCmd",
"Data is missing %d parameters %s",
1315 if (buf[0] ==
' ') {
1319 wordCount = sscanf(data,
"%d %d %d", &color, &type, &subtype);
1320 if (wordCount != 3) {
1322 "common::DrawExtInfoCmd",
"Wrong parameters received. Could only parse %d out of 3 int in %s",
1330 "common::DrawExtInfoCmd",
"Server send us a type %d but i can't find any callback for it",
1334 fnct(color, type, subtype, buf);
1358 }
while(next != skill_id && next >= 0);
1370 int i = 0, c,
redraw = 0;
1518 int rlen = data[i++];
1519 strncpy(
cpl.
range, (
const char*)data+i, rlen);
1526 int rlen = data[i++];
1527 strncpy(
cpl.
title, (
const char*)data+i, rlen);
1534 LOG(
LOG_WARNING,
"common::StatsCmd",
"Unknown stat number %d", c);
1541 LOG(
LOG_WARNING,
"common::StatsCmd",
"got stats overflow, processed %d bytes out of %d", i, len);
1559 guint8 flags = atoi(data);
1573 buf = strchr(data,
' ');
1581 while ((buf = strchr(buf,
'\n')) != NULL) {
1632 int tag, weight, face, i = 0, nlen;
1642 memcpy(name, (
const char*)data+i, nlen);
1647 LOG(
LOG_WARNING,
"common::PlayerCmd",
"lengths do not match (%d!=%d)", len, i);
1678 int weight, loc, tag, face, flags, pos = 0, nlen, anim, nrof, type;
1686 LOG(
LOG_WARNING,
"common::common_item_command",
"Got location with no other data");
1688 }
else if (loc < 0) {
1689 LOG(
LOG_WARNING,
"common::common_item_command",
"Got location with negative value (%d)", loc);
1702 memcpy(name, (
char*)data+pos, nlen);
1707 animspeed = data[pos++];
1712 update_item(tag, loc, name, weight, face, flags, anim, animspeed, nrof, type);
1716 LOG(
LOG_WARNING,
"common::common_item_cmd",
"Overread buffer: %d > %d", pos, len);
1729 int weight, loc, tag, face, sendflags, flags, pos = 0, nlen, anim;
1735 sendflags = data[0];
1752 weight = ip->
weight*1000;
1761 LOG(
LOG_WARNING,
"common::UpdateItemCmd",
"Got tag of unknown object (%d) for new location", loc);
1778 memcpy(name, (
char*)data+pos, nlen);
1783 LOG(
LOG_WARNING,
"common::UpdateItemCmd",
"Overread buffer: %d > %d", pos, len);
1791 animspeed = data[pos++];
1802 update_item(tag, loc, name, weight, face, flags, anim, animspeed, nrof, ip->
type);
1824 LOG(
LOG_WARNING,
"common::DeleteItem",
"Cannot find tag %d", tag);
1828 LOG(
LOG_WARNING,
"common::DeleteItem",
"Overread buffer: %d > %d", pos, len);
1844 tag = atoi((
const char*)data);
1849 LOG(
LOG_WARNING,
"common::DeleteInventory",
"Invalid tag: %d", tag);
1856 static void rstrip(
char buf[
static 1],
size_t len) {
1857 for (
size_t i = len - 1; i > 0; i--) {
1858 if (buf[i] ==
'\n' || buf[i] ==
' ') {
1881 guint16 mlen, pos = 0;
1882 Spell *newspell, *tmp;
1885 newspell = calloc(1,
sizeof(
Spell));
1909 strncpy(newspell->
name, (
char*)data+pos, nlen);
1911 newspell->
name[nlen] =
'\0';
1914 strncpy(newspell->
message, (
char*)data+pos, mlen);
1916 newspell->
message[mlen] =
'\0';
1924 newspell->
usage = 0;
1927 }
else if (pos < len) {
1936 strncpy(newspell->
requirements, (
char*) data+pos, nlen);
1952 tmp->
next = newspell;
1958 LOG(
LOG_WARNING,
"common::AddspellCmd",
"Overread buffer: %d > %d", pos, len);
1969 LOG(
LOG_WARNING,
"common::UpdspellCmd",
"I know no spells to update");
1996 LOG(
LOG_WARNING,
"common::UpdspellCmd",
"Overread buffer: %d > %d", pos, len);
2003 Spell *tmp, *target;
2006 LOG(
LOG_WARNING,
"common::DeleteSpell",
"I know no spells to delete");
2074 #define NUM_LAYERS (MAP1_LAYERS-1)
2083 int mask, x, y, pos = 0, space_len, value;
2133 space_len = type>>5;
2140 value = data[pos++];
2144 if (space_len != 7) {
2148 unsigned int lenp2 = data[pos++];
2149 unsigned char subtype = data[pos++];
2150 unsigned int len = data[pos++];
2152 strncpy(buf, (
const char *)(data+pos), len);
2166 LOG(
LOG_WARNING,
"commands.c::Map2Cmd",
"got layer >= MAXLAYERS!");
2169 assert(0 <= layer && layer <
MAXLAYERS);
2178 if (space_len > 2) {
2189 if (space_len > 3) {
2196 if (space_len != 7) {
2199 int len = data[pos++];
2223 buf = strchr(data,
' ');
2245 int ExtSmooth(
unsigned char *data,
int len,
int x,
int y,
int layer)
2247 static int dx[8] = { 0, 1, 1, 1, 0, -1, -1, -1, };
2248 static int dy[8] = { -1, -1, 0, 1, 1, 1, 0, -1, };
2261 for (i = 0; i < 8; i++) {
2285 int mask, x, y, pos = 0, layer;
2308 while (pos+entrysize+2 <= len) {
2311 x = (mask>>10)&0x3f;
2313 for (layer =
NUM_LAYERS; layer >= 0; layer--) {
2314 if (mask&(1<<layer)) {
2316 if (pos+entrysize > len) {
2319 startpackentry = pos;
2330 pos = startpackentry+entrysize;
2352 LOG(
LOG_WARNING,
"common::MagicMapCmd",
"Was not able to properly extract magic map size, pos");
2364 for (cp = data, i = 0; i < 4 && cp < data+len; cp++) {
2370 LOG(
LOG_WARNING,
"common::MagicMapCmd",
"Was unable to find start of magic map data");
2375 LOG(
LOG_WARNING,
"common::MagicMapCmd",
"Magic map size mismatch. Have %d bytes, should have %d",
2446 cp = strchr(buf,
' ');
2454 if (!strcmp(buf,
"accountlogin")) {
2456 }
else if (!strcmp(buf,
"accountnew")) {
2458 }
else if (!strcmp(buf,
"accountaddplayer")) {
2460 }
else if (!strcmp(buf,
"createplayer")) {
2462 }
else if (!strcmp(buf,
"accountpw")) {
2464 }
else if (!strcmp(buf,
"accountplay")) {
2476 LOG(
LOG_ERROR,
"common::FailureCmd",
"Got a failure response we can not handle: %s:%s",
2484 int level, pos, faceno;
2523 if ((pos +flen) > len) {
2524 LOG(
LOG_ERROR,
"commands.c:AccountPlayerCmd",
"data overran buffer");
2529 strncpy(name, buf + pos +1, flen-1);
2534 strncpy(
class, buf + pos +1, flen-1);
2539 strncpy(race, buf + pos +1, flen-1);
2544 strncpy(face, buf + pos +1, flen-1);
2549 strncpy(party, buf + pos +1, flen-1);
2554 strncpy(
map, buf + pos +1, flen-1);
void DeleteSpell(unsigned char *data, int len)
gint16 skill_level[MAX_SKILL]
Level of known skills.
struct MapCell * mapdata_cell(const int x, const int y)
Get the stored map cell at the given map coordinate.
#define CS_NUM_SKILLS
CS_NUM_SKILLS does not match how many skills there really are - instead, it is used as a range of val...
@ LOG_INFO
Minor, non-harmful issues.
static gboolean redraw(gpointer data)
Redraw the map.
#define MSG_TYPE_CLIENT
Client originated Messages.
char message[10000]
This is huge, the packets can't be much bigger than this anyway.
void item_actions(item *op)
void TickCmd(guint8 *data, int len)
Got a tick from the server.
void mapdata_clear_space(int x, int y)
short GetShort_String(const unsigned char *data)
@ LOG_WARNING
Warning that something might not work.
void client_tick(guint32 tick)
Called whenever the server sends a tick command.
void(* ExtTextManager)(int flag, int type, int subtype, char *message)
The usage of the stat_mapping is to simplify the code and make it easier to expand.
guint32 tag
Unique ID number for a spell so updspell etc can operate on it.
gint64 skill_exp[MAX_SKILL]
Experience points for skills.
#define CS_QUERY_YESNO
Yes/no question.
char title[MAX_BUF]
Title of character.
#define MAP2_COORD_OFFSET
How much the x,y coordinates in the map2 are off from actual upper left corner.
For classes & races, the server can present some number of choices, eg, the character gets to choose ...
void setTextManager(int type, ExtTextManager callback)
#define EMI_NOREDRAW
< Take extended information into account but do not redraw.
Input_State input_state
What the input state is.
void client_disconnect()
Closes the connection to the server.
void GoodbyeCmd(char *data, int len)
static void get_race_info(unsigned char *data, int len)
This is a little wrapper function that does some bounds checking and then calls process_race_info() t...
void free_all_race_class_info(Race_Class_Info *data, int num_entries)
This function clears the data from the Race_Class_Info array.
void DeleteItem(unsigned char *data, int len)
void handle_query(char *data, int len)
Prompts the user for input.
void draw_stats(int redraw)
Draws the stats window.
void mapdata_set_face_layer(int x, int y, gint16 face, int layer)
gint16 food
Quantity food in stomach.
#define CS_STAT_SPELL_DENY
void remove_item_inventory(item *op)
void mapdata_newmap(void)
Clears the map view.
#define EMI_SMOOTH
Data about smoothing.
void starting_map_update_info()
We have gotten starting map information from the server - now update the combo boxes.
void hide_all_login_windows(void)
Hides all the login related windows.
gint32 weapon_sp
Weapon speed (displayed in client as a float)
guint8 num_animations
Number of animations.
#define CS_QUERY_SINGLECHAR
Single character response expected.
Face_Information face_info
static void get_exp_info(const unsigned char *data, int len)
gint16 maxgrace
Maximum spell points.
void new_player(long tag, char *name, long weight, long face)
Initialize player object using information from the server.
int GetInt_String(const unsigned char *data)
The reverse of SockList_AddInt, but on strings instead.
static int rc_compar(const Race_Class_Info *a, const Race_Class_Info *b)
Used for bsearch searching.
void mapdata_set_smooth(int x, int y, guint8 smooth, int layer)
void script_lua_stats(void)
void update_item(int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, guint32 nrof, int type)
void mapdata_set_check_space(int x, int y)
void display_map_doneupdate(int redraw, int notice)
This is called after the map has been all digested.
void client_pickup(guint32 pickup)
We get pickup information from server, update our status.
void DrawExtInfoCmd(char *data, int len)
We must extract color, type, subtype and dispatch to callback.
#define MSG_TYPE_CLIENT_COMMAND
DrawInfoCmd()
void new_char_window_update_info()
We have gotten some new information from the server, so we need to update the information - race/clas...
guint8 skill_number
The index in the skill arrays, plus CS_STAT_SKILLINFO.
void start_login(int method)
Starts the login process.
void ReplyInfoCmd(unsigned char *buf, int len)
Handles the response from a 'requestinfo' command.
char requirements[256]
Spellmon 2 data.
void AddMeFail(char *data, int len)
Handles when the server says we can't be added.
#define UPD_SP_MANA
updspell command flag value.
void PlayerCmd(unsigned char *data, int len)
Gets the player information.
gint16 resists[30]
Resistant values.
struct TextManager * next
static void get_starting_map_info(unsigned char *data, int len)
This processes the replyinfo starting_map_info.
#define CS_STAT_RESIST_START
Start of resistances (inclusive)
void SmoothCmd(unsigned char *data, int len)
Receives the smooth mapping from the server.
int ExtSmooth(unsigned char *data, int len, int x, int y, int layer)
Extract smoothing infos from an extendedmapinfo packet part data is located at the beginning of the s...
guint16 flags
Contains fire on/run on flags.
void mapdata_clear_old(int x, int y)
Prepare a map cell, which may contain old fog of war data, for new visible map data.
void MapExtendedCmd(unsigned char *data, int len)
Handle MapExtended command Warning! if you add commands to extended, take care that the 'layer' argum...
void SinkCmd(unsigned char *data, int len)
void account_change_password_failure(char *message)
#define UPD_SP_DAMAGE
updspell command flag value.
gint16 grace
Spell points for using prayers.
void NewmapCmd(unsigned char *data, int len)
void open_container(item *op)
guint32 resist_change
Resistant value change flag.
struct Spell_struct * next
void draw_magic_map(void)
#define CS_STAT_SPELL_REPEL
void close_container(item *op)
Open and close_container are now no-ops - since these are now drawn inline as treestores,...
int last_used_skills[MAX_SKILL+1]
maps position to skill id with trailing zero as stop mark.
#define NUM_NEW_CHAR_STATS
void get_image_info(guint8 *data, int len)
Takes the data from a replyinfo image_info and breaks it down.
void FailureCmd(char *buf, int len)
Handles a failure return from the server.
gint16 sp
Spell points for casting spells.
gint32 face
A face ID that may be used to show a graphic representation of the spell.
item * container
open container
gint32 speed
Speed (is displayed as a float)
gint8 level
Experience level.
gint16 maxhp
Maximum hit points.
struct RC_Choice * rc_choice
void free_all_starting_map_info()
This function clears the data from the Race_Class_Info array.
#define MSG_TYPE_CLIENT_SERVER
Server configuration issues.
char name[256]
One length byte plus data
void Map2Cmd(unsigned char *data, int len)
void account_login_failure(char *message)
Handles a failure from the server - pretty basic - just throw up the message and let the user try aga...
char range[MAX_BUF]
Range attack chosen.
void PickupCmd(guint8 *data, int len)
Server gives us current player's pickup.
gint16 maxsp
Maximum spell points.
void get_image_sums(char *data, int len)
This gets a block of checksums from the server.
char * skill
Pointer to the skill name, derived from the skill number.
void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer)
#define ASSERT_LEN(function, curpos, buflen)
#define CS_STAT_SKILLINFO
CS_STAT_SKILLINFO is used as the starting index point.
#define MAX_SKILL
How many skill types server supports/client will get sent to it.
void map_scrollCmd(char *data, int len)
Scrolls the map on the client by some amount.
void LOG(LogLevel level, const char *origin, const char *format,...)
Log messages of a certain importance to stderr.
TextManager * firstTextManager
#define MAP2_TYPE_DARKNESS
int cs_print_string(GSocketConnection *fd, const char *str,...)
Send a printf-formatted packet to the socket.
void send_reply(const char *text)
Sends a reply to the server.
void create_new_character_failure(char *message)
Pop up a dialog window with the error from the server.
void addsmooth(guint16 face, guint16 smooth_face)
Referenced from common/commands.c.
void DrawInfoCmd(char *data, int len)
Draws a string in the info window.
#define INFO_MAP_ARCH_NAME
Definitions for the requestion/replyinfo map data.
Starting_Map_Info * starting_map_info
gint16 want_config[CONFIG_NUMS]
void draw_ext_info(int orig_color, int type, int subtype, const char *message)
A message processor that accepts messages along with meta information color and type.
gint8 stat_adj[NUM_NEW_CHAR_STATS]
void update_character_choose(const char *name, const char *class, const char *race, const char *face, const char *party, const char *map, int level, int faceno)
This gets data and adds it to the list store.
guint8 * magicmap
Magic map data.
#define CS_STAT_WEIGHT_LIM
static void get_skill_info(char *data, int len)
void StatsCmd(unsigned char *data, int len)
Updates the local copy of the stats and displays it.
guint32 no_echo
If TRUE, don't echo keystrokes.
void UpdspellCmd(unsigned char *data, int len)
guint32 path
The bitmask of paths this spell belongs to.
void account_add_character_failure(char *message)
Handles a failure from the server - pretty basic - just throw up the message and let the user try aga...
struct Stat_Mapping stat_mapping[NUM_NEW_CHAR_STATS]
gint16 dam
How much damage this object does for each hit.
void draw_prompt(const char *str)
Draws a prompt.
#define CS_STAT_SPELL_ATTUNE
guint8 usage
Spellmon 2 data.
void choose_character_init(void)
Called when we get the accountplayers command from the server (indirectly via AccountPlayersCmd).
#define CS_STAT_EXP
No longer used.
bool mapdata_contains(int x, int y)
Determine whether the map data contains the given cell.
Animations animations[MAXANIM]
guint16 pmapy
Where the player is on the magic map.
void resize_map_window(int x, int y)
Resize_map_window is a NOOP for the time being - not sure if it will in fact need to do something,...
void remove_item(item *op)
@ LOG_ERROR
Warning that something definitely didn't work.
static void process_race_class_info(unsigned char *data, int len, Race_Class_Info *rci)
This extracts the data from a replyinfo race_info/class_info request.
item * locate_item(gint32 tag)
static void get_class_info(unsigned char *data, int len)
This is a little wrapper function that does some bounds checking and then calls process_race_info() t...
Client_Player cpl
Player object.
void mapdata_scroll(int dx, int dy)
Scrolls the map view.
void Item2Cmd(unsigned char *data, int len)
Parses the data sent to us from the server.
void AddMeSuccess(char *data, int len)
This is really a throwaway command - there really isn't any reason to send addme_success commands.
void MagicMapCmd(unsigned char *data, int len)
void reset_player_data()
Reset player experience data.
guint16 sp
Mana per cast; may be zero.
guint32 repelled
Spell paths to which the player is repelled.
void AddspellCmd(unsigned char *data, int len)
void mapdata_set_size(int viewx, int viewy)
Initializes the module.
void mapdata_add_label(int x, int y, int subtype, const char *label)
void account_creation_failure(char *message)
Handles a failure from the server - pretty basic - just throw up the message and let the user try aga...
void show_main_client(void)
Show main client window.
guint16 dam
Damage done by spell though the meaning is spell dependent and actual damage may depend on how the sp...
guint16 level
The casting level of the spell.
static ExtTextManager getTextManager(int type)
guint32 weight_limit
Carrying weight limit.
#define UPD_SP_GRACE
updspell command flag value.
static int spellmon_level
Keeps track of what spellmon command is supported by the server.
void mapdata_set_darkness(int x, int y, int darkness)
PlayerPosition pl_pos
Position of the player on the internal map.
void AnimCmd(unsigned char *data, int len)
gint16 use_config[CONFIG_NUMS]
void AccountPlayersCmd(char *buf, int len)
This handles the accountplayers command.
#define EMI_HASMOREBITS
Indicates the bitfield continue un next byte There may be several on contiguous bytes.
#define MSG_TYPE_CLIENT_QUERY
handle_query() and prompts
guint32 denied
Spell paths denied to the player.
void DeleteInventory(unsigned char *data, int len)
#define MAXLAYERS
The protocol supports 10 layers, so set MAXLAYERS accordingly.
guint16 mmapy
size of magic map
guint16 time
Casting time in server ticks.
void draw_message_window(int redraw)
Updates the stats pane - hp, sp, etc labels.
guint16 grace
Grace per cast; may be zero.
#define MAX_VIEW
Maximum size of view area a server could support.
#define INFO_MAP_NAME
Proper name of this entry.
void update_login_info(int type)
This is called from ReplyInfoCmd when it gets a response from news/motd/rules.
gint64 GetInt64_String(const unsigned char *data)
The reverse of SockList_AddInt, but on strings instead.
char GetChar_String(const unsigned char *data)
guint32 attuned
Spell paths to which the player is attuned.
static const char *const short_stat_name[NUM_STATS]
Short name of stats.
void SetupCmd(char *buf, int len)
Received a response to a setup from the server.
Spell * spelldata
List of spells known.
void use_skill(int skill_id)
Maintain the last_used_skills LRU list for displaying the recently used skills first.
#define CS_STAT_RESIST_END
End of resistances (inclusive)
guint32 spells_updated
Whether or not spells updated.
char * skill_names[MAX_SKILL]
@ LOG_DEBUG
Useful debugging information.
Race_Class_Info * classes
static void get_new_char_info(unsigned char *data, int len)
This is process the newcharinfo requestinfo.
#define INFO_MAP_DESCRIPTION
Description of this map.
void client_mapsize(int width, int height)
Ask the server for the given map size.
void UpdateItemCmd(unsigned char *data, int len)
Updates some attributes of an item.
void set_weight_limit(guint32 wlim)
No reason to divide by 1000 everytime we do the display, so do it once and store it here.
#define CS_QUERY_HIDEINPUT
Hide input being entered.
static void rstrip(char buf[static 1], size_t len)
Remove trailing newlines from the given C string in-place.