mirror of
https://github.com/AdAstra-LD/DS-Pokemon-Rom-Editor.git
synced 2026-06-01 21:19:09 -05:00
commit
fbce596c86
|
|
@ -117,7 +117,9 @@
|
|||
<Compile Include="DVCalculator\DVCalcNatureViewerForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DVCalculator\DVCalcNatureViewerForm.Designer.cs" />
|
||||
<Compile Include="DVCalculator\DVCalcNatureViewerForm.Designer.cs">
|
||||
<DependentUpon>DVCalcNatureViewerForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DVCalculator\DVCalculator.cs" />
|
||||
<Compile Include="EditorPanels.cs" />
|
||||
<Compile Include="Editors\EncountersEditor.cs">
|
||||
|
|
@ -426,7 +428,9 @@
|
|||
<EmbeddedResource Include="DVCalculator\DVCalc.resx">
|
||||
<DependentUpon>DVCalc.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="DVCalculator\DVCalcNatureViewerForm.resx" />
|
||||
<EmbeddedResource Include="DVCalculator\DVCalcNatureViewerForm.resx">
|
||||
<DependentUpon>DVCalcNatureViewerForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Editors\EncountersEditor.resx">
|
||||
<DependentUpon>EncountersEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
|||
1059
DS_Map/DVCalculator/DVCalc.Designer.cs
generated
1059
DS_Map/DVCalculator/DVCalc.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -1,590 +1,300 @@
|
|||
using DSPRE.ROMFiles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static DSPRE.RomInfo;
|
||||
|
||||
namespace DSPRE
|
||||
{
|
||||
public partial class DVCalc : Form
|
||||
{
|
||||
|
||||
public DVCalc()
|
||||
public TrainerFile trainerFile;
|
||||
private TrainerProperties trainerProp;
|
||||
private List<Label> pokeLabels = new List<Label>();
|
||||
private List<ComboBox> abilityCombos = new List<ComboBox>();
|
||||
private List<ComboBox> genderCombos = new List<ComboBox>();
|
||||
private List<NumericUpDown> upDownsDV = new List<NumericUpDown>();
|
||||
private List<Label> labelsIV = new List<Label>();
|
||||
private List<Label> natureLabels = new List<Label>();
|
||||
private List<Button> changeButtons = new List<Button>();
|
||||
private List<Button> showAllButtons = new List<Button>();
|
||||
|
||||
private readonly string[] abilitySelection = { "No Flag", "Force Ability 1", "Force Ability 2" };
|
||||
private readonly string[] genderSelection = { "No Flag", "Force Male", "Force Female" };
|
||||
private bool listsSetup = false;
|
||||
|
||||
|
||||
public DVCalc(TrainerFile trainerFile)
|
||||
{
|
||||
Helpers.DisableHandlers();
|
||||
InitializeComponent();
|
||||
PopulateComboBox();
|
||||
|
||||
//make Pokemon searchable
|
||||
pokemonSelector.TextChanged += PokemonSelector_TextChanged;
|
||||
pokemonSelector.AutoCompleteMode = AutoCompleteMode.Suggest;
|
||||
pokemonSelector.AutoCompleteSource = AutoCompleteSource.CustomSource;
|
||||
this.trainerFile = trainerFile;
|
||||
this.trainerProp = trainerFile.trp;
|
||||
|
||||
AutoCompleteStringCollection autoCompleteSource = new AutoCompleteStringCollection();
|
||||
foreach (KeyValuePair<int, string> item in pokemonSelector.Items)
|
||||
{
|
||||
autoCompleteSource.Add(item.Value);
|
||||
}
|
||||
labelTrainerName.Text = $"Trainer Name: [{trainerProp.trainerID}] " + RomInfo.GetSimpleTrainerNames()[trainerProp.trainerID];
|
||||
labelTrainerClass.Text = $"Trainer Class: [{trainerProp.trainerClass}] " + RomInfo.GetTrainerClassNames()[trainerProp.trainerClass];
|
||||
|
||||
pokemonSelector.AutoCompleteCustomSource = autoCompleteSource;
|
||||
|
||||
Version version = new Version(major: 1, minor: 1);
|
||||
if (DVCalculator.TrainerClassGender.GetTrainerClassGender(trainerProp.trainerClass))
|
||||
radioMale.Checked = true;
|
||||
else
|
||||
radioFemale.Checked = true;
|
||||
|
||||
Version version = new Version(major: 2, minor: 0);
|
||||
this.Text = "DVCalc " + version.ToString();
|
||||
|
||||
}
|
||||
|
||||
public DVCalc(uint TrainerIndex, uint TrainerClassIndex) : this()
|
||||
{
|
||||
trainerIdx.Value = TrainerIndex;
|
||||
trainerClassIdx.Value = TrainerClassIndex;
|
||||
|
||||
maleCheck.Checked = DVCalculator.TrainerClassGender.GetTrainerClassGender((int)TrainerClassIndex);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.poke_label = new System.Windows.Forms.Label();
|
||||
this.trainerClassIdx_label = new System.Windows.Forms.Label();
|
||||
this.trainerIdx_label = new System.Windows.Forms.Label();
|
||||
this.pokeLVL_label = new System.Windows.Forms.Label();
|
||||
this.pokeLevel = new System.Windows.Forms.NumericUpDown();
|
||||
this.trainerClassIdx = new System.Windows.Forms.NumericUpDown();
|
||||
this.trainerIdx = new System.Windows.Forms.NumericUpDown();
|
||||
this.natureSelect = new System.Windows.Forms.ComboBox();
|
||||
this.nature_label = new System.Windows.Forms.Label();
|
||||
this.DV_label = new System.Windows.Forms.Label();
|
||||
this.calcButton = new System.Windows.Forms.Button();
|
||||
this.maleCheck = new System.Windows.Forms.CheckBox();
|
||||
this.maxDVNature_label = new System.Windows.Forms.Label();
|
||||
this.IV_label = new System.Windows.Forms.Label();
|
||||
this.pokemonSelector = new System.Windows.Forms.ComboBox();
|
||||
this.showAllButton = new System.Windows.Forms.Button();
|
||||
this.radioButtonMale = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonFemale = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonAbility1 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonAbility2 = new System.Windows.Forms.RadioButton();
|
||||
this.numericUpDownGender = new System.Windows.Forms.NumericUpDown();
|
||||
this.groupBoxGender = new System.Windows.Forms.GroupBox();
|
||||
this.radioButtonIngoreGender = new System.Windows.Forms.RadioButton();
|
||||
this.groupBoxAbility = new System.Windows.Forms.GroupBox();
|
||||
this.radioButtonIgnoreAbility = new System.Windows.Forms.RadioButton();
|
||||
this.labelGenderRatio = new System.Windows.Forms.Label();
|
||||
this.groupBoxHGSS = new System.Windows.Forms.GroupBox();
|
||||
this.buttonHelp = new System.Windows.Forms.Button();
|
||||
this.buttonHGSS = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pokeLevel)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trainerClassIdx)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trainerIdx)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownGender)).BeginInit();
|
||||
this.groupBoxGender.SuspendLayout();
|
||||
this.groupBoxAbility.SuspendLayout();
|
||||
this.groupBoxHGSS.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// poke_label
|
||||
//
|
||||
this.poke_label.AutoSize = true;
|
||||
this.poke_label.Location = new System.Drawing.Point(22, 78);
|
||||
this.poke_label.Name = "poke_label";
|
||||
this.poke_label.Size = new System.Drawing.Size(65, 16);
|
||||
this.poke_label.TabIndex = 3;
|
||||
this.poke_label.Text = "Pokémon";
|
||||
//
|
||||
// trainerClassIdx_label
|
||||
//
|
||||
this.trainerClassIdx_label.AutoSize = true;
|
||||
this.trainerClassIdx_label.Location = new System.Drawing.Point(172, 22);
|
||||
this.trainerClassIdx_label.Name = "trainerClassIdx_label";
|
||||
this.trainerClassIdx_label.Size = new System.Drawing.Size(122, 16);
|
||||
this.trainerClassIdx_label.TabIndex = 4;
|
||||
this.trainerClassIdx_label.Text = "Trainer Class Index";
|
||||
//
|
||||
// trainerIdx_label
|
||||
//
|
||||
this.trainerIdx_label.AutoSize = true;
|
||||
this.trainerIdx_label.Location = new System.Drawing.Point(28, 21);
|
||||
this.trainerIdx_label.Name = "trainerIdx_label";
|
||||
this.trainerIdx_label.Size = new System.Drawing.Size(85, 16);
|
||||
this.trainerIdx_label.TabIndex = 5;
|
||||
this.trainerIdx_label.Text = "Trainer Index";
|
||||
//
|
||||
// pokeLVL_label
|
||||
//
|
||||
this.pokeLVL_label.AutoSize = true;
|
||||
this.pokeLVL_label.Location = new System.Drawing.Point(315, 102);
|
||||
this.pokeLVL_label.Name = "pokeLVL_label";
|
||||
this.pokeLVL_label.Size = new System.Drawing.Size(33, 16);
|
||||
this.pokeLVL_label.TabIndex = 6;
|
||||
this.pokeLVL_label.Text = "LVL.";
|
||||
//
|
||||
// pokeLevel
|
||||
//
|
||||
this.pokeLevel.Location = new System.Drawing.Point(349, 100);
|
||||
this.pokeLevel.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.pokeLevel.Name = "pokeLevel";
|
||||
this.pokeLevel.Size = new System.Drawing.Size(46, 22);
|
||||
this.pokeLevel.TabIndex = 7;
|
||||
this.pokeLevel.Value = new decimal(new int[] {
|
||||
50,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// trainerClassIdx
|
||||
//
|
||||
this.trainerClassIdx.Location = new System.Drawing.Point(172, 45);
|
||||
this.trainerClassIdx.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.trainerClassIdx.Name = "trainerClassIdx";
|
||||
this.trainerClassIdx.Size = new System.Drawing.Size(125, 22);
|
||||
this.trainerClassIdx.TabIndex = 9;
|
||||
//
|
||||
// trainerIdx
|
||||
//
|
||||
this.trainerIdx.Location = new System.Drawing.Point(28, 44);
|
||||
this.trainerIdx.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.trainerIdx.Name = "trainerIdx";
|
||||
this.trainerIdx.Size = new System.Drawing.Size(125, 22);
|
||||
this.trainerIdx.TabIndex = 10;
|
||||
//
|
||||
// natureSelect
|
||||
//
|
||||
this.natureSelect.FormattingEnabled = true;
|
||||
this.natureSelect.Location = new System.Drawing.Point(433, 44);
|
||||
this.natureSelect.Name = "natureSelect";
|
||||
this.natureSelect.Size = new System.Drawing.Size(227, 24);
|
||||
this.natureSelect.TabIndex = 11;
|
||||
//
|
||||
// nature_label
|
||||
//
|
||||
this.nature_label.AutoSize = true;
|
||||
this.nature_label.Location = new System.Drawing.Point(433, 21);
|
||||
this.nature_label.Name = "nature_label";
|
||||
this.nature_label.Size = new System.Drawing.Size(47, 16);
|
||||
this.nature_label.TabIndex = 12;
|
||||
this.nature_label.Text = "Nature";
|
||||
//
|
||||
// DV_label
|
||||
//
|
||||
this.DV_label.AutoSize = true;
|
||||
this.DV_label.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.DV_label.Location = new System.Drawing.Point(316, 139);
|
||||
this.DV_label.Name = "DV_label";
|
||||
this.DV_label.Size = new System.Drawing.Size(162, 28);
|
||||
this.DV_label.TabIndex = 13;
|
||||
this.DV_label.Text = "Difficulty Value: 0";
|
||||
//
|
||||
// calcButton
|
||||
//
|
||||
this.calcButton.Font = new System.Drawing.Font("Segoe UI", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.calcButton.Location = new System.Drawing.Point(546, 292);
|
||||
this.calcButton.Name = "calcButton";
|
||||
this.calcButton.Size = new System.Drawing.Size(114, 51);
|
||||
this.calcButton.TabIndex = 14;
|
||||
this.calcButton.Text = "Calculate";
|
||||
this.calcButton.UseVisualStyleBackColor = true;
|
||||
this.calcButton.Click += new System.EventHandler(this.CalcButton_Click);
|
||||
//
|
||||
// maleCheck
|
||||
//
|
||||
this.maleCheck.AutoSize = true;
|
||||
this.maleCheck.Checked = true;
|
||||
this.maleCheck.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.maleCheck.Location = new System.Drawing.Point(303, 46);
|
||||
this.maleCheck.Name = "maleCheck";
|
||||
this.maleCheck.Size = new System.Drawing.Size(112, 20);
|
||||
this.maleCheck.TabIndex = 15;
|
||||
this.maleCheck.Text = "Trainer Male?";
|
||||
this.maleCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// maxDVNature_label
|
||||
//
|
||||
this.maxDVNature_label.AutoSize = true;
|
||||
this.maxDVNature_label.Font = new System.Drawing.Font("Segoe UI", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.maxDVNature_label.Location = new System.Drawing.Point(316, 170);
|
||||
this.maxDVNature_label.Name = "maxDVNature_label";
|
||||
this.maxDVNature_label.Size = new System.Drawing.Size(133, 25);
|
||||
this.maxDVNature_label.TabIndex = 16;
|
||||
this.maxDVNature_label.Text = "DV 255 Nature:";
|
||||
//
|
||||
// IV_label
|
||||
//
|
||||
this.IV_label.AutoSize = true;
|
||||
this.IV_label.Font = new System.Drawing.Font("Segoe UI", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.IV_label.Location = new System.Drawing.Point(315, 198);
|
||||
this.IV_label.Name = "IV_label";
|
||||
this.IV_label.Size = new System.Drawing.Size(116, 25);
|
||||
this.IV_label.TabIndex = 17;
|
||||
this.IV_label.Text = "Resulting IVs:";
|
||||
//
|
||||
// pokemonSelector
|
||||
//
|
||||
this.pokemonSelector.FormattingEnabled = true;
|
||||
this.pokemonSelector.Location = new System.Drawing.Point(22, 99);
|
||||
this.pokemonSelector.Name = "pokemonSelector";
|
||||
this.pokemonSelector.Size = new System.Drawing.Size(287, 24);
|
||||
this.pokemonSelector.TabIndex = 18;
|
||||
this.pokemonSelector.TextChanged += new System.EventHandler(this.PokemonSelector_TextChanged);
|
||||
//
|
||||
// showAllButton
|
||||
//
|
||||
this.showAllButton.Location = new System.Drawing.Point(566, 88);
|
||||
this.showAllButton.Name = "showAllButton";
|
||||
this.showAllButton.Size = new System.Drawing.Size(94, 29);
|
||||
this.showAllButton.TabIndex = 19;
|
||||
this.showAllButton.Text = "Show All";
|
||||
this.showAllButton.UseVisualStyleBackColor = true;
|
||||
this.showAllButton.Click += new System.EventHandler(this.ShowAllButton_Click);
|
||||
//
|
||||
// radioButtonMale
|
||||
//
|
||||
this.radioButtonMale.AutoSize = true;
|
||||
this.radioButtonMale.Location = new System.Drawing.Point(6, 47);
|
||||
this.radioButtonMale.Name = "radioButtonMale";
|
||||
this.radioButtonMale.Size = new System.Drawing.Size(96, 20);
|
||||
this.radioButtonMale.TabIndex = 20;
|
||||
this.radioButtonMale.TabStop = true;
|
||||
this.radioButtonMale.Text = "Force Male";
|
||||
this.radioButtonMale.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
this.radioButtonMale.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonFemale
|
||||
//
|
||||
this.radioButtonFemale.AutoSize = true;
|
||||
this.radioButtonFemale.Location = new System.Drawing.Point(6, 72);
|
||||
this.radioButtonFemale.Name = "radioButtonFemale";
|
||||
this.radioButtonFemale.Size = new System.Drawing.Size(112, 20);
|
||||
this.radioButtonFemale.TabIndex = 21;
|
||||
this.radioButtonFemale.TabStop = true;
|
||||
this.radioButtonFemale.Text = "Force Female";
|
||||
this.radioButtonFemale.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonAbility1
|
||||
//
|
||||
this.radioButtonAbility1.AutoSize = true;
|
||||
this.radioButtonAbility1.Location = new System.Drawing.Point(6, 47);
|
||||
this.radioButtonAbility1.Name = "radioButtonAbility1";
|
||||
this.radioButtonAbility1.Size = new System.Drawing.Size(112, 20);
|
||||
this.radioButtonAbility1.TabIndex = 22;
|
||||
this.radioButtonAbility1.TabStop = true;
|
||||
this.radioButtonAbility1.Text = "Force Ability 1";
|
||||
this.radioButtonAbility1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioButtonAbility2
|
||||
//
|
||||
this.radioButtonAbility2.AutoSize = true;
|
||||
this.radioButtonAbility2.Location = new System.Drawing.Point(6, 72);
|
||||
this.radioButtonAbility2.Name = "radioButtonAbility2";
|
||||
this.radioButtonAbility2.Size = new System.Drawing.Size(112, 20);
|
||||
this.radioButtonAbility2.TabIndex = 23;
|
||||
this.radioButtonAbility2.TabStop = true;
|
||||
this.radioButtonAbility2.Text = "Force Ability 2";
|
||||
this.radioButtonAbility2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownGender
|
||||
//
|
||||
this.numericUpDownGender.Enabled = false;
|
||||
this.numericUpDownGender.Location = new System.Drawing.Point(6, 170);
|
||||
this.numericUpDownGender.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownGender.Name = "numericUpDownGender";
|
||||
this.numericUpDownGender.Size = new System.Drawing.Size(120, 22);
|
||||
this.numericUpDownGender.TabIndex = 24;
|
||||
//
|
||||
// groupBoxGender
|
||||
//
|
||||
this.groupBoxGender.Controls.Add(this.radioButtonIngoreGender);
|
||||
this.groupBoxGender.Controls.Add(this.radioButtonMale);
|
||||
this.groupBoxGender.Controls.Add(this.radioButtonFemale);
|
||||
this.groupBoxGender.Location = new System.Drawing.Point(11, 22);
|
||||
this.groupBoxGender.Name = "groupBoxGender";
|
||||
this.groupBoxGender.Size = new System.Drawing.Size(132, 112);
|
||||
this.groupBoxGender.TabIndex = 25;
|
||||
this.groupBoxGender.TabStop = false;
|
||||
this.groupBoxGender.Text = "Pokémon Gender";
|
||||
//
|
||||
// radioButtonIngoreGender
|
||||
//
|
||||
this.radioButtonIngoreGender.AutoSize = true;
|
||||
this.radioButtonIngoreGender.Checked = true;
|
||||
this.radioButtonIngoreGender.Location = new System.Drawing.Point(6, 22);
|
||||
this.radioButtonIngoreGender.Name = "radioButtonIngoreGender";
|
||||
this.radioButtonIngoreGender.Size = new System.Drawing.Size(76, 20);
|
||||
this.radioButtonIngoreGender.TabIndex = 22;
|
||||
this.radioButtonIngoreGender.TabStop = true;
|
||||
this.radioButtonIngoreGender.Text = "No Flag";
|
||||
this.radioButtonIngoreGender.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
this.radioButtonIngoreGender.UseVisualStyleBackColor = true;
|
||||
this.radioButtonIngoreGender.CheckedChanged += new System.EventHandler(this.radioButtonNoFlag_CheckedChanged);
|
||||
//
|
||||
// groupBoxAbility
|
||||
//
|
||||
this.groupBoxAbility.Controls.Add(this.radioButtonIgnoreAbility);
|
||||
this.groupBoxAbility.Controls.Add(this.radioButtonAbility1);
|
||||
this.groupBoxAbility.Controls.Add(this.radioButtonAbility2);
|
||||
this.groupBoxAbility.Location = new System.Drawing.Point(143, 22);
|
||||
this.groupBoxAbility.Name = "groupBoxAbility";
|
||||
this.groupBoxAbility.Size = new System.Drawing.Size(138, 112);
|
||||
this.groupBoxAbility.TabIndex = 26;
|
||||
this.groupBoxAbility.TabStop = false;
|
||||
this.groupBoxAbility.Text = "Pokémon Ability";
|
||||
//
|
||||
// radioButtonIgnoreAbility
|
||||
//
|
||||
this.radioButtonIgnoreAbility.AutoSize = true;
|
||||
this.radioButtonIgnoreAbility.Checked = true;
|
||||
this.radioButtonIgnoreAbility.Location = new System.Drawing.Point(6, 22);
|
||||
this.radioButtonIgnoreAbility.Name = "radioButtonIgnoreAbility";
|
||||
this.radioButtonIgnoreAbility.Size = new System.Drawing.Size(76, 20);
|
||||
this.radioButtonIgnoreAbility.TabIndex = 24;
|
||||
this.radioButtonIgnoreAbility.TabStop = true;
|
||||
this.radioButtonIgnoreAbility.Text = "No Flag";
|
||||
this.radioButtonIgnoreAbility.UseVisualStyleBackColor = true;
|
||||
this.radioButtonIgnoreAbility.CheckedChanged += new System.EventHandler(this.radioButtonNoFlag_CheckedChanged);
|
||||
//
|
||||
// labelGenderRatio
|
||||
//
|
||||
this.labelGenderRatio.AutoSize = true;
|
||||
this.labelGenderRatio.Location = new System.Drawing.Point(6, 148);
|
||||
this.labelGenderRatio.Name = "labelGenderRatio";
|
||||
this.labelGenderRatio.Size = new System.Drawing.Size(148, 16);
|
||||
this.labelGenderRatio.TabIndex = 27;
|
||||
this.labelGenderRatio.Text = "Pokémon Gender Ratio";
|
||||
//
|
||||
// groupBoxHGSS
|
||||
//
|
||||
this.groupBoxHGSS.Controls.Add(this.buttonHGSS);
|
||||
this.groupBoxHGSS.Controls.Add(this.groupBoxGender);
|
||||
this.groupBoxHGSS.Controls.Add(this.labelGenderRatio);
|
||||
this.groupBoxHGSS.Controls.Add(this.numericUpDownGender);
|
||||
this.groupBoxHGSS.Controls.Add(this.groupBoxAbility);
|
||||
this.groupBoxHGSS.Location = new System.Drawing.Point(22, 139);
|
||||
this.groupBoxHGSS.Name = "groupBoxHGSS";
|
||||
this.groupBoxHGSS.Size = new System.Drawing.Size(287, 204);
|
||||
this.groupBoxHGSS.TabIndex = 28;
|
||||
this.groupBoxHGSS.TabStop = false;
|
||||
this.groupBoxHGSS.Text = "HGSS Only";
|
||||
//
|
||||
// buttonHelp
|
||||
//
|
||||
this.buttonHelp.Location = new System.Drawing.Point(591, 123);
|
||||
this.buttonHelp.Name = "buttonHelp";
|
||||
this.buttonHelp.Size = new System.Drawing.Size(69, 29);
|
||||
this.buttonHelp.TabIndex = 29;
|
||||
this.buttonHelp.Text = "Help";
|
||||
this.buttonHelp.UseVisualStyleBackColor = true;
|
||||
this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click);
|
||||
//
|
||||
// buttonHGSS
|
||||
//
|
||||
this.buttonHGSS.Location = new System.Drawing.Point(170, 163);
|
||||
this.buttonHGSS.Name = "buttonHGSS";
|
||||
this.buttonHGSS.Size = new System.Drawing.Size(102, 29);
|
||||
this.buttonHGSS.TabIndex = 28;
|
||||
this.buttonHGSS.Text = "HGSS Help";
|
||||
this.buttonHGSS.UseVisualStyleBackColor = true;
|
||||
this.buttonHGSS.Click += new System.EventHandler(this.buttonHGSS_Click);
|
||||
//
|
||||
// DVCalc
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(664, 347);
|
||||
this.Controls.Add(this.buttonHelp);
|
||||
this.Controls.Add(this.groupBoxHGSS);
|
||||
this.Controls.Add(this.showAllButton);
|
||||
this.Controls.Add(this.pokemonSelector);
|
||||
this.Controls.Add(this.IV_label);
|
||||
this.Controls.Add(this.maxDVNature_label);
|
||||
this.Controls.Add(this.maleCheck);
|
||||
this.Controls.Add(this.calcButton);
|
||||
this.Controls.Add(this.DV_label);
|
||||
this.Controls.Add(this.nature_label);
|
||||
this.Controls.Add(this.natureSelect);
|
||||
this.Controls.Add(this.trainerIdx);
|
||||
this.Controls.Add(this.trainerClassIdx);
|
||||
this.Controls.Add(this.pokeLevel);
|
||||
this.Controls.Add(this.pokeLVL_label);
|
||||
this.Controls.Add(this.trainerIdx_label);
|
||||
this.Controls.Add(this.trainerClassIdx_label);
|
||||
this.Controls.Add(this.poke_label);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "DVCalc";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "DVCalc";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pokeLevel)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trainerClassIdx)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trainerIdx)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownGender)).EndInit();
|
||||
this.groupBoxGender.ResumeLayout(false);
|
||||
this.groupBoxGender.PerformLayout();
|
||||
this.groupBoxAbility.ResumeLayout(false);
|
||||
this.groupBoxAbility.PerformLayout();
|
||||
this.groupBoxHGSS.ResumeLayout(false);
|
||||
this.groupBoxHGSS.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
SetupLists();
|
||||
SetupToolTips();
|
||||
UpdateNatures();
|
||||
Helpers.EnableHandlers();
|
||||
|
||||
}
|
||||
|
||||
private void PopulateComboBox()
|
||||
private void SetupLists()
|
||||
{
|
||||
// Populate Nature ComboBox (static readonly List)
|
||||
natureSelect.DataSource = DVCalculator.Natures;
|
||||
pokeLabels.Clear();
|
||||
abilityCombos.Clear();
|
||||
genderCombos.Clear();
|
||||
upDownsDV.Clear();
|
||||
labelsIV.Clear();
|
||||
natureLabels.Clear();
|
||||
changeButtons.Clear();
|
||||
showAllButtons.Clear();
|
||||
|
||||
// Fill the pokemon selector combo box with pokemon names from the ROM
|
||||
string[] pokeNames = RomInfo.GetPokemonNames();
|
||||
pokeLabels.AddRange(new Label[] { pokeLabel1, pokeLabel2, pokeLabel3, pokeLabel4, pokeLabel5, pokeLabel6});
|
||||
abilityCombos.AddRange(new ComboBox[] { comboAbility1, comboAbility2, comboAbility3, comboAbility4, comboAbility5, comboAbility6});
|
||||
genderCombos.AddRange(new ComboBox[] { comboGender1, comboGender2, comboGender3, comboGender4, comboGender5, comboGender6 });
|
||||
upDownsDV.AddRange(new NumericUpDown[] { numericUpDownDV1, numericUpDownDV2, numericUpDownDV3, numericUpDownDV4, numericUpDownDV5, numericUpDownDV6 });
|
||||
labelsIV.AddRange(new Label[] { labelIV1, labelIV2, labelIV3, labelIV4, labelIV5, labelIV6 });
|
||||
natureLabels.AddRange(new Label[] { labelNature1, labelNature2, labelNature3, labelNature4, labelNature5, labelNature6 });
|
||||
changeButtons.AddRange(new Button[] { buttonChange1, buttonChange2, buttonChange3, buttonChange4, buttonChange5, buttonChange6 });
|
||||
showAllButtons.AddRange(new Button[] { buttonShowAll1, buttonShowAll2, buttonShowAll3, buttonShowAll4, buttonShowAll5, buttonShowAll6 });
|
||||
|
||||
pokemonSelector.Items.Clear();
|
||||
|
||||
for (int id = 0; id < pokeNames.Length; id++)
|
||||
for (int i = 0; i < trainerProp.partyCount; i++)
|
||||
{
|
||||
pokemonSelector.Items.Add(new KeyValuePair<int, string>(id, pokeNames[id]));
|
||||
}
|
||||
// Enable only if mon exists
|
||||
abilityCombos[i].Enabled = (RomInfo.gameFamily == RomInfo.GameFamilies.HGSS || RomInfo.AIBackportEnabled);
|
||||
genderCombos[i].Enabled = (RomInfo.gameFamily == RomInfo.GameFamilies.HGSS || RomInfo.AIBackportEnabled);
|
||||
upDownsDV[i].Enabled = true;
|
||||
changeButtons[i].Enabled = true;
|
||||
showAllButtons[i].Enabled = true;
|
||||
abilityCombos[i].DataSource = new BindingSource(abilitySelection, string.Empty);
|
||||
genderCombos[i].DataSource = new BindingSource(genderSelection, string.Empty);
|
||||
|
||||
pokemonSelector.SelectedIndex = 0;
|
||||
// Pokemon names can be obtained from the ID
|
||||
int pokeID = trainerFile.party[i].pokeID ?? (int)trainerFile.party[i].pokeID;
|
||||
int pokeLevel = trainerFile.party[i].level;
|
||||
pokeLabels[i].Text = RomInfo.GetPokemonNames()[pokeID] + " Lv. " + pokeLevel;
|
||||
|
||||
}
|
||||
// Upper 4 bits = ability index (0 = no flag, 1 = ability 1, 2 = ability 2)
|
||||
abilityCombos[i].SelectedIndex = (((int)trainerFile.party[i].genderAndAbilityFlags & 0xF0) >> 4);
|
||||
|
||||
private void CalcButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Lower 4 bits = gender index (0 = no flag, 1 = force male, 2 = force female)
|
||||
genderCombos[i].SelectedIndex = ((int)trainerFile.party[i].genderAndAbilityFlags & 0x0F);
|
||||
|
||||
uint nature = (uint)natureSelect.SelectedIndex;
|
||||
// DV is stored as a single byte, so we can just cast it directly
|
||||
int DV = (int)trainerFile.party[i].difficulty;
|
||||
upDownsDV[i].Value = DV;
|
||||
|
||||
uint pokemonIndex = 1;
|
||||
|
||||
if (pokemonSelector.SelectedItem != null)
|
||||
{
|
||||
KeyValuePair<int, string> selectedPokemon = (KeyValuePair<int, string>)pokemonSelector.SelectedItem;
|
||||
|
||||
pokemonIndex = (uint)selectedPokemon.Key;
|
||||
}
|
||||
|
||||
int genderOverride = 0;
|
||||
int abilityOverride = 0;
|
||||
|
||||
if (radioButtonMale.Checked) { genderOverride = 1; }
|
||||
else if (radioButtonFemale.Checked) { genderOverride = 2; }
|
||||
|
||||
if (radioButtonAbility1.Checked) { abilityOverride = 1; }
|
||||
else if (radioButtonAbility2.Checked) { abilityOverride = 2; }
|
||||
|
||||
int DV = DVCalculator.findHighestDV(
|
||||
(uint)trainerIdx.Value, (uint)trainerClassIdx.Value, maleCheck.Checked, pokemonIndex,
|
||||
(byte)pokeLevel.Value, (byte)numericUpDownGender.Value, genderOverride, abilityOverride, nature);
|
||||
|
||||
uint maxDVNature = DVCalculator.getNatureFromPID(DVCalculator.generatePID(
|
||||
|
||||
(uint)trainerIdx.Value, (uint)trainerClassIdx.Value, maleCheck.Checked, pokemonIndex,
|
||||
(byte)pokeLevel.Value, (byte)numericUpDownGender.Value, genderOverride, abilityOverride, 255));
|
||||
|
||||
DV_label.Text = "Difficulty Value: " + DV;
|
||||
|
||||
|
||||
IV_label.Text = "Resulting IVs: " + (DV * 31 / 255);
|
||||
maxDVNature_label.Text = "DV 255 Nature: " + DVCalculator.Natures[(int)maxDVNature];
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ShowAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
uint pokemonIndex = 1;
|
||||
|
||||
if (pokemonSelector.SelectedItem != null)
|
||||
{
|
||||
KeyValuePair<int, string> selectedPokemon = (KeyValuePair<int, string>)pokemonSelector.SelectedItem;
|
||||
|
||||
pokemonIndex = (uint)selectedPokemon.Key;
|
||||
labelsIV[i].Text = ((int)(DV * 31 / 255)).ToString();
|
||||
|
||||
}
|
||||
for (int i = trainerProp.partyCount; i < 6; i++)
|
||||
{
|
||||
abilityCombos[i].Enabled = false;
|
||||
genderCombos[i].Enabled = false;
|
||||
upDownsDV[i].Enabled = false;
|
||||
changeButtons[i].Enabled = false;
|
||||
showAllButtons[i].Enabled = false;
|
||||
|
||||
int genderOverride = 0;
|
||||
int abilityOverride = 0;
|
||||
pokeLabels[i].Text = "Empty Slot";
|
||||
natureLabels[i].Text = "N/A";
|
||||
labelsIV[i].Text = "N/A";
|
||||
}
|
||||
|
||||
if (radioButtonMale.Checked) { genderOverride = 1; }
|
||||
else if (radioButtonFemale.Checked) { genderOverride = 2; }
|
||||
|
||||
if (radioButtonAbility1.Checked) { abilityOverride = 1; }
|
||||
else if (radioButtonAbility2.Checked) { abilityOverride = 2; }
|
||||
|
||||
// Create a list of DV-IV-Nature Triplets
|
||||
List<DVIVNatureTriplet> natureDict = DVCalculator.getAllNatures(
|
||||
(uint)trainerIdx.Value, (uint)trainerClassIdx.Value, maleCheck.Checked, pokemonIndex,
|
||||
(byte)pokeLevel.Value, (byte)numericUpDownGender.Value, genderOverride, abilityOverride);
|
||||
|
||||
// Create an instance of the view form and pass the data
|
||||
// There might be a better way to do this?
|
||||
DVCalcNatureViewerForm natureViewer = new DVCalcNatureViewerForm(natureDict);
|
||||
natureViewer.ShowDialog();
|
||||
listsSetup = true;
|
||||
}
|
||||
|
||||
private void PokemonSelector_TextChanged(object sender, EventArgs e)
|
||||
private void SetupToolTips()
|
||||
{
|
||||
if (sender == null || !(sender is ComboBox)) { return; }
|
||||
|
||||
ComboBox comboBox = (ComboBox)sender;
|
||||
string enteredText = comboBox.Text.ToLower();
|
||||
|
||||
// If name of pokemon is typed select that item
|
||||
foreach (KeyValuePair<int, string> item in comboBox.Items)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (item.Value.ToLower().Equals(enteredText))
|
||||
toolTipDVCalc.SetToolTip(pokeLabels[i], "Pokemon Name and Level");
|
||||
toolTipDVCalc.SetToolTip(abilityCombos[i], "This sets the ability flag of the Pokémon.\n" +
|
||||
"If there are no other gender or ability flags set, then \"No Flag\" will result in ability 1.");
|
||||
toolTipDVCalc.SetToolTip(genderCombos[i], "This sets the gender flag of the Pokémon. Gender flags can affect the ability.\n" +
|
||||
"Make sure to also choose an ability flag if you want to prevent this.");
|
||||
toolTipDVCalc.SetToolTip(upDownsDV[i], "This sets the Difficulty Value (DV) of the Pokémon.\n" +
|
||||
"The DV is used to calculate the IVs of the Pokémon.\n" +
|
||||
"The higher the DV, the higher the IVs. DVs can range from 0 to 255.");
|
||||
toolTipDVCalc.SetToolTip(changeButtons[i], "Click to open a list of possible nature / IV combinations for this Pokémon.\n" +
|
||||
"You can double click an entry to select it.\nOnly the highest possible DV for each nature will be shown.");
|
||||
toolTipDVCalc.SetToolTip(showAllButtons[i], "Click to open a list of all possible nature / IV combinations for this Pokémon.\n" +
|
||||
"You can double click an entry to select it.");
|
||||
}
|
||||
|
||||
toolTipDVCalc.SetToolTip(buttonSave, "Click to save the changes made to the Pokémon's DVs and Flags.\n" +
|
||||
"This will update the Trainer File with the new values.\n" +
|
||||
"Don't forget to also save in the main trainer editor!");
|
||||
|
||||
toolTipDVCalc.SetToolTip(buttonHelp, "Show some basic information about DVs");
|
||||
toolTipDVCalc.SetToolTip(buttonUsage, "Show some basic usage information about DVCalc");
|
||||
toolTipDVCalc.SetToolTip(buttonMoreInfo, "Open a link to a detailed explanation of how trainer Pokémon PID generation works");
|
||||
|
||||
string trainerGenderExplanation = "You can manually change the trainer gender here.\n" +
|
||||
"If you've repointed the trainer gender table the value read by DSPRE may be wrong.\n" +
|
||||
"This is only for the sake of the calculation. The trainer gender table will NOT be updated!";
|
||||
|
||||
toolTipDVCalc.SetToolTip(panelTrainerGender, trainerGenderExplanation);
|
||||
toolTipDVCalc.SetToolTip(labelTrainerGender, trainerGenderExplanation);
|
||||
toolTipDVCalc.SetToolTip(radioMale, trainerGenderExplanation);
|
||||
toolTipDVCalc.SetToolTip(radioFemale, trainerGenderExplanation);
|
||||
}
|
||||
|
||||
private void UpdateNatures()
|
||||
{
|
||||
if (!listsSetup)
|
||||
return;
|
||||
|
||||
DVCalculator.ResetGenderMod(radioMale.Checked);
|
||||
|
||||
for (int i = 0; i < trainerProp.partyCount; i++)
|
||||
{
|
||||
uint pokeID = trainerFile.party[i].pokeID ?? (uint)trainerFile.party[i].pokeID;
|
||||
byte pokeLevel = (byte) trainerFile.party[i].level;
|
||||
byte baseGenderRatio = new PokemonPersonalData((int) pokeID).genderVec;
|
||||
|
||||
uint PID = DVCalculator.generatePID(trainerProp.trainerID,trainerProp.trainerClass,
|
||||
pokeID, pokeLevel, baseGenderRatio, genderCombos[i].SelectedIndex, abilityCombos[i].SelectedIndex,(byte)upDownsDV[i].Value);
|
||||
string nature = DVCalculator.Natures[DVCalculator.getNatureFromPID(PID)];
|
||||
|
||||
natureLabels[i].Text = nature;
|
||||
labelsIV[i].Text = ((int)(upDownsDV[i].Value * 31 / 255)).ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void valueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Helpers.HandlersDisabled || !listsSetup)
|
||||
return;
|
||||
|
||||
UpdateNatures();
|
||||
}
|
||||
|
||||
private List<DVIVNatureTriplet> generateTriplets(int index)
|
||||
{
|
||||
DVCalculator.ResetGenderMod(radioMale.Checked);
|
||||
|
||||
if (RomInfo.gameFamily == GameFamilies.HGSS || RomInfo.AIBackportEnabled)
|
||||
{
|
||||
// Need to run this loop at least until we reach the current index
|
||||
for (int i = 0; i < index; i++)
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
return;
|
||||
byte genderRatio = new PokemonPersonalData((int)trainerFile.party[i].pokeID).genderVec;
|
||||
DVCalculator.UpdateGenderMod(genderRatio, genderCombos[i].SelectedIndex, abilityCombos[i].SelectedIndex);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
List<DVIVNatureTriplet> triplets = DVCalculator.getAllNatures(
|
||||
trainerProp.trainerID,
|
||||
trainerProp.trainerClass,
|
||||
(uint)trainerFile.party[index].pokeID,
|
||||
(byte)trainerFile.party[index].level,
|
||||
new PokemonPersonalData((int)trainerFile.party[index].pokeID).genderVec,
|
||||
genderCombos[index].SelectedIndex,
|
||||
abilityCombos[index].SelectedIndex);
|
||||
|
||||
return triplets;
|
||||
}
|
||||
|
||||
private void radioButtonNoFlag_CheckedChanged(object sender, EventArgs e)
|
||||
private void buttonShowAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (radioButtonIgnoreAbility.Checked && radioButtonIngoreGender.Checked)
|
||||
Button button = (Button) sender;
|
||||
int index = button.Name.Last() - '1'; // Get the index from the button name, maybe jank?
|
||||
|
||||
List<DVIVNatureTriplet> triplets = generateTriplets(index);
|
||||
|
||||
// Show the nature viewer form with the triplets
|
||||
DVCalcNatureViewerForm form = new DVCalcNatureViewerForm(triplets);
|
||||
form.ShowDialog();
|
||||
if (form.selectedDV != -1)
|
||||
upDownsDV[index].Value = form.selectedDV;
|
||||
|
||||
}
|
||||
private void buttonChange_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = (Button)sender;
|
||||
int index = button.Name.Last() - '1'; // Get the index from the button name, maybe jank?
|
||||
|
||||
List<DVIVNatureTriplet> triplets = generateTriplets(index);
|
||||
DVCalculator.filterHighestDV(ref triplets);
|
||||
|
||||
// Show the nature viewer form with the triplets
|
||||
DVCalcNatureViewerForm form = new DVCalcNatureViewerForm(triplets);
|
||||
form.ShowDialog();
|
||||
if (form.selectedDV != -1)
|
||||
upDownsDV[index].Value = form.selectedDV;
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < trainerProp.partyCount; i++)
|
||||
{
|
||||
numericUpDownGender.Enabled = false;
|
||||
return;
|
||||
trainerFile.party[i].genderAndAbilityFlags = (PartyPokemon.GenderAndAbilityFlags)(((abilityCombos[i].SelectedIndex & 0x0F) << 4)
|
||||
| (genderCombos[i].SelectedIndex & 0x0F));
|
||||
trainerFile.party[i].difficulty = (byte)upDownsDV[i].Value;
|
||||
|
||||
}
|
||||
|
||||
numericUpDownGender.Enabled = true;
|
||||
|
||||
}
|
||||
|
||||
private void buttonHelp_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("DV, or \"Difficulty Value\", is used by the game engine to calculate how tough an opponent Pokemon should be.\n" +
|
||||
"The DV affects a Pokemon's Nature and IVs - the higher the value, the stronger the Pokemon.\n" +
|
||||
MessageBox.Show("DV, or \"Difficulty Value\", is used by the game to calculate how tough an opponent Pokémon should be.\n" +
|
||||
"The DV primarily affects a Pokémon's IVs - the higher the value, the higher the Pokémon's IVs.\n" +
|
||||
"DVs will go from 0 (0 IVs) to 255 (31 IVs). Natures are chosen semi-randomly." +
|
||||
"\nIVs will be the same value for all Stats at any DV, so Hidden Power will only be Fighting or Dark Type." +
|
||||
"\nThis calculator allows you to choose a desired Nature and then find the highest possible DV that will yield that Nature." +
|
||||
"\nIf you want a specific combination of IVs and Nature instead, please click the \"Show All\" button and find the one you want."
|
||||
"\nIf you want a specific combination of IVs and Nature instead, please click the \"Show All\" button and find the one you want.\n\n" +
|
||||
"For more information click \"More Info\""
|
||||
, "Difficulty Value", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
}
|
||||
|
||||
private void buttonHGSS_Click(object sender, EventArgs e)
|
||||
private void buttonUsage_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("In Diamond, Pearl and Platinum Pokemon will always have the same gender as their trainer and will always have ability 1. " +
|
||||
"Heartgold and Soulsilver allow for the Pokemon's Gender and Ability to be set using special flags. " +
|
||||
"Setting those flags will also affect a Pokemon's Nature. " +
|
||||
"In order for this calculator to work it needs to know which flags have been set. " +
|
||||
"You can follow this guide:\n" +
|
||||
"- If the Pokemon whose nature you are trying to calculate has ability 2 then \"Force Ability 2\" must be selected.\n" +
|
||||
"- If the Pokemon whose nature you are trying to calculate has a non-default gender then \"Force Male\" / \"Force Female\" must be selected.\n" +
|
||||
"- If the Pokemon whose nature you are trying to calculate has a non-default gender and ability 1 then \"Force Ability 1\" must also be selected.\n" +
|
||||
"If you are changing a Pokemon's gender you must also provide the correct Gender Ratio which you can look up using DSPRE's \"Pokémon Editor\".", "How to use" ,MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show("Click the \"Change\" or \"Show All\" buttons to open a list of possible nature / IV combinations. " +
|
||||
"Double click an entry to select it. You can also try changing the ability and gender flags." +
|
||||
"Because of the way that the PIDs of trainer Pokémon are generated, only certain combinations of " +
|
||||
"gender, ability, IVs and nature are possible. This is a limitation of the game itself.\n" +
|
||||
"In general changes made to gender and ability flags of a Pokémon in any given party slot " +
|
||||
"will affect all the slots after it. You should therefore work from top to bottom.\n" +
|
||||
"Diamond, Pearl and Platinum do not allow for gender or ability flags to be set."
|
||||
, "DVCalc Usage", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void buttonMoreInfo_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Do you want to open a link to an external website?",
|
||||
"Confirm Open Website", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = "https://gist.github.com/YakosWG/2200732c473656db2e47c37ca72807d7",
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,4 +117,98 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="buttonSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
|
||||
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAacSURBVFhHxZd5bFRVGMX5Aw24VmtbI4lGoyHGYPSP
|
||||
mqgoEQg0SqELbVEiGiWAqIS1lha6sdTK0oWyiAYQTBVQBEqrgEaIghAKDaC1te1M91k7nZnXmS4z0+N3
|
||||
7rQDtTMmNia85Mx777v3/s5533uzjQJwS+V/8W+3ReVUmMOzK3B/VjnCMstx19py3LGmHGNHKK4lgywy
|
||||
yY7MKjsqXqP9lrINBKC5Jfu8A1VWH65YfDhv9MrQ/7ORRSbZ9Ihce7RMPP0hZJy7MKarsfkwOr8WYzfX
|
||||
YdTGGlitHdC1W1DfNjJxLRlkkUk2PeglnnfTeDBAJFt01epFWKEOY+IyMHarDna7DY0mCWEUmWz+vahB
|
||||
yRo4D1bjeaPJqhhkkUk2PeglnhE0vilABSpNHkSVNOKe2Zm4t6gRmtOBVqsDbZ1utDu60Wp3o8XmQnNH
|
||||
l0hDa6dLFKzGcw0tFjucDodikUk2PehFTxrfCCBtOdfWi3Hb9Xhw+UGEF+uhaU4Y7C6kzE7E6ynJ2Lm9
|
||||
BNu3FWNbUQEMjh4kJcZjR8m2ILViFBcWoM2myUU4FYtMsulBL3rSOBCA9+VMcy8e2dGAJz7VI6q4Hq6u
|
||||
LhXA1NUHs9ur9gatVxmxI0Y5NmpSc/prBqmZ5Jx1jrfbuhSDLDLJpsfAMzA8wOnGHjy+swFP7tZhXIkE
|
||||
cLlhFJDZ5YW1G7L3SQgvjF2eG3L6A3COxd0fmKNCye0hgywyyaZH0AAPSPFEQ4+aOOFznUrb090Nq6sP
|
||||
ydLWOclJ/nYXF6EkoEIUF2yVcP0yJyEwh/Wigi0waz3oFgZZZJJND3rRk8ZDAhyrd8tEPZ7Zo8dju3To
|
||||
6emFRdre0QPY+qD2NGM3/OqHRa6YV//POayZpQtkkEUm2fQIGeBwrRvP7tUjep8e43c3oK/Pgw65950C
|
||||
pgjvEGO7HDvkc2qwRkMes869rXcgoMujGGSRSTY9ggfIqUBptQvPfdGE5/c34ilpmcfjhV1giXEzA211
|
||||
eICkhHikJCXK01+kanapJcbPGrg9heodUbhlM2zdPsUgi0yy6UEvetI4ECBCivv/cOHFA8146csm1TKv
|
||||
V65s4OoGr8wmV8wQTukAjVljF1QH5DwwV2o2eSg9nn7FIpNsetCLnjQeEmDv7xomlbZgsiha0nKT24hO
|
||||
GlDSVpsocB6qNlB3yp4bWWSSTY+QAT67qmHqVy2Y/rVMlsSndG4F8PWPTNzIIItMsukRMsAuGYw52IrX
|
||||
DrXi1YMtmFLajJdl8cQDIxPXkkEWmWTTI2SA7VUaYg+3Ie7bNsSLZn3ThplyPuNw64jEtWSQRSbZ9AgZ
|
||||
oPiKhoQj7Zj9XTuSRDyOFUDMoTZMk/T/RVzDtWSQRSaP6RE0QKQUCyo1JB81YM4xv+KPGFBaaQC88lj3
|
||||
iTzymHvl8ad4zFooyRquJWOQRzY96EVPGg8JsPWShrnHDXizzKD2cZIYXg+u1ptwVdeB6hYNfxm7lapb
|
||||
nKpWVW8WmYaqTubLHj6PYtzMpEfIAJsuOTGv3Ii3RPNOGJEgbePVXtfZYJKPvozsPEybOhnTpryC9Mx1
|
||||
qnZd34lrMn5df0M8vybhuJYMshRTRI+QAT655MC735swX/ROhQnJ0jZCqpsd4Fs6ZnoMlqXlinKwcEka
|
||||
5INOjVU324erqVOtJYMsMsmmR8gAH1/UsPCkBYtOmrHgBzPeKDNKG72oadUgdxyxM2Kxam0eVq7ZgPeX
|
||||
r0WvvNc5VtPqHK4Wh6z1KQZZZJJNj5ABNl504IPTZqXFp8yqZej3oU7uOX8jx8XFIy07Hx9l5mPJqmzI
|
||||
o6bG6gyuoOJaMsga5NIjZIANMrj0J6vIgiU/WlTLhAKduVde5QsncTYy1m1Ges4mLF+dq0JxTGfqHi4J
|
||||
xrVkkEUm2fT4lwAaUs/akHqmAyt+tmLRKYsMQ350elSApOQUrFm/BWskxMqM9ZBHAM0y1tTRN1TWPjRb
|
||||
5UtENjLIIpNsegQNEJVV1pl/2Y11FzTk/uaUPxBOrDhrVxCTpnZISExEWmYeVmflITU9V9WMTshvweEy
|
||||
ibiRQRaZZNMjYuWBs+I55Gd5mCg6KvO4nemo8Oxy3J5ehmvXanHu8p/45XIN3p6/4L2lq1IXf7hs2eK5
|
||||
G/fsuFBVi18rZSyIzom4lgyyBrkRy/edE6+nRUP+mNwmekgULZosmhJEL4jGix4WPSqaIJooCjY3lCaJ
|
||||
aM6rH/LXjBtDsBO8N8F0n2iMiAs5905RuCjY3FCiMa982J/TW7SNGvU3iJOEw8UaLRYAAAAASUVORK5C
|
||||
YII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonMoreInfo.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAIdJREFUOE/t
|
||||
jMsNgDAMQzsS+3BhAoZgUyYpCnWkftw0gnLDkgW1nRc+0bId0WPMu3vUabDup2k96G0pUL6WMafQvC+A
|
||||
iExNBTJYc+sF1jB501saVtJNDkN1d/hNGgEtGJUFHMHkrUbkB1p90dEQkkyNqBC9paFTPzApD5+4C3zj
|
||||
BjjDwM1UCBeyBtPscqsr/QAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonHelp.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAAYxJREFUOE/NkztLA0EUhe/ERQwoSPwDqQQLC8FKrG0F/4CdKNoFLKwEKysLQdDa
|
||||
0sJC8YFudiYIYhobGwstxAdisLEK7F7PLjf7TJYkIPjBYYe5Zw7zuEvt4BoVWat5dqgC7ca0w5pWPUdN
|
||||
4KvEno+nC1Ns6AGhnCOPjTpwHasoy9rjOYVJmD9SizvLqCO+JkuWJ8HOBrCz29SiHxztDXoJZOgTc82E
|
||||
x6hliUiC+5mGwY2MdOpVVQnj8K4wtjytZvFtxHx1fAtiiWCbFkKTf0cOjUspA0K2Q6+hd76gQSlFIHAJ
|
||||
xWYgjaOe06iUMsCzFQtsIHBIShF8QhZCRgKd0TAfSiEFWqaMkOcwUFNNSr3BVSpj8V6wo1YYhM5YEUv3
|
||||
uNryH+I7HhTIqDu2VX4vpnFtq4RdfaXC/Ma+wu7GxNY9aJONRJghg6A5jLv79dLg3i5jYTdop2yL9AIC
|
||||
X2OB+zLdP3jdOkKfAtlUkel/BI56DN2LFmW6fxDyCLVeeV2m++cvAtegTdGMTHeA6BdzLXdUY5VUpwAA
|
||||
AABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="toolTipDVCalc.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>3, 3</value>
|
||||
</metadata>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAFBQAAAEAIAC4BgAAFgAAACgAAAAUAAAAKAAAAAEAIAAAAAAAQAYAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAJnM/wCZzP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACZzP8zzP//M8z//wCZzP8AAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmcz/M8z//zPM
|
||||
//8zzP//M8z//wCZzP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAJnM/zPM//8zzP//Zsz//2bM//8zzP//M8z//wCZzP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzzP//M8z//2bM//8AAAAAAAAAAGbM//8zzP//M8z//wAA
|
||||
AAAAAAAAAJnM/wCZzP8Amcz/AJnM/wCZzP8Amcz/AJnM/wAAAAAAAAAAAAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAADPM//8zzP//AAAAAAAAAAAzzP//M8z//zPM//8zzP//M8z//zPM//8zzP//AJnM/wCZ
|
||||
zP8AAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAM8z//zPM//8AAAAAAAAAADPM//8zzP//Zsz//2bM
|
||||
//9mzP//Zsz//zPM//8zzP//M8z//wAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAzzP//M8z//wAA
|
||||
AAAAAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAZsz//zPM//8zzP//AAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAADPM//8zzP//AAAAAAAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAAAAAAM8z//zPM
|
||||
//8AAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAM8z//zPM//8AAAAAAAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAzzP//M8z//wAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAzzP//M8z//wAA
|
||||
AAAAAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAAAAAADPM//8zzP//AAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAADPM//8zzP//AAAAAAAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAAAAAAM8z//zPM
|
||||
//8AAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAM8z//zPM//8AAAAAAAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAzzP//M8z//wAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAzzP//M8z//wAA
|
||||
AAAAAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAAJnM/zPM//8zzP//AAAAAGbM//9mzP//AAAAAAAA
|
||||
AAAAAAAAAAAAAGbM//9mzP//AAAAAAAAAAAzzP//M8z//wCZzP8Amcz/AJnM/wCZzP8zzP//M8z//zPM
|
||||
//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADPM//8zzP//M8z//zPM
|
||||
//8zzP//M8z//zPM//9mzP//Zsz//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAZsz//2bM//9mzP//Zsz//2bM//9mzP//Zsz//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///wAP/88AD/+HAA//AwAP/g
|
||||
EAD/4xAAgOeQAIAnkACAJ5AAnieQAJ8nkACfJ5AAnyeQAJ8nkACfJ5AAnieQAIA/8ACAP/AAgP/wAP//
|
||||
8AA=
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Drawing;
|
||||
using DSPRE.Properties;
|
||||
using System.Drawing;
|
||||
using System.Resources;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DSPRE
|
||||
|
|
@ -31,7 +33,9 @@ namespace DSPRE
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.natureGridView = new System.Windows.Forms.DataGridView();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DVCalcNatureViewerForm));
|
||||
((System.ComponentModel.ISupportInitialize)(this.natureGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
|
@ -52,9 +56,11 @@ namespace DSPRE
|
|||
this.natureGridView.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.natureGridView.Size = new System.Drawing.Size(387, 333);
|
||||
this.natureGridView.TabIndex = 0;
|
||||
this.natureGridView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.natureGridView_CellDoubleClick);
|
||||
this.natureGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.natureGridView_ColumnHeaderMouseClick);
|
||||
//
|
||||
// DVCalcNatureViewerForm
|
||||
//
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
|
|
@ -65,14 +71,16 @@ namespace DSPRE
|
|||
this.MaximizeBox = false;
|
||||
this.Name = "DVCalcNatureViewerForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Full List";
|
||||
this.Text = "Nature List";
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
((System.ComponentModel.ISupportInitialize)(this.natureGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView natureGridView;
|
||||
private System.Windows.Forms.DataGridView natureGridView;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,9 @@ namespace DSPRE
|
|||
{
|
||||
|
||||
private List<DVIVNatureTriplet> data;
|
||||
private int sortedColumnIndex = 0;
|
||||
private bool sortAscending = true;
|
||||
public int selectedDV = -1;
|
||||
|
||||
public DVCalcNatureViewerForm(List<DVIVNatureTriplet> data)
|
||||
{
|
||||
|
|
@ -26,15 +29,47 @@ namespace DSPRE
|
|||
natureGridView.DataSource = bindingList;
|
||||
|
||||
// Set the columns
|
||||
natureGridView.Columns[0].HeaderText = "IV";
|
||||
natureGridView.Columns[0].DataPropertyName = "IV";
|
||||
natureGridView.Columns[1].HeaderText = "Nature";
|
||||
natureGridView.Columns[1].DataPropertyName = "Nature";
|
||||
natureGridView.Columns[2].HeaderText = "DV";
|
||||
natureGridView.Columns[2].DataPropertyName = "DV";
|
||||
natureGridView.Columns[0].HeaderText = "DV";
|
||||
natureGridView.Columns[0].DataPropertyName = "DV";
|
||||
natureGridView.Columns[1].HeaderText = "IV";
|
||||
natureGridView.Columns[1].DataPropertyName = "IV";
|
||||
natureGridView.Columns[2].HeaderText = "Nature";
|
||||
natureGridView.Columns[2].DataPropertyName = "Nature";
|
||||
|
||||
// Adjust column widths
|
||||
natureGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
}
|
||||
|
||||
private void natureGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
|
||||
{
|
||||
// Get the selected triplet
|
||||
var selectedTriplet = data[e.RowIndex];
|
||||
selectedDV = selectedTriplet.DV;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void natureGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||
{
|
||||
if (sortedColumnIndex == e.ColumnIndex)
|
||||
{
|
||||
// If the column is already sorted, toggle the direction
|
||||
sortAscending = !sortAscending;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If a different column is clicked, sort ascending by default
|
||||
// "Ascending" since the order is actually inverted for DV and IV
|
||||
sortAscending = true;
|
||||
}
|
||||
|
||||
DVCalculator.SortTriplets(ref data, natureGridView.Columns[e.ColumnIndex].DataPropertyName, sortAscending);
|
||||
sortedColumnIndex = e.ColumnIndex;
|
||||
|
||||
var bindingList = new BindingList<DVIVNatureTriplet>(data.ToList());
|
||||
natureGridView.DataSource = bindingList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,4 +117,39 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAFBQAAAEAIAC4BgAAFgAAACgAAAAUAAAAKAAAAAEAIAAAAAAAQAYAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAJnM/wCZzP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACZzP8zzP//M8z//wCZzP8AAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmcz/M8z//zPM
|
||||
//8zzP//M8z//wCZzP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAJnM/zPM//8zzP//Zsz//2bM//8zzP//M8z//wCZzP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzzP//M8z//2bM//8AAAAAAAAAAGbM//8zzP//M8z//wAA
|
||||
AAAAAAAAAJnM/wCZzP8Amcz/AJnM/wCZzP8Amcz/AJnM/wAAAAAAAAAAAAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAADPM//8zzP//AAAAAAAAAAAzzP//M8z//zPM//8zzP//M8z//zPM//8zzP//AJnM/wCZ
|
||||
zP8AAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAM8z//zPM//8AAAAAAAAAADPM//8zzP//Zsz//2bM
|
||||
//9mzP//Zsz//zPM//8zzP//M8z//wAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAzzP//M8z//wAA
|
||||
AAAAAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAZsz//zPM//8zzP//AAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAADPM//8zzP//AAAAAAAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAAAAAAM8z//zPM
|
||||
//8AAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAM8z//zPM//8AAAAAAAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAzzP//M8z//wAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAzzP//M8z//wAA
|
||||
AAAAAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAAAAAADPM//8zzP//AAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAADPM//8zzP//AAAAAAAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAAAAAAM8z//zPM
|
||||
//8AAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAM8z//zPM//8AAAAAAAAAADPM//8zzP//AAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAzzP//M8z//wAAAAAzzP//M8z//wAAAAAAAAAAAAAAAAAAAAAzzP//M8z//wAA
|
||||
AAAAAAAAM8z//zPM//8AAAAAAAAAAAAAAAAAAAAAAJnM/zPM//8zzP//AAAAAGbM//9mzP//AAAAAAAA
|
||||
AAAAAAAAAAAAAGbM//9mzP//AAAAAAAAAAAzzP//M8z//wCZzP8Amcz/AJnM/wCZzP8zzP//M8z//zPM
|
||||
//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADPM//8zzP//M8z//zPM
|
||||
//8zzP//M8z//zPM//9mzP//Zsz//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAZsz//2bM//9mzP//Zsz//2bM//9mzP//Zsz//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///wAP/88AD/+HAA//AwAP/g
|
||||
EAD/4xAAgOeQAIAnkACAJ5AAnieQAJ8nkACfJ5AAnyeQAJ8nkACfJ5AAnieQAIA/8ACAP/AAgP/wAP//
|
||||
8AA=
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using static DSPRE.RomInfo;
|
||||
|
||||
namespace DSPRE
|
||||
{
|
||||
|
|
@ -17,11 +18,13 @@ namespace DSPRE
|
|||
this.IV = IV;
|
||||
this.Nature = Nature;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal static class DVCalculator
|
||||
public static class DVCalculator
|
||||
{
|
||||
private static uint state;
|
||||
private static uint genderMod;
|
||||
public static void setSeed(uint seed)
|
||||
{
|
||||
|
||||
|
|
@ -40,21 +43,44 @@ namespace DSPRE
|
|||
return state >> 16;
|
||||
}
|
||||
|
||||
public static int findHighestDV(uint trainerIdx, uint trainerClassIdx, bool trainerClassMale, uint pokeIdx, byte pokeLevel, byte baseGenderRatio, int genderOverride, int abilityOverride, uint nature)
|
||||
{
|
||||
byte DV;
|
||||
|
||||
for (DV = 255; DV > 0; DV--)
|
||||
{
|
||||
if (getNatureFromPID(generatePID(trainerIdx, trainerClassIdx, trainerClassMale, pokeIdx, pokeLevel, baseGenderRatio, genderOverride, abilityOverride, DV)) == nature)
|
||||
{ return DV; }
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
public static void ResetGenderMod(bool maleOrMulti)
|
||||
{
|
||||
genderMod = maleOrMulti ? 136u : 120u;
|
||||
}
|
||||
|
||||
public static uint generatePID(uint trainerIdx, uint trainerClassIdx, bool trainerClassMale, uint pokeIdx, byte pokeLevel, byte baseGenderRatio, int genderOverride, int abilityOverride, byte difficultyValue)
|
||||
public static void filterHighestDV(ref List<DVIVNatureTriplet> natures)
|
||||
{
|
||||
var result = new Dictionary<string, DVIVNatureTriplet>();
|
||||
foreach (var triplet in natures)
|
||||
{
|
||||
if (!result.ContainsKey(triplet.Nature) || triplet.DV > result[triplet.Nature].DV)
|
||||
{
|
||||
result[triplet.Nature] = triplet;
|
||||
}
|
||||
}
|
||||
natures = new List<DVIVNatureTriplet>(result.Values);
|
||||
}
|
||||
|
||||
public static void SortTriplets(ref List<DVIVNatureTriplet> triplets, string sortBy, bool ascending = true)
|
||||
{
|
||||
if (sortBy == "Nature")
|
||||
{
|
||||
if (ascending)
|
||||
triplets.Sort((a, b) => string.Compare(a.Nature, b.Nature));
|
||||
else
|
||||
triplets.Sort((a, b) => string.Compare(b.Nature, a.Nature));
|
||||
}
|
||||
else if (sortBy == "DV" || sortBy == "IV")
|
||||
{
|
||||
// Ascending isn't really a sensible option here
|
||||
if (!ascending)
|
||||
triplets.Sort((a, b) => a.DV.CompareTo(b.DV));
|
||||
else
|
||||
triplets.Sort((a, b) => b.DV.CompareTo(a.DV));
|
||||
}
|
||||
}
|
||||
|
||||
public static uint generatePID(uint trainerIdx, uint trainerClassIdx, uint pokeIdx, byte pokeLevel, byte baseGenderRatio, int genderOverride, int abilityOverride, byte difficultyValue)
|
||||
{
|
||||
uint newSeed = (uint)(trainerIdx + pokeIdx + pokeLevel + difficultyValue);
|
||||
|
||||
|
|
@ -67,16 +93,22 @@ namespace DSPRE
|
|||
trainerClassIdx--;
|
||||
random = getNextRandom();
|
||||
}
|
||||
if (RomInfo.gameFamily == GameFamilies.HGSS || RomInfo.AIBackportEnabled)
|
||||
UpdateGenderMod(baseGenderRatio, genderOverride, abilityOverride);
|
||||
|
||||
uint genderMod = 0;
|
||||
uint PID = (random << 8) + genderMod;
|
||||
|
||||
// this is always the case in platinum
|
||||
if (genderOverride == 0)
|
||||
{
|
||||
genderMod = trainerClassMale ? 136u : 120u;
|
||||
}
|
||||
return (uint)PID;
|
||||
}
|
||||
|
||||
// Code from here in is HGSS exclusive
|
||||
public static int getNatureFromPID(uint PID)
|
||||
{
|
||||
return (int) (PID % 100) % 25;
|
||||
}
|
||||
|
||||
public static void UpdateGenderMod(byte baseGenderRatio, int genderOverride, int abilityOverride)
|
||||
{
|
||||
// Code from here on is HGSS exclusive
|
||||
if (genderOverride == 1)
|
||||
{
|
||||
genderMod = baseGenderRatio + 2u;
|
||||
|
|
@ -98,29 +130,23 @@ namespace DSPRE
|
|||
{
|
||||
genderMod = (uint)(genderMod | 1);
|
||||
}
|
||||
|
||||
uint PID = (random << 8) + genderMod;
|
||||
|
||||
return (uint)PID;
|
||||
}
|
||||
|
||||
public static uint getNatureFromPID(uint PID)
|
||||
{
|
||||
return (PID % 100) % 25;
|
||||
}
|
||||
|
||||
public static List<DVIVNatureTriplet> getAllNatures(uint trainerIdx, uint trainerClassIdx, bool trainerClassMale, uint pokeIdx, byte pokeLevel, byte baseGenderRatio, int genderOverride, int abilityOverride)
|
||||
public static List<DVIVNatureTriplet> getAllNatures(uint trainerIdx, uint trainerClassIdx, uint pokeIdx, byte pokeLevel, byte baseGenderRatio, int genderOverride, int abilityOverride)
|
||||
{
|
||||
List<DVIVNatureTriplet> natureDict = new List<DVIVNatureTriplet>();
|
||||
|
||||
byte DV;
|
||||
uint natureIdx;
|
||||
int DV;
|
||||
int natureIdx;
|
||||
uint genderModLocal = genderMod;
|
||||
|
||||
for (DV = 255; DV > 0; DV--)
|
||||
for (DV = 255; DV >= 0; DV--)
|
||||
{
|
||||
natureIdx = getNatureFromPID(generatePID(trainerIdx, trainerClassIdx, trainerClassMale, pokeIdx, pokeLevel, baseGenderRatio, genderOverride, abilityOverride, DV));
|
||||
natureIdx = getNatureFromPID(generatePID(trainerIdx, trainerClassIdx, pokeIdx, pokeLevel, baseGenderRatio, genderOverride, abilityOverride, (byte) DV));
|
||||
|
||||
natureDict.Add(new DVIVNatureTriplet(DV, DV * 31 / 255, Natures[(int)natureIdx]));
|
||||
genderMod = genderModLocal;
|
||||
|
||||
natureDict.Add(new DVIVNatureTriplet(DV, DV * 31 / 255, Natures[natureIdx]));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -156,115 +182,115 @@ namespace DSPRE
|
|||
"Quirky: Neutral"
|
||||
};
|
||||
|
||||
public static class TrainerClassGender
|
||||
public static class TrainerClassGender
|
||||
{
|
||||
|
||||
// true represents male, false represents female
|
||||
private static List<bool> trainerClassGenders = new List<bool>();
|
||||
|
||||
private static bool tableLoaded = false;
|
||||
|
||||
public static bool GetTrainerClassGender(int trainerClassID)
|
||||
{
|
||||
|
||||
// true represents male, false represents female
|
||||
private static List<bool> trainerClassGenders = new List<bool>();
|
||||
|
||||
private static bool tableLoaded = false;
|
||||
|
||||
public static bool GetTrainerClassGender(int trainerClassID)
|
||||
if (!tableLoaded)
|
||||
{
|
||||
if (!tableLoaded)
|
||||
{
|
||||
ReadTrainerClassGenderTable();
|
||||
}
|
||||
return trainerClassGenders[trainerClassID];
|
||||
ReadTrainerClassGenderTable();
|
||||
}
|
||||
return trainerClassGenders[trainerClassID];
|
||||
}
|
||||
|
||||
public static void ReadTrainerClassGenderTable()
|
||||
public static void ReadTrainerClassGenderTable()
|
||||
{
|
||||
uint offset = GetTableOffset();
|
||||
uint length = GetTableLength();
|
||||
if (offset == 0 || length == 0)
|
||||
{
|
||||
uint offset = GetTableOffset();
|
||||
uint length = GetTableLength();
|
||||
if (offset == 0 || length == 0)
|
||||
{
|
||||
MessageBox.Show("Couldn't load trainer class gender table from arm9." +
|
||||
"\nTrainers will default to male when calculating natures.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
tableLoaded = true;
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] table = ARM9.ReadBytes(offset, length);
|
||||
|
||||
for (int i = 0; i < table.Length; i++)
|
||||
{
|
||||
trainerClassGenders.Add(table[i] == 1 ? false : true);
|
||||
}
|
||||
MessageBox.Show("Couldn't load trainer class gender table from arm9." +
|
||||
"\nTrainers will default to male when calculating natures.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
tableLoaded = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private static uint GetTableLength()
|
||||
byte[] table = ARM9.ReadBytes(offset, length);
|
||||
|
||||
for (int i = 0; i < table.Length; i++)
|
||||
{
|
||||
switch (RomInfo.gameFamily)
|
||||
{
|
||||
case RomInfo.GameFamilies.Plat:
|
||||
return 105; // Platinum has 105 trainer classes
|
||||
case RomInfo.GameFamilies.HGSS:
|
||||
return 128;
|
||||
case RomInfo.GameFamilies.DP:
|
||||
return 0;
|
||||
default:
|
||||
// Unknown game family
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static uint GetTableOffset()
|
||||
{
|
||||
switch (RomInfo.gameFamily)
|
||||
{
|
||||
case RomInfo.GameFamilies.Plat:
|
||||
switch(RomInfo.gameLanguage)
|
||||
{
|
||||
case RomInfo.GameLanguages.English:
|
||||
return 0xF0714;
|
||||
case RomInfo.GameLanguages.Japanese:
|
||||
return 0xEFDA4;
|
||||
case RomInfo.GameLanguages.Spanish:
|
||||
return 0xF078A;
|
||||
case RomInfo.GameLanguages.German:
|
||||
return 0xF076C;
|
||||
case RomInfo.GameLanguages.French:
|
||||
return 0xF079C;
|
||||
case RomInfo.GameLanguages.Italian:
|
||||
return 0xF0730;
|
||||
default:
|
||||
// Unknown game language
|
||||
return 0;
|
||||
}
|
||||
case RomInfo.GameFamilies.HGSS:
|
||||
switch (RomInfo.gameLanguage)
|
||||
{
|
||||
case RomInfo.GameLanguages.English:
|
||||
return 0xFFB90;
|
||||
case RomInfo.GameLanguages.Japanese:
|
||||
return 0xFF310;
|
||||
case RomInfo.GameLanguages.Spanish:
|
||||
return 0xFFB90;
|
||||
case RomInfo.GameLanguages.German:
|
||||
return 0xFFB44;
|
||||
case RomInfo.GameLanguages.French:
|
||||
return 0xFFB74;
|
||||
case RomInfo.GameLanguages.Italian:
|
||||
return 0xFFB08;
|
||||
default:
|
||||
// Unknown game language
|
||||
return 0;
|
||||
}
|
||||
case RomInfo.GameFamilies.DP:
|
||||
// Dummy offset for DP
|
||||
return 0;
|
||||
default:
|
||||
// Unknown game family
|
||||
return 0;
|
||||
}
|
||||
trainerClassGenders.Add(table[i] == 1 ? false : true);
|
||||
}
|
||||
tableLoaded = true;
|
||||
|
||||
}
|
||||
|
||||
private static uint GetTableLength()
|
||||
{
|
||||
switch (RomInfo.gameFamily)
|
||||
{
|
||||
case RomInfo.GameFamilies.Plat:
|
||||
return 105; // Platinum has 105 trainer classes
|
||||
case RomInfo.GameFamilies.HGSS:
|
||||
return 128;
|
||||
case RomInfo.GameFamilies.DP:
|
||||
return 0;
|
||||
default:
|
||||
// Unknown game family
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static uint GetTableOffset()
|
||||
{
|
||||
switch (RomInfo.gameFamily)
|
||||
{
|
||||
case RomInfo.GameFamilies.Plat:
|
||||
switch(RomInfo.gameLanguage)
|
||||
{
|
||||
case RomInfo.GameLanguages.English:
|
||||
return 0xF0714;
|
||||
case RomInfo.GameLanguages.Japanese:
|
||||
return 0xEFDA4;
|
||||
case RomInfo.GameLanguages.Spanish:
|
||||
return 0xF078A;
|
||||
case RomInfo.GameLanguages.German:
|
||||
return 0xF076C;
|
||||
case RomInfo.GameLanguages.French:
|
||||
return 0xF079C;
|
||||
case RomInfo.GameLanguages.Italian:
|
||||
return 0xF0730;
|
||||
default:
|
||||
// Unknown game language
|
||||
return 0;
|
||||
}
|
||||
case RomInfo.GameFamilies.HGSS:
|
||||
switch (RomInfo.gameLanguage)
|
||||
{
|
||||
case RomInfo.GameLanguages.English:
|
||||
return 0xFFB90;
|
||||
case RomInfo.GameLanguages.Japanese:
|
||||
return 0xFF310;
|
||||
case RomInfo.GameLanguages.Spanish:
|
||||
return 0xFFB90;
|
||||
case RomInfo.GameLanguages.German:
|
||||
return 0xFFB44;
|
||||
case RomInfo.GameLanguages.French:
|
||||
return 0xFFB74;
|
||||
case RomInfo.GameLanguages.Italian:
|
||||
return 0xFFB08;
|
||||
default:
|
||||
// Unknown game language
|
||||
return 0;
|
||||
}
|
||||
case RomInfo.GameFamilies.DP:
|
||||
// Dummy offset for DP
|
||||
return 0;
|
||||
default:
|
||||
// Unknown game family
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -419,6 +419,7 @@ namespace DSPRE
|
|||
bool trainerMale = false;
|
||||
|
||||
trainerMale = DVCalculator.TrainerClassGender.GetTrainerClassGender(trainerClassID);
|
||||
DVCalculator.ResetGenderMod(trainerMale);
|
||||
|
||||
// Get Pokemon Genders and Abilities from flags
|
||||
for (int j = 0; j < partyPokemon.Length; j++)
|
||||
|
|
@ -447,7 +448,7 @@ namespace DSPRE
|
|||
genderOverride = 2;
|
||||
break;
|
||||
}
|
||||
int abilityFlag = (int)monFlags[j] & 0xF0; // Get the upper 4 bits
|
||||
int abilityFlag = ((int)monFlags[j] & 0xF0) >> 4; // Get the upper 4 bits
|
||||
switch (abilityFlag)
|
||||
{
|
||||
case 0: // Unset
|
||||
|
|
@ -472,9 +473,8 @@ namespace DSPRE
|
|||
abilityOverride = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
uint PID = DVCalculator.generatePID((uint)trainerID, (uint)trainerClassID, trainerMale, (uint)partyPokemon[j].pokeID, (byte)partyPokemon[j].level, baseGenderRatio, genderOverride, abilityOverride, partyPokemon[j].difficulty);
|
||||
natures[j] = DVCalculator.Natures[(int)DVCalculator.getNatureFromPID(PID)].Split(':')[0];
|
||||
uint PID = DVCalculator.generatePID((uint)trainerID, (uint)trainerClassID, (uint)partyPokemon[j].pokeID, (byte)partyPokemon[j].level, baseGenderRatio, genderOverride, abilityOverride, partyPokemon[j].difficulty);
|
||||
natures[j] = DVCalculator.Natures[DVCalculator.getNatureFromPID(PID)].Split(':')[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
DS_Map/Main Window.Designer.cs
generated
4
DS_Map/Main Window.Designer.cs
generated
|
|
@ -7800,9 +7800,9 @@
|
|||
//
|
||||
this.DVExplainButton.Image = ((System.Drawing.Image)(resources.GetObject("DVExplainButton.Image")));
|
||||
this.DVExplainButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.DVExplainButton.Location = new System.Drawing.Point(242, 11);
|
||||
this.DVExplainButton.Location = new System.Drawing.Point(220, 11);
|
||||
this.DVExplainButton.Name = "DVExplainButton";
|
||||
this.DVExplainButton.Size = new System.Drawing.Size(118, 29);
|
||||
this.DVExplainButton.Size = new System.Drawing.Size(140, 29);
|
||||
this.DVExplainButton.TabIndex = 45;
|
||||
this.DVExplainButton.Text = "Open DV Calculator";
|
||||
this.DVExplainButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ namespace DSPRE {
|
|||
|
||||
#region Variables
|
||||
public bool iconON = false;
|
||||
public bool wslDetected = false; // Not technically necessary rn, but it might be useful in the future
|
||||
|
||||
/* Editors Setup */
|
||||
public bool matrixEditorIsReady { get; private set; } = false;
|
||||
|
|
@ -545,6 +546,45 @@ namespace DSPRE {
|
|||
return;
|
||||
}
|
||||
|
||||
// Validate path and check for OneDrive
|
||||
if (!ValidateFilePath(openRom.FileName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!detectAndHandleWSL(openRom.FileName)) {
|
||||
return; // User chose not to create a new work directory
|
||||
}
|
||||
|
||||
// Handle WSL
|
||||
if (wslDetected)
|
||||
{
|
||||
string executablePath = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
string buildFolderPath = Path.Combine(executablePath, "build");
|
||||
// Create a new work directory in the same folder as DSPRE
|
||||
if (!Directory.Exists(buildFolderPath)) {
|
||||
Directory.CreateDirectory(buildFolderPath);
|
||||
}
|
||||
|
||||
// Copy the ROM to the build folder
|
||||
string newRomPath = Path.Combine(buildFolderPath, Path.GetFileName(openRom.FileName));
|
||||
|
||||
// Check if file already exists and ask to overwrite
|
||||
if (File.Exists(newRomPath)) {
|
||||
DialogResult overwriteResult = MessageBox.Show("The ROM file already exists in the build folder. Do you want to overwrite it?", "File Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (overwriteResult != DialogResult.Yes) {
|
||||
return; // User chose not to overwrite
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
File.Copy(openRom.FileName, newRomPath, true);
|
||||
openRom.FileName = newRomPath; // Update the file name to the new path
|
||||
} catch (IOException ex) {
|
||||
MessageBox.Show("Failed to copy ROM to build folder: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SetupROMLanguage(openRom.FileName);
|
||||
/* Set ROM gameVersion and language */
|
||||
romInfo = new RomInfo(gameCode, openRom.FileName, useSuffix: true);
|
||||
|
|
@ -608,6 +648,61 @@ namespace DSPRE {
|
|||
ReadROMInitData();
|
||||
}
|
||||
|
||||
private bool ValidateFilePath(string fileName) {
|
||||
// Empty file name check
|
||||
if (string.IsNullOrWhiteSpace(fileName)) {
|
||||
MessageBox.Show("File path is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
string fullPath = Path.GetFullPath(fileName);
|
||||
|
||||
// File / directory existence check
|
||||
if (!File.Exists(fileName) && !Directory.Exists(fileName)) {
|
||||
MessageBox.Show("The specified file at path "+ fullPath +" does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
// One drive check
|
||||
if (fullPath.ToLower().Contains("onedrive")) {
|
||||
MessageBox.Show("OneDrive was detected in the path. DSPRE is not compatible with OneDrive. " +
|
||||
"Please move the ROM and unpacked folder to the same local drive DSPRE is stored on.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool detectAndHandleWSL(string fileName) {
|
||||
string fullPath = Path.GetFullPath(fileName);
|
||||
|
||||
if (!fullPath.ToLower().Contains("wsl."))
|
||||
{
|
||||
return true; // No WSL detected, proceed normally
|
||||
}
|
||||
if (Directory.Exists(fullPath))
|
||||
{
|
||||
MessageBox.Show("WSL was detected in the path. " +
|
||||
"The associated unpacked folder of a ROM should not be stored on the WSL file system! " +
|
||||
"Please move the folder to the same drive that DSPRE is located on.", "Invalid Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
DialogResult result = MessageBox.Show("WSL was detected in the path. " +
|
||||
"Do you want to create a build directory in the same folder as DSPRE to unpack to?", "WSL Detected", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
wslDetected = true;
|
||||
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
return true; // User wants to create a new work directory
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Unpacking will not be possible without a valid work directory.", "Unpacking aborted", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void CheckROMLanguage() {
|
||||
versionLabel.Visible = true;
|
||||
languageLabel.Visible = true;
|
||||
|
|
@ -633,14 +728,26 @@ namespace DSPRE {
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
SetupROMLanguage(Directory.GetFiles(romFolder.FileName).First(x => x.Contains("header.bin")));
|
||||
// Validate path and check for OneDrive
|
||||
if (!ValidateFilePath(romFolder.FileName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!detectAndHandleWSL(romFolder.FileName)) {
|
||||
return; // User chose not to create a new work directory
|
||||
}
|
||||
|
||||
string fileName = romFolder.FileName;
|
||||
|
||||
try
|
||||
{
|
||||
SetupROMLanguage(Directory.GetFiles(fileName).First(x => x.Contains("header.bin")));
|
||||
} catch (InvalidOperationException) {
|
||||
MessageBox.Show("This folder does not seem to contain any data from a NDS Pokémon ROM.", "No ROM Data", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
/* Set ROM gameVersion and language */
|
||||
romInfo = new RomInfo(gameCode, romFolder.FileName, useSuffix: false);
|
||||
romInfo = new RomInfo(gameCode, fileName, useSuffix: false);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(RomInfo.romID) || string.IsNullOrWhiteSpace(RomInfo.fileName)) {
|
||||
return;
|
||||
|
|
@ -7859,8 +7966,9 @@ namespace DSPRE {
|
|||
private const int TRAINER_PARTY_POKEMON_GENDER_DEFAULT_INDEX = 0;
|
||||
private const int TRAINER_PARTY_POKEMON_GENDER_MALE_INDEX = 1;
|
||||
private const int TRAINER_PARTY_POKEMON_GENDER_FEMALE_INDEX = 2;
|
||||
private const int TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX = 0;
|
||||
private const int TRAINER_PARTY_POKEMON_ABILITY_SLOT2_INDEX = 1;
|
||||
private const int TRAINER_PARTY_POKEMON_ABILITY_DEFAULT_INDEX = 0;
|
||||
private const int TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX = 1;
|
||||
private const int TRAINER_PARTY_POKEMON_ABILITY_SLOT2_INDEX = 2;
|
||||
|
||||
|
||||
string[] abilityNames;
|
||||
|
|
@ -8176,11 +8284,20 @@ namespace DSPRE {
|
|||
setTrainerPartyPokemonForm(i);
|
||||
setTrainerPokemonGender(i);
|
||||
|
||||
partyAbilityComboBoxList[i].SelectedIndex = currentTrainerFile.party[i].genderAndAbilityFlags.HasFlag(PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT2)
|
||||
? TRAINER_PARTY_POKEMON_ABILITY_SLOT2_INDEX
|
||||
: TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX;
|
||||
if (currentTrainerFile.party[i].genderAndAbilityFlags.HasFlag(PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT1))
|
||||
{
|
||||
partyAbilityComboBoxList[i].SelectedIndex = TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX;
|
||||
}
|
||||
else if (currentTrainerFile.party[i].genderAndAbilityFlags.HasFlag(PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT2))
|
||||
{
|
||||
partyAbilityComboBoxList[i].SelectedIndex = TRAINER_PARTY_POKEMON_ABILITY_SLOT2_INDEX;
|
||||
}
|
||||
else
|
||||
{
|
||||
partyAbilityComboBoxList[i].SelectedIndex = TRAINER_PARTY_POKEMON_ABILITY_DEFAULT_INDEX;
|
||||
}
|
||||
|
||||
partyFormComboBoxList[i].SelectedIndex = currentTrainerFile.party[i].formID;
|
||||
partyFormComboBoxList[i].SelectedIndex = currentTrainerFile.party[i].formID;
|
||||
|
||||
if (currentTrainerFile.party[i].moves == null) {
|
||||
for (int j = 0; j < Party.MOVES_PER_POKE; j++) {
|
||||
|
|
@ -8287,12 +8404,16 @@ namespace DSPRE {
|
|||
showTrainerEditorItemPic(5);
|
||||
}
|
||||
|
||||
private void DVExplainButton_Click(object sender, EventArgs e) {
|
||||
uint trainerIdx = (uint)trainerComboBox.SelectedIndex;
|
||||
uint trainerClassIdx = (uint)trainerClassListBox.SelectedIndex;
|
||||
private void DVExplainButton_Click(object sender, EventArgs e) {
|
||||
|
||||
DVCalc DVCalcForm = new DVCalc(currentTrainerFile);
|
||||
DVCalcForm.ShowDialog();
|
||||
|
||||
currentTrainerFile = DVCalcForm.trainerFile;
|
||||
Helpers.DisableHandlers();
|
||||
RefreshTrainerPartyGUI();
|
||||
Helpers.EnableHandlers();
|
||||
|
||||
DVCalc DVcalcForm = new DVCalc(trainerIdx, trainerClassIdx);
|
||||
DVcalcForm.ShowDialog();
|
||||
}
|
||||
|
||||
private void partyCountUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
|
|
@ -8368,8 +8489,6 @@ namespace DSPRE {
|
|||
currentTrainerFile.party[i].moves = trainerMovesCheckBox.Checked ? new ushort[4] : null;
|
||||
}
|
||||
|
||||
// Need to account for the case where ability 2 was set on a previous mon. If so then ability one flag needs to be set on other mons with ability 1
|
||||
bool wasAbility2Set = false;
|
||||
|
||||
for (int i = 0; i < partyCountUpDown.Value; i++) {
|
||||
currentTrainerFile.party[i].pokeID = (ushort)partyPokemonComboboxList[i].SelectedIndex;
|
||||
|
|
@ -8404,21 +8523,13 @@ namespace DSPRE {
|
|||
} else
|
||||
currentTrainerFile.party[i].genderAndAbilityFlags = PartyPokemon.GenderAndAbilityFlags.NO_FLAGS;
|
||||
|
||||
|
||||
|
||||
if (partyAbilityComboBoxList[i].SelectedIndex == TRAINER_PARTY_POKEMON_ABILITY_SLOT2_INDEX) {
|
||||
if (partyAbilityComboBoxList[i].SelectedIndex == TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX)
|
||||
{
|
||||
currentTrainerFile.party[i].genderAndAbilityFlags |= PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT1;
|
||||
}
|
||||
else if (partyAbilityComboBoxList[i].SelectedIndex == TRAINER_PARTY_POKEMON_ABILITY_SLOT2_INDEX)
|
||||
{
|
||||
currentTrainerFile.party[i].genderAndAbilityFlags |= PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT2;
|
||||
wasAbility2Set = true;
|
||||
}
|
||||
// If ability 2 was set previously force ability 1 must be set here other wise the pokemon will have ability 2
|
||||
else if (wasAbility2Set && partyAbilityComboBoxList[i].SelectedIndex == TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX) {
|
||||
currentTrainerFile.party[i].genderAndAbilityFlags |= PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT1;
|
||||
}
|
||||
//ability slot 1 flag must be set if the pokemon's gender is forced to male or female, otherwise the pokemon will have ability2 even if the ability2 flag is not set
|
||||
//the ability 1 flag should not be set if neither of the gender flags are set, otherwise this will cause a problem with using alternate forms
|
||||
else if (currentTrainerFile.party[i].genderAndAbilityFlags.HasFlag(PartyPokemon.GenderAndAbilityFlags.FORCE_MALE)
|
||||
|| currentTrainerFile.party[i].genderAndAbilityFlags.HasFlag(PartyPokemon.GenderAndAbilityFlags.FORCE_FEMALE)) {
|
||||
currentTrainerFile.party[i].genderAndAbilityFlags |= PartyPokemon.GenderAndAbilityFlags.ABILITY_SLOT1;
|
||||
}
|
||||
|
||||
currentTrainerFile.party[i].ballSeals = (ushort)partyBallUpdownList[i].Value;
|
||||
|
|
@ -8714,23 +8825,34 @@ namespace DSPRE {
|
|||
|
||||
private void setTrainerPartyPokemonAbilities(int partyPokemonPosition) {
|
||||
(string ability1, string ability2) = getPokemonAbilityNames(partyPokemonComboboxList[partyPokemonPosition].SelectedIndex);
|
||||
string noFlags = "No Flag";
|
||||
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Clear();
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Add(ability1);
|
||||
|
||||
//if the name " -" is returned for ability 2 then there is no ability 2
|
||||
if (ability2.Equals(" -") || (gameFamily != GameFamilies.HGSS && !RomInfo.AIBackportEnabled)) {
|
||||
|
||||
// In DPPt just show ability 1 and do not allow editing
|
||||
if (RomInfo.gameFamily != GameFamilies.HGSS && !RomInfo.AIBackportEnabled)
|
||||
{
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Add(ability1);
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Enabled = false;
|
||||
} else {
|
||||
string stringAbi2 = ability2;
|
||||
if (ability2.Equals(ability1)) {
|
||||
stringAbi2 += " (2nd Slot)";
|
||||
}
|
||||
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Add(stringAbi2);
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// In HGSS allow editing of ability flags
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Add(noFlags);
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Add(ability1);
|
||||
|
||||
partyAbilityComboBoxList[partyPokemonPosition].SelectedIndex = TRAINER_PARTY_POKEMON_ABILITY_SLOT1_INDEX;
|
||||
string stringAbi2 = ability2;
|
||||
if (ability2.Equals(ability1))
|
||||
{
|
||||
stringAbi2 += " (2nd Slot)";
|
||||
}
|
||||
else if (ability2.Equals(" -"))
|
||||
{
|
||||
stringAbi2 = ability1 += " (2nd Slot)";
|
||||
}
|
||||
partyAbilityComboBoxList[partyPokemonPosition].Items.Add(stringAbi2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setTrainerPokemonGender(int partyPokemonPosition) {
|
||||
|
|
|
|||
|
|
@ -808,15 +808,11 @@
|
|||
</data>
|
||||
<data name="DVExplainButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAAX5JREFUOE/Fkr0rRWEcx7/PcZJblK5/4E7KYFAmma3KP2ATsSmDSZlMBqWYjQYD
|
||||
ucS9z0tKLBaLgUFeEllMt87z1TnXy3N/nS5nkE99p9/3+ZyX5wfkQIcSjRqnxjw11oKs0mDWazVAAyXP
|
||||
5eJNNESLSzqwTTyt2kx0XJLnW/A6GqTDY44gP1Zt8xix9GR4E3XQ4lQceqPBPQ1us1g80aEhpNPSlUGN
|
||||
YTok30Xs+boq033/KzrE3qhROrwEvXM6RK22tFzDRPBkT41+2fmEFiuB8IEH6JSdVDhFi0YWgzdW0Ss7
|
||||
n9BiORC+8ABdsgPuImYVPVn20c0t2WjitarQ4uZLaOBk51ewjgoN1rM3Ci7F62hGdn8kMXF6Ea+hqPm5
|
||||
6ow11X4XJUktLtPiWcjSxT7yOuqT/R/xRi22vhWs19FYuE6FoMFhIDuhzlmRItDgLhBuyHlhWMc5Da6z
|
||||
1DAv5/8PHXbocPGRSTkvDB2ugltekPPC/IVwjg5LHxmRc8k7cy13VAsXPGAAAAAASUVORK5CYII=
|
||||
</value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAKVJREFUOE+1
|
||||
kosNhSAQBOnJnuzJnugJWcLFxWMTPjrJJb5lb+JTwy+keCY1tTJHikdeVrMgtuV45UsaFtfqGGqJpfit
|
||||
7tblSghaYb/nclUEfKZ6LldFwGeq53JVBHymei5XRcBnqudyXcTb2xDa63/G8mWhH/vIuVeWCJfbUm9q
|
||||
pTAsHMUW8ThqlLP2OU+BO2Ypy97/ZphWuikzWLotMyD6TKYJ4QYHbKuW1u/htgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="replacePropertiesButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
|
|
|||
BIN
DS_Map/Resources/Graphics/Program Icons/DV_Icon.ico
Normal file
BIN
DS_Map/Resources/Graphics/Program Icons/DV_Icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
DS_Map/Resources/Graphics/Program Icons/DV_Icon.png
Normal file
BIN
DS_Map/Resources/Graphics/Program Icons/DV_Icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 247 B |
BIN
DS_Map/Resources/Graphics/Program Icons/OpenLink.png
Normal file
BIN
DS_Map/Resources/Graphics/Program Icons/OpenLink.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 231 B |
Loading…
Reference in New Issue
Block a user