Crossfire Server, Trunk  R20513
newclient.h
Go to the documentation of this file.
1 
14 #ifndef NEWCLIENT_H
15 #define NEWCLIENT_H
16 
25 #define MAXSOCKBUF (2+65535+1)
26 
32 #define MAP2_COORD_OFFSET 15
33 
42 #define MAP2_TYPE_CLEAR 0x0
43 #define MAP2_TYPE_DARKNESS 0x1
44 /*
45  * These next two are not used presently, but the numbers are set aside for
46  * when support is added.
47  *
48  * #define MAP2_TYPE_SOUND 0x2
49  * #define MAP2_TYPE_LIGHTSOURCE 0x3
50  */
53 #define MAP2_LAYER_START 0x10
54 
64 #define MAP2_COORD_ENCODE(x, y, flags) ((((x)+MAP2_COORD_OFFSET)&0x3f)<<10|(((y)+MAP2_COORD_OFFSET)&0x3f)<<4|(flags&0x0f))
65 
66 #define CS_QUERY_YESNO 0x1
67 #define CS_QUERY_SINGLECHAR 0x2
68 #define CS_QUERY_HIDEINPUT 0x4
70 #define CS_SAY_NORMAL 0x1
71 #define CS_SAY_SHOUT 0x2
72 #define CS_SAY_GSAY 0x4
79 #define FLOAT_MULTI 100000
80 #define FLOAT_MULTF 100000.0
81 
87 #define CS_STAT_HP 1
88 #define CS_STAT_MAXHP 2
89 #define CS_STAT_SP 3
90 #define CS_STAT_MAXSP 4
91 #define CS_STAT_STR 5
92 #define CS_STAT_INT 6
93 #define CS_STAT_WIS 7
94 #define CS_STAT_DEX 8
95 #define CS_STAT_CON 9
96 #define CS_STAT_CHA 10
97 #define CS_STAT_EXP 11
98 #define CS_STAT_LEVEL 12
99 #define CS_STAT_WC 13
100 #define CS_STAT_AC 14
101 #define CS_STAT_DAM 15
102 #define CS_STAT_ARMOUR 16
103 #define CS_STAT_SPEED 17
104 #define CS_STAT_FOOD 18
105 #define CS_STAT_WEAP_SP 19
106 #define CS_STAT_RANGE 20
107 #define CS_STAT_TITLE 21
108 #define CS_STAT_POW 22
109 #define CS_STAT_GRACE 23
110 #define CS_STAT_MAXGRACE 24
111 #define CS_STAT_FLAGS 25
112 #define CS_STAT_WEIGHT_LIM 26
113 #define CS_STAT_EXP64 28
114 #define CS_STAT_SPELL_ATTUNE 29
115 #define CS_STAT_SPELL_REPEL 30
116 #define CS_STAT_SPELL_DENY 31
117 #define CS_STAT_RACE_STR 32
118 #define CS_STAT_RACE_INT 33
119 #define CS_STAT_RACE_WIS 34
120 #define CS_STAT_RACE_DEX 35
121 #define CS_STAT_RACE_CON 36
122 #define CS_STAT_RACE_CHA 37
123 #define CS_STAT_RACE_POW 38
124 #define CS_STAT_BASE_STR 39
125 #define CS_STAT_BASE_INT 40
126 #define CS_STAT_BASE_WIS 41
127 #define CS_STAT_BASE_DEX 42
128 #define CS_STAT_BASE_CON 43
129 #define CS_STAT_BASE_CHA 44
130 #define CS_STAT_BASE_POW 45
131 #define CS_STAT_APPLIED_STR 46
132 #define CS_STAT_APPLIED_INT 47
133 #define CS_STAT_APPLIED_WIS 48
134 #define CS_STAT_APPLIED_DEX 49
135 #define CS_STAT_APPLIED_CON 50
136 #define CS_STAT_APPLIED_CHA 51
137 #define CS_STAT_APPLIED_POW 52
138 #define CS_STAT_GOLEM_HP 53
139 #define CS_STAT_GOLEM_MAXHP 54
141 #define CS_STAT_RESIST_START 100
142 #define CS_STAT_RESIST_END 117
144 #define CS_STAT_RES_PHYS 100
145 #define CS_STAT_RES_MAG 101
146 #define CS_STAT_RES_FIRE 102
147 #define CS_STAT_RES_ELEC 103
148 #define CS_STAT_RES_COLD 104
149 #define CS_STAT_RES_CONF 105
150 #define CS_STAT_RES_ACID 106
151 #define CS_STAT_RES_DRAIN 107
152 #define CS_STAT_RES_GHOSTHIT 108
153 #define CS_STAT_RES_POISON 109
154 #define CS_STAT_RES_SLOW 110
155 #define CS_STAT_RES_PARA 111
156 #define CS_STAT_TURN_UNDEAD 112
157 #define CS_STAT_RES_FEAR 113
158 #define CS_STAT_RES_DEPLETE 114
159 #define CS_STAT_RES_DEATH 115
160 #define CS_STAT_RES_HOLYWORD 116
161 #define CS_STAT_RES_BLIND 117
162 
168 #define CS_STAT_SKILLINFO 140
169 
175 #define CS_NUM_SKILLS 50
176 
185 #define SF_FIREON 0x01
186 #define SF_RUNON 0x02
187 
196 #define ACL_NAME 1
197 #define ACL_CLASS 2
198 #define ACL_RACE 3
199 #define ACL_LEVEL 4
200 #define ACL_FACE 5
201 #define ACL_PARTY 6
202 #define ACL_MAP 7
203 #define ACL_FACE_NUM 8
204 
221 #define NDI_BLACK 0
222 #define NDI_WHITE 1
223 #define NDI_NAVY 2
224 #define NDI_RED 3
225 #define NDI_ORANGE 4
226 #define NDI_BLUE 5
227 #define NDI_DK_ORANGE 6
228 #define NDI_GREEN 7
229 #define NDI_LT_GREEN 8
231 #define NDI_GREY 9
232 #define NDI_BROWN 10
233 #define NDI_GOLD 11
234 #define NDI_TAN 12
235 #define NDI_MAX_COLOR 12
237 #define NDI_COLOR_MASK 0xff
241 #define NDI_UNIQUE 0x100
242 #define NDI_ALL 0x200
243 #define NDI_ALL_DMS 0x400
252 
253 #define F_APPLIED 0x000F
254 #define F_UNIDENTIFIED 0x0010
255 #define F_UNPAID 0x0200
256 #define F_MAGIC 0x0400
257 #define F_CURSED 0x0800
258 #define F_DAMNED 0x1000
259 #define F_OPEN 0x2000
260 #define F_NOPICK 0x4000
261 #define F_LOCKED 0x8000
262 #define F_BLESSED 0x0100
272 #define FACE_FLOOR 0x80
273 #define FACE_WALL 0x40
275 #define FACE_COLOR_MASK 0xf
276 
283 #define UPD_LOCATION 0x01
284 #define UPD_FLAGS 0x02
285 #define UPD_WEIGHT 0x04
286 #define UPD_FACE 0x08
287 #define UPD_NAME 0x10
288 #define UPD_ANIM 0x20
289 #define UPD_ANIMSPEED 0x40
290 #define UPD_NROF 0x80
291 #define UPD_ALL 0xFF
293 #define UPD_SP_MANA 0x01
294 #define UPD_SP_GRACE 0x02
295 #define UPD_SP_DAMAGE 0x04
298 
302 #define SOUND_TYPE_LIVING 1
303 #define SOUND_TYPE_SPELL 2
304 #define SOUND_TYPE_ITEM 3
305 #define SOUND_TYPE_GROUND 4
306 #define SOUND_TYPE_HIT 5
307 #define SOUND_TYPE_HIT_BY 6
315 #define FACE_IS_ANIM 1<<15
316 #define ANIM_RANDOM 1<<13
317 #define ANIM_SYNC 2<<13
318 
319 #define ANIM_FLAGS_MASK 0x6000
325 #define ANIM_MASK 0x1fff
326 
342 #define EMI_NOREDRAW 0x01
343 
346 #define EMI_SMOOTH 0x02
347 
352 #define EMI_HASMOREBITS 0x80
353 
355 /*
356  * Note!
357  * When adding message types, don't forget to keep the client up to date too!
358  */
359 
364 #define MSG_TYPE_BOOK 1
365 #define MSG_TYPE_CARD 2
366 #define MSG_TYPE_PAPER 3
367 #define MSG_TYPE_SIGN 4
368 #define MSG_TYPE_MONUMENT 5
369 #define MSG_TYPE_DIALOG 6
370 #define MSG_TYPE_MOTD 7
371 #define MSG_TYPE_ADMIN 8
372 #define MSG_TYPE_SHOP 9
373 #define MSG_TYPE_COMMAND 10
374 #define MSG_TYPE_ATTRIBUTE 11
376 #define MSG_TYPE_SKILL 12
377 #define MSG_TYPE_APPLY 13
378 #define MSG_TYPE_ATTACK 14
379 #define MSG_TYPE_COMMUNICATION 15
380 #define MSG_TYPE_SPELL 16
381 #define MSG_TYPE_ITEM 17
382 #define MSG_TYPE_MISC 18
384 #define MSG_TYPE_VICTIM 19
386 #define MSG_TYPE_CLIENT 20
387 #define MSG_TYPE_LAST 21
389 #define MSG_SUBTYPE_NONE 0
390 
391 /* book messages subtypes */
392 #define MSG_TYPE_BOOK_CLASP_1 1
393 #define MSG_TYPE_BOOK_CLASP_2 2
394 #define MSG_TYPE_BOOK_ELEGANT_1 3
395 #define MSG_TYPE_BOOK_ELEGANT_2 4
396 #define MSG_TYPE_BOOK_QUARTO_1 5
397 #define MSG_TYPE_BOOK_QUARTO_2 6
398 #define MSG_TYPE_BOOK_SPELL_EVOKER 7
399 #define MSG_TYPE_BOOK_SPELL_PRAYER 8
400 #define MSG_TYPE_BOOK_SPELL_PYRO 9
401 #define MSG_TYPE_BOOK_SPELL_SORCERER 10
402 #define MSG_TYPE_BOOK_SPELL_SUMMONER 11
404 /* card messages subtypes*/
405 #define MSG_TYPE_CARD_SIMPLE_1 1
406 #define MSG_TYPE_CARD_SIMPLE_2 2
407 #define MSG_TYPE_CARD_SIMPLE_3 3
408 #define MSG_TYPE_CARD_ELEGANT_1 4
409 #define MSG_TYPE_CARD_ELEGANT_2 5
410 #define MSG_TYPE_CARD_ELEGANT_3 6
411 #define MSG_TYPE_CARD_STRANGE_1 7
412 #define MSG_TYPE_CARD_STRANGE_2 8
413 #define MSG_TYPE_CARD_STRANGE_3 9
414 #define MSG_TYPE_CARD_MONEY_1 10
415 #define MSG_TYPE_CARD_MONEY_2 11
416 #define MSG_TYPE_CARD_MONEY_3 12
418 /* Paper messages subtypes */
419 #define MSG_TYPE_PAPER_NOTE_1 1
420 #define MSG_TYPE_PAPER_NOTE_2 2
421 #define MSG_TYPE_PAPER_NOTE_3 3
422 #define MSG_TYPE_PAPER_LETTER_OLD_1 4
423 #define MSG_TYPE_PAPER_LETTER_OLD_2 5
424 #define MSG_TYPE_PAPER_LETTER_NEW_1 6
425 #define MSG_TYPE_PAPER_LETTER_NEW_2 7
426 #define MSG_TYPE_PAPER_ENVELOPE_1 8
427 #define MSG_TYPE_PAPER_ENVELOPE_2 9
428 #define MSG_TYPE_PAPER_SCROLL_OLD_1 10
429 #define MSG_TYPE_PAPER_SCROLL_OLD_2 11
430 #define MSG_TYPE_PAPER_SCROLL_NEW_1 12
431 #define MSG_TYPE_PAPER_SCROLL_NEW_2 13
432 #define MSG_TYPE_PAPER_SCROLL_MAGIC 14
434 /* road signs messages subtypes */ /* Including magic mouths */
435 #define MSG_TYPE_SIGN_BASIC 1
436 #define MSG_TYPE_SIGN_DIR_LEFT 2
437 #define MSG_TYPE_SIGN_DIR_RIGHT 3
438 #define MSG_TYPE_SIGN_DIR_BOTH 4
439 #define MSG_TYPE_SIGN_MAGIC_MOUTH 5
441 /* stones and monument messages */
442 #define MSG_TYPE_MONUMENT_STONE_1 1
443 #define MSG_TYPE_MONUMENT_STONE_2 2
444 #define MSG_TYPE_MONUMENT_STONE_3 3
445 #define MSG_TYPE_MONUMENT_STATUE_1 4
446 #define MSG_TYPE_MONUMENT_STATUE_2 5
447 #define MSG_TYPE_MONUMENT_STATUE_3 6
448 #define MSG_TYPE_MONUMENT_GRAVESTONE_1 7
449 #define MSG_TYPE_MONUMENT_GRAVESTONE_2 8
450 #define MSG_TYPE_MONUMENT_GRAVESTONE_3 9
451 #define MSG_TYPE_MONUMENT_WALL_1 10
452 #define MSG_TYPE_MONUMENT_WALL_2 11
453 #define MSG_TYPE_MONUMENT_WALL_3 12
455 /* dialog message */
456 #define MSG_TYPE_DIALOG_NPC 1
457 #define MSG_TYPE_DIALOG_ALTAR 2
458 #define MSG_TYPE_DIALOG_MAGIC_EAR 3
460 /* MOTD doesn't have any subtypes */
462 /* admin/global messages */
463 #define MSG_TYPE_ADMIN_RULES 1
464 #define MSG_TYPE_ADMIN_NEWS 2
465 #define MSG_TYPE_ADMIN_PLAYER 3
466 #define MSG_TYPE_ADMIN_DM 4
467 #define MSG_TYPE_ADMIN_HISCORE 5
468 #define MSG_TYPE_ADMIN_LOADSAVE 6
469 #define MSG_TYPE_ADMIN_LOGIN 7
470 #define MSG_TYPE_ADMIN_VERSION 8
471 #define MSG_TYPE_ADMIN_ERROR 9
472 /*
473  * I'm not actually expecting anything to make much use of the MSG_TYPE_SHOP
474  * values However, to use the media tags, need to use draw_ext_info, and need
475  * to have a type/subtype, so figured might as well put in real values here.
476  */
477 #define MSG_TYPE_SHOP_LISTING 1
479 #define MSG_TYPE_SHOP_PAYMENT 2
481 #define MSG_TYPE_SHOP_SELL 3
482 #define MSG_TYPE_SHOP_MISC 4
483 /*
484  * Basically, 1 subtype/command. Like shops, not expecting much to be done,
485  * but by having different subtypes, it makes it easier for client to store
486  * way information (eg, who output)
487  */
488 #define MSG_TYPE_COMMAND_WHO 1
489 #define MSG_TYPE_COMMAND_MAPS 2
490 #define MSG_TYPE_COMMAND_BODY 3
491 #define MSG_TYPE_COMMAND_MALLOC 4
492 #define MSG_TYPE_COMMAND_WEATHER 5
493 #define MSG_TYPE_COMMAND_STATISTICS 6
494 #define MSG_TYPE_COMMAND_CONFIG 7
495 #define MSG_TYPE_COMMAND_INFO 8
496 #define MSG_TYPE_COMMAND_QUESTS 9
497 #define MSG_TYPE_COMMAND_DEBUG 10
498 #define MSG_TYPE_COMMAND_ERROR 11
499 #define MSG_TYPE_COMMAND_SUCCESS 12
500 #define MSG_TYPE_COMMAND_FAILURE 13
501 #define MSG_TYPE_COMMAND_EXAMINE 14
502 #define MSG_TYPE_COMMAND_INVENTORY 15
503 #define MSG_TYPE_COMMAND_HELP 16
504 #define MSG_TYPE_COMMAND_DM 17
505 #define MSG_TYPE_COMMAND_NEWPLAYER 18
510 /* This is somewhat verbose. If the client ends up being able to
511  * choose various attributes based on message type, I think it is important
512  * for the client to know if this is a benefit or detriment to the player.
513  * In the case of losing a bonus, this typically indicates a spell has
514  * ended, which is probably more important (and should be displayed more
515  * prominently) than when you cast the spell
516  */
517 
518 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN 1
519 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS 2
524 #define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN 3
525 #define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS 4
531 #define MSG_TYPE_ATTRIBUTE_MOVE 5
533 #define MSG_TYPE_ATTRIBUTE_RACE 6
534 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START 7
536 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END 8
537 #define MSG_TYPE_ATTRIBUTE_STAT_GAIN 9
538 #define MSG_TYPE_ATTRIBUTE_STAT_LOSS 10
539 #define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN 11
540 #define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS 12
541 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START 13
543 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END 14
544 #define MSG_TYPE_ATTRIBUTE_GOD 15
546 /* I think one type/skill is overkill, so instead, use broader categories
547  * for these messages.
548  * The difference in ERROR vs FAILURE is basically this: ERROR indicates
549  * something wasn't right to even attempt to use the skill (don't have
550  * needed object, or haven't marked objects, etc).
551  * FAILURE indicates that player attempted to use the skill, but it
552  * didn't work.
553  * PRAY is listed out because praying over altars can generate some
554  * messages not really related to the skill itself.
555  */
556 #define MSG_TYPE_SKILL_MISSING 1
557 #define MSG_TYPE_SKILL_ERROR 2
558 #define MSG_TYPE_SKILL_SUCCESS 3
559 #define MSG_TYPE_SKILL_FAILURE 4
560 #define MSG_TYPE_SKILL_PRAY 5
561 #define MSG_TYPE_SKILL_LIST 6
563 /* Messages related to applying objects. Note that applying many objects may
564  * generate MSG_TYPE_ATTRIBUTE messages - the APPLY here more directly related
565  * to the direct messages related to applying them (you put on your armor, you
566  * apply scroll, etc). The ERROR is like that for SKILLS - something prevent
567  * even trying to apply the object. FAILURE indicates result wasn't
568  * successful.
569  */
570 #define MSG_TYPE_APPLY_ERROR 1
571 #define MSG_TYPE_APPLY_UNAPPLY 2
572 #define MSG_TYPE_APPLY_SUCCESS 3
573 #define MSG_TYPE_APPLY_FAILURE 4
574 #define MSG_TYPE_APPLY_CURSED 5
575 #define MSG_TYPE_APPLY_TRAP 6
576 #define MSG_TYPE_APPLY_BADBODY 7
577 #define MSG_TYPE_APPLY_PROHIBITION 8
578 #define MSG_TYPE_APPLY_BUILD 9
580 /* attack related messages */
581 #define MSG_TYPE_ATTACK_DID_HIT 1
582 #define MSG_TYPE_ATTACK_PET_HIT 2
583 #define MSG_TYPE_ATTACK_FUMBLE 3
584 #define MSG_TYPE_ATTACK_DID_KILL 4
585 #define MSG_TYPE_ATTACK_PET_DIED 5
586 #define MSG_TYPE_ATTACK_NOKEY 6
587 #define MSG_TYPE_ATTACK_NOATTACK 7
588 #define MSG_TYPE_ATTACK_PUSHED 8
589 #define MSG_TYPE_ATTACK_MISS 9
591 #define MSG_TYPE_COMMUNICATION_RANDOM 1
592 #define MSG_TYPE_COMMUNICATION_SAY 2
593 #define MSG_TYPE_COMMUNICATION_ME 3
594 #define MSG_TYPE_COMMUNICATION_TELL 4
595 #define MSG_TYPE_COMMUNICATION_EMOTE 5
596 #define MSG_TYPE_COMMUNICATION_PARTY 6
597 #define MSG_TYPE_COMMUNICATION_SHOUT 7
598 #define MSG_TYPE_COMMUNICATION_CHAT 8
600 #define MSG_TYPE_SPELL_HEAL 1
601 #define MSG_TYPE_SPELL_PET 2
602 #define MSG_TYPE_SPELL_FAILURE 3
603 #define MSG_TYPE_SPELL_END 4
604 #define MSG_TYPE_SPELL_SUCCESS 5
605 #define MSG_TYPE_SPELL_ERROR 6
606 #define MSG_TYPE_SPELL_PERCEIVE_SELF 7
607 #define MSG_TYPE_SPELL_TARGET 8
608 #define MSG_TYPE_SPELL_INFO 9
611 #define MSG_TYPE_ITEM_REMOVE 1
612 #define MSG_TYPE_ITEM_ADD 2
613 #define MSG_TYPE_ITEM_CHANGE 3
614 #define MSG_TYPE_ITEM_INFO 4
615 /*
616  * MSG_TYPE_MISC, by its very nature, doesn't really have subtypes. It is
617  * used for messages that really don't belong anyplace else
618  */
619 #define MSG_TYPE_VICTIM_SWAMP 1
620 #define MSG_TYPE_VICTIM_WAS_HIT 2
621 #define MSG_TYPE_VICTIM_STEAL 3
623 #define MSG_TYPE_VICTIM_SPELL 4
625 #define MSG_TYPE_VICTIM_DIED 5
626 #define MSG_TYPE_VICTIM_WAS_PUSHED 6
629 #define MSG_TYPE_CLIENT_CONFIG 1
630 #define MSG_TYPE_CLIENT_SERVER 2
631 #define MSG_TYPE_CLIENT_COMMAND 3
632 #define MSG_TYPE_CLIENT_QUERY 4
633 #define MSG_TYPE_CLIENT_DEBUG 5
634 #define MSG_TYPE_CLIENT_NOTICE 6
635 #define MSG_TYPE_CLIENT_METASERVER 7
636 #define MSG_TYPE_CLIENT_SCRIPT 8
637 #define MSG_TYPE_CLIENT_ERROR 9
643 #define INFO_MAP_ARCH_NAME 1
644 #define INFO_MAP_NAME 2
645 #define INFO_MAP_DESCRIPTION 3
650 typedef struct SockList {
651 #ifdef CLIENT_TYPES_H /* Used by the client */
652  int len;
653  unsigned char *buf;
654 #else /* Used by the server */
655  size_t len;
656  unsigned char buf[MAXSOCKBUF]; /* 2(size)+65535(content)+1(ending NULL) */
657 #endif
658 } SockList;
663 typedef struct CS_Stats {
664  int ibytes;
665  int obytes;
666  short max_conn;
667  time_t time_start;
668 } CS_Stats;
669 
670 extern CS_Stats cst_tot, cst_lst;
671 
672 #endif /* NEWCLIENT_H */
int obytes
Definition: newclient.h:695
CS_Stats cst_lst
short max_conn
Maximum connections received.
Definition: newclient.h:696
int ibytes
ibytes, obytes are bytes in, out.
Definition: newclient.h:694
struct SockList SockList
Contains the base information we use to make up a packet we want to send.
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:25
Statistics on server.
Definition: newclient.h:693
time_t time_start
When we started logging this.
Definition: newclient.h:697
struct CS_Stats CS_Stats
Statistics on server.