/* * Tweak an item */ static void wiz_tweak_item(object_type *o_ptr) { cptr p; char tmp_val[80]; /* Hack -- leave artefacts alone */ if (artefact_p(o_ptr)) return; p = "Enter new 'att' setting: "; sprintf(tmp_val, "%d", o_ptr->att); if (!term_get_string(p, tmp_val, 6)) return; o_ptr->att = atoi(tmp_val); wiz_display_item(o_ptr); p = "Enter new 'evn' setting: "; sprintf(tmp_val, "%d", o_ptr->evn); if (!term_get_string(p, tmp_val, 6)) return; o_ptr->evn = atoi(tmp_val); wiz_display_item(o_ptr); p = "Enter new 'pval' setting: "; sprintf(tmp_val, "%d", o_ptr->pval); if (!term_get_string(p, tmp_val, 6)) return; o_ptr->pval = atoi(tmp_val); wiz_display_item(o_ptr); p = "Enter new weight: "; sprintf(tmp_val, "%d", o_ptr->weight); if (!term_get_string(p, tmp_val, 6)) return; o_ptr->weight = atoi(tmp_val); wiz_display_item(o_ptr); }
/* * Change the quantity of a the item */ static void wiz_quantity_item(object_type *o_ptr) { int tmp_int; char tmp_val[3]; /* Never duplicate artefacts */ if (artefact_p(o_ptr)) return; /* Default */ sprintf(tmp_val, "%d", o_ptr->number); /* Query */ if (term_get_string("Quantity: ", tmp_val, 3)) { /* Extract */ tmp_int = atoi(tmp_val); /* Paranoia */ if (tmp_int < 1) tmp_int = 1; if (tmp_int > 99) tmp_int = 99; /* Accept modifications */ o_ptr->number = tmp_int; } }
/* * Go to any level */ static void do_cmd_wiz_jump(void) { /* Ask for level */ if (p_ptr->command_arg <= 0) { char ppp[80]; char tmp_val[160]; /* Prompt */ sprintf(ppp, "Jump to level (0-%d): ", MORGOTH_DEPTH); /* Default */ sprintf(tmp_val, "%d", p_ptr->depth); /* Ask for a level */ if (!term_get_string(ppp, tmp_val, 11)) return; /* Extract request */ p_ptr->command_arg = atoi(tmp_val); } /* Paranoia */ if (p_ptr->command_arg < 0) p_ptr->command_arg = 0; /* Paranoia */ if (p_ptr->command_arg > MORGOTH_DEPTH) p_ptr->command_arg = MORGOTH_DEPTH; /* Accept request */ msg_format("You jump to dungeon level %d.", p_ptr->command_arg); // make a note if the player loses a greater vault note_lost_greater_vault(); /* New depth */ p_ptr->depth = p_ptr->command_arg; /* Leaving */ p_ptr->leaving = TRUE; }
/* * Get the Age, Height and Weight. */ static bool get_ahw(void) { char prompt[50]; char line[70]; char query2; int loopagain = TRUE; // hack to see whether we are opening an old player file bool roll_ahw = !p_ptr->age; //put_str("(a)ccept age/height/weight, (r)eroll, (m)anually enter ", 0, 0); while (loopagain == TRUE) { if (roll_ahw) { /*get the random age/height/weight, display for approval. */ get_ahw_aux(); } else { roll_ahw = TRUE; } /* Display the player */ display_player(0); // Highlight relevant info display_player_xtra_info(1); /* Prompt */ Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, -1, TERM_SLATE, "Enter accept age/height/weight"); Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, -1, TERM_SLATE, "Space reroll"); Term_putstr(QUESTION_COL, INSTRUCT_ROW + 3, -1, TERM_SLATE, " m manually enter"); /* Hack - highlight the key names */ Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, - 1, TERM_L_WHITE, "Enter"); Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, - 1, TERM_L_WHITE, "Space"); Term_putstr(QUESTION_COL + 4, INSTRUCT_ROW + 3, - 1, TERM_L_WHITE, "m"); /* Move the cursor */ Term_gotoxy(0, INSTRUCT_ROW + 1); /* Query */ query2 = inkey(); if ((query2 == '\r') || (query2 == '\n')) { /* got ahw*/ loopagain = FALSE; p_ptr->redraw |= (PR_MISC); } else if ((query2 == 'm') || (query2 == 'M')) { /* don't want random stats */ int age = 0; int height = 0; int weight = 0; int age_l, age_h, height_l, height_h, weight_l, weight_h; age_l = 10; age_h = 4865; if (p_ptr->psex == SEX_MALE) { height_l = rp_ptr->m_b_ht - 5 * (rp_ptr->m_m_ht); height_h = rp_ptr->m_b_ht + 5 * (rp_ptr->m_m_ht); weight_l = rp_ptr->m_b_wt / 3; weight_h = rp_ptr->m_b_wt * 2; } else { height_l = rp_ptr->f_b_ht - 5 * (rp_ptr->f_m_ht); height_h = rp_ptr->f_b_ht + 5 * (rp_ptr->f_m_ht); weight_l = rp_ptr->f_b_wt / 3; weight_h = rp_ptr->f_b_wt * 2; } // clear line line[0] = '\0'; while ((age < age_l) || (age > age_h)) { sprintf(prompt, "Enter age (%d-%d): ", age_l, age_h); if (!term_get_string(prompt, line, sizeof(line))) return (FALSE); age = atoi(line); p_ptr->age = age; } /* Display the player */ p_ptr->redraw |= (PR_MISC); display_player(0); // clear line line[0] = '\0'; while ((height < height_l) || (height > height_h)) { sprintf(prompt, "Enter height in inches (%d-%d): ", height_l, height_h); if (!term_get_string(prompt, line, sizeof(line))) return (FALSE); height = atoi(line); p_ptr->ht = height; } /* Display the player */ p_ptr->redraw |= (PR_MISC); display_player(0); // clear line line[0] = '\0'; while ((weight < weight_l) || (weight > weight_h)) { sprintf(prompt, "Enter weight in pounds (%d-%d): ", weight_l, weight_h); if (!term_get_string(prompt, line, sizeof(line))) return (FALSE); weight = atoi(line); p_ptr->wt = weight; } /* Display the player */ p_ptr->redraw |= (PR_MISC); display_player(0); // confirm the choices if (!get_ahw()) return (FALSE); loopagain = FALSE; } else if (query2 == ESCAPE) return (FALSE); else if (((query2 == 'Q') || (query2 == 'q')) && (turn == 0)) quit (NULL); } return (TRUE); }
/* * Aux function for "do_cmd_wiz_change()" */ static void do_cmd_wiz_change_aux(void) { int i; int tmp_int; long tmp_long; char tmp_val[160]; char ppp[80]; /* Query the stats */ for (i = 0; i < A_MAX; i++) { /* Prompt */ strnfmt(ppp, sizeof(ppp), "%s (%d to %d): ", stat_names[i], BASE_STAT_MIN, BASE_STAT_MAX); /* Default */ sprintf(tmp_val, "%d", p_ptr->stat_base[i]); /* Query */ if (!term_get_string(ppp, tmp_val, 4)) return; /* Extract */ tmp_int = atoi(tmp_val); /* Verify */ if (tmp_int > BASE_STAT_MAX) tmp_int = BASE_STAT_MAX; else if (tmp_int < BASE_STAT_MIN) tmp_int = BASE_STAT_MIN; /* Save it */ p_ptr->stat_base[i] = tmp_int; p_ptr->stat_drain[i] = 0; } /* Default */ sprintf(tmp_val, "%ld", (long)(p_ptr->new_exp)); /* Query */ if (!term_get_string("Experience Pool: ", tmp_val, 10)) return; /* Extract */ tmp_long = atol(tmp_val); /* Verify */ if (tmp_long < 0) tmp_long = 0L; /* Update total Exp */ p_ptr->exp += tmp_long - p_ptr->new_exp; /* Save */ p_ptr->new_exp = tmp_long; /* Update */ check_experience(); /* Default */ sprintf(tmp_val, "%ld", (long)(p_ptr->game_type)); /* Query */ if (!term_get_string("Game Type: ", tmp_val, 10)) return; /* Extract */ tmp_long = atol(tmp_val); /* Update game type */ p_ptr->game_type = tmp_long; }
/* * Ask for and parse a "debug command" * * The "p_ptr->command_arg" may have been set. */ void do_cmd_debug(void) { int py = p_ptr->py; int px = p_ptr->px; char cmd; /* Get a "debug command" */ if (!get_com("Debug Command: ", &cmd)) return; /* Analyze the command */ switch (cmd) { /* Ignore */ case ESCAPE: case ' ': case '\n': case '\r': { break; } #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': { do_cmd_spoilers(); break; } #endif /* Hack -- Help */ case '?': { do_cmd_help(); break; } /* Cure all maladies */ case 'a': { do_cmd_wiz_cure_all(); break; } /* Teleport to target */ case 'b': { do_cmd_wiz_bamf(); break; } /* Create any object */ case 'c': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; wiz_create_item(p_ptr->command_arg); break; } /* Create an artefact */ case 'C': { char prompt[80]; char buf[80]; sprintf(prompt, "%s", "Index: "); sprintf(buf, "%d", 0); if(term_get_string(prompt, buf, 0)) wiz_create_artefact( atoi(buf) ); break; } /* Detect everything */ case 'd': { detect_all_doors_traps(); detect_all(); break; } /* Edit character */ case 'e': { do_cmd_wiz_change(); break; } /* Forget items and map and monster memory */ case 'f': { do_cmd_wiz_forget(); break; } /* Good Objects */ case 'g': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->command_arg, FALSE); break; } /* Identify */ case 'i': { (void)ident_spell(); break; } /* Go up or down in the dungeon */ case 'j': { do_cmd_wiz_jump(); break; } /* Self-Knowledge */ case 'k': { self_knowledge(); break; } /* Wizard Look */ case 'l': { do_cmd_wiz_look(); break; } /* Magic Mapping */ case 'm': { map_area(); break; } /* Summon Named Monster */ case 'n': { char prompt[80]; char buf[80]; sprintf(prompt, "%s", "Index: "); sprintf(buf, "%d", 0); if(term_get_string(prompt, buf, 0)) do_cmd_wiz_named(atoi(buf), TRUE); break; } /* Object playing routines */ case 'o': { do_cmd_wiz_play(); break; } /* Debug Options */ case 'O': { screen_save(); do_cmd_options_aux(6, "Debug Options"); screen_load(); break; } /* Phase Door */ case 'p': { teleport_player(10); break; } /* Query the dungeon */ case 'q': { do_cmd_wiz_query(); break; } /* Summon Random Monster(s) */ case 's': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; do_cmd_wiz_summon(p_ptr->command_arg); break; } /* Teleport */ case 't': { teleport_player(100); break; } /* Un-hide all monsters */ case 'u': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 255; do_cmd_wiz_unhide(p_ptr->command_arg); break; } /* Very Good Objects */ case 'v': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = 1; acquirement(py, px, p_ptr->command_arg, TRUE); break; } /* Wizard Light the Level */ case 'w': { wiz_light(); break; } /* Increase Experience */ case 'x': { if (p_ptr->command_arg) { gain_exp(p_ptr->command_arg); } else { gain_exp(p_ptr->exp); } break; } /* Zap Monsters (Banishment) */ case 'z': { if (p_ptr->command_arg <= 0) p_ptr->command_arg = MAX_SIGHT; do_cmd_wiz_zap(p_ptr->command_arg); break; } /* Oops */ default: { msg_print("That is not a valid debug command."); break; } } }
/* * Inscribe an object with a comment */ void do_cmd_inscribe(void) { int item; object_type *o_ptr; char o_name[80]; char tmp[80]; cptr q, s; /* Get an item */ q = "Inscribe which item? "; s = "You have nothing to inscribe."; if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) { o_ptr = &inventory[item]; } /* Get the item (on the floor) */ else { o_ptr = &o_list[0 - item]; } /* Describe the activity */ object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 3); /* Message */ msg_format("Inscribing %s.", o_name); message_flush(); /* Start with nothing */ my_strcpy(tmp, "", sizeof(tmp)); /* Use old inscription */ if (o_ptr->obj_note) { /* Start with the old inscription */ strnfmt(tmp, sizeof(tmp), "%s", quark_str(o_ptr->obj_note)); } /* Get a new inscription (possibly empty) */ if (term_get_string("Inscription: ", tmp, sizeof(tmp))) { char tmp_val[160]; char o_name2[80]; /*make a fake object so we can give a proper message*/ object_type *i_ptr; object_type object_type_body; // if given an empty inscription, then uninscribe instead if (strlen(tmp) == 0) { uninscribe(o_ptr); return; } /* Save the inscription */ o_ptr->obj_note = quark_add(tmp); /* Add an autoinscription? */ // Sil-y: removed restriction to known items (through 'object_aware') if (!(k_info[o_ptr->k_idx].flags3 & (TR3_INSTA_ART))) { /* Get local object */ i_ptr = &object_type_body; /* Wipe the object */ object_wipe(i_ptr); /* Create the object */ object_prep(i_ptr, o_ptr->k_idx); /*make it plural*/ i_ptr->number = 2; /*now describe with correct amount*/ object_desc(o_name2, sizeof(o_name2), i_ptr, FALSE, 0); /* Prompt */ strnfmt(tmp_val, sizeof(tmp_val), "Automatically inscribe all %s with '%s'? ", o_name2, tmp); /* Auto-Inscribe if they want that */ if (get_check(tmp_val)) add_autoinscription(o_ptr->k_idx, tmp); } /* Combine the pack */ p_ptr->notice |= (PN_COMBINE); /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP); } }