/************************************************************	/************************************************************
 *  file: db.h , Database module.                          Pa |	*		 MEDIEVIA CyberSpace Code and Data files
 *  Usage: Loading/Saving chars booting world.                |	*       Copyright (C) 1992, 1995 INTENSE Software(tm) and Mik
 *  Copyright (C) 1990, 1991 - see 'license.doc' for complete |	*			   All rights reserved		
 *                                                            |	*************************************************************
 *  Copyright (C) 1992, 1993 Michael Chastain, Michael Quan,  <
 *  Performance optimization and bug fixes by MERC Industries <
 *  You can use our stuff in any way you like whatsoever so l <
 *  copyright notice remains intact.  If you like it please d <
 *  to mec@garnet.berkeley.edu.                               <
 *                                                            <
 *  This is free software and you are benefitting.  We hope t <
 *  share your changes too.  What goes around, comes around.  <
 ************************************************************ <


/* data files used by the game system */			/* data files used by the game system */

							      >	#define MAX_ROOM    65534
							      >	#define MAX_MOB	    20000
							      >	#define MAX_OBJ	    20000
							      >	#define MAX_INDEX   20000
							      >	#define MAX_RACTION 20000
							      >	#define MAX_ZONE    200
							      >	#define MAX_TRIVIA  1500
#define DFLT_DIR          "../lib"        /* default data dir	#define DFLT_DIR          "../lib"        /* default data dir
#define SAVE_DIR          "../save"       /* save directory  	#define SAVE_DIR          "../save"       /* save directory  

#define WORLD_FILE        "tinyworld.wld" /* room definitions |	#define WORLD_FILE        "medievia.wld" /* room definitions 
#define MOB_FILE          "tinyworld.mob" /* monster prototyp |	#define MOB_FILE          "medievia.mob" /* monster prototype
#define OBJ_FILE          "tinyworld.obj" /* object prototype |	#define OBJ_FILE          "medievia.obj" /* object prototypes
#define ZONE_FILE         "tinyworld.zon" /* zone defs & comm |	#define ZONE_FILE         "medievia.zon" /* zone defs & comma
#define SHOP_FILE         "tinyworld.shp" /* shop messages an |	#define SHOP_FILE         "medievia.shp" /* shop messages and
#define GREETINGS_FILE    "greetings.txt" /* initial greeting	#define GREETINGS_FILE    "greetings.txt" /* initial greeting
#define CREDITS_FILE      "credits.txt"   /* for the 'credits	#define CREDITS_FILE      "credits.txt"   /* for the 'credits
#define NEWS_FILE         "news.txt"      /* for the 'news' c	#define NEWS_FILE         "news.txt"      /* for the 'news' c
#define MOTD_FILE         "motd.txt"      /* messages of toda	#define MOTD_FILE         "motd.txt"      /* messages of toda
							      >	#define MODS_FILE         "mods.txt"      /* our mods        
#define STORY_FILE        "story.txt"     /* game story      	#define STORY_FILE        "story.txt"     /* game story      
#define TIME_FILE         "time.txt"      /* game calendar in	#define TIME_FILE         "time.txt"      /* game calendar in
#define IDEA_FILE         "ideas.txt"     /* for the 'idea'-c	#define IDEA_FILE         "ideas.txt"     /* for the 'idea'-c
#define TYPO_FILE         "typos.txt"     /*         'typo'  	#define TYPO_FILE         "typos.txt"     /*         'typo'  
#define BUG_FILE          "bugs.txt"      /*         'bug'   	#define BUG_FILE          "bugs.txt"      /*         'bug'   
#define MESS_FILE         "messages.txt"  /* damage message  	#define MESS_FILE         "messages.txt"  /* damage message  
#define SOCIAL_FILE       "social.txt"    /* messgs for socia	#define SOCIAL_FILE       "social.txt"    /* messgs for socia
#define HELP_KWRD_FILE    "help_key.txt"  /* for HELP <keywrd	#define HELP_KWRD_FILE    "help_key.txt"  /* for HELP <keywrd
#define HELP_PAGE_FILE    "help.txt"      /* for HELP <CR>   	#define HELP_PAGE_FILE    "help.txt"      /* for HELP <CR>   
#define INFO_FILE         "info.txt"      /* for INFO        	#define INFO_FILE         "info.txt"      /* for INFO        
#define WIZLIST_FILE      "wizlist.txt"   /* for WIZLIST     	#define WIZLIST_FILE      "wizlist.txt"   /* for WIZLIST     
#define POSEMESS_FILE     "poses.txt"     /* for 'pose'-comma	#define POSEMESS_FILE     "poses.txt"     /* for 'pose'-comma
							      >	#define TRIVIA_FILE		  "trivia.txt"    /* for TRIV
							      >

/* public procedures in db.c */					/* public procedures in db.c */

