Merge branch 'main' into dev-kuha

This commit is contained in:
Corentin MACÉ (Kuha)
2025-08-04 22:19:07 +02:00
committed by GitHub
45 changed files with 6542 additions and 5504 deletions

View File

@@ -51,6 +51,9 @@
<setting name="neverAskForOpening" serializeAs="String">
<value>False</value>
</setting>
<setting name="databasesPulled" serializeAs="String">
<value>False</value>
</setting>
</DSPRE.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -166,6 +166,7 @@
<Compile Include="Editors\HeadbuttEncounterEditorTab.Designer.cs">
<DependentUpon>HeadbuttEncounterEditorTab.cs</DependentUpon>
</Compile>
<Compile Include="Editors\Utils\IndexedBitmapHandler.cs" />
<Compile Include="Editors\ItemEditor.cs">
<SubType>Form</SubType>
</Compile>
@@ -199,7 +200,12 @@
<Compile Include="Editors\NsbtxEditor.Designer.cs">
<DependentUpon>NsbtxEditor.cs</DependentUpon>
</Compile>
<Compile Include="Editors\PokemonSpriteEditor.cs" />
<Compile Include="Editors\PokemonSpriteEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Editors\PokemonSpriteEditor.Designer.cs">
<DependentUpon>PokemonSpriteEditor.cs</DependentUpon>
</Compile>
<Compile Include="Editors\SafariZoneEditor.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -242,12 +248,20 @@
<Compile Include="Editors\TextEditor.Designer.cs">
<DependentUpon>TextEditor.cs</DependentUpon>
</Compile>
<Compile Include="Editors\TradeEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Editors\TradeEditor.Designer.cs">
<DependentUpon>TradeEditor.cs</DependentUpon>
</Compile>
<Compile Include="Editors\TrainerEditor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Editors\TrainerEditor.Designer.cs">
<DependentUpon>TrainerEditor.cs</DependentUpon>
</Compile>
<Compile Include="Editors\Utils\NarcReader.cs" />
<Compile Include="Editors\Utils\SpriteSet.cs" />
<Compile Include="EventFileImport.cs">
<SubType>Form</SubType>
</Compile>
@@ -358,6 +372,7 @@
<Compile Include="ROMFiles\LevelScriptTrigger.cs" />
<Compile Include="ROMFiles\MapScreenLoadTrigger.cs" />
<Compile Include="ROMFiles\ScriptAction.cs" />
<Compile Include="ROMFiles\TradeData.cs" />
<Compile Include="Script\ScriptCommandPosition.cs" />
<Compile Include="Script\ScriptLabeledSection.cs" />
<Compile Include="Script\ScriptParameter.cs" />
@@ -400,7 +415,7 @@
<Compile Include="Editors\SpawnEditor.Designer.cs">
<DependentUpon>SpawnEditor.cs</DependentUpon>
</Compile>
<Compile Include="UniqueList.cs" />
<Compile Include="Editors\Utils\UniqueList.cs" />
<Compile Include="Editors\WildEditorHGSS.cs">
<SubType>Form</SubType>
</Compile>
@@ -524,6 +539,9 @@
<EmbeddedResource Include="Editors\NsbtxEditor.resx">
<DependentUpon>NsbtxEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\PokemonSpriteEditor.resx">
<DependentUpon>PokemonSpriteEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\SafariZoneEditor.resx">
<DependentUpon>SafariZoneEditor.cs</DependentUpon>
</EmbeddedResource>
@@ -542,6 +560,9 @@
<EmbeddedResource Include="Editors\TextEditor.resx">
<DependentUpon>TextEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\TradeEditor.resx">
<DependentUpon>TradeEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\TrainerEditor.resx">
<DependentUpon>TrainerEditor.cs</DependentUpon>
</EmbeddedResource>
@@ -879,6 +900,12 @@
<PackageReference Include="Velopack">
<Version>0.0.1298</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>9.0.7</Version>
</PackageReference>
<PackageReference Include="LibGit2Sharp">
<Version>0.31.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -415,7 +415,6 @@ namespace DSPRE
PartyPokemon.GenderAndAbilityFlags[] monFlags, ref string[] abilityNames,
ref string[] monGenders, ref string[] abilities, ref string[] natures)
{
bool wasFlagSet = false;
bool trainerMale = false;
trainerMale = DVCalculator.TrainerClassGender.GetTrainerClassGender(trainerClassID);
@@ -426,55 +425,34 @@ namespace DSPRE
{
byte baseGenderRatio = new PokemonPersonalData((int)partyPokemon[j].pokeID).genderVec;
byte genderOverride = 0;
byte abilityOverride = 0;
byte genderOverride = (byte)((byte) monFlags[j] & 0x0F); // Get the lower 4 bits
byte abilityOverride = (byte)((byte)monFlags[j] >> 4); // Get the upper 4 bits
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];
int genderFlag = (int)monFlags[j] & 0x0F; // Get the lower 4 bits
switch (genderFlag)
switch (genderOverride)
{
case 0: // Random
monGenders[j] = "random";
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).firstAbility];
genderOverride = 0;
break;
case 1: // Male
monGenders[j] = "M";
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).secondAbility];
genderOverride = 1;
break;
case 2: // Female
monGenders[j] = "F";
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).secondAbility];
genderOverride = 2;
break;
}
int abilityFlag = ((int)monFlags[j] & 0xF0) >> 4; // Get the upper 4 bits
switch (abilityFlag)
switch (PID % 2) // Lowest bit of PID determines the ability
{
case 0: // Unset
// If a gender or ability flag was previously set, we need to use the second ability
if (wasFlagSet)
{
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).secondAbility];
abilityOverride = 0;
}
else
{
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).firstAbility];
abilityOverride = 0;
}
break;
case 1: // Ability 1
case 0:
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).firstAbility];
abilityOverride = 1;
break;
case 2: // Ability 2
case 1:
abilities[j] = abilityNames[new PokemonPersonalData((int)partyPokemon[j].pokeID).secondAbility];
abilityOverride = 2;
break;
}
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];
}
}
}

View File

@@ -1,16 +1,19 @@
using System.Windows.Forms;
using MKDS_Course_Editor.Export3DTools;
using System.Windows.Forms;
namespace DSPRE.Editors
{
public partial class EncountersEditor : UserControl
{
public bool encounterEditorIsReady { get; set; } = false;
public EncountersEditor()
{
InitializeComponent();
}
public void SetupEncountersEditor() {
tabPageHeadbuttEditor_Enter(null, null);
encounterEditorIsReady = true;
tabPageHeadbuttEditor_Enter(null, null);
}
private void tabPageHeadbuttEditor_Enter(object sender, System.EventArgs e)

View File

@@ -16,7 +16,7 @@ namespace DSPRE {
private int currentLoadedId = 0;
private EvolutionFile currentLoadedFile = null;
private static bool dirty = false;
public bool dirty = false;
private static readonly string formName = "Evolutions Editor";
private (ComboBox m, Label l, NumericUpDown p, ComboBox t)[] evoRows;
@@ -181,6 +181,7 @@ namespace DSPRE {
dirty = false;
this.Text = formName;
}
_parent.UpdateTabPageNames();
}
private void evoMethodComboBox1_SelectedIndexChanged(object sender, EventArgs e) {

View File

@@ -32,7 +32,6 @@
this.itemNumberNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.holdEffectComboBox = new System.Windows.Forms.ComboBox();
this.fieldPocketComboBox = new System.Windows.Forms.ComboBox();
this.battlePocketComboBox = new System.Windows.Forms.ComboBox();
this.itemNameInputComboBox = new System.Windows.Forms.ComboBox();
this.priceNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
@@ -44,6 +43,7 @@
this.holdEffectLabel = new System.Windows.Forms.Label();
this.pocketFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.pocketGroupBox = new System.Windows.Forms.GroupBox();
this.pokeBallsBattlePocketCheck = new System.Windows.Forms.CheckBox();
this.fieldPocketLabel = new System.Windows.Forms.Label();
this.battlePocketLabel = new System.Windows.Forms.Label();
this.moveRelatedFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
@@ -130,15 +130,19 @@
this.friendshipMidCheckBox = new System.Windows.Forms.CheckBox();
this.friendshipLowValueNumeric = new System.Windows.Forms.NumericUpDown();
this.friendshipLowCheckBox = new System.Windows.Forms.CheckBox();
this.itemEditorSelectedPictureBox = new System.Windows.Forms.PictureBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.itemEditorSelectedPictureFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.itemEditorSelectedPictureGroupBox = new System.Windows.Forms.GroupBox();
this.imageLabel = new System.Windows.Forms.Label();
this.paletteLabel = new System.Windows.Forms.Label();
this.imageComboBox = new System.Windows.Forms.ComboBox();
this.paletteComboBox = new System.Windows.Forms.ComboBox();
this.saveIconButton = new System.Windows.Forms.Button();
this.paletteComboBox = new System.Windows.Forms.ComboBox();
this.imageComboBox = new System.Windows.Forms.ComboBox();
this.paletteLabel = new System.Windows.Forms.Label();
this.imageLabel = new System.Windows.Forms.Label();
this.itemEditorSelectedPictureBox = new System.Windows.Forms.PictureBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.battleItemsBattlePocketCheck = new System.Windows.Forms.CheckBox();
this.ppRestoreBattlePocketCheck = new System.Windows.Forms.CheckBox();
this.hpRestoreBattlePocketCheck = new System.Windows.Forms.CheckBox();
this.statusHealersBattlePocketCheck = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.itemNumberNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.priceNumericUpDown)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
@@ -184,9 +188,9 @@
((System.ComponentModel.ISupportInitialize)(this.friendshipHighValueNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.friendshipMidValueNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.friendshipLowValueNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemEditorSelectedPictureBox)).BeginInit();
this.itemEditorSelectedPictureFlowLayoutPanel.SuspendLayout();
this.itemEditorSelectedPictureGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.itemEditorSelectedPictureBox)).BeginInit();
this.SuspendLayout();
//
// itemNumberNumericUpDown
@@ -212,22 +216,12 @@
//
this.fieldPocketComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.fieldPocketComboBox.FormattingEnabled = true;
this.fieldPocketComboBox.Location = new System.Drawing.Point(107, 35);
this.fieldPocketComboBox.Location = new System.Drawing.Point(94, 22);
this.fieldPocketComboBox.Name = "fieldPocketComboBox";
this.fieldPocketComboBox.Size = new System.Drawing.Size(121, 21);
this.fieldPocketComboBox.TabIndex = 2;
this.fieldPocketComboBox.SelectedIndexChanged += new System.EventHandler(this.fieldPocketComboBox_SelectedIndexChanged);
//
// battlePocketComboBox
//
this.battlePocketComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.battlePocketComboBox.FormattingEnabled = true;
this.battlePocketComboBox.Location = new System.Drawing.Point(107, 78);
this.battlePocketComboBox.Name = "battlePocketComboBox";
this.battlePocketComboBox.Size = new System.Drawing.Size(121, 21);
this.battlePocketComboBox.TabIndex = 3;
this.battlePocketComboBox.SelectedIndexChanged += new System.EventHandler(this.battlePocketComboBox_SelectedIndexChanged);
//
// itemNameInputComboBox
//
this.itemNameInputComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -349,7 +343,11 @@
//
// pocketGroupBox
//
this.pocketGroupBox.Controls.Add(this.battlePocketComboBox);
this.pocketGroupBox.Controls.Add(this.statusHealersBattlePocketCheck);
this.pocketGroupBox.Controls.Add(this.hpRestoreBattlePocketCheck);
this.pocketGroupBox.Controls.Add(this.ppRestoreBattlePocketCheck);
this.pocketGroupBox.Controls.Add(this.battleItemsBattlePocketCheck);
this.pocketGroupBox.Controls.Add(this.pokeBallsBattlePocketCheck);
this.pocketGroupBox.Controls.Add(this.fieldPocketLabel);
this.pocketGroupBox.Controls.Add(this.fieldPocketComboBox);
this.pocketGroupBox.Controls.Add(this.battlePocketLabel);
@@ -360,11 +358,22 @@
this.pocketGroupBox.TabStop = false;
this.pocketGroupBox.Text = "Pocket Data";
//
// pokeBallsBattlePocketCheck
//
this.pokeBallsBattlePocketCheck.AutoSize = true;
this.pokeBallsBattlePocketCheck.Location = new System.Drawing.Point(9, 82);
this.pokeBallsBattlePocketCheck.Name = "pokeBallsBattlePocketCheck";
this.pokeBallsBattlePocketCheck.Size = new System.Drawing.Size(73, 17);
this.pokeBallsBattlePocketCheck.TabIndex = 9;
this.pokeBallsBattlePocketCheck.Text = "PokeBalls";
this.pokeBallsBattlePocketCheck.UseVisualStyleBackColor = true;
this.pokeBallsBattlePocketCheck.CheckedChanged += new System.EventHandler(this.BattlePocketCheckBox_CheckedChanged);
//
// fieldPocketLabel
//
this.fieldPocketLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.fieldPocketLabel.AutoSize = true;
this.fieldPocketLabel.Location = new System.Drawing.Point(21, 38);
this.fieldPocketLabel.Location = new System.Drawing.Point(6, 25);
this.fieldPocketLabel.Name = "fieldPocketLabel";
this.fieldPocketLabel.Size = new System.Drawing.Size(66, 13);
this.fieldPocketLabel.TabIndex = 7;
@@ -375,11 +384,11 @@
//
this.battlePocketLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.battlePocketLabel.AutoSize = true;
this.battlePocketLabel.Location = new System.Drawing.Point(16, 81);
this.battlePocketLabel.Location = new System.Drawing.Point(6, 63);
this.battlePocketLabel.Name = "battlePocketLabel";
this.battlePocketLabel.Size = new System.Drawing.Size(71, 13);
this.battlePocketLabel.Size = new System.Drawing.Size(76, 13);
this.battlePocketLabel.TabIndex = 8;
this.battlePocketLabel.Text = "Battle Pocket";
this.battlePocketLabel.Text = "Battle Pockets";
this.battlePocketLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// moveRelatedFlowLayoutPanel
@@ -1233,16 +1242,6 @@
this.friendshipLowCheckBox.Text = "Low Friendship";
this.friendshipLowCheckBox.UseVisualStyleBackColor = true;
//
// itemEditorSelectedPictureBox
//
this.itemEditorSelectedPictureBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.itemEditorSelectedPictureBox.Image = global::DSPRE.Properties.Resources.IconItem;
this.itemEditorSelectedPictureBox.Location = new System.Drawing.Point(180, 54);
this.itemEditorSelectedPictureBox.Name = "itemEditorSelectedPictureBox";
this.itemEditorSelectedPictureBox.Size = new System.Drawing.Size(47, 47);
this.itemEditorSelectedPictureBox.TabIndex = 18;
this.itemEditorSelectedPictureBox.TabStop = false;
//
// itemEditorSelectedPictureFlowLayoutPanel
//
this.itemEditorSelectedPictureFlowLayoutPanel.Controls.Add(this.itemEditorSelectedPictureGroupBox);
@@ -1266,33 +1265,15 @@
this.itemEditorSelectedPictureGroupBox.TabStop = false;
this.itemEditorSelectedPictureGroupBox.Text = "Icon";
//
// imageLabel
// saveIconButton
//
this.imageLabel.AutoSize = true;
this.imageLabel.Location = new System.Drawing.Point(11, 21);
this.imageLabel.Name = "imageLabel";
this.imageLabel.Size = new System.Drawing.Size(36, 13);
this.imageLabel.TabIndex = 20;
this.imageLabel.Text = "Image";
//
// paletteLabel
//
this.paletteLabel.AutoSize = true;
this.paletteLabel.Location = new System.Drawing.Point(11, 63);
this.paletteLabel.Name = "paletteLabel";
this.paletteLabel.Size = new System.Drawing.Size(40, 13);
this.paletteLabel.TabIndex = 22;
this.paletteLabel.Text = "Palette";
//
// imageComboBox
//
this.imageComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.imageComboBox.FormattingEnabled = true;
this.imageComboBox.Location = new System.Drawing.Point(77, 18);
this.imageComboBox.Name = "imageComboBox";
this.imageComboBox.Size = new System.Drawing.Size(58, 21);
this.imageComboBox.TabIndex = 23;
this.imageComboBox.SelectedIndexChanged += new System.EventHandler(this.imageComboBox_SelectedIndexChanged);
this.saveIconButton.Location = new System.Drawing.Point(14, 102);
this.saveIconButton.Name = "saveIconButton";
this.saveIconButton.Size = new System.Drawing.Size(121, 23);
this.saveIconButton.TabIndex = 25;
this.saveIconButton.Text = "Save Icon Changes";
this.saveIconButton.UseVisualStyleBackColor = true;
this.saveIconButton.Click += new System.EventHandler(this.saveIconButton_Click);
//
// paletteComboBox
//
@@ -1304,15 +1285,83 @@
this.paletteComboBox.TabIndex = 24;
this.paletteComboBox.SelectedIndexChanged += new System.EventHandler(this.paletteComboBox_SelectedIndexChanged);
//
// saveIconButton
// imageComboBox
//
this.saveIconButton.Location = new System.Drawing.Point(14, 102);
this.saveIconButton.Name = "saveIconButton";
this.saveIconButton.Size = new System.Drawing.Size(121, 23);
this.saveIconButton.TabIndex = 25;
this.saveIconButton.Text = "Save Icon Changes";
this.saveIconButton.UseVisualStyleBackColor = true;
this.saveIconButton.Click += new System.EventHandler(this.saveIconButton_Click);
this.imageComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.imageComboBox.FormattingEnabled = true;
this.imageComboBox.Location = new System.Drawing.Point(77, 18);
this.imageComboBox.Name = "imageComboBox";
this.imageComboBox.Size = new System.Drawing.Size(58, 21);
this.imageComboBox.TabIndex = 23;
this.imageComboBox.SelectedIndexChanged += new System.EventHandler(this.imageComboBox_SelectedIndexChanged);
//
// paletteLabel
//
this.paletteLabel.AutoSize = true;
this.paletteLabel.Location = new System.Drawing.Point(11, 63);
this.paletteLabel.Name = "paletteLabel";
this.paletteLabel.Size = new System.Drawing.Size(40, 13);
this.paletteLabel.TabIndex = 22;
this.paletteLabel.Text = "Palette";
//
// imageLabel
//
this.imageLabel.AutoSize = true;
this.imageLabel.Location = new System.Drawing.Point(11, 21);
this.imageLabel.Name = "imageLabel";
this.imageLabel.Size = new System.Drawing.Size(36, 13);
this.imageLabel.TabIndex = 20;
this.imageLabel.Text = "Image";
//
// itemEditorSelectedPictureBox
//
this.itemEditorSelectedPictureBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.itemEditorSelectedPictureBox.Image = global::DSPRE.Properties.Resources.IconItem;
this.itemEditorSelectedPictureBox.Location = new System.Drawing.Point(180, 54);
this.itemEditorSelectedPictureBox.Name = "itemEditorSelectedPictureBox";
this.itemEditorSelectedPictureBox.Size = new System.Drawing.Size(47, 47);
this.itemEditorSelectedPictureBox.TabIndex = 18;
this.itemEditorSelectedPictureBox.TabStop = false;
//
// battleItemsBattlePocketCheck
//
this.battleItemsBattlePocketCheck.AutoSize = true;
this.battleItemsBattlePocketCheck.Location = new System.Drawing.Point(9, 105);
this.battleItemsBattlePocketCheck.Name = "battleItemsBattlePocketCheck";
this.battleItemsBattlePocketCheck.Size = new System.Drawing.Size(81, 17);
this.battleItemsBattlePocketCheck.TabIndex = 10;
this.battleItemsBattlePocketCheck.Text = "Battle Items";
this.battleItemsBattlePocketCheck.UseVisualStyleBackColor = true;
//
// ppRestoreBattlePocketCheck
//
this.ppRestoreBattlePocketCheck.AutoSize = true;
this.ppRestoreBattlePocketCheck.Location = new System.Drawing.Point(88, 105);
this.ppRestoreBattlePocketCheck.Name = "ppRestoreBattlePocketCheck";
this.ppRestoreBattlePocketCheck.Size = new System.Drawing.Size(80, 17);
this.ppRestoreBattlePocketCheck.TabIndex = 11;
this.ppRestoreBattlePocketCheck.Text = "PP Restore";
this.ppRestoreBattlePocketCheck.UseVisualStyleBackColor = true;
//
// hpRestoreBattlePocketCheck
//
this.hpRestoreBattlePocketCheck.AutoSize = true;
this.hpRestoreBattlePocketCheck.Location = new System.Drawing.Point(88, 81);
this.hpRestoreBattlePocketCheck.Name = "hpRestoreBattlePocketCheck";
this.hpRestoreBattlePocketCheck.Size = new System.Drawing.Size(81, 17);
this.hpRestoreBattlePocketCheck.TabIndex = 12;
this.hpRestoreBattlePocketCheck.Text = "HP Restore";
this.hpRestoreBattlePocketCheck.UseVisualStyleBackColor = true;
//
// statusHealersBattlePocketCheck
//
this.statusHealersBattlePocketCheck.AutoSize = true;
this.statusHealersBattlePocketCheck.Location = new System.Drawing.Point(167, 81);
this.statusHealersBattlePocketCheck.Name = "statusHealersBattlePocketCheck";
this.statusHealersBattlePocketCheck.Size = new System.Drawing.Size(95, 17);
this.statusHealersBattlePocketCheck.TabIndex = 13;
this.statusHealersBattlePocketCheck.Text = "Status Healers";
this.statusHealersBattlePocketCheck.UseVisualStyleBackColor = true;
//
// ItemEditor
//
@@ -1379,10 +1428,10 @@
((System.ComponentModel.ISupportInitialize)(this.friendshipHighValueNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.friendshipMidValueNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.friendshipLowValueNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemEditorSelectedPictureBox)).EndInit();
this.itemEditorSelectedPictureFlowLayoutPanel.ResumeLayout(false);
this.itemEditorSelectedPictureGroupBox.ResumeLayout(false);
this.itemEditorSelectedPictureGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.itemEditorSelectedPictureBox)).EndInit();
this.ResumeLayout(false);
}
@@ -1392,7 +1441,6 @@
private System.Windows.Forms.NumericUpDown itemNumberNumericUpDown;
private System.Windows.Forms.ComboBox holdEffectComboBox;
private System.Windows.Forms.ComboBox fieldPocketComboBox;
private System.Windows.Forms.ComboBox battlePocketComboBox;
private System.Windows.Forms.ComboBox itemNameInputComboBox;
private System.Windows.Forms.NumericUpDown priceNumericUpDown;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
@@ -1499,5 +1547,10 @@
private System.Windows.Forms.ComboBox paletteComboBox;
private System.Windows.Forms.ComboBox imageComboBox;
private System.Windows.Forms.Button saveIconButton;
private System.Windows.Forms.CheckBox pokeBallsBattlePocketCheck;
private System.Windows.Forms.CheckBox statusHealersBattlePocketCheck;
private System.Windows.Forms.CheckBox hpRestoreBattlePocketCheck;
private System.Windows.Forms.CheckBox ppRestoreBattlePocketCheck;
private System.Windows.Forms.CheckBox battleItemsBattlePocketCheck;
}
}

View File

@@ -91,7 +91,6 @@ namespace DSPRE.Editors
itemNameInputComboBox.Items.AddRange(this.itemFileNames);
holdEffectComboBox.Items.AddRange(Enum.GetNames(typeof(HoldEffect)));
fieldPocketComboBox.Items.AddRange(Enum.GetNames(typeof(FieldPocket)));
battlePocketComboBox.Items.AddRange(Enum.GetNames(typeof(BattlePocket)));
naturalGiftTypeComboBox.Items.AddRange(Enum.GetNames(typeof(NaturalGiftType)));
fieldFunctionComboBox.Items.AddRange(Enum.GetNames(typeof(FieldUseFunc)));
battleFunctionComboBox.Items.AddRange(Enum.GetNames(typeof(BattleUseFunc)));
@@ -124,6 +123,17 @@ namespace DSPRE.Editors
paletteComboBox.EndUpdate();
}
public void UpdateBattlePocketCheckBoxes()
{
BattlePocket battlePocket = currentLoadedFile.battlePocket;
pokeBallsBattlePocketCheck.Checked = (battlePocket & BattlePocket.PokeBalls) != 0;
battleItemsBattlePocketCheck.Checked = (battlePocket & BattlePocket.BattleItems) != 0;
hpRestoreBattlePocketCheck.Checked = (battlePocket & BattlePocket.HpRestore) != 0;
statusHealersBattlePocketCheck.Checked = (battlePocket & BattlePocket.StatusHealers) != 0;
ppRestoreBattlePocketCheck.Checked = (battlePocket & BattlePocket.PpRestore) != 0;
}
private void BindItemParamsEvents()
{
@@ -287,9 +297,7 @@ namespace DSPRE.Editors
// Pockets
fieldPocketComboBox.SelectedIndex = (int)currentLoadedFile.fieldPocket;
// Set the selected value for non sequential enums
BattlePocket battlePocket = (BattlePocket)currentLoadedFile.battlePocket;
string battlePocketEnum = Enum.GetName(typeof(BattlePocket), battlePocket);
battlePocketComboBox.SelectedItem = battlePocketEnum;
UpdateBattlePocketCheckBoxes();
// Move Related
// Set the selected value for non sequential enums
@@ -555,17 +563,6 @@ namespace DSPRE.Editors
setDirty(true);
}
private void battlePocketComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
currentLoadedFile.battlePocket = (BattlePocket)Enum.Parse(typeof(BattlePocket), (string)battlePocketComboBox.SelectedItem);
setDirty(true);
}
private void priceNumericUpDown_ValueChanged(object sender, EventArgs e)
{
@@ -822,5 +819,29 @@ namespace DSPRE.Editors
}
setDirty(false);
}
private void BattlePocketCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
// Build battlePocket from checkbox states
BattlePocket battlePocket = BattlePocket.None;
if (pokeBallsBattlePocketCheck.Checked)
battlePocket |= BattlePocket.PokeBalls;
if (battleItemsBattlePocketCheck.Checked)
battlePocket |= BattlePocket.BattleItems;
if (hpRestoreBattlePocketCheck.Checked)
battlePocket |= BattlePocket.HpRestore;
if (statusHealersBattlePocketCheck.Checked)
battlePocket |= BattlePocket.StatusHealers;
if (ppRestoreBattlePocketCheck.Checked)
battlePocket |= BattlePocket.PpRestore;
currentLoadedFile.battlePocket = battlePocket;
setDirty(true);
}
}
}

View File

