コード例 #1
0
ファイル: medit.c プロジェクト: axanon/tbamud
/* Save new/edited mob to memory. */
void medit_save_internally(struct descriptor_data *d)
{
  int i;
  mob_rnum new_rnum;
  struct descriptor_data *dsc;
  struct char_data *mob;

  i = (real_mobile(OLC_NUM(d)) == NOBODY);

  if ((new_rnum = add_mobile(OLC_MOB(d), OLC_NUM(d))) == NOBODY) {
    log("medit_save_internally: add_mobile failed.");
    return;
  }

  /* Update triggers and free old proto list */
  if (mob_proto[new_rnum].proto_script &&
      mob_proto[new_rnum].proto_script != OLC_SCRIPT(d))
    free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER);

  mob_proto[new_rnum].proto_script = OLC_SCRIPT(d);

  /* this takes care of the mobs currently in-game */
  for (mob = character_list; mob; mob = mob->next) {
    if (GET_MOB_RNUM(mob) != new_rnum)
      continue;

    /* remove any old scripts */
    if (SCRIPT(mob))
      extract_script(mob, MOB_TRIGGER);

    free_proto_script(mob, MOB_TRIGGER);
    copy_proto_script(&mob_proto[new_rnum], mob, MOB_TRIGGER);
    assign_triggers(mob, MOB_TRIGGER);
  }
  /* end trigger update */

  if (!i)	/* Only renumber on new mobiles. */
    return;

  /* Update keepers in shops being edited and other mobs being edited. */
  for (dsc = descriptor_list; dsc; dsc = dsc->next) {
    if (STATE(dsc) == CON_SEDIT)
      S_KEEPER(OLC_SHOP(dsc)) += (S_KEEPER(OLC_SHOP(dsc)) != NOTHING && S_KEEPER(OLC_SHOP(dsc)) >= new_rnum);
    else if (STATE(dsc) == CON_MEDIT)
      GET_MOB_RNUM(OLC_MOB(dsc)) += (GET_MOB_RNUM(OLC_MOB(dsc)) != NOTHING && GET_MOB_RNUM(OLC_MOB(dsc)) >= new_rnum);
  }

  /* Update other people in zedit too. From: C.Raehl 4/27/99 */
  for (dsc = descriptor_list; dsc; dsc = dsc->next)
    if (STATE(dsc) == CON_ZEDIT)
      for (i = 0; OLC_ZONE(dsc)->cmd[i].command != 'S'; i++)
        if (OLC_ZONE(dsc)->cmd[i].command == 'M')
          if (OLC_ZONE(dsc)->cmd[i].arg1 >= new_rnum)
            OLC_ZONE(dsc)->cmd[i].arg1++;
}
コード例 #2
0
ファイル: zedit.c プロジェクト: vedicveko/Aarait
/*
 * Print the appropriate message for the command type for arg1 and set
 * up the input catch clause  
 */
