// This is the main constructor. PropertiesDialog::PropertiesDialog(QWidget *parent, const QVector<QString> Qheader, const QString sourceInput, const QString targetInput) : QDialog(parent) { // We first set up the standard elements of the interface, which are only two labels and two buttons. sourceLabel = new QLabel(sourceInput); targetLabel = new QLabel(targetInput); saveCloseButton = new QPushButton(tr("Save and Close")); cancelButton = new QPushButton(tr("Cancel")); // We dynamically create two lists of checkboxes as well, which represent potential properties. // Only variables that were not already selected as source and target nodes are included as options. QVectorIterator<QString> it(Qheader); while (it.hasNext()) { QPointer<QCheckBox> tempBoxOne = new QCheckBox(it.peekNext(), this); QPointer<QCheckBox> tempBoxTwo = new QCheckBox(it.next(), this); if (tempBoxOne->text() != sourceInput && tempBoxOne->text() != targetInput) { sourceVector.push_back(tempBoxOne); } else { delete tempBoxOne; } if (tempBoxTwo->text() != targetInput && tempBoxTwo->text() != sourceInput) { targetVector.push_back(tempBoxTwo); if (sourceInput == targetInput) { tempBoxTwo->setEnabled(false); } } else { delete tempBoxTwo; } } // We then set up the signals. Basically, save and close is the only signal that will send information from the properties dialog // to the main dialog. connect(saveCloseButton, SIGNAL(clicked()), this, SLOT(saveAndClose())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); // In case the user decides not to set properties. // Then we create our layout. QPointer<QVBoxLayout> mainLayout = new QVBoxLayout; QPointer<QHBoxLayout> mainBodyLayout = new QHBoxLayout; QPointer<QVBoxLayout> mainBodyLeft = new QVBoxLayout; QPointer<QVBoxLayout> mainBodyRight = new QVBoxLayout; mainBodyLeft->addWidget(sourceLabel); QVectorIterator<QPointer<QCheckBox> > sI(sourceVector); while (sI.hasNext()) { mainBodyLeft->addWidget(sI.next()); } mainBodyRight->addWidget(targetLabel); QVectorIterator<QPointer<QCheckBox> > tI(targetVector); while (tI.hasNext()) { mainBodyRight->addWidget(tI.next()); } mainBodyLayout->addLayout(mainBodyLeft); mainBodyLayout->addLayout(mainBodyRight); mainLayout->addLayout(mainBodyLayout); QPointer<QHBoxLayout> lowerLayout = new QHBoxLayout; lowerLayout->addWidget(saveCloseButton); lowerLayout->addWidget(cancelButton); mainLayout->addLayout(lowerLayout); setLayout(mainLayout); setWindowTitle(tr("Set Properties")); setFixedHeight(sizeHint().height()); // And that finishes our constructor }
PlayerDeathDialog::PlayerDeathDialog(void) { QPointer<QVBoxLayout> vlay = new QVBoxLayout; QPointer<QLabel> obj_label = new QLabel(QString("<b><big>Press 'Close' when ready:</big></b>")); obj_label->setAlignment(Qt::AlignCenter); vlay->addWidget(obj_label); vlay->addStretch(1); // Add the "Character Screen" button QPointer<QPushButton> char_screen_button = new QPushButton("Character Information"); char_screen_button->setToolTip("View player screen."); connect(char_screen_button, SIGNAL(clicked()), this, SLOT(death_player_info())); vlay->addWidget(char_screen_button); // Add the "Information" button QPointer<QPushButton> info_button = new QPushButton(" Equipment and Inventory Information "); info_button->setToolTip("View equipment, inventory."); connect(info_button, SIGNAL(clicked()), this, SLOT(death_inven_info())); vlay->addWidget(info_button); // Add the "Home Inventory" button QPointer<QPushButton> home_button = new QPushButton("Home Inventory"); home_button->setToolTip("View inventory in player's home."); connect(home_button, SIGNAL(clicked()), this, SLOT(death_home_inven())); vlay->addWidget(home_button); // Add the "Messages" button QPointer<QPushButton> message_button = new QPushButton("Messages"); message_button->setToolTip("View recent messages."); connect(message_button, SIGNAL(clicked()), this, SLOT(death_messages())); vlay->addWidget(message_button); // Add the "Character Dump" button QPointer<QPushButton> file_dump_button = new QPushButton("Character Dump"); file_dump_button->setToolTip("Create a final character dump."); connect(file_dump_button, SIGNAL(clicked()), this, SLOT(death_file_dump())); vlay->addWidget(file_dump_button); // Add the "Screenshot" button QPointer<QPushButton> screenshot_button = new QPushButton("Screenshot"); screenshot_button->setToolTip("Create a final screenshot."); connect(screenshot_button, SIGNAL(clicked()), this, SLOT(death_screenshot())); vlay->addWidget(screenshot_button); // Add the "Scores" button QPointer<QPushButton> scores_button = new QPushButton("View Scores"); scores_button->setToolTip("View the scores for all characters."); connect(scores_button, SIGNAL(clicked()), this, SLOT(death_scores())); vlay->addWidget(scores_button); // Add the "Examine" button QPointer<QPushButton> examine_button = new QPushButton("Examine Items"); examine_button->setToolTip("Examine Items in Player Inventory and Backpack."); connect(examine_button, SIGNAL(clicked()), this, SLOT(death_examine())); vlay->addWidget(examine_button); // Add the "View Notes" button QPointer<QPushButton> notes_button = new QPushButton("View Notes"); notes_button->setToolTip("View a log of all notes from the game."); connect(notes_button, SIGNAL(clicked()), this, SLOT(death_notes())); vlay->addWidget(notes_button); // Add the "Spoilers" button QPointer<QPushButton> spoilers_button = new QPushButton("Create Spoilers"); spoilers_button->setToolTip("Create spoiler files."); connect(spoilers_button, SIGNAL(clicked()), this, SLOT(death_spoilers())); vlay->addWidget(spoilers_button); vlay->addStretch(1); //Add a close button on the right side QPointer<QDialogButtonBox> buttons = new QDialogButtonBox(QDialogButtonBox::Close); connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); vlay->addWidget(buttons); setLayout(vlay); setWindowTitle("Press 'Close' when done:"); this->exec(); }
//Init the dialog void QxMainWindow::initDialog() { // Menu QPointer<QMenu> pFileMenu = menuBar()->addMenu("File"); QPointer<QMenu> pViewMenu = menuBar()->addMenu("View"); QPointer<QMenu> pHelpMenu = menuBar()->addMenu("Help"); m_pOpenAction = pFileMenu->addAction("Open"); m_pDecodeAction = pFileMenu->addAction("Decode Selected"); m_pDecodeAllAction = pFileMenu->addAction("Decode All"); m_pRemoveAction = pFileMenu->addAction("Remove Selected"); m_pClearListAction = pFileMenu->addAction("Remove All"); m_pHidePreviewAction = pViewMenu->addAction("Hide Preview"); m_pAboutAction = pHelpMenu->addAction("About gntDecoder"); m_pOpenAction->setIcon(QIcon(":/Resources/open.ico")); m_pDecodeAllAction->setIcon(QIcon(":/Resources/save_all.ico")); m_pAboutAction->setIcon(QIcon(":/Resources/about.ico")); m_pDecodeAction->setIcon(QIcon(":/Resources/save.png")); m_pRemoveAction->setIcon(QIcon(":/Resources/remove.ico")); m_pClearListAction->setIcon(QIcon(":/Resources/clear.ico")); m_pHidePreviewAction->setIcon(QIcon(":/Resources/hide.png")); m_pOpenAction->setToolTip("Add .gnt files to file list"); m_pDecodeAction->setToolTip("Decode selected file"); m_pDecodeAllAction->setToolTip("Decode all files in the file list"); m_pRemoveAction->setToolTip("Remove selected file from file list(Do nothing with local files)"); m_pClearListAction->setToolTip("Clear file list(Do nothing with local files)"); m_pHidePreviewAction->setToolTip("Hide preview image"); // Toolbar m_pToolBar = new QToolBar; addToolBar(m_pToolBar); m_pToolBar->addAction(m_pOpenAction); m_pToolBar->addAction(m_pDecodeAction); m_pToolBar->addAction(m_pDecodeAllAction); m_pToolBar->addAction(m_pRemoveAction); m_pToolBar->addAction(m_pClearListAction); m_pToolBar->addAction(m_pHidePreviewAction); // window widgets m_pFileListWidget = new QListWidget; m_pPreviewLabel = new QLabel; m_pPreviewLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QPointer<QSplitter> pSplitter = new QSplitter(Qt::Horizontal); pSplitter->addWidget(m_pFileListWidget); pSplitter->addWidget(m_pPreviewLabel); // window style setCentralWidget(pSplitter); setWindowFlags(windowFlags() & ~Qt::WindowMinMaxButtonsHint); // connect signals/slots connect(m_pOpenAction.data(), &QAction::triggered, this, &QxMainWindow::setFileList); connect(m_pDecodeAction.data(), &QAction::triggered, this, &QxMainWindow::decodeSelected); connect(m_pDecodeAllAction.data(), &QAction::triggered, this, &QxMainWindow::decodeAll); connect(m_pClearListAction.data(), &QAction::triggered, this, &QxMainWindow::clearFileList); connect(m_pRemoveAction.data(), &QAction::triggered, this, &QxMainWindow::removeSelectedFile); connect(m_pHidePreviewAction.data(), &QAction::triggered, this, &QxMainWindow::closePreview); connect(m_pFileListWidget.data(), &QListWidget::itemSelectionChanged, this, &QxMainWindow::preview); connect(m_pAboutAction.data(), &QAction::triggered, this, &QxMainWindow::showAboutDialog); }
// Select a monster from a list and place it in the dungeon. MakeMonsterDialog::MakeMonsterDialog(void) { int i; QPointer<QVBoxLayout> vlay = new QVBoxLayout; mon_choice = new QComboBox; int y, x; QPointer<QLabel> mon_label = new QLabel(QString("<b><big>Please select a monster:</big></b>")); mon_label->setAlignment(Qt::AlignCenter); vlay->addWidget(mon_label); vlay->addStretch(); connect(mon_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(update_mon_choice(int))); QPointer<QPushButton> close_button = new QPushButton(tr("&Close")); connect(close_button, SIGNAL(clicked()), this, SLOT(close())); int count = 0; mon_num = 0; for (i = 1; i < z_info->r_max; i++) { monster_race *r_ptr = &r_info[i]; /* Skip "empty" items */ if (r_ptr->r_name_full.isEmpty()) continue; // Skip player_ghost templates if (r_ptr->flags2 & (RF2_PLAYER_GHOST)) continue; mon_choice->addItem(QString("%1") .arg(i)); mon_choice->setItemText(count++, get_mon_display_name(i)); } vlay->addWidget(mon_choice); vlay->addStretch(); vlay->addWidget(close_button); setLayout(vlay); setWindowTitle(tr("Make Monster")); this->exec(); // find the monster count = 0; for (i = 1; i < z_info->r_max; i++) { monster_race *r_ptr = &r_info[i]; /* Skip "empty" items */ if (r_ptr->r_name_full.isEmpty()) continue; // Skip player_ghost templates if (r_ptr->flags2 & (RF2_PLAYER_GHOST)) continue; // Found the match if (count == mon_num) break; count++; } /* Try 10 times */ for (int k = 0; k < 10; k++) { int d = 2; /* Pick a location */ scatter(&y, &x, p_ptr->py, p_ptr->px, d, 0); /* Require empty grids */ if (!cave_empty_bold(y, x)) continue; /* Place it (allow groups) */ if (place_monster_aux(y, x, i, (MPLACE_GROUP | MPLACE_OVERRIDE | MPLACE_SLEEP))) break; } }
// Select a monster from a list and place it in the dungeon. MakeFeatureDialog::MakeFeatureDialog(void) { int i; QPointer<QVBoxLayout> vlay = new QVBoxLayout; feat_choice = new QComboBox; QPointer<QLabel> feat_label = new QLabel(QString("<b><big>Please select a feature:</big></b>")); feat_label->setAlignment(Qt::AlignCenter); vlay->addWidget(feat_label); vlay->addStretch(); connect(feat_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(update_feat_choice(int))); QPointer<QPushButton> close_button = new QPushButton(tr("&Close")); connect(close_button, SIGNAL(clicked()), this, SLOT(close())); int count = 0; feat_num = 0; for (i = 1; i < z_info->f_max; i++) { /* Get the feature */ feature_type *f_ptr = &f_info[i]; if (f_ptr->f_name.isEmpty()) continue; feat_choice->addItem(QString("%1") .arg(i)); feat_choice->setItemText(count++, get_feat_display_name(i)); } vlay->addWidget(feat_choice); vlay->addStretch(); vlay->addWidget(close_button); setLayout(vlay); setWindowTitle(tr("Make Feature")); this->exec(); // find the feature count = 0; for (i = 1; i < z_info->f_max; i++) { /* Get the feature */ feature_type *f_ptr = &f_info[i]; if (f_ptr->f_name.isEmpty()) continue; // Found the match if (count == feat_num) break; count++; } /* Pick a location */ if (!target_set_interactive(TARGET_GRID, -1, -1)) return; /* Paranoia */ if (!p_ptr->target_set) return; int y = p_ptr->target_row; int x = p_ptr->target_col; /* Paranoia */ if (dungeon_info[y][x].has_object()) { pop_up_message_box("Must be an empty grid"); return; } if (feat_ff2_match(i, FF2_EFFECT)) { feature_type *f_ptr = &f_info[i]; int gf_type = f_ptr->x_gf_type; if (feat_ff2_match(i, FF2_TRAP_SMART)) { QString dummy_string; u16b flags = fire_trap_smart(i, y, x, MODE_FLAGS, &dummy_string); set_effect_trap_smart(i, y, x, flags); } else if (feat_ff2_match(i, FF2_TRAP_PASSIVE)) set_effect_trap_passive(i, y, x); else if (feat_ff2_match(i, FF2_TRAP_MON)) set_effect_trap_player(i, y, x); else if (i == FEAT_GLYPH_WARDING) set_effect_glyph(y, x); else if (i == FEAT_WALL_GLACIER) set_effect_glacier(i, y, x, SOURCE_EFFECT, 0); else if (i == FEAT_WALL_INSCRIPTION) set_effect_inscription(i, y, x, SOURCE_EFFECT, 0); else if ((i == FEAT_RUBBLE) || (i == FEAT_RUBBLE_HIDDEN_OBJECT) || (i == FEAT_LOOSE_ROCK)) set_effect_rocks(i, y, x); else if (i == FEAT_EFFECT_SMOKE) set_effect_lingering_cloud(FEAT_EFFECT_SMOKE, y, x, 100, SOURCE_OTHER, 0); else if (i == FEAT_EFFECT_FOG) set_effect_permanent_cloud(i, y, x, 0, 0); // This list should be kept current with the function project_x else switch (gf_type) { case GF_COLD: case GF_ACID: case GF_ELEC: case GF_POIS: case GF_BWATER: case GF_BMUD: case GF_FIRE: case GF_LAVA: case GF_SPORE: case GF_NETHER: case GF_CHAOS: case GF_DISENCHANT: case GF_NEXUS: case GF_TIME: case GF_CONFUSION: case GF_SHARD: { set_effect_lingering_cloud(i, y, x, 50, SOURCE_OTHER, 0); break; } case GF_GRAVITY: case GF_INERTIA_NPP: case GF_LIFE_DRAIN: case GF_LIGHT: case GF_DARK: case GF_ELEC_BURST: case GF_METEOR: { set_effect_shimmering_cloud(i, y, x, 50, 50, SOURCE_OTHER, 0); break; } default :break; } } /* Create the feature */ else cave_set_feat(y, x, i); }
EditObjectDialog::EditObjectDialog(void) { object_type *o_ptr; int item; /* Get an item */ QString q = "Choose an item to edit. "; QString s = "You have no eligible items."; /* Only accept legal items. */ item_tester_hook = item_tester_hook_not_artifact; if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | USE_QUIVER))) 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]; } QPointer<QVBoxLayout> vlay = new QVBoxLayout; QPointer<QGridLayout> edit_info = new QGridLayout; QPointer<QLabel> obj_label = new QLabel(QString("<b><big>Editing %1</big></b>") .arg(object_desc(o_ptr, ODESC_PREFIX | ODESC_FULL))); obj_label->setAlignment(Qt::AlignCenter); vlay->addWidget(obj_label); // Edit quantity QPointer<QLabel> quant_label = new QLabel("Edit quantity"); QPointer<QSpinBox> quant_spinner = new QSpinBox; quant_spinner->setRange(1,MAX_STACK_SIZE); quant_spinner->setValue(o_ptr->number); edit_info->addWidget(quant_label, 1, 0); edit_info->addWidget(quant_spinner, 1, 1); // Pval QPointer<QLabel> pval_label = new QLabel("Edit pval"); QPointer<QSpinBox> pval_spinner = new QSpinBox; pval_spinner->setRange(-99,99); pval_spinner->setValue(o_ptr->pval); edit_info->addWidget(pval_label, 2, 0); edit_info->addWidget(pval_spinner, 2, 1); if (!o_ptr->is_wieldable()) { pval_label->hide(); pval_spinner->hide(); } // To-hit QPointer<QLabel> to_h_label = new QLabel("Edit To-Hit"); QPointer<QSpinBox> to_h_spinner = new QSpinBox; to_h_spinner->setRange(-99,99); to_h_spinner->setValue(o_ptr->to_h); edit_info->addWidget(to_h_label, 3, 0); edit_info->addWidget(to_h_spinner, 3, 1); if (!o_ptr->is_wieldable() && !o_ptr->is_ammo()) { to_h_label->hide(); to_h_spinner->hide(); } // To-damage QPointer<QLabel> to_d_label = new QLabel("Edit To-Dam"); QPointer<QSpinBox> to_d_spinner = new QSpinBox; to_d_spinner->setRange(-99,99); to_d_spinner->setValue(o_ptr->to_d); edit_info->addWidget(to_d_label, 4, 0); edit_info->addWidget(to_d_spinner, 4, 1); if (!o_ptr->is_wieldable() && !o_ptr->is_ammo()) { to_h_label->hide(); to_h_spinner->hide(); to_d_label->hide(); to_d_spinner->hide(); } // Armor Class QPointer<QLabel> to_ac_label = new QLabel("Edit Armor Class"); QPointer<QSpinBox> to_ac_spinner = new QSpinBox; to_ac_spinner->setRange(-99,99); to_ac_spinner->setValue(o_ptr->to_d); edit_info->addWidget(to_ac_label, 5, 0); edit_info->addWidget(to_ac_spinner, 5, 1); if (!o_ptr->is_wieldable()) { to_ac_label->hide(); to_ac_spinner->hide(); } QPointer<QPushButton> close_button = new QPushButton(tr("&Close")); connect(close_button, SIGNAL(clicked()), this, SLOT(close())); vlay->addLayout(edit_info); vlay->addStretch(); vlay->addWidget(close_button); setLayout(vlay); setWindowTitle("Object Editor"); this->exec(); o_ptr->number = quant_spinner->value(); o_ptr->pval = pval_spinner->value(); o_ptr->to_h = to_h_spinner->value(); o_ptr->to_d = to_d_spinner->value(); o_ptr->to_a = to_ac_spinner->value(); /* Combine and Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER | PN_SORT_QUIVER); /* Update stuff */ p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); handle_stuff(); }
// Select an artifact from a list and place it in the player's inventory. // Note that dragon armor comes out doesn't work too well, since it // is always make into an ego item. MakeObjectDialog::MakeObjectDialog(void) { int i; QPointer<QVBoxLayout> vlay = new QVBoxLayout; obj_choice = new QComboBox; object_type object_type_body; object_type *i_ptr = &object_type_body; QPointer<QLabel> obj_label = new QLabel(QString("<b><big>Please select an object:</big></b>")); obj_label->setAlignment(Qt::AlignCenter); vlay->addWidget(obj_label); vlay->addStretch(); connect(obj_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(update_obj_choice(int))); QPointer<QPushButton> close_button = new QPushButton(tr("&Close")); connect(close_button, SIGNAL(clicked()), this, SLOT(close())); int count = 0; obj_num = 0; for (i = 1; i < z_info->k_max; i++) { object_kind *k_ptr = &k_info[i]; /* Skip "empty" items */ if (k_ptr->k_name.isEmpty()) continue; // Skip artifact templates if (k_ptr->k_flags3 & (TR3_INSTA_ART)) continue; // Skip gold if (k_ptr->tval == TV_GOLD) continue; obj_choice->addItem(QString("%1") .arg(i)); obj_choice->setItemText(count++, get_object_display_name(i)); } vlay->addWidget(obj_choice); vlay->addStretch(); vlay->addWidget(close_button); setLayout(vlay); setWindowTitle(tr("Make Object")); this->exec(); // find the object count = 0; for (i = 1; i < z_info->k_max; i++) { object_kind *k_ptr = &k_info[i]; /* Skip "empty" items */ if (k_ptr->k_name.isEmpty()) continue; // Skip artifact templates if (k_ptr->k_flags3 & (TR3_INSTA_ART)) continue; // Skip gold if (k_ptr->tval == TV_GOLD) continue; // Found the match if (count == obj_num) break; count++; } // This is necessary to keep the game from freezing on dragon armor object_level = k_info[i].k_level; i_ptr->object_wipe(); object_prep(i_ptr, i); apply_magic(i_ptr, p_ptr->depth, FALSE, FALSE, FALSE, FALSE); object_history(i_ptr, ORIGIN_CHEAT, 0); identify_object(i_ptr, true); if(inven_carry(i_ptr) < 0) { drop_near(i_ptr, -1, p_ptr->py, p_ptr->px); } object_level = p_ptr->depth; }
// Select an artifact from a list and place it in the player's inventory MakeArtifactDialog::MakeArtifactDialog(void) { int i; QPointer<QVBoxLayout> vlay = new QVBoxLayout; art_choice = new QComboBox; object_type object_type_body; object_type *i_ptr = &object_type_body; QPointer<QLabel> obj_label = new QLabel(QString("<b><big>Please select an artifact:</big></b>")); obj_label->setAlignment(Qt::AlignCenter); vlay->addWidget(obj_label); vlay->addStretch(); connect(art_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(update_art_choice(int))); QPointer<QPushButton> close_button = new QPushButton(tr("&Close")); connect(close_button, SIGNAL(clicked()), this, SLOT(close())); int count = 0; art_num = 0; for (i = 1; i < z_info->art_norm_max; i++) { artifact_type *a_ptr = &a_info[i]; /* Skip "empty" items */ if (a_ptr->tval + a_ptr->sval == 0) continue; art_choice->addItem(QString("%1") .arg(i)); art_choice->setItemText(count++, get_artifact_display_name(i)); } vlay->addWidget(art_choice); vlay->addStretch(); vlay->addWidget(close_button); setLayout(vlay); setWindowTitle(tr("Make Artifact")); this->exec(); // find the artifact count = 0; for (i = 1; i < z_info->art_norm_max; i++) { artifact_type *a_ptr = &a_info[i]; /* Skip "empty" items */ if (a_ptr->tval + a_ptr->sval == 0) continue; // Found the match if (count == art_num) break; count++; } i_ptr->object_wipe(); if (!wiz_alloc_artifact(i_ptr, i)) { return; } object_history(i_ptr, ORIGIN_CHEAT, 0); identify_object(i_ptr, true); if(inven_carry(i_ptr) < 0) { drop_near(i_ptr, -1, p_ptr->py, p_ptr->px); } }
EditCharacterDialog::EditCharacterDialog(void) { QPointer<QGridLayout> edit_info = new QGridLayout; QPointer<QVBoxLayout> vlay = new QVBoxLayout; // First allow the 6 stats to be edited // Strength QPointer<QLabel> str_label = new QLabel("Strength"); QPointer<QSpinBox> str_spinner = new QSpinBox; str_spinner->setRange(3,118); str_spinner->setValue(p_ptr->stat_base_cur[A_STR]); edit_info->addWidget(str_label, 1, 0); edit_info->addWidget(str_spinner, 1, 1); // Intelligence QPointer<QLabel> int_label = new QLabel("Intelligence"); QPointer<QSpinBox> int_spinner = new QSpinBox; int_spinner->setRange(3,118); int_spinner->setValue(p_ptr->stat_base_cur[A_INT]); edit_info->addWidget(int_label, 2, 0); edit_info->addWidget(int_spinner, 2, 1); // Wisdom QPointer<QLabel> wis_label = new QLabel("Wisdom"); QPointer<QSpinBox> wis_spinner = new QSpinBox; wis_spinner->setRange(3,118); wis_spinner->setValue(p_ptr->stat_base_cur[A_WIS]); edit_info->addWidget(wis_label, 3, 0); edit_info->addWidget(wis_spinner, 3, 1); // Dexterity QPointer<QLabel> dex_label = new QLabel("Dexterity"); QPointer<QSpinBox> dex_spinner = new QSpinBox; dex_spinner->setRange(3,118); dex_spinner->setValue(p_ptr->stat_base_cur[A_DEX]); edit_info->addWidget(dex_label, 4, 0); edit_info->addWidget(dex_spinner, 4, 1); // Constitution QPointer<QLabel> con_label = new QLabel("Constitution"); QPointer<QSpinBox> con_spinner = new QSpinBox; con_spinner->setRange(3,118); con_spinner->setValue(p_ptr->stat_base_cur[A_CON]); edit_info->addWidget(con_label, 5, 0); edit_info->addWidget(con_spinner, 5, 1); // Charisma QPointer<QLabel> chr_label = new QLabel("Charisma"); QPointer<QSpinBox> chr_spinner = new QSpinBox; chr_spinner->setRange(3,118); chr_spinner->setValue(p_ptr->stat_base_cur[A_CHR]); edit_info->addWidget(chr_label, 6, 0); edit_info->addWidget(chr_spinner, 6, 1); // Gold QPointer<QLabel> gold_label = new QLabel("Gold"); QPointer<QSpinBox> gold_spinner = new QSpinBox; gold_spinner->setRange(0,500000000); gold_spinner->setValue(p_ptr->au); gold_spinner->setSingleStep(1000000); edit_info->addWidget(gold_label, 7, 0); edit_info->addWidget(gold_spinner, 7, 1); // Experience QPointer<QLabel> exp_label = new QLabel("Experience"); QPointer<QSpinBox> exp_spinner = new QSpinBox; exp_spinner->setRange(0,10000000); exp_spinner->setValue(p_ptr->max_exp); exp_spinner->setSingleStep(10000); edit_info->addWidget(exp_label, 8, 0); edit_info->addWidget(exp_spinner, 8, 1); // Experience QPointer<QLabel> fame_label = new QLabel("Fame"); QPointer<QSpinBox> fame_spinner = new QSpinBox; fame_spinner->setRange(0,5000); fame_spinner->setValue(p_ptr->q_fame); fame_spinner->setSingleStep(100); edit_info->addWidget(fame_label, 9, 0); edit_info->addWidget(fame_spinner, 9, 1); QPointer<QPushButton> close_button = new QPushButton(tr("&Close")); connect(close_button, SIGNAL(clicked()), this, SLOT(close())); vlay->addLayout(edit_info); vlay->addStretch(); vlay->addWidget(close_button); setLayout(vlay); setWindowTitle(tr("Character Edit Screen")); this->exec(); p_ptr->stat_base_cur[A_STR] = p_ptr->stat_base_max[A_STR] = str_spinner->value(); p_ptr->stat_base_cur[A_INT] = p_ptr->stat_base_max[A_INT] = int_spinner->value(); p_ptr->stat_base_cur[A_WIS] = p_ptr->stat_base_max[A_WIS] = wis_spinner->value(); p_ptr->stat_base_cur[A_DEX] = p_ptr->stat_base_max[A_DEX] = dex_spinner->value(); p_ptr->stat_base_cur[A_CON] = p_ptr->stat_base_max[A_CON] = con_spinner->value(); p_ptr->stat_base_cur[A_CHR] = p_ptr->stat_base_max[A_CHR] = chr_spinner->value(); p_ptr->au = gold_spinner->value(); p_ptr->max_exp = p_ptr->exp = exp_spinner->value(); check_experience(); p_ptr->q_fame = fame_spinner->value(); /* Combine and Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER | PN_SORT_QUIVER); /* Update stuff */ p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); /* Fully update the visuals */ p_ptr->update |= (PU_FORGET_VIEW | PU_UPDATE_VIEW | PU_MONSTERS); /* Redraw everything */ p_ptr->redraw |= (PR_STATUSBAR | PR_SIDEBAR_PL | PR_MAP | PR_WIN_INVENTORY | PR_WIN_EQUIPMENT | PR_MESSAGES | PR_WIN_MON_RECALL | PR_WIN_OBJ_RECALL | PR_WIN_MESSAGES | PR_WIN_OBJLIST | PR_WIN_FEAT_RECALL); handle_stuff(); }
WizardModeDialog::WizardModeDialog(void) { int row = 0; // Paranoia if (!p_ptr->playing) return; if (!p_ptr->is_wizard) { QString prompt = color_string(QString ("<b><big>You are about to use 'Wizard Mode' commands.</big></b><br><br>"), TERM_RED); prompt.append("Wizard Mode contains many powerful 'cheat' commands. "); prompt.append("Your savefile will be marked as a wizard mode character and will not be scored.<br><br>"); prompt.append("Really use Wizard Mode?"); if (!get_check(prompt)) return; p_ptr->is_wizard = TRUE; } main_prompt = new QLabel(QString("<b><big>Please select a command</big></b><br>")); main_prompt->setAlignment(Qt::AlignCenter); QPointer<QVBoxLayout> vlay = new QVBoxLayout; vlay->addWidget(main_prompt); // Add the player related commands QPointer<QGridLayout> wizard_layout = new QGridLayout; player_section = new QLabel("<b>Player commands</b>"); player_section->setAlignment(Qt::AlignCenter); wizard_layout->addWidget(player_section, row, 1); row++; // Add the "cure all" button QPointer<QPushButton> heal_button = new QPushButton("Heal Player"); heal_button->setToolTip("Completely heal and restore the player."); connect(heal_button, SIGNAL(clicked()), this, SLOT(wiz_cure_all())); wizard_layout->addWidget(heal_button, row, 0); // Add the "know all" button QPointer<QPushButton> know_button = new QPushButton("Know All"); know_button->setToolTip("Know everything about every feature, object, and monster in the game."); connect(know_button, SIGNAL(clicked()), this, SLOT(wiz_know_all())); wizard_layout->addWidget(know_button, row, 1); // Add the "jump" button QPointer<QPushButton> jump_button = new QPushButton("Jump To New Level"); jump_button->setToolTip("Allow the player to instantly jump to any level in the dungeon."); connect(jump_button, SIGNAL(clicked()), this, SLOT(wiz_jump())); wizard_layout->addWidget(jump_button, row, 2); row++; // Add the "teleport_to_target" button QPointer<QPushButton> teleport_target_button = new QPushButton("Teleport To Targeted Spot"); teleport_target_button->setToolTip("Teleports the player to a specified spot on the dungeon level."); connect(teleport_target_button, SIGNAL(clicked()), this, SLOT(wiz_teleport_to_target())); wizard_layout->addWidget(teleport_target_button, row, 0); // Add the "phase door" button QPointer<QPushButton> phase_door = new QPushButton("Phase Door"); phase_door->setToolTip("Teleports the player to a random spot up to 10 squares away."); connect(phase_door, SIGNAL(clicked()), this, SLOT(wiz_phase_door())); wizard_layout->addWidget(phase_door, row, 1); // Add the "teleport" button QPointer<QPushButton> teleport = new QPushButton("Teleport"); teleport->setToolTip("Teleports the player to a random spot up to 100 squares away."); connect(teleport, SIGNAL(clicked()), this, SLOT(wiz_teleport())); wizard_layout->addWidget(teleport, row, 2); row++; // Add the "edit character" button QPointer<QPushButton> edit_character = new QPushButton("Edit Character"); edit_character->setToolTip("Edit character statistics, experience, gold, and fame."); connect(edit_character, SIGNAL(clicked()), this, SLOT(wiz_edit_character())); wizard_layout->addWidget(edit_character, row, 0); // Add the "know all" button QPointer<QPushButton> spoil_button = new QPushButton("Print Spoilers"); spoil_button->setToolTip("Print out Spoilers for all Monsters, objects, artifacts, and terrain."); connect(spoil_button, SIGNAL(clicked()), this, SLOT(wiz_print_spoilers())); wizard_layout->addWidget(spoil_button, row, 1); row++; // Add the dungeon commands dungeon_section = new QLabel("<b>Dungeon commands</b>"); dungeon_section->setAlignment(Qt::AlignCenter); wizard_layout->addWidget(dungeon_section, row, 1); row++; // Add the "summon" button QPointer<QPushButton> summon_button = new QPushButton("Summon Monster"); summon_button->setToolTip("Summon one random monster."); connect(summon_button, SIGNAL(clicked()), this, SLOT(wiz_summon())); wizard_layout->addWidget(summon_button, row, 0); // Add the "banish" button QPointer<QPushButton> banish_button = new QPushButton("Banish Monsters"); banish_button->setToolTip("Erase all monsters within 30 squares of player, except for uniques and quest monsters."); connect(banish_button, SIGNAL(clicked()), this, SLOT(wiz_banish())); wizard_layout->addWidget(banish_button, row, 1); // Add the "detect all monsters" button QPointer<QPushButton> display_mon_button = new QPushButton("Detect All Monsters"); display_mon_button->setToolTip("Detect all monsters on the level."); connect(display_mon_button, SIGNAL(clicked()), this, SLOT(wiz_detect_all_monsters())); wizard_layout->addWidget(display_mon_button, row, 2); row++; // Add the "detection" button QPointer<QPushButton> detection = new QPushButton("Detection"); detection->setToolTip("Cast the 'Detection' spell"); connect(detection, SIGNAL(clicked()), this, SLOT(wiz_detection())); wizard_layout->addWidget(detection, row, 0); // Add the "magic mapping" button QPointer<QPushButton> magic_mapping = new QPushButton("Magic Mapping"); magic_mapping->setToolTip("Cast the 'Magic Mapping' spell."); connect(magic_mapping, SIGNAL(clicked()), this, SLOT(wiz_magic_mapping())); wizard_layout->addWidget(magic_mapping, row, 1); // Add the "light dungeon" button QPointer<QPushButton> dungeon_light = new QPushButton("Light Dungeon"); dungeon_light->setToolTip("Illuminate the entire dungeon level."); connect(dungeon_light, SIGNAL(clicked()), this, SLOT(wiz_level_light())); wizard_layout->addWidget(dungeon_light, row, 2); row++; // Add the "redraw dungeon" button QPointer<QPushButton> redraw_dungeon = new QPushButton("Redraw Dungeon"); redraw_dungeon->setToolTip("Redraw a new dungeon level at the current depth."); connect(redraw_dungeon, SIGNAL(clicked()), this, SLOT(wiz_redraw_dungeon())); wizard_layout->addWidget(redraw_dungeon, row, 0); // Add the "make monster" button QPointer<QPushButton> make_monster = new QPushButton("Make Monster"); make_monster->setToolTip("Attempt to make a monster of a specified monster race."); connect(make_monster, SIGNAL(clicked()), this, SLOT(wiz_create_monster())); wizard_layout->addWidget(make_monster, row, 1); // Add the "make feature" button QPointer<QPushButton> make_feature = new QPushButton("Make Feature"); make_feature->setToolTip("Attempt to make a specified feature type."); connect(make_feature, SIGNAL(clicked()), this, SLOT(wiz_create_feature())); wizard_layout->addWidget(make_feature, row, 2); row++; // Add the object commands object_section = new QLabel("<b>Object commands</b>"); object_section->setAlignment(Qt::AlignCenter); wizard_layout->addWidget(object_section, row, 1); row++; // Add the "mass create items" button QPointer<QPushButton> mass_create_items_button = new QPushButton("Create 25 Random Items"); mass_create_items_button->setToolTip("Drop 25 randomly generated objects around the player."); connect(mass_create_items_button , SIGNAL(clicked()), this, SLOT(wiz_mass_create_items())); wizard_layout->addWidget(mass_create_items_button, row, 0); // Add the "create 1 random good item" button QPointer<QPushButton> create_good_item = new QPushButton("Create 1 Random Good Item"); create_good_item->setToolTip("Drop one randomly created guaranteed good item by the player."); connect(create_good_item , SIGNAL(clicked()), this, SLOT(wiz_create_good_item())); wizard_layout->addWidget(create_good_item, row, 1); // Add the "create 1 random great item" button QPointer<QPushButton> create_great_item = new QPushButton("Create 1 Random Great Item"); create_great_item->setToolTip("Drop one randomly created guaranteed great item by the player."); connect(create_great_item , SIGNAL(clicked()), this, SLOT(wiz_create_great_item())); wizard_layout->addWidget(create_great_item, row, 2); row++; // Add the "mass identify" button QPointer<QPushButton> mass_identify = new QPushButton("Mass Identify"); mass_identify->setToolTip("Identify all objects the player has, as well as all objects within 5 squares."); connect(mass_identify, SIGNAL(clicked()), this, SLOT(wiz_mass_identify_items())); wizard_layout->addWidget(mass_identify, row, 0); // Add the "winner's kit" button QPointer<QPushButton> winners_kit = new QPushButton("Winner's kit"); winners_kit->setToolTip("Create a set of artifacts suitable for winning the game."); connect(winners_kit, SIGNAL(clicked()), this, SLOT(wiz_winners_kit())); wizard_layout->addWidget(winners_kit, row, 1); // Add the "edit object" button QPointer<QPushButton> edit_object = new QPushButton("Edit Object"); edit_object->setToolTip("Edit a non-artifact object."); connect(edit_object, SIGNAL(clicked()), this, SLOT(wiz_edit_object())); wizard_layout->addWidget(edit_object, row, 2); row++; // Add the "make artifact" button QPointer<QPushButton> create_artifact = new QPushButton("Create artifact"); create_artifact->setToolTip("Create an artifact."); connect(create_artifact, SIGNAL(clicked()), this, SLOT(wiz_create_artifact())); wizard_layout->addWidget(create_artifact, row, 0); // Add the "make objecct" button QPointer<QPushButton> create_object = new QPushButton("Create object"); create_object->setToolTip("Create a normal object."); connect(create_object, SIGNAL(clicked()), this, SLOT(wiz_create_object())); wizard_layout->addWidget(create_object, row, 1); vlay->addLayout(wizard_layout); buttons = new QDialogButtonBox(QDialogButtonBox::Cancel); connect(buttons, SIGNAL(rejected()), this, SLOT(close())); vlay->addStretch(); vlay->addWidget(buttons); setLayout(vlay); setWindowTitle(tr("Wizard Mode Menu")); this->exec(); }