void boot_db(void);						void boot_db(void);
int create_entry(char *name);					int create_entry(char *name);
void zone_update(void);						void zone_update(void);
void init_char(struct char_data *ch);				void init_char(struct char_data *ch);
void clear_char(struct char_data *ch);				void clear_char(struct char_data *ch);
void clear_object(struct obj_data *obj);			void clear_object(struct obj_data *obj);
void reset_char(struct char_data *ch);				void reset_char(struct char_data *ch);
void free_char(struct char_data *ch);				void free_char(struct char_data *ch);
int real_room(int virtual);					int real_room(int virtual);
char *fread_string(FILE *fl);					char *fread_string(FILE *fl);
int real_object(int virtual);					int real_object(int virtual);
int real_mobile(int virtual);					int real_mobile(int virtual);

#define REAL 0							#define REAL 0
#define VIRTUAL 1						#define VIRTUAL 1

struct obj_data *read_object(int nr, int eq_level);		struct obj_data *read_object(int nr, int eq_level);
struct char_data *read_mobile(int nr, int type);		struct char_data *read_mobile(int nr, int type);
							      |	struct obj_data *load_object(int nr, int eq_level, FILE *new)
							      >	struct char_data *load_mobile(int nr, int type, FILE *new);

/* structure for the reset commands */				/* structure for the reset commands */
struct reset_com						struct reset_com
{								{
							      >	    int zone;
    char command;   /* current command                      *	    char command;   /* current command                      *
    bool if_flag;   /* if TRUE: exe only if preceding exe'd *	    bool if_flag;   /* if TRUE: exe only if preceding exe'd *
    int arg1;       /*                                      *	    int arg1;       /*                                      *
    int arg2;       /* Arguments to the command             *	    int arg2;       /* Arguments to the command             *
    int arg3;       /*                                      *	    int arg3;       /*                                      *
							      >	    int arg4;	    /*					    *

    /* 								    /* 
    *  Commands:              *					    *  Commands:              *
    *  'M': Read a mobile     *					    *  'M': Read a mobile     *
    *  'O': Read an object    *					    *  'O': Read an object    *
    *  'P': Put obj in obj    *					    *  'P': Put obj in obj    *
    *  'G': Obj to char       *					    *  'G': Obj to char       *
    *  'E': Obj to char equip *					    *  'E': Obj to char equip *
    *  'D': Set state of door *					    *  'D': Set state of door *
							      >	    *  'W': Just like the 'E' command with a percent chance t
    */								    */
};								};

							      |	/* continents */
							      >	#define MEDIEVIA 1
							      >	#define TRELLOR 2

/* zone definition structure. for the 'zone-table'   */		/* zone definition structure. for the 'zone-table'   */
struct zone_data						struct zone_data
{								{
    char *name;             /* name of this zone             	    char *name;             /* name of this zone             
							      >	    char *szMaintainer;	    /* Adopt a Zone: Maintainer ! 
    int lifespan;           /* how long between resets (minut	    int lifespan;           /* how long between resets (minut
    int age;                /* current age of this zone (minu	    int age;                /* current age of this zone (minu
    int top;                /* upper limit for rooms in this 	    int top;                /* upper limit for rooms in this 
							      |	    int continent;
							      >	    int numkills;
							      >	    int population;
							      >	    int time_to_empty;
							      >	    bool populated;
							      >	    int num_resets;
    int reset_mode;         /* conditions for reset (see belo	    int reset_mode;         /* conditions for reset (see belo
    struct reset_com *cmd;  /* command table for reset       	    struct reset_com *cmd;  /* command table for reset       
							      |		short int siX;	/* HoloCords information for the zone
							      >		short int siY;
							      >		int iRecallRoom;
							      >		int iSocialRestricted;
    /*								    /*
    *  Reset mode:                              *		    *  Reset mode:                              *
    *  0: Don't reset, and don't update age.    *		    *  0: Don't reset, and don't update age.    *
    *  1: Reset if no PC's are located in zone. *		    *  1: Reset if no PC's are located in zone. *
    *  2: Just reset.                           *		    *  2: Just reset.                           *
    */								    */
};								};




/* element in monster and object index-tables   */		/* element in monster and object index-tables   */
struct index_data						struct index_data
{								{
    int virtual;    /* virtual number of this mob/obj         |	    long pos;
    long pos;       /* file position of this field            <
    int number;     /* number of existing units of this mob/o	    int number;     /* number of existing units of this mob/o
    int (*func)();  /* special procedure for this mob/obj     |	    int (*func)();
};								};




struct help_index_element					struct help_index_element
{								{
    char *keyword;						    char *keyword;
    long pos;							    long pos;
};								};

extern const int exp_table[36+1];				extern const int exp_table[36+1];
extern const char *title_table[4][36][2];			extern const char *title_table[4][36][2];