@@ -32,24 +32,26 @@
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.movesListBox = new System.Windows.Forms.ListBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.editLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.entryCountLabel = new System.Windows.Forms.Label();
this.descriptorLabel = new System.Windows.Forms.Label();
this.addMoveButton = new System.Windows.Forms.Button();
this.deleteMoveButton = new System.Windows.Forms.Button();
this.editMoveButton = new System.Windows.Forms.Button();
this.levelNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.moveInputComboBox = new DSPRE.InputComboBox();
this.levelLabel = new System.Windows.Forms.Label();
this.statusLabel = new System.Windows.Forms.Label();
this.moveUpButton = new System.Windows.Forms.Button();
this.moveDownButton = new System.Windows.Forms.Button();
this.moveInputComboBox = new DSPRE.InputComboBox();
this.pokemonNameInputComboBox = new DSPRE.InputComboBox();
this.entryCountLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pokemonPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.monNumberNumericUpDown)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.editLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.levelNumericUpDown)).BeginInit();
this.SuspendLayout();
//
@@ -66,23 +68,21 @@
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.pokemonNameInputComboBox, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 6);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tableLayoutPanel1.Location = new System.Drawing.Point(5, 5);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.58022F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 88.41978F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(654, 553);
this.tableLayoutPanel1.Size = new System.Drawing.Size(491, 449);
this.tableLayoutPanel1.TabIndex = 0;
//
// saveDataButton
//
this.saveDataButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.saveDataButton.Image = ((System.Drawing.Image)(resources.GetObject("saveDataButton.Image")));
this.saveDataButton.Location = new System.Drawing.Point(588, 4);
this.saveDataButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.saveDataButton.Location = new System.Drawing.Point(441, 3);
this.saveDataButton.Name = "saveDataButton";
this.saveDataButton.Size = new System.Drawing.Size(62, 56);
this.saveDataButton.Size = new System.Drawing.Size(47, 45);
this.saveDataButton.TabIndex = 30;
this.saveDataButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.saveDataButton.UseVisualStyleBackColor = true;
@@ -91,10 +91,9 @@
// pokemonPictureBox
//
this.pokemonPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pokemonPictureBox.Location = new System.Drawing.Point(4, 4);
this.pokemonPictureBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.pokemonPictureBox.Location = new System.Drawing.Point(3, 3);
this.pokemonPictureBox.Name = "pokemonPictureBox";
this.pokemonPictureBox.Size = new System.Drawing.Size(59, 56);
this.pokemonPictureBox.Size = new System.Drawing.Size(44, 45);
this.pokemonPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pokemonPictureBox.TabIndex = 12;
this.pokemonPictureBox.TabStop = false;
@@ -102,10 +101,9 @@
// monNumberNumericUpDown
//
this.monNumberNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.monNumberNumericUpDown.Location = new System.Drawing.Point(465, 21);
this.monNumberNumericUpDown.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.monNumberNumericUpDown.Location = new System.Drawing.Point(349, 15);
this.monNumberNumericUpDown.Name = "monNumberNumericUpDown";
this.monNumberNumericUpDown.Size = new System.Drawing.Size(115, 22);
this.monNumberNumericUpDown.Size = new System.Drawing.Size(86, 20);
this.monNumberNumericUpDown.TabIndex = 16;
this.monNumberNumericUpDown.ValueChanged += new System.EventHandler(this.monNumberNumericUpDown_ValueChanged);
//
@@ -115,29 +113,26 @@
this.tableLayoutPanel1.SetColumnSpan(this.tableLayoutPanel2, 4);
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 8.303955F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 8.303955F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 27F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel2.Controls.Add(this.groupBox2, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.groupBox3, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(4, 68);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 54);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(5);
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 470F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(646, 481);
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 382F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(485, 392);
this.tableLayoutPanel2.TabIndex = 17;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.movesListBox);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(11, 10);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox2.Location = new System.Drawing.Point(8, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox2.Size = new System.Drawing.Size(308, 461);
this.groupBox2.Size = new System.Drawing.Size(231, 376);
this.groupBox2.TabIndex = 34;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "View";
@@ -146,79 +141,93 @@
//
this.movesListBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.movesListBox.FormattingEnabled = true;
this.movesListBox.ItemHeight = 16;
this.movesListBox.Location = new System.Drawing.Point(4, 19);
this.movesListBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.movesListBox.Location = new System.Drawing.Point(3, 16);
this.movesListBox.Margin = new System.Windows.Forms.Padding(2);
this.movesListBox.Name = "movesListBox";
this.movesListBox.Size = new System.Drawing.Size(300, 438);
this.movesListBox.Size = new System.Drawing.Size(225, 357);
this.movesListBox.TabIndex = 0;
this.movesListBox.SelectedIndexChanged += new System.EventHandler(this.movesListBox_SelectedIndexChanged);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.tableLayoutPanel3);
this.groupBox3.Controls.Add(this.editLayoutPanel);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(327, 10);
this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox3.Location = new System.Drawing.Point(245, 8);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox3.Size = new System.Drawing.Size(308, 461);
this.groupBox3.Size = new System.Drawing.Size(232, 376);
this.groupBox3.TabIndex = 35;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Edit";
//
// tableLayoutPanel3
// editLayoutPanel
//
this.tableLayoutPanel3.ColumnCount = 3;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.Controls.Add(this.entryCountLabel, 0, 5);
this.tableLayoutPanel3.Controls.Add(this.descriptorLabel, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.addMoveButton, 0, 4);
this.tableLayoutPanel3.Controls.Add(this.deleteMoveButton, 2, 4);
this.tableLayoutPanel3.Controls.Add(this.editMoveButton, 1, 4);
this.tableLayoutPanel3.Controls.Add(this.levelNumericUpDown, 1, 2);
this.tableLayoutPanel3.Controls.Add(this.label1, 0, 2);
this.tableLayoutPanel3.Controls.Add(this.moveInputComboBox, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.statusLabel, 0, 3);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(4, 19);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tableLayoutPanel3.RowCount = 6;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34.50088F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65.49912F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 144F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 44F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(226, 357);
this.tableLayoutPanel3.TabIndex = 0;
this.editLayoutPanel.ColumnCount = 3;
this.editLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33112F));
this.editLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33444F));
this.editLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33444F));
this.editLayoutPanel.Controls.Add(this.moveDownButton, 1, 4);
this.editLayoutPanel.Controls.Add(this.moveUpButton, 0, 4);
this.editLayoutPanel.Controls.Add(this.addMoveButton, 0, 5);
this.editLayoutPanel.Controls.Add(this.deleteMoveButton, 2, 5);
this.editLayoutPanel.Controls.Add(this.editMoveButton, 1, 5);
this.editLayoutPanel.Controls.Add(this.levelNumericUpDown, 1, 2);
this.editLayoutPanel.Controls.Add(this.moveInputComboBox, 0, 0);
this.editLayoutPanel.Controls.Add(this.descriptorLabel, 0, 1);
this.editLayoutPanel.Controls.Add(this.entryCountLabel, 0, 6);
this.editLayoutPanel.Controls.Add(this.levelLabel, 0, 2);
this.editLayoutPanel.Controls.Add(this.statusLabel, 0, 3);
this.editLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.editLayoutPanel.Location = new System.Drawing.Point(3, 16);
this.editLayoutPanel.Margin = new System.Windows.Forms.Padding(2);
this.editLayoutPanel.Name = "editLayoutPanel";
this.editLayoutPanel.Padding = new System.Windows.Forms.Padding(2);
this.editLayoutPanel.RowCount = 7;
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.editLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.editLayoutPanel.Size = new System.Drawing.Size(226, 357);
this.editLayoutPanel.TabIndex = 0;
//
// entryCountLabel
//
this.entryCountLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.entryCountLabel.AutoSize = true;
this.editLayoutPanel.SetColumnSpan(this.entryCountLabel, 3);
this.entryCountLabel.Location = new System.Drawing.Point(4, 334);
this.entryCountLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.entryCountLabel.Name = "entryCountLabel";
this.entryCountLabel.Padding = new System.Windows.Forms.Padding(1, 4, 1, 4);
this.entryCountLabel.Size = new System.Drawing.Size(70, 21);
this.entryCountLabel.TabIndex = 9;
this.entryCountLabel.Text = "Entry Count: ";
this.entryCountLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// descriptorLabel
//
this.descriptorLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.descriptorLabel.AutoSize = true;
this.tableLayoutPanel3.SetColumnSpan(this.descriptorLabel, 3);
this.descriptorLabel.Location = new System.Drawing.Point(7, 52);
this.descriptorLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.editLayoutPanel.SetColumnSpan(this.descriptorLabel, 3);
this.descriptorLabel.Location = new System.Drawing.Point(5, 45);
this.descriptorLabel.Name = "descriptorLabel";
this.descriptorLabel.Padding = new System.Windows.Forms.Padding(1, 6, 1, 6);
this.descriptorLabel.Size = new System.Drawing.Size(71, 28);
this.descriptorLabel.Padding = new System.Windows.Forms.Padding(1, 5, 1, 5);
this.descriptorLabel.Size = new System.Drawing.Size(57, 23);
this.descriptorLabel.TabIndex = 8;
this.descriptorLabel.Text = "Descriptor";
//
// addMoveButton
//
this.addMoveButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.addMoveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.addMoveButton.Enabled = false;
this.addMoveButton.Image = global::DSPRE.Properties.Resources.addIcon;
this.addMoveButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.addMoveButton.Location = new System.Drawing.Point(4, 286);
this.addMoveButton.Location = new System.Drawing.Point(4, 201);
this.addMoveButton.Margin = new System.Windows.Forms.Padding(2);
this.addMoveButton.Name = "addMoveButton";
this.addMoveButton.Size = new System.Drawing.Size(70, 40);
this.addMoveButton.Size = new System.Drawing.Size(69, 32);
this.addMoveButton.TabIndex = 1;
this.addMoveButton.Text = "Add";
this.addMoveButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -227,14 +236,14 @@
//
// deleteMoveButton
//
this.deleteMoveButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.deleteMoveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.deleteMoveButton.Enabled = false;
this.deleteMoveButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
this.deleteMoveButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.deleteMoveButton.Location = new System.Drawing.Point(152, 286);
this.deleteMoveButton.Location = new System.Drawing.Point(151, 201);
this.deleteMoveButton.Margin = new System.Windows.Forms.Padding(2);
this.deleteMoveButton.Name = "deleteMoveButton";
this.deleteMoveButton.Size = new System.Drawing.Size(70, 40);
this.deleteMoveButton.Size = new System.Drawing.Size(71, 32);
this.deleteMoveButton.TabIndex = 2;
this.deleteMoveButton.Text = "Delete";
this.deleteMoveButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -243,14 +252,14 @@
//
// editMoveButton
//
this.editMoveButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.editMoveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.editMoveButton.Enabled = false;
this.editMoveButton.Image = global::DSPRE.Properties.Resources.RenameIcon;
this.editMoveButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.editMoveButton.Location = new System.Drawing.Point(78, 286);
this.editMoveButton.Location = new System.Drawing.Point(77, 201);
this.editMoveButton.Margin = new System.Windows.Forms.Padding(2);
this.editMoveButton.Name = "editMoveButton";
this.editMoveButton.Size = new System.Drawing.Size(70, 40);
this.editMoveButton.Size = new System.Drawing.Size(70, 32);
this.editMoveButton.TabIndex = 3;
this.editMoveButton.Text = "Edit";
this.editMoveButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -259,89 +268,108 @@
//
// levelNumericUpDown
//
this.tableLayoutPanel3.SetColumnSpan(this.levelNumericUpDown, 2);
this.levelNumericUpDown.Dock = System.Windows.Forms.DockStyle.Fill;
this.levelNumericUpDown.Location = new System.Drawing.Point(103, 148);
this.levelNumericUpDown.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.levelNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.editLayoutPanel.SetColumnSpan(this.levelNumericUpDown, 2);
this.levelNumericUpDown.Location = new System.Drawing.Point(77, 82);
this.levelNumericUpDown.Margin = new System.Windows.Forms.Padding(2);
this.levelNumericUpDown.Name = "levelNumericUpDown";
this.levelNumericUpDown.Size = new System.Drawing.Size(191, 22);
this.levelNumericUpDown.Size = new System.Drawing.Size(145, 20);
this.levelNumericUpDown.TabIndex = 4;
this.levelNumericUpDown.ValueChanged += new System.EventHandler(this.levelNumericUpDown_ValueChanged);
//
// label1
// levelLabel
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 150);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(91, 16);
this.label1.TabIndex = 5;
this.label1.Text = "Level:";
this.levelLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.levelLabel.AutoSize = true;
this.levelLabel.Location = new System.Drawing.Point(4, 85);
this.levelLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.levelLabel.Name = "levelLabel";
this.levelLabel.Size = new System.Drawing.Size(69, 13);
this.levelLabel.TabIndex = 5;
this.levelLabel.Text = "Level:";
//
// statusLabel
//
this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.statusLabel.AutoSize = true;
this.editLayoutPanel.SetColumnSpan(this.statusLabel, 3);
this.statusLabel.Location = new System.Drawing.Point(4, 119);
this.statusLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.statusLabel.Name = "statusLabel";
this.statusLabel.Padding = new System.Windows.Forms.Padding(1, 5, 1, 5);
this.statusLabel.Size = new System.Drawing.Size(39, 23);
this.statusLabel.TabIndex = 7;
this.statusLabel.Text = "Status";
//
// moveUpButton
//
this.moveUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.moveUpButton.Enabled = false;
this.moveUpButton.Image = global::DSPRE.Properties.Resources.arrowup;
this.moveUpButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.moveUpButton.Location = new System.Drawing.Point(4, 151);
this.moveUpButton.Margin = new System.Windows.Forms.Padding(2);
this.moveUpButton.Name = "moveUpButton";
this.moveUpButton.Size = new System.Drawing.Size(69, 32);
this.moveUpButton.TabIndex = 10;
this.moveUpButton.Text = "Move";
this.moveUpButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.moveUpButton.UseVisualStyleBackColor = true;
this.moveUpButton.Click += new System.EventHandler(this.moveUpButton_Click);
//
// moveDownButton
//
this.moveDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.moveDownButton.Enabled = false;
this.moveDownButton.Image = global::DSPRE.Properties.Resources.arrowdown;
this.moveDownButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.moveDownButton.Location = new System.Drawing.Point(77, 151);
this.moveDownButton.Margin = new System.Windows.Forms.Padding(2);
this.moveDownButton.Name = "moveDownButton";
this.moveDownButton.Size = new System.Drawing.Size(70, 32);
this.moveDownButton.TabIndex = 11;
this.moveDownButton.Text = "Move";
this.moveDownButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.moveDownButton.UseVisualStyleBackColor = true;
this.moveDownButton.Click += new System.EventHandler(this.moveDownButton_Click);
//
// moveInputComboBox
//
this.moveInputComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.moveInputComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.moveInputComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.tableLayoutPanel3.SetColumnSpan(this.moveInputComboBox, 3);
this.editLayoutPanel.SetColumnSpan(this.moveInputComboBox, 3);
this.moveInputComboBox.FormattingEnabled = true;
this.moveInputComboBox.Location = new System.Drawing.Point(6, 15);
this.moveInputComboBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.moveInputComboBox.Location = new System.Drawing.Point(4, 11);
this.moveInputComboBox.Margin = new System.Windows.Forms.Padding(2);
this.moveInputComboBox.Name = "moveInputComboBox";
this.moveInputComboBox.Size = new System.Drawing.Size(288, 24);
this.moveInputComboBox.Size = new System.Drawing.Size(218, 21);
this.moveInputComboBox.TabIndex = 6;
this.moveInputComboBox.SelectedIndexChanged += new System.EventHandler(this.moveInputComboBox_SelectedIndexChanged);
//
// statusLabel
//
this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.statusLabel.AutoSize = true;
this.tableLayoutPanel3.SetColumnSpan(this.statusLabel, 3);
this.statusLabel.Location = new System.Drawing.Point(5, 261);
this.statusLabel.Name = "statusLabel";
this.statusLabel.Padding = new System.Windows.Forms.Padding(1, 6, 1, 6);
this.statusLabel.Size = new System.Drawing.Size(46, 28);
this.statusLabel.TabIndex = 7;
this.statusLabel.Text = "Status";
//
// pokemonNameInputComboBox
//
this.pokemonNameInputComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.pokemonNameInputComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.pokemonNameInputComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.pokemonNameInputComboBox.FormattingEnabled = true;
this.pokemonNameInputComboBox.Location = new System.Drawing.Point(71, 20);
this.pokemonNameInputComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.pokemonNameInputComboBox.Location = new System.Drawing.Point(53, 15);
this.pokemonNameInputComboBox.Name = "pokemonNameInputComboBox";
this.pokemonNameInputComboBox.Size = new System.Drawing.Size(386, 24);
this.pokemonNameInputComboBox.Size = new System.Drawing.Size(290, 21);
this.pokemonNameInputComboBox.TabIndex = 31;
this.pokemonNameInputComboBox.SelectedIndexChanged += new System.EventHandler(this.pokemonNameInputComboBox_SelectedIndexChanged);
//
// entryCountLabel
//
this.entryCountLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.entryCountLabel.AutoSize = true;
this.tableLayoutPanel3.SetColumnSpan(this.entryCountLabel, 3);
this.entryCountLabel.Location = new System.Drawing.Point(5, 332);
this.entryCountLabel.Name = "entryCountLabel";
this.entryCountLabel.Padding = new System.Windows.Forms.Padding(1, 5, 1, 5);
this.entryCountLabel.Size = new System.Drawing.Size(70, 23);
this.entryCountLabel.TabIndex = 9;
this.entryCountLabel.Text = "Entry Count: ";
this.entryCountLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// LearnsetEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(668, 565);
this.ClientSize = new System.Drawing.Size(501, 459);
this.Controls.Add(this.tableLayoutPanel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LearnsetEditor";
this.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.Padding = new System.Windows.Forms.Padding(5);
this.Text = "Learnset Editor";
this.tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pokemonPictureBox)).EndInit();
@@ -349,8 +377,8 @@
this.tableLayoutPanel2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.editLayoutPanel.ResumeLayout(false);
this.editLayoutPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.levelNumericUpDown)).EndInit();
this.ResumeLayout(false);
@@ -365,17 +393,19 @@
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ListBox movesListBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.TableLayoutPanel editLayoutPanel;
private System.Windows.Forms.Button addMoveButton;
private System.Windows.Forms.Button deleteMoveButton;
private System.Windows.Forms.Button editMoveButton;
private System.Windows.Forms.NumericUpDown levelNumericUpDown;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label levelLabel;
private InputComboBox moveInputComboBox;
private System.Windows.Forms.Label descriptorLabel;
private System.Windows.Forms.Label statusLabel;
public InputComboBox pokemonNameInputComboBox;
public System.Windows.Forms.NumericUpDown monNumberNumericUpDown;
private System.Windows.Forms.Label entryCountLabel;
private System.Windows.Forms.Button moveUpButton;
private System.Windows.Forms.Button moveDownButton;
}
}

View File