void zedit_disp_arg1(struct descriptor_data *d)
{
  switch (OLC_CMD(d).command) {
  case 'M':
    SEND_TO_Q("Input mob's vnum : ", d);
    OLC_MODE(d) = ZEDIT_ARG1;
    break;
  case 'O':
  case 'E':
  case 'P':
  case 'G':
    SEND_TO_Q("Input object vnum : ", d);
    OLC_MODE(d) = ZEDIT_ARG1;
    break;
  case 'D':
  case 'R':
    /*
     * Arg1 for these is the room number, skip to arg2  
     */
    OLC_CMD(d).arg1 = real_room(OLC_NUM(d));
    zedit_disp_arg2(d);
    break;
  default:
    /*
     * We should never get here.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog("SYSERR: OLC: zedit_disp_arg1(): Help!", BRF, LVL_BUILDER, TRUE);
    SEND_TO_Q("Oops...\r\n", d);
    return;
  }
}
コード例 #3
0
ファイル: msgedit.c プロジェクト: Lundessa/raven3
static void msgedit_setup(struct descriptor_data *d)
{
  CREATE(OLC_MSG_LIST(d), struct message_list, 1);
  OLC_MSG_LIST(d)->msg = NULL;  
    
  copy_message_list(OLC_MSG_LIST(d), &fight_messages[OLC_NUM(d)]);
  OLC_MSG(d) = OLC_MSG_LIST(d)->msg;
}
コード例 #4
0
ファイル: sedit.c プロジェクト: tbamud/tbamud
/* Display main menu. */
static void sedit_disp_menu(struct descriptor_data *d)
{
  char buf1[MAX_STRING_LENGTH];
  char buf2[MAX_STRING_LENGTH];
  struct shop_data *shop;

  shop = OLC_SHOP(d);
  get_char_colors(d->character);

  clear_screen(d);
  sprintbit(S_NOTRADE(shop), trade_letters, buf1, sizeof(buf1));
  sprintbit(S_BITVECTOR(shop), shop_bits, buf2, sizeof(buf2));
  write_to_output(d,
	  "-- Shop Number : [%s%d%s]\r\n"
	  "%s0%s) Keeper      : [%s%d%s] %s%s\r\n"
          "%s1%s) Open 1      : %s%4d%s          %s2%s) Close 1     : %s%4d\r\n"
          "%s3%s) Open 2      : %s%4d%s          %s4%s) Close 2     : %s%4d\r\n"
	  "%s5%s) Sell rate   : %s%1.2f%s          %s6%s) Buy rate    : %s%1.2f\r\n"
	  "%s7%s) Keeper no item : %s%s\r\n"
	  "%s8%s) Player no item : %s%s\r\n"
	  "%s9%s) Keeper no cash : %s%s\r\n"
	  "%sA%s) Player no cash : %s%s\r\n"
	  "%sB%s) Keeper no buy  : %s%s\r\n"
	  "%sC%s) Buy success    : %s%s\r\n"
	  "%sD%s) Sell success   : %s%s\r\n"
	  "%sE%s) No Trade With  : %s%s\r\n"
	  "%sF%s) Shop flags     : %s%s\r\n"
	  "%sR%s) Rooms Menu\r\n"
	  "%sP%s) Products Menu\r\n"
	  "%sT%s) Accept Types Menu\r\n"
          "%sW%s) Copy Shop\r\n"
	  "%sQ%s) Quit\r\n"
	  "Enter Choice : ",

	  cyn, OLC_NUM(d), nrm,
	  grn, nrm, cyn, S_KEEPER(shop) == NOBODY ? -1 : mob_index[S_KEEPER(shop)].vnum,
	  nrm, yel, S_KEEPER(shop) == NOBODY ? "None" : mob_proto[S_KEEPER(shop)].player.short_descr,
	  grn, nrm, cyn, S_OPEN1(shop), nrm,
	  grn, nrm, cyn, S_CLOSE1(shop),
	  grn, nrm, cyn, S_OPEN2(shop), nrm,
	  grn, nrm, cyn, S_CLOSE2(shop),
	  grn, nrm, cyn, S_BUYPROFIT(shop), nrm,
	  grn, nrm, cyn, S_SELLPROFIT(shop),
	  grn, nrm, yel, S_NOITEM1(shop),
	  grn, nrm, yel, S_NOITEM2(shop),
	  grn, nrm, yel, S_NOCASH1(shop),
	  grn, nrm, yel, S_NOCASH2(shop),
	  grn, nrm, yel, S_NOBUY(shop),
	  grn, nrm, yel, S_BUY(shop),
	  grn, nrm, yel, S_SELL(shop),
	  grn, nrm, cyn, buf1,
	  grn, nrm, cyn, buf2,
	  grn, nrm, grn, nrm, grn, nrm, grn, nrm, grn, nrm
  );

  OLC_MODE(d) = SEDIT_MAIN_MENU;
}
コード例 #5
0
ファイル: olc_redit.c プロジェクト: Onirik79/bardmud
/*
 * Il menu principale.
 */
void redit_disp_menu( DESCRIPTOR_DATA *d )
{
	char	 	 buf[MSL];
	ROOM_DATA	*room = d->character->dest_buf;
	char		*sect;


	switch ( room->sector )
	{
	  default:					sect = "None";			break;
	  case SECTOR_INSIDE:			sect = "Inside";		break;
	  case SECTOR_CITY:			sect = "City";			break;
	  case SECTOR_FIELD:			sect = "Field";			break;
	  case SECTOR_FOREST:			sect = "Forest";		break;
	  case SECTOR_HILLS:			sect = "Hills";			break;
	  case SECTOR_MOUNTAIN:		sect = "Mountains";		break;
	  case SECTOR_WATER_SWIM:		sect = "Swim";			break;
	  case SECTOR_WATER_NOSWIM:	sect = "Noswim";		break;
	  case SECTOR_UNDERWATER:		sect = "Underwater";	break;
	  case SECTOR_AIR:			sect = "Air";			break;
	  case SECTOR_DESERT:			sect = "Desert";		break;
	  case SECTOR_OCEANFLOOR:		sect = "Oceanfloor";	break;
	  case SECTOR_UNDERGROUND:	sect = "Underground";	break;
	}

	write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 );

	sprintf( buf,
		"&w-- Room number : [&c%d&w]	  Room area: [&c%-30.30s&w]\r\n"
		"&g1&w) Name		: &O%s\r\n"
		"&g2&w) Description :\r\n&O%s"
		"&g3&w) Room flags  : &c%s\r\n"
		"&g4&w) Sector type : &c%s\r\n"
		"&g5&w) Tunnel	  : &c%d\r\n"
		"&g6&w) TeleDelay   : &c%d\r\n"
		"&g7&w) TeleVnum	: &c%d\r\n"
		"&gA&w) Exit menu\r\n"
		"&gB&w) Extra descriptions menu\r\n"
		"&gQ&w) Quit\r\n"
		"Enter choice : ",

		OLC_NUM(d),
		(room->area)  ?  room->area->name  :  "None???",
		room->name,
		room->description,
		code_bit(NULL, room->flags, CODE_ROOM),
		sect,
		room->tunnel,
		room->tele_delay,
		room->tele_vnum );

	set_char_color( AT_PLAIN, d->character );
	send_to_char( d->character, buf );

	OLC_MODE(d) = REDIT_MAIN_MENU;
}
コード例 #6
0
ファイル: dg_olc.c プロジェクト: tbjers/arcanerealms
void trigedit_disp_menu(struct descriptor_data *d)
{
	struct trig_data *trig = OLC_TRIG(d);
	char *attach_type;
	char trgtypes[256];

	get_char_colors(d->character);
	clear_screen(d);

	if (trig->attach_type==OBJ_TRIGGER) {
		attach_type = "Objects";
		sprintbit(GET_TRIG_TYPE(trig), otrig_types, trgtypes, sizeof(trgtypes));
	} else if (trig->attach_type==WLD_TRIGGER) {
		attach_type = "Rooms";
		sprintbit(GET_TRIG_TYPE(trig), wtrig_types, trgtypes, sizeof(trgtypes));
	} else {
		attach_type = "Mobiles";
		sprintbit(GET_TRIG_TYPE(trig), trig_types, trgtypes, sizeof(trgtypes));
	}
			
	write_to_output(d, TRUE,
#if	defined(CLEAR_SCREEN)
		"^[[H^[[J"
#endif
		"Trigger Editor [%s%d%s]\r\n\r\n"
		"%s1)%s Name         : %s%s\r\n"
		"%s2)%s Intended for : %s%s\r\n"
		"%s3)%s Trigger types: %s%s\r\n"
		"%s4)%s Numberic Arg : %s%d\r\n"
		"%s5)%s Arguments    : %s%s\r\n"
		"%s6)%s Commands:\r\n%s",	
		grn, OLC_NUM(d), nrm,														/* vnum on the title line */
		grn, nrm, yel, GET_TRIG_NAME(trig),							/* name                   */
		grn, nrm, yel, attach_type,											/* attach type            */
		grn, nrm, yel, trgtypes,												/* greet/drop/etc         */
		grn, nrm, yel, trig->narg,											/* numeric arg            */
		grn, nrm, yel, trig->arglist?trig->arglist:"",	/* strict arg             */
		grn, nrm, cyn
	);
		
	write_to_output(d, FALSE,
		"%s\r\n",
		OLC_STORAGE(d)																	/* the command list       */
	);

	write_to_output(d, TRUE,
		"%sQ)%s Quit\r\n"
		"Enter Choice :",
		grn, nrm																				/* quit colors            */
	);

	OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
}
コード例 #7
0
ファイル: medit.c プロジェクト: axanon/tbamud
/* Display main menu. */
static void medit_disp_menu(struct descriptor_data *d)
{
  struct char_data *mob;
  char flags[MAX_STRING_LENGTH], flag2[MAX_STRING_LENGTH];

  mob = OLC_MOB(d);
  get_char_colors(d->character);
  clear_screen(d);

  write_to_output(d,
  "-- Mob Number:  [%s%d%s]\r\n"
  "%s1%s) Sex: %s%-7.7s%s	         %s2%s) Keywords: %s%s\r\n"
  "%s3%s) S-Desc: %s%s\r\n"
  "%s4%s) L-Desc:-\r\n%s%s\r\n"
  "%s5%s) D-Desc:-\r\n%s%s\r\n",

	  cyn, OLC_NUM(d), nrm,
	  grn, nrm, yel, genders[(int)GET_SEX(mob)], nrm,
	  grn, nrm, yel, GET_ALIAS(mob),
	  grn, nrm, yel, GET_SDESC(mob),
	  grn, nrm, yel, GET_LDESC(mob),
	  grn, nrm, yel, GET_DDESC(mob)
	  );

  sprintbitarray(MOB_FLAGS(mob), action_bits, AF_ARRAY_MAX, flags);
  sprintbitarray(AFF_FLAGS(mob), affected_bits, AF_ARRAY_MAX, flag2);
  write_to_output(d,
	  "%s6%s) Position  : %s%s\r\n"
	  "%s7%s) Default   : %s%s\r\n"
	  "%s8%s) Attack    : %s%s\r\n"
      "%s9%s) Stats Menu...\r\n"
	  "%sA%s) NPC Flags : %s%s\r\n"
	  "%sB%s) AFF Flags : %s%s\r\n"
          "%sS%s) Script    : %s%s\r\n"
          "%sW%s) Copy mob\r\n"
	  "%sX%s) Delete mob\r\n"
	  "%sQ%s) Quit\r\n"
	  "Enter choice : ",

	  grn, nrm, yel, position_types[(int)GET_POS(mob)],
	  grn, nrm, yel, position_types[(int)GET_DEFAULT_POS(mob)],
	  grn, nrm, yel, attack_hit_text[(int)GET_ATTACK(mob)].singular,
	  grn, nrm,
	  grn, nrm, cyn, flags,
	  grn, nrm, cyn, flag2,
          grn, nrm, cyn, OLC_SCRIPT(d) ?"Set.":"Not Set.",
          grn, nrm,
	  grn, nrm,
	  grn, nrm
	  );

  OLC_MODE(d) = MEDIT_MAIN_MENU;
}
コード例 #8
0
ファイル: hedit.c プロジェクト: tbjers/arcanerealms
/*
 * Display main menu.
 */
void hedit_disp_menu(struct descriptor_data *d)
{
	struct house_data *house;
	char *name;

	house = OLC_HOUSE(d);
	get_char_colors(d->character);

	if ((name = get_name_by_id(H_OWNER(house))) == NULL)
		name = str_dup("nobody");
	else
		name = str_dup(get_name_by_id(H_OWNER(house)));

	clear_screen(d);
	write_to_output(d, TRUE,
		"-- House Number : [%s%d%s]\r\n"
		"%s0%s) Owner                 : %s%s\r\n"
		"%s1%s) Atrium                : [%s%d%s] %s%s\r\n"
		"%s2%s) Exit                  : [%s%d%s] %s%s\r\n"
		"%s3%s) House type            : %s%s\r\n"
		"%s4%s) Prune-safe            : %s%s\r\n"
		"%s5%s) Cost                  : [%s%d%s]\r\n"
		"%s6%s) Max Secure containers : [%s%d%s]\r\n"
		"%s7%s) Max Locked-down objs  : [%s%d%s]\r\n"
		"%sR%s) Rooms Menu\r\n"
		"%sC%s) Co-Owners Menu\r\n"
		"%sG%s) Guests Menu\r\n"
		"%sD%s) Delete this house\r\n"
		"%sQ%s) Quit\r\n"
		"Enter Choice : ",
		cyn, OLC_NUM(d), nrm,
		grn, nrm, yel, CAP(name),
		grn, nrm, cyn, real_room(H_ATRIUM(house)) == NOWHERE ? -1 : world[real_room(H_ATRIUM(house))].number,
		nrm, yel, real_room(H_ATRIUM(house)) == NOWHERE ? "Nowhere" : world[real_room(H_ATRIUM(house))].name,
		grn, nrm, cyn, H_EXIT(house) < 0 || H_EXIT(house) >= NUM_OF_DIRS ? -1 : H_EXIT(house),
		nrm, yel, H_EXIT(house) < 0 || H_EXIT(house) >= NUM_OF_DIRS ? "Nowhere" : dirs[H_EXIT(house)],
		grn, nrm, cyn, house_types[H_MODE(house)],
		grn, nrm, cyn, YESNO(H_PRUNE_SAFE(house)),
		grn, nrm, cyn, H_COST(house), nrm,
		grn, nrm, cyn, H_MAX_SECURE(house), nrm,
		grn, nrm, cyn, H_MAX_LOCKED(house), nrm,
		grn, nrm,
		grn, nrm,
		grn, nrm,
		grn, nrm,
		grn, nrm
	);

	release_buffer(name);

	OLC_MODE(d) = HEDIT_MAIN_MENU;
}
コード例 #9
0
ファイル: wedit.c プロジェクト: DalilaMud/Dalila-Mud
/*
 * The main menu.
 */
void wedit_disp_menu(struct descriptor_data *d)
{
  struct wild_data *wild;

  get_char_cols(d->character);
  wild = OLC_WILD(d);

  sprinttype(wild->color,             colori,       buf1);
  sprintbit((long)wild->room_flags,        room_bits,    buf2);
  sprintf(buf,
#if defined(CLEAR_SCREEN)
	  ""
#endif
	  "-- Wild Type number : [%s%d%s]\r\n"
	  "%s1%s) Name               : %s%s\r\n"
	  "%s2%s) Description        :\r\n%s%s"
          "%s3%s) Symbol             : %s%c\r\n"
	  "%s4%s) Color              : %s%s\r\n"
	  "%s5%s) Room flags         : %s%s\r\n",

	  cyn, OLC_NUM(d), nrm,
	  grn, nrm, yel, wild->name,
	  grn, nrm, yel, wild->description,
          grn, nrm, (wild->color > 1 ? color_from_color(d->character, wild->color) : nrm), wild->symbol,
          grn, nrm, (wild->color > 1 ? color_from_color(d->character, wild->color) : nrm), buf1,
	  grn, nrm, cyn, buf2
          );

  send_to_char(buf, d->character);

  sprinttype(wild->sector_type, sector_types, buf1);
  sprintf(buf,
	  "%s6%s) Sector type        : %s%s\r\n"
	  "%s7%s) Movement cost      : %s%d\r\n"
	  "%s8%s) Altitudine         : %s%d\r\n"
	  "%s9%s) Can enter into     : %s%s\r\n"
	  "%sA%s) Owner:             : %s%d\r\n"
	  "%sQ%s) Quit\r\n"
	  "Enter choice : ",

	  grn, nrm, cyn, buf1,
	  grn, nrm, cyn, wild->move_cost,
	  grn, nrm, cyn, wild->altitudine,
	  grn, nrm, cyn, wild->can_enter ? "YES" : "NO",
	  grn, nrm, cyn, wild->owner,
          grn, nrm
          );

  send_to_char(buf, d->character);

  OLC_MODE(d) = WEDIT_MAIN_MENU;
}
コード例 #10
0
ファイル: dg_olc.c プロジェクト: bigmac12/Mac-s-CWG
/* save the zone's triggers to internal memory and to disk */
void trigedit_save(struct descriptor_data *d)
{
  int i;
  trig_rnum rnum;
  int found = 0;
  char *s;
  trig_data *proto;
  trig_data *trig = OLC_TRIG(d);
  trig_data *live_trig;
  struct cmdlist_element *cmd, *next_cmd;
  struct index_data **new_index;
  struct descriptor_data *dsc;
  FILE *trig_file;
  int zone, top;
  char buf[MAX_CMD_LENGTH];
  char bitBuf[MAX_INPUT_LENGTH];
  char fname[MAX_INPUT_LENGTH];

  if ((rnum = real_trigger(OLC_NUM(d))) != NOTHING) {
    proto = trig_index[rnum]->proto;
    for (cmd = proto->cmdlist; cmd; cmd = next_cmd) { 
      next_cmd = cmd->next;
      if (cmd->cmd)
        free(cmd->cmd);
      free(cmd);
    }


    free(proto->arglist);
    free(proto->name);

    /* Recompile the command list from the new script */
    s = OLC_STORAGE(d);
 
    CREATE(trig->cmdlist, struct cmdlist_element, 1);
    if (s) {
      char *t = strtok(s, "\n\r"); /* strtok returns NULL if s is "\r\n" */
      if (t)
        trig->cmdlist->cmd = strdup(t);
      else
        trig->cmdlist->cmd = strdup("* No script");

      cmd = trig->cmdlist;
      while ((s = strtok(NULL, "\n\r"))) {
        CREATE(cmd->next, struct cmdlist_element, 1);
        cmd = cmd->next;
        cmd->cmd = strdup(s);
      }
    } else 
コード例 #11
0
ファイル: medit.c プロジェクト: vedicveko/Aarait
/*
 * Save new/edited mob to memory.
 */
void medit_save_internally(struct descriptor_data *d)
{
  int i;
  mob_rnum new_rnum;
  struct descriptor_data *dsc;

  i = (real_mobile(OLC_NUM(d)) == NOBODY);

  if ((new_rnum = add_mobile(OLC_MOB(d), OLC_NUM(d))) < 0) {
    log("medit_save_internally: add_object failed.");
    return;
  }

  if (!i)	/* Only renumber on new mobiles. */
    return;

  /*
   * Update keepers in shops being edited and other mobs being edited.
   */
  for (dsc = descriptor_list; dsc; dsc = dsc->next) {
    if (STATE(dsc) == CON_SEDIT)
      S_KEEPER(OLC_SHOP(dsc)) += (S_KEEPER(OLC_SHOP(dsc)) >= new_rnum);
    else if (STATE(dsc) == CON_MEDIT)
      GET_MOB_RNUM(OLC_MOB(dsc)) += (GET_MOB_RNUM(OLC_MOB(dsc)) >= new_rnum);
  }

  /*
   * Update other people in zedit too. From: C.Raehl 4/27/99
   */
  for (dsc = descriptor_list; dsc; dsc = dsc->next)
    if (STATE(dsc) == CON_ZEDIT)
      for (i = 0; OLC_ZONE(dsc)->cmd[i].command != 'S'; i++)
        if (OLC_ZONE(dsc)->cmd[i].command == 'M')
          if (OLC_ZONE(dsc)->cmd[i].arg1 >= new_rnum)
            OLC_ZONE(dsc)->cmd[i].arg1++;
}
コード例 #12
0
ファイル: zedit.c プロジェクト: vedicveko/Aarait
/*
 * the main menu 
 */
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));

  /*
   * Menu header  
   */
  sprintf(buf,
	  "Room number: %s%d%s		Room zone: %s%d\r\n"
	  "%sZ%s) Zone name   : %s%s\r\n"
	  "%sL%s) Lifespan    : %s%d minutes\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)->name ? OLC_ZONE(d)->name : "<NONE!>",
	  grn, nrm, yel, OLC_ZONE(d)->lifespan,
	  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
	  );

  /*
   * Print the commands for this room into display buffer.
   */
  while (MYCMD.command != 'S') {
    /*
     * Translate what the command means.
     */
    switch (MYCMD.command) {
    case 'M':
      sprintf(buf2, "%sLoad %s [%s%d%s], Max : %d, Percent: %d",
              MYCMD.if_flag ? " then " : "",
              mob_proto[MYCMD.arg1].player.short_descr, cyn,
              mob_index[MYCMD.arg1].vnum, yel, MYCMD.arg2, MYCMD.arg4
              );
      break;
    case 'G':
      sprintf(buf2, "%sGive it %s [%s%d%s], Max : %d, Percent: %d",
	      MYCMD.if_flag ? " then " : "",
	      obj_proto[MYCMD.arg1].short_description,
	      cyn, obj_index[MYCMD.arg1].vnum, yel,
	      MYCMD.arg2, MYCMD.arg4
	      );
      break;
    case 'O':
      sprintf(buf2, "%sLoad %s [%s%d%s], Max : %d, Percent: %d",
	      MYCMD.if_flag ? " then " : "",
	      obj_proto[MYCMD.arg1].short_description,
	      cyn, obj_index[MYCMD.arg1].vnum, yel,
	      MYCMD.arg2, MYCMD.arg4
	      );
      break;
    case 'E':
      sprintf(buf2, "%sEquip with %s [%s%d%s], %s, Max : %d, Percent: %d",
	      MYCMD.if_flag ? " then " : "",
	      obj_proto[MYCMD.arg1].short_description,
	      cyn, obj_index[MYCMD.arg1].vnum, yel,
	      equipment_types[MYCMD.arg3],
	      MYCMD.arg2, MYCMD.arg4
	      );
      break;
    case 'P':
      sprintf(buf2, "%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':
      sprintf(buf2, "%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':
      sprintf(buf2, "%sSet door %s as %s.",
	      MYCMD.if_flag ? " then " : "",
	      dirs[MYCMD.arg2],
	      MYCMD.arg3 ? ((MYCMD.arg3 == 1) ? "closed" : "locked") : "open"
	      );
      break;
    default:
      strcpy(buf2, "<Unknown Command>");
      break;
    }
    /*
     * Build the display buffer for this command  
     */
    sprintf(buf1, "%s%d - %s%s\r\n", nrm, counter++, yel, buf2);
    strcat(buf, buf1);
    subcmd++;
  }
  /*
   * Finish off menu  
   */
  sprintf(buf1,
	  "%s%d - <END OF LIST>\r\n"
	  "%sN%s) 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
	  );

  strcat(buf, buf1);
  SEND_TO_Q(buf, d);

  OLC_MODE(d) = ZEDIT_MAIN_MENU;
}
コード例 #13
0
ファイル: zedit.c プロジェクト: vedicveko/Aarait
/*
 * Save all the information in the player's temporary buffer back into
 * the current zone table.
 */
void zedit_save_internally(struct descriptor_data *d)
{
  int	mobloaded = FALSE,
	objloaded = FALSE,
	subcmd = 0,
	room_num = real_room(OLC_NUM(d));

  remove_room_zone_commands(OLC_ZNUM(d), room_num);

  /*
   * Now add all the entries in the players descriptor list  
   */
  for (subcmd = 0; MYCMD.command != 'S'; subcmd++) {
    add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, subcmd);

    /*
     * Since Circle does not keep track of what rooms the 'G', 'E', and
     * '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.
     * C.Raehl 4/27/99
     */
    switch (MYCMD.command) {
      case 'M':
        mobloaded = TRUE;
        break;
      case 'G':
      case 'E':
        if (mobloaded)
          break;
        SEND_TO_Q("Equip/Give command not saved since no mob was loaded first.\r\n", d);
        remove_cmd_from_list(&(OLC_ZONE(d)->cmd), subcmd);
        break;
      case 'O':
        objloaded = TRUE;
        break;
      case 'P':
        if (objloaded)
          break;
        SEND_TO_Q("Put command not saved since another object was not loaded first.\r\n", d);
        remove_cmd_from_list(&(OLC_ZONE(d)->cmd), subcmd);
        break;
      default:
        mobloaded = objloaded = FALSE;
        break;
    }
  }

  /*
   * Finally, if zone headers have been changed, copy over  
   */
  if (OLC_ZONE(d)->number) {
    free(zone_table[OLC_ZNUM(d)].name);
    zone_table[OLC_ZNUM(d)].name = str_dup(OLC_ZONE(d)->name);
    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);
}
コード例 #14
0
ファイル: dg_olc.c プロジェクト: bigmac12/Mac-s-CWG
void trigedit_parse(struct descriptor_data *d, char *arg)
{
  int i = 0;

  switch (OLC_MODE(d)) {
    case TRIGEDIT_MAIN_MENU:
     switch (tolower(*arg)) {
       case 'q':
         if (OLC_VAL(d)) { /* Anything been changed? */
           if (!GET_TRIG_TYPE(OLC_TRIG(d))) {
             write_to_output(d, "Invalid Trigger Type! Answer a to abort quit!\r\n");
           }
           write_to_output(d, "Do you wish to save your changes? : ");
           OLC_MODE(d) = TRIGEDIT_CONFIRM_SAVESTRING;
         } else
           cleanup_olc(d, CLEANUP_ALL);
           return;
         case '1':
           OLC_MODE(d) = TRIGEDIT_NAME;
           write_to_output(d, "Name: ");
           break;
         case '2':
           OLC_MODE(d) = TRIGEDIT_INTENDED;
           write_to_output(d, "0: Mobiles, 1: Objects, 2: Rooms: ");
           break;
         case '3':
           OLC_MODE(d) = TRIGEDIT_TYPES;
           trigedit_disp_types(d);
           break;
         case '4':
           OLC_MODE(d) = TRIGEDIT_NARG;
           write_to_output(d, "Numeric argument: ");
           break;
         case '5':
           OLC_MODE(d) = TRIGEDIT_ARGUMENT;
           write_to_output(d, "Argument: ");
           break;
         case '6':
           OLC_MODE(d) = TRIGEDIT_COMMANDS;
           write_to_output(d, "Enter trigger commands: (/s saves /h for help)\r\n\r\n");
           d->backstr = NULL;
           if (OLC_STORAGE(d)) {
             write_to_output(d, "%s", OLC_STORAGE(d));
             d->backstr = strdup(OLC_STORAGE(d));
           }
           d->str = &OLC_STORAGE(d);
           d->max_str = MAX_CMD_LENGTH;
           d->mail_to = 0;
           OLC_VAL(d) = 1;

           break;
         default:
           trigedit_disp_menu(d);
           return;
     }
     return;
    
    case TRIGEDIT_CONFIRM_SAVESTRING:
      switch(tolower(*arg)) {
        case 'y':
          trigedit_save(d);
          mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE,
                 "OLC: %s edits trigger %d", GET_NAME(d->character),
                 OLC_NUM(d));
          /* fall through */
        case 'n':
          cleanup_olc(d, CLEANUP_ALL);
          return;
        case 'a': /* abort quitting */
          break;
        default:
          write_to_output(d, "Invalid choice!\r\n");
          write_to_output(d, "Do you wish to save the trigger? : ");
          return;
      }
      break;

    case TRIGEDIT_NAME:
      smash_tilde(arg);
      if (OLC_TRIG(d)->name)
        free(OLC_TRIG(d)->name);
      OLC_TRIG(d)->name = strdup((arg && *arg) ? arg : "undefined");
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_INTENDED:
      if ((atoi(arg)>=MOB_TRIGGER) || (atoi(arg)<=WLD_TRIGGER))
        OLC_TRIG(d)->attach_type = atoi(arg);
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_NARG:
      OLC_TRIG(d)->narg = LIMIT(atoi(arg), 0, 100);
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_ARGUMENT:
      smash_tilde(arg);
      OLC_TRIG(d)->arglist = (*arg?strdup(arg):NULL);
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_TYPES:
      if ((i = atoi(arg)) == 0)
        break;
      else if (!((i < 0) || (i > NUM_TRIG_TYPE_FLAGS)))
        TOGGLE_BIT((GET_TRIG_TYPE(OLC_TRIG(d))), 1 << (i - 1));
      OLC_VAL(d)++;
      trigedit_disp_types(d);
      return;

    case TRIGEDIT_COMMANDS:
      break;

  }

  OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
  trigedit_disp_menu(d);
}
コード例 #15
0
ファイル: dg_olc.c プロジェクト: tbjers/arcanerealms
/* save the zone's triggers to internal memory and to disk */
void trigedit_save(struct descriptor_data *d)
{
	char *name=NULL;
	char *trgarglist=NULL;
	char *code=NULL;
	int trig_rnum, i;
	int found = 0;
	char *s;
	trig_data *proto;
	trig_data *trig = OLC_TRIG(d);
	trig_data *live_trig;
	struct cmdlist_element *cmd, *next_cmd;
	struct index_data **new_index;
	struct descriptor_data *dsc;
	int zone, top;
	char buf[MAX_CMD_LENGTH];
	char bitBuf[MAX_INPUT_LENGTH];

	char *trg_replace = "REPLACE INTO %s ("
		"znum, "
		"vnum, "
		"name, "
		"attach_type, "
		"flags, "
		"numarg, "
		"arglist, "
		"code) "
		"VALUES (%d, %d, '%s', %d, '%s', %d, '%s', '%s');";

	if ((trig_rnum = real_trigger(OLC_NUM(d))) != -1) {
		proto = trig_index[trig_rnum]->proto;
		for (cmd = proto->cmdlist; cmd; cmd = next_cmd) { 
			next_cmd = cmd->next;
			if (cmd->cmd)
				free(cmd->cmd);
			free(cmd);
		}

		if (proto->arglist)
			free(proto->arglist);
		if (proto->name)
			free(proto->name);

		/* Recompile the command list from the new script */
		s = OLC_STORAGE(d);

		CREATE(trig->cmdlist, struct cmdlist_element, 1);
		trig->cmdlist->cmd = str_dup(strtok(s, "\n\r"));
		cmd = trig->cmdlist;

		while ((s = strtok(NULL, "\n\r"))) {
			CREATE(cmd->next, struct cmdlist_element, 1);
			cmd = cmd->next;
			cmd->cmd = str_dup(s);
		}

		/* make the prorotype look like what we have */
		trig_data_copy(proto, trig);

		/* go through the mud and replace existing triggers         */
		live_trig = trigger_list;
		while (live_trig)
		{
			if (GET_TRIG_RNUM(live_trig) == trig_rnum) {
				if (live_trig->arglist) {
					free(live_trig->arglist);
					live_trig->arglist = NULL;
				}
				if (live_trig->name) {
					free(live_trig->name);
					live_trig->name = NULL;
				}

				if (proto->arglist)
					live_trig->arglist = str_dup(proto->arglist);
				if (proto->name)
					live_trig->name = str_dup(proto->name);

				live_trig->cmdlist = proto->cmdlist;
				live_trig->curr_state = live_trig->cmdlist;
				live_trig->trigger_type = proto->trigger_type;
				live_trig->attach_type = proto->attach_type;
				live_trig->narg = proto->narg;
				live_trig->data_type = proto->data_type;
				live_trig->depth = 0;
				live_trig->wait_event = NULL;
				if (GET_TRIG_WAIT(live_trig))
					event_cancel(GET_TRIG_WAIT(live_trig));
				free_varlist(live_trig->var_list);
			}

			live_trig = live_trig->next_in_world;
		}
	} else {
コード例 #16
0
ファイル: oasis.c プロジェクト: Lundessa/raven3
/* This procedure frees up the strings and/or the structures attatched to a
 * descriptor, sets all flags back to how they should be. */
void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
{
  /* Clean up WHAT? */
  if (d->olc == NULL)
    return;

  /* Check for a room. free_room doesn't perform sanity checks, we must be
   * careful here. */
  if (OLC_ROOM(d)) {
    switch (cleanup_type) {
    case CLEANUP_ALL:
      /* free(OLC_SCRIPT(d)) equivalent */
      free_proto_script(OLC_ROOM(d), WLD_TRIGGER);
      free_room(OLC_ROOM(d));
      break;
    case CLEANUP_STRUCTS:
      free(OLC_ROOM(d));
      break;
    case CLEANUP_CONFIG:
      free_config(OLC_CONFIG(d));
      break;
    default: /* The caller has screwed up. */
      log("SYSERR: cleanup_olc: Unknown type!");
      break;
    }
  }

  /* Check for an existing object in the OLC.  The strings aren't part of the
   * prototype any longer.  They get added with strdup(). */
  if (OLC_OBJ(d)) {
    free_object_strings(OLC_OBJ(d));
    free(OLC_OBJ(d));
  }

  /* Check for a mob.  free_mobile() makes sure strings are not in the
   * prototype. */
  if (OLC_MOB(d))
    free_mobile(OLC_MOB(d));

  /* Check for a zone.  cleanup_type is irrelevant here, free() everything. */
  if (OLC_ZONE(d)) {
    if (OLC_ZONE(d)->builders)
      free(OLC_ZONE(d)->builders);
    if (OLC_ZONE(d)->name)
      free(OLC_ZONE(d)->name);
    if (OLC_ZONE(d)->cmd)
      free(OLC_ZONE(d)->cmd);
    free(OLC_ZONE(d));
  }

  /* Check for a shop.  free_shop doesn't perform sanity checks, we must be
   * careful here. OLC_SHOP(d) is a _copy_ - no pointers to the original. Just
   * go ahead and free it all. */
  if (OLC_SHOP(d))
      free_shop(OLC_SHOP(d));

  /* Check for a quest. */
  if (OLC_QUEST(d)) {
    switch (cleanup_type) {
      case CLEANUP_ALL:
        free_quest(OLC_QUEST(d));
        break;
      case CLEANUP_STRUCTS:
        free(OLC_QUEST(d));
        break;
      default:
        break;
    }
  }

  /*. Check for aedit stuff -- M. Scott */
  if (OLC_ACTION(d))  {
    switch(cleanup_type)  {
      case CLEANUP_ALL:
 	free_action(OLC_ACTION(d));
 	break;
      case CLEANUP_STRUCTS:
        free(OLC_ACTION(d));
        break;
      default:
        /* Caller has screwed up */
 	break;
    }
  }

  /* Used for cleanup of Hedit */
  if (OLC_HELP(d))  {
    switch(cleanup_type)  {
      case CLEANUP_ALL:
 	free_help(OLC_HELP(d));
 	break;
      case CLEANUP_STRUCTS:
        free(OLC_HELP(d));
        break;
      default:
 	break;
    }
  }

   if (OLC_IBT(d)) {
	   free_olc_ibt(OLC_IBT(d));
	   OLC_IBT(d) = NULL;
   }
   
   if (OLC_MSG_LIST(d)) {
     free_message_list(OLC_MSG_LIST(d));
     OLC_MSG_LIST(d) = NULL;  
     OLC_MSG(d) = NULL;
   }

  /* Free storage if allocated (tedit, aedit, and trigedit). This is the command
   * list - it's been copied to disk already, so just free it -Welcor. */
   if (OLC_STORAGE(d)) {
     free(OLC_STORAGE(d));
     OLC_STORAGE(d) = NULL;
   }
   /* Free this one regardless. If we've left olc, we've either made a fresh
    * copy of it in the trig index, or we lost connection. Either way, we need
    * to get rid of this. */
   if (OLC_TRIG(d)) {
     free_trigger(OLC_TRIG(d));
     OLC_TRIG(d) = NULL;
   }

   /* Free this one regardless. If we've left olc, we've either copied the    *
    * preferences to the player, or we lost connection. Either way, we need   *
    * to get rid of this. */
   if(OLC_PREFS(d)) {
     /*. There is nothing else really to free, except this... .*/
     free(OLC_PREFS(d));
     OLC_PREFS(d) = NULL;
   }

   /* OLC_SCRIPT is always set as trig_proto of OLC_OBJ/MOB/ROOM. Therefore it
    * should not be free'd here. */

  /* Restore descriptor playing status. */
  if (d->character) {
    REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);
    act("$n stops using OLC.", TRUE, d->character, NULL, NULL, TO_ROOM);

    if (cleanup_type == CLEANUP_CONFIG)
      mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s stops editing the game configuration", GET_NAME(d->character));
    else if (STATE(d) == CON_TEDIT)
      mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s stops editing text files.", GET_NAME(d->character));
    else if (STATE(d) == CON_HEDIT)
      mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s stops editing help files.", GET_NAME(d->character));
    else if (STATE(d) == CON_ABEDIT)
      mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s stops editing ability %d.", GET_NAME(d->character),OLC_NUM(d));
    else
      mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s stops editing zone %d allowed zone %d", GET_NAME(d->character), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(d->character));

    STATE(d) = CON_PLAYING;
  }

  free(d->olc);
  d->olc = NULL;
}
コード例 #17
0
ファイル: medit.c プロジェクト: vedicveko/Aarait
/*
 * Display main menu.
 */
void medit_disp_menu(struct descriptor_data *d)
{
  struct char_data *mob;

  mob = OLC_MOB(d);
  get_char_colors(d->character);
  clear_screen(d);

  sprintf(buf,
	  "-- Mob Number:  [%s%d%s]\r\n"
	  "%s1%s) Sex: %s%-7.7s%s	         %s2%s) Alias: %s%s\r\n"
	  "%s3%s) S-Desc: %s%s\r\n"
	  "%s4%s) L-Desc:-\r\n%s%s"
	  "%s5%s) D-Desc:-\r\n%s%s"
     "%s6%s) Level:       [%s%4d%s],  %s7%s) Alignment:    [%s%4d%s]\r\n"
     "%s8%s) HR//SKY:      [%s%4d%s],  %s9%s) DR//FD:        [%s%4d%s]\r\n"
     "%sA%s) NumDamDice:  [%s%4d%s],  %sB%s) SizeDamDice:  [%s%4d%s]\r\n"
	  "%sC%s) Num HP Dice: [%s%4d%s],  %sD%s) Size HP Dice: [%s%4d%s],  %sE%s) HP Bonus: [%s%5d%s]\r\n"
	  "%sF%s) Armor Class: [%s%4d%s],  %sG%s) Exp:     [%s%9d%s],  %sH%s) Gold:  [%s%8d%s]\r\n",

	  cyn, OLC_NUM(d), nrm,
	  grn, nrm, yel, genders[(int)GET_SEX(mob)], nrm,
	  grn, nrm, yel, GET_ALIAS(mob),
	  grn, nrm, yel, GET_SDESC(mob),
	  grn, nrm, yel, GET_LDESC(mob),
	  grn, nrm, yel, GET_DDESC(mob),
	  grn, nrm, cyn, GET_LEVEL(mob), nrm,
	  grn, nrm, cyn, GET_ALIGNMENT(mob), nrm,
	  grn, nrm, cyn, GET_HITROLL(mob), nrm,
	  grn, nrm, cyn, GET_DAMROLL(mob), nrm,
	  grn, nrm, cyn, GET_NDD(mob), nrm,
	  grn, nrm, cyn, GET_SDD(mob), nrm,
	  grn, nrm, cyn, GET_HIT(mob), nrm,
	  grn, nrm, cyn, GET_MANA(mob), nrm,
	  grn, nrm, cyn, GET_MOVE(mob), nrm,
	  grn, nrm, cyn, GET_AC(mob), nrm,
	  grn, nrm, cyn, GET_EXP(mob), nrm,
	  grn, nrm, cyn, convert_all_to_copper(mob), nrm
	  );
  SEND_TO_Q(buf, d);

  sprintbit(MOB_FLAGS(mob), action_bits, buf1);
  sprintbit(AFF_FLAGS(mob), affected_bits, buf2);
  sprintf(buf,
	  "%sI%s) Position  : %s%s\r\n"
	  "%sJ%s) Default   : %s%s\r\n"
	  "%sK%s) Attack    : %s%s\r\n"
          "%sN%s) Class     : %s%s\r\n"
          "%sR%s) Race      : %s%s\r\n"
          "%sS%s) Size      : %s%d\r\n"
          "%sW%s) Weight    : %s%d\r\n"
	  "%sL%s) NPC Flags : %s%s\r\n"
	  "%sM%s) AFF Flags : %s%s\r\n"
#if CONFIG_OASIS_MPROG
	  "%sP%s) Mob Progs : %s%s\r\n"
#endif
	  "%sQ%s) Quit\r\n"
	  "Enter choice : ",

	  grn, nrm, yel, position_types[(int)GET_POS(mob)],
	  grn, nrm, yel, position_types[(int)GET_DEFAULT_POS(mob)],
	  grn, nrm, yel, attack_hit_text[GET_ATTACK(mob)].singular,
          grn, nrm, cyn, npc_class_types[(int)GET_CLASS(mob)],
          grn, nrm, cyn, npc_race_types[(int)GET_RACE(mob)],
          grn, nrm, cyn, GET_MOB_SIZE(mob),
          grn, nrm, cyn, GET_MOB_WEIGHT(mob), 
	  grn, nrm, cyn, buf1,
	  grn, nrm, cyn, buf2,
#if CONFIG_OASIS_MPROG
	  grn, nrm, cyn, (OLC_MPROGL(d) ? "Set." : "Not Set."),
#endif
	  grn, nrm
	  );
  SEND_TO_Q(buf, d);

  OLC_MODE(d) = MEDIT_MAIN_MENU;
}
コード例 #18
0
ファイル: hedit.c プロジェクト: tbjers/arcanerealms
/*
 * Should check more things.
 */
void hedit_save_internally(struct descriptor_data *d)
{
	OLC_HOUSE(d)->vnum = OLC_NUM(d);
	add_house(OLC_HOUSE(d));
}
コード例 #19
0
ファイル: medit.c プロジェクト: axanon/tbamud
/* Display main menu. */
static void medit_disp_stats_menu(struct descriptor_data *d)
{
  struct char_data *mob;
  char buf[MAX_STRING_LENGTH];

  mob = OLC_MOB(d);
  get_char_colors(d->character);
  clear_screen(d);

  /* Color codes have to be used here, for count_color_codes to work */
  sprintf(buf, "(range \ty%d\tn to \ty%d\tn)", GET_HIT(mob) + GET_MOVE(mob), (GET_HIT(mob) * GET_MANA(mob)) + GET_MOVE(mob));

  /* Top section - standard stats */
  write_to_output(d,
  "-- Mob Number:  %s[%s%d%s]%s\r\n"
  "(%s1%s) Level:       %s[%s%4d%s]%s\r\n"
  "(%s2%s) %sAuto Set Stats (based on level)%s\r\n\r\n"
  "Hit Points  (xdy+z):        Bare Hand Damage (xdy+z): \r\n"
  "(%s3%s) HP NumDice:  %s[%s%5d%s]%s    (%s6%s) BHD NumDice:  %s[%s%5d%s]%s\r\n"
  "(%s4%s) HP SizeDice: %s[%s%5d%s]%s    (%s7%s) BHD SizeDice: %s[%s%5d%s]%s\r\n"
  "(%s5%s) HP Addition: %s[%s%5d%s]%s    (%s8%s) DamRoll:      %s[%s%5d%s]%s\r\n"
  "%-*s(range %s%d%s to %s%d%s)\r\n\r\n"

  "(%sA%s) Armor Class: %s[%s%4d%s]%s        (%sD%s) Hitroll:   %s[%s%5d%s]%s\r\n"
  "(%sB%s) Exp Points:  %s[%s%10d%s]%s  (%sE%s) Alignment: %s[%s%5d%s]%s\r\n"
  "(%sC%s) Gold:        %s[%s%10d%s]%s\r\n\r\n",
      cyn, yel, OLC_NUM(d), cyn, nrm,
      cyn, nrm, cyn, yel, GET_LEVEL(mob), cyn, nrm,
      cyn, nrm, cyn, nrm,
      cyn, nrm, cyn, yel, GET_HIT(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_NDD(mob), cyn, nrm,
      cyn, nrm, cyn, yel, GET_MANA(mob), cyn, nrm,  cyn, nrm, cyn, yel, GET_SDD(mob), cyn, nrm,
      cyn, nrm, cyn, yel, GET_MOVE(mob), cyn, nrm,  cyn, nrm, cyn, yel, GET_DAMROLL(mob), cyn, nrm,

      count_color_chars(buf)+28, buf,
      yel, GET_NDD(mob) + GET_DAMROLL(mob), nrm,
      yel, (GET_NDD(mob) * GET_SDD(mob)) + GET_DAMROLL(mob), nrm,

      cyn, nrm, cyn, yel, GET_AC(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_HITROLL(mob), cyn, nrm,
      cyn, nrm, cyn, yel, GET_EXP(mob), cyn, nrm,  cyn, nrm, cyn, yel, GET_ALIGNMENT(mob), cyn, nrm,
      cyn, nrm, cyn, yel, GET_GOLD(mob), cyn, nrm
      );

  if (CONFIG_MEDIT_ADVANCED) {
    /* Bottom section - non-standard stats, togglable in cedit */
    write_to_output(d,
    "(%sF%s) Str: %s[%s%2d/%3d%s]%s   Saving Throws\r\n"
    "(%sG%s) Int: %s[%s%3d%s]%s      (%sL%s) Paralysis     %s[%s%3d%s]%s\r\n"
    "(%sH%s) Wis: %s[%s%3d%s]%s      (%sM%s) Rods/Staves   %s[%s%3d%s]%s\r\n"
    "(%sI%s) Dex: %s[%s%3d%s]%s      (%sN%s) Petrification %s[%s%3d%s]%s\r\n"
    "(%sJ%s) Con: %s[%s%3d%s]%s      (%sO%s) Breath        %s[%s%3d%s]%s\r\n"
    "(%sK%s) Cha: %s[%s%3d%s]%s      (%sP%s) Spells        %s[%s%3d%s]%s\r\n\r\n",
        cyn, nrm, cyn, yel, GET_STR(mob), GET_ADD(mob), cyn, nrm,
        cyn, nrm, cyn, yel, GET_INT(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_PARA), cyn, nrm,
        cyn, nrm, cyn, yel, GET_WIS(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_ROD), cyn, nrm,
        cyn, nrm, cyn, yel, GET_DEX(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_PETRI), cyn, nrm,
        cyn, nrm, cyn, yel, GET_CON(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_BREATH), cyn, nrm,
        cyn, nrm, cyn, yel, GET_CHA(mob), cyn, nrm,   cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_SPELL), cyn, nrm
        );
  }

  /* Quit to previous menu option */
  write_to_output(d, "(%sQ%s) Quit to main menu\r\nEnter choice : ", cyn, nrm);

  OLC_MODE(d) = MEDIT_STATS_MENU;
}
コード例 #20
0
ファイル: wedit.c プロジェクト: DalilaMud/Dalila-Mud
void wedit_save_internally(struct descriptor_data *d)
{
  int i, wild_num, found = 0;
  int x,y;
  int zone;
  room_rnum number;
  struct wild_data *new_wild_table;

  wild_num = real_wild_table(OLC_NUM(d));
  /*
   * Wild_Element exists: move contents over then free and replace it.
   */
  if (wild_num > 0)
    {
    free_wild(wild_table + wild_num);
    wild_table[wild_num] = *OLC_WILD(d);
    for ( zone = 0; zone <= top_of_zone_table; zone++)
      {
      if (zone_table[zone].wilderness == ZONE_WILDERNESS)
        {
        for ( x=WILD_RXOR; x<=WILD_RXEN; x++)
          for ( y=WILD_RYOR; y<WILD_RYEN; y++)
            if ( (number=real_room(WILD_VNUM(x,y)))>0 && world[number].wild_rnum==wild_num && world[number].wild_modif==FALSE)
              {
              world[number].name=wild_table[wild_num].name;
              world[number].description=wild_table[wild_num].description;
              world[number].sector_type=wild_table[wild_num].sector_type;
              world[number].room_flags=wild_table[wild_num].room_flags;
              }
        }
      else if (zone_table[zone].wilderness == ZONE_MINIWILD)
        {
        for ( x=MINIWILD_RXOR; x<=MINIWILD_RXEN; x++)
          for ( y=MINIWILD_RYOR; y<MINIWILD_RYEN; y++)
            if ( (number=real_room(MINIWILD_VNUM(zone,x,y)))>0 && world[number].wild_rnum == wild_num && world[number].wild_modif==FALSE)
              {
              world[number].name=wild_table[wild_num].name;
              world[number].description=wild_table[wild_num].description;
              world[number].sector_type=wild_table[wild_num].sector_type;
              world[number].room_flags=wild_table[wild_num].room_flags;
              }
        }
      }
    }
  else               /* Wild_element doesn't exist, add it. */
    {
    CREATE(new_wild_table, struct wild_data, top_of_wild_table + 2);

    /*
     * Count through wild_table.
     */
    for (i = 0; i <= top_of_wild_table; i++)
      {
      if (!found)
        {
	/*
	 * Is this the place? 
	 */
	if (wild_table[i].index > OLC_NUM(d))
          {
	  found = TRUE;
	  new_wild_table[i] = *(OLC_WILD(d));
	  new_wild_table[i].index = OLC_NUM(d);
	  wild_num = i;

	  /*
	   * Copy from world to new_world + 1.
	   */
	  new_wild_table[i + 1] = wild_table[i];

	  /*
	   * Update all wilderness rooms pointing to a new wild_rnum.
	   */
	  }
        else	/* Not yet placed, copy straight over. */
          new_wild_table[i] = wild_table[i];
        }
      else              /* Already been found. */
	new_wild_table[i + 1] = wild_table[i];
      }

    if (!found)        /* Still not found, insert at top of table. */
      {
      new_wild_table[i] = *(OLC_WILD(d));
      new_wild_table[i].index = OLC_NUM(d);
      wild_num = i;
      }

    /*
     * Update wilderness/miniwild room wild_rnum.
     */
    for ( zone =0; zone <= top_of_zone_table; zone++)
      {
      if (zone_table[zone].wilderness == ZONE_WILDERNESS)
        {
        for ( x=WILD_RXOR; x<=WILD_RXEN; x++)
          for ( y=WILD_RYOR; y<WILD_RYEN; y++)
            if ( (number=real_room(WILD_VNUM(x,y)))>0 && world[number].wild_rnum > wild_num )
              world[number].wild_rnum ++;
        }
      else if (zone_table[zone].wilderness == ZONE_MINIWILD)
        {
        for ( x=MINIWILD_RXOR; x<=MINIWILD_RXEN; x++)
          for ( y=MINIWILD_RYOR; y<MINIWILD_RYEN; y++)
            if ( (number=real_room(MINIWILD_VNUM(zone,x,y)))>0 && world[number].wild_rnum > wild_num )
              world[number].wild_rnum ++;
        }
      }
    /*
     * Copy wild table over to new one.
     */
    free(wild_table);
    wild_table = new_wild_table;
    top_of_wild_table++;
  }
  
  kill_all_events();
  olc_add_to_save_list(WILD_ZONE, OLC_SAVE_WILD); 
}
コード例 #21
0
ファイル: wedit.c プロジェクト: DalilaMud/Dalila-Mud
void wedit_parse(struct descriptor_data *d, char *arg)
{
  int number  ;

  switch (OLC_MODE(d))
    {
    case WEDIT_CONFIRM_SAVESTRING:
      switch (*arg)
        {
        case 'y':
        case 'Y':
          wedit_save_internally(d);
          sprintf(buf, "OLC: %s edits wild element %d.", GET_NAME(d->character), OLC_NUM(d));
          mudlog(buf, CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE);
          /*
           * Do NOT free strings! Just the wild element structure. 
           */
          cleanup_olc(d, CLEANUP_STRUCTS);
          send_to_char("Wild element saved to memory.\r\n", d->character);
          break;
        case 'n':
        case 'N':
          /*
           * Free everything up, including strings, etc.
           */
          cleanup_olc(d, CLEANUP_ALL);
          break;
        default:
          send_to_char("Invalid choice!\r\nDo you wish to save this wild element internally? : ", d->character);
          break;
        }
      return;

    case WEDIT_MAIN_MENU:
      switch (*arg)
        {
        case 'q':
        case 'Q':
          if (OLC_VAL(d))    /* Something has been modified. */
            {
	    send_to_char("Do you wish to save this wild element internally? : ", d->character);
	    OLC_MODE(d) = WEDIT_CONFIRM_SAVESTRING;
            }
          else cleanup_olc(d, CLEANUP_ALL);
          return;
        case '1':
          send_to_char("Enter wild type name:-\r\n] ", d->character);
          OLC_MODE(d) = WEDIT_NAME;
          break;
        case '2':
          OLC_MODE(d) = WEDIT_DESC;
#if defined(CLEAR_SCREEN)
          SEND_TO_Q("\x1B[H\x1B[J", d);
#endif
          SEND_TO_Q("Enter wild type description: (/s saves /h for help)\r\n\r\n", d);
          d->backstr = NULL;
          if (OLC_WILD(d)->description)
            {
	    SEND_TO_Q(OLC_WILD(d)->description, d);
	    d->backstr = str_dup(OLC_WILD(d)->description);
            }
          d->str = &OLC_WILD(d)->description;
          d->max_str = MAX_ROOM_DESC;
          d->mail_to = 0;
          OLC_VAL(d)=1;
          break;
        case '3':
          send_to_char("Enter wild type symbol: \r\n", d->character);
          OLC_MODE(d) = WEDIT_SYMBOL;
          break;
        case '4':
          wedit_disp_color_menu(d);
          break;
        case '5':
          wedit_disp_flag_menu(d);
          break;
        case '6':
          wedit_disp_sector_menu(d);
          break;
        case '7':
          send_to_char("Enter wild type movement cost: \r\n", d->character);
          OLC_MODE(d) = WEDIT_MOVE_COST;
          break;
        case '8':
          send_to_char("Enter wild type altitudine: \r\n", d->character);
          OLC_MODE(d) = WEDIT_ALTITUDINE;
          break;
        case '9':
          if (OLC_WILD(d)->can_enter==TRUE) OLC_WILD(d)->can_enter=FALSE;
          else OLC_WILD(d)->can_enter=TRUE;
          OLC_VAL(d) = 1;
          wedit_disp_menu(d);
          break;
        case 'a':
        case 'A':
          send_to_char("This hasn't been implemented yet\r\n", d->character);
          wedit_disp_menu(d);
          break;
        default:
          send_to_char("Invalid choice!\r\n", d->character);
          wedit_disp_menu(d);
          break;
        }
      return;

    case WEDIT_NAME:
      if (OLC_WILD(d)->name)
      free(OLC_WILD(d)->name);
      if (strlen(arg) > MAX_ROOM_NAME)
        arg[MAX_ROOM_NAME - 1] = '\0';
      OLC_WILD(d)->name = str_dup((arg && *arg) ? arg : "undefined");
      break;

    case WEDIT_DESC:
      /*
       * We will NEVER get here, we hope.
       */
      mudlog("SYSERR: Reached WEDIT_DESC case in parse_wedit", BRF, LVL_BUILDER, TRUE);
      break;

    case WEDIT_SYMBOL:
      if (!*arg)
        {
        send_to_char("Invalid choice!", d->character);
        wedit_disp_menu(d);
        return;
        }
      else OLC_WILD(d)->symbol = *arg;
      break;

    case WEDIT_COLOR:
      number = atoi(arg);
      if (number < 1 || number > NUM_WILD_COLOR)
        {
        send_to_char("Invalid choice!", d->character);
        wedit_disp_color_menu(d);
        return;
        }
      else OLC_WILD(d)->color = number;
      break;

    case WEDIT_FLAGS:
      number = atoi(arg);
      if ((number < 0) || (number > NUM_ROOM_FLAGS))
        {
        send_to_char("That is not a valid choice!\r\n", d->character);
        wedit_disp_flag_menu(d);
        }
      else if (number == 0) break;
      else 
        {
        /*
         * Toggle the bit.
         */
        TOGGLE_BIT(OLC_WILD(d)->room_flags, 1 << (number - 1));
        wedit_disp_flag_menu(d);
        }
      return;

    case WEDIT_SECTOR:
      number = atoi(arg);
      if (number < 0 || number >= NUM_ROOM_SECTORS)
        {
        send_to_char("Invalid choice!", d->character);
        wedit_disp_sector_menu(d);
        return;
        }
      else OLC_WILD(d)->sector_type = number;
      break;

    case WEDIT_MOVE_COST:
      number = atoi(arg);
      if (number < 1 || number > MAX_WILD_MOVE_COST)
        {
        send_to_char("Invalid choice!", d->character);
        wedit_disp_menu(d);
        return;
        }
      else OLC_WILD(d)->move_cost = number;
      break;

    case WEDIT_ALTITUDINE:
      number = atoi(arg);
      if (number < 1 || number > MAX_WILD_ALTITUDINE)
        {
        send_to_char("Invalid choice!", d->character);
        wedit_disp_menu(d);
        return;
        }
      else OLC_WILD(d)->altitudine = number;
      break;

    default:
      /*
       * We should never get here.
       */
      mudlog("SYSERR: Reached default case in parse_wedit", BRF, LVL_BUILDER, TRUE);
      break;
    }
  
  /*
   * If we get this far, something has been changed.
   */
  OLC_VAL(d) = 1;
  wedit_disp_menu(d);
}
コード例 #22
0
ファイル: sedit.c プロジェクト: bigmac12/Mac-s-CWG
void sedit_parse(struct descriptor_data *d, char *arg)
{
  int i;

  if (OLC_MODE(d) > SEDIT_NUMERICAL_RESPONSE) {
    if (!isdigit(arg[0]) && ((*arg == '-') && (!isdigit(arg[1])))) {
      write_to_output(d, "Field must be numerical, try again : ");
      return;
    }
  }
  switch (OLC_MODE(d)) {
/*-------------------------------------------------------------------*/
  case SEDIT_CONFIRM_SAVESTRING:
    switch (*arg) {
    case 'y':
    case 'Y':
      sedit_save_internally(d);
      mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE,
        "OLC: %s edits shop %d", GET_NAME(d->character), OLC_NUM(d));
      if (CONFIG_OLC_SAVE) {
      sedit_save_to_disk(real_zone_by_thing(OLC_NUM(d)));
      write_to_output(d, "Shop saved to disk.\r\n");
      } else
      write_to_output(d, "Shop saved to memory.\r\n");
      cleanup_olc(d, CLEANUP_STRUCTS);
      return;
    case 'n':
    case 'N':
      cleanup_olc(d, CLEANUP_ALL);
      return;
    default:
      write_to_output(d, "Invalid choice!\r\nDo you wish to save your changes? : ");
      return;
    }
    break;

/*-------------------------------------------------------------------*/
  case SEDIT_MAIN_MENU:
    i = 0;
    switch (*arg) {
    case 'q':
    case 'Q':
      if (OLC_VAL(d)) {		/* Anything been changed? */
        write_to_output(d, "Do you wish to save your changes? : ");
	OLC_MODE(d) = SEDIT_CONFIRM_SAVESTRING;
      } else
	cleanup_olc(d, CLEANUP_ALL);
      return;
    case '0':
      OLC_MODE(d) = SEDIT_KEEPER;
      write_to_output(d, "Enter vnum number of shop keeper : ");
      return;
    case '1':
      OLC_MODE(d) = SEDIT_OPEN1;
      i++;
      break;
    case '2':
      OLC_MODE(d) = SEDIT_CLOSE1;
      i++;
      break;
    case '3':
      OLC_MODE(d) = SEDIT_OPEN2;
      i++;
      break;
    case '4':
      OLC_MODE(d) = SEDIT_CLOSE2;
      i++;
      break;
    case '5':
      OLC_MODE(d) = SEDIT_BUY_PROFIT;
      i++;
      break;
    case '6':
      OLC_MODE(d) = SEDIT_SELL_PROFIT;
      i++;
      break;
    case '7':
      OLC_MODE(d) = SEDIT_NOITEM1;
      i--;
      break;
    case '8':
      OLC_MODE(d) = SEDIT_NOITEM2;
      i--;
      break;
    case '9':
      OLC_MODE(d) = SEDIT_NOCASH1;
      i--;
      break;
    case 'a':
    case 'A':
      OLC_MODE(d) = SEDIT_NOCASH2;
      i--;
      break;
    case 'b':
    case 'B':
      OLC_MODE(d) = SEDIT_NOBUY;
      i--;
      break;
    case 'c':
    case 'C':
      OLC_MODE(d) = SEDIT_BUY;
      i--;
      break;
    case 'd':
    case 'D':
      OLC_MODE(d) = SEDIT_SELL;
      i--;
      break;
    case 'e':
    case 'E':
      sedit_no_trade_menu(d);
      return;
    case 'f':
    case 'F':
      sedit_shop_flags_menu(d);
      return;
    case 'r':
    case 'R':
      sedit_rooms_menu(d);
      return;
    case 'p':
    case 'P':
      sedit_products_menu(d);
      return;
    case 't':
    case 'T':
      sedit_namelist_menu(d);
      return;
    default:
      sedit_disp_menu(d);
      return;
    }

    if (i == 0)
      break;
    else if (i == 1)
      write_to_output(d, "\r\nEnter new value : ");
    else if (i == -1)
      write_to_output(d, "\r\nEnter new text :\r\n] ");
    else
      write_to_output(d, "Oops...\r\n");
    return;
/*-------------------------------------------------------------------*/
  case SEDIT_NAMELIST_MENU:
    switch (*arg) {
    case 'a':
    case 'A':
      sedit_types_menu(d);
      return;
    case 'd':
    case 'D':
      write_to_output(d, "\r\nDelete which entry? : ");
      OLC_MODE(d) = SEDIT_DELETE_TYPE;
      return;
    case 'q':
    case 'Q':
      break;
    }
    break;
/*-------------------------------------------------------------------*/
  case SEDIT_PRODUCTS_MENU:
    switch (*arg) {
    case 'a':
    case 'A':
      write_to_output(d, "\r\nEnter new product vnum number : ");
      OLC_MODE(d) = SEDIT_NEW_PRODUCT;
      return;
    case 'd':
    case 'D':
      write_to_output(d, "\r\nDelete which product? : ");
      OLC_MODE(d) = SEDIT_DELETE_PRODUCT;
      return;
    case 'q':
    case 'Q':
      break;
    }
    break;
/*-------------------------------------------------------------------*/
  case SEDIT_ROOMS_MENU:
    switch (*arg) {
    case 'a':
    case 'A':
      write_to_output(d, "\r\nEnter new room vnum number : ");
      OLC_MODE(d) = SEDIT_NEW_ROOM;
      return;
    case 'c':
    case 'C':
      sedit_compact_rooms_menu(d);
      return;
    case 'l':
    case 'L':
      sedit_rooms_menu(d);
      return;
    case 'd':
    case 'D':
      write_to_output(d, "\r\nDelete which room? : ");
      OLC_MODE(d) = SEDIT_DELETE_ROOM;
      return;
    case 'q':
    case 'Q':
      break;
    }
    break;
/*-------------------------------------------------------------------*/
    /*
     * String edits.
     */
  case SEDIT_NOITEM1:
    if (genolc_checkstring(d, arg))
      modify_string(&S_NOITEM1(OLC_SHOP(d)), arg);
    break;
  case SEDIT_NOITEM2:
    if (genolc_checkstring(d, arg))
      modify_string(&S_NOITEM2(OLC_SHOP(d)), arg);
    break;
  case SEDIT_NOCASH1:
    if (genolc_checkstring(d, arg))
      modify_string(&S_NOCASH1(OLC_SHOP(d)), arg);
    break;
  case SEDIT_NOCASH2:
    if (genolc_checkstring(d, arg))
      modify_string(&S_NOCASH2(OLC_SHOP(d)), arg);
    break;
  case SEDIT_NOBUY:
    if (genolc_checkstring(d, arg))
      modify_string(&S_NOBUY(OLC_SHOP(d)), arg);
    break;
  case SEDIT_BUY:
    if (genolc_checkstring(d, arg))
      modify_string(&S_BUY(OLC_SHOP(d)), arg);
    break;
  case SEDIT_SELL:
    if (genolc_checkstring(d, arg))
      modify_string(&S_SELL(OLC_SHOP(d)), arg);
    break;
  case SEDIT_NAMELIST:
    if (genolc_checkstring(d, arg)) {
      struct shop_buy_data new_entry;

      BUY_TYPE(new_entry) = OLC_VAL(d);
      BUY_WORD(new_entry) = strdup(arg);
      add_to_type_list(&(S_NAMELISTS(OLC_SHOP(d))), &new_entry);
    }
    sedit_namelist_menu(d);
    return;

/*-------------------------------------------------------------------*/
    /*
     * Numerical responses.
     */
  case SEDIT_KEEPER:
    i = atoi(arg);
    if ((i = atoi(arg)) != -1)
      if ((i = real_mobile(i)) == NOBODY) {
	write_to_output(d, "That mobile does not exist, try again : ");
	return;
      }
    S_KEEPER(OLC_SHOP(d)) = i;
    if (i == -1)
      break;
    /*
     * Fiddle with special procs.
     */
    S_FUNC(OLC_SHOP(d)) = mob_index[i].func != shop_keeper ? mob_index[i].func : NULL;
    mob_index[i].func = shop_keeper;
    break;
  case SEDIT_OPEN1:
    S_OPEN1(OLC_SHOP(d)) = LIMIT(atoi(arg), 0, 28);
    break;
  case SEDIT_OPEN2:
    S_OPEN2(OLC_SHOP(d)) = LIMIT(atoi(arg), 0, 28);
    break;
  case SEDIT_CLOSE1:
    S_CLOSE1(OLC_SHOP(d)) = LIMIT(atoi(arg), 0, 28);
    break;
  case SEDIT_CLOSE2:
    S_CLOSE2(OLC_SHOP(d)) = LIMIT(atoi(arg), 0, 28);
    break;
  case SEDIT_BUY_PROFIT:
    sscanf(arg, "%f", &S_BUYPROFIT(OLC_SHOP(d)));
    break;
  case SEDIT_SELL_PROFIT:
    sscanf(arg, "%f", &S_SELLPROFIT(OLC_SHOP(d)));
    break;
  case SEDIT_TYPE_MENU:
    OLC_VAL(d) = LIMIT(atoi(arg), 0, NUM_ITEM_TYPES - 1);
    write_to_output(d, "Enter namelist (return for none) :-\r\n] ");
    OLC_MODE(d) = SEDIT_NAMELIST;
    return;
  case SEDIT_DELETE_TYPE:
    remove_from_type_list(&(S_NAMELISTS(OLC_SHOP(d))), atoi(arg));
    sedit_namelist_menu(d);
    return;
  case SEDIT_NEW_PRODUCT:
    if ((i = atoi(arg)) != -1)
      if ((i = real_object(i)) == NOTHING) {
	write_to_output(d, "That object does not exist, try again : ");
	return;
      }
    if (i > 0)
      add_to_int_list(&(S_PRODUCTS(OLC_SHOP(d))), i);
    sedit_products_menu(d);
    return;
  case SEDIT_DELETE_PRODUCT:
    remove_from_int_list(&(S_PRODUCTS(OLC_SHOP(d))), atoi(arg));
    sedit_products_menu(d);
    return;
  case SEDIT_NEW_ROOM:
    if ((i = atoi(arg)) != -1)
      if ((i = real_room(i)) == NOWHERE) {
	write_to_output(d, "That room does not exist, try again : ");
	return;
      }
    if (i >= 0)
      add_to_int_list(&(S_ROOMS(OLC_SHOP(d))), atoi(arg));
    sedit_rooms_menu(d);
    return;
  case SEDIT_DELETE_ROOM:
    remove_from_int_list(&(S_ROOMS(OLC_SHOP(d))), atoi(arg));
    sedit_rooms_menu(d);
    return;
  case SEDIT_SHOP_FLAGS:
    if ((i = LIMIT(atoi(arg), 0, NUM_SHOP_FLAGS)) > 0) {
      TOGGLE_BIT(S_BITVECTOR(OLC_SHOP(d)), 1 << (i - 1));
      sedit_shop_flags_menu(d);
      return;
    }
    break;
  case SEDIT_NOTRADE:
    if ((i = LIMIT(atoi(arg), 0, NUM_TRADERS)) > 0) {
      TOGGLE_BIT(S_NOTRADE(OLC_SHOP(d)), 1 << (i - 1));
      sedit_no_trade_menu(d);
      return;
    }
    break;

/*-------------------------------------------------------------------*/
  default:
    /*
     * We should never get here.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: sedit_parse(): Reached default case!");
    write_to_output(d, "Oops...\r\n");
    break;
  }

/*-------------------------------------------------------------------*/

/*
 * END OF CASE 
 * If we get here, we have probably changed something, and now want to
 * return to main menu.  Use OLC_VAL as a 'has changed' flag.
 */
  OLC_VAL(d) = 1;
  sedit_disp_menu(d);
}
コード例 #23
0
ファイル: medit.c プロジェクト: vedicveko/Aarait
void medit_parse(struct descriptor_data *d, char *arg)
{
  int i = -1;
  char *oldtext = NULL;

  if (OLC_MODE(d) > MEDIT_NUMERICAL_RESPONSE) {
    i = atoi(arg);
    if (!*arg || (!isdigit(arg[0]) && ((*arg == '-') && !isdigit(arg[1])))) {
      SEND_TO_Q("Field must be numerical, try again : ", d);
      return;
    }
  } else {	/* String response. */
    if (!genolc_checkstring(d, arg))
      return;
  }
  switch (OLC_MODE(d)) {
/*-------------------------------------------------------------------*/
  case MEDIT_CONFIRM_SAVESTRING:
    /*
     * Ensure mob has MOB_ISNPC set or things will go pear shaped.
     */
    SET_BIT(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC);
    switch (*arg) {
    case 'y':
    case 'Y':
      /*
       * Save the mob in memory and to disk.
       */
      SEND_TO_Q("Saving mobile to memory.\r\n", d);
      medit_save_internally(d);
      sprintf(buf, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d));
      mudlog(buf, CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE);
      /* FALL THROUGH */
    case 'n':
    case 'N':
      cleanup_olc(d, CLEANUP_ALL);
      return;
    default:
      SEND_TO_Q("Invalid choice!\r\n", d);
      SEND_TO_Q("Do you wish to save the mobile? : ", d);
      return;
    }
    break;

/*-------------------------------------------------------------------*/
  case MEDIT_MAIN_MENU:
    i = 0;
    switch (*arg) {
    case 'q':
    case 'Q':
      if (OLC_VAL(d)) {	/* Anything been changed? */
	SEND_TO_Q("Do you wish to save the changes to the mobile? (y//n) : ", d);
	OLC_MODE(d) = MEDIT_CONFIRM_SAVESTRING;
      } else
	cleanup_olc(d, CLEANUP_ALL);
      return;
    case '1':
      OLC_MODE(d) = MEDIT_SEX;
      medit_disp_sex(d);
      return;
    case '2':
      OLC_MODE(d) = MEDIT_ALIAS;
      i--;
      break;
    case '3':
      OLC_MODE(d) = MEDIT_S_DESC;
      i--;
      break;
    case '4':
      OLC_MODE(d) = MEDIT_L_DESC;
      i--;
      break;
    case '5':
      OLC_MODE(d) = MEDIT_D_DESC;
      send_editor_help(d);
      SEND_TO_Q("Enter mob description:\r\n\r\n", d);
      if (OLC_MOB(d)->player.description) {
	SEND_TO_Q(OLC_MOB(d)->player.description, d);
	oldtext = str_dup(OLC_MOB(d)->player.description);
      }
      string_write(d, &OLC_MOB(d)->player.description, MAX_MOB_DESC, 0, oldtext);
      OLC_VAL(d) = 1;
      return;
    case '6':
      OLC_MODE(d) = MEDIT_LEVEL;
      i++;
      break;
    case '7':
      OLC_MODE(d) = MEDIT_ALIGNMENT;
      i++;
      break;
    case '8':
      OLC_MODE(d) = MEDIT_HITROLL;
      i++;
      break;
    case '9':
      OLC_MODE(d) = MEDIT_DAMROLL;
      i++;
      break;
    case 'a':
    case 'A':
      OLC_MODE(d) = MEDIT_NDD;
      i++;
      break;
    case 'b':
    case 'B':
      OLC_MODE(d) = MEDIT_SDD;
      i++;
      break;
    case 'c':
    case 'C':
      OLC_MODE(d) = MEDIT_NUM_HP_DICE;
      i++;
      break;
    case 'd':
    case 'D':
      OLC_MODE(d) = MEDIT_SIZE_HP_DICE;
      i++;
      break;
    case 'e':
    case 'E':
      OLC_MODE(d) = MEDIT_ADD_HP;
      i++;
      break;
    case 'f':
    case 'F':
      OLC_MODE(d) = MEDIT_AC;
      i++;
      break;
    case 'g':
    case 'G':
      OLC_MODE(d) = MEDIT_EXP;
      i++;
      break;
    case 'h':
    case 'H':
      OLC_MODE(d) = MEDIT_GOLD;
      i++;
      break;
    case 'i':
    case 'I':
      OLC_MODE(d) = MEDIT_POS;
      medit_disp_positions(d);
      return;
    case 'j':
    case 'J':
      OLC_MODE(d) = MEDIT_DEFAULT_POS;
      medit_disp_positions(d);
      return;
    case 'k':
    case 'K':
      OLC_MODE(d) = MEDIT_ATTACK;
      medit_disp_attack_types(d);
      return;
    case 'l':
    case 'L':
      OLC_MODE(d) = MEDIT_NPC_FLAGS;
      medit_disp_mob_flags(d);
      return;
    case 'm':
    case 'M':
      OLC_MODE(d) = MEDIT_AFF_FLAGS;
      medit_disp_aff_flags(d);
      return;
    case 'n':
    case 'N':
     OLC_MODE(d) = MEDIT_CLASS;
     medit_disp_class_flags(d);
     return;
    case 'r':
    case 'R':
     OLC_MODE(d) = MEDIT_RACE;
     medit_disp_race_flags(d);
     return;
    case 's':
    case 'S':
     OLC_MODE(d) = MEDIT_MSIZE;
     medit_disp_size_flags(d);
     return;
    case 'w':
    case 'W':
     OLC_MODE(d) = MEDIT_WEIGHT;
      send_to_char("Please enter the mobiles weight in pounds: ", d->character); 
     return;

#if CONFIG_OASIS_MPROG
    case 'p':
    case 'P':
      OLC_MODE(d) = MEDIT_MPROG;
      medit_disp_mprog(d);
      return;
#endif
    default:
      medit_disp_menu(d);
      return;
    }
    if (i == 0)
      break;
    else if (i == 1)
      SEND_TO_Q("\r\nEnter new value : ", d);
    else if (i == -1)
      SEND_TO_Q("\r\nEnter new text :\r\n] ", d);
    else
      SEND_TO_Q("Oops...\r\n", d);
    return;
/*-------------------------------------------------------------------*/
  case MEDIT_ALIAS:
    if (GET_ALIAS(OLC_MOB(d)))
      free(GET_ALIAS(OLC_MOB(d)));
    GET_ALIAS(OLC_MOB(d)) = str_udup(arg);
    break;
/*-------------------------------------------------------------------*/
  case MEDIT_S_DESC:
    if (GET_SDESC(OLC_MOB(d)))
      free(GET_SDESC(OLC_MOB(d)));
    GET_SDESC(OLC_MOB(d)) = str_udup(arg);
    break;
/*-------------------------------------------------------------------*/
  case MEDIT_L_DESC:
    if (GET_LDESC(OLC_MOB(d)))
      free(GET_LDESC(OLC_MOB(d)));
    if (arg && *arg) {
      strcpy(buf, arg);
      strcat(buf, "\r\n");
      GET_LDESC(OLC_MOB(d)) = str_dup(buf);
    } else
      GET_LDESC(OLC_MOB(d)) = str_dup("undefined");

    break;
/*-------------------------------------------------------------------*/
  case MEDIT_D_DESC:
    /*
     * We should never get here.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog("SYSERR: OLC: medit_parse(): Reached D_DESC case!", BRF, LVL_BUILDER, TRUE);
    SEND_TO_Q("Oops...\r\n", d);
    break;
/*-------------------------------------------------------------------*/
#if CONFIG_OASIS_MPROG
  case MEDIT_MPROG_COMLIST:
    /*
     * We should never get here, but if we do, bail out.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog("SYSERR: OLC: medit_parse(): Reached MPROG_COMLIST case!", BRF, LVL_BUILDER, TRUE);
    break;
#endif
/*-------------------------------------------------------------------*/
  case MEDIT_NPC_FLAGS:
    if ((i = atoi(arg)) <= 0)
      break;
    else if (i <= NUM_MOB_FLAGS)
      TOGGLE_BIT(MOB_FLAGS(OLC_MOB(d)), 1 << (i - 1));
    medit_disp_mob_flags(d);
    return;
/*-------------------------------------------------------------------*/
  case MEDIT_AFF_FLAGS:
    if ((i = atoi(arg)) <= 0)
      break;
    else if (i <= NUM_AFF_FLAGS)
      TOGGLE_BIT(AFF_FLAGS(OLC_MOB(d)), 1 << (i - 1));
    medit_disp_aff_flags(d);
    return;
/*-------------------------------------------------------------------*/
#if CONFIG_OASIS_MPROG
  case MEDIT_MPROG:
    if ((i = atoi(arg)) == 0)
      medit_disp_menu(d);
    else if (i == OLC_MTOTAL(d)) {
      struct mob_prog_data *temp;
      CREATE(temp, struct mob_prog_data, 1);
      temp->next = OLC_MPROGL(d);
      temp->type = -1;
      temp->arglist = NULL;
      temp->comlist = NULL;
      OLC_MPROG(d) = temp;
      OLC_MPROGL(d) = temp;
      OLC_MODE(d) = MEDIT_CHANGE_MPROG;
      medit_change_mprog (d);
    } else if (i < OLC_MTOTAL(d)) {
      struct mob_prog_data *temp;
      int x = 1;
      for (temp = OLC_MPROGL(d); temp && x < i; temp = temp->next)
        x++;
      OLC_MPROG(d) = temp;
      OLC_MODE(d) = MEDIT_CHANGE_MPROG;
      medit_change_mprog (d);
    } else if (i == (OLC_MTOTAL(d) + 1)) {
      SEND_TO_Q("Which mob prog do you want to purge? ", d);
      OLC_MODE(d) = MEDIT_PURGE_MPROG;
    } else
      medit_disp_menu(d);
    return;

  case MEDIT_PURGE_MPROG:
    if ((i = atoi(arg)) > 0 && i < OLC_MTOTAL(d)) {
      struct mob_prog_data *temp;
      int x = 1;

      for (temp = OLC_MPROGL(d); temp && x < i; temp = temp->next)
	x++;
      OLC_MPROG(d) = temp;
      REMOVE_FROM_LIST(OLC_MPROG(d), OLC_MPROGL(d), next);
      free(OLC_MPROG(d)->arglist);
      free(OLC_MPROG(d)->comlist);
      free(OLC_MPROG(d));
      OLC_MPROG(d) = NULL;
      OLC_VAL(d) = 1;
    }
    medit_disp_mprog(d);
    return;

  case MEDIT_CHANGE_MPROG:
    if ((i = atoi(arg)) == 1)
      medit_disp_mprog_types(d);
    else if (i == 2) {
      SEND_TO_Q("Enter new arg list: ", d);
      OLC_MODE(d) = MEDIT_MPROG_ARGS;
    } else if (i == 3) {
      SEND_TO_Q("Enter new mob prog commands:\r\n", d);
      /*
       * Pass control to modify.c for typing.
       */
      OLC_MODE(d) = MEDIT_MPROG_COMLIST;
      if (OLC_MPROG(d)->comlist) {
        SEND_TO_Q(OLC_MPROG(d)->comlist, d);
        oldtext = str_dup(OLC_MPROG(d)->comlist);
      }
      string_write(d, &OLC_MPROG(d)->comlist, MAX_STRING_LENGTH, 0, oldtext);
      OLC_VAL(d) = 1;
    } else
      medit_disp_mprog(d);
    return;
#endif

/*-------------------------------------------------------------------*/

/*
 * Numerical responses.
 */

#if CONFIG_OASIS_MPROG
  case MEDIT_MPROG_TYPE:
    /*
     * This calculation may be off by one too many powers of 2?
     * Someone who actually uses MobProgs will have to check.
     */
    OLC_MPROG(d)->type = (1 << LIMIT(atoi(arg), 0, NUM_PROGS - 1));
    OLC_VAL(d) = 1;
    medit_change_mprog(d);
    return;

  case MEDIT_MPROG_ARGS:
    OLC_MPROG(d)->arglist = str_dup(arg);
    OLC_VAL(d) = 1;
    medit_change_mprog(d);
    return;
#endif

  case MEDIT_SEX:
    GET_SEX(OLC_MOB(d)) = LIMIT(i, 0, NUM_GENDERS - 1);
    break;

  case MEDIT_HITROLL:
    GET_HITROLL(OLC_MOB(d)) = LIMIT(i, 0, 50);
    break;

  case MEDIT_DAMROLL:
    GET_DAMROLL(OLC_MOB(d)) = LIMIT(i, 0, 50);
    break;

  case MEDIT_NDD:
    GET_NDD(OLC_MOB(d)) = LIMIT(i, 0, 30);
    break;

  case MEDIT_SDD:
    GET_SDD(OLC_MOB(d)) = LIMIT(i, 0, 127);
    break;

  case MEDIT_NUM_HP_DICE:
    GET_HIT(OLC_MOB(d)) = LIMIT(i, 0, 30);
    break;

  case MEDIT_SIZE_HP_DICE:
    GET_MANA(OLC_MOB(d)) = LIMIT(i, 0, 1000);
    break;

  case MEDIT_ADD_HP:
    GET_MOVE(OLC_MOB(d)) = LIMIT(i, 0, 30000);
    break;

  case MEDIT_AC:
    GET_AC(OLC_MOB(d)) = LIMIT(i, 10, 200);
    break;

  case MEDIT_EXP:
    GET_EXP(OLC_MOB(d)) = MAX(i, 0);
    break;

  case MEDIT_GOLD:
    add_money_to_char(OLC_MOB(d), MAX(i, 0), COPPER_COINS);
    break;

  case MEDIT_POS:
    GET_POS(OLC_MOB(d)) = LIMIT(i, 0, NUM_POSITIONS - 1);
    break;

  case MEDIT_DEFAULT_POS:
    GET_DEFAULT_POS(OLC_MOB(d)) = LIMIT(i, 0, NUM_POSITIONS - 1);
    break;

  case MEDIT_ATTACK:
    GET_ATTACK(OLC_MOB(d)) = LIMIT(i, 0, NUM_ATTACK_TYPES - 1);
    break;

  case MEDIT_LEVEL:
    GET_LEVEL(OLC_MOB(d)) = i;
    break;

  case MEDIT_ALIGNMENT:
    GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
    break;

  case MEDIT_CLASS:
    GET_CLASS(OLC_MOB(d)) = MAX(0, MIN(NUM_NPC_CLASS, atoi(arg)));
    break;
  case MEDIT_RACE:
    GET_RACE(OLC_MOB(d)) = MAX(0, MIN(NUM_NPC_RACE, atoi(arg)));
    // INT, WIS, STR, DEX, CON, CHA
    GET_INT(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][0];
    GET_WIS(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][1];
    GET_STR(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][2];
    GET_DEX(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][3];
    GET_CON(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][4];
    GET_CHA(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][5];
    GET_HIT(OLC_MOB(d)) = mob_hp[i][0];
    GET_MANA(OLC_MOB(d)) = mob_hp[i][2];
    GET_MOVE(OLC_MOB(d)) = mob_hp[i][3];
    break;

  case MEDIT_WEIGHT:
    GET_MOB_WEIGHT(OLC_MOB(d)) = LIMIT(i, 1, 1000);
    break;

  case MEDIT_MSIZE:
    GET_MOB_SIZE(OLC_MOB(d)) = atoi(arg);
    break;

/*-------------------------------------------------------------------*/
  default:
    /*
     * We should never get here.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog("SYSERR: OLC: medit_parse(): Reached default case!", BRF, LVL_BUILDER, TRUE);
    SEND_TO_Q("Oops...\r\n", d);
    break;
  }
コード例 #24
0
ファイル: sedit.c プロジェクト: bigmac12/Mac-s-CWG
/*
 * Should check more things.
 */
void sedit_save_internally(struct descriptor_data *d)
{
  OLC_SHOP(d)->vnum = OLC_NUM(d);
  add_shop(OLC_SHOP(d));
}
コード例 #25
0
ファイル: zedit.c プロジェクト: vedicveko/Aarait
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':
      /*
       * Save the zone in memory, hiding invisible people.
       */
      SEND_TO_Q("Saving zone info in memory.\r\n", d);
      zedit_save_internally(d);
      sprintf(buf, "OLC: %s edits zone info for room %d.", GET_NAME(d->character), OLC_NUM(d));
      mudlog(buf, CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE);
      /* FALL THROUGH */
    case 'n':
    case 'N':
      cleanup_olc(d, CLEANUP_ALL);
      break;
    default:
      SEND_TO_Q("Invalid choice!\r\n", d);
      SEND_TO_Q("Do you wish to save the zone info? : ", d);
      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) {
	SEND_TO_Q("Do you wish to save the changes to the zone info? (y//n) : ", d);
	OLC_MODE(d) = ZEDIT_CONFIRM_SAVESTRING;
      } else {
	SEND_TO_Q("No changes made.\r\n", d);
	cleanup_olc(d, CLEANUP_ALL);
      }
      break;
    case 'n':
    case 'N':
      /*
       * New entry.
       */
      SEND_TO_Q("What number in the list should the new command be? : ", d);
      OLC_MODE(d) = ZEDIT_NEW_ENTRY;
      break;
    case 'e':
    case 'E':
      /*
       * Change an entry.
       */
      SEND_TO_Q("Which command do you wish to change? : ", d);
      OLC_MODE(d) = ZEDIT_CHANGE_ENTRY;
      break;
    case 'd':
    case 'D':
      /*
       * Delete an entry.
       */
      SEND_TO_Q("Which command do you wish to delete? : ", d);
      OLC_MODE(d) = ZEDIT_DELETE_ENTRY;
      break;
    case 'z':
    case 'Z':
      /*
       * Edit zone name.
       */
      SEND_TO_Q("Enter new zone name : ", d);
      OLC_MODE(d) = ZEDIT_ZONE_NAME;
      break;
    case 't':
    case 'T':
      /*
       * Edit top of zone.
       */
      if (GET_LEVEL(d->character) < LVL_IMPL)
	zedit_disp_menu(d);
      else {
	SEND_TO_Q("Enter new top of zone : ", d);
	OLC_MODE(d) = ZEDIT_ZONE_TOP;
      }
      break;
    case 'l':
    case 'L':
      /*
       * Edit zone lifespan.
       */
      SEND_TO_Q("Enter new zone lifespan : ", d);
      OLC_MODE(d) = ZEDIT_ZONE_LIFE;
      break;
    case 'r':
    case 'R':
      /*
       * Edit zone reset mode.
       */
      SEND_TO_Q("\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 : ", d);
      OLC_MODE(d) = ZEDIT_ZONE_RESET;
      break;
    default:
      zedit_disp_menu(d);
      break;
    }
    break;
    /* End of ZEDIT_MAIN_MENU */

/*-------------------------------------------------------------------*/
  case ZEDIT_NEW_ENTRY:
    /*
     * Get the line number and insert the new line.
     */
    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:
    /*
     * Get the line number and delete the line.
     */
    pos = atoi(arg);
    if (isdigit(*arg)) {
      delete_command(OLC_ZONE(d), pos);
      OLC_ZONE(d)->age = 1;
    }
    zedit_disp_menu(d);
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_CHANGE_ENTRY:
    /*
     * Parse the input for which line to edit, and goto next quiz.
     */
    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:
    /*
     * Parse the input for which type of command this is, and goto next
     * quiz.
     */
    OLC_CMD(d).command = toupper(*arg);
    if (!OLC_CMD(d).command || (strchr("MOPEDGR", OLC_CMD(d).command) == NULL)) {
      SEND_TO_Q("Invalid choice, try again : ", d);
    } else {
      if (OLC_VAL(d)) {	/* If there was a previous command. */
	SEND_TO_Q("Is this command dependent on the success of the previous one? (y//n)\r\n", d);
	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:
    /*
     * Parse the input for the if flag, and goto next quiz.
     */
    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:
      SEND_TO_Q("Try again : ", d);
      return;
    }
    zedit_disp_arg1(d);
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_ARG1:
    /*
     * Parse the input for arg1, and goto next quiz.
     */
    if (!isdigit(*arg)) {
      SEND_TO_Q("Must be a numeric value, try again : ", d);
      return;
    }
    switch (OLC_CMD(d).command) {
    case 'M':
      if ((pos = real_mobile(atoi(arg))) >= 0) {
	OLC_CMD(d).arg1 = pos;
	zedit_disp_arg2(d);
      } else
	SEND_TO_Q("That mobile does not exist, try again : ", d);
      break;
    case 'O':
    case 'P':
    case 'E':
    case 'G':
      if ((pos = real_object(atoi(arg))) >= 0) {
	OLC_CMD(d).arg1 = pos;
	zedit_disp_arg2(d);
      } else
	SEND_TO_Q("That object does not exist, try again : ", d);
      break;
    case 'D':
    case 'R':
    default:
      /*
       * We should never get here.
       */
      cleanup_olc(d, CLEANUP_ALL);
      mudlog("SYSERR: OLC: zedit_parse(): case ARG1: Ack!", BRF, LVL_BUILDER, TRUE);
      SEND_TO_Q("Oops...\r\n", d);
      break;
    }
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_ARG2:
    /*
     * Parse the input for arg2, and goto next quiz.
     */
    if (!isdigit(*arg)) {
      SEND_TO_Q("Must be a numeric value, try again : ", d);
      return;
    }
    switch (OLC_CMD(d).command) {
    case 'M':
    case 'O':
      OLC_CMD(d).arg2 = atoi(arg);
      OLC_CMD(d).arg3 = real_room(OLC_NUM(d));
      zedit_disp_arg4(d);
      break;
    case 'G':
      OLC_CMD(d).arg2 = atoi(arg);
      zedit_disp_arg4(d);
      break;
    case 'P':
    case 'E':
      OLC_CMD(d).arg2 = atoi(arg);
      zedit_disp_arg3(d);
      break;
    case 'D':
      pos = atoi(arg);
      /*
       * Count directions.
       */
      if (pos < 0 || pos > NUM_OF_DIRS)
	SEND_TO_Q("Try again : ", d);
      else {
	OLC_CMD(d).arg2 = pos;
	zedit_disp_arg3(d);
      }
      break;
    case 'R':
      if ((pos = real_object(atoi(arg))) >= 0) {
	OLC_CMD(d).arg2 = pos;
	zedit_disp_menu(d);
      } else
	SEND_TO_Q("That object does not exist, try again : ", d);
      break;
    default:
      /*
       * We should never get here, but just in case...
       */
      cleanup_olc(d, CLEANUP_ALL);
      mudlog("SYSERR: OLC: zedit_parse(): case ARG2: Ack!", BRF, LVL_BUILDER, TRUE);
      SEND_TO_Q("Oops...\r\n", d);
      break;
    }
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_ARG3:
    /*
     * Parse the input for arg3, and goto arg4's menu.
     */
    if (!isdigit(*arg)) {
      SEND_TO_Q("Must be a numeric value, try again : ", d);
      return;
    }
    switch (OLC_CMD(d).command) {
    case 'E':
      pos = atoi(arg);
      /*
       * Count number of wear positions.  We could use NUM_WEARS, this is
       * more reliable.
       */
      while (*equipment_types[i] != '\n')
	i++;
      if (pos < 0 || pos > i)
	SEND_TO_Q("Try again : ", d);
      else {
	OLC_CMD(d).arg3 = pos;
        zedit_disp_arg4(d);
      }
      break;
    case 'P':
      if ((pos = real_object(atoi(arg))) >= 0) {
	OLC_CMD(d).arg3 = pos;
        zedit_disp_arg4(d);
      } else
	SEND_TO_Q("That object does not exist, try again : ", d);
      break;
    case 'D':
      pos = atoi(arg);
      if (pos < 0 || pos > 2)
	SEND_TO_Q("Try again : ", d);
      else {
	OLC_CMD(d).arg3 = pos;
        zedit_disp_arg4(d);
      }
      break;
    case 'M':
    case 'O':
    case 'G':
    case 'R':
    default:
      /*
       * We should never get here, but just in case...
       */
      cleanup_olc(d, CLEANUP_ALL);
      mudlog("SYSERR: OLC: zedit_parse(): case ARG3: Ack!", BRF, LVL_BUILDER, TRUE);
      SEND_TO_Q("Oops...\r\n", d);
      break;
    }
    break;

  case ZEDIT_ARG4:
    /*
     * Parse the input for arg4, and go back to main menu.
     */
    if (!isdigit(*arg)) {
      SEND_TO_Q("Must be a numeric value, try again : ", d);
      return;
    }
    switch (OLC_CMD(d).command) {
    case 'M':
    case 'O':
    case 'G':
    case 'E':
      pos = atoi(arg);
      if (pos < 0 || pos > 100)
        SEND_TO_Q("Try again : ", d);
      else {
        OLC_CMD(d).arg4 = pos;
        zedit_disp_menu(d);
      }
      break;

    case 'P':
    case 'D':
        OLC_CMD(d).arg3 = 100;
      break;

    default:
      /*

       * We should never get here, but just in case...
       */
      cleanup_olc(d, CLEANUP_ALL);
      mudlog("SYSERR: OLC: zedit_parse(): case ARG3: Ack!", BRF, LVL_BUILDER, TRUE);
      SEND_TO_Q("Oops...\r\n", d);
      break;
    }
    break;


/*-------------------------------------------------------------------*/
  case ZEDIT_ZONE_NAME:
    /*
     * Add new name and return to main menu.
     */
    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 = str_dup(arg);
      OLC_ZONE(d)->number = 1;
    }
    zedit_disp_menu(d);
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_ZONE_RESET:
    /*
     * Parse and add new reset_mode and return to main menu.
     */
    pos = atoi(arg);
    if (!isdigit(*arg) || pos < 0 || pos > 2)
      SEND_TO_Q("Try again (0-2) : ", d);
    else {
      OLC_ZONE(d)->reset_mode = pos;
      OLC_ZONE(d)->number = 1;
      zedit_disp_menu(d);
    }
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_ZONE_LIFE:
    /*
     * Parse and add new lifespan and return to main menu.
     */
    pos = atoi(arg);
    if (!isdigit(*arg) || pos < 0 || pos > 240)
      SEND_TO_Q("Try again (0-240) : ", d);
    else {
      OLC_ZONE(d)->lifespan = pos;
      OLC_ZONE(d)->number = 1;
      zedit_disp_menu(d);
    }
    break;

/*-------------------------------------------------------------------*/
  case ZEDIT_ZONE_TOP:
    /*
     * Parse and add new top room in zone and return to main menu.
     */
    if (OLC_ZNUM(d) == top_of_zone_table)
      OLC_ZONE(d)->top = LIMIT(atoi(arg), OLC_ZNUM(d) * 100, 32000);
    else
      OLC_ZONE(d)->top = LIMIT(atoi(arg), OLC_ZNUM(d) * 100, zone_table[OLC_ZNUM(d) + 1].number * 100);
    zedit_disp_menu(d);
    break;

/*-------------------------------------------------------------------*/
  default:
    /*
     * We should never get here, but just in case...
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog("SYSERR: OLC: zedit_parse(): Reached default case!", BRF, LVL_BUILDER, TRUE);
    SEND_TO_Q("Oops...\r\n", d);
    break;
  }
}
コード例 #26
0
ファイル: dg_olc.c プロジェクト: tbjers/arcanerealms
void trigedit_parse(struct descriptor_data *d, char *arg)
{
	int i = 0;
	char *backstr = NULL;

	switch (OLC_MODE(d)) {
	case TRIGEDIT_MAIN_MENU:
	 switch (tolower(*arg)) {
	 case 'q':
		 if (OLC_VAL(d)) { /* Anything been changed? */
			 if (!GET_TRIG_TYPE(OLC_TRIG(d))) {
				 send_to_char("Invalid Trigger Type! Answer a to abort quit!\r\n",
					 d->character);     
			 }
			 send_to_char("Do you wish to save the changes to the trigger? (y/n): ",
				 d->character);     
			 OLC_MODE(d) = TRIGEDIT_CONFIRM_SAVESTRING;
		 } else
			 cleanup_olc(d, CLEANUP_ALL);
		 return;
	 case '1':
		 OLC_MODE(d) = TRIGEDIT_NAME;
		 send_to_char("Name: ", d->character);
		 break;
	 case '2':
		 OLC_MODE(d) = TRIGEDIT_INTENDED;
		 send_to_char("0: Mobiles, 1: Objects, 2: Rooms: ", d->character);
		 break;
	 case '3':
		 OLC_MODE(d) = TRIGEDIT_TYPES;
		 trigedit_disp_types(d);
		 break;
	 case '4':
		 OLC_MODE(d) = TRIGEDIT_NARG;
		 send_to_char("Numeric argument: ", d->character);
		 break;
	 case '5':
		 OLC_MODE(d) = TRIGEDIT_ARGUMENT;
		 send_to_char("Argument: ", d->character);
		 break;
	 case '6':
		 OLC_MODE(d) = TRIGEDIT_COMMANDS;

		 clear_screen(d);
		 if (OLC_STORAGE(d)) {
			 write_to_output(d, FALSE, "%s", OLC_STORAGE(d));
			 backstr = str_dup(OLC_STORAGE(d));
		 }
		 string_write(d, &OLC_STORAGE(d), MAX_CMD_LENGTH, 0, STATE(d));
		 OLC_VAL(d) = 1;

		 break;
	 default:
		 trigedit_disp_menu(d);
		 return;
	 }
	 return;
	
	case TRIGEDIT_CONFIRM_SAVESTRING:
		switch(tolower(*arg)) {
		case 'y':
			trigedit_save(d);
			sprintf(buf, "OLC: %s edits trigger %d", GET_NAME(d->character),
				OLC_NUM(d));
			mudlog(buf, CMP, MAX(RIGHTS_TRIGGERS, GET_INVIS_LEV(d->character)), TRUE);
			/* fall through */
		case 'n':
			cleanup_olc(d, CLEANUP_ALL);
			return;
		case 'a': /* abort quitting */
			break;
		default:
			send_to_char("Invalid choice!\r\n", d->character);
			send_to_char("Do you wish to save the trigger? : ", d->character);
			return;
		}
		break;

	case TRIGEDIT_NAME:
		if (OLC_TRIG(d)->name)
			free(OLC_TRIG(d)->name);
		OLC_TRIG(d)->name = str_dup((arg && *arg) ? arg : "undefined");
		OLC_VAL(d)++;
		break;

	case TRIGEDIT_INTENDED:
		if ((atoi(arg)>=MOB_TRIGGER) || (atoi(arg)<=WLD_TRIGGER))
			OLC_TRIG(d)->attach_type = atoi(arg);
		OLC_VAL(d)++;
		break;

	case TRIGEDIT_NARG:
		OLC_TRIG(d)->narg = atoi(arg);
		OLC_VAL(d)++;
		break;

	case TRIGEDIT_ARGUMENT:
		OLC_TRIG(d)->arglist = (*arg?str_dup(arg):NULL);
		OLC_VAL(d)++;
		break;

	case TRIGEDIT_TYPES:
		if ((i = atoi(arg)) == 0)
			break;
		else if (!((i < 0) || (i > NUM_TRIG_TYPE_FLAGS)))
			TOGGLE_BIT((GET_TRIG_TYPE(OLC_TRIG(d))), 1ULL << (i - 1));
		OLC_VAL(d)++;
		trigedit_disp_types(d);
		return;

	case TRIGEDIT_COMMANDS:
		break;

	}

	OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
	trigedit_disp_menu(d);
}
コード例 #27
0
ファイル: hedit.c プロジェクト: tbjers/arcanerealms
void hedit_parse(struct descriptor_data *d, char *arg)
{
	int i, j;

	if (OLC_MODE(d) > HEDIT_NUMERICAL_RESPONSE) {
		if (!isdigit(arg[0]) && ((*arg == '-') && (!isdigit(arg[1])))) {
			write_to_output(d, TRUE, "Field must be numerical, try again : ");
			return;
		}
	}
	switch (OLC_MODE(d)) {
/*-------------------------------------------------------------------*/
	case SEDIT_CONFIRM_SAVESTRING:
		switch (*arg) {
		case 'y':
		case 'Y':
			write_to_output(d, TRUE, "Saving house to memory.\r\n");
			hedit_save_internally(d);
			hedit_save_to_disk();
			extended_mudlog(BRF, SYSL_OLC, TRUE, "%s edits house %d.", GET_NAME(d->character), OLC_NUM(d));
			cleanup_olc(d, CLEANUP_STRUCTS);
			return;
		case 'n':
		case 'N':
			cleanup_olc(d, CLEANUP_ALL);
			return;
		default:
			write_to_output(d, TRUE, "Invalid choice!\r\nDo you wish to save the house? : ");
			return;
		}
		break;

/*-------------------------------------------------------------------*/
	case HEDIT_MAIN_MENU:
		i = 0;
		switch (*arg) {
		case 'q':
		case 'Q':
			if (OLC_VAL(d)) {		/* Anything been changed? */
				write_to_output(d, TRUE, "Do you wish to save the changes to the house? (y/n) : ");
				OLC_MODE(d) = HEDIT_CONFIRM_SAVESTRING;
			} else
				cleanup_olc(d, CLEANUP_ALL);
			return;
		case '0':
			OLC_MODE(d) = HEDIT_OWNER;
			write_to_output(d, TRUE, "Enter the name of the house owner : ");
			i--;
			return;
		case '1':
			OLC_MODE(d) = HEDIT_ATRIUM;
			write_to_output(d, TRUE, "Enter the room number of the atrium : ");
			i++;
			return;
		case '2':
			OLC_MODE(d) = HEDIT_EXIT;
			hedit_exits_menu(d);
			return;
		case '3':
			OLC_MODE(d) = HEDIT_MODE;
			hedit_modes_menu(d);
			return;
		case '4':
			OLC_MODE(d) = HEDIT_PRUNE_SAFE;
			hedit_prune_safe_menu(d);
			return;
		case '5':
			OLC_MODE(d) = HEDIT_COST;
			write_to_output(d, TRUE, "Enter the house cost : ");
			i++;
			return;
		case '6':
			OLC_MODE(d) = HEDIT_MAX_SECURE;
			write_to_output(d, TRUE, "Enter maximum number of secure containers : ");
			i++;
			return;
		case '7':
			OLC_MODE(d) = HEDIT_MAX_LOCKED;
			write_to_output(d, TRUE, "Enter maximum number of locked-down items : ");
			i++;
			return;
		case 'c':
		case 'C':
			hedit_owners_menu(d);
			return;
		case 'g':
		case 'G':
			hedit_guests_menu(d);
			return;
		case 'r':
		case 'R':
			hedit_rooms_menu(d);
			return;
		case 'd':
		case 'D':
			delete_house(d, OLC_NUM(d));
			cleanup_olc(d, CLEANUP_ALL);
			return;
		default:
			hedit_disp_menu(d);
			return;
		}

		if (i == 0)
			break;
		else if (i == 1)
			write_to_output(d, TRUE, "\r\nEnter new value : ");
		else if (i == -1)
			write_to_output(d, TRUE, "\r\nEnter new text :\r\n] ");
		else
			write_to_output(d, TRUE, "Oops...\r\n");
		return;
/*-------------------------------------------------------------------*/
	case HEDIT_ROOMS_MENU:
		switch (*arg) {
		case 'a':
		case 'A':
			write_to_output(d, TRUE, "\r\nEnter new room vnum number : ");
			OLC_MODE(d) = HEDIT_NEW_ROOM;
			return;
		case 'c':
		case 'C':
			hedit_compact_rooms_menu(d);
			return;
		case 'l':
		case 'L':
			hedit_rooms_menu(d);
			return;
		case 'd':
		case 'D':
			write_to_output(d, TRUE, "\r\nDelete which room? : ");
			OLC_MODE(d) = HEDIT_DELETE_ROOM;
			return;
		case 'q':
		case 'Q':
			break;
		}
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_COWNERS_MENU:
		switch (*arg) {
		case 'a':
		case 'A':
			write_to_output(d, TRUE, "\r\nEnter player name : ");
			OLC_MODE(d) = HEDIT_NEW_COWNER;
			return;
		case 'l':
		case 'L':
			hedit_owners_menu(d);
			return;
		case 'd':
		case 'D':
			write_to_output(d, TRUE, "\r\nDelete which co-owner? : ");
			OLC_MODE(d) = HEDIT_DELETE_COWNER;
			return;
		case 'q':
		case 'Q':
			break;
		}
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_GUESTS_MENU:
		switch (*arg) {
		case 'a':
		case 'A':
			write_to_output(d, TRUE, "\r\nEnter player name : ");
			OLC_MODE(d) = HEDIT_NEW_GUEST;
			return;
		case 'l':
		case 'L':
			hedit_guests_menu(d);
			return;
		case 'd':
		case 'D':
			write_to_output(d, TRUE, "\r\nDelete which guest? : ");
			OLC_MODE(d) = HEDIT_DELETE_GUEST;
			return;
		case 'q':
		case 'Q':
			break;
		}
		break;
/*-------------------------------------------------------------------*/
		/*
		 * Numerical responses.
		 */
/*-------------------------------------------------------------------*/
	case HEDIT_OWNER:
		if ((i = get_id_by_name(arg)) == NOBODY) {
			write_to_output(d, TRUE, "No such player, try again : ");
			return;
		}
		H_OWNER(OLC_HOUSE(d)) = i;
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_ATRIUM:
		if ((i = real_room(atoi(arg))) == NOWHERE) {
			write_to_output(d, TRUE, "No such room, try again : ");
			return;
		}
		if ((find_house(atoi(arg))) != NOWHERE) {
			write_to_output(d, TRUE, "That's a house room, try again : ");
			return;
		}
		H_ATRIUM(OLC_HOUSE(d)) = atoi(arg);
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_EXIT:
		/* Check for a valid exit. */
		if (atoi(arg) < 0 || atoi(arg) >= NUM_OF_DIRS) {
			write_to_output(d, TRUE, "\r\n&RThat's not a valid exit.&n\r\n\r\n");
			hedit_exits_menu(d);
			return;
		}
		/* Make sure we have a start room (first in list). */
		if ((i = real_room(H_ROOM(OLC_HOUSE(d), 0))) == NOWHERE) {
			write_to_output(d, TRUE, "\r\n&RYou have to define the starting room first.&n\r\n\r\n");
			break;
		}
		/* Make sure we have an atrium. */
		if ((j = real_room(H_ATRIUM(OLC_HOUSE(d)))) == NOWHERE) {
			write_to_output(d, TRUE, "\r\n&RYou have to define the atrium room first.&n\r\n\r\n");
			break;
		}
		/* Check for a valid exit leading out from start room. */
		if (TOROOM(i, atoi(arg)) == NOWHERE) {
			write_to_output(d, TRUE, "\r\n&RThere is no exit %s from room %d.&n\r\n\r\n", dirs[atoi(arg)], H_ROOM(OLC_HOUSE(d), 0));
			hedit_exits_menu(d);
			return;
		}
		/* Check for a valid return exit from the atrium. */
		if (TOROOM(j, rev_dir[atoi(arg)]) != i) {
			write_to_output(d, TRUE, "\r\n&RThe returning exit %s does not come from the atrium %d.&n\r\n\r\n", dirs[rev_dir[atoi(arg)]], H_ATRIUM(OLC_HOUSE(d)));
			hedit_exits_menu(d);
			return;
		}
		H_EXIT(OLC_HOUSE(d)) = atoi(arg);
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_MODE:
		i = atoi(arg);
		if (i < 0 || i >= NUM_HOUSE_FLAGS) {
			write_to_output(d, TRUE, "\r\n&RThat's not a valid house type.&n\r\n\r\n");
			hedit_modes_menu(d);
			return;
		}
		H_MODE(OLC_HOUSE(d)) = i;
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_PRUNE_SAFE:
		i = atoi(arg);
		if (i < 0 || i > 1) {
			write_to_output(d, TRUE, "\r\n&RValid choices are 0 or 1.&n\r\n\r\n");
			hedit_prune_safe_menu(d);
			return;
		}
		H_PRUNE_SAFE(OLC_HOUSE(d)) = i;
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_COST:
		H_COST(OLC_HOUSE(d)) = atoi(arg);
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_MAX_SECURE:
		if ((i = atoi(arg)) > HOUSE_MAX_SECURES) {
			write_to_output(d, TRUE, "Valid ranges are 0-%d : ", HOUSE_MAX_SECURES);
			return;
		}
		H_MAX_SECURE(OLC_HOUSE(d)) = i;
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_MAX_LOCKED:
		if ((i = atoi(arg)) > HOUSE_MAX_LOCKS) {
			write_to_output(d, TRUE, "Valid ranges are 0-%d : ", HOUSE_MAX_LOCKS);
			return;
		}
		H_MAX_LOCKED(OLC_HOUSE(d)) = i;
		break;
/*-------------------------------------------------------------------*/
	case HEDIT_NEW_ROOM:
		if ((i = atoi(arg)) != -1)
			if ((i = real_room(i)) < 0) {
				write_to_output(d, TRUE, "That room does not exist, try again : ");
				return;
			}
		if (i >= 0)
			add_to_house_list(&(H_ROOMS(OLC_HOUSE(d))), atoi(arg));
		hedit_rooms_menu(d);
		return;
	case HEDIT_DELETE_ROOM:
		remove_from_house_list(&(H_ROOMS(OLC_HOUSE(d))), atoi(arg));
		hedit_rooms_menu(d);
		return;

/*-------------------------------------------------------------------*/
	case HEDIT_NEW_COWNER:
		if ((i = get_id_by_name(arg)) == NOBODY) {
			write_to_output(d, TRUE, "No such player, try again : ");
			return;
		}
		if (i == H_OWNER(OLC_HOUSE(d))) {
			write_to_output(d, TRUE, "That player already owns the house, try again : ");
			return;
		}
		for (j = 0; H_COWNER(OLC_HOUSE(d), j) != NOBODY; j++) {
			if (i == H_COWNER(OLC_HOUSE(d), j)) {
				write_to_output(d, TRUE, "That player has already been added, try again : ");
				return;
			}
		}
		for (j = 0; H_GUEST(OLC_HOUSE(d), j) != NOBODY; j++) {
			if (i == H_GUEST(OLC_HOUSE(d), j)) {
				write_to_output(d, TRUE, "That player is listed as a guest, try again : ");
				return;
			}
		}
		if (i >= 0)
			add_to_house_list(&(H_COWNERS(OLC_HOUSE(d))), i);
		hedit_owners_menu(d);
		return;
	case HEDIT_DELETE_COWNER:
		remove_from_house_list(&(H_COWNERS(OLC_HOUSE(d))), atoi(arg));
		hedit_owners_menu(d);
		return;
/*-------------------------------------------------------------------*/
	case HEDIT_NEW_GUEST:
		if ((i = get_id_by_name(arg)) == NOBODY) {
			write_to_output(d, TRUE, "No such player, try again : ");
			return;
		}
		if (i == H_OWNER(OLC_HOUSE(d))) {
			write_to_output(d, TRUE, "That player already owns the house, try again : ");
			return;
		}
		for (j = 0; H_COWNER(OLC_HOUSE(d), j) != NOBODY; j++) {
			if (i == H_COWNER(OLC_HOUSE(d), j)) {
				write_to_output(d, TRUE, "That player is a co-owner, try again : ");
				return;
			}
		}
		for (j = 0; H_GUEST(OLC_HOUSE(d), j) != NOBODY; j++) {
			if (i == H_GUEST(OLC_HOUSE(d), j)) {
				write_to_output(d, TRUE, "That player has already been added, try again : ");
				return;
			}
		}
		if (i >= 0)
			add_to_house_list(&(H_GUESTS(OLC_HOUSE(d))), i);
		hedit_guests_menu(d);
		return;
	case HEDIT_DELETE_GUEST:
		remove_from_house_list(&(H_GUESTS(OLC_HOUSE(d))), atoi(arg));
		hedit_guests_menu(d);
		return;
/*-------------------------------------------------------------------*/
	default:
		/*
		 * We should never get here.
		 */
		cleanup_olc(d, CLEANUP_ALL);
		extended_mudlog(NRM, SYSL_BUGS, TRUE, "OLC: hedit_parse(): Reached default case!");
		write_to_output(d, TRUE, "Oops...\r\n");
		break;
	}
/*-------------------------------------------------------------------*/

/*
 * END OF CASE 
 * If we get here, we have probably changed something, and now want to
 * return to main menu.  Use OLC_VAL as a 'has changed' flag.
 */
	OLC_VAL(d) = 1;
	hedit_disp_menu(d);
}
コード例 #28
0
ファイル: olc_redit.c プロジェクト: Onirik79/bardmud
void redit_parse( DESCRIPTOR_DATA *d , char *arg )
{
	ROOM_DATA		 *room  = d->character->dest_buf;
	ROOM_DATA		 *tmp;
	EXIT_DATA		 *pexit = d->character->spare_ptr;
	EXTRA_DESCR_DATA *ed	  = d->character->spare_ptr;
	char			  arg1[MIL];
	char			  buf[MSL];
	int				  number = 0;

	switch ( OLC_MODE(d) )
	{
	  case REDIT_CONFIRM_SAVESTRING:
		switch ( *arg )
		{
		  case 'y':
		  case 'Y':
			/* redit_save_internally(d); */
			send_log( NULL, LOG_OLC, "OLC: %s edits room %d", d->character->name, OLC_NUM(d) );
			cleanup_olc( d );
			send_to_char( d->character, "Room saved to memory.\r\n" );
			break;
		  case 'n':
		  case 'N':
			cleanup_olc( d );
			break;
		  default:
			send_to_char( d->character, "Invalid choice!\r\n" );
			send_to_char( d->character, "Do you wish to save this room internally? : " );
			break;
		}
		return;

	  case REDIT_MAIN_MENU:
		switch ( *arg )
		{
		  case 'q':
		  case 'Q':
/*			if ( OLC_CHANGE(d) )
			{ *. Something has been modified .*
				send_to_char( d->character, "Do you wish to save this room internally? : " );
				OLC_MODE(d) = REDIT_CONFIRM_SAVESTRING;
			}
			else */
			cleanup_olc( d );
			return;
		  case '1':
			send_to_char( d->character, "Enter room name:-\r\n| " );
			OLC_MODE(d) = REDIT_NAME;
			break;
		  case '2':
			OLC_MODE(d) = REDIT_DESC;
			d->character->substate = SUB_ROOM_DESCR;
			d->character->last_cmd = do_redit_reset;

			send_to_char( d->character, "Enter room description:-\r\n" );
			if ( !room->description )
				room->description = str_dup( "" );
			start_editing( d->character, room->description );
			break;
		  case '3':
			redit_disp_flag_menu(d);
			break;
		  case '4':
			redit_disp_sector_menu(d);
			break;
		  case '5':
			send_to_char( d->character, "How many people can fit in the room? " );
			OLC_MODE(d) = REDIT_TUNNEL;
			break;
		  case '6':
			send_to_char( d->character, "How long before people are teleported out? " );
			OLC_MODE(d) = REDIT_TELEDELAY;
			break;
		  case '7':
			send_to_char( d->character, "Where are they teleported to? " );
			OLC_MODE(d) = REDIT_TELEVNUM;
			break;
		  case 'a':
		  case 'A':
			redit_disp_exit_menu(d);
			break;
		  case 'b':
		  case 'B':
			redit_disp_extradesc_menu(d);
			break;

		  default:
			send_to_char( d->character, "Invalid choice!" );
			redit_disp_menu(d);
			break;
		}
		return;

	  case REDIT_NAME:
		DISPOSE( room->name );
		room->name = str_dup( arg );
		olc_log( d, "Changed name to %s", room->name );
		break;

	  case REDIT_DESC:
		/* we will NEVER get here */
		send_log( NULL, LOG_OLC, "redit_parse: reached REDIT_DESC case in redit_parse" );
		break;

	  case REDIT_FLAGS:
		if ( is_number(arg) )
		{
			number = atoi( arg );
			if ( number == 0 )
				break;
			else if ( number < 0 || number >= MAX_ROOM )
			{
				send_to_char( d->character, "Invalid flag, try again: " );
				return;
			}
			else
			{
				number--;	/* Offset for 0 */
				TOGGLE_BIT( room->flags, number );
				olc_log( d, "%s the room flag %s",
				HAS_BIT( room->flags, number ) ? "Added" : "Removed",
				code_name(NULL, number, CODE_ROOM) );
			}
		}
		else
		{
			while ( VALID_STR(arg) )
			{
				arg = one_argument( arg, arg1 );
				number = code_num( NULL, arg1, CODE_ROOM );
				if ( number > 0 )
				{
					TOGGLE_BIT( room->flags, number );
					olc_log( d, "%s the room flag %s",
						HAS_BIT( room->flags, number ) ? "Added" : "Removed",
						code_name( NULL, number, CODE_ROOM) );
				}
			}
		}
		redit_disp_flag_menu(d);
		return;

	  case REDIT_SECTOR:
		number = atoi( arg );
		if ( number < 0 || number >= MAX_SECTOR )
		{
			send_to_char( d->character, "Invalid choice!" );
			redit_disp_sector_menu(d);
			return;
		}
		else
			room->sector = number;

		olc_log( d, "Changed sector to %s", code_name(NULL, number, CODE_SECTOR) );
		break;

	  case REDIT_TUNNEL:
		number = atoi( arg );
		room->tunnel = URANGE( 0, number, 1000 );
		olc_log( d, "Changed tunnel amount to %d", room->tunnel );
		break;

	  case REDIT_TELEDELAY:
		number = atoi( arg );
		room->tele_delay = number;
		olc_log( d, "Changed teleportation delay to %d", room->tele_delay );
		break;

	  case REDIT_TELEVNUM:
		number = atoi( arg );
		room->tele_vnum = URANGE( 1, number, MAX_VNUM-1 );
		olc_log( d, "Changed teleportation vnum to %d", room->tele_vnum );
		break;

	  case REDIT_EXIT_MENU:
		switch ( toupper(arg[0]) )
		{
		  default:
			if ( is_number(arg) )
			{
				number = atoi( arg );
				pexit = get_exit_num( room, number );
				d->character->spare_ptr = pexit;
				redit_disp_exit_edit(d);
				return;
			}
			redit_disp_exit_menu( d );
			return;
		  case 'A':
			OLC_MODE(d) = REDIT_EXIT_ADD;
			redit_disp_exit_dirs( d );
			return;
		  case 'R':
			OLC_MODE(d) = REDIT_EXIT_DELETE;
			send_to_char( d->character, "Delete which exit? " );
			return;
		  case 'Q':
			d->character->spare_ptr = NULL;
			break;
		}
		break;

	  case REDIT_EXIT_EDIT:
		switch ( toupper(arg[0]) )
		{
		  case 'Q':
			d->character->spare_ptr = NULL;
			redit_disp_exit_menu(d);
			return;
		  case '1':
			/* OLC_MODE(d) = REDIT_EXIT_DIR;
			redit_disp_exit_dirs(d); */
			send_to_char( d->character, "This option can only be changed by remaking the exit.\r\n" );
			break;
		  case '2':
			OLC_MODE(d) = REDIT_EXIT_VNUM;
			send_to_char( d->character, "Which room does this exit go to? " );
			return;
		  case '3':
			OLC_MODE(d) = REDIT_EXIT_KEY;
			send_to_char( d->character, "What is the vnum of the key to this exit? " );
			return;
		  case '4':
			OLC_MODE(d) = REDIT_EXIT_KEYWORD;
			send_to_char( d->character, "What is the keyword to this exit? " );
			return;
		  case '5':
			OLC_MODE(d) = REDIT_EXIT_FLAGS;
			redit_disp_exit_flag_menu(d);
			return;
		  case '6':
			OLC_MODE(d) = REDIT_EXIT_DESC;
			send_to_char( d->character, "Description:\r\n] " );
			return;
		}
		redit_disp_exit_edit(d);
		return;

	  case REDIT_EXIT_DESC:
		if ( !VALID_STR(arg) )
		{
			DISPOSE( pexit->description );
			pexit->description = str_dup( "" );
		}
		else
		{
			sprintf( buf, "%s\r\n", arg );
			DISPOSE( pexit->description );
			pexit->description = str_dup( buf );
		}
		olc_log( d, "Changed %s description to %s", code_name( NULL, pexit->vdir, CODE_DIR), arg  ?  arg  :  "none" );
		redit_disp_exit_edit(d);
		return;

	  case REDIT_EXIT_ADD:
		if ( is_number( arg ) )
		{
			number = atoi( arg );
			if ( number < 0 || number >= MAX_DIR )
			{
				send_to_char( d->character, "Invalid direction, try again: " );
				return;
			}
			d->character->tempnum = number;
		}
		else
		{
			number = get_dir(arg);
			pexit = get_exit( room, number );
			if ( pexit )
			{
				send_to_char( d->character, "An exit in that direction already exists.\r\n" );
				redit_disp_exit_menu(d);
				return;
			}
			d->character->tempnum = number;
		}
		OLC_MODE(d) = REDIT_EXIT_ADD_VNUM;
		send_to_char( d->character, "Which room does this exit go to? " );
		return;

	  case REDIT_EXIT_ADD_VNUM:
		number = atoi( arg );
		if ( (tmp = get_room_index(NULL, number)) == NULL )
		{
			send_to_char( d->character, "Non-existant room.\r\n" );
			OLC_MODE(d) = REDIT_EXIT_MENU;
			redit_disp_exit_menu(d);
			return;
		}
		pexit = make_exit( room, tmp, d->character->tempnum );
		DISPOSE( pexit->keyword );
		DISPOSE( pexit->description );
		pexit->keyword		= str_dup( "" );
		pexit->description	= str_dup( "" );
		pexit->key			= -1;
		pexit->flags	= 0;
		act( AT_ADMIN, "$n reveals a hidden passage!", d->character, NULL, NULL, TO_ROOM );
		d->character->spare_ptr = pexit;

		olc_log( d, "Added %s exit to %d", code_name( NULL, pexit->vdir, CODE_DIR), pexit->vnum );

		OLC_MODE(d) = REDIT_EXIT_EDIT;
		redit_disp_exit_edit(d);
		return;

	  case REDIT_EXIT_DELETE:
		if ( !is_number( arg ) )
		{
			send_to_char( d->character, "Exit must be specified in a number.\r\n" );
			redit_disp_exit_menu(d);
		}
		number = atoi( arg );
		pexit = get_exit_num( room, number );

		if ( !pexit )
		{
			send_to_char( d->character, "That exit does not exist.\r\n" );
			redit_disp_exit_menu(d);
		}
		olc_log( d, "Removed %s exit", code_name( NULL, pexit->vdir, CODE_DIR) );
		extract_exit( room, pexit );
		redit_disp_exit_menu( d );
		return;

	  case REDIT_EXIT_VNUM:
		number = atoi( arg );
		if ( number < 1 || number >= MAX_VNUM )
		{
			send_to_char( d->character, "Invalid room number, try again : " );
			return;
		}

		if ( get_room_index(NULL, number) == NULL )
		{
			send_to_char( d->character, "That room does not exist, try again: " );
			return;
		}
		pexit->vnum = number;
		olc_log( d, "%s exit vnum changed to %d", code_name( NULL, pexit->vdir, CODE_DIR), pexit->vnum );
		redit_disp_exit_menu( d );
		return;

	  case REDIT_EXIT_KEYWORD:
		DISPOSE( pexit->keyword );
		pexit->keyword = str_dup( arg );
		olc_log( d, "Changed %s keyword to %s", code_name( NULL, pexit->vdir, CODE_DIR), pexit->keyword );
		redit_disp_exit_edit( d );
		return;

	  case REDIT_EXIT_KEY:
		number = atoi( arg );
		if ( number < 1 || number >= MAX_VNUM )
			send_to_char( d->character, "Invalid vnum, try again: " );
		else
		{
			pexit->key = number;
			redit_disp_exit_edit( d );
		}
		olc_log( d, "%s key vnum is now %d", code_name( NULL, pexit->vdir, CODE_DIR), pexit->key );
		return;

	  case REDIT_EXIT_FLAGS:
		number = atoi( arg );
		if ( number == 0 )
		{
			redit_disp_exit_edit( d );
			return;
		}

		if ( number < 0 || number >= MAX_EXIT
		  || ((number-1) == EXIT_RES1)
		  || ((number-1) == EXIT_RES2)
		  || ((number-1) == EXIT_PORTAL) )
		{
			send_to_char( d->character, "That's not a valid choice!\r\n" );
			redit_disp_exit_flag_menu( d );
		}
		number -= 1;
		TOGGLE_BIT( pexit->flags, number );
		olc_log( d, "%s %s to %s exit",
			HAS_BIT(pexit->flags, number)  ?  "Added"  :  "Removed",
			code_name(NULL, number, CODE_EXIT),
			code_name(NULL, pexit->vdir, CODE_DIR) );
		redit_disp_exit_flag_menu( d );
		return;

	  case REDIT_EXTRADESC_DELETE:
		ed = redit_find_extradesc( room, atoi(arg) );
		if ( !ed )
		{
			send_to_char( d->character, "Not found, try again: " );
			return;
		}
		olc_log( d, "Deleted exdesc %s", ed->keyword );
		UNLINK( ed, room->first_extradescr, room->last_extradescr, next, prev );
		DISPOSE( ed->keyword );
		DISPOSE( ed->description );
		DISPOSE( ed );
		top_ed--;
		redit_disp_extradesc_menu(d);
		return;

	  case REDIT_EXTRADESC_CHOICE:
		switch ( toupper( arg[0] ) )
		{
		  case 'Q':
			if ( !ed->keyword || !ed->description )
			{
				send_to_char( d->character, "No keyword and/or description, junking..." );
				UNLINK( ed, room->first_extradescr, room->last_extradescr, next, prev );
				DISPOSE( ed->keyword );
				DISPOSE( ed->keyword );
				DISPOSE( ed );
				top_ed--;
			}
			d->character->spare_ptr = NULL;
			redit_disp_extradesc_menu(d);
			return;
		  case '1':
			OLC_MODE(d) = REDIT_EXTRADESC_KEY;
			send_to_char( d->character, "Keywords, seperated by spaces: " );
			return;
		  case '2':
			OLC_MODE(d) = REDIT_EXTRADESC_DESCRIPTION;
			d->character->substate = SUB_ROOM_EXTRA;
			d->character->last_cmd = do_redit_reset;
			send_to_char( d->character, "Enter new extradesc description: \r\n" );
			start_editing( d->character, ed->description );
			return;
		}
		break;

	  case REDIT_EXTRADESC_KEY:
/*		if ( SetRExtra( room, arg ) )
		{
			send_to_char( d->character, "A extradesc with that keyword already exists.\r\n" );
			redit_disp_extradesc_menu(d);
			return;
		} */
		olc_log( d, "Changed exkey %s to %s", ed->keyword, arg );
		DISPOSE( ed->keyword );
		ed->keyword = str_dup( arg );
		oedit_disp_extra_choice(d);
		OLC_MODE(d) = REDIT_EXTRADESC_CHOICE;
		return;

	  case REDIT_EXTRADESC_MENU:
		switch ( toupper( arg[0] ) )
		{
		  case 'Q':
			break;
		  case 'A':
			CREATE( ed, EXTRA_DESCR_DATA, 1 );
			LINK( ed, room->first_extradescr, room->last_extradescr, next, prev );
			ed->keyword = str_dup( "" );
			ed->description = str_dup( "" );
			top_ed++;
			d->character->spare_ptr = ed;
			olc_log( d, "Added new exdesc" );
			oedit_disp_extra_choice(d);
			OLC_MODE(d) = REDIT_EXTRADESC_CHOICE;
			return;
		  case 'R':
			OLC_MODE(d) = REDIT_EXTRADESC_DELETE;
			send_to_char( d->character, "Delete which extra description? " );
			return;
		  default:
			if ( is_number(arg) )
			{
				ed = redit_find_extradesc( room, atoi(arg) );
				if ( !ed )
				{
					send_to_char( d->character, "Not found, try again: " );
					return;
				}
				d->character->spare_ptr = ed;
				oedit_disp_extra_choice(d);
				OLC_MODE(d) = REDIT_EXTRADESC_CHOICE;
			}
			else
				redit_disp_extradesc_menu(d);

			return;
		}
		break;

	  default:
		/* we should never get here */
		send_log( NULL, LOG_OLC, "redit_parse: reached default case in parse_redit" );
		break;
	} /* chiude lo switch */
	/* Log the changes, so we can keep track of those sneaky bastards */
	/* Don't log on the flags cause it does that above */
/*	if ( OLC_MODE(d) != REDIT_FLAGS )
		olc_log( d, arg );
*/
	/*. If we get this far, something has be changed .*/
	OLC_CHANGE(d) = TRUE;
	redit_disp_menu(d);
}
コード例 #29
0
ファイル: medit.c プロジェクト: axanon/tbamud
void medit_parse(struct descriptor_data *d, char *arg)
{
  int i = -1, j;
  char *oldtext = NULL;

  if (OLC_MODE(d) > MEDIT_NUMERICAL_RESPONSE) {
    i = atoi(arg);
    if (!*arg || (!isdigit(arg[0]) && ((*arg == '-') && !isdigit(arg[1])))) {
      write_to_output(d, "Try again : ");
      return;
    }
  } else {	/* String response. */
    if (!genolc_checkstring(d, arg))
      return;
  }
  switch (OLC_MODE(d)) {
  case MEDIT_CONFIRM_SAVESTRING:
    /* Ensure mob has MOB_ISNPC set. */
    SET_BIT_AR(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC);
    switch (*arg) {
    case 'y':
    case 'Y':
      /* Save the mob in memory and to disk. */
      medit_save_internally(d);
      mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d));
      if (CONFIG_OLC_SAVE) {
        medit_save_to_disk(zone_table[real_zone_by_thing(OLC_NUM(d))].number);
        write_to_output(d, "Mobile saved to disk.\r\n");
      } else
        write_to_output(d, "Mobile saved to memory.\r\n");
      cleanup_olc(d, CLEANUP_ALL);
      return;
    case 'n':
    case 'N':
      /* If not saving, we must free the script_proto list. We do so by
       * assigning it to the edited mob and letting free_mobile in
       * cleanup_olc handle it. */
      OLC_MOB(d)->proto_script = OLC_SCRIPT(d);
      cleanup_olc(d, CLEANUP_ALL);
      return;
    default:
      write_to_output(d, "Invalid choice!\r\n");
      write_to_output(d, "Do you wish to save your changes? : ");
      return;
    }
    break;

  case MEDIT_MAIN_MENU:
    i = 0;
    switch (*arg) {
    case 'q':
    case 'Q':
      if (OLC_VAL(d)) {	/* Anything been changed? */
	write_to_output(d, "Do you wish to save your changes? : ");
	OLC_MODE(d) = MEDIT_CONFIRM_SAVESTRING;
      } else
	cleanup_olc(d, CLEANUP_ALL);
      return;
    case '1':
      OLC_MODE(d) = MEDIT_SEX;
      medit_disp_sex(d);
      return;
    case '2':
      OLC_MODE(d) = MEDIT_KEYWORD;
      i--;
      break;
    case '3':
      OLC_MODE(d) = MEDIT_S_DESC;
      i--;
      break;
    case '4':
      OLC_MODE(d) = MEDIT_L_DESC;
      i--;
      break;
    case '5':
      OLC_MODE(d) = MEDIT_D_DESC;
      send_editor_help(d);
      write_to_output(d, "Enter mob description:\r\n\r\n");
      if (OLC_MOB(d)->player.description) {
	write_to_output(d, "%s", OLC_MOB(d)->player.description);
	oldtext = strdup(OLC_MOB(d)->player.description);
      }
      string_write(d, &OLC_MOB(d)->player.description, MAX_MOB_DESC, 0, oldtext);
      OLC_VAL(d) = 1;
      return;
    case '6':
      OLC_MODE(d) = MEDIT_POS;
      medit_disp_positions(d);
      return;
    case '7':
      OLC_MODE(d) = MEDIT_DEFAULT_POS;
      medit_disp_positions(d);
      return;
    case '8':
      OLC_MODE(d) = MEDIT_ATTACK;
      medit_disp_attack_types(d);
      return;
    case '9':
      OLC_MODE(d) = MEDIT_STATS_MENU;
      medit_disp_stats_menu(d);
      return;
    case 'a':
    case 'A':
      OLC_MODE(d) = MEDIT_NPC_FLAGS;
      medit_disp_mob_flags(d);
      return;
    case 'b':
    case 'B':
      OLC_MODE(d) = MEDIT_AFF_FLAGS;
      medit_disp_aff_flags(d);
      return;
    case 'w':
    case 'W':
      write_to_output(d, "Copy what mob? ");
      OLC_MODE(d) = MEDIT_COPY;
      return;
    case 'x':
    case 'X':
      write_to_output(d, "Are you sure you want to delete this mobile? ");
      OLC_MODE(d) = MEDIT_DELETE;
      return;
    case 's':
    case 'S':
      OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
      dg_script_menu(d);
      return;
    default:
      medit_disp_menu(d);
      return;
    }
    if (i == 0)
      break;
    else if (i == 1)
      write_to_output(d, "\r\nEnter new value : ");
    else if (i == -1)
      write_to_output(d, "\r\nEnter new text :\r\n] ");
    else
      write_to_output(d, "Oops...\r\n");
    return;

  case MEDIT_STATS_MENU:
    i=0;
    switch(*arg) {
    case 'q':
    case 'Q':
      medit_disp_menu(d);
      return;
    case '1':  /* Edit level */
      OLC_MODE(d) = MEDIT_LEVEL;
      i++;
      break;
    case '2':  /* Autoroll stats */
      medit_autoroll_stats(d);
      medit_disp_stats_menu(d);
      OLC_VAL(d) = TRUE;
      return;
    case '3':
      OLC_MODE(d) = MEDIT_NUM_HP_DICE;
      i++;
      break;
    case '4':
      OLC_MODE(d) = MEDIT_SIZE_HP_DICE;
      i++;
      break;
    case '5':
      OLC_MODE(d) = MEDIT_ADD_HP;
      i++;
      break;
    case '6':
      OLC_MODE(d) = MEDIT_NDD;
      i++;
      break;
    case '7':
      OLC_MODE(d) = MEDIT_SDD;
      i++;
      break;
    case '8':
      OLC_MODE(d) = MEDIT_DAMROLL;
      i++;
      break;
    case 'a':
    case 'A':
      OLC_MODE(d) = MEDIT_AC;
      i++;
      break;
    case 'b':
    case 'B':
      OLC_MODE(d) = MEDIT_EXP;
      i++;
      break;
    case 'c':
    case 'C':
      OLC_MODE(d) = MEDIT_GOLD;
      i++;
      break;
    case 'd':
    case 'D':
      OLC_MODE(d) = MEDIT_HITROLL;
      i++;
      break;
    case 'e':
    case 'E':
      OLC_MODE(d) = MEDIT_ALIGNMENT;
      i++;
      break;
    case 'f':
    case 'F':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_STR;
      i++;
      break;
    case 'g':
    case 'G':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_INT;
      i++;
      break;
    case 'h':
    case 'H':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_WIS;
      i++;
      break;
    case 'i':
    case 'I':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_DEX;
      i++;
      break;
    case 'j':
    case 'J':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_CON;
      i++;
      break;
    case 'k':
    case 'K':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_CHA;
      i++;
      break;
    case 'l':
    case 'L':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_PARA;
      i++;
      break;
    case 'm':
    case 'M':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_ROD;
      i++;
      break;
    case 'n':
    case 'N':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_PETRI;
      i++;
      break;
    case 'o':
    case 'O':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_BREATH;
      i++;
      break;
    case 'p':
    case 'P':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_SPELL;
      i++;
      break;
    default:
      medit_disp_stats_menu(d);
      return;
    }
    if (i == 0)
      break;
    else if (i == 1)
      write_to_output(d, "\r\nEnter new value : ");
    else if (i == -1)
      write_to_output(d, "\r\nEnter new text :\r\n] ");
    else
      write_to_output(d, "Oops...\r\n");
    return;

  case OLC_SCRIPT_EDIT:
    if (dg_script_edit_parse(d, arg)) return;
    break;

  case MEDIT_KEYWORD:
    smash_tilde(arg);
    if (GET_ALIAS(OLC_MOB(d)))
      free(GET_ALIAS(OLC_MOB(d)));
    GET_ALIAS(OLC_MOB(d)) = str_udup(arg);
    break;

  case MEDIT_S_DESC:
    smash_tilde(arg);
    if (GET_SDESC(OLC_MOB(d)))
      free(GET_SDESC(OLC_MOB(d)));
    GET_SDESC(OLC_MOB(d)) = str_udup(arg);
    break;

  case MEDIT_L_DESC:
    smash_tilde(arg);
    if (GET_LDESC(OLC_MOB(d)))
      free(GET_LDESC(OLC_MOB(d)));
    if (arg && *arg) {
      char buf[MAX_INPUT_LENGTH];
      snprintf(buf, sizeof(buf), "%s\r\n", arg);
      GET_LDESC(OLC_MOB(d)) = strdup(buf);
    } else
      GET_LDESC(OLC_MOB(d)) = strdup("undefined");

    break;

  case MEDIT_D_DESC:
    /*
     * We should never get here.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached D_DESC case!");
    write_to_output(d, "Oops...\r\n");
    break;

  case MEDIT_NPC_FLAGS:
    if ((i = atoi(arg)) <= 0)
      break;
    else if ( (j = medit_get_mob_flag_by_number(i)) == -1) {
       write_to_output(d, "Invalid choice!\r\n");
       write_to_output(d, "Enter mob flags (0 to quit) :");
       return;
    } else if (j <= NUM_MOB_FLAGS) {
      TOGGLE_BIT_AR(MOB_FLAGS(OLC_MOB(d)), (j));
    }
    medit_disp_mob_flags(d);
    return;

  case MEDIT_AFF_FLAGS:
    if ((i = atoi(arg)) <= 0)
      break;
    else if (i <= NUM_AFF_FLAGS)
      TOGGLE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), i);

    /* Remove unwanted bits right away. */
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_CHARM);
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_POISON);
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_GROUP);
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_SLEEP);
    medit_disp_aff_flags(d);
    return;

