// seg002:0269 void __pascal far check_guard_fallout() { if (Guard.direction == dir_56_none || Guard.y < 211) { return; } if (Guard.charid == charid_1_shadow) { if (Guard.action != actions_4_in_freefall) { return; } loadshad(); clear_char(); saveshad(); } else if (Guard.charid == charid_4_skeleton && (Guard.room = level.roomlinks[Guard.room - 1].down) == 3) { // if skeleton falls down into room 3 Guard.x = 133; Guard.curr_row = 1; Guard.direction = dir_0_right; Guard.alive = -1; leave_guard(); } else { on_guard_killed(); level.guards_tile[drawn_room - 1] = -1; Guard.direction = dir_56_none; draw_guard_hp(0, guardhp_curr); guardhp_curr = 0; } }
// seg002:1000 void __pascal far autocontrol_shadow_level4() { if (Char.room == 4) { if (Char.x < 80) { clear_char(); } else { move_1_forward(); } } }
/* * Find the char, if not online, load char up. Currently unused. If you can get this to work * for you, please send me an update! Where you get_player_vis in do_clan, substitute this * and theoretically you can do anything with the victim offline. * Theoretically. Can also be used in cedit when saving the clan to set leader * at clan creation/edit. */ struct char_data *find_clan_char( struct char_data *ch, char *arg ) { struct char_data *vict = NULL, *cbuf = NULL; if (!(vict = get_player_vis(ch, arg, FIND_CHAR_WORLD))) { /* we need to load the file up :( */ CREATE(cbuf, struct char_data, 1); clear_char(cbuf); if (load_char(arg, vict) > -1) { vict = cbuf; } }
// seg002:101A void __pascal far autocontrol_shadow_level5() { if (Char.room == 24) { if (demo_time == 0) { get_tile(24, 1, 0); // is the door open? if (curr_room_modif[curr_tilepos] < 80) return; demo_index = 0; } do_auto_moves(shad_drink_move); if (Char.x < 15) { clear_char(); } } }
/* * Create an instance of a mobile. */ CHAR_DATA *create_mobile( MOB_INDEX_DATA *pMobIndex ) { CHAR_DATA *mob; if ( pMobIndex == NULL ) { bug( "Create_mobile: NULL pMobIndex.", 0 ); exit( 1 ); } if ( char_free == NULL ) { mob = alloc_perm( sizeof(*mob) ); } else { mob = char_free; char_free = char_free->next; } clear_char( mob ); mob->pIndexData = pMobIndex; mob->name = pMobIndex->player_name; mob->short_descr = pMobIndex->short_descr; mob->long_descr = pMobIndex->long_descr; mob->description = pMobIndex->description; mob->spec_fun = pMobIndex->spec_fun; mob->level = number_fuzzy( pMobIndex->level ); mob->act = pMobIndex->act; mob->affected_by = pMobIndex->affected_by; mob->alignment = pMobIndex->alignment; mob->sex = pMobIndex->sex; mob->armor = interpolate( mob->level, 100, -100 ); mob->max_hit = mob->level * 8 + number_range( mob->level * mob->level / 4, mob->level * mob->level ); mob->hit = mob->max_hit; /* * Insert in list. */ mob->next = char_list; char_list = mob; pMobIndex->count++; return mob; }
// seg002:07EB void __pascal far autocontrol_mouse() { if (Char.direction == dir_56_none) { return; } if (Char.action == actions_0_stand) { if (Char.x >= 200) { clear_char(); } } else { if (Char.x < 166) { seqtbl_offset_char(seq_107_mouse_stand_up_and_go); // mouse play_seq(); } } }
/* * Ideally, this function should be in db.c, but I'll put it here for * portability. */ void init_mobile(struct char_data *mob) { clear_char(mob); GET_HIT(mob) = GET_MANA(mob) = 1; GET_MAX_MANA(mob) = GET_MAX_MOVE(mob) = 100; GET_NDD(mob) = GET_SDD(mob) = 1; GET_WEIGHT(mob) = 200; GET_HEIGHT(mob) = 198; GET_MOB_WEIGHT(mob) = 1; mob->real_abils.str = mob->real_abils.intel = mob->real_abils.wis = 11; mob->real_abils.dex = mob->real_abils.con = mob->real_abils.cha = 11; mob->aff_abils = mob->real_abils; SET_BIT(MOB_FLAGS(mob), MOB_ISNPC); mob->player_specials = &dummy_mob; }
/* Ideally, this function should be in db.c, but I'll put it here for portability. */ static void init_mobile(struct char_data *mob) { clear_char(mob); GET_HIT(mob) = GET_MANA(mob) = 1; GET_MAX_MANA(mob) = GET_MAX_MOVE(mob) = 100; GET_NDD(mob) = GET_SDD(mob) = 1; GET_WEIGHT(mob) = 200; GET_HEIGHT(mob) = 198; mob->real_abils.str = mob->real_abils.intel = mob->real_abils.wis = 11; mob->real_abils.dex = mob->real_abils.con = mob->real_abils.cha = 11; mob->aff_abils = mob->real_abils; GET_SAVE(mob, SAVING_PARA) = 0; GET_SAVE(mob, SAVING_ROD) = 0; GET_SAVE(mob, SAVING_PETRI) = 0; GET_SAVE(mob, SAVING_BREATH) = 0; GET_SAVE(mob, SAVING_SPELL) = 0; SET_BIT_AR(MOB_FLAGS(mob), MOB_ISNPC); mob->player_specials = &dummy_mob; }
/** * Creates a new mob entry. * * @param mob_vnum vnum The number to create. * @return char_data* The new mob's prototype. */ char_data *create_mob_table_entry(mob_vnum vnum) { void add_mobile_to_table(char_data *mob); char_data *mob; // sanity if (mob_proto(vnum)) { log("SYSERR: Attempting to insert mobile at existing vnum %d", vnum); return mob_proto(vnum); } CREATE(mob, char_data, 1); clear_char(mob); mob->vnum = vnum; SET_BIT(MOB_FLAGS(mob), MOB_ISNPC); // need this for some macroes add_mobile_to_table(mob); // save mob index and mob file now so there's no trouble later save_index(DB_BOOT_MOB); save_library_file_for_vnum(DB_BOOT_MOB, vnum); return mob; }
// seg002:1082 void __pascal far autocontrol_shadow_level12() { short opp_frame; short xdiff; if (Char.room == 15 && shadow_initialized == 0) { if (Opp.x >= 150) { do_init_shad(/*&*/init_shad_12, 7 /*fall*/); return; } shadow_initialized = 1; } if (Char.sword >= sword_2_drawn) { // if the Kid puts his sword away, the shadow does the same, // but only if the shadow was already hurt (?) if (offguard == 0 || guard_refrac == 0) { autocontrol_guard_active(); } else { move_4_down(); } return; } if (Opp.sword >= sword_2_drawn || offguard == 0) { xdiff = 0x7000; // bugfix/workaround // This behavior matches the DOS version but not the Apple II source. if (can_guard_see_kid < 2 || (xdiff = char_opp_dist()) >= 90) { if (xdiff < 0) { move_2_backward(); } return; } // Shadow draws his sword if (Char.frame == 15) { move_down_forw(); } return; } if (char_opp_dist() < 10) { // unite with the shadow flash_color = color_15_white; // white flash_time = 18; // get an extra HP for uniting the shadow add_life(); // time of Kid-shadow flash united_with_shadow = 42; // put the Kid where the shadow was Char.charid = charid_0_kid; savekid(); // remove the shadow clear_char(); return; } if (can_guard_see_kid == 2) { // If Kid runs to shadow, shadow runs to Kid. opp_frame = Opp.frame; // frames 1..14: running // frames 121..132: stepping if ((opp_frame >= frame_3_start_run && opp_frame < frame_15_stand) || (opp_frame >= frame_127_stepping_7 && opp_frame < 133) ) { move_1_forward(); } } }
void medit_parse(struct descriptor_data *d, char *arg) { int number; int mob_number; // the RNUM switch(d->edit_mode) { case MEDIT_CONFIRM_EDIT: /* if player hits 'Y' then edit mob */ switch (*arg) { case 'y': case 'Y': medit_disp_menu(d); break; case 'n': case 'N': STATE(d) = CON_PLAYING; /* free up the editing mob */ if (d->edit_mob) Mem->DeleteCh(d->edit_mob); d->edit_mob = NULL; d->edit_number = 0; 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 it?\r\n", CH); break; } break; /* end of MEDIT_CONFIRM_EDIT */ case MEDIT_CONFIRM_SAVESTRING: switch(*arg) { case 'y': case 'Y': // first write to the internal tables if (!from_ip_zone(d->edit_number)) { sprintf(buf,"%s wrote new mob #%ld", GET_CHAR_NAME(d->character), d->edit_number); mudlog(buf, d->character, LOG_WIZLOG, TRUE); } mob_number = real_mobile(d->edit_number); if (mob_number > 0) { // first we go through the entire list of mobs to find out // which are pointing to this prototype; if it is, it gets // replaced struct char_data *i, *temp; int c; for (i = character_list; i; i = i->next) { if (mob_number == i->nr) { // alloc a temp mobile temp = Mem->GetCh(); *temp = *i; *i = *d->edit_mob; /* copy game-time dependent vars over */ i->in_room = temp->in_room; i->nr = mob_number; i->affected = temp->affected; i->carrying = temp->carrying; i->cyberware = temp->cyberware; i->bioware = temp->bioware; // any eq worn for (c = 0; c < NUM_WEARS; ++c) i->equipment[c] = temp->equipment[c]; i->next_in_room = temp->next_in_room; i->next = temp->next; i->next_fighting = temp->next_fighting; i->followers = temp->followers; i->master = temp->master; i->char_specials.fighting = temp->char_specials.fighting; i->char_specials.hunting = temp->char_specials.hunting; i->mob_specials.last_direction = temp->mob_specials.last_direction; i->mob_specials.memory = temp->mob_specials.memory; i->mob_specials.wait_state = temp->mob_specials.wait_state; Mem->ClearCh(temp); } // end if statement } // end for loop // now you can free the old prototype and put in the new one if (mob_proto[mob_number].player.physical_text.keywords) delete [] mob_proto[mob_number].player.physical_text.keywords; if (mob_proto[mob_number].player.title) delete [] mob_proto[mob_number].player.title; if (mob_proto[mob_number].player.physical_text.name) delete [] mob_proto[mob_number].player.physical_text.name; if (mob_proto[mob_number].player.physical_text.room_desc) delete [] mob_proto[mob_number].player.physical_text.room_desc; if (mob_proto[mob_number].player.physical_text.look_desc) delete [] mob_proto[mob_number].player.physical_text.look_desc; if (mob_proto[mob_number].mob_specials.arrive) delete [] mob_proto[mob_number].mob_specials.arrive; if (mob_proto[mob_number].mob_specials.leave) delete [] mob_proto[mob_number].mob_specials.leave; mob_proto[mob_number] = *d->edit_mob; mob_proto[mob_number].nr = mob_number; } else { // if not, we need to make a new spot in the list int counter; int found = FALSE; struct char_data *new_mob_proto; struct index_data *new_mob_index; struct char_data *temp_mob; // two because you are adding one and you need one over new_mob_index = new struct index_data[top_of_mobt + 2]; new_mob_proto = new struct char_data[top_of_mobt + 2]; // count through the tables for (counter = 0; counter < top_of_mobt + 1; counter++) { /* if we haven't found it */ if (!found) { /* check if current virtual is bigger than our virtual */ if (MOB_VNUM_RNUM(counter) > d->edit_number) { /* eureka. insert now */ /*---------*/ new_mob_index[counter].vnum = d->edit_number; new_mob_index[counter].number = 0; new_mob_index[counter].func = NULL; /*---------*/ new_mob_proto[counter] = *(d->edit_mob); new_mob_proto[counter].in_room = NOWHERE; /* it is now safe (and necessary!) to assign real number to * the edit_mob, which has been -1 all this time */ d->edit_mob->nr = counter; /* and assign to prototype as well */ new_mob_proto[counter].nr = counter; found = TRUE; /* insert the other proto at this point */ new_mob_index[counter + 1] = mob_index[counter]; new_mob_proto[counter + 1] = mob_proto[counter]; new_mob_proto[counter + 1].nr = counter + 1; } else { /* just copy from old to new, no num change */ new_mob_proto[counter] = mob_proto[counter]; new_mob_index[counter] = mob_index[counter]; } } else { // if !found else /* we HAVE already found it.. therefore copy to mobile + 1 */ new_mob_index[counter + 1] = mob_index[counter]; new_mob_proto[counter + 1] = mob_proto[counter]; new_mob_proto[counter + 1].nr = counter + 1; } } // for loop through list /* if we STILL haven't found it, means the mobile was > than all * the other mobs.. so insert at end */ if (!found) { new_mob_index[top_of_mobt + 1].vnum = d->edit_number; new_mob_index[top_of_mobt + 1].number = 0; new_mob_index[top_of_mobt + 1].func = NULL; clear_char(new_mob_proto + top_of_mobt + 1); new_mob_proto[top_of_mobt + 1] = *(d->edit_mob); new_mob_proto[top_of_mobt + 1].in_room = NOWHERE; new_mob_proto[top_of_mobt + 1].nr = top_of_mobt + 1; /* it is now safe (and necessary!) to assign real number to * the edit_mob, which has been -1 all this time */ d->edit_mob->nr = top_of_mobt + 1; } top_of_mobt++; /* we also have to renumber all the mobiles currently * * existing in the world. This is because when I start * * extracting mobiles, bad things will happen! */ for (temp_mob = character_list; temp_mob; temp_mob = temp_mob->next) if (GET_MOB_RNUM (temp_mob) >= d->edit_mob->nr) GET_MOB_RNUM (temp_mob)++; /* free and replace old tables */ delete [] mob_proto; delete [] mob_index; mob_proto = new_mob_proto; mob_index = new_mob_index; /* RENUMBER ZONE TABLES HERE, only * * because I ADDED a mobile! * * This code shamelessly ripped off from db.c */ int zone, cmd_no; for (zone = 0; zone <= top_of_zone_table; zone++) for (cmd_no = 0; cmd_no < zone_table[zone].num_cmds; cmd_no++) { switch (ZCMD.command) { case 'M': ZCMD.arg1 = (ZCMD.arg1 >= d->edit_mob->nr ? ZCMD.arg1 + 1 : ZCMD.arg1); break; } } } // finally done putting the mobile into memory send_to_char("Writing mobile to disk...", CH); write_mobs_to_disk(d->character->player_specials->saved.zonenum); // again, here we don't delete it cause we don't want to end up // deleting the strings from the prototypes if (d->edit_mob) Mem->ClearCh(d->edit_mob); d->edit_mob = NULL; STATE(d) = CON_PLAYING; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); send_to_char("Done.\r\n", d->character); break; case 'n': case 'N': send_to_char("Mobile not saved, aborting.\r\n", d->character); STATE(d) = CON_PLAYING; // complete nuke if (d->edit_mob) Mem->DeleteCh(d->edit_mob); d->edit_mob = NULL; d->edit_number = 0; d->edit_zone = 0; PLR_FLAGS(d->character).RemoveBit(PLR_EDITING); break; default: send_to_char("Invalid choice!\r\n", d->character); send_to_char("Do you wish to save this mobile internally?\r\n", d->character); break; } break; case MEDIT_MAIN_MENU: switch (*arg) { case 'q': case 'Q': d->edit_mode = MEDIT_CONFIRM_SAVESTRING; medit_parse(d, "y"); break; case 'x': case 'X': d->edit_mode = MEDIT_CONFIRM_SAVESTRING; medit_parse(d, "n"); break; case '1': send_to_char("Enter keywords:", CH); d->edit_mode = MEDIT_EDIT_NAMELIST; break; case '2': send_to_char("Enter name:", CH); d->edit_mode = MEDIT_SHORT_DESCR; break; case '3': send_to_char("Enter room description:", CH); d->edit_mode = MEDIT_REG_DESCR; d->str = new (char *); if (!d->str) { mudlog("Malloc failed!", NULL, LOG_SYSLOG, TRUE); shutdown(); } *(d->str) = NULL; d->max_str = MAX_REG_DESC_LENGTH; d->mail_to = 0; break; case '4': // go to modify.cc send_to_char("Enter look description:\r\n", CH); d->edit_mode = MEDIT_LONG_DESCR; d->str = new (char *); if (!d->str) { mudlog("Malloc failed!", NULL, LOG_SYSLOG, TRUE); shutdown(); } *(d->str) = NULL; d->max_str = MAX_MESSAGE_LENGTH; d->mail_to = 0; break; case '5': medit_disp_mobflags_menu(d); d->edit_mode = MEDIT_MOB_FLAGS; break; case '6': medit_disp_affected_menu(d); d->edit_mode = MEDIT_AFF_FLAGS; break; case '8': send_to_char("Enter average nuyen: ", CH); d->edit_mode = MEDIT_NUYEN; break; case '9': send_to_char("Enter bonus karma points: ", CH); d->edit_mode = MEDIT_EXPERIENCE; break; case 'a': medit_disp_att_menu(d); d->edit_mode = MEDIT_ATTRIBUTES; break; case 'b': send_to_char("Enter level: ", CH); d->edit_mode = MEDIT_LEVEL; break; case 'c': send_to_char("Enter ballistic armor points: ", CH); d->edit_mode = MEDIT_BALLISTIC; break; case 'd': send_to_char("Enter impact armor points: ", CH); d->edit_mode = MEDIT_IMPACT; break; case 'e': send_to_char("Enter max physical points: ", CH); d->edit_mode = MEDIT_PHYSICAL; break; case 'f': send_to_char("Enter max mental points: ", CH); d->edit_mode = MEDIT_MENTAL; break; case 'g': medit_disp_pos_menu(d); send_to_char("Enter position: ", CH); d->edit_mode = MEDIT_POSITION; break; case 'h': medit_disp_pos_menu(d); send_to_char("Enter default position: ", CH); d->edit_mode = MEDIT_DEFAULT_POSITION; break; case 'i': medit_disp_gender_menu(d); d->edit_mode = MEDIT_GENDER; break; case 'j': send_to_char("Enter weight (in kilograms): ", CH); d->edit_mode = MEDIT_WEIGHT; break; case 'k': send_to_char("Enter height (in centimeters): ", CH); d->edit_mode = MEDIT_HEIGHT; break; case 'l': medit_disp_class_menu(d); d->edit_mode = MEDIT_CLASS; break; case 'm': medit_disp_attack_menu(d); d->edit_mode = MEDIT_ATTACK_TYPE; break; case 'n': medit_disp_skill_menu(d); d->edit_mode = MEDIT_SKILLS; break; case 'o': send_to_char("Enter arrive text: ", CH); d->edit_mode = MEDIT_ARRIVE_MSG; break; case 'p': send_to_char("Enter leave text: ", CH); d->edit_mode = MEDIT_LEAVE_MSG; break; default: medit_disp_menu(d); break; } break; case MEDIT_EDIT_NAMELIST: if (MOB->player.physical_text.keywords) delete [] MOB->player.physical_text.keywords; MOB->player.physical_text.keywords = str_dup(arg); medit_disp_menu(d); break; case MEDIT_SHORT_DESCR: if (MOB->player.physical_text.name) delete [] MOB->player.physical_text.name; MOB->player.physical_text.name = str_dup(arg); medit_disp_menu(d); break; case MEDIT_ARRIVE_MSG: if (MOB->mob_specials.arrive) delete [] MOB->mob_specials.arrive; MOB->mob_specials.arrive = str_dup(arg); medit_disp_menu(d); break; case MEDIT_LEAVE_MSG: if (MOB->mob_specials.leave) delete [] MOB->mob_specials.leave; MOB->mob_specials.leave = str_dup(arg); medit_disp_menu(d); break; case MEDIT_REG_DESCR: // you should not come here break; case MEDIT_LONG_DESCR: // you should not come here break; case MEDIT_MOB_FLAGS: number = atoi(arg); if ((number < 0) || (number > MOB_MAX)) medit_disp_mobflags_menu(d); else { if (number == 0) // 0 = quit medit_disp_menu(d); else { MOB_FLAGS(MOB).ToggleBit(number-1); medit_disp_mobflags_menu(d); } } break; case MEDIT_AFF_FLAGS: number = atoi(arg); if ((number < 0) || (number > AFF_MAX)) medit_disp_affected_menu(d); else { if (number == 0) // 0 = quit medit_disp_menu(d); else { AFF_FLAGS(MOB).ToggleBit(number - 1); medit_disp_affected_menu(d); } } break; case MEDIT_NUYEN: number = atoi(arg); if ((number < 0) || (number > 999999)) { send_to_char("Value must range between 0 and 999999.\r\n", CH); send_to_char("Enter average nuyen: ", CH); } else { GET_NUYEN(MOB) = number; send_to_char("Enter average credstick value: ", CH); d->edit_mode = MEDIT_CREDSTICK; } break; case MEDIT_CREDSTICK: number = atoi(arg); if ((number < 0) || (number > 999999)) { send_to_char("Value must range between 0 and 999999.\r\n", CH); send_to_char("Enter average credstick value: ", CH); } else { GET_BANK(MOB) = number; medit_disp_menu(d); } break; case MEDIT_EXPERIENCE: number = atoi(arg); if ((number < 0) || (number > 7500)) { send_to_char("Value must range between 0 and 7500.\r\n", CH); send_to_char("Enter bonus karma points: ", CH); } else { int karma; if (number > (karma=calc_karma(NULL, MOB))) { send_to_char("Bonus karma may not be higher than actual karma. Lowering.\r\n", CH); number = karma; } GET_KARMA(MOB) = number; medit_disp_menu(d); } break; case MEDIT_SKILLS: switch (*arg) { case '0': medit_disp_menu(d); break; case '1': medit_disp_skills(d); send_to_char("Enter a skill (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL1; break; case '2': medit_disp_skills(d); send_to_char("Enter a skill (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL2; break; case '3': medit_disp_skills(d); send_to_char("Enter a skill (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL3; break; case '4': medit_disp_skills(d); send_to_char("Enter a skill (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL4; break; case '5': medit_disp_skills(d); send_to_char("Enter a skill (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL5; break; default: medit_disp_skill_menu(d); break; } break; // end of MEDIT_SKILLS case MEDIT_SKILL1: number = atoi(arg); if ((number < 0) || (number > MAX_SKILLS)) { medit_disp_skills(d); send_to_char(CH, "Value must range between 1 and %d.\r\n", MAX_SKILLS); send_to_char("Enter a skill (0 to quit): ", CH); } else if (number == 0) { // 0 = quit medit_disp_skill_menu(d); d->edit_mode = MEDIT_SKILLS; } else { SET_SKILL(MOB, MOB->mob_specials.mob_skills[0], 0) MOB->mob_specials.mob_skills[0] = number; // to adjust it send_to_char("Enter skill level (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL1_VAL; } break; case MEDIT_SKILL2: number = atoi(arg); if ((number < 0) || (number > MAX_SKILLS)) { medit_disp_skills(d); send_to_char(CH, "Value must range between 1 and %d.\r\n", MAX_SKILLS); send_to_char("Enter a skill (0 to quit): ", CH); } else if (number == 0) { // 0 = quit medit_disp_skill_menu(d); d->edit_mode = MEDIT_SKILLS; } else { SET_SKILL(MOB, MOB->mob_specials.mob_skills[0], 0) MOB->mob_specials.mob_skills[0] = number; // to adjust it send_to_char("Enter skill level (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL2_VAL; } break; case MEDIT_SKILL3: number = atoi(arg); if ((number < 0) || (number > MAX_SKILLS)) { medit_disp_skills(d); send_to_char(CH, "Value must range between 1 and %d.\r\n", MAX_SKILLS); send_to_char("Enter a skill (0 to quit): ", CH); } else if (number == 0) { // 0 = quit medit_disp_skill_menu(d); d->edit_mode = MEDIT_SKILLS; } else { SET_SKILL(MOB, MOB->mob_specials.mob_skills[0], 0) MOB->mob_specials.mob_skills[0] = number; // to adjust it send_to_char("Enter skill level (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL3_VAL; } break; case MEDIT_SKILL4: number = atoi(arg); if ((number < 0) || (number > MAX_SKILLS)) { medit_disp_skills(d); send_to_char(CH, "Value must range between 1 and %d.\r\n", MAX_SKILLS); send_to_char("Enter a skill (0 to quit): ", CH); } else if (number == 0) { // 0 = quit medit_disp_skill_menu(d); d->edit_mode = MEDIT_SKILLS; } else { SET_SKILL(MOB, MOB->mob_specials.mob_skills[0], 0) MOB->mob_specials.mob_skills[0] = number; // to adjust it send_to_char("Enter skill level (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL4_VAL; } break; case MEDIT_SKILL5: number = atoi(arg); if ((number < 0) || (number > MAX_SKILLS)) { medit_disp_skills(d); send_to_char(CH, "Value must range between 1 and %d.\r\n", MAX_SKILLS); send_to_char("Enter a skill (0 to quit): ", CH); } else if (number == 0) { // 0 = quit medit_disp_skill_menu(d); d->edit_mode = MEDIT_SKILLS; } else { SET_SKILL(MOB, MOB->mob_specials.mob_skills[0], 0) MOB->mob_specials.mob_skills[0] = number; // to adjust it send_to_char("Enter skill level (0 to quit): ", CH); d->edit_mode = MEDIT_SKILL5_VAL; } break; case MEDIT_SKILL1_VAL: number = atoi(arg); if ((number < 0) || (number > 50)) { send_to_char("Skill level must be between 1 and 50.\r\n", CH); send_to_char("Enter skill level: ", CH); } else if (number == 0) { MOB->mob_specials.mob_skills[0] = 0; MOB->mob_specials.mob_skills[1] = 0; d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } else { MOB->mob_specials.mob_skills[1] = number; GET_SKILL(MOB, MOB->mob_specials.mob_skills[0]) = MOB->mob_specials.mob_skills[1]; SET_SKILL(MOB, MOB->mob_specials.mob_skills[0], MOB->mob_specials.mob_skills[1]); d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } break; case MEDIT_SKILL2_VAL: number = atoi(arg); if ((number < 0) || (number > 50)) { send_to_char("Skill level must be between 1 and 50.\r\n", CH); send_to_char("Enter skill level: ", CH); } else if (number == 0) { MOB->mob_specials.mob_skills[2] = 0; MOB->mob_specials.mob_skills[3] = 0; d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } else { MOB->mob_specials.mob_skills[3] = number; GET_SKILL(MOB, MOB->mob_specials.mob_skills[2]) = MOB->mob_specials.mob_skills[3]; SET_SKILL(MOB, MOB->mob_specials.mob_skills[2], MOB->mob_specials.mob_skills[3]); d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } break; case MEDIT_SKILL3_VAL: number = atoi(arg); if ((number < 0) || (number > 50)) { send_to_char("Skill level must be between 1 and 50.\r\n", CH); send_to_char("Enter skill level: ", CH); } else if (number == 0) { MOB->mob_specials.mob_skills[4] = 0; MOB->mob_specials.mob_skills[5] = 0; d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } else { MOB->mob_specials.mob_skills[5] = number; GET_SKILL(MOB, MOB->mob_specials.mob_skills[4]) = MOB->mob_specials.mob_skills[5]; SET_SKILL(MOB, MOB->mob_specials.mob_skills[4], MOB->mob_specials.mob_skills[5]); d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } break; case MEDIT_SKILL4_VAL: number = atoi(arg); if ((number < 0) || (number > 50)) { send_to_char("Skill level must be between 1 and 50.\r\n", CH); send_to_char("Enter skill level: ", CH); } else if (number == 0) { MOB->mob_specials.mob_skills[6] = 0; MOB->mob_specials.mob_skills[7] = 0; d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } else { MOB->mob_specials.mob_skills[7] = number; GET_SKILL(MOB, MOB->mob_specials.mob_skills[6]) = MOB->mob_specials.mob_skills[7]; SET_SKILL(MOB, MOB->mob_specials.mob_skills[6], MOB->mob_specials.mob_skills[7]); d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } break; case MEDIT_SKILL5_VAL: number = atoi(arg); if ((number < 0) || (number > 50)) { send_to_char("Skill level must be between 1 and 50.\r\n", CH); send_to_char("Enter skill level: ", CH); } else if (number == 0) { MOB->mob_specials.mob_skills[8] = 0; MOB->mob_specials.mob_skills[9] = 0; d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } else { MOB->mob_specials.mob_skills[9] = number; GET_SKILL(MOB, MOB->mob_specials.mob_skills[8]) = MOB->mob_specials.mob_skills[9]; SET_SKILL(MOB, MOB->mob_specials.mob_skills[8], MOB->mob_specials.mob_skills[9]); d->edit_mode = MEDIT_SKILLS; medit_disp_skill_menu(d); } break; case MEDIT_ATTRIBUTES: switch (*arg) { case '1': send_to_char("Enter body attribute: ", CH); d->edit_mode = MEDIT_BOD; break; case '2': send_to_char("Enter quickness attribute: ", CH); d->edit_mode = MEDIT_QUI; break; case '3': send_to_char("Enter strength attribute: ", CH); d->edit_mode = MEDIT_STR; break; case '4': send_to_char("Enter charisma attribute: ", CH); d->edit_mode = MEDIT_CHA; break; case '5': send_to_char("Enter intelligence attribute: ", CH); d->edit_mode = MEDIT_INT; break; case '6': send_to_char("Enter willpower attribute: ", CH); d->edit_mode = MEDIT_WIL; break; case '7': send_to_char("Enter magic attribute: ", CH); d->edit_mode = MEDIT_MAG; break; case 'q': case 'Q': // back to main menu medit_disp_menu(d); break; default: medit_disp_att_menu(d); break; } break; case MEDIT_BOD: number = atoi(arg); if ((number < 1) || (number > 50)) { send_to_char("Value must range between 1 and 50.\r\n", CH); send_to_char("Enter body attribute: ", CH); } else { GET_REAL_BOD(MOB) = number; MOB->real_abils.bod_index = number * 100; medit_disp_att_menu(d); } break; case MEDIT_QUI: number = atoi(arg); if ((number < 1) || (number > 50)) { send_to_char("Value must range between 1 and 50.\r\n", CH); send_to_char("Enter quickness attribute: ", CH); } else { GET_REAL_QUI(MOB) = number; GET_REAL_REA(MOB) = (number + GET_REAL_INT(MOB)) >> 1; medit_disp_att_menu(d); } break; case MEDIT_STR: number = atoi(arg); if ((number < 1) || (number > 50)) { send_to_char("Value must range between 1 and 50.\r\n", CH); send_to_char("Enter strength attribute: ", CH); } else { GET_REAL_STR(MOB) = number; medit_disp_att_menu(d); } break; case MEDIT_CHA: number = atoi(arg); if ((number < 1) || (number > 50)) { send_to_char("Value must range between 1 and 50.\r\n", CH); send_to_char("Enter charisma attribute: ", CH); } else { GET_REAL_CHA(MOB) = number; medit_disp_att_menu(d); } break; case MEDIT_INT: number = atoi(arg); if ((number < 1) || (number > 50)) { send_to_char("Value must range between 1 and 50.\r\n", CH); send_to_char("Enter intelligence attribute: ", CH); } else { GET_REAL_INT(MOB) = number; GET_REAL_REA(MOB) = (number + GET_REAL_QUI(MOB)) >> 1; medit_disp_att_menu(d); } break; case MEDIT_WIL: number = atoi(arg); if ((number < 1) || (number > 50)) { send_to_char("Value must range between 1 and 50.\r\n", CH); send_to_char("Enter willpower attribute: ", CH); } else { GET_REAL_WIL(MOB) = number; medit_disp_att_menu(d); } break; case MEDIT_MAG: number = atoi(arg); if ((number < 0) || (number > 50)) { send_to_char("Value must range between 0 and 50.\r\n", CH); send_to_char("Enter magic attribute: ", CH); } else { MOB->real_abils.mag = number * 100; medit_disp_att_menu(d); } break; case MEDIT_LEVEL: number = atoi(arg); if (number < 0) { send_to_char("Invalid choice.\r\n", CH); send_to_char("Enter level: ", CH); } else { GET_LEVEL(MOB) = number; medit_disp_menu(d); } break; case MEDIT_BALLISTIC: number = atoi(arg); if (number < 0) { send_to_char("Value must be greater than 0.\r\n", CH); send_to_char("Enter ballistic armor points: ", CH); } else { GET_BALLISTIC(MOB) = number; medit_disp_menu(d); } break; case MEDIT_IMPACT: number = atoi(arg); if (number < 0) { send_to_char("Value must be greater than 0.\r\n", CH); send_to_char("Enter impact armor points: ", CH); } else { GET_IMPACT(MOB) = number; medit_disp_menu(d); } break; case MEDIT_PHYSICAL: number = atoi(arg); if ((number < 0) || (number > 10)) { send_to_char("Value must range between 0 and 10.\r\n", CH); send_to_char("Enter max physical points: ", CH); } else { GET_MAX_PHYSICAL(MOB) = number * 100; GET_PHYSICAL(MOB) = number * 100; medit_disp_menu(d); } break; case MEDIT_MENTAL: number = atoi(arg); if ((number < 0) || (number > 10)) { send_to_char("Value must range between 0 and 10.\r\n", CH); send_to_char("Enter max mental points: ", CH); } else { GET_MAX_MENTAL(MOB) = number * 100; GET_MENTAL(MOB) = number * 100; medit_disp_menu(d); } break; case MEDIT_WEIGHT: number = atoi(arg); if (number < 0) { send_to_char("Value must be greater than 0.\r\n", CH); send_to_char("Enter weight (in kilograms): ", CH); } else { GET_WEIGHT(MOB) = number; medit_disp_menu(d); } break; case MEDIT_HEIGHT: number = atoi(arg); if (number < 0) { send_to_char("Value must be greater than 0.\r\n", CH); send_to_char("Enter height (in centimeters): ", CH); } else { GET_HEIGHT(MOB) = number; medit_disp_menu(d); } break; case MEDIT_CLASS: number = atoi(arg); if ((number < 1) || (number > NUM_MOB_CLASSES)) medit_disp_class_menu(d); else { GET_RACE(MOB) = (number - 1); medit_disp_menu(d); } break; case MEDIT_POSITION: number = atoi(arg); if ((number < POS_MORTALLYW) || (number > POS_STANDING)) { send_to_char("Invalid choice.\r\nEnter position: ", CH); medit_disp_pos_menu(d); } else { GET_POS(MOB) = number; medit_disp_menu(d); } break; case MEDIT_DEFAULT_POSITION: number = atoi(arg); if ((number < POS_MORTALLYW) || (number > POS_STANDING)) { send_to_char("Invalid choice.\r\nEnter default position: ", CH); medit_disp_pos_menu(d); } else { GET_DEFAULT_POS(MOB) = number; medit_disp_menu(d); } break; case MEDIT_GENDER: number = atoi(arg); if ((number < 0) || (number > 3)) { send_to_char("Invalid choice.\r\n", CH); medit_disp_gender_menu(d); } else if (number != 0) // 0 = quit GET_SEX(MOB) = (number - 1); medit_disp_menu(d); break; case MEDIT_ATTACK_TYPE: number = atoi(arg); if ((number < 0) || (number > NUM_ATTACK_TYPES)) { send_to_char("Invalid choice.\r\n", CH); medit_disp_attack_menu(d); } else if (number != 0) // 0 = quit MOB->mob_specials.attack_type = number-1 + TYPE_HIT; medit_disp_menu(d); break; } }
/* * Loads a character for review. */ void do_rload( CHAR_DATA *ch, char *arg ) { char *name; CHAR_DATA *rch; DESCRIPTOR_DATA *d; char strsave[MAX_INPUT_LENGTH]; FILE *fp; if ( arg == NULL || arg[0] == '\0' ) { send_to_char("Syntax: rload <character>\n\r", ch ); return; } name = capitalize( arg ); for ( rch = char_list; rch != NULL; rch = rch->next ) { if ( !IS_NPC(rch) && !str_cmp( rch->name, name ) ) { send_to_char("That character is already in the game.\n\r", ch ); return; } } for ( d = descriptor_list; d != NULL; d = d->next ) { if ( d->character == NULL ) continue; if ( !str_cmp( d->character->name, name ) ) { send_to_char("That character is logging on.\n\r", ch ); return; } } sprintf( strsave, "%s%s", PLAYER_DIR, name ); if ( ( fp = fopen( strsave, "r" ) ) == NULL ) { sprintf( strsave, "%s%s", UNAPPROVED_DIR, name ); fp = fopen( strsave, "r" ); } if ( fp == NULL ) { sprintf( strsave, "%s%s", REJECTED_DIR, name ); fp = fopen( strsave, "r" ); } if ( fp == NULL ) { send_to_char("No such character exists.\n\r", ch ); return; } if ( char_free == NULL ) { rch = alloc_perm( sizeof(*ch) ); } else { rch = char_free; char_free = char_free->next; } clear_char( rch ); init_char( rch, name, TRUE ); rch->desc = NULL; load_char_from_file( rch, fp ); fclose( fp ); char_to_room( rch, get_room_index( ROOM_VNUM_REVIEW_ROOM ), FALSE ); SET_BIT( rch->act, PLR_REVIEWING ); rch->next = char_list; char_list = rch; send_to_char( "Character loaded to review room.\n\r", ch ); return; }
/* * Load a char and inventory into a new ch structure. */ bool load_char_obj( DESCRIPTOR_DATA *d, char *name ) { static PC_DATA pcdata_zero; char strsave[MAX_INPUT_LENGTH]; char buf [MAX_STRING_LENGTH]; CHAR_DATA *ch; FILE *fp; bool found; if ( char_free == NULL ) { ch = alloc_perm( sizeof(*ch) ); } else { ch = char_free; char_free = char_free->next; } clear_char( ch ); if ( pcdata_free == NULL ) { ch->pcdata = alloc_perm( sizeof(*ch->pcdata) ); } else { ch->pcdata = pcdata_free; pcdata_free = pcdata_free->next; } *ch->pcdata = pcdata_zero; d->character = ch; ch->desc = d; ch->name = str_dup( name ); ch->prompt = str_dup( "<%hhp %mm %vmv> " ); ch->last_note = 0; ch->act = PLR_BLANK | PLR_COMBINE | PLR_PROMPT; ch->pcdata->pwd = str_dup( "" ); ch->pcdata->bamfin = str_dup( "" ); ch->pcdata->bamfout = str_dup( "" ); ch->pcdata->title = str_dup( "" ); ch->pcdata->perm_str = 13; ch->pcdata->perm_int = 13; ch->pcdata->perm_wis = 13; ch->pcdata->perm_dex = 13; ch->pcdata->perm_con = 13; ch->pcdata->condition[COND_THIRST] = 48; ch->pcdata->pagelen = 20; ch->pcdata->condition[COND_FULL] = 48; found = FALSE; fclose( fpReserve ); /* parsed player file directories by Yaz of 4th Realm */ /* decompress if .gz file exists - Thx Alander */ #if !defined(macintosh) && !defined(MSDOS) sprintf( strsave, "%s%s%s%s%s", PLAYER_DIR, initial( ch->name ), "/", capitalize( name ), ".gz" ); if ( ( fp = fopen( strsave, "r" ) ) != NULL ) { fclose( fp ); sprintf( buf, "gzip -dfq %s", strsave ); system( buf ); } #endif #if !defined(machintosh) && !defined(MSDOS) sprintf( strsave, "%s%s%s%s", PLAYER_DIR, initial( ch->name ), "/", capitalize( name ) ); #else sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( name ) ); #endif if ( ( fp = fopen( strsave, "r" ) ) != NULL ) { int iNest; for ( iNest = 0; iNest < MAX_NEST; iNest++ ) rgObjNest[iNest] = NULL; found = TRUE; for ( ; ; ) { char letter; char *word; letter = fread_letter( fp ); if ( letter == '*' ) { fread_to_eol( fp ); continue; } if ( letter != '#' ) { bug( "Load_char_obj: # not found.", 0 ); break; } word = fread_word( fp ); if ( !str_cmp( word, "PLAYER" ) ) fread_char ( ch, fp ); else if ( !str_cmp( word, "OBJECT" ) ) fread_obj ( ch, fp ); else if ( !str_cmp( word, "END" ) ) break; else { bug( "Load_char_obj: bad section.", 0 ); break; } } fclose( fp ); } fpReserve = fopen( NULL_FILE, "r" ); return found; }