Crossfire Client, Branches  R11627
newclient.h
Go to the documentation of this file.
1 /*
2  * static char *rcsid_newclient_h =
3  * "$Id: newclient.h 6716 2007-06-27 18:57:31Z akirschbaum $";
4  */
5 
6 /*
7  CrossFire, A Multiplayer game for X-windows
8 
9  Copyright (C) 2002,2006 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 /* Ideally, this file should be the same between the server and
42  * the client. However, this often drifts apart because of a value
43  * that is only useful on the client and server. Generally, it isn't
44  * a problem to have a few extra #defines if this lets them stay
45  * in sync.
46  *
47  * Given this file contains the constants that dictate what is sent
48  * between the server and client, keeping them in sync makes doing changes
49  * easier - modify this file in one place, copy it over.
50  *
51  */
52 
53 
54 #ifndef NEWCLIENT_H
55 #define NEWCLIENT_H
56 
57 /* MAXSOCKRECVBUF and MAXSOCKSENDBUF are used on the server
58  * MAXSOCKBUF is used by the client.
59  */
60 
61 /* Maximum size of any packet we expect. This number includes both the length
62  * bytes (2 bytes) at the start of each packet and the trailing '\0' (1 byte)
63  * at the end of each packet.
64  */
65 #define MAXSOCKRECVBUF (2+65535+1)
66 
67 /* Maximum size of any packet we send. This number does not include the length
68  * bytes at the start of each packet. The value is chosen to not overflow the
69  * input buffer of old clients (2006-05-21).
70  */
71 #define MAXSOCKSENDBUF 10239
72 
73 /* Maximum size of any packet we expect. Using this makes it so we don't need to
74  * allocate and deallocate the same buffer over and over again and the price
75  * of using a bit of extra memory. It also makes the code simpler.
76  * The size is big enough to receive any valid packet: 2 bytes for length,
77  * 65535 for max. packet size, 1 for appended trailing '\0'.
78  */
79 #define MAXSOCKBUF (2+65535+1)
80 
81 
82 /* How much the x,y coordinates in the map2 are off from
83  * actual upper left corner. Necessary for light sources
84  * that may be off the edge of the visible map.
85  */
86 #define MAP2_COORD_OFFSET 15
87 
88 
89 #define CS_QUERY_YESNO 0x1 /* Yes/no question */
90 #define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */
91 #define CS_QUERY_HIDEINPUT 0x4 /* Hide input being entered */
92 
93 #define CS_SAY_NORMAL 0x1 /* Normal say command */
94 #define CS_SAY_SHOUT 0x2 /* Text is shouted. */
95 #define CS_SAY_GSAY 0x4 /* Text is group say command */
96 
97 /* These are multiplication values that should be used when changing
98  * floats to ints, and vice version. MULTI is integer representatin
99  * (float to int), MULTF is float, for going from int to float.
100  */
101 #define FLOAT_MULTI 100000
102 #define FLOAT_MULTF 100000.0
103 
104 /* ID's for the various stats that get sent across. */
105 
106 #define CS_STAT_HP 1
107 #define CS_STAT_MAXHP 2
108 #define CS_STAT_SP 3
109 #define CS_STAT_MAXSP 4
110 #define CS_STAT_STR 5
111 #define CS_STAT_INT 6
112 #define CS_STAT_WIS 7
113 #define CS_STAT_DEX 8
114 #define CS_STAT_CON 9
115 #define CS_STAT_CHA 10
116 #define CS_STAT_EXP 11
117 #define CS_STAT_LEVEL 12
118 #define CS_STAT_WC 13
119 #define CS_STAT_AC 14
120 #define CS_STAT_DAM 15
121 #define CS_STAT_ARMOUR 16
122 #define CS_STAT_SPEED 17
123 #define CS_STAT_FOOD 18
124 #define CS_STAT_WEAP_SP 19
125 #define CS_STAT_RANGE 20
126 #define CS_STAT_TITLE 21
127 #define CS_STAT_POW 22
128 #define CS_STAT_GRACE 23
129 #define CS_STAT_MAXGRACE 24
130 #define CS_STAT_FLAGS 25
131 #define CS_STAT_WEIGHT_LIM 26
132 #define CS_STAT_EXP64 28
133 #define CS_STAT_SPELL_ATTUNE 29
134 #define CS_STAT_SPELL_REPEL 30
135 #define CS_STAT_SPELL_DENY 31
136 
137 /* Start & end of resistances, inclusive. */
138 #define CS_STAT_RESIST_START 100
139 #define CS_STAT_RESIST_END 117
140 #define CS_STAT_RES_PHYS 100
141 #define CS_STAT_RES_MAG 101
142 #define CS_STAT_RES_FIRE 102
143 #define CS_STAT_RES_ELEC 103
144 #define CS_STAT_RES_COLD 104
145 #define CS_STAT_RES_CONF 105
146 #define CS_STAT_RES_ACID 106
147 #define CS_STAT_RES_DRAIN 107
148 #define CS_STAT_RES_GHOSTHIT 108
149 #define CS_STAT_RES_POISON 109
150 #define CS_STAT_RES_SLOW 110
151 #define CS_STAT_RES_PARA 111
152 #define CS_STAT_TURN_UNDEAD 112
153 #define CS_STAT_RES_FEAR 113
154 #define CS_STAT_RES_DEPLETE 114
155 #define CS_STAT_RES_DEATH 115
156 #define CS_STAT_RES_HOLYWORD 116
157 #define CS_STAT_RES_BLIND 117
158 
159 /* Start & end of skill experience + skill level, inclusive. */
160 #define CS_STAT_SKILLEXP_START 118
161 #define CS_STAT_SKILLEXP_END 129
162 #define CS_STAT_SKILLEXP_AGILITY 118
163 #define CS_STAT_SKILLEXP_AGLEVEL 119
164 #define CS_STAT_SKILLEXP_PERSONAL 120
165 #define CS_STAT_SKILLEXP_PELEVEL 121
166 #define CS_STAT_SKILLEXP_MENTAL 122
167 #define CS_STAT_SKILLEXP_MELEVEL 123
168 #define CS_STAT_SKILLEXP_PHYSIQUE 124
169 #define CS_STAT_SKILLEXP_PHLEVEL 125
170 #define CS_STAT_SKILLEXP_MAGIC 126
171 #define CS_STAT_SKILLEXP_MALEVEL 127
172 #define CS_STAT_SKILLEXP_WISDOM 128
173 #define CS_STAT_SKILLEXP_WILEVEL 129
174 
175 /* CS_STAT_SKILLINFO is used as the starting index point. Skill number->name
176  * map is generated dynamically for the client, so a bunch of entries will
177  * be used here. CS_NUM_SKILLS does not match how many skills there really
178  * are - instead, it is used as a range of values so that the client
179  * can have some idea how many skill categories there may be.
180  */
181 #define CS_STAT_SKILLINFO 140
182 #define CS_NUM_SKILLS 50
183 
184 /* These are used with CS_STAT_FLAGS above to communicate S->C what the
185  * server thinks the fireon & runon states are.
186  */
187 #define SF_FIREON 0x01
188 #define SF_RUNON 0x02
189 
190 /* The following are the color flags passed to new_draw_info.
191  *
192  * We also set up some control flags
193  *
194  * NDI = New Draw Info
195  */
196 
197 /* Color specifications - note these match the order in xutil.c */
198 /* Note 2: Black, the default color, is 0. Thus, it does not need to
199  * be implicitly specified.
200  */
201 #define NDI_BLACK 0
202 #define NDI_WHITE 1
203 #define NDI_NAVY 2
204 #define NDI_RED 3
205 #define NDI_ORANGE 4
206 #define NDI_BLUE 5 /* Actually, it is Dodger Blue */
207 #define NDI_DK_ORANGE 6 /* DarkOrange2 */
208 #define NDI_GREEN 7 /* SeaGreen */
209 #define NDI_LT_GREEN 8 /* DarkSeaGreen, which is actually paler */
210  /* Than seagreen - also background color */
211 #define NDI_GREY 9
212 #define NDI_BROWN 10 /* Sienna */
213 #define NDI_GOLD 11
214 #define NDI_TAN 12 /* Khaki */
215 
216 #define NDI_MAX_COLOR 12 /* Last value in */
217 #define NDI_COLOR_MASK 0xff /* Gives lots of room for expansion - we are */
218  /* using an int anyways, so we have the space */
219  /* to still do all the flags */
220 
221 
222 #define NDI_UNIQUE 0x100 /* Print this out immediately, don't buffer */
223 #define NDI_ALL 0x200 /* Inform all players of this message */
224 
225 /* Flags for the item command */
227 #define F_APPLIED 0x000F
228 #define F_LOCATION 0x00F0
229 #define F_UNPAID 0x0200
230 #define F_MAGIC 0x0400
231 #define F_CURSED 0x0800
232 #define F_DAMNED 0x1000
233 #define F_OPEN 0x2000
234 #define F_NOPICK 0x4000
235 #define F_LOCKED 0x8000
236 
237 #define CF_FACE_NONE 0
238 #define CF_FACE_BITMAP 1
239 #define CF_FACE_XPM 2
240 #define CF_FACE_PNG 3
241 #define CF_FACE_CACHE 0x10
242 
243 /* Used in the new_face structure on the magicmap field. Low bits
244  * are color informatin. For now, only high bit information we need
245  * is floor information.
246  */
247 #define FACE_FLOOR 0x80
248 #define FACE_WALL 0x40 /* Or'd into the color value by the server
249  * right before sending.
250  */
251 #define FACE_COLOR_MASK 0xf
252 
253 #define UPD_LOCATION 0x01
254 #define UPD_FLAGS 0x02
255 #define UPD_WEIGHT 0x04
256 #define UPD_FACE 0x08
257 #define UPD_NAME 0x10
258 #define UPD_ANIM 0x20
259 #define UPD_ANIMSPEED 0x40
260 #define UPD_NROF 0x80
261 
262 /* The flag values sent by the updspell command */
263 #define UPD_SP_MANA 0x01
264 #define UPD_SP_GRACE 0x02
265 #define UPD_SP_DAMAGE 0x04
266 
267 #define SOUND_NORMAL 0
268 #define SOUND_SPELL 1
269 
270 #define FACE_IS_ANIM 1<<15
271 #define ANIM_RANDOM 1<<13
272 #define ANIM_SYNC 2<<13
273 
274 /* ANIM_FLAGS_MASK and ANIM_MASK are only used by the client */
275 #define ANIM_FLAGS_MASK 0x6000
276 
277 /* AND'ing this with data from server gets us just the animation id */
278 #define ANIM_MASK 0x1fff
279 
280 
281 /* Constants in the form EMI_ is for extended map infos.
282  * Even if the client select the additionnal infos it wants
283  * on the map, there may exist cases where this whole info
284  * is not given in one buch but in separate bunches. This
285  * is done performance reasons (imagine some info related to
286  * a visible object and another info related to a 4 square
287  * width and height area). At the begin of an extended info packet
288  * is a bit field. A bit is activated for each extended info
289  * present in the data
290  */
291 /* Meanings:
292  * EMI_NOREDRAW Take extended infos into account but don't redraw,
293  * some additionnal datas will follow in a new packet
294  * EMI_SMOOTH Datas about smoothing
295  */
296 #define EMI_NOREDRAW 0x01
297 #define EMI_SMOOTH 0x02
298 
299 /* this last one says the bitfield continue un next byte
300  * There may be several on contiguous bytes. So there is 7
301  * actual bits used per byte, and the number of bytes
302  * is not fixed in protocol
303  */
304 #define EMI_HASMOREBITS 0x80
305 
306 
307 /*
308  * Note!
309  * If you add message types here, don't forget
310  * to keep the client up to date too!
311  */
312 
313 
314 /* message types */
315 #define MSG_TYPE_BOOK 1
316 #define MSG_TYPE_CARD 2
317 #define MSG_TYPE_PAPER 3
318 #define MSG_TYPE_SIGN 4
319 #define MSG_TYPE_MONUMENT 5
320 #define MSG_TYPE_DIALOG 6
321 #define MSG_TYPE_MOTD 7
322 #define MSG_TYPE_ADMIN 8
323 #define MSG_TYPE_SHOP 9
324 #define MSG_TYPE_COMMAND 10 /* Responses to commands, eg, who */
325 #define MSG_TYPE_ATTRIBUTE 11 /* Changes to attributes (stats, */
326  /* resistances, etc) */
327 #define MSG_TYPE_SKILL 12 /* Messages related to using skills */
328 #define MSG_TYPE_APPLY 13 /* Applying objects */
329 #define MSG_TYPE_ATTACK 14 /* Attack related messges */
330 #define MSG_TYPE_COMMUNICATION 15 /* Communication between players */
331 #define MSG_TYPE_SPELL 16 /* Spell related info */
332 #define MSG_TYPE_ITEM 17 /* Item related information */
333 #define MSG_TYPE_MISC 18 /* Messages that don't go anyplace else */
334 #define MSG_TYPE_VICTIM 19 /* Something bad is happening to the player */
335 #define MSG_TYPE_LAST 20
336 
337 #define MSG_SUBTYPE_NONE 0
338 
339 /* book messages subtypes */
340 #define MSG_TYPE_BOOK_CLASP_1 1
341 #define MSG_TYPE_BOOK_CLASP_2 2
342 #define MSG_TYPE_BOOK_ELEGANT_1 3
343 #define MSG_TYPE_BOOK_ELEGANT_2 4
344 #define MSG_TYPE_BOOK_QUARTO_1 5
345 #define MSG_TYPE_BOOK_QUARTO_2 6
346 #define MSG_TYPE_BOOK_SPELL_EVOKER 7
347 #define MSG_TYPE_BOOK_SPELL_PRAYER 8
348 #define MSG_TYPE_BOOK_SPELL_PYRO 9
349 #define MSG_TYPE_BOOK_SPELL_SORCERER 10
350 #define MSG_TYPE_BOOK_SPELL_SUMMONER 11
351 
352 /* card messages subtypes*/
353 #define MSG_TYPE_CARD_SIMPLE_1 1
354 #define MSG_TYPE_CARD_SIMPLE_2 2
355 #define MSG_TYPE_CARD_SIMPLE_3 3
356 #define MSG_TYPE_CARD_ELEGANT_1 4
357 #define MSG_TYPE_CARD_ELEGANT_2 5
358 #define MSG_TYPE_CARD_ELEGANT_3 6
359 #define MSG_TYPE_CARD_STRANGE_1 7
360 #define MSG_TYPE_CARD_STRANGE_2 8
361 #define MSG_TYPE_CARD_STRANGE_3 9
362 #define MSG_TYPE_CARD_MONEY_1 10
363 #define MSG_TYPE_CARD_MONEY_2 11
364 #define MSG_TYPE_CARD_MONEY_3 12
365 
366 /* Paper messages subtypes */
367 #define MSG_TYPE_PAPER_NOTE_1 1
368 #define MSG_TYPE_PAPER_NOTE_2 2
369 #define MSG_TYPE_PAPER_NOTE_3 3
370 #define MSG_TYPE_PAPER_LETTER_OLD_1 4
371 #define MSG_TYPE_PAPER_LETTER_OLD_2 5
372 #define MSG_TYPE_PAPER_LETTER_NEW_1 6
373 #define MSG_TYPE_PAPER_LETTER_NEW_2 7
374 #define MSG_TYPE_PAPER_ENVELOPE_1 8
375 #define MSG_TYPE_PAPER_ENVELOPE_2 9
376 #define MSG_TYPE_PAPER_SCROLL_OLD_1 10
377 #define MSG_TYPE_PAPER_SCROLL_OLD_2 11
378 #define MSG_TYPE_PAPER_SCROLL_NEW_1 12
379 #define MSG_TYPE_PAPER_SCROLL_NEW_2 13
380 #define MSG_TYPE_PAPER_SCROLL_MAGIC 14
381 
382 /* road signs messages subtypes */
383 #define MSG_TYPE_SIGN_BASIC 1
384 #define MSG_TYPE_SIGN_DIR_LEFT 2
385 #define MSG_TYPE_SIGN_DIR_RIGHT 3
386 #define MSG_TYPE_SIGN_DIR_BOTH 4
387 
388 /* stones and monument messages */
389 #define MSG_TYPE_MONUMENT_STONE_1 1
390 #define MSG_TYPE_MONUMENT_STONE_2 2
391 #define MSG_TYPE_MONUMENT_STONE_3 3
392 #define MSG_TYPE_MONUMENT_STATUE_1 4
393 #define MSG_TYPE_MONUMENT_STATUE_2 5
394 #define MSG_TYPE_MONUMENT_STATUE_3 6
395 #define MSG_TYPE_MONUMENT_GRAVESTONE_1 7
396 #define MSG_TYPE_MONUMENT_GRAVESTONE_2 8
397 #define MSG_TYPE_MONUMENT_GRAVESTONE_3 9
398 #define MSG_TYPE_MONUMENT_WALL_1 10
399 #define MSG_TYPE_MONUMENT_WALL_2 11
400 #define MSG_TYPE_MONUMENT_WALL_3 12
401 
402 /* dialog messsage */
403 #define MSG_TYPE_DIALOG_NPC 1 /* A message from the npc */
404 #define MSG_TYPE_DIALOG_ALTAR 2 /* A message from an altar */
405 #define MSG_TYPE_DIALOG_MAGIC_MOUTH 3 /* Magic Mouth/Magic Ear */
406 
407 /* MOTD doesn't have any subtypes */
408 
409 /* admin/global messages */
410 #define MSG_TYPE_ADMIN_RULES 1
411 #define MSG_TYPE_ADMIN_NEWS 2
412 #define MSG_TYPE_ADMIN_PLAYER 3 /* Player coming/going/death */
413 #define MSG_TYPE_ADMIN_DM 4 /* DM related admin actions */
414 #define MSG_TYPE_ADMIN_HISCORE 5 /* Hiscore list */
415 #define MSG_TYPE_ADMIN_LOADSAVE 6 /* load/save operations */
416 #define MSG_TYPE_ADMIN_LOGIN 7 /* login messages/errors */
417 #define MSG_TYPE_ADMIN_VERSION 8 /* version info */
418 
419 
420 /* I'm not actually expecting anything to make much use of the MSG_TYPE_SHOP
421  * values However, to use the media tags, need to use draw_ext_info, and need
422  * to have a type/subtype, so figured might as well put in real values here.
423  */
424 #define MSG_TYPE_SHOP_LISTING 1 /* Shop listings - inventory, */
425  /* what it deals in */
426 #define MSG_TYPE_SHOP_PAYMENT 2 /* Messages about payment, lack */
427  /* of funds */
428 #define MSG_TYPE_SHOP_SELL 3 /* Messages about selling items */
429 #define MSG_TYPE_SHOP_MISC 4 /* Random messages */
430 
431 /* Basically, 1 subtype/command. Like shops, not expecting much
432  * to be done, but by having different subtypes, it makes it easier for
433  * client to store way information (eg, who output)
434  */
435 #define MSG_TYPE_COMMAND_WHO 1
436 #define MSG_TYPE_COMMAND_MAPS 2
437 #define MSG_TYPE_COMMAND_BODY 3
438 #define MSG_TYPE_COMMAND_MALLOC 4
439 #define MSG_TYPE_COMMAND_WEATHER 5
440 #define MSG_TYPE_COMMAND_STATISTICS 6
441 #define MSG_TYPE_COMMAND_CONFIG 7 /* bowmode, petmode, applymode */
442 #define MSG_TYPE_COMMAND_INFO 8 /* Generic info - resistances, etc */
443 #define MSG_TYPE_COMMAND_QUESTS 9 /* Quest info */
444 #define MSG_TYPE_COMMAND_DEBUG 10 /* Various debug type commands */
445 #define MSG_TYPE_COMMAND_ERROR 11 /* Bad syntax/can't use command */
446 #define MSG_TYPE_COMMAND_SUCCESS 12 /* Successful result from command */
447 #define MSG_TYPE_COMMAND_FAILURE 13 /* Failed result from command */
448 #define MSG_TYPE_COMMAND_EXAMINE 14 /* Player examining something */
449 #define MSG_TYPE_COMMAND_INVENTORY 15 /* Inventory listing */
450 #define MSG_TYPE_COMMAND_HELP 16 /* Help related information */
451 #define MSG_TYPE_COMMAND_DM 17 /* DM related commands */
452 #define MSG_TYPE_COMMAND_NEWPLAYER 18 /* Create a new character - not */
453  /* really a command, but is responding */
454  /* to player input */
455 
456 /* This is somewhat verbose. If the client ends up being able to
457  * choose various attributes based on message type, I think it is important
458  * for the client to know if this is a benefit or detriment to the player.
459  * In the case of losing a bonus, this typically indicates a spell has
460  * ended, which is probably more important (and should be displayed more
461  * prominently) than when you cast the spell
462  */
463 
464 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN 1 /* Atacktypes here refer to */
465 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS 2 /* the player gaining or */
466  /* losing these attacktypes */
467  /* not being a victim of an */
468  /* attacktype. */
469 #define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN 3 /* Protections in this */
470 #define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS 4 /* context are pretty */
471  /* generic - things like */
472  /* reflection or lifesave */
473  /* are also under the */
474  /* protection category. */
475 #define MSG_TYPE_ATTRIBUTE_MOVE 5 /* A change in the movement */
476  /* type of the player */
477 #define MSG_TYPE_ATTRIBUTE_RACE 6 /* Racial related changes */
478 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START 7 /* The start/end of bad */
479 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END 8 /* effects to the player */
480 #define MSG_TYPE_ATTRIBUTE_STAT_GAIN 9 /* Start/end of stat changes */
481 #define MSG_TYPE_ATTRIBUTE_STAT_LOSS 10
482 #define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN 11 /* Gaining/losing of levels */
483 #define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS 12
484 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START 13 /* Like bad effects, but for */
485 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END 14 /* good effects to the player */
486 #define MSG_TYPE_ATTRIBUTE_GOD 15 /* changing god info */
487 
488 
489 /* I think one type/skill is overkill, so instead, use broader categories
490  * for these messages.
491  * The difference in ERROR vs FAILURE is basically this: ERROR indicates
492  * something wasn't right to even attempt to use the skill (don't have
493  * needed object, or haven't marked objects, etc).
494  * FAILURE indicates that player attempted to use the skill, but it
495  * didn't work.
496  * PRAY is listed out because praying over altars can generate some
497  * messages not really related to the skill itself.
498  */
499 #define MSG_TYPE_SKILL_MISSING 1 /* Don't have the skill */
500 #define MSG_TYPE_SKILL_ERROR 2 /* Doing something wrong */
501 #define MSG_TYPE_SKILL_SUCCESS 3 /* Successfully used skill */
502 #define MSG_TYPE_SKILL_FAILURE 4 /* Failure in using skill */
503 #define MSG_TYPE_SKILL_PRAY 5 /* Praying related messages */
504 #define MSG_TYPE_SKILL_LIST 6 /* List of skills */
505 
506 
507 /* Messages related to applying objects. Note that applying many
508  * objects may generate MSG_TYPE_ATTRIBUTE messages - the APPLY here
509  * more directly related to the direct messages related to applying
510  * them (you put on your armor, you apply scroll, etc).
511  * The ERROR is like that for SKILLS - something prevent even trying
512  * to apply the object. FAILURE indicates result wasn't successful.
513  */
514 #define MSG_TYPE_APPLY_ERROR 1
515 #define MSG_TYPE_APPLY_UNAPPLY 2 /* Unapply an object */
516 #define MSG_TYPE_APPLY_SUCCESS 3 /* Was able to apply object */
517 #define MSG_TYPE_APPLY_FAILURE 4 /* Apply OK, but no/bad result */
518 #define MSG_TYPE_APPLY_CURSED 5 /* Applied a cursed object (BAD) */
519 #define MSG_TYPE_APPLY_TRAP 6 /* Have activated a trap */
520 #define MSG_TYPE_APPLY_BADBODY 7 /* Don't have body to use object */
521 #define MSG_TYPE_APPLY_PROHIBITION 8 /* Class/god prohibiiton on obj */
522 #define MSG_TYPE_APPLY_BUILD 9 /* Build related actions */
523 
524 /* attack related messages */
525 #define MSG_TYPE_ATTACK_DID_HIT 1 /* Player hit something else */
526 #define MSG_TYPE_ATTACK_PET_HIT 2 /* Players pet hit something else */
527 #define MSG_TYPE_ATTACK_FUMBLE 3 /* Player fumbled attack */
528 #define MSG_TYPE_ATTACK_DID_KILL 4 /* Player killed something */
529 #define MSG_TYPE_ATTACK_PET_DIED 5 /* Pet was killed */
530 #define MSG_TYPE_ATTACK_NOKEY 6 /* Keys are like attacks, so... */
531 #define MSG_TYPE_ATTACK_NOATTACK 7 /* You avoid attacking */
532 #define MSG_TYPE_ATTACK_PUSHED 8 /* Pushed a friendly player */
533 
534 #define MSG_TYPE_COMMUNICATION_RANDOM 1 /* Random event (coin toss) */
535 #define MSG_TYPE_COMMUNICATION_SAY 2 /* Player says something */
536 #define MSG_TYPE_COMMUNICATION_ME 3 /* Player me's a message */
537 #define MSG_TYPE_COMMUNICATION_TELL 4 /* Player tells something */
538 #define MSG_TYPE_COMMUNICATION_EMOTE 5 /* Player emotes */
539 #define MSG_TYPE_COMMUNICATION_PARTY 6 /* Party message */
540 #define MSG_TYPE_COMMUNICATION_SHOUT 7 /* Party message */
541 #define MSG_TYPE_COMMUNICATION_CHAT 8 /* Party message */
542 
543 #define MSG_TYPE_SPELL_HEAL 1 /* Healing related spells */
544 #define MSG_TYPE_SPELL_PET 2 /* Pet related messages */
545 #define MSG_TYPE_SPELL_FAILURE 3 /* Spell failure messages */
546 #define MSG_TYPE_SPELL_END 4 /* A spell ends */
547 #define MSG_TYPE_SPELL_SUCCESS 5 /* Spell succeeded messages */
548 #define MSG_TYPE_SPELL_ERROR 6 /* Spell failure messages */
549 #define MSG_TYPE_SPELL_PERCEIVE_SELF 7 /* Perceive self messages */
550 #define MSG_TYPE_SPELL_TARGET 8 /* Target of non attack spell */
551 #define MSG_TYPE_SPELL_INFO 9 /* random info about spell, not */
552  /* related to failure/success */
553 
554 #define MSG_TYPE_ITEM_REMOVE 1 /* Item removed from inv */
555 #define MSG_TYPE_ITEM_ADD 2 /* Item added to inv */
556 #define MSG_TYPE_ITEM_CHANGE 3 /* Item has changed in some way */
557 #define MSG_TYPE_ITEM_INFO 3 /* Information related to an item */
558 
559 /* MSG_TYPE_MISC, by its very nature, doesn't really have subtypes. It is
560  * used for messages that really don't belong anyplace else
561  */
562 
563 #define MSG_TYPE_VICTIM_SWAMP 1 /* Player is sinking in a swamp */
564 #define MSG_TYPE_VICTIM_WAS_HIT 2 /* Player was hit by something */
565 #define MSG_TYPE_VICTIM_STEAL 3 /* Someone tried to steal from the player */
566 #define MSG_TYPE_VICTIM_SPELL 4 /* Someone cast a bad spell on the player */
567 #define MSG_TYPE_VICTIM_DIED 5 /* Player died! */
568 #define MSG_TYPE_VICTIM_WAS_PUSHED 6 /* Player was pushed or attempted pushed */
569 
570 /* Contains the base information we use to make up a packet we want to send. */
571 typedef struct SockList {
572  int len;
573  unsigned char *buf;
574 } SockList;
575 
576 typedef struct CS_Stats {
577  int ibytes; /* ibytes, obytes are bytes in, out */
578  int obytes;
579  short max_conn; /* Maximum connections received */
580  time_t time_start; /* When we started logging this */
581 } CS_Stats;
582 
583 
584 extern CS_Stats cst_tot, cst_lst;
585 
586 #endif /* NEWCLIENT_H */
int obytes
Definition: newclient.h:578
CS_Stats cst_lst
short max_conn
Definition: newclient.h:579
int ibytes
Definition: newclient.h:577
struct SockList SockList
unsigned char * buf
Definition: newclient.h:573
int len
Definition: newclient.h:572
CS_Stats cst_tot
time_t time_start
Definition: newclient.h:580
struct CS_Stats CS_Stats