pdirt/data/
pdirt/data/HELP/
pdirt/data/HELP/0/
pdirt/data/HELP/F/
pdirt/data/HELP/G/
pdirt/data/HELP/H/
pdirt/data/HELP/J/
pdirt/data/HELP/K/
pdirt/data/HELP/O/
pdirt/data/HELP/Q/
pdirt/data/HELP/R/
pdirt/data/HELP/U/
pdirt/data/HELP/V/
pdirt/data/HELP/Y/
pdirt/data/HELP/Z/
pdirt/data/MESSAGES/
pdirt/data/POWERINFO/
pdirt/data/WIZ_ZONES/
pdirt/drv/
pdirt/drv/bin/
pdirt/drv/compiler/converter/
pdirt/drv/compiler/libs/
pdirt/drv/compiler/scripts/
pdirt/drv/include/AberChat/
pdirt/drv/include/InterMud/
pdirt/drv/include/machine/
pdirt/drv/src/InterMud/
pdirt/drv/src/Players/
pdirt/drv/utils/UAFPort/
pdirt/drv/utils/dnsresolv/
pdirt/drv/utils/gdbm/
#ifndef __MUDTYPES_H__ 
#define __MUDTYPES_H__ 

#include "types.h"
#include <time.h>
#include <sys/time.h>

/*****************************************************************************
 ** Definitions for The various flags.
 ** DoubleLongInt: 96 bits
 ** LongInt      : 64 bits?
 ** long int     : 32 bits?
 *****************************************************************************/
typedef DoubleLongInt  	LFLAGS;
typedef DoubleLongInt  	OFLAGS;
typedef DoubleLongInt  	PFLAGS;
typedef DoubleLongInt  	SFLAGS;
typedef LongInt 	MFLAGS;
typedef LongInt		QFLAGS;    /* Quest flags */

#define TITLE_LEN   	55               /* Max. length of a players title */
#define PROMPT_LEN  	80               /* Max. length of the prompt */
#define PNAME_LEN   	12               /* Max. length of a player-name */
#define MNAME_LEN   	16               /* Max length, mobile-name */
#define ONAME_LEN   	32               /* Max length, object-name */
#define SETIN_MAX   	80               /* Max length, travel-message */
#define TTY_LEN     	64               /* Max length, name of players host */
#define MSG_LEN     	240              /* Max length of a message */
#define PASSWD_LEN  	16               /* Max chars of passwd + 1 */
#define MAX_COM_LEN 	300              /* Max chars in a command line */
#define MAX_EMAIL_LEN   128		 /* max chars in email address */


struct _CastedSpell;
struct _SpellQueue;
/****************************************************************************
 ** Definition for the special events structure (Small struct to give some
 ** more info to the event handler).
 *****************************************************************************/
typedef struct _CommBuf {
  int                 plx;        /* Player for which things should be checked */
  char                *buf;       /* pointer to buffer (for E_ONCOMM) for example */
  int                 loc;        /* Location an object is in */
  int                 ret;        /* Return value (needed for Objects get/give etc) */
  int                 ob;         /* object at stake for give, get*/
  int                 pl;         /* Player number 2 */
  int                 to;         /* Go to where? */
  int                 misc;       /* Misc. events, put handle code here */
  struct _SpellQueue  *spelldata;
} Comm_msg;

/***************************************************************************
 ** Definition of a input handler (function that handles all input of a
 ** player).
 ***************************************************************************/
/* Input handler */
typedef struct _a_inp_h {
  struct _a_inp_h *next;
  void            (*inp_handler)(char *input_string);
} INP_HANDLER;

/*
 * Setin struct
 */
typedef struct _SETIN_STRUCT {
    char	prompt[PROMPT_LEN+1];
    char	setin[SETIN_MAX+1];
    char	setout[SETIN_MAX+1];
    char	setmin[SETIN_MAX+1];
    char	setmout[SETIN_MAX+1];
    char	setvin[SETIN_MAX+1];
    char	setvout[SETIN_MAX+1];
    char	setqin[SETIN_MAX+1];
    char	setqout[SETIN_MAX+1];
    char	setsit[SETIN_MAX+1];
    char	setstand[SETIN_MAX+1];
    char        settrenter[SETIN_MAX+1];
    char        settrvict[SETIN_MAX+1];
    char        settrroom[SETIN_MAX+1];
    char        setsleep[SETIN_MAX+1];
    char        settrance[SETIN_MAX+1];
    char        setaway[SETIN_MAX+1];
} SETIN_STRUCT;


/* A setin-file entry.
 */
typedef struct _SETIN_REC {
    char        name[PNAME_LEN+1];
    char	prompt[PROMPT_LEN+1];
    char	setin[SETIN_MAX+1];
    char	setout[SETIN_MAX+1];
    char	setmin[SETIN_MAX+1];
    char	setmout[SETIN_MAX+1];
    char	setvin[SETIN_MAX+1];
    char	setvout[SETIN_MAX+1];
    char	setqin[SETIN_MAX+1];
    char	setqout[SETIN_MAX+1];
    char	setsit[SETIN_MAX+1];
    char	setstand[SETIN_MAX+1];
    char 	settrenter[SETIN_MAX+1];
    char   	settrvict[SETIN_MAX+1];
    char	settrroom[SETIN_MAX+1];
    char        setsleep[SETIN_MAX+1];
    char        settrance[SETIN_MAX+1];
    char        setaway[SETIN_MAX+1];
    /* Yet unused */
    char        spare2[SETIN_MAX+1];
    char        spare3[SETIN_MAX+1]; 
    char        spare4[SETIN_MAX+1];
} SETIN_REC;


/* A PERSONA as described in the uaf_rand file 
 */
typedef struct _PERSONA {
    char 	p_idname[PNAME_LEN+1];
    char	p_name[PNAME_LEN+1];
    char        p_title[TITLE_LEN+1];
    char	p_email[MAX_EMAIL_LEN+1];
    char        p_passwd[PASSWD_LEN];
    char 	p_prompt[PROMPT_LEN+1];
    char        p_lasthost[MAXHOSTNAMELEN];
    char        p_home[ONAME_LEN+1];
    int		p_score;
    int		p_strength;
    int         p_damage;
    int         p_armor;
    SFLAGS	p_sflags;
    PFLAGS	p_pflags;
    PFLAGS	p_mask;
    QFLAGS      p_quests;
    int		p_vlevel;
    int		p_level;
    time_t      p_last_on;
    int         p_wimpy;
    long int    p_id;
    int         p_pager;
    /* Unused now, for future expantions */
    SFLAGS      spareset2;
    int         p_killed;
    int         p_died;
    int         p_questpoints; 
    int         p_losses;
    int         spareint5;
} PERSONA;



/* zone table entry 
 */
typedef struct _ZONE {
    char	*z_name;   /* Zone name */

    int         maxlocs;
    int         maxmobs;
    int         maxobjs;

    int		startloc;	/* Start of locations */

    int_set     locations;
    int_set     mobiles;
    int_set     objects;

    Boolean     temporary; /* Real zone, or one to destruct on reset ? */
} ZONE;


/* Location data in the rooms arrray as read from locations file 
 */
typedef struct {
    int          r_exit[NEXITS];
    LFLAGS	 r_flags;
    char        *r_short;
    char        *r_long;
    long int     id;
    int_set      objects;      /* Set of objects in this loc. */
    int_set      mobiles;      /* Set of players/mobiles in this loc. */
    int_set      exits_to_me;  /* Set of locations that have exits to this */
    Boolean      temporary;    /* Can it be destructed on reset ? */
    Boolean      touched;      /* Has any exit been changed since last reset?*/
    int          zone;         /* To which zone do we belong ? */
/* Reset data: */
    long int     r_exit_reset[NEXITS];
    LFLAGS       r_flags_reset;

    void         (*spec_case)(int); /* Do special situation */

    struct	_CastedSpell *spells;
} Location;



/* An object
 */
typedef struct {

/* Unalterable, no need to reset on a reset: */
    char	 *oname;      /* objects name */
    char	 *oaltname;   /* objects alternate name */
    char	 *odesc[4];   /* descriptions for each state  */
    int		  omaxstate;  /* max state a wiz can SET an obj to */
    long	  oexamine;   /* ptr in file where examine text is found */
    char         *oexam_text; /* ptr to exam-txt for in-game created objs */
    long int      id;         /* unique ID, needed for new saved objects */
    Boolean       temporary;  /* Part of a wizards permenent zone ? */
    int           linked;     /* Which object, if any, is this linked to ? */
    int           zone;       /* To which zone do we belong ? */
    int           onum;       /* number for the code to test so that cloned
				 objects can behave like the originals. */
/* Alterable, needs saved reset values too: */
    int		  ovalue;     /* base value */
    int		  osize;
    int           oloc;
    int           ovis;       /* the objects visibility level */
    int           odamage;
    int           oarmor;
    int           ocarrf;
    int           ostate;
    OFLAGS        oflags;

    long int      oloc_reset;
    int		  osize_reset;
    int		  ovalue_reset;
    int           ovis_reset;
    int           odamage_reset;
    int           oarmor_reset;
    int           ocarrf_reset;
    int           ostate_reset;
    OFLAGS        oflags_reset;

    int_set       objects;    /* set of objects inside this object */
    void          (*spec_case)(int);
    struct	_CastedSpell *spells;
} Object;


/* A record describing a player or mobile in the world.
 */
typedef struct {
    char          pname[MNAME_LEN+1];
    int           ploc;
    int           phome;      /* players start-loc. and home */
    int           pdam;       /* Damage */
    int           parmor;
    int           pagg;       /* Agression */
    int	          pspeed;     /* Speed */
    int           pcarry;     /* Carrying capacity */
    int           pstr;
    int           pvis;
    int           pkilled;    /* Times killed */
    int           pdied;      /* Times died in a deathroom */
    time_t        p_last_on;
    SFLAGS	  psflags;
    PFLAGS        pflags;
    PFLAGS	  pmask;
    MFLAGS	  pmflags;
    QFLAGS        pquests;
    int		  pquestpoints;
    int           plev;
    int           pweapon;
    int           psitting;
    int           phelping;
    int           pfighting;
    int  	  pscore;

    char         *pftxt;       /* Mobile's one-line description */
    char         *p_exam;      /* exam-text for mobiles (may also be in DESC)*/
    int           pnum;        /* player/mobile number */
    int_set       objects;     /* set of objects carried by this character */
    long int      id;          /* Unique ID */
    Boolean       temporary;   /* Mobile part of a wizards permanent stuff ? */
    int           zone;        /* To which zone do we belong ? */
    int           pwimpy;
    char 	  hate[MNAME_LEN+1];
    void          (*spec_case)(int);
    struct	_CastedSpell *spells;


/* Reset data for mobiles: */

    char         *pname_reset;
#ifdef LEAVE_CORPSES
    char	 *pftxt_reset;
    char	 *pexam_reset;
#endif
    long int	  ploc_reset;
    int		  pstr_reset;
    int           pvis_reset;
    SFLAGS	  psflags_reset;
    PFLAGS	  pflags_reset;
    MFLAGS	  pmflags_reset;
    int		  plev_reset;
    int           pagg_reset;   /* Agression */
    int           pspeed_reset; /* Speed */
    int		  pdam_reset;
    int           parmor_reset;
    int           pwimpy_reset;
} UBLOCK_REC;

typedef UBLOCK_REC Mobile;
typedef UBLOCK_REC Player;



/* iDIRT Mailing Message System */
typedef struct _MAIL {
  void          (*old_handler)(char *str);
  FILE          *read;
  FILE          *write;
  char          r_name[PNAME_LEN];
  char          w_name[PNAME_LEN];
  char          cc_name[PNAME_LEN];
  char          last[14];
  char          subject[MAX_COM_LEN];
  char          data[100];
  Boolean       level;
  char          prompt[PROMPT_LEN+40];
} MAIL;

/***************************************************************************
 ** Dyrt advanced file pager. Allows pattern matching and some other neat
 ** Things.
 ***************************************************************************/
typedef struct _PAGER 
{ FILE *file;
  INP_HANDLER *oldhandler;
  int size;
  int read;
  int len;
  Boolean brief;
  char old_prompt[PROMPT_LEN+1];
  char *pattern;
  char stopper[20];
} PAGER;

typedef struct _CONVERSE 
{ char old_prompt[PROMPT_LEN+50];
  int talking_to;
  Boolean active;
} CONVERSE;
/*

typedef struct _EDIT 
{	void	(*old_handler)(char *str);
	char	old_prompt[PROMPT_LEN+50];
	int	num;
	Object 	*o;
 	Object *o2;
	UBLOCK_REC *mob;
	Location	*room;
} EDIT;
*/

typedef struct _Line {
	char *line;
	int  nr;
        struct _Line *next;
} Line;

typedef enum { Append, Overwrite } EdMode;

typedef struct _Edit_Data {
	char	old_prompt[PROMPT_LEN];		/* Store Prompt */
	char	filename[120];			/* Store Filename of file */
        EdMode	mode;				/* Append or Overwrite */
        void    (*func)(char *,char *);		/* Who handles the end file */
        int	num_lines;			/* How many lines are written */
	int	max_lines;			/* What the max */
        FILE	*fp;				/* Where do we write to? */
	Line	*start;				/* First line */
	Line	*current;			/* Current line (not last)*/
	char	*parameter;			/* Given by initialisation */
	Boolean active;				/* Editor active? */
} Editor;

#ifdef GROUP
typedef struct _party 
{ int    leader;
  char   name[ONAME_LEN+1];
  int    shares;
  int    xp;

  struct _CastedSpell *spells;
} PARTY;
#endif

typedef struct _defrob {
   int		real_level;
   int		real_vis;
   PFLAGS	real_pflags;
   PFLAGS	real_mask;
   int		real_dam;
   int		real_armor;
} DEFROB;

typedef struct {
   int	 trace_item;
   int	 trace_class;
   int	 trace_loc;
   int   trace_carrf;
   int   trace_oroom;
} TRACE;

/* Player data that are not shared by mobiles.
 */
typedef struct _a_player {
  time_t             last_cmd;
  time_t             logged_on;
  time_t	     p_last_comm;   /* last gossip or say */
  time_t             p_last_spell;  /* Time last spell was casted */
  int                fil_des;
  FILE               *stream;
  struct sockaddr_in sin;
  int                sin_len;
  INP_HANDLER        *inp_handler;
  MAIL               mails;          /* Mail structure */
  Boolean            inmailer;       /* Is the user in the mailer? */
  /*EDIT		     edits;*/
  CONVERSE	     converse;
  TRACE		     tr;
  char               *inp_buffer_p;
  char               *inp_buffer_end;
  char               *sock_buffer_p;
  char               *sock_buffer_end;
  void               *writer;     /* Current writer */
  void		     *board;       /* similar to writer, to help with board */
  int                no_logins;   /* No of failed passwd */
  int                work;        /* General work area for use by code */
  char               work2[64];
  Boolean	     announced;

  Boolean	     is_new;	  /* a new player */
  Boolean            no_echo;     /* True if telnet should turn off echo */
  Boolean            isawiz;      /* Is this player a system's wizard? */
  Boolean	     ismonitored; /* is this player being monitored? */
  Boolean	     iamon;       /* Am I on? Init to false. */
  Boolean	     in_pbfr;     /* Are we busy inside pbfr()? */
  Boolean	     aliased;     /* Are we aliased? */
  Boolean            hold_loc;    /* Hold Location (for kick out) */
  Boolean	     linkdead;	  /* is player linkdead? */

  int                quit_next;   /* Next on quit_list, -2 if not in list */
  int		     polymorphed; /* Polymorphed for how many more turns? */
  int		     pretend;     /* Who we pretend to be if aliased or poly */
  int                isforce;     /* Set to -1 if not force, else pl. indx. */
  int                i_follow;    /* Set to -1 if not following anyone. */
  int		     aliasto;

  int                me_ivct;     /* Invisible for how many cmds ? */
  int 	             me_drunkct;  /* Drunk for how many ticks ? */

  int                snooped;     /* How many are snooping us? */
  int                snooptarget; /* Who if any are we snooping? */
  int                asmortal;    /* Are we pretending to be a mortal? */

  char               passwd[PASSWD_LEN];
  char               cprompt[PROMPT_LEN+1];
  char  	     prompt[PROMPT_LEN+1];
  char	             setin[SETIN_MAX+1];
  char		     setout[SETIN_MAX+1];
  char		     setmin[SETIN_MAX+1];
  char		     setmout[SETIN_MAX+1];
  char		     setvin[SETIN_MAX+1];
  char		     setvout[SETIN_MAX+1];
  char		     setqin[SETIN_MAX+1];
  char		     setqout[SETIN_MAX+1];
  char		     setsit[SETIN_MAX+1];
  char		     setstand[SETIN_MAX+1];
  char		     settrenter[SETIN_MAX+1];
  char		     settrvict[SETIN_MAX+1];
  char		     settrroom[SETIN_MAX+1];
  char               setsleep[SETIN_MAX+1];
  char               settrance[SETIN_MAX+1];
  char		     setaway[SETIN_MAX+1];
  char               awaymsg[SETIN_MAX+1]; /* For future away message */
  char		     o_setin[SETIN_MAX+1]; /* dupl. sets for aliased pl. */
  char		     o_setout[SETIN_MAX+1];
  char		     o_prompt[PROMPT_LEN+1];

  char               wd_her[MNAME_LEN+1];
  char               wd_him[MNAME_LEN+1];
  char		     *wd_them;
  char		     *wd_it;

  char               ptitle[TITLE_LEN+1];
  char               hostname[MAXHOSTNAMELEN];
  char               realhostname[MAXHOSTNAMELEN];
  char               prev_com[MAX_COM_LEN];
  char               inp_buffer[MAX_COM_LEN*16];
  char               sock_buffer[MAX_COM_LEN*16];

  char		email[MAX_EMAIL_LEN+1];

  FILE		*syslog_fp;
  char		syslog_match[10][80];
  int 		syslog_sameline;
  Boolean	syslog_popened;

  int           login_time;
  int           last_command;
  time_t        p_last_on;

  /* Wizard's defrob command */
  DEFROB	     *defrob;

  Editor        editor;
    
  PAGER         pager;            /* iDIRT pager system */
  Boolean	inpager;
#ifdef GROUP
  PARTY         *party;
  int           share;
#endif
#ifdef ABERCHAT
    char         *atarget;
    char         *amud;
#endif
} PLAYER_REC;


struct _SpellMask;

/* The world. Contains some global variables.
 */
typedef struct _a_world {
  int               w_msg_low;
  int               w_msg_high;
  int               w_weather;
  int               w_lock;
  int               w_mob_stop;
  int               w_peace;
  int		    w_max_users;
  int               w_tournament;
  int		    w_delayed;
  int		    w_start_loc;
  PFLAGS	    w_pflags[12];
  PFLAGS	    w_mask[12];
  struct _SpellMask  *w_spellmask;
} WORLD_REC;


/* ---------- */
typedef struct _calendar {
  char season;                    /* spring, summer, etc  */
  char modifier;                  /* late, early, etc     */
  char daytime;                   /* morning, noon, etc   */
  char daycount;                  /* 30 days per modifier */
  char light;                     /* is there light now?  */
  char temp;                      /* what is the temp?    */
  unsigned int countdown;         /* for timing           */
  
} CALENDAR;

#endif /* Add nothing past this line... */