| 1 |
root |
1.1 |
/* |
| 2 |
|
|
* static char *rcsid_newclient_h = |
| 3 |
root |
1.2 |
* "$Id$"; |
| 4 |
root |
1.1 |
*/ |
| 5 |
|
|
|
| 6 |
|
|
/* |
| 7 |
|
|
CrossFire, A Multiplayer game for X-windows |
| 8 |
|
|
|
| 9 |
|
|
Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
| 10 |
|
|
Copyright (C) 1992 Frank Tore Johansen |
| 11 |
|
|
|
| 12 |
|
|
This program is free software; you can redistribute it and/or modify |
| 13 |
|
|
it under the terms of the GNU General Public License as published by |
| 14 |
|
|
the Free Software Foundation; either version 2 of the License, or |
| 15 |
|
|
(at your option) any later version. |
| 16 |
|
|
|
| 17 |
|
|
This program is distributed in the hope that it will be useful, |
| 18 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
|
|
GNU General Public License for more details. |
| 21 |
|
|
|
| 22 |
|
|
You should have received a copy of the GNU General Public License |
| 23 |
|
|
along with this program; if not, write to the Free Software |
| 24 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 25 |
|
|
|
| 26 |
|
|
The authors can be reached via e-mail at crossfire-devel@real-time.com |
| 27 |
|
|
*/ |
| 28 |
|
|
|
| 29 |
|
|
/* This file defines various flags that both the new client and |
| 30 |
|
|
* newserver uses. These should never be changed, only expanded. |
| 31 |
|
|
* Changing them will likely cause all old clients to not work properly. |
| 32 |
|
|
* While called newclient, it is really used by both the client and |
| 33 |
|
|
* server to keep some values the same. |
| 34 |
|
|
* |
| 35 |
|
|
* Name format is CS_(command)_(flag) |
| 36 |
|
|
* CS = Client/Server. |
| 37 |
|
|
* (command) is protocol command, ie ITEM |
| 38 |
|
|
* (flag) is the flag name |
| 39 |
|
|
*/ |
| 40 |
|
|
|
| 41 |
|
|
/* It is trivial to keep a link of copy of this file in the client |
| 42 |
|
|
* or server area. But keeping one common file should make things |
| 43 |
|
|
* more reliable, as both the client and server will definately be |
| 44 |
|
|
* talking about the same values. |
| 45 |
|
|
*/ |
| 46 |
|
|
|
| 47 |
|
|
|
| 48 |
|
|
#ifndef NEWCLIENT_H |
| 49 |
|
|
#define NEWCLIENT_H |
| 50 |
|
|
|
| 51 |
|
|
/* Maximum size of any packet we expect. Using this makes it so we don't need to |
| 52 |
root |
1.2 |
* allocated and deallocated the same buffer over and over again and the price |
| 53 |
|
|
* of using a bit of extra memory. It also makes the code simpler. |
| 54 |
root |
1.3 |
* |
| 55 |
|
|
* The size must be the same in the server and the client (stupid), and its also NOT |
| 56 |
|
|
* the maximum buffer size as one would expect, but the maximum buffer size + 1. |
| 57 |
root |
1.1 |
*/ |
| 58 |
|
|
#define MAXSOCKBUF 10240 |
| 59 |
|
|
|
| 60 |
|
|
|
| 61 |
|
|
#define CS_QUERY_YESNO 0x1 /* Yes/no question */ |
| 62 |
|
|
#define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */ |
| 63 |
|
|
#define CS_QUERY_HIDEINPUT 0x4 /* Hide input being entered */ |
| 64 |
|
|
|
| 65 |
|
|
#define CS_SAY_NORMAL 0x1 /* Normal say command */ |
| 66 |
|
|
#define CS_SAY_SHOUT 0x2 /* Text is shouted. */ |
| 67 |
|
|
#define CS_SAY_GSAY 0x4 /* Text is group say command */ |
| 68 |
|
|
|
| 69 |
|
|
/* These are multiplication values that should be used when changing |
| 70 |
|
|
* floats to ints, and vice version. MULTI is integer representatin |
| 71 |
|
|
* (float to int), MULTF is float, for going from int to float. |
| 72 |
|
|
*/ |
| 73 |
|
|
#define FLOAT_MULTI 100000 |
| 74 |
|
|
#define FLOAT_MULTF 100000.0 |
| 75 |
|
|
|
| 76 |
|
|
/* ID's for the various stats that get sent across. */ |
| 77 |
|
|
|
| 78 |
|
|
#define CS_STAT_HP 1 |
| 79 |
|
|
#define CS_STAT_MAXHP 2 |
| 80 |
|
|
#define CS_STAT_SP 3 |
| 81 |
|
|
#define CS_STAT_MAXSP 4 |
| 82 |
|
|
#define CS_STAT_STR 5 |
| 83 |
|
|
#define CS_STAT_INT 6 |
| 84 |
|
|
#define CS_STAT_WIS 7 |
| 85 |
|
|
#define CS_STAT_DEX 8 |
| 86 |
|
|
#define CS_STAT_CON 9 |
| 87 |
|
|
#define CS_STAT_CHA 10 |
| 88 |
|
|
#define CS_STAT_EXP 11 |
| 89 |
|
|
#define CS_STAT_LEVEL 12 |
| 90 |
|
|
#define CS_STAT_WC 13 |
| 91 |
|
|
#define CS_STAT_AC 14 |
| 92 |
|
|
#define CS_STAT_DAM 15 |
| 93 |
|
|
#define CS_STAT_ARMOUR 16 |
| 94 |
|
|
#define CS_STAT_SPEED 17 |
| 95 |
|
|
#define CS_STAT_FOOD 18 |
| 96 |
|
|
#define CS_STAT_WEAP_SP 19 |
| 97 |
|
|
#define CS_STAT_RANGE 20 |
| 98 |
|
|
#define CS_STAT_TITLE 21 |
| 99 |
|
|
#define CS_STAT_POW 22 |
| 100 |
|
|
#define CS_STAT_GRACE 23 |
| 101 |
|
|
#define CS_STAT_MAXGRACE 24 |
| 102 |
|
|
#define CS_STAT_FLAGS 25 |
| 103 |
|
|
#define CS_STAT_WEIGHT_LIM 26 |
| 104 |
|
|
#define CS_STAT_EXP64 28 |
| 105 |
|
|
#define CS_STAT_SPELL_ATTUNE 29 |
| 106 |
|
|
#define CS_STAT_SPELL_REPEL 30 |
| 107 |
|
|
#define CS_STAT_SPELL_DENY 31 |
| 108 |
|
|
|
| 109 |
|
|
/* Start & end of resistances, inclusive. */ |
| 110 |
|
|
#define CS_STAT_RESIST_START 100 |
| 111 |
|
|
#define CS_STAT_RESIST_END 117 |
| 112 |
|
|
#define CS_STAT_RES_PHYS 100 |
| 113 |
|
|
#define CS_STAT_RES_MAG 101 |
| 114 |
|
|
#define CS_STAT_RES_FIRE 102 |
| 115 |
|
|
#define CS_STAT_RES_ELEC 103 |
| 116 |
|
|
#define CS_STAT_RES_COLD 104 |
| 117 |
|
|
#define CS_STAT_RES_CONF 105 |
| 118 |
|
|
#define CS_STAT_RES_ACID 106 |
| 119 |
|
|
#define CS_STAT_RES_DRAIN 107 |
| 120 |
|
|
#define CS_STAT_RES_GHOSTHIT 108 |
| 121 |
|
|
#define CS_STAT_RES_POISON 109 |
| 122 |
|
|
#define CS_STAT_RES_SLOW 110 |
| 123 |
|
|
#define CS_STAT_RES_PARA 111 |
| 124 |
|
|
#define CS_STAT_TURN_UNDEAD 112 |
| 125 |
|
|
#define CS_STAT_RES_FEAR 113 |
| 126 |
|
|
#define CS_STAT_RES_DEPLETE 114 |
| 127 |
|
|
#define CS_STAT_RES_DEATH 115 |
| 128 |
|
|
#define CS_STAT_RES_HOLYWORD 116 |
| 129 |
|
|
#define CS_STAT_RES_BLIND 117 |
| 130 |
|
|
|
| 131 |
|
|
/* Start & end of skill experience + skill level, inclusive. */ |
| 132 |
|
|
#define CS_STAT_SKILLEXP_START 118 |
| 133 |
|
|
#define CS_STAT_SKILLEXP_END 129 |
| 134 |
|
|
#define CS_STAT_SKILLEXP_AGILITY 118 |
| 135 |
|
|
#define CS_STAT_SKILLEXP_AGLEVEL 119 |
| 136 |
|
|
#define CS_STAT_SKILLEXP_PERSONAL 120 |
| 137 |
|
|
#define CS_STAT_SKILLEXP_PELEVEL 121 |
| 138 |
|
|
#define CS_STAT_SKILLEXP_MENTAL 122 |
| 139 |
|
|
#define CS_STAT_SKILLEXP_MELEVEL 123 |
| 140 |
|
|
#define CS_STAT_SKILLEXP_PHYSIQUE 124 |
| 141 |
|
|
#define CS_STAT_SKILLEXP_PHLEVEL 125 |
| 142 |
|
|
#define CS_STAT_SKILLEXP_MAGIC 126 |
| 143 |
|
|
#define CS_STAT_SKILLEXP_MALEVEL 127 |
| 144 |
|
|
#define CS_STAT_SKILLEXP_WISDOM 128 |
| 145 |
|
|
#define CS_STAT_SKILLEXP_WILEVEL 129 |
| 146 |
|
|
|
| 147 |
|
|
/* CS_STAT_SKILLINFO is used as the starting index point. Skill number->name |
| 148 |
|
|
* map is generated dynamically for the client, so a bunch of entries will |
| 149 |
|
|
* be used here. CS_NUM_SKILLS does not match how many skills there really |
| 150 |
|
|
* are - instead, it is used as a range of values so that the client |
| 151 |
|
|
* can have some idea how many skill categories there may be. |
| 152 |
|
|
*/ |
| 153 |
|
|
#define CS_STAT_SKILLINFO 140 |
| 154 |
|
|
#define CS_NUM_SKILLS 50 |
| 155 |
|
|
|
| 156 |
|
|
/* These are used with CS_STAT_FLAGS above to communicate S->C what the |
| 157 |
|
|
* server thinks the fireon & runon states are. |
| 158 |
|
|
*/ |
| 159 |
|
|
#define SF_FIREON 0x01 |
| 160 |
|
|
#define SF_RUNON 0x02 |
| 161 |
|
|
|
| 162 |
|
|
/* The following are the color flags passed to new_draw_info. |
| 163 |
|
|
* |
| 164 |
|
|
* We also set up some control flags |
| 165 |
|
|
* |
| 166 |
|
|
* NDI = New Draw Info |
| 167 |
|
|
*/ |
| 168 |
|
|
|
| 169 |
|
|
/* Color specifications - note these match the order in xutil.c */ |
| 170 |
|
|
/* Note 2: Black, the default color, is 0. Thus, it does not need to |
| 171 |
|
|
* be implicitly specified. |
| 172 |
|
|
*/ |
| 173 |
|
|
#define NDI_BLACK 0 |
| 174 |
|
|
#define NDI_WHITE 1 |
| 175 |
|
|
#define NDI_NAVY 2 |
| 176 |
|
|
#define NDI_RED 3 |
| 177 |
|
|
#define NDI_ORANGE 4 |
| 178 |
|
|
#define NDI_BLUE 5 /* Actually, it is Dodger Blue */ |
| 179 |
|
|
#define NDI_DK_ORANGE 6 /* DarkOrange2 */ |
| 180 |
|
|
#define NDI_GREEN 7 /* SeaGreen */ |
| 181 |
|
|
#define NDI_LT_GREEN 8 /* DarkSeaGreen, which is actually paler */ |
| 182 |
root |
1.5 |
/* Than seagreen - also background color */ |
| 183 |
root |
1.1 |
#define NDI_GREY 9 |
| 184 |
|
|
#define NDI_BROWN 10 /* Sienna */ |
| 185 |
|
|
#define NDI_GOLD 11 |
| 186 |
|
|
#define NDI_TAN 12 /* Khaki */ |
| 187 |
|
|
|
| 188 |
|
|
#define NDI_MAX_COLOR 12 /* Last value in */ |
| 189 |
|
|
#define NDI_COLOR_MASK 0xff /* Gives lots of room for expansion - we are */ |
| 190 |
root |
1.5 |
/* using an int anyways, so we have the space */ |
| 191 |
|
|
/* to still do all the flags */ |
| 192 |
root |
1.1 |
|
| 193 |
|
|
|
| 194 |
|
|
#define NDI_UNIQUE 0x100 /* Print this out immediately, don't buffer */ |
| 195 |
|
|
#define NDI_ALL 0x200 /* Inform all players of this message */ |
| 196 |
|
|
|
| 197 |
|
|
/* Flags for the item command */ |
| 198 |
|
|
enum {a_none, a_readied, a_wielded, a_worn, a_active, a_applied}; |
| 199 |
|
|
#define F_APPLIED 0x000F |
| 200 |
|
|
#define F_LOCATION 0x00F0 |
| 201 |
|
|
#define F_UNPAID 0x0200 |
| 202 |
|
|
#define F_MAGIC 0x0400 |
| 203 |
|
|
#define F_CURSED 0x0800 |
| 204 |
|
|
#define F_DAMNED 0x1000 |
| 205 |
|
|
#define F_OPEN 0x2000 |
| 206 |
|
|
#define F_NOPICK 0x4000 |
| 207 |
|
|
#define F_LOCKED 0x8000 |
| 208 |
|
|
|
| 209 |
|
|
#define CF_FACE_NONE 0 |
| 210 |
|
|
#define CF_FACE_BITMAP 1 |
| 211 |
|
|
#define CF_FACE_XPM 2 |
| 212 |
|
|
#define CF_FACE_PNG 3 |
| 213 |
|
|
#define CF_FACE_CACHE 0x10 |
| 214 |
|
|
|
| 215 |
|
|
/* Used in the new_face structure on the magicmap field. Low bits |
| 216 |
|
|
* are color informatin. For now, only high bit information we need |
| 217 |
|
|
* is floor information. |
| 218 |
|
|
*/ |
| 219 |
|
|
#define FACE_FLOOR 0x80 |
| 220 |
|
|
#define FACE_WALL 0x40 /* Or'd into the color value by the server |
| 221 |
root |
1.5 |
* right before sending. |
| 222 |
|
|
*/ |
| 223 |
root |
1.1 |
#define FACE_COLOR_MASK 0xf |
| 224 |
|
|
|
| 225 |
|
|
#define UPD_LOCATION 0x01 |
| 226 |
|
|
#define UPD_FLAGS 0x02 |
| 227 |
|
|
#define UPD_WEIGHT 0x04 |
| 228 |
|
|
#define UPD_FACE 0x08 |
| 229 |
|
|
#define UPD_NAME 0x10 |
| 230 |
|
|
#define UPD_ANIM 0x20 |
| 231 |
|
|
#define UPD_ANIMSPEED 0x40 |
| 232 |
|
|
#define UPD_NROF 0x80 |
| 233 |
|
|
|
| 234 |
|
|
/* The flag values sent by the updspell command */ |
| 235 |
|
|
#define UPD_SP_MANA 0x01 |
| 236 |
|
|
#define UPD_SP_GRACE 0x02 |
| 237 |
|
|
#define UPD_SP_DAMAGE 0x04 |
| 238 |
|
|
|
| 239 |
|
|
#define SOUND_NORMAL 0 |
| 240 |
|
|
#define SOUND_SPELL 1 |
| 241 |
|
|
|
| 242 |
|
|
/* Contains the base information we use to make up a packet we want to send. */ |
| 243 |
root |
1.4 |
struct SockList { |
| 244 |
root |
1.1 |
int len; |
| 245 |
|
|
unsigned char *buf; |
| 246 |
root |
1.4 |
}; |
| 247 |
root |
1.1 |
|
| 248 |
root |
1.4 |
inline void SockList_AddChar (SockList *sl, char c) |
| 249 |
|
|
{ |
| 250 |
|
|
sl->buf[sl->len++]=c; |
| 251 |
|
|
} |
| 252 |
|
|
|
| 253 |
|
|
inline void SockList_AddShort (SockList *sl, unsigned short data) |
| 254 |
|
|
{ |
| 255 |
|
|
sl->buf[sl->len++] = data >> 8; |
| 256 |
|
|
sl->buf[sl->len++] = data; |
| 257 |
|
|
} |
| 258 |
|
|
|
| 259 |
|
|
struct CS_Stats { |
| 260 |
root |
1.1 |
int ibytes; /* ibytes, obytes are bytes in, out */ |
| 261 |
|
|
int obytes; |
| 262 |
|
|
short max_conn; /* Maximum connections received */ |
| 263 |
|
|
time_t time_start; /* When we started logging this */ |
| 264 |
root |
1.4 |
}; |
| 265 |
root |
1.1 |
|
| 266 |
|
|
extern CS_Stats cst_tot, cst_lst; |
| 267 |
|
|
|
| 268 |
|
|
#endif |