room_rnum get_holo_room(room_vnum vnum) { /* sprintf(buf, "SYSLOG: vnum holo : %d ", vnum); log(buf); */ if (1527 == vnum) { return real_room(1570); } if (1528 == vnum) { return real_room(1571); } if (1529 == vnum) { return real_room(1572); } if (1530 == vnum) { return real_room(1573); } if (1531 == vnum) { return real_room(1574); } return NOWHERE; }
void load_acorn(int rnum, int how_many) { int r, obj_num, znum, n, DROP = 0; struct obj_data *acorn; znum = world[real_room(rnum)].zone; for (n = 0; n <= how_many; n++) { r = number(rnum, (rnum + 99)); if (real_room(r)) { obj_num = real_object(200); acorn = read_object(obj_num, REAL); obj_to_room(acorn, real_room(r)); DROP = 1; } } if (DROP) { send_to_zone_outdoor(znum, "In the distance, you hear an acorn fall to the ground with a rustle of leaves.\r\n"); } obj_num = real_object(599); acorn = read_object(obj_num, REAL); obj_to_room(acorn, real_room(220)); }
/* * 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; }
static void sedit_compact_rooms_menu(struct descriptor_data *d) { struct shop_data *shop; int i; shop = OLC_SHOP(d); get_char_colors(d->character); clear_screen(d); for (i = 0; S_ROOM(shop, i) != NOWHERE; i++) { if (real_room(S_ROOM(shop, i)) != NOWHERE) { write_to_output(d, "%2d - [@\t%5d\tn] - \ty%s\tn\r\n", i, S_ROOM(shop, i), world[real_room(S_ROOM(shop, i))].name); } else { write_to_output(d, "%2d - [\tR!Removed Room!\tn]\r\n", i); } } write_to_output(d, "\r\n" "%sA%s) Add a new room.\r\n" "%sD%s) Delete a room.\r\n" "%sL%s) Long display.\r\n" "%sQ%s) Quit\r\n" "Enter choice : ", grn, nrm, grn, nrm, grn, nrm, grn, nrm); OLC_MODE(d) = SEDIT_ROOMS_MENU; }
static void sedit_rooms_menu(struct descriptor_data *d) { struct shop_data *shop; int i; room_rnum rnum; shop = OLC_SHOP(d); get_char_colors(d->character); clear_screen(d); write_to_output(d, "## VNUM Room\r\n\r\n"); for (i = 0; S_ROOM(shop, i) != NOWHERE; i++) { rnum = real_room(S_ROOM(shop, i)); /* if the room has been deleted, this may crash us otherwise. */ /* set to 0 to be deletable. -- Welcor 09/04 */ if (rnum == NOWHERE) S_ROOM(shop, i) = rnum = 0; write_to_output(d, "%2d - [%s%5d%s] - %s%s%s\r\n", i, cyn, S_ROOM(shop, i), nrm, yel, world[rnum].name, nrm); } write_to_output(d, "\r\n" "%sA%s) Add a new room.\r\n" "%sD%s) Delete a room.\r\n" "%sC%s) Compact Display.\r\n" "%sQ%s) Quit\r\n" "Enter choice : ", grn, nrm, grn, nrm, grn, nrm, grn, nrm); OLC_MODE(d) = SEDIT_ROOMS_MENU; }
/* * 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; } }
/* Load all objects for a house */ int House_load(room_vnum vnum) { FILE *fl; char fname[MAX_STRING_LENGTH]; struct obj_file_elem object; room_rnum rnum; if ((rnum = real_room(vnum)) == -1) return 0; if (!House_get_filename(vnum, fname)) return 0; if (!(fl = fopen(fname, "r+b"))) { /* no file found */ return 0; } while (!feof(fl)) { fread(&object, sizeof(struct obj_file_elem), 1, fl); if (ferror(fl)) { perror("Reading house file: House_load."); fclose(fl); return 0; } if (!feof(fl)) obj_to_room(Obj_from_store(object), rnum); } fclose(fl); return 1; }
/* should do sanity checks on vnums & remove invalid records */ void House_boot(void) { struct house_control_rec temp_house; int real_house, real_atrium; FILE *fl; memset((char *)house_control,0,sizeof(struct house_control_rec)*MAX_HOUSES); if (!(fl = fopen(HCONTROL_FILE, "rb"))) { log("House control file does not exist."); return; } while (!feof(fl) && num_of_houses < MAX_HOUSES) { fread(&temp_house, sizeof(struct house_control_rec), 1, fl); if (feof(fl)) break; if (get_name_by_id(temp_house.owner) == NULL) continue; /* owner no longer exists -- skip */ if ((real_house = real_room(temp_house.vnum)) < 0) continue; /* this vnum doesn't exist -- skip */ if ((find_house(temp_house.vnum)) >= 0) continue; /* this vnum is already a hosue -- skip */ if ((real_atrium = real_room(temp_house.atrium)) < 0) continue; /* house doesn't have an atrium -- skip */ if (temp_house.exit_num < 0 || temp_house.exit_num >= NUM_OF_DIRS) continue; /* invalid exit num -- skip */ if (TOROOM(real_house, temp_house.exit_num) != real_atrium) continue; /* exit num mismatch -- skip */ house_control[num_of_houses++] = temp_house; SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE); SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE); SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); House_load(temp_house.vnum); } fclose(fl); House_save_control(); }
void ASSIGNROOM(room_vnum room, SPECIAL(fname)) { if (real_room(room) >= 0) { world[real_room(room)].func = fname; if (get_spec_name(room_procs, fname) == 0) { sprintf(buf, "SYSWAR: Assign spec not in table to room #%d", room); log(buf); } } else if (!mini_mud) { sprintf(buf, "SYSERR: Attempt to assign spec to non-existant rm. #%d", room); log(buf); } }
void hcontrol_destroy_house(struct char_data * ch, char *arg) { int i, j; int real_atrium, real_house; if (!*arg) { send_to_char(HCONTROL_FORMAT, ch); return; } if ((i = find_house(atoi(arg))) < 0) { send_to_char("Unknown house.\r\n", ch); return; } if ((real_atrium = real_room(house_control[i].atrium)) < 0) log("SYSERR: House had invalid atrium!"); else REMOVE_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); if ((real_house = real_room(house_control[i].vnum)) < 0) log("SYSERR: House had invalid vnum!"); else { REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE); REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE); REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE_CRASH); } House_delete_file(house_control[i].vnum); for (j = i; j < num_of_houses - 1; j++) house_control[j] = house_control[j + 1]; num_of_houses--; send_to_char("House deleted.\r\n", ch); House_save_control(); /* * Now, reset the ROOM_ATRIUM flag on all existing houses' atriums, * just in case the house we just deleted shared an atrium with another * house. --JE 9/19/94 */ for (i = 0; i < num_of_houses; i++) if ((real_atrium = real_room(house_control[i].atrium)) >= 0) SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); }
flusspferd::value JS_getRoom( int vnum ) { int rnum = real_room(vnum); if( rnum == -1 ) return lookupValue( 0 ); else return lookupValue( World[rnum] ); }
void ASSIGNROOM(room_vnum room, SPECIAL(fname)) { room_rnum rnum; if ((rnum = real_room(room)) >= 0) world[rnum].func = fname; else if (!mini_mud) log("SYSERR: Attempt to assign spec to non-existant room #%d", room); }
room_rnum castle_real_room(room_vnum roomoffset) { zone_rnum zon; if ((zon = real_zone(Z_KINGS_C)) == NOWHERE) return NOWHERE; return real_room(zone_table[zon].bot + roomoffset); }
/* crash-save all the houses */ void House_save_all(void) { int i; int real_house; for (i = 0; i < num_of_houses; i++) if ((real_house = real_room(house_control[i].vnum)) != NOWHERE) if (IS_SET_AR(ROOM_FLAGS(real_house), ROOM_HOUSE_CRASH)) House_crashsave(house_control[i].vnum); }
int ok_shop_room(int shop_nr, int room) { int index; for (index = 0; SHOP_ROOM(shop_nr, index) != NOWHERE; index++) if (SHOP_ROOM(shop_nr, index) == room || SHOP_ROOM(shop_nr, index) == real_room(1) ) return (TRUE); return (FALSE); }
/* assign special procedures to rooms */ void assign_rooms(void) { int dump(struct char_data *ch, int cmd, char *arg); int chalice(struct char_data *ch, int cmd, char *arg); int kings_hall(struct char_data *ch, int cmd, char *arg); int pet_shops(struct char_data *ch, int cmd, char *arg); int mar_gate(struct char_data *ch, int cmd, char *arg); int pray_for_items(struct char_data *ch, int cmd, char *arg); world[real_room(3030)].funct = dump; world[real_room(3054)].funct = pray_for_items; /* world[real_room(704)].funct = chalice; world[real_room(2518)].funct = kings_hall; */ world[real_room(3031)].funct = pet_shops; world[real_room(8001)].funct = mar_gate; }
int guild_guard(struct char_data *ch, int cmd, char *arg) { char buf[256], buf2[256]; if (cmd>6 || cmd<1) return FALSE; strcpy(buf, "The guard humiliates you, and block your way.\n\r"); strcpy(buf2, "The guard humiliates $n, and blocks $s way."); if ((ch->in_room == real_room(3017)) && (cmd == 3)) { if (GET_CLASS(ch) != CLASS_MAGIC_USER) { act(buf2, FALSE, ch, 0, 0, TO_ROOM); send_to_char(buf, ch); return TRUE; } } else if ((ch->in_room == real_room(3004)) && (cmd == 1)) { if (GET_CLASS(ch) != CLASS_CLERIC) { act(buf2, FALSE, ch, 0, 0, TO_ROOM); send_to_char(buf, ch); return TRUE; } } else if ((ch->in_room == real_room(3027)) && (cmd == 2)) { if (GET_CLASS(ch) != CLASS_THIEF) { act(buf2, FALSE, ch, 0, 0, TO_ROOM); send_to_char(buf, ch); return TRUE; } } else if ((ch->in_room == real_room(3021)) && (cmd == 2)) { if (GET_CLASS(ch) != CLASS_WARRIOR) { act(buf2, FALSE, ch, 0, 0, TO_ROOM); send_to_char(buf, ch); return TRUE; } } return FALSE; }
int kings_hall(struct char_data *ch, int cmd, char *arg) { if (cmd != 176) return(0); do_action(ch, arg, 176); send_to_char("You feel as if some mighty force has been offended.\n\r", ch); send_to_char(CHAL_ACT, ch); act("$n is struck by an intense beam of light and vanishes.", TRUE, ch, 0, 0, TO_ROOM); char_from_room(ch); char_to_room(ch, real_room(1420)); /* behind the altar */ do_look(ch, "", 15); return(1); }
/** * WARNING: This function actually deletes a crop. * * @param char_data *ch The person doing the deleting. * @param crop_vnum vnum The vnum to delete. */ void olc_delete_crop(char_data *ch, crop_vnum vnum) { void remove_crop_from_table(crop_data *crop); extern const sector_vnum climate_default_sector[NUM_CLIMATES]; obj_data *obj, *next_obj; descriptor_data *desc; struct map_data *map; room_data *room; crop_data *crop; sector_data *base = NULL; int count; if (!(crop = crop_proto(vnum))) { msg_to_char(ch, "There is no such crop %d.\r\n", vnum); return; } if (HASH_COUNT(crop_table) <= 1) { msg_to_char(ch, "You can't delete the last crop.\r\n"); return; } // remove it from the hash table first remove_crop_from_table(crop); // save base sect for later base = sector_proto(climate_default_sector[GET_CROP_CLIMATE(crop)]); // save index and crop file now save_index(DB_BOOT_CROP); save_library_file_for_vnum(DB_BOOT_CROP, vnum); // update world count = 0; LL_FOREACH(land_map, map) { room = real_real_room(map->vnum); if (map->crop_type == crop || (room && ROOM_CROP(room) == crop)) { if (!room) { room = real_room(map->vnum); } set_crop_type(room, NULL); // remove it explicitly change_terrain(room, GET_SECT_VNUM(base)); ++count; } }
/* returns the real room number, or NOWHERE if not found or invalid */ room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr) { int tmp; room_rnum location; char_data *target_mob; obj_data *target_obj; char roomstr[MAX_INPUT_LENGTH]; one_argument(rawroomstr, roomstr); if (!*roomstr) return NOWHERE; if (isdigit(*roomstr) && !strchr(roomstr, '.')) { tmp = atoi(roomstr); if ((location = real_room(tmp)) == NOWHERE) return NOWHERE; } else if ((target_mob = get_char_by_obj(obj, roomstr))) location = IN_ROOM(target_mob); else if ((target_obj = get_obj_by_obj(obj, roomstr))) { if (IN_ROOM(target_obj) != NOWHERE) location = IN_ROOM(target_obj); else return NOWHERE; } else return NOWHERE; /* a room has been found. Check for permission */ if (ROOM_FLAGGED(location, ROOM_GODROOM) || #ifdef ROOM_IMPROOM ROOM_FLAGGED(location, ROOM_IMPROOM) || #endif ROOM_FLAGGED(location, ROOM_HOUSE)) return NOWHERE; if (ROOM_FLAGGED(location, ROOM_PRIVATE) && world[location].people && world[location].people->next_in_room) return NOWHERE; return location; }
/* Used by Tim/Tom at Kings bedroom and Dick/David at treasury */ int block_way(struct char_data * ch, int cmd, char *arg, int iIn_room, int iProhibited_direction) { if (cmd != ++iProhibited_direction || (ch->player.short_descr && !strncmp(ch->player.short_descr, "King Welmar", 11))) return FALSE; if ((ch->in_room == real_room(iIn_room)) && (cmd == iProhibited_direction)) { if (!member_of_staff(ch)) act("The guard roars at $n and pushes $m back.", FALSE, ch, 0, 0, TO_ROOM); send_to_char("The guard roars: 'Entrance is Prohibited!', and pushes you back.\r\n", ch); return (TRUE); } return FALSE; }
void assign_spec_procs (char type, sh_int vnum, int which, char startup) { if (startup) { /*startup should always = 0 except one time at boot up*/ do_initial_specs(); return; } else { switch (toupper(type)) { case 'M': if (which < 0 || which > NUM_MOB_SPECS) mob_index[real_mobile(vnum)].func=NULL; else ASSIGNMOB(vnum, mob_specproc_info[which].sfunc); break; case 'O': if (which < 0 || which > NUM_OBJ_SPECS) obj_index[real_object(vnum)].func=NULL; else ASSIGNOBJ(vnum, obj_specproc_info[which].sfunc); break; case 'R': if (which < 0 || which > NUM_ROOM_SPECS) world[real_room(vnum)].func=NULL; else ASSIGNROOM(vnum, room_specproc_info[which].sfunc); break; } /*switch type*/ } /*else !startup*/ }
/* Save all objects in a house */ void House_crashsave(room_vnum vnum) { int rnum; char buf[MAX_STRING_LENGTH]; FILE *fp; if ((rnum = real_room(vnum)) == -1) return; if (!House_get_filename(vnum, buf)) return; if (!(fp = fopen(buf, "wb"))) { perror("SYSERR: Error saving house file"); return; } if (!House_save(world[rnum].contents, fp)) { fclose(fp); return; } fclose(fp); House_restore_weight(world[rnum].contents); REMOVE_BIT_AR(ROOM_FLAGS(rnum), ROOM_HOUSE_CRASH); }
void hedit_rooms_menu(struct descriptor_data *d) { struct house_data *house; int i; house = OLC_HOUSE(d); get_char_colors(d->character); clear_screen(d); write_to_output(d, TRUE, "## VNUM Room\r\n\r\n"); for (i = 0; H_ROOM(house, i) != -1; i++) write_to_output(d, TRUE, "%2d - [%s%5d%s] - %s%s%s\r\n", i, cyn, H_ROOM(house, i), nrm, yel, world[real_room(H_ROOM(house, i))].name, nrm); write_to_output(d, TRUE, "\r\n" "%sA%s) Add a new room.\r\n" "%sD%s) Delete a room.\r\n" "%sC%s) Compact Display.\r\n" "%sQ%s) Quit\r\n" "Enter choice : ", grn, nrm, grn, nrm, grn, nrm, grn, nrm); OLC_MODE(d) = HEDIT_ROOMS_MENU; }
void sedit_rooms_menu(struct descriptor_data *d) { struct shop_data *shop; int i; shop = OLC_SHOP(d); get_char_colors(d->character); clear_screen(d); write_to_output(d, "## VNUM Room\r\n\r\n"); for (i = 0; S_ROOM(shop, i) != NOWHERE; i++) { write_to_output(d, "%2d - [%s%5d%s] - %s%s%s\r\n", i, cyn, S_ROOM(shop, i), nrm, yel, world[real_room(S_ROOM(shop, i))].name, nrm); } write_to_output(d, "\r\n" "%sA%s) Add a new room.\r\n" "%sD%s) Delete a room.\r\n" "%sC%s) Compact Display.\r\n" "%sQ%s) Quit\r\n" "Enter choice : ", grn, nrm, grn, nrm, grn, nrm, grn, nrm); OLC_MODE(d) = SEDIT_ROOMS_MENU; }
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; } }
/* * 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; }
/* * 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); }
// MAIN LOOP! void zedit_parse(struct descriptor_data *d, char *arg) { int number, i = 0, zone; switch (d->edit_mode) { case ZEDIT_CONFIRM_EDIT_DATA: switch (*arg) { case 'y': case 'Y': d->edit_zon = new zone_data; // we do need to zero it out since we are accessing its elements memset((char *) ZON, 0, sizeof(struct zone_data)); *d->edit_zon = zone_table[d->edit_number]; if (zone_table[d->edit_number].name) d->edit_zon->name = str_dup(zone_table[d->edit_number].name); zedit_disp_data_menu(d); break; case 'n': case 'N': STATE(d) = CON_PLAYING; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); break; default: send_to_char("That's not a valid choice!\r\n", d->character); send_to_char("Do you wish to edit the data?\r\n", d->character); break; } break; case ZEDIT_CONFIRM_CREATE_DATA: switch (*arg) { case 'y': case 'Y': d->edit_zon = new zone_data; // we do need to zero it out since we are accessing its elements memset((char *) ZON, 0, sizeof(struct zone_data)); // set a few vars ZON->name = str_dup("an unfinished zone"); ZON->number = CH->player_specials->saved.zonenum; ZON->top = ZON->number * 100 + 99; zedit_disp_data_menu(d); break; case 'n': case 'N': STATE(d) = CON_PLAYING; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); break; default: send_to_char("That's not a valid choice!\r\n", d->character); send_to_char("Do you wish to edit the data?\r\n", d->character); break; } break; case ZEDIT_CONFIRM_SAVEDATA: switch (*arg) { int zone_num; case 'y': case 'Y': zone_num = real_zone(ZON->number); sprintf(buf,"%s wrote new zcmd %ld in zone %d", GET_CHAR_NAME(d->character), d->edit_number, zone_table[zone_num].number); mudlog(buf, d->character, LOG_WIZLOG, TRUE); // first we insert into memory if (zone_num > -1) { // ie, it already exists ZON->cmd = zone_table[zone_num].cmd; delete [] zone_table[zone_num].name; zone_table[zone_num] = *ZON; } else { // here we got to add a new spot int counter; int found = 0; struct zone_data *new_z_table; // create new table + 2 new_z_table = new struct zone_data[top_of_zone_table + 2]; for (counter = 0; counter < top_of_zone_table + 1; counter++) { if (!found) { if (zone_table[counter].number > CH->player_specials->saved.zonenum) { new_z_table[counter] = *(ZON); found = 1; new_z_table[counter + 1] = zone_table[counter]; } else new_z_table[counter] = zone_table[counter]; } else new_z_table[counter + 1] = zone_table[counter]; } if (!found) new_z_table[top_of_zone_table + 1] = *(ZON); top_of_zone_table++; delete [] zone_table; zone_table = new_z_table; } write_zone_to_disk(ZONENUM); write_index_file("zon"); d->edit_mode = 0; delete ZON; ZON = NULL; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); STATE(d) = CON_PLAYING; send_to_char("Done.\r\n", d->character); break; // end of 'y' case in confirm savestring case 'n': case 'N': if (ZON) { if (ZON->name) delete [] ZON->name; delete ZON; } STATE(d) = CON_PLAYING; ZON = NULL; d->edit_number = 0; PLR_FLAGS(CH).RemoveBit(PLR_EDITING); break; // end of 'n' case in confirm savestring default: send_to_char("Please enter yes or no.\r\n" "Do you wish to save this zone internally?\r\n", CH); break; } break; // end of confirm savestring case ZEDIT_CONFIRM_ADD_CMD: switch (*arg) { case 'y': case 'Y': COM = new reset_com; COM->command = '*'; zedit_disp_command_menu(d); break; case 'n': case 'N': STATE(d) = CON_PLAYING; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); break; default: send_to_char("That's not a valid choice!\r\n", CH); send_to_char("Do you wish to add a command?\r\n", CH); break; } break; case ZEDIT_CONFIRM_INSERT_CMD: switch (*arg) { case 'y': case 'Y': COM = new reset_com; COM->command = '*'; // so it knows to insert if they decide to save d->edit_number2 = TRUE; zedit_disp_command_menu(d); break; case 'n': case 'N': STATE(d) = CON_PLAYING; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); break; default: send_to_char("That's not a valid choice!\r\n", CH); send_to_char("Do you wish to insert a command?\r\n", CH); break; } break; case ZEDIT_CONFIRM_EDIT_CMD: switch (*arg) { case 'y': case 'Y': COM = new reset_com; *COM = zone_table[real_zone(ZONENUM)].cmd[d->edit_number]; zedit_disp_command_menu(d); break; case 'n': case 'N': STATE(d) = CON_PLAYING; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); break; default: send_to_char("That's not a valid choice!\r\n", CH); send_to_char("Do you wish to edit the command?\r\n", CH); break; } break; case ZEDIT_DATA_MENU: switch (*arg) { case 'q': case 'Q': send_to_char("Do you wish to save this zone internally?\r\n", CH); d->edit_mode = ZEDIT_CONFIRM_SAVEDATA; break; case '1': send_to_char("Enter zone name: ", CH); d->edit_mode = ZEDIT_ZONE_NAME; break; case '2': send_to_char("Enter top of zone: ", CH); d->edit_mode = ZEDIT_TOP_OF_ZONE; break; case '3': send_to_char("Lifespan (in ticks between resets): ", CH); d->edit_mode = ZEDIT_LIFESPAN; break; case '4': CLS(CH); send_to_char("1) Don't reset\r\n" "2) Reset only if no PCs are in the zone\r\n" "3) Always reset\r\n" "0) Quit\r\n" "Enter reset mode: ", CH); d->edit_mode = ZEDIT_RESET_MODE; break; case '5': send_to_char("Zone security (1 (none) - 15 (paranoid)):\r\n", CH); d->edit_mode = ZEDIT_SECURITY; break; case '6': send_to_char("0) Seattle\r\n" "1) Portland\r\n" "Enter juridiction: ", CH); d->edit_mode = ZEDIT_JURID; break; case '7': if (!access_level(CH, LVL_VICEPRES)) { send_to_char("That's not a valid choice.\r\n", CH); return; } send_to_char("Enter ID list seperated by spaces:\r\n", CH); d->edit_mode = ZEDIT_ID_LIST; break; case '8': if (!access_level(CH, LVL_VICEPRES)) { send_to_char("That's not a valid choice.\r\n", CH); return; } send_to_char("Zone is connected (1 - yes, 0 - no)? ", CH); d->edit_mode = ZEDIT_CONNECTED; break; default: send_to_char("That's not a valid choice.\r\n", CH); zedit_disp_data_menu(d); break; } break; case ZEDIT_COMMAND_MENU: switch (*arg) { case 'q': case 'Q': send_to_char("Do you wish to save this zone command internally?\r\n", CH); d->edit_mode = ZEDIT_CONFIRM_SAVECMDS; break; case '1': zedit_disp_type_cmd(d); d->edit_mode = ZEDIT_CMD_TYPE; break; case '2': send_to_char("\r\n1) Always\r\n2) If last\r\nEnter your selection: ", CH); d->edit_mode = ZEDIT_IF_FLAG_CMD; break; case '3': switch (COM->command) { case 'M': case 'S': send_to_char("\r\nEnter virtual number of mob: ", CH); d->edit_mode = ZEDIT_ARG1; break; case 'H': case 'U': case 'I': case 'O': case 'P': case 'E': case 'G': case 'R': case 'N': case 'C': send_to_char("\r\nEnter virtual number of obj: ", CH); d->edit_mode = ZEDIT_ARG1; break; case 'D': zedit_disp_direction_menu(d); d->edit_mode = ZEDIT_DIRECTION_OF_DOOR; break; case 'V': send_to_char("\r\nEnter virtual number of vehicle: ", CH); d->edit_mode = ZEDIT_ARG1; break; default: zedit_disp_command_menu(d); break; } break; case '4': switch (COM->command) { case 'M': case 'S': case 'U': case 'I': case 'O': case 'P': case 'E': case 'N': case 'G': case 'H': case 'V': send_to_char("Enter max allowed to exist in game: ", CH); d->edit_mode = ZEDIT_ARG2; break; case 'R': case 'D': send_to_char("Enter the room number: ", CH); d->edit_mode = ZEDIT_REMOVE_ROOM; break; case 'C': send_to_char(" 0) Cyberware\r\n 1) Bioware\r\nEnter location to place obj: ", CH); d->edit_mode = ZEDIT_ARG2; break; default: zedit_disp_command_menu(d); break; } break; case '5': switch (COM->command) { case 'M': case 'O': case 'V': send_to_char("Enter the room number: ", CH); d->edit_mode = ZEDIT_ARG3; break; case 'H': send_to_char("Enter the host number: ", CH); d->edit_mode = ZEDIT_ARG3; break; case 'P': send_to_char("Enter the object number: ", CH); d->edit_mode = ZEDIT_ARG3; break; case 'E': zedit_disp_wear_menu(d); d->edit_mode = ZEDIT_WEAR; break; case 'D': zedit_disp_state_menu(d); d->edit_mode = ZEDIT_DOOR_STATE; break; case 'N': send_to_char("Enter total number to give mob: ", CH); d->edit_mode = ZEDIT_ARG3; break; default: zedit_disp_command_menu(d); break; } break; } break; case ZEDIT_CONFIRM_SAVECMDS: int zone_num, top_of_cmds; switch (*arg) { case 'y': case 'Y': zone_num = real_zone(ZONENUM); top_of_cmds = zone_table[zone_num].num_cmds; sprintf(buf,"%s wrote new zcmd %ld in zone %d", GET_CHAR_NAME(d->character), d->edit_number, zone_table[zone_num].number); mudlog(buf, d->character, LOG_WIZLOG, TRUE); // first, determine if you are adding or replacing if (d->edit_number < top_of_cmds) { if (!d->edit_number2) zone_table[zone_num].cmd[d->edit_number] = *(COM); else { int counter; struct reset_com *new_cmds; new_cmds = new struct reset_com[top_of_cmds + 1]; if (top_of_cmds > 1) { // first count your way up for (counter = 0; counter < d->edit_number; counter++) new_cmds[counter] = zone_table[zone_num].cmd[counter]; for (counter = top_of_cmds; counter > d->edit_number; counter--) new_cmds[counter] = zone_table[zone_num].cmd[counter-1]; new_cmds[d->edit_number] = *(COM); zone_table[zone_num].num_cmds++; delete [] zone_table[zone_num].cmd; zone_table[zone_num].cmd = new_cmds; } else { new_cmds[1] = zone_table[zone_num].cmd[0]; new_cmds[0] = *(COM); zone_table[zone_num].num_cmds++; if (zone_table[zone_num].cmd) delete [] zone_table[zone_num].cmd; zone_table[zone_num].cmd = new_cmds; } } } else { int counter; struct reset_com *new_cmds; // create a new set of commands, with 1 extra spot new_cmds = new struct reset_com[top_of_cmds + 1]; // we know it is always going in at the end, so we copy the old 1st if (top_of_cmds > 0) { // you have to do this in case there are 0 cmds for (counter = 0; counter < top_of_cmds; counter++) new_cmds[counter] = zone_table[zone_num].cmd[counter]; // tada, here it goes now, do not increase counter, for loop new_cmds[counter] = *(COM); // already did! zone_table[zone_num].num_cmds++; delete [] zone_table[zone_num].cmd; zone_table[zone_num].cmd = new_cmds; } else { new_cmds[0] = *(COM); zone_table[zone_num].num_cmds++; if (zone_table[zone_num].cmd) delete [] zone_table[zone_num].cmd; zone_table[zone_num].cmd = new_cmds; } } // end else write_zone_to_disk(ZONENUM); d->edit_mode = 0; delete COM; COM = NULL; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); STATE(d) = CON_PLAYING; send_to_char("Done.\r\n", d->character); break; // for 'y' case case 'n': case 'N': if (COM) delete COM; STATE(d) = CON_PLAYING; COM = NULL; d->edit_number = 0; PLR_FLAGS(CH).RemoveBit(PLR_EDITING); break; // for 'n' case default: send_to_char("That's not a valid choice.\r\n", CH); send_to_char("Do you wish to save this zone command internally?\r\n", CH); break; } // for switch in confirm save cmds break; // for ZEDIT_CONFIRM_SAVECMDS case ZEDIT_ARG3: number = atoi(arg); switch (COM->command) { case 'H': COM->arg3 = MAX(0, real_host(number)); break; case 'M': case 'V': case 'O': COM->arg3 = MAX(0, real_room(number)); if (!access_level(CH, LVL_ADMIN) && !(number >= (ZONENUM * 100) && number <= zone_table[real_zone(ZONENUM)].top)) COM->arg3 = 0; break; case 'P': COM->arg3 = MAX(0, real_object(number)); if (!access_level(CH, LVL_ADMIN) && (number < 600 || number > 699)) { for (zone = 0; zone <= top_of_zone_table; zone++) if (number >= (zone_table[zone].number * 100) && number <= zone_table[zone].top) break; if (zone <= top_of_zone_table) { for (i = 0; i < 5; i++) if (zone_table[zone].editor_ids[i] == GET_IDNUM(CH)) break; } else i = 5; } if (i >= 5) COM->arg3 = 0; break; case 'N': COM->arg3 = MIN(25, MAX(0, number)); break; } zedit_disp_command_menu(d); break; case ZEDIT_DOOR_STATE: number = atoi(arg); if ((number < 0) || (number > 3)) { zedit_disp_state_menu(d); return; } else if (number != 0) COM->arg3 = number - 1; zedit_disp_command_menu(d); break; case ZEDIT_WEAR: number = atoi(arg); if ((number < 0) || (number > (NUM_WEARS - 1))) { zedit_disp_wear_menu(d); return; } else if (number != 0) COM->arg3 = number - 1; zedit_disp_command_menu(d); break; case ZEDIT_REMOVE_ROOM: number = atoi(arg); COM->arg1 = MAX(0, real_room(number)); if (!access_level(CH, LVL_ADMIN) && !(number >= (ZONENUM * 100) && number <= zone_table[real_zone(ZONENUM)].top)) COM->arg1 = 0; zedit_disp_command_menu(d); break; case ZEDIT_ARG2: number = atoi(arg); if (COM->command == 'C' && (number < 0 || number > 1)) { send_to_char("Value must be either 0 (cyberware) or 1 (bioware).\r\n" "Enter location to place obj: ", CH); return; } else if ((number < -1) || (number > 1000)) { send_to_char("Value must be between -1 and 1000.\r\n" "Enter max allowed to exist in game: ", CH); return; } COM->arg2 = number; zedit_disp_command_menu(d); break; case ZEDIT_DIRECTION_OF_DOOR: number = atoi(arg); if (number < 0 || number > 10) { zedit_disp_direction_menu(d); return; } else if (number != 0) COM->arg2 = number - 1; zedit_disp_command_menu(d); break; case ZEDIT_ARG1: number = atoi(arg); if (COM->command == 'V') { COM->arg1 = MAX(0, real_vehicle(number)); } else { if (COM->command == 'M' || COM->command == 'S') { COM->arg1 = MAX(0, real_mobile(number)); if (!access_level(CH, LVL_ADMIN)) { for (zone = 0; zone <= top_of_zone_table; zone++) if (number >= (zone_table[zone].number * 100) && number <= zone_table[zone].top) break; if (zone <= top_of_zone_table) { for (i = 0; i < 5; i++) if (zone_table[zone].editor_ids[i] == GET_IDNUM(CH)) break; } else i = 5; } if (i >= 5) COM->arg1 = 0; } else { if (COM->command == 'R') COM->arg2 = MAX(0, real_object(number)); else COM->arg1 = MAX(0, real_object(number)); if (!access_level(CH, LVL_ADMIN) && (number < 300 || number > 699 || (number > 499 && number < 600))) { for (zone = 0; zone <= top_of_zone_table; zone++) if (number >= (zone_table[zone].number * 100) && number <= zone_table[zone].top) break; if (zone <= top_of_zone_table) { for (i = 0; i < 5; i++) if (zone_table[zone].editor_ids[i] == GET_IDNUM(CH)) break; } else i = 5; } if (i >= 5) { if (COM->command == 'R') COM->arg2 = 0; else COM->arg1 = 0; } } } zedit_disp_command_menu(d); break; case ZEDIT_CMD_TYPE: number = atoi(arg); if ((number < 0) || (number > 9) && *arg != 'n') { zedit_disp_type_cmd(d); send_to_char("\r\nInvalid selection. Please try again: ", CH); return; } else { COM->command = get_real_type(arg); if ((COM->command == 'E') || (COM->command == 'G') || (COM->command == 'P') || (COM->command == 'N') || (COM->command == 'C')) COM->if_flag = 1; else COM->if_flag = 0; COM->arg1 = 0; COM->arg2 = 0; COM->arg3 = 0; } zedit_disp_command_menu(d); break; case ZEDIT_IF_FLAG_CMD: number = atoi(arg); if ((number < 1) || (number > 2)) { send_to_char("Invalid selection.\r\n1) Always\r\n2) If last\r\n" "Enter your selection: ", CH); } else { COM->if_flag = COM->if_flag; zedit_disp_command_menu(d); } break; case ZEDIT_ZONE_NAME: if (ZON->name) delete [] ZON->name; ZON->name = str_dup(arg); zedit_disp_data_menu(d); break; case ZEDIT_SECURITY: number = atoi(arg); if (number < 1 || number > 15) { send_to_char("Security rating must range from 1 to 15.\r\nZone security: ", CH); return; } ZON->security = number; zedit_disp_data_menu(d); break; case ZEDIT_ID_LIST: { int t[5] = {0, 0, 0, 0, 0}; if (sscanf(arg, "%d %d %d %d %d\n", &t[0], &t[1], &t[2], &t[3], &t[4]) == 5) { ZON->editor_ids[0] = t[0]; ZON->editor_ids[1] = t[1]; ZON->editor_ids[2] = t[2]; ZON->editor_ids[3] = t[3]; ZON->editor_ids[4] = t[4]; } zedit_disp_data_menu(d); } break; case ZEDIT_CONNECTED: number = atoi(arg); if (number != 0 && number != 1) { send_to_char("Value must be 0 or 1! Zone is connected? ", CH); return; } sprintf(arg, "%s set zone %d to connected %d (was %d)", GET_CHAR_NAME( CH ), ZON->number, number, ZON->connected ); mudlog(arg, CH, LOG_WIZLOG, TRUE); ZON->connected = number; zedit_disp_data_menu(d); break; case ZEDIT_TOP_OF_ZONE: number = atoi(arg); if ((d->edit_number == top_of_zone_table) || (d->edit_number == -1)) if ((number < ZON->number * 100) || (number > (ZON->number * 100 + 499))) { send_to_char(CH, "Value must range from %d to %d\r\n", ZON->number * 100, (ZON->number * 100 + 499)); send_to_char("Enter top of zone: ", CH); return; } else ZON->top = number; else if ((number < ZON->number * 100) || (number > zone_table[d->edit_number + 1].number * 100 - 1)) { send_to_char(CH, "Value must range from %d to %d\r\n", ZON->number * 100, zone_table[d->edit_number + 1].number * 100 - 1); send_to_char("Enter top of zone: ", CH); return; } else ZON->top = number; zedit_disp_data_menu(d); break; case ZEDIT_LIFESPAN: number = atoi(arg); if ((number < 0) || (number > 1440)) { send_to_char("Value must range from 0 to 1440\r\n", CH); send_to_char("Lifespan (in ticks between resets): ", CH); } else { ZON->lifespan = number; zedit_disp_data_menu(d); } break; case ZEDIT_RESET_MODE: number = atoi(arg); if ((number < 0) || (number > 3)) { send_to_char("Invalid choice. Please enter from 0 to 3.\r\n", CH); send_to_char("Enter reset mode: ", CH); return; } else if (number != 0) ZON->reset_mode = number - 1; zedit_disp_data_menu(d); break; case ZEDIT_JURID: number = atoi(arg); if (number < 0 || number > 3) { send_to_char("Invalid choice. Please enter from 0 to 1.\r\n", CH); send_to_char("Enter Juridiction: ", CH); return; } else ZON->juridiction = number; zedit_disp_data_menu(d); break; } }
void check_idling( CharData * ch ) { #define VOID_TIME 8 #define EXTRACT_TIME 32 void Crash_rentsave(CharData *ch, int cost); void Crash_cryosave(CharData *ch, int cost); /* ** CONJURED timer */ int i = 0; for(;i < 4;i++) { if( GET_CONJ_CNT(ch, i) > 0) { SET_CONJ_CNT(ch, i) -= 1; if(SET_CONJ_CNT(ch, i) == 0) switch(GET_CLASS(ch)) { case CLASS_RANGER: sendChar( ch, "The creatures of the wild will answer your call again.\r\n" ); break; case CLASS_NECROMANCER: sendChar(ch, "The dead will heed your summons once more.\r\n"); case CLASS_MAGIC_USER: switch(i) { case TIMER_GATE: sendChar(ch, "Demons will answer your summons again.\r\n"); break; case TIMER_MONSTER: sendChar(ch, "Monsters will answer your summons again.\r\n"); break; case TIMER_ELEMENTAL: sendChar(ch, "Elementals will answer your summons again.\r\n"); break; } break; default: sendChar( ch, "Conjured creatures will answer your summons again.\r\n" ); } } } /* ** HUNTED timer */ if( IS_SET_AR( PLR_FLAGS(ch), PLR_HUNTED ) && ch->desc && (--(ch)->player_specials->saved.phunt_countdown <= 0)) { sendChar( ch, "You are no longer hunted.\r\n" ); unset_hunted_player(ch); } /* ** THIEF timer */ if( IS_SET_AR(PLR_FLAGS(ch), PLR_THIEF) && ch->desc && (--(ch)->player_specials->saved.pthief_countdown <= 0)) { REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF); send_to_char("You are no longer a registered thief.\r\n", ch); (ch)->player_specials->saved.pthief_countdown = 0; } /* KILLER timer */ if (IS_SET_AR(PLR_FLAGS(ch), PLR_KILLER) && (--(ch)->player_specials->saved.pkill_countdown <= 0)) { REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER); send_to_char("You are no longer a registered killer.\r\n", ch); (ch)->player_specials->saved.pkill_countdown = 0; } /* JAILED timer */ if (IS_SET_AR(PLR_FLAGS(ch), PLR_JAILED) && (--(ch)->player_specials->saved.jail_timer <= 0)) { int jail_exit_room; REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_JAILED); if (PRF_FLAGGED(ch, PRF_GOLD_TEAM) && IN_ROOM(ch) == real_room(GOLD_TEAM_JAIL)) { jail_exit_room = real_room(GOLD_TEAM_START_ROOM); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); char_from_room(ch); char_to_room(ch, jail_exit_room); look_at_room(ch, 0); } if (PRF_FLAGGED(ch, PRF_BLACK_TEAM) && IN_ROOM(ch) == real_room(BLACK_TEAM_JAIL)) { jail_exit_room = real_room(BLACK_TEAM_START_ROOM); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); char_from_room(ch); char_to_room(ch, jail_exit_room); look_at_room(ch, 0); } if (PRF_FLAGGED(ch, PRF_ROGUE_TEAM) && IN_ROOM(ch) == real_room(ROGUE_TEAM_JAIL)) { jail_exit_room = real_room(ROGUE_TEAM_START_ROOM); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); char_from_room(ch); char_to_room(ch, jail_exit_room); look_at_room(ch, 0); } sendChar(ch, "Your imprisonement is over.\r\n"); // if (PRF_FLAGGED(ch, PRF_GOLD_TEAM)) // jail_exit_room = IN_ROOM(ch); // else if (PRF_FLAGGED(ch, PRF_BLACK_TEAM)) // jail_exit_room = IN_ROOM(ch); // else if (PRF_FLAGGED(ch, PRF_ROGUE_TEAM)) // jail_exit_room = IN_ROOM(ch); // else // jail_exit_room = getStartRoom(ch); // char_to_room(ch, jail_exit_room); // look_at_room(ch, 0); } /* ** If your hunted there is NO escape. */ if(( ++(ch->char_specials.timer) > VOID_TIME ) && !IS_SET_AR(PLR_FLAGS(ch), PLR_HUNTED)) { if (GET_WAS_IN(ch) == NOWHERE && ch->in_room != NOWHERE) { GET_WAS_IN(ch) = ch->in_room; end_fight(ch); act("$n disappears into the void.", TRUE, ch, 0, 0, TO_ROOM); send_to_char("You have been idle, and are pulled into a void.\r\n", ch); save_char(ch, NOWHERE); Crash_crashsave(ch); GET_WAS_IN(ch) = ch->in_room; char_from_room(ch); char_to_room(ch, 1); } //else if (ch->char_specials.timer > EXTRACT_TIME) //{ //if (ch->in_room != NOWHERE) //char_from_room(ch); //char_to_room(ch, 1); //if (ch->desc) //SET_DCPENDING(ch->desc); //ch->desc = NULL; //Crash_idlesave(ch); /* apparently causing problems? */ //crashRentSave(ch, -1); //mudlog( NRM, LVL_LRGOD, TRUE, "%s force-rented and extracted (idle).", GET_NAME(ch)); //extract_char(ch); //} } #undef VOID_TIME #undef EXTRACT_TIME }