Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Jan 27, 2020
1 parent 3a94e7f commit f7f89e4
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Gen3EventLegality
{
public static class Program
{
private static string version = "2.0";

[Flags]
public enum Algo : ulong
Expand Down Expand Up @@ -216,6 +217,8 @@ public enum Algo : ulong

public static void Main(string[] args)
{
Console.WriteLine("3rd Gen Legality Checker by Sabresite (v{0})", version);

Console.WriteLine("If an egg event or PCNY, press enter");
Console.Write("TID:");
uint[] numbers = GetNumbers();
Expand Down Expand Up @@ -334,17 +337,9 @@ public static void Main(string[] args)

Console.WriteLine("Nature: {0}", index2Nature(PID));

if (Has(algo, Algo.CanBeShiny))
Console.WriteLine("Shiny: Can be shiny");
else
Console.WriteLine("Shiny: Cannot be shiny");

uint[] ivs;
Console.WriteLine(Has(algo, Algo.CanBeShiny) ? "Shiny: Can be shiny" : "Shiny: Cannot be shiny");

if (noIVs)
ivs = new uint[] { 0, 0, 0, 0, 0, 0 };
else
ivs = ParseStats((rand5 >> 0x10) & 0x7FFF, (rand4 >> 0x10) & 0x7FFF);
var ivs = noIVs ? new uint[] { 0, 0, 0, 0, 0, 0 } : ParseStats((rand5 >> 0x10) & 0x7FFF, (rand4 >> 0x10) & 0x7FFF);

Console.WriteLine("IVs: {0}, {1}, {2}, {4}, {5}, {3}", ivs[0], ivs[1], ivs[2], ivs[3], ivs[4], ivs[5]);

Expand Down Expand Up @@ -434,7 +429,6 @@ public static void Main(string[] args)
Console.WriteLine("----------");
}

uint rand6;
if (forceAntishiny)
{
bool another = false;
Expand All @@ -447,7 +441,7 @@ public static void Main(string[] args)
rand4 = Next(rand3, algo);
rand5 = Next(rand4, algo);

if (((rand2 >> 0x10) ^ TID ^ SID ^ (rand1 >> 0x10)) == (PID >> 0x10) && !isShiny(PID, TID, SID))
if (((rand2 >> 0x10) ^ TID ^ SID ^ (rand1 >> 0x10)) == PID >> 0x10 && !isShiny(PID, TID, SID))
{
if (another)
Console.WriteLine(" - ");
Expand Down Expand Up @@ -557,7 +551,7 @@ public static void Main(string[] args)
rand3 = Next(rand2, algo); // IV1
rand4 = Next(rand3, algo); // IV2
rand5 = Next(rand4, algo); // Item if available or OTG if Item not available
rand6 = Next(rand5, algo); // OTG if Item available
var rand6 = Next(rand5, algo);
Next(rand6, algo);

itemRand = Has(algo, Algo.ItemFirst) ? rand5 : rand6;
Expand Down Expand Up @@ -589,10 +583,11 @@ public static void Main(string[] args)
if (knownSeed == "Known Seed")
{
long mewIndex = Array.IndexOf(MystryMewSeeds, rand1b) + 1;
mystryMewBatch = string.Format("{0}/{1} {2}", mewIndex, MystryMewSeeds.Length, string.Format("{0} Slot {1}", mewIndex < 7 ? "Party" : "PC", mewIndex < 7 ? mewIndex : mewIndex - 6));
mystryMewBatch =
$"{mewIndex}/{MystryMewSeeds.Length} {(mewIndex < 7 ? "Party" : "PC")} Slot {(mewIndex < 7 ? mewIndex : mewIndex - 6)}";
}
else
mystryMewBatch = string.Format(" ({0} of 5)", batchCount);
mystryMewBatch = $" ({batchCount} of 5)";
}

Console.WriteLine("{0}: {1:X8} - {2} {3}", knownSeed, i, option.Item1, mystryMewBatch);
Expand Down Expand Up @@ -623,12 +618,7 @@ public static void Main(string[] args)
else
Console.WriteLine("Shiny: Cannot be shiny");

uint[] ivs;

if (Has(algo, Algo.NoIVs))
ivs = new uint[] { 0, 0, 0, 0, 0, 0 };
else
ivs = ParseStats((rand3 >> 0x10) & 0x7FFF, (rand4 >> 0x10) & 0x7FFF);
var ivs = Has(algo, Algo.NoIVs) ? new uint[] { 0, 0, 0, 0, 0, 0 } : ParseStats((rand3 >> 0x10) & 0x7FFF, (rand4 >> 0x10) & 0x7FFF);

Console.WriteLine("IVs: {0}, {1}, {2}, {4}, {5}, {3}", ivs[0], ivs[1], ivs[2], ivs[3], ivs[4], ivs[5]);

Expand Down Expand Up @@ -791,9 +781,8 @@ public static string eReaderType(uint pid)
return "HACKED";
}

public static string index2Nature(uint nature)
{
return nature switch
public static string index2Nature(uint nature) =>
nature switch
{
0 => "Hardy",
1 => "Lonely",
Expand Down Expand Up @@ -822,7 +811,6 @@ public static string index2Nature(uint nature)
24 => "Quirky",
_ => "Hardy"
};
}

public static uint[] ParseStats(uint first, uint second)
{
Expand Down

0 comments on commit f7f89e4

Please sign in to comment.