Crossfire Client, Trunk  R19593
newclient.h
Go to the documentation of this file.
1 /*
2  * static char *rcsid_newclient_h =
3  * "$Id$";
4  */
5 
6 /*
7  CrossFire, A Multiplayer game for X-windows
8 
9  Copyright (C) 2002,2006,2010 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 
42 #ifndef NEWCLIENT_H
43 #define NEWCLIENT_H
44 
53 #define MAXSOCKBUF (2+65535+1)
54 
60 #define MAP2_COORD_OFFSET 15
61 
70 #define MAP2_TYPE_CLEAR 0x0
71 #define MAP2_TYPE_DARKNESS 0x1
72 /*
73  * These next two are not used presently, but the numbers are set aside for
74  * when support is added.
75  *
76  * #define MAP2_TYPE_SOUND 0x2
77  * #define MAP2_TYPE_LIGHTSOURCE 0x3
78  */
81 #define MAP2_LAYER_START 0x10
82 
92 #define MAP2_COORD_ENCODE(x, y, flags) ((((x)+MAP2_COORD_OFFSET)&0x3f)<<10|(((y)+MAP2_COORD_OFFSET)&0x3f)<<4|(flags&0x0f))
93 
94 #define CS_QUERY_YESNO 0x1
95 #define CS_QUERY_SINGLECHAR 0x2
96 #define CS_QUERY_HIDEINPUT 0x4
98 #define CS_SAY_NORMAL 0x1
99 #define CS_SAY_SHOUT 0x2
100 #define CS_SAY_GSAY 0x4
107 #define FLOAT_MULTI 100000
108 #define FLOAT_MULTF 100000.0
109 
115 #define CS_STAT_HP 1
116 #define CS_STAT_MAXHP 2
117 #define CS_STAT_SP 3
118 #define CS_STAT_MAXSP 4
119 #define CS_STAT_STR 5
120 #define CS_STAT_INT 6
121 #define CS_STAT_WIS 7
122 #define CS_STAT_DEX 8
123 #define CS_STAT_CON 9
124 #define CS_STAT_CHA 10
125 #define CS_STAT_EXP 11
126 #define CS_STAT_LEVEL 12
127 #define CS_STAT_WC 13
128 #define CS_STAT_AC 14
129 #define CS_STAT_DAM 15
130 #define CS_STAT_ARMOUR 16
131 #define CS_STAT_SPEED 17
132 #define CS_STAT_FOOD 18
133 #define CS_STAT_WEAP_SP 19
134 #define CS_STAT_RANGE 20
135 #define CS_STAT_TITLE 21
136 #define CS_STAT_POW 22
137 #define CS_STAT_GRACE 23
138 #define CS_STAT_MAXGRACE 24
139 #define CS_STAT_FLAGS 25
140 #define CS_STAT_WEIGHT_LIM 26
141 #define CS_STAT_EXP64 28
142 #define CS_STAT_SPELL_ATTUNE 29
143 #define CS_STAT_SPELL_REPEL 30
144 #define CS_STAT_SPELL_DENY 31
145 #define CS_STAT_RACE_STR 32
146 #define CS_STAT_RACE_INT 33
147 #define CS_STAT_RACE_WIS 34
148 #define CS_STAT_RACE_DEX 35
149 #define CS_STAT_RACE_CON 36
150 #define CS_STAT_RACE_CHA 37
151 #define CS_STAT_RACE_POW 38
152 #define CS_STAT_BASE_STR 39
153 #define CS_STAT_BASE_INT 40
154 #define CS_STAT_BASE_WIS 41
155 #define CS_STAT_BASE_DEX 42
156 #define CS_STAT_BASE_CON 43
157 #define CS_STAT_BASE_CHA 44
158 #define CS_STAT_BASE_POW 45
159 #define CS_STAT_APPLIED_STR 46
160 #define CS_STAT_APPLIED_INT 47
161 #define CS_STAT_APPLIED_WIS 48
162 #define CS_STAT_APPLIED_DEX 49
163 #define CS_STAT_APPLIED_CON 50
164 #define CS_STAT_APPLIED_CHA 51
165 #define CS_STAT_APPLIED_POW 52
166 #define CS_STAT_GOLEM_HP 53
167 #define CS_STAT_GOLEM_MAXHP 54
169 #define CS_STAT_RESIST_START 100
170 #define CS_STAT_RESIST_END 117
172 #define CS_STAT_RES_PHYS 100
173 #define CS_STAT_RES_MAG 101
174 #define CS_STAT_RES_FIRE 102
175 #define CS_STAT_RES_ELEC 103
176 #define CS_STAT_RES_COLD 104
177 #define CS_STAT_RES_CONF 105
178 #define CS_STAT_RES_ACID 106
179 #define CS_STAT_RES_DRAIN 107
180 #define CS_STAT_RES_GHOSTHIT 108
181 #define CS_STAT_RES_POISON 109
182 #define CS_STAT_RES_SLOW 110
183 #define CS_STAT_RES_PARA 111
184 #define CS_STAT_TURN_UNDEAD 112
185 #define CS_STAT_RES_FEAR 113
186 #define CS_STAT_RES_DEPLETE 114
187 #define CS_STAT_RES_DEATH 115
188 #define CS_STAT_RES_HOLYWORD 116
189 #define CS_STAT_RES_BLIND 117
190 
196 #define CS_STAT_SKILLINFO 140
197 
203 #define CS_NUM_SKILLS 50
204 
213 #define SF_FIREON 0x01
214 #define SF_RUNON 0x02
215 
224 #define ACL_NAME 1
225 #define ACL_CLASS 2
226 #define ACL_RACE 3
227 #define ACL_LEVEL 4
228 #define ACL_FACE 5
229 #define ACL_PARTY 6
230 #define ACL_MAP 7
231 #define ACL_FACE_NUM 8
232 
249 #define NDI_BLACK 0
250 #define NDI_WHITE 1
251 #define NDI_NAVY 2
252 #define NDI_RED 3
253 #define NDI_ORANGE 4
254 #define NDI_BLUE 5
255 #define NDI_DK_ORANGE 6
256 #define NDI_GREEN 7
257 #define NDI_LT_GREEN 8
259 #define NDI_GREY 9
260 #define NDI_BROWN 10
261 #define NDI_GOLD 11
262 #define NDI_TAN 12
263 #define NDI_MAX_COLOR 12
265 #define NDI_COLOR_MASK 0xff
269 #define NDI_UNIQUE 0x100
270 #define NDI_ALL 0x200
271 #define NDI_ALL_DMS 0x400
280 
281 #define F_APPLIED 0x000F
282 #define F_UNIDENTIFIED 0x0010
283 #define F_UNPAID 0x0200
284 #define F_MAGIC 0x0400
285 #define F_CURSED 0x0800
286 #define F_DAMNED 0x1000
287 #define F_OPEN 0x2000
288 #define F_NOPICK 0x4000
289 #define F_LOCKED 0x8000
290 #define F_BLESSED 0x0100
300 #define FACE_FLOOR 0x80
301 #define FACE_WALL 0x40
303 #define FACE_COLOR_MASK 0xf
304 
311 #define UPD_LOCATION 0x01
312 #define UPD_FLAGS 0x02
313 #define UPD_WEIGHT 0x04
314 #define UPD_FACE 0x08
315 #define UPD_NAME 0x10
316 #define UPD_ANIM 0x20
317 #define UPD_ANIMSPEED 0x40
318 #define UPD_NROF 0x80
319 #define UPD_ALL 0xFF
321 #define UPD_SP_MANA 0x01
322 #define UPD_SP_GRACE 0x02
323 #define UPD_SP_DAMAGE 0x04
326 
331 #define SOUND_NORMAL 0
332 #define SOUND_SPELL 1
333 
340 #define FACE_IS_ANIM 1<<15
341 #define ANIM_RANDOM 1<<13
342 #define ANIM_SYNC 2<<13
343 
344 #define ANIM_FLAGS_MASK 0x6000
350 #define ANIM_MASK 0x1fff
351 
367 #define EMI_NOREDRAW 0x01
368 
371 #define EMI_SMOOTH 0x02
372 
377 #define EMI_HASMOREBITS 0x80
378 
380 /*
381  * Note!
382  * When adding message types, don't forget to keep the client up to date too!
383  */
384 
389 #define MSG_TYPE_BOOK 1
390 #define MSG_TYPE_CARD 2
391 #define MSG_TYPE_PAPER 3
392 #define MSG_TYPE_SIGN 4
393 #define MSG_TYPE_MONUMENT 5
394 #define MSG_TYPE_DIALOG 6
395 #define MSG_TYPE_MOTD 7
396 #define MSG_TYPE_ADMIN 8
397 #define MSG_TYPE_SHOP 9
398 #define MSG_TYPE_COMMAND 10
399 #define MSG_TYPE_ATTRIBUTE 11
401 #define MSG_TYPE_SKILL 12
402 #define MSG_TYPE_APPLY 13
403 #define MSG_TYPE_ATTACK 14
404 #define MSG_TYPE_COMMUNICATION 15
405 #define MSG_TYPE_SPELL 16
406 #define MSG_TYPE_ITEM 17
407 #define MSG_TYPE_MISC 18
409 #define MSG_TYPE_VICTIM 19
411 #define MSG_TYPE_CLIENT 20
412 #define MSG_TYPE_LAST 21
414 #define MSG_SUBTYPE_NONE 0
415 
416 /* book messages subtypes */
417 #define MSG_TYPE_BOOK_CLASP_1 1
418 #define MSG_TYPE_BOOK_CLASP_2 2
419 #define MSG_TYPE_BOOK_ELEGANT_1 3
420 #define MSG_TYPE_BOOK_ELEGANT_2 4
421 #define MSG_TYPE_BOOK_QUARTO_1 5
422 #define MSG_TYPE_BOOK_QUARTO_2 6
423 #define MSG_TYPE_BOOK_SPELL_EVOKER 7
424 #define MSG_TYPE_BOOK_SPELL_PRAYER 8
425 #define MSG_TYPE_BOOK_SPELL_PYRO 9
426 #define MSG_TYPE_BOOK_SPELL_SORCERER 10
427 #define MSG_TYPE_BOOK_SPELL_SUMMONER 11
429 /* card messages subtypes*/
430 #define MSG_TYPE_CARD_SIMPLE_1 1
431 #define MSG_TYPE_CARD_SIMPLE_2 2
432 #define MSG_TYPE_CARD_SIMPLE_3 3
433 #define MSG_TYPE_CARD_ELEGANT_1 4
434 #define MSG_TYPE_CARD_ELEGANT_2 5
435 #define MSG_TYPE_CARD_ELEGANT_3 6
436 #define MSG_TYPE_CARD_STRANGE_1 7
437 #define MSG_TYPE_CARD_STRANGE_2 8
438 #define MSG_TYPE_CARD_STRANGE_3 9
439 #define MSG_TYPE_CARD_MONEY_1 10
440 #define MSG_TYPE_CARD_MONEY_2 11
441 #define MSG_TYPE_CARD_MONEY_3 12
443 /* Paper messages subtypes */
444 #define MSG_TYPE_PAPER_NOTE_1 1
445 #define MSG_TYPE_PAPER_NOTE_2 2
446 #define MSG_TYPE_PAPER_NOTE_3 3
447 #define MSG_TYPE_PAPER_LETTER_OLD_1 4
448 #define MSG_TYPE_PAPER_LETTER_OLD_2 5
449 #define MSG_TYPE_PAPER_LETTER_NEW_1 6
450 #define MSG_TYPE_PAPER_LETTER_NEW_2 7
451 #define MSG_TYPE_PAPER_ENVELOPE_1 8
452 #define MSG_TYPE_PAPER_ENVELOPE_2 9
453 #define MSG_TYPE_PAPER_SCROLL_OLD_1 10
454 #define MSG_TYPE_PAPER_SCROLL_OLD_2 11
455 #define MSG_TYPE_PAPER_SCROLL_NEW_1 12
456 #define MSG_TYPE_PAPER_SCROLL_NEW_2 13
457 #define MSG_TYPE_PAPER_SCROLL_MAGIC 14
459 /* road signs messages subtypes */ /* Including magic mouths */
460 #define MSG_TYPE_SIGN_BASIC 1
461 #define MSG_TYPE_SIGN_DIR_LEFT 2
462 #define MSG_TYPE_SIGN_DIR_RIGHT 3
463 #define MSG_TYPE_SIGN_DIR_BOTH 4
464 #define MSG_TYPE_SIGN_MAGIC_MOUTH 5
466 /* stones and monument messages */
467 #define MSG_TYPE_MONUMENT_STONE_1 1
468 #define MSG_TYPE_MONUMENT_STONE_2 2
469 #define MSG_TYPE_MONUMENT_STONE_3 3
470 #define MSG_TYPE_MONUMENT_STATUE_1 4
471 #define MSG_TYPE_MONUMENT_STATUE_2 5
472 #define MSG_TYPE_MONUMENT_STATUE_3 6
473 #define MSG_TYPE_MONUMENT_GRAVESTONE_1 7
474 #define MSG_TYPE_MONUMENT_GRAVESTONE_2 8
475 #define MSG_TYPE_MONUMENT_GRAVESTONE_3 9
476 #define MSG_TYPE_MONUMENT_WALL_1 10
477 #define MSG_TYPE_MONUMENT_WALL_2 11
478 #define MSG_TYPE_MONUMENT_WALL_3 12
480 /* dialog message */
481 #define MSG_TYPE_DIALOG_NPC 1
482 #define MSG_TYPE_DIALOG_ALTAR 2
483 #define MSG_TYPE_DIALOG_MAGIC_EAR 3
485 /* MOTD doesn't have any subtypes */
487 /* admin/global messages */
488 #define MSG_TYPE_ADMIN_RULES 1
489 #define MSG_TYPE_ADMIN_NEWS 2
490 #define MSG_TYPE_ADMIN_PLAYER 3
491 #define MSG_TYPE_ADMIN_DM 4
492 #define MSG_TYPE_ADMIN_HISCORE 5
493 #define MSG_TYPE_ADMIN_LOADSAVE 6
494 #define MSG_TYPE_ADMIN_LOGIN 7
495 #define MSG_TYPE_ADMIN_VERSION 8
496 #define MSG_TYPE_ADMIN_ERROR 9
497 /*
498  * I'm not actually expecting anything to make much use of the MSG_TYPE_SHOP
499  * values However, to use the media tags, need to use draw_ext_info, and need
500  * to have a type/subtype, so figured might as well put in real values here.
501  */
502 #define MSG_TYPE_SHOP_LISTING 1
504 #define MSG_TYPE_SHOP_PAYMENT 2
506 #define MSG_TYPE_SHOP_SELL 3
507 #define MSG_TYPE_SHOP_MISC 4
508 /*
509  * Basically, 1 subtype/command. Like shops, not expecting much to be done,
510  * but by having different subtypes, it makes it easier for client to store
511  * way information (eg, who output)
512  */
513 #define MSG_TYPE_COMMAND_WHO 1
514 #define MSG_TYPE_COMMAND_MAPS 2
515 #define MSG_TYPE_COMMAND_BODY 3
516 #define MSG_TYPE_COMMAND_MALLOC 4
517 #define MSG_TYPE_COMMAND_WEATHER 5
518 #define MSG_TYPE_COMMAND_STATISTICS 6
519 #define MSG_TYPE_COMMAND_CONFIG 7
520 #define MSG_TYPE_COMMAND_INFO 8
521 #define MSG_TYPE_COMMAND_QUESTS 9
522 #define MSG_TYPE_COMMAND_DEBUG 10
523 #define MSG_TYPE_COMMAND_ERROR 11
524 #define MSG_TYPE_COMMAND_SUCCESS 12
525 #define MSG_TYPE_COMMAND_FAILURE 13
526 #define MSG_TYPE_COMMAND_EXAMINE 14
527 #define MSG_TYPE_COMMAND_INVENTORY 15
528 #define MSG_TYPE_COMMAND_HELP 16
529 #define MSG_TYPE_COMMAND_DM 17
530 #define MSG_TYPE_COMMAND_NEWPLAYER 18
535 /* This is somewhat verbose. If the client ends up being able to
536  * choose various attributes based on message type, I think it is important
537  * for the client to know if this is a benefit or detriment to the player.
538  * In the case of losing a bonus, this typically indicates a spell has
539  * ended, which is probably more important (and should be displayed more
540  * prominently) than when you cast the spell
541  */
542 
543 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN 1
544 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS 2
549 #define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN 3
550 #define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS 4
556 #define MSG_TYPE_ATTRIBUTE_MOVE 5
558 #define MSG_TYPE_ATTRIBUTE_RACE 6
559 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START 7
561 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END 8
562 #define MSG_TYPE_ATTRIBUTE_STAT_GAIN 9
563 #define MSG_TYPE_ATTRIBUTE_STAT_LOSS 10
564 #define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN 11
565 #define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS 12
566 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START 13
568 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END 14
569 #define MSG_TYPE_ATTRIBUTE_GOD 15
571 /* I think one type/skill is overkill, so instead, use broader categories
572  * for these messages.
573  * The difference in ERROR vs FAILURE is basically this: ERROR indicates
574  * something wasn't right to even attempt to use the skill (don't have
575  * needed object, or haven't marked objects, etc).
576  * FAILURE indicates that player attempted to use the skill, but it
577  * didn't work.
578  * PRAY is listed out because praying over altars can generate some
579  * messages not really related to the skill itself.
580  */
581 #define MSG_TYPE_SKILL_MISSING 1
582 #define MSG_TYPE_SKILL_ERROR 2
583 #define MSG_TYPE_SKILL_SUCCESS 3
584 #define MSG_TYPE_SKILL_FAILURE 4
585 #define MSG_TYPE_SKILL_PRAY 5
586 #define MSG_TYPE_SKILL_LIST 6
588 /* Messages related to applying objects. Note that applying many objects may
589  * generate MSG_TYPE_ATTRIBUTE messages - the APPLY here more directly related
590  * to the direct messages related to applying them (you put on your armor, you
591  * apply scroll, etc). The ERROR is like that for SKILLS - something prevent
592  * even trying to apply the object. FAILURE indicates result wasn't
593  * successful.
594  */
595 #define MSG_TYPE_APPLY_ERROR 1
596 #define MSG_TYPE_APPLY_UNAPPLY 2
597 #define MSG_TYPE_APPLY_SUCCESS 3
598 #define MSG_TYPE_APPLY_FAILURE 4
599 #define MSG_TYPE_APPLY_CURSED 5
600 #define MSG_TYPE_APPLY_TRAP 6
601 #define MSG_TYPE_APPLY_BADBODY 7
602 #define MSG_TYPE_APPLY_PROHIBITION 8
603 #define MSG_TYPE_APPLY_BUILD 9
605 /* attack related messages */
606 #define MSG_TYPE_ATTACK_DID_HIT 1
607 #define MSG_TYPE_ATTACK_PET_HIT 2
608 #define MSG_TYPE_ATTACK_FUMBLE 3
609 #define MSG_TYPE_ATTACK_DID_KILL 4
610 #define MSG_TYPE_ATTACK_PET_DIED 5
611 #define MSG_TYPE_ATTACK_NOKEY 6
612 #define MSG_TYPE_ATTACK_NOATTACK 7
613 #define MSG_TYPE_ATTACK_PUSHED 8
614 #define MSG_TYPE_ATTACK_MISS 9
616 #define MSG_TYPE_COMMUNICATION_RANDOM 1
617 #define MSG_TYPE_COMMUNICATION_SAY 2
618 #define MSG_TYPE_COMMUNICATION_ME 3
619 #define MSG_TYPE_COMMUNICATION_TELL 4
620 #define MSG_TYPE_COMMUNICATION_EMOTE 5
621 #define MSG_TYPE_COMMUNICATION_PARTY 6
622 #define MSG_TYPE_COMMUNICATION_SHOUT 7
623 #define MSG_TYPE_COMMUNICATION_CHAT 8
625 #define MSG_TYPE_SPELL_HEAL 1
626 #define MSG_TYPE_SPELL_PET 2
627 #define MSG_TYPE_SPELL_FAILURE 3
628 #define MSG_TYPE_SPELL_END 4
629 #define MSG_TYPE_SPELL_SUCCESS 5
630 #define MSG_TYPE_SPELL_ERROR 6
631 #define MSG_TYPE_SPELL_PERCEIVE_SELF 7
632 #define MSG_TYPE_SPELL_TARGET 8
633 #define MSG_TYPE_SPELL_INFO 9
636 #define MSG_TYPE_ITEM_REMOVE 1
637 #define MSG_TYPE_ITEM_ADD 2
638 #define MSG_TYPE_ITEM_CHANGE 3
639 #define MSG_TYPE_ITEM_INFO 4
640 /*
641  * MSG_TYPE_MISC, by its very nature, doesn't really have subtypes. It is
642  * used for messages that really don't belong anyplace else
643  */
644 #define MSG_TYPE_VICTIM_SWAMP 1
645 #define MSG_TYPE_VICTIM_WAS_HIT 2
646 #define MSG_TYPE_VICTIM_STEAL 3
648 #define MSG_TYPE_VICTIM_SPELL 4
650 #define MSG_TYPE_VICTIM_DIED 5
651 #define MSG_TYPE_VICTIM_WAS_PUSHED 6
654 #define MSG_TYPE_CLIENT_CONFIG 1
655 #define MSG_TYPE_CLIENT_SERVER 2
656 #define MSG_TYPE_CLIENT_COMMAND 3
657 #define MSG_TYPE_CLIENT_QUERY 4
658 #define MSG_TYPE_CLIENT_DEBUG 5
659 #define MSG_TYPE_CLIENT_NOTICE 6
660 #define MSG_TYPE_CLIENT_METASERVER 7
661 #define MSG_TYPE_CLIENT_SCRIPT 8
662 #define MSG_TYPE_CLIENT_ERROR 9
668 #define INFO_MAP_ARCH_NAME 1
669 #define INFO_MAP_NAME 2
670 #define INFO_MAP_DESCRIPTION 3
675 typedef struct {
676 #ifdef CLIENT_TYPES_H /* Used by the client */
677  int len;
678  unsigned char *buf;
679 #else /* Used by the server */
680  size_t len;
681  unsigned char buf[MAXSOCKBUF]; /* 2(size)+65535(content)+1(ending NULL) */
682 #endif
683 } SockList;
688 typedef struct {
689  int ibytes;
690  int obytes;
691  short max_conn;
692  time_t time_start;
693 } CS_Stats;
694 
695 extern CS_Stats cst_tot, cst_lst;
696 
697 #endif /* NEWCLIENT_H */
CS_Stats cst_lst
CS_Stats cst_tot
#define MAXSOCKBUF
Maximum size of a packet the client expects to get and that the server can send.
Definition: newclient.h:53
Statistics on server.
Definition: newclient.h:718
Contains the base information we use to make up a packet we want to send.
Definition: newclient.h:705