diff --git a/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs b/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs index 41a63bf29..17d086276 100644 --- a/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs +++ b/PKHeX.Core/Legality/Encounters/Data/EncounterUtil.cs @@ -249,5 +249,17 @@ namespace PKHeX.Core result.Ball = 25; // Dream Ball return result; } + + internal static void MarkEncounterTradeStrings(EncounterTrade[] table, string[][] strings) + { + int half = strings[1].Length / 2; + for (var i = 0; i < half; i++) + { + var t = table[i]; + t.Nicknames = getNames(i, strings); + t.TrainerNames = getNames(i + half, strings); + } + string[] getNames(int i, IEnumerable names) => names?.Select(z => z?.Length > i ? z[i] : null).ToArray(); + } } } diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs index d6613b4fa..ccbcd197b 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs @@ -18,6 +18,11 @@ namespace PKHeX.Core SlotsRBY = GetAreas(); MarkEncountersGeneration(1, SlotsRBY); MarkEncountersGeneration(1, StaticRBY, TradeGift_RBY_NoTradeback, TradeGift_RBY_Tradeback); + + var trades = TradeGift_RBY_Common.Concat(TradeGift_RBY_NoTradeback).Concat(TradeGift_RBY_Tradeback); + var names = new[] {null, "トレーナー", "TRAINER", "TRAINER", "TRAINER", "TRAINER", null, "TRAINER", null}; + foreach (var t in trades) + t.TrainerNames = names; } private static EncounterArea[] GetAreas() diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs index dd9775167..c018d409b 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs @@ -26,6 +26,8 @@ namespace PKHeX.Core ReduceAreasSize(ref SlotsGSC); MarkEncountersGeneration(2, SlotsGS, SlotsC, SlotsGSC); MarkEncountersGeneration(2, StaticGS, StaticC, StaticGSC, TradeGift_GSC); + + MarkEncounterTradeStrings(TradeGift_GSC, TradeGift_GSC_OTs); } private static EncounterArea[] GetTables2(GameVersion Version) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs index afe053cb4..2069afa1f 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs @@ -58,6 +58,9 @@ namespace PKHeX.Core MarkEncountersGeneration(3, SlotsR, SlotsS, SlotsE, SlotsFR, SlotsLG, SlotsXD); MarkEncountersGeneration(3, StaticR, StaticS, StaticE, StaticFR, StaticLG, Encounter_CXD, TradeGift_RSE, TradeGift_FRLG); + + MarkEncounterTradeStrings(TradeGift_RSE, TradeRSE); + MarkEncounterTradeStrings(TradeGift_FRLG, TradeFRLG); } private static void MarkG3Slots_FRLG(ref EncounterArea[] Areas) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs index 3f02fd965..76d090a80 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs @@ -76,6 +76,9 @@ namespace PKHeX.Core MarkEncountersGeneration(4, SlotsD, SlotsP, SlotsPt, SlotsHG, SlotsSS); MarkEncountersGeneration(4, StaticD, StaticP, StaticPt, StaticHG, StaticSS, TradeGift_DPPt, TradeGift_HGSS); + + MarkEncounterTradeStrings(TradeGift_DPPt, TradeDPPt); + MarkEncounterTradeStrings(TradeGift_HGSS, TradeHGSS); } private static EncounterArea[] GetFeebasArea(EncounterArea template) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs index 665f731c9..35525dc6c 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs @@ -46,6 +46,11 @@ namespace PKHeX.Core MarkEncountersGeneration(5, SlotsB, SlotsW, SlotsB2, SlotsW2); MarkEncountersGeneration(5, StaticB, StaticW, StaticB2, StaticW2, TradeGift_BW, TradeGift_B2W2); + + MarkEncounterTradeStrings(TradeGift_BW, TradeBW); + MarkEncounterTradeStrings(TradeGift_B2W2_Regular, TradeB2W2); + foreach (var t in TradeGift_B2W2_YancyCurtis) + t.TrainerNames = t.OTGender == 0 ? TradeOT_B2W2_M : TradeOT_B2W2_F; } private static void MarkBWSwarmSlots(EncounterArea[] Areas) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs index e344a797e..9452973af 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs @@ -36,6 +36,8 @@ namespace PKHeX.Core MarkEncountersGeneration(6, StaticX, StaticY, StaticA, StaticO, TradeGift_XY, TradeGift_AO); FriendSafari = GetFriendSafariArea(); + MarkEncounterTradeStrings(TradeGift_XY, TradeXY); + MarkEncounterTradeStrings(TradeGift_AO, TradeAO); } private static ILookup GetFriendSafariArea() diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs index 62bb3afa3..1d9a7c8ac 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs @@ -47,6 +47,9 @@ namespace PKHeX.Core MarkEncountersGeneration(7, SlotsSN, SlotsMN, SlotsUS, SlotsUM); MarkEncountersGeneration(7, StaticSN, StaticMN, StaticUS, StaticUM, TradeGift_SM, TradeGift_USUM); + + MarkEncounterTradeStrings(TradeGift_SM, TradeSM); + MarkEncounterTradeStrings(TradeGift_USUM, TradeUSUM); } private static void MarkG7REGSlots(ref EncounterArea[] Areas) { diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade.cs index 63dbce9a9..3af783bbb 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterTrade.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterTrade.cs @@ -44,6 +44,11 @@ public bool Fateful { get; set; } public bool IsNicknamed { get; set; } = true; + public string[] Nicknames { get; internal set; } + public string[] TrainerNames { get; internal set; } + public string GetNickname(int language) => Nicknames?.Length < language ? Nicknames[language] : null; + public string GetOT(int language) => TrainerNames?.Length < language ? TrainerNames[language] : null; + public static readonly int[] DefaultMetLocation = { 0, 126, 254, 2001, 30002, 30001, 30001,