/ circle3.1 / src / constants.c
constants.c
  1  /* ************************************************************************
  2  *   File: constants.c                                   Part of CircleMUD *
  3  *  Usage: Numeric and string contants used by the MUD                     *
  4  *                                                                         *
  5  *  All rights reserved.  See license.doc for complete information.        *
  6  *                                                                         *
  7  *  Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
  8  *  CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.               *
  9  ************************************************************************ */
 10  
 11  #include "conf.h"
 12  #include "sysdep.h"
 13  
 14  #include "structs.h"
 15  #include "interpreter.h"	/* alias_data */
 16  
 17  cpp_extern const char *circlemud_version =
 18  	"CircleMUD, version 3.1";
 19  
 20  /* strings corresponding to ordinals/bitvectors in structs.h ***********/
 21  
 22  
 23  /* (Note: strings for class definitions in class.c instead of here) */
 24  
 25  
 26  /* cardinal directions */
 27  const char *dirs[] =
 28  {
 29    "north",
 30    "east",
 31    "south",
 32    "west",
 33    "up",
 34    "down",
 35    "\n"
 36  };
 37  
 38  
 39  /* ROOM_x */
 40  const char *room_bits[] = {
 41    "DARK",
 42    "DEATH",
 43    "NO_MOB",
 44    "INDOORS",
 45    "PEACEFUL",
 46    "SOUNDPROOF",
 47    "NO_TRACK",
 48    "NO_MAGIC",
 49    "TUNNEL",
 50    "PRIVATE",
 51    "GODROOM",
 52    "HOUSE",
 53    "HCRSH",
 54    "ATRIUM",
 55    "OLC",
 56    "*",				/* BFS MARK */
 57    "\n"
 58  };
 59  
 60  
 61  /* EX_x */
 62  const char *exit_bits[] = {
 63    "DOOR",
 64    "CLOSED",
 65    "LOCKED",
 66    "PICKPROOF",
 67    "\n"
 68  };
 69  
 70  
 71  /* SECT_ */
 72  const char *sector_types[] = {
 73    "Inside",
 74    "City",
 75    "Field",
 76    "Forest",
 77    "Hills",
 78    "Mountains",
 79    "Water (Swim)",
 80    "Water (No Swim)",
 81    "In Flight",
 82    "Underwater",
 83    "\n"
 84  };
 85  
 86  
 87  /*
 88   * SEX_x
 89   * Not used in sprinttype() so no \n.
 90   */
 91  const char *genders[] =
 92  {
 93    "neutral",
 94    "male",
 95    "female",
 96    "\n"
 97  };
 98  
 99  
