2007-04-08 10:36:36 +00:00
|
|
|
/**************************************************************************
|
|
|
|
|
* File: zedit.c Part of tbaMUD *
|
|
|
|
|
* Usage: Oasis OLC - Zones and commands. *
|
|
|
|
|
* *
|
|
|
|
|
* Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
|
|
|
|
|
**************************************************************************/
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
#include "conf.h"
|
|
|
|
|
#include "sysdep.h"
|
|
|
|
|
#include "structs.h"
|
|
|
|
|
#include "comm.h"
|
|
|
|
|
#include "interpreter.h"
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
#include "db.h"
|
|
|
|
|
#include "constants.h"
|
|
|
|
|
#include "genolc.h"
|
|
|
|
|
#include "genzon.h"
|
|
|
|
|
#include "oasis.h"
|
|
|
|
|
#include "dg_scripts.h"
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Nasty internal macros to clean up the code. */
|
2006-12-19 22:56:18 +00:00
|
|
|
#define MYCMD (OLC_ZONE(d)->cmd[subcmd])
|
|
|
|
|
#define OLC_CMD(d) (OLC_ZONE(d)->cmd[OLC_VAL(d)])
|
|
|
|
|
#define MAX_DUPLICATES 100
|
|
|
|
|
|
2007-01-15 17:48:18 +00:00
|
|
|
/* local functions */
|
2006-12-19 22:56:18 +00:00
|
|
|
int start_change_command(struct descriptor_data *d, int pos);
|
2007-01-15 17:48:18 +00:00
|
|
|
void zedit_setup(struct descriptor_data *d, int room_num);
|
|
|
|
|
void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top);
|
|
|
|
|
void zedit_save_internally(struct descriptor_data *d);
|
|
|
|
|
void zedit_save_to_disk(int zone_num);
|
|
|
|
|
void zedit_disp_menu(struct descriptor_data *d);
|
|
|
|
|
void zedit_disp_comtype(struct descriptor_data *d);
|
|
|
|
|
void zedit_disp_arg1(struct descriptor_data *d);
|
|
|
|
|
void zedit_disp_arg2(struct descriptor_data *d);
|
|
|
|
|
void zedit_disp_arg3(struct descriptor_data *d);
|
2006-12-19 22:56:18 +00:00
|
|
|
|
|
|
|
|
ACMD(do_oasis_zedit)
|
|
|
|
|
{
|
|
|
|
|
int number = NOWHERE, save = 0, real_num;
|
|
|
|
|
struct descriptor_data *d;
|
|
|
|
|
char *buf3;
|
|
|
|
|
char buf1[MAX_STRING_LENGTH];
|
|
|
|
|
char buf2[MAX_STRING_LENGTH];
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-28 12:53:48 +00:00
|
|
|
/* No building as a mob or while being forced. */
|
|
|
|
|
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
|
|
|
|
return;
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse any arguments. */
|
2006-12-19 22:56:18 +00:00
|
|
|
buf3 = two_arguments(argument, buf1, buf2);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* If no argument was given, use the zone the builder is standing in. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!*buf1)
|
|
|
|
|
number = GET_ROOM_VNUM(IN_ROOM(ch));
|
|
|
|
|
else if (!isdigit(*buf1)) {
|
|
|
|
|
if (str_cmp("save", buf1) == 0) {
|
|
|
|
|
save = TRUE;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (is_number(buf2))
|
|
|
|
|
number = atoi(buf2);
|
|
|
|
|
else if (GET_OLC_ZONE(ch) > 0) {
|
|
|
|
|
zone_rnum zlok;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
|
|
|
|
number = NOWHERE;
|
|
|
|
|
else
|
|
|
|
|
number = genolc_zone_bottom(zlok);
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if (number == NOWHERE) {
|
|
|
|
|
send_to_char(ch, "Save which zone?\r\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if (GET_LEVEL(ch) >= LVL_IMPL) {
|
|
|
|
|
if (str_cmp("new", buf1) || !buf3 || !*buf3)
|
|
|
|
|
send_to_char(ch, "Format: zedit new <zone number> <bottom-room> "
|
|
|
|
|
"<upper-room>\r\n");
|
|
|
|
|
else {
|
|
|
|
|
char sbot[MAX_INPUT_LENGTH], stop[MAX_INPUT_LENGTH];
|
|
|
|
|
room_vnum bottom, top;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
skip_spaces(&buf3);
|
|
|
|
|
two_arguments(buf3, sbot, stop);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
number = atoi(buf2);
|
|
|
|
|
if (number < 0)
|
|
|
|
|
number = NOWHERE;
|
|
|
|
|
bottom = atoi(sbot);
|
|
|
|
|
top = atoi(stop);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Setup the new zone (displays the menu to the builder). */
|
2006-12-19 22:56:18 +00:00
|
|
|
zedit_new_zone(ch, number, bottom, top);
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Done now, exit the function. */
|
2006-12-19 22:56:18 +00:00
|
|
|
return;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
} else {
|
|
|
|
|
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* If a numeric argumentwas given, retrieve it. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (number == NOWHERE)
|
|
|
|
|
number = atoi(buf1);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Check that nobody is currently editing this zone. */
|
2006-12-19 22:56:18 +00:00
|
|
|
for (d = descriptor_list; d; d = d->next) {
|
|
|
|
|
if (STATE(d) == CON_ZEDIT) {
|
|
|
|
|
if (d->olc && OLC_NUM(d) == number) {
|
|
|
|
|
send_to_char(ch, "That zone is currently being edited by %s.\r\n",
|
|
|
|
|
PERS(d->character, ch));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Store the builder's descriptor in d. */
|
2006-12-19 22:56:18 +00:00
|
|
|
d = ch->desc;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Give the builder's descriptor an OLC structure. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (d->olc) {
|
|
|
|
|
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_zedit: Player already "
|
|
|
|
|
"had olc structure.");
|
|
|
|
|
free(d->olc);
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Find the zone. */
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
|
|
|
|
if (OLC_ZNUM(d) == NOWHERE) {
|
|
|
|
|
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Free the descriptor's OLC structure. */
|
2006-12-19 22:56:18 +00:00
|
|
|
free(d->olc);
|
|
|
|
|
d->olc = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Everyone but IMPLs can only edit zones they have been assigned. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!can_edit_zone(ch, OLC_ZNUM(d))) {
|
2007-03-04 20:18:13 +00:00
|
|
|
send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
|
2007-04-14 00:44:52 +00:00
|
|
|
/* Free the OLC structure. */
|
2006-12-19 22:56:18 +00:00
|
|
|
free(d->olc);
|
|
|
|
|
d->olc = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* If we need to save, then save the zone. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (save) {
|
|
|
|
|
send_to_char(ch, "Saving all zone information for zone %d.\r\n",
|
|
|
|
|
zone_table[OLC_ZNUM(d)].number);
|
|
|
|
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
|
|
|
|
"OLC: %s saves zone information for zone %d.", GET_NAME(ch),
|
|
|
|
|
zone_table[OLC_ZNUM(d)].number);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Save the zone information to the zone file. */
|
2006-12-19 22:56:18 +00:00
|
|
|
save_zone(OLC_ZNUM(d));
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Free the descriptor's OLC structure. */
|
2006-12-19 22:56:18 +00:00
|
|
|
free(d->olc);
|
|
|
|
|
d->olc = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_NUM(d) = number;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
if ((real_num = real_room(number)) == NOWHERE) {
|
|
|
|
|
write_to_output(d, "That room does not exist.\r\n");
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Free the descriptor's OLC structure. */
|
2006-12-19 22:56:18 +00:00
|
|
|
free(d->olc);
|
|
|
|
|
d->olc = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
zedit_setup(d, real_num);
|
|
|
|
|
STATE(d) = CON_ZEDIT;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
|
|
|
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
|
|
|
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void zedit_setup(struct descriptor_data *d, int room_num)
|
|
|
|
|
{
|
|
|
|
|
struct zone_data *zone;
|
|
|
|
|
int subcmd = 0, count = 0, cmd_room = NOWHERE;
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Allocate one scratch zone structure. */
|
2006-12-19 22:56:18 +00:00
|
|
|
CREATE(zone, struct zone_data, 1);
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Copy all the zone header information over. */
|
2006-12-19 22:56:18 +00:00
|
|
|
zone->name = strdup(zone_table[OLC_ZNUM(d)].name);
|
|
|
|
|
if (zone_table[OLC_ZNUM(d)].builders)
|
|
|
|
|
zone->builders = strdup(zone_table[OLC_ZNUM(d)].builders);
|
|
|
|
|
zone->lifespan = zone_table[OLC_ZNUM(d)].lifespan;
|
|
|
|
|
zone->bot = zone_table[OLC_ZNUM(d)].bot;
|
|
|
|
|
zone->top = zone_table[OLC_ZNUM(d)].top;
|
|
|
|
|
zone->reset_mode = zone_table[OLC_ZNUM(d)].reset_mode;
|
2007-03-04 20:18:13 +00:00
|
|
|
/* The remaining fields are used as a 'has been modified' flag */
|
2006-12-19 22:56:18 +00:00
|
|
|
zone->number = 0; /* Header information has changed. */
|
|
|
|
|
zone->age = 0; /* The commands have changed. */
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Start the reset command list with a terminator. */
|
2006-12-19 22:56:18 +00:00
|
|
|
CREATE(zone->cmd, struct reset_com, 1);
|
|
|
|
|
zone->cmd[0].command = 'S';
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Add all entries in zone_table that relate to this room. */
|
2006-12-19 22:56:18 +00:00
|
|
|
while (ZCMD(OLC_ZNUM(d), subcmd).command != 'S') {
|
|
|
|
|
switch (ZCMD(OLC_ZNUM(d), subcmd).command) {
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'O':
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'V':
|
|
|
|
|
cmd_room = ZCMD(OLC_ZNUM(d), subcmd).arg3;
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
case 'R':
|
|
|
|
|
cmd_room = ZCMD(OLC_ZNUM(d), subcmd).arg1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (cmd_room == room_num) {
|
|
|
|
|
add_cmd_to_list(&(zone->cmd), &ZCMD(OLC_ZNUM(d), subcmd), count);
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
subcmd++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OLC_ZONE(d) = zone;
|
|
|
|
|
/*
|
|
|
|
|
* Display main menu.
|
|
|
|
|
*/
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Create a new zone. */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top)
|
|
|
|
|
{
|
|
|
|
|
int result;
|
|
|
|
|
const char *error;
|
|
|
|
|
struct descriptor_data *dsc;
|
|
|
|
|
|
|
|
|
|
if ((result = create_new_zone(vzone_num, bottom, top, &error)) == NOWHERE) {
|
|
|
|
|
write_to_output(ch->desc, error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (dsc = descriptor_list; dsc; dsc = dsc->next) {
|
|
|
|
|
switch (STATE(dsc)) {
|
|
|
|
|
case CON_REDIT:
|
|
|
|
|
OLC_ROOM(dsc)->zone += (OLC_ZNUM(dsc) >= result);
|
|
|
|
|
/* Fall through. */
|
|
|
|
|
case CON_ZEDIT:
|
|
|
|
|
case CON_MEDIT:
|
|
|
|
|
case CON_SEDIT:
|
|
|
|
|
case CON_OEDIT:
|
|
|
|
|
case CON_TRIGEDIT:
|
|
|
|
|
OLC_ZNUM(dsc) += (OLC_ZNUM(dsc) >= result);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
zedit_save_to_disk(result); /* save to disk .. */
|
|
|
|
|
|
|
|
|
|
mudlog(BRF, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s creates new zone #%d", GET_NAME(ch), vzone_num);
|
|
|
|
|
write_to_output(ch->desc, "Zone created successfully.\r\n");
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Save all the information in the player's temporary buffer back into
|
|
|
|
|
* the current zone table. */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_save_internally(struct descriptor_data *d)
|
|
|
|
|
{
|
|
|
|
|
int mobloaded = FALSE,
|
|
|
|
|
objloaded = FALSE,
|
|
|
|
|
subcmd;
|
|
|
|
|
room_rnum room_num = real_room(OLC_NUM(d));
|
|
|
|
|
|
|
|
|
|
if (room_num == NOWHERE) {
|
|
|
|
|
log("SYSERR: zedit_save_internally: OLC_NUM(d) room %d not found.", OLC_NUM(d));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remove_room_zone_commands(OLC_ZNUM(d), room_num);
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Now add all the entries in the players descriptor list */
|
2006-12-19 22:56:18 +00:00
|
|
|
for (subcmd = 0; MYCMD.command != 'S'; subcmd++) {
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Since Circle does not keep track of what rooms the 'G', 'E', and
|
2006-12-19 22:56:18 +00:00
|
|
|
* 'P' commands are exitted in, but OasisOLC groups zone commands
|
|
|
|
|
* by rooms, this creates interesting problems when builders use these
|
|
|
|
|
* commands without loading a mob or object first. This fix prevents such
|
|
|
|
|
* commands from being saved and 'wandering' through the zone command
|
|
|
|
|
* list looking for mobs/objects to latch onto.
|
2007-03-04 20:18:13 +00:00
|
|
|
* C.Raehl 4/27/99 */
|
2006-12-19 22:56:18 +00:00
|
|
|
switch (MYCMD.command) {
|
|
|
|
|
/* Possible fail cases. */
|
|
|
|
|
case 'G':
|
|
|
|
|
case 'E':
|
|
|
|
|
if (mobloaded)
|
|
|
|
|
break;
|
|
|
|
|
write_to_output(d, "Equip/Give command not saved since no mob was loaded first.\r\n");
|
|
|
|
|
continue;
|
|
|
|
|
case 'P':
|
|
|
|
|
if (objloaded)
|
|
|
|
|
break;
|
|
|
|
|
write_to_output(d, "Put command not saved since another object was not loaded first.\r\n");
|
|
|
|
|
continue;
|
|
|
|
|
/* Pass cases. */
|
|
|
|
|
case 'M':
|
|
|
|
|
mobloaded = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case 'O':
|
|
|
|
|
objloaded = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
mobloaded = objloaded = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, subcmd);
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Finally, if zone headers have been changed, copy over */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (OLC_ZONE(d)->number) {
|
|
|
|
|
free(zone_table[OLC_ZNUM(d)].name);
|
|
|
|
|
free(zone_table[OLC_ZNUM(d)].builders);
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
zone_table[OLC_ZNUM(d)].name = strdup(OLC_ZONE(d)->name);
|
|
|
|
|
zone_table[OLC_ZNUM(d)].builders = strdup(OLC_ZONE(d)->builders);
|
|
|
|
|
zone_table[OLC_ZNUM(d)].bot = OLC_ZONE(d)->bot;
|
|
|
|
|
zone_table[OLC_ZNUM(d)].top = OLC_ZONE(d)->top;
|
|
|
|
|
zone_table[OLC_ZNUM(d)].reset_mode = OLC_ZONE(d)->reset_mode;
|
|
|
|
|
zone_table[OLC_ZNUM(d)].lifespan = OLC_ZONE(d)->lifespan;
|
|
|
|
|
}
|
|
|
|
|
add_to_save_list(zone_table[OLC_ZNUM(d)].number, SL_ZON);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void zedit_save_to_disk(int zone)
|
|
|
|
|
{
|
|
|
|
|
save_zone(zone);
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Error check user input and then setup change */
|
2006-12-19 22:56:18 +00:00
|
|
|
int start_change_command(struct descriptor_data *d, int pos)
|
|
|
|
|
{
|
|
|
|
|
if (pos < 0 || pos >= count_commands(OLC_ZONE(d)->cmd))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Ok, let's get editing. */
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_VAL(d) = pos;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Menu functions */
|
|
|
|
|
/* the main menu */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_disp_menu(struct descriptor_data *d)
|
|
|
|
|
{
|
|
|
|
|
int subcmd = 0, room, counter = 0;
|
|
|
|
|
|
|
|
|
|
get_char_colors(d->character);
|
|
|
|
|
clear_screen(d);
|
|
|
|
|
room = real_room(OLC_NUM(d));
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Menu header */
|
2007-01-23 03:07:23 +00:00
|
|
|
send_to_char(d->character,
|
2006-12-19 22:56:18 +00:00
|
|
|
"Room number: %s%d%s Room zone: %s%d\r\n"
|
|
|
|
|
"%s1%s) Builders : %s%s\r\n"
|
|
|
|
|
"%sZ%s) Zone name : %s%s\r\n"
|
|
|
|
|
"%sL%s) Lifespan : %s%d minutes\r\n"
|
|
|
|
|
"%sB%s) Bottom of zone : %s%d\r\n"
|
|
|
|
|
"%sT%s) Top of zone : %s%d\r\n"
|
|
|
|
|
"%sR%s) Reset Mode : %s%s%s\r\n"
|
|
|
|
|
"[Command list]\r\n",
|
|
|
|
|
|
|
|
|
|
cyn, OLC_NUM(d), nrm,
|
|
|
|
|
cyn, zone_table[OLC_ZNUM(d)].number,
|
|
|
|
|
grn, nrm, yel, OLC_ZONE(d)->builders ? OLC_ZONE(d)->builders : "None.",
|
|
|
|
|
grn, nrm, yel, OLC_ZONE(d)->name ? OLC_ZONE(d)->name : "<NONE!>",
|
|
|
|
|
grn, nrm, yel, OLC_ZONE(d)->lifespan,
|
|
|
|
|
grn, nrm, yel, OLC_ZONE(d)->bot,
|
|
|
|
|
grn, nrm, yel, OLC_ZONE(d)->top,
|
|
|
|
|
grn, nrm,
|
|
|
|
|
yel,
|
|
|
|
|
OLC_ZONE(d)->reset_mode ? ((OLC_ZONE(d)->reset_mode == 1) ? "Reset when no players are in zone." : "Normal reset.") : "Never reset",
|
|
|
|
|
nrm
|
|
|
|
|
);
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Print the commands for this room into display buffer. */
|
2006-12-19 22:56:18 +00:00
|
|
|
while (MYCMD.command != 'S') {
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Translate what the command means. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "%s%d - %s", nrm, counter++, yel);
|
|
|
|
|
switch (MYCMD.command) {
|
|
|
|
|
case 'M':
|
|
|
|
|
write_to_output(d, "%sLoad %s [%s%d%s], Max : %d",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
mob_proto[MYCMD.arg1].player.short_descr, cyn,
|
|
|
|
|
mob_index[MYCMD.arg1].vnum, yel, MYCMD.arg2
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'G':
|
|
|
|
|
write_to_output(d, "%sGive it %s [%s%d%s], Max : %d",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
obj_proto[MYCMD.arg1].short_description,
|
|
|
|
|
cyn, obj_index[MYCMD.arg1].vnum, yel,
|
|
|
|
|
MYCMD.arg2
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'O':
|
|
|
|
|
write_to_output(d, "%sLoad %s [%s%d%s], Max : %d",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
obj_proto[MYCMD.arg1].short_description,
|
|
|
|
|
cyn, obj_index[MYCMD.arg1].vnum, yel,
|
|
|
|
|
MYCMD.arg2
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'E':
|
|
|
|
|
write_to_output(d, "%sEquip with %s [%s%d%s], %s, Max : %d",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
obj_proto[MYCMD.arg1].short_description,
|
|
|
|
|
cyn, obj_index[MYCMD.arg1].vnum, yel,
|
|
|
|
|
equipment_types[MYCMD.arg3],
|
|
|
|
|
MYCMD.arg2
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'P':
|
|
|
|
|
write_to_output(d, "%sPut %s [%s%d%s] in %s [%s%d%s], Max : %d",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
obj_proto[MYCMD.arg1].short_description,
|
|
|
|
|
cyn, obj_index[MYCMD.arg1].vnum, yel,
|
|
|
|
|
obj_proto[MYCMD.arg3].short_description,
|
|
|
|
|
cyn, obj_index[MYCMD.arg3].vnum, yel,
|
|
|
|
|
MYCMD.arg2
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
write_to_output(d, "%sRemove %s [%s%d%s] from room.",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
obj_proto[MYCMD.arg2].short_description,
|
|
|
|
|
cyn, obj_index[MYCMD.arg2].vnum, yel
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
write_to_output(d, "%sSet door %s as %s.",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
dirs[MYCMD.arg2],
|
|
|
|
|
MYCMD.arg3 ? ((MYCMD.arg3 == 1) ? "closed" : "locked") : "open"
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
write_to_output(d, "%sAttach trigger %s%s%s [%s%d%s] to %s",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
2007-01-23 03:07:23 +00:00
|
|
|
cyn, trig_index[MYCMD.arg2]->proto->name, yel,
|
2006-12-19 22:56:18 +00:00
|
|
|
cyn, trig_index[MYCMD.arg2]->vnum, yel,
|
|
|
|
|
((MYCMD.arg1 == MOB_TRIGGER) ? "mobile" :
|
|
|
|
|
((MYCMD.arg1 == OBJ_TRIGGER) ? "object" :
|
|
|
|
|
((MYCMD.arg1 == WLD_TRIGGER)? "room" : "????"))));
|
|
|
|
|
break;
|
|
|
|
|
case 'V':
|
|
|
|
|
write_to_output(d, "%sAssign global %s:%d to %s = %s",
|
|
|
|
|
MYCMD.if_flag ? " then " : "",
|
|
|
|
|
MYCMD.sarg1, MYCMD.arg2,
|
|
|
|
|
((MYCMD.arg1 == MOB_TRIGGER) ? "mobile" :
|
|
|
|
|
((MYCMD.arg1 == OBJ_TRIGGER) ? "object" :
|
|
|
|
|
((MYCMD.arg1 == WLD_TRIGGER)? "room" : "????"))),
|
|
|
|
|
MYCMD.sarg2);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
write_to_output(d, "<Unknown Command>");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
write_to_output(d, "\r\n");
|
|
|
|
|
subcmd++;
|
|
|
|
|
}
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Finish off menu */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d,
|
|
|
|
|
"%s%d - <END OF LIST>\r\n"
|
|
|
|
|
"%sN%s) Insert new command.\r\n"
|
|
|
|
|
"%sE%s) Edit a command.\r\n"
|
|
|
|
|
"%sD%s) Delete a command.\r\n"
|
|
|
|
|
"%sQ%s) Quit\r\nEnter your choice : ",
|
|
|
|
|
nrm, counter, grn, nrm, grn, nrm, grn, nrm, grn, nrm
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
OLC_MODE(d) = ZEDIT_MAIN_MENU;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Print the command type menu and setup response catch. */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_disp_comtype(struct descriptor_data *d)
|
|
|
|
|
{
|
|
|
|
|
get_char_colors(d->character);
|
|
|
|
|
clear_screen(d);
|
|
|
|
|
write_to_output(d,
|
|
|
|
|
"\r\n"
|
|
|
|
|
"%sM%s) Load Mobile to room %sO%s) Load Object to room\r\n"
|
|
|
|
|
"%sE%s) Equip mobile with object %sG%s) Give an object to a mobile\r\n"
|
|
|
|
|
"%sP%s) Put object in another object %sD%s) Open/Close/Lock a Door\r\n"
|
|
|
|
|
"%sR%s) Remove an object from the room\r\n"
|
|
|
|
|
"%sT%s) Assign a trigger %sV%s) Set a global variable\r\n"
|
|
|
|
|
"\r\n"
|
|
|
|
|
"What sort of command will this be? : ",
|
|
|
|
|
grn, nrm, grn, nrm, grn, nrm, grn, nrm, grn, nrm,
|
|
|
|
|
grn, nrm, grn, nrm, grn, nrm, grn, nrm
|
|
|
|
|
);
|
|
|
|
|
OLC_MODE(d) = ZEDIT_COMMAND_TYPE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Print the appropriate message for the command type for arg1 and set
|
|
|
|
|
up the input catch clause */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_disp_arg1(struct descriptor_data *d)
|
|
|
|
|
{
|
|
|
|
|
write_to_output(d, "\r\n");
|
|
|
|
|
|
|
|
|
|
switch (OLC_CMD(d).command) {
|
|
|
|
|
case 'M':
|
|
|
|
|
write_to_output(d, "Input mob's vnum : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ARG1;
|
|
|
|
|
break;
|
|
|
|
|
case 'O':
|
|
|
|
|
case 'E':
|
|
|
|
|
case 'P':
|
|
|
|
|
case 'G':
|
|
|
|
|
write_to_output(d, "Input object vnum : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ARG1;
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
case 'R':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Arg1 for these is the room number, skip to arg2 */
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_CMD(d).arg1 = real_room(OLC_NUM(d));
|
|
|
|
|
zedit_disp_arg2(d);
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'V':
|
|
|
|
|
write_to_output(d, "Input trigger type (0:mob, 1:obj, 2:room) :");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ARG1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here. */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg1(): Help!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Print the appropriate message for the command type for arg2 and set
|
|
|
|
|
up the input catch clause. */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_disp_arg2(struct descriptor_data *d)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
write_to_output(d, "\r\n");
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
switch (OLC_CMD(d).command) {
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'O':
|
|
|
|
|
case 'E':
|
|
|
|
|
case 'P':
|
|
|
|
|
case 'G':
|
|
|
|
|
write_to_output(d, "Input the maximum number that can exist on the mud : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
for (i = 0; *dirs[i] != '\n'; i++) {
|
|
|
|
|
write_to_output(d, "%d) Exit %s.\r\n", i, dirs[i]);
|
|
|
|
|
}
|
|
|
|
|
write_to_output(d, "Enter exit number for door : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
write_to_output(d, "Input object's vnum : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
write_to_output(d, "Enter the trigger VNum : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'V':
|
|
|
|
|
write_to_output(d, "Global's context (0 for none) : ");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here, but just in case. */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg2(): Help!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ARG2;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Print the appropriate message for the command type for arg3 and set
|
|
|
|
|
up the input catch clause. */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_disp_arg3(struct descriptor_data *d)
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
write_to_output(d, "\r\n");
|
|
|
|
|
|
|
|
|
|
switch (OLC_CMD(d).command) {
|
|
|
|
|
case 'E':
|
|
|
|
|
while (*equipment_types[i] != '\n') {
|
|
|
|
|
write_to_output(d, "%2d) %26.26s %2d) %26.26s\r\n", i,
|
|
|
|
|
equipment_types[i], i + 1, (*equipment_types[i + 1] != '\n') ?
|
|
|
|
|
equipment_types[i + 1] : "");
|
|
|
|
|
if (*equipment_types[i + 1] != '\n')
|
|
|
|
|
i += 2;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
write_to_output(d, "Location to equip : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'P':
|
|
|
|
|
write_to_output(d, "Virtual number of the container : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
write_to_output(d, "0) Door open\r\n"
|
|
|
|
|
"1) Door closed\r\n"
|
|
|
|
|
"2) Door locked\r\n"
|
|
|
|
|
"Enter state of the door : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'V':
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'O':
|
|
|
|
|
case 'R':
|
|
|
|
|
case 'G':
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here, just in case. */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg3(): Help!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ARG3;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-04 20:18:13 +00:00
|
|
|
/* The event handler */
|
2006-12-19 22:56:18 +00:00
|
|
|
void zedit_parse(struct descriptor_data *d, char *arg)
|
|
|
|
|
{
|
|
|
|
|
int pos, i = 0;
|
|
|
|
|
|
|
|
|
|
switch (OLC_MODE(d)) {
|
|
|
|
|
case ZEDIT_CONFIRM_SAVESTRING:
|
|
|
|
|
switch (*arg) {
|
|
|
|
|
case 'y':
|
|
|
|
|
case 'Y':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Save the zone in memory, hiding invisible people. */
|
2006-12-19 22:56:18 +00:00
|
|
|
zedit_save_internally(d);
|
|
|
|
|
if (CONFIG_OLC_SAVE) {
|
|
|
|
|
write_to_output(d, "Saving zone info to disk.\r\n");
|
|
|
|
|
zedit_save_to_disk(OLC_ZNUM(d));
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "Saving zone info in memory.\r\n");
|
|
|
|
|
|
|
|
|
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits zone info for room %d.", GET_NAME(d->character), OLC_NUM(d));
|
|
|
|
|
/* FALL THROUGH */
|
|
|
|
|
case 'n':
|
|
|
|
|
case 'N':
|
|
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
write_to_output(d, "Invalid choice!\r\n");
|
2007-03-04 20:18:13 +00:00
|
|
|
write_to_output(d, "Do you wish to save your changes? : ");
|
2006-12-19 22:56:18 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
/* End of ZEDIT_CONFIRM_SAVESTRING */
|
|
|
|
|
|
|
|
|
|
case ZEDIT_MAIN_MENU:
|
|
|
|
|
switch (*arg) {
|
|
|
|
|
case 'q':
|
|
|
|
|
case 'Q':
|
|
|
|
|
if (OLC_ZONE(d)->age || OLC_ZONE(d)->number) {
|
2007-03-28 12:53:48 +00:00
|
|
|
write_to_output(d, "Do you wish to save your changes? : ");
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_MODE(d) = ZEDIT_CONFIRM_SAVESTRING;
|
|
|
|
|
} else {
|
|
|
|
|
write_to_output(d, "No changes made.\r\n");
|
|
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'n':
|
|
|
|
|
case 'N':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* New entry. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (OLC_ZONE(d)->cmd[0].command == 'S') {
|
|
|
|
|
/* first command */
|
|
|
|
|
if (new_command(OLC_ZONE(d), 0) && start_change_command(d, 0)) {
|
|
|
|
|
zedit_disp_comtype(d);
|
|
|
|
|
OLC_ZONE(d)->age = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
write_to_output(d, "What number in the list should the new command be? : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_NEW_ENTRY;
|
|
|
|
|
break;
|
|
|
|
|
case 'e':
|
|
|
|
|
case 'E':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Change an entry. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "Which command do you wish to change? : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_CHANGE_ENTRY;
|
|
|
|
|
break;
|
|
|
|
|
case 'd':
|
|
|
|
|
case 'D':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Delete an entry. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "Which command do you wish to delete? : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_DELETE_ENTRY;
|
|
|
|
|
break;
|
|
|
|
|
case 'z':
|
|
|
|
|
case 'Z':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Edit zone name. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "Enter new zone name : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ZONE_NAME;
|
|
|
|
|
break;
|
|
|
|
|
case '1':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Edit zone builders. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "Enter new builders list : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ZONE_BUILDERS;
|
|
|
|
|
break;
|
|
|
|
|
case 'b':
|
|
|
|
|
case 'B':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Edit bottom of zone. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (GET_LEVEL(d->character) < LVL_IMPL)
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
else {
|
|
|
|
|
write_to_output(d, "Enter new bottom of zone : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ZONE_BOT;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
case 'T':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Edit top of zone. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (GET_LEVEL(d->character) < LVL_IMPL)
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
else {
|
|
|
|
|
write_to_output(d, "Enter new top of zone : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ZONE_TOP;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'l':
|
|
|
|
|
case 'L':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Edit zone lifespan. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "Enter new zone lifespan : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ZONE_LIFE;
|
|
|
|
|
break;
|
|
|
|
|
case 'r':
|
|
|
|
|
case 'R':
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Edit zone reset mode. */
|
2006-12-19 22:56:18 +00:00
|
|
|
write_to_output(d, "\r\n"
|
|
|
|
|
"0) Never reset\r\n"
|
|
|
|
|
"1) Reset only when no players in zone\r\n"
|
|
|
|
|
"2) Normal reset\r\n"
|
|
|
|
|
"Enter new zone reset type : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_ZONE_RESET;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
/* End of ZEDIT_MAIN_MENU */
|
|
|
|
|
|
|
|
|
|
case ZEDIT_NEW_ENTRY:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Get the line number and insert the new line. */
|
2006-12-19 22:56:18 +00:00
|
|
|
pos = atoi(arg);
|
|
|
|
|
if (isdigit(*arg) && new_command(OLC_ZONE(d), pos)) {
|
|
|
|
|
if (start_change_command(d, pos)) {
|
|
|
|
|
zedit_disp_comtype(d);
|
|
|
|
|
OLC_ZONE(d)->age = 1;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_DELETE_ENTRY:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Get the line number and delete the line. */
|
2006-12-19 22:56:18 +00:00
|
|
|
pos = atoi(arg);
|
|
|
|
|
if (isdigit(*arg)) {
|
2007-01-15 17:48:18 +00:00
|
|
|
delete_zone_command(OLC_ZONE(d), pos);
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_ZONE(d)->age = 1;
|
|
|
|
|
}
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_CHANGE_ENTRY:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse the input for which line to edit, and goto next quiz. Abort edit,
|
|
|
|
|
and return to main menu idea from Mark Garringer zizazat@hotmail.com */
|
2007-01-23 03:07:23 +00:00
|
|
|
if (toupper(*arg) == 'A') {
|
|
|
|
|
if (OLC_CMD(d).command == 'N') {
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_CMD(d).command = '*';
|
2007-01-23 03:07:23 +00:00
|
|
|
}
|
2006-12-19 22:56:18 +00:00
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos = atoi(arg);
|
|
|
|
|
if (isdigit(*arg) && start_change_command(d, pos)) {
|
|
|
|
|
zedit_disp_comtype(d);
|
|
|
|
|
OLC_ZONE(d)->age = 1;
|
|
|
|
|
} else
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_COMMAND_TYPE:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse the input for which type of command this is, and goto next quiz. */
|
2006-12-19 22:56:18 +00:00
|
|
|
OLC_CMD(d).command = toupper(*arg);
|
|
|
|
|
if (!OLC_CMD(d).command || (strchr("MOPEDGRTV", OLC_CMD(d).command) == NULL)) {
|
|
|
|
|
write_to_output(d, "Invalid choice, try again : ");
|
|
|
|
|
} else {
|
|
|
|
|
if (OLC_VAL(d)) { /* If there was a previous command. */
|
|
|
|
|
if (OLC_CMD(d).command == 'T' || OLC_CMD(d).command == 'V') {
|
|
|
|
|
OLC_CMD(d).if_flag = 1;
|
|
|
|
|
zedit_disp_arg1(d);
|
|
|
|
|
} else {
|
|
|
|
|
write_to_output(d, "Is this command dependent on the success of the previous one? (y/n)\r\n");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_IF_FLAG;
|
|
|
|
|
}
|
|
|
|
|
} else { /* 'if-flag' not appropriate. */
|
|
|
|
|
OLC_CMD(d).if_flag = 0;
|
|
|
|
|
zedit_disp_arg1(d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_IF_FLAG:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse the input for the if flag, and goto next quiz. */
|
2006-12-19 22:56:18 +00:00
|
|
|
switch (*arg) {
|
|
|
|
|
case 'y':
|
|
|
|
|
case 'Y':
|
|
|
|
|
OLC_CMD(d).if_flag = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 'n':
|
|
|
|
|
case 'N':
|
|
|
|
|
OLC_CMD(d).if_flag = 0;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
write_to_output(d, "Try again : ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
zedit_disp_arg1(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ARG1:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse the input for arg1, and goto next quiz. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!isdigit(*arg)) {
|
|
|
|
|
write_to_output(d, "Must be a numeric value, try again : ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (OLC_CMD(d).command) {
|
|
|
|
|
case 'M':
|
|
|
|
|
if ((pos = real_mobile(atoi(arg))) != NOBODY) {
|
|
|
|
|
OLC_CMD(d).arg1 = pos;
|
|
|
|
|
zedit_disp_arg2(d);
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "That mobile does not exist, try again : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'O':
|
|
|
|
|
case 'P':
|
|
|
|
|
case 'E':
|
|
|
|
|
case 'G':
|
|
|
|
|
if ((pos = real_object(atoi(arg))) != NOTHING) {
|
|
|
|
|
OLC_CMD(d).arg1 = pos;
|
|
|
|
|
zedit_disp_arg2(d);
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "That object does not exist, try again : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'V':
|
|
|
|
|
if (atoi(arg)<MOB_TRIGGER || atoi(arg)>WLD_TRIGGER)
|
|
|
|
|
write_to_output(d, "Invalid input.");
|
|
|
|
|
else {
|
|
|
|
|
OLC_CMD(d).arg1 = atoi(arg);
|
|
|
|
|
zedit_disp_arg2(d);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
case 'R':
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here. */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG1: Ack!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ARG2:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse the input for arg2, and goto next quiz. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!isdigit(*arg)) {
|
|
|
|
|
write_to_output(d, "Must be a numeric value, try again : ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (OLC_CMD(d).command) {
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'O':
|
|
|
|
|
OLC_CMD(d).arg2 = MIN(MAX_DUPLICATES, atoi(arg));
|
|
|
|
|
OLC_CMD(d).arg3 = real_room(OLC_NUM(d));
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
case 'G':
|
|
|
|
|
OLC_CMD(d).arg2 = MIN(MAX_DUPLICATES, atoi(arg));
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
case 'P':
|
|
|
|
|
case 'E':
|
|
|
|
|
OLC_CMD(d).arg2 = MIN(MAX_DUPLICATES, atoi(arg));
|
|
|
|
|
zedit_disp_arg3(d);
|
|
|
|
|
break;
|
|
|
|
|
case 'V':
|
|
|
|
|
OLC_CMD(d).arg2 = atoi(arg); /* context */
|
|
|
|
|
OLC_CMD(d).arg3 = real_room(OLC_NUM(d));
|
|
|
|
|
write_to_output(d, "Enter the global name : ");
|
|
|
|
|
OLC_MODE(d) = ZEDIT_SARG1;
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
if (real_trigger(atoi(arg)) != NOTHING) {
|
|
|
|
|
OLC_CMD(d).arg2 = real_trigger(atoi(arg)); /* trigger */
|
2007-01-23 03:07:23 +00:00
|
|
|
OLC_CMD(d).arg3 = real_room(OLC_NUM(d));
|
2006-12-19 22:56:18 +00:00
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "That trigger does not exist, try again : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
pos = atoi(arg);
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Count directions. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (pos < 0 || pos > NUM_OF_DIRS)
|
|
|
|
|
write_to_output(d, "Try again : ");
|
|
|
|
|
else {
|
|
|
|
|
OLC_CMD(d).arg2 = pos;
|
|
|
|
|
zedit_disp_arg3(d);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
if ((pos = real_object(atoi(arg))) != NOTHING) {
|
|
|
|
|
OLC_CMD(d).arg2 = pos;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "That object does not exist, try again : ");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here, but just in case. */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG2: Ack!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ARG3:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse the input for arg3, and go back to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (!isdigit(*arg)) {
|
|
|
|
|
write_to_output(d, "Must be a numeric value, try again : ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (OLC_CMD(d).command) {
|
|
|
|
|
case 'E':
|
|
|
|
|
pos = atoi(arg);
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Count number of wear positions. We could use NUM_WEARS, this is
|
|
|
|
|
more reliable. */
|
2006-12-19 22:56:18 +00:00
|
|
|
while (*equipment_types[i] != '\n')
|
|
|
|
|
i++;
|
|
|
|
|
if (pos < 0 || pos > i)
|
|
|
|
|
write_to_output(d, "Try again : ");
|
|
|
|
|
else {
|
|
|
|
|
OLC_CMD(d).arg3 = pos;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'P':
|
|
|
|
|
if ((pos = real_object(atoi(arg))) != NOTHING) {
|
|
|
|
|
OLC_CMD(d).arg3 = pos;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "That object does not exist, try again : ");
|
|
|
|
|
break;
|
|
|
|
|
case 'D':
|
|
|
|
|
pos = atoi(arg);
|
|
|
|
|
if (pos < 0 || pos > 2)
|
|
|
|
|
write_to_output(d, "Try again : ");
|
|
|
|
|
else {
|
|
|
|
|
OLC_CMD(d).arg3 = pos;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'O':
|
|
|
|
|
case 'G':
|
|
|
|
|
case 'R':
|
|
|
|
|
case 'T':
|
|
|
|
|
case 'V':
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here, but just in case. */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG3: Ack!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_SARG1:
|
|
|
|
|
if (strlen(arg)) {
|
|
|
|
|
OLC_CMD(d).sarg1 = strdup(arg);
|
|
|
|
|
OLC_MODE(d) = ZEDIT_SARG2;
|
|
|
|
|
write_to_output(d, "Enter the global value : ");
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "Must have some name to assign : ");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_SARG2:
|
|
|
|
|
if (strlen(arg)) {
|
|
|
|
|
OLC_CMD(d).sarg2 = strdup(arg);
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
} else
|
|
|
|
|
write_to_output(d, "Must have some value to set it to :");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ZONE_NAME:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Add new name and return to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (genolc_checkstring(d, arg)) {
|
|
|
|
|
if (OLC_ZONE(d)->name)
|
|
|
|
|
free(OLC_ZONE(d)->name);
|
|
|
|
|
else
|
|
|
|
|
log("SYSERR: OLC: ZEDIT_ZONE_NAME: no name to free!");
|
|
|
|
|
OLC_ZONE(d)->name = strdup(arg);
|
|
|
|
|
OLC_ZONE(d)->number = 1;
|
|
|
|
|
}
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ZONE_BUILDERS:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Add new builders list and return to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (genolc_checkstring(d, arg)) {
|
|
|
|
|
if (OLC_ZONE(d)->builders)
|
|
|
|
|
free(OLC_ZONE(d)->builders);
|
|
|
|
|
else
|
|
|
|
|
log("SYSERR: OLC: ZEDIT_ZONE_BUILDERS: no builders list to free!");
|
|
|
|
|
OLC_ZONE(d)->builders = strdup(arg);
|
|
|
|
|
OLC_ZONE(d)->number = 1;
|
|
|
|
|
}
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
2007-01-23 03:07:23 +00:00
|
|
|
|
2006-12-19 22:56:18 +00:00
|
|
|
case ZEDIT_ZONE_RESET:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse and add new reset_mode and return to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
pos = atoi(arg);
|
|
|
|
|
if (!isdigit(*arg) || pos < 0 || pos > 2)
|
|
|
|
|
write_to_output(d, "Try again (0-2) : ");
|
|
|
|
|
else {
|
|
|
|
|
OLC_ZONE(d)->reset_mode = pos;
|
|
|
|
|
OLC_ZONE(d)->number = 1;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ZONE_LIFE:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse and add new lifespan and return to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
pos = atoi(arg);
|
|
|
|
|
if (!isdigit(*arg) || pos < 0 || pos > 240)
|
|
|
|
|
write_to_output(d, "Try again (0-240) : ");
|
|
|
|
|
else {
|
|
|
|
|
OLC_ZONE(d)->lifespan = pos;
|
|
|
|
|
OLC_ZONE(d)->number = 1;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ZONE_BOT:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse and add new bottom room in zone and return to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (OLC_ZNUM(d) == 0)
|
|
|
|
|
OLC_ZONE(d)->bot = LIMIT(atoi(arg), 0, OLC_ZONE(d)->top);
|
|
|
|
|
else
|
|
|
|
|
OLC_ZONE(d)->bot = LIMIT(atoi(arg), zone_table[OLC_ZNUM(d) - 1].top + 1, OLC_ZONE(d)->top);
|
|
|
|
|
OLC_ZONE(d)->number = 1;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ZEDIT_ZONE_TOP:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* Parse and add new top room in zone and return to main menu. */
|
2006-12-19 22:56:18 +00:00
|
|
|
if (OLC_ZNUM(d) == top_of_zone_table)
|
|
|
|
|
OLC_ZONE(d)->top = LIMIT(atoi(arg), genolc_zonep_bottom(OLC_ZONE(d)), 32000);
|
|
|
|
|
else
|
|
|
|
|
OLC_ZONE(d)->top = LIMIT(atoi(arg), genolc_zonep_bottom(OLC_ZONE(d)), genolc_zone_bottom(OLC_ZNUM(d) + 1) - 1);
|
|
|
|
|
OLC_ZONE(d)->number = 1;
|
|
|
|
|
zedit_disp_menu(d);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2007-03-04 20:18:13 +00:00
|
|
|
/* We should never get here, but just in case... */
|
2006-12-19 22:56:18 +00:00
|
|
|
cleanup_olc(d, CLEANUP_ALL);
|
|
|
|
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): Reached default case!");
|
|
|
|
|
write_to_output(d, "Oops...\r\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|