@@ -10,10 +10,18 @@ using MessageBox = System.Windows.Forms.MessageBox;
namespace DSPRE {
public partial class LearnsetEditor : Form {
private PokemonEditor _parent;
private readonly string[] fileNames;
private readonly string[] pokenames;
private readonly string[] moveNames;
private PokemonEditor _parent;
private bool editMode = false;
public bool dirty = false;
private int currentLoadedId = 0;
private LearnsetData currentLoadedFile = null;
private readonly string formName = "Learnset Editor";
private readonly string[] editButtonNames = new string[] {
"Edit",
"Confirm"
@@ -23,55 +31,190 @@ namespace DSPRE {
"Delete",
"Discard"
};
private bool editMode = false;
private int currentLoadedId = 0;
private LearnsetData currentLoadedFile = null;
private bool dirty = false;
private readonly string formName = "Learnset Editor";
public LearnsetEditor(string[] moveNames, Control parent, PokemonEditor pokeEditor) {
this.moveNames = moveNames;
this._parent = pokeEditor;
InitializeComponent();
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.FormBorderStyle = FormBorderStyle.None;
this.Size = parent.Size;
this.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
Helpers.DisableHandlers();
BindingList<string> listMoveNames = new BindingList<string>(moveNames);
moveInputComboBox.DataSource = listMoveNames;
/* ---------------- */
int count = RomInfo.GetLearnsetFilesCount();
this._parent = pokeEditor;
this.moveNames = moveNames;
this.pokenames = RomInfo.GetPokemonNames();
List<string> fileNames = new List<string>(count);
fileNames.AddRange(pokenames);
this.fileNames = GetFileNames();
for (int i = 0; i < PokeDatabase.PersonalData.personalExtraFiles.Length; i++) {
PokeDatabase.PersonalData.PersonalExtraFiles altFormEntry = PokeDatabase.PersonalData.personalExtraFiles[i];
fileNames.Add(fileNames[altFormEntry.monId] + " - " + altFormEntry.description);
}
InitDataRanges();
int extraEntries = fileNames.Count;
for (int i = 0; i < count - extraEntries; i++) {
fileNames.Add($"Extra entry {fileNames.Count}");
}
this.fileNames = fileNames.ToArray();
monNumberNumericUpDown.Maximum = fileNames.Count - 1;
pokemonNameInputComboBox.Items.AddRange(this.fileNames);
/* ---------------- */
descriptorLabel.Text = "";
statusLabel.Text = "";
Helpers.EnableHandlers();
ChangeLoadedFile(1);
Helpers.EnableHandlers();
}
private void InitDataRanges()
{
moveInputComboBox.DataSource = moveNames;
pokemonNameInputComboBox.DataSource = fileNames;
monNumberNumericUpDown.Minimum = 0;
monNumberNumericUpDown.Maximum = RomInfo.GetLearnsetFilesCount() - 1;
pokemonNameInputComboBox.SelectedIndex = 1;
monNumberNumericUpDown.Value = 1;
levelNumericUpDown.Value = 1;
}
private void setDirty(bool status) {
private string[] GetFileNames()
{
int learnsetCount = RomInfo.GetLearnsetFilesCount();
List<string> fileNames = new List<string>(RomInfo.GetLearnsetFilesCount());
fileNames.AddRange(pokenames);
for (int i = 0; i < PokeDatabase.PersonalData.personalExtraFiles.Length; i++) {
PokeDatabase.PersonalData.PersonalExtraFiles altFormEntry = PokeDatabase.PersonalData.personalExtraFiles[i];
fileNames.Add(fileNames[altFormEntry.monId] + " - " + altFormEntry.description);
}
for (int i = 0; i < learnsetCount - fileNames.Count; i++)
{
fileNames.Add($"Extra entry {fileNames.Count}");
}
return fileNames.ToArray();
}
public void ChangeLoadedFile(int learnsetID)
{
currentLoadedFile = new LearnsetData(learnsetID);
currentLoadedId = learnsetID;
monNumberNumericUpDown.Value = currentLoadedId;
pokemonNameInputComboBox.SelectedIndex = currentLoadedId;
UpdateMovesListFromFile();
UpdateEntryCountLabel();
UpdateButtonsOnMoveSelection();
UpdatePokePic();
UpdateAddEditStatus();
SetDirty(false);
}
private void UpdateMovesListFromFile()
{
movesListBox.BeginUpdate();
movesListBox.Items.Clear();
foreach (var elem in currentLoadedFile.list)
{
movesListBox.Items.Add(ElemToString(elem));
}
movesListBox.EndUpdate();
}
private void UpdateEntryCountLabel()
{
StringBuilder labelText = new StringBuilder("Entry Count: ");
labelText.Append(movesListBox.Items.Count);
if (movesListBox.Items.Count > LearnsetData.VanillaLimit)
{
labelText.Append("!");
entryCountLabel.ForeColor = Color.FromArgb(210, 120, 0);
entryCountLabel.Font = new Font(entryCountLabel.Font, FontStyle.Bold);
}
else
{
entryCountLabel.ForeColor = Color.Black;
entryCountLabel.Font = new Font(entryCountLabel.Font, FontStyle.Regular);
}
entryCountLabel.Text = labelText.ToString();
}
private void UpdatePokePic()
{
int excess = currentLoadedId - pokenames.Length;
int toLoad = currentLoadedId; // Default to the current ID
try
{
if (excess >= 0)
{
toLoad = PokeDatabase.PersonalData.personalExtraFiles[excess].iconId;
}
}
catch (IndexOutOfRangeException)
{
toLoad = 0;
}
finally
{
pokemonPictureBox.Image = DSUtils.GetPokePic(toLoad, pokemonPictureBox.Width, pokemonPictureBox.Height);
}
}
private void UpdateAddEditStatus()
{
(byte level, ushort move) newEntry = ((byte)levelNumericUpDown.Value, (ushort)moveInputComboBox.SelectedIndex);
if (currentLoadedFile == null)
{
return;
}
bool duplicate = currentLoadedFile.list.Contains(newEntry);
if (duplicate)
{
if (editMode)
{
editMoveButton.Enabled = false;
}
else
{
addMoveButton.Enabled = false;
}
statusLabel.Text = "Entry already exists!";
}
else
{
bool addable = IsValidEntry();
if (addable)
{
statusLabel.Text = "";
}
else
{
statusLabel.Text = "Invalid Move ID or Level!";
}
if (editMode)
{
editMoveButton.Enabled = addable;
}
else
{
addMoveButton.Enabled = addable;
}
}
}
public void SaveLearnsetData() {
if (currentLoadedFile == null) {
return;
}
currentLoadedFile.SaveToFileDefaultDir(currentLoadedId, false);
SetDirty(false);
}
private void SetDirty(bool status) {
if (status) {
dirty = true;
this.Text = formName + "*";
@@ -79,90 +222,172 @@ namespace DSPRE {
dirty = false;
this.Text = formName;
}
_parent.UpdateTabPageNames();
}
public bool CheckDiscardChanges() {
public bool CheckDiscardChanges()
{
if (!dirty) {
return true;
}
DialogResult res = MessageBox.Show(this, "Learnsets Editor\nThere are unsaved changes to the current Learnset data.\nDiscard and proceed?", "Learnset Editor - Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (res.Equals(DialogResult.Yes)) {
return true;
DialogResult res = MessageBox.Show(this,
"You have unsaved changes. Do you want to save them before switching Pokémon?",
"Learnset Editor - Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (res == DialogResult.Yes)
{
SaveLearnsetData();
}
else if (res == DialogResult.Cancel)
{
monNumberNumericUpDown.Value = currentLoadedId;
pokemonNameInputComboBox.SelectedIndex = currentLoadedId;
return false; // Cancel the change
}
monNumberNumericUpDown.Value = currentLoadedId;
pokemonNameInputComboBox.SelectedIndex = currentLoadedId;
return false;
return true;
}
private string ElemToString((ushort level, ushort move) elem) {
return $"Lv. {elem.level}: {moveNames[elem.move]}";
}
public void ChangeLoadedFile(int toLoad) {
currentLoadedId = toLoad;
currentLoadedFile = new LearnsetData(currentLoadedId);
PopulateAllFromCurrentFile();
UpdateButtonsOnMoveSelection();
int excess = toLoad - pokenames.Length;
try {
if (excess >= 0) {
toLoad = PokeDatabase.PersonalData.personalExtraFiles[excess].iconId;
}
} catch (IndexOutOfRangeException) {
toLoad = 0;
} finally {
pokemonPictureBox.Image = DSUtils.GetPokePic(toLoad, pokemonPictureBox.Width, pokemonPictureBox.Height);
}
setDirty(false);
private bool IsValidEntry()
{
return levelNumericUpDown.Value > 0 &&
moveInputComboBox.SelectedIndex > 0;
}
private void PopulateAllFromCurrentFile() {
movesListBox.BeginUpdate();
movesListBox.Items.Clear();
foreach (var elem in currentLoadedFile.list) {
movesListBox.Items.Add(ElemToString(elem));
}
UpdateEntryCountLabel();
movesListBox.EndUpdate();
private void UpdateByEditMode()
{
int index = editMode == false ? 0 : 1;
editMoveButton.Text = editButtonNames[index];
deleteMoveButton.Text = deleteButtonNames[index];
}
//-------------------------------
private void saveDataButton_Click(object sender, EventArgs e) {
currentLoadedFile.SaveToFileDefaultDir(currentLoadedId, true);
setDirty(false);
}
private void UpdateButtonsOnMoveSelection()
{
int sel = movesListBox.SelectedIndex;
private void pokemonNameInputComboBox_SelectedIndexChanged(object sender, EventArgs e) {
Update();
if (Helpers.HandlersDisabled) {
if (sel < 0)
{
editMoveButton.Enabled = false;
deleteMoveButton.Enabled = false;
moveUpButton.Enabled = false;
moveDownButton.Enabled = false;
return;
}
editMoveButton.Enabled = true;
deleteMoveButton.Enabled = true;
int moveLevel = currentLoadedFile.list[sel].level;
int previousLevel = sel > 0 ? currentLoadedFile.list[sel - 1].level : 0;
int nextLevel = sel < currentLoadedFile.list.Count - 1 ? currentLoadedFile.list[sel + 1].level : 255;
// Allow reordering only if the levels are the same
moveUpButton.Enabled = moveLevel == previousLevel;
moveDownButton.Enabled = moveLevel == nextLevel;
}
private int InsertEntrySafe(int level, int moveID)
{
if (currentLoadedFile == null || !IsValidEntry())
{
return -1;
}
(byte level, ushort move) newEntry = ((byte)level, (ushort)moveID);
if (currentLoadedFile.list.Contains(newEntry))
{
MessageBox.Show(this, "This entry already exists!\nThis should not have happened.", "Learnset Editor - Duplicate Entry", MessageBoxButtons.OK, MessageBoxIcon.Warning);
AppLogger.Error("Learnset Editor: Attempted to insert a duplicate entry: " + newEntry);
return -1;
}
int index = currentLoadedFile.list.FindIndex(x => x.level > newEntry.level || (x.level == newEntry.level && x.move > newEntry.move));
if (index < 0)
{
currentLoadedFile.list.Add(newEntry);
return currentLoadedFile.list.Count - 1; // Add to the end if no larger entry is found
}
else
{
currentLoadedFile.list.Insert(index, newEntry);
return index; // Insert at the found index
}
}
private bool ShiftEntry(int index, int direction)
{
if (currentLoadedFile == null || index < 0 || index >= currentLoadedFile.list.Count)
{
return false; // Invalid index
}
int newIndex = index + direction;
if (newIndex < 0 || newIndex >= currentLoadedFile.list.Count)
{
return false; // Out of bounds
}
// Move the entry safely
SwapEntriesSafe(index, newIndex);
return true;
}
private bool SwapEntriesSafe(int indexA, int indexB)
{
if (currentLoadedFile == null || indexA < 0 || indexB < 0 || indexA >= currentLoadedFile.list.Count || indexB >= currentLoadedFile.list.Count)
{
return false; // Invalid indices
}
(byte level, ushort move) entryA = currentLoadedFile.list[indexA];
(byte level, ushort move) entryB = currentLoadedFile.list[indexB];
// Swap the entries
currentLoadedFile.list[indexA] = entryB;
currentLoadedFile.list[indexB] = entryA;
return true; // Successfully swapped
}
#region Event Handlers
private void saveDataButton_Click(object sender, EventArgs e) {
SaveLearnsetData();
}
private void pokemonNameInputComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
Update();
this._parent.TrySyncIndices((ComboBox)sender);
Helpers.DisableHandlers();
UpdateAddEditStatus();
if (CheckDiscardChanges()) {
int newNumber = pokemonNameInputComboBox.SelectedIndex;
monNumberNumericUpDown.Value = newNumber;
ChangeLoadedFile(newNumber);
if (CheckDiscardChanges())
{
ChangeLoadedFile(pokemonNameInputComboBox.SelectedIndex);
}
Helpers.EnableHandlers();
}
private void monNumberNumericUpDown_ValueChanged(object sender, EventArgs e) {
Update();
if (Helpers.HandlersDisabled) {
if (Helpers.HandlersDisabled)
{
return;
}
Update();
this._parent.TrySyncIndices((NumericUpDown)sender);
Helpers.DisableHandlers();
UpdateAddEditStatus();
if (CheckDiscardChanges()) {
int newNumber = (int)monNumberNumericUpDown.Value;
pokemonNameInputComboBox.SelectedIndex = newNumber;
ChangeLoadedFile(newNumber);
if (CheckDiscardChanges())
{
ChangeLoadedFile((int)monNumberNumericUpDown.Value);
}
Helpers.EnableHandlers();
}
@@ -175,10 +400,6 @@ namespace DSPRE {
descriptorLabel.Text = "Move ID: " + moveInputComboBox.SelectedIndex;
}
private bool CheckValidEntry() {
return levelNumericUpDown.Value > 0 &&
moveInputComboBox.SelectedIndex > 0;
}
private void levelNumericUpDown_ValueChanged(object sender, EventArgs e) {
if (currentLoadedFile == null) {
return;
@@ -186,61 +407,39 @@ namespace DSPRE {
UpdateAddEditStatus();
}
private void UpdateAddEditStatus() {
(byte level, ushort move) newEntry = ((byte)levelNumericUpDown.Value, (ushort)moveInputComboBox.SelectedIndex);
if (currentLoadedFile == null)
{
return;
}
bool duplicate = currentLoadedFile.list.Contains(newEntry);
if (duplicate) {
if (editMode) {
editMoveButton.Enabled = false;
} else {
addMoveButton.Enabled = false;
}
statusLabel.Text = "Entry already exists!";
} else {
bool addable = CheckValidEntry();
if (addable) {
statusLabel.Text = "";
} else {
statusLabel.Text = "Invalid Move ID or Level!";
}
if (editMode) {
editMoveButton.Enabled = addable;
} else {
addMoveButton.Enabled = addable;
}
}
}
private void addMoveButton_Click(object sender, EventArgs e) {
(byte level, ushort move) newEntry = ((byte)levelNumericUpDown.Value, (ushort)moveInputComboBox.SelectedIndex);
currentLoadedFile.list.Add(newEntry);
currentLoadedFile.list.Sort();
PopulateAllFromCurrentFile();
movesListBox.SelectedIndex = currentLoadedFile.list.FindIndex(x => x == newEntry);
int index = InsertEntrySafe((byte)levelNumericUpDown.Value, (ushort)moveInputComboBox.SelectedIndex);
if (index < 0) {
return; // Insertion failed, likely due to invalid entry
}
UpdateMovesListFromFile();
movesListBox.SelectedIndex = index;
UpdateAddEditStatus();
setDirty(true);
SetDirty(true);
}
private void deleteMoveButton_Click(object sender, EventArgs e) {
if (currentLoadedFile == null) {
return;
}
int sel = movesListBox.SelectedIndex;
if (sel < 0) {
return;
}
if (editMode) {
if (editMode)
{
editMode = false;
movesListBox.Enabled = true;
UpdateButtonsOnMoveSelection();
} else {
}
else
{
currentLoadedFile.list.RemoveAt(sel);
movesListBox.Items.RemoveAt(sel);
@@ -254,7 +453,7 @@ namespace DSPRE {
UpdateByEditMode();
UpdateAddEditStatus();
setDirty(true);
SetDirty(true);
}
private void editMoveButton_Click(object sender, EventArgs e) {
@@ -268,16 +467,19 @@ namespace DSPRE {
int newSelection;
int oldLevel = currentLoadedFile.list[sel].level;
currentLoadedFile.list[sel] = newEntry;
if (newEntry.level == oldLevel) {
if (newEntry.level == oldLevel)
{
currentLoadedFile.list[sel] = newEntry;
movesListBox.Items[sel] = ElemToString(newEntry);
newSelection = sel;
} else {
currentLoadedFile.list.Sort();
PopulateAllFromCurrentFile();
newSelection = currentLoadedFile.list.FindIndex(x => x == newEntry);
}
else
{
currentLoadedFile.list.RemoveAt(sel);
newSelection = InsertEntrySafe(newEntry.level, newEntry.move);
UpdateMovesListFromFile();
}
UpdateEntryCountLabel();
movesListBox.SelectedIndex = newSelection;
@@ -286,6 +488,8 @@ namespace DSPRE {
} else {
editMode = true;
movesListBox.Enabled = false;
moveUpButton.Enabled = false;
moveDownButton.Enabled = false;
editMoveButton.Text = editButtonNames[1];
deleteMoveButton.Text = deleteButtonNames[1];
@@ -296,50 +500,39 @@ namespace DSPRE {
}
UpdateByEditMode();
addMoveButton.Enabled = (editMode == false && CheckValidEntry());
setDirty(true);
}
private void UpdateByEditMode() {
UpdateButtonNames(editMode);
}
private void UpdateButtonNames(bool editMode) {
int index = editMode == false ? 0 : 1;
editMoveButton.Text = editButtonNames[index];
deleteMoveButton.Text = deleteButtonNames[index];
UpdateAddEditStatus();
SetDirty(true);
}
private void movesListBox_SelectedIndexChanged(object sender, EventArgs e) {
UpdateButtonsOnMoveSelection();
}
private void UpdateButtonsOnMoveSelection() {
private void moveUpButton_Click(object sender, EventArgs e)
{
int sel = movesListBox.SelectedIndex;
if (sel < 0) {
editMoveButton.Enabled = false;
deleteMoveButton.Enabled = false;
if (!ShiftEntry(sel, -1))
{
return;
}
editMoveButton.Enabled = true;
deleteMoveButton.Enabled = true;
UpdateMovesListFromFile();
movesListBox.SelectedIndex = sel-1;
SetDirty(true);
}
private void UpdateEntryCountLabel(){
StringBuilder labelText = new StringBuilder("Entry Count: ");
labelText.Append(movesListBox.Items.Count);
if (movesListBox.Items.Count > LearnsetData.VanillaLimit) {
labelText.Append("!");
entryCountLabel.ForeColor = Color.FromArgb(210, 120, 0);
entryCountLabel.Font = new Font(entryCountLabel.Font, FontStyle.Bold);
} else {
entryCountLabel.ForeColor = Color.Black;
entryCountLabel.Font = new Font(entryCountLabel.Font, FontStyle.Regular);
private void moveDownButton_Click(object sender, EventArgs e)
{
int sel = movesListBox.SelectedIndex;
if (!ShiftEntry(sel, 1))
{
return;
}
entryCountLabel.Text = labelText.ToString();
UpdateMovesListFromFile();
movesListBox.SelectedIndex = sel+1;
SetDirty(true);
}
#endregion
}
}

View File

@@ -81,11 +81,11 @@
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel9 = new System.Windows.Forms.TableLayoutPanel();
this.eggStepsNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.label21 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.eggGroup1Label = new System.Windows.Forms.Label();
this.eggGroup2Label = new System.Windows.Forms.Label();
this.eggGroup1InputCombobox = new DSPRE.InputComboBox();
this.eggGroup2InputCombobox = new DSPRE.InputComboBox();
this.label23 = new System.Windows.Forms.Label();
this.hatchStepsLabel = new System.Windows.Forms.Label();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel8 = new System.Windows.Forms.TableLayoutPanel();
this.dexColorInputComboBox = new DSPRE.InputComboBox();
@@ -118,6 +118,8 @@
this.type2InputComboBox = new DSPRE.InputComboBox();
this.type1InputComboBox = new DSPRE.InputComboBox();
this.pokemonNameInputComboBox = new DSPRE.InputComboBox();
this.hatchResultLabel = new System.Windows.Forms.Label();
this.hatchResultComboBox = new DSPRE.InputComboBox();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pokemonPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.monNumberNumericUpDown)).BeginInit();
@@ -922,30 +924,34 @@
//
this.tableLayoutPanel9.ColumnCount = 1;
this.tableLayoutPanel9.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel9.Controls.Add(this.hatchResultLabel, 0, 6);
this.tableLayoutPanel9.Controls.Add(this.eggStepsNumericUpDown, 0, 5);
this.tableLayoutPanel9.Controls.Add(this.label21, 0, 0);
this.tableLayoutPanel9.Controls.Add(this.label22, 0, 2);
this.tableLayoutPanel9.Controls.Add(this.eggGroup1Label, 0, 0);
this.tableLayoutPanel9.Controls.Add(this.eggGroup2Label, 0, 2);
this.tableLayoutPanel9.Controls.Add(this.eggGroup1InputCombobox, 0, 1);
this.tableLayoutPanel9.Controls.Add(this.eggGroup2InputCombobox, 0, 3);
this.tableLayoutPanel9.Controls.Add(this.label23, 0, 4);
this.tableLayoutPanel9.Controls.Add(this.hatchStepsLabel, 0, 4);
this.tableLayoutPanel9.Controls.Add(this.hatchResultComboBox, 0, 7);
this.tableLayoutPanel9.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel9.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel9.Name = "tableLayoutPanel9";
this.tableLayoutPanel9.Padding = new System.Windows.Forms.Padding(5);
this.tableLayoutPanel9.RowCount = 6;
this.tableLayoutPanel9.RowCount = 8;
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.06265F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.06265F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.06265F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel9.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 24.81203F));
this.tableLayoutPanel9.Size = new System.Drawing.Size(120, 231);
this.tableLayoutPanel9.TabIndex = 23;
//
// eggStepsNumericUpDown
//
this.eggStepsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.eggStepsNumericUpDown.Location = new System.Drawing.Point(8, 188);
this.eggStepsNumericUpDown.Location = new System.Drawing.Point(8, 142);
this.eggStepsNumericUpDown.Maximum = new decimal(new int[] {
255,
0,
@@ -956,25 +962,25 @@
this.eggStepsNumericUpDown.TabIndex = 18;
this.eggStepsNumericUpDown.ValueChanged += new System.EventHandler(this.eggStepsNumericUpDown_ValueChanged);
//
// label21
// eggGroup1Label
//
this.label21.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(8, 8);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(104, 13);
this.label21.TabIndex = 13;
this.label21.Text = "Group 1";
this.eggGroup1Label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.eggGroup1Label.AutoSize = true;
this.eggGroup1Label.Location = new System.Drawing.Point(8, 8);
this.eggGroup1Label.Name = "eggGroup1Label";
this.eggGroup1Label.Size = new System.Drawing.Size(104, 13);
this.eggGroup1Label.TabIndex = 13;
this.eggGroup1Label.Text = "Group 1";
//
// label22
// eggGroup2Label
//
this.label22.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(8, 81);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(104, 13);
this.label22.TabIndex = 14;
this.label22.Text = "Group 2";
this.eggGroup2Label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.eggGroup2Label.AutoSize = true;
this.eggGroup2Label.Location = new System.Drawing.Point(8, 63);
this.eggGroup2Label.Name = "eggGroup2Label";
this.eggGroup2Label.Size = new System.Drawing.Size(104, 13);
this.eggGroup2Label.TabIndex = 14;
this.eggGroup2Label.Text = "Group 2";
//
// eggGroup1InputCombobox
//
@@ -982,7 +988,7 @@
this.eggGroup1InputCombobox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.eggGroup1InputCombobox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.eggGroup1InputCombobox.FormattingEnabled = true;
this.eggGroup1InputCombobox.Location = new System.Drawing.Point(8, 41);
this.eggGroup1InputCombobox.Location = new System.Drawing.Point(8, 32);
this.eggGroup1InputCombobox.Name = "eggGroup1InputCombobox";
this.eggGroup1InputCombobox.Size = new System.Drawing.Size(104, 21);
this.eggGroup1InputCombobox.TabIndex = 15;
@@ -994,21 +1000,21 @@
this.eggGroup2InputCombobox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.eggGroup2InputCombobox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.eggGroup2InputCombobox.FormattingEnabled = true;
this.eggGroup2InputCombobox.Location = new System.Drawing.Point(8, 114);
this.eggGroup2InputCombobox.Location = new System.Drawing.Point(8, 87);
this.eggGroup2InputCombobox.Name = "eggGroup2InputCombobox";
this.eggGroup2InputCombobox.Size = new System.Drawing.Size(104, 21);
this.eggGroup2InputCombobox.TabIndex = 16;
this.eggGroup2InputCombobox.SelectedIndexChanged += new System.EventHandler(this.eggGroup2InputCombobox_SelectedIndexChanged);
//
// label23
// hatchStepsLabel
//
this.label23.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(8, 154);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(104, 13);
this.label23.TabIndex = 17;
this.label23.Text = "Hatch Steps";
this.hatchStepsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.hatchStepsLabel.AutoSize = true;
this.hatchStepsLabel.Location = new System.Drawing.Point(8, 118);
this.hatchStepsLabel.Name = "hatchStepsLabel";
this.hatchStepsLabel.Size = new System.Drawing.Size(104, 13);
this.hatchStepsLabel.TabIndex = 17;
this.hatchStepsLabel.Text = "Hatch Steps";
//
// groupBox7
//
@@ -1437,6 +1443,28 @@
this.pokemonNameInputComboBox.TabIndex = 31;
this.pokemonNameInputComboBox.SelectedIndexChanged += new System.EventHandler(this.pokemonNameInputComboBox_SelectedIndexChanged);
//
// hatchResultLabel
//
this.hatchResultLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.hatchResultLabel.AutoSize = true;
this.hatchResultLabel.Location = new System.Drawing.Point(8, 173);
this.hatchResultLabel.Name = "hatchResultLabel";
this.hatchResultLabel.Size = new System.Drawing.Size(104, 13);
this.hatchResultLabel.TabIndex = 19;
this.hatchResultLabel.Text = "Hatch Result";
//
// hatchResultComboBox
//
this.hatchResultComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.hatchResultComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.hatchResultComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.hatchResultComboBox.FormattingEnabled = true;
this.hatchResultComboBox.Location = new System.Drawing.Point(8, 197);
this.hatchResultComboBox.Name = "hatchResultComboBox";
this.hatchResultComboBox.Size = new System.Drawing.Size(104, 21);
this.hatchResultComboBox.TabIndex = 20;
this.hatchResultComboBox.SelectedIndexChanged += new System.EventHandler(this.hatchResultComboBox_SelectedIndexChanged);
//
// PersonalDataEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1560,11 +1588,11 @@
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel9;
private System.Windows.Forms.NumericUpDown eggStepsNumericUpDown;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label eggGroup1Label;
private System.Windows.Forms.Label eggGroup2Label;
private InputComboBox eggGroup1InputCombobox;
private InputComboBox eggGroup2InputCombobox;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label hatchStepsLabel;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel8;
private InputComboBox dexColorInputComboBox;
@@ -1605,5 +1633,7 @@
private InputComboBox type1InputComboBox;
public InputComboBox pokemonNameInputComboBox;
public System.Windows.Forms.NumericUpDown monNumberNumericUpDown;
private System.Windows.Forms.Label hatchResultLabel;
private InputComboBox hatchResultComboBox;
}
}

View File

@@ -3,6 +3,7 @@ using DSPRE.ROMFiles;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Forms;
@@ -17,7 +18,7 @@ namespace DSPRE {
private int currentLoadedId = 0;
private PokemonPersonalData currentLoadedFile = null;
private static bool dirty = false;
public bool dirty = false;
private bool modifiedAbilities = false;
private static readonly string formName = "Personal Data Editor";
@@ -72,6 +73,7 @@ namespace DSPRE {
this.fileNames = fileNames.ToArray();
monNumberNumericUpDown.Maximum = fileNames.Count - 1;
pokemonNameInputComboBox.Items.AddRange(this.fileNames);
hatchResultComboBox.DataSource = fileNames.ToArray();
/* ---------------- */
Helpers.EnableHandlers();
@@ -87,6 +89,7 @@ namespace DSPRE {
dirty = false;
this.Text = formName;
}
_parent.UpdateTabPageNames();
}
private void baseHpNumericUpDown_ValueChanged(object sender, EventArgs e) {
if (Helpers.HandlersDisabled) {
@@ -398,6 +401,7 @@ namespace DSPRE {
}
private void saveDataButton_Click(object sender, EventArgs e) {
currentLoadedFile.SaveToFileDefaultDir(currentLoadedId, true);
WriteHatchResult(currentLoadedId);
//if (modifiedAbilities) {
// EditorPanels.MainProgram.RefreshAbilities(currentLoadedId);
// modifiedAbilities = false;
@@ -452,6 +456,18 @@ namespace DSPRE {
Helpers.EnableHandlers();
}
private void hatchResultComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
setDirty(true);
}
public void ChangeLoadedFile(int toLoad) {
currentLoadedId = toLoad;
currentLoadedFile = new PokemonPersonalData(currentLoadedId);
@@ -486,6 +502,7 @@ namespace DSPRE {
eggGroup1InputCombobox.SelectedIndex = currentLoadedFile.eggGroup1;
eggGroup2InputCombobox.SelectedIndex = currentLoadedFile.eggGroup2;
hatchResultComboBox.SelectedIndex = GetHatchResult(currentLoadedId);
ability1InputComboBox.SelectedIndex = currentLoadedFile.firstAbility;
ability2InputComboBox.SelectedIndex = currentLoadedFile.secondAbility;
@@ -554,6 +571,50 @@ namespace DSPRE {
}
}
private int GetHatchResult(int monID)
{
if (monID < 0) {
return 0;
}
// Open PMS file to find the hatch result
// This isn't a narc despite the name, it's a binary file. It's also in the same location for all games and languages.
FileStream stream = new FileStream(Path.Combine(RomInfo.dataPath, @"poketool/personal/pms.narc"), FileMode.Open);
using (BinaryReader reader = new BinaryReader(stream))
{
// Each entry is 2 bytes long
int offset = monID * 2;
if (offset + 1 > stream.Length) {
return 0; // Out of bounds
}
stream.Seek(offset, SeekOrigin.Begin);
ushort hatchResult = reader.ReadUInt16();
stream.Close();
return hatchResult;
}
}
private void WriteHatchResult(int monID) {
if (monID < 0) {
return;
}
// Open PMS file to write the hatch result
FileStream stream = new FileStream(Path.Combine(RomInfo.dataPath, @"poketool/personal/pms.narc"), FileMode.Open);
using (BinaryWriter writer = new BinaryWriter(stream))
{
// Each entry is 2 bytes long
int offset = monID * 2;
if (offset + 1 > stream.Length)
{
return; // Out of bounds
}
stream.Seek(offset, SeekOrigin.Begin);
writer.Write((ushort)hatchResultComboBox.SelectedIndex);
stream.Close();
}
}
private static string MachineNameFromZeroBasedIndex(int n) {
//0-91 --> TMs
//>=92 --> HM

View File

@@ -33,6 +33,7 @@
this.syncChangesCheckbox = new System.Windows.Forms.CheckBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.FormClosing += PokemonEditor_FormClosing;
this.tabControl.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();

View File

@@ -106,5 +106,37 @@ namespace DSPRE {
}
Helpers.RestoreDisableHandler();
}
public void UpdateTabPageNames()
{
if (personalEditor == null || learnsetEditor == null || evoEditor == null)
{
return;
}
personalPage.Text = personalEditor.Text;
learnsetPage.Text = learnsetEditor.Text;
evoPage.Text = evoEditor.Text;
}
private void PokemonEditor_FormClosing(object sender, FormClosingEventArgs e)
{
if (personalEditor == null || learnsetEditor == null || evoEditor == null)
{
return;
}
if (personalEditor.dirty || learnsetEditor.dirty || evoEditor.dirty)
{
DialogResult result = MessageBox.Show("There are unsaved changes. Closing the editor will discard them!", "Unsaved Changes", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
if (result != DialogResult.OK)
{
e.Cancel = true;
return;
}
}
}
}
}

View File

@@ -0,0 +1,364 @@
using DSPRE.Editors.Utils;
using System.Drawing;
using System.Windows.Forms;
using static DSPRE.RomInfo;
namespace DSPRE.Editors
{
partial class PokemonSpriteEditor
{
private System.ComponentModel.IContainer components = null;
private ComboBox IndexBox;
private ComboBox SaveBox;
private ComboBox BasePalette;
private ComboBox ShinyPalette;
private Button OpenPngs;
private Button LoadSheet;
private Button SaveSingle;
private Button MakeShiny;
private Button OpenOther;
private Button SaveChanges;
private Label lblMale;
private Label lblFemale;
private Label BackN;
private Label BackS;
private Label FrontN;
private Label FrontS;
private Label lblNormal;
private Label lblShiny;
private void InitializeComponent()
{
this.OpenPngs = new System.Windows.Forms.Button();
this.LoadSheet = new System.Windows.Forms.Button();
this.SaveSingle = new System.Windows.Forms.Button();
this.MakeShiny = new System.Windows.Forms.Button();
this.OpenOther = new System.Windows.Forms.Button();
this.SaveChanges = new System.Windows.Forms.Button();
this.lblMale = new System.Windows.Forms.Label();
this.lblFemale = new System.Windows.Forms.Label();
this.BackN = new System.Windows.Forms.Label();
this.BackS = new System.Windows.Forms.Label();
this.FrontN = new System.Windows.Forms.Label();
this.FrontS = new System.Windows.Forms.Label();
this.lblNormal = new System.Windows.Forms.Label();
this.lblShiny = new System.Windows.Forms.Label();
this.IndexBox = new System.Windows.Forms.ComboBox();
this.BasePalette = new System.Windows.Forms.ComboBox();
this.ShinyPalette = new System.Windows.Forms.ComboBox();
this.SaveBox = new System.Windows.Forms.ComboBox();
this.femaleBackNormalPic = new System.Windows.Forms.PictureBox();
this.maleBackNormalPic = new System.Windows.Forms.PictureBox();
this.femaleFrontNormalPic = new System.Windows.Forms.PictureBox();
this.maleFrontNormalPic = new System.Windows.Forms.PictureBox();
this.maleBackShinyPic = new System.Windows.Forms.PictureBox();
this.femaleBackShinyPic = new System.Windows.Forms.PictureBox();
this.maleFrontShinyPic = new System.Windows.Forms.PictureBox();
this.femaleFrontShinyPic = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.femaleBackNormalPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maleBackNormalPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.femaleFrontNormalPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maleFrontNormalPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maleBackShinyPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.femaleBackShinyPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maleFrontShinyPic)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.femaleFrontShinyPic)).BeginInit();
this.SuspendLayout();
//
// OpenPngs
//
this.OpenPngs.Enabled = false;
this.OpenPngs.Location = new System.Drawing.Point(475, 8);
this.OpenPngs.Name = "OpenPngs";
this.OpenPngs.Size = new System.Drawing.Size(100, 25);
this.OpenPngs.TabIndex = 3;
this.OpenPngs.Text = "Load Sprite Set";
//
// LoadSheet
//
this.LoadSheet.Location = new System.Drawing.Point(369, 8);
this.LoadSheet.Name = "LoadSheet";
this.LoadSheet.Size = new System.Drawing.Size(100, 25);
this.LoadSheet.TabIndex = 9;
this.LoadSheet.Text = "Load Sprite Sheet";
this.LoadSheet.Click += new System.EventHandler(this.btnLoadSheet_Click);
//
// SaveSingle
//
this.SaveSingle.Location = new System.Drawing.Point(674, 728);
this.SaveSingle.Name = "SaveSingle";
this.SaveSingle.Size = new System.Drawing.Size(70, 21);
this.SaveSingle.TabIndex = 10;
this.SaveSingle.Text = "Save PNG";
this.SaveSingle.Click += new System.EventHandler(this.SaveSingle_Click);
//
// MakeShiny
//
this.MakeShiny.Location = new System.Drawing.Point(12, 728);
this.MakeShiny.Name = "MakeShiny";
this.MakeShiny.Size = new System.Drawing.Size(120, 21);
this.MakeShiny.TabIndex = 11;
this.MakeShiny.Text = "Create Shiny Palette";
//
// OpenOther
//
this.OpenOther.Location = new System.Drawing.Point(12, 8);
this.OpenOther.Name = "OpenOther";
this.OpenOther.Size = new System.Drawing.Size(100, 25);
this.OpenOther.TabIndex = 12;
this.OpenOther.Text = "Open Forms";
this.OpenOther.Visible = false;
this.OpenOther.Click += new System.EventHandler(this.btnOpenOther_Click);
//
// SaveChanges
//
this.SaveChanges.Location = new System.Drawing.Point(642, 12);
this.SaveChanges.Name = "SaveChanges";
this.SaveChanges.Size = new System.Drawing.Size(100, 21);
this.SaveChanges.TabIndex = 13;
this.SaveChanges.Text = "Save Changes";
this.SaveChanges.Click += new System.EventHandler(this.SaveChanges_Click);
//
// lblMale
//
this.lblMale.Location = new System.Drawing.Point(564, 36);
this.lblMale.Name = "lblMale";
this.lblMale.Size = new System.Drawing.Size(100, 23);
this.lblMale.TabIndex = 1;
this.lblMale.Text = "Male";
//
// lblFemale
//
this.lblFemale.Location = new System.Drawing.Point(232, 36);
this.lblFemale.Name = "lblFemale";
this.lblFemale.Size = new System.Drawing.Size(100, 23);
this.lblFemale.TabIndex = 0;
this.lblFemale.Text = "Female";
//
// BackN
//
this.BackN.Location = new System.Drawing.Point(52, 126);
this.BackN.Name = "BackN";
this.BackN.Size = new System.Drawing.Size(56, 23);
this.BackN.TabIndex = 2;
this.BackN.Text = "Back";
//
// BackS
//
this.BackS.Location = new System.Drawing.Point(52, 462);
this.BackS.Name = "BackS";
this.BackS.Size = new System.Drawing.Size(56, 23);
this.BackS.TabIndex = 3;
this.BackS.Text = "Back";
//
// FrontN
//
this.FrontN.Location = new System.Drawing.Point(52, 294);
this.FrontN.Name = "FrontN";
this.FrontN.Size = new System.Drawing.Size(56, 23);
this.FrontN.TabIndex = 4;
this.FrontN.Text = "Front";
//
// FrontS
//
this.FrontS.Location = new System.Drawing.Point(52, 630);
this.FrontS.Name = "FrontS";
this.FrontS.Size = new System.Drawing.Size(56, 23);
this.FrontS.TabIndex = 5;
this.FrontS.Text = "Front";
//
// lblNormal
//
this.lblNormal.Location = new System.Drawing.Point(8, 210);
this.lblNormal.Name = "lblNormal";
this.lblNormal.Size = new System.Drawing.Size(100, 23);
this.lblNormal.TabIndex = 6;
this.lblNormal.Text = "Normal";
//
// lblShiny
//
this.lblShiny.Location = new System.Drawing.Point(8, 546);
this.lblShiny.Name = "lblShiny";
this.lblShiny.Size = new System.Drawing.Size(100, 23);
this.lblShiny.TabIndex = 7;
this.lblShiny.Text = "Shiny";
//
// IndexBox
//
this.IndexBox.DropDownWidth = 160;
this.IndexBox.Location = new System.Drawing.Point(172, 8);
this.IndexBox.MaxDropDownItems = 16;
this.IndexBox.Name = "IndexBox";
this.IndexBox.Size = new System.Drawing.Size(160, 21);
this.IndexBox.TabIndex = 6;
this.IndexBox.SelectedIndexChanged += new System.EventHandler(this.IndexBox_SelectedIndexChanged);
//
// BasePalette
//
this.BasePalette.DropDownWidth = 160;
this.BasePalette.Enabled = false;
this.BasePalette.Location = new System.Drawing.Point(138, 728);
this.BasePalette.MaxDropDownItems = 16;
this.BasePalette.Name = "BasePalette";
this.BasePalette.Size = new System.Drawing.Size(160, 21);
this.BasePalette.TabIndex = 6;
this.BasePalette.Visible = false;
this.BasePalette.SelectedIndexChanged += new System.EventHandler(this.BasePalette_SelectedIndexChanged);
//
// ShinyPalette
//
this.ShinyPalette.DropDownWidth = 160;
this.ShinyPalette.Enabled = false;
this.ShinyPalette.Location = new System.Drawing.Point(309, 729);
this.ShinyPalette.MaxDropDownItems = 16;
this.ShinyPalette.Name = "ShinyPalette";
this.ShinyPalette.Size = new System.Drawing.Size(160, 21);
this.ShinyPalette.TabIndex = 6;
this.ShinyPalette.Visible = false;
this.ShinyPalette.SelectedIndexChanged += new System.EventHandler(this.ShinyPalette_SelectedIndexChanged);
//
// SaveBox
//
this.SaveBox.DropDownWidth = 160;
this.SaveBox.Items.AddRange(new object[] {
"Normal Female Backsprite",
"Normal Male Backsprite",
"Normal Female Frontsprite",
"Normal Male Frontprite",
"Shiny Female Backsprite",
"Shiny Male Backsprite",
"Shiny Female Frontsprite",
"Shiny Male Frontprite"});
this.SaveBox.Location = new System.Drawing.Point(512, 728);
this.SaveBox.Name = "SaveBox";
this.SaveBox.Size = new System.Drawing.Size(160, 21);
this.SaveBox.TabIndex = 8;
//
// femaleBackNormalPic
//
this.femaleBackNormalPic.Location = new System.Drawing.Point(96, 64);
this.femaleBackNormalPic.Name = "femaleBackNormalPic";
this.femaleBackNormalPic.Size = new System.Drawing.Size(320, 160);
this.femaleBackNormalPic.TabIndex = 14;
this.femaleBackNormalPic.TabStop = false;
this.femaleBackNormalPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// maleBackNormalPic
//
this.maleBackNormalPic.Location = new System.Drawing.Point(422, 64);
this.maleBackNormalPic.Name = "maleBackNormalPic";
this.maleBackNormalPic.Size = new System.Drawing.Size(320, 160);
this.maleBackNormalPic.TabIndex = 15;
this.maleBackNormalPic.TabStop = false;
this.maleBackNormalPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// femaleFrontNormalPic
//
this.femaleFrontNormalPic.Location = new System.Drawing.Point(96, 230);
this.femaleFrontNormalPic.Name = "femaleFrontNormalPic";
this.femaleFrontNormalPic.Size = new System.Drawing.Size(320, 160);
this.femaleFrontNormalPic.TabIndex = 16;
this.femaleFrontNormalPic.TabStop = false;
this.femaleFrontNormalPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// maleFrontNormalPic
//
this.maleFrontNormalPic.Location = new System.Drawing.Point(422, 230);
this.maleFrontNormalPic.Name = "maleFrontNormalPic";
this.maleFrontNormalPic.Size = new System.Drawing.Size(320, 160);
this.maleFrontNormalPic.TabIndex = 17;
this.maleFrontNormalPic.TabStop = false;
this.maleFrontNormalPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// maleBackShinyPic
//
this.maleBackShinyPic.Location = new System.Drawing.Point(422, 396);
this.maleBackShinyPic.Name = "maleBackShinyPic";
this.maleBackShinyPic.Size = new System.Drawing.Size(320, 160);
this.maleBackShinyPic.TabIndex = 18;
this.maleBackShinyPic.TabStop = false;
this.maleBackShinyPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// femaleBackShinyPic
//
this.femaleBackShinyPic.Location = new System.Drawing.Point(96, 396);
this.femaleBackShinyPic.Name = "femaleBackShinyPic";
this.femaleBackShinyPic.Size = new System.Drawing.Size(320, 160);
this.femaleBackShinyPic.TabIndex = 19;
this.femaleBackShinyPic.TabStop = false;
this.femaleBackShinyPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// maleFrontShinyPic
//
this.maleFrontShinyPic.Location = new System.Drawing.Point(422, 562);
this.maleFrontShinyPic.Name = "maleFrontShinyPic";
this.maleFrontShinyPic.Size = new System.Drawing.Size(320, 160);
this.maleFrontShinyPic.TabIndex = 20;
this.maleFrontShinyPic.TabStop = false;
this.maleFrontShinyPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// femaleFrontShinyPic
//
this.femaleFrontShinyPic.Location = new System.Drawing.Point(96, 562);
this.femaleFrontShinyPic.Name = "femaleFrontShinyPic";
this.femaleFrontShinyPic.Size = new System.Drawing.Size(320, 160);
this.femaleFrontShinyPic.TabIndex = 21;
this.femaleFrontShinyPic.TabStop = false;
this.femaleFrontShinyPic.Click += new System.EventHandler(this.Picturebox_Click);
//
// PokemonSpriteEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(763, 761);
this.Controls.Add(this.femaleFrontShinyPic);
this.Controls.Add(this.maleFrontShinyPic);
this.Controls.Add(this.femaleBackShinyPic);
this.Controls.Add(this.maleBackShinyPic);
this.Controls.Add(this.maleFrontNormalPic);
this.Controls.Add(this.femaleFrontNormalPic);
this.Controls.Add(this.maleBackNormalPic);
this.Controls.Add(this.femaleBackNormalPic);
this.Controls.Add(this.lblFemale);
this.Controls.Add(this.lblMale);
this.Controls.Add(this.BackN);
this.Controls.Add(this.BackS);
this.Controls.Add(this.FrontN);
this.Controls.Add(this.FrontS);
this.Controls.Add(this.lblNormal);
this.Controls.Add(this.lblShiny);
this.Controls.Add(this.IndexBox);
this.Controls.Add(this.BasePalette);
this.Controls.Add(this.ShinyPalette);
this.Controls.Add(this.SaveBox);
this.Controls.Add(this.OpenPngs);
this.Controls.Add(this.LoadSheet);
this.Controls.Add(this.SaveSingle);
this.Controls.Add(this.MakeShiny);
this.Controls.Add(this.OpenOther);
this.Controls.Add(this.SaveChanges);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "PokemonSpriteEditor";
((System.ComponentModel.ISupportInitialize)(this.femaleBackNormalPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maleBackNormalPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.femaleFrontNormalPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maleFrontNormalPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maleBackShinyPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.femaleBackShinyPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maleFrontShinyPic)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.femaleFrontShinyPic)).EndInit();
this.ResumeLayout(false);
}
private PictureBox femaleBackNormalPic;
private PictureBox maleBackNormalPic;
private PictureBox femaleFrontNormalPic;
private PictureBox maleFrontNormalPic;
private PictureBox maleBackShinyPic;
private PictureBox femaleBackShinyPic;
private PictureBox maleFrontShinyPic;
private PictureBox femaleFrontShinyPic;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -98,6 +98,9 @@ namespace DSPRE.Editors
populate_selectScriptFileComboBox(0);
UpdateScriptNumberCheckBox((NumberStyles)SettingsManager.Settings.scriptEditorFormatPreference);
Helpers.statusLabelMessage();
ScriptDatabase.InitializePokemonNames();
ScriptDatabase.InitializeItemNames();
ScriptDatabase.InitializeMoveNames();
}
public void OpenScriptEditor(MainProgram parent, int scriptFileID)
{
@@ -116,6 +119,9 @@ namespace DSPRE.Editors
secondaryKeyWords = String.Join(" ", RomInfo.ScriptComparisonOperatorsDict.Values) +
" " + String.Join(" ", ScriptDatabase.specialOverworlds.Values) +
" " + String.Join(" ", ScriptDatabase.overworldDirections.Values) +
" " + String.Join(" ", ScriptDatabase.pokemonNames.Values) +
" " + String.Join(" ", ScriptDatabase.itemNames.Values) +
" " + String.Join(" ", ScriptDatabase.moveNames.Values) +
" " + ScriptFile.ContainerTypes.Script.ToString() +
" " + ScriptFile.ContainerTypes.Function.ToString() +
" " + ScriptFile.ContainerTypes.Action.ToString() +

View File

@@ -21,6 +21,7 @@ namespace DSPRE.Editors
public TextEditor()
{
InitializeComponent();
this.textSearchResultsListBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.textSearchResultsListBox_GoToEntryResult);
}

836
DS_Map/Editors/TradeEditor.Designer.cs generated Normal file
View File

@@ -0,0 +1,836 @@
namespace DSPRE.Editors
{
partial class TradeEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.mainPanel = new System.Windows.Forms.Panel();
this.saveAllButton = new System.Windows.Forms.Button();
this.saveTextDataButton = new System.Windows.Forms.Button();
this.saveTradeButton = new System.Windows.Forms.Button();
this.textDataGroupBox = new System.Windows.Forms.GroupBox();
this.nicknameTextBox = new System.Windows.Forms.TextBox();
this.otNameTextBox = new System.Windows.Forms.TextBox();
this.nicknameLabel = new System.Windows.Forms.Label();
this.otNameLabel = new System.Windows.Forms.Label();
this.tradeDataGroupBox = new System.Windows.Forms.GroupBox();
this.requestedComboBox = new System.Windows.Forms.ComboBox();
this.requestedLabel = new System.Windows.Forms.Label();
this.otGenderComboBox = new System.Windows.Forms.ComboBox();
this.otGenderLabel = new System.Windows.Forms.Label();
this.otIDNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.otIDLabel = new System.Windows.Forms.Label();
this.monDataGroupBox = new System.Windows.Forms.GroupBox();
this.monDataPanel = new System.Windows.Forms.Panel();
this.abilityComboBox = new System.Windows.Forms.ComboBox();
this.abilityLabel = new System.Windows.Forms.Label();
this.unknownNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.unknownLabel = new System.Windows.Forms.Label();
this.pidNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.pidLabel = new System.Windows.Forms.Label();
this.langComboBox = new System.Windows.Forms.ComboBox();
this.langLabel = new System.Windows.Forms.Label();
this.heldItemComboBox = new System.Windows.Forms.ComboBox();
this.heldItemLabel = new System.Windows.Forms.Label();
this.contestGroupBox = new System.Windows.Forms.GroupBox();
this.toughNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.smartNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.cuteNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.beautyNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.coolNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.sheenNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.toughLabel = new System.Windows.Forms.Label();
this.smartLabel = new System.Windows.Forms.Label();
this.cuteLabel = new System.Windows.Forms.Label();
this.beautyLabel = new System.Windows.Forms.Label();
this.coolLabel = new System.Windows.Forms.Label();
this.sheenLabel = new System.Windows.Forms.Label();
this.IVGroupBox = new System.Windows.Forms.GroupBox();
this.speIVNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.spdIVNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.spaIVNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.defIVNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.atkIVNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.hpIVNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.speIVLabel = new System.Windows.Forms.Label();
this.spdIVLabel = new System.Windows.Forms.Label();
this.spaIVLabel = new System.Windows.Forms.Label();
this.defIVLabel = new System.Windows.Forms.Label();
this.atkIVLabel = new System.Windows.Forms.Label();
this.hpIVLabel = new System.Windows.Forms.Label();
this.speciesComboBox = new System.Windows.Forms.ComboBox();
this.speciesLabel = new System.Windows.Forms.Label();
this.tradeIDNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.tradeIDLabel = new System.Windows.Forms.Label();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.addFileButton = new System.Windows.Forms.Button();
this.removeLastButton = new System.Windows.Forms.Button();
this.mainPanel.SuspendLayout();
this.textDataGroupBox.SuspendLayout();
this.tradeDataGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.otIDNumericUpDown)).BeginInit();
this.monDataGroupBox.SuspendLayout();
this.monDataPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.unknownNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pidNumericUpDown)).BeginInit();
this.contestGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.toughNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.smartNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cuteNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.beautyNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.coolNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sheenNumericUpDown)).BeginInit();
this.IVGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.speIVNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spdIVNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.spaIVNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.defIVNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.atkIVNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.hpIVNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tradeIDNumericUpDown)).BeginInit();
this.SuspendLayout();
//
// mainPanel
//
this.mainPanel.Controls.Add(this.removeLastButton);
this.mainPanel.Controls.Add(this.saveAllButton);
this.mainPanel.Controls.Add(this.addFileButton);
this.mainPanel.Controls.Add(this.saveTextDataButton);
this.mainPanel.Controls.Add(this.saveTradeButton);
this.mainPanel.Controls.Add(this.textDataGroupBox);
this.mainPanel.Controls.Add(this.tradeDataGroupBox);
this.mainPanel.Location = new System.Drawing.Point(12, 12);
this.mainPanel.Name = "mainPanel";
this.mainPanel.Size = new System.Drawing.Size(624, 444);
this.mainPanel.TabIndex = 0;
//
// saveAllButton
//
this.saveAllButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.saveAllButton.Image = global::DSPRE.Properties.Resources.saveButton;
this.saveAllButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.saveAllButton.Location = new System.Drawing.Point(470, 389);
this.saveAllButton.Name = "saveAllButton";
this.saveAllButton.Size = new System.Drawing.Size(147, 47);
this.saveAllButton.TabIndex = 6;
this.saveAllButton.Text = "Save All";
this.saveAllButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.saveAllButton.UseVisualStyleBackColor = true;
this.saveAllButton.Click += new System.EventHandler(this.saveAllButton_Click);
//
// saveTextDataButton
//
this.saveTextDataButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.saveTextDataButton.Image = global::DSPRE.Properties.Resources.saveButton;
this.saveTextDataButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.saveTextDataButton.Location = new System.Drawing.Point(479, 142);
this.saveTextDataButton.Name = "saveTextDataButton";
this.saveTextDataButton.Size = new System.Drawing.Size(126, 40);
this.saveTextDataButton.TabIndex = 5;
this.saveTextDataButton.Text = "Save Text Data";
this.saveTextDataButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.saveTextDataButton.UseVisualStyleBackColor = true;
this.saveTextDataButton.Click += new System.EventHandler(this.saveTextDataButton_Click);
//
// saveTradeButton
//
this.saveTradeButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.saveTradeButton.Image = global::DSPRE.Properties.Resources.saveButton;
this.saveTradeButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.saveTradeButton.Location = new System.Drawing.Point(480, 342);
this.saveTradeButton.Name = "saveTradeButton";
this.saveTradeButton.Size = new System.Drawing.Size(126, 40);
this.saveTradeButton.TabIndex = 4;
this.saveTradeButton.Text = "Save Trade Data";
this.saveTradeButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.saveTradeButton.UseVisualStyleBackColor = true;
this.saveTradeButton.Click += new System.EventHandler(this.saveTradeButton_Click);
//
// textDataGroupBox
//
this.textDataGroupBox.Controls.Add(this.nicknameTextBox);
this.textDataGroupBox.Controls.Add(this.otNameTextBox);
this.textDataGroupBox.Controls.Add(this.nicknameLabel);
this.textDataGroupBox.Controls.Add(this.otNameLabel);
this.textDataGroupBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textDataGroupBox.Location = new System.Drawing.Point(470, 3);
this.textDataGroupBox.Name = "textDataGroupBox";
this.textDataGroupBox.Size = new System.Drawing.Size(147, 133);
this.textDataGroupBox.TabIndex = 3;
this.textDataGroupBox.TabStop = false;
this.textDataGroupBox.Text = "Text Data";
//
// nicknameTextBox
//
this.nicknameTextBox.Location = new System.Drawing.Point(9, 100);
this.nicknameTextBox.Name = "nicknameTextBox";
this.nicknameTextBox.Size = new System.Drawing.Size(126, 22);
this.nicknameTextBox.TabIndex = 17;
//
// otNameTextBox
//
this.otNameTextBox.Location = new System.Drawing.Point(9, 46);
this.otNameTextBox.Name = "otNameTextBox";
this.otNameTextBox.Size = new System.Drawing.Size(126, 22);
this.otNameTextBox.TabIndex = 16;
//
// nicknameLabel
//
this.nicknameLabel.AutoSize = true;
this.nicknameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nicknameLabel.Location = new System.Drawing.Point(6, 79);
this.nicknameLabel.Name = "nicknameLabel";
this.nicknameLabel.Size = new System.Drawing.Size(129, 16);
this.nicknameLabel.TabIndex = 15;
this.nicknameLabel.Text = "Pokémon Nickname";
//
// otNameLabel
//
this.otNameLabel.AutoSize = true;
this.otNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.otNameLabel.Location = new System.Drawing.Point(6, 25);
this.otNameLabel.Name = "otNameLabel";
this.otNameLabel.Size = new System.Drawing.Size(66, 16);
this.otNameLabel.TabIndex = 13;
this.otNameLabel.Text = "OT Name";
//
// tradeDataGroupBox
//
this.tradeDataGroupBox.Controls.Add(this.requestedComboBox);
this.tradeDataGroupBox.Controls.Add(this.requestedLabel);
this.tradeDataGroupBox.Controls.Add(this.otGenderComboBox);
this.tradeDataGroupBox.Controls.Add(this.otGenderLabel);
this.tradeDataGroupBox.Controls.Add(this.otIDNumericUpDown);
this.tradeDataGroupBox.Controls.Add(this.otIDLabel);
this.tradeDataGroupBox.Controls.Add(this.monDataGroupBox);
this.tradeDataGroupBox.Controls.Add(this.tradeIDNumericUpDown);
this.tradeDataGroupBox.Controls.Add(this.tradeIDLabel);
this.tradeDataGroupBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tradeDataGroupBox.Location = new System.Drawing.Point(3, 3);
this.tradeDataGroupBox.Name = "tradeDataGroupBox";
this.tradeDataGroupBox.Size = new System.Drawing.Size(461, 437);
this.tradeDataGroupBox.TabIndex = 2;
this.tradeDataGroupBox.TabStop = false;
this.tradeDataGroupBox.Text = "Trade Data";
//
// requestedComboBox
//
this.requestedComboBox.FormattingEnabled = true;
this.requestedComboBox.Location = new System.Drawing.Point(165, 44);
this.requestedComboBox.Name = "requestedComboBox";
this.requestedComboBox.Size = new System.Drawing.Size(150, 24);
this.requestedComboBox.TabIndex = 12;
//
// requestedLabel
//
this.requestedLabel.AutoSize = true;
this.requestedLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.requestedLabel.Location = new System.Drawing.Point(162, 25);
this.requestedLabel.Name = "requestedLabel";
this.requestedLabel.Size = new System.Drawing.Size(135, 16);
this.requestedLabel.TabIndex = 11;
this.requestedLabel.Text = "Requested Pokémon";
//
// otGenderComboBox
//
this.otGenderComboBox.FormattingEnabled = true;
this.otGenderComboBox.Location = new System.Drawing.Point(165, 98);
this.otGenderComboBox.Name = "otGenderComboBox";
this.otGenderComboBox.Size = new System.Drawing.Size(150, 24);
this.otGenderComboBox.TabIndex = 10;
//
// otGenderLabel
//
this.otGenderLabel.AutoSize = true;
this.otGenderLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.otGenderLabel.Location = new System.Drawing.Point(162, 79);
this.otGenderLabel.Name = "otGenderLabel";
this.otGenderLabel.Size = new System.Drawing.Size(74, 16);
this.otGenderLabel.TabIndex = 9;
this.otGenderLabel.Text = "OT Gender";
//
// otIDNumericUpDown
//
this.otIDNumericUpDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.otIDNumericUpDown.Location = new System.Drawing.Point(21, 98);
this.otIDNumericUpDown.Name = "otIDNumericUpDown";
this.otIDNumericUpDown.Size = new System.Drawing.Size(120, 22);
this.otIDNumericUpDown.TabIndex = 6;
//
// otIDLabel
//
this.otIDLabel.AutoSize = true;
this.otIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.otIDLabel.Location = new System.Drawing.Point(18, 79);
this.otIDLabel.Name = "otIDLabel";
this.otIDLabel.Size = new System.Drawing.Size(42, 16);
this.otIDLabel.TabIndex = 7;
this.otIDLabel.Text = "OT ID";
//
// monDataGroupBox
//
this.monDataGroupBox.Controls.Add(this.monDataPanel);
this.monDataGroupBox.Location = new System.Drawing.Point(9, 139);
this.monDataGroupBox.Name = "monDataGroupBox";
this.monDataGroupBox.Size = new System.Drawing.Size(441, 288);
this.monDataGroupBox.TabIndex = 5;
this.monDataGroupBox.TabStop = false;
this.monDataGroupBox.Text = "Pokémon Data";
//
// monDataPanel
//
this.monDataPanel.Controls.Add(this.abilityComboBox);
this.monDataPanel.Controls.Add(this.abilityLabel);
this.monDataPanel.Controls.Add(this.unknownNumericUpDown);
this.monDataPanel.Controls.Add(this.unknownLabel);
this.monDataPanel.Controls.Add(this.pidNumericUpDown);
this.monDataPanel.Controls.Add(this.pidLabel);
this.monDataPanel.Controls.Add(this.langComboBox);
this.monDataPanel.Controls.Add(this.langLabel);
this.monDataPanel.Controls.Add(this.heldItemComboBox);
this.monDataPanel.Controls.Add(this.heldItemLabel);
this.monDataPanel.Controls.Add(this.contestGroupBox);
this.monDataPanel.Controls.Add(this.IVGroupBox);
this.monDataPanel.Controls.Add(this.speciesComboBox);
this.monDataPanel.Controls.Add(this.speciesLabel);
this.monDataPanel.Location = new System.Drawing.Point(6, 21);
this.monDataPanel.Name = "monDataPanel";
this.monDataPanel.Size = new System.Drawing.Size(418, 257);
this.monDataPanel.TabIndex = 4;
//
// abilityComboBox
//
this.abilityComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.abilityComboBox.FormattingEnabled = true;
this.abilityComboBox.Location = new System.Drawing.Point(6, 218);
this.abilityComboBox.Name = "abilityComboBox";
this.abilityComboBox.Size = new System.Drawing.Size(147, 24);
this.abilityComboBox.TabIndex = 26;
//
// abilityLabel
//
this.abilityLabel.AutoSize = true;
this.abilityLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.abilityLabel.Location = new System.Drawing.Point(3, 198);
this.abilityLabel.Name = "abilityLabel";
this.abilityLabel.Size = new System.Drawing.Size(101, 16);
this.abilityLabel.TabIndex = 27;
this.abilityLabel.Text = "Ability (Unused)";
//
// unknownNumericUpDown
//
this.unknownNumericUpDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.unknownNumericUpDown.Location = new System.Drawing.Point(294, 220);
this.unknownNumericUpDown.Name = "unknownNumericUpDown";
this.unknownNumericUpDown.Size = new System.Drawing.Size(111, 22);
this.unknownNumericUpDown.TabIndex = 24;
//
// unknownLabel
//
this.unknownLabel.AutoSize = true;
this.unknownLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.unknownLabel.Location = new System.Drawing.Point(291, 201);
this.unknownLabel.Name = "unknownLabel";
this.unknownLabel.Size = new System.Drawing.Size(100, 16);
this.unknownLabel.TabIndex = 25;
this.unknownLabel.Text = "Unknown Value";
//
// pidNumericUpDown
//
this.pidNumericUpDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.pidNumericUpDown.Location = new System.Drawing.Point(169, 220);
this.pidNumericUpDown.Name = "pidNumericUpDown";
this.pidNumericUpDown.Size = new System.Drawing.Size(111, 22);
this.pidNumericUpDown.TabIndex = 11;
//
// pidLabel
//
this.pidLabel.AutoSize = true;
this.pidLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.pidLabel.Location = new System.Drawing.Point(166, 201);
this.pidLabel.Name = "pidLabel";
this.pidLabel.Size = new System.Drawing.Size(29, 16);
this.pidLabel.TabIndex = 23;
this.pidLabel.Text = "PID";
//
// langComboBox
//
this.langComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.langComboBox.FormattingEnabled = true;
this.langComboBox.Location = new System.Drawing.Point(6, 166);
this.langComboBox.Name = "langComboBox";
this.langComboBox.Size = new System.Drawing.Size(147, 24);
this.langComboBox.TabIndex = 20;
//
// langLabel
//
this.langLabel.AutoSize = true;
this.langLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.langLabel.Location = new System.Drawing.Point(3, 146);
this.langLabel.Name = "langLabel";
this.langLabel.Size = new System.Drawing.Size(106, 16);
this.langLabel.TabIndex = 21;
this.langLabel.Text = "Origin Language";
//
// heldItemComboBox
//
this.heldItemComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.heldItemComboBox.FormattingEnabled = true;
this.heldItemComboBox.Location = new System.Drawing.Point(6, 98);
this.heldItemComboBox.Name = "heldItemComboBox";
this.heldItemComboBox.Size = new System.Drawing.Size(147, 24);
this.heldItemComboBox.TabIndex = 18;
//
// heldItemLabel
//
this.heldItemLabel.AutoSize = true;
this.heldItemLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.heldItemLabel.Location = new System.Drawing.Point(3, 78);
this.heldItemLabel.Name = "heldItemLabel";
this.heldItemLabel.Size = new System.Drawing.Size(64, 16);
this.heldItemLabel.TabIndex = 19;
this.heldItemLabel.Text = "Held Item";
//
// contestGroupBox
//
this.contestGroupBox.Controls.Add(this.toughNumericUpDown);
this.contestGroupBox.Controls.Add(this.smartNumericUpDown);
this.contestGroupBox.Controls.Add(this.cuteNumericUpDown);
this.contestGroupBox.Controls.Add(this.beautyNumericUpDown);
this.contestGroupBox.Controls.Add(this.coolNumericUpDown);
this.contestGroupBox.Controls.Add(this.sheenNumericUpDown);
this.contestGroupBox.Controls.Add(this.toughLabel);
this.contestGroupBox.Controls.Add(this.smartLabel);
this.contestGroupBox.Controls.Add(this.cuteLabel);
this.contestGroupBox.Controls.Add(this.beautyLabel);
this.contestGroupBox.Controls.Add(this.coolLabel);
this.contestGroupBox.Controls.Add(this.sheenLabel);
this.contestGroupBox.Location = new System.Drawing.Point(285, 10);
this.contestGroupBox.Name = "contestGroupBox";
this.contestGroupBox.Size = new System.Drawing.Size(120, 180);
this.contestGroupBox.TabIndex = 17;
this.contestGroupBox.TabStop = false;
this.contestGroupBox.Text = "Contest Stats";
//
// toughNumericUpDown
//
this.toughNumericUpDown.Location = new System.Drawing.Point(64, 148);
this.toughNumericUpDown.Name = "toughNumericUpDown";
this.toughNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.toughNumericUpDown.TabIndex = 16;
//
// smartNumericUpDown
//
this.smartNumericUpDown.Location = new System.Drawing.Point(64, 123);
this.smartNumericUpDown.Name = "smartNumericUpDown";
this.smartNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.smartNumericUpDown.TabIndex = 15;
//
// cuteNumericUpDown
//
this.cuteNumericUpDown.Location = new System.Drawing.Point(64, 97);
this.cuteNumericUpDown.Name = "cuteNumericUpDown";
this.cuteNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.cuteNumericUpDown.TabIndex = 14;
//
// beautyNumericUpDown
//
this.beautyNumericUpDown.Location = new System.Drawing.Point(64, 72);
this.beautyNumericUpDown.Name = "beautyNumericUpDown";
this.beautyNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.beautyNumericUpDown.TabIndex = 13;
//
// coolNumericUpDown
//
this.coolNumericUpDown.Location = new System.Drawing.Point(64, 47);
this.coolNumericUpDown.Name = "coolNumericUpDown";
this.coolNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.coolNumericUpDown.TabIndex = 12;
//
// sheenNumericUpDown
//
this.sheenNumericUpDown.Location = new System.Drawing.Point(64, 22);
this.sheenNumericUpDown.Name = "sheenNumericUpDown";
this.sheenNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.sheenNumericUpDown.TabIndex = 11;
//
// toughLabel
//
this.toughLabel.AutoSize = true;
this.toughLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.toughLabel.Location = new System.Drawing.Point(6, 150);
this.toughLabel.Name = "toughLabel";
this.toughLabel.Size = new System.Drawing.Size(46, 16);
this.toughLabel.TabIndex = 10;
this.toughLabel.Text = "Tough";
//
// smartLabel
//
this.smartLabel.AutoSize = true;
this.smartLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.smartLabel.Location = new System.Drawing.Point(6, 125);
this.smartLabel.Name = "smartLabel";
this.smartLabel.Size = new System.Drawing.Size(42, 16);
this.smartLabel.TabIndex = 9;
this.smartLabel.Text = "Smart";
//
// cuteLabel
//
this.cuteLabel.AutoSize = true;
this.cuteLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cuteLabel.Location = new System.Drawing.Point(6, 100);
this.cuteLabel.Name = "cuteLabel";
this.cuteLabel.Size = new System.Drawing.Size(34, 16);
this.cuteLabel.TabIndex = 8;
this.cuteLabel.Text = "Cute";
//
// beautyLabel
//
this.beautyLabel.AutoSize = true;
this.beautyLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.beautyLabel.Location = new System.Drawing.Point(6, 75);
this.beautyLabel.Name = "beautyLabel";
this.beautyLabel.Size = new System.Drawing.Size(49, 16);
this.beautyLabel.TabIndex = 7;
this.beautyLabel.Text = "Beauty";
//
// coolLabel
//
this.coolLabel.AutoSize = true;
this.coolLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.coolLabel.Location = new System.Drawing.Point(6, 50);
this.coolLabel.Name = "coolLabel";
this.coolLabel.Size = new System.Drawing.Size(35, 16);
this.coolLabel.TabIndex = 6;
this.coolLabel.Text = "Cool";
//
// sheenLabel
//
this.sheenLabel.AutoSize = true;
this.sheenLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sheenLabel.Location = new System.Drawing.Point(6, 25);
this.sheenLabel.Name = "sheenLabel";
this.sheenLabel.Size = new System.Drawing.Size(46, 16);
this.sheenLabel.TabIndex = 5;
this.sheenLabel.Text = "Sheen";
//
// IVGroupBox
//
this.IVGroupBox.Controls.Add(this.speIVNumericUpDown);
this.IVGroupBox.Controls.Add(this.spdIVNumericUpDown);
this.IVGroupBox.Controls.Add(this.spaIVNumericUpDown);
this.IVGroupBox.Controls.Add(this.defIVNumericUpDown);
this.IVGroupBox.Controls.Add(this.atkIVNumericUpDown);
this.IVGroupBox.Controls.Add(this.hpIVNumericUpDown);
this.IVGroupBox.Controls.Add(this.speIVLabel);
this.IVGroupBox.Controls.Add(this.spdIVLabel);
this.IVGroupBox.Controls.Add(this.spaIVLabel);
this.IVGroupBox.Controls.Add(this.defIVLabel);
this.IVGroupBox.Controls.Add(this.atkIVLabel);
this.IVGroupBox.Controls.Add(this.hpIVLabel);
this.IVGroupBox.Location = new System.Drawing.Point(160, 10);
this.IVGroupBox.Name = "IVGroupBox";
this.IVGroupBox.Size = new System.Drawing.Size(120, 180);
this.IVGroupBox.TabIndex = 4;
this.IVGroupBox.TabStop = false;
this.IVGroupBox.Text = "IVs";
//
// speIVNumericUpDown
//
this.speIVNumericUpDown.Location = new System.Drawing.Point(50, 148);
this.speIVNumericUpDown.Name = "speIVNumericUpDown";
this.speIVNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.speIVNumericUpDown.TabIndex = 16;
//
// spdIVNumericUpDown
//
this.spdIVNumericUpDown.Location = new System.Drawing.Point(50, 123);
this.spdIVNumericUpDown.Name = "spdIVNumericUpDown";
this.spdIVNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.spdIVNumericUpDown.TabIndex = 15;
//
// spaIVNumericUpDown
//
this.spaIVNumericUpDown.Location = new System.Drawing.Point(50, 97);
this.spaIVNumericUpDown.Name = "spaIVNumericUpDown";
this.spaIVNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.spaIVNumericUpDown.TabIndex = 14;
//
// defIVNumericUpDown
//
this.defIVNumericUpDown.Location = new System.Drawing.Point(50, 72);
this.defIVNumericUpDown.Name = "defIVNumericUpDown";
this.defIVNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.defIVNumericUpDown.TabIndex = 13;
//
// atkIVNumericUpDown
//
this.atkIVNumericUpDown.Location = new System.Drawing.Point(50, 47);
this.atkIVNumericUpDown.Name = "atkIVNumericUpDown";
this.atkIVNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.atkIVNumericUpDown.TabIndex = 12;
//
// hpIVNumericUpDown
//
this.hpIVNumericUpDown.Location = new System.Drawing.Point(50, 22);
this.hpIVNumericUpDown.Name = "hpIVNumericUpDown";
this.hpIVNumericUpDown.Size = new System.Drawing.Size(51, 22);
this.hpIVNumericUpDown.TabIndex = 11;
//
// speIVLabel
//
this.speIVLabel.AutoSize = true;
this.speIVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.speIVLabel.Location = new System.Drawing.Point(6, 150);
this.speIVLabel.Name = "speIVLabel";
this.speIVLabel.Size = new System.Drawing.Size(32, 16);
this.speIVLabel.TabIndex = 10;
this.speIVLabel.Text = "Spe";
//
// spdIVLabel
//
this.spdIVLabel.AutoSize = true;
this.spdIVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.spdIVLabel.Location = new System.Drawing.Point(6, 125);
this.spdIVLabel.Name = "spdIVLabel";
this.spdIVLabel.Size = new System.Drawing.Size(34, 16);
this.spdIVLabel.TabIndex = 9;
this.spdIVLabel.Text = "SpD";
//
// spaIVLabel
//
this.spaIVLabel.AutoSize = true;
this.spaIVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.spaIVLabel.Location = new System.Drawing.Point(6, 100);
this.spaIVLabel.Name = "spaIVLabel";
this.spaIVLabel.Size = new System.Drawing.Size(33, 16);
this.spaIVLabel.TabIndex = 8;
this.spaIVLabel.Text = "SpA";
//
// defIVLabel
//
this.defIVLabel.AutoSize = true;
this.defIVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.defIVLabel.Location = new System.Drawing.Point(6, 75);
this.defIVLabel.Name = "defIVLabel";
this.defIVLabel.Size = new System.Drawing.Size(28, 16);
this.defIVLabel.TabIndex = 7;
this.defIVLabel.Text = "Def";
//
// atkIVLabel
//
this.atkIVLabel.AutoSize = true;
this.atkIVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.atkIVLabel.Location = new System.Drawing.Point(6, 50);
this.atkIVLabel.Name = "atkIVLabel";
this.atkIVLabel.Size = new System.Drawing.Size(26, 16);
this.atkIVLabel.TabIndex = 6;
this.atkIVLabel.Text = "Atk";
//
// hpIVLabel
//
this.hpIVLabel.AutoSize = true;
this.hpIVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hpIVLabel.Location = new System.Drawing.Point(6, 25);
this.hpIVLabel.Name = "hpIVLabel";
this.hpIVLabel.Size = new System.Drawing.Size(26, 16);
this.hpIVLabel.TabIndex = 5;
this.hpIVLabel.Text = "HP";
//
// speciesComboBox
//
this.speciesComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.speciesComboBox.FormattingEnabled = true;
this.speciesComboBox.Location = new System.Drawing.Point(6, 30);
this.speciesComboBox.Name = "speciesComboBox";
this.speciesComboBox.Size = new System.Drawing.Size(147, 24);
this.speciesComboBox.TabIndex = 2;
//
// speciesLabel
//
this.speciesLabel.AutoSize = true;
this.speciesLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.speciesLabel.Location = new System.Drawing.Point(3, 10);
this.speciesLabel.Name = "speciesLabel";
this.speciesLabel.Size = new System.Drawing.Size(57, 16);
this.speciesLabel.TabIndex = 3;
this.speciesLabel.Text = "Species";
//
// tradeIDNumericUpDown
//
this.tradeIDNumericUpDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tradeIDNumericUpDown.Location = new System.Drawing.Point(21, 46);
this.tradeIDNumericUpDown.Name = "tradeIDNumericUpDown";
this.tradeIDNumericUpDown.Size = new System.Drawing.Size(120, 22);
this.tradeIDNumericUpDown.TabIndex = 0;
this.tradeIDNumericUpDown.ValueChanged += new System.EventHandler(this.tradeIDNumericUpDown_ValueChanged);
//
// tradeIDLabel
//
this.tradeIDLabel.AutoSize = true;
this.tradeIDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tradeIDLabel.Location = new System.Drawing.Point(18, 27);
this.tradeIDLabel.Name = "tradeIDLabel";
this.tradeIDLabel.Size = new System.Drawing.Size(60, 16);
this.tradeIDLabel.TabIndex = 1;
this.tradeIDLabel.Text = "Trade ID";
//
// addFileButton
//
this.addFileButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.addFileButton.Image = global::DSPRE.Properties.Resources.addIcon;
this.addFileButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.addFileButton.Location = new System.Drawing.Point(480, 242);
this.addFileButton.Name = "addFileButton";
this.addFileButton.Size = new System.Drawing.Size(126, 40);
this.addFileButton.TabIndex = 13;
this.addFileButton.Text = "Add File";
this.addFileButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.addFileButton.UseVisualStyleBackColor = true;
this.addFileButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// removeLastButton
//
this.removeLastButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.removeLastButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
this.removeLastButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.removeLastButton.Location = new System.Drawing.Point(480, 292);
this.removeLastButton.Name = "removeLastButton";
this.removeLastButton.Size = new System.Drawing.Size(126, 40);
this.removeLastButton.TabIndex = 14;
this.removeLastButton.Text = "Remove Last";
this.removeLastButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.removeLastButton.UseVisualStyleBackColor = true;
this.removeLastButton.Click += new System.EventHandler(this.removeLastButton_Click);
//
// TradeEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(641, 460);
this.Controls.Add(this.mainPanel);
this.Name = "TradeEditor";
this.Text = "TradeEditor";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TradeEditor_FormClosing);
this.mainPanel.ResumeLayout(false);
this.textDataGroupBox.ResumeLayout(false);
this.textDataGroupBox.PerformLayout();
this.tradeDataGroupBox.ResumeLayout(false);
this.tradeDataGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.otIDNumericUpDown)).EndInit();
this.monDataGroupBox.ResumeLayout(false);
this.monDataPanel.ResumeLayout(false);
this.monDataPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.unknownNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pidNumericUpDown)).EndInit();
this.contestGroupBox.ResumeLayout(false);
this.contestGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.toughNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.smartNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cuteNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.beautyNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.coolNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sheenNumericUpDown)).EndInit();
this.IVGroupBox.ResumeLayout(false);
this.IVGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.speIVNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spdIVNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.spaIVNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.defIVNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.atkIVNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.hpIVNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tradeIDNumericUpDown)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel mainPanel;
private System.Windows.Forms.NumericUpDown tradeIDNumericUpDown;
private System.Windows.Forms.Label tradeIDLabel;
private System.Windows.Forms.GroupBox tradeDataGroupBox;
private System.Windows.Forms.GroupBox textDataGroupBox;
private System.Windows.Forms.Label speciesLabel;
private System.Windows.Forms.ComboBox speciesComboBox;
private System.Windows.Forms.Panel monDataPanel;
private System.Windows.Forms.GroupBox IVGroupBox;
private System.Windows.Forms.Label speIVLabel;
private System.Windows.Forms.Label spdIVLabel;
private System.Windows.Forms.Label spaIVLabel;
private System.Windows.Forms.Label defIVLabel;
private System.Windows.Forms.Label atkIVLabel;
private System.Windows.Forms.Label hpIVLabel;
private System.Windows.Forms.NumericUpDown speIVNumericUpDown;
private System.Windows.Forms.NumericUpDown spdIVNumericUpDown;
private System.Windows.Forms.NumericUpDown spaIVNumericUpDown;
private System.Windows.Forms.NumericUpDown defIVNumericUpDown;
private System.Windows.Forms.NumericUpDown atkIVNumericUpDown;
private System.Windows.Forms.NumericUpDown hpIVNumericUpDown;
private System.Windows.Forms.GroupBox contestGroupBox;
private System.Windows.Forms.NumericUpDown toughNumericUpDown;
private System.Windows.Forms.NumericUpDown smartNumericUpDown;
private System.Windows.Forms.NumericUpDown cuteNumericUpDown;
private System.Windows.Forms.NumericUpDown beautyNumericUpDown;
private System.Windows.Forms.NumericUpDown coolNumericUpDown;
private System.Windows.Forms.NumericUpDown sheenNumericUpDown;
private System.Windows.Forms.Label toughLabel;
private System.Windows.Forms.Label smartLabel;
private System.Windows.Forms.Label cuteLabel;
private System.Windows.Forms.Label beautyLabel;
private System.Windows.Forms.Label coolLabel;
private System.Windows.Forms.Label sheenLabel;
private System.Windows.Forms.ComboBox heldItemComboBox;
private System.Windows.Forms.Label heldItemLabel;
private System.Windows.Forms.GroupBox monDataGroupBox;
private System.Windows.Forms.ComboBox langComboBox;
private System.Windows.Forms.Label langLabel;
private System.Windows.Forms.NumericUpDown otIDNumericUpDown;
private System.Windows.Forms.Label otIDLabel;
private System.Windows.Forms.Label otGenderLabel;
private System.Windows.Forms.ComboBox otGenderComboBox;
private System.Windows.Forms.NumericUpDown pidNumericUpDown;
private System.Windows.Forms.Label pidLabel;
private System.Windows.Forms.NumericUpDown unknownNumericUpDown;
private System.Windows.Forms.Label unknownLabel;
private System.Windows.Forms.ComboBox abilityComboBox;
private System.Windows.Forms.Label abilityLabel;
private System.Windows.Forms.ComboBox requestedComboBox;
private System.Windows.Forms.Label requestedLabel;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Button saveTradeButton;
private System.Windows.Forms.TextBox nicknameTextBox;
private System.Windows.Forms.TextBox otNameTextBox;
private System.Windows.Forms.Label nicknameLabel;
private System.Windows.Forms.Label otNameLabel;
private System.Windows.Forms.Button saveTextDataButton;
private System.Windows.Forms.Button saveAllButton;
private System.Windows.Forms.Button addFileButton;
private System.Windows.Forms.Button removeLastButton;
}
}

View File

@@ -0,0 +1,546 @@
using DSPRE.ROMFiles;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DSPRE.Editors
{
public partial class TradeEditor : Form
{
private TradeData curTradeData;
private TextArchive tradeArchive;
// Track if any changes have been made
private bool tradeDirty = false;
private bool textDirty = false;
#region Enums
public enum OriginLang
{
NONE = 0,
JAPANESE = 1,
ENGLISH = 2,
FRENCH = 3,
ITALIAN = 4,
GERMAN = 5,
UNUSED = 6,
SPANISH = 7,
KOREAN = 8
}
#endregion
public TradeEditor()
{
Helpers.DisableHandlers();
AppLogger.Debug("TradeEditor: Initializing Trade Editor.");
InitializeComponent();
InitLimits();
InitDataRanges();
SetToolTips();
RegisterMarkDirtyHandlers();
if (TradeData.GetTradeCount() == 0)
{
MessageBox.Show("No trades could be found! The narc may have failed to unpack.", "Loading Trades Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
AppLogger.Error("TradeEditor: Loading trades failed.");
return;
}
if (RomInfo.gameFamily != RomInfo.GameFamilies.HGSS)
{
unknownNumericUpDown.Enabled = false;
}
// PLAT: Overlay 6, 0x8050-0x8053: dc f5 f0 fb -> 00 00 00 00 to dummy out ASSERT
// Disable buttons until trade expansion is implemented
addFileButton.Enabled = false;
removeLastButton.Enabled = false;
tradeArchive = new TextArchive(GetTextBankIndex());
LoadFromFile(0);
}
private void InitLimits()
{
// IVs: 0-31
hpIVNumericUpDown.Minimum = 0;
hpIVNumericUpDown.Maximum = 31;
atkIVNumericUpDown.Minimum = 0;
atkIVNumericUpDown.Maximum = 31;
defIVNumericUpDown.Minimum = 0;
defIVNumericUpDown.Maximum = 31;
speIVNumericUpDown.Minimum = 0;
speIVNumericUpDown.Maximum = 31;
spaIVNumericUpDown.Minimum = 0;
spaIVNumericUpDown.Maximum = 31;
spdIVNumericUpDown.Minimum = 0;
spdIVNumericUpDown.Maximum = 31;
// Contest stats: 0-255
coolNumericUpDown.Minimum = 0;
coolNumericUpDown.Maximum = 255;
beautyNumericUpDown.Minimum = 0;
beautyNumericUpDown.Maximum = 255;
cuteNumericUpDown.Minimum = 0;
cuteNumericUpDown.Maximum = 255;
smartNumericUpDown.Minimum = 0;
smartNumericUpDown.Maximum = 255;
toughNumericUpDown.Minimum = 0;
toughNumericUpDown.Maximum = 255;
// PID: (32-bit unsigned)
pidNumericUpDown.Minimum = 0;
pidNumericUpDown.Maximum = int.MaxValue;
// Sheen: 0-255
sheenNumericUpDown.Minimum = 0;
sheenNumericUpDown.Maximum = 255;
// Unknown: (32-bit unsigned)
unknownNumericUpDown.Minimum = 0;
unknownNumericUpDown.Maximum = int.MaxValue;
// Trade ID: (dynamic based on loaded data)
tradeIDNumericUpDown.Minimum = 0;
tradeIDNumericUpDown.Maximum = TradeData.GetTradeCount() - 1;
// OT ID: (32-bit unsigned)
otIDNumericUpDown.Minimum = 0;
otIDNumericUpDown.Maximum = int.MaxValue;
// Text fields
otNameTextBox.MaxLength = 7;
nicknameTextBox.MaxLength = 10;
}
private void InitDataRanges()
{
// Species Names
speciesComboBox.DataSource = RomInfo.GetPokemonNames();
speciesComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
requestedComboBox.DataSource = RomInfo.GetPokemonNames();
requestedComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
// Abilities
abilityComboBox.DataSource = RomInfo.GetAbilityNames();
abilityComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
// Held Items
heldItemComboBox.DataSource = RomInfo.GetItemNames();
heldItemComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
// OT Gender
otGenderComboBox.DataSource = new string[] { "Male", "Female" };
// Languages
langComboBox.DataSource = Enum.GetNames(typeof(OriginLang));
langComboBox.AutoCompleteSource = AutoCompleteSource.ListItems;
}
private void SetToolTips()
{
SetToolTipsForControls(new Control[] { tradeIDNumericUpDown, tradeIDLabel }, "The Trade ID to edit.");
SetToolTipsForControls(new Control[] { speciesComboBox, speciesLabel }, "The species of the Pokémon being traded.");
SetToolTipsForControls(new Control[] { IVGroupBox }, "Individual Values (IVs)");
SetToolTipsForControls(new Control[] { abilityComboBox, abilityLabel }, "The ability of the Pokémon.\nThis value is unused and will have no effect!");
SetToolTipsForControls(new Control[] { otIDNumericUpDown, otIDLabel }, "The Original Trainer ID of the Pokémon.");
SetToolTipsForControls(new Control[] { contestGroupBox }, "Contest stats for the Pokémon.");
SetToolTipsForControls(new Control[] { pidNumericUpDown, pidLabel }, "The PID of the Pokémon.\nDetermines ability and nature.");
SetToolTipsForControls(new Control[] { heldItemComboBox, heldItemLabel }, "The held item of the Pokémon.");
SetToolTipsForControls(new Control[] { otGenderComboBox, otGenderLabel }, "The gender of the Original Trainer (OT).\nThe OT name is determined by the text bank.");
SetToolTipsForControls(new Control[] { langComboBox, langLabel }, "The language of origin of the traded Pokémon.");
SetToolTipsForControls(new Control[] { requestedComboBox, requestedLabel }, "The species of the requested Pokémon.\nWhether the Pokémon selected by the player matches this species or not is checked via scripting.");
SetToolTipsForControls(new Control[] { unknownNumericUpDown, unknownLabel }, "An unknown value, present in HGSS only.\nAppears to be unused.");
SetToolTipsForControls(new Control[] { otNameTextBox, otNameLabel },
$"The Original Trainer's name.\nStored in text bank {GetTextBankIndex()}.\nAt most {otNameTextBox.MaxLength} characters.");
SetToolTipsForControls(new Control[] { nicknameTextBox, nicknameLabel },
$"The nickname of the Pokémon.\nStored in text bank {GetTextBankIndex()}.\nAt most {nicknameTextBox.MaxLength} characters.");
SetToolTipsForControls(new Control[] { saveTradeButton }, "Save the current trade data to file.");
SetToolTipsForControls(new Control[] { saveTextDataButton }, "Save the current text data to file.");
SetToolTipsForControls(new Control[] { saveAllButton }, "Save both trade data and text data to file.");
// ToDo: Remove these tooltips when the features are implemented
SetToolTipsForControls(new Control[] { addFileButton, removeLastButton }, "Coming soon!\nThis feature is not yet implemented.\nIt will allow you to add or remove trades from the trade data file.");
}
private void SetToolTipsForControls(IEnumerable<Control> controls, string text)
{
foreach (var control in controls)
{
toolTip.SetToolTip(control, text);
}
}
public void LoadFromFile(int tradeID)
{
Helpers.DisableHandlers();
curTradeData = new TradeData(tradeID);
tradeArchive = new TextArchive(GetTextBankIndex());
tradeIDNumericUpDown.Value = tradeID;
speciesComboBox.SelectedIndex = curTradeData.species;
hpIVNumericUpDown.Value = curTradeData.hpIV;
atkIVNumericUpDown.Value = curTradeData.atkIV;
defIVNumericUpDown.Value = curTradeData.defIV;
speIVNumericUpDown.Value = curTradeData.speedIV;
spaIVNumericUpDown.Value = curTradeData.spAtkIV;
spdIVNumericUpDown.Value = curTradeData.spDefIV;
abilityComboBox.SelectedIndex = curTradeData.ability;
otIDNumericUpDown.Value = curTradeData.otID;
coolNumericUpDown.Value = curTradeData.cool;
beautyNumericUpDown.Value = curTradeData.beauty;
cuteNumericUpDown.Value = curTradeData.cute;
smartNumericUpDown.Value = curTradeData.smart;
toughNumericUpDown.Value = curTradeData.tough;
pidNumericUpDown.Value = curTradeData.pid;
heldItemComboBox.SelectedIndex = curTradeData.heldItem;
otGenderComboBox.SelectedIndex = curTradeData.otGender;
sheenNumericUpDown.Value = curTradeData.sheen;
langComboBox.SelectedIndex = curTradeData.language;
requestedComboBox.SelectedIndex = curTradeData.requestedSpecies;
unknownNumericUpDown.Value = curTradeData.unknown;
otNameTextBox.Text = GetOTName(tradeID);
nicknameTextBox.Text = GetMonNickname(tradeID);
tradeDataGroupBox.Text = "Trade Data";
textDataGroupBox.Text = "Text Data";
this.Text = "Trade Editor";
tradeDirty = false;
textDirty = false;
Helpers.EnableHandlers();
}
private void SaveTradeToFile()
{
Helpers.DisableHandlers();
curTradeData.species = speciesComboBox.SelectedIndex;
curTradeData.hpIV = (int)hpIVNumericUpDown.Value;
curTradeData.atkIV = (int)atkIVNumericUpDown.Value;
curTradeData.defIV = (int)defIVNumericUpDown.Value;
curTradeData.speedIV = (int)speIVNumericUpDown.Value;
curTradeData.spAtkIV = (int)spaIVNumericUpDown.Value;
curTradeData.spDefIV = (int)spdIVNumericUpDown.Value;
curTradeData.ability = abilityComboBox.SelectedIndex;
curTradeData.otID = (int)otIDNumericUpDown.Value;
curTradeData.cool = (int)coolNumericUpDown.Value;
curTradeData.beauty = (int)beautyNumericUpDown.Value;
curTradeData.cute = (int)cuteNumericUpDown.Value;
curTradeData.smart = (int)smartNumericUpDown.Value;
curTradeData.tough = (int)toughNumericUpDown.Value;
curTradeData.pid = (int)pidNumericUpDown.Value;
curTradeData.heldItem = heldItemComboBox.SelectedIndex;
curTradeData.otGender = otGenderComboBox.SelectedIndex;
curTradeData.sheen = (int)sheenNumericUpDown.Value;
curTradeData.language = langComboBox.SelectedIndex;
curTradeData.requestedSpecies = requestedComboBox.SelectedIndex;
if (RomInfo.gameFamily == RomInfo.GameFamilies.HGSS)
{
curTradeData.unknown = (int)unknownNumericUpDown.Value;
}
else
{
curTradeData.unknown = 0;
}
curTradeData.SaveToFileDefaultDir((int)tradeIDNumericUpDown.Value, false);
tradeDataGroupBox.Text = "Trade Data";
tradeDirty = false;
if (!textDirty)
{
this.Text = "Trade Editor";
}
AppLogger.Debug($"TradeEditor: Saved trade data for ID {curTradeData.id}.");
Helpers.EnableHandlers();
}
private void SaveTextDataToFile()
{
Helpers.DisableHandlers();
int tradeID = (int)tradeIDNumericUpDown.Value;
if (tradeID < 0 || tradeID + TradeData.GetTradeCount() > tradeArchive.messages.Count)
{
MessageBox.Show("Can't save to text bank. Index is out of range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
AppLogger.Error("TradeEditor: Can't save to text bank. Index is out of range.");
Helpers.EnableHandlers();
return;
}
// Nickname
tradeArchive.messages[tradeID] = nicknameTextBox.Text;
// OT Name
tradeArchive.messages[tradeID + TradeData.GetTradeCount()] = otNameTextBox.Text;
tradeArchive.SaveToFileDefaultDir(GetTextBankIndex(), false);
// Reset the text data group box and dirty flags
textDataGroupBox.Text = "Text Data";
textDirty = false;
if (!tradeDirty)
{
this.Text = "Trade Editor";
}
AppLogger.Debug($"TradeEditor: Saved trade text data to message bank {GetTextBankIndex()}");
Helpers.EnableHandlers();
}
private int GetTextBankIndex()
{
switch (RomInfo.gameFamily)
{
case RomInfo.GameFamilies.DP:
switch (RomInfo.gameLanguage)
{
case RomInfo.GameLanguages.Japanese:
return 324;
default:
return 326;
}
case RomInfo.GameFamilies.Plat:
switch (RomInfo.gameLanguage)
{
case RomInfo.GameLanguages.Japanese:
return 369;
default:
return 370;
}
case RomInfo.GameFamilies.HGSS:
switch (RomInfo.gameLanguage)
{
case RomInfo.GameLanguages.Japanese:
return 198;
default:
return 200;
}
default:
AppLogger.Error("TradeEditor: Invalid game family for text bank index retrieval.");
MessageBox.Show("Invalid game family for text bank index retrieval.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return 0;
}
}
private string GetMonNickname(int tradeID)
{
string msg = tradeArchive.messages[tradeID];
if (msg.Length > nicknameTextBox.MaxLength)
{
msg = msg.Substring(0, nicknameTextBox.MaxLength);
}
return msg;
}
private string GetOTName(int tradeID)
{
int index = tradeID + TradeData.GetTradeCount();
string msg = tradeArchive.messages[index];
if (msg.Length > otNameTextBox.MaxLength)
{
msg = msg.Substring(0, otNameTextBox.MaxLength);
}
return msg;
}
private void RegisterMarkDirtyHandlers()
{
// ComboBoxes
speciesComboBox.SelectedIndexChanged += MarkDirty;
abilityComboBox.SelectedIndexChanged += MarkDirty;
heldItemComboBox.SelectedIndexChanged += MarkDirty;
otGenderComboBox.SelectedIndexChanged += MarkDirty;
langComboBox.SelectedIndexChanged += MarkDirty;
requestedComboBox.SelectedIndexChanged += MarkDirty;
// NumericUpDowns
hpIVNumericUpDown.ValueChanged += MarkDirty;
atkIVNumericUpDown.ValueChanged += MarkDirty;
defIVNumericUpDown.ValueChanged += MarkDirty;
speIVNumericUpDown.ValueChanged += MarkDirty;
spaIVNumericUpDown.ValueChanged += MarkDirty;
spdIVNumericUpDown.ValueChanged += MarkDirty;
otIDNumericUpDown.ValueChanged += MarkDirty;
coolNumericUpDown.ValueChanged += MarkDirty;
beautyNumericUpDown.ValueChanged += MarkDirty;
cuteNumericUpDown.ValueChanged += MarkDirty;
smartNumericUpDown.ValueChanged += MarkDirty;
toughNumericUpDown.ValueChanged += MarkDirty;
pidNumericUpDown.ValueChanged += MarkDirty;
sheenNumericUpDown.ValueChanged += MarkDirty;
unknownNumericUpDown.ValueChanged += MarkDirty;
// TextBoxes
otNameTextBox.TextChanged += MarkDirty;
nicknameTextBox.TextChanged += MarkDirty;
}
#region Handlers
private void MarkDirty(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
Helpers.DisableHandlers();
if (sender.Equals(otNameTextBox) || sender.Equals(nicknameTextBox))
{
textDataGroupBox.Text = "Text Data*";
this.Text = "Trade Editor*";
textDirty = true;
}
else
{
tradeDataGroupBox.Text = "Trade Data*";
this.Text = "Trade Editor*";
tradeDirty = true;
}
Helpers.EnableHandlers();
}
private void tradeIDNumericUpDown_ValueChanged(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
Helpers.DisableHandlers();
if (tradeDirty || textDirty)
{
DialogResult result = MessageBox.Show("You have unsaved changes. Do you want to save before changing the Trade ID?", "Unsaved Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
SaveTradeToFile();
SaveTextDataToFile();
}
else if (result == DialogResult.Cancel)
{
// Revert the change
tradeIDNumericUpDown.Value = curTradeData.id;
Helpers.EnableHandlers();
return;
}
}
int tradeID = (int)tradeIDNumericUpDown.Value;
if (tradeID < 0 || tradeID >= TradeData.GetTradeCount())
{
MessageBox.Show("Invalid Trade ID selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
LoadFromFile(tradeID);
Helpers.EnableHandlers();
}
private void saveTradeButton_Click(object sender, EventArgs e)
{
SaveTradeToFile();
}
private void saveTextDataButton_Click(object sender, EventArgs e)
{
SaveTextDataToFile();
}
private void saveAllButton_Click(object sender, EventArgs e)
{
SaveTradeToFile();
SaveTextDataToFile();
}
private void TradeEditor_FormClosing(object sender, FormClosingEventArgs e)
{
if (tradeDirty || textDirty)
{
DialogResult result = MessageBox.Show("You have unsaved changes. Do you want to save before closing?", "Unsaved Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
SaveTradeToFile();
SaveTextDataToFile();
}
else if (result == DialogResult.Cancel)
{
e.Cancel = true; // Cancel the closing
}
}
}
private void addFileButton_Click(object sender, EventArgs e)
{
TradeData newTrade = new TradeData(TradeData.GetTradeCount());
newTrade.SaveToFileDefaultDir(newTrade.id, false);
tradeIDNumericUpDown.Maximum = TradeData.GetTradeCount() - 1; // Update the maximum value
// Adjust text archive to accommodate the new trade
int lastNicknameIndex = TradeData.GetTradeCount() - 1;
tradeArchive.messages.Insert(lastNicknameIndex, "Nickname");
tradeArchive.messages.Add("OT Name");
tradeArchive.SaveToFileDefaultDir(GetTextBankIndex(), false);
MessageBox.Show($"Added new trade with id {newTrade.id}", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void removeLastButton_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("Are you sure you want to remove the last trade? This action cannot be undone.", "Confirm Removal", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result != DialogResult.Yes)
{
return; // User cancelled the removal
}
if (TradeData.GetTradeCount() <= 1)
{
MessageBox.Show("Cannot remove the last trade.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
int lastTradeID = TradeData.GetTradeCount() - 1;
try
{
File.Delete(RomInfo.gameDirs[RomInfo.DirNames.tradeData].unpackedDir + "\\" + lastTradeID.ToString("D4"));
}
catch (Exception ex)
{
MessageBox.Show($"Failed to delete trade file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
AppLogger.Error($"TradeEditor: Failed to delete trade file for ID {lastTradeID}: {ex.Message}");
return;
}
tradeIDNumericUpDown.Maximum = lastTradeID - 1; // Update the maximum value
// Adjust text archive to remove the last trade's text
if (tradeArchive.messages.Count > lastTradeID)
{
tradeArchive.messages.RemoveAt(lastTradeID); // Remove Nickname
tradeArchive.messages.RemoveAt(tradeArchive.messages.Count - 1); // Remove OT Name
tradeArchive.SaveToFileDefaultDir(GetTextBankIndex(), false);
}
}
#endregion
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

File diff suppressed because it is too large Load Diff

View File

@@ -52,6 +52,7 @@ namespace DSPRE.Editors
SpeciesFile[] pokemonSpecies;
private (int abi1, int abi2)[] pokemonSpeciesAbilities;
private List<(int monIdx, int moveIdx1, int moveIdx2)> duplicateMoves = new List<(int monIdx, int moveIdx1, int moveIdx2)>();
TrainerFile currentTrainerFile;
public PaletteBase trainerPal;
@@ -398,6 +399,8 @@ namespace DSPRE.Editors
RefreshTrainerPartyGUI();
RefreshTrainerPropertiesGUI();
UpdateDuplicateMovesList();
Helpers.EnableHandlers();
if (error)
@@ -472,9 +475,13 @@ namespace DSPRE.Editors
for (int j = 0; j < Party.MOVES_PER_POKE; j++)
{
(partyMovesGroupboxList[i].Controls[j] as ComboBox).SelectedIndex = currentTrainerFile.party[i].moves[j];
(partyMovesGroupboxList[i].Controls[j] as ComboBox).ForeColor = SystemColors.WindowText;
}
}
}
MarkDuplicateMoves();
}
private void ShowPartyPokemonPic(byte partyPos)
@@ -654,19 +661,61 @@ namespace DSPRE.Editors
partyItemsComboboxList[i].Enabled = trainerItemsCheckBox.Checked;
}
}
private void partyMoveComboBox_DropDown(object sender, EventArgs e)
{
if (Helpers.HandlersDisabled)
{
return;
}
((ComboBox)sender).ForeColor = SystemColors.WindowText;
}
private void partyMoveComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (Helpers.HandlersEnabled)
if (Helpers.HandlersDisabled)
{
for (int i = 0; i < TrainerFile.POKE_IN_PARTY; i++)
{
ushort[] moves = currentTrainerFile.party[i].moves;
return;
}
if (moves != null)
MarkDuplicateMoves();
}
private void MarkDuplicateMoves()
{
foreach (var cbGroup in partyMovesGroupboxList)
{
foreach (var cb in cbGroup.Controls)
{
((ComboBox)cb).ForeColor = SystemColors.WindowText;
}
}
UpdateDuplicateMovesList();
foreach (var duplicate in duplicateMoves)
{
((ComboBox)partyMovesGroupboxList[duplicate.monIdx].Controls[duplicate.moveIdx1]).ForeColor = Color.Red;
((ComboBox)partyMovesGroupboxList[duplicate.monIdx].Controls[duplicate.moveIdx2]).ForeColor = Color.Red;
}
}
private void UpdateDuplicateMovesList()
{
duplicateMoves.Clear();
for (int pokemonIndex = 0; pokemonIndex < partyMovesGroupboxList.Count; pokemonIndex++)
{
for (int i = 0; i < Party.MOVES_PER_POKE - 1; i++)
{
for (int j = i + 1; j < Party.MOVES_PER_POKE; j++)
{
for (int j = 0; j < Party.MOVES_PER_POKE; j++)
ComboBox cb1 = (ComboBox)partyMovesGroupboxList[pokemonIndex].Controls[i];
ComboBox cb2 = (ComboBox)partyMovesGroupboxList[pokemonIndex].Controls[j];
if (cb1.SelectedIndex != 0 && cb1.SelectedIndex == cb2.SelectedIndex)
{
moves[j] = (ushort)(partyMovesGroupboxList[i].Controls[j] as ComboBox).SelectedIndex;
duplicateMoves.Add((pokemonIndex, i, j));
}
}
}
@@ -750,6 +799,21 @@ namespace DSPRE.Editors
currentTrainerFile.party[i].ballSeals = (ushort)partyBallUpdownList[i].Value;
}
if (duplicateMoves.Count != 0)
{
StringBuilder sb = new StringBuilder();
sb.Append("Duplicate moves have been found:\n");
foreach (var duplicate in duplicateMoves)
{
string move = partyMovesGroupboxList[duplicate.monIdx].Controls[duplicate.moveIdx1].Text;
sb.Append($"- {partyPokemonComboboxList[duplicate.monIdx].Text} has duplicate move \"{move}\"\n");
}
sb.Append("This will cause issues in game.");
MessageBox.Show(sb.ToString(), "Duplicate Moves", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
/*Write to File*/
string indexStr = "\\" + trainerComboBox.SelectedIndex.ToString("D4");
File.WriteAllBytes(RomInfo.gameDirs[DirNames.trainerProperties].unpackedDir + indexStr, currentTrainerFile.trp.ToByteArray());

View File

@@ -118,33 +118,21 @@
<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="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>
</data>
<data name="replacePropertiesButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
vAAADrwBlbxySQAAAI1JREFUSEtjYBgFZALDkLT/MIwuR3MAsjRt000whjqgBV0NTQDMxzDLQdg8uQKO
bQu7cGJ0s0gC2CzGhssv/seKoQ4gPZQotZgiB1DDYoocAAK4QgDdAkKYbAdAQYtH47z/IIxuMLGYUgfA
AFaHwMTwYWo5AAbADkF2ANRwYjD1ALIPqW44CYA2vhtRAAAmDYpgT13R+wAAAABJRU5ErkJggg==
vAAADrwBlbxySQAAAI5JREFUSEtjGAXkAsOQtP8wDBWiHwBZmrbpJhhDHdACkaExgPkYZjkImydXwLFt
YRdODDWCPIDNYmy4/OJ/rBjqANJDiVKLYZgsB1DDYhimeghgswQfJtsBUNDi0TjvPwhjM5wYTKkDYACr
Q2Bi+DC1HAADYIcgOwAkRiSmHkD2IZBLXcNJALTx3QgCDAwAJg2KYP9PC1YAAAAASUVORK5CYII=
</value>
</data>
<data name="exportPropertiesButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
vAAADrwBlbxySQAAAJdJREFUSEtjYBgFFIA4Nav/MIwuRxcAsvh6XBcYU90RyL7DhRe6psEdAMItxoFg
jG4WWQDZd4Tw/4IlKJgqDgE54HZcN4Zl+CxGxxQ5BJ8D0C0ihMlyBDYHoBtMCCOFQAsUEw+QHYBuMCE8
0y4ejJEsJs1yEKg18YMbhA9T3WI0gGwQBkZ2ALUtJgoghwRdLUYD9PX1sAMAB89ugVJE7dUAAAAASUVO
RK5CYII=
vAAADrwBlbxySQAAAJ5JREFUSEtjGAWUgDg1q/8wDBWiLwBZfD2uC4yp7ghk3+HCC13T4A4A4RbjQDCG
GkEZAFmAbDg+/L9gCQqmikNADrgd143VQhhGtxgdU+QQfA7AZhk+TJYjsDkAm+H4MFIItEAx8QDZAdgM
x4dn2sWDMdAYmMWkWQ4CtSZ+cIPwYapbjAaQDcLAyA6gtsVEAZiP0SynO6Cvr4cZYGAAAAfPboEh2axl
AAAAAElFTkSuQmCC
</value>
</data>
</root>

View File

@@ -0,0 +1,437 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Windows;
namespace DSPRE.Editors.Utils
{
public class IndexedBitmapHandler
{
public IndexedBitmapHandler()
{
}
public Bitmap Convert(Bitmap source, PixelFormat target)
{
if ((source.PixelFormat == target) || (target == PixelFormat.DontCare))
return source;
Bitmap image = new Bitmap(source.Width, source.Height, target);
if ((source.PixelFormat == PixelFormat.Format4bppIndexed) && (target == PixelFormat.Format8bppIndexed))
{
byte[] array = GetArray(source);
byte[] array2 = new byte[(array.Length * 2)];
byte current;
for (int i = 0; i < array.Length; i++)
{
current = array[i];
array2[2 * i] = (byte)((current & 0xF0) >> 4);
array2[2 * i + 1] = (byte)((current & 0x0F));
}
image = MakeImage(source.Width, source.Height, array2, target);
image.Palette = source.Palette;
}
if (((source.PixelFormat == PixelFormat.Format24bppRgb) || (source.PixelFormat == PixelFormat.Format32bppArgb)) && (target == PixelFormat.Format8bppIndexed))
{
int skip = 3;
if (source.PixelFormat == PixelFormat.Format32bppArgb)
skip = 4;
Color[] newPalette = new Color[256];
byte[] array = new byte[source.Width * source.Height];
byte[] sourceArray = GetArray(source);
Color Pixel = Color.FromArgb(sourceArray[2], sourceArray[1], sourceArray[0]);
newPalette[0] = Pixel;
int index = 1;
array[0] = 0;
byte r = 0;
byte g = 0;
byte b = 0;
bool match = false;
for (int i = 1; i < (source.Width * source.Height); i++)
{
b = sourceArray[(i * skip)];
g = sourceArray[(i * skip + 1)];
r = sourceArray[(i * skip + 2)];
Pixel = Color.FromArgb(r, g, b);
for (int j = 0; j < index; j++)
{
if (Pixel == newPalette[j])
{
array[i] = (byte)j;
match = true;
break;
}
}
if (!match)
{
if (index >= 256)
{
MessageBox.Show("Conversion failed");
return null;
}
newPalette[index] = Pixel;
array[i] = (byte)index;
index++;
}
match = false;
}
image = MakeImage(source.Width, source.Height, array, target);
ColorPalette oldPalette = image.Palette;
for (int i = 0; i < index; i++)
{
oldPalette.Entries[i] = newPalette[i];
}
image.Palette = oldPalette;
}
return image;
}
public Bitmap Resize(Bitmap source, int top, int bottom, int left, int right)
{
int newWidth = source.Width + left + right;
int newHeight = source.Height + top + bottom;
int arraysize = newWidth * newHeight;
ColorPalette palette = source.Palette;
byte[] source_array = GetArray(source);
byte[] byte_array = new byte[arraysize];
byte background = source_array[0];
int source_index = 0;
int index = 0;
for (int j = 0; j < newHeight; j++)
{
for (int i = 0; i < newWidth; i++)
{
if (i < left || i >= (left + source.Width) || j < top || j >= (top + source.Height))
byte_array[index] = background;
else
{
source_index = ((j - top) * source.Width) + i - left;
byte_array[index] = source_array[source_index];
}
index++;
}
}
Bitmap newImage = MakeImage(newWidth, newHeight, byte_array, PixelFormat.Format8bppIndexed);
newImage.Palette = palette;
return newImage;
}
public Bitmap Concat(Bitmap first, Bitmap second)
{
int newWidth = first.Width + second.Width;
int newHeight = first.Height;
if (first.Height < second.Height)
newHeight = second.Height;
int arraysize = newWidth * newHeight;
ColorPalette palette = first.Palette;
byte[] first_array = GetArray(first);
byte[] second_array = GetArray(second);
byte[] byte_array = new byte[arraysize];
byte background = first_array[0];
int source_index = 0;
int index = 0;
for (int j = 0; j < newHeight; j++)
{
for (int i = 0; i < first.Width; i++)
{
if (j > first.Height)
byte_array[index] = background;
else
{
source_index = ((j * first.Width) + i);
byte_array[index] = first_array[source_index];
}
index++;
}
for (int i = 0; i < second.Width; i++)
{
if (j > second.Height)
byte_array[index] = background;
else
{
source_index = ((j * second.Width) + i);
byte_array[index] = second_array[source_index];
}
index++;
}
}
Bitmap newImage = MakeImage(newWidth, newHeight, byte_array, PixelFormat.Format8bppIndexed);
newImage.Palette = palette;
return newImage;
}
public Bitmap[] Split(Bitmap source, int tilewidth, int tileheight)
{
int maxTiles = (source.Width / tilewidth) * (source.Height / tileheight);
Bitmap[] tiles = new Bitmap[maxTiles];
int index = 0;
int x_index = 0;
int y_index = 0;
while (y_index + tileheight <= source.Height)
{
if (x_index + tilewidth <= source.Width)
{
tiles[index] = Resize(source, (y_index * -1), ((source.Height - y_index - tileheight) * -1), (x_index * -1), ((source.Width - x_index - tilewidth) * -1));
index++;
}
x_index += tilewidth;
if (x_index + tilewidth > source.Width)
{
y_index += tileheight;
x_index = 0;
}
}
return tiles;
}
public Bitmap ShrinkImage(Bitmap image, int x_scale, int y_scale)
{
byte[] array = GetArray(image);
ColorPalette palette = image.Palette;
int new_width = image.Width / x_scale;
int new_height = image.Height / y_scale;
byte[] array2 = new byte[new_width * new_height];
for (int j = 0; j < new_height; j++)
{
for (int i = 0; i < new_width; i++)
{
array2[j * new_width + i] = array[y_scale * j * image.Width + i * x_scale];
}
}
Bitmap temp = MakeImage(new_width, new_height, array2, image.PixelFormat);
temp.Palette = palette;
return temp;
}
public ColorPalette AlternatePalette(Bitmap parent, Bitmap child)
{
Bitmap temp = new Bitmap(1, 1, parent.PixelFormat);
ColorPalette newPalette = temp.Palette;
ColorPalette ChildPalette = child.Palette;
byte[] ParentArray = GetArray(parent);
byte[] ChildArray = GetArray(child);
if (ParentArray.Length != ChildArray.Length)
return null;
for (int i = 0; i < ChildPalette.Entries.Length; i++)
{
for (int j = 0; j < ParentArray.Length; j++)
{
if (ParentArray[j] == i)
{
newPalette.Entries[i] = ChildPalette.Entries[ChildArray[j]];
break;
}
}
}
return newPalette;
}
public Bitmap PaletteMatch(ColorPalette parent, Bitmap child, bool[] used = null)
{
if (parent.Entries == child.Palette.Entries)
return child;
if (used == null)
{
used = new bool[parent.Entries.Length];
for (int i = 0; i < parent.Entries.Length; i++)
used[i] = true;
}
Bitmap image = ShrinkPalette(child);
Bitmap temp = new Bitmap(1, 1, child.PixelFormat);
ColorPalette childPalette = image.Palette;
ColorPalette newPalette = temp.Palette;
int size = PaletteSize(image);
byte[] array = GetArray(image);
byte[] indexof = new byte[size];
bool[] NotFound = new bool[size];
for (int i = 0; i < size; i++)
NotFound[i] = true;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < parent.Entries.Length; j++)
{
if (parent.Entries[j] == childPalette.Entries[i])
{
indexof[i] = (byte)j;
NotFound[i] = false;
break;
}
}
}
int maxsize = 0;
for (int i = 0; i < parent.Entries.Length; i++)
{
if (used[i])
{
newPalette.Entries[i] = parent.Entries[i];
maxsize++;
}
}
for (int i = 0; i < size; i++)
{
if (NotFound[i])
maxsize++;
}
for (int i = 0; i < maxsize; i++)
{
if ((i < used.Length) && (used[i]))
continue;
for (int j = 0; j < size; j++)
{
if (NotFound[j])
{
indexof[j] = (byte)i;
newPalette.Entries[i] = childPalette.Entries[j];
NotFound[j] = false;
break;
}
}
}
byte[] newArray = new byte[array.Length];
for (int i = 0; i < array.Length; i++)
{
newArray[i] = indexof[array[i]];
}
image = MakeImage(child.Width, child.Height, newArray, child.PixelFormat);
image.Palette = newPalette;
return image;
}
public Bitmap ShrinkPalette(Bitmap image, bool[] used = null)
{
used = IsUsed(image, used);
byte[] array = GetArray(image);
ColorPalette oldPalette = image.Palette;
Bitmap temp = new Bitmap(image.Width, image.Height, image.PixelFormat);
ColorPalette newPalette = temp.Palette;
int size = oldPalette.Entries.Length;
int index = 0;
int unused = 0;
byte[] indexof = new byte[size];
for (int i = 0; i < size; i++)
{
if (used[i])
{
newPalette.Entries[index] = oldPalette.Entries[i];
indexof[i] = (byte)index;
index++;
}
else
unused++;
}
if (unused == 0 || unused == size)
return image;
byte[] newArray = new byte[array.Length];
for (int i = 0; i < array.Length; i++)
{
newArray[i] = indexof[array[i]];
}
image = MakeImage(image.Width, image.Height, newArray, image.PixelFormat);
image.Palette = newPalette;
return image;
}
public bool[] IsUsed(Bitmap image, bool[] used = null)
{
byte[] array = GetArray(image);
int size = image.Palette.Entries.Length;
if (used == null)
{
used = new bool[size];
for (int i = 0; i < size; i++)
{
used[i] = false;
}
}
if (size > used.Length)
{
bool[] temp = new bool[size];
for (int i = 0; i < size; i++)
{
if (i < used.Length)
temp[i] = used[i];
else
temp[i] = false;
}
used = temp;
}
for (int i = 0; i < array.Length; i++)
{
used[array[i]] = true;
}
return used;
}
public byte PaletteSize(Bitmap image)
{
byte[] array = GetArray(image);
byte max = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i] > max)
max = array[i];
}
return (byte)(max + 1);
}
public bool PaletteEquals(ColorPalette parent, Bitmap child)
{
bool Match = true;
int max = PaletteSize(child);
for (int i = 0; i < max; i++)
{
if (parent.Entries[i] != child.Palette.Entries[i])
Match = false;
}
return Match;
}
public ColorPalette CleanPalette(Bitmap image)
{
int used = PaletteSize(image);
ColorPalette temp = image.Palette;
for (int i = used; i < image.Palette.Entries.Length; i++)
temp.Entries[i] = Color.FromArgb(0, 0, 0);
return temp;
}
public byte[] GetArray(Bitmap target)
{
int Width = target.Width;
if (target.PixelFormat == PixelFormat.Format1bppIndexed)
Width = Width / 8;
if (target.PixelFormat == PixelFormat.Format4bppIndexed)
Width = Width / 2;
if ((target.PixelFormat == PixelFormat.Format16bppArgb1555) || (target.PixelFormat == PixelFormat.Format16bppGrayScale) || (target.PixelFormat == PixelFormat.Format16bppRgb555) || (target.PixelFormat == PixelFormat.Format16bppRgb565))
Width = Width * 2;
if (target.PixelFormat == PixelFormat.Format24bppRgb)
Width = Width * 3;
if ((target.PixelFormat == PixelFormat.Format32bppRgb) || (target.PixelFormat == PixelFormat.Format32bppArgb) || (target.PixelFormat == PixelFormat.Format32bppPArgb))
Width = Width * 4;
byte[] array = new byte[Width * target.Height];
Rectangle rect = new Rectangle(0, 0, target.Width, target.Height);
BitmapData sourceData = target.LockBits(rect, ImageLockMode.ReadOnly, target.PixelFormat);
IntPtr scan = sourceData.Scan0;
Marshal.Copy(scan, array, 0, Width * target.Height);
target.UnlockBits(sourceData);
return array;
}
public Bitmap MakeImage(int width, int height, byte[] array, PixelFormat format)
{
Bitmap image = new Bitmap(width, height, format);
Rectangle rect = new Rectangle(0, 0, width, height);
BitmapData imageData = image.LockBits(rect, ImageLockMode.WriteOnly, image.PixelFormat);
IntPtr scan = imageData.Scan0;
Marshal.Copy(array, 0, scan, (width * height));
image.UnlockBits(imageData);
return image;
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSPRE.Editors.Utils
{
public class NarcReader
{
public int Entrys;
public FileEntry[] fe;
public FileStream fs;
string m_sFileName;
public long size;
public NarcReader(string strFileName)
{
m_sFileName = strFileName;
fs = new FileStream(strFileName, FileMode.Open, FileAccess.ReadWrite);
BinaryReader binaryReader = new BinaryReader(fs);
byte[] array = new byte[16];
binaryReader.Read(array, 0, 16);
size = BitConverter.ToUInt32(array, 8);
int num = BitConverter.ToInt16(array, 12);
fs.Seek(num, SeekOrigin.Begin);
array = new byte[12];
binaryReader.Read(array, 0, 12);
int num2 = BitConverter.ToInt32(array, 4);
Entrys = BitConverter.ToInt32(array, 8);
fe = new FileEntry[Entrys];
for (int i = 0; i < Entrys; i++)
{
fe[i].Ofs = binaryReader.ReadInt32();
fe[i].Size = binaryReader.ReadInt32() - fe[i].Ofs;
}
fs.Seek(num + num2, SeekOrigin.Begin);
array = new byte[16];
binaryReader.Read(array, 0, 16);
int num3 = BitConverter.ToInt32(array, 4);
num3 = num + num3 + num2 + 8;
for (int j = 0; j < Entrys; j++)
{
fe[j].Ofs += num3;
}
fs.Close();
}
public void Close()
{
fs.Close();
}
public int OpenEntry(int id)
{
fs = new FileStream(m_sFileName, FileMode.Open, FileAccess.ReadWrite);
fs.Seek(fe[id].Ofs, SeekOrigin.Begin);
return 0;
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DSPRE.Editors.Utils
{
public class SpriteSet
{
public Bitmap[] Sprites;
public ColorPalette Normal;
public ColorPalette Shiny;
public SpriteSet()
{
Sprites = new Bitmap[4];
for (int i = 0; i < 4; i++)
{
Sprites[i] = null;
}
Normal = null;
Shiny = null;
}
}
}

View File

@@ -47,6 +47,22 @@ namespace DSPRE.ROMFiles {
return false;
}
public bool Insert(int index, T item) {
if (set.Contains(item)) {
//If the item is already in the set, we just move it to the new index
int oldIndex = list.FindIndex(x => x.Equals(item));
if (oldIndex != index) {
list.Move(oldIndex, index);
}
return false; //No insertion happened
} else {
//New item, insert it
list.Insert(index, item);
set.Add(item);
return true; //Insertion happened
}
}
// Expose some methods from the internal List
public T Find(Predicate<T> match) {
return list.Find(match);

View File

@@ -284,6 +284,7 @@
this.tableEditorTabPage = new System.Windows.Forms.TabPage();
this.tableEditor = new DSPRE.Editors.TableEditor();
this.tabPageEncountersEditor = new System.Windows.Forms.TabPage();
this.encountersEditor = new DSPRE.Editors.EncountersEditor();
this.mainTabImageList = new System.Windows.Forms.ImageList(this.components);
this.gameIcon = new System.Windows.Forms.PictureBox();
this.languageLabel = new System.Windows.Forms.Label();
@@ -329,6 +330,7 @@
this.flyWarpEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.itemEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.overworldEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tradeEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
@@ -441,6 +443,7 @@
this.cameraEditorTabPage.SuspendLayout();
this.trainerEditorTabPage.SuspendLayout();
this.tableEditorTabPage.SuspendLayout();
this.tabPageEncountersEditor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gameIcon)).BeginInit();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
@@ -3548,6 +3551,7 @@
//
// tabPageEncountersEditor
//
this.tabPageEncountersEditor.Controls.Add(this.encountersEditor);
this.tabPageEncountersEditor.Location = new System.Drawing.Point(4, 23);
this.tabPageEncountersEditor.Name = "tabPageEncountersEditor";
this.tabPageEncountersEditor.Padding = new System.Windows.Forms.Padding(3);
@@ -3556,6 +3560,14 @@
this.tabPageEncountersEditor.Text = "Encounters";
this.tabPageEncountersEditor.UseVisualStyleBackColor = true;
//
// encountersEditor
//
this.encountersEditor.encounterEditorIsReady = false;
this.encountersEditor.Location = new System.Drawing.Point(0, 0);
this.encountersEditor.Name = "encountersEditor";
this.encountersEditor.Size = new System.Drawing.Size(1189, 675);
this.encountersEditor.TabIndex = 0;
//
// mainTabImageList
//
this.mainTabImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("mainTabImageList.ImageStream")));
@@ -3920,7 +3932,8 @@
this.moveDataEditorToolStripMenuItem,
this.flyWarpEditorToolStripMenuItem,
this.itemEditorToolStripMenuItem,
this.overworldEditorToolStripMenuItem});
this.overworldEditorToolStripMenuItem,
this.tradeEditorToolStripMenuItem});
this.otherEditorsToolStripMenuItem.Enabled = false;
this.otherEditorsToolStripMenuItem.Name = "otherEditorsToolStripMenuItem";
this.otherEditorsToolStripMenuItem.Size = new System.Drawing.Size(88, 20);
@@ -3975,6 +3988,13 @@
this.overworldEditorToolStripMenuItem.Text = "Overworld Editor";
this.overworldEditorToolStripMenuItem.Click += new System.EventHandler(this.overworldEditorToolStripMenuItem_Click);
//
// tradeEditorToolStripMenuItem
//
this.tradeEditorToolStripMenuItem.Name = "tradeEditorToolStripMenuItem";
this.tradeEditorToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
this.tradeEditorToolStripMenuItem.Text = "Trade Editor";
this.tradeEditorToolStripMenuItem.Click += new System.EventHandler(this.tradeEditorToolStripMenuItem_Click);
//
// aboutToolStripMenuItem1
//
this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
@@ -4476,6 +4496,7 @@
this.trainerEditorTabPage.ResumeLayout(false);
this.trainerEditorTabPage.PerformLayout();
this.tableEditorTabPage.ResumeLayout(false);
this.tabPageEncountersEditor.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gameIcon)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
@@ -4819,7 +4840,6 @@
public System.Windows.Forms.TabControl mainTabControl;
public System.Windows.Forms.NumericUpDown scriptFileUpDown;
public System.Windows.Forms.TabPage tabPageEncountersEditor;
public Editors.EncountersEditor encountersEditor;
private System.Windows.Forms.Button scanUnusedCollisionTypesButton;
private System.Windows.Forms.ToolStripMenuItem overlayEditorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem spawnEditorToolStripMenuItem;
@@ -4834,6 +4854,7 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.ToolStripMenuItem flyWarpEditorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem itemEditorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem tradeEditorToolStripMenuItem;
private System.Windows.Forms.Button popoutTextEditorButton;
private System.Windows.Forms.Label textEditorPoppedOutLabel;
private System.Windows.Forms.Button popoutLevelScriptEditorButton;

View File

@@ -73,6 +73,7 @@ namespace DSPRE
}
#endif
InitializeComponent();
Program.CloneAndSetupDatabase();
EditorPanels.Initialize(this);
Helpers.Initialize(this);
@@ -5251,7 +5252,7 @@ namespace DSPRE
}
private void exportScriptDatabaseJSONToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Not implemented yet");
MessageBox.Show("The database JSONs can be found in AppData/Roaming/DSPRE");
}
private void generateCSVToolStripMenuItem_Click(object sender, EventArgs e)
@@ -5270,6 +5271,14 @@ namespace DSPRE
flyEditor.Show();
}
private void tradeEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
DSUtils.TryUnpackNarcs(new List<DirNames> { DirNames.tradeData });
TradeEditor tradeEditor = new TradeEditor();
tradeEditor.Show();
}
private void itemEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
Helpers.statusLabelMessage("Setting up Item Data Editor...");

