/*___________________________________________________________________________*
)()( DalekenMUD 1.12 (C) 2000 )()(
`][' by Martin Thomson, Lee Brooks, `]['
|| Ken Herbert and David Jacques ||
|| ----------------------------------------------------------------- ||
|| Envy Diku Mud improvements copyright (C) 1994 by Michael Quan, ||
|| David Love, Guilherme 'Willie' Arnold, and Mitchell Tse. ||
|| Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael ||
|| Chastain, Michael Quan, and Mitchell Tse. ||
|| Original Diku Mud copyright (C) 1990, 1991 ||
|| by Sebastian Hammer, Michael Seifert, Hans Henrik St{rfeldt, ||
|| Tom Madsen, and Katja Nyboe. ||
|| ----------------------------------------------------------------- ||
|| Any use of this software must follow the licenses of the ||
|| creators. Much time and thought has gone into this software and ||
|| you are benefitting. We hope that you share your changes too. ||
|| What goes around, comes around. ||
|| ----------------------------------------------------------------- ||
|| types.h ||
|| Definition of all data structures needed. ||
*_/<>\_________________________________________________________________/<>\_*/
/*
* Short scalar types.
* Diavolo reports AIX compiler has bugs with short types.
*/
#if !defined( FALSE )
#define FALSE 0
#endif
#if !defined( TRUE )
#define TRUE 1
#endif
#if defined( _AIX ) || defined( CYGWIN32 )
#if !defined( const )
#define const
#endif
typedef int bool;
#define unix
#else
typedef unsigned char bool;
#endif
typedef int int_32;
typedef short int int_16;
typedef char int_8;
typedef unsigned int uint_32;
typedef unsigned short uint_16;
typedef unsigned char uint_8;
/*
* Structure types.
*/
typedef struct affect_data AFFECT_DATA;
typedef struct alias_data ALIAS_DATA;
typedef struct area_data AREA_DATA;
typedef struct ban_data BAN_DATA;
typedef struct board_data BOARD_DATA;
typedef struct buffer_type BUFFER;
typedef struct char_data CHAR_DATA;
typedef struct clan_data CLAN_DATA;
typedef struct descriptor_data DESCRIPTOR_DATA;
typedef struct event_data EVENT;
typedef struct exit_data EXIT_DATA;
typedef struct extra_descr_data EXTRA_DESCR_DATA;
typedef struct help_data HELP_DATA;
typedef struct highest_data HIGHEST_DATA;
typedef struct highest_entry HIGHEST_ENTRY;
typedef struct ident_data IDENT_DATA;
typedef struct interpreter_type INTERPRETER_DATA;
typedef struct kill_data KILL_DATA;
typedef struct mob_index_data MOB_INDEX_DATA;
typedef struct mud_prog_act_list MPROG_ACT_LIST;
typedef struct mud_prog_callback MPROG_CALLBACK;
typedef struct mud_prog_data MPROG_DATA;
typedef struct mud_prog_global MPROG_GLOBAL;
typedef struct mud_prog_info MPROG_INFO;
typedef struct mud_prog_line MPROG_LINE;
typedef struct mud_prog_stack MPROG_STACK;
typedef struct mud_prog_variable MPROG_VAR;
typedef struct note_data NOTE_DATA;
typedef struct obj_data OBJ_DATA;
typedef struct obj_index_data OBJ_INDEX_DATA;
typedef struct pc_data PC_DATA;
typedef struct plane_data PLANE_DATA;
typedef struct pose_data POSE_DATA;
typedef struct quest_data QUEST_DATA;
typedef struct religion_data RELIGION_DATA;
typedef struct religion_skill RELIGION_SKILL;
typedef struct reset_data RESET_DATA;
typedef struct room_index_data ROOM_INDEX_DATA;
typedef struct shop_data SHOP_DATA;
typedef struct social_type SOCIAL_DATA;
typedef struct text_block TEXT_BLOCK;
typedef struct time_info_data TIME_INFO_DATA;
typedef struct track_data TRACK_DATA;
typedef struct trade_data TRADE_DATA;
typedef struct weather_data WEATHER_DATA;
#if !defined( WIN32 )
typedef unsigned int SOCKET;
#endif
/*
* Function types.
*/
typedef void DO_FUN args( ( CHAR_DATA *ch, const char *argument ) );
typedef bool SPEC_FUN args( ( CHAR_DATA *ch, CHAR_DATA *player,
int type, void *thing ) );
typedef void SPELL_FUN args( ( int sn, int level,
CHAR_DATA *ch, void *vo ) );
typedef bool READ_FUN args( ( FILE *fp, void *vo ) );
/* --Not used at the moment, perhaps never--
typedef void GAME_FUN args( ( CHAR_DATA *ch, CHAR_DATA *croupier,
char *argument ) );
*/
typedef void INTERPRETER_FUN args( ( DESCRIPTOR_DATA *d,
const char *argument ) );
typedef void PROMPT_FUN args( ( DESCRIPTOR_DATA *d ) );
/*
* Player character key data struct
* Stuff for new error trapping of corrupt pfiles.
*/
struct key_data
{
char key[11]; /* Increase if you make a key > 11 chars */
int string; /* TRUE for string, FALSE for int */
int deflt; /* Default value or pointer */
void *ptrs[7]; /* Increase if you have > 6 parms/line */
};
/*
* System Information data structure.
*/
struct sysinfo_type
{
char * name;
int version;
int minor;
int build;
char * build_date;
char * platform;
time_t down_time;
int object_key;
int char_key;
int numlock;
int saveat;
int file_version;
int flags;
char * dictionary;
time_t pulse;
/* count information */
int total_logins; /* player logins */
int new_characters; /* new players */
int curr_descriptors; /* current no. of players */
int max_descriptors; /* max. no. of players */
int levels; /* levels gained */
int deaths; /* player deaths */
int mob_deaths; /* mobile deaths */
};
/*
* Site ban structure.
*/
struct ban_data
{
BAN_DATA *next;
char *name;
};
/*
* Time and Weather.
*/
struct time_info_data
{
int hour;
int day;
int month;
int year;
};
struct weather_data
{
int mmhg;
int change;
int sky;
int sunlight;
int winddir;
int windspeed;
int temperature;
};
/*
* Descriptor (channel) structure.
*/
struct descriptor_data
{
DESCRIPTOR_DATA *next;
DESCRIPTOR_DATA *snoop_by;
CHAR_DATA *character;
CHAR_DATA *original;
IDENT_DATA *ident;
char *host;
SOCKET descriptor;
const INTERPRETER_DATA *interpreter;
bool fcommand;
bool fpromptok;
char inbuf[ MAX_INPUT_LENGTH * 4 ];
char incomm[ MAX_INPUT_LENGTH ];
char inlast[ MAX_INPUT_LENGTH ];
int repeat;
char *showstr_head;
char *showstr_point;
char outbuf[ SMALL_OUTBUF_SIZE ];
int outtop;
TEXT_BLOCK *large_buffer;
char **pString; /* OLC, notes, desc. */
void *pEdit; /* OLC */
#if defined( MCCP )
z_stream *out_compress;
unsigned char *out_compress_buf;
int mccp_version;
#endif
};
/*
* Used for storing lists of strings.
*/
struct text_block
{
TEXT_BLOCK *next;
char *str;
int size;
};
/*
* Struct for ident information.
*/
struct ident_data
{
IDENT_DATA *next;
DESCRIPTOR_DATA *desc;
SOCKET descriptor;
time_t timeout;
unsigned short localport;
unsigned short remoteport;
unsigned short reply_pos;
char reply_text [MAX_INPUT_LENGTH];
bool connected;
};
/*
* One character (PC or NPC).
*/
struct char_data
{
char magic;
CHAR_DATA *next;
CHAR_DATA *next_in_room;
CHAR_DATA *master;
CHAR_DATA *leader;
CHAR_DATA *fighting;
CHAR_DATA *reply;
CHAR_DATA *tracking;
CHAR_DATA *fearing;
CHAR_DATA *next_initiative;
int spec_fun;
MOB_INDEX_DATA *pIndexData;
MPROG_VAR *variables;
EVENT *events;
DESCRIPTOR_DATA *desc;
AFFECT_DATA *affected;
OBJ_DATA *carrying;
ROOM_INDEX_DATA *in_room;
ROOM_INDEX_DATA *was_in_room;
PC_DATA *pcdata;
OBJ_DATA *on;
char *name;
char *short_descr;
char *long_descr;
char *description;
int sex;
int class;
int race;
int level;
int sublevel;
int trust;
int played;
time_t logon;
time_t save_time;
int wait;
int hit;
int max_hit;
int mana[MAGIC_MAX];
int max_mana[MAGIC_MAX];
int move;
int max_move;
int gold;
int exp;
int act[MAX_VECTOR];
int affected_by[MAX_VECTOR];
int extra_bits;
int position;
int practice;
int carry_weight;
int carry_number;
int saving_throw;
int alignment;
int hitroll;
int damroll;
int speed;
int armour;
int wimpy;
int deaf;
int recall_room;
int resil_mod;
int temp_mod;
int size_mod;
int body_parts;
int damaged_parts;
int num_hits, tot_dam, tot_xp;
int temp; /* used locally in functions
such as room_violence_update */
int unique_key;
bool deleted;
};
/*
* Data which only PC's have.
*/
struct pc_data
{
PC_DATA *next;
ALIAS_DATA *aliases;
QUEST_DATA *quest;
RELIGION_DATA *religion;
CLAN_DATA *clan;
NOTE_DATA *note;
BOARD_DATA *board;
TRADE_DATA *trade;
int clan_rank;
char *pwd;
char *bamfin;
char *bamfout;
char *immname;
char *setmin;
char *setmout;
char *immskll;
char *title;
char *prompt;
int perm_str;
int perm_int;
int perm_wis;
int perm_dex;
int perm_con;
int mod_str;
int mod_int;
int mod_wis;
int mod_dex;
int mod_con;
int perm_magic[MAGIC_MAX];
int mod_magic[MAGIC_MAX];
int condition[3];
int timer;
int pagelen;
int learned[MAX_SKILL];
int multi_class[NUM_MULTI_CLASS];
int killed;
int died;
int banked;
int familiar;
int blink;
int bounty;
unsigned int pc_bits;
bool switched;
int security; /* OLC */
int language;
time_t last_note [ MAX_BOARD ];
};
/*
* One object.
*/
struct obj_data
{
char magic; /* used in act() and mudprogs */
OBJ_DATA *next;
OBJ_DATA *next_content;
OBJ_DATA *contains;
OBJ_DATA *in_obj;
CHAR_DATA *carried_by;
EXTRA_DESCR_DATA *extra_descr;
AFFECT_DATA *affected;
OBJ_INDEX_DATA *pIndexData;
ROOM_INDEX_DATA *in_room;
MPROG_VAR *variables;
EVENT *events;
char *name;
char *short_descr;
char *description;
char *action;
int item_type;
int extra_flags;
int wear_flags;
int wear_loc;
int weight;
int cost;
int level;
int required_skill;
int condition;
int value[4];
int unique_key;
bool deleted;
};
/*
* Clans.
*/
struct clan_data
{
CLAN_DATA * next; /* next clan in list */
char * name; /* Clan name */
char * display_name; /* Clan displayed name, colourful etc. */
char * motto; /* Clan motto */
char * description; /* A brief description of the clan */
char * rules; /* Rules */
char * overlord; /* Head clan leader */
char * chieftains; /* Second in command */
char * enemies; /* Who the clan wars against */
int clan_type; /* See clan type defines */
int clanheros; /* Number of clanheros */
int members; /* Number of clan members */
int kills; /* Number of p/mkills on behalf of clan */
int deaths; /* Number of p/mkills against clan */
int recall; /* Vnum of clan's recall room */
RELIGION_DATA *religion; /* For orders */
int class; /* For guilds */
RELIGION_SKILL *skills; /* a list of skills by clan level */
int karma; /* for orders, their karmic strength */
};
/*
* Religions.
*/
struct religion_data
{
RELIGION_DATA *next; /* memory management */
char * name; /* normal name for the clan */
char * display_name; /* displayed name, colour etc... */
char * god_name; /* may or may not be an actual imm */
int align_min; /* minimum alignment */
int align_max; /* maximum alignment */
int sac_events; /* Bits with what happens after a sac */
int token; /* obj vnum of a token */
RELIGION_SKILL *skills; /* a list of skills by order level */
};
struct religion_skill
{
RELIGION_SKILL *next;
int sn;
int level;
};
/*-------------------------------------------------------------------
* Area File Constructs.
*/
/*
* Area definition.
*/
struct area_data
{
AREA_DATA *next;
char *name;
int recall;
int age; /* changed, now a time in minutes */
int nplayer;
int nmobile;
char *filename; /* OLC */
char *builders; /* OLC - Listing of builders */
int security; /* OLC - Value 0-infinity */
int lvnum; /* OLC - Lower vnum */
int uvnum; /* OLC - Upper vnum */
int vnum; /* OLC - Area vnum */
int area_flags; /* OLC */
int ave_temp;
int min, ave, max;
char *repop;
PLANE_DATA *plane;
CLAN_DATA *order; /* The clan that holds the area */
EVENT *events;
char *description;
int token_room;
int economy;
};
struct plane_data
{
PLANE_DATA *next;
char *name;
int min_level;
WEATHER_DATA weather; /* FIX */
TIME_INFO_DATA time; /* FIX */
EVENT *events;
};
/*
* Room type.
*/
struct room_index_data
{
ROOM_INDEX_DATA *next;
CHAR_DATA *people;
OBJ_DATA *contents;
EXTRA_DESCR_DATA *extra_descr;
AREA_DATA *area;
EXIT_DATA *exit[6];
MPROG_DATA *mudprogs;
int progtypes[MAX_VECTOR];
MPROG_VAR *variables;
EVENT *events;
char *name;
char *description;
int vnum;
int room_flags;
int light;
int sector_type;
RESET_DATA *reset_first; /* OLC */
RESET_DATA *reset_last; /* OLC */
};
/*
* Exit data.
*
*/
struct exit_data
{
ROOM_INDEX_DATA *to_room;
int vnum;
int exit_info;
int key;
char *keyword;
char *description;
EXIT_DATA *next; /* OLC */
int rs_flags; /* OLC */
ROOM_INDEX_DATA *in_room;
};
/*
* Prototype for a mob.
* This is the in-memory version of #MOBILES.
*/
struct mob_index_data
{
MOB_INDEX_DATA *next;
AREA_DATA *area; /* OLC */
int spec_fun;
SHOP_DATA *pShop;
MPROG_DATA *mudprogs;
int progtypes[MAX_VECTOR];
char *name;
char *short_descr;
char *long_descr;
char *description;
int vnum;
int count;
int killed;
int sex;
int level;
int act[MAX_VECTOR];
int affected_by[MAX_VECTOR];
int alignment;
int race;
int body_parts;
int class;
int reset_chance;
};
/*
* Prototype for an object.
*/
struct obj_index_data
{
OBJ_INDEX_DATA *next;
AREA_DATA *area; /* OLC */
EXTRA_DESCR_DATA *extra_descr;
AFFECT_DATA *affected;
MPROG_DATA *mudprogs;
int progtypes[MAX_VECTOR];
char *name;
char *short_descr;
char *description;
char *action;
int vnum;
int item_type;
int extra_flags;
int wear_flags;
int count;
int weight;
int cost;
int required_skill;
int material;
int condition;
int value[4];
int level;
int reset_chance;
};
/*
* An affect.
*/
struct affect_data
{
AFFECT_DATA *next;
int type;
int level;
int duration;
int location;
int modifier;
int bitvector[MAX_VECTOR];
bool deleted;
};
/*
* Shop Information.
*/
struct shop_data
{
SHOP_DATA *next; /* Next shop in list */
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 */
};
/*
* Mobile Special Function.
*/
struct spec_type
{
SPEC_FUN *spec_fun; /* the actual function */
const char *const spec_name; /* ascii name for spec_lookup */
int usage; /* when it is to be used */
const char *const message; /* message for mob lore */
int prcnt_xp; /* percentage modifier on xp */
};
/*
* Extra description data for a room or object.
*/
struct extra_descr_data
{
EXTRA_DESCR_DATA *next; /* Next in list */
char *keyword; /* Keyword in look/examine */
char *description; /* What to see */
bool deleted;
};
/*
* Area-reset definition.
* 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
*/
struct reset_data
{
RESET_DATA *next;
char command;
int arg1;
int arg2;
};
/*
* Help table types.
*/
struct help_data
{
HELP_DATA *next;
int level;
char *keyword;
char *text;
AREA_DATA *area;
};
/*------------------------------------------------------------------
* Constant Tables.
*/
/*
* Per-class stuff.
*/
struct class_type
{
char who_name[4]; /* Three-letter name for 'who' */
char name[20]; /* The long format name */
int attr_prime; /* Prime attribute */
int weapon; /* First weapon */
int mudschool; /* Vnum of mudschool room */
int skill_adept; /* Maximum skill level */
int combat_no; /* Combat number for hitting */
int hp_min; /* Min hp gained on leveling */
int hp_max; /* Max hp gained on leveling */
int fMana; /* Class gains mana on level */
};
/*
* Race structures.
*/
struct race_type
{
const char *name;
const char who_name[7];
int race_abilities;
int size;
int str_mod;
int int_mod;
int wis_mod;
int dex_mod;
int con_mod;
int hp_gain;
int mana_gain[MAGIC_MAX];
int move_gain;
int thirst_mod;
int hunger_mod;
const char *dmg_message;
const char *hate;
int resil;
int magic_resist;
int base_age;
int body_temp;
int body_parts;
const char *racial_skill;
int languages;
int natural_align;
};
/*
* Skills include spells as a particular case.
*/
struct skill_type
{
const char *name; /* Name of skill */
int skill_level[MAX_CLASS]; /* Level needed by class */
SPELL_FUN *spell_fun; /* Spell pointer (for spells) */
int target; /* Legal targets */
int minimum_position; /* Position for caster / user */
int *pgsn; /* Pointer to associated gsn */
int beats; /* Waiting time after use */
int min_mana[MAGIC_MAX+1]; /* Minimum mana used in each sphere */
const char *noun_damage; /* Damage message */
const char *msg_off; /* Wear off message */
int skill_type; /* What sort of skill is this? */
int usage; /* How often will it be used */
};
/*
* Struct for Interpreter Table.
*/
struct interpreter_type
{
const char *name;
INTERPRETER_FUN *interpreter;
PROMPT_FUN *prompt;
int flags;
};
/*
* Structure for a command in the command lookup table.
*/
struct cmd_type
{
const char *const name;
DO_FUN *do_fun;
int position;
int level;
int log;
};
/*
* Structure for a social in the socials table.
* changed into a dynamic linked list
*/
struct social_type
{
SOCIAL_DATA *next;
char *name;
char *char_no_arg;
char *others_no_arg;
char *char_found;
char *others_found;
char *vict_found;
char *char_auto;
char *others_auto;
};
/*
* Poses.
*/
struct pose_index_data
{
POSE_DATA *first;
int size;
};
struct pose_data
{
POSE_DATA *next;
char *to_char;
char *to_room;
};
/*
* Liquids.
*/
struct liq_type
{
const char *liq_name;
const char *liq_color;
int liq_affect[3];
};
/*
* Wearing Equipment Table.
*/
struct wear_stuff
{
int wear_flag;
int body_parts;
const char *no_part;
const char *where_name;
const char *wear_on_ch;
const char *wear_on_room;
};
/*
* Structure for limb loss.
*/
struct limb_loss
{
int chance;
int body_parts;
int limb_vnum;
const char *const act_char;
const char *const act_other;
};
/*
* Drunkeness communication structure.
*/
struct struckdrunk
{
int min_drunk_level;
int number_of_rep;
const char *replacement[ 11 ];
};
/*
* OLC.
* This structure is used in bit.c to lookup flags and stats.
*/
struct flag_type
{
const char *name;
int bit;
bool settable;
};
/*
* New system for area files.
*
* I realise that this method of reading from the area files
* causes a much longer boot time for the mud, but the benefit
* is that the area files are both backward and forward compatible.
* This slow boot is a small price to pay, as it doesn't effect
* the running of the MUD once started.
*
* --by Symposium for DalekenMUD
*/
struct file_read_type
{
const char *name;
int standard;
void *target;
READ_FUN *read_fun;
};
/*------------------------------------------------------------------
* MudProgs.
*/
struct mud_prog_data
{
MPROG_DATA *next;
int type;
char *arglist;
char *comlist;
};
struct mud_prog_global
{
MPROG_GLOBAL *next;
AREA_DATA *area;
int vnum;
int allowed;
int type;
char *arglist;
char *comlist;
};
struct mud_prog_variable
{
MPROG_VAR *next;
char *name;
char *value;
};
struct mud_prog_info
{
MPROG_DATA *mprg;
MPROG_VAR *local;
CHAR_DATA *mob;
CHAR_DATA *actor;
OBJ_DATA *obj;
void *vo;
CHAR_DATA *rndm;
};
struct mud_prog_line
{
struct mud_prog_line *next;
const char *line;
};
struct mud_prog_stack
{
int *stack;
int max_size;
int current;
};
/* The struct that contains all the information that a
* returning event requires */
struct mud_prog_callback
{
const char *commands;
MPROG_INFO info;
MPROG_STACK *stack;
int line_no;
};
struct mud_prog_act_list
{
MPROG_ACT_LIST *next;
void *target;
MPROG_DATA *mprg;
MPROG_INFO *info;
};
struct supermob_data
{
struct supermob_data *next;
CHAR_DATA *supermob;
OBJ_DATA *prog_obj;
ROOM_INDEX_DATA *prog_room;
};
/*------------------------------------------------------------
* Miscellaneous Structures.
*/
/*
* Highest Table.
*/
struct highest_entry
{
HIGHEST_ENTRY *next;
char *name;
int level;
int sublevel;
int class;
int race;
};
struct highest_data
{
HIGHEST_DATA *next;
char *type;
HIGHEST_ENTRY *entries[10];
};
/*
* Data structure for boards.
*/
struct board_data
{
const char *short_name; /* Name used to refer to it */
const char *long_name; /* Descriptive name */
int read_level; /* Minimum level to see board */
int write_level; /* Minimum level to post notes */
const char *include; /* These must be included */
const char *exclude; /* These must not be included */
int purge_days; /* Default expiration */
bool changed; /* Has the board changed */
NOTE_DATA *note_first; /* The head of the list */
};
/*
* Data structure for notes.
*/
struct note_data
{
NOTE_DATA *next;
char *sender;
char *date;
char *to_list;
char *subject;
char *text;
time_t date_stamp;
time_t expire;
};
/*
* Aliases.
*/
struct alias_data
{
ALIAS_DATA *next;
char *name;
char *command;
int complex;
};
/*
* Questing Data.
*/
struct quest_data
{
QUEST_DATA *next;
int score;
int time;
int reward;
int type;
void * target;
};
struct quest_race_corpse
{
int race;
int min_lvl;
};
struct quest_obj_material
{
int material;
int min_weight;
};
/*
* Structures for the securing trading interface.
* by Symposium.
*/
struct trade_data
{
TRADE_DATA *other;
CHAR_DATA *ch;
int flags;
OBJ_DATA *objs[MAX_TRADE_OBJ];
int gold;
};
/*
* A kill structure (indexed by level).
*/
struct kill_data
{
int number;
int killed;
};
/*
* Damage messages
*/
struct damage_message
{
int max_dam;
const char *mesg;
const char *fire_mesg;
const char *ice_mesg;
};
/*
* Tracking struct.
*/
struct track_data
{
TRACK_DATA *next;
ROOM_INDEX_DATA *room;
int dir;
};
/*
* Flexible buffer type.
*/
struct buffer_type
{
char *data; /* The data */
int len; /* The current len of the buffer */
int size; /* The allocated size of data */
bool overflowed; /* Is the buffer overflowed? */
};