mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
Simplifying Code and fixing ball population
This commit is contained in:
parent
90dffe42ca
commit
f091fa5ca9
6 changed files with 66 additions and 20 deletions
|
@ -28,8 +28,8 @@ namespace PKHeX
|
||||||
752,753,754,755,756,757,758,759,760,761,762,763,764,767,768,769,770,
|
752,753,754,755,756,757,758,759,760,761,762,763,764,767,768,769,770,
|
||||||
};
|
};
|
||||||
internal static readonly int[] Items_Ball = { 4, 3, 2, 7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6, 12, 15, 9, 5, 499, 10, 1, 16 };
|
internal static readonly int[] Items_Ball = { 4, 3, 2, 7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6, 12, 15, 9, 5, 499, 10, 1, 16 };
|
||||||
internal static readonly int[] Items_CommonBall = { 4, 3, 2 };
|
internal static readonly int[] Items_CommonBall = { 4, 3, 2, 1};
|
||||||
internal static readonly int[] Items_UncommonBall = { 7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6, 12, 15, 9, 5, 499, 10, 1, 16 };
|
internal static readonly int[] Items_UncommonBall = { 7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6, 12, 15, 9, 5, 499, 10, 16 };
|
||||||
#endregion
|
#endregion
|
||||||
internal static readonly int[] Gen4EncounterTypes = { 2, 4, 9, 10, 24 };
|
internal static readonly int[] Gen4EncounterTypes = { 2, 4, 9, 10, 24 };
|
||||||
#region Games
|
#region Games
|
||||||
|
|
26
Misc/PKX.cs
26
Misc/PKX.cs
|
@ -216,25 +216,21 @@ namespace PKHeX
|
||||||
int growth = MonData.EXPGrowth;
|
int growth = MonData.EXPGrowth;
|
||||||
uint levelxp = (uint)table.Rows[tl][growth + 1];
|
uint levelxp = (uint)table.Rows[tl][growth + 1];
|
||||||
|
|
||||||
if (levelxp < exp)
|
while (levelxp < exp)
|
||||||
{
|
{
|
||||||
while (levelxp < exp)
|
// While EXP for guessed level is below our current exp
|
||||||
|
tl += 1;
|
||||||
|
if (tl == 100)
|
||||||
{
|
{
|
||||||
// While EXP for guessed level is below our current exp
|
exp = getEXP(100, species);
|
||||||
tl += 1;
|
|
||||||
if (tl == 100)
|
|
||||||
{
|
|
||||||
exp = getEXP(100, species);
|
|
||||||
return tl;
|
|
||||||
}
|
|
||||||
levelxp = (uint)table.Rows[tl][growth + 1];
|
|
||||||
// when calcexp exceeds our exp, we exit loop
|
|
||||||
}
|
|
||||||
if (levelxp == exp) // Matches level threshold
|
|
||||||
return tl;
|
return tl;
|
||||||
else return (tl - 1);
|
}
|
||||||
|
levelxp = (uint)table.Rows[tl][growth + 1];
|
||||||
|
// when calcexp >= our exp, we exit loop
|
||||||
}
|
}
|
||||||
else return tl;
|
if (levelxp == exp) // Matches level threshold
|
||||||
|
return tl;
|
||||||
|
else return (tl - 1);
|
||||||
}
|
}
|
||||||
public static bool getIsShiny(uint PID, uint TID, uint SID)
|
public static bool getIsShiny(uint PID, uint TID, uint SID)
|
||||||
{
|
{
|
||||||
|
|
40
Misc/Util.cs
40
Misc/Util.cs
|
@ -431,6 +431,13 @@ namespace PKHeX
|
||||||
return Text;
|
return Text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal static string[] getFilteredList(string[] data, int[] chosen)
|
||||||
|
{
|
||||||
|
string[] result = new string[chosen.Length];
|
||||||
|
for (int i = 0; i < chosen.Length; i++)
|
||||||
|
result[i] = data[chosen[i]];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
internal static List<cbItem> getCBList(string textfile, string lang)
|
internal static List<cbItem> getCBList(string textfile, string lang)
|
||||||
{
|
{
|
||||||
// Set up
|
// Set up
|
||||||
|
@ -525,6 +532,39 @@ namespace PKHeX
|
||||||
}
|
}
|
||||||
return cbList;
|
return cbList;
|
||||||
}
|
}
|
||||||
|
internal static List<cbItem> getVariedCBList(List<cbItem> cbList, string[] inStrings, int[] stringNum, int[] stringVal)
|
||||||
|
{
|
||||||
|
// Set up
|
||||||
|
List<cbItem> newlist = new List<cbItem>();
|
||||||
|
|
||||||
|
for (int i = 4; i > 1; i--) // add 4,3,2
|
||||||
|
{
|
||||||
|
// First 3 Balls are always first
|
||||||
|
cbItem ncbi = new cbItem();
|
||||||
|
ncbi.Text = inStrings[i];
|
||||||
|
ncbi.Value = i;
|
||||||
|
newlist.Add(ncbi);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the Rest based on String Name
|
||||||
|
string[] ballnames = new string[stringNum.Length];
|
||||||
|
for (int i = 0; i < stringNum.Length; i++)
|
||||||
|
ballnames[i] = inStrings[stringNum[i]];
|
||||||
|
|
||||||
|
string[] sortedballs = new string[stringNum.Length];
|
||||||
|
Array.Copy(ballnames, sortedballs, ballnames.Length);
|
||||||
|
Array.Sort(sortedballs);
|
||||||
|
|
||||||
|
// Add the rest of the balls
|
||||||
|
for (int i = 0; i < sortedballs.Length; i++)
|
||||||
|
{
|
||||||
|
cbItem ncbi = new cbItem();
|
||||||
|
ncbi.Text = sortedballs[i];
|
||||||
|
ncbi.Value = stringVal[Array.IndexOf(ballnames, sortedballs[i])];
|
||||||
|
newlist.Add(ncbi);
|
||||||
|
}
|
||||||
|
return newlist;
|
||||||
|
}
|
||||||
internal static List<cbItem> getUnsortedCBList(string textfile)
|
internal static List<cbItem> getUnsortedCBList(string textfile)
|
||||||
{
|
{
|
||||||
// Set up
|
// Set up
|
||||||
|
|
2
PKX/f1-Main.Designer.cs
generated
2
PKX/f1-Main.Designer.cs
generated
|
@ -3277,6 +3277,7 @@
|
||||||
// PAN_BattleBox
|
// PAN_BattleBox
|
||||||
//
|
//
|
||||||
this.PAN_BattleBox.BackgroundImage = global::PKHeX.Properties.Resources.party;
|
this.PAN_BattleBox.BackgroundImage = global::PKHeX.Properties.Resources.party;
|
||||||
|
this.PAN_BattleBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.PAN_BattleBox.Controls.Add(this.bbpkx1);
|
this.PAN_BattleBox.Controls.Add(this.bbpkx1);
|
||||||
this.PAN_BattleBox.Controls.Add(this.bbpkx2);
|
this.PAN_BattleBox.Controls.Add(this.bbpkx2);
|
||||||
this.PAN_BattleBox.Controls.Add(this.bbpkx3);
|
this.PAN_BattleBox.Controls.Add(this.bbpkx3);
|
||||||
|
@ -3385,6 +3386,7 @@
|
||||||
// PAN_Party
|
// PAN_Party
|
||||||
//
|
//
|
||||||
this.PAN_Party.BackgroundImage = global::PKHeX.Properties.Resources.party;
|
this.PAN_Party.BackgroundImage = global::PKHeX.Properties.Resources.party;
|
||||||
|
this.PAN_Party.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.PAN_Party.Controls.Add(this.ppkx1);
|
this.PAN_Party.Controls.Add(this.ppkx1);
|
||||||
this.PAN_Party.Controls.Add(this.ppkx2);
|
this.PAN_Party.Controls.Add(this.ppkx2);
|
||||||
this.PAN_Party.Controls.Add(this.ppkx3);
|
this.PAN_Party.Controls.Add(this.ppkx3);
|
||||||
|
|
|
@ -765,7 +765,9 @@ namespace PKHeX
|
||||||
// Set the various ComboBox DataSources up with their allowed entries
|
// Set the various ComboBox DataSources up with their allowed entries
|
||||||
CB_3DSReg.DataSource = Util.getUnsortedCBList("regions3ds");
|
CB_3DSReg.DataSource = Util.getUnsortedCBList("regions3ds");
|
||||||
CB_Language.DataSource = Util.getUnsortedCBList("languages");
|
CB_Language.DataSource = Util.getUnsortedCBList("languages");
|
||||||
CB_Ball.DataSource = Util.getCBList(itemlist, new int[] { 4 }, new int[] { 3 }, new int[] { 2 }, Legal.Items_UncommonBall);
|
int[] ball_nums = new int[] { 7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6, 12, 15, 9, 5, 499, 10, 1, 16 };
|
||||||
|
int[] ball_vals = new int[] { 7, 25, 13, 17, 22, 14, 20, 18, 21, 19, 11, 23, 8, 6, 12, 15, 9, 5, 24, 10, 1, 16 };
|
||||||
|
CB_Ball.DataSource = Util.getVariedCBList(Util.getCBList(itemlist, new int[] { 4 }, new int[] { 3 }, new int[] { 2 }, new int[] { 1 }), itemlist, ball_nums, ball_vals);
|
||||||
CB_HeldItem.DataSource = Util.getCBList(itemlist, (DEV_Ability.Enabled) ? null : Legal.Items_Held);
|
CB_HeldItem.DataSource = Util.getCBList(itemlist, (DEV_Ability.Enabled) ? null : Legal.Items_Held);
|
||||||
CB_Species.DataSource = Util.getCBList(specieslist, null);
|
CB_Species.DataSource = Util.getCBList(specieslist, null);
|
||||||
DEV_Ability.DataSource = Util.getCBList(abilitylist, null);
|
DEV_Ability.DataSource = Util.getCBList(abilitylist, null);
|
||||||
|
|
|
@ -410,9 +410,15 @@ http://projectpokemon.org/forums/showthread.php?36986
|
||||||
- Improved: Message popups should be much more appealing.
|
- Improved: Message popups should be much more appealing.
|
||||||
- Fixed various bugs for drag&drop.
|
- Fixed various bugs for drag&drop.
|
||||||
|
|
||||||
12/17/14 - New Update:
|
12/17/14 - New Update: (790)
|
||||||
- Fixed: DexNav levels saving to species-1.
|
- Fixed: DexNav levels saving to species-1.
|
||||||
- Fixed: EXP growth accessing the wrong exp table.
|
- Fixed: EXP growth accessing the wrong exp table.
|
||||||
- Fixed: Dragout sprite update triggering errors.
|
- Fixed: Dragout sprite update triggering errors.
|
||||||
- Changed: Gen4 Encounter Type will only appear for Pokemon that originate from Gen 4.
|
- Changed: Gen4 Encounter Type will only appear for Pokemon that originate from Gen 4.
|
||||||
- Fixed: Some item sprites.
|
- Fixed: Some item sprites.
|
||||||
|
|
||||||
|
12/18/14 - New Update:
|
||||||
|
- Fixed: EXP-level defaulting to 100.
|
||||||
|
- Fixed: Abilities not populating correctly.
|
||||||
|
- Fixed: Balls not being set properly.
|
||||||
|
- Added: Some more PSS stat strings to the Trainer Editor.
|
Loading…
Reference in a new issue