Misc fixes (#1027)

* Fix Chinese Characters mixup

Some chinese characters are shared by tranditional CH and
simplified CH, should be remapped as a whole. There is no chinese OT/HT.
The remapping only happens at gen7 species nickname

* Fix about HGSS Togepi gift egg

Should upcase eggname when compare egg nickname at generation < 5
Remove unnecessary `wasegg`, it's checked before entering the function
Get egg move from encounter table
EncounterMatch should be as EncounterStatic type not a List.
Remain only special move for in-game gift egg for order checking.
Change default Static moves length to 0
Remove duplicate dratini

* Avoid duplicate relearn move suggestion

The move already in the move list above would be suggested again (was
flagged)

* Fix up some duplicate location strings

Duplicate location string will affact location ID

* Revert conflict parts to merge
This commit is contained in:
wwwwwwzx 2017-04-04 23:11:47 -07:00 committed by Kurt
parent d4d896e353
commit 17c682df58
7 changed files with 19 additions and 17 deletions

View file

@ -179,6 +179,8 @@ namespace PKHeX.Core
metHGSS_02000[1] += " (NPC)"; // Anything from an NPC
metHGSS_02000[2] += " (" + eggname + ")"; // Egg From Link Trade
metBW2_00000[36] = metBW2_00000[84] + "/" + metBW2_00000[36]; // Cold Storage in BW = PWT in BW2
metBW2_00000[40] += "(B/W)"; // Victory Road in BW
metBW2_00000[134] += "(B2/W2)"; // Victory Road in B2W2
// BW2 Entries from 76 to 105 are for Entralink in BW
for (int i = 76; i < 106; i++)

View file

@ -306,6 +306,7 @@ namespace PKHeX.Core
List<int> window = new List<int>(RelearnBase);
window.AddRange(pkm.Moves.Where((v, i) => !vMoves[i].Valid || vMoves[i].Flag));
window = window.Distinct().ToList();
if (window.Count < 4)
window.AddRange(new int[4 - window.Count]);
return window.Skip(window.Count - 4).ToArray();

View file

@ -282,7 +282,7 @@ namespace PKHeX.Core
{
if (!pkm.IsNicknamed && (pkm.Format != 7))
AddLine(Severity.Invalid, V12, CheckIdentifier.Egg);
else if (PKX.SpeciesLang[pkm.Language][0] != pkm.Nickname)
else if (PKX.getSpeciesNameGeneration(0, pkm.Language, pkm.GenNumber) != pkm.Nickname)
AddLine(Severity.Invalid, V13, CheckIdentifier.Egg);
else
AddLine(Severity.Valid, V14, CheckIdentifier.Egg);
@ -2511,11 +2511,11 @@ namespace PKHeX.Core
int splitctr = Legal.SplitBreed.Contains(pkm.Species) ? 1 : 0;
foreach (var ver in Games)
{
var EventEggMoves = pkm.WasEgg && !pkm.WasGiftEgg? Legal.getSpecialEggMoves(pkm, ver).ToArray() : new int[0];
var EventEggMoves = !pkm.WasGiftEgg? Legal.getSpecialEggMoves(pkm, ver).ToArray() : new int[0];
for (int i = 0; i <= splitctr; i++)
{
var baseEggMoves = Legal.getBaseEggMoves(pkm, i, ver, 100)?.ToArray() ?? new int[0];
var EggMoves = pkm.WasEgg && !pkm.WasGiftEgg ? Legal.getEggMoves(pkm, i, ver).ToArray() : new int[0];
var EggMoves = pkm.WasGiftEgg ? (EncounterMatch as EncounterStatic)?.Moves ?? new int[0] : Legal.getEggMoves(pkm, i, ver).ToArray();
res = parseMoves(Moves, validLevelMoves, new int[0], validTMHM, validTutor, new int[0], baseEggMoves, EggMoves, EventEggMoves);

View file

@ -490,10 +490,9 @@ namespace PKHeX.Core
new EncounterStatic { Gift = true, Species = 410, Level = 20, Location = 140, }, // Shieldon
//Gift
new EncounterStatic { Gift = true, Species = 133, Level = 05, Location = 131, }, // Eevee @ Goldenrod City
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new[] {245, 086, 239, 082}, }, // Dratini @ Dragon's Den (ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new[] {043, 086, 239, 082}, }, // Dratini @ Dragon's Den (Non-ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 147, Level = 15, Location = 222, Moves = new[] {245}, }, // Dratini @ Dragon's Den (ExtremeSpeed)
new EncounterStatic { Gift = true, Species = 236, Level = 10, Location = 216, }, // Tyrogue @ Mt. Mortar
new EncounterStatic { Gift = true, Species = 175, Level = 01, EggLocation = 2013, Moves = new[] {045, 204, 326},}, // Togepi Egg from Mr. Pokemon (Extrasensory as Egg move)
new EncounterStatic { Gift = true, Species = 175, Level = 01, EggLocation = 2013, Moves = new[] {326},}, // Togepi Egg from Mr. Pokemon (Extrasensory as Egg move)
new EncounterStatic { Gift = true, Species = 179, Level = 01, EggLocation = 2014,}, // Mareep Egg from Primo
new EncounterStatic { Gift = true, Species = 194, Level = 01, EggLocation = 2014,}, // Wooper Egg from Primo
new EncounterStatic { Gift = true, Species = 218, Level = 01, EggLocation = 2014,}, // Slugma Egg from Primo

View file

@ -217,12 +217,12 @@ namespace PKHeX.Core
#region Block B
public override string Nickname
{
get { return PKX.SanitizeString(Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x40, 24))); }
get { return PKX.bin2strG7_zh(PKX.SanitizeString(Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x40, 24)))); }
set
{
if (value.Length > 12)
value = value.Substring(0, 12); // Hard cap
string TempNick = PKX.UnSanitizeString(value)
string TempNick = PKX.str2binG7_zh(PKX.UnSanitizeString(value),Language == 10)
.PadRight(value.Length + 1, '\0'); // Null Terminator
Encoding.Unicode.GetBytes(TempNick).CopyTo(Data, 0x40);
}

View file

@ -1051,7 +1051,6 @@ namespace PKHeX.Core
var s = str.Replace("\u2019", "\u0027"); // farfetch'd
s = s.Replace("\uE08F", "\u2640"); // ♀
s = s.Replace("\uE08E", "\u2642"); // ♂
s = bin2strG7_zh(s);
return s;
}
@ -1065,7 +1064,6 @@ namespace PKHeX.Core
public static string UnSanitizeString(string str, int species = -1, bool nicknamed = true)
{
var s = str.Replace("\u0027", "\u2019"); // farfetch'd
s = str2binG7_zh(s);
bool foreign = true;
if ((species == 029 || species == 032) && !nicknamed)
@ -1194,17 +1192,19 @@ namespace PKHeX.Core
/// Converts a Unicode string to Generation 7 in-game chinese string.
/// </summary>
/// <param name="inputstr">Unicode string.</param>
/// <param name="cht">Pkm language is Traditional Chinese.</param>
/// <returns>In-game chinese string.</returns>
public static string str2binG7_zh(string inputstr)
public static string str2binG7_zh(string inputstr, bool cht = false)
{
int index; string resultstr = "";
bool IsCHT = inputstr.Any(chr => Gen7_CHT.Contains(chr) && !Gen7_CHS.Contains(chr));
IsCHT |= cht && !inputstr.Any(chr => Gen7_CHT.Contains(chr) ^ Gen7_CHS.Contains(chr)); // CHS and CHT have the same display name
var table = IsCHT ? Gen7_CHT : Gen7_CHS;
ushort ofs = IsCHT ? Gen7_CHT_Ofs : Gen7_CHS_Ofs;
foreach (char chr in inputstr)
{
index = Array.IndexOf(Gen7_CHS, chr);
if (index > -1)
{ resultstr += (char)(index + Gen7_CHS_Ofs); continue; }
index = Array.IndexOf(Gen7_CHT, chr);
resultstr += index > -1 ? (char)(index + Gen7_CHT_Ofs) : chr;
index = Array.IndexOf(table, chr);
resultstr += index > -1 ? (char)(ofs + index) : chr;
}
return resultstr;
}

View file

@ -73,7 +73,7 @@ P2实验室
迷幻森林
试炼之室
引导之间
潜入连接
连入之森
雷文市
帆巴市
吹寄市