Crossfire Client, Branch  R11627
newclient.h
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_newclient_h =
00003  *   "$Id: newclient.h 6716 2007-06-27 18:57:31Z akirschbaum $";
00004  */
00005 
00006 /*
00007     CrossFire, A Multiplayer game for X-windows
00008 
00009     Copyright (C) 2002,2006 Mark Wedel & Crossfire Development Team
00010     Copyright (C) 1992 Frank Tore Johansen
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025 
00026     The authors can be reached via e-mail at crossfire-devel@real-time.com
00027 */
00028 
00029 /* This file defines various flags that both the new client and
00030  * newserver uses.  These should never be changed, only expanded.
00031  * Changing them will likely cause all old clients to not work properly.
00032  * While called newclient, it is really used by both the client and
00033  * server to keep some values the same.
00034  *
00035  * Name format is CS_(command)_(flag)
00036  * CS = Client/Server.
00037  * (command) is protocol command, ie ITEM
00038  * (flag) is the flag name
00039  */
00040 
00041 /* Ideally, this file should be the same between the server and
00042  * the client.  However, this often drifts apart because of a value
00043  * that is only useful on the client and server.  Generally, it isn't
00044  * a problem to have a few extra #defines if this lets them stay
00045  * in sync.
00046  *
00047  * Given this file contains the constants that dictate what is sent
00048  * between the server and client, keeping them in sync makes doing changes
00049  * easier - modify this file in one place, copy it over.
00050  *
00051  */
00052 
00053 
00054 #ifndef NEWCLIENT_H
00055 #define NEWCLIENT_H
00056 
00057 /* MAXSOCKRECVBUF and MAXSOCKSENDBUF are used on the server
00058  * MAXSOCKBUF is used by the client.
00059  */
00060 
00061 /* Maximum size of any packet we expect. This number includes both the length
00062  * bytes (2 bytes) at the start of each packet and the trailing '\0' (1 byte)
00063  * at the end of each packet.
00064  */
00065 #define MAXSOCKRECVBUF (2+65535+1)
00066 
00067 /* Maximum size of any packet we send. This number does not include the length
00068  * bytes at the start of each packet. The value is chosen to not overflow the
00069  * input buffer of old clients (2006-05-21).
00070  */
00071 #define MAXSOCKSENDBUF 10239
00072 
00073 /* Maximum size of any packet we expect.  Using this makes it so we don't need to
00074  * allocate and deallocate the same buffer over and over again and the price
00075  * of using a bit of extra memory.  It also makes the code simpler.
00076  * The size is big enough to receive any valid packet: 2 bytes for length,
00077  * 65535 for max. packet size, 1 for appended trailing '\0'.
00078  */
00079 #define MAXSOCKBUF (2+65535+1)
00080 
00081 
00082 /* How much the x,y coordinates in the map2 are off from
00083  * actual upper left corner.  Necessary for light sources
00084  * that may be off the edge of the visible map.
00085  */
00086 #define MAP2_COORD_OFFSET   15
00087 
00088 
00089 #define CS_QUERY_YESNO  0x1     /* Yes/no question */
00090 #define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */
00091 #define CS_QUERY_HIDEINPUT 0x4  /* Hide input being entered */
00092 
00093 #define CS_SAY_NORMAL   0x1     /* Normal say command */
00094 #define CS_SAY_SHOUT    0x2     /* Text is shouted. */
00095 #define CS_SAY_GSAY     0x4     /* Text is group say command */
00096 
00097 /* These are multiplication values that should be used when changing
00098  * floats to ints, and vice version.  MULTI is integer representatin
00099  * (float to int), MULTF is float, for going from int to float.
00100  */
00101 #define FLOAT_MULTI     100000
00102 #define FLOAT_MULTF     100000.0
00103 
00104 /* ID's for the various stats that get sent across. */
00105 
00106 #define CS_STAT_HP       1
00107 #define CS_STAT_MAXHP    2
00108 #define CS_STAT_SP       3
00109 #define CS_STAT_MAXSP    4
00110 #define CS_STAT_STR      5
00111 #define CS_STAT_INT      6
00112 #define CS_STAT_WIS      7
00113 #define CS_STAT_DEX      8
00114 #define CS_STAT_CON      9
00115 #define CS_STAT_CHA     10
00116 #define CS_STAT_EXP     11
00117 #define CS_STAT_LEVEL   12
00118 #define CS_STAT_WC      13
00119 #define CS_STAT_AC      14
00120 #define CS_STAT_DAM     15
00121 #define CS_STAT_ARMOUR  16
00122 #define CS_STAT_SPEED   17
00123 #define CS_STAT_FOOD    18
00124 #define CS_STAT_WEAP_SP 19
00125 #define CS_STAT_RANGE   20
00126 #define CS_STAT_TITLE   21
00127 #define CS_STAT_POW     22
00128 #define CS_STAT_GRACE   23
00129 #define CS_STAT_MAXGRACE        24
00130 #define CS_STAT_FLAGS   25
00131 #define CS_STAT_WEIGHT_LIM      26
00132 #define CS_STAT_EXP64   28
00133 #define CS_STAT_SPELL_ATTUNE    29
00134 #define CS_STAT_SPELL_REPEL     30
00135 #define CS_STAT_SPELL_DENY      31
00136 
00137 /* Start & end of resistances, inclusive. */
00138 #define CS_STAT_RESIST_START    100
00139 #define CS_STAT_RESIST_END      117
00140 #define CS_STAT_RES_PHYS        100
00141 #define CS_STAT_RES_MAG         101
00142 #define CS_STAT_RES_FIRE        102
00143 #define CS_STAT_RES_ELEC        103
00144 #define CS_STAT_RES_COLD        104
00145 #define CS_STAT_RES_CONF        105
00146 #define CS_STAT_RES_ACID        106
00147 #define CS_STAT_RES_DRAIN       107
00148 #define CS_STAT_RES_GHOSTHIT    108
00149 #define CS_STAT_RES_POISON      109
00150 #define CS_STAT_RES_SLOW        110
00151 #define CS_STAT_RES_PARA        111
00152 #define CS_STAT_TURN_UNDEAD     112
00153 #define CS_STAT_RES_FEAR        113
00154 #define CS_STAT_RES_DEPLETE     114
00155 #define CS_STAT_RES_DEATH       115
00156 #define CS_STAT_RES_HOLYWORD    116
00157 #define CS_STAT_RES_BLIND       117
00158 
00159 /* Start & end of skill experience + skill level, inclusive. */
00160 #define CS_STAT_SKILLEXP_START 118
00161 #define CS_STAT_SKILLEXP_END 129
00162 #define CS_STAT_SKILLEXP_AGILITY 118
00163 #define CS_STAT_SKILLEXP_AGLEVEL 119
00164 #define CS_STAT_SKILLEXP_PERSONAL 120
00165 #define CS_STAT_SKILLEXP_PELEVEL 121
00166 #define CS_STAT_SKILLEXP_MENTAL 122
00167 #define CS_STAT_SKILLEXP_MELEVEL 123
00168 #define CS_STAT_SKILLEXP_PHYSIQUE 124
00169 #define CS_STAT_SKILLEXP_PHLEVEL 125
00170 #define CS_STAT_SKILLEXP_MAGIC 126
00171 #define CS_STAT_SKILLEXP_MALEVEL 127
00172 #define CS_STAT_SKILLEXP_WISDOM 128
00173 #define CS_STAT_SKILLEXP_WILEVEL 129
00174 
00175 /* CS_STAT_SKILLINFO is used as the starting index point.  Skill number->name
00176  * map is generated dynamically for the client, so a bunch of entries will
00177  * be used here.  CS_NUM_SKILLS does not match how many skills there really
00178  * are - instead, it is used as a range of values so that the client
00179  * can have some idea how many skill categories there may be.
00180  */
00181 #define CS_STAT_SKILLINFO   140
00182 #define CS_NUM_SKILLS        50
00183 
00184 /* These are used with CS_STAT_FLAGS above to communicate S->C what the
00185  * server thinks the fireon & runon states are.
00186  */
00187 #define SF_FIREON   0x01
00188 #define SF_RUNON    0x02
00189 
00190 /* The following are the color flags passed to new_draw_info.
00191  *
00192  * We also set up some control flags
00193  *
00194  * NDI = New Draw Info
00195  */
00196 
00197 /* Color specifications - note these match the order in xutil.c */
00198 /* Note 2:  Black, the default color, is 0.  Thus, it does not need to
00199  * be implicitly specified.
00200  */
00201 #define NDI_BLACK       0
00202 #define NDI_WHITE       1
00203 #define NDI_NAVY        2
00204 #define NDI_RED         3
00205 #define NDI_ORANGE      4
00206 #define NDI_BLUE        5       /* Actually, it is Dodger Blue */
00207 #define NDI_DK_ORANGE   6       /* DarkOrange2 */
00208 #define NDI_GREEN       7       /* SeaGreen */
00209 #define NDI_LT_GREEN    8       /* DarkSeaGreen,  which is actually paler */
00210                                 /* Than seagreen - also background color */
00211 #define NDI_GREY        9
00212 #define NDI_BROWN       10      /* Sienna */
00213 #define NDI_GOLD        11
00214 #define NDI_TAN         12      /* Khaki */
00215 
00216 #define NDI_MAX_COLOR   12      /* Last value in */
00217 #define NDI_COLOR_MASK  0xff    /* Gives lots of room for expansion - we are */
00218                                 /* using an int anyways, so we have the space */
00219                                 /* to still do all the flags */
00220 
00221 
00222 #define NDI_UNIQUE      0x100   /* Print this out immediately, don't buffer */
00223 #define NDI_ALL         0x200   /* Inform all players of this message */
00224 
00225 /* Flags for the item command */
00226 enum {a_none, a_readied, a_wielded, a_worn, a_active, a_applied};
00227 #define F_APPLIED       0x000F
00228 #define F_LOCATION      0x00F0
00229 #define F_UNPAID        0x0200
00230 #define F_MAGIC         0x0400
00231 #define F_CURSED        0x0800
00232 #define F_DAMNED        0x1000
00233 #define F_OPEN          0x2000
00234 #define F_NOPICK        0x4000
00235 #define F_LOCKED        0x8000
00236 
00237 #define CF_FACE_NONE    0
00238 #define CF_FACE_BITMAP  1
00239 #define CF_FACE_XPM     2
00240 #define CF_FACE_PNG     3
00241 #define CF_FACE_CACHE   0x10
00242 
00243 /* Used in the new_face structure on the magicmap field.  Low bits
00244  * are color informatin.  For now, only high bit information we need
00245  * is floor information.
00246  */
00247 #define FACE_FLOOR      0x80
00248 #define FACE_WALL       0x40    /* Or'd into the color value by the server
00249                                  * right before sending.
00250                                  */
00251 #define FACE_COLOR_MASK 0xf
00252 
00253 #define UPD_LOCATION    0x01
00254 #define UPD_FLAGS       0x02
00255 #define UPD_WEIGHT      0x04
00256 #define UPD_FACE        0x08
00257 #define UPD_NAME        0x10
00258 #define UPD_ANIM        0x20
00259 #define UPD_ANIMSPEED   0x40
00260 #define UPD_NROF        0x80
00261 
00262 /* The flag values sent by the updspell command */
00263 #define UPD_SP_MANA     0x01
00264 #define UPD_SP_GRACE    0x02
00265 #define UPD_SP_DAMAGE   0x04
00266 
00267 #define SOUND_NORMAL    0
00268 #define SOUND_SPELL     1
00269 
00270 #define FACE_IS_ANIM    1<<15
00271 #define ANIM_RANDOM     1<<13
00272 #define ANIM_SYNC       2<<13
00273 
00274 /* ANIM_FLAGS_MASK and ANIM_MASK are only used by the client */
00275 #define ANIM_FLAGS_MASK 0x6000
00276 
00277 /* AND'ing this with data from server gets us just the animation id */
00278 #define ANIM_MASK       0x1fff
00279 
00280 
00281 /* Constants in the form EMI_ is for extended map infos.
00282  * Even if the client select the additionnal infos it wants
00283  * on the map, there may exist cases where this whole info
00284  * is not given in one buch but in separate bunches. This
00285  * is done performance reasons (imagine some info related to
00286  * a visible object and another info related to a 4 square
00287  * width and height area). At the begin of an extended info packet
00288  * is a bit field. A bit is activated for each extended info
00289  * present in the data
00290  */
00291 /* Meanings:
00292  * EMI_NOREDRAW  Take extended infos into account but don't redraw,
00293  *               some additionnal datas will follow in a new packet
00294  * EMI_SMOOTH    Datas about smoothing
00295  */
00296 #define EMI_NOREDRAW        0x01
00297 #define EMI_SMOOTH          0x02
00298 
00299 /* this last one says the bitfield continue un next byte
00300  * There may be several on contiguous bytes. So there is 7
00301  * actual bits used per byte, and the number of bytes
00302  * is not fixed in protocol
00303  */
00304 #define EMI_HASMOREBITS     0x80
00305 
00306 
00307 /*
00308  * Note!
00309  * If you add message types here, don't forget
00310  * to keep the client up to date too!
00311  */
00312 
00313 
00314 /* message types */
00315 #define MSG_TYPE_BOOK               1
00316 #define MSG_TYPE_CARD               2
00317 #define MSG_TYPE_PAPER              3
00318 #define MSG_TYPE_SIGN               4
00319 #define MSG_TYPE_MONUMENT           5
00320 #define MSG_TYPE_DIALOG             6
00321 #define MSG_TYPE_MOTD               7
00322 #define MSG_TYPE_ADMIN              8
00323 #define MSG_TYPE_SHOP               9
00324 #define MSG_TYPE_COMMAND            10  /* Responses to commands, eg, who */
00325 #define MSG_TYPE_ATTRIBUTE          11  /* Changes to attributes (stats, */
00326                                         /* resistances, etc) */
00327 #define MSG_TYPE_SKILL              12  /* Messages related to using skills */
00328 #define MSG_TYPE_APPLY              13  /* Applying objects */
00329 #define MSG_TYPE_ATTACK             14  /* Attack related messges */
00330 #define MSG_TYPE_COMMUNICATION      15  /* Communication between players */
00331 #define MSG_TYPE_SPELL              16  /* Spell related info */
00332 #define MSG_TYPE_ITEM               17  /* Item related information */
00333 #define MSG_TYPE_MISC               18  /* Messages that don't go anyplace else */
00334 #define MSG_TYPE_VICTIM             19  /* Something bad is happening to the player */
00335 #define MSG_TYPE_LAST               20
00336 
00337 #define MSG_SUBTYPE_NONE         0
00338 
00339 /* book messages subtypes */
00340 #define MSG_TYPE_BOOK_CLASP_1    1
00341 #define MSG_TYPE_BOOK_CLASP_2    2
00342 #define MSG_TYPE_BOOK_ELEGANT_1  3
00343 #define MSG_TYPE_BOOK_ELEGANT_2  4
00344 #define MSG_TYPE_BOOK_QUARTO_1   5
00345 #define MSG_TYPE_BOOK_QUARTO_2   6
00346 #define MSG_TYPE_BOOK_SPELL_EVOKER    7
00347 #define MSG_TYPE_BOOK_SPELL_PRAYER    8
00348 #define MSG_TYPE_BOOK_SPELL_PYRO      9
00349 #define MSG_TYPE_BOOK_SPELL_SORCERER  10
00350 #define MSG_TYPE_BOOK_SPELL_SUMMONER  11
00351 
00352 /* card messages subtypes*/
00353 #define MSG_TYPE_CARD_SIMPLE_1    1
00354 #define MSG_TYPE_CARD_SIMPLE_2    2
00355 #define MSG_TYPE_CARD_SIMPLE_3    3
00356 #define MSG_TYPE_CARD_ELEGANT_1   4
00357 #define MSG_TYPE_CARD_ELEGANT_2   5
00358 #define MSG_TYPE_CARD_ELEGANT_3   6
00359 #define MSG_TYPE_CARD_STRANGE_1   7
00360 #define MSG_TYPE_CARD_STRANGE_2   8
00361 #define MSG_TYPE_CARD_STRANGE_3   9
00362 #define MSG_TYPE_CARD_MONEY_1     10
00363 #define MSG_TYPE_CARD_MONEY_2     11
00364 #define MSG_TYPE_CARD_MONEY_3     12
00365 
00366 /* Paper messages subtypes */
00367 #define MSG_TYPE_PAPER_NOTE_1       1
00368 #define MSG_TYPE_PAPER_NOTE_2       2
00369 #define MSG_TYPE_PAPER_NOTE_3       3
00370 #define MSG_TYPE_PAPER_LETTER_OLD_1 4
00371 #define MSG_TYPE_PAPER_LETTER_OLD_2 5
00372 #define MSG_TYPE_PAPER_LETTER_NEW_1 6
00373 #define MSG_TYPE_PAPER_LETTER_NEW_2 7
00374 #define MSG_TYPE_PAPER_ENVELOPE_1   8
00375 #define MSG_TYPE_PAPER_ENVELOPE_2   9
00376 #define MSG_TYPE_PAPER_SCROLL_OLD_1 10
00377 #define MSG_TYPE_PAPER_SCROLL_OLD_2 11
00378 #define MSG_TYPE_PAPER_SCROLL_NEW_1 12
00379 #define MSG_TYPE_PAPER_SCROLL_NEW_2 13
00380 #define MSG_TYPE_PAPER_SCROLL_MAGIC 14
00381 
00382 /* road signs messages subtypes */
00383 #define MSG_TYPE_SIGN_BASIC         1
00384 #define MSG_TYPE_SIGN_DIR_LEFT      2
00385 #define MSG_TYPE_SIGN_DIR_RIGHT     3
00386 #define MSG_TYPE_SIGN_DIR_BOTH      4
00387 
00388 /* stones and monument messages */
00389 #define MSG_TYPE_MONUMENT_STONE_1      1
00390 #define MSG_TYPE_MONUMENT_STONE_2      2
00391 #define MSG_TYPE_MONUMENT_STONE_3      3
00392 #define MSG_TYPE_MONUMENT_STATUE_1     4
00393 #define MSG_TYPE_MONUMENT_STATUE_2     5
00394 #define MSG_TYPE_MONUMENT_STATUE_3     6
00395 #define MSG_TYPE_MONUMENT_GRAVESTONE_1 7
00396 #define MSG_TYPE_MONUMENT_GRAVESTONE_2 8
00397 #define MSG_TYPE_MONUMENT_GRAVESTONE_3 9
00398 #define MSG_TYPE_MONUMENT_WALL_1       10
00399 #define MSG_TYPE_MONUMENT_WALL_2       11
00400 #define MSG_TYPE_MONUMENT_WALL_3       12
00401 
00402 /* dialog messsage */
00403 #define MSG_TYPE_DIALOG_NPC             1   /* A message from the npc */
00404 #define MSG_TYPE_DIALOG_ALTAR           2   /* A message from an altar */
00405 #define MSG_TYPE_DIALOG_MAGIC_MOUTH     3   /* Magic Mouth/Magic Ear */
00406 
00407 /* MOTD doesn't have any subtypes */
00408 
00409 /* admin/global messages */
00410 #define MSG_TYPE_ADMIN_RULES        1
00411 #define MSG_TYPE_ADMIN_NEWS         2
00412 #define MSG_TYPE_ADMIN_PLAYER       3       /* Player coming/going/death */
00413 #define MSG_TYPE_ADMIN_DM           4       /* DM related admin actions */
00414 #define MSG_TYPE_ADMIN_HISCORE      5       /* Hiscore list */
00415 #define MSG_TYPE_ADMIN_LOADSAVE     6       /* load/save operations */
00416 #define MSG_TYPE_ADMIN_LOGIN        7       /* login messages/errors */
00417 #define MSG_TYPE_ADMIN_VERSION      8       /* version info */
00418 
00419 
00420 /* I'm not actually expecting anything to make much use of the MSG_TYPE_SHOP
00421  * values However, to use the media tags, need to use draw_ext_info, and need
00422  * to have a type/subtype, so figured might as well put in real values here.
00423  */
00424 #define MSG_TYPE_SHOP_LISTING           1   /* Shop listings - inventory, */
00425                                             /* what it deals in */
00426 #define MSG_TYPE_SHOP_PAYMENT           2   /* Messages about payment, lack */
00427                                             /* of funds */
00428 #define MSG_TYPE_SHOP_SELL              3   /* Messages about selling items */
00429 #define MSG_TYPE_SHOP_MISC              4   /* Random messages */
00430 
00431 /* Basically, 1 subtype/command.  Like shops, not expecting much
00432  * to be done, but by having different subtypes, it makes it easier for
00433  * client to store way information (eg, who output)
00434  */
00435 #define MSG_TYPE_COMMAND_WHO        1
00436 #define MSG_TYPE_COMMAND_MAPS       2
00437 #define MSG_TYPE_COMMAND_BODY       3
00438 #define MSG_TYPE_COMMAND_MALLOC     4
00439 #define MSG_TYPE_COMMAND_WEATHER    5
00440 #define MSG_TYPE_COMMAND_STATISTICS 6
00441 #define MSG_TYPE_COMMAND_CONFIG     7   /* bowmode, petmode, applymode */
00442 #define MSG_TYPE_COMMAND_INFO       8   /* Generic info - resistances, etc */
00443 #define MSG_TYPE_COMMAND_QUESTS     9   /* Quest info */
00444 #define MSG_TYPE_COMMAND_DEBUG      10  /* Various debug type commands */
00445 #define MSG_TYPE_COMMAND_ERROR      11  /* Bad syntax/can't use command */
00446 #define MSG_TYPE_COMMAND_SUCCESS    12  /* Successful result from command */
00447 #define MSG_TYPE_COMMAND_FAILURE    13  /* Failed result from command */
00448 #define MSG_TYPE_COMMAND_EXAMINE    14  /* Player examining something */
00449 #define MSG_TYPE_COMMAND_INVENTORY  15  /* Inventory listing */
00450 #define MSG_TYPE_COMMAND_HELP       16  /* Help related information */
00451 #define MSG_TYPE_COMMAND_DM         17  /* DM related commands */
00452 #define MSG_TYPE_COMMAND_NEWPLAYER  18  /* Create a new character - not */
00453                                         /* really a command, but is responding */
00454                                         /* to player input */
00455 
00456 /* This is somewhat verbose.  If the client ends up being able to
00457  * choose various attributes based on message type, I think it is important
00458  * for the client to know if this is a benefit or detriment to the player.
00459  * In the case of losing a bonus, this typically indicates a spell has
00460  * ended, which is probably more important (and should be displayed more
00461  * prominently) than when you cast the spell
00462  */
00463 
00464 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN  1   /* Atacktypes here refer to */
00465 #define MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS  2   /* the player gaining or */
00466                                                 /* losing these attacktypes */
00467                                                 /* not being a victim of an */
00468                                                 /* attacktype. */
00469 #define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN  3   /* Protections in this */
00470 #define MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS  4   /* context  are pretty */
00471                                                 /* generic - things like */
00472                                                 /* reflection or lifesave */
00473                                                 /* are also under the */
00474                                                 /* protection category. */
00475 #define MSG_TYPE_ATTRIBUTE_MOVE             5   /* A change in the movement */
00476                                                 /* type of the player */
00477 #define MSG_TYPE_ATTRIBUTE_RACE             6   /* Racial related changes */
00478 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START 7   /* The start/end of bad */
00479 #define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END   8   /* effects to the player */
00480 #define MSG_TYPE_ATTRIBUTE_STAT_GAIN        9   /* Start/end of stat changes */
00481 #define MSG_TYPE_ATTRIBUTE_STAT_LOSS        10
00482 #define MSG_TYPE_ATTRIBUTE_LEVEL_GAIN       11  /* Gaining/losing of levels */
00483 #define MSG_TYPE_ATTRIBUTE_LEVEL_LOSS       12
00484 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START 13 /* Like bad effects, but for */
00485 #define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END  14  /* good effects to the player */
00486 #define MSG_TYPE_ATTRIBUTE_GOD              15  /* changing god info */
00487 
00488 
00489 /* I think one type/skill is overkill, so instead, use broader categories
00490  * for these messages.
00491  * The difference in ERROR vs FAILURE is basically this:  ERROR indicates
00492  * something wasn't right to even attempt to use the skill (don't have
00493  * needed object, or haven't marked objects, etc).
00494  * FAILURE indicates that player attempted to use the skill, but it
00495  * didn't work.
00496  * PRAY is listed out because praying over altars can generate some
00497  * messages not really related to the skill itself.
00498  */
00499 #define MSG_TYPE_SKILL_MISSING  1       /* Don't have the skill */
00500 #define MSG_TYPE_SKILL_ERROR    2       /* Doing something wrong */
00501 #define MSG_TYPE_SKILL_SUCCESS  3       /* Successfully used skill */
00502 #define MSG_TYPE_SKILL_FAILURE  4       /* Failure in using skill */
00503 #define MSG_TYPE_SKILL_PRAY     5       /* Praying related messages */
00504 #define MSG_TYPE_SKILL_LIST     6       /* List of skills */
00505 
00506 
00507 /* Messages related to applying objects.  Note that applying many
00508  * objects may generate MSG_TYPE_ATTRIBUTE messages - the APPLY here
00509  * more directly related to the direct messages related to applying
00510  * them (you put on your armor, you apply scroll, etc).
00511  * The ERROR is like that for SKILLS - something prevent even trying
00512  * to apply the object.  FAILURE indicates result wasn't successful.
00513  */
00514 #define MSG_TYPE_APPLY_ERROR    1
00515 #define MSG_TYPE_APPLY_UNAPPLY  2   /* Unapply an object */
00516 #define MSG_TYPE_APPLY_SUCCESS  3   /* Was able to apply object */
00517 #define MSG_TYPE_APPLY_FAILURE  4   /* Apply OK, but no/bad result */
00518 #define MSG_TYPE_APPLY_CURSED   5   /* Applied a cursed object (BAD) */
00519 #define MSG_TYPE_APPLY_TRAP     6   /* Have activated a trap */
00520 #define MSG_TYPE_APPLY_BADBODY  7   /* Don't have body to use object */
00521 #define MSG_TYPE_APPLY_PROHIBITION 8   /* Class/god prohibiiton on obj */
00522 #define MSG_TYPE_APPLY_BUILD    9   /* Build related actions */
00523 
00524 /* attack related messages */
00525 #define MSG_TYPE_ATTACK_DID_HIT     1   /* Player hit something else */
00526 #define MSG_TYPE_ATTACK_PET_HIT     2   /* Players pet hit something else */
00527 #define MSG_TYPE_ATTACK_FUMBLE      3   /* Player fumbled attack */
00528 #define MSG_TYPE_ATTACK_DID_KILL    4   /* Player killed something */
00529 #define MSG_TYPE_ATTACK_PET_DIED    5   /* Pet was killed */
00530 #define MSG_TYPE_ATTACK_NOKEY       6   /* Keys are like attacks, so... */
00531 #define MSG_TYPE_ATTACK_NOATTACK    7   /* You avoid attacking */
00532 #define MSG_TYPE_ATTACK_PUSHED      8   /* Pushed a friendly player */
00533 
00534 #define MSG_TYPE_COMMUNICATION_RANDOM   1   /* Random event (coin toss) */
00535 #define MSG_TYPE_COMMUNICATION_SAY      2   /* Player says something */
00536 #define MSG_TYPE_COMMUNICATION_ME       3   /* Player me's a message */
00537 #define MSG_TYPE_COMMUNICATION_TELL     4   /* Player tells something */
00538 #define MSG_TYPE_COMMUNICATION_EMOTE    5   /* Player emotes */
00539 #define MSG_TYPE_COMMUNICATION_PARTY    6   /* Party message */
00540 #define MSG_TYPE_COMMUNICATION_SHOUT    7   /* Party message */
00541 #define MSG_TYPE_COMMUNICATION_CHAT     8   /* Party message */
00542 
00543 #define MSG_TYPE_SPELL_HEAL             1   /* Healing related spells */
00544 #define MSG_TYPE_SPELL_PET              2   /* Pet related messages */
00545 #define MSG_TYPE_SPELL_FAILURE          3   /* Spell failure messages */
00546 #define MSG_TYPE_SPELL_END              4   /* A spell ends */
00547 #define MSG_TYPE_SPELL_SUCCESS          5   /* Spell succeeded messages */
00548 #define MSG_TYPE_SPELL_ERROR            6   /* Spell failure messages */
00549 #define MSG_TYPE_SPELL_PERCEIVE_SELF    7   /* Perceive self messages */
00550 #define MSG_TYPE_SPELL_TARGET           8   /* Target of non attack spell */
00551 #define MSG_TYPE_SPELL_INFO             9   /* random info about spell, not */
00552                                             /* related to failure/success */
00553 
00554 #define MSG_TYPE_ITEM_REMOVE            1   /* Item removed from inv */
00555 #define MSG_TYPE_ITEM_ADD               2   /* Item added to inv */
00556 #define MSG_TYPE_ITEM_CHANGE            3   /* Item has changed in some way */
00557 #define MSG_TYPE_ITEM_INFO              3   /* Information related to an item */
00558 
00559 /* MSG_TYPE_MISC, by its very nature, doesn't really have subtypes.  It is
00560  * used for messages that really don't belong anyplace else
00561  */
00562 
00563 #define MSG_TYPE_VICTIM_SWAMP           1   /* Player is sinking in a swamp */
00564 #define MSG_TYPE_VICTIM_WAS_HIT         2   /* Player was hit by something */
00565 #define MSG_TYPE_VICTIM_STEAL           3   /* Someone tried to steal from the player */
00566 #define MSG_TYPE_VICTIM_SPELL           4   /* Someone cast a bad spell on the player */
00567 #define MSG_TYPE_VICTIM_DIED            5   /* Player died! */
00568 #define MSG_TYPE_VICTIM_WAS_PUSHED      6   /* Player was pushed or attempted pushed */
00569 
00570 /* Contains the base information we use to make up a packet we want to send. */
00571 typedef struct SockList {
00572     int len;
00573     unsigned char *buf;
00574 } SockList;
00575 
00576 typedef struct CS_Stats {
00577     int     ibytes;     /* ibytes, obytes are bytes in, out */
00578     int     obytes;
00579     short   max_conn;   /* Maximum connections received */
00580     time_t  time_start; /* When we started logging this */
00581 } CS_Stats;
00582 
00583 
00584 extern CS_Stats cst_tot, cst_lst;
00585 
00586 #endif /* NEWCLIENT_H */