100  /* POS_x */
101  const char *position_types[] = {
102    "Dead",
103    "Mortally wounded",
104    "Incapacitated",
105    "Stunned",
106    "Sleeping",
107    "Resting",
108    "Sitting",
109    "Fighting",
110    "Standing",
111    "\n"
112  };
113  
114  
115  /* PLR_x */
116  const char *player_bits[] = {
117    "KILLER",
118    "THIEF",
119    "FROZEN",
120    "DONTSET",
121    "WRITING",
122    "MAILING",
123    "CSH",
124    "SITEOK",
125    "NOSHOUT",
126    "NOTITLE",
127    "DELETED",
128    "LOADRM",
129    "NO_WIZL",
130    "NO_DEL",
131    "INVST",
132    "CRYO",
133    "DEAD",    /* You should never see this. */
134    "\n"
135  };
136  
137  
138  /* MOB_x */
139  const char *action_bits[] = {
140    "SPEC",
141    "SENTINEL",
142    "SCAVENGER",
143    "ISNPC",
144    "AWARE",
145    "AGGR",
146    "STAY-ZONE",
147    "WIMPY",
148    "AGGR_EVIL",
149    "AGGR_GOOD",
150    "AGGR_NEUTRAL",
151    "MEMORY",
152    "HELPER",
153    "NO_CHARM",
154    "NO_SUMMN",
155    "NO_SLEEP",
156    "NO_BASH",
157    "NO_BLIND",
158    "DEAD",    /* You should never see this. */
159    "\n"
160  };
161  
162  
163  /* PRF_x */
164  const char *preference_bits[] = {
165    "BRIEF",
166    "COMPACT",
167    "DEAF",
168    "NO_TELL",
169    "D_HP",
170    "D_MANA",
171    "D_MOVE",
172    "AUTOEX",
173    "NO_HASS",
174    "QUEST",
175    "SUMN",
176    "NO_REP",
177    "LIGHT",
178    "C1",
179    "C2",
180    "NO_WIZ",
181    "L1",
182    "L2",
183    "NO_AUC",
184    "NO_GOS",
185    "NO_GTZ",
186    "RMFLG",
187    "\n"
188  };
189  
190  
191  /* AFF_x */
192  const char *affected_bits[] =
193  {
194    "BLIND",
195    "INVIS",
196    "DET-ALIGN",
197    "DET-INVIS",
198    "DET-MAGIC",
199    "SENSE-LIFE",
200    "WATWALK",
201    "SANCT",
202    "GROUP",
203    "CURSE",
204    "INFRA",
205    "POISON",
206    "PROT-EVIL",
207    "PROT-GOOD",
208    "SLEEP",
209    "NO_TRACK",
210    "UNUSED",
211    "UNUSED",
212    "SNEAK",
213    "HIDE",
214    "UNUSED",
215    "CHARM",
216    "\n"
217  };
218  
219  
220  /* CON_x */
221  const char *connected_types[] = {
222    "Playing",
223    "Disconnecting",
224    "Get name",
225    "Confirm name",
226    "Get password",
227    "Get new PW",
228    "Confirm new PW",
229    "Select sex",
230    "Select class",
231    "Reading MOTD",
232    "Main Menu",
233    "Get descript.",
234    "Changing PW 1",
235    "Changing PW 2",
236    "Changing PW 3",
237    "Self-Delete 1",
238    "Self-Delete 2",
239    "Disconnecting",
240    "\n"
241  };
242  
243  
244  /*
245   * WEAR_x - for eq list
246   * Not use in sprinttype() so no \n.
247   */
248  const char *wear_where[] = {
249    "<used as light>      ",
250    "<worn on finger>     ",
251    "<worn on finger>     ",
252    "<worn around neck>   ",
253    "<worn around neck>   ",
254    "<worn on body>       ",
255    "<worn on head>       ",
256    "<worn on legs>       ",
257    "<worn on feet>       ",
258    "<worn on hands>      ",
259    "<worn on arms>       ",
260    "<worn as shield>     ",
261    "<worn about body>    ",
262    "<worn about waist>   ",
263    "<worn around wrist>  ",
264    "<worn around wrist>  ",
265    "<wielded>            ",
266    "<held>               "
267  };
268  
269  
270  /* WEAR_x - for stat */
271  const char *equipment_types[] = {
272    "Used as light",
273    "Worn on right finger",
274    "Worn on left finger",
275    "First worn around Neck",
276    "Second worn around Neck",
277    "Worn on body",
278    "Worn on head",
279    "Worn on legs",
280    "Worn on feet",
281    "Worn on hands",
282    "Worn on arms",
283    "Worn as shield",
284    "Worn about body",
285    "Worn around waist",
286    "Worn around right wrist",
287    "Worn around left wrist",
288    "Wielded",
289    "Held",
290    "\n"
291  };
292  
293  
294  /* ITEM_x (ordinal object types) */
295  const char *item_types[] = {
296    "UNDEFINED",
297    "LIGHT",
298    "SCROLL",
299    "WAND",
300    "STAFF",
301    "WEAPON",
302    "FIRE WEAPON",
303    "MISSILE",
304    "TREASURE",
305    "ARMOR",
306    "POTION",
307    "WORN",
308    "OTHER",
309    "TRASH",
310    "TRAP",
311    "CONTAINER",
312    "NOTE",
313    "LIQ CONTAINER",
314    "KEY",
315    "FOOD",
316    "MONEY",
317    "PEN",
318    "BOAT",
319    "FOUNTAIN",
320    "\n"
321  };
322  
323  
324  /* ITEM_WEAR_ (wear bitvector) */
325  const char *wear_bits[] = {
326    "TAKE",
327    "FINGER",
328    "NECK",
329    "BODY",
330    "HEAD",
331    "LEGS",
332    "FEET",
333    "HANDS",
334    "ARMS",
335    "SHIELD",
336    "ABOUT",
337    "WAIST",
338    "WRIST",
339    "WIELD",
340    "HOLD",
341    "\n"
342  };
343  
344  
345  /* ITEM_x (extra bits) */
346  const char *extra_bits[] = {
347    "GLOW",
348    "HUM",
349    "NO_RENT",
350    "NO_DONATE",
351    "NO_INVIS",
352    "INVISIBLE",
353    "MAGIC",
354    "NO_DROP",
355    "BLESS",
356    "ANTI_GOOD",
357    "ANTI_EVIL",
358    "ANTI_NEUTRAL",
359    "ANTI_MAGE",
360    "ANTI_CLERIC",
361    "ANTI_THIEF",
362    "ANTI_WARRIOR",
363    "NO_SELL",
364    "\n"
365  };
366  
367  
368  /* APPLY_x */
369  const char *apply_types[] = {
370    "NONE",
371    "STR",
372    "DEX",
373    "INT",
374    "WIS",
375    "CON",
376    "CHA",
377    "CLASS",
378    "LEVEL",
379    "AGE",
380    "CHAR_WEIGHT",
381    "CHAR_HEIGHT",
382    "MAXMANA",
383    "MAXHIT",
384    "MAXMOVE",
385    "GOLD",
386    "EXP",
387    "ARMOR",
388    "HITROLL",
389    "DAMROLL",
390    "SAVING_PARA",
391    "SAVING_ROD",
392    "SAVING_PETRI",
393    "SAVING_BREATH",
394    "SAVING_SPELL",
395    "\n"
396  };
397  
398  
399  /* CONT_x */
400  const char *container_bits[] = {
401    "CLOSEABLE",
402    "PICKPROOF",
403    "CLOSED",
404    "LOCKED",
405    "\n",
406  };
407  
408  
409  /* LIQ_x */
410  const char *drinks[] =
411  {
412    "water",
413    "beer",
414    "wine",
415    "ale",
416    "dark ale",
417    "whisky",
418    "lemonade",
419    "firebreather",
420    "local speciality",
421    "slime mold juice",
422    "milk",
423    "tea",
424    "coffee",
425    "blood",
426    "salt water",
427    "clear water",
428    "\n"
429  };
430  
431  
432  /* other constants for liquids ******************************************/
433  
434  
435  /* one-word alias for each drink */
436  const char *drinknames[] =
437  {
438    "water",
439    "beer",
440    "wine",
441    "ale",
442    "ale",
443    "whisky",
444    "lemonade",
445    "firebreather",
446    "local",
447    "juice",
448    "milk",
449    "tea",
450    "coffee",
451    "blood",
452    "salt",
453    "water",
454    "\n"
455  };
456  
457  
458  /* effect of drinks on hunger, thirst, and drunkenness -- see values.doc */
459  int drink_aff[][3] = {
460    {0, 1, 10},
461    {3, 2, 5},
462    {5, 2, 5},
463    {2, 2, 5},
464    {1, 2, 5},
465    {6, 1, 4},
466    {0, 1, 8},
467    {10, 0, 0},
468    {3, 3, 3},
469    {0, 4, -8},
470    {0, 3, 6},
471    {0, 1, 6},
472    {0, 1, 6},
473    {0, 2, -1},
474    {0, 1, -2},
475    {0, 0, 13}
476  };
477  
478  
479  /* color of the various drinks */
480  const char *color_liquid[] =
481  {
482    "clear",
483    "brown",
484    "clear",
485    "brown",
486    "dark",
487    "golden",
488    "red",
489    "green",
490    "clear",
491    "light green",
492    "white",
493    "brown",
494    "black",
495    "red",
496    "clear",
497    "crystal clear",
498    "\n"
499  };
500  
501  
502  /*
503   * level of fullness for drink containers
504   * Not used in sprinttype() so no \n.
505   */
506  const char *fullness[] =
507  {
508    "less than half ",
509    "about half ",
510    "more than half ",
511    ""
512  };
513  
514  
515  /* str, int, wis, dex, con applies **************************************/
516  
517  
518  /* [ch] strength apply (all) */
519  cpp_extern const struct str_app_type str_app[] = {
520    {-5, -4, 0, 0},	/* str = 0 */
521    {-5, -4, 3, 1},	/* str = 1 */
522    {-3, -2, 3, 2},
523    {-3, -1, 10, 3},
524    {-2, -1, 25, 4},
525    {-2, -1, 55, 5},	/* str = 5 */
526    {-1, 0, 80, 6},
527    {-1, 0, 90, 7},
528    {0, 0, 100, 8},
529    {0, 0, 100, 9},
530    {0, 0, 115, 10},	/* str = 10 */
531    {0, 0, 115, 11},
532    {0, 0, 140, 12},
533    {0, 0, 140, 13},
534    {0, 0, 170, 14},
535    {0, 0, 170, 15},	/* str = 15 */
536    {0, 1, 195, 16},
537    {1, 1, 220, 18},
538    {1, 2, 255, 20},	/* str = 18 */
539    {3, 7, 640, 40},
540    {3, 8, 700, 40},	/* str = 20 */
541    {4, 9, 810, 40},
542    {4, 10, 970, 40},
543    {5, 11, 1130, 40},
544    {6, 12, 1440, 40},
545    {7, 14, 1750, 40},	/* str = 25 */
546    {1, 3, 280, 22},	/* str = 18/0 - 18-50 */
547    {2, 3, 305, 24},	/* str = 18/51 - 18-75 */
548    {2, 4, 330, 26},	/* str = 18/76 - 18-90 */
549    {2, 5, 380, 28},	/* str = 18/91 - 18-99 */
550    {3, 6, 480, 30}	/* str = 18/100 */
551  };
552  
553  
554  
555  /* [dex] skill apply (thieves only) */
556  cpp_extern const struct dex_skill_type dex_app_skill[] = {
557    {-99, -99, -90, -99, -60},	/* dex = 0 */
558    {-90, -90, -60, -90, -50},	/* dex = 1 */
559    {-80, -80, -40, -80, -45},
560    {-70, -70, -30, -70, -40},
561    {-60, -60, -30, -60, -35},
562    {-50, -50, -20, -50, -30},	/* dex = 5 */
563    {-40, -40, -20, -40, -25},
564    {-30, -30, -15, -30, -20},
565    {-20, -20, -15, -20, -15},
566    {-15, -10, -10, -20, -10},
567    {-10, -5, -10, -15, -5},	/* dex = 10 */
568    {-5, 0, -5, -10, 0},
569    {0, 0, 0, -5, 0},
570    {0, 0, 0, 0, 0},
571    {0, 0, 0, 0, 0},
572    {0, 0, 0, 0, 0},		/* dex = 15 */
573    {0, 5, 0, 0, 0},
574    {5, 10, 0, 5, 5},
575    {10, 15, 5, 10, 10},		/* dex = 18 */
576    {15, 20, 10, 15, 15},
577    {15, 20, 10, 15, 15},		/* dex = 20 */
578    {20, 25, 10, 15, 20},
579    {20, 25, 15, 20, 20},
580    {25, 25, 15, 20, 20},
581    {25, 30, 15, 25, 25},
582    {25, 30, 15, 25, 25}		/* dex = 25 */
583  };
584  
585  
586  
587  /* [dex] apply (all) */
588  cpp_extern const struct dex_app_type dex_app[] = {
589    {-7, -7, 6},		/* dex = 0 */
590    {-6, -6, 5},		/* dex = 1 */
591    {-4, -4, 5},
592    {-3, -3, 4},
593    {-2, -2, 3},
594    {-1, -1, 2},		/* dex = 5 */
595    {0, 0, 1},
596    {0, 0, 0},
597    {0, 0, 0},
598    {0, 0, 0},
599    {0, 0, 0},		/* dex = 10 */
600    {0, 0, 0},
601    {0, 0, 0},
602    {0, 0, 0},
603    {0, 0, 0},
604    {0, 0, -1},		/* dex = 15 */
605    {1, 1, -2},
606    {2, 2, -3},
607    {2, 2, -4},		/* dex = 18 */
608    {3, 3, -4},
609    {3, 3, -4},		/* dex = 20 */
610    {4, 4, -5},
611    {4, 4, -5},
612    {4, 4, -5},
613    {5, 5, -6},
614    {5, 5, -6}		/* dex = 25 */
615  };
616  
617  
618  
619  /* [con] apply (all) */
620  cpp_extern const struct con_app_type con_app[] = {
621    {-4, 20},		/* con = 0 */
622    {-3, 25},		/* con = 1 */
623    {-2, 30},
624    {-2, 35},
625    {-1, 40},
626    {-1, 45},		/* con = 5 */
627    {-1, 50},
628    {0, 55},
629    {0, 60},
630    {0, 65},
631    {0, 70},		/* con = 10 */
632    {0, 75},
633    {0, 80},
634    {0, 85},
635    {0, 88},
636    {1, 90},		/* con = 15 */
637    {2, 95},
638    {2, 97},
639    {3, 99},		/* con = 18 */
640    {3, 99},
641    {4, 99},		/* con = 20 */
642    {5, 99},
643    {5, 99},
644    {5, 99},
645    {6, 99},
646    {6, 99}		/* con = 25 */
647  };
648  
649  
650  
651  /* [int] apply (all) */
652  cpp_extern const struct int_app_type int_app[] = {
653    {3},		/* int = 0 */
654    {5},		/* int = 1 */
655    {7},
656    {8},
657    {9},
658    {10},		/* int = 5 */
659    {11},
660    {12},
661    {13},
662    {15},
663    {17},		/* int = 10 */
664    {19},
665    {22},
666    {25},
667    {30},
668    {35},		/* int = 15 */
669    {40},
670    {45},
671    {50},		/* int = 18 */
672    {53},
673    {55},		/* int = 20 */
674    {56},
675    {57},
676    {58},
677    {59},
678    {60}		/* int = 25 */
679  };
680  
681  
682  /* [wis] apply (all) */
683  cpp_extern const struct wis_app_type wis_app[] = {
684    {0},	/* wis = 0 */
685    {0},  /* wis = 1 */
686    {0},
687    {0},
688    {0},
689    {0},  /* wis = 5 */
690    {0},
691    {0},
692    {0},
693    {0},
694    {0},  /* wis = 10 */
695    {0},
696    {2},
697    {2},
698    {3},
699    {3},  /* wis = 15 */
700    {3},
701    {4},
702    {5},	/* wis = 18 */
703    {6},
704    {6},  /* wis = 20 */
705    {6},
706    {6},
707    {7},
708    {7},
709    {7}  /* wis = 25 */
710  };
711  
712  
713  const char *npc_class_types[] = {
714    "Normal",
715    "Undead",
716    "\n"
717  };
718  
719  
720  int rev_dir[] =
721  {
722    2,
723    3,
724    0,
725    1,
726    5,
727    4
728  };
729  
730  
731  int movement_loss[] =
732  {
733    1,	/* Inside     */
734    1,	/* City       */
735    2,	/* Field      */
736    3,	/* Forest     */
737    4,	/* Hills      */
738    6,	/* Mountains  */
739    4,	/* Swimming   */
740    1,	/* Unswimable */
741    1,	/* Flying     */
742    5     /* Underwater */
743  };
744  
745  /* Not used in sprinttype(). */
746  const char *weekdays[] = {
747    "the Day of the Moon",
748    "the Day of the Bull",
749    "the Day of the Deception",
750    "the Day of Thunder",
751    "the Day of Freedom",
752    "the Day of the Great Gods",
753    "the Day of the Sun"
754  };
755  
756  
757  /* Not used in sprinttype(). */
758  const char *month_name[] = {
759    "Month of Winter",		/* 0 */
760    "Month of the Winter Wolf",
761    "Month of the Frost Giant",
762    "Month of the Old Forces",
763    "Month of the Grand Struggle",
764    "Month of the Spring",
765    "Month of Nature",
766    "Month of Futility",
767    "Month of the Dragon",
768    "Month of the Sun",
769    "Month of the Heat",
770    "Month of the Battle",
771    "Month of the Dark Shades",
772    "Month of the Shadows",
773    "Month of the Long Shadows",
774    "Month of the Ancient Darkness",
775    "Month of the Great Evil"
776  };
777  
778  
779  /* --- End of constants arrays. --- */
780  
781  /*
782   * Various arrays we count so we can check the world files.  These
783   * must be at the bottom of the file so they're pre-declared.
784   */
785  size_t	room_bits_count = sizeof(room_bits) / sizeof(room_bits[0]) - 1,
786  	action_bits_count = sizeof(action_bits) / sizeof(action_bits[0]) - 1,
787  	affected_bits_count = sizeof(affected_bits) / sizeof(affected_bits[0]) - 1,
788  	extra_bits_count = sizeof(extra_bits) / sizeof(extra_bits[0]) - 1,
789  	wear_bits_count = sizeof(wear_bits) / sizeof(wear_bits[0]) - 1;
790