View File

@@ -696,6 +696,96 @@
vAAADrwBlbxySQAAAGJJREFUOE9j+P//P1bMMEXuHxD/Z5gm+x/ExqYGhLEKgjDYgAUK/8F41AD8BoAV
gkIbAwNDH24AJCawYhSFpGJQFFPBACzOAmMkg/F5AVvAgDBYEm7AaEIi3wBEwsJhwH8GAOQLbolFp0OS
AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="mainTabImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>239, 17</value>
</metadata>
<data name="mainTabImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM
EgAAAk1TRnQBSQFMAgEBCgEAAfABHQHwAR0BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/xMABLwEAAS8KwAGvAIA
BOkBvAMABOkBvCoAASYBHgQAArwBAATpBAAE6QG8KgABJgEeAgABJgEeAQABvAEAAukBvAIABLwBAALp
AbwtAAG8ASYBHgMAAukBvAEABAsCvALpAbwsAAEmAR4CAAG8AgAC6QG8AgsBvAEAAgsBvALpAbwmAAO8
AgABJgEeAgABvAMAAukBvAILArwCCwEAAukBvCUAAc0BCgEAAbwBAAEmAR4BAAHsAwABvAEAAukBvAUL
AgAC6QG8JQABzQEKAQACvAEmAR4BAAESArwBAAG8AQAC6QG8AgsCvAMAAukBvCQAAc0BCgMAAbwBAAEm
AR4GAALpAbwBAAILA7wBAALpAbwkAAHNAQoBEgHsAQABEgG8CAAC6QG8AgADCwIAAukBvCQAAc0BCgES
AgABEgG8CAAC6QO8BAABvALpAbwjAAHNAQoBAAG8AwABvAgABOkBvAMABOkBvAEAAbwhAAHNAQoBAAG8
AwAB7AG8BwAE6QQABOkBGwExAZkhAAFlGwADMT0AARsBMQEbKQAB7AESAe8FAAH0EQAKEhgAAvMC6wHv
AewB6wHzBQAB6gH0BQAC8gH0BgADEgZKAxIUAAHzAfEBvALsAQcBvAEHAewB6wEHBAABDgESAe0EAAHw
ASIBKQHrAfMFAAESAkoGbgJKARIDAAEPBwABDwUAAQ8BAAG8AfcB7QGSAe8BvAEHAfAB9AHyAesB6gQA
AQ4BbQHtAwABBwEjAisBKgHrAfMDAAESAUoBbgFKBm4BSgFuAUoBEgEAAQ8J7wEPAwAB7wIAAW0C9wHw
AbwB8wLyAvQB7QHrAQcDAAEHARUB6gPtASkBKwElAR8BJQEqAesB9AIAARIBSgFuAUoGkwFKAW4BSgES
AgAB7wEBAR8G7wMAAu8CAAG8Ae8B8QH0AfYB8gLwAfQB9gHvAewBbQMAAfQBEAHrAUoBMAEDASUBFwH5
AiABJQEqAeoCAAESAUoBkwFuBkkBbgGTAUoBEgIAAe8CAQEfBe8BAAIPAu8CAAHyAe8C9gH3AW0B6wHy
AfQB9gHzAesB7AEHAgAB9AEQAXMBRQEkASAB+QEXAfkBIAEfASABMQEiAfQBAAESAZMBbgFJBmwBSQFu
AZMBEgIAAe8BAQEfBu8DAALvAwAB7wHzAbwBkgHwAfcB9gH3Ae0BBwHrAewB7wMAAfIBEQFFAR8CIAH5
ARcB+QEgAR8BMQEiAfQBAAESAZMBSQJsBHECbAFJAZMBEgEAAQ8J7wEPAwAB7wMAAQcB8AFEASUBGgKS
AfIC8wH0ARIB6wHyAgAB8gFDAewBRQEfASAB+QEXASYBMQE3ATABFAIAAUkBbgFsAXEBlwRxAZcBcQFs
AW4BEgIAAQ8HAAEPBQABDwIAAfQBbQEsASUB6wH0AvEC7wHyAusBvAIAAfMBbQHrAUUBHwIgAfkBMQFR
Am0B8wIAAUkCbAGXAnEClwJxAZcCbAFJAgABFQEPARUDAAEVAQ8BFQgAARwBLAErAeoBBwG8Au8B9AK8
AfMCbQMAAfABEwFFAR8BJAIrAVEBvAUAAUkBbAJxBpcCcQFsAUkBAAEVAfcBBwH3ARUBAAEVAfcBBwH3
ARUGAAHvAisBSwHvAQcBvAHxBAcB9AGLAeoDAAHwAREBSwEkASMBAwFKAfAHAAFsAXEDlwJ4A5cBcQFs
AgABDwEHAQABBwEPAQABDwEHAQABBwEPBQAB7wErASwBRQK8AQcB7wEHAbwB8AEZAtsBbAEHAwAB8AEj
AisBDgHwAfEIAAFJAXEClwF4BZcBcQFJAgABFQH3AQcB9wEVAQABFQH3AQcB9wEVBQABEgEsAUUB8gHz
Ae8B8gHxAbsC2gGzAosB8wQAAfABIwE3ATEBDgsAAUkBcQKXAXgDlwFxAUkEAAEVAQ8BFQMAARUBDwEV
BwABEgG8AgABBwGzAdQBswJsAe8IAAHvAg4B8wwAAWwBcQSXAXEBbBkAAQcCEgG8HQAEcRcAAfQL8wH0
EwAN8xMAAQcL7wEHAgAPEAEAAQcNswEHBwAEQwcAAe8BAAG7BrMBuwIAAe8CAAEQBjgBEAbTARABAAGz
DQABswUAAkME8AJDBQAB7wEAAbMGAAGzAgAB7wIAARACOAMAATgBEALTAgAC0wEQAQABsw0AAbMEAAFD
CPABQwQAAe8BAAGtAQABlwJWAZcBAAGzAgAB7wIAARADOAEAAjgBEAHTAQAC0wEAAdMBEAEAAbMBAAFW
CVABVgEAAbMDAAFDA/ABkgJDAZID8AFDAwAB7wEAAa0BAARWAQABswH0AQAB7wIAARACOAIAAjgBEAHT
AQAC0wEAAdMBEAEAAbMBAAtWAQABswMAAUMB8AGSARIBQwHwAZIBQwESAZIB8AFDAwAB7wEAAa0BAARW
AQABswH0AQAB7wIAARADOAEAAjgBEALTAgAC0wEQAQABswEAC1YBAAGzAgABQwHwARICYwFDAQAB8AFD
AmMBEgHwAUMCAAHvAQABrQEABHgBAAGzAfQBAAHvAgABEAY4ARAG0wEQAQABswEAC1YBAAGzAgABQwES
BEcCQwRHARIBQwIAAe8BAAGtBgABswHzAQAB7wIADxABAAGzAQALVgEAAbMCAAFDDEcBQwIAAe8BAAG7
Aq0EswG7AfMBAAHvAgABEAZHARAGAAEQAQABswEAC1YBAAGzAgABQwxHAUMCAAHvAQAB8wP0AfMB9AQA
Ae8CAAEQAkcCAAJHARAGAAEQAQABswEAC1YBAAGzAwABQwJHApQGRwFDAwAB7wEAAXQCMgEsAXQBAAG8
AvcBAAHvAgABEAFHAQACRwEAAUcBEAYAARABAAGzAQABVgl4AVYBAAGzAwABQwFHBJQFRwFDAwAB7wEA
ASwDwwFTAQAB9wIAAfMB8AIAARABRwEAAkcBAAFHARAGAAEQAQABswEAC3gBAAGzBAABQwSUBEcBQwQA
Ae8BAAF0AywBdAEAAfcBAAHzAfADAAEQAkcCAAJHARAGAAEQAQABswEAC3gBAAGzBQACQwGUA0cCQwUA
Ae8IAAHzAfAEAAEQBkcBEAYAARABAAGzDQABswcABEMHAAEHCO8BBwUADxABAAEJDbMBCREAAUIBTQE+
BwABPgMAASgDAAFAAwABMAMAAQEBAAEBBQABgAEBFgAD/wEAAv8CwwQAAf8BgQKDBAAB/wEAAYcBgwQA
Af8BMAGMASMEAAH/AeEBiAEDBAAB/wHBAYEBAwQAAfEBgwGAASMEAAHhAQ4BgAFjBAAB4AEAAYAB4wQA
AcABgQGIASMEAAHAAX8BjAFjBAABxAF/AYMBwwQAAYQBfwGDAYIEAAGEAT8BhwGABAABjAF/Af8B+AQA
A/8B+AQAAf8BjwG/Af8B4AEHAv8B+AEHAo8BwAEDAv8BwAEHAY8BBwHAAQMBgAE8AYABBwGOAQMBgAEB
AQABGAGAAQMBgAEBAYABAQIAAYABAwGAAQEBgAEBAgABgAEBAYABAAGAAQECAAHAAQEBwAEAAYABAQEA
ARgBwAEAAcABAQGAAQEBgAE8AcABAAHAAQEBgAEBAY4BPwHAAQAB4AEPAYABAQEEAR8BgAEAAeABHwHA
AQMBJAGfAgAB4AE/AcABAwEEAR8BAAEBAeAB/wHgAQcBjgE/AZgBDwHwAf8B8AEPAv8B+AF/Av8B/AE/
Av8BgAEDAv8BgAEDAv8BgAEDAQABAQEAAQEB/AE/AaABGwEAAQEBfwH9AfABDwGvAdsBAAExAX8B/QHg
AQcBqAFbAQABSQFAAQUBwAEDAagBSwEAAUkBQAEFAcABAwGoAUsBAAExAUABBQGBAQEBqAFLAQABAQFA
AQUBgAEBAa8BywEAAQEBQAEFAYABAQGgAQsBAAH9AUABBQGAAQEBoAF7ARgBxQFAAQUBwAEDAaABiwEk
Ae0BQAEFAcABAwGgAbMBJAHNAUABBQHgAQcBoAGnARgB7QFAAQUB8AEPAb8BzwEAAf0BfwH9AfwBPwGA
AR8BAAEBAQABAQL/Cw==
</value>
</data>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
@@ -707,9 +797,6 @@
<metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>386, 19</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>533, 20</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>57</value>
</metadata>

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Velopack;
using LibGit2Sharp;
namespace DSPRE
{
@@ -13,6 +14,7 @@ namespace DSPRE
public static string DspreDataPath { get; } = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"DSPRE");
public static string DatabasePath = Path.Combine(Program.DspreDataPath, "databases");
/// <summary>
/// Punto di ingresso principale dell'applicazione.
@@ -23,7 +25,6 @@ namespace DSPRE
if (!Directory.Exists(DspreDataPath))
Directory.CreateDirectory(DspreDataPath);
VelopackApp.Build().Run();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
@@ -31,5 +32,28 @@ namespace DSPRE
CrashReporter.Initialize(mainProgram);
Application.Run(mainProgram);
}
public static void CloneAndSetupDatabase()
{
try
{
string repoUrl = "https://github.com/DS-Pokemon-Rom-Editor/scrcmd-database.git";
// Only clone if directory doesn't exist
if (!Directory.Exists(DatabasePath) && SettingsManager.Settings.databasesPulled == false)
{
Repository.Clone(repoUrl, DatabasePath);
SettingsManager.Settings.databasesPulled = true;
}
}
catch (Exception ex)
{
MessageBox.Show($"Failed to clone database repository: {ex.Message}",
"Database Setup Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -745,4 +745,7 @@
<data name="popout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Graphics\Program Icons\popout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DV_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Graphics\Program Icons\DV_Icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Net.Sockets;
using System.Windows.Controls.Primitives;
using static DSPRE.RomInfo;
using static Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System;
@@ -82,14 +83,15 @@ namespace DSPRE.ROMFiles
KeyItems = 7
}
[Flags]
public enum BattlePocket
{
None = 0,
PokeBalls = 1,
BattleItems = 2,
HpRestore = 4,
StatusHealers = 8,
PpRestore = 16
PokeBalls = 1 << 0, // 0b00001
BattleItems = 1 << 1, // 0b00010
HpRestore = 1 << 2, // 0b00100
StatusHealers = 1 << 3, // 0b01000
PpRestore = 1 << 4 // 0b10000
}
public enum HoldEffect
@@ -394,7 +396,7 @@ namespace DSPRE.ROMFiles
if (PreventToss) bitfield |= (1 << 5);
if (Selectable) bitfield |= (1 << 6);
bitfield |= (ushort)(((byte)fieldPocket & 0b1111) << 7);
bitfield |= (ushort)(((byte)battlePocket & 0b11111) << 11);
bitfield |= (ushort)((bitfield & ~(0b11111 << 11)) | (((byte)battlePocket & 0b11111) << 11));
writer.Write(bitfield);
writer.Write((byte)fieldUseFunc);

View File

@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using DSPRE.ROMFiles;
using static DSPRE.RomInfo;
@@ -12,28 +14,37 @@ namespace DSPRE {
public readonly UniqueList<(byte level, ushort move)> list;
public ushort[] GetLearnsetAtLevel(int atLevel) {
ushort[] learnset = new ushort[4] {0, 0 , 0, 0};
foreach ((ushort level, ushort move) in list)
{
if (level <= atLevel)
{
if (learnset[0] == 0) {
learnset[0] = move;
} else if (learnset[1] == 0) {
learnset[1] = move;
} else if (learnset[2] == 0) {
learnset[2] = move;
} else if (learnset[3] == 0) {
learnset[3] = move;
} else {
learnset[0] = learnset[1];
learnset[1] = learnset[2];
learnset[2] = learnset[3];
learnset[3] = move;
}
public ushort[] GetLearnsetAtLevel(int atLevel)
{
List<ushort> moves = new List<ushort>();
foreach ((byte level, ushort move) elem in list) {
if (elem.level > atLevel) {
continue; // the moves should be sorted by level so we can probably break here but better safe than sorry
}
if (elem.move == 0) {
continue; // skip empty moves
}
if (!moves.Contains(elem.move)) {
if (moves.Count >= 4)
{
moves.RemoveAt(0);
}
moves.Add(elem.move); // add the new move to the end of the list
}
}
ushort[] learnset = moves.ToArray();
// Ensure we have exactly 4 moves, filling with 0 if necessary
if (learnset.Length < 4) {
Array.Resize(ref learnset, 4);
}
return learnset;
}

View File

@@ -17,7 +17,10 @@ namespace DSPRE.ROMFiles {
OW_DIRECTION,
FUNCTION_ID,
ACTION_ID,
CMD_NUMBER
CMD_NUMBER,
POKEMON_NAME,
ITEM_NAME,
MOVE_NAME
};
public ushort? id;
@@ -64,19 +67,39 @@ namespace DSPRE.ROMFiles {
break;
}
case 0x005E: // Movement
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.ACTION_ID)}";
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.ACTION_ID)}";
break;
case 0x006A: // GetOverworldPosition
name += FormatCmd_Overworld_TwoParams(parametersList);
name += FormatCmd_Overworld_TwoParams(parametersList);
break;
case 0x0062: // Lock
case 0x0063: // Release
case 0x0064: // AddOW
case 0x0065: // RemoveOW
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)}";
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)}";
break;
case 0x006D: // SetOverworldMovement
name += FormatCmd_Overworld_Move(parametersList);
name += FormatCmd_Overworld_Move(parametersList);
break;
case 0x004C: // PlayCry
name += FormatCmd_par0Pokemonpar1Generic(parametersList);
break;
case 0x0083: // SetStarter [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.POKEMON_NAME)}";
} else {
goto default;
}
break;
case 0x0089: // GivePokemon [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_GivePokemonHGSS(parametersList);
} else {
goto default;
}
break;
case 0x00B0: // Warp [HGSS]
@@ -85,47 +108,215 @@ namespace DSPRE.ROMFiles {
} else {
goto default;
}
break;
case 0x008A: // GivePokemonEgg [HGSS]
case 0x00F9: // WildBattle [HGSS]
case 0x00FA: // WildBattleNoButtons [HGSS]
case 0x01C4: // ShowPokemonPic [HGSS]
case 0x0205: // CheckPokemonInParty [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_par0Pokemonpar1Generic(parametersList);
} else {
goto default;
}
break;
case 0x0081: // CheckItemIsMachine [HGSS]
case 0x0082: // GetItemPocket [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_par0Itempar1Generic(parametersList);
} else {
goto default;
}
break;
case 0x008B: // ReplaceMove [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_ReplaceMove(parametersList);
} else {
goto default;
}
break;
case 0x008C: // CheckPokemonHasMove [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_CheckPokemonHasMove(parametersList);
} else {
goto default;
}
break;
case 0x008D: // CheckMoveInParty [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_CheckMoveInParty(parametersList);
} else {
goto default;
}
break;
case 0x00C2: // TextItem [HGSS]
case 0x00C4: // TextMachineMove [HGSS]
case 0x01B0: // CheckFossilPokemon [HGSS]
case 0x034B: // TextItemLowercase [HGSS]
case 0x034C: // TextItemPlural [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_par0Genericpar1Item(parametersList);
} else {
goto default;
}
break;
case 0x00CA: // TextPokemon [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_TextPokemon(parametersList);
} else {
goto default;
}
break;
case 0x0185: // CheckBornPokemonInParty [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_par0Genericpar1Pokemon(parametersList);
} else {
goto default;
}
break;
case 0x0152: // SetOverworldDefaultPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_TwoParams(parametersList);
} else {
goto default;
}
break;
case 0x0153: // SetOverworldPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_3Coords_Dir(parametersList);
} else {
goto default;
}
break;
case 0x0154: // SetOverworldDefaultMovement [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Move(parametersList);
} else {
goto default;
}
break;
case 0x0155: // SetOverworldDefaultDirection [DPPt]
case 0x01B1: // CheckFossil [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Dir(parametersList);
name += FormatCmd_CheckFossil(parametersList);
} else {
goto default;
}
break;
case 0x024D: // WildBattleSp [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_par0Pokemonpar1Genericpar2Generic(parametersList);
} else {
goto default;
}
break;
case 0x007E: // TakeItem [HGSS] or CheckItem [DPPt]
case 0x007D: // GiveItem [HGSS] or CheckItemSpace [DPPt]
name += FormatCmd_TakeItem(parametersList);
break;
case 0x007F: // CheckItemSpace [HGSS] or CheckItemIsMachine [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_TakeItem(parametersList);
} else if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Itempar1Generic(parametersList);
} else {
goto default;
}
break;
case 0x0080: // CheckItem [HGSS] or GetItemPocket [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_TakeItem(parametersList);
} else if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Itempar1Generic(parametersList);
} else {
goto default;
}
break;
case 0x00D3: // GetSwarmInfo [HGSS] or TextMachineMove [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_par0Genericpar1Pokemon(parametersList);
} else if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Genericpar1Item(parametersList);
} else {
goto default;
}
break;
case 0x007B: // GiveItem [DPPt]
case 0x007C: // TakeItem [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_TakeItem(parametersList);
} else {
goto default;
}
break;
case 0x0155: // SetOverworldDefaultDirection [DPPt]
case 0x0158: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
break;
case 0x0097: // GivePokemonEgg [DPPt]
case 0x0124: // WildBattle [DPPt]
case 0x0208: // ShowPokemonPic [DPPt]
case 0x0262: // CheckPokemonInParty [DPPt]
case 0x02BD: // WildBattleSp [DPPt]
case 0x02DD: // GetBornPokemonPartyPos [DPPt]
case 0x0319: // GiratinaBattle [DPPt]
case 0x0337: // CheckPokemonIsSeen [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Pokemonpar1Generic(parametersList);
} else {
goto default;
}
break;
case 0x0096: // GivePokemon [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_GivePokemonDPPt(parametersList);
} else {
goto default;
}
break;
case 0x0099: // CheckMove [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_CheckMove(parametersList);
} else {
goto default;
}
break;
case 0x009A: // CheckMoveInParty [DPPt]
case 0x00D4: // TextMove [DPPt]
case 0x0224: // TeachMoveScreen [DPPt]
case 0x02E7: // LearnMoveScreen [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Genericpar1Move(parametersList);
} else {
goto default;
}
break;
case 0x00BE: // Warp [DPPt]
@@ -134,54 +325,132 @@ namespace DSPRE.ROMFiles {
} else {
goto default;
}
break;
case 0x00DA: // TextPokemon [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_TextPokemon(parametersList);
} else {
goto default;
}
break;
case 0x00E3: // GetSwarmInfo [DPPt]
case 0x01C0: // CheckBornPokemonInParty [DPPt]
case 0x0217: // GetAmitySquareAccessory [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Genericpar1Pokemon(parametersList);
} else {
goto default;
}
break;
case 0x00D1: // TextItem [DPPt]
case 0x01F4: // CheckFossilPokemon [DPPt]
case 0x033C: // TextItemLowercase [DPPt]
case 0x033D: // TextItemPlural [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_par0Genericpar1Item(parametersList);
} else {
goto default;
}
break;
case 0x017B: // TextBerry [DPPt]
case 0x01F5: // CheckFossil [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_CheckFossil(parametersList);
} else {
goto default;
}
break;
case 0x0182: // SetBerryMulch [DPPt]
case 0x0183: // SetBerrySpecies [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.ITEM_NAME)}";
} else {
goto default;
}
break;
case 0x0186: // SetOverworldDefaultPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_TwoParams(parametersList);
} else {
goto default;
}
break;
case 0x0187: // SetOverworldPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_3Coords_Dir(parametersList);
} else {
goto default;
}
break;
case 0x0188: // SetOverworldDefaultMovement [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Move(parametersList);
} else {
goto default;
}
break;
case 0x0189: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
break;
case 0x018C: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Dir(parametersList);
} else {
goto default;
}
break;
case 0x02E9: // ChangePartyPokemonMove [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_ChangePartyPokemonMove(parametersList);
} else {
goto default;
}
break;
case 0x02EA: // CheckAffordMove [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.MOVE_NAME)} {FormatNumber(parametersList[1], ParamTypeEnum.MOVE_NAME)}";
} else {
goto default;
}
break;
case 0x02EB: // PayTutorShards [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.MOVE_NAME)}";
} else {
goto default;
}
break;
case 0x02EC: // ShowMovePriceBoard [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_ShowMovePriceBoard(parametersList);
} else {
goto default;
}
break;
case 0x031A: // RegisterSeenPokemon [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.POKEMON_NAME)}";
} else {
goto default;
}
break;
default:
for (int i = 0; i < parametersList.Count; i++) {
name += $" {FormatNumber(parametersList[i])}";
}
break;
}
@@ -208,11 +477,73 @@ namespace DSPRE.ROMFiles {
private string FormatCmd_Overworld_Dir(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_DIRECTION)}";
}
// generic formatting command for playcry, showpokemonpic etc, first param is species, second param is a generic integer
private string FormatCmd_par0Pokemonpar1Generic(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.POKEMON_NAME)} {FormatNumber(parametersList[1])}";
}
private string FormatCmd_par0Itempar1Generic(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.ITEM_NAME)} {FormatNumber(parametersList[1])}";
}
private string FormatCmd_par0Genericpar1Item(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.ITEM_NAME)}";
}
private string FormatCmd_par0Genericpar1Pokemon(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.POKEMON_NAME)}";
}
private string FormatCmd_par0Pokemonpar1Genericpar2Generic(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.POKEMON_NAME)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])}";
}
private string FormatCmd_TakeItem(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.ITEM_NAME)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])}";
}
private string FormatCmd_ReplaceMove(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2], ParamTypeEnum.MOVE_NAME)}";
}
private string FormatCmd_CheckPokemonHasMove(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.MOVE_NAME)} {FormatNumber(parametersList[2])}";
}
private string FormatCmd_CheckMoveInParty(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.MOVE_NAME)}";
}
private string FormatCmd_TextPokemon(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.POKEMON_NAME)} {FormatNumber(parametersList[2])} {FormatNumber(parametersList[3])}";
}
private string FormatCmd_GivePokemonHGSS(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.POKEMON_NAME)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2], ParamTypeEnum.ITEM_NAME)} {FormatNumber(parametersList[3])} {FormatNumber(parametersList[4])} {FormatNumber(parametersList[5])}";
}
private string FormatCmd_GivePokemonDPPt(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.POKEMON_NAME)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2], ParamTypeEnum.ITEM_NAME)} {FormatNumber(parametersList[3])}";
}
private string FormatCmd_CheckFossil(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.ITEM_NAME)} {FormatNumber(parametersList[2])}";
}
private string FormatCmd_CheckMove(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.MOVE_NAME)} {FormatNumber(parametersList[2])}";
}
private string FormatCmd_par0Genericpar1Move(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1], ParamTypeEnum.MOVE_NAME)}";
}
private string FormatCmd_ChangePartyPokemonMove(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2], ParamTypeEnum.MOVE_NAME)}";
}
private string FormatCmd_ShowMovePriceBoard(List<byte[]> parametersList)
{
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2], ParamTypeEnum.MOVE_NAME)} {FormatNumber(parametersList[3])}";
}
public ScriptCommand(string wholeLine, int lineNumber = 0) {
name = wholeLine;
cmdParams = new List<byte[]>();
string[] nameParts = wholeLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Separate command code from parameters
var processedLine = ProcessBracketedItems(wholeLine);
string[] nameParts = processedLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Separate command code from parameters
/* Get command id, which is always first in the description */
if (RomInfo.ScriptCommandNamesReverseDict.TryGetValue(nameParts[0].ToLower(), out ushort cmdID)) {
@@ -241,7 +572,7 @@ namespace DSPRE.ROMFiles {
int paramLength = 0;
int paramsProcessed = 0;
if (parametersSizeArr.First() == 0xFF) {
if (parametersSizeArr.Length > 0 && parametersSizeArr.First() == 0xFF) {
int firstParamValue = int.Parse(nameParts[1].PurgeSpecial(ScriptFile.specialChars), nameParts[1].GetNumberStyle());
byte firstParamSize = parametersSizeArr[1];
@@ -315,35 +646,75 @@ namespace DSPRE.ROMFiles {
int result = 0;
try {
try
{
result = int.Parse(nameParts[i + 1], numStyle);
} catch {
if (string.IsNullOrWhiteSpace(nameParts[i + 1])) {
MessageBox.Show($"You must specify an Overworld ID, Script, Function or Action number.\n\n" +
$"Line {lineNumber}: {wholeLine}", "Unspecified identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
} else {
var first = ScriptDatabase.specialOverworlds.FirstOrDefault(x => x.Value.IgnoreCaseEquals(nameParts[i + 1]));
if (string.IsNullOrWhiteSpace(first.Value)) {
var res = ScriptDatabase.overworldDirections.FirstOrDefault(x => x.Value.IgnoreCaseEquals(nameParts[i + 1]));
if (string.IsNullOrWhiteSpace(res.Value)) {
MessageBox.Show($"Argument {nameParts[i + 1]} couldn't be parsed as a valid Condition, Overworld ID, Direction ID, Script, Function or Action number.\n\n" +
$"Line {lineNumber}: {wholeLine}", "Invalid identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
} else {
result = res.Key;
}
} else {
}
catch (FormatException)
{
try
{
string paramToCheck = RestoreSpaces(nameParts[i + 1]);
var first = ScriptDatabase.specialOverworlds.FirstOrDefault(x => x.Value.IgnoreCaseEquals(paramToCheck));
if (!string.IsNullOrWhiteSpace(first.Value))
{
result = first.Key;
}
else
{
var direction = ScriptDatabase.overworldDirections.FirstOrDefault(x => x.Value.IgnoreCaseEquals(paramToCheck));
if (!string.IsNullOrWhiteSpace(direction.Value))
{
result = direction.Key;
}
else
{
var pokemon = ScriptDatabase.pokemonNames.FirstOrDefault(x => x.Value.IgnoreCaseEquals(paramToCheck));
if (!string.IsNullOrWhiteSpace(pokemon.Value))
{
result = pokemon.Key;
}
else
{
var item = ScriptDatabase.itemNames.FirstOrDefault(x => x.Value.IgnoreCaseEquals(paramToCheck));
if (!string.IsNullOrWhiteSpace(item.Value))
{
result = item.Key;
}
else
{
var move = ScriptDatabase.moveNames.FirstOrDefault(x => x.Value.IgnoreCaseEquals(paramToCheck));
if (!string.IsNullOrWhiteSpace(move.Value))
{
result = move.Key;
}
else
{
MessageBox.Show($"Argument {paramToCheck} couldn't be parsed as a valid Condition, Overworld ID, Direction ID, Pokemon ID, Item ID, Move ID, Script, Function or Action number.\n\n" +
$"Line {lineNumber}: {wholeLine}", "Invalid identifier", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
return;
}
}
}
}
}
}
catch (ArgumentException ex)
{
MessageBox.Show($"{ex.Message}\n\nLine {lineNumber}: {wholeLine}",
"Invalid syntax", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
return;
}
}
try {
try
{
cmdParams.Add(result.ToByteArrayChooseSize(parametersSizeArr[i]));
} catch (OverflowException) {
}
catch (OverflowException)
{
MessageBox.Show($"Argument {nameParts[i + 1]} at line {lineNumber} is not in the range [0, {Math.Pow(2, 8 * parametersSizeArr[i]) - 1}].", "Argument error", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
}
@@ -357,6 +728,155 @@ namespace DSPRE.ROMFiles {
}
}
private string ProcessBracketedItems(string line)
{
// Early exit if no brackets
if (!line.Contains('[')) return line;
StringBuilder result = new StringBuilder(line);
int currentPos = 0;
while (true)
{
int start = result.ToString().IndexOf('[', currentPos);
if (start == -1) break;
int end = result.ToString().IndexOf(']', start);
if (end == -1) break;
// Process only the current bracket pair
for (int i = start + 1; i < end; i++)
{
if (result[i] == ' ')
{
result[i] = '§';
}
}
currentPos = end + 1;
}
return result.ToString();
}
private int LevenshteinDistance(string s1, string s2)
{
int[,] d = new int[s1.Length + 1, s2.Length + 1];
for (int i = 0; i <= s1.Length; i++)
d[i, 0] = i;
for (int j = 0; j <= s2.Length; j++)
d[0, j] = j;
for (int i = 1; i <= s1.Length; i++)
{
for (int j = 1; j <= s2.Length; j++)
{
int cost = (s2[j - 1] == s1[i - 1]) ? 0 : 1;
d[i, j] = Math.Min(Math.Min(
d[i - 1, j] + 1,
d[i, j - 1] + 1),
d[i - 1, j - 1] + cost);
}
}
return d[s1.Length, s2.Length];
}
private string FindClosestMatch(string input, IEnumerable<string> possibilities, int threshold = 3)
{
// Remove brackets and spaces for comparison
input = input.Trim('[', ']').Replace(" ", "").ToLower();
var closest = possibilities
.Select(x => new {
Name = x,
Distance = LevenshteinDistance(
input,
x.Replace(" ", "").ToLower()
)
})
.Where(x => x.Distance <= threshold)
.OrderBy(x => x.Distance)
.FirstOrDefault();
return closest?.Name;
}
private string RestoreSpaces(string parameter)
{
if (!parameter.StartsWith("[") || !parameter.EndsWith("]"))
return parameter;
string content = parameter.Substring(1, parameter.Length - 2);
// First restore any § back to spaces for comparison
string contentWithSpaces = content.Replace("§", " ");
// Check for Pokemon names first
var pokemon = ScriptDatabase.pokemonNames.FirstOrDefault(x =>
x.Value.IgnoreCaseEquals(contentWithSpaces));
if (!string.IsNullOrWhiteSpace(pokemon.Value))
{
return pokemon.Value;
}
// Then check for Item names
var item = ScriptDatabase.itemNames.FirstOrDefault(x =>
x.Value.IgnoreCaseEquals(contentWithSpaces));
if (!string.IsNullOrWhiteSpace(item.Value))
{
return item.Value;
}
// Then check for Move names
var move = ScriptDatabase.moveNames.FirstOrDefault(x =>
x.Value.IgnoreCaseEquals(contentWithSpaces));
if (!string.IsNullOrWhiteSpace(move.Value))
{
return move.Value;
}
// If it's a number in brackets, provide suggestions
if (int.TryParse(content, out int numericValue))
{
string suggestion = "";
if (ScriptDatabase.itemNames.TryGetValue((ushort)numericValue, out string itemName))
{
suggestion = $"\nDid you mean [{itemName}]?";
}
else if (ScriptDatabase.pokemonNames.TryGetValue((ushort)numericValue, out string pokemonName))
{
suggestion = $"\nDid you mean [{pokemonName}]?";
}
else if (ScriptDatabase.moveNames.TryGetValue((ushort)numericValue, out string moveName))
{
suggestion = $"\nDid you mean [{moveName}]?";
}
throw new ArgumentException($"Invalid syntax: Numbers should not be wrapped in brackets: '{parameter}'{suggestion}");
}
string closestItem = FindClosestMatch(contentWithSpaces, ScriptDatabase.itemNames.Values);
if (!string.IsNullOrWhiteSpace(closestItem))
{
throw new ArgumentException($"'{parameter}' is not a valid Item name.\nDid you mean [{closestItem}]?");
}
string closestPokemon = FindClosestMatch(contentWithSpaces, ScriptDatabase.pokemonNames.Values);
if (!string.IsNullOrWhiteSpace(closestPokemon))
{
throw new ArgumentException($"'{parameter}' is not a valid Pokemon name.\nDid you mean [{closestPokemon}]?");
}
string closestMove = FindClosestMatch(contentWithSpaces, ScriptDatabase.moveNames.Values);
if (!string.IsNullOrWhiteSpace(closestMove))
{
throw new ArgumentException($"'{parameter}' is not a valid Move name.\nDid you mean [{closestMove}]?");
}
return contentWithSpaces;
}
private string FormatNumber(byte[] par, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
//number acquisition
uint num;
@@ -426,6 +946,53 @@ namespace DSPRE.ROMFiles {
outp += $"Direction.";
}
goto default;
}
}
case ParamTypeEnum.POKEMON_NAME:
{
if (ScriptDatabase.pokemonNames.TryGetValue((ushort)num, out string output))
{
return $"[{output}]"; // Return the already-bracketed name directly
}
else
{
if (num < 4000)
{
outp += $"Pokemon.";
}
goto default;
}
}
case ParamTypeEnum.ITEM_NAME:
{
if (ScriptDatabase.itemNames.TryGetValue((ushort)num, out string output))
{
return $"[{output}]";
}
else
{
if (num < 4000)
{
outp += $"Item.";
}
goto default;
}
}
case ParamTypeEnum.MOVE_NAME:
{
if (ScriptDatabase.moveNames.TryGetValue((ushort)num, out string output))
{
return $"[{output}]";
}
else
{
if (num < 4000)
{
outp += $"Move.";
}
goto default;
}
}

View File

@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static DSPRE.RomInfo;
namespace DSPRE.ROMFiles
{
internal class TradeData : RomFile
{
public int id;
// TradeData structure in narc
public int species;
public int hpIV;
public int atkIV;
public int defIV;
public int speedIV;
public int spAtkIV;
public int spDefIV;
public int ability; // unused
public int otID;
public int cool;
public int beauty;
public int cute;
public int smart;
public int tough;
public int pid;
public int heldItem;
public int otGender;
public int sheen;
public int language;
public int requestedSpecies;
public int unknown; // unused?
public TradeData(int id, Stream stream)
{
this.id = id;
using (BinaryReader br = new BinaryReader(stream))
{
species = br.ReadInt32();
hpIV = br.ReadInt32();
atkIV = br.ReadInt32();
defIV = br.ReadInt32();
speedIV = br.ReadInt32();
spAtkIV = br.ReadInt32();
spDefIV = br.ReadInt32();
ability = br.ReadInt32(); // appears unused
otID = br.ReadInt32();
cool = br.ReadInt32();
beauty = br.ReadInt32();
cute = br.ReadInt32();
smart = br.ReadInt32();
tough = br.ReadInt32();
pid = br.ReadInt32();
heldItem = br.ReadInt32();
otGender = br.ReadInt32();
sheen = br.ReadInt32();
language = br.ReadInt32();
requestedSpecies = br.ReadInt32();
if (RomInfo.gameFamily == GameFamilies.HGSS)
{
unknown = br.ReadInt32(); // unused?
}
}
}
public TradeData(int id) : this(id, GetStream(id)) { }
private static Stream GetStream(int id)
{
if (!File.Exists(RomInfo.gameDirs[DirNames.tradeData].unpackedDir + "\\" + id.ToString("D4")))
{
// If the file does not exist, create it with default values
FileStream fileStream = new FileStream(RomInfo.gameDirs[DirNames.tradeData].unpackedDir + "\\" + id.ToString("D4"), FileMode.Create);
fileStream.Write(new byte[0x50], 0, 0x50); // create an empty file
if (RomInfo.gameFamily == GameFamilies.HGSS)
{
fileStream.Write(new byte[0x04], 0, 0x04); // HGSS only
}
fileStream.Seek(0, SeekOrigin.Begin); // Reset the position to the start of the file
return fileStream;
}
return new FileStream(RomInfo.gameDirs[DirNames.tradeData].unpackedDir + "\\" + id.ToString("D4"), FileMode.Open);
}
public override byte[] ToByteArray()
{
using (MemoryStream ms = new MemoryStream())
using (BinaryWriter bw = new BinaryWriter(ms))
{
bw.Write(species);
bw.Write(hpIV);
bw.Write(atkIV);
bw.Write(defIV);
bw.Write(speedIV);
bw.Write(spAtkIV);
bw.Write(spDefIV);
bw.Write(ability); // unused
bw.Write(otID);
bw.Write(cool);
bw.Write(beauty);
bw.Write(cute);
bw.Write(smart);
bw.Write(tough);
bw.Write(pid);
bw.Write(heldItem);
bw.Write(otGender);
bw.Write(sheen);
bw.Write(language);
bw.Write(requestedSpecies);
if (RomInfo.gameFamily == GameFamilies.HGSS)
{
bw.Write(unknown); // HGSS only
}
return ms.ToArray();
}
}
public void SaveToFileDefaultDir(int IDtoReplace, bool showSuccessMessage = true)
{
SaveToFileDefaultDir(DirNames.tradeData, IDtoReplace, showSuccessMessage);
}
public void SaveToFileExplorePath(string suggestedFileName, bool showSuccessMessage = true)
{
SaveToFileExplorePath("Gen IV Trade data", "bin", suggestedFileName, showSuccessMessage);
}
public static int GetTradeCount()
{
return Directory.GetFiles(RomInfo.gameDirs[DirNames.tradeData].unpackedDir, "*.*").Length;
}
}
}

View File

@@ -1805,7 +1805,7 @@ namespace DSPRE.Resources {
/* 213 */ "Camouflage effect",
/* 214 */ "Roost effect",
/* 215 */ "Gravity effect",
/* 216 */ "2x power if target is asleep; wakes up target",
/* 216 */ "Miracle Eye effect",
/* 217 */ "Wake-Up Slap effect",
/* 218 */ "Lowers user's Spd",
/* 219 */ "Power = min(150; (25 x Target's Current Speed / User's Current Speed) + 1)",

File diff suppressed because it is too large Load Diff

View File

@@ -175,7 +175,9 @@ namespace DSPRE
evolutions,
itemData,
itemIcons
itemIcons,
tradeData
};
public static Dictionary<DirNames, (string packedDir, string unpackedDir)> gameDirs { get; private set; }
@@ -247,6 +249,14 @@ namespace DSPRE
ScriptCommandNamesReverseDict = ScriptCommandNamesDict.Reverse();
ScriptActionNamesReverseDict = ScriptActionNamesDict.Reverse();
ScriptComparisonOperatorsReverseDict = ScriptComparisonOperatorsDict.Reverse();
if (gameVersion == GameVersions.Platinum) {
ScriptDatabaseJsonLoader.InitializeFromJson(Path.Combine(Program.DatabasePath, "platinum_scrcmd_database.json"), gameVersion);
} else if (gameVersion == GameVersions.HeartGold || gameVersion == GameVersions.SoulSilver) {
ScriptDatabaseJsonLoader.InitializeFromJson(Path.Combine(Program.DatabasePath, "hgss_scrcmd_database.json"), gameVersion);
} else if (gameVersion == GameVersions.Diamond || gameVersion == GameVersions.Pearl) {
ScriptDatabaseJsonLoader.InitializeFromJson(Path.Combine(Program.DatabasePath, "diamond_pearl_scrcmd_database.json"), gameVersion);
}
}
#endregion Constructors (1)
@@ -261,13 +271,14 @@ namespace DSPRE
switch (gameFam)
{
case GameFamilies.DP:
commonDictionaryNames = ScriptDatabase.DPPtScrCmdNames;
specificDictionaryNames = ScriptDatabase.DPScrCmdNames;
commonDictionaryNames = ScriptDatabase.DPScrCmdNames;
specificDictionaryNames = new Dictionary<ushort, string>();
break;
case GameFamilies.Plat:
commonDictionaryNames = ScriptDatabase.DPPtScrCmdNames;
specificDictionaryNames = ScriptDatabase.PlatScrCmdNames;
//commonDictionaryNames = ScriptDatabase.DPPtScrCmdNames;
commonDictionaryNames = ScriptDatabase.PlatScrCmdNames;
specificDictionaryNames = new Dictionary<ushort, string>();
break;
default:
@@ -290,13 +301,13 @@ namespace DSPRE
switch (gameFam)
{
case GameFamilies.DP:
commonDictionaryParams = ScriptDatabase.DPPtScrCmdParameters;
specificDictionaryParams = ScriptDatabase.DPScrCmdParameters;
commonDictionaryParams = ScriptDatabase.DPScrCmdParameters;
specificDictionaryParams = new Dictionary<ushort, byte[]>();
break;
case GameFamilies.Plat:
commonDictionaryParams = ScriptDatabase.DPPtScrCmdParameters;
specificDictionaryParams = ScriptDatabase.PlatScrCmdParameters;
commonDictionaryParams = ScriptDatabase.PlatScrCmdParameters;
specificDictionaryParams = new Dictionary<ushort, byte[]>();
break;
default:
@@ -1024,7 +1035,7 @@ namespace DSPRE
switch (gameFamily)
{
case GameFamilies.DP:
itemNamesTextNumber = 344;
itemNamesTextNumber = gameLanguage == GameLanguages.Japanese ? 341 : 344;
itemDescriptionsTextNumber = 0;
break;
@@ -1470,7 +1481,9 @@ namespace DSPRE
[DirNames.otherPokemonBattleSprites] = @"data\poketool\pokegra\otherpoke.narc",
[DirNames.itemData] = @"data\itemtool\itemdata\item_data.narc",
[DirNames.itemIcons] = @"data\itemtool\itemdata\item_icon.narc"
[DirNames.itemIcons] = @"data\itemtool\itemdata\item_icon.narc",
[DirNames.tradeData] = @"data\fielddata\pokemon_trade\fld_trade.narc"
};
//Personal Data archive is different for Pearl
@@ -1482,6 +1495,11 @@ namespace DSPRE
personal += @"\personal.narc";
packedDirsDict[DirNames.personalPokeData] = personal;
if (gameLanguage != GameLanguages.Japanese)
{
packedDirsDict[DirNames.tradeData] = $@"data\resource\{GetLangResFolderName()}\pokemon_trade\fld_trade.narc";
}
break;
case GameFamilies.Plat:
@@ -1525,8 +1543,16 @@ namespace DSPRE
[DirNames.evolutions] = @"data\poketool\personal\evo.narc",
[DirNames.itemData] = @"data\itemtool\itemdata\pl_item_data.narc",
[DirNames.itemIcons] = @"data\itemtool\itemdata\item_icon.narc"
[DirNames.itemIcons] = @"data\itemtool\itemdata\item_icon.narc",
[DirNames.tradeData] = @"data\fielddata\pokemon_trade\fld_trade.narc"
};
if (gameLanguage != GameLanguages.Japanese && gameLanguage != GameLanguages.English)
{
packedDirsDict[DirNames.tradeData] = $@"data\resource\{GetLangResFolderName()}\pokemon_trade\fld_trade.narc";
}
break;
case GameFamilies.HGSS:
@@ -1567,6 +1593,7 @@ namespace DSPRE
[DirNames.evolutions] = @"data\a\0\3\4",
[DirNames.itemData] = @"data\a\0\1\7",
[DirNames.itemIcons] = @"data\a\0\1\8",
[DirNames.tradeData] = @"data\a\1\1\2",
[DirNames.safariZone] = @"data\a\2\3\0",
[DirNames.headbutt] = @"data\a\2\5\2", //both versions use the same folder with different data
@@ -1584,6 +1611,25 @@ namespace DSPRE
}
}
public static string GetLangResFolderName()
{
switch (gameLanguage)
{
case GameLanguages.English:
return "eng";
case GameLanguages.Italian:
return "ita";
case GameLanguages.French:
return "fra";
case GameLanguages.German:
return "ger";
case GameLanguages.Spanish:
return "spa";
default:
return "";
}
}
public void ResetMapCellsColorDictionary()
{
switch (gameFamily)

View File

@@ -5,7 +5,10 @@ public class ScriptParameter {
Integer,
RelativeJump,
Byte,
Variable
Variable,
PokemonName,
ItemName,
MoveName
}
public ParameterType Type { get; set; } = ParameterType.Integer;

View File

@@ -23,6 +23,7 @@ namespace DSPRE
public string mapImportStarterPoint { get; set; } = "";
public string openDefaultRom { get; set; } = "";
public bool neverAskForOpening { get; set; } = false;
public bool databasesPulled { get; set; } = false;
}
public static class SettingsManager

BIN
DS_Map/Tools/msgenc.exe Normal file

Binary file not shown.

661
LICENSE Normal file
View File

@@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.