act.build.c
act.build.c · 143.3 KB
From the archive obuild.05.tar.gz
Download the archive « Back to the archive contents
/*************************************************************************
* File: act.build.c Part of CircleMUD *
* Usage: online editing/creating *
* By Samedi *
* *
* All rights reserved. See license.doc for complete information. *
* *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <sys/types.h>
/* PATCH LEVEL 8 AND OLDER IMPS - delete the next two lines. They're meant
for patch level 9
*/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "spells.h"
#include "house.h"
#include "screen.h"
/* external vars */
extern FILE *player_fl;
extern struct room_data *world;
extern struct char_data *character_list;
extern struct obj_data *object_list;
extern struct descriptor_data *descriptor_list;
extern struct title_type titles[NUM_CLASSES][LVL_IMPL + 1];
extern struct index_data *mob_index;
extern struct index_data *obj_index;
extern struct int_app_type int_app[36];
extern struct wis_app_type wis_app[36];
extern struct zone_data *zone_table;
extern int top_of_zone_table;
extern int restrict;
extern int top_of_world;
extern int top_of_mobt;
extern int top_of_objt;
extern int top_of_p_table;
/* for objects */
extern char *item_types[];
extern char *wear_bits[];
extern char *extra_bits[];
extern char *drinks[];
extern struct obj_data *obj_proto; /*oeditmod*/
extern int max_new_objects; /*oeditmod*/
/* for rooms */
extern char *dirs[];
extern char *room_bits[];
extern char *exit_bits[];
extern char *sector_types[];
extern int max_new_rooms;/*reditmod*/
/* for zones */
extern int comment_zone_file; /*zeditmod*/
/* for chars */
extern char *spells[];
extern char *equipment_types[];
extern char *affected_bits[];
extern char *apply_types[];
extern char *pc_class_types[];
extern char *npc_class_types[];
extern char *action_bits[];
extern char *player_bits[];
extern char *preference_bits[];
extern char *position_types[];
extern char *connected_types[];
extern struct char_data *mob_proto; /*meditmod*/
extern int max_new_mobs; /*meditmod*/
extern struct player_special_data dummy_mob; /*meditmod*/
/* internal for object editing */ /*oeditmod*/
int new_objects;
int get_line2(FILE * fl, char *buf);
int get_zone_perms(struct char_data * ch, int z_num);
int check_edit_obj(struct char_data * ch, int obj_vnum);
int obj_allow = TRUE;
int objs_to_file(int zone);
int copy_object(struct obj_data * dest, struct obj_data * src);
/*room editing *reditmod*/
int new_rooms;
int room_allow = TRUE;
int add_to_index(int zone, char * type);
int save_rooms(int zone);
int check_edit_zone(struct char_data * ch, int zone_vnum);
/*mob editing *meditmod*/
int mob_allow = TRUE;
int new_mobs;
int check_edit_mob(struct char_data * ch, int mob_vnum);
void save_mob(struct char_data * ch);
int mobs_to_file(int zone);
int copy_mobile(struct char_data * dest, struct char_data * src);
/*zone editing *zeditmod*/
int zone_allow = FALSE;
int new_zones;
struct zone_data *add_zone(struct zone_data * zn_table, int zone);
int get_top(int zone);
int get_zon_num(int vnum);
int get_zone_rnum(int zone);
int read_zone_perms(int rnum);
void show_z_resets(struct char_data * ch, int min, int max);
void delete_reset_com(int zone, int com_num);
void add_reset_com(int zone, int com_num, struct reset_com * cmd);
void save_zone(struct char_data * ch, int zone);
void sprintbits(long vektor,char *outstring);
#define OBJ_NEW(ch) ((ch)->player.obj_buffer)
#define MOB_NEW(ch) ((ch)->player.mob_buf)
#define ZONE_BUF(ch) ((ch)->player.zone_edit)
#define GET_ROOM_SECTOR(room) (world[(room)].sector_type)
#define ZON_FLAGS(ch) ((ch)->player.zone_flags)
#define ZON_FLAGGED(ch, flag) (IS_SET(ZON_FLAGS(ch), (flag)))
#define CHECK_NULL(string) ((string) ? (string) : "")
void do_stat_object(struct char_data * ch, struct obj_data * j);
void do_stat_character(struct char_data * ch, struct char_data * k);
void do_stat_room(struct char_data * ch);
/* oeditmod */
ACMD(do_ostat)
{
struct obj_data *obj;
int number, r_num;
one_argument(argument, buf);
if(*buf) {
if (!isdigit(*buf)) {
send_to_char("Usage: ostat [vnum]\r\n", ch);
return;
}
if ((number = atoi(buf)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_object(number)) < 0) {
send_to_char("There is no object with that number.\r\n", ch);
return;
}
obj = read_object(r_num, REAL);
do_stat_object(ch, obj);
extract_obj(obj);
} else if (!OBJ_NEW(ch)) {
send_to_char("There is no default object to edit.\r\n", ch);
return;
} else {
do_stat_object(ch, OBJ_NEW(ch));
}
}
/* meditmod */
ACMD(do_mstat)
{
struct char_data *mob;
int number, r_num;
one_argument(argument, buf);
if(*buf) {
if (!isdigit(*buf)) {
send_to_char("Usage: mstat [vnum]\r\n", ch);
return;
}
if ((number = atoi(buf)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_mobile(number)) < 0) {
send_to_char("There is no mob with that number.\r\n", ch);
return;
}
mob = read_mobile(r_num, REAL);
char_to_room(mob, 0);
do_stat_character(ch, mob);
extract_char(mob);
} else if (!MOB_NEW(ch)) {
send_to_char("There is no default mob to stat.\r\n", ch);
return;
} else {
if(!MOB_NEW(ch)) {
send_to_char("No mob in the edit buffer.\r\n", ch);
return;
}
do_stat_character(ch, MOB_NEW(ch));
}
}
/* reditmod */
ACMD(do_rstat)
{
int number, r_num, room_temp;
one_argument(argument, buf);
if(*buf) {
if (!isdigit(*buf)) {
send_to_char("Usage: rstat [vnum]\r\n", ch);
return;
}
if ((number = atoi(buf)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_room(number)) < 0) {
send_to_char("There is no room with that number.\r\n", ch);
return;
}
room_temp = ch->in_room;
char_from_room(ch);
char_to_room(ch, r_num);
do_stat_room(ch);
char_from_room(ch);
char_to_room(ch, room_temp);
} else {
do_stat_room(ch);
}
}
/* zeditmod */
ACMD(do_zstat)
{
int i, zn = -1, pos = 0, none = TRUE;
struct builder_list *bldr;
char *rmode[] =
{ "Never resets",
"Resets only when deserted",
"Always resets" };
one_argument(argument, buf);
if(*buf) {
if(isdigit(*buf))
zn = atoi(buf);
else {
send_to_char("Usage: zstat [zone number]\r\n", ch);
return;
}
} else zn = get_zon_num(world[ch->in_room].number);
if(zn < 0) {
sprintf(buf, "SYSERR: Zone #%d doesn't seem to exist.",
world[ch->in_room].number / 100);
log(buf);
send_to_char("Warning! The room you're in doesn't belong to any zone in memory.\r\n", ch);
return;
}
for(i = 0; i <= top_of_zone_table && zone_table[i].number != zn; i++);
if(i > top_of_zone_table) {
send_to_char("That zone doesn't exist.\r\n", ch);
return;
}
if((zone_table[i].reset_mode < 0) || (zone_table[i].reset_mode > 2))
zone_table[i].reset_mode = 2;
sprintf(buf, "%sZone # : %s%3d %sName : %s%s\r\n",
CCMAG(ch, C_SPR),
CCWHT(ch, C_SPR), zone_table[i].number, CCMAG(ch, C_SPR),
CCWHT(ch, C_SPR), zone_table[i].name);
sprintf(buf, "%s%sAge/Lifespan: %s%3d%s/%s%3d %sTop vnum : %s%5d\r\n",
buf, CCMAG(ch, C_SPR), CCWHT(ch, C_SPR), zone_table[i].age,
CCMAG(ch, C_SPR), CCWHT(ch, C_SPR), zone_table[i].lifespan,
CCMAG(ch, C_SPR), CCWHT(ch, C_SPR), zone_table[i].top);
sprintf(buf, "%s%sReset mode : %s%s\r\n", buf, CCMAG(ch, C_SPR),
CCWHT(ch, C_SPR), rmode[zone_table[i].reset_mode]);
sprintf(buf, "%s%sBuilders : %s", buf, CCMAG(ch, C_SPR), CCWHT(ch, C_SPR));
if(zone_table[i].builders == NULL)
read_zone_perms(i);
for(bldr = zone_table[i].builders; bldr; bldr = bldr->next) {
if(*(bldr->name) != '*') {
none = FALSE;
switch (pos) {
case 0:
sprintf(buf, "%s%s", buf, bldr->name);
pos = 2;
break;
case 1:
sprintf(buf, "%s\r\n %s", buf, bldr->name);
pos = 2;
break;
case 2:
sprintf(buf, "%s, %s", buf, bldr->name);
pos = 3;
break;
case 3:
sprintf(buf, "%s, %s", buf, bldr->name);
pos = 1;
break;
}
}
}
if(none) sprintf(buf, "%sNONE%s\r\n", buf, CCNRM(ch, C_SPR));
else sprintf(buf, "%s%s\r\n", buf, CCNRM(ch, C_SPR));
send_to_char(buf, ch);
}
/*zeditmod*/
ACMD(do_zflags)
{
int cmmd = 0, length = 0, help = FALSE;
char field[MAX_INPUT_LENGTH];
char val_arg[MAX_INPUT_LENGTH];
int min = -1, max = -1;
char *fields[] =
{ "show" ,"none" ,"doors" ,
"all" ,"mobs" ,"oloads" ,
"gives" ,"equips" ,"puts" ,
"removes" ,"default" ,
"\n" };
if(!*argument && ZON_FLAGS(ch) != 0) {
show_z_resets(ch, -1, -1);
return;
}
half_chop(argument, field, val_arg);
if(!*field) *field = '*';
if(isdigit(*field))
min = atoi(field);
if((*val_arg) && isdigit(*val_arg))
max = atoi(val_arg);
if((min != -1) || (max != -1)) {
show_z_resets(ch, min, max);
return;
}
do {
for (length = strlen(field), cmmd = 0; *fields[cmmd] != '\n'; cmmd++)
if (!strn_cmp(fields[cmmd], field, length))
break;
switch(cmmd) {
case 0:
send_to_char("You currently have the following flags ON.\r\n", ch);
if(!ZON_FLAGS(ch)) {
send_to_char(" All flags are OFF\r\n", ch);
return;
}
if(ZON_FLAGGED(ch, ZFL_DOORS))
send_to_char(" Doors are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_MOBS))
send_to_char(" Mobs are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_OLOADS))
send_to_char(" Objects loaded to the room are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_OGIVES))
send_to_char(" Objects given to mobs are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_OEQUIPS))
send_to_char(" Objects equipped by mobs are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_OPUTS))
send_to_char(" Objects put in other objects are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_REMOVES))
send_to_char(" Objects removed from the room are ON\r\n", ch);
if(ZON_FLAGGED(ch, ZFL_DEFAULT))
send_to_char(" The default mob is ON\r\n", ch);
return;
case 1:
send_to_char("All flags turned OFF\r\n", ch);
ZON_FLAGS(ch) = 0;
break;
case 2:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_DOORS);
if(IS_SET(ZON_FLAGS(ch), ZFL_DOORS))
send_to_char("Doors turned ON\r\n", ch);
else
send_to_char("Doors turned OFF\r\n", ch);
break;
case 3:/*all on*/
SET_BIT(ZON_FLAGS(ch), ZFL_DOORS | ZFL_MOBS | ZFL_OLOADS |
ZFL_OGIVES | ZFL_OEQUIPS | ZFL_OPUTS | ZFL_REMOVES | ZFL_DEFAULT);
send_to_char("All flags turned ON\r\n", ch);
break;
case 4:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_MOBS);
if(IS_SET(ZON_FLAGS(ch), ZFL_MOBS))
send_to_char("Mobs turned ON\r\n", ch);
else
send_to_char("Mobs turned OFF\r\n", ch);
break;
case 5:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_OLOADS);
if(IS_SET(ZON_FLAGS(ch), ZFL_OLOADS))
send_to_char("Object loads turned ON\r\n", ch);
else
send_to_char("Object loads turned OFF\r\n", ch);
break;
case 6:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_OGIVES);
if(IS_SET(ZON_FLAGS(ch), ZFL_OGIVES))
send_to_char("Object gives turned ON\r\n", ch);
else
send_to_char("Object gives turned OFF\r\n", ch);
break;
case 7:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_OEQUIPS);
if(IS_SET(ZON_FLAGS(ch), ZFL_OEQUIPS))
send_to_char("Object equips turned ON\r\n", ch);
else
send_to_char("Object equips turned OFF\r\n", ch);
break;
case 8:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_OPUTS);
if(IS_SET(ZON_FLAGS(ch), ZFL_OPUTS))
send_to_char("Object puts turned ON\r\n", ch);
else
send_to_char("Object puts turned OFF\r\n", ch);
break;
case 9:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_REMOVES);
if(IS_SET(ZON_FLAGS(ch), ZFL_REMOVES))
send_to_char("Object removes turned ON\r\n", ch);
else
send_to_char("Object removes turned OFF\r\n", ch);
break;
case 10:
TOGGLE_BIT(ZON_FLAGS(ch), ZFL_DEFAULT);
if(IS_SET(ZON_FLAGS(ch), ZFL_DEFAULT))
send_to_char("Default mob turned ON\r\n", ch);
else
send_to_char("Default mob turned OFF\r\n", ch);
break;
default:
if(!help) {
send_to_char("Usage : zflags [flag]\r\n\r\n", ch);
send_to_char("Valid flags are:\r\n\r\n", ch);
send_to_char("show show status of flags\r\n", ch);
send_to_char("all turn all flags ON\r\n", ch);
send_to_char("none turn all flags OFF\r\n", ch);
send_to_char("doors show door resets\r\n", ch);
send_to_char("mobs show mob resets\r\n", ch);
send_to_char("oloads show objects that load into the room\r\n", ch);
send_to_char("gives show objects given to mobs\r\n", ch);
send_to_char("equips show objects equipped on mobs\r\n", ch);
send_to_char("puts show objects put in other objects\r\n", ch);
send_to_char("removes show objects removed from the room\r\n", ch);
send_to_char("default show the default mob\r\n", ch);
send_to_char("help show this list\r\n\r\n", ch);
send_to_char("Zflags will accept multiple flags on the same line. Zflags with no arguments\r\n", ch);
send_to_char("will show the resets in the current room.\r\n", ch);
help = TRUE;
}
}
half_chop(val_arg, field, val_arg);
} while(*field);
}
/* load a copy of the object being edited to the editor's
* inventory *oeditmod*
*/
ACMD(do_oload)
{
int number, r_num, i;
struct obj_data *obj;
struct extra_descr_data *desc, *desc2;
one_argument(argument, buf);
if(!*buf && !OBJ_NEW(ch)) {
send_to_char("There is no object in the edit buffer. Use oedit to set one.\r\n", ch);
return;
} else if (!*buf) {
sprintf(buf, "Poof! You create %s.\r\n", OBJ_NEW(ch)->short_description);
send_to_char(buf, ch);
obj = read_object(OBJ_NEW(ch)->item_number, REAL);
if(OBJ_NEW(ch)->name)
obj->name = str_dup(OBJ_NEW(ch)->name);
if(OBJ_NEW(ch)->short_description)
obj->short_description = str_dup(OBJ_NEW(ch)->short_description);
if(OBJ_NEW(ch)->description)
obj->description = str_dup(OBJ_NEW(ch)->description);
if(OBJ_NEW(ch)->action_description)
obj->action_description = str_dup(OBJ_NEW(ch)->action_description);
obj->obj_flags.type_flag = OBJ_NEW(ch)->obj_flags.type_flag;
obj->obj_flags.extra_flags = OBJ_NEW(ch)->obj_flags.extra_flags;
obj->obj_flags.wear_flags = OBJ_NEW(ch)->obj_flags.wear_flags;
obj->obj_flags.value[0] = OBJ_NEW(ch)->obj_flags.value[0];
obj->obj_flags.value[1] = OBJ_NEW(ch)->obj_flags.value[1];
obj->obj_flags.value[2] = OBJ_NEW(ch)->obj_flags.value[2];
obj->obj_flags.value[3] = OBJ_NEW(ch)->obj_flags.value[3];
obj->obj_flags.weight = OBJ_NEW(ch)->obj_flags.weight;
obj->obj_flags.cost = OBJ_NEW(ch)->obj_flags.cost;
obj->obj_flags.cost_per_day = OBJ_NEW(ch)->obj_flags.cost_per_day;
obj->ex_description = NULL;
if(OBJ_NEW(ch)->ex_description) {
for(desc = OBJ_NEW(ch)->ex_description; desc; desc = desc->next) {
CREATE(desc2, struct extra_descr_data, 1);
desc2->keyword = str_dup(desc->keyword);
desc2->description = str_dup(desc->description);
desc2->next = obj->ex_description;
obj->ex_description = desc2;
}
}
for(i = 0; i < MAX_OBJ_AFFECT; i++) {
obj->affected[i].location = OBJ_NEW(ch)->affected[i].location;
obj->affected[i].modifier = OBJ_NEW(ch)->affected[i].modifier;
}
obj_to_char(obj, ch);
sprintf(buf2, "load: obj #%i oloaded by %s", GET_OBJ_VNUM(obj),
GET_NAME(ch));
log(buf2);
return;
}
if(!isdigit(*buf)) {
send_to_char("Usage: oload [vnum]\r\n", ch);
return;
}
if ((number = atoi(buf)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_object(number)) < 0) {
send_to_char("There is no object with that number.\r\n", ch);
return;
}
obj = read_object(r_num, REAL);
sprintf(buf, "Poof! You create %s.\r\n", obj->short_description);
sprintf(buf2, "load: obj #%i oloaded by %s", GET_OBJ_VNUM(obj),
GET_NAME(ch));
log(buf2);
send_to_char(buf, ch);
obj_to_char(obj, ch);
}
/* save object edit buffer to obj_proto and *.obj file
* oeditmod
*/
ACMD(do_osave)
{
int i, obj_new_vnum;
if(!OBJ_NEW(ch)) {
send_to_char("There is no object in the edit buffer. Use oedit to set one.\r\n", ch);
return;
}
obj_new_vnum = GET_OBJ_VNUM(OBJ_NEW(ch));
i = real_object(obj_new_vnum);
if(copy_object(obj_proto + i, OBJ_NEW(ch))) {
send_to_char("Error: unable to copy object to prototype\r\n", ch);
return;
}
sprintf(buf, "object #%d\r\n", obj_new_vnum);
send_to_char(buf, ch);
sprintf(buf, "olc: osave : #%i saved in memory by %s", obj_new_vnum,
GET_NAME(ch));
mudlog(buf, CMP, LVL_GOD, TRUE);
send_to_char("Object prototype saved in memory.\r\n", ch);
i = get_zon_num(obj_new_vnum);
if(objs_to_file(i)) {
send_to_char("Error: could not write object file.\r\n", ch);
return;
}
sprintf(buf2, "olc: osave : #%i saved in obj file by %s", obj_new_vnum,
GET_NAME(ch));
mudlog(buf2, CMP, LVL_GOD, TRUE);
send_to_char("Object prototype saved in obj file.\r\n", ch);
}
/* save mob edit buffer to mob_proto and *.mob file
* meditmod
*/
void save_mob(struct char_data * ch)
{
int i, mob_new_vnum;
if(!MOB_NEW(ch)) {
send_to_char("There is no mob in the edit buffer. Use medit to set one.\r\n", ch);
return;
}
mob_new_vnum = GET_MOB_VNUM(MOB_NEW(ch));
i = real_mobile(mob_new_vnum);
if(copy_mobile(mob_proto + i, MOB_NEW(ch))) {
send_to_char("Error: could not copy mob to prototype\r\n", ch);
return;
}
sprintf(buf, "mob #%d\r\n", mob_new_vnum);
send_to_char(buf, ch);
sprintf(buf, "olc: msave : #%i saved in memory by %s", mob_new_vnum,
GET_NAME(ch));
mudlog(buf, CMP, LVL_GOD, TRUE);
send_to_char("Mob prototype saved in memory.\r\n", ch);
i = get_zon_num(mob_new_vnum);
if(mobs_to_file(i)) {
send_to_char("Error: could not write mob file.\r\n", ch);
return;
}
sprintf(buf2, "olc: msave : #%i saved in mob file by %s", mob_new_vnum,
GET_NAME(ch));
mudlog(buf2, CMP, LVL_GOD, TRUE);
send_to_char("Mob prototype saved in mob file.\r\n", ch);
}
/* set the object to be edited */ /*oeditmod*/
ACMD(do_oedit)
{
int number, r_num, i = 0, j, zone, zn, top_obj;
int obj_new_num = NOTHING, obj_new_new = FALSE;
struct extra_descr_data *desc, *desc2;
one_argument(argument, buf);
if(GET_LEVEL(ch) == LVL_IMPL && is_abbrev(buf, "allow")) {
mob_allow = TRUE;
sprintf(buf, "olc: %s turns obj editor access ON", GET_NAME(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
if(GET_LEVEL(ch) == LVL_IMPL && is_abbrev(buf, "deny")) {
mob_allow = FALSE;
sprintf(buf, "olc: %s turns obj editor access OFF", GET_NAME(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
if(!mob_allow) {
send_to_char("The object editor is currently disabled.\r\n", ch);
return;
}
if(!*buf || (!isdigit(*buf) && !is_abbrev(buf, "create")
&& !is_abbrev(buf, "done"))) {
send_to_char("Usage: oedit (<vnum>|create|done)\r\n", ch);
return;
}
if(is_abbrev(buf, "done")) {
free(OBJ_NEW(ch));
OBJ_NEW(ch) = NULL;
return;
}
if(is_abbrev(buf, "create")) {
zn = get_zon_num(world[ch->in_room].number);
zone = get_zone_perms(ch, zn);
if(zone == -1) return;
obj_new_new = TRUE;
top_obj = get_top(zn);
for(j = zone * 100; j <= top_obj; j++) {
if(j > top_obj) {
send_to_char("No free object vnums in this zone.\r\n", ch);
return;
}
if (real_object(j) < 0) {
obj_new_num = j;
obj_new_new = TRUE;
sprintf(buf, "New object #%i in zone #%i.\r\n", j, zone);
send_to_char(buf, ch);
break;
}
}
} else {
if ((number = atoi(buf)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_object(number)) < 0) {
send_to_char("There is no object with that number.\r\n", ch);
return;
}
zn = get_zon_num(number);
zone = get_zone_perms(ch, zn);
if(zone == -1) return;
if(!check_edit_obj(ch, number)) {
OBJ_NEW(ch) = NULL;
return;
}
i = r_num;
}
if (OBJ_NEW(ch)) free(OBJ_NEW(ch));
CREATE(OBJ_NEW(ch), struct obj_data, 1); /*rev.01*/
if(obj_new_new) {
new_objects++;
if(new_objects > max_new_objects) {
send_to_char("There are no more new object slots. Reboot for more.\r\n", ch);
free(OBJ_NEW(ch));
return;
}
top_of_objt++;
i = top_of_objt;
obj_index[i].virtual = obj_new_num;
obj_index[i].number = 0;
obj_index[i].func = NULL;
obj_proto[i].in_room = NOWHERE;
obj_proto[i].item_number = top_of_objt;
obj_proto[i].name = str_dup("object new");
obj_proto[i].short_description = str_dup("a new object");
obj_proto[i].description = str_dup("A new object is here.");
obj_proto[i].action_description = NULL;
obj_proto[i].ex_description = NULL;
}
*(OBJ_NEW(ch)) = obj_proto[i];
if(obj_proto[i].name)
OBJ_NEW(ch)->name = str_dup(obj_proto[i].name);
if(obj_proto[i].short_description)
OBJ_NEW(ch)->short_description = str_dup(obj_proto[i].short_description);
if(obj_proto[i].description)
OBJ_NEW(ch)->description = str_dup(obj_proto[i].description);
if(obj_proto[i].action_description)
OBJ_NEW(ch)->action_description = str_dup(obj_proto[i].action_description);
OBJ_NEW(ch)->ex_description = NULL;
if(obj_proto[i].ex_description) {
for(desc = obj_proto[i].ex_description; desc; desc = desc->next) {
CREATE(desc2, struct extra_descr_data, 1);
desc2->keyword = str_dup(desc->keyword);
desc2->description = str_dup(desc->description);
desc2->next = OBJ_NEW(ch)->ex_description;
OBJ_NEW(ch)->ex_description = desc2;
}
}
}
/* set the mob to be edited */ /*meditmod*/
ACMD(do_medit)
{
int number, r_num, i = 0, j, k, zone, zn, top_mob;
int mob_new_num = NOTHING, mob_new_new = FALSE;
one_argument(argument, buf);
if(GET_LEVEL(ch) == LVL_IMPL && is_abbrev(buf, "allow")) {
mob_allow = TRUE;
sprintf(buf, "olc: %s turns mob editor access ON", GET_NAME(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
if(GET_LEVEL(ch) == LVL_IMPL && is_abbrev(buf, "deny")) {
mob_allow = FALSE;
sprintf(buf, "olc: %s turns mob editor access OFF", GET_NAME(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
if(!mob_allow) {
send_to_char("The mob editor is currently disabled.\r\n", ch);
return;
}
if(!*buf || (!isdigit(*buf) && !is_abbrev(buf, "create")
&& !is_abbrev(buf, "done") && !is_abbrev(buf, "save"))) {
send_to_char("Usage: medit (<vnum>|create|save|done)\r\n", ch);
return;
}
if(is_abbrev(buf, "save")) {
save_mob(ch);
return;
}
if(is_abbrev(buf, "done")) {
free(MOB_NEW(ch));
MOB_NEW(ch) = NULL;
return;
}
if(is_abbrev(buf, "create")) {
zn = get_zon_num(world[ch->in_room].number);
zone = get_zone_perms(ch, zn);
if(zone == -1) return;
mob_new_new = TRUE;
top_mob = get_top(zn);
for(j = zone * 100; j <= top_mob; j++) {
if(j > top_mob) {
send_to_char("No free mob vnums in this zone.\r\n", ch);
return;
}
if (real_mobile(j) < 0) {
mob_new_num = j;
mob_new_new = TRUE;
sprintf(buf, "New mob #%i in zone #%i.\r\n", j, zone);
send_to_char(buf, ch);
break;
}
}
} else {
if ((number = atoi(buf)) < 0) {
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if ((r_num = real_mobile(number)) < 0) {
send_to_char("There is no mob with that number.\r\n", ch);
return;
}
zn = get_zon_num(number);
zone = get_zone_perms(ch, zn);
if(zone == -1) return;
if(!check_edit_mob(ch, number)) {
MOB_NEW(ch) = NULL;
return;
}
i = r_num;
}
if (MOB_NEW(ch)) free(MOB_NEW(ch));
CREATE(MOB_NEW(ch), struct char_data, 1);
if(mob_new_new) {
new_mobs++;
if(new_mobs > max_new_mobs) {
send_to_char("There are no more new mob slots. Reboot for more.\r\n", ch);
free(MOB_NEW(ch));
return;
}
top_of_mobt++;
i = top_of_mobt;
mob_index[i].virtual = mob_new_num;
mob_index[i].number = 0;
mob_index[i].func = NULL;
mob_proto[i].nr = i;
mob_proto[i].desc = NULL;
mob_proto[i].player_specials = &dummy_mob;
mob_proto[i].in_room = NOWHERE;
mob_proto[i].player.name = str_dup("mob new");
mob_proto[i].player.short_descr = str_dup("A new mob");
mob_proto[i].player.long_descr = str_dup("A new mob is existing here.");
mob_proto[i].player.description = NULL;
mob_proto[i].player.title = NULL;
MOB_FLAGS(mob_proto + i) = 0;
SET_BIT(MOB_FLAGS(mob_proto + i), MOB_ISNPC);
AFF_FLAGS(mob_proto + i) = 0;
GET_ALIGNMENT(mob_proto + i) = 0;
mob_proto[i].real_abils.str = 11;
mob_proto[i].real_abils.intel = 11;
mob_proto[i].real_abils.wis = 11;
mob_proto[i].real_abils.dex = 11;
mob_proto[i].real_abils.con = 11;
mob_proto[i].real_abils.cha = 11;
GET_LEVEL(mob_proto + i) = 1;
mob_proto[i].points.hitroll = 0;
mob_proto[i].points.armor = 100;
mob_proto[i].points.max_hit = 0;
mob_proto[i].points.hit = 1;
mob_proto[i].points.mana = 3;
mob_proto[i].points.move = 10;
mob_proto[i].points.max_mana = 10;
mob_proto[i].points.max_move = 50;
mob_proto[i].mob_specials.damnodice = 1;
mob_proto[i].mob_specials.damsizedice = 3;
mob_proto[i].points.damroll = 0;
GET_GOLD(mob_proto + i) = 0;
GET_EXP(mob_proto + i) = 0;
mob_proto[i].mob_specials.attack_type = 0;
mob_proto[i].char_specials.position = 8;
mob_proto[i].mob_specials.default_pos = 8;
mob_proto[i].player.sex = 0;
mob_proto[i].player.class = 0;
mob_proto[i].player.weight = 200;
mob_proto[i].player.height = 198;
for(k = 0; k < 3; k++)
GET_COND(mob_proto + i, k) = -1;
for(k = 0; k < 5; k++)
GET_SAVE(mob_proto + i, k) = 0;
mob_proto[i].aff_abils = mob_proto[i].real_abils;
}
MOB_NEW(ch)->nr = i;
if(mob_proto[i].player.name)
MOB_NEW(ch)->player.name = str_dup(mob_proto[i].player.name);
if(mob_proto[i].player.short_descr)
MOB_NEW(ch)->player.short_descr = str_dup(mob_proto[i].player.short_descr);
if(mob_proto[i].player.long_descr)
MOB_NEW(ch)->player.long_descr = str_dup(mob_proto[i].player.long_descr);
if(mob_proto[i].player.description)
MOB_NEW(ch)->player.description = str_dup(mob_proto[i].player.description);
MOB_NEW(ch)->player.title = NULL;
MOB_NEW(ch)->desc = NULL;
MOB_NEW(ch)->player_specials = &dummy_mob;
MOB_NEW(ch)->in_room = NOWHERE;
MOB_FLAGS(MOB_NEW(ch)) = MOB_FLAGS(mob_proto + i);
SET_BIT(MOB_FLAGS(MOB_NEW(ch)), MOB_ISNPC);
AFF_FLAGS(MOB_NEW(ch)) = AFF_FLAGS(mob_proto + i);
GET_ALIGNMENT(MOB_NEW(ch)) = GET_ALIGNMENT(mob_proto + i);
MOB_NEW(ch)->real_abils.str = mob_proto[i].real_abils.str;
MOB_NEW(ch)->real_abils.intel = mob_proto[i].real_abils.intel;
MOB_NEW(ch)->real_abils.wis = mob_proto[i].real_abils.wis;
MOB_NEW(ch)->real_abils.dex = mob_proto[i].real_abils.dex;
MOB_NEW(ch)->real_abils.con = mob_proto[i].real_abils.con;
MOB_NEW(ch)->real_abils.cha = mob_proto[i].real_abils.cha;
GET_LEVEL(MOB_NEW(ch)) = GET_LEVEL(mob_proto + i);
MOB_NEW(ch)->points.hitroll = mob_proto[i].points.hitroll;
MOB_NEW(ch)->points.damroll = mob_proto[i].points.damroll;
MOB_NEW(ch)->points.armor = mob_proto[i].points.armor;
MOB_NEW(ch)->points.max_hit = mob_proto[i].points.max_hit;
MOB_NEW(ch)->points.max_mana = mob_proto[i].points.max_mana;
MOB_NEW(ch)->points.max_move = mob_proto[i].points.max_move;
MOB_NEW(ch)->points.hit = mob_proto[i].points.hit;
MOB_NEW(ch)->points.mana = mob_proto[i].points.mana;
MOB_NEW(ch)->points.move = mob_proto[i].points.move;
MOB_NEW(ch)->mob_specials.damnodice = mob_proto[i].mob_specials.damnodice;
MOB_NEW(ch)->mob_specials.damsizedice = mob_proto[i].mob_specials.damsizedice;
MOB_NEW(ch)->mob_specials.attack_type = mob_proto[i].mob_specials.attack_type;
MOB_NEW(ch)->mob_specials.default_pos = mob_proto[i].mob_specials.default_pos;
GET_GOLD(MOB_NEW(ch)) = GET_GOLD(mob_proto + i);
GET_EXP(MOB_NEW(ch)) = GET_EXP(mob_proto + i);
MOB_NEW(ch)->char_specials.position = mob_proto[i].char_specials.position;
MOB_NEW(ch)->player.sex = mob_proto[i].player.sex;
MOB_NEW(ch)->player.class = mob_proto[i].player.class;
MOB_NEW(ch)->player.weight = mob_proto[i].player.weight;
MOB_NEW(ch)->player.height = mob_proto[i].player.height;
for(k = 0; k < 3; k++)
GET_COND(MOB_NEW(ch), k) = -1;
for(k = 0; k < 5; k++)
GET_SAVE(MOB_NEW(ch), k) = 0;
MOB_NEW(ch)->aff_abils = MOB_NEW(ch)->real_abils;
}
/*oeditmod*/
ACMD(do_zallow)
{
int zone, rnum = -1;
FILE *old_file, *new_file;
char *old_fname, *new_fname, line[256];
char arg1[40], arg2[40];
struct builder_list *bldr;
half_chop(argument, arg1, arg2);
if(!*arg1 || !*arg2 || !isdigit(*arg2)) {
send_to_char("Usage : zallow <player> <zone>\r\n", ch);
return;
}
*arg1 = UPPER(*arg1);
zone = atoi(arg2);
if((rnum = get_zone_rnum(zone)) == -1) {
send_to_char("That zone doesn't seem to exist.\r\n", ch);
return;
}
if(zone_table[rnum].builders == NULL)
read_zone_perms(rnum);
for(bldr = zone_table[rnum].builders; bldr; bldr = bldr->next) {
if(!strcmp(bldr->name, arg1)) {
send_to_char("That person already has access to that zone.\r\n", ch);
return;
}
}
CREATE(bldr, struct builder_list, 1);
bldr->name = str_dup(arg1);
bldr->next = zone_table[rnum].builders;
zone_table[rnum].builders = bldr;
sprintf(buf1, "%s/%i.zon", ZON_PREFIX, zone);
old_fname = buf1;
sprintf(buf2, "%s/%i.zon.temp", ZON_PREFIX, zone);
new_fname = buf2;
if(!(old_file = fopen(old_fname, "r"))) {
sprintf(buf, "Error: Could not open %s for read.\r\n", old_fname);
send_to_char(buf, ch);
return;
}
if(!(new_file = fopen(new_fname, "w"))) {
sprintf(buf, "Error: Could not open %s for write.\r\n", new_fname);
send_to_char(buf, ch);
fclose(old_file);
return;
}
get_line2(old_file, line);
fprintf(new_file, "%s\n", line);
get_line2(old_file, line);
fprintf(new_file, "%s\n", line);
get_line2(old_file, line);
fprintf(new_file, "* Builder %s\n", arg1);
fprintf(new_file, "%s\n", line);
do {
get_line2(old_file, line);
fprintf(new_file, "%s\n", line);
} while(*line != '$');
fclose(old_file);
fclose(new_file);
remove(old_fname);
rename(new_fname, old_fname);
send_to_char("Zone file edited.\r\n", ch);
sprintf(buf, "olc: %s gives %s zone #%i builder access.", GET_NAME(ch),
arg1, zone);
mudlog(buf, BRF, LVL_IMPL, TRUE);
}
/*oeditmod*/
ACMD(do_zdeny)
{
int zone, rnum, found = FALSE;
FILE *old_file, *new_file;
char *old_fname, *new_fname, line[256];
char arg1[40], arg2[40], arg3[40], arg4[40], arg5[40], arg6[40];
struct builder_list *bldr, *lbldr;
half_chop(argument, arg1, arg2);
if(!*arg1 || !*arg2 || !isdigit(*arg2)) {
send_to_char("Usage : zdeny <player> <zone>\r\n", ch);
return;
}
*arg1 = UPPER(*arg1);
zone = atoi(arg2);
if((rnum = get_zone_rnum(zone)) == -1) {
send_to_char("That zone doesn't seem to exist.\r\n", ch);
return;
}
if(zone_table[rnum].builders == NULL)
read_zone_perms(rnum);
lbldr = NULL;
for(bldr = zone_table[rnum].builders; bldr; lbldr = bldr, bldr =
bldr->next) {
if(!strcmp(bldr->name, arg1)) {
if(!lbldr)
zone_table[rnum].builders = bldr->next;
else
lbldr->next = bldr->next;
free(bldr);
found = TRUE;
}
}
if(!found) {
send_to_char("That person doesn't have access to that zone.\r\n", ch);
return;
}
if(zone_table[rnum].builders == NULL) {
CREATE(zone_table[rnum].builders, struct builder_list, 1);
zone_table[rnum].builders->name = strdup("*");
zone_table[rnum].builders->next = NULL;
}
sprintf(buf1, "%s/%i.zon", ZON_PREFIX, zone);
old_fname = buf1;
sprintf(buf2, "%s/%i.zon.temp", ZON_PREFIX, zone);
new_fname = buf2;
if(!(old_file = fopen(old_fname, "r"))) {
sprintf(buf, "Error: Could not open %s for read.\r\n", old_fname);
send_to_char(buf, ch);
return;
}
if(!(new_file = fopen(new_fname, "w"))) {
sprintf(buf, "Error: Could not open %s for write.\r\n", new_fname);
send_to_char(buf, ch);
fclose(old_file);
return;
}
do {
get_line2(old_file, line);
if(*line == '*') {
half_chop(line, arg3, arg4);
half_chop(arg4, arg5, arg6);
if(!*arg5 || !strcmp(arg5, "Builder")) {
fprintf(new_file, "%s\n", line);
} else if(strcmp(arg1, arg6))
fprintf(new_file, "%s\n", line);
} else {
fprintf(new_file, "%s\n", line);
}
} while(*line != '$');
fclose(old_file);
fclose(new_file);
remove(old_fname);
rename(new_fname, old_fname);
send_to_char("Zone file edited.\r\n", ch);
sprintf(buf, "olc: %s removes %s's zone #%i builder access.", GET_NAME(ch),
arg1, zone);
mudlog(buf, BRF, LVL_IMPL, TRUE);
}
/*reditmod*/
ACMD(do_zedit)
{
int zone, i, zn;
char field[MAX_INPUT_LENGTH], val_arg[MAX_INPUT_LENGTH];
char *fname;
FILE *tempfile;
half_chop(argument, field, val_arg);
if(is_abbrev(field, "allow")) {
if(GET_LEVEL(ch) < LVL_IMPL)
return;
room_allow = TRUE;
sprintf(buf, "olc: %s turns room editor access ON", GET_NAME(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
if(is_abbrev(field, "deny")) {
if(GET_LEVEL(ch) < LVL_IMPL)
return;
room_allow = FALSE;
sprintf(buf, "olc: %s turns room editor access OFF", GET_NAME(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
if(!room_allow) {
send_to_char("The room editor is currently disabled.\r\n", ch);
return;
}
if(is_abbrev(field, "save")) {
if(ZONE_BUF(ch) == NOWHERE) {
send_to_char("No zone is being edited.\r\n", ch);
return;
} else if((ZONE_BUF(ch) == 0) && (GET_LEVEL(ch) == LVL_IMPL)) {
save_rooms(ZONE_BUF(ch));
send_to_char("Rooms saved.\r\n", ch);
save_zone(ch, ZONE_BUF(ch));
sprintf(buf, "olc: %s saves zone #%i", GET_NAME(ch), ZONE_BUF(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
} else if(ZONE_BUF(ch) > 0) {
save_rooms(ZONE_BUF(ch));
send_to_char("Rooms saved.\r\n", ch);
save_zone(ch, ZONE_BUF(ch));
sprintf(buf, "olc: %s saves zone #%i", GET_NAME(ch), ZONE_BUF(ch));
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
} else {
send_to_char("Zone not saved.\r\n", ch);
return;
}
}
if(is_abbrev(field, "done")) {
ZONE_BUF(ch) = NOWHERE;
return;
}
if(is_abbrev(field, "create")) {
if(GET_LEVEL(ch) < LVL_IMPL) {
send_to_char("You're not holy enough to conjure a zone.\r\n", ch);
return;
}
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Please specify a zone number to create.\r\n", ch);
return;
}
zone = atoi(val_arg);
if(zone > 326) {
send_to_char("326 is the highest zone you can conjure.\r\n", ch);
return;
}
sprintf(buf1, "%s/%i.zon", ZON_PREFIX, zone);
fname = buf1;
if((tempfile = fopen(fname, "r"))) {
fclose(tempfile);
send_to_char("That zone already exists.\r\n", ch);
return;
}
if(!(tempfile = fopen(fname, "w"))) {
send_to_char("Error: can't write new zone file\r\n", ch);
return;
}
fprintf(tempfile, "#%i\n", zone);
fprintf(tempfile, "Zone %i~\n", zone);
fprintf(tempfile, "%i 25 2\n", (zone * 100) + 99);
fprintf(tempfile, "S\n");
fprintf(tempfile, "$\n");
fclose(tempfile);
send_to_char("Wrote new zone file\r\n", ch);
if(!add_to_index(zone, "zon")) {
send_to_char("Error editing zone index\r\n", ch);
return;
}
send_to_char("Added zone to zone index\r\n", ch);
zone_table = add_zone(zone_table, zone);
send_to_char("Added zone to memory\r\n", ch);
sprintf(buf1, "%s/%i.wld", WLD_PREFIX, zone);
fname = buf1;
if(!(tempfile = fopen(fname, "w"))) {
send_to_char("Error: can't write new world file\r\n", ch);
return;
}
fprintf(tempfile, "#%i\n",zone * 100);
fprintf(tempfile, "the start of zone %i~\n",zone);
fprintf(tempfile, "You are in a room.\n~\n");
fprintf(tempfile, "%i 0 0\n", zone);
fprintf(tempfile, "S\n");
fprintf(tempfile, "$\n");
fclose(tempfile);
send_to_char("Wrote new world file\r\n", ch);
new_rooms++;
if(new_rooms > max_new_rooms)
send_to_char("Reached maximum number of rooms. Reboot for more.\r\n", ch);
else {
top_of_world++;
world[top_of_world].zone = zone;
world[top_of_world].number = zone * 100;
world[top_of_world].name = str_dup("The start of the zone");
world[top_of_world].description = str_dup("You are in a room.\r\n");
world[top_of_world].room_flags = 0;
world[top_of_world].sector_type = 0;
world[top_of_world].func = NULL;
world[top_of_world].contents = NULL;
world[top_of_world].people = NULL;
world[top_of_world].light = 0;
world[top_of_world].ex_description = NULL;
for(i = 0; i < NUM_OF_DIRS; i++)
world[top_of_world].dir_option[i] = NULL;
sprintf(buf, "Created new room #%i\r\n", zone * 100);
send_to_char(buf, ch);
}
if(!add_to_index(zone, "wld")) {
send_to_char("Error editing world index\r\n", ch);
return;
}
send_to_char("Added zone to world index\r\n", ch);
sprintf(buf1, "%s/%i.mob", MOB_PREFIX, zone);
fname = buf1;
if(!(tempfile = fopen(fname, "w"))) {
send_to_char("Error: can't write new mob file\r\n", ch);
return;
}
fprintf(tempfile, "$\n");
fclose(tempfile);
send_to_char("Wrote new mob file\r\n", ch);
if(!add_to_index(zone, "mob")) {
send_to_char("Error editing mob index\r\n", ch);
return;
}
send_to_char("Added zone to mob index\r\n", ch);
sprintf(buf1, "%s/%i.obj", OBJ_PREFIX, zone);
fname = buf1;
if(!(tempfile = fopen(fname, "w"))) {
send_to_char("Error: can't write new object file\r\n", ch);
return;
}
fprintf(tempfile, "$\n");
fclose(tempfile);
send_to_char("Wrote new object file\r\n", ch);
if(!add_to_index(zone, "obj")) {
send_to_char("Error editing object index\r\n", ch);
return;
}
send_to_char("Added zone to object index\r\n", ch);
/* sprintf(buf1, "%s/%i.shp", SHP_PREFIX, zone);
fname = buf1;
if(!(tempfile = fopen(fname, "w"))) {
send_to_char("Error: can't write new shop file\r\n", ch);
return;
}
fprintf(tempfile, "$\n");
fclose(tempfile);
send_to_char("Wrote new shop file\r\n", ch);
if(!add_to_index(zone, "shp")) {
send_to_char("Error editing shop index\r\n", ch);
return;
}
send_to_char("Added zone to shop index\r\n", ch);
*/
save_rooms(zone);
send_to_char("Zone created\r\n", ch);
sprintf(buf, "olc: %s creates new zone #%i", GET_NAME(ch), zone);
mudlog(buf, BRF, LVL_GOD, TRUE);
return;
}
zn = get_zon_num(world[ch->in_room].number);
zone = get_zone_perms(ch, zn);
if(zone == -1)
return;
if(!check_edit_zone(ch, zone)) {
ZONE_BUF(ch) = NOWHERE;
return;
}
ZONE_BUF(ch) = zone;
sprintf(buf, "olc: %s begins editing zone #%i.", GET_NAME(ch), zone);
mudlog(buf, CMP, LVL_GOD, TRUE);
sprintf(buf, "You begin editing zone #%i.\r\n", zone);
send_to_char(buf, ch);
}
/* oeditmod */
ACMD(do_oset)
{
int i, afftype, affmod, cmmd = 0, length = 0, help = FALSE;
char field[MAX_INPUT_LENGTH], val_arg[MAX_INPUT_LENGTH];
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
struct extra_descr_data *desc = NULL, *last = NULL;
int neg_affect = FALSE;
char *fields[] =
{ "name" ,"short" ,"long" ,"type" ,/*0-3*/
"extra" ,"wear" ,"v0" ,"v1" ,
"v2" ,"v3" ,"weight" ,"cost" ,
"rent" ,"light" ,"scroll" ,"wand" ,/*12-15*/
"staff" ,"weapon" ,"treasure" ,"armor" ,
"potion" ,"worn" ,"other" ,"trash" ,
"container" ,"note" ,"drinkcon" ,"key" ,/*24-27*/
"food" ,"money" ,"pen" ,"boat" ,
"fountain" ,"glow" ,"hum" ,"norent" ,
"nodonate" ,"noinvis" ,"invisible" ,"magic" ,/*36-39*/
"nodrop" ,"bless" ,"nogood" ,"noevil" ,
"noneutral" ,"nomage" ,"nocleric" ,"nothief" ,
"nowarrior" ,"nosell" ,"take" ,"finger" ,/*48-51*/
"neck" ,"body" ,"head" ,"legs" ,
"feet" ,"hands" ,"arms" ,"shield" ,
"about" ,"waist" ,"wrist" ,"wield" ,/*60-63*/
"hold" ,"action" ,"reserved" ,"reserved" ,
"reserved" ,"reserved" ,"reserved" ,"reserved" ,
"reserved" ,"reserved" ,"reserved" ,"affect" ,
"edesc" ,"reserved" ,"\n" };
char *affs[] =
{ "none" ,"str" ,"dex" ,"int" ,
"wis" ,"con" ,"cha" ,"age" ,
"weight" ,"height" ,"mana" ,"hit" ,
"move" ,"ac" ,"hitroll" ,"damroll" ,
"paralysis" ,"rod" ,"petrify" ,"breath" ,
"spell" ,"\n" };
half_chop(argument, field, val_arg);
if(!OBJ_NEW(ch)) {
send_to_char("There is no object in the edit buffer. Use oedit to set one.\r\n\r\n", ch);
*val_arg = '*';
return;
}
if (!*field) *field = '*';
do {
for (length = strlen(field), cmmd = 0; *fields[cmmd] != '\n'; cmmd++)
if (!strn_cmp(fields[cmmd], field, length))
break;
switch (cmmd) {
case 0:
if(!*val_arg) {
send_to_char("Usage : oset name <alias list>\r\n\r\n", ch);
send_to_char("<alias list> should be a list of names players can use to act on the\r\n", ch);
send_to_char("object.\r\n\r\n", ch);
send_to_char("Example : oset name sword short\r\n", ch);
break;
}
OBJ_NEW(ch)->name = str_dup(val_arg);
*val_arg = '\0';
break;
case 1:
if(!*val_arg) {
send_to_char("Usage : oset short <object short description>\r\n", ch);
send_to_char("Example : oset short a short sword\r\n", ch);
break;
}
OBJ_NEW(ch)->short_description = str_dup(val_arg);
*val_arg = '\0';
break;
case 2:
if(!*val_arg) {
send_to_char("Usage : oset long <object long description>\r\n", ch);
send_to_char("An object's long description is the text you see when it is lying on\r\n", ch);
send_to_char("the ground. The first word should be capitalized, and it should end\r\n", ch);
send_to_char("with a period.\r\n\r\n", ch);
send_to_char("Example : oset long A short sword is lying here.\r\n", ch);
break;
}
OBJ_NEW(ch)->description = str_dup(val_arg);
*val_arg = '\0';
break;
case 3:
send_to_char("Usage : oset <object type>\r\n\r\n", ch);
send_to_char("Valid object types are:\r\n", ch);
send_to_char(" light note\r\n", ch);
send_to_char(" scroll drinkcon\r\n", ch);
send_to_char(" wand key\r\n", ch);
send_to_char(" staff food\r\n", ch);
send_to_char(" weapon money\r\n", ch);
send_to_char(" treasure pen\r\n", ch);
send_to_char(" armor boat\r\n", ch);
send_to_char(" potion fountain\r\n", ch);
send_to_char(" worn \r\n", ch);
send_to_char(" other \r\n", ch);
send_to_char(" trash \r\n", ch);
send_to_char(" container\r\n\r\n", ch);
send_to_char("Example : oset weapon\r\n", ch);
send_to_char(" oset potion\r\n", ch);
break;
case 4:
send_to_char("Usage : oset <extra flag>\r\n\r\n", ch);
send_to_char("This will toggle the flag you specify.\r\n", ch);
send_to_char("Valid extra flags are:\r\n", ch);
send_to_char(" glow nogood\r\n", ch);
send_to_char(" hum noevil\r\n", ch);
send_to_char(" norent noneutral\r\n", ch);
send_to_char(" nodonate nomage\r\n", ch);
send_to_char(" noinvis nocleric\r\n", ch);
send_to_char(" invisible nothief\r\n", ch);
send_to_char(" magic nowarrior\r\n", ch);
send_to_char(" nodrop nosell\r\n", ch);
send_to_char(" nopaladin noapaladin\r\n", ch);
send_to_char(" nomort nosmort\r\n", ch);
send_to_char(" nobard noranger\r\n", ch);
send_to_char(" bless\r\n\r\n", ch);
send_to_char("Example : oset glow\r\n", ch);
send_to_char(" oset magic\r\n", ch);
break;
case 5:
send_to_char("Usage : oset <wear flag>\r\n\r\n", ch);
send_to_char("This will toggle the flag you specify.\r\n", ch);
send_to_char("Valid wear flags are:\r\n", ch);
send_to_char(" take arms\r\n", ch);
send_to_char(" finger shield\r\n", ch);
send_to_char(" neck about\r\n", ch);
send_to_char(" body waist\r\n", ch);
send_to_char(" head wrist\r\n", ch);
send_to_char(" legs wield\r\n", ch);
send_to_char(" feet hold\r\n", ch);
send_to_char(" hands\r\n\r\n", ch);
send_to_char("Example : oset take\r\n", ch);
send_to_char(" oset wield\r\n", ch);
break;
case 6:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset v0 <value>\r\n", ch);
send_to_char("v0-v3 are based on object type.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.value[0] = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 7:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset v1 <value>\r\n", ch);
send_to_char("v0-v3 are based on object type.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.value[1] = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 8:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset v2 <value>\r\n", ch);
send_to_char("v0-v3 are based on object type.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.value[2] = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 9:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset v3 <value>\r\n", ch);
send_to_char("v0-v3 are based on object type.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.value[3] = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 10:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset weight <value>\r\n", ch);
send_to_char("Use this to set an object's weight in pounds.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.weight = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 11:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset cost <value>\r\n", ch);
send_to_char("This sets an object's monetary value in gold coins.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.cost = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 12:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset rent <value>\r\n", ch);
send_to_char("This sets an objects cost per day when rented.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.cost_per_day = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 13:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_LIGHT;
break;
case 14:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_SCROLL;
break;
case 15:
GET_OBJ_TYPE(OBJ_NEW(ch))= ITEM_WAND;
break;
case 16:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_STAFF;
break;
case 17:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_WEAPON;
break;
case 18:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_TREASURE;
break;
case 19:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_ARMOR;
break;
case 20:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_POTION;
break;
case 21:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_WORN;
break;
case 22:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_OTHER;
break;
case 23:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_TRASH;
break;
case 24:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_CONTAINER;
break;
case 25:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_NOTE;
break;
case 26:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_DRINKCON;
break;
case 27:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_KEY;
break;
case 28:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_FOOD;
break;
case 29:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_MONEY;
break;
case 30:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_PEN;
break;
case 31:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_BOAT;
break;
case 32:
GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_FOUNTAIN;
break;
case 33:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_GLOW);
break;
case 34:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_HUM);
break;
case 35:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_NORENT);
break;
case 36:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_NODONATE);
break;
case 37:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_NOINVIS);
break;
case 38:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_INVISIBLE);
break;
case 39:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_MAGIC);
break;
case 40:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_NODROP);
break;
case 41:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_BLESS);
break;
case 42:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_GOOD);
break;
case 43:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_EVIL);
break;
case 44:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_NEUTRAL);
break;
case 45:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_MAGIC_USER);
break;
case 46:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_CLERIC);
break;
case 47:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_THIEF);
break;
case 48:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_ANTI_WARRIOR);
break;
case 49:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_NOSELL);
break;
case 50:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_TAKE);
break;
case 51:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_FINGER);
break;
case 52:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_NECK);
break;
case 53:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_BODY);
break;
case 54:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_HEAD);
break;
case 55:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_LEGS);
break;
case 56:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_FEET);
break;
case 57:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_HANDS);
break;
case 58:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_ARMS);
break;
case 59:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_SHIELD);
break;
case 60:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_ABOUT);
break;
case 61:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_WAIST);
break;
case 62:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_WRIST);
break;
case 63:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_WIELD);
break;
case 64:
TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.wear_flags, ITEM_WEAR_HOLD);
break;
case 65:
if(!*val_arg) {
send_to_char("Usage : oset action <object action description>\r\n", ch);
send_to_char("An object's action description is the text you see when it is used.\r\n", ch);
send_to_char("The circle documention on this is incomplete so no info on syntax\r\n", ch);
send_to_char("is available. If the object is a note, the action description\r\n", ch);
send_to_char("is the text on the note.\r\n\r\n", ch);
break;
}
OBJ_NEW(ch)->action_description = str_dup(val_arg);
*val_arg = '\0';
break;
case 66:
/*
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : oset level <value>\r\n", ch);
send_to_char("Use this to set an object's minimum level.\r\n", ch);
return;
}
OBJ_NEW(ch)->obj_flags.min_level = atoi(val_arg);
half_chop(val_arg, field, val_arg);
*/
break;
case 67:
/*GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM;*/
break;
case 68:
/*GET_OBJ_TYPE(OBJ_NEW(ch))= ITEM_;*/
break;
case 69:
/*TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_);*/
break;
case 70:
/*TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_);*/
break;
case 71:
/*TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_);*/
break;
case 72:
/*TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_);*/
break;
case 73:
/*TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_);*/
break;
case 74:
/*TOGGLE_BIT(OBJ_NEW(ch)->obj_flags.extra_flags, ITEM_);*/
break;
case 75:
half_chop(val_arg, arg1, arg2);
for (length = strlen(arg1), cmmd = 0; *affs[cmmd] != '\n'; cmmd++)
if (!strn_cmp(affs[cmmd], arg1, length))
break;
if(*arg2 == '+') {
neg_affect = FALSE;
*arg2 = '0';
} else if(*arg2 == '-') {
neg_affect = TRUE;
*arg2 = '0';
} else neg_affect = FALSE;
if(!*arg1 || (!*arg2 && (cmmd != 0)) ||((cmmd != 0)&&!isdigit(*arg2))) {
send_to_char("Usage : oset affect <affect> <value>\r\n", ch);
send_to_char("Valid affect fields are:\r\n", ch);
send_to_char("str ac\r\n", ch);
send_to_char("dex hitroll\r\n", ch);
send_to_char("int damroll\r\n", ch);
send_to_char("wis paralysis (save throw)\r\n", ch);
send_to_char("con rod (save throw)\r\n", ch);
send_to_char("cha petrify (save throw)\r\n", ch);
send_to_char("age breath (save throw)\r\n", ch);
send_to_char("weight spell (save throw)\r\n", ch);
send_to_char("height none\r\n", ch);
send_to_char("mana \r\n", ch);
send_to_char("hit \r\n", ch);
send_to_char("move \r\n\r\n", ch);
send_to_char("The field 'none' will remove all affects. Any other affect with a\r\n", ch);
send_to_char("value of 0 will rmove that affect. The maximum number of affects\r\n", ch);
send_to_char("for any object is 6.\r\n\r\n", ch);
send_to_char("Example : oset affect str 2\r\n", ch);
return;
}
affmod = atoi(arg2);
switch(cmmd) {
case 0:
for(i = 0; i < MAX_OBJ_AFFECT; i++) {
OBJ_NEW(ch)->affected[i].location = 0;
OBJ_NEW(ch)->affected[i].modifier = 0;
}
afftype = 0;
affmod = 0;
half_chop(val_arg, arg1, val_arg);
break;
case 1:
afftype = 1;
break;
case 2:
afftype = 2;
break;
case 3:
afftype = 3;
break;
case 4:
afftype = 4;
break;
case 5:
afftype = 5;
break;
case 6:
afftype = 6;
break;
case 7:
afftype = 9;
break;
case 8:
afftype = 10;
break;
case 9:
afftype = 11;
break;
case 10:
afftype = 12;
break;
case 11:
afftype = 13;
break;
case 12:
afftype = 14;
break;
case 13:
afftype = 17;
break;
case 14:
afftype = 18;
break;
case 15:
afftype = 19;
break;
case 16:
afftype = 20;
break;
case 17:
afftype = 21;
break;
case 18:
afftype = 22;
break;
case 19:
afftype = 23;
break;
case 20:
afftype = 24;
break;
default:
send_to_char("Invalid affect field. type 'oset affect' for help\r\n", ch);
afftype = 0;
affmod = 0;
help = TRUE;
half_chop(arg2, arg1, val_arg);
}
if(afftype !=0) {
if(affmod == 0) {
for(i = 0; i < MAX_OBJ_AFFECT; i++) {
if(OBJ_NEW(ch)->affected[i].location == afftype) {
OBJ_NEW(ch)->affected[i].location = 0;
OBJ_NEW(ch)->affected[i].modifier = 0;
}
}
} else {
for(i = 0; i < MAX_OBJ_AFFECT; i++) {
if((OBJ_NEW(ch)->affected[i].location == 0) ||
(OBJ_NEW(ch)->affected[i].location == afftype)) {
OBJ_NEW(ch)->affected[i].location = afftype;
if(neg_affect) affmod = 0 - affmod;
OBJ_NEW(ch)->affected[i].modifier = affmod;
break;
}
}
if(i == MAX_OBJ_AFFECT)
send_to_char("Affect not added. All affect slots full.\r\n", ch);
}
half_chop(arg2, arg1, val_arg);
}
break;
case 76:
if(!*val_arg) {
send_to_char("Usage : oset edesc <command> <keyword list>\r\n\r\n", ch);
send_to_char("To add an extra description, use oset edesc add <keyword list>, as in:\r\n", ch);
send_to_char("oset edesc add inscription hilt\r\n\r\n", ch);
send_to_char("To set the description text, use oset edesc set <keyword>, as in:\r\n", ch);
send_to_char("oset edesc set hilt\r\n\r\n", ch);
send_to_char("Use no doublequotes, and use only one keyword.\r\n\r\n", ch);
send_to_char("To delete an extra description, use oset edesc del <keyword>, as in:\r\n", ch);
send_to_char("oset del hilt\r\n\r\n", ch);
send_to_char("To show the description text, use oset edesc show <keyword>, as in:\r\n", ch);
send_to_char("oset edesc show hilt\r\n\r\n", ch);
break;
}
half_chop(val_arg, arg1, arg2);
if(is_abbrev(arg1, "add")) {
if(!*arg2) {
send_to_char("Keyword list missing. Type oset edesc for help.\r\n", ch);
return;
}
CREATE(desc, struct extra_descr_data, 1);
desc->keyword = str_dup(arg2);
desc->description = str_dup("You see nothing special.\r\n");
desc->next = OBJ_NEW(ch)->ex_description;
OBJ_NEW(ch)->ex_description = desc;
*val_arg = '\0';
break;
}
if(is_abbrev(arg1, "del")) {
if(!*arg2) {
send_to_char("Keyword missing. Type oset edesc for help.\r\n", ch);
return;
}
for(desc = OBJ_NEW(ch)->ex_description; desc; desc=desc->next) {
if(isname(arg2, desc->keyword)) {
if(!last) {
if(OBJ_NEW(ch)->ex_description->next)
OBJ_NEW(ch)->ex_description = OBJ_NEW(ch)->ex_description->next;
else OBJ_NEW(ch)->ex_description = NULL;
free(desc);
} else {
if(desc->next) last->next = desc->next;
else last->next = NULL;
free(desc);
}
return;
}
last = desc;
}
send_to_char("No keyword match found.\r\n", ch);
return;
}
if(is_abbrev(arg1, "set")) {
if(!*arg2) {
send_to_char("Keyword missing. Type oset edesc for help.\r\n", ch);
return;
}
for(desc = OBJ_NEW(ch)->ex_description; desc; desc=desc->next) {
if(isname(arg2, desc->keyword)) {
if(desc->description) free(desc->description);
CREATE(desc->description, char, 2048);
ch->desc->str = &(desc->description);
ch->desc->max_str = 2048;
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); /*rev.01*/
send_to_char("Enter the extra description. '@' at the beginning of a line\r\n", ch);
send_to_char("ends the description text.\r\n", ch);
return;
}
}
send_to_char("No keyword match found.\r\n", ch);
return;
}
if(is_abbrev(arg1, "show")) {
if(!*arg2) {
send_to_char("Keyword missing. Type oset edesc for help.\r\n", ch);
return;
}
for(desc = OBJ_NEW(ch)->ex_description; desc; desc=desc->next) {
if(isname(arg2, desc->keyword)) {
if(!desc->description) {
send_to_char("No extra desc set for that keyword.\r\n", ch);
return;
}
send_to_char(desc->description, ch);
return;
}
}
send_to_char("No keyword match found.\r\n", ch);
return;
}
send_to_char("Invalid edesc argument. Type oset edesc for help.\r\n", ch);
return;
case 77:
/*GET_OBJ_TYPE(OBJ_NEW(ch)) = ITEM_;*/
break;
default:
if(!help) {
send_to_char("Usage : oset <field> <value> [field2...]\r\n", ch);
send_to_char("Valid fields are:\r\n", ch);
send_to_char("name object alias list (ex: oset name short sword)\r\n", ch);
send_to_char("short short description (ex: oset short a short sword)\r\n", ch);
send_to_char("long long description \r\n", ch);
send_to_char("action action description\r\n", ch);
send_to_char("edesc extra descriptions\r\n", ch);
send_to_char("type object type\r\n", ch);
send_to_char("extra extra effects bitvector\r\n", ch);
send_to_char("wear wear bitvector\r\n", ch);
/*send_to_char("level minimmum level\r\n", ch);*/
send_to_char("v0 value0 }\r\n", ch);
send_to_char("v1 value1 }\r\n", ch);
send_to_char("v2 value2 }-- object type dependent\r\n", ch);
send_to_char("v3 value3 }\r\n", ch);
send_to_char("weight object weight\r\n", ch);
send_to_char("cost value of object in gold coins\r\n", ch);
send_to_char("rent rent per day in gold\r\n", ch);
send_to_char("affect affections\r\n", ch);
send_to_char("oset will accept multiple fields, up to MAX_INPUT_LENGTH.\r\n", ch);
send_to_char("The fields name, short, long, action, and edesc can't be followed by\r\n", ch);
send_to_char("additional fields.\r\n", ch);
send_to_char("For detailed field help, use: oset <field>\r\n", ch);
send_to_char("Example : oset weapon glow magic weight 5 v0 2", ch);
}
help = TRUE;
}
half_chop(val_arg, field, val_arg);
} while(*field);
}
/* meditmod */
ACMD(do_mset)
{
int cmmd = 0, length = 0, help = FALSE;
char field[MAX_INPUT_LENGTH], val_arg[MAX_INPUT_LENGTH];
int neg_affect = FALSE;
struct char_data *mob;
int t[3];
char *fields[] =
{ "alias" ,"short" ,"long" ,"detail" ,/*0-3*/
"flags" ,"affects" ,"align" ,"level" ,
"hitroll" ,"damroll" ,"ac" ,"damage" ,
"hitpoints" ,"reserved" ,"sentinel" ,"scavenger" ,/*12-15*/
"aware" ,"aggressive" ,"stayzone" ,"wimpy" ,
"aggevil" ,"agggood" ,"aggneutral" ,"memory" ,
"helper" ,"nocharm" ,"nosummon" ,"nosleep" ,/*24-27*/
"nobash" ,"noblind" ,"reserved" ,"reserved" ,
"reserved" ,"blind" ,"invisible" ,"detalign" ,
"detinvis" ,"detmagic" ,"senselife" ,"waterwalk" ,/*36-39*/
"sanctuary" ,"curse" ,"infravis" ,"poison" ,
"protfrevil","protfrgood" ,"sleep" ,"notrack" ,
"reserved" ,"reserved" ,"sneak" ,"hide" ,/*48-51*/
"reserved" ,"reserved" ,"reserved" ,"reserved" ,
"gold" ,"experience" ,"loadpos" ,"defaultpos" ,
"attacktype","sex" ,"strength" ,"stradd" ,
"intel" ,"wisdom" ,"dexterity" ,"con" ,
"charisma" ,
"\n" };
half_chop(argument, field, val_arg);
if(!MOB_NEW(ch)) {
send_to_char("There is no mob in the edit buffer. Use medit to set one.\r\n\r\n", ch);
*val_arg = '*';
return;
}
mob = MOB_NEW(ch);
if (!*field) *field = '*';
do {
for (length = strlen(field), cmmd = 0; *fields[cmmd] != '\n'; cmmd++)
if (!strn_cmp(fields[cmmd], field, length))
break;
switch (cmmd) {
case 0:
if(!*val_arg) {
send_to_char("Usage : mset alias <alias list>\r\n\r\n", ch);
send_to_char("<alias list> should be a list of names players can use to act on the\r\n", ch);
send_to_char("mob.\r\n\r\n", ch);
send_to_char("Example : mset name demon guard\r\n", ch);
break;
}
mob->player.name = str_dup(val_arg);
*val_arg = '\0';
break;
case 1:
if(!*val_arg) {
send_to_char("Usage : mset short <mob name>\r\n", ch);
send_to_char("Example : mset short The demon guard\r\n", ch);
break;
}
mob->player.short_descr = str_dup(val_arg);
*val_arg = '\0';
break;
case 2:
if(!*val_arg) {
send_to_char("Usage : mset long <mob long description>\r\n", ch);
send_to_char("A mob's long description is the text you see when it is in it's default\r\n", ch);
send_to_char("position. The first word should be capitalized, and it should end\r\n", ch);
send_to_char("with a period.\r\n\r\n", ch);
send_to_char("Example : mset long A demon duard stands here guarding the portal.\r\n", ch);
break;
}
mob->player.long_descr = str_dup(val_arg);
strcat(mob->player.long_descr, "\n");
*val_arg = '\0';
break;
case 3:
if(mob->player.description) free(mob->player.description);
CREATE(mob->player.description, char, 2048);
ch->desc->str = &(mob->player.description);
ch->desc->max_str = 2048;
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); /*rev.01*/
send_to_char("Enter the extra description. '@' at the beginning of a line\r\n", ch);
send_to_char("ends the description text.\r\n", ch);
return;
case 4:
send_to_char("Usage : mset <action flag>\r\n\r\n", ch);
send_to_char("This will toggle the flag you specify.\r\n", ch);
send_to_char("Valid action flags are:\r\n\r\n", ch);
send_to_char(" sentinel scavenger\r\n", ch);
send_to_char(" aware aggressive\r\n", ch);
send_to_char(" stayzone wimpy\r\n", ch);
send_to_char(" aggevil agggood\r\n", ch);
send_to_char(" aggneutral memory\r\n", ch);
send_to_char(" helper nocharm\r\n", ch);
send_to_char(" nosummon nosleep\r\n", ch);
send_to_char(" nobash noblind\r\n\r\n", ch);
send_to_char("Example : mset sentinel\r\n", ch);
send_to_char(" mset stayzone nobash\r\n", ch);
break;
case 5:
send_to_char("Usage : mset <affect flag>\r\n\r\n", ch);
send_to_char("This will toggle the flag you specify.\r\n", ch);
send_to_char("Valid affect flags are:\r\n\r\n", ch);
send_to_char(" blind invisible\r\n", ch);
send_to_char(" detalign detinvis\r\n", ch);
send_to_char(" detmagic senselife\r\n", ch);
send_to_char(" waterwalk sanctuary\r\n", ch);
send_to_char(" curse infravision\r\n", ch);
send_to_char(" poison protfrevil\r\n", ch);
send_to_char(" protfrgood sleep\r\n", ch);
send_to_char(" notrack \r\n", ch);
send_to_char(" sneak hide\r\n", ch);
send_to_char(" \r\n\r\n", ch);
send_to_char("Example : mset invisible\r\n", ch);
send_to_char(" mset senselife infravision\r\n", ch);
break;
case 6:
if(!*val_arg || (!isdigit(*val_arg) && *val_arg != '-' &&
*val_arg != '+')) {
send_to_char("Usage : mset align <value>\r\n", ch);
return;
}
if(*val_arg == '+') {
neg_affect = FALSE;
*val_arg = '0';
} else if(*val_arg == '-') {
neg_affect = TRUE;
*val_arg = '0';
} else neg_affect = FALSE;
if(neg_affect)
GET_ALIGNMENT(MOB_NEW(ch)) = 0 - atoi(val_arg);
else
GET_ALIGNMENT(MOB_NEW(ch)) = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 7:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset level <mob level>\r\n", ch);
return;
}
GET_LEVEL(MOB_NEW(ch)) = atoi(val_arg);
if(GET_LEVEL(MOB_NEW(ch)) < 1)
GET_LEVEL(MOB_NEW(ch)) = 1;
if(GET_LEVEL(MOB_NEW(ch)) > 101)
GET_LEVEL(MOB_NEW(ch)) = 101;
half_chop(val_arg, field, val_arg);
break;
case 8:
if(!*val_arg || (!isdigit(*val_arg) && *val_arg != '-' &&
*val_arg != '+')) {
send_to_char("Usage : mset hitroll <value>\r\n", ch);
return;
}
if(*val_arg == '+') {
neg_affect = FALSE;
*val_arg = '0';
} else if(*val_arg == '-') {
neg_affect = TRUE;
*val_arg = '0';
} else neg_affect = FALSE;
if(neg_affect)
MOB_NEW(ch)->points.hitroll = 0 - atoi(val_arg);
else
MOB_NEW(ch)->points.hitroll = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 9:
if(!*val_arg || (!isdigit(*val_arg) && *val_arg != '-' &&
*val_arg != '+')) {
send_to_char("Usage : mset damroll <value>\r\n", ch);
return;
}
if(*val_arg == '+') {
neg_affect = FALSE;
*val_arg = '0';
} else if(*val_arg == '-') {
neg_affect = TRUE;
*val_arg = '0';
} else neg_affect = FALSE;
if(neg_affect)
MOB_NEW(ch)->points.damroll = 0 - atoi(val_arg);
else
MOB_NEW(ch)->points.damroll = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 10:
if(!*val_arg || (!isdigit(*val_arg) && *val_arg != '-' &&
*val_arg != '+')) {
send_to_char("Usage : mset ac <value>\r\n", ch);
return;
}
if(*val_arg == '+') {
neg_affect = FALSE;
*val_arg = '0';
} else if(*val_arg == '-') {
neg_affect = TRUE;
*val_arg = '0';
} else neg_affect = FALSE;
if(neg_affect)
MOB_NEW(ch)->points.armor = 0 - atoi(val_arg);
else
MOB_NEW(ch)->points.armor = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 11:
if(!*val_arg || sscanf(val_arg, " %dd%d ", t, t + 1) !=2) {
send_to_char("Usage : mset damage XdY\r\n\r\n", ch);
send_to_char("Example : mset damage 2d5\r\n", ch);
return;
}
MOB_NEW(ch)->mob_specials.damnodice = t[0];
MOB_NEW(ch)->mob_specials.damsizedice = t[1];
half_chop(val_arg, field, val_arg);
break;
case 12:
if(!*val_arg || sscanf(val_arg, " %dd%d+%d ", t, t + 1, t + 2) !=3) {
send_to_char("Usage : mset hitpoints XdY+Z\r\n\r\n", ch);
send_to_char("Example : mset hitpoints 2d4+30\r\n", ch);
return;
}
MOB_NEW(ch)->points.hit = t[0];
MOB_NEW(ch)->points.mana = t[1];
MOB_NEW(ch)->points.move = t[2];
half_chop(val_arg, field, val_arg);
break;
case 13:
/*TOGGLE_BIT(MOB_FLAGS(mob), MOB_);*/
break;
case 14:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_SENTINEL);
break;
case 15:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_SCAVENGER);
break;
case 16:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_AWARE);
break;
case 17:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_AGGRESSIVE);
break;
case 18:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_STAY_ZONE);
break;
case 19:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_WIMPY);
break;
case 20:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_AGGR_EVIL);
break;
case 21:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_AGGR_GOOD);
break;
case 22:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_AGGR_NEUTRAL);
break;
case 23:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_MEMORY);
break;
case 24:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_HELPER);
break;
case 25:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_NOCHARM);
break;
case 26:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_NOSUMMON);
break;
case 27:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_NOSLEEP);
break;
case 28:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_NOBASH);
break;
case 29:
TOGGLE_BIT(MOB_FLAGS(mob), MOB_NOBLIND);
break;
case 30:
/*TOGGLE_BIT(MOB_FLAGS(mob), MOB_);*/
break;
case 31:
/*TOGGLE_BIT(MOB_FLAGS(mob), MOB_);*/
break;
case 32:
/*TOGGLE_BIT(MOB_FLAGS(mob), MOB_);*/
break;
case 33:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_BLIND);
break;
case 34:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_INVISIBLE);
break;
case 35:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_DETECT_ALIGN);
break;
case 36:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_DETECT_INVIS);
break;
case 37:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_DETECT_MAGIC);
break;
case 38:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_SENSE_LIFE);
break;
case 39:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_WATERWALK);
break;
case 40:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_SANCTUARY);
break;
case 41:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_CURSE);
break;
case 42:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_INFRAVISION);
break;
case 43:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_POISON);
break;
case 44:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_PROTECT_EVIL);
break;
case 45:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_PROTECT_EVIL);
break;
case 46:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_SLEEP);
break;
case 47:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_NOTRACK);
break;
case 48:
/*TOGGLE_BIT(AFF_FLAGS(mob), AFF_);*/
break;
case 49:
/*TOGGLE_BIT(AFF_FLAGS(mob), AFF_);*/
break;
case 50:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_SNEAK);
break;
case 51:
TOGGLE_BIT(AFF_FLAGS(mob), AFF_HIDE);
break;
case 52:
/*TOGGLE_BIT(AFF_FLAGS(mob), AFF_);*/
break;
case 53:
/*TOGGLE_BIT(AFF_FLAGS(mob), AFF_);*/
break;
case 54:
/*TOGGLE_BIT(AFF_FLAGS(mob), AFF_);*/
break;
case 55:
/*TOGGLE_BIT(AFF_FLAGS(mob), AFF_);*/
break;
case 56:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset gold <number of coins>\r\n", ch);
return;
}
GET_GOLD(MOB_NEW(ch)) = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 57:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset experience <exp value of mob>\r\n", ch);
return;
}
GET_EXP(MOB_NEW(ch)) = atoi(val_arg);
half_chop(val_arg, field, val_arg);
break;
case 58:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset loadpos <starting position od mob>\r\n\r\n", ch);
send_to_char("Valid positions are:\r\n\r\n", ch);
send_to_char("4 sleeping\r\n", ch);
send_to_char("5 resting\r\n", ch);
send_to_char("6 sitting\r\n", ch);
send_to_char("8 standing\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if((t[0] < 4 || t[0] > 6) && t[0] != 8)
MOB_NEW(ch)->char_specials.position = 8;
else
MOB_NEW(ch)->char_specials.position = t[0];
half_chop(val_arg, field, val_arg);
break;
case 59:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset defaultpos <position mob takes after fighting>\r\n\r\n", ch);
send_to_char("Valid positions are:\r\n\r\n", ch);
send_to_char("4 sleeping\r\n", ch);
send_to_char("5 resting\r\n", ch);
send_to_char("6 sitting\r\n", ch);
send_to_char("8 standing\r\n\r\n", ch);
send_to_char("Note that when the mob is in its default position, looking at the room\r\n", ch);
send_to_char("will show the mob's long description.\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if((t[0] < 4 || t[0] > 6) && t[0] != 8)
MOB_NEW(ch)->mob_specials.default_pos = 8;
else
MOB_NEW(ch)->mob_specials.default_pos = t[0];
half_chop(val_arg, field, val_arg);
break;
case 60:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset attacktype <mob's barehand attack type>\r\n\r\n", ch);
send_to_char("Valid attack types are:\r\n\r\n", ch);
send_to_char("0 hits\r\n", ch);
send_to_char("1 stings\r\n", ch);
send_to_char("2 whips\r\n", ch);
send_to_char("3 slashes\r\n", ch);
send_to_char("4 bites\r\n", ch);
send_to_char("5 bludgeons\r\n", ch);
send_to_char("6 crushes\r\n", ch);
send_to_char("7 pounds\r\n", ch);
send_to_char("8 claws\r\n", ch);
send_to_char("9 mauls\r\n", ch);
send_to_char("10 thrashes\r\n", ch);
send_to_char("11 pierces\r\n", ch);
send_to_char("12 blasts\r\n", ch);
send_to_char("13 punches\r\n", ch);
send_to_char("14 stabs\r\n\r\n", ch);
send_to_char("Note that these attack types are used only when the mob is not\r\n", ch);
send_to_char("wielding a weapon.\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 0 || t[0] > 14)
MOB_NEW(ch)->mob_specials.attack_type = 0;
else
MOB_NEW(ch)->mob_specials.attack_type = t[0];
half_chop(val_arg, field, val_arg);
break;
case 61:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset sex <gender>\r\n\r\n", ch);
send_to_char("Valid genders are:\r\n\r\n", ch);
send_to_char("0 neutered (it)\r\n", ch);
send_to_char("1 male\r\n", ch);
send_to_char("2 female\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 0 || t[0] > 2)
MOB_NEW(ch)->player.sex = 0;
else
MOB_NEW(ch)->player.sex = t[0];;
half_chop(val_arg, field, val_arg);
break;
case 62:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset strength <strength>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 3 || t[0] > 25)
MOB_NEW(ch)->real_abils.str = 11;
else
MOB_NEW(ch)->real_abils.str = t[0];
half_chop(val_arg, field, val_arg);
break;
case 63:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset stradd <strength addition>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 0 || t[0] > 100)
MOB_NEW(ch)->real_abils.str_add = 0;
else
MOB_NEW(ch)->real_abils.str_add = t[0];
half_chop(val_arg, field, val_arg);
break;
case 64:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset intel <intelligence>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 3 || t[0] > 25)
MOB_NEW(ch)->real_abils.intel = 11;
else
MOB_NEW(ch)->real_abils.intel = t[0];
half_chop(val_arg, field, val_arg);
break;
case 65:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset wisdom <wisdom>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 3 || t[0] > 25)
MOB_NEW(ch)->real_abils.wis = 11;
else
MOB_NEW(ch)->real_abils.wis = t[0];
half_chop(val_arg, field, val_arg);
break;
case 66:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset dexterity <dexterity>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 3 || t[0] > 25)
MOB_NEW(ch)->real_abils.dex = 11;
else
MOB_NEW(ch)->real_abils.dex = t[0];
half_chop(val_arg, field, val_arg);
break;
case 67:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset con <constitution>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 3 || t[0] > 25)
MOB_NEW(ch)->real_abils.con = 11;
else
MOB_NEW(ch)->real_abils.con = t[0];
half_chop(val_arg, field, val_arg);
break;
case 68:
if(!*val_arg || !isdigit(*val_arg)) {
send_to_char("Usage : mset charisma <charisma>\r\n", ch);
return;
}
t[0] = atoi(val_arg);
if(t[0] < 3 || t[0] > 25)
MOB_NEW(ch)->real_abils.cha = 11;
else
MOB_NEW(ch)->real_abils.cha = t[0];
half_chop(val_arg, field, val_arg);
break;
default:
if(!help) {
send_to_char("Usage : mset <field> <value> [field2...]\r\n", ch);
send_to_char("Valid fields are:\r\n", ch);
send_to_char("alias mob alias list (ex: mset alias guard demon)\r\n", ch);
send_to_char("short short description (ex: mset short The demon guard)\r\n", ch);
send_to_char("long long description (seen when you look room)\r\n", ch);
send_to_char("detail detailed description (seen when you look demon)\r\n", ch);
send_to_char("flags mob flags ac mob armor class\r\n", ch);
send_to_char("affects mob affects hitpoints mob max hp\r\n", ch);
send_to_char("align mob alignment damage mob damage dice\r\n", ch);
send_to_char("level mob level attacktype barehand attack type\r\n", ch);
send_to_char("hitroll mob hitroll gold mob pocket change\r\n", ch);
send_to_char("damroll mob damroll experience mob exp point value\r\n", ch);
send_to_char("loadpos mob load position sex mob sex\r\n", ch);
send_to_char("strength mob strength stradd mob strength addition\r\n", ch);
send_to_char("intel mob intelligence wisdom mob wisdom\r\n", ch);
send_to_char("dexterity mob dexterity con mob constitution\r\n", ch);
send_to_char("charisma mob charisma defaultpos mob default pos\r\n\r\n", ch);
send_to_char("mset will accept multiple fields, up to MAX_INPUT_LENGTH.\r\n\r\n", ch);
send_to_char("The fields alias, short, long, and detail can't be followed by\r\n", ch);
send_to_char("additional fields.\r\n", ch);
send_to_char("For detailed field help, use: mset <field>\r\n", ch);
send_to_char("Example : mset align -500 nocharm invisible\r\n", ch);
}
help = TRUE;
}
half_chop(val_arg, field, val_arg);
} while(*field);
}
/*reditmod*/
ACMD(do_rset)
{
int cmmd = 0, length = 0, help = FALSE, top_room;
char field[MAX_INPUT_LENGTH], val_arg[MAX_INPUT_LENGTH];
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH], arg4[MAX_INPUT_LENGTH];
char arg5[MAX_INPUT_LENGTH];
struct extra_descr_data *desc = NULL, *last = NULL;
int direct, croom = NOWHERE, revdir = 0, i, r_num;
char *fields[] =
{ "name" ,"description" ,"RESERVED" ,
"RESERVED" ,"exit" ,"edesc" ,
"RESERVED" ,"flags" ,"type" ,
"dark" ,"death" ,"nomob" ,
"indoors" ,"peaceful" ,"soundproof" ,
"notrack" ,"nomagic" ,"tunnel" ,
"private" ,"godroom" ,"reserved" ,
"reserved" ,"reserved" ,"reserved" ,
"inside" ,"city" ,"field" ,
"forest" ,"hills" ,"mountain" ,
"swim" ,"noswim" ,"underwater" ,
"flying" ,"desert" ,"coder" ,
"\n" };
char *efields[] =
{ "key" ,"description" ,"nodoor" ,
"normal" ,"pickproof" ,"keyword" ,
"delete" ,"connect" ,"disconnect" ,
"reserved" ,"reserved" ,
"\n" };
if(ZONE_BUF(ch) == -1) {
send_to_char("You must first enter the zone editor with zedit.\r\n", ch);
return;
}
if(get_zon_num(world[ch->in_room].number) != ZONE_BUF(ch)) {
send_to_char("This room is not in the zone you are editing.\r\n", ch);
return;
}
half_chop(argument, field, val_arg);
if(!*field) *field = '*';
do {
for (length = strlen(field), cmmd = 0; *fields[cmmd] != '\n'; cmmd++)
if (!strn_cmp(fields[cmmd], field, length))
break;
switch(cmmd) {
case 0:
if(!*val_arg) {
send_to_char("Usage : rset name <room name>\r\n\r\n", ch);
send_to_char("Example : rset name The Bakery\r\n", ch);
break;
}
world[ch->in_room].name = str_dup(val_arg);
return;
case 1:
if(world[ch->in_room].description)
free(world[ch->in_room].description);
CREATE(world[ch->in_room].description, char, 2048);
ch->desc->str = &(world[ch->in_room].description);
ch->desc->max_str = 2048;
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); /*rev.01*/
send_to_char("Enter the new room description. End with a @.\r\n", ch);
send_to_char(" [----*----*----*----*----*----*----*----*----*----*----*----*----*----*----*----]\r\n", ch);
return;
case 4:
half_chop(val_arg, arg1, arg4);
half_chop(arg4, arg2, arg3);
if(!*arg1 || !*arg2) {
send_to_char("Usage : rset exit <direction> <command> [arguments]\r\n\r\n", ch);
send_to_char("Direction must be n, s, e, w, u, or d. Valid commands are: \r\n\r\n", ch);
send_to_char("keyword valid names to use when opening/closing the door,\r\n", ch);
send_to_char(" if there is a door.\r\n", ch);
send_to_char("description the description seen when you look in that direction\r\n", ch);
send_to_char("nodoor no door here\r\n", ch);
send_to_char("normal a normal door that can be opened/closed/picked\r\n", ch);
send_to_char("pickproof door is pickproof\r\n", ch);
send_to_char("key sets the vnumof the key for this door\r\n", ch);
send_to_char("delete remove this exit\r\n", ch);
send_to_char("connect connect this exit to a room\r\n", ch);
send_to_char("disconnect disconnect this exit from a room\r\n\r\n", ch);
send_to_char("For deatiled help with connect/disconnect, type\r\n", ch);
send_to_char("rset exit <dir> (dis)connect.\r\n\r\n", ch);
send_to_char("Example : rset exit n keyword door\r\n", ch);
send_to_char(" rset exit n normal\r\n", ch);
send_to_char(" rset exit n connect 2 3001\r\n", ch);
return;
}
switch(*arg1) {
case 'n':
direct = 0;
break;
case 'e':
direct = 1;
break;
case 's':
direct = 2;
break;
case 'w':
direct = 3;
break;
case 'u':
direct = 4;
break;
case 'd':
direct = 5;
break;
default:
send_to_char("Invalid direction. Type rset exit for help.\r\n", ch);
return;
}
for (length = strlen(arg2), cmmd = 0; *efields[cmmd] != '\n'; cmmd++)
if (!strn_cmp(efields[cmmd], arg2, length))
break;
switch(cmmd) {
case 0:
if(!*arg3 || !isdigit(*arg3)) {
send_to_char("Usage: rset exit <dir> key <vnum>\r\n", ch);
return;
}
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
world[ch->in_room].dir_option[direct]->key = atoi(arg3);
return;
case 1:
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
if(world[ch->in_room].dir_option[direct]->general_description != NULL)
free(world[ch->in_room].dir_option[direct]->general_description);
CREATE(world[ch->in_room].dir_option[direct]->general_description,
char, 1024);
ch->desc->str = &(world[ch->in_room].dir_option[direct]->general_description);
ch->desc->max_str = 1024;
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); /*rev.01*/
send_to_char("Enter new description. End with a @.\r\n", ch);
return;
case 2:
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
world[ch->in_room].dir_option[direct]->exit_info = 0;
return;
case 3:
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
world[ch->in_room].dir_option[direct]->exit_info = EX_ISDOOR;
return;
case 4:
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
world[ch->in_room].dir_option[direct]->exit_info = EX_ISDOOR
| EX_PICKPROOF;
return;
case 5:
if(!*arg3) {
if(!*world[ch->in_room].dir_option[direct]->keyword)
return;
free(world[ch->in_room].dir_option[direct]->keyword);
return;
}
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
if(world[ch->in_room].dir_option[direct]->keyword != NULL)
free(world[ch->in_room].dir_option[direct]->keyword); /*rev.01*/
world[ch->in_room].dir_option[direct]->keyword = str_dup(arg3);
return;
case 6:
if(world[ch->in_room].dir_option[direct])
free(world[ch->in_room].dir_option[direct]);
world[ch->in_room].dir_option[direct] = NULL;
return;
case 7: /*connect*/
half_chop(arg3, arg4, arg5);
if(((*arg4 != '1') && (*arg4 != '2')) || (!(!*arg5) &&
!isdigit(*arg5))) {
send_to_char("Usage : rset exit <dir> connect <1|2> [room]\r\n\r\n", ch);
send_to_char("The <1|2> argument should be 1 for a one-way connection, or 2 for a\r\n", ch);
send_to_char("two-way connection. Two-way connections can't be made across zone\r\n", ch);
send_to_char("boundaries.\r\n\r\n[room] is the virtual number of the room you want to connect to.\r\n", ch);
send_to_char("If no room is specified, a new room will be created.\r\n\r\n", ch);
send_to_char("Example : rset exit n connect 1 3001\r\n", ch);
return;
}
if(*arg4 == '2') {
switch(direct) {
case 0:
revdir = 2;
break;
case 1:
revdir = 3;
break;
case 2:
revdir = 0;
break;
case 3:
revdir = 1;
break;
case 4:
revdir = 5;
break;
case 5:
revdir = 4;
break;
}
}
if(!*arg5) {
new_rooms++;
if(new_rooms > max_new_rooms) {
send_to_char("No more new rooms allowed. Reboot for more.\r\n", ch);
return;
}
top_room = get_top(ZONE_BUF(ch));
for(i = (ZONE_BUF(ch) * 100); i <= top_room; i++) {
if(i > top_room) {
send_to_char("No free room vnums in this zone.\r\n", ch);
return;
}
if(real_room(i) < 0) {
top_of_world++;
croom = i;
world[top_of_world].zone = ZONE_BUF(ch);
world[top_of_world].number = croom;
world[top_of_world].name = str_dup("A new room");
world[top_of_world].description = str_dup("You are in a room.\r\n");
world[top_of_world].room_flags = 0;
world[top_of_world].sector_type = 0;
world[top_of_world].func = NULL;
world[top_of_world].contents = NULL;
world[top_of_world].people = NULL;
world[top_of_world].light = 0;
world[top_of_world].ex_description = NULL;
for(i = 0; i < NUM_OF_DIRS; i++)
world[top_of_world].dir_option[i] = NULL;
sprintf(buf, "Created new room #%i\r\n", croom);
send_to_char(buf, ch);
break;
}
}
if(!world[ch->in_room].dir_option[direct])
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room =
real_room(croom);
if(*arg4 == '2') {
if(!world[real_room(croom)].dir_option[revdir])
CREATE(world[real_room(croom)].dir_option[revdir],
struct room_direction_data, 1);
world[real_room(croom)].dir_option[revdir]->to_room =
ch->in_room;
world[real_room(croom)].dir_option[revdir]->exit_info =
world[ch->in_room].dir_option[direct]->exit_info;
}
} else {
croom = atoi(arg5);
if(croom < 0) {
send_to_char("A negative number?\r\n", ch);
return;
}
if((r_num = real_room(croom)) < 0) {
send_to_char("There is no room with that number.\r\n", ch);
return;
}
if(!world[ch->in_room].dir_option[direct])
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = r_num;
if(*arg4 == '2') {
if(get_zon_num(croom) != ZONE_BUF(ch)) {
send_to_char("Second room is not in this zone.\r\n", ch);
return;
}
if(!world[r_num].dir_option[revdir])
CREATE(world[r_num].dir_option[revdir],
struct room_direction_data, 1);
world[r_num].dir_option[revdir]->to_room = ch->in_room;
world[r_num].dir_option[revdir]->exit_info =
world[ch->in_room].dir_option[direct]->exit_info;
}
}
return;
case 8: /*disconnect*/
half_chop(arg3, arg4, arg5);
if((*arg4 != '1') && (*arg4 != '2')) {
send_to_char("Usage : rset exit <dir> disconnect <1|2>\r\n\r\n", ch);
send_to_char("The <1|2> should be 1 to disconnect the exit room from this room.\r\n", ch);
send_to_char("Use a 2 to disconnect in both directions.\r\n", ch);
send_to_char("Double disconnects across zone boundaries are not permitted.\r\n\r\n", ch);
send_to_char("Example : rset exit n connect 1 3001\r\n", ch);
return;
}
if(*arg4 == '2') {
switch(direct) {
case 0:
revdir = 2;
break;
case 1:
revdir = 3;
break;
case 2:
revdir = 0;
break;
case 3:
revdir = 1;
break;
case 4:
revdir = 5;
break;
case 5:
revdir = 4;
break;
}
}
if(world[ch->in_room].dir_option[direct] == NULL) {
send_to_char("That exit does not exist.\r\n", ch);
return;
}
r_num = world[ch->in_room].dir_option[direct]->to_room;
if(r_num < 0)
return;
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
if(*arg4 == '2') {
if(get_zon_num(world[r_num].number) != ZONE_BUF(ch)) {
send_to_char("Can't disconnect outside of the zone.\r\n", ch);
return;
}
world[r_num].dir_option[revdir]->to_room = NOWHERE;
}
return;
case 9:
/*
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
world[ch->in_room].dir_option[direct]->exit_info = EX_ISDOOR
| EX_SECRET;
*/
return;
case 10:
/*
if(!world[ch->in_room].dir_option[direct]) {
CREATE(world[ch->in_room].dir_option[direct],
struct room_direction_data, 1);
world[ch->in_room].dir_option[direct]->to_room = NOWHERE;
}
world[ch->in_room].dir_option[direct]->exit_info = EX_ISDOOR
| EX_PICKPROOF | EX_SECRET;
*/
return;
default:
send_to_char("Invalid exit command. Type rset exit for help.\r\n", ch);
return;
}
case 5:
if(!*val_arg) {
send_to_char("Usage : rset edesc <command> <keyword list>\r\n\r\n", ch);
send_to_char("To add an extra description, use rset edesc add <keyword list>, as in:\r\n", ch);
send_to_char("rset edesc add sign\r\n\r\n", ch);
send_to_char("To set the description text, use rset edesc set <keyword>, as in:\r\n", ch);
send_to_char("rset edesc set sign\r\n\r\n", ch);
send_to_char("Use no doublequotes, and use only one keyword.\r\n\r\n", ch);
send_to_char("To delete an extra description, use rset edesc del <keyword>, as in:\r\n", ch);
send_to_char("rset del sign\r\n\r\n", ch);
send_to_char("To show the description text, use rset edesc show <keyword>, as in:\r\n", ch);
send_to_char("rset edesc show sign\r\n\r\n", ch);
break;
}
half_chop(val_arg, arg1, arg2);
if(is_abbrev(arg1, "add")) {
if(!*arg2) {
send_to_char("Keyword list missing. Type rset edesc for help.\r\n", ch);
return;
}
CREATE(desc, struct extra_descr_data, 1);
desc->keyword = str_dup(arg2);
desc->description = str_dup("You see nothing special.\r\n");
desc->next = world[ch->in_room].ex_description;
world[ch->in_room].ex_description = desc;
*val_arg = '\0';
return;
}
if(is_abbrev(arg1, "del")) {
if(!*arg2) {
send_to_char("Keyword missing. Type rset edesc for help.\r\n", ch);
return;
}
for(desc = world[ch->in_room].ex_description; desc; desc=desc->next) {
if(isname(arg2, desc->keyword)) {
if(!last) {
if(world[ch->in_room].ex_description->next)
world[ch->in_room].ex_description = world[ch->in_room].ex_description->next;
else world[ch->in_room].ex_description = NULL;
free(desc);
} else {
if(desc->next) last->next = desc->next;
else last->next = NULL;
free(desc);
}
return;
}
last = desc;
}
send_to_char("No keyword match found.\r\n", ch);
return;
}
if(is_abbrev(arg1, "set")) {
if(!*arg2) {
send_to_char("Keyword missing. Type rset edesc for help.\r\n", ch);
return;
}
for(desc = world[ch->in_room].ex_description; desc; desc=desc->next) {
if(isname(arg2, desc->keyword)) {
if(desc->description) free(desc->description);
CREATE(desc->description, char, 2048);
ch->desc->str = &(desc->description);
ch->desc->max_str = 2048;
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); /*rev.01*/
send_to_char("Enter the extra description. '@' at the beginning of a line\r\n", ch);
send_to_char("ends the description text.\r\n", ch);
return;
}
}
send_to_char("No keyword match found.\r\n", ch);
return;
}
if(is_abbrev(arg1, "show")) {
if(!*arg2) {
send_to_char("Keyword missing. Type rset edesc for help.\r\n", ch);
return;
}
for(desc = world[ch->in_room].ex_description; desc; desc=desc->next) {
if(isname(arg2, desc->keyword)) {
if(!desc->description) {
send_to_char("No extra desc set for that keyword.\r\n", ch);
return;
}
send_to_char(desc->description, ch);
return;
}
}
send_to_char("No keyword match found.\r\n", ch);
return;
}
send_to_char("Invalid edesc argument. Type rset edesc for help.\r\n", ch);
return;
case 7:
send_to_char("Usage : rset <flag>\r\n\r\n", ch);
send_to_char("Valid flags are:\r\n\r\n", ch);
send_to_char("dark death\r\n", ch);
send_to_char("nomob indoors\r\n", ch);
send_to_char("peaceful soundproof\r\n", ch);
send_to_char("notrack nomagic\r\n", ch);
send_to_char("tunnel private\r\n", ch);
send_to_char("godroom \r\n", ch);
send_to_char("You may specify more than one flag on the command line.\r\n\r\n", ch);
send_to_char("Example : rset dark tunnel\r\n", ch);
break;
case 8:
send_to_char("Usage : rset <room type>\r\n\r\n", ch);
send_to_char("Valid room types are:\r\n\r\n", ch);
send_to_char("inside city\r\n", ch);
send_to_char("field forest\r\n", ch);
send_to_char("hills mountain\r\n", ch);
send_to_char("swim noswim\r\n", ch);
send_to_char("underwater flying\r\n", ch);
send_to_char("\r\n\r\n", ch);
send_to_char("Example : rset mountain\r\n", ch);
break;
case 9:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_DARK);
break;
case 10:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_DEATH);
break;
case 11:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_NOMOB);
break;
case 12:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_INDOORS);
break;
case 13:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_PEACEFUL);
break;
case 14:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_SOUNDPROOF);
break;
case 15:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_NOTRACK);
break;
case 16:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_NOMAGIC);
break;
case 17:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_TUNNEL);
break;
case 18:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_PRIVATE);
break;
case 19:
TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_GODROOM);
break;
case 20:
/*TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_);*/
break;
case 21:
/*TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_);*/
break;
case 22:
/*TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_);*/
break;
case 23:
/*TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_);*/
break;
case 24:
GET_ROOM_SECTOR(ch->in_room) = SECT_INSIDE;
break;
case 25:
GET_ROOM_SECTOR(ch->in_room) = SECT_CITY;
break;
case 26:
GET_ROOM_SECTOR(ch->in_room) = SECT_FIELD;
break;
case 27:
GET_ROOM_SECTOR(ch->in_room) = SECT_FOREST;
break;
case 28:
GET_ROOM_SECTOR(ch->in_room) = SECT_HILLS;
break;
case 29:
GET_ROOM_SECTOR(ch->in_room) = SECT_MOUNTAIN;
break;
case 30:
GET_ROOM_SECTOR(ch->in_room) = SECT_WATER_SWIM;
break;
case 31:
GET_ROOM_SECTOR(ch->in_room) = SECT_WATER_NOSWIM;
break;
case 32:
GET_ROOM_SECTOR(ch->in_room) = SECT_UNDERWATER;
break;
case 33:
GET_ROOM_SECTOR(ch->in_room) = SECT_FLYING;
break;
case 34:
/*GET_ROOM_SECTOR(ch->in_room) = SECT_;*/
break;
case 35:
/*TOGGLE_BIT(ROOM_FLAGS(ch->in_room), ROOM_);*/
break;
default:
if(!help) {
send_to_char("Usage : rset <field|flag> [value]\r\n\r\n", ch);
send_to_char("Valid fields/flags are:\r\n\r\n", ch);
send_to_char("name room name\r\n", ch);
send_to_char("description room description\r\n", ch);
send_to_char("exit add/change room exits\r\n", ch);
send_to_char("edesc extra descriptions\r\n", ch);
send_to_char("flags room flags\r\n", ch);
send_to_char("type room type\r\n\r\n", ch);
send_to_char("rset will accept multiple flags/types on a single line. Specifying\r\n", ch);
send_to_char("a flag toggles that flag. Setting a type overrides any previous type.\r\n\r\n", ch);
send_to_char("For detailed field help help, type rset <field>\r\n\r\n", ch);
send_to_char("Example : rset name The Temple Of Midgaard\r\n", ch);
send_to_char(" rset dark notrack inside\r\n", ch);
}
help = TRUE;
}
half_chop(val_arg, field, val_arg);
} while(*field);
}
/*zeditmod*/
ACMD(do_zset)
{
int rzone, temp;
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
if(ZONE_BUF(ch) == -1) {
send_to_char("You must first edit the zone editor with ZEDIT.\r\n", ch);
return;
}
half_chop(argument, arg1, arg2);
if(!*arg1) {
send_to_char("Usage : zset <option> [value]\r\n\r\n", ch);
send_to_char("Valid options are:\r\n", ch);
send_to_char("name set zone name\r\n", ch);
send_to_char("top set top vnum\r\n", ch);
send_to_char("lifespan set number of ticks between resets\r\n", ch);
send_to_char("type set reset type\r\n\r\n", ch);
send_to_char("For detailed help, type zset <option> with no value.\r\n", ch);
return;
}
rzone = get_zone_rnum(ZONE_BUF(ch));
if(is_abbrev(arg1, "name")) {
if(!*arg2) {
send_to_char("Usage : zset name <zone name>\r\n", ch);
send_to_char("Example : zset name Southwestern Midgaard\r\n", ch);
retShowing the first 100 KB of 143.3 KB. Download the archive for the full file.