1 |
root |
1.1 |
/* |
2 |
|
|
* static char *rcsid_newclient_h = |
3 |
|
|
* "$Id: newclient.h,v 1.12 2006/01/09 19:35:12 cavesomething Exp $"; |
4 |
|
|
*/ |
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 |
|
|
* allocated and deallocated teh same buffer over and over again and the price |
53 |
|
|
* of using a bit of extra memory. IT also makes the code simpler. |
54 |
|
|
*/ |
55 |
|
|
#define MAXSOCKBUF 10240 |
56 |
|
|
|
57 |
|
|
|
58 |
|
|
#define CS_QUERY_YESNO 0x1 /* Yes/no question */ |
59 |
|
|
#define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */ |
60 |
|
|
#define CS_QUERY_HIDEINPUT 0x4 /* Hide input being entered */ |
61 |
|
|
|
62 |
|
|
#define CS_SAY_NORMAL 0x1 /* Normal say command */ |
63 |
|
|
#define CS_SAY_SHOUT 0x2 /* Text is shouted. */ |
64 |
|
|
#define CS_SAY_GSAY 0x4 /* Text is group say command */ |
65 |
|
|
|
66 |
|
|
/* These are multiplication values that should be used when changing |
67 |
|
|
* floats to ints, and vice version. MULTI is integer representatin |
68 |
|
|
* (float to int), MULTF is float, for going from int to float. |
69 |
|
|
*/ |
70 |
|
|
#define FLOAT_MULTI 100000 |
71 |
|
|
#define FLOAT_MULTF 100000.0 |
72 |
|
|
|
73 |
|
|
/* ID's for the various stats that get sent across. */ |
74 |
|
|
|
75 |
|
|
#define CS_STAT_HP 1 |
76 |
|
|
#define CS_STAT_MAXHP 2 |
77 |
|
|
#define CS_STAT_SP 3 |
78 |
|
|
#define CS_STAT_MAXSP 4 |
79 |
|
|
#define CS_STAT_STR 5 |
80 |
|
|
#define CS_STAT_INT 6 |
81 |
|
|
#define CS_STAT_WIS 7 |
82 |
|
|
#define CS_STAT_DEX 8 |
83 |
|
|
#define CS_STAT_CON 9 |
84 |
|
|
#define CS_STAT_CHA 10 |
85 |
|
|
#define CS_STAT_EXP 11 |
86 |
|
|
#define CS_STAT_LEVEL 12 |
87 |
|
|
#define CS_STAT_WC 13 |
88 |
|
|
#define CS_STAT_AC 14 |
89 |
|
|
#define CS_STAT_DAM 15 |
90 |
|
|
#define CS_STAT_ARMOUR 16 |
91 |
|
|
#define CS_STAT_SPEED 17 |
92 |
|
|
#define CS_STAT_FOOD 18 |
93 |
|
|
#define CS_STAT_WEAP_SP 19 |
94 |
|
|
#define CS_STAT_RANGE 20 |
95 |
|
|
#define CS_STAT_TITLE 21 |
96 |
|
|
#define CS_STAT_POW 22 |
97 |
|
|
#define CS_STAT_GRACE 23 |
98 |
|
|
#define CS_STAT_MAXGRACE 24 |
99 |
|
|
#define CS_STAT_FLAGS 25 |
100 |
|
|
#define CS_STAT_WEIGHT_LIM 26 |
101 |
|
|
#define CS_STAT_EXP64 28 |
102 |
|
|
#define CS_STAT_SPELL_ATTUNE 29 |
103 |
|
|
#define CS_STAT_SPELL_REPEL 30 |
104 |
|
|
#define CS_STAT_SPELL_DENY 31 |
105 |
|
|
|
106 |
|
|
/* Start & end of resistances, inclusive. */ |
107 |
|
|
#define CS_STAT_RESIST_START 100 |
108 |
|
|
#define CS_STAT_RESIST_END 117 |
109 |
|
|
#define CS_STAT_RES_PHYS 100 |
110 |
|
|
#define CS_STAT_RES_MAG 101 |
111 |
|
|
#define CS_STAT_RES_FIRE 102 |
112 |
|
|
#define CS_STAT_RES_ELEC 103 |
113 |
|
|
#define CS_STAT_RES_COLD 104 |
114 |
|
|
#define CS_STAT_RES_CONF 105 |
115 |
|
|
#define CS_STAT_RES_ACID 106 |
116 |
|
|
#define CS_STAT_RES_DRAIN 107 |
117 |
|
|
#define CS_STAT_RES_GHOSTHIT 108 |
118 |
|
|
#define CS_STAT_RES_POISON 109 |
119 |
|
|
#define CS_STAT_RES_SLOW 110 |
120 |
|
|
#define CS_STAT_RES_PARA 111 |
121 |
|
|
#define CS_STAT_TURN_UNDEAD 112 |
122 |
|
|
#define CS_STAT_RES_FEAR 113 |
123 |
|
|
#define CS_STAT_RES_DEPLETE 114 |
124 |
|
|
#define CS_STAT_RES_DEATH 115 |
125 |
|
|
#define CS_STAT_RES_HOLYWORD 116 |
126 |
|
|
#define CS_STAT_RES_BLIND 117 |
127 |
|
|
|
128 |
|
|
/* Start & end of skill experience + skill level, inclusive. */ |
129 |
|
|
#define CS_STAT_SKILLEXP_START 118 |
130 |
|
|
#define CS_STAT_SKILLEXP_END 129 |
131 |
|
|
#define CS_STAT_SKILLEXP_AGILITY 118 |
132 |
|
|
#define CS_STAT_SKILLEXP_AGLEVEL 119 |
133 |
|
|
#define CS_STAT_SKILLEXP_PERSONAL 120 |
134 |
|
|
#define CS_STAT_SKILLEXP_PELEVEL 121 |
135 |
|
|
#define CS_STAT_SKILLEXP_MENTAL 122 |
136 |
|
|
#define CS_STAT_SKILLEXP_MELEVEL 123 |
137 |
|
|
#define CS_STAT_SKILLEXP_PHYSIQUE 124 |
138 |
|
|
#define CS_STAT_SKILLEXP_PHLEVEL 125 |
139 |
|
|
#define CS_STAT_SKILLEXP_MAGIC 126 |
140 |
|
|
#define CS_STAT_SKILLEXP_MALEVEL 127 |
141 |
|
|
#define CS_STAT_SKILLEXP_WISDOM 128 |
142 |
|
|
#define CS_STAT_SKILLEXP_WILEVEL 129 |
143 |
|
|
|
144 |
|
|
/* CS_STAT_SKILLINFO is used as the starting index point. Skill number->name |
145 |
|
|
* map is generated dynamically for the client, so a bunch of entries will |
146 |
|
|
* be used here. CS_NUM_SKILLS does not match how many skills there really |
147 |
|
|
* are - instead, it is used as a range of values so that the client |
148 |
|
|
* can have some idea how many skill categories there may be. |
149 |
|
|
*/ |
150 |
|
|
#define CS_STAT_SKILLINFO 140 |
151 |
|
|
#define CS_NUM_SKILLS 50 |
152 |
|
|
|
153 |
|
|
/* These are used with CS_STAT_FLAGS above to communicate S->C what the |
154 |
|
|
* server thinks the fireon & runon states are. |
155 |
|
|
*/ |
156 |
|
|
#define SF_FIREON 0x01 |
157 |
|
|
#define SF_RUNON 0x02 |
158 |
|
|
|
159 |
|
|
/* The following are the color flags passed to new_draw_info. |
160 |
|
|
* |
161 |
|
|
* We also set up some control flags |
162 |
|
|
* |
163 |
|
|
* NDI = New Draw Info |
164 |
|
|
*/ |
165 |
|
|
|
166 |
|
|
/* Color specifications - note these match the order in xutil.c */ |
167 |
|
|
/* Note 2: Black, the default color, is 0. Thus, it does not need to |
168 |
|
|
* be implicitly specified. |
169 |
|
|
*/ |
170 |
|
|
#define NDI_BLACK 0 |
171 |
|
|
#define NDI_WHITE 1 |
172 |
|
|
#define NDI_NAVY 2 |
173 |
|
|
#define NDI_RED 3 |
174 |
|
|
#define NDI_ORANGE 4 |
175 |
|
|
#define NDI_BLUE 5 /* Actually, it is Dodger Blue */ |
176 |
|
|
#define NDI_DK_ORANGE 6 /* DarkOrange2 */ |
177 |
|
|
#define NDI_GREEN 7 /* SeaGreen */ |
178 |
|
|
#define NDI_LT_GREEN 8 /* DarkSeaGreen, which is actually paler */ |
179 |
|
|
/* Than seagreen - also background color */ |
180 |
|
|
#define NDI_GREY 9 |
181 |
|
|
#define NDI_BROWN 10 /* Sienna */ |
182 |
|
|
#define NDI_GOLD 11 |
183 |
|
|
#define NDI_TAN 12 /* Khaki */ |
184 |
|
|
|
185 |
|
|
#define NDI_MAX_COLOR 12 /* Last value in */ |
186 |
|
|
#define NDI_COLOR_MASK 0xff /* Gives lots of room for expansion - we are */ |
187 |
|
|
/* using an int anyways, so we have the space */ |
188 |
|
|
/* to still do all the flags */ |
189 |
|
|
|
190 |
|
|
|
191 |
|
|
#define NDI_UNIQUE 0x100 /* Print this out immediately, don't buffer */ |
192 |
|
|
#define NDI_ALL 0x200 /* Inform all players of this message */ |
193 |
|
|
|
194 |
|
|
/* Flags for the item command */ |
195 |
|
|
enum {a_none, a_readied, a_wielded, a_worn, a_active, a_applied}; |
196 |
|
|
#define F_APPLIED 0x000F |
197 |
|
|
#define F_LOCATION 0x00F0 |
198 |
|
|
#define F_UNPAID 0x0200 |
199 |
|
|
#define F_MAGIC 0x0400 |
200 |
|
|
#define F_CURSED 0x0800 |
201 |
|
|
#define F_DAMNED 0x1000 |
202 |
|
|
#define F_OPEN 0x2000 |
203 |
|
|
#define F_NOPICK 0x4000 |
204 |
|
|
#define F_LOCKED 0x8000 |
205 |
|
|
|
206 |
|
|
#define CF_FACE_NONE 0 |
207 |
|
|
#define CF_FACE_BITMAP 1 |
208 |
|
|
#define CF_FACE_XPM 2 |
209 |
|
|
#define CF_FACE_PNG 3 |
210 |
|
|
#define CF_FACE_CACHE 0x10 |
211 |
|
|
|
212 |
|
|
/* Used in the new_face structure on the magicmap field. Low bits |
213 |
|
|
* are color informatin. For now, only high bit information we need |
214 |
|
|
* is floor information. |
215 |
|
|
*/ |
216 |
|
|
#define FACE_FLOOR 0x80 |
217 |
|
|
#define FACE_WALL 0x40 /* Or'd into the color value by the server |
218 |
|
|
* right before sending. |
219 |
|
|
*/ |
220 |
|
|
#define FACE_COLOR_MASK 0xf |
221 |
|
|
|
222 |
|
|
#define UPD_LOCATION 0x01 |
223 |
|
|
#define UPD_FLAGS 0x02 |
224 |
|
|
#define UPD_WEIGHT 0x04 |
225 |
|
|
#define UPD_FACE 0x08 |
226 |
|
|
#define UPD_NAME 0x10 |
227 |
|
|
#define UPD_ANIM 0x20 |
228 |
|
|
#define UPD_ANIMSPEED 0x40 |
229 |
|
|
#define UPD_NROF 0x80 |
230 |
|
|
|
231 |
|
|
/* The flag values sent by the updspell command */ |
232 |
|
|
#define UPD_SP_MANA 0x01 |
233 |
|
|
#define UPD_SP_GRACE 0x02 |
234 |
|
|
#define UPD_SP_DAMAGE 0x04 |
235 |
|
|
|
236 |
|
|
#define SOUND_NORMAL 0 |
237 |
|
|
#define SOUND_SPELL 1 |
238 |
|
|
|
239 |
|
|
/* Contains the base information we use to make up a packet we want to send. */ |
240 |
|
|
typedef struct SockList { |
241 |
|
|
int len; |
242 |
|
|
unsigned char *buf; |
243 |
|
|
} SockList; |
244 |
|
|
|
245 |
|
|
typedef struct CS_Stats { |
246 |
|
|
int ibytes; /* ibytes, obytes are bytes in, out */ |
247 |
|
|
int obytes; |
248 |
|
|
short max_conn; /* Maximum connections received */ |
249 |
|
|
time_t time_start; /* When we started logging this */ |
250 |
|
|
} CS_Stats; |
251 |
|
|
|
252 |
|
|
|
253 |
|
|
extern CS_Stats cst_tot, cst_lst; |
254 |
|
|
|
255 |
|
|
#endif |