/* Numerical responses. */

  case MEDIT_SEX:
    GET_SEX(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_GENDERS - 1);
    break;

  case MEDIT_HITROLL:
    GET_HITROLL(OLC_MOB(d)) = LIMIT(i, 0, 50);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_DAMROLL:
    GET_DAMROLL(OLC_MOB(d)) = LIMIT(i, 0, 50);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_NDD:
    GET_NDD(OLC_MOB(d)) = LIMIT(i, 0, 30);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_SDD:
    GET_SDD(OLC_MOB(d)) = LIMIT(i, 0, 127);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_NUM_HP_DICE:
    GET_HIT(OLC_MOB(d)) = LIMIT(i, 0, 30);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_SIZE_HP_DICE:
    GET_MANA(OLC_MOB(d)) = LIMIT(i, 0, 1000);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_ADD_HP:
    GET_MOVE(OLC_MOB(d)) = LIMIT(i, 0, 30000);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_AC:
    GET_AC(OLC_MOB(d)) = LIMIT(i, -200, 200);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_EXP:
    GET_EXP(OLC_MOB(d)) = LIMIT(i, 0, MAX_MOB_EXP);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_GOLD:
    GET_GOLD(OLC_MOB(d)) = LIMIT(i, 0, MAX_MOB_GOLD);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_STR:
    GET_STR(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_INT:
    GET_INT(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_WIS:
    GET_WIS(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_DEX:
    GET_DEX(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_CON:
    GET_CON(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_CHA:
    GET_CHA(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_PARA:
    GET_SAVE(OLC_MOB(d), SAVING_PARA) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_ROD:
    GET_SAVE(OLC_MOB(d), SAVING_ROD) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_PETRI:
    GET_SAVE(OLC_MOB(d), SAVING_PETRI) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_BREATH:
    GET_SAVE(OLC_MOB(d), SAVING_BREATH) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_SPELL:
    GET_SAVE(OLC_MOB(d), SAVING_SPELL) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_POS:
    GET_POS(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_POSITIONS - 1);
    break;

  case MEDIT_DEFAULT_POS:
    GET_DEFAULT_POS(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_POSITIONS - 1);
    break;

  case MEDIT_ATTACK:
    GET_ATTACK(OLC_MOB(d)) = LIMIT(i, 0, NUM_ATTACK_TYPES - 1);
    break;

  case MEDIT_LEVEL:
    GET_LEVEL(OLC_MOB(d)) = LIMIT(i, 1, LVL_IMPL);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_ALIGNMENT:
    GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_COPY:
    if ((i = real_mobile(atoi(arg))) != NOWHERE) {
      medit_setup_existing(d, i);
    } else
      write_to_output(d, "That mob does not exist.\r\n");
    break;

  case MEDIT_DELETE:
    if (*arg == 'y' || *arg == 'Y') {
      if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))) != NOBODY)
        write_to_output(d, "Mobile deleted.\r\n");
      else
        write_to_output(d, "Couldn't delete the mobile!\r\n");

      cleanup_olc(d, CLEANUP_ALL);
      return;
    } else if (*arg == 'n' || *arg == 'N') {
      medit_disp_menu(d);
      OLC_MODE(d) = MEDIT_MAIN_MENU;
      return;
    } else
      write_to_output(d, "Please answer 'Y' or 'N': ");
    break;

  default:
    /* We should never get here. */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached default case!");
    write_to_output(d, "Oops...\r\n");
    break;
  }

/* END OF CASE If we get here, we have probably changed something, and now want
   to return to main menu.  Use OLC_VAL as a 'has changed' flag */

  OLC_VAL(d) = TRUE;
  medit_disp_menu(d);
}
コード例 #30
0
ファイル: oedit.c プロジェクト: mysidia/circle31dgpy
void oedit_parse(struct descriptor_data *d, char *arg)
{
  int number, max_val, min_val;
  char *oldtext = NULL;

  switch (OLC_MODE(d)) {

  case OEDIT_CONFIRM_SAVESTRING:
    switch (*arg) {
    case 'y':
    case 'Y':
      write_to_output(d, "Saving object to memory.\r\n");
      oedit_save_internally(d);
      mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits obj %d", GET_NAME(d->character), OLC_NUM(d));
      /* Fall through. */
    case 'n':
    case 'N':
      cleanup_olc(d, CLEANUP_ALL);
      return;
    default:
      write_to_output(d, "Invalid choice!\r\n");
      write_to_output(d, "Do you wish to save this object internally?\r\n");
      return;
    }

  case OEDIT_MAIN_MENU:
    /*
     * Throw us out to whichever edit mode based on user input.
     */
    switch (*arg) {
    case 'q':
    case 'Q':
      if (OLC_VAL(d)) {	/* Something has been modified. */
	write_to_output(d, "Do you wish to save this object internally? : ");
	OLC_MODE(d) = OEDIT_CONFIRM_SAVESTRING;
      } else
	cleanup_olc(d, CLEANUP_ALL);
      return;
    case '1':
      write_to_output(d, "Enter namelist : ");
      OLC_MODE(d) = OEDIT_EDIT_NAMELIST;
      break;
    case '2':
      write_to_output(d, "Enter short desc : ");
      OLC_MODE(d) = OEDIT_SHORTDESC;
      break;
    case '3':
      write_to_output(d, "Enter long desc :-\r\n| ");
      OLC_MODE(d) = OEDIT_LONGDESC;
      break;
    case '4':
      OLC_MODE(d) = OEDIT_ACTDESC;
      send_editor_help(d);
      write_to_output(d, "Enter action description:\r\n\r\n");
      if (OLC_OBJ(d)->action_description) {
	write_to_output(d, "%s", OLC_OBJ(d)->action_description);
	oldtext = strdup(OLC_OBJ(d)->action_description);
      }
      string_write(d, &OLC_OBJ(d)->action_description, MAX_MESSAGE_LENGTH, 0, oldtext);
      OLC_VAL(d) = 1;
      break;
    case '5':
      oedit_disp_type_menu(d);
      OLC_MODE(d) = OEDIT_TYPE;
      break;
    case '6':
      oedit_disp_extra_menu(d);
      OLC_MODE(d) = OEDIT_EXTRAS;
      break;
    case '7':
      oedit_disp_wear_menu(d);
      OLC_MODE(d) = OEDIT_WEAR;
      break;
    case '8':
      write_to_output(d, "Enter weight : ");
      OLC_MODE(d) = OEDIT_WEIGHT;
      break;
    case '9':
      write_to_output(d, "Enter cost : ");
      OLC_MODE(d) = OEDIT_COST;
      break;
    case 'a':
    case 'A':
      write_to_output(d, "Enter cost per day : ");
      OLC_MODE(d) = OEDIT_COSTPERDAY;
      break;
    case 'b':
    case 'B':
      write_to_output(d, "Enter timer : ");
      OLC_MODE(d) = OEDIT_TIMER;
      break;
    case 'c':
    case 'C':
      /*
       * Clear any old values  
       */
      GET_OBJ_VAL(OLC_OBJ(d), 0) = 0;
      GET_OBJ_VAL(OLC_OBJ(d), 1) = 0;
      GET_OBJ_VAL(OLC_OBJ(d), 2) = 0;
      GET_OBJ_VAL(OLC_OBJ(d), 3) = 0;
      oedit_disp_val1_menu(d);
      break;
    case 'd':
    case 'D':
      oedit_disp_prompt_apply_menu(d);
      break;
    case 'e':
    case 'E':
      /*
       * If extra descriptions don't exist.
       */
      if (OLC_OBJ(d)->ex_description == NULL) {
	CREATE(OLC_OBJ(d)->ex_description, struct extra_descr_data, 1);
	OLC_OBJ(d)->ex_description->next = NULL;
      }
      OLC_DESC(d) = OLC_OBJ(d)->ex_description;
      oedit_disp_extradesc_menu(d);
      break;
    case 'm':
    case 'M':
      write_to_output(d, "Enter new minimum level: ");
      OLC_MODE(d) = OEDIT_LEVEL;
      break;
    case 'p':
    case 'P':
      oedit_disp_perm_menu(d);
      OLC_MODE(d) = OEDIT_PERM;
      break;
    case 's':
    case 'S':
      OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
      dg_script_menu(d);
      return;
    default:
      oedit_disp_menu(d);
      break;
    }
    return;			/*
				 * end of OEDIT_MAIN_MENU 
				 */

  case OLC_SCRIPT_EDIT:
    if (dg_script_edit_parse(d, arg)) return;
    break;

  case OEDIT_EDIT_NAMELIST:
    if (!genolc_checkstring(d, arg))
      break;
    if (OLC_OBJ(d)->name)
      free(OLC_OBJ(d)->name);
    OLC_OBJ(d)->name = str_udup(arg);
    break;

  case OEDIT_SHORTDESC:
    if (!genolc_checkstring(d, arg))
      break;
    if (OLC_OBJ(d)->short_description)
      free(OLC_OBJ(d)->short_description);
    OLC_OBJ(d)->short_description = str_udup(arg);
    break;

  case OEDIT_LONGDESC:
    if (!genolc_checkstring(d, arg))
      break;
    if (OLC_OBJ(d)->description)
      free(OLC_OBJ(d)->description);
    OLC_OBJ(d)->description = str_udup(arg);
    break;

  case OEDIT_TYPE:
    number = atoi(arg);
    if ((number < 1) || (number >= NUM_ITEM_TYPES)) {
      write_to_output(d, "Invalid choice, try again : ");
      return;
    } else
      GET_OBJ_TYPE(OLC_OBJ(d)) = number;
    break;

  case OEDIT_EXTRAS:
    number = atoi(arg);
    if ((number < 0) || (number > NUM_ITEM_FLAGS)) {
      oedit_disp_extra_menu(d);
      return;
    } else if (number == 0)
      break;
    else {
      TOGGLE_BIT(GET_OBJ_EXTRA(OLC_OBJ(d)), 1 << (number - 1));
      oedit_disp_extra_menu(d);
      return;
    }

  case OEDIT_WEAR:
    number = atoi(arg);
    if ((number < 0) || (number > NUM_ITEM_WEARS)) {
      write_to_output(d, "That's not a valid choice!\r\n");
      oedit_disp_wear_menu(d);
      return;
    } else if (number == 0)	/* Quit. */
      break;
    else {
      TOGGLE_BIT(GET_OBJ_WEAR(OLC_OBJ(d)), 1 << (number - 1));
      oedit_disp_wear_menu(d);
      return;
    }

  case OEDIT_WEIGHT:
    GET_OBJ_WEIGHT(OLC_OBJ(d)) = atoi(arg);
    break;

  case OEDIT_COST:
    GET_OBJ_COST(OLC_OBJ(d)) = atoi(arg);
    break;

  case OEDIT_COSTPERDAY:
    GET_OBJ_RENT(OLC_OBJ(d)) = atoi(arg);
    break;

  case OEDIT_TIMER:
    GET_OBJ_TIMER(OLC_OBJ(d)) = atoi(arg);
    break;

  case OEDIT_LEVEL:
    GET_OBJ_LEVEL(OLC_OBJ(d)) = atoi(arg);
    break;

  case OEDIT_PERM:
    if ((number = atoi(arg)) == 0)
      break;
    if (number > 0 && number <= NUM_AFF_FLAGS)
      TOGGLE_BIT(GET_OBJ_PERM(OLC_OBJ(d)), 1 << (number - 1));
    oedit_disp_perm_menu(d);
    return;

  case OEDIT_VALUE_1:
    /*
     * Lucky, I don't need to check any of these for out of range values.
     * Hmm, I'm not so sure - Rv  
     */
    GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg);
    /*
     * proceed to menu 2 
     */
    oedit_disp_val2_menu(d);
    return;
  case OEDIT_VALUE_2:
    /*
     * Here, I do need to check for out of range values.
     */
    number = atoi(arg);
    switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
    case ITEM_SCROLL:
    case ITEM_POTION:
      if (number < 0 || number >= NUM_SPELLS)
	oedit_disp_val2_menu(d);
      else {
	GET_OBJ_VAL(OLC_OBJ(d), 1) = number;
	oedit_disp_val3_menu(d);
      }
      break;
    case ITEM_CONTAINER:
      /*
       * Needs some special handling since we are dealing with flag values
       * here.
       */
      if (number < 0 || number > 4)
	oedit_disp_container_flags_menu(d);
      else if (number != 0) {
        TOGGLE_BIT(GET_OBJ_VAL(OLC_OBJ(d), 1), 1 << (number - 1));
        OLC_VAL(d) = 1;
	oedit_disp_val2_menu(d);
      } else
	oedit_disp_val3_menu(d);
      break;

    default:
      GET_OBJ_VAL(OLC_OBJ(d), 1) = number;
      oedit_disp_val3_menu(d);
    }
    return;

  case OEDIT_VALUE_3:
    number = atoi(arg);
    /*
     * Quick'n'easy error checking.
     */
    switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
    case ITEM_SCROLL:
    case ITEM_POTION:
      min_val = -1;
      max_val = NUM_SPELLS - 1;
      break;
    case ITEM_WEAPON:
      min_val = 1;
      max_val = 50;
      break;
    case ITEM_WAND:
    case ITEM_STAFF:
      min_val = 0;
      max_val = 20;
      break;
    case ITEM_DRINKCON:
    case ITEM_FOUNTAIN:
      min_val = 0;
      max_val = NUM_LIQ_TYPES - 1;
      break;
    case ITEM_KEY:
      min_val = 0;
      max_val = 32099;
      break;
    default:
      min_val = -32000;
      max_val = 32000;
    }
    GET_OBJ_VAL(OLC_OBJ(d), 2) = LIMIT(number, min_val, max_val);
    oedit_disp_val4_menu(d);
    return;

  case OEDIT_VALUE_4:
    number = atoi(arg);
    switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
    case ITEM_SCROLL:
    case ITEM_POTION:
      min_val = -1;
      max_val = NUM_SPELLS - 1;
      break;
    case ITEM_WAND:
    case ITEM_STAFF:
      min_val = 1;
      max_val = NUM_SPELLS - 1;
      break;
    case ITEM_WEAPON:
      min_val = 0;
      max_val = NUM_ATTACK_TYPES - 1;
      break;
    default:
      min_val = -32000;
      max_val = 32000;
      break;
    }
    GET_OBJ_VAL(OLC_OBJ(d), 3) = LIMIT(number, min_val, max_val);
    break;

  case OEDIT_PROMPT_APPLY:
    if ((number = atoi(arg)) == 0)
      break;
    else if (number < 0 || number > MAX_OBJ_AFFECT) {
      oedit_disp_prompt_apply_menu(d);
      return;
    }
    OLC_VAL(d) = number - 1;
    OLC_MODE(d) = OEDIT_APPLY;
    oedit_disp_apply_menu(d);
    return;

  case OEDIT_APPLY:
    if ((number = atoi(arg)) == 0) {
      OLC_OBJ(d)->affected[OLC_VAL(d)].location = 0;
      OLC_OBJ(d)->affected[OLC_VAL(d)].modifier = 0;
      oedit_disp_prompt_apply_menu(d);
    } else if (number < 0 || number >= NUM_APPLIES)
      oedit_disp_apply_menu(d);
    else {
      int counter;

      /* add in check here if already applied.. deny builders another */
      if (GET_LEVEL(d->character) < LVL_IMPL) {
        for (counter = 0; counter < MAX_OBJ_AFFECT; counter++) {
          if (OLC_OBJ(d)->affected[counter].location == number) {
            write_to_output(d, "Object already has that apply.");
            return;
          }
        }
      }

      OLC_OBJ(d)->affected[OLC_VAL(d)].location = number;
      write_to_output(d, "Modifier : ");
      OLC_MODE(d) = OEDIT_APPLYMOD;
    }
    return;

  case OEDIT_APPLYMOD:
    OLC_OBJ(d)->affected[OLC_VAL(d)].modifier = atoi(arg);
    oedit_disp_prompt_apply_menu(d);
    return;

  case OEDIT_EXTRADESC_KEY:
    if (genolc_checkstring(d, arg)) {
      if (OLC_DESC(d)->keyword)
        free(OLC_DESC(d)->keyword);
      OLC_DESC(d)->keyword = str_udup(arg);
    }
    oedit_disp_extradesc_menu(d);
    return;

  case OEDIT_EXTRADESC_MENU:
    switch ((number = atoi(arg))) {
    case 0:
      if (!OLC_DESC(d)->keyword || !OLC_DESC(d)->description) {
	struct extra_descr_data **tmp_desc;

	if (OLC_DESC(d)->keyword)
	  free(OLC_DESC(d)->keyword);
	if (OLC_DESC(d)->description)
	  free(OLC_DESC(d)->description);

	/*
	 * Clean up pointers  
	 */
	for (tmp_desc = &(OLC_OBJ(d)->ex_description); *tmp_desc; tmp_desc = &((*tmp_desc)->next)) {
	  if (*tmp_desc == OLC_DESC(d)) {
	    *tmp_desc = NULL;
	    break;
	  }
	}
	free(OLC_DESC(d));
      }
    break;

    case 1:
      OLC_MODE(d) = OEDIT_EXTRADESC_KEY;
      write_to_output(d, "Enter keywords, separated by spaces :-\r\n| ");
      return;

    case 2:
      OLC_MODE(d) = OEDIT_EXTRADESC_DESCRIPTION;
      send_editor_help(d);
      write_to_output(d, "Enter the extra description:\r\n\r\n");
      if (OLC_DESC(d)->description) {
	write_to_output(d, "%s", OLC_DESC(d)->description);
	oldtext = strdup(OLC_DESC(d)->description);
      }
      string_write(d, &OLC_DESC(d)->description, MAX_MESSAGE_LENGTH, 0, oldtext);
      OLC_VAL(d) = 1;
      return;

    case 3:
      /*
       * Only go to the next description if this one is finished.
       */
      if (OLC_DESC(d)->keyword && OLC_DESC(d)->description) {
	struct extra_descr_data *new_extra;

	if (OLC_DESC(d)->next)
	  OLC_DESC(d) = OLC_DESC(d)->next;
	else {	/* Make new extra description and attach at end. */
	  CREATE(new_extra, struct extra_descr_data, 1);
	  OLC_DESC(d)->next = new_extra;
	  OLC_DESC(d) = OLC_DESC(d)->next;
	}
      }
      /*
       * No break - drop into default case.
       */
    default:
      oedit_disp_extradesc_menu(d);
      return;
    }
    break;
  default:
    mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: Reached default case in oedit_parse()!");
    write_to_output(d, "Oops...\r\n");
    break;
  }