Misc updates

extract some enums to core, use Enum.GetNames to do string fetch
make stamp listbox taller
clean up Display*ID setters
This commit is contained in:
Kurt
2019-02-21 21:54:41 -08:00
parent 5f4241063f
commit df94afa711
11 changed files with 212 additions and 165 deletions

View File

@@ -67,6 +67,7 @@ public bool Execute(BoxManipType type, int box, bool allBoxes, bool reverse = fa
/// </summary>
/// <param name="message">Optional message to show if applicable.</param>
/// <param name="all">Indicates if all boxes were manipulated, or just one box.</param>
/// <param name="count">Count of manipulated slots</param>
protected abstract void FinishBoxManipulation(string message, bool all, int count);
}
}

View File

@@ -90,7 +90,7 @@ private static CheckMoveResult[] ParseMovesForSmeargle(PKM pkm, int[] Moves, Leg
private static CheckMoveResult[] ParseMovesIsEggPreRelearn(PKM pkm, int[] Moves, int[] SpecialMoves, EncounterEgg e)
{
EggInfoSource infoset = new EggInfoSource(pkm, SpecialMoves, e);
var infoset = new EggInfoSource(pkm, SpecialMoves, e);
return VerifyPreRelearnEggBase(pkm, Moves, infoset);
}
@@ -155,7 +155,7 @@ private static CheckMoveResult[] ParseMovesPre3DS(PKM pkm, int[] Moves, LegalInf
{
if (pkm.IsEgg && info.EncounterMatch is EncounterEgg egg)
{
int[] SpecialMoves = GetSpecialMoves(info.EncounterMatch);
var SpecialMoves = GetSpecialMoves(info.EncounterMatch);
return ParseMovesIsEggPreRelearn(pkm, Moves, SpecialMoves, egg);
}
if (info.EncounterMatch is EncounterEgg e)
@@ -168,12 +168,12 @@ private static CheckMoveResult[] ParseMovesPre3DS(PKM pkm, int[] Moves, LegalInf
private static CheckMoveResult[] ParseMovesGenGB(PKM pkm, int[] Moves, LegalInfo info)
{
CheckMoveResult[] res = new CheckMoveResult[4];
var res = new CheckMoveResult[4];
var G1Encounter = info.EncounterMatch;
if (G1Encounter == null)
return ParseMovesSpecialMoveset(pkm, Moves, info);
var InitialMoves = Array.Empty<int>();
int[] SpecialMoves = GetSpecialMoves(info.EncounterMatch);
var SpecialMoves = GetSpecialMoves(info.EncounterMatch);
var games = info.EncounterMatch is IGeneration g && g.Generation == 1 ? GBRestrictions.GetGen1Versions(info) : GBRestrictions.GetGen2Versions(info);
foreach (var ver in games)
{
@@ -223,12 +223,11 @@ private static CheckMoveResult[] ParseMovesRelearn(PKM pkm, int[] Moves, LegalIn
if (info.EncounterMatch is EncounterEgg e)
source.EggMoveSource = MoveEgg.GetEggMoves(pkm, e.Species, pkm.AltForm, e.Version);
CheckMoveResult[] res = ParseMoves(pkm, source, info);
int[] RelearnMoves = pkm.RelearnMoves;
var res = ParseMoves(pkm, source, info);
var relearn = pkm.RelearnMoves;
for (int i = 0; i < 4; i++)
{
if ((pkm.IsEgg || res[i].Flag) && !RelearnMoves.Contains(Moves[i]))
if ((pkm.IsEgg || res[i].Flag) && !relearn.Contains(Moves[i]))
res[i] = new CheckMoveResult(res[i], Invalid, string.Format(LMoveRelearnFMiss_0, res[i].Comment), res[i].Identifier);
}
@@ -237,7 +236,7 @@ private static CheckMoveResult[] ParseMovesRelearn(PKM pkm, int[] Moves, LegalIn
private static CheckMoveResult[] ParseMoves(PKM pkm, MoveParseSource source, LegalInfo info)
{
CheckMoveResult[] res = new CheckMoveResult[4];
var res = new CheckMoveResult[4];
bool AllParsed() => res.All(z => z != null);
var required = pkm.Format != 1 ? 1 : GBRestrictions.GetRequiredMoveCount(pkm, source.CurrentMoves, info, source.Base);
@@ -289,21 +288,21 @@ private static void ParseMovesByGeneration(PKM pkm, CheckMoveResult[] res, int g
switch (gen)
{
case 3:
case 4:
if (pkm.Format > gen)
FlagIncompatibleTransferHMs(res, learnInfo.Source.CurrentMoves, gen, HMLearned, KnowDefogWhirlpool);
break;
case 1:
case 2:
ParseMovesByGeneration12(pkm, res, learnInfo.Source.CurrentMoves, gen, info, learnInfo);
break;
case 3:
case 4:
if (pkm.Format > gen)
FlagIncompatibleTransferHMs45(res, learnInfo.Source.CurrentMoves, gen, HMLearned, KnowDefogWhirlpool);
break;
}
// Pokemon that evolved by leveling up while learning a specific move
// This pokemon could only have 3 moves from preevolutions that are not the move used to evolved
// including special and eggs moves before realearn generations
// including special and eggs moves before relearn generations
if (Legal.SpeciesEvolutionWithMove.Contains(pkm.Species))
ParseEvolutionLevelupMove(pkm, res, learnInfo.Source.CurrentMoves, info);
}
@@ -422,15 +421,16 @@ private static void ParseEggMoves(PKM pkm, CheckMoveResult[] res, int gen, Learn
{
if (IsCheckValid(res[m]))
continue;
if (moves[m] == 0)
int move = moves[m];
if (move == 0)
continue;
bool wasEggMove = learnInfo.Source.EggMoveSource.Contains(moves[m]);
bool wasEggMove = learnInfo.Source.EggMoveSource.Contains(move);
if (wasEggMove)
{
// To learn exclusive generation 1 moves the pokemon was tradeback, but it can't be trade to generation 1
// without removing moves above MaxMoveID_1, egg moves above MaxMoveID_1 and gen 1 moves are incompatible
if (learnInfo.IsGen2Pkm && learnInfo.Gen1Moves.Count != 0 && moves[m] > Legal.MaxMoveID_1)
if (learnInfo.IsGen2Pkm && learnInfo.Gen1Moves.Count != 0 && move > Legal.MaxMoveID_1)
{
res[m] = new CheckMoveResult(EggMove, gen, Invalid, LG1MoveTradeback, Move);
learnInfo.MixedGen12NonTradeback = true;
@@ -444,12 +444,12 @@ private static void ParseEggMoves(PKM pkm, CheckMoveResult[] res, int gen, Learn
if (pkm.TradebackStatus == TradebackType.Any && pkm.GenNumber == 1)
pkm.TradebackStatus = TradebackType.WasTradeback;
}
if (!learnInfo.Source.EggEventSource.Contains(moves[m]))
if (!learnInfo.Source.EggEventSource.Contains(move))
continue;
if (!wasEggMove)
{
if (learnInfo.IsGen2Pkm && learnInfo.Gen1Moves.Count != 0 && moves[m] > Legal.MaxMoveID_1)
if (learnInfo.IsGen2Pkm && learnInfo.Gen1Moves.Count != 0 && move > Legal.MaxMoveID_1)
{
res[m] = new CheckMoveResult(SpecialEgg, gen, Invalid, LG1MoveTradeback, Move);
learnInfo.MixedGen12NonTradeback = true;
@@ -685,7 +685,7 @@ void IsHMSource(IList<bool> flags, ICollection<int> source)
private static bool IsCheckInvalid(CheckResult chk) => !(chk?.Valid ?? false);
private static bool IsCheckValid(CheckResult chk) => chk?.Valid ?? false;
private static void FlagIncompatibleTransferHMs(CheckMoveResult[] res, int[] moves, int gen, bool[] HMLearned, bool KnowDefogWhirlpool)
private static void FlagIncompatibleTransferHMs45(CheckMoveResult[] res, int[] moves, int gen, bool[] HMLearned, bool KnowDefogWhirlpool)
{
// After all the moves from the generations 3 and 4,
// including egg moves if is the origin generation because some hidden moves are also special egg moves in gen 3

View File

@@ -282,13 +282,13 @@ private byte[] Write()
public int DisplayTID
{
get => GenNumber >= 7 ? TrainerID7 : TID;
set => _ = GenNumber >= 7 ? (TrainerID7 = value) : (TID = value);
set { if (GenNumber >= 7) TrainerID7 = value; else TID = value; }
}
public int DisplaySID
{
get => GenNumber >= 7 ? TrainerSID7 : SID;
set => _ = GenNumber >= 7 ? (TrainerSID7 = value) : (SID = value);
set { if (GenNumber >= 7) TrainerSID7 = value; else SID = value; }
}
private void SetID7(int sid7, int tid7)

View File

@@ -53,7 +53,7 @@ private SecretBase3PKM GetPKM(int i)
private void SetPKM(int i)
{
var pk = Team[i];
BitConverter.GetBytes((uint) pk.PID).CopyTo(Data, GetOffsetPID(i));
BitConverter.GetBytes(pk.PID).CopyTo(Data, GetOffsetPID(i));
BitConverter.GetBytes((ushort)pk.Species).CopyTo(Data, GetOffsetSpecies(i));
BitConverter.GetBytes((ushort)pk.HeldItem).CopyTo(Data, GetOffsetItem(i));
BitConverter.GetBytes((ushort)pk.Move1).CopyTo(Data, GetOffsetMove(i, 0));
@@ -62,8 +62,6 @@ private void SetPKM(int i)
BitConverter.GetBytes((ushort)pk.Move4).CopyTo(Data, GetOffsetMove(i, 3));
Data[O_Level + i] = (byte) pk.Level;
Data[O_EV + i] = (byte) pk.EVAll;
BitConverter.GetBytes((uint) pk.PID).CopyTo(Data, GetOffsetPID(i));
}
}
}

View File

@@ -0,0 +1,83 @@
namespace PKHeX.Core
{
public enum TrainerSprite6
{
Calem = 00,
Serena = 01,
Sycamore = 02,
Diantha = 03,
Wikstrom = 04,
Malva = 05,
Drasna = 06,
Siebold = 07,
Viola = 08,
Grant = 09,
Korrina = 10,
Ramos = 11,
Clemont = 12,
Valerie = 13,
Olympia = 14,
Wulfric = 15,
Youngster_XY = 16,
// Unused 17
Lass_XY = 18,
Lady_XY = 19,
Schoolgirl_XY = 20,
Battle_Girl_XY = 21,
Schoolboy_XY = 22,
Rich_Boy_XY = 23,
Female_Ace_Trainer_XY = 24,
// Unused 25
Female_Ranger_XY = 26,
Male_Ace_Trainer_XY = 27,
Male_Ranger_XY = 28,
Madame = 29,
Monsieur = 30,
Black_Belt_XY = 31,
Male_Punk_XY = 32,
Fairy_Tale_Girl_XY = 33,
Shauna = 34,
Tierno = 35,
Trevor = 36,
Brendan = 37,
May = 38,
// Unused 39
Hiker = 40,
Aroma_Lady = 41,
Male_Schoolkid = 42,
Female_Schoolkid = 43,
Black_Belt_ORAS = 44,
Battle_Girl_ORAS = 45,
Pokemaniac_ORAS = 46,
Fairy_Tale_Girl_ORAS = 47,
Victor_Winstrate = 48,
Victoria_Winstrate = 49,
Male_Ranger_ORAS = 50,
Female_Ranger_ORAS = 51,
Male_Swimmer_ORAS = 52,
Hex_Maniac = 53,
Male_Ace_Trainer_ORAS = 54,
Female_Ace_Trainer_ORAS = 55,
Street_Thug = 56,
Delinquent = 57,
Male_Expert = 58,
Female_Expert = 59,
Lady_ORAS = 60,
Rich_Boy_ORAS = 61,
Ninja_Boy = 62,
Beauty_ORAS = 63,
Guitarist = 64,
Lass_ORAS = 65,
Male_Breeder_ORAS = 66,
Female_Breeder_ORAS = 67,
Camper = 68,
Picnicker = 69,
Wally = 70,
Steven = 71,
Maxie = 72,
Archie = 73,
Pokémon_Center = 0x80,
Gift = 0x81,
}
}

View File

@@ -0,0 +1,19 @@
namespace PKHeX.Core
{
public enum BattleStyle7
{
Normal,
Elegant,
Girlish,
Reverent,
Smug,
LeftHanded,
Passionate,
Idol,
/// <summary>
/// USUM Only
/// </summary>
Nihilist,
}
}

View File

@@ -0,0 +1,14 @@
namespace PKHeX.Core
{
public enum SkinColor7
{
M_Pale,
F_Pale,
M_Default,
F_Default,
M_Tan,
F_Tan,
M_Dark,
F_Dark,
}
}

View File

@@ -0,0 +1,20 @@
namespace PKHeX.Core
{
public enum Stamp7
{
Melemele_Trial_Completion,
Akala_Trial_Completion,
Ula_ula_Trial_Completion,
Poni_Trial_Completion,
Island_Challenge_Completion,
Melemele_Pokedex_Completion,
Akala_Pokedex_Completion,
Ula_ula_Pokedex_Completion,
Poni_Pokedex_Completion,
Alola_Pokedex_Completion,
_50_Consecutive_Single_Battle_Wins,
_50_Consecutive_Double_Battle_Wins,
_50_Consecutive_Multi_Battle_Wins,
Poke_Finder_Pro,
}
}

View File

@@ -76,14 +76,7 @@ public SAV_Trainer(SaveFile sav)
private void GetComboBoxes()
{
var dsregion_list = new[] {
new { Text = "NA/SA", Value = 1 },
new { Text = "EUR", Value = 2 },
new { Text = "JPN", Value = 0 },
new { Text = "CN", Value = 4 },
new { Text = "KOR", Value = 5 },
new { Text = "TW", Value = 6 }
};
var dsregion_list = Util.GetUnsortedCBList("regions3ds");
CB_3DSReg.InitializeBinding();
CB_3DSReg.DataSource = dsregion_list;
@@ -94,91 +87,18 @@ private void GetComboBoxes()
CB_Region.InitializeBinding();
Main.SetCountrySubRegion(CB_Country, "countries");
var oras_sprite_list = new[] {
//new { Text = "Calem", Value = 00 },
//new { Text = "Serena", Value = 01 },
new { Text = "Sycamore", Value = 02 },
new { Text = "Diantha", Value = 03 },
new { Text = "Wikstrom", Value = 04 },
new { Text = "Malva", Value = 05 },
new { Text = "Drasna", Value = 06 },
new { Text = "Siebold", Value = 07 },
new { Text = "Viola", Value = 08 },
new { Text = "Grant", Value = 09 },
new { Text = "Korrina", Value = 10 },
new { Text = "Ramos", Value = 11 },
new { Text = "Clemont", Value = 12 },
new { Text = "Valerie", Value = 13 },
new { Text = "Olympia", Value = 14 },
new { Text = "Wulfric", Value = 15 },
new { Text = "Youngster (XY)", Value = 16 },
//new { Text = "(None)", Value = 17 },
new { Text = "Lass (XY)", Value = 18 },
new { Text = "Lady (XY)", Value = 19 },
new { Text = "Schoolgirl (XY)", Value = 20 },
new { Text = "Battle Girl (XY)", Value = 21 },
new { Text = "Schoolboy (XY)", Value = 22 },
new { Text = "Rich Boy (XY)", Value = 23 },
new { Text = "Female Ace Trainer (XY)", Value = 24 },
//new { Text = "(None)", Value = 25 },
new { Text = "Female Ranger (XY)", Value = 26 },
new { Text = "Male Ace Trainer (XY)", Value = 27 },
new { Text = "Male Ranger (XY)", Value = 28 },
new { Text = "Madame", Value = 29 },
new { Text = "Monsieur", Value = 30 },
new { Text = "Black Belt (XY)", Value = 31 },
new { Text = "Male Punk (XY)", Value = 32 },
new { Text = "Fairy Tale Girl (XY)", Value = 33 },
new { Text = "Shauna", Value = 34 },
new { Text = "Tierno", Value = 35 },
new { Text = "Trevor", Value = 36 },
new { Text = "Brendan", Value = 37 },
new { Text = "May", Value = 38 },
//new { Text = "(None)", Value = 39 },
new { Text = "Hiker", Value = 40 },
new { Text = "Aroma Lady", Value = 41 },
new { Text = "Male Schoolkid", Value = 42 },
new { Text = "Female Schoolkid", Value = 43 },
new { Text = "Black Belt (ORAS)", Value = 44 },
new { Text = "Battle Girl (ORAS)", Value = 45 },
new { Text = "Pokemaniac (ORAS)", Value = 46 },
new { Text = "Fairy Tale Girl (ORAS)", Value = 47 },
new { Text = "Victor Winstrate", Value = 48 },
new { Text = "Victoria Winstrate", Value = 49 },
new { Text = "Male Ranger (ORAS)", Value = 50 },
new { Text = "Female Ranger (ORAS)", Value = 51 },
new { Text = "Male Swimmer (ORAS)", Value = 52 },
new { Text = "Hex Maniac", Value = 53 },
new { Text = "Male Ace Trainer (ORAS)", Value = 54 },
new { Text = "Female Ace Trainer (ORAS)", Value = 55 },
new { Text = "Street Thug", Value = 56 },
new { Text = "Delinquent", Value = 57 },
new { Text = "Male Expert", Value = 58 },
new { Text = "Female Expert", Value = 59 },
new { Text = "Lady (ORAS)", Value = 60 },
new { Text = "Rich Boy (ORAS)", Value = 61 },
new { Text = "Ninja Boy", Value = 62 },
new { Text = "Beauty (ORAS)", Value = 63 },
new { Text = "Guitarist", Value = 64 },
new { Text = "Lass (ORAS)", Value = 65 },
new { Text = "Male Breeder (ORAS)", Value = 66 },
new { Text = "Female Breeder (ORAS)", Value = 67 },
new { Text = "Camper", Value = 68 },
new { Text = "Picnicker", Value = 69 },
new { Text = "Wally", Value = 70 },
new { Text = "Steven", Value = 71 },
new { Text = "Maxie", Value = 72 },
new { Text = "Archie", Value = 73 },
new { Text = "Pokémon Center", Value = 0x80 },
new { Text = "Gift", Value = 0x81 },
};
var names = Enum.GetNames(typeof(TrainerSprite6));
var values = (int[])Enum.GetValues(typeof(TrainerSprite6));
var data = names.Zip(values, (a, b) => new ComboItem {Text = a, Value = b})
.Where(z => z.Value >= 2) // ignore Calem & Serena (no sprite)
.ToList();
CB_MultiplayerSprite.InitializeBinding();
CB_MultiplayerSprite.DataSource = oras_sprite_list;
CB_MultiplayerSprite.DataSource = data;
L_Vivillon.Text = GameInfo.Strings.specieslist[666] + ":";
L_Vivillon.Text = GameInfo.Strings.specieslist[(int)Species.Vivillon] + ":";
CB_Vivillon.InitializeBinding();
CB_Vivillon.DataSource = PKX.GetFormList(666, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, 6).ToList();
CB_Vivillon.DataSource = PKX.GetFormList((int)Species.Vivillon, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, 6).ToList();
}
private void GetBadges()
@@ -296,10 +216,12 @@ private void GetTextBoxes()
{
L_LastSaved.Visible = CAL_LastSavedDate.Visible = CAL_LastSavedTime.Visible = false;
}
CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart);
CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400);
CAL_HoFDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame);
CAL_HoFTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame % 86400);
var epoch = new DateTime(2000, 1, 1);
CAL_AdventureStartDate.Value = epoch.AddSeconds(SAV.SecondsToStart);
CAL_AdventureStartTime.Value = epoch.AddSeconds(SAV.SecondsToStart % 86400);
CAL_HoFDate.Value = epoch.AddSeconds(SAV.SecondsToFame);
CAL_HoFTime.Value = epoch.AddSeconds(SAV.SecondsToFame % 86400);
}
private void Save()
@@ -478,9 +400,10 @@ private string UpdateTip(int index)
switch (index)
{
case 2: // Storyline Completed Time
int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
var epoch = new DateTime(2000, 1, 1);
int seconds = (int)(CAL_AdventureStartDate.Value - epoch).TotalSeconds;
seconds -= seconds % 86400;
seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
seconds += (int)(CAL_AdventureStartTime.Value - epoch).TotalSeconds;
return ConvertDateValueToString(SAV.GetRecord(index), seconds);
default:
return null;

View File

@@ -1756,7 +1756,7 @@ private void InitializeComponent()
this.LB_Stamps.Location = new System.Drawing.Point(217, 194);
this.LB_Stamps.Name = "LB_Stamps";
this.LB_Stamps.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.LB_Stamps.Size = new System.Drawing.Size(159, 43);
this.LB_Stamps.Size = new System.Drawing.Size(159, 95);
this.LB_Stamps.TabIndex = 71;
//
// L_DaysFromRefreshed

View File

@@ -46,21 +46,15 @@ public SAV_Trainer7(SaveFile sav)
private readonly bool Loading;
private bool MapUpdated;
private static readonly string[] TrainerStampTitle = { "01:Official Pokemon Trainer", "02:Melemele Trial Completion", "03:Akala Trial Completion", "04:Ula'ula Trial Completion", "05:Poni Trial Completion", "06:Island Challenge Completion", "07:Melemele Pokedex Completion", "08:Akala Pokedex Completion", "09:Ula'ula Pokedex Completion", "10:Poni Pokedex Completion", "11:Alola Pokedex Completion", "12:50 Consecutive Single Battle Wins", "13:50 Consecutive Double Battle Wins", "14:50 Consecutive Multi Battle Wins", "15:Poke Finder Pro" };
private static readonly string[] BattleStyles = { "Normal", "Elegant", "Girlish", "Reverent", "Smug", "Left-handed", "Passionate", "Idol" };
private static readonly string[] AllStyles = Enum.GetNames(typeof(BattleStyle7));
private readonly List<string> BattleStyles = new List<string>(AllStyles);
private int[] FlyDestFlagOfs, MapUnmaskFlagOfs;
private int SkipFlag => SAV.USUM ? 4160 : 3200; // FlagMax - 768
private void GetComboBoxes()
{
var dsregion_list = new[] {
new { Text = "NA/SA", Value = 1 },
new { Text = "EUR", Value = 2 },
new { Text = "JPN", Value = 0 },
new { Text = "CN", Value = 4 },
new { Text = "KOR", Value = 5 },
new { Text = "TW", Value = 6 }
};
var dsregion_list = Util.GetUnsortedCBList("regions3ds");
var alolatime_list = new[] { new { Text = "Sun Time", Value = 24*60*60 } };
Array.Resize(ref alolatime_list, 24);
@@ -80,41 +74,34 @@ private void GetComboBoxes()
Main.SetCountrySubRegion(CB_Country, "countries");
CB_SkinColor.Items.Clear();
string[] skinColors = { "Pale", "Default", "Tan", "Dark" };
foreach (string c in skinColors)
{
CB_SkinColor.Items.Add($"{Main.GenderSymbols[0]} - {c}"); // M
CB_SkinColor.Items.Add($"{Main.GenderSymbols[1]} - {c}"); // F
}
CB_SkinColor.Items.AddRange(Enum.GetNames(typeof(SkinColor7)));
L_Vivillon.Text = GameInfo.Strings.specieslist[666] + ":";
L_Vivillon.Text = GameInfo.Strings.Species[(int)Species.Vivillon] + ":";
CB_Vivillon.InitializeBinding();
CB_Vivillon.DataSource = PKX.GetFormList(666, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();
CB_Vivillon.DataSource = PKX.GetFormList((int)Species.Vivillon, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();
var styles = new List<string>(BattleStyles);
if (SAV.USUM)
styles.Add("Nihilist");
foreach (string t in styles)
if (!SAV.USUM)
BattleStyles.RemoveAt(BattleStyles.Count - 1); // remove Nihilist
foreach (string t in BattleStyles)
{
CB_BallThrowType.Items.Add(t);
LB_BallThrowTypeUnlocked.Items.Add(t);
LB_BallThrowTypeLearned.Items.Add(t);
}
foreach (string t in TrainerStampTitle)
var stamps = Enum.GetNames(typeof(Stamp7)).Select(z => z.Replace("_", " "));
foreach (string t in stamps)
LB_Stamps.Items.Add(t);
}
private void GetTextBoxes()
{
// Get Data
string OT_NAME = SAV.OT;
CB_Game.SelectedIndex = SAV.Game - 30;
CB_Game.SelectedIndex = SAV.Game - (int)GameVersion.SN;
CB_Gender.SelectedIndex = SAV.Gender;
// Display Data
TB_OTName.Text = OT_NAME;
TB_OTName.Text = SAV.OT;
trainerID1.LoadIDValues(SAV);
MT_Money.Text = SAV.Money.ToString();
@@ -158,10 +145,11 @@ private void GetTextBoxes()
L_LastSaved.Visible = CAL_LastSavedDate.Visible = CAL_LastSavedTime.Visible = false;
}
CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart);
CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400);
CAL_HoFDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame);
CAL_HoFTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame % 86400);
var epoch = new DateTime(2000, 1, 1);
CAL_AdventureStartDate.Value = epoch.AddSeconds(SAV.SecondsToStart);
CAL_AdventureStartTime.Value = epoch.AddSeconds(SAV.SecondsToStart % 86400);
CAL_HoFDate.Value = epoch.AddSeconds(SAV.SecondsToFame);
CAL_HoFTime.Value = epoch.AddSeconds(SAV.SecondsToFame % 86400);
NUD_BP.Value = Math.Min(NUD_BP.Maximum, SAV.BP);
NUD_FC.Value = Math.Min(NUD_FC.Maximum, SAV.FestaCoins);
@@ -223,11 +211,11 @@ private void LoadThrowTypeLists()
const int learnedStart = 3479;
LB_BallThrowTypeUnlocked.SetSelected(0, true);
LB_BallThrowTypeUnlocked.SetSelected(1, true);
for (int i = 2; i < BattleStyles.Length; i++)
for (int i = 2; i < BattleStyles.Count; i++)
LB_BallThrowTypeUnlocked.SetSelected(i, SAV.GetEventFlag(unlockStart + i));
LB_BallThrowTypeLearned.SetSelected(0, true);
for (int i = 1; i < BattleStyles.Length; i++)
for (int i = 1; i < BattleStyles.Count; i++)
LB_BallThrowTypeLearned.SetSelected(i, SAV.GetEventFlag(learnedStart + i));
CB_BallThrowTypeListMode.SelectedIndex = 0;
@@ -235,7 +223,7 @@ private void LoadThrowTypeLists()
private void LoadMapFlyToData()
{
IReadOnlyList<ComboItem> metLocationList = GameInfo.GetLocationList(GameVersion.US, 7, false);
var metLocationList = GameInfo.GetLocationList(GameVersion.US, 7, false);
int[] FlyDestNameIndex = {
-1,24,34,8,20,38,12,46,40,30,//Melemele
70,68,78,86,74,104,82,58,90,72,76,92,62,//Akala
@@ -257,7 +245,7 @@ private void LoadMapFlyToData()
75,332,334,
331,333,335,336,
};
string[] FlyDestAltName = { "My House", "Photo Club(Hau'oli)", "Photo Club(Konikoni)", };
string[] FlyDestAltName = { "My House", "Photo Club (Hau'oli)", "Photo Club (Konikoni)", };
CLB_FlyDest.Items.Clear();
for (int i = 0, u = 0, m = FlyDestNameIndex.Length - (SAV.USUM ? 0 : 6); i < m; i++)
{
@@ -284,7 +272,7 @@ private void LoadMapFlyToData()
181,
409,297,32,296,
};
string[] MapUnmaskAltName = { "Melemele Sea(East)", "Melemele Sea(West)", };
string[] MapUnmaskAltName = { "Melemele Sea (East)", "Melemele Sea (West)", };
CLB_MapUnmask.Items.Clear();
for (int i = 0, u = 0, m = MapUnmaskNameIndex.Length - (SAV.USUM ? 0 : 4); i < m; i++)
{
@@ -357,14 +345,15 @@ private void SaveTrainerInfo()
SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text)%60;
SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text)%60;
int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
var epoch = new DateTime(2000, 1, 1);
int seconds = (int)(CAL_AdventureStartDate.Value - epoch).TotalSeconds;
seconds -= seconds%86400;
seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
seconds += (int)(CAL_AdventureStartTime.Value - epoch).TotalSeconds;
SAV.SecondsToStart = seconds;
int fame = (int)(CAL_HoFDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
int fame = (int)(CAL_HoFDate.Value - epoch).TotalSeconds;
fame -= fame % 86400;
fame += (int)(CAL_HoFTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
fame += (int)(CAL_HoFTime.Value - epoch).TotalSeconds;
SAV.SecondsToFame = fame;
if (SAV.LastSavedDate.HasValue)
@@ -426,9 +415,9 @@ private void SaveThrowType()
const int unlockStart = 292;
const int learnedStart = 3479;
for (int i = 2; i < BattleStyles.Length; i++)
for (int i = 2; i < BattleStyles.Count; i++)
SAV.SetEventFlag(unlockStart + i, LB_BallThrowTypeUnlocked.GetSelected(i));
for (int i = 1; i < BattleStyles.Length; i++)
for (int i = 1; i < BattleStyles.Count; i++)
SAV.SetEventFlag(learnedStart + i, LB_BallThrowTypeLearned.GetSelected(i));
}