1stMUD4.0/bin/
1stMUD4.0/doc/MPDocs/
1stMUD4.0/player/
1stMUD4.0/win32/
1stMUD4.0/win32/rom/
/**************************************************************************
*  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
*  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
*                                                                         *
*  Merc Diku Mud improvements copyright (C) 1992, 1993 by Michael         *
*  Chastain, Michael Quan, and Mitchell Tse.                              *
*                                                                         *
*  In order to use any part of this Merc Diku Mud, you must comply with   *
*  both the original Diku license in 'license.doc' as well the Merc       *
*  license in 'license.txt'.  In particular, you may not remove either of *
*  these copyright notices.                                               *
*                                                                         *
*  Much time and thought has gone into this software and you are          *
*  benefiting.  We hope that you share your changes too.  What goes       *
*  around, comes around.                                                  *
***************************************************************************
*       ROM 2.4 is copyright 1993-1998 Russ Taylor                        *
*       ROM has been brought to you by the ROM consortium                 *
*           Russ Taylor (rtaylor@hypercube.org)                           *
*           Gabrielle Taylor (gtaylor@hypercube.org)                      *
*           Brian Moore (zump@rom.org)                                    *
*       By using this code, you have agreed to follow the terms of the    *
*       ROM license, in the file Rom24/doc/rom.license                    *
***************************************************************************
*       1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings              *
*            http://1stmud.dlmud.com/  <r-jenn@shaw.ca>                   *
***************************************************************************/
#if !defined(STRUCTS_H)
#define STRUCTS_H

/*
 * Site ban structure.
 */
struct ban_data
{
	BAN_DATA *next;
	BAN_DATA *prev;
	bool valid;
	flag_t ban_flags;
	int level;
	const char *name;
};

struct buf_type
{
	BUFFER *next;
	BUFFER *prev;
	bool valid;
	int state;					/* error state of the buffer */
	int size;					/* size in k */
	char *string;				/* buffer's string */
};

struct auction_data
{
	AUCTION_DATA *next;
	AUCTION_DATA *prev;
	OBJ_DATA *item;
	CHAR_DATA *owner;
	CHAR_DATA *high_bidder;
	int status;
	int number;
	unsigned long bid;
	bool valid;
};

/*
 * Time and weather stuff.
 */
struct time_info_data
{
	int hour;
	int day;
	int month;
	int year;
	sun_t sunlight;
};

struct weather_data
{
	int temp;					/* temperature */
	int precip;					/* precipitation */
	int wind;					/* umm... wind */
	int temp_vector;			/* vectors controlling */
	int precip_vector;			/* rate of change */
	int wind_vector;
	int climate_temp;			/* climate of the area */
	int climate_precip;
	int climate_wind;
	const char *echo;			/* echo string */
	const char *echo_color;		/* color for the echo */
};

/*
 * Descriptor (channel) structure.
 */
struct descriptor_data
{
	DESCRIPTOR_DATA *next;
	DESCRIPTOR_DATA *prev;
	DESCRIPTOR_DATA *snoop_by;
	CHAR_DATA *character;
	CHAR_DATA *original;
	bool valid;
	const char *host;
	int descriptor;
	connect_t connected;
	bool fcommand;
	char inbuf[4 * MAX_INPUT_LENGTH];
	char incomm[MAX_INPUT_LENGTH];
	char inlast[MAX_INPUT_LENGTH];
	int repeat;
	char *outbuf;
	int outsize;
	int outtop;
	const char *showstr_head;
	const char *showstr_point;
	void *pEdit;				/* OLC */
	const char **pString;		/* OLC */
	int editor;					/* OLC */
	flag_t d_flags;
	unsigned int scr_width;		/* screen width */
	unsigned int scr_height;	/* screen height */
#if !defined(NO_MCCP)
	z_stream *out_compress;
	unsigned char *out_compress_buf;
	unsigned long bytes_compressed;
	int mccp_version;
#endif
	unsigned long bytes_normal;
	const char *run_buf;
	const char *run_head;
	char ttype[60];
	struct
	{
		const char *supports;
		float mxp_ver;
		float client_ver;
		float style_ver;
		const char *client;
		int registered;
		flag_t flags;
		flag_t flags2;
	}
	mxp;
	struct
	{
		unsigned int keycode;
		char version[20];
	}
	portal;
	double imp_vers;
	double pueblo_vers;
#if defined(__cplusplus)
	// a c++ example
	void wrap(const char *buf);
#endif
};

