mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-25 23:54:33 -05:00
Add Ingame Trade OT/Nick check
This commit is contained in:
@@ -67,6 +67,40 @@ private LegalityCheck verifyNickname()
|
||||
return new LegalityCheck(Severity.Indeterminate, "Species index invalid for Nickname comparison.");
|
||||
if (!Encounter.Valid)
|
||||
return new LegalityCheck(Severity.Valid, "Skipped Nickname check due to other check being invalid.");
|
||||
|
||||
if (pk6.Language > 8)
|
||||
return new LegalityCheck(Severity.Indeterminate, "Language ID > 8.");
|
||||
|
||||
Type etype = EncounterMatch?.GetType();
|
||||
if (etype == typeof(EncounterTrade))
|
||||
{
|
||||
string[] validOT = new string[0];
|
||||
int index = -1;
|
||||
if (pk6.XY)
|
||||
{
|
||||
validOT = Legal.TradeXY[pk6.Language];
|
||||
index = Array.IndexOf(Legal.TradeGift_XY, EncounterMatch);
|
||||
}
|
||||
else if (pk6.AO)
|
||||
{
|
||||
validOT = Legal.TradeAO[pk6.Language];
|
||||
index = Array.IndexOf(Legal.TradeGift_AO, EncounterMatch);
|
||||
}
|
||||
if (validOT.Length == 0)
|
||||
return new LegalityCheck(Severity.Indeterminate, "Ingame Trade invalid version?");
|
||||
if (index == -1 || validOT.Length < index * 2)
|
||||
return new LegalityCheck(Severity.Indeterminate, "Ingame Trade invalid lookup?");
|
||||
|
||||
string nick = validOT[index];
|
||||
string OT = validOT[validOT.Length/2 + index];
|
||||
|
||||
if (nick != pk6.Nickname)
|
||||
return new LegalityCheck(Severity.Fishy, "Ingame Trade nickname has been altered.");
|
||||
if (OT != pk6.OT_Name)
|
||||
return new LegalityCheck(Severity.Invalid, "Ingame Trade OT has been altered.");
|
||||
|
||||
return new LegalityCheck(Severity.Valid, "Ingame Trade OT/Nickname have not been altered.");
|
||||
}
|
||||
|
||||
if (pk6.IsEgg)
|
||||
{
|
||||
|
||||
@@ -444,7 +444,7 @@ public static partial class Legal
|
||||
538, 539, // Sawk & Throh
|
||||
};
|
||||
|
||||
private static readonly string[][] TradeXY =
|
||||
internal static readonly string[][] TradeXY =
|
||||
{
|
||||
new string[0], // 0 - None
|
||||
Util.getStringList("tradexy", "ja"), // 1
|
||||
@@ -456,7 +456,7 @@ public static partial class Legal
|
||||
Util.getStringList("tradexy", "es"), // 7
|
||||
Util.getStringList("tradexy", "ko"), // 8
|
||||
};
|
||||
private static readonly string[][] TradeAO =
|
||||
internal static readonly string[][] TradeAO =
|
||||
{
|
||||
new string[0], // 0 - None
|
||||
Util.getStringList("tradeao", "ja"), // 1
|
||||
@@ -647,7 +647,7 @@ public static partial class Legal
|
||||
};
|
||||
#endregion
|
||||
#region Trade Tables
|
||||
private static readonly EncounterTrade[] TradeGift_XY =
|
||||
internal static readonly EncounterTrade[] TradeGift_XY =
|
||||
{
|
||||
new EncounterTrade { Species = 129, Level = 5, Ability = 1, Gender = 0, TID = 44285, Nature = Nature.Adamant, }, // Magikarp
|
||||
new EncounterTrade { Species = 133, Level = 5, Ability = 1, Gender = 1, TID = 29294, Nature = Nature.Docile, }, // Eevee
|
||||
@@ -662,7 +662,7 @@ public static partial class Legal
|
||||
|
||||
new EncounterTrade { Species = 280, Level = 5, Ability = 1, Gender = 1, TID = 37110, Nature = Nature.Modest, IVs = new[] {20, 20, 20, 31, 31, 20}, }, // Ralts
|
||||
};
|
||||
private static readonly EncounterTrade[] TradeGift_AO =
|
||||
internal static readonly EncounterTrade[] TradeGift_AO =
|
||||
{
|
||||
new EncounterTrade { Species = 296, Level = 9, Ability = 2, Gender = 0, TID = 30724, Nature = Nature.Brave, IVs = new[] {-1, 31, -1, -1, -1, -1}, }, // Makuhita
|
||||
new EncounterTrade { Species = 300, Level = 25, Ability = 1, Gender = 1, TID = 03239, Nature = Nature.Naughty, IVs = new[] {-1, -1, -1, 31, -1, -1}, }, // Skitty
|
||||
|
||||
Reference in New Issue
Block a user