1 /** 2 * @file 3 * Defines various flags that both the new client and new server use. These 4 * should never be changed, only expanded. Changing them will likely cause all 5 * old clients to not work properly. While called newclient, it is used by 6 * both the client and server to keep some values the same. 7 * 8 * Name format is CS_(command)_(flag) 9 * CS = Client/Server. 10 * (command) is protocol command, ie ITEM 11 * (flag) is the flag name 12 */ 13 14 #ifndef NEWCLIENT_H 15 #define NEWCLIENT_H 16 17 /** 18 * Maximum size of a packet the client expects to get and that the server can 19 * send. Using a buffer of this size allows the client to avoid constant 20 * allocation and deallocation of the same buffer over and over again (at the 21 * cost of using extra memory). This also makes the code simpler. The size 22 * is big enough to receive any valid packet: 2 bytes for length, 65535 for 23 * maximum packet size, 1 for a trailing null character. 24 */ 25 #define MAXSOCKBUF (2+65535+1) 26 27 /** 28 * How much the x,y coordinates in the map2 are off from actual upper left 29 * corner. Necessary for light sources that may be off the edge of the 30 * visible map. 31 */ 32 #define MAP2_COORD_OFFSET 15 33 34 /** 35 * @defgroup MAP2_TYPE_xxx Type values present in map2 commands. 36 * The different type values that may be present in a map2 command. These are 37 * described in the protocol entry in more detail. These values are sent in 38 * the bottom 5 bits of their byte, the top 3 are for the length of the data 39 * that is sent. 40 */ 41 /*@{*/ 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 */ 51 /*@}*/ 52 53 #define MAP2_LAYER_START 0x10 54 55 /** 56 * Encodes a (x, y) pair suitable for map2 parameters. The coordinates must be 57 * between [-MAP2_COORD_OFFSET..63-MAP2_COORD_OFFSET]. The flags value must be 58 * between [0..15]. 59 * 60 * @param x the x-coordinate 61 * @param y the y-coordinate 62 * @param flags the flags value 63 */ 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 /**< Yes/no question. */ 67 #define CS_QUERY_SINGLECHAR 0x2 /**< Single character response expected. */ 68 #define CS_QUERY_HIDEINPUT 0x4 /**< Hide input being entered. */ 69 70 #define CS_SAY_NORMAL 0x1 /**< Normal say command. */ 71 #define CS_SAY_SHOUT 0x2 /**< Text is shouted. */ 72 #define CS_SAY_GSAY 0x4 /**< Text is group say command. */ 73 74 /** 75 * @defgroup FLOAT_xxx FLOAT_xxx multipliers for changing floats to int. 76 * and vice versa. 77 */ 78 /*@{*/ 79 #define FLOAT_MULTI 100000 /**< Integer representation (float to int). */ 80 #define FLOAT_MULTF 100000.0 /**< Float for going from int to float. */ 81 /*@} FLOAT_xxx */ 82 83 /** 84 * @defgroup CS_STAT_xxx CS_STAT_xxx IDs for character statistics. 85 */ 86 /*@{*/ 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 /**< No longer used */ 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 /**< STR changes from gear or skills. */ 132 #define CS_STAT_APPLIED_INT 47 /**< INT changes from gear or skills. */ 133 #define CS_STAT_APPLIED_WIS 48 /**< WIS changes from gear or skills. */ 134 #define CS_STAT_APPLIED_DEX 49 /**< DEX changes from gear or skills. */ 135 #define CS_STAT_APPLIED_CON 50 /**< CON changes from gear or skills. */ 136 #define CS_STAT_APPLIED_CHA 51 /**< CHA changes from gear or skills. */ 137 #define CS_STAT_APPLIED_POW 52 /**< POW changes from gear or skills. */ 138 #define CS_STAT_GOLEM_HP 53 /**< Golem's current hp, 0 if no golem. */ 139 #define CS_STAT_GOLEM_MAXHP 54 /**< Golem's max hp, 0 if no golem. */ 140 141 #define CS_STAT_RESIST_START 100 /**< Start of resistances (inclusive) */ 142 #define CS_STAT_RESIST_END 117 /**< End of resistances (inclusive) */ 143 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 163 /** 164 * CS_STAT_SKILLINFO is used as the starting index point. Skill number->name 165 * map is generated dynamically for the client, so a bunch of entries will be 166 * used here. 167 */ 168 #define CS_STAT_SKILLINFO 140 169 170 /** 171 * CS_NUM_SKILLS does not match how many skills there really are - instead, it 172 * is used as a range of values so that the client can have some idea how many 173 * skill categories there may be. 174 */ 175 #define CS_NUM_SKILLS 50 176 /*@}*/ 177 178 /** 179 * @defgroup SF_xxx SF_xxx Masks used in conjunction with fire and run states. 180 * 181 * These values are used with CS_STAT_FLAGS above to communicate S->C what the 182 * server thinks the fireon & runon states are. 183 */ 184 /*@{*/ 185 #define SF_FIREON 0x01 186 #define SF_RUNON 0x02 187 /*@}*/ 188 189 /** 190 * @defgroup ACL_xxx ACL_xxx field IDs that support account login. 191 * 192 * These values are used for the account login code to denote what field 193 * follows. ACL = Account Character Login 194 */ 195 /*@{*/ 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 /*@}*/ 205 206 /** 207 * @defgroup NDI_xxx NDI_xxx message color flags and masks. 208 * 209 * The following are the color flags passed to new_draw_info(). 210 * 211 * We also set up some control flags 212 * 213 * NDI = New Draw Info 214 * 215 * Color specifications - note these match the order in xutil.c. 216 * 217 * Note 2: Black, the default color, is 0. Thus, it does not need to 218 * be implicitly specified. 219 */ 220 /*@{*/ 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 /**< Actually, it is Dodger Blue */ 227 #define NDI_DK_ORANGE 6 /**< DarkOrange2 */ 228 #define NDI_GREEN 7 /**< SeaGreen */ 229 #define NDI_LT_GREEN 8 /**< DarkSeaGreen, which is actually paler 230 * than seagreen - also background color. */ 231 #define NDI_GREY 9 232 #define NDI_BROWN 10 /**< Sienna. */ 233 #define NDI_GOLD 11 234 #define NDI_TAN 12 /**< Khaki. */ 235 #define NDI_MAX_COLOR 12 /**< Last value in. */ 236 237 #define NDI_COLOR_MASK 0xff /**< Gives lots of room for expansion - we are 238 * using an int anyways, so we have the 239 * space to still do all the flags. 240 */ 241 #define NDI_UNIQUE 0x100 /**< Print immediately, don't buffer. */ 242 #define NDI_ALL 0x200 /**< Inform all players of this message. */ 243 #define NDI_ALL_DMS 0x400 /**< Inform all logged in DMs. Used in case of 244 * errors. Overrides NDI_ALL. */ 245 /*@}*/ 246 247 /** 248 * @defgroup F_xxx F_xxx flags for the item command. 249 */ 250 /*@{*/ 251 enum {a_none, a_readied, a_wielded, a_worn, a_active, a_applied}; 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 263 #define F_READ 0x0020 264 /*@}*/ 265 266 /** 267 * @defgroup FACE_xxx FACE_xxx magic map masks. 268 * 269 * Used in the new_face structure on the magicmap field. Low bits are color 270 * information. For now, only high bit information we need is for the floor. 271 */ 272 /*@{*/ 273 #define FACE_FLOOR 0x80 274 #define FACE_WALL 0x40 /**< Or'd into the color value by the server 275 * right before sending. */ 276 #define FACE_COLOR_MASK 0xf 277 /*@}*/ 278 279 /** 280 * @defgroup UPD_xxx UPD_xxx UpdSpell constants. 281 * 282 */ 283 /*@{*/ 284 #define UPD_LOCATION 0x01 285 #define UPD_FLAGS 0x02 286 #define UPD_WEIGHT 0x04 287 #define UPD_FACE 0x08 288 #define UPD_NAME 0x10 289 #define UPD_ANIM 0x20 290 #define UPD_ANIMSPEED 0x40 291 #define UPD_NROF 0x80 292 #define UPD_ALL 0xFF 293 294 #define UPD_SP_MANA 0x01 /**< updspell command flag value. */ 295 #define UPD_SP_GRACE 0x02 /**< updspell command flag value. */ 296 #define UPD_SP_DAMAGE 0x04 /**< updspell command flag value. */ 297 /*@}*/ 298 299 /** 300 * @defgroup Soundtypes Sound types 301 */ 302 /*@{*/ 303 #define SOUND_TYPE_LIVING 1 304 #define SOUND_TYPE_SPELL 2 305 #define SOUND_TYPE_ITEM 3 306 #define SOUND_TYPE_GROUND 4 307 #define SOUND_TYPE_HIT 5 308 #define SOUND_TYPE_HIT_BY 6 309 /*@}*/ 310 311 /** 312 * @defgroup ANIM_xxx Animation constants. 313 * 314 */ 315 /*@{*/ 316 #define FACE_IS_ANIM 1<<15 317 #define ANIM_RANDOM 1<<13 318 #define ANIM_SYNC 2<<13 319 320 #define ANIM_FLAGS_MASK 0x6000 /**< Used only by the client. */ 321 322 /** 323 * AND'ing this with data from server gets us just the animation id. Used 324 * only by the client. 325 */ 326 #define ANIM_MASK 0x1fff 327 /*@}*/ 328 329 /** 330 * @defgroup EMI_xxx EMI_xxx extended map constants. 331 * 332 * Even if the client select the additionnal infos it wants on the map, there 333 * may exist cases where this whole info is not given in one bunch but in 334 * separate bunches. This is done performance reasons (imagine some info 335 * related to a visible object and another info related to a 4 square width 336 * and height area). At the begin of an extended info packet is a bit field. A 337 * bit is activated for each extended information present in the data. 338 */ 339 /*@{*/ 340 /**< Take extended information into account but do not redraw. Some 341 * additional data will follow in a new packet. 342 */ 343 #define EMI_NOREDRAW 0x01 344 /** 345 * Data about smoothing. 346 */ 347 #define EMI_SMOOTH 0x02 348 /** 349 * Indicates the bitfield continue un next byte There may be several on 350 * contiguous bytes. So there is 7 actual bits used per byte, and the number 351 * of bytes is not fixed in protocol 352 */ 353 #define EMI_HASMOREBITS 0x80 354 /*@}*/ 355 356 /* 357 * Note! 358 * When adding message types, don't forget to keep the client up to date too! 359 */ 360 361 /** 362 * @defgroup MSG_TYPE_xxx MSG_TYPE_xxx message types 363 */ 364 /*@{*/ 365 #define MSG_TYPE_BOOK 1 366 #define MSG_TYPE_CARD 2 367 #define MSG_TYPE_PAPER 3 368 #define MSG_TYPE_SIGN 4 369 #define MSG_TYPE_MONUMENT 5 370 #define MSG_TYPE_DIALOG 6 /**< NPCs, magic mouths, and altars */ 371 #define MSG_TYPE_MOTD 7 372 #define MSG_TYPE_ADMIN 8 373 #define MSG_TYPE_SHOP 9 374 #define MSG_TYPE_COMMAND 10 /**< Responses to commands, eg, who */ 375 #define MSG_TYPE_ATTRIBUTE 11 /**< Changes to attributes (stats, 376 * resistances, etc) */ 377 #define MSG_TYPE_SKILL 12 /**< Messages related to skill use. */ 378 #define MSG_TYPE_APPLY 13 /**< Applying objects */ 379 #define MSG_TYPE_ATTACK 14 /**< Attack related messages */ 380 #define MSG_TYPE_COMMUNICATION 15 /**< Communication between players */ 381 #define MSG_TYPE_SPELL 16 /**< Spell related info */ 382 #define MSG_TYPE_ITEM 17 /**< Item related information */ 383 #define MSG_TYPE_MISC 18 /**< Messages that don't go 384 * elsewhere */ 385 #define MSG_TYPE_VICTIM 19 /**< Something bad is happening to 386 * the player. */ 387 #define MSG_TYPE_CLIENT 20 /**< Client originated Messages */ 388 #define MSG_TYPE_LAST 21 389 390 #define MSG_SUBTYPE_NONE 0 391 392 /* book messages subtypes */ 393 #define MSG_TYPE_BOOK_CLASP_1 1 394 #define MSG_TYPE_BOOK_CLASP_2 2 395 #define MSG_TYPE_BOOK_ELEGANT_1 3 396 #define MSG_TYPE_BOOK_ELEGANT_2 4 397 #define MSG_TYPE_BOOK_QUARTO_1 5 398 #define MSG_TYPE_BOOK_QUARTO_2 6 399 #define MSG_TYPE_BOOK_SPELL_EVOKER 7 400 #define MSG_TYPE_BOOK_SPELL_PRAYER 8 401 #define MSG_TYPE_BOOK_SPELL_PYRO 9 402 #define MSG_TYPE_BOOK_SPELL_SORCERER 10 403 #define MSG_TYPE_BOOK_SPELL_SUMMONER 11 404 405 /* card messages subtypes*/ 406 #define MSG_TYPE_CARD_SIMPLE_1 1 407 #define MSG_TYPE_CARD_SIMPLE_2 2 408 #define MSG_TYPE_CARD_SIMPLE_3 3 409 #define MSG_TYPE_CARD_ELEGANT_1 4 410 #define MSG_TYPE_CARD_ELEGANT_2 5 411 #define MSG_TYPE_CARD_ELEGANT_3 6 412 #define MSG_TYPE_CARD_STRANGE_1 7 413 #define MSG_TYPE_CARD_STRANGE_2 8 414 #define MSG_TYPE_CARD_STRANGE_3 9 415 #define MSG_TYPE_CARD_MONEY_1 10 416 #define MSG_TYPE_CARD_MONEY_2 11 417 #define MSG_TYPE_CARD_MONEY_3 12 418 419 /* Paper messages subtypes */ 420 #define MSG_TYPE_PAPER_NOTE_1 1 421 #define MSG_TYPE_PAPER_NOTE_2 2 422 #define MSG_TYPE_PAPER_NOTE_3 3 423 #define MSG_TYPE_PAPER_LETTER_OLD_1 4 424 #define MSG_TYPE_PAPER_LETTER_OLD_2 5 425 #define MSG_TYPE_PAPER_LETTER_NEW_1 6 426 #define MSG_TYPE_PAPER_LETTER_NEW_2 7 427 #define MSG_TYPE_PAPER_ENVELOPE_1 8 428 #define MSG_TYPE_PAPER_ENVELOPE_2 9 429 #define MSG_TYPE_PAPER_SCROLL_OLD_1 10 430 #define MSG_TYPE_PAPER_SCROLL_OLD_2 11 431 #define MSG_TYPE_PAPER_SCROLL_NEW_1 12 432 #define MSG_TYPE_PAPER_SCROLL_NEW_2 13 433 #define MSG_TYPE_PAPER_SCROLL_MAGIC 14 434 435 /* road signs messages subtypes */ /* Including magic mouths */ 436 #define MSG_TYPE_SIGN_BASIC 1 437 #define MSG_TYPE_SIGN_DIR_LEFT 2 438 #define MSG_TYPE_SIGN_DIR_RIGHT 3 439 #define MSG_TYPE_SIGN_DIR_BOTH 4 440 #define MSG_TYPE_SIGN_MAGIC_MOUTH 5 441 442 /* stones and monument messages */ 443 #define MSG_TYPE_MONUMENT_STONE_1 1 444 #define MSG_TYPE_MONUMENT_STONE_2 2 445 #define MSG_TYPE_MONUMENT_STONE_3 3 446 #define MSG_TYPE_MONUMENT_STATUE_1 4 447 #define MSG_TYPE_MONUMENT_STATUE_2 5 448 #define MSG_TYPE_MONUMENT_STATUE_3 6 449 #define MSG_TYPE_MONUMENT_GRAVESTONE_1 7 450 #define MSG_TYPE_MONUMENT_GRAVESTONE_2 8 451 #define MSG_TYPE_MONUMENT_GRAVESTONE_3 9 452 #define MSG_TYPE_MONUMENT_WALL_1 10 453 #define MSG_TYPE_MONUMENT_WALL_2 11 454 #define MSG_TYPE_MONUMENT_WALL_3 12 455 456 /* dialog message */ 457 #define MSG_TYPE_DIALOG_NPC 1 /**< A message from the npc */ 458 #define MSG_TYPE_DIALOG_ALTAR 2 /**< A message from an altar */ 459 #define MSG_TYPE_DIALOG_MAGIC_EAR 3 /**< Magic ear */ 460 461 /* MOTD doesn't have any subtypes */ 462 463 /* admin/global messages */ 464 #define MSG_TYPE_ADMIN_RULES 1 465 #define MSG_TYPE_ADMIN_NEWS 2 466 #define MSG_TYPE_ADMIN_PLAYER 3 /**< Player coming/going/death */ 467 #define MSG_TYPE_ADMIN_DM 4 /**< DM related admin actions */ 468 #define MSG_TYPE_ADMIN_HISCORE 5 /**< Hiscore list */ 469 #define MSG_TYPE_ADMIN_LOADSAVE 6 /**< load/save operations */ 470 #define MSG_TYPE_ADMIN_LOGIN 7 /**< login messages/errors */ 471 #define MSG_TYPE_ADMIN_VERSION 8 /**< version info */ 472 #define MSG_TYPE_ADMIN_ERROR 9 /**< Error on command, setup, etc */ 473 /* 474 * I'm not actually expecting anything to make much use of the MSG_TYPE_SHOP 475 * values However, to use the media tags, need to use draw_ext_info, and need 476 * to have a type/subtype, so figured might as well put in real values here. 477 */ 478 #define MSG_TYPE_SHOP_LISTING 1 /**< Shop listings - inventory, 479 * what it deals in. */ 480 #define MSG_TYPE_SHOP_PAYMENT 2 /**< Messages about payment, lack 481 * of funds. */ 482 #define MSG_TYPE_SHOP_SELL 3 /**< Messages about selling items */ 483 #define MSG_TYPE_SHOP_MISC 4 /**< Random messages */ 484 /* 485 * Basically, 1 subtype/command. Like shops, not expecting much to be done, 486 * but by having different subtypes, it makes it easier for client to store 487 * way information (eg, who output) 488 */ 489 #define MSG_TYPE_COMMAND_WHO 1 490 #define MSG_TYPE_COMMAND_MAPS 2 491 #define MSG_TYPE_COMMAND_BODY 3 492 #define MSG_TYPE_COMMAND_MALLOC 4 493 #define MSG_TYPE_COMMAND_WEATHER 5 494 #define MSG_TYPE_COMMAND_STATISTICS 6 495 #define MSG_TYPE_COMMAND_CONFIG 7 /**< bowmode, petmode, applymode */ 496 #define MSG_TYPE_COMMAND_INFO 8 /**< Generic info: resistances, etc */ 497 #define MSG_TYPE_COMMAND_QUESTS 9 /**< Quest info */ 498 #define MSG_TYPE_COMMAND_DEBUG 10 /**< Various debug type commands */ 499 #define MSG_TYPE_COMMAND_ERROR 11 /**< Bad syntax/can't use command */ 500 #define MSG_TYPE_COMMAND_SUCCESS 12 /**< Successful result from command */ 501 #define MSG_TYPE_COMMAND_FAILURE 13 /**< Failed result from command */ 502 #define MSG_TYPE_COMMAND_EXAMINE 14 /**< Player examining something */ 503 #define MSG_TYPE_COMMAND_INVENTORY 15 /**< Inventory listing */ 504 #define MSG_TYPE_COMMAND_HELP 16 /**< Help related information */ 505 #define MSG_TYPE_COMMAND_DM 17 /**< DM related commands */ 506 #define MSG_TYPE_COMMAND_NEWPLAYER 18 /**< Create a new character - not 507 * really a command, but is 508 * responding to player input 509 */ 510 511 /* This is somewhat verbose. If the client ends up being able to 512 * choose various attributes based on message type, I think it is important 513 * for the client to know if this is a benefit or detriment to the player. 514 * In the case of losing a bonus, this typically indicates a spell has 515 * ended, which is probably more important (and should be displayed more 516 * prominently) than when you cast the spell 517 */ 518 519 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN 1 /**< Atacktypes here refer to */ 520 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS 2 /**< the player gaining or 521 * losing these attacktypes 522 * not being a victim of an 523 * attacktype. 524 */ 525 #define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN 3 /**< Protections in this */ 526 #define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS 4 /**< context are pretty 527 * generic - things like 528 * reflection or lifesave 529 * are also under the 530 * protection category. 531 */ 532 #define MSG_TYPE_ATTRIBUTE_MOVE 5 /**< A change in the movement 533 * type of the player. */ 534 #define MSG_TYPE_ATTRIBUTE_RACE 6 /**< Race-related changes. */ 535 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START 7 /**< Start of a bad effect 536 * to the player. */ 537 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END 8 /**< End of a bad effect. */ 538 #define MSG_TYPE_ATTRIBUTE_STAT_GAIN 9 539 #define MSG_TYPE_ATTRIBUTE_STAT_LOSS 10 540 #define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN 11 541 #define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS 12 542 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START 13 /**< Start of a good effect to 543 * the player. */ 544 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END 14 /**< End of a good effect. */ 545 #define MSG_TYPE_ATTRIBUTE_GOD 15 /**< changing god info */ 546 547 /* I think one type/skill is overkill, so instead, use broader categories 548 * for these messages. 549 * The difference in ERROR vs FAILURE is basically this: ERROR indicates 550 * something wasn't right to even attempt to use the skill (don't have 551 * needed object, or haven't marked objects, etc). 552 * FAILURE indicates that player attempted to use the skill, but it 553 * didn't work. 554 * PRAY is listed out because praying over altars can generate some 555 * messages not really related to the skill itself. 556 */ 557 #define MSG_TYPE_SKILL_MISSING 1 /**< Don't have the skill */ 558 #define MSG_TYPE_SKILL_ERROR 2 /**< Doing something wrong */ 559 #define MSG_TYPE_SKILL_SUCCESS 3 /**< Successfully used skill */ 560 #define MSG_TYPE_SKILL_FAILURE 4 /**< Failure in using skill */ 561 #define MSG_TYPE_SKILL_PRAY 5 /**< Praying related messages */ 562 #define MSG_TYPE_SKILL_LIST 6 /**< List of skills */ 563 564 /* Messages related to applying objects. Note that applying many objects may 565 * generate MSG_TYPE_ATTRIBUTE messages - the APPLY here more directly related 566 * to the direct messages related to applying them (you put on your armor, you 567 * apply scroll, etc). The ERROR is like that for SKILLS - something prevent 568 * even trying to apply the object. FAILURE indicates result wasn't 569 * successful. 570 */ 571 #define MSG_TYPE_APPLY_ERROR 1 572 #define MSG_TYPE_APPLY_UNAPPLY 2 /**< Unapply an object */ 573 #define MSG_TYPE_APPLY_SUCCESS 3 /**< Was able to apply object */ 574 #define MSG_TYPE_APPLY_FAILURE 4 /**< Apply OK, but no/bad result */ 575 #define MSG_TYPE_APPLY_CURSED 5 /**< Applied a cursed object (BAD) */ 576 #define MSG_TYPE_APPLY_TRAP 6 /**< Have activated a trap */ 577 #define MSG_TYPE_APPLY_BADBODY 7 /**< Don't have body to use object */ 578 #define MSG_TYPE_APPLY_PROHIBITION 8 /**< Class/god prohibiiton on obj */ 579 #define MSG_TYPE_APPLY_BUILD 9 /**< Build related actions */ 580 581 /* attack related messages */ 582 #define MSG_TYPE_ATTACK_DID_HIT 1 /**< Player hit something else */ 583 #define MSG_TYPE_ATTACK_PET_HIT 2 /**< Players pet hit something else */ 584 #define MSG_TYPE_ATTACK_FUMBLE 3 /**< Player fumbled attack */ 585 #define MSG_TYPE_ATTACK_DID_KILL 4 /**< Player killed something */ 586 #define MSG_TYPE_ATTACK_PET_DIED 5 /**< Pet was killed */ 587 #define MSG_TYPE_ATTACK_NOKEY 6 /**< Keys are like attacks, so... */ 588 #define MSG_TYPE_ATTACK_NOATTACK 7 /**< You avoid attacking */ 589 #define MSG_TYPE_ATTACK_PUSHED 8 /**< Pushed a friendly player */ 590 #define MSG_TYPE_ATTACK_MISS 9 /**< attack didn't hit */ 591 592 #define MSG_TYPE_COMMUNICATION_RANDOM 1 /**< Random event (coin toss) */ 593 #define MSG_TYPE_COMMUNICATION_SAY 2 /**< Player says something */ 594 #define MSG_TYPE_COMMUNICATION_ME 3 /**< Player me's a message */ 595 #define MSG_TYPE_COMMUNICATION_TELL 4 /**< Player tells something */ 596 #define MSG_TYPE_COMMUNICATION_EMOTE 5 /**< Player emotes */ 597 #define MSG_TYPE_COMMUNICATION_PARTY 6 /**< Party message */ 598 #define MSG_TYPE_COMMUNICATION_SHOUT 7 /**< Party message */ 599 #define MSG_TYPE_COMMUNICATION_CHAT 8 /**< Party message */ 600 601 #define MSG_TYPE_SPELL_HEAL 1 /**< Healing related spells */ 602 #define MSG_TYPE_SPELL_PET 2 /**< Pet related messages */ 603 #define MSG_TYPE_SPELL_FAILURE 3 /**< Spell failure messages */ 604 #define MSG_TYPE_SPELL_END 4 /**< A spell ends */ 605 #define MSG_TYPE_SPELL_SUCCESS 5 /**< Spell succeeded messages */ 606 #define MSG_TYPE_SPELL_ERROR 6 /**< Spell failure messages */ 607 #define MSG_TYPE_SPELL_PERCEIVE_SELF 7 /**< Perceive self messages */ 608 #define MSG_TYPE_SPELL_TARGET 8 /**< Target of non attack spell */ 609 #define MSG_TYPE_SPELL_INFO 9 /**< random info about spell, not 610 * related to failure/success */ 611 612 #define MSG_TYPE_ITEM_REMOVE 1 /**< Item removed from inv */ 613 #define MSG_TYPE_ITEM_ADD 2 /**< Item added to inventory */ 614 #define MSG_TYPE_ITEM_CHANGE 3 /**< Item has changed in some way */ 615 #define MSG_TYPE_ITEM_INFO 4 /**< Information related to items */ 616 /* 617 * MSG_TYPE_MISC, by its very nature, doesn't really have subtypes. It is 618 * used for messages that really don't belong anyplace else 619 */ 620 #define MSG_TYPE_VICTIM_SWAMP 1 /**< Player is sinking in a swamp */ 621 #define MSG_TYPE_VICTIM_WAS_HIT 2 /**< Player was hit by something */ 622 #define MSG_TYPE_VICTIM_STEAL 3 /**< Someone tried to steal from 623 * the player */ 624 #define MSG_TYPE_VICTIM_SPELL 4 /**< Someone cast a bad spell on 625 * the player */ 626 #define MSG_TYPE_VICTIM_DIED 5 /**< Player died! */ 627 #define MSG_TYPE_VICTIM_WAS_PUSHED 6 /**< Player was pushed or attempted 628 * pushed */ 629 630 #define MSG_TYPE_CLIENT_CONFIG 1 /**< Local configuration issues */ 631 #define MSG_TYPE_CLIENT_SERVER 2 /**< Server configuration issues */ 632 #define MSG_TYPE_CLIENT_COMMAND 3 /**< DrawInfoCmd() */ 633 #define MSG_TYPE_CLIENT_QUERY 4 /**< handle_query() and prompts */ 634 #define MSG_TYPE_CLIENT_DEBUG 5 /**< General debug messages */ 635 #define MSG_TYPE_CLIENT_NOTICE 6 /**< Non-critical note to player */ 636 #define MSG_TYPE_CLIENT_METASERVER 7 /**< Metaserver messages */ 637 #define MSG_TYPE_CLIENT_SCRIPT 8 /**< Script related messages */ 638 #define MSG_TYPE_CLIENT_ERROR 9 /**< Bad things happening */ 639 /*@}*/ 640 641 /** 642 * Definitions for the requestion/replyinfo map data. 643 */ 644 #define INFO_MAP_ARCH_NAME 1 /**< Archetype name of this entry */ 645 #define INFO_MAP_NAME 2 /**< Proper name of this entry */ 646 #define INFO_MAP_DESCRIPTION 3 /**< Description of this map */ 647 648 /** 649 * Contains the base information we use to make up a packet we want to send. 650 */ 651 typedef struct SockList { 652 #ifdef CLIENT_TYPES_H /* Used by the client */ 653 int len; 654 unsigned char *buf; 655 #else /* Used by the server */ 656 size_t len; 657 unsigned char buf[MAXSOCKBUF]; /* 2(size)+65535(content)+1(ending NULL) */ 658 #endif 659 } SockList; 660 661 /** 662 * Statistics on server. 663 */ 664 typedef struct CS_Stats { 665 int ibytes; /**< ibytes, obytes are bytes in, out. */ 666 int obytes; 667 short max_conn; /**< Maximum connections received. */ 668 time_t time_start; /**< When we started logging this. */ 669 } CS_Stats; 670 671 extern CS_Stats cst_tot, cst_lst; 672 673 #endif /* NEWCLIENT_H */ 674