/*
 * Attribute bonus structures.
 */
struct str_app_type
{
	int tohit;
	int todam;
	int carry;
	int wield;
};

struct int_app_type
{
	int learn;
};

struct wis_app_type
{
	int practice;
};

struct dex_app_type
{
	int defensive;
};

struct con_app_type
{
	int hitp;
	int shock;
};

/*
 * Help table types.
 */
struct help_data
{
	HELP_DATA *next;
	HELP_DATA *prev;
	int level;
	const char *keyword;
	const char *text;
};

struct shop_data
{
	SHOP_DATA *next;
	SHOP_DATA *prev;			/* Next shop in list        */
	vnum_t keeper;				/* Vnum of shop keeper mob  */
	int buy_type[MAX_TRADE];	/* Item types shop will buy */
	int profit_buy;				/* Cost multiplier for buying   */
	int profit_sell;			/* Cost multiplier for selling  */
	int open_hour;				/* First opening hour       */
	int close_hour;				/* First closing hour       */
};

struct class_type
{
	const char *name;			/* the full name of the class */
	int attr_prime;				/* Prime attribute      */
	vnum_t weapon;				/* First weapon         */
	vnum_t guild[MAX_GUILD];	/* Vnum of guild rooms      */
	int skill_adept;			/* Maximum skill level      */
	int thac0_00;				/* Thac0 for level  0       */
	int thac0_32;				/* Thac0 for level 32       */
	int hp_min;					/* Min hp gained on leveling    */
	int hp_max;					/* Max hp gained on leveling    */
	bool fMana;					/* Class gains mana on level    */
	const char *base_group;		/* base skills gained       */
	const char *default_group;	/* default skills gained    */
};

struct item_type
{
	int type;
	const char *name;
};

struct weapon_type
{
	const char *name;
	vnum_t vnum;
	int type;
	int *gsn;
};

struct wiznet_type
{
	const char *name;
	flag_t flag;
	int level;
};

struct attack_type
{
	const char *name;			/* name */
	const char *noun;			/* message */
	int damage;					/* damage class */
};

struct deity_type
{
	const char *name;
	const char *desc;
	const char *skillname;
	DEITY_DATA *next, *prev;
	bool valid;
};

struct corpse_data
{
	CORPSE_DATA *next;
	CORPSE_DATA *prev;
	OBJ_DATA *corpse;
};

struct race_type
{
	const char *name;			/* call name of the race */
	bool pc_race;				/* can be chosen by pcs */
	flag_t act;					/* act bits for the race */
	flag_t aff;					/* aff bits for the race */
	flag_t off;					/* off bits for the race */
	flag_t imm;					/* imm bits for the race */
	flag_t res;					/* res bits for the race */
	flag_t vuln;				/* vuln bits for the race */
	flag_t form;				/* default form flag_t for the race */
	flag_t parts;				/* default parts for the race */
	int points;					/* cost in points of the race */
	int *class_mult;			/* exp multiplier for class, * 100 */
	const char *skills[5];		/* bonus skills for the race */
	int stats[MAX_STATS];		/* starting stats */
	int max_stats[MAX_STATS];	/* maximum stats */
	int size;					/* aff bits for the race */
	RACE_DATA *next, *prev;
	bool valid;
};

struct spec_type
{
	const char *name;			/* special function name */
	SPEC_FUN *function;			/* the function */
};

/*
 * Data structure for notes.
 */
struct note_data
{
	NOTE_DATA *next;
	NOTE_DATA *prev;
	bool valid;
	const char *sender;
	const char *date;
	const char *to_list;
	const char *subject;
	const char *text;
	time_t date_stamp;
	time_t expire;
};

struct channel_type
{
	int *index;
	channel_types spec_flag;
	flag_t bit;
	const char *format;
	const char *colour;
	int custom_colour;
	int page_length;
	const char *name;
	const char *description;
};

struct gquest_char_data
{
	GQ_DATA *next, *prev;
	CHAR_DATA *ch;
	vnum_t *gq_mobs;
};

struct gquest_data
{
	GQ_DATA *first, *last;
	CHAR_DATA *last_registar;
	vnum_t *mobs;
	const char *who;
	int mob_count;
	int timer;
	int involved;
	int qpoints;
	int gold;
	int minlevel;
	int maxlevel;
	gquest_t running;
};

/*
 * An affect.
 */
struct affect_data
{
	AFFECT_DATA *next;
	AFFECT_DATA *prev;
	bool valid;
	where_t where;
	int type;
	int level;
	int duration;
	apply_t location;
	int modifier;
	flag_t bitvector;
};

/* (C)opyover-(R)eboot-(S)hutdown Data */
struct crs_data
{
	crs_t status;
	long timer;					// in pulses
	const char *who;			// who initiated
	const char *reason;			// why its initiated
};

/*
 * A kill structure (indexed by level).
 */
struct kill_data
{
	int number;
	int killed;
};

struct mud_data
{
	flag_t mud_flags;
	arena_t arena;
	int share_value;
	int max_online;
	int pulsepersec;
	/* weather stuff */
	int rand_factor;
	int weath_unit;
	int max_vector;
	int climate_factor;
	// more global data here!
};

struct war_char_data
{
	WAR_DATA *next, *prev;
	CHAR_DATA *ch;
	long hit, mana, move;
	flag_t flags;
};

struct war_data
{
	WAR_DATA *first, *last;
	const char *who;
	int min_level;
	int max_level;
	int inwar;
	war_types wartype;
	int timer;
	war_t status;
};

struct wpwd_data
{
	WPWD_DATA *next;
	WPWD_DATA *prev;
	bool valid;
	const char *name;
	const char *passw;
};

/*
 * Prototype for a mob.
 * This is the in-memory version of #MOBILES.
 */
struct mob_index_data
{
	MOB_INDEX_DATA *next;
	SPEC_FUN *spec_fun;
	SHOP_DATA *pShop;
	PROG_LIST *first_mprog;
	PROG_LIST *last_mprog;
	AREA_DATA *area;			/* OLC */
	vnum_t vnum;
	vnum_t group;
	bool new_format;
	int count;
	int killed;
	const char *player_name;
	const char *short_descr;
	const char *long_descr;
	const char *description;
	flag_t act;
	flag_t affected_by;
	int alignment;
	int level;
	int hitroll;
	int hit[3];
	int mana[3];
	int damage[3];
	int ac[4];
	int dam_type;
	flag_t off_flags;
	flag_t imm_flags;
	flag_t res_flags;
	flag_t vuln_flags;
	position_t start_pos;
	position_t default_pos;
	int sex;
	RACE_DATA *race;
	long wealth;
	flag_t form;
	flag_t parts;
	int size;
	const char *material;
	flag_t mprog_flags;
};

struct stat_data
{
	STAT_DATA *next;
	STAT_DATA *prev;
	bool valid;
	const char *name;			// name of character
	long gamestat[MAX_GAMESTAT];	// stat data
};

struct mbr_data
{
	MBR_DATA *next;
	MBR_DATA *prev;
	bool valid;
	const char *name;
	int rank;
	CLAN_DATA *clan;
	int level;
};

/*
 * One character (PC or NPC).
 */
struct char_data
{
	CHAR_DATA *next;
	CHAR_DATA *prev;
	CHAR_DATA *next_player;
	CHAR_DATA *prev_player;
	CHAR_DATA *next_in_room;
	CHAR_DATA *prev_in_room;
	CHAR_DATA *master;
	CHAR_DATA *leader;
	CHAR_DATA *fighting;
	CHAR_DATA *reply;
	CHAR_DATA *pet;
	CHAR_DATA *mprog_target;
	SPEC_FUN *spec_fun;
	MOB_INDEX_DATA *pIndexData;
	DESCRIPTOR_DATA *desc;
	AFFECT_DATA *first_affect;
	AFFECT_DATA *last_affect;
	OBJ_DATA *first_carrying;
	OBJ_DATA *last_carrying;
	OBJ_DATA *on;
	ROOM_INDEX_DATA *in_room;
	ROOM_INDEX_DATA *was_in_room;
	AREA_DATA *zone;
	PC_DATA *pcdata;
	GEN_DATA *gen_data;
	CHAR_DATA *hunting;
	WAR_DATA *war;
	GQ_DATA *gquest;
	bool valid;
	const char *name;
	long id;
	int version;
	const char *short_descr;
	const char *long_descr;
	const char *description;
	const char *prompt;
	const char *prefix;
	int group;
	CLAN_DATA *clan;
	int sex;
	int rank;
	CLAN_DATA *invited;
	int Class[MAX_MCLASS];
	RACE_DATA *race;
	int level;
	DEITY_DATA *deity;
	int trust;
	int played;
	int lines;					/* for the pager */
	int columns;
	time_t logon;
	int timer;
	int wait;
	int daze;
	long hit;
	long max_hit;
	long mana;
	long max_mana;
	long move;
	long max_move;
	long gold;
	long silver;
	int exp;
	flag_t act;
	flag_t comm;				/* RT added to pad the vector */
	flag_t wiznet;				/* wiz stuff */
	flag_t imm_flags;
	flag_t res_flags;
	flag_t vuln_flags;
	int invis_level;
	int incog_level;
	flag_t affected_by;
	position_t position;
	int practice;
	int train;
	int carry_weight;
	int carry_number;
	int saving_throw;
	int alignment;
	int hitroll;
	int damroll;
	int armor[4];
	int wimpy;
	/* stats */
	int perm_stat[MAX_STATS];
	int mod_stat[MAX_STATS];
	/* parts stuff */
	flag_t form;
	flag_t parts;
	int size;
	const char *material;
	/* mobile stuff */
	flag_t off_flags;
	int damage[3];
	int dam_type;
	position_t start_pos;
	position_t default_pos;
	flag_t info_settings;
	int mprog_delay;
	int stance[MAX_STANCE];
};

/*
 * Data which only PC's have.
 */
struct pc_data
{
	PC_DATA *next;
	PC_DATA *prev;
	BUFFER *buffer;
	CHAR_DATA *challenger;
	CHAR_DATA *challenged;
	CHAR_DATA *gladiator;
	bool valid;
	const char *pwd;
	const char *bamfin;
	const char *bamfout;
	const char *title;
	const char *who_descr;
	const char *afk_msg;
	long perm_hit;
	long perm_mana;
	long perm_move;
	int true_sex;
	int last_level;
	int condition[4];
	int *learned;
	bool *group_known;
	int points;
	bool confirm_delete;
	BOARD_DATA *board;			/* The current board        */
	time_t last_note[MAX_BOARD];	/* last note for the boards */
	NOTE_DATA *in_progress;
	const char *alias[MAX_ALIAS];
	const char *alias_sub[MAX_ALIAS];
	int security;				/* OLC *//* Builder security */
	int colour[MAX_CUSTOM_COLOUR][CT_MAX];
	long gamestat[MAX_GAMESTAT];
	int nextquest;
	int countdown;
	vnum_t questobj;
	vnum_t questmob;
	vnum_t questgiver;
	vnum_t questloc;
	int questpoints;
	int trivia;
	bool confirm_remort;
	bool stay_race;
	char explored[MAX_EXPLORE_HASH];
	long home_invite;
	vnum_t home[MAX_HOUSE_ROOMS];
	vnum_t home_key;
	int awins;
	int alosses;
	int plr_wager;
	long gold_bank;
	long silver_bank;
	int shares;
	const char *webpass;
	char str_ed_key;
	const char *buddies[MAX_BUDDY];
	const char ***history;
	int *history_index;
	int timezone;
	const char *ignore[MAX_IGNORE];
	flag_t ignore_flags[MAX_IGNORE];
};

/* Data for generating characters -- only used during generation */
struct gen_data
{
	GEN_DATA *next;
	GEN_DATA *prev;
	bool valid;
	bool *skill_chosen;
	bool *group_chosen;
	int points_chosen;
};

struct liq_type
{
	const char *liq_name;
	const char *liq_color;
	int liq_affect[5];
};

/*
 * Extra description data for a room or object.
 */
struct extra_descr_data
{
	EXTRA_DESCR_DATA *next;
	EXTRA_DESCR_DATA *prev;		/* Next in list                     */
	bool valid;
	const char *keyword;		/* Keyword in look/examine          */
	const char *description;	/* What to see                      */
};

/*
 * Prototype for an object.
 */
struct obj_index_data
{
	OBJ_INDEX_DATA *next;
	EXTRA_DESCR_DATA *first_extra_descr;
	EXTRA_DESCR_DATA *last_extra_descr;
	AFFECT_DATA *first_affect;
	AFFECT_DATA *last_affect;
	PROG_LIST *first_oprog;
	PROG_LIST *last_oprog;
	AREA_DATA *area;			/* OLC */
	bool new_format;
	const char *name;
	const char *short_descr;
	const char *description;
	vnum_t vnum;
	int reset_num;
	const char *material;
	int item_type;
	flag_t extra_flags;
	flag_t wear_flags;
	int level;
	int condition;
	int count;
	int weight;
	int cost;
	long value[5];
	flag_t oprog_flags;
};

/*
 * One object.
 */
struct obj_data
{
	OBJ_DATA *next;
	OBJ_DATA *prev;
	OBJ_DATA *next_content;
	OBJ_DATA *prev_content;
	OBJ_DATA *first_content;
	OBJ_DATA *last_content;
	OBJ_DATA *in_obj;
	OBJ_DATA *on;
	CHAR_DATA *carried_by;
	EXTRA_DESCR_DATA *first_extra_descr;
	EXTRA_DESCR_DATA *last_extra_descr;
	AFFECT_DATA *first_affect;
	AFFECT_DATA *last_affect;
	OBJ_INDEX_DATA *pIndexData;
	ROOM_INDEX_DATA *in_room;
	CHAR_DATA *oprog_target;
	int oprog_delay;
	bool valid;
	bool enchanted;
	const char *owner;
	const char *name;
	const char *short_descr;
	const char *description;
	int item_type;
	flag_t extra_flags;
	flag_t wear_flags;
	wloc_t wear_loc;
	int weight;
	int cost;
	int level;
	int condition;
	const char *material;
	int timer;
	long value[5];
};

/*
 * Exit data.
 */
struct exit_data
{
	union
	{
		ROOM_INDEX_DATA *to_room;
		vnum_t vnum;
	}
	u1;
	flag_t exit_info;
	vnum_t key;
	const char *keyword;
	const char *description;
	EXIT_DATA *next;
	EXIT_DATA *prev;			/* OLC */
	flag_t rs_flags;			/* OLC */
	int orig_door;				/* OLC */
};

/*
 * Reset commands:
 *   '*': comment
 *   'M': read a mobile 
 *   'O': read an object
 *   'P': put object in object
 *   'G': give object to mobile
 *   'E': equip object to mobile
 *   'D': set state of door
 *   'R': randomize room exits
 *   'S': stop (end of list)
 */

/*
 * Area-reset definition.
 */
struct reset_data
{
	RESET_DATA *next;
	RESET_DATA *prev;
	char command;
	vnum_t arg1;
	int arg2;
	vnum_t arg3;
	int arg4;
};

/*
 * Area definition.
 */
struct area_data
{
	AREA_DATA *next;
	AREA_DATA *prev;
	AREA_DATA *next_sort;
	const char *file_name;
	const char *name;
	const char *credits;
	const char *lvl_comment;
	int version;
	int age;
	int nplayer;
	int min_level;
	int max_level;
	vnum_t min_vnum;
	vnum_t max_vnum;
	bool empty;
	const char *builders;		/* OLC *//* Listing of */
	int vnum;					/* OLC *//* Area vnum  */
	flag_t area_flags;			/* OLC */
	int security;				/* OLC *//* Value 1-9  */
	WEATHER_DATA weather;
};

/*
 * Room type.
 */
struct room_index_data
{
	ROOM_INDEX_DATA *next;
	CHAR_DATA *first_person;
	CHAR_DATA *last_person;
	OBJ_DATA *first_content;
	OBJ_DATA *last_content;
	EXTRA_DESCR_DATA *first_extra_descr;
	EXTRA_DESCR_DATA *last_extra_descr;
	AREA_DATA *area;
	EXIT_DATA *exit[6];
	RESET_DATA *reset_first;	/* OLC */
	RESET_DATA *reset_last;		/* OLC */
	PROG_LIST *first_rprog;
	PROG_LIST *last_rprog;
	CHAR_DATA *rprog_target;
	flag_t rprog_flags;
	int rprog_delay;
	const char *name;
	const char *description;
	const char *owner;
	vnum_t vnum;
	flag_t room_flags;
	int light;
	sector_t sector_type;
	int heal_rate;
	int mana_rate;
	CLAN_DATA *clan;
};

 /* one disabled command */
struct disabled_data
{
	DISABLED_DATA *next;
	DISABLED_DATA *prev;		/* pointer to next node */
	CMD_DATA *command;			/* pointer to the command struct */
	const char *disabled_by;	/* name of disabler */
	const char *disabled_for;	/* name of person who can't use it */
	int level;					/* level of disabler */
};

/*
 * Skills include spells as a particular case.
 */
struct skill_type
{
	const char *name;			/* Name of skill        */
	int *skill_level;			/* Level needed by class    */
	int *rating;				/* How hard it is to learn  */
	SPELL_FUN *spell_fun;		/* Spell pointer (for spells)   */
	tar_t target;				/* Legal targets        */
	position_t minimum_position;	/* Position for caster / user   */
	int *pgsn;					/* Pointer to associated gsn    */
	int min_mana;				/* Minimum mana used        */
	int beats;					/* Waiting time after use   */
	const char *noun_damage;	/* Damage message       */
	const char *msg_off;		/* Wear off message     */
	const char *msg_obj;		/* Wear off message for obects  */
};

struct group_type
{
	const char *name;
	int *rating;
	const char *spells[MAX_IN_GROUP];
};

struct write_data
{
	FILE *stream;
	const char *temp;
	const char *file;
};

struct read_data
{
	char *str;
	size_t pos, size;
	const char *file;
};

struct prog_list
{
	flag_t trig_type;
	const char *trig_phrase;
	vnum_t vnum;
	const char *code;
	PROG_LIST *next;
	PROG_LIST *prev;
	bool valid;
};

struct prog_code
{
	AREA_DATA *area;
	vnum_t vnum;
	const char *code;
	PROG_CODE *next;
	PROG_CODE *prev;
};

/*
 * Structure for a social in the socials table.
 */
struct social_type
{
	const char *name;
	const char *char_no_arg;
	const char *others_no_arg;
	const char *char_found;
	const char *others_found;
	const char *vict_found;
	const char *char_not_found;
	const char *char_auto;
	const char *others_auto;
	SOCIAL_DATA *next, *prev, *next_hash;
	bool valid;
};

#endif