Current progress

Still a few milestones left to hit before official release.
This commit is contained in:
Kaphotics 2016-06-19 21:22:43 -07:00
parent 862c2fd823
commit 6378eb7f56
101 changed files with 9574 additions and 9090 deletions

View file

@ -21,9 +21,11 @@ namespace PKHeX
public string Report => getLegalityReport();
public string VerboseReport => getVerboseLegalityReport();
public LegalityAnalysis(PK6 pk)
public LegalityAnalysis(PKM pk)
{
pk6 = pk;
if (!(pk is PK6))
return;
pk6 = pk as PK6;
updateRelearnLegality();
updateMoveLegality();
updateChecks();
@ -66,7 +68,7 @@ namespace PKHeX
}
private string getLegalityReport()
{
if (!pk6.Gen6)
if (pk6 == null || !pk6.Gen6)
return "Analysis only available for Pokémon that originate from X/Y & OR/AS.";
var chks = Checks;
@ -91,6 +93,8 @@ namespace PKHeX
private string getVerboseLegalityReport()
{
string r = getLegalityReport() + Environment.NewLine;
if (pk6 == null)
return r;
r += "===" + Environment.NewLine + Environment.NewLine;
int rl = r.Length;

View file

@ -37,6 +37,13 @@ namespace PKHeX
if (pk6.PID == 0)
return new LegalityCheck(Severity.Fishy, "PID is not set.");
if (EncounterType == typeof (EncounterStatic))
{
var enc = (EncounterStatic) EncounterMatch;
if (enc.Shiny != null && (bool)enc.Shiny ^ pk6.IsShiny)
return new LegalityCheck(Severity.Invalid, "Encounter " + (enc.Shiny == true ? "must be" : "cannot be") + " shiny.");
}
string special = "";
if (pk6.Gen6)
{

View file

@ -198,8 +198,10 @@ namespace PKHeX
continue;
if (e.Level != pk6.Met_Level)
continue;
if (e.Shiny != null && e.Shiny != pk6.IsShiny)
continue;
// Defer to EC/PID check
// if (e.Shiny != null && e.Shiny != pk6.IsShiny)
// continue;
// Defer ball check to later
// if (e.Gift && pk6.Ball != 4) // PokéBall

View file

@ -1,57 +1,22 @@
namespace PKHeX
using System.Linq;
namespace PKHeX
{
public static partial class Legal
{
// PKHeX Valid Array Storage
#region Items
internal static readonly int[] Items_Held =
{
000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 017, 018, 019, 020, 021, 022,
023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033, 034, 035,
036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 046, 047, 048, 049, 050, 051, 052, 053, 054, 055, 056, 057,
058, 059, 060, 061, 062, 063, 064, 065, 066, 067, 068, 069, 070,
071, 072, 073, 074, 075, 076, 077, 078, 079, 080, 081, 082, 083, 084, 085, 086, 087, 088, 089, 090, 091, 092,
093, 094, 099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 112, 116, 117, 118, 119, 134, 135, 136, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 504, 537, 538, 539, 540, 541, 542, 543, 544,
545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557,
558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 577, 580, 581, 582, 583, 584,
585, 586, 587, 588, 589, 590, 591, 639, 640, 644, 645, 646, 647,
648, 649, 650, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670,
671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683,
684, 685, 686, 687, 688, 699, 704, 708, 709, 710, 711, 715,
// Appended ORAS Items (Orbs & Mega Stones)
534, 535,
752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 767, 768, 769, 770,
};
internal static readonly int[] Items_Ball =
{
000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012,
013, 014, 015, 016, 492, 493, 494, 495, 496, 497, 498, 499, 576,
};
internal static readonly int[] Items_CommonBall = {4, 3, 2, 1};
internal static readonly int[] Items_UncommonBall =
{
7, 576, 13, 492, 497, 14, 495, 493, 496, 494, 11, 498, 8, 6,
12, 15, 9, 5, 499, 10, 16
};
#endregion
#region Games
@ -170,7 +135,7 @@
internal static readonly ushort[] Pouch_Items_XY =
{
000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 055, 056,
001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 055, 056,
057, 058, 059, 060, 061, 062, 063, 064, 065, 066, 067, 068, 069, 070, 071, 072, 073, 074, 075,
076, 077, 078, 079, 080, 081, 082, 083, 084, 085, 086, 087, 088, 089, 090, 091, 092, 093, 094,
099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 116, 117, 118, 119, 135, 136,
@ -188,9 +153,9 @@
699, 704, 710, 711, 715,
};
internal static readonly ushort[] Pouch_Items_ORAS =
internal static readonly ushort[] Pouch_Items_AO =
{
000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 055, 056,
001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012, 013, 014, 015, 016, 055, 056,
057, 058, 059, 060, 061, 062, 063, 064, 068, 069, 070, 071, 072, 073, 074, 075,
076, 077, 078, 079, 080, 081, 082, 083, 084, 085, 086, 087, 088, 089, 090, 091, 092, 093, 094,
099, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 116, 117, 118, 119, 135, 136,
@ -214,7 +179,7 @@
internal static readonly ushort[] Pouch_Key_XY =
{
000, 216, 431, 442, 445, 446, 447, 450, 465, 466, 471, 628,
216, 431, 442, 445, 446, 447, 450, 465, 466, 471, 628,
629, 631, 632, 638, 641, 642, 643, 689, 695, 696, 697, 698,
700, 701, 702, 703, 705, 706, 707, 712, 713, 714,
@ -222,9 +187,9 @@
716, 717, // For the cheaters who want useless items...
};
internal static readonly ushort[] Pouch_Key_ORAS =
internal static readonly ushort[] Pouch_Key_AO =
{
000, 216, 445, 446, 447, 465, 466, 471, 628,
216, 445, 446, 447, 465, 466, 471, 628,
629, 631, 632, 638, 697,
// Illegal
@ -242,7 +207,6 @@
internal static readonly ushort[] Pouch_TMHM_XY =
{
0,
328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381,
@ -253,9 +217,8 @@
420, 421, 422, 423, 424,
};
internal static readonly ushort[] Pouch_TMHM_ORAS =
internal static readonly ushort[] Pouch_TMHM_AO =
{
0,
328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381,
@ -271,14 +234,14 @@
internal static readonly ushort[] Pouch_Medicine_XY =
{
000, 017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033,
017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033,
034, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 046, 047, 048, 049, 050, 051,
052, 053, 054, 134, 504, 565, 566, 567, 568, 569, 570, 571, 591, 645, 708, 709,
};
internal static readonly ushort[] Pouch_Medicine_ORAS =
internal static readonly ushort[] Pouch_Medicine_AO =
{
000, 017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033,
017, 018, 019, 020, 021, 022, 023, 024, 025, 026, 027, 028, 029, 030, 031, 032, 033,
034, 035, 036, 037, 038, 039, 040, 041, 042, 043, 044, 045, 046, 047, 048, 049, 050, 051,
052, 053, 054, 134, 504, 565, 566, 567, 568, 569, 570, 571, 591, 645, 708, 709,
@ -288,13 +251,15 @@
internal static readonly ushort[] Pouch_Berry_XY =
{
0, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 686, 687, 688,
};
internal static readonly ushort[] HeldItem_XY = new ushort[1].Concat(Pouch_Items_XY).Concat(Pouch_Medicine_XY).Concat(Pouch_Berry_XY).ToArray();
internal static readonly ushort[] HeldItem_AO = new ushort[1].Concat(Pouch_Items_AO).Concat(Pouch_Medicine_AO).Concat(Pouch_Berry_XY).ToArray();
#endregion
#region TMHM
@ -345,8 +310,8 @@
// Legality
internal static readonly int[] Gen4EncounterTypes = { 1, 2, 4, 5, 7, 9, 10, 12, 23, 24 };
internal static readonly int Struggle = 165;
internal static readonly int Chatter = 448;
internal const int Struggle = 165;
internal const int Chatter = 448;
internal static readonly int[] InvalidSketch = {Struggle, Chatter};
internal static readonly int[] EggLocations = {60002, 30002};
internal static readonly int[] LightBall = {25, 26, 172};

70
Legality/Tables4.cs Normal file
View file

@ -0,0 +1,70 @@
using System.Linq;
namespace PKHeX
{
public static partial class Legal
{
// PKHeX Valid Array Storage
#region DP
internal static readonly ushort[] Pouch_Items_DP = {
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 135, 136, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327
};
internal static readonly ushort[] Pouch_Key_DP = {
428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464
};
internal static readonly ushort[] Pouch_TMHM_DP = {
328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427
};
internal static readonly ushort[] Pouch_Mail_DP = {
137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148
};
internal static readonly ushort[] Pouch_Medicine_DP = {
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54
};
internal static readonly ushort[] Pouch_Berries_DP = {
149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212
};
internal static readonly ushort[] Pouch_Ball_DP = {
1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
};
internal static readonly ushort[] Pouch_Battle_DP = {
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67
};
internal static readonly ushort[] HeldItems_DP = new ushort[1].Concat(Pouch_Items_DP).Concat(Pouch_Mail_DP).Concat(Pouch_Medicine_DP).Concat(Pouch_Berries_DP).Concat(Pouch_Ball_DP).ToArray();
#endregion
#region Pt
internal static readonly ushort[] Pouch_Items_Pt = {
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 135, 136, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327
};
internal static readonly ushort[] Pouch_Key_Pt = {
428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467
};
internal static readonly ushort[] Pouch_TMHM_Pt = Pouch_TMHM_DP;
internal static readonly ushort[] Pouch_Mail_Pt = Pouch_Mail_DP;
internal static readonly ushort[] Pouch_Medicine_Pt = Pouch_Medicine_DP;
internal static readonly ushort[] Pouch_Berries_Pt = Pouch_Berries_DP;
internal static readonly ushort[] Pouch_Ball_Pt = Pouch_Ball_DP;
internal static readonly ushort[] Pouch_Battle_Pt = Pouch_Battle_DP;
internal static readonly ushort[] HeldItems_Pt = new ushort[1].Concat(Pouch_Items_Pt).Concat(Pouch_Mail_Pt).Concat(Pouch_Medicine_Pt).Concat(Pouch_Berries_Pt).Concat(Pouch_Ball_Pt).ToArray();
#endregion
#region HGSS
internal static readonly ushort[] Pouch_Items_HGSS = Pouch_Items_Pt;
internal static readonly ushort[] Pouch_Key_HGSS = {
434, 435, 437, 444, 445, 446, 447, 450, 456, 464, 465, 466, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 501, 502, 503, 504, 532, 533, 534, 535, 536
};
internal static readonly ushort[] Pouch_TMHM_HGSS = Pouch_TMHM_DP;
internal static readonly ushort[] Pouch_Mail_HGSS = Pouch_Mail_DP;
internal static readonly ushort[] Pouch_Medicine_HGSS = Pouch_Medicine_DP;
internal static readonly ushort[] Pouch_Berries_HGSS = Pouch_Berries_DP;
internal static readonly ushort[] Pouch_Ball_HGSS = {
1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 492, 493, 494, 495, 496, 497, 498, 499, 500
};
internal static readonly ushort[] Pouch_Battle_HGSS = Pouch_Battle_DP;
internal static readonly ushort[] HeldItems_HGSS = new ushort[1].Concat(Pouch_Items_HGSS).Concat(Pouch_Mail_HGSS).Concat(Pouch_Medicine_HGSS).Concat(Pouch_Berries_HGSS).Concat(Pouch_Ball_Pt).ToArray();
#endregion
}
}

29
Legality/Tables5.cs Normal file
View file

@ -0,0 +1,29 @@
using System.Linq;
namespace PKHeX
{
public static partial class Legal
{
// PKHeX Valid Array Storage
internal static readonly ushort[] Pouch_Items_BW = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 116, 117, 118, 119, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 492, 493, 494, 495, 496, 497, 498, 499, 500, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 571, 572, 573, 575, 576, 577, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590,
};
internal static readonly ushort[] Pouch_Key_BW = {
437, 442, 447, 450, 465, 466, 471, 504, 533, 574, 578, 579, 616, 617, 621, 623, 624, 625, 626,
};
internal static readonly ushort[] Pouch_TMHM_BW = {
328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 618, 619, 620, 420, 421, 422, 423, 424, 425
};
internal static readonly ushort[] Pouch_Medicine_BW = {
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 134, 504, 565, 566, 567, 568, 569, 570, 591
};
internal static readonly ushort[] Pouch_Berries_BW = {
149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212
};
internal static readonly ushort[] HeldItems_BW = new ushort[1].Concat(Pouch_Items_BW).Concat(Pouch_Medicine_BW).Concat(Pouch_Berries_BW).ToArray();
internal static readonly ushort[] Pouch_Key_B2W2 = {
437, 442, 447, 450, 453, 458, 465, 466, 471, 504, 578, 616, 617, 621, 626, 627, 628, 630, 631, 632, 633, 634, 635, 636, 637, 638,
};
}
}

View file

@ -1,142 +0,0 @@
using System;
namespace PKHeX
{
public class PCD
{
internal const int Size = 0x358; // 856
public byte[] Data;
public PCD(byte[] data = null)
{
Data = data ?? new byte[Size];
byte[] giftData = new byte[PGT.Size];
Array.Copy(Data, 0, giftData, 0, PGT.Size);
Gift = new PGT(giftData);
Information = new byte[Data.Length - PGT.Size];
Array.Copy(Data, PGT.Size, Information, 0, Information.Length);
}
public readonly PGT Gift;
public readonly byte[] Information;
/* Big thanks to Grovyle91's Pokémon Mystery Gift Editor, from which the structure was referenced.
* http://projectpokemon.org/forums/member.php?829-Grovyle91
* http://projectpokemon.org/forums/showthread.php?6524
* See also: http://tccphreak.shiny-clique.net/debugger/pcdfiles.htm
*/
}
public class PGT
{
internal static int Size = 0x104; // 260
public byte[] Data;
public PGT(byte[] data = null)
{
Data = data ?? new byte[Size];
byte[] ekdata = new byte[PK4.SIZE_PARTY];
Array.Copy(Data, 8, ekdata, 0, ekdata.Length);
// Decrypt PK4
PK = new PK4(PKM.decryptArray(ekdata));
Unknown = new byte[0x10];
Array.Copy(Data, 0xF4, Unknown, 0, 0x10);
}
public byte CardType { get { return Data[0]; } set { Data[0] = value; } }
// Unused 0x01
public byte Slot { get { return Data[2]; } set { Data[2] = value; } }
public byte Detail { get { return Data[3]; } set { Data[3] = value; } }
public PK4 PK;
public byte[] Unknown;
public bool IsPokémon { get { return CardType == 1; } set { if (value) CardType = 1; } }
public bool IsEgg { get { return CardType == 2; } set { if (value) CardType = 2; } }
public bool IsManaphyEgg { get { return CardType == 7; } set { if (value) CardType = 7; } }
public bool PokémonGift => IsPokémon || IsEgg || IsManaphyEgg;
public PK4 convertToPK4(SAV6 SAV)
{
if (!PokémonGift)
return null;
PK4 pk4 = new PK4(PK.Data);
if (!IsPokémon && Detail == 0)
{
pk4.OT_Name = "PKHeX";
pk4.TID = 12345;
pk4.SID = 54321;
pk4.OT_Gender = (int)(Util.rnd32()%2);
}
if (IsManaphyEgg)
{
// Since none of this data is populated, fill in default info.
pk4.Species = 490;
// Level 1 Moves
pk4.Move1 = 294;
pk4.Move2 = 145;
pk4.Move3 = 346;
pk4.FatefulEncounter = true;
pk4.Ball = 4;
pk4.Version = 10; // Diamond
pk4.Language = 2; // English
pk4.Nickname = "MANAPHY";
pk4.Egg_Location = 1; // Ranger (will be +3000 later)
}
// Generate IV
uint seed = Util.rnd32();
if (pk4.PID == 1) // Create Nonshiny
{
uint pid1 = PKM.LCRNG(ref seed) >> 16;
uint pid2 = PKM.LCRNG(ref seed) >> 16;
while ((pid1 ^ pid2 ^ pk4.TID ^ pk4.SID) < 8)
{
uint testPID = pid1 | pid2 << 16;
// Call the ARNG to change the PID
testPID = testPID * 0x6c078965 + 1;
pid1 = testPID & 0xFFFF;
pid2 = testPID >> 16;
}
pk4.PID = pid1 | (pid2 << 16);
}
// Generate IVs
if (pk4.IV32 == 0)
{
uint iv1 = PKM.LCRNG(ref seed) >> 16;
uint iv2 = PKM.LCRNG(ref seed) >> 16;
pk4.IV32 = (iv1 | iv2 << 16) & 0x3FFFFFFF;
}
// Generate Met Info
DateTime dt = DateTime.Now;
if (IsPokémon)
{
pk4.Met_Location = pk4.Egg_Location + 3000;
pk4.Egg_Location = 0;
pk4.Met_Day = dt.Day;
pk4.Met_Month = dt.Month;
pk4.Met_Year = dt.Year - 2000;
pk4.IsEgg = false;
}
else
{
pk4.Egg_Location = pk4.Egg_Location + 3000;
pk4.Egg_Day = dt.Day;
pk4.Egg_Month = dt.Month;
pk4.Egg_Year = dt.Year - 2000;
pk4.IsEgg = false;
// Met Location is modified when transferred to pk5; don't worry about it.
}
if (pk4.Species == 201) // Never will be true; Unown was never distributed.
pk4.AltForm = PKM.getUnownForm(pk4.PID);
return pk4;
}
}
}

View file

@ -1,299 +0,0 @@
using System;
using System.Linq;
namespace PKHeX
{
public class PK3 // 3rd Generation PKM File
{
internal const int SIZE_PARTY = 100;
internal const int SIZE_STORED = 80;
internal const int SIZE_BLOCK = 12;
public PK3(byte[] decryptedData = null, string ident = null)
{
Data = (byte[])(decryptedData ?? new byte[SIZE_PARTY]).Clone();
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
}
// Internal Attributes set on creation
public byte[] Data; // Raw Storage
public string Identifier; // User or Form Custom Attribute
// 0x20 Intro
public uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public uint EID { get { return BitConverter.ToUInt32(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } }
public ushort TID { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } }
public ushort SID { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } }
public string Nickname {
get { return PKM.getG3Str(Data.Skip(0x08).Take(10).ToArray(), Japanese); }
set { byte[] strdata = PKM.setG3Str(value, Japanese);
if (strdata.Length > 10)
Array.Resize(ref strdata, 10);
strdata.CopyTo(Data, 0x08); } }
public int Language { get { return BitConverter.ToUInt16(Data, 0x12); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } }
public string OT_Name {
get { return PKM.getG3Str(Data.Skip(0x14).Take(7).ToArray(), Japanese); }
set { byte[] strdata = PKM.setG3Str(value, Japanese);
if (strdata.Length > 7)
Array.Resize(ref strdata, 7);
strdata.CopyTo(Data, 0x14); } }
private byte Markings { get { return Data[0x1B]; } set { Data[0x1B] = value; } }
public bool Circle { get { return (Markings & (1 << 0)) == 1 << 0; } set { Markings = (byte)(Markings & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public bool Square { get { return (Markings & (1 << 1)) == 1 << 1; } set { Markings = (byte)(Markings & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
public bool Triangle { get { return (Markings & (1 << 2)) == 1 << 2; } set { Markings = (byte)(Markings & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
public bool Heart { get { return (Markings & (1 << 3)) == 1 << 3; } set { Markings = (byte)(Markings & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
public ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1C); } }
public ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1E); } }
#region Block A
public int Species { get { return PKM.getG4Species(BitConverter.ToUInt16(Data, 0x20)); } set { BitConverter.GetBytes((ushort)PKM.getG3Species(value)).CopyTo(Data, 0x20); } }
public ushort HeldItem { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x22); } }
public uint EXP { get { return BitConverter.ToUInt32(Data, 0x24); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x24); } }
private byte PPUps { get { return Data[0x28]; } set { Data[0x28] = value; } }
public int Move1_PPUps { get { return (PPUps >> 0) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 0)) | value); } }
public int Move2_PPUps { get { return (PPUps >> 2) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 2)) | value); } }
public int Move3_PPUps { get { return (PPUps >> 4) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 4)) | value); } }
public int Move4_PPUps { get { return (PPUps >> 6) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 6)) | value); } }
public int Friendship { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } }
// Unused 0x2A 0x2B
#endregion
#region Block B
public int Move1 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
public int Move2 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } }
public int Move3 { get { return BitConverter.ToUInt16(Data, 0x30); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x30); } }
public int Move4 { get { return BitConverter.ToUInt16(Data, 0x32); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x32); } }
public int Move1_PP { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
public int Move2_PP { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } }
public int Move3_PP { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } }
public int Move4_PP { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } }
#endregion
#region Block C
public int EV_HP { get { return Data[0x38]; } set { Data[0x38] = (byte)value; } }
public int EV_ATK { get { return Data[0x39]; } set { Data[0x39] = (byte)value; } }
public int EV_DEF { get { return Data[0x3A]; } set { Data[0x3A] = (byte)value; } }
public int EV_SPE { get { return Data[0x3B]; } set { Data[0x3B] = (byte)value; } }
public int EV_SPA { get { return Data[0x3C]; } set { Data[0x3C] = (byte)value; } }
public int EV_SPD { get { return Data[0x3D]; } set { Data[0x3D] = (byte)value; } }
public int CNT_Cool { get { return Data[0x3E]; } set { Data[0x3E] = (byte)value; } }
public int CNT_Beauty { get { return Data[0x3F]; } set { Data[0x3F] = (byte)value; } }
public int CNT_Cute { get { return Data[0x40]; } set { Data[0x40] = (byte)value; } }
public int CNT_Smart { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } }
public int CNT_Tough { get { return Data[0x42]; } set { Data[0x42] = (byte)value; } }
public int CNT_Sheen { get { return Data[0x43]; } set { Data[0x43] = (byte)value; } }
#endregion
#region Block D
private byte PKRS { get { return Data[0x44]; } set { Data[0x44] = value; } }
public int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } }
public int Met_Location { get { return Data[0x45]; } set { Data[0x45] = (byte)value; } }
// Origins
private ushort Origins { get { return BitConverter.ToUInt16(Data, 0x46); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x46); } }
public int Version { get { return (Origins >> 7) & 0xF; } set { Origins = (ushort)((Origins & ~0x780) | ((value & 0xF) << 7));} }
public int Pokéball { get { return (Origins >> 11) & 0xF; } set { Origins = (ushort)((Origins & ~0x7800) | ((value & 0xF) << 11)); } }
public int OT_Gender { get { return (Origins >> 15) & 1; } set { Origins = (ushort)(Origins & ~(1 << 15) | ((value & 1) << 15)); } }
public uint IV32 { get { return BitConverter.ToUInt32(Data, 0x48); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x48); } }
public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public int Ability { get { return (int)((IV32 >> 31) & 1); } set { IV32 = (IV32 & 0x7FFFFFFF) | (value == 1 ? 0x80000000 : 0); } }
private uint RIB0 { get { return BitConverter.ToUInt32(Data, 0x4C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } }
public int Cool_Ribbons { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7)); } }
public int Beauty_Ribbons{ get { return (int)(RIB0 >> 03) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 03)) | (uint)(value & 7)); } }
public int Cute_Ribbons { get { return (int)(RIB0 >> 06) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 06)) | (uint)(value & 7)); } }
public int Smart_Ribbons { get { return (int)(RIB0 >> 09) & 3; } set { RIB0 = (uint)((RIB0 & ~(7 << 09)) | (uint)(value & 7)); } }
public int Tough_Ribbons { get { return (int)(RIB0 >> 12) & 3; } set { RIB0 = (uint)((RIB0 & ~(7 << 12)) | (uint)(value & 7)); } }
public bool Champion { get { return (RIB0 & (1 << 15)) == 1 << 15; } set { RIB0 = (uint)(RIB0 & ~(1 << 15) | (uint)(value ? 1 << 0 : 0)); } }
public bool Winning { get { return (RIB0 & (1 << 16)) == 1 << 16; } set { RIB0 = (uint)(RIB0 & ~(1 << 16) | (uint)(value ? 1 << 0 : 0)); } }
public bool Victory { get { return (RIB0 & (1 << 17)) == 1 << 17; } set { RIB0 = (uint)(RIB0 & ~(1 << 17) | (uint)(value ? 1 << 0 : 0)); } }
public bool Artist { get { return (RIB0 & (1 << 18)) == 1 << 18; } set { RIB0 = (uint)(RIB0 & ~(1 << 18) | (uint)(value ? 1 << 0 : 0)); } }
public bool Effort { get { return (RIB0 & (1 << 19)) == 1 << 19; } set { RIB0 = (uint)(RIB0 & ~(1 << 19) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special1 { get { return (RIB0 & (1 << 20)) == 1 << 20; } set { RIB0 = (uint)(RIB0 & ~(1 << 20) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special2 { get { return (RIB0 & (1 << 21)) == 1 << 21; } set { RIB0 = (uint)(RIB0 & ~(1 << 21) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special3 { get { return (RIB0 & (1 << 22)) == 1 << 22; } set { RIB0 = (uint)(RIB0 & ~(1 << 22) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special4 { get { return (RIB0 & (1 << 23)) == 1 << 23; } set { RIB0 = (uint)(RIB0 & ~(1 << 23) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special5 { get { return (RIB0 & (1 << 24)) == 1 << 24; } set { RIB0 = (uint)(RIB0 & ~(1 << 24) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special6 { get { return (RIB0 & (1 << 25)) == 1 << 25; } set { RIB0 = (uint)(RIB0 & ~(1 << 25) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special7 { get { return (RIB0 & (1 << 26)) == 1 << 26; } set { RIB0 = (uint)(RIB0 & ~(1 << 26) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused1 { get { return (RIB0 & (1 << 27)) == 1 << 27; } set { RIB0 = (uint)(RIB0 & ~(1 << 27) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused2 { get { return (RIB0 & (1 << 28)) == 1 << 28; } set { RIB0 = (uint)(RIB0 & ~(1 << 28) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused3 { get { return (RIB0 & (1 << 29)) == 1 << 29; } set { RIB0 = (uint)(RIB0 & ~(1 << 29) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused4 { get { return (RIB0 & (1 << 30)) == 1 << 30; } set { RIB0 = (uint)(RIB0 & ~(1 << 30) | (uint)(value ? 1 << 0 : 0)); } }
public bool Obedience { get { return (RIB0 & (1 << 31)) == 1 << 31; } set { RIB0 = (RIB0 & ~(1 << 31)) | (uint)(value ? 1 << 0 : 0); } }
#endregion
// Simple Generated Attributes
public bool Japanese => Language == 1;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
public int[] Moves
{
get { return new[] { Move1, Move2, Move3, Move4 }; }
set
{
if (value.Length > 0) Move1 = value[0];
if (value.Length > 1) Move2 = value[1];
if (value.Length > 2) Move3 = value[2];
if (value.Length > 3) Move4 = value[3];
}
}
// Methods
public void FixMoves()
{
if (Move4 != 0 && Move3 == 0)
{
Move3 = Move4;
Move3_PP = Move4_PP;
Move3_PPUps = Move4_PPUps;
Move4 = Move4_PP = Move4_PPUps = 0;
}
if (Move3 != 0 && Move2 == 0)
{
Move2 = Move3;
Move2_PP = Move3_PP;
Move2_PPUps = Move3_PPUps;
Move3 = Move3_PP = Move3_PPUps = 0;
}
if (Move2 != 0 && Move1 == 0)
{
Move1 = Move2;
Move1_PP = Move2_PP;
Move1_PPUps = Move2_PPUps;
Move2 = Move2_PP = Move2_PPUps = 0;
}
}
public PK4 convertToPK4()
{
DateTime moment = DateTime.Now;
PK4 pk4 = new PK4 // Convert away!
{
PID = PID,
Species = Species,
TID = TID,
SID = SID,
EXP = IsEgg ? PKX.getEXP(5, Species) : EXP,
IsEgg = false,
Friendship = 40,
Circle = Circle,
Square = Square,
Triangle = Triangle,
Heart = Heart,
Language = Language,
EV_HP = EV_HP,
EV_ATK = EV_ATK,
EV_DEF = EV_DEF,
EV_SPA = EV_SPA,
EV_SPD = EV_SPD,
EV_SPE = EV_SPE,
CNT_Cool = CNT_Cool,
CNT_Beauty = CNT_Beauty,
CNT_Cute = CNT_Cute,
CNT_Smart = CNT_Smart,
CNT_Tough = CNT_Tough,
CNT_Sheen = CNT_Sheen,
FatefulEncounter = Obedience,
Move1 = Move1,
Move2 = Move2,
Move3 = Move3,
Move4 = Move4,
Move1_PPUps = Move1_PPUps,
Move2_PPUps = Move2_PPUps,
Move3_PPUps = Move3_PPUps,
Move4_PPUps = Move4_PPUps,
Move1_PP = PKX.getMovePP(Move1, Move1_PPUps),
Move2_PP = PKX.getMovePP(Move2, Move2_PPUps),
Move3_PP = PKX.getMovePP(Move3, Move3_PPUps),
Move4_PP = PKX.getMovePP(Move4, Move4_PPUps),
IV_HP = IV_HP,
IV_ATK = IV_ATK,
IV_DEF = IV_DEF,
IV_SPA = IV_SPA,
IV_SPD = IV_SPD,
IV_SPE = IV_SPE,
Ability = PKM.Gen3Abilities[Species][Ability],
Version = Version,
Ball = Pokéball,
PKRS_Strain = PKRS_Strain,
PKRS_Days = PKRS_Days,
OT_Gender = OT_Gender,
Met_Year = moment.Year - 2000,
Met_Month = moment.Month,
Met_Day = moment.Day,
Met_Location = 0x37, // Pal Park
RIB6_4 = Champion,
RIB6_5 = Winning,
RIB6_6 = Victory,
RIB6_7 = Artist,
RIB7_0 = Effort,
RIB7_1 = Special1, // Battle Champion Ribbon
RIB7_2 = Special2, // Regional Champion Ribbon
RIB7_3 = Special3, // National Champion Ribbon
RIB7_4 = Special4, // Country Ribbon
RIB7_5 = Special5, // National Ribbon
RIB7_6 = Special6, // Earth Ribbon
RIB7_7 = Special7, // World Ribbon
};
// Remaining Ribbons
pk4.RIB4_0 |= Cool_Ribbons > 0;
pk4.RIB4_1 |= Cool_Ribbons > 1;
pk4.RIB4_2 |= Cool_Ribbons > 2;
pk4.RIB4_3 |= Cool_Ribbons > 3;
pk4.RIB4_4 |= Beauty_Ribbons > 0;
pk4.RIB4_5 |= Beauty_Ribbons > 1;
pk4.RIB4_6 |= Beauty_Ribbons > 2;
pk4.RIB4_7 |= Beauty_Ribbons > 3;
pk4.RIB5_0 |= Cute_Ribbons > 0;
pk4.RIB5_1 |= Cute_Ribbons > 1;
pk4.RIB5_2 |= Cute_Ribbons > 2;
pk4.RIB5_3 |= Cute_Ribbons > 3;
pk4.RIB5_4 |= Smart_Ribbons > 0;
pk4.RIB5_5 |= Smart_Ribbons > 1;
pk4.RIB5_6 |= Smart_Ribbons > 2;
pk4.RIB5_7 |= Smart_Ribbons > 3;
pk4.RIB6_0 |= Tough_Ribbons > 0;
pk4.RIB6_1 |= Tough_Ribbons > 1;
pk4.RIB6_2 |= Tough_Ribbons > 2;
pk4.RIB6_3 |= Tough_Ribbons > 3;
// Yay for reusing string buffers!
PKM.G4TransferTrashBytes[pk4.Language].CopyTo(pk4.Data, 0x48 + 4);
pk4.Nickname = IsEgg ? PKM.getSpeciesName(pk4.Species, pk4.Language) : Nickname;
Array.Copy(pk4.Data, 0x48, pk4.Data, 0x68, 0x10);
pk4.OT_Name = OT_Name;
// Set Final Data
pk4.Met_Level = PKX.getLevel(pk4.Species, pk4.EXP);
pk4.Gender = PKM.getGender(pk4.Species, pk4.PID);
pk4.IsNicknamed |= pk4.Nickname != PKM.getSpeciesName(pk4.Species, pk4.Language);
// Unown Form
if (Species == 201)
pk4.AltForm = PKM.getUnownForm(PID);
// Remove HM moves
int[] banned = { 15, 19, 57, 70, 148, 249, 127, 291 };
int[] newMoves = pk4.Moves;
for (int i = 0; i < 4; i++)
if (banned.Contains(newMoves[i]))
newMoves[i] = 0;
pk4.Moves = newMoves;
pk4.FixMoves();
pk4.RefreshChecksum();
return pk4;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,8 @@
using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Web;
using System.Windows.Forms;
namespace PKHeX
@ -41,5 +44,57 @@ namespace PKHeX
try { Clipboard.SetImage(PB_QR.BackgroundImage); }
catch { Util.Alert("Failed to set Image to Clipboard"); }
}
// QR Utility
internal static byte[] getQRData()
{
// Fetch data from QR code...
string address;
try { address = Clipboard.GetText(); }
catch { Util.Alert("No text (url) in clipboard."); return null; }
try { if (address.Length < 4 || address.Substring(0, 3) != "htt") { Util.Alert("Clipboard text is not a valid URL:", address); return null; } }
catch { Util.Alert("Clipboard text is not a valid URL:", address); return null; }
string webURL = "http://api.qrserver.com/v1/read-qr-code/?fileurl=" + HttpUtility.UrlEncode(address);
try
{
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(webURL);
HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse();
var reader = new StreamReader(httpWebReponse.GetResponseStream());
string data = reader.ReadToEnd();
if (data.Contains("could not find")) { Util.Alert("Reader could not find QR data in the image."); return null; }
if (data.Contains("filetype not supported")) { Util.Alert("Input URL is not valid. Double check that it is an image (jpg/png).", address); return null; }
// Quickly convert the json response to a data string
string pkstr = data.Substring(data.IndexOf("#", StringComparison.Ordinal) + 1); // Trim intro
pkstr = pkstr.Substring(0, pkstr.IndexOf("\",\"error\":null}]}]", StringComparison.Ordinal)); // Trim outro
if (pkstr.Contains("nQR-Code:")) pkstr = pkstr.Substring(0, pkstr.IndexOf("nQR-Code:", StringComparison.Ordinal)); // Remove multiple QR codes in same image
pkstr = pkstr.Replace("\\", ""); // Rectify response
try { return Convert.FromBase64String(pkstr); }
catch { Util.Alert("QR string to Data failed.", pkstr); return null; }
}
catch { Util.Alert("Unable to connect to the internet to decode QR code."); return null; }
}
internal static Image getQRImage(byte[] data, string server)
{
string qrdata = Convert.ToBase64String(data);
string message = server + qrdata;
string webURL = "http://chart.apis.google.com/chart?chs=365x365&cht=qr&chl=" + HttpUtility.UrlEncode(message);
try
{
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(webURL);
HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse();
Stream stream = httpWebReponse.GetResponseStream();
if (stream != null) return Image.FromStream(stream);
}
catch
{
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Unable to connect to the internet to receive QR code.", "Copy QR URL to Clipboard?"))
return null;
try { Clipboard.SetText(webURL); }
catch { Util.Alert("Failed to set text to Clipboard"); }
}
return null;
}
}
}

View file

@ -1,178 +0,0 @@
using System;
using System.Linq;
namespace PKHeX
{
public class SAV4 : PKM
{
internal const int SIZERAW = 0x80000; // 512KB
internal static int getIsG4SAV(byte[] data)
{
int version = -1;
if (BitConverter.ToUInt16(data, 0xC0FE) == ccitt16(data.Take(0xC0EC).ToArray()))
version = 0; // DP
else if (BitConverter.ToUInt16(data, 0xCF2A) == ccitt16(data.Take(0xCF18).ToArray()))
version = 1; // PT
else if (BitConverter.ToUInt16(data, 0xF626) == ccitt16(data.Take(0xF618).ToArray()))
version = 2; // HGSS
return version;
}
// Global Settings
// Save Data Attributes
public readonly byte[] Data;
public bool Edited;
public readonly bool Exportable;
public readonly byte[] BAK;
public string FileName, FilePath;
public SAV4(byte[] data = null)
{
Data = (byte[])(data ?? new byte[SIZERAW]).Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
// Get Version
int version = getIsG4SAV(Data);
getActiveBlock(version);
getSAVOffsets(version);
}
private int generalBlock = -1;
private int storageBlock = -1;
private void getActiveBlock(int version)
{
if (version < 0)
return;
int ofs = 0;
if (version == 0) ofs = 0xC0F0; // DP
else if (version == 1) ofs = 0xCF1C; // PT
else if (version == 2) ofs = 0xF626; // HGSS
generalBlock = BitConverter.ToUInt16(Data, ofs) >= BitConverter.ToUInt16(Data, ofs + 0x40000) ? 0 : 1;
if (version == 0) ofs = 0x1E2D0; // DP
else if (version == 1) ofs = 0x1F100; // PT
else if (version == 2) ofs = 0x21A00; // HGSS
storageBlock = BitConverter.ToUInt16(Data, ofs) >= BitConverter.ToUInt16(Data, ofs + 0x40000) ? 0 : 1;
}
private void getSAVOffsets(int version)
{
if (version < 0)
return;
switch (version)
{
case 0: // DP
Party = 0x98 + 0x40000 * generalBlock;
Box = 0xC104 + 0x40000 * storageBlock;
break;
case 1: // PT
Party = 0xA0 + 0x40000 * generalBlock;
Box = 0xCF34 + 0x40000 * storageBlock;
break;
case 2: // HGSS
Party = 0x98 + 0x40000 * generalBlock;
Box = 0xF704 + 0x40000 * storageBlock;
break;
}
}
private int Box, Party = -1;
public int PartyCount
{
get { return Data[Party - 4]; }
set { Data[Party - 4] = (byte)value; }
}
public int BoxCount
{
get { return Data[Box - 4]; }
set { Data[Box - 4] = (byte)value; }
}
public PK4[] BoxData
{
get
{
PK4[] data = new PK4[18 * 30];
for (int i = 0; i < data.Length; i++)
{
data[i] = getPK4Stored(Box + PK4.SIZE_STORED * i);
data[i].Identifier = $"B{(i / 30 + 1).ToString("00")}:{(i % 30 + 1).ToString("00")}";
}
return data;
}
set
{
if (value == null)
throw new ArgumentNullException();
if (value.Length != 18 * 30)
throw new ArgumentException("Expected 540, got " + value.Length);
for (int i = 0; i < value.Length; i++)
setPK4Stored(value[i], Box + PK4.SIZE_STORED * i);
}
}
public PK4[] PartyData
{
get
{
PK4[] data = new PK4[PartyCount];
for (int i = 0; i < data.Length; i++)
data[i] = getPK4Party(Party + PK4.SIZE_PARTY * i);
return data;
}
set
{
if (value == null)
throw new ArgumentNullException();
if (value.Length == 0 || value.Length > 6)
throw new ArgumentException("Expected 1-6, got " + value.Length);
if (value[0].Species == 0)
throw new ArgumentException("Can't have an empty first slot." + value.Length);
PK4[] newParty = value.Where(pk => pk.Species != 0).ToArray();
PartyCount = newParty.Length;
Array.Resize(ref newParty, 6);
for (int i = PartyCount; i < newParty.Length; i++)
newParty[i] = new PK4();
for (int i = 0; i < newParty.Length; i++)
setPK4Party(newParty[i], Party + PK4.SIZE_PARTY * i);
}
}
public PK4 getPK4Party(int offset)
{
return new PK4(decryptArray(getData(offset, PK4.SIZE_PARTY)));
}
public PK4 getPK4Stored(int offset)
{
return new PK4(decryptArray(getData(offset, PK4.SIZE_STORED)));
}
public void setPK4Party(PK4 pk4, int offset)
{
if (pk4 == null) return;
setData(pk4.EncryptedPartyData, offset);
Edited = true;
}
public void setPK4Stored(PK4 pk4, int offset)
{
if (pk4 == null) return;
setData(pk4.EncryptedBoxData, offset);
Edited = true;
}
public byte[] getData(int Offset, int Length)
{
return Data.Skip(Offset).Take(Length).ToArray();
}
public void setData(byte[] input, int Offset)
{
input.CopyTo(Data, Offset);
Edited = true;
}
}
}

View file

@ -1,204 +0,0 @@
using System;
using System.Linq;
namespace PKHeX
{
public class SAV5 : PKM
{
internal const int SIZERAW = 0x80000; // 512KB
internal const int SIZE1 = 0x24000; // B/W
internal const int SIZE2 = 0x26000; // B2/W2
internal static int getIsG5SAV(byte[] data)
{
ushort chk1 = BitConverter.ToUInt16(data, SIZE1 - 0x100 + 0x8C + 0xE);
ushort actual1 = ccitt16(data.Skip(SIZE1 - 0x100).Take(0x8C).ToArray());
if (chk1 == actual1)
return 0;
ushort chk2 = BitConverter.ToUInt16(data, SIZE2 - 0x100 + 0x94 + 0xE);
ushort actual2 = ccitt16(data.Skip(SIZE2 - 0x100).Take(0x94).ToArray());
if (chk2 == actual2)
return 1;
return -1;
}
// Global Settings
// Save Data Attributes
public readonly byte[] Data;
public bool Edited;
public readonly bool Exportable;
public readonly byte[] BAK;
public string FileName, FilePath;
public SAV5(byte[] data = null)
{
Data = (byte[])(data ?? new byte[SIZERAW]).Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
// Get Version
int version = getIsG5SAV(Data);
if (version < 0) // Invalidate Data
Data = null;
// Different Offsets for different games.
BattleBox = version == 1 ? 0x20A00 : 0x20900;
}
private const int Box = 0x400;
private const int Party = 0x18E00;
private readonly int BattleBox;
private const int Trainer = 0x19400;
private const int Wondercard = 0x1C800;
private const int wcSeed = 0x1D290;
public int PartyCount
{
get { return Data[Party]; }
set { Data[Party] = (byte)value; }
}
public PK5[] BoxData
{
get
{
PK5[] data = new PK5[24 * 30];
for (int i = 0; i < data.Length; i++)
{
data[i] = getPK5Stored(Box + i/30 * 0x10 + PK5.SIZE_STORED * i);
data[i].Identifier = $"B{(i / 30 + 1).ToString("00")}:{(i % 30 + 1).ToString("00")}";
}
return data;
}
set
{
if (value == null)
throw new ArgumentNullException();
if (value.Length != 24 * 30)
throw new ArgumentException("Expected 720, got " + value.Length);
for (int i = 0; i < value.Length; i++)
setPK5Stored(value[i], Box + i/30 * 0x10 + PK5.SIZE_STORED * i);
}
}
public PK5[] PartyData
{
get
{
PK5[] data = new PK5[PartyCount];
for (int i = 0; i < data.Length; i++)
data[i] = getPK5Party(Party + 8 + PK5.SIZE_PARTY * i);
return data;
}
set
{
if (value == null)
throw new ArgumentNullException();
if (value.Length == 0 || value.Length > 6)
throw new ArgumentException("Expected 1-6, got " + value.Length);
if (value[0].Species == 0)
throw new ArgumentException("Can't have an empty first slot." + value.Length);
PK5[] newParty = value.Where(pk => pk.Species != 0).ToArray();
PartyCount = newParty.Length;
Array.Resize(ref newParty, 6);
for (int i = PartyCount; i < newParty.Length; i++)
newParty[i] = new PK5();
for (int i = 0; i < newParty.Length; i++)
setPK5Party(newParty[i], Party + 8 + PK5.SIZE_PARTY * i);
}
}
public PK5[] BattleBoxData
{
get
{
PK5[] data = new PK5[6];
for (int i = 0; i < data.Length; i++)
{
data[i] = getPK5Stored(BattleBox + PK5.SIZE_STORED * i);
if (data[i].Species == 0)
return data.Take(i).ToArray();
}
return data;
}
}
public class MysteryGift
{
public readonly PGF[] Cards = new PGF[12];
public readonly bool[] UsedFlags = new bool[0x800];
public uint Seed;
}
public MysteryGift WondercardInfo
{
get
{
uint seed = BitConverter.ToUInt32(Data, wcSeed);
MysteryGift Info = new MysteryGift { Seed = seed };
byte[] wcData = Data.Skip(Wondercard).Take(0xA90).ToArray(); // Encrypted, Decrypt
for (int i = 0; i < wcData.Length; i += 2)
BitConverter.GetBytes((ushort)(BitConverter.ToUInt16(wcData, i) ^ LCRNG(ref seed) >> 16)).CopyTo(wcData, i);
// 0x100 Bytes for Used Flags
for (int i = 0; i < Info.UsedFlags.Length; i++)
Info.UsedFlags[i] = (wcData[i/8] >> i%8 & 0x1) == 1;
// 12 PGFs
for (int i = 0; i < Info.Cards.Length; i++)
Info.Cards[i] = new PGF(Data.Skip(0x100 + i*PGF.Size).Take(PGF.Size).ToArray());
return Info;
}
set
{
MysteryGift Info = value;
byte[] wcData = new byte[0xA90];
// Toss back into byte[]
for (int i = 0; i < Info.UsedFlags.Length; i++)
if (Info.UsedFlags[i])
wcData[i/8] |= (byte)(1 << (i & 7));
for (int i = 0; i < Info.Cards.Length; i++)
Info.Cards[i].Data.CopyTo(wcData, 0x100 + i*PGF.Size);
// Decrypted, Encrypt
uint seed = Info.Seed;
for (int i = 0; i < wcData.Length; i += 2)
BitConverter.GetBytes((ushort)(BitConverter.ToUInt16(wcData, i) ^ LCRNG(ref seed) >> 16)).CopyTo(wcData, i);
BitConverter.GetBytes(Info.Seed).CopyTo(Data, wcSeed);
}
}
public PK5 getPK5Party(int offset)
{
return new PK5(decryptArray(getData(offset, PK5.SIZE_PARTY)));
}
public PK5 getPK5Stored(int offset)
{
return new PK5(decryptArray(getData(offset, PK5.SIZE_STORED)));
}
public void setPK5Party(PK5 pk5, int offset)
{
if (pk5 == null) return;
setData(pk5.EncryptedPartyData, offset);
Edited = true;
}
public void setPK5Stored(PK5 pk5, int offset)
{
if (pk5 == null) return;
setData(pk5.EncryptedBoxData, offset);
Edited = true;
}
public byte[] getData(int Offset, int Length)
{
return Data.Skip(Offset).Take(Length).ToArray();
}
public void setData(byte[] input, int Offset)
{
input.CopyTo(Data, Offset);
Edited = true;
}
}
}

View file

@ -149,6 +149,7 @@ namespace PKHeX
internal static string[] getStringList(string f)
{
object txt = Properties.Resources.ResourceManager.GetObject(f); // Fetch File, \n to list.
if (txt == null) return new string[0];
string[] rawlist = ((string)txt).Split('\n');
for (int i = 0; i < rawlist.Length; i++)
rawlist[i] = rawlist[i].Trim();
@ -157,6 +158,7 @@ namespace PKHeX
internal static string[] getStringList(string f, string l)
{
object txt = Properties.Resources.ResourceManager.GetObject("text_" + f + "_" + l); // Fetch File, \n to list.
if (txt == null) return new string[0];
string[] rawlist = ((string)txt).Split('\n');
for (int i = 0; i < rawlist.Length; i++)
rawlist[i] = rawlist[i].Trim();
@ -473,57 +475,5 @@ namespace PKHeX
}
return cbList;
}
// QR Utility
internal static byte[] getQRData()
{
// Fetch data from QR code...
string address;
try { address = Clipboard.GetText(); }
catch { Alert("No text (url) in clipboard."); return null; }
try { if (address.Length < 4 || address.Substring(0, 3) != "htt") { Alert("Clipboard text is not a valid URL:", address); return null; } }
catch { Alert("Clipboard text is not a valid URL:", address); return null; }
string webURL = "http://api.qrserver.com/v1/read-qr-code/?fileurl=" + System.Web.HttpUtility.UrlEncode(address);
try
{
System.Net.HttpWebRequest httpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(webURL);
System.Net.HttpWebResponse httpWebReponse = (System.Net.HttpWebResponse)httpWebRequest.GetResponse();
var reader = new StreamReader(httpWebReponse.GetResponseStream());
string data = reader.ReadToEnd();
if (data.Contains("could not find")) { Alert("Reader could not find QR data in the image."); return null; }
if (data.Contains("filetype not supported")) { Alert("Input URL is not valid. Double check that it is an image (jpg/png).", address); return null; }
// Quickly convert the json response to a data string
string pkstr = data.Substring(data.IndexOf("#", StringComparison.Ordinal) + 1); // Trim intro
pkstr = pkstr.Substring(0, pkstr.IndexOf("\",\"error\":null}]}]", StringComparison.Ordinal)); // Trim outro
if (pkstr.Contains("nQR-Code:")) pkstr = pkstr.Substring(0, pkstr.IndexOf("nQR-Code:", StringComparison.Ordinal)); // Remove multiple QR codes in same image
pkstr = pkstr.Replace("\\", ""); // Rectify response
try { return Convert.FromBase64String(pkstr); }
catch { Alert("QR string to Data failed.", pkstr); return null; }
}
catch { Alert("Unable to connect to the internet to decode QR code."); return null;}
}
internal static Image getQRImage(byte[] data, string server)
{
string qrdata = Convert.ToBase64String(data);
string message = server + qrdata;
string webURL = "http://chart.apis.google.com/chart?chs=365x365&cht=qr&chl=" + System.Web.HttpUtility.UrlEncode(message);
try
{
System.Net.HttpWebRequest httpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(webURL);
System.Net.HttpWebResponse httpWebReponse = (System.Net.HttpWebResponse)httpWebRequest.GetResponse();
Stream stream = httpWebReponse.GetResponseStream();
if (stream != null) return Image.FromStream(stream);
}
catch
{
if (DialogResult.Yes != Prompt(MessageBoxButtons.YesNo, "Unable to connect to the internet to receive QR code.", "Copy QR URL to Clipboard?"))
return null;
try { Clipboard.SetText(webURL); }
catch { Alert("Failed to set text to Clipboard"); }
}
return null;
}
}
}

View file

@ -0,0 +1,41 @@
using System;
using System.Linq;
namespace PKHeX
{
public abstract class MysteryGift
{
internal static MysteryGift getMysteryGift(byte[] data, string ext)
{
if (data.Length == WC6.SizeFull && ext == ".wc6full")
return new WC6(data);
if (data.Length == WC6.Size && ext == ".wc6")
return new WC6(data);
if (data.Length == PGF.Size && ext == ".pgf")
return new PGF(data);
if (data.Length == PGT.Size && ext == ".pgt")
return new PGT(data);
if (data.Length == PCD.Size && ext == ".pcd")
return new PCD(data);
return null;
}
public abstract string Extension { get; }
public virtual byte[] Data { get; set; }
public abstract PKM convertToPKM(SaveFile SAV);
// Properties
public abstract bool GiftUsed { get; set; }
public abstract string CardTitle { get; set; }
public abstract int CardID { get; set; }
public abstract bool IsItem { get; set; }
public abstract int Item { get; set; }
public abstract bool IsPokémon { get; set; }
public virtual int Quantity { get { return 1; } set { } }
public bool Empty => Data.SequenceEqual(new byte[Data.Length]);
public string getCardHeader() => (CardID > 0 ? $"Card #: {CardID.ToString("0000")}" : "N/A") + $" - {CardTitle.Trim()}" + Environment.NewLine;
}
}

View file

@ -3,14 +3,16 @@ using System.Text;
namespace PKHeX
{
public class PGF
public class PGF : MysteryGift
{
internal const int Size = 0xCC;
public override string Extension => ".pgf";
public byte[] Data;
public PGF(byte[] data = null)
{
Data = data ?? new byte[Size];
Data = (byte[])(data?.Clone() ?? new byte[Size]);
if (data == null) Data = new byte[Size];
else Data = (byte[])data.Clone();
}
public ushort TID { get { return BitConverter.ToUInt16(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
@ -49,7 +51,7 @@ namespace PKHeX
public int Language { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } }
public string Nickname
{
get { return PKM.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x1E, 0x16)); }
get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x1E, 0x16)); }
set { Encoding.Unicode.GetBytes(value.PadRight(0xB, (char)0xFFFF)).CopyTo(Data, 0x1E); }
}
public int Nature { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
@ -73,27 +75,32 @@ namespace PKHeX
public int IV_SPD { get { return Data[0x48]; } set { Data[0x48] = (byte)value; } }
// Unused 0x49
public string OT {
get { return PKM.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x4A, 0x10)); }
get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x4A, 0x10)); }
set { Encoding.Unicode.GetBytes(value.PadRight(0x08, (char)0xFFFF)).CopyTo(Data, 0x4A); } }
public int OTGender { get { return Data[0x5A]; } set { Data[0x5A] = (byte)value; } }
public int Level { get { return Data[0x5B]; } set { Data[0x5C] = (byte)value; } }
public bool IsEgg { get { return Data[0x5C] == 1; } set { Data[0x5C] = (byte)(value ? 1 : 0); } }
// Unused 0x5D 0x5E 0x5F
public override string CardTitle
{
get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x60, 0x4A)); }
set { Encoding.Unicode.GetBytes((value + '\uFFFF').PadRight(0x4A/2, '\0')).CopyTo(Data, 0x60); }
}
// Card Attributes
public ushort Item { get { return BitConverter.ToUInt16(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public override int Item { get { return BitConverter.ToUInt16(Data, 0x00); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } }
public ushort Year { get { return BitConverter.ToUInt16(Data, 0xAE); } set { BitConverter.GetBytes(value).CopyTo(Data, 0xAE); } }
public byte Month { get { return Data[0xAD]; } set { Data[0xAD] = value; } }
public byte Day { get { return Data[0xAC]; } set { Data[0xAC] = value; } }
public int CardID
public override int CardID
{
get { return BitConverter.ToUInt16(Data, 0xB0); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xB0); }
}
public int CardLocation { get { return Data[0xB2]; } set { Data[0xB2] = (byte)value; } }
public int CardType { get { return Data[0xB3]; } set { Data[0xB3] = (byte)value; } }
public bool GiftUsed { get { return Data[0xB4] >> 1 > 0; } set { Data[0xB4] = (byte)(Data[0xB4] & ~2 | (value ? 2 : 0)); } }
public override bool GiftUsed { get { return Data[0xB4] >> 1 > 0; } set { Data[0xB4] = (byte)(Data[0xB4] & ~2 | (value ? 2 : 0)); } }
public bool MultiObtain { get { return Data[0xB4] == 1; } set { Data[0xB4] = (byte)(value ? 1 : 0); } }
// Meta Accessible Properties
@ -111,11 +118,11 @@ namespace PKHeX
if (value.Length > 3) Move4 = value[3];
}
}
public bool IsPokémon { get { return CardType == 1; } set { if (value) CardType = 1; } }
public bool IsItem { get { return CardType == 2; } set { if (value) CardType = 2; } }
public override bool IsPokémon { get { return CardType == 1; } set { if (value) CardType = 1; } }
public override bool IsItem { get { return CardType == 2; } set { if (value) CardType = 2; } }
public bool IsPower { get { return CardType == 3; } set { if (value) CardType = 3; } }
public PK5 convertToPK5(SAV6 SAV)
public override PKM convertToPKM(SaveFile SAV)
{
if (!IsPokémon)
return null;
@ -179,21 +186,21 @@ namespace PKHeX
RIB7_3 = RIB1_5, // National Champ Ribbon
RIB2_5 = RIB1_6, // World Champ Ribbon
Friendship = PKX.getBaseFriendship(Species),
OT_Friendship = PKX.getBaseFriendship(Species),
FatefulEncounter = true,
};
if (OTGender == 3) // User's
{
pk.TID = 12345;
pk.SID = 54321;
pk.OT_Name = "PKHeX";
pk.TID = SAV.TID;
pk.SID = SAV.SID;
pk.OT_Name = SAV.OT;
pk.OT_Gender = 1; // Red PKHeX OT
}
else
{
pk.TID = TID;
pk.SID = SID;
pk.OT_Name = OT.Length > 0 ? OT : "PKHeX";
pk.TID = IsEgg ? SAV.TID : TID;
pk.SID = IsEgg ? SAV.SID : SID;
pk.OT_Name = OT.Length > 0 ? OT : SAV.OT;
pk.OT_Gender = OTGender % 2; // %2 just in case?
}
pk.IsNicknamed = IsNicknamed;

209
MysteryGifts/PGT.cs Normal file
View file

@ -0,0 +1,209 @@
using System;
using System.Linq;
namespace PKHeX
{
/* Big thanks to Grovyle91's Pokémon Mystery Gift Editor, from which the structure was referenced.
* http://projectpokemon.org/forums/member.php?829-Grovyle91
* http://projectpokemon.org/forums/showthread.php?6524
* See also: http://tccphreak.shiny-clique.net/debugger/pcdfiles.htm
*/
public class PCD : MysteryGift
{
internal const int Size = 0x358; // 856
public override string Extension => ".pcd";
public PCD(byte[] data = null)
{
Data = (byte[])(data?.Clone() ?? new byte[Size]);
byte[] giftData = new byte[PGT.Size];
Array.Copy(Data, 0, giftData, 0, PGT.Size);
Gift = new PGT(giftData);
Information = new byte[Data.Length - PGT.Size];
Array.Copy(Data, PGT.Size, Information, 0, Information.Length);
}
public readonly PGT Gift;
public readonly byte[] Information;
public override bool GiftUsed { get { return Gift.GiftUsed; } set { Gift.GiftUsed = value; } }
public override bool IsPokémon { get { return Gift.IsPokémon; } set { Gift.IsPokémon = value; } }
public override bool IsItem { get { return Gift.IsItem; } set { Gift.IsItem = value; } }
public override int Item { get { return Gift.Item; } set { Gift.Item = value; } }
public override int CardID
{
get { return BitConverter.ToUInt16(Data, 0x150); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x150); }
}
public override string CardTitle
{
get { return PKX.array2strG4(Data.Skip(0x104).Take(0x48).ToArray()); }
set
{
byte[] data = PKX.str2arrayG4(value);
int len = data.Length;
Array.Resize(ref data, 0x48);
for (int i = 0; i < len; i++)
data[i] = 0xFF;
data.CopyTo(Data, 0x104);
}
}
public override PKM convertToPKM(SaveFile SAV)
{
return Gift.convertToPKM(SAV);
}
}
public class PGT : MysteryGift
{
internal const int Size = 0x104; // 260
public override string Extension => ".pgt";
private enum GiftType
{
Pokémon = 1,
PokémonEgg = 2,
Item = 3,
Rule = 4,
Seal = 5,
Accessory = 6,
ManaphyEgg = 7,
MemberCard = 8,
OaksLetter = 9,
AzureFlute = 10,
PokétchApp = 11,
Ribbon = 12,
PokéWalkerArea = 14
}
public override string CardTitle { get { return "Raw Gift (PGT)"; } set { } }
public override int CardID { get { return -1; } set { } }
public override bool GiftUsed { get { return false; } set { } }
public PGT(byte[] data = null)
{
refreshData((byte[])(data?.Clone() ?? new byte[Size]));
}
public void refreshData(byte[] data)
{
byte[] ekdata = new byte[PKX.SIZE_4PARTY];
Array.Copy(data, 8, ekdata, 0, ekdata.Length);
bool empty = ekdata.SequenceEqual(new byte[ekdata.Length]);
PK = new PK4(empty ? ekdata : PKX.decryptArray45(ekdata));
Unknown = new byte[0x10];
Array.Copy(data, 0xF4, Unknown, 0, 0x10);
RAW = data;
}
public byte CardType { get { return Data[0]; } set { Data[0] = value; } }
// Unused 0x01
public byte Slot { get { return Data[2]; } set { Data[2] = value; } }
public byte Detail { get { return Data[3]; } set { Data[3] = value; } }
public override int Item { get { return BitConverter.ToUInt16(Data, 0x4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4); } }
private PK4 PK;
private byte[] Unknown;
private byte[] RAW;
public override byte[] Data
{
get { return RAW; }
set
{
refreshData(value);
}
}
private GiftType Type { get { return (GiftType)Data[0]; } set {Data[0] = (byte)value; } }
public bool IsHatched => Type == GiftType.Pokémon;
public bool IsEgg => Type == GiftType.PokémonEgg;
public bool IsManaphyEgg => Type == GiftType.ManaphyEgg;
public override bool IsItem { get { return Type == GiftType.Item; } set { if (value) CardType = (int)GiftType.Item; } }
public override bool IsPokémon { get { return Type == GiftType.Pokémon || Type == GiftType.PokémonEgg || Type == GiftType.ManaphyEgg; } set { } }
public override PKM convertToPKM(SaveFile SAV)
{
if (!IsPokémon)
return null;
PK4 pk4 = new PK4(PK.Data);
if (!IsHatched && Detail == 0)
{
pk4.OT_Name = SAV.OT;
pk4.TID = SAV.TID;
pk4.SID = SAV.SID;
pk4.OT_Gender = SAV.Gender;
}
if (IsManaphyEgg)
{
// Since none of this data is populated, fill in default info.
pk4.Species = 490;
// Level 1 Moves
pk4.Move1 = 294;
pk4.Move2 = 145;
pk4.Move3 = 346;
pk4.FatefulEncounter = true;
pk4.Ball = 4;
pk4.Version = 10; // Diamond
pk4.Language = 2; // English
pk4.Nickname = "MANAPHY";
pk4.Egg_Location = 1; // Ranger (will be +3000 later)
}
// Generate IV
uint seed = Util.rnd32();
if (pk4.PID == 1 || IsManaphyEgg) // Create Nonshiny
{
uint pid1 = PKX.LCRNG(ref seed) >> 16;
uint pid2 = PKX.LCRNG(ref seed) >> 16;
while ((pid1 ^ pid2 ^ pk4.TID ^ pk4.SID) < 8)
{
uint testPID = pid1 | pid2 << 16;
// Call the ARNG to change the PID
testPID = testPID * 0x6c078965 + 1;
pid1 = testPID & 0xFFFF;
pid2 = testPID >> 16;
}
pk4.PID = pid1 | (pid2 << 16);
}
// Generate IVs
if (pk4.IV32 == 0)
{
uint iv1 = PKX.LCRNG(ref seed) >> 16;
uint iv2 = PKX.LCRNG(ref seed) >> 16;
pk4.IV32 = (iv1 | iv2 << 16) & 0x3FFFFFFF;
}
// Generate Met Info
DateTime dt = DateTime.Now;
if (IsPokémon)
{
pk4.Met_Location = pk4.Egg_Location + 3000;
pk4.Egg_Location = 0;
pk4.Met_Day = dt.Day;
pk4.Met_Month = dt.Month;
pk4.Met_Year = dt.Year - 2000;
pk4.IsEgg = false;
}
else
{
pk4.Egg_Location = pk4.Egg_Location + 3000;
pk4.Egg_Day = dt.Day;
pk4.Egg_Month = dt.Month;
pk4.Egg_Year = dt.Year - 2000;
pk4.IsEgg = false;
// Met Location is modified when transferred to pk5; don't worry about it.
}
if (pk4.Species == 201) // Never will be true; Unown was never distributed.
pk4.AltForm = PKX.getUnownForm(pk4.PID);
if (IsEgg || IsManaphyEgg)
pk4.IsEgg = true;
return pk4;
}
}
}

View file

@ -4,16 +4,16 @@ using System.Text;
namespace PKHeX
{
public partial class WC6
public class WC6 : MysteryGift
{
internal const int Size = 0x108;
internal const int SizeFull = 0x310;
internal const uint EonTicketConst = 0x225D73C2;
public override string Extension => ".wc6";
public readonly byte[] Data;
public WC6(byte[] data = null)
{
Data = data ?? new byte[Size];
Data = (byte[])(data?.Clone() ?? new byte[Size]);
if (Data.Length == SizeFull)
{
Data = Data.Skip(SizeFull - Size).ToArray();
@ -23,12 +23,12 @@ namespace PKHeX
Day = (uint)now.Day;
}
}
// General Card Properties
public int CardID {
public override int CardID {
get { return BitConverter.ToUInt16(Data, 0); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0); } }
public string CardTitle { // Max len 36 char, followed by null terminator
public override string CardTitle { // Max len 36 char, followed by null terminator
get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 2, 72)); }
set { Encoding.Unicode.GetBytes(value.PadRight(36, '\0')).CopyTo(Data, 2); } }
private uint Date {
@ -46,20 +46,20 @@ namespace PKHeX
public int CardLocation { get { return Data[0x50]; } set { Data[0x50] = (byte)value; } }
public int CardType { get { return Data[0x51]; } set { Data[0x51] = (byte)value; } }
public bool GiftUsed { get { return Data[0x52] >> 1 > 0; } set { Data[0x52] = (byte)(Data[0x52] & ~2 | (value ? 2 : 0)); } }
public override bool GiftUsed { get { return Data[0x52] >> 1 > 0; } set { Data[0x52] = (byte)(Data[0x52] & ~2 | (value ? 2 : 0)); } }
public bool MultiObtain { get { return Data[0x53] == 1; } set { Data[0x53] = (byte)(value ? 1 : 0); } }
// Item Properties
public bool IsItem { get { return CardType == 1; } set { if (value) CardType = 1; } }
public int Item {
public override bool IsItem { get { return CardType == 1; } set { if (value) CardType = 1; } }
public override int Item {
get { return BitConverter.ToUInt16(Data, 0x68); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } }
public int Quantity {
public override int Quantity {
get { return BitConverter.ToUInt16(Data, 0x70); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } }
// Pokémon Properties
public bool IsPokémon { get { return CardType == 0; } set { if (value) CardType = 0; } }
public override bool IsPokémon { get { return CardType == 0; } set { if (value) CardType = 0; } }
public int TID {
get { return BitConverter.ToUInt16(Data, 0x68); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } }
@ -207,7 +207,7 @@ namespace PKHeX
}
}
public PK6 convertToPK6(SAV6 SAV)
public override PKM convertToPKM(SaveFile SAV)
{
if (!IsPokémon)
return null;

View file

@ -71,24 +71,32 @@
<Compile Include="Legality\Checks.cs" />
<Compile Include="Legality\Core.cs" />
<Compile Include="Legality\Data.cs" />
<Compile Include="Misc\PGT.cs" />
<Compile Include="Misc\PK3.cs" />
<Compile Include="Misc\PK4.cs" />
<Compile Include="Legality\Tables5.cs" />
<Compile Include="Legality\Tables4.cs" />
<Compile Include="MysteryGifts\MysteryGift.cs" />
<Compile Include="PKM\PKM.cs" />
<Compile Include="PKM\PKMConverter.cs" />
<Compile Include="PKM\ShowdownSet.cs" />
<Compile Include="MysteryGifts\PGT.cs" />
<Compile Include="PKM\PK3.cs" />
<Compile Include="PKM\PK4.cs" />
<Compile Include="Legality\Tables.cs" />
<Compile Include="Misc\PGF.cs" />
<Compile Include="Misc\PK5.cs" />
<Compile Include="Misc\PK6.cs" />
<Compile Include="Misc\PKM.cs" />
<Compile Include="MysteryGifts\PGF.cs" />
<Compile Include="PKM\PK5.cs" />
<Compile Include="PKM\PK6.cs" />
<Compile Include="Misc\QR.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Misc\QR.Designer.cs">
<DependentUpon>QR.cs</DependentUpon>
</Compile>
<Compile Include="Misc\SAV4.cs" />
<Compile Include="Misc\SAV5.cs" />
<Compile Include="Misc\SAV6.cs" />
<Compile Include="Misc\WC6.cs" />
<Compile Include="Saves\BlockInfo.cs" />
<Compile Include="Saves\Inventory.cs" />
<Compile Include="Saves\SAV4.cs" />
<Compile Include="Saves\SAV5.cs" />
<Compile Include="Saves\SAV6.cs" />
<Compile Include="Saves\SaveFile.cs" />
<Compile Include="MysteryGifts\WC6.cs" />
<Compile Include="PKX\f2-Text.cs">
<SubType>Form</SubType>
</Compile>
@ -101,7 +109,7 @@
<Compile Include="Misc\About.Designer.cs">
<DependentUpon>About.cs</DependentUpon>
</Compile>
<Compile Include="Misc\PKX.cs" />
<Compile Include="PKM\PKX.cs" />
<Compile Include="PKX\f1-Main.cs">
<SubType>Form</SubType>
</Compile>
@ -125,11 +133,13 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_BerryFieldORAS.cs">
<Compile Include="Saves\SaveObjects.cs" />
<Compile Include="Saves\SaveUtil.cs" />
<Compile Include="SAV\SAV_PokeBlockORAS.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SAV\SAV_BerryFieldORAS.Designer.cs">
<DependentUpon>SAV_BerryFieldORAS.cs</DependentUpon>
<Compile Include="SAV\SAV_PokeBlockORAS.Designer.cs">
<DependentUpon>SAV_PokeBlockORAS.cs</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_Database.cs">
<SubType>Form</SubType>
@ -149,11 +159,11 @@
<Compile Include="SAV\SAV_SecretBase.Designer.cs">
<DependentUpon>SAV_SecretBase.cs</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_EventFlagsORAS.cs">
<Compile Include="SAV\SAV_EventFlags.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SAV\SAV_EventFlagsORAS.Designer.cs">
<DependentUpon>SAV_EventFlagsORAS.cs</DependentUpon>
<Compile Include="SAV\SAV_EventFlags.Designer.cs">
<DependentUpon>SAV_EventFlags.cs</DependentUpon>
</Compile>
<Compile Include="SAV\frmReport.cs">
<SubType>Form</SubType>
@ -175,12 +185,6 @@
<Compile Include="SAV\SAV_BoxLayout.Designer.cs">
<DependentUpon>SAV_BoxLayout.cs</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_EventFlagsXY.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SAV\SAV_EventFlagsXY.Designer.cs">
<DependentUpon>SAV_EventFlagsXY.cs</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_HallOfFame.cs">
<SubType>Form</SubType>
</Compile>
@ -238,12 +242,14 @@
<Compile Include="Misc\Util.cs" />
<EmbeddedResource Include="Misc\QR.resx">
<DependentUpon>QR.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="PKX\f2-Text.resx">
<DependentUpon>f2-Text.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Misc\About.resx">
<DependentUpon>About.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="PKX\f1-Main.resx">
<DependentUpon>f1-Main.cs</DependentUpon>
@ -255,8 +261,8 @@
<EmbeddedResource Include="PKX\f3-MemoryAmie.resx">
<DependentUpon>f3-MemoryAmie.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_BerryFieldORAS.resx">
<DependentUpon>SAV_BerryFieldORAS.cs</DependentUpon>
<EmbeddedResource Include="SAV\SAV_PokeBlockORAS.resx">
<DependentUpon>SAV_PokeBlockORAS.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_Database.resx">
<DependentUpon>SAV_Database.cs</DependentUpon>
@ -267,8 +273,8 @@
<EmbeddedResource Include="SAV\SAV_SecretBase.resx">
<DependentUpon>SAV_SecretBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_EventFlagsORAS.resx">
<DependentUpon>SAV_EventFlagsORAS.cs</DependentUpon>
<EmbeddedResource Include="SAV\SAV_EventFlags.resx">
<DependentUpon>SAV_EventFlags.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\frmReport.resx">
<DependentUpon>frmReport.cs</DependentUpon>
@ -284,9 +290,6 @@
<EmbeddedResource Include="SAV\SAV_BoxLayout.resx">
<DependentUpon>SAV_BoxLayout.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_EventFlagsXY.resx">
<DependentUpon>SAV_EventFlagsXY.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_HallOfFame.resx">
<DependentUpon>SAV_HallOfFame.cs</DependentUpon>
</EmbeddedResource>
@ -313,6 +316,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Misc\SplashScreen.resx">
<DependentUpon>SplashScreen.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
@ -370,6 +374,27 @@
<None Include="Resources\byte\wc6full.pkl" />
<None Include="Resources\img\warn.png" />
<None Include="Resources\img\valid.png" />
<None Include="Resources\img\Program\about.png" />
<None Include="Resources\img\Program\bak.png" />
<None Include="Resources\img\Program\database.png" />
<None Include="Resources\img\Program\exit.png" />
<None Include="Resources\img\Program\export.png" />
<None Include="Resources\img\Program\import.png" />
<None Include="Resources\img\Program\language.png" />
<None Include="Resources\img\Program\open.png" />
<None Include="Resources\img\Program\other.png" />
<None Include="Resources\img\Program\report.png" />
<None Include="Resources\img\Program\savePKM.png" />
<None Include="Resources\img\Program\saveSAV.png" />
<None Include="Resources\img\Program\settings-16.png" />
<None Include="Resources\img\Program\settings.png" />
<None Include="Resources\img\Program\nocheck.png" />
<None Include="Resources\img\Program\load.png" />
<None Include="Resources\img\Program\data.png" />
<None Include="Resources\img\Program\dump.png" />
<None Include="Resources\img\Program\showdown.png" />
<None Include="Resources\img\Program\folder.png" />
<None Include="Resources\img\Program\main.png" />
<Content Include="Resources\text\de\text_Pokeblock_de.txt" />
<None Include="Resources\text\de\text_tradeao_de.txt" />
<None Include="Resources\text\de\text_tradexy_de.txt" />
@ -391,6 +416,9 @@
<Content Include="Resources\text\ko\text_Pokeblock_ko.txt" />
<None Include="Resources\text\ko\text_tradeao_ko.txt" />
<None Include="Resources\text\ko\text_tradexy_ko.txt" />
<None Include="Resources\text\other\const_oras.txt" />
<None Include="Resources\text\other\flags_oras.txt" />
<None Include="Resources\text\other\flags_xy.txt" />
<Content Include="Resources\text\zh\text_Pokeblock_zh.txt" />
<None Include="Resources\text\it\lang_it.txt" />
<None Include="Resources\img\Pokemon Sprites\414-2.png" />

299
PKM/PK3.cs Normal file
View file

@ -0,0 +1,299 @@
using System;
using System.Linq;
namespace PKHeX
{
public class PK3 : PKM // 3rd Generation PKM File
{
public override int SIZE_PARTY => PKX.SIZE_3PARTY;
public override int SIZE_STORED => PKX.SIZE_3STORED;
public override int Format => 3;
public PK3(byte[] decryptedData = null, string ident = null)
{
Data = (byte[])(decryptedData ?? new byte[SIZE_PARTY]).Clone();
PKMConverter.checkEncrypted(ref Data);
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
}
public override PKM Clone() { return new PK3(Data); }
// Future Attributes
public override uint EncryptionConstant { get { return PID; } set { } }
public override int Nature { get { return (int)(PID % 25); } set { } }
public override int AltForm { get { return -1; } set { } }
public override bool IsNicknamed { get { return Nickname != PKX.getSpeciesName(Species, Language); } set { } }
public override int Gender { get { return PKX.getGender(Species, PID); } set { } }
public override int Characteristic => -1;
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int Ability { get { return PKX.Gen3Abilities[Species][AbilityNumber]; } set { } }
public override int CurrentHandler { get { return 0; } set { } }
public override int Egg_Location { get { return 0; } set { } }
public override int Met_Level { get { return -1; } set { } }
// 0x20 Intro
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public override int TID { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x04); } }
public override int SID { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x06); } }
public override string Nickname {
get { return PKX.getG3Str(Data.Skip(0x08).Take(10).ToArray(), Japanese); }
set { byte[] strdata = PKX.setG3Str(value, Japanese);
if (strdata.Length > 10)
Array.Resize(ref strdata, 10);
strdata.CopyTo(Data, 0x08); } }
public override int Language { get { return BitConverter.ToUInt16(Data, 0x12); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } }
public override string OT_Name {
get { return PKX.getG3Str(Data.Skip(0x14).Take(7).ToArray(), Japanese); }
set { byte[] strdata = PKX.setG3Str(value, Japanese);
if (strdata.Length > 7)
Array.Resize(ref strdata, 7);
strdata.CopyTo(Data, 0x14); } }
public override byte MarkByte { get { return Data[0x1B]; } protected set { Data[0x1B] = value; } }
public override ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1C); } }
public override ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1E); } }
#region Block A
public override int Species { get { return PKX.getG4Species(BitConverter.ToUInt16(Data, 0x20)); } set { BitConverter.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x20); } }
public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } }
public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x24); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x24); } }
private byte PPUps { get { return Data[0x28]; } set { Data[0x28] = value; } }
public override int Move1_PPUps { get { return (PPUps >> 0) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 0)) | value); } }
public override int Move2_PPUps { get { return (PPUps >> 2) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 2)) | value); } }
public override int Move3_PPUps { get { return (PPUps >> 4) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 4)) | value); } }
public override int Move4_PPUps { get { return (PPUps >> 6) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 6)) | value); } }
public override int OT_Friendship { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } }
// Unused 0x2A 0x2B
#endregion
#region Block B
public override int Move1 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
public override int Move2 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } }
public override int Move3 { get { return BitConverter.ToUInt16(Data, 0x30); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x30); } }
public override int Move4 { get { return BitConverter.ToUInt16(Data, 0x32); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x32); } }
public override int Move1_PP { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
public override int Move2_PP { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } }
public override int Move3_PP { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } }
public override int Move4_PP { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } }
#endregion
#region Block C
public override int EV_HP { get { return Data[0x38]; } set { Data[0x38] = (byte)value; } }
public override int EV_ATK { get { return Data[0x39]; } set { Data[0x39] = (byte)value; } }
public override int EV_DEF { get { return Data[0x3A]; } set { Data[0x3A] = (byte)value; } }
public override int EV_SPE { get { return Data[0x3B]; } set { Data[0x3B] = (byte)value; } }
public override int EV_SPA { get { return Data[0x3C]; } set { Data[0x3C] = (byte)value; } }
public override int EV_SPD { get { return Data[0x3D]; } set { Data[0x3D] = (byte)value; } }
public override int CNT_Cool { get { return Data[0x3E]; } set { Data[0x3E] = (byte)value; } }
public override int CNT_Beauty { get { return Data[0x3F]; } set { Data[0x3F] = (byte)value; } }
public override int CNT_Cute { get { return Data[0x40]; } set { Data[0x40] = (byte)value; } }
public override int CNT_Smart { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } }
public override int CNT_Tough { get { return Data[0x42]; } set { Data[0x42] = (byte)value; } }
public override int CNT_Sheen { get { return Data[0x43]; } set { Data[0x43] = (byte)value; } }
#endregion
#region Block D
private byte PKRS { get { return Data[0x44]; } set { Data[0x44] = value; } }
public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } }
public override int Met_Location { get { return Data[0x45]; } set { Data[0x45] = (byte)value; } }
// Origins
private ushort Origins { get { return BitConverter.ToUInt16(Data, 0x46); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x46); } }
public override int Version { get { return (Origins >> 7) & 0xF; } set { Origins = (ushort)((Origins & ~0x780) | ((value & 0xF) << 7));} }
public override int Ball { get { return (Origins >> 11) & 0xF; } set { Origins = (ushort)((Origins & ~0x7800) | ((value & 0xF) << 11)); } }
public override int OT_Gender { get { return (Origins >> 15) & 1; } set { Origins = (ushort)(Origins & ~(1 << 15) | ((value & 1) << 15)); } }
public uint IV32 { get { return BitConverter.ToUInt32(Data, 0x48); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x48); } }
public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public int AbilityNumber { get { return (int)((IV32 >> 31) & 1); } set { IV32 = (IV32 & 0x7FFFFFFF) | (value == 1 ? 0x80000000 : 0); } }
private uint RIB0 { get { return BitConverter.ToUInt32(Data, 0x4C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } }
public int Cool_Ribbons { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7)); } }
public int Beauty_Ribbons{ get { return (int)(RIB0 >> 03) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 03)) | (uint)(value & 7)); } }
public int Cute_Ribbons { get { return (int)(RIB0 >> 06) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 06)) | (uint)(value & 7)); } }
public int Smart_Ribbons { get { return (int)(RIB0 >> 09) & 3; } set { RIB0 = (uint)((RIB0 & ~(7 << 09)) | (uint)(value & 7)); } }
public int Tough_Ribbons { get { return (int)(RIB0 >> 12) & 3; } set { RIB0 = (uint)((RIB0 & ~(7 << 12)) | (uint)(value & 7)); } }
public bool Champion { get { return (RIB0 & (1 << 15)) == 1 << 15; } set { RIB0 = (uint)(RIB0 & ~(1 << 15) | (uint)(value ? 1 << 0 : 0)); } }
public bool Winning { get { return (RIB0 & (1 << 16)) == 1 << 16; } set { RIB0 = (uint)(RIB0 & ~(1 << 16) | (uint)(value ? 1 << 0 : 0)); } }
public bool Victory { get { return (RIB0 & (1 << 17)) == 1 << 17; } set { RIB0 = (uint)(RIB0 & ~(1 << 17) | (uint)(value ? 1 << 0 : 0)); } }
public bool Artist { get { return (RIB0 & (1 << 18)) == 1 << 18; } set { RIB0 = (uint)(RIB0 & ~(1 << 18) | (uint)(value ? 1 << 0 : 0)); } }
public bool Effort { get { return (RIB0 & (1 << 19)) == 1 << 19; } set { RIB0 = (uint)(RIB0 & ~(1 << 19) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special1 { get { return (RIB0 & (1 << 20)) == 1 << 20; } set { RIB0 = (uint)(RIB0 & ~(1 << 20) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special2 { get { return (RIB0 & (1 << 21)) == 1 << 21; } set { RIB0 = (uint)(RIB0 & ~(1 << 21) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special3 { get { return (RIB0 & (1 << 22)) == 1 << 22; } set { RIB0 = (uint)(RIB0 & ~(1 << 22) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special4 { get { return (RIB0 & (1 << 23)) == 1 << 23; } set { RIB0 = (uint)(RIB0 & ~(1 << 23) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special5 { get { return (RIB0 & (1 << 24)) == 1 << 24; } set { RIB0 = (uint)(RIB0 & ~(1 << 24) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special6 { get { return (RIB0 & (1 << 25)) == 1 << 25; } set { RIB0 = (uint)(RIB0 & ~(1 << 25) | (uint)(value ? 1 << 0 : 0)); } }
public bool Special7 { get { return (RIB0 & (1 << 26)) == 1 << 26; } set { RIB0 = (uint)(RIB0 & ~(1 << 26) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused1 { get { return (RIB0 & (1 << 27)) == 1 << 27; } set { RIB0 = (uint)(RIB0 & ~(1 << 27) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused2 { get { return (RIB0 & (1 << 28)) == 1 << 28; } set { RIB0 = (uint)(RIB0 & ~(1 << 28) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused3 { get { return (RIB0 & (1 << 29)) == 1 << 29; } set { RIB0 = (uint)(RIB0 & ~(1 << 29) | (uint)(value ? 1 << 0 : 0)); } }
public bool Unused4 { get { return (RIB0 & (1 << 30)) == 1 << 30; } set { RIB0 = (uint)(RIB0 & ~(1 << 30) | (uint)(value ? 1 << 0 : 0)); } }
public override bool FatefulEncounter { get { return (RIB0 & (1 << 31)) == 1 << 31; } set { RIB0 = (RIB0 & ~(1 << 31)) | (uint)(value ? 1 << 0 : 0); } }
#endregion
public override int Stat_Level { get { return Data[0x54]; } set { Data[0x54] = (byte)value; } }
public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0x56); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x56); } }
public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0x58); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x58); } }
public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0x5A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } }
public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0x5C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } }
public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0x5E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } }
public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0x60); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } }
public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0x62); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x62); } }
// Generated Attributes
public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3);
public override int TSV => (TID ^ SID) >> 3;
public bool Japanese => Language == 1;
public override byte[] Encrypt()
{
throw new NotImplementedException();
}
public override bool getGenderIsValid()
{
int gv = PKX.Personal[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
public PK4 convertToPK4()
{
DateTime moment = DateTime.Now;
PK4 pk4 = new PK4 // Convert away!
{
PID = PID,
Species = Species,
TID = TID,
SID = SID,
EXP = IsEgg ? PKX.getEXP(5, Species) : EXP,
IsEgg = false,
OT_Friendship = 40,
Circle = Circle,
Square = Square,
Triangle = Triangle,
Heart = Heart,
Language = Language,
EV_HP = EV_HP,
EV_ATK = EV_ATK,
EV_DEF = EV_DEF,
EV_SPA = EV_SPA,
EV_SPD = EV_SPD,
EV_SPE = EV_SPE,
CNT_Cool = CNT_Cool,
CNT_Beauty = CNT_Beauty,
CNT_Cute = CNT_Cute,
CNT_Smart = CNT_Smart,
CNT_Tough = CNT_Tough,
CNT_Sheen = CNT_Sheen,
FatefulEncounter = FatefulEncounter,
Move1 = Move1,
Move2 = Move2,
Move3 = Move3,
Move4 = Move4,
Move1_PPUps = Move1_PPUps,
Move2_PPUps = Move2_PPUps,
Move3_PPUps = Move3_PPUps,
Move4_PPUps = Move4_PPUps,
Move1_PP = PKX.getMovePP(Move1, Move1_PPUps),
Move2_PP = PKX.getMovePP(Move2, Move2_PPUps),
Move3_PP = PKX.getMovePP(Move3, Move3_PPUps),
Move4_PP = PKX.getMovePP(Move4, Move4_PPUps),
IV_HP = IV_HP,
IV_ATK = IV_ATK,
IV_DEF = IV_DEF,
IV_SPA = IV_SPA,
IV_SPD = IV_SPD,
IV_SPE = IV_SPE,
Ability = PKX.Gen3Abilities[Species][Ability],
Version = Version,
Ball = Ball,
PKRS_Strain = PKRS_Strain,
PKRS_Days = PKRS_Days,
OT_Gender = OT_Gender,
Met_Year = moment.Year - 2000,
Met_Month = moment.Month,
Met_Day = moment.Day,
Met_Location = 0x37, // Pal Park
RIB6_4 = Champion,
RIB6_5 = Winning,
RIB6_6 = Victory,
RIB6_7 = Artist,
RIB7_0 = Effort,
RIB7_1 = Special1, // Battle Champion Ribbon
RIB7_2 = Special2, // Regional Champion Ribbon
RIB7_3 = Special3, // National Champion Ribbon
RIB7_4 = Special4, // Country Ribbon
RIB7_5 = Special5, // National Ribbon
RIB7_6 = Special6, // Earth Ribbon
RIB7_7 = Special7, // World Ribbon
};
// Remaining Ribbons
pk4.RIB4_0 |= Cool_Ribbons > 0;
pk4.RIB4_1 |= Cool_Ribbons > 1;
pk4.RIB4_2 |= Cool_Ribbons > 2;
pk4.RIB4_3 |= Cool_Ribbons > 3;
pk4.RIB4_4 |= Beauty_Ribbons > 0;
pk4.RIB4_5 |= Beauty_Ribbons > 1;
pk4.RIB4_6 |= Beauty_Ribbons > 2;
pk4.RIB4_7 |= Beauty_Ribbons > 3;
pk4.RIB5_0 |= Cute_Ribbons > 0;
pk4.RIB5_1 |= Cute_Ribbons > 1;
pk4.RIB5_2 |= Cute_Ribbons > 2;
pk4.RIB5_3 |= Cute_Ribbons > 3;
pk4.RIB5_4 |= Smart_Ribbons > 0;
pk4.RIB5_5 |= Smart_Ribbons > 1;
pk4.RIB5_6 |= Smart_Ribbons > 2;
pk4.RIB5_7 |= Smart_Ribbons > 3;
pk4.RIB6_0 |= Tough_Ribbons > 0;
pk4.RIB6_1 |= Tough_Ribbons > 1;
pk4.RIB6_2 |= Tough_Ribbons > 2;
pk4.RIB6_3 |= Tough_Ribbons > 3;
// Yay for reusing string buffers!
PKX.G4TransferTrashBytes[pk4.Language].CopyTo(pk4.Data, 0x48 + 4);
pk4.Nickname = IsEgg ? PKX.getSpeciesName(pk4.Species, pk4.Language) : Nickname;
Array.Copy(pk4.Data, 0x48, pk4.Data, 0x68, 0x10);
pk4.OT_Name = OT_Name;
// Set Final Data
pk4.Met_Level = PKX.getLevel(pk4.Species, pk4.EXP);
pk4.Gender = PKX.getGender(pk4.Species, pk4.PID);
pk4.IsNicknamed |= pk4.Nickname != PKX.getSpeciesName(pk4.Species, pk4.Language);
// Unown Form
if (Species == 201)
pk4.AltForm = PKX.getUnownForm(PID);
// Remove HM moves
int[] banned = { 15, 19, 57, 70, 148, 249, 127, 291 };
int[] newMoves = pk4.Moves;
for (int i = 0; i < 4; i++)
if (banned.Contains(newMoves[i]))
newMoves[i] = 0;
pk4.Moves = newMoves;
pk4.FixMoves();
pk4.RefreshChecksum();
return pk4;
}
}
}

View file

@ -3,57 +3,58 @@ using System.Linq;
namespace PKHeX
{
public class PK4 // 4th Generation PKM File
public class PK4 : PKM // 4th Generation PKM File
{
internal const int SIZE_PARTY = 236;
internal const int SIZE_STORED = 136;
internal const int SIZE_BLOCK = 32;
internal static readonly byte[] ExtraBytes =
{
0x42, 0x43, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87
};
public override int SIZE_PARTY => PKX.SIZE_4PARTY;
public override int SIZE_STORED => PKX.SIZE_4STORED;
public override int Format => 4;
public PK4(byte[] decryptedData = null, string ident = null)
{
Data = (byte[])(decryptedData ?? new byte[SIZE_PARTY]).Clone();
PKMConverter.checkEncrypted(ref Data);
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
}
public override PKM Clone() { return new PK4(Data); }
// Internal Attributes set on creation
public byte[] Data; // Raw Storage
public string Identifier; // User or Form Custom Attribute
// Future Attributes
public override uint EncryptionConstant { get { return PID; } set { } }
public override int Nature { get { return (int)(PID%25); } set { } }
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int CurrentHandler { get { return 0; } set { } }
// Structure
public uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } }
public ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } }
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public override ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } }
public override ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } }
#region Block A
public int Species { get { return BitConverter.ToUInt16(Data, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } }
public int HeldItem { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } }
public int TID { get { return BitConverter.ToUInt16(Data, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } }
public int SID { get { return BitConverter.ToUInt16(Data, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } }
public uint EXP { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } }
public int Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
public int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
public byte Markings { get { return Data[0x16]; } set { Data[0x16] = value; } }
public bool Circle { get { return (Markings & (1 << 0)) == 1 << 0; } set { Markings = (byte)(Markings & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public bool Triangle { get { return (Markings & (1 << 1)) == 1 << 1; } set { Markings = (byte)(Markings & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
public bool Square { get { return (Markings & (1 << 2)) == 1 << 2; } set { Markings = (byte)(Markings & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
public bool Heart { get { return (Markings & (1 << 3)) == 1 << 3; } set { Markings = (byte)(Markings & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
public bool Star { get { return (Markings & (1 << 4)) == 1 << 4; } set { Markings = (byte)(Markings & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
public bool Diamond { get { return (Markings & (1 << 5)) == 1 << 5; } set { Markings = (byte)(Markings & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
public int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
public int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } }
public int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } }
public int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } }
public int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } }
public int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
public int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } }
public int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
public int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
public int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
public int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
public int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
public override int Species { get { return BitConverter.ToUInt16(Data, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } }
public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } }
public override int TID { get { return BitConverter.ToUInt16(Data, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } }
public override int SID { get { return BitConverter.ToUInt16(Data, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } }
public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } }
public override int OT_Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
public override int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
public override byte MarkByte { get { return Data[0x16]; } protected set { Data[0x16] = value; } }
public override int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
public override int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } }
public override int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } }
public override int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } }
public override int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } }
public override int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
public override int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } }
public override int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
public override int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
public override int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public override int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
public override int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
public override int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
private byte RIB0 { get { return Data[0x24]; } set { Data[0x24] = value; } } // Sinnoh 1
public bool RIB0_0 { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Sinnoh Champ Ribbon
@ -94,27 +95,27 @@ namespace PKHeX
#endregion
#region Block B
public int Move1 { get { return BitConverter.ToUInt16(Data, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } }
public int Move2 { get { return BitConverter.ToUInt16(Data, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } }
public int Move3 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
public int Move4 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } }
public int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } }
public int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } }
public int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } }
public int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } }
public int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
public int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } }
public int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } }
public int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } }
public override int Move1 { get { return BitConverter.ToUInt16(Data, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } }
public override int Move2 { get { return BitConverter.ToUInt16(Data, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } }
public override int Move3 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
public override int Move4 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } }
public override int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } }
public override int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } }
public override int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } }
public override int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } }
public override int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
public override int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } }
public override int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } }
public override int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } }
public uint IV32 { get { return BitConverter.ToUInt32(Data, 0x38); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x38); } }
public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } }
public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } }
private byte RIB4 { get { return Data[0x3C]; } set { Data[0x3C] = value; } } // Hoenn 1a
public bool RIB4_0 { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Cool Ribbon
@ -153,18 +154,18 @@ namespace PKHeX
public bool RIB7_6 { get { return (RIB7 & (1 << 6)) == 1 << 6; } set { RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Earth Ribbon
public bool RIB7_7 { get { return (RIB7 & (1 << 7)) == 1 << 7; } set { RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // World Ribbon
public bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } }
public int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } }
public int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } }
public override bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } }
public override int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } }
public override int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } }
// 0x43-0x47 Unused
#endregion
#region Block C
public string Nickname
public override string Nickname
{
get
{
return PKM.array2strG4(Data.Skip(0x48).Take(22).ToArray())
return PKX.array2strG4(Data.Skip(0x48).Take(22).ToArray())
.Replace("\uE08F", "\u2640") // nidoran
.Replace("\uE08E", "\u2642") // nidoran
.Replace("\u2019", "\u0027"); // farfetch'd
@ -177,11 +178,11 @@ namespace PKHeX
.Replace("\u2640", "\uE08F") // nidoran
.Replace("\u2642", "\uE08E") // nidoran
.Replace("\u0027", "\u2019"); // farfetch'd
PKM.str2arrayG4(TempNick).CopyTo(Data, 0x48);
PKX.str2arrayG4(TempNick).CopyTo(Data, 0x48);
}
}
// 0x5E unused
public int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } }
public override int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } }
private byte RIB8 { get { return Data[0x60]; } set { Data[0x60] = value; } } // Sinnoh 3
public bool RIB8_0 { get { return (RIB8 & (1 << 0)) == 1 << 0; } set { RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Cool Ribbon
public bool RIB8_1 { get { return (RIB8 & (1 << 1)) == 1 << 1; } set { RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Cool Ribbon Great
@ -222,11 +223,11 @@ namespace PKHeX
#endregion
#region Block D
public string OT_Name
public override string OT_Name
{
get
{
return PKM.array2strG4(Data.Skip(0x68).Take(16).ToArray())
return PKX.array2strG4(Data.Skip(0x68).Take(16).ToArray())
.Replace("\uE08F", "\u2640") // Nidoran ♂
.Replace("\uE08E", "\u2642") // Nidoran ♀
.Replace("\u2019", "\u0027"); // Farfetch'd
@ -239,65 +240,85 @@ namespace PKHeX
.Replace("\u2640", "\uE08F") // Nidoran ♂
.Replace("\u2642", "\uE08E") // Nidoran ♀
.Replace("\u0027", "\u2019"); // Farfetch'd
PKM.str2arrayG4(TempNick).CopyTo(Data, 0x68);
PKX.str2arrayG4(TempNick).CopyTo(Data, 0x68);
}
}
public override int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } }
public override int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } }
public override int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } }
public override int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } }
public override int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } }
public override int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } }
public override int Egg_Location
{
get
{
ushort hgssloc = BitConverter.ToUInt16(Data, 0x44);
if (hgssloc != 0)
return hgssloc;
return BitConverter.ToUInt16(Data, 0x7E);
}
set
{
if (PtHGSS)
{
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x44);
BitConverter.GetBytes(0x7D0).CopyTo(Data, 0x7E);
}
else
{
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x44);
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E);
}
}
}
public override int Met_Location
{
get
{
ushort hgssloc = BitConverter.ToUInt16(Data, 0x46);
if (hgssloc != 0)
return hgssloc;
return BitConverter.ToUInt16(Data, 0x80);
}
set
{
if (PtHGSS)
{
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x46);
BitConverter.GetBytes(0x7D0).CopyTo(Data, 0x80);
}
else
{
BitConverter.GetBytes((ushort)0).CopyTo(Data, 0x46);
BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80);
}
}
}
public int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } }
public int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } }
public int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } }
public int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } }
public int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } }
public int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } }
public int Egg_Location { get { return BitConverter.ToUInt16(Data, 0x7E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } }
public int Met_Location { get { return BitConverter.ToUInt16(Data, 0x80); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } }
private byte PKRS { get { return Data[0x82]; } set { Data[0x82] = value; } }
public int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } }
public int Ball { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } }
public int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } }
public int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } }
public int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } }
public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } }
public override int Ball { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } }
public override int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } }
public override int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } }
public override int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } }
public int HGSSBall { get { return Data[0x86]; } set { Data[0x86] = (byte)value; } }
// Unused 0x87
#endregion
// Simple Generated Attributes
public int[] IVs
{
get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; }
set
{
if (value == null || value.Length != 6) return;
IV_HP = value[0]; IV_ATK = value[1]; IV_DEF = value[2];
IV_SPE = value[3]; IV_SPA = value[4]; IV_SPD = value[5];
}
}
public int[] EVs => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD };
public int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3);
public int TSV => (TID ^ SID) >> 3;
public bool IsShiny => TSV == PSV;
public bool PKRS_Infected => PKRS_Strain > 0;
public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0;
public bool Gen4 => Version >= 10 && Version < 12 || Version >= 7 && Version <= 8;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
public bool GenU => !(Gen4 || Gen3);
public override int Stat_Level { get { return Data[0x8C]; } set { Data[0x8C] = (byte)value; } }
public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0x8E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8E); } }
public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0x90); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x90); } }
public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0x92); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x92); } }
public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0x94); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x94); } }
public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0x96); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x96); } }
public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0x98); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x98); } }
public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0x9A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x9A); } }
public int[] Moves
{
get { return new[] { Move1, Move2, Move3, Move4 }; }
set
{
if (value.Length > 0) Move1 = value[0];
if (value.Length > 1) Move2 = value[1];
if (value.Length > 2) Move3 = value[2];
if (value.Length > 3) Move4 = value[3];
}
}
// Complex Generated Attributes
public byte[] EncryptedPartyData => Encrypt().Take(SIZE_PARTY).ToArray();
public byte[] EncryptedBoxData => Encrypt().Take(SIZE_STORED).ToArray();
public int Characteristic
public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3);
public override int TSV => (TID ^ SID) >> 3;
public override int Characteristic
{
get
{
@ -315,40 +336,9 @@ namespace PKHeX
return pm6stat * 5 + maxIV % 5;
}
}
public int PotentialRating
{
get
{
int ivTotal = IVs.Sum();
if (ivTotal <= 90)
return 0;
if (ivTotal <= 120)
return 1;
return ivTotal <= 150 ? 2 : 3;
}
}
public string FileName => $"{Species.ToString("000")}{(IsShiny ? " " : "")} - {Nickname} - {Checksum.ToString("X4")}{PID.ToString("X8")}.pkm";
public bool ChecksumValid => Checksum == CalculateChecksum();
// Methods
public void RefreshChecksum()
{
Checksum = CalculateChecksum();
}
public ushort CalculateChecksum()
{
ushort chk = 0;
for (int i = 8; i < SIZE_STORED; i += 2) // Loop through the entire PK6
chk += BitConverter.ToUInt16(Data, i);
return chk;
}
public byte[] Write()
{
RefreshChecksum();
return Data;
}
public bool getGenderIsValid()
public override bool getGenderIsValid()
{
int gv = PKX.Personal[Species].Gender;
@ -365,34 +355,10 @@ namespace PKHeX
return false;
}
public void FixMoves()
public override byte[] Encrypt()
{
if (Move4 != 0 && Move3 == 0)
{
Move3 = Move4;
Move3_PP = Move4_PP;
Move3_PPUps = Move4_PPUps;
Move4 = Move4_PP = Move4_PPUps = 0;
}
if (Move3 != 0 && Move2 == 0)
{
Move2 = Move3;
Move2_PP = Move3_PP;
Move2_PPUps = Move3_PPUps;
Move3 = Move3_PP = Move3_PPUps = 0;
}
if (Move2 != 0 && Move1 == 0)
{
Move1 = Move2;
Move1_PP = Move2_PP;
Move1_PPUps = Move2_PPUps;
Move2 = Move2_PP = Move2_PPUps = 0;
}
}
public byte[] Encrypt()
{
Checksum = CalculateChecksum();
return PKM.encryptArray(Data);
RefreshChecksum();
return PKX.encryptArray45(Data);
}
public PK5 convertToPK5()
@ -406,7 +372,7 @@ namespace PKHeX
PK5 pk5 = new PK5(Data) // Convert away!
{
HeldItem = 0,
Friendship = 70,
OT_Friendship = 70,
// Apply new met date
Met_Year = moment.Year - 2000,
Met_Month = moment.Month,
@ -420,7 +386,7 @@ namespace PKHeX
pk5.Move4_PP = PKX.getMovePP(pk5.Move4_PP, pk5.Move4_PPUps);
// Disassociate Nature and PID
pk5.Nature = (int)(pk5.PID % 0x19);
pk5.Nature = (int)(pk5.PID % 25);
// Delete Platinum/HGSS Met Location Data
BitConverter.GetBytes((uint)0).CopyTo(pk5.Data, 0x44);

View file

@ -6,55 +6,55 @@ namespace PKHeX
{
public class PK5 : PKM // 5th Generation PKM File
{
internal const int SIZE_PARTY = 220;
internal const int SIZE_STORED = 136;
internal const int SIZE_BLOCK = 32;
internal static readonly byte[] ExtraBytes =
{
0x42, 0x43, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87
};
public override int SIZE_PARTY => PKX.SIZE_5PARTY;
public override int SIZE_STORED => PKX.SIZE_5STORED;
public override int Format => 5;
public PK5(byte[] decryptedData = null, string ident = null)
{
Data = (byte[])(decryptedData ?? new byte[SIZE_PARTY]).Clone();
PKMConverter.checkEncrypted(ref Data);
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
}
public override PKM Clone() { return new PK5(Data); }
// Internal Attributes set on creation
public byte[] Data; // Raw Storage
public string Identifier; // User or Form Custom Attribute
// Future Attributes
public override uint EncryptionConstant { get { return PID; } set { } }
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
public override int CurrentHandler { get { return 0; } set { } }
// Structure
public uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } }
public ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } }
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
public override ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } }
public override ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } }
#region Block A
public int Species { get { return BitConverter.ToUInt16(Data, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } }
public int HeldItem { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } }
public int TID { get { return BitConverter.ToUInt16(Data, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } }
public int SID { get { return BitConverter.ToUInt16(Data, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } }
public uint EXP { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } }
public int Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
public int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
public byte Markings { get { return Data[0x16]; } set { Data[0x16] = value; } }
public bool Circle { get { return (Markings & (1 << 0)) == 1 << 0; } set { Markings = (byte)(Markings & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public bool Triangle { get { return (Markings & (1 << 1)) == 1 << 1; } set { Markings = (byte)(Markings & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
public bool Square { get { return (Markings & (1 << 2)) == 1 << 2; } set { Markings = (byte)(Markings & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
public bool Heart { get { return (Markings & (1 << 3)) == 1 << 3; } set { Markings = (byte)(Markings & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
public bool Star { get { return (Markings & (1 << 4)) == 1 << 4; } set { Markings = (byte)(Markings & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
public bool Diamond { get { return (Markings & (1 << 5)) == 1 << 5; } set { Markings = (byte)(Markings & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
public int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
public int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } }
public int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } }
public int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } }
public int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } }
public int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
public int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } }
public int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
public int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
public int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
public int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
public int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
public override int Species { get { return BitConverter.ToUInt16(Data, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } }
public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } }
public override int TID { get { return BitConverter.ToUInt16(Data, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } }
public override int SID { get { return BitConverter.ToUInt16(Data, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } }
public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } }
public override int OT_Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
public override int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
public override byte MarkByte { get { return Data[0x16]; } protected set { Data[0x16] = value; } }
public override int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
public override int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } }
public override int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } }
public override int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } }
public override int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } }
public override int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
public override int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } }
public override int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
public override int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
public override int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public override int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
public override int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
public override int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
private byte RIB0 { get { return Data[0x24]; } set { Data[0x24] = value; } } // Sinnoh 1
public bool RIB0_0 { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Sinnoh Champ Ribbon
@ -95,27 +95,27 @@ namespace PKHeX
#endregion
#region Block B
public int Move1 { get { return BitConverter.ToUInt16(Data, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } }
public int Move2 { get { return BitConverter.ToUInt16(Data, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } }
public int Move3 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
public int Move4 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } }
public int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } }
public int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } }
public int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } }
public int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } }
public int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
public int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } }
public int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } }
public int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } }
public override int Move1 { get { return BitConverter.ToUInt16(Data, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } }
public override int Move2 { get { return BitConverter.ToUInt16(Data, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } }
public override int Move3 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } }
public override int Move4 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } }
public override int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } }
public override int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } }
public override int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } }
public override int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } }
public override int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } }
public override int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } }
public override int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } }
public override int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } }
private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x38); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x38); } }
public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } }
public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } }
private byte RIB4 { get { return Data[0x3C]; } set { Data[0x3C] = value; } } // Hoenn 1a
public bool RIB4_0 { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Cool Ribbon
@ -154,21 +154,21 @@ namespace PKHeX
public bool RIB7_6 { get { return (RIB7 & (1 << 6)) == 1 << 6; } set { RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Earth Ribbon
public bool RIB7_7 { get { return (RIB7 & (1 << 7)) == 1 << 7; } set { RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // World Ribbon
public bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } }
public int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } }
public int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } }
public int Nature { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } }
public override bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } }
public override int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } }
public override int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } }
public override int Nature { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } }
public bool HiddenAbility { get { return (Data[0x41] & 1) == 1; } set { Data[0x41] = (byte)(Data[0x41] & ~0x01 | (value ? 1 : 0)); } }
public bool NPokémon { get { return (Data[0x41] & 2) == 2; } set { Data[0x41] = (byte)(Data[0x41] & ~0x02 | (value ? 2 : 0)); } }
// 0x43-0x47 Unused
#endregion
#region Block C
public string Nickname
public override string Nickname
{
get
{
return TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x48, 22))
return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x48, 22))
.Replace("\uE08F", "\u2640") // nidoran
.Replace("\uE08E", "\u2642") // nidoran
.Replace("\u2019", "\u0027"); // farfetch'd
@ -186,7 +186,7 @@ namespace PKHeX
}
}
// 0x5E unused
public int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } }
public override int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } }
private byte RIB8 { get { return Data[0x60]; } set { Data[0x60] = value; } } // Sinnoh 3
public bool RIB8_0 { get { return (RIB8 & (1 << 0)) == 1 << 0; } set { RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Cool Ribbon
public bool RIB8_1 { get { return (RIB8 & (1 << 1)) == 1 << 1; } set { RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Cool Ribbon Great
@ -227,11 +227,11 @@ namespace PKHeX
#endregion
#region Block D
public string OT_Name
public override string OT_Name
{
get
{
return TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x68, 16))
return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x68, 16))
.Replace("\uE08F", "\u2640") // Nidoran ♂
.Replace("\uE08E", "\u2642") // Nidoran ♀
.Replace("\u2019", "\u0027"); // farfetch'd
@ -248,60 +248,37 @@ namespace PKHeX
Encoding.Unicode.GetBytes(TempNick).CopyTo(Data, 0x68);
}
}
public int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } }
public int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } }
public int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } }
public int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } }
public int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } }
public int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } }
public int Egg_Location { get { return BitConverter.ToUInt16(Data, 0x7E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } }
public int Met_Location { get { return BitConverter.ToUInt16(Data, 0x80); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } }
public override int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } }
public override int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } }
public override int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } }
public override int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } }
public override int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } }
public override int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } }
public override int Egg_Location { get { return BitConverter.ToUInt16(Data, 0x7E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } }
public override int Met_Location { get { return BitConverter.ToUInt16(Data, 0x80); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } }
private byte PKRS { get { return Data[0x82]; } set { Data[0x82] = value; } }
public int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } }
public int Ball { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } }
public int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } }
public int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } }
public int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } }
public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } }
public override int Ball { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } }
public override int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } }
public override int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } }
public override int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } }
// 0x86-0x87 Unused
#endregion
// Simple Generated Attributes
public int[] IVs
{
get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; }
set
{
if (value == null || value.Length != 6) return;
IV_HP = value[0]; IV_ATK = value[1]; IV_DEF = value[2];
IV_SPE = value[3]; IV_SPA = value[4]; IV_SPD = value[5];
}
}
public int[] EVs => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD };
public int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3);
public int TSV => (TID ^ SID) >> 3;
public bool IsShiny => TSV == PSV;
public bool PKRS_Infected => PKRS_Strain > 0;
public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0;
public bool Gen5 => Version >= 20 && Version <= 23;
public bool Gen4 => Version >= 10 && Version < 12 || Version >= 7 && Version <= 8;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
public bool GenU => !(Gen5 || Gen4 || Gen3);
public override int Stat_Level { get { return Data[0x8C]; } set { Data[0x8C] = (byte)value; } }
public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0x8E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8E); } }
public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0x90); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x90); } }
public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0x92); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x92); } }
public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0x94); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x94); } }
public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0x96); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x96); } }
public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0x98); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x98); } }
public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0x9A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x9A); } }
public int[] Moves {
get { return new[] {Move1, Move2, Move3, Move4}; }
set {
if (value.Length > 0) Move1 = value[0];
if (value.Length > 1) Move2 = value[1];
if (value.Length > 2) Move3 = value[2];
if (value.Length > 3) Move4 = value[3]; } }
// Complex Generated Attributes
public byte[] EncryptedPartyData => Encrypt().Take(SIZE_PARTY).ToArray();
public byte[] EncryptedBoxData => Encrypt().Take(SIZE_STORED).ToArray();
public byte[] DecryptedPartyData => Data.Take(SIZE_PARTY).ToArray();
public byte[] DecryptedBoxData => Data.Take(SIZE_STORED).ToArray();
public int Characteristic
// Generated Attributes
public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3);
public override int TSV => (TID ^ SID) >> 3;
public override int Characteristic
{
get
{
@ -319,40 +296,9 @@ namespace PKHeX
return pm6stat * 5 + maxIV % 5;
}
}
public int PotentialRating
{
get
{
int ivTotal = IVs.Sum();
if (ivTotal <= 90)
return 0;
if (ivTotal <= 120)
return 1;
return ivTotal <= 150 ? 2 : 3;
}
}
public string FileName => $"{Species.ToString("000")}{(IsShiny ? " " : "")} - {Nickname} - {Checksum.ToString("X4")}{PID.ToString("X8")}.pkm";
public bool ChecksumValid => Checksum == CalculateChecksum();
// Methods
public void RefreshChecksum()
{
Checksum = CalculateChecksum();
}
public ushort CalculateChecksum()
{
ushort chk = 0;
for (int i = 8; i < SIZE_STORED; i += 2) // Loop through the entire PK5
chk += BitConverter.ToUInt16(Data, i);
return chk;
}
public byte[] Write()
{
RefreshChecksum();
return Data;
}
public bool getGenderIsValid()
public override bool getGenderIsValid()
{
int gv = PKX.Personal[Species].Gender;
if (gv == 255 && Gender == 2)
@ -367,34 +313,10 @@ namespace PKHeX
return true;
return false;
}
public void FixMoves()
public override byte[] Encrypt()
{
if (Move4 != 0 && Move3 == 0)
{
Move3 = Move4;
Move3_PP = Move4_PP;
Move3_PPUps = Move4_PPUps;
Move4 = Move4_PP = Move4_PPUps = 0;
}
if (Move3 != 0 && Move2 == 0)
{
Move2 = Move3;
Move2_PP = Move3_PP;
Move2_PPUps = Move3_PPUps;
Move3 = Move3_PP = Move3_PPUps = 0;
}
if (Move2 != 0 && Move1 == 0)
{
Move1 = Move2;
Move1_PP = Move2_PP;
Move1_PPUps = Move2_PPUps;
Move2 = Move2_PP = Move2_PPUps = 0;
}
}
public byte[] Encrypt()
{
Checksum = CalculateChecksum();
return encryptArray(Data);
RefreshChecksum();
return PKX.encryptArray45(Data);
}
public PK6 convertToPK6()
@ -581,16 +503,16 @@ namespace PKHeX
pk6.Data[0x34] = (byte)bx34;
// Write Transfer Location - location is dependent on 3DS system that transfers.
pk6.Country = Converter.Country;
pk6.Region = Converter.Region;
pk6.ConsoleRegion = Converter.ConsoleRegion;
pk6.Country = PKMConverter.Country;
pk6.Region = PKMConverter.Region;
pk6.ConsoleRegion = PKMConverter.ConsoleRegion;
// Write the Memories, Friendship, and Origin!
pk6.CurrentHandler = 1;
pk6.HT_Name = Converter.OT_Name;
pk6.HT_Gender = Converter.OT_Gender;
pk6.Geo1_Region = Converter.Region;
pk6.Geo1_Country = Converter.Country;
pk6.HT_Name = PKMConverter.OT_Name;
pk6.HT_Gender = PKMConverter.OT_Gender;
pk6.Geo1_Region = PKMConverter.Region;
pk6.Geo1_Country = PKMConverter.Country;
pk6.HT_Intensity = 1;
pk6.HT_Memory = 4;
pk6.HT_Feeling = (int)(Util.rnd32() % 10);

View file

@ -1,104 +1,99 @@
using System;
using System.Drawing;
using System.Linq;
using System.Text;
namespace PKHeX
{
public class PK6 : PKX
public class PK6 : PKM
{
internal const int SIZE_PARTY = 0x104;
internal const int SIZE_STORED = 0xE8;
internal static readonly byte[] ExtraBytes =
{
0x36, 0x37, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x58, 0x59, 0x73, 0x90, 0x91, 0x9E, 0x9F, 0xA0, 0xA1, 0xA7, 0xAA, 0xAB, 0xAC, 0xAD, 0xC8, 0xC9, 0xD7, 0xE4, 0xE5, 0xE6, 0xE7
};
public override int SIZE_PARTY => PKX.SIZE_6PARTY;
public override int SIZE_STORED => PKX.SIZE_6STORED;
public override int Format => 6;
public PK6(byte[] decryptedData = null, string ident = null)
{
Data = (byte[])(decryptedData ?? new byte[SIZE_PARTY]).Clone();
PKMConverter.checkEncrypted(ref Data);
Identifier = ident;
if (Data.Length != SIZE_PARTY)
Array.Resize(ref Data, SIZE_PARTY);
}
// Internal Attributes set on creation
public byte[] Data; // Raw Storage
public string Identifier; // User or Form Custom Attribute
public override PKM Clone() { return new PK6(Data); }
// Structure
#region Block A
public uint EncryptionConstant
public override uint EncryptionConstant
{
get { return BitConverter.ToUInt32(Data, 0x00); }
set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); }
}
public ushort Sanity
public override ushort Sanity
{
get { return BitConverter.ToUInt16(Data, 0x04); }
set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } // Should always be zero...
}
public ushort Checksum
public override ushort Checksum
{
get { return BitConverter.ToUInt16(Data, 0x06); }
set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); }
}
public int Species
public override int Species
{
get { return BitConverter.ToUInt16(Data, 0x08); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); }
}
public int HeldItem
public override int HeldItem
{
get { return BitConverter.ToUInt16(Data, 0x0A); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); }
}
public int TID
public override int TID
{
get { return BitConverter.ToUInt16(Data, 0x0C); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); }
}
public int SID
public override int SID
{
get { return BitConverter.ToUInt16(Data, 0x0E); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); }
}
public uint EXP
public override uint EXP
{
get { return BitConverter.ToUInt32(Data, 0x10); }
set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); }
}
public int Ability { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
public override int Ability { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
public int AbilityNumber { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
public int TrainingBagHits { get { return Data[0x16]; } set { Data[0x16] = (byte)value; } }
public int TrainingBag { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
public uint PID
public int TrainingBag { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } }
public override uint PID
{
get { return BitConverter.ToUInt32(Data, 0x18); }
set { BitConverter.GetBytes(value).CopyTo(Data, 0x18); }
}
public int Nature { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
public bool FatefulEncounter { get { return (Data[0x1D] & 1) == 1; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } }
public int Gender { get { return (Data[0x1D] >> 1) & 0x3; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x06 | (value << 1)); } }
public int AltForm { get { return Data[0x1D] >> 3; } set { Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } }
public int EV_HP { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
public int EV_ATK { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
public int EV_DEF { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public int EV_SPE { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
public int EV_SPA { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
public int EV_SPD { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
public int CNT_Cool { get { return Data[0x24]; } set { Data[0x24] = (byte)value; } }
public int CNT_Beauty { get { return Data[0x25]; } set { Data[0x25] = (byte)value; } }
public int CNT_Cute { get { return Data[0x26]; } set { Data[0x26] = (byte)value; } }
public int CNT_Smart { get { return Data[0x27]; } set { Data[0x27] = (byte)value; } }
public int CNT_Tough { get { return Data[0x28]; } set { Data[0x28] = (byte)value; } }
public int CNT_Sheen { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } }
public byte Markings { get { return Data[0x2A]; } set { Data[0x2A] = value; } }
public bool Circle { get { return (Markings & (1 << 0)) == 1 << 0; } set { Markings = (byte)(Markings & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public bool Triangle { get { return (Markings & (1 << 1)) == 1 << 1; } set { Markings = (byte)(Markings & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
public bool Square { get { return (Markings & (1 << 2)) == 1 << 2; } set { Markings = (byte)(Markings & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
public bool Heart { get { return (Markings & (1 << 3)) == 1 << 3; } set { Markings = (byte)(Markings & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
public bool Star { get { return (Markings & (1 << 4)) == 1 << 4; } set { Markings = (byte)(Markings & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
public bool Diamond { get { return (Markings & (1 << 5)) == 1 << 5; } set { Markings = (byte)(Markings & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
public override int Nature { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } }
public override bool FatefulEncounter { get { return (Data[0x1D] & 1) == 1; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } }
public override int Gender { get { return (Data[0x1D] >> 1) & 0x3; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x06 | (value << 1)); } }
public override int AltForm { get { return Data[0x1D] >> 3; } set { Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } }
public override int EV_HP { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } }
public override int EV_ATK { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } }
public override int EV_DEF { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
public override int EV_SPE { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
public override int EV_SPA { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } }
public override int EV_SPD { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } }
public override int CNT_Cool { get { return Data[0x24]; } set { Data[0x24] = (byte)value; } }
public override int CNT_Beauty { get { return Data[0x25]; } set { Data[0x25] = (byte)value; } }
public override int CNT_Cute { get { return Data[0x26]; } set { Data[0x26] = (byte)value; } }
public override int CNT_Smart { get { return Data[0x27]; } set { Data[0x27] = (byte)value; } }
public override int CNT_Tough { get { return Data[0x28]; } set { Data[0x28] = (byte)value; } }
public override int CNT_Sheen { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } }
public override byte MarkByte { get { return Data[0x2A]; } protected set { Data[0x2A] = value; } }
private byte PKRS { get { return Data[0x2B]; } set { Data[0x2B] = value; } }
public int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } }
public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } }
public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } }
private byte ST1 { get { return Data[0x2C]; } set { Data[0x2C] = value; } }
public bool Unused0 { get { return (ST1 & (1 << 0)) == 1 << 0; } set { ST1 = (byte)(ST1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public bool Unused1 { get { return (ST1 & (1 << 1)) == 1 << 1; } set { ST1 = (byte)(ST1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
@ -209,7 +204,7 @@ namespace PKHeX
public byte _0x3F { get { return Data[0x3F]; } set { Data[0x3F] = value; } }
#endregion
#region Block B
public string Nickname
public override string Nickname
{
get
{
@ -230,50 +225,50 @@ namespace PKHeX
Encoding.Unicode.GetBytes(TempNick).CopyTo(Data, 0x40);
}
}
public int Move1
public override int Move1
{
get { return BitConverter.ToUInt16(Data, 0x5A); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); }
}
public int Move2
public override int Move2
{
get { return BitConverter.ToUInt16(Data, 0x5C); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); }
}
public int Move3
public override int Move3
{
get { return BitConverter.ToUInt16(Data, 0x5E); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); }
}
public int Move4
public override int Move4
{
get { return BitConverter.ToUInt16(Data, 0x60); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); }
}
public int Move1_PP { get { return Data[0x62]; } set { Data[0x62] = (byte)value; } }
public int Move2_PP { get { return Data[0x63]; } set { Data[0x63] = (byte)value; } }
public int Move3_PP { get { return Data[0x64]; } set { Data[0x64] = (byte)value; } }
public int Move4_PP { get { return Data[0x65]; } set { Data[0x65] = (byte)value; } }
public int Move1_PPUps { get { return Data[0x66]; } set { Data[0x66] = (byte)value; } }
public int Move2_PPUps { get { return Data[0x67]; } set { Data[0x67] = (byte)value; } }
public int Move3_PPUps { get { return Data[0x68]; } set { Data[0x68] = (byte)value; } }
public int Move4_PPUps { get { return Data[0x69]; } set { Data[0x69] = (byte)value; } }
public int RelearnMove1
public override int Move1_PP { get { return Data[0x62]; } set { Data[0x62] = (byte)value; } }
public override int Move2_PP { get { return Data[0x63]; } set { Data[0x63] = (byte)value; } }
public override int Move3_PP { get { return Data[0x64]; } set { Data[0x64] = (byte)value; } }
public override int Move4_PP { get { return Data[0x65]; } set { Data[0x65] = (byte)value; } }
public override int Move1_PPUps { get { return Data[0x66]; } set { Data[0x66] = (byte)value; } }
public override int Move2_PPUps { get { return Data[0x67]; } set { Data[0x67] = (byte)value; } }
public override int Move3_PPUps { get { return Data[0x68]; } set { Data[0x68] = (byte)value; } }
public override int Move4_PPUps { get { return Data[0x69]; } set { Data[0x69] = (byte)value; } }
public override int RelearnMove1
{
get { return BitConverter.ToUInt16(Data, 0x6A); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); }
}
public int RelearnMove2
public override int RelearnMove2
{
get { return BitConverter.ToUInt16(Data, 0x6C); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6C); }
}
public int RelearnMove3
public override int RelearnMove3
{
get { return BitConverter.ToUInt16(Data, 0x6E); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6E); }
}
public int RelearnMove4
public override int RelearnMove4
{
get { return BitConverter.ToUInt16(Data, 0x70); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); }
@ -281,14 +276,14 @@ namespace PKHeX
public bool SecretSuperTraining { get { return Data[0x72] == 1; } set { Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); } }
public byte _0x73 { get { return Data[0x73]; } set { Data[0x73] = value; } }
private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x74); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x74); } }
public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } }
public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } }
public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } }
public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } }
public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } }
public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } }
public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } }
public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } }
public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } }
#endregion
#region Block C
public string HT_Name
@ -313,7 +308,7 @@ namespace PKHeX
}
}
public int HT_Gender { get { return Data[0x92]; } set { Data[0x92] = (byte)value; } }
public int CurrentHandler { get { return Data[0x93]; } set { Data[0x93] = (byte)value; } }
public override int CurrentHandler { get { return Data[0x93]; } set { Data[0x93] = (byte)value; } }
public int Geo1_Region { get { return Data[0x94]; } set { Data[0x94] = (byte)value; } }
public int Geo1_Country { get { return Data[0x95]; } set { Data[0x95] = (byte)value; } }
public int Geo2_Region { get { return Data[0x96]; } set { Data[0x96] = (byte)value; } }
@ -343,7 +338,7 @@ namespace PKHeX
public byte Enjoyment { get { return Data[0xAF]; } set { Data[0xAF] = value; } }
#endregion
#region Block D
public string OT_Name
public override string OT_Name
{
get
{
@ -364,44 +359,44 @@ namespace PKHeX
Encoding.Unicode.GetBytes(TempNick).CopyTo(Data, 0xB0);
}
}
public int OT_Friendship { get { return Data[0xCA]; } set { Data[0xCA] = (byte)value; } }
public int OT_Affection { get { return Data[0xCB]; } set { Data[0xCB] = (byte)value; } }
public override int OT_Friendship { get { return Data[0xCA]; } set { Data[0xCA] = (byte)value; } }
public override int OT_Affection { get { return Data[0xCB]; } set { Data[0xCB] = (byte)value; } }
public int OT_Intensity { get { return Data[0xCC]; } set { Data[0xCC] = (byte)value; } }
public int OT_Memory { get { return Data[0xCD]; } set { Data[0xCD] = (byte)value; } }
public int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0xCE); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xCE); } }
public int OT_Feeling { get { return Data[0xD0]; } set { Data[0xD0] = (byte)value; } }
public int Egg_Year { get { return Data[0xD1]; } set { Data[0xD1] = (byte)value; } }
public int Egg_Month { get { return Data[0xD2]; } set { Data[0xD2] = (byte)value; } }
public int Egg_Day { get { return Data[0xD3]; } set { Data[0xD3] = (byte)value; } }
public int Met_Year { get { return Data[0xD4]; } set { Data[0xD4] = (byte)value; } }
public int Met_Month { get { return Data[0xD5]; } set { Data[0xD5] = (byte)value; } }
public int Met_Day { get { return Data[0xD6]; } set { Data[0xD6] = (byte)value; } }
public override int Egg_Year { get { return Data[0xD1]; } set { Data[0xD1] = (byte)value; } }
public override int Egg_Month { get { return Data[0xD2]; } set { Data[0xD2] = (byte)value; } }
public override int Egg_Day { get { return Data[0xD3]; } set { Data[0xD3] = (byte)value; } }
public override int Met_Year { get { return Data[0xD4]; } set { Data[0xD4] = (byte)value; } }
public override int Met_Month { get { return Data[0xD5]; } set { Data[0xD5] = (byte)value; } }
public override int Met_Day { get { return Data[0xD6]; } set { Data[0xD6] = (byte)value; } }
public byte _0xD7 { get { return Data[0xD7]; } set { Data[0xD7] = value; } }
public int Egg_Location { get { return BitConverter.ToUInt16(Data, 0xD8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } }
public int Met_Location { get { return BitConverter.ToUInt16(Data, 0xDA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } }
public int Ball { get { return Data[0xDC]; } set { Data[0xDC] = (byte)value; } }
public int Met_Level { get { return Data[0xDD] & ~0x80; } set { Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } }
public int OT_Gender { get { return Data[0xDD] >> 7; } set { Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } }
public int EncounterType { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } }
public int Version { get { return Data[0xDF]; } set { Data[0xDF] = (byte)value; } }
public override int Egg_Location { get { return BitConverter.ToUInt16(Data, 0xD8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } }
public override int Met_Location { get { return BitConverter.ToUInt16(Data, 0xDA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } }
public override int Ball { get { return Data[0xDC]; } set { Data[0xDC] = (byte)value; } }
public override int Met_Level { get { return Data[0xDD] & ~0x80; } set { Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } }
public override int OT_Gender { get { return Data[0xDD] >> 7; } set { Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } }
public override int EncounterType { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } }
public override int Version { get { return Data[0xDF]; } set { Data[0xDF] = (byte)value; } }
public int Country { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } }
public int Region { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } }
public int ConsoleRegion { get { return Data[0xE2]; } set { Data[0xE2] = (byte)value; } }
public int Language { get { return Data[0xE3]; } set { Data[0xE3] = (byte)value; } }
public override int Language { get { return Data[0xE3]; } set { Data[0xE3] = (byte)value; } }
#endregion
#region Battle Stats
public int Stat_Level { get { return Data[0xEC]; } set { Data[0xEC] = (byte)value; } }
public int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0xF0); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF0); } }
public int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0xF2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF2); } }
public int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0xF4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF4); } }
public int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0xF6); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF6); } }
public int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0xF8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF8); } }
public int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0xFA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFA); } }
public int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0xFC); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFC); } }
public override int Stat_Level { get { return Data[0xEC]; } set { Data[0xEC] = (byte)value; } }
public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0xF0); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF0); } }
public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0xF2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF2); } }
public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0xF4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF4); } }
public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0xF6); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF6); } }
public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0xF8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF8); } }
public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0xFA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFA); } }
public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0xFC); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFC); } }
#endregion
// Simple Generated Attributes
public int CurrentFriendship {
public override int CurrentFriendship {
get { return CurrentHandler == 0 ? OT_Friendship : HT_Friendship; }
set { if (CurrentHandler == 0) OT_Friendship = value; else HT_Friendship = value; }
}
@ -410,41 +405,12 @@ namespace PKHeX
get { return CurrentHandler == 1 ? OT_Friendship : HT_Friendship; }
set { if (CurrentHandler == 1) OT_Friendship = value; else HT_Friendship = value; }
}
public int[] IVs {
get { return new[] {IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD}; }
set { if (value == null || value.Length != 6) return;
IV_HP = value[0]; IV_ATK = value[1]; IV_DEF = value[2];
IV_SPE = value[3]; IV_SPA = value[4]; IV_SPD = value[5]; } }
public int[] EVs => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD };
public int[] CNTs => new[] { CNT_Cool, CNT_Beauty, CNT_Cute, CNT_Smart, CNT_Tough, CNT_Sheen };
public int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 4);
public int TSV => (TID ^ SID) >> 4;
public bool IsShiny => TSV == PSV;
public bool PKRS_Infected => PKRS_Strain > 0;
public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0;
public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 4);
public override int TSV => (TID ^ SID) >> 4;
public bool IsUntraded => string.IsNullOrWhiteSpace(HT_Name);
public bool IsUntradedEvent6 => Geo1_Country == 0 && Geo1_Region == 0 && Met_Location / 10000 == 4 && Gen6;
public bool Gen6 => Version >= 24 && Version <= 29;
public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y;
public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR;
public bool SM => Version == (int)GameVersion.SN || Version == (int)GameVersion.MN;
public bool Gen5 => Version >= 20 && Version <= 23;
public bool Gen4 => Version >= 7 && Version <= 12 && Version != 9;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
public bool GenU => !(Gen6 || Gen5 || Gen4 || Gen3);
public int[] Moves
{
get { return new[] { Move1, Move2, Move3, Move4 }; }
set
{
if (value.Length > 0) Move1 = value[0];
if (value.Length > 1) Move2 = value[1];
if (value.Length > 2) Move3 = value[2];
if (value.Length > 3) Move4 = value[3];
}
}
public int[] RelearnMoves
{
get { return new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; }
@ -456,31 +422,10 @@ namespace PKHeX
if (value.Length > 3) RelearnMove4 = value[3];
}
}
public int CurrentLevel => getLevel(Species, EXP);
// Complex Generated Attributes
public Image Sprite => getSprite(this);
public string ShowdownText => getShowdownText(this);
public string[] QRText => getQRText(this);
public byte[] EncryptedPartyData => Encrypt().Take(SIZE_PARTY).ToArray();
public byte[] EncryptedBoxData => Encrypt().Take(SIZE_STORED).ToArray();
public byte[] DecryptedPartyData => Data.Take(SIZE_PARTY).ToArray();
public byte[] DecryptedBoxData => Data.Take(SIZE_STORED).ToArray();
public int HPType
{
get { return 15 * ((IV_HP & 1) + 2 * (IV_ATK & 1) + 4 * (IV_DEF & 1) + 8 * (IV_SPE & 1) + 16 * (IV_SPA & 1) + 32 * (IV_SPD & 1)) / 63; }
set
{
IV_HP = (IV_HP & ~1) + hpivs[value, 0];
IV_ATK = (IV_ATK & ~1) + hpivs[value, 1];
IV_DEF = (IV_DEF & ~1) + hpivs[value, 2];
IV_SPE = (IV_SPE & ~1) + hpivs[value, 3];
IV_SPA = (IV_SPA & ~1) + hpivs[value, 4];
IV_SPD = (IV_SPD & ~1) + hpivs[value, 5];
}
}
public int Characteristic
public override int Characteristic
{
get
{
@ -495,86 +440,27 @@ namespace PKHeX
return pm6stat*5 + maxIV%5;
}
}
public int PotentialRating
{
get
{
int ivTotal = IVs.Sum();
if (ivTotal <= 90)
return 0;
if (ivTotal <= 120)
return 1;
return ivTotal <= 150 ? 2 : 3;
}
}
public string FileName => getFileName(this);
public bool ChecksumValid => Checksum == CalculateChecksum();
// Methods
public void RefreshChecksum()
public override byte[] Encrypt()
{
Checksum = CalculateChecksum();
return PKX.encryptArray(Data);
}
public ushort CalculateChecksum()
public override bool getGenderIsValid()
{
ushort chk = 0;
for (int i = 8; i < SIZE_STORED; i += 2) // Loop through the entire PK6
chk += BitConverter.ToUInt16(Data, i);
int gv = PKX.Personal[Species].Gender;
return chk;
}
public byte[] Write()
{
RefreshChecksum();
return Data;
}
public byte[] Encrypt()
{
Checksum = CalculateChecksum();
return encryptArray(Data);
}
public void CalculateStats()
{
ushort[] Stats = getStats(this);
Stat_HPMax = Stat_HPCurrent = Stats[0];
Stat_ATK = Stats[1];
Stat_DEF = Stats[2];
Stat_SPE = Stats[3];
Stat_SPA = Stats[4];
Stat_SPD = Stats[5];
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
return true;
}
// General User-error Fixes
public void FixMoves()
{
while (true)
{
if (Move4 != 0 && Move3 == 0)
{
Move3 = Move4;
Move3_PP = Move4_PP;
Move3_PPUps = Move4_PPUps;
Move4 = Move4_PP = Move4_PPUps = 0;
}
if (Move3 != 0 && Move2 == 0)
{
Move2 = Move3;
Move2_PP = Move3_PP;
Move2_PPUps = Move3_PPUps;
Move3 = Move3_PP = Move3_PPUps = 0;
continue;
}
if (Move2 != 0 && Move1 == 0)
{
Move1 = Move2;
Move1_PP = Move2_PP;
Move1_PPUps = Move2_PPUps;
Move2 = Move2_PP = Move2_PPUps = 0;
continue;
}
break;
}
}
public void FixRelearn()
{
while (true)
@ -743,7 +629,7 @@ namespace PKHeX
return;
// Reset
HT_Friendship = getBaseFriendship(Species);
HT_Friendship = PKX.getBaseFriendship(Species);
HT_Affection = 0;
}

278
PKM/PKM.cs Normal file
View file

@ -0,0 +1,278 @@
using System;
using System.Drawing;
using System.Linq;
namespace PKHeX
{
public abstract class PKM
{
public abstract int SIZE_PARTY { get; }
public abstract int SIZE_STORED { get; }
public string Extension => "pk" + Format;
// Internal Attributes set on creation
public byte[] Data; // Raw Storage
public string Identifier; // User or Form Custom Attribute
public byte[] EncryptedPartyData => Encrypt().Take(SIZE_PARTY).ToArray();
public byte[] EncryptedBoxData => Encrypt().Take(SIZE_STORED).ToArray();
public byte[] DecryptedPartyData => Write().Take(SIZE_PARTY).ToArray();
public byte[] DecryptedBoxData => Write().Take(SIZE_STORED).ToArray();
public ushort CalculateChecksum()
{
ushort chk = 0;
for (int i = 8; i < SIZE_STORED; i += 2) // Loop through the entire PK5
chk += BitConverter.ToUInt16(Data, i);
return chk;
}
public abstract byte[] Encrypt();
public abstract int Format { get; }
public byte[] Write()
{
RefreshChecksum();
return Data;
}
// Surface Properties
public abstract int Species { get; set; }
public abstract string Nickname { get; set; }
public abstract int HeldItem { get; set; }
public abstract int Gender { get; set; }
public abstract int Nature { get; set; }
public abstract int Ability { get; set; }
public abstract int CurrentFriendship { get; set; }
public abstract int AltForm { get; set; }
public abstract bool IsEgg { get; set; }
public abstract bool IsNicknamed { get; set; }
public abstract uint EXP { get; set; }
public abstract int TID { get; set; }
public abstract string OT_Name { get; set; }
public abstract int OT_Gender { get; set; }
public abstract int Ball { get; set; }
public abstract int Met_Level { get; set; }
// Battle
public abstract int Move1 { get; set; }
public abstract int Move2 { get; set; }
public abstract int Move3 { get; set; }
public abstract int Move4 { get; set; }
public abstract int Move1_PP { get; set; }
public abstract int Move2_PP { get; set; }
public abstract int Move3_PP { get; set; }
public abstract int Move4_PP { get; set; }
public abstract int Move1_PPUps { get; set; }
public abstract int Move2_PPUps { get; set; }
public abstract int Move3_PPUps { get; set; }
public abstract int Move4_PPUps { get; set; }
public abstract int EV_HP { get; set; }
public abstract int EV_ATK { get; set; }
public abstract int EV_DEF { get; set; }
public abstract int EV_SPE { get; set; }
public abstract int EV_SPA { get; set; }
public abstract int EV_SPD { get; set; }
public abstract int IV_HP { get; set; }
public abstract int IV_ATK { get; set; }
public abstract int IV_DEF { get; set; }
public abstract int IV_SPE { get; set; }
public abstract int IV_SPA { get; set; }
public abstract int IV_SPD { get; set; }
public abstract int Stat_Level { get; set; }
public abstract int Stat_HPMax { get; set; }
public abstract int Stat_HPCurrent { get; set; }
public abstract int Stat_ATK { get; set; }
public abstract int Stat_DEF { get; set; }
public abstract int Stat_SPE { get; set; }
public abstract int Stat_SPA { get; set; }
public abstract int Stat_SPD { get; set; }
// Hidden Properties
public abstract int Version { get; set; }
public abstract int SID { get; set; }
public abstract int PKRS_Strain { get; set; }
public abstract int PKRS_Days { get; set; }
public abstract int CNT_Cool { get; set; }
public abstract int CNT_Beauty { get; set; }
public abstract int CNT_Cute { get; set; }
public abstract int CNT_Smart { get; set; }
public abstract int CNT_Tough { get; set; }
public abstract int CNT_Sheen { get; set; }
public abstract uint EncryptionConstant { get; set; }
public abstract uint PID { get; set; }
public abstract ushort Sanity { get; set; }
public abstract ushort Checksum { get; set; }
// Misc Properties
public abstract int Language { get; set; }
public abstract bool FatefulEncounter { get; set; }
public abstract int TSV { get; }
public abstract int PSV { get; }
public abstract int Characteristic { get; }
public abstract byte MarkByte { get; protected set; }
public abstract int Met_Location { get; set; }
public abstract int Egg_Location { get; set; }
public abstract int OT_Friendship { get; set; }
// Future Properties
public virtual int Met_Year { get { return 0; } set { } }
public virtual int Met_Month { get { return 0; } set { } }
public virtual int Met_Day { get { return 0; } set { } }
public virtual int Egg_Year { get { return 0; } set { } }
public virtual int Egg_Month { get { return 0; } set { } }
public virtual int Egg_Day { get { return 0; } set { } }
public virtual int OT_Affection { get { return 0; } set { } }
public virtual int RelearnMove1 { get { return 0; } set { } }
public virtual int RelearnMove2 { get { return 0; } set { } }
public virtual int RelearnMove3 { get { return 0; } set { } }
public virtual int RelearnMove4 { get { return 0; } set { } }
public virtual int EncounterType { get { return 0; } set { } }
// Exposed but not Present in all
public abstract int CurrentHandler { get; set; }
// Derived
public bool IsShiny => TSV == PSV;
public bool Gen6 => Version >= 24 && Version <= 29;
public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y;
public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR;
public bool SM => Version == (int)GameVersion.SN || Version == (int)GameVersion.MN;
public bool PtHGSS => new[] {GameVersion.Pt, GameVersion.HG, GameVersion.SS}.Contains((GameVersion)Version);
public bool Gen5 => Version >= 20 && Version <= 23;
public bool Gen4 => Version >= 10 && Version < 12 || Version >= 7 && Version <= 8;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
public bool GenU => !(Gen6 || Gen5 || Gen4 || Gen3);
public bool PKRS_Infected => PKRS_Strain > 0;
public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0;
public bool ChecksumValid => Checksum == CalculateChecksum();
public int CurrentLevel => PKX.getLevel(Species, EXP);
public bool Circle { get { return Markings[0]; } set { Markings[0] = value; } }
public bool Triangle { get { return Markings[1]; } set { Markings[1] = value; } }
public bool Square { get { return Markings[2]; } set { Markings[2] = value; } }
public bool Heart { get { return Markings[3]; } set { Markings[3] = value; } }
public bool Star { get { return Markings[4]; } set { Markings[4] = value; } }
public bool Diamond { get { return Markings[5]; } set { Markings[5] = value; } }
public Image Sprite => PKX.getSprite(this);
public string ShowdownText => ShowdownSet.getShowdownText(this);
public string[] QRText => PKX.getQRText(this);
public string FileName => PKX.getFileName(this);
public int[] IVs
{
get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; }
set
{
if (value?.Length != 6) return;
IV_HP = value[0]; IV_ATK = value[1]; IV_DEF = value[2];
IV_SPE = value[3]; IV_SPA = value[4]; IV_SPD = value[5];
}
}
public int[] EVs
{
get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; }
set
{
if (value?.Length != 6) return;
EV_HP = value[0]; EV_ATK = value[1]; EV_DEF = value[2];
EV_SPE = value[3]; EV_SPA = value[4]; EV_SPD = value[5];
}
}
public int[] Moves
{
get { return new[] { Move1, Move2, Move3, Move4 }; }
set { if (value?.Length != 4) return; Move1 = value[0]; Move2 = value[1]; Move3 = value[2]; Move4 = value[3]; }
}
public bool[] Markings
{
get
{
bool[] mark = new bool[8];
for (int i = 0; i < 8; i++)
mark[i] = ((MarkByte >> i) & 1) == 1;
return mark;
}
set
{
if (value.Length > 8)
return;
byte b = 0;
for (int i = 0; i < value.Length; i++)
b |= (byte)(value[i] ? 1 << i : 0);
MarkByte = b;
}
}
public int[] CNTs
{
get { return new[] { CNT_Cool, CNT_Beauty, CNT_Cute, CNT_Smart, CNT_Tough, CNT_Sheen }; }
set { if (value?.Length != 6) return; CNT_Cool = value[0]; CNT_Beauty = value[1]; CNT_Cute = value[2]; CNT_Smart = value[3]; CNT_Tough = value[4]; CNT_Sheen = value[5]; }
}
public int HPType
{
get { return 15 * ((IV_HP & 1) + 2 * (IV_ATK & 1) + 4 * (IV_DEF & 1) + 8 * (IV_SPE & 1) + 16 * (IV_SPA & 1) + 32 * (IV_SPD & 1)) / 63; }
set
{
IV_HP = (IV_HP & ~1) + PKX.hpivs[value, 0];
IV_ATK = (IV_ATK & ~1) + PKX.hpivs[value, 1];
IV_DEF = (IV_DEF & ~1) + PKX.hpivs[value, 2];
IV_SPE = (IV_SPE & ~1) + PKX.hpivs[value, 3];
IV_SPA = (IV_SPA & ~1) + PKX.hpivs[value, 4];
IV_SPD = (IV_SPD & ~1) + PKX.hpivs[value, 5];
}
}
// Methods
public abstract bool getGenderIsValid();
public void RefreshChecksum() { Checksum = CalculateChecksum(); }
public void FixMoves()
{
if (Move4 != 0 && Move3 == 0)
{
Move3 = Move4;
Move3_PP = Move4_PP;
Move3_PPUps = Move4_PPUps;
Move4 = Move4_PP = Move4_PPUps = 0;
}
if (Move3 != 0 && Move2 == 0)
{
Move2 = Move3;
Move2_PP = Move3_PP;
Move2_PPUps = Move3_PPUps;
Move3 = Move3_PP = Move3_PPUps = 0;
}
if (Move2 != 0 && Move1 == 0)
{
Move1 = Move2;
Move1_PP = Move2_PP;
Move1_PPUps = Move2_PPUps;
Move2 = Move2_PP = Move2_PPUps = 0;
}
}
public int PotentialRating
{
get
{
int ivTotal = IVs.Sum();
if (ivTotal <= 90)
return 0;
if (ivTotal <= 120)
return 1;
return ivTotal <= 150 ? 2 : 3;
}
}
public void CalculateStats()
{
ushort[] Stats = PKX.getStats(this);
Stat_HPMax = Stat_HPCurrent = Stats[0];
Stat_ATK = Stats[1];
Stat_DEF = Stats[2];
Stat_SPE = Stats[3];
Stat_SPA = Stats[4];
Stat_SPD = Stats[5];
}
public abstract PKM Clone();
}
}

138
PKM/PKMConverter.cs Normal file
View file

@ -0,0 +1,138 @@
using System;
namespace PKHeX
{
internal static class PKMConverter
{
internal static int Country = 31;
internal static int Region = 7;
internal static int ConsoleRegion = 1;
internal static string OT_Name = "PKHeX";
internal static int OT_Gender;
internal static void updateConfig(int SUBREGION, int COUNTRY, int _3DSREGION, string TRAINERNAME, int TRAINERGENDER)
{
Region = SUBREGION;
Country = COUNTRY;
ConsoleRegion = _3DSREGION;
OT_Name = TRAINERNAME;
OT_Gender = TRAINERGENDER;
}
private static int getPKMDataFormat(byte[] data)
{
if (!PKX.getIsPKM(data.Length))
return -1;
switch (data.Length)
{
case PKX.SIZE_3PARTY:
case PKX.SIZE_3STORED:
return 3;
case PKX.SIZE_4PARTY:
case PKX.SIZE_4STORED:
case PKX.SIZE_5PARTY:
if ((BitConverter.ToUInt16(data, 0x80) >= 0x3333 || data[0x5F] >= 0x10) && BitConverter.ToUInt16(data, 0x46) == 0) // PK5
return 5;
return 4;
case PKX.SIZE_6STORED:
return 6;
case PKX.SIZE_6PARTY: // collision with PGT, same size.
if (BitConverter.ToUInt16(data, 0x4) != 0) // Bad Sanity?
return -1;
if (BitConverter.ToUInt16(data, 0x58) != 0) // Encrypted?
{
PKX.getCHK(data);
for (int i = data.Length - 0x10; i < data.Length; i++) // 0x10 of 00's at the end != PK6
if (data[i] != 0)
break;
return 6;
}
return -1;
}
return -1;
}
internal static PKM getPKMfromBytes(byte[] data)
{
checkEncrypted(ref data);
switch (getPKMDataFormat(data))
{
case 3:
return new PK3(data);
case 4:
return new PK4(data);
case 5:
return new PK5(data);
case 6:
return new PK6(data);
default:
return null;
}
}
internal static PKM convertToFormat(PKM pk, int Format, out string comment)
{
if (pk == null)
{
comment = "Null input. Aborting.";
return null;
}
if (pk.Format == Format)
{
comment = "No need to convert, current format matches requested format.";
return pk;
}
if (pk.Format > Format)
{
comment = "Cannot convert a PKM backwards." + Environment.NewLine
+ "Current Format: " + pk.Format + Environment.NewLine
+ "Desired Format: " + Format;
return null;
}
string currentFormat = pk.Format.ToString();
PKM pkm = pk.Clone();
if (pkm.IsEgg) // force hatch
{
pkm.IsEgg = false;
if (pkm.AO)
pkm.Met_Location = 318; // Battle Resort
else if (pkm.XY)
pkm.Met_Location = 38; // Route 7
else if (pkm.Gen5)
pkm.Met_Location = 16; // Route 16
else
pkm.Met_Location = 30001; // Pokétransfer
}
if (pkm.Format == 3 && Format > 3)
pkm = (pkm as PK3).convertToPK4();
if (pkm.Format == 4 && Format > 4)
pkm = (pkm as PK4).convertToPK5();
if (pkm.Format == 5 && Format > 5)
pkm = (pkm as PK5).convertToPK6();
comment = $"Converted from pk{currentFormat} to pk{Format}";
return pkm;
}
internal static void checkEncrypted(ref byte[] pkm)
{
int format = getPKMDataFormat(pkm);
ushort chk = 0;
switch (format)
{
case 3: // TOneverDO, nobody exports encrypted pk3s
return;
case 4:
case 5:
for (int i = 8; i < PKX.SIZE_4STORED; i += 2)
chk += BitConverter.ToUInt16(pkm, i);
if (chk != BitConverter.ToUInt16(pkm, 0x06))
pkm = PKX.decryptArray45(pkm);
return;
case 6:
if (BitConverter.ToUInt16(pkm, 0xC8) != 0 && BitConverter.ToUInt16(pkm, 0x58) != 0)
pkm = PKX.decryptArray(pkm);
return;
default:
return; // bad!
}
}
}
}

File diff suppressed because it is too large Load diff

281
PKM/ShowdownSet.cs Normal file
View file

@ -0,0 +1,281 @@
using System;
using System.Linq;
namespace PKHeX
{
public class ShowdownSet
{
// String to Values
internal static readonly string[] StatNames = { "HP", "Atk", "Def", "SpA", "SpD", "Spe" };
public static readonly string[] types = Util.getStringList("types", "en");
public static readonly string[] forms = Util.getStringList("forms", "en");
private static readonly string[] species = Util.getStringList("species", "en");
private static readonly string[] items = Util.getStringList("items", "en");
private static readonly string[] natures = Util.getStringList("natures", "en");
private static readonly string[] moves = Util.getStringList("moves", "en");
private static readonly string[] abilities = Util.getStringList("abilities", "en");
private static readonly string[] hptypes = types.Skip(1).ToArray();
// Default Set Data
public string Nickname;
public int Species;
public string Form;
public string Gender;
public int Item;
public int Ability;
public int Level;
public bool Shiny;
public int Friendship;
public int Nature;
public int[] EVs;
public int[] IVs;
public int[] Moves;
// Parsing Utility
public ShowdownSet(string input = null)
{
if (input == null)
return;
Nickname = null;
Species = -1;
Form = null;
Gender = null;
Item = 0;
Ability = 0;
Level = 100;
Shiny = false;
Friendship = 255;
Nature = 0;
EVs = new int[6];
IVs = new[] { 31, 31, 31, 31, 31, 31 };
Moves = new int[4];
string[] lines = input.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
for (int i = 0; i < lines.Length; i++) lines[i] = lines[i].Replace("'", "").Trim(); // Sanitize apostrophes
if (lines.Length < 3) return;
// Seek for start of set
int start = -1;
for (int i = 0; i < lines.Length; i++)
if (lines[i].Contains(" @ ")) { start = i; break; }
lines = lines.Skip(start).Take(lines.Length - start).ToArray();
// Abort if no text is found
if (start == -1)
{
// Try to parse the first line if it does not have any item
string ld = lines[0];
// Gender Detection
string last3 = ld.Substring(ld.Length - 3);
if (last3 == "(M)" || last3 == "(F)")
{
Gender = last3.Substring(1, 1);
ld = ld.Substring(0, ld.Length - 3);
}
// Nickname Detection
string spec = ld;
if (spec.Contains("("))
{
int index = spec.LastIndexOf("(", StringComparison.Ordinal);
string n1 = spec.Substring(0, index - 1);
string n2 = spec.Substring(index).Replace("(", "").Replace(")", "").Replace(" ", "");
bool inverted = Array.IndexOf(species, n2.Replace(" ", "")) > -1 || (Species = Array.IndexOf(species, n2.Split('-')[0])) > 0;
spec = inverted ? n2 : n1;
Nickname = inverted ? n1 : n2;
}
Species = Array.IndexOf(species, spec.Replace(" ", ""));
if (
(Species = Array.IndexOf(species, spec)) < 0 // Not an Edge Case
&&
(Species = Array.IndexOf(species, spec.Replace(" ", ""))) < 0 // Has Form
)
{
string[] tmp = spec.Split(new[] { "-" }, StringSplitOptions.None);
if (tmp.Length < 2) return;
Species = Array.IndexOf(species, tmp[0].Replace(" ", ""));
Form = tmp[1].Replace(" ", "");
if (tmp.Length > 2)
Form += " " + tmp[2];
}
if (Species < -1)
return;
lines = lines.Skip(1).Take(lines.Length - 1).ToArray();
}
int movectr = 0;
// Detect relevant data
foreach (string line in lines)
{
if (line.Length < 2) continue;
if (line.Contains("- "))
{
string moveString = line.Substring(2);
if (moveString.Contains("Hidden Power"))
{
if (moveString.Length > 13) // Defined Hidden Power
{
string type = moveString.Remove(0, 13).Replace("[", "").Replace("]", ""); // Trim out excess data
int hpVal = Array.IndexOf(hptypes, type); // Get HP Type
if (hpVal >= 0) IVs = PKX.setHPIVs(hpVal, IVs); // Get IVs
}
moveString = "Hidden Power";
}
Moves[movectr++] = Array.IndexOf(moves, moveString);
if (movectr == 4)
break; // End of moves
continue;
}
string[] brokenline = line.Split(new[] { ": " }, StringSplitOptions.None);
switch (brokenline[0])
{
case "Trait":
case "Ability": { Ability = Array.IndexOf(abilities, brokenline[1]); break; }
case "Level": { Level = Util.ToInt32(brokenline[1]); break; }
case "Shiny": { Shiny = brokenline[1] == "Yes"; break; }
case "Happiness": { Friendship = Util.ToInt32(brokenline[1]); break; }
case "EVs":
{
// Get EV list String
string[] evlist = brokenline[1].Replace("SAtk", "SpA").Replace("SDef", "SpD").Replace("Spd", "Spe").Split(new[] { " / ", " " }, StringSplitOptions.None);
for (int i = 0; i < evlist.Length / 2; i++)
EVs[Array.IndexOf(StatNames, evlist[1 + i * 2])] = (byte)Util.ToInt32(evlist[0 + 2 * i]);
break;
}
case "IVs":
{
// Get IV list String
string[] ivlist = brokenline[1].Split(new[] { " / ", " " }, StringSplitOptions.None);
for (int i = 0; i < ivlist.Length / 2; i++)
IVs[Array.IndexOf(StatNames, ivlist[1 + i * 2])] = (byte)Util.ToInt32(ivlist[0 + 2 * i]);
break;
}
default:
{
// Either Nature or Gender ItemSpecies
if (brokenline[0].Contains(" @ "))
{
string[] ld = line.Split(new[] { " @ " }, StringSplitOptions.None);
Item = Array.IndexOf(items, ld.Last());
// Gender Detection
string last3 = ld[0].Substring(ld[0].Length - 3);
if (last3 == "(M)" || last3 == "(F)")
{
Gender = last3.Substring(1, 1);
ld[0] = ld[0].Substring(0, ld[ld.Length - 2].Length - 3);
}
// Nickname Detection
string spec = ld[0];
if (spec.Contains("("))
{
int index = spec.LastIndexOf("(", StringComparison.Ordinal);
string n1 = spec.Substring(0, index - 1);
string n2 = spec.Substring(index).Replace("(", "").Replace(")", "").Replace(" ", "");
bool inverted = Array.IndexOf(species, n2.Replace(" ", "")) > -1 || (Species = Array.IndexOf(species, n2.Split('-')[0])) > 0;
spec = inverted ? n2 : n1;
Nickname = inverted ? n1 : n2;
}
if (
(Species = Array.IndexOf(species, spec)) < 0 // Not an Edge Case
&&
(Species = Array.IndexOf(species, spec.Replace(" ", ""))) < 0 // Has Form
)
{
string[] tmp = spec.Split(new[] { "-" }, StringSplitOptions.None);
Species = Array.IndexOf(species, tmp[0].Replace(" ", ""));
Form = tmp[1].Replace(" ", "");
if (tmp.Length > 2)
Form += " " + tmp[2];
}
}
else if (brokenline[0].Contains("Nature"))
Nature = Array.IndexOf(natures, line.Split(' ')[0]);
else // Fallback
Species = Array.IndexOf(species, line.Split('(')[0]);
}
break;
}
}
}
public string getText()
{
if (Species == 0 || Species > 722)
return "";
// First Line: Name, Nickname, Gender, Item
string result = string.Format(species[Species] != Nickname ? "{0} ({1})" : "{1}", Nickname,
species[Species] + ((Form ?? "") != "" ? "-" + Form.Replace("Mega ", "Mega-") : "")) // Species (& Form if necessary)
+ Gender + (Item != 0 ? " @ " + items[Item] : "") + Environment.NewLine;
// IVs
string[] ivstr = new string[6];
int ivctr = 0;
int[] sIVs = { IVs[0], IVs[1], IVs[2], IVs[4], IVs[5], IVs[3] }; // Reorganize speed
for (int i = 0; i < 6; i++)
{
if (sIVs[i] == 31) continue;
ivstr[ivctr++] += $"{sIVs[i]} {StatNames[i]}";
}
if (ivctr > 0)
result += "IVs: " + string.Join(" / ", ivstr.Take(ivctr)) + Environment.NewLine;
// EVs
string[] evstr = new string[6];
int[] sEVs = { EVs[0], EVs[1], EVs[2], EVs[4], EVs[5], EVs[3] }; // Reorganize speed
int evctr = 0;
for (int i = 0; i < 6; i++)
{
if (sEVs[i] == 0) continue;
evstr[evctr++] += $"{sEVs[i]} {StatNames[i]}";
}
if (evctr > 0)
result += "EVs: " + string.Join(" / ", evstr.Take(evctr)) + Environment.NewLine;
// Secondary Stats
result += "Ability: " + abilities[Ability] + Environment.NewLine;
result += "Level: " + Level + Environment.NewLine;
if (Shiny)
result += "Shiny: Yes" + Environment.NewLine;
result += natures[Nature] + " Nature" + Environment.NewLine;
// Add in Moves
string[] MoveLines = new string[Moves.Length];
int movectr = 0;
foreach (int move in Moves.Where(move => move != 0 && move < moves.Length))
{
MoveLines[movectr] += "- " + moves[move];
if (move == 237)
MoveLines[movectr] += $" [{hptypes[PKX.getHPType(IVs)]}]";
movectr++;
}
result += string.Join(Environment.NewLine, MoveLines.Take(movectr));
return result;
}
internal static string getShowdownText(PKM pkm)
{
if (pkm.Species == 0) return "";
ShowdownSet Set = new ShowdownSet
{
Nickname = pkm.Nickname,
Species = pkm.Species,
Item = pkm.HeldItem,
Ability = pkm.Ability,
EVs = pkm.EVs,
IVs = pkm.IVs,
Moves = pkm.Moves,
Nature = pkm.Nature,
Gender = new[] { " (M)", " (F)", "" }[pkm.Gender],
Friendship = pkm.CurrentFriendship,
Level = PKX.getLevel(pkm.Species, pkm.EXP),
Shiny = pkm.IsShiny,
Form = pkm.AltForm > 0 ? PKX.getFormList(pkm.Species, types, forms, new[] { "", "F", "" })[pkm.AltForm] : "",
};
if (Set.Form == "F") Set.Gender = "";
return Set.getText();
}
}
}

636
PKX/f1-Main.Designer.cs generated

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -453,168 +453,27 @@
<metadata name="PB_WarnMove4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="PB_WarnMove4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_WarnMove3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_WarnMove2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_WarnMove1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="GB_RelearnMoves.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_CurrentMoves.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_PP4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_PP3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_PP2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_PP1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label_CurPP.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label_PPups.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Diamond.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Star.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Heart.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Square.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_EC.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_nOT.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Triangle.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Circle.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BTN_RerollEC.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -624,9 +483,6 @@
<metadata name="BTN_Ribbons.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_Markings.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_ExtraBytes.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -636,9 +492,6 @@
<metadata name="Label_EncryptionConstant.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label_Diamond.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Language.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -756,6 +609,7 @@
<metadata name="Label_IsShiny.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="Label_IsShiny.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
@ -1009,6 +863,101 @@
<metadata name="TB_EVTotal.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnMove4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_WarnMove3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_WarnMove2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_WarnMove1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_WarnMove1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAeZJREFUOE+1
kz1LI1EUhscQ0UzunTszMSoIoiKBLRSxsBHBwkb8aiy2s9TGQjsR/AmysN2CC/4DRUFETMgkZGZEEBQ/
UgjaZQvDrvhRaDiek3snJqti5YGXufee9zlz5syM9mUxMjJct9Ld1biU6I7gOkx7lfo8yLwVax1IM+sm
y6yiGzX7Vaom3i2KhyEUTxm26wgbPCbAjYqcSleCYFRYbWUE8Ha8ZYbgs9ExuJydA79cxPiubIGPHq1e
HVUq8oW+nua0YV7RnR9OzwBKJTiw4+Ayfp3StEYFc5SOkh3ggmCqKPbs2ArBdNf74xOgODBj5X2Oi2X0
ECyUX84AFzRl/WdnR5en81syk/6lHXgqFstrKupw8w49CfRSkdcB4qYeFfGY8SuASTcbm/CYz0sYZ5JG
JU17Hb0hhcrAg3CGWb0IPVcX+LP2G/5iFwFM1xwTJV8XfQqVQe14jO9Vw6TjwSE4mpiswMFsfMaTCpXh
cz7+P0zmi4VFuFz9AY5ZDQd5c0rhmubp4rw2KZ+5sJ+E20IBfKupBia5ushT5xpoWgjf8X2QqB5YtrUN
Dts738DSZzzMf0s0lDtwuTnpR40NLyq2M4a14xj2Dl1p778jD727sfg0dvDmS6TvgV7ph39frW84/AKK
SiSLGvswRQAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="GB_RelearnMoves.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_RelearnMove1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_WarnRelearn4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1089,6 +1038,9 @@
<metadata name="CB_RelearnMove1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_CurrentMoves.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_PP4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1131,16 +1083,46 @@
<metadata name="CB_Move1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Diamond.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="TB_PP4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Star.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="TB_PP3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Heart.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="TB_PP2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Square.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="TB_PP1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label_CurPP.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label_PPups.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_PPu1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CB_Move1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TB_EC.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -1167,12 +1149,6 @@
<metadata name="Label_PrevOT.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Triangle.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CHK_Circle.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BTN_RerollEC.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1182,9 +1158,6 @@
<metadata name="BTN_Ribbons.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_Markings.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_MarkPentagon.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1194,24 +1167,20 @@
<metadata name="PB_MarkShiny.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_Mark6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_Mark5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_Mark4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_Mark3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_Mark2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PB_Mark1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark6.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAFVJREFUKFNjQAeKioqhUCZuoKSktAqI/wMVd0CFMAFMEQxjVYyuCIZRFCsrK6dh
UwTDQMUuUKVgD8zEpgiIy6FKEACLYkxFMICkGLciGEBxE+mAgQEAw6cxLyPYHYMAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark6.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAFVJREFUKFNjQAeKioqhUCZuoKSktAqI/wMVd0CFMAFMEQxjVYyuCIZRFCsrK6dh
UwTDQMUuUKVgD8zEpgiIy6FKEACLYkxFMICkGLciGEBxE+mAgQEAw6cxLyPYHYMAAAAASUVORK5CYII=
</value>
</data>
<metadata name="PB_MarkPentagon.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1229,6 +1198,38 @@
wwAADsMBx2+oZAAAAGFJREFUKFNjIA/oVggyGJetYjCpUIKKYAEmFS5ARe8YjMv/gzGIjwGMy8vhClBx
OVQFEBhXhGJRgISB8nCAVQEUowCjsg6sikDiKADsWywKQeIYwLhsJhCfgWMM04gCDAwAOXZIpY+syQoA
AAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAPklEQVQoU2OA
gf///+PEcKCkpPQOF0ZRDBX8jwW/g6iAApAAmgIaKoS7EUSABNAU4FWIFaMoJAZjFcTE/xkAiduxT7wO
KegAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark3.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAPklEQVQoU2OA
gf///+PEcKCkpPQOF0ZRDBX8jwW/g6iAApAAmgIaKoS7EUSABNAU4FWIFaMoJAZjFcTE/xkAiduxT7wO
KegAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark5.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHpJREFUKFNjQAeKioodUCZuAFTkoqSk9B9EQ4UwgZycnCBQwRmowrvKysrGUCkI
AEqUgyRxYaCmmVClEHdhUwTEq6BKEAAouBtZEch6qBQqgLkPGUOlUAFUcreqqqoSyF0gPpBG9T3Ih0Cc
BuWCAUgMqDAUyiUWMDAAALO6MzuvKR9eAAAAAElFTkSuQmCC
</value>
</data>
<data name="PB_Mark5.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHpJREFUKFNjQAeKioodUCZuAFTkoqSk9B9EQ4UwgZycnCBQwRmowrvKysrGUCkI
AEqUgyRxYaCmmVClEHdhUwTEq6BKEAAouBtZEch6qBQqgLkPGUOlUAFUcreqqqoSyF0gPpBG9T3Ih0Cc
BuWCAUgMqDAUyiUWMDAAALO6MzuvKR9eAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="PB_MarkCured.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -1248,6 +1249,22 @@
wwAADsMBx2+oZAAAAI1JREFUKFOVUEENwzAMDIViKYVBiPcogFIohXIahUKwK5VAIcSz3ZvqaPvspJMv
vpPjpGTodAxadwqaRrtHI16URHvyDPuCPuURxnreoY82DzELkmzRdMwIQrfKL8Ts2spnmO57TbqRCGJp
4g92E23pMYzF9rISdO29vKPDX5gnBe2bYH/jms4jjv+ilDfBD7LrZqlEjQAAAABJRU5ErkJggg==
</value>
</data>
<data name="PB_Mark2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAG5JREFUKFNjQAeKioqhUCZuoKysbKykpPQfREOFsAOgot0ghUBTz0CFMAFQ0gWk
CIZxOgFkCprCu1ApBADpRlYEw0C3pkGVQABQ8B26Iih+B1UCVlSOJomCgbZ1gBWqqqoqgYIDFwbJgxUS
BxgYAGs4NknmoWGpAAAAAElFTkSuQmCC
</value>
</data>
<data name="PB_Mark2.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAG5JREFUKFNjQAeKioqhUCZuoKysbKykpPQfREOFsAOgot0ghUBTz0CFMAFQ0gWk
CIZxOgFkCprCu1ApBADpRlYEw0C3pkGVQABQ8B26Iih+B1UCVlSOJomCgbZ1gBWqqqoqgYIDFwbJgxUS
BxgYAGs4NknmoWGpAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="PB_MarkShiny.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -1269,102 +1286,6 @@
GigXDIB8F3QxIgADAwC7NFU/mWb72QAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="PB_Mark6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark6.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAFVJREFUKFNjQAeKioqhUCZuoKSktAqI/wMVd0CFMAFMEQxjVYyuCIZRFCsrK6dh
UwTDQMUuUKVgD8zEpgiIy6FKEACLYkxFMICkGLciGEBxE+mAgQEAw6cxLyPYHYMAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark6.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAFVJREFUKFNjQAeKioqhUCZuoKSktAqI/wMVd0CFMAFMEQxjVYyuCIZRFCsrK6dh
UwTDQMUuUKVgD8zEpgiIy6FKEACLYkxFMICkGLciGEBxE+mAgQEAw6cxLyPYHYMAAAAASUVORK5CYII=
</value>
</data>
<metadata name="PB_Mark5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark5.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHpJREFUKFNjQAeKioodUCZuAFTkoqSk9B9EQ4UwgZycnCBQwRmowrvKysrGUCkI
AEqUgyRxYaCmmVClEHdhUwTEq6BKEAAouBtZEch6qBQqgLkPGUOlUAFUcreqqqoSyF0gPpBG9T3Ih0Cc
BuWCAUgMqDAUyiUWMDAAALO6MzuvKR9eAAAAAElFTkSuQmCC
</value>
</data>
<data name="PB_Mark5.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHpJREFUKFNjQAeKioodUCZuAFTkoqSk9B9EQ4UwgZycnCBQwRmowrvKysrGUCkI
AEqUgyRxYaCmmVClEHdhUwTEq6BKEAAouBtZEch6qBQqgLkPGUOlUAFUcreqqqoSyF0gPpBG9T3Ih0Cc
BuWCAUgMqDAUyiUWMDAAALO6MzuvKR9eAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="PB_Mark4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHBJREFUKFNjgAFlZWVjOTk5QRAbRCsqKrrA+GCgqqqqBATvgPg/iEbnwxUDOeVQ
QTAGmnQGmQ+0KQ2sECjRgSyBjkHyYIUgt2FTAMMgebBCEAA5HJsioHgoVAkCgASRFcHdhg2AJAkqggEU
N5EOGBgAEVY/pv9ltCoAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark4.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHBJREFUKFNjgAFlZWVjOTk5QRAbRCsqKrrA+GCgqqqqBATvgPg/iEbnwxUDOeVQ
QTAGmnQGmQ+0KQ2sECjRgSyBjkHyYIUgt2FTAMMgebBCEAA5HJsioHgoVAkCgASRFcHdhg2AJAkqggEU
N5EOGBgAEVY/pv9ltCoAAAAASUVORK5CYII=
</value>
</data>
<metadata name="PB_Mark3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAPklEQVQoU2OA
gf///+PEcKCkpPQOF0ZRDBX8jwW/g6iAApAAmgIaKoS7EUSABNAU4FWIFaMoJAZjFcTE/xkAiduxT7wO
KegAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark3.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAPklEQVQoU2OA
gf///+PEcKCkpPQOF0ZRDBX8jwW/g6iAApAAmgIaKoS7EUSABNAU4FWIFaMoJAZjFcTE/xkAiduxT7wO
KegAAAAASUVORK5CYII=
</value>
</data>
<metadata name="PB_Mark2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAG5JREFUKFNjQAeKioqhUCZuoKysbKykpPQfREOFsAOgot0ghUBTz0CFMAFQ0gWk
CIZxOgFkCprCu1ApBADpRlYEw0C3pkGVQABQ8B26Iih+B1UCVlSOJomCgbZ1gBWqqqoqgYIDFwbJgxUS
BxgYAGs4NknmoWGpAAAAAElFTkSuQmCC
</value>
</data>
<data name="PB_Mark2.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAG5JREFUKFNjQAeKioqhUCZuoKysbKykpPQfREOFsAOgot0ghUBTz0CFMAFQ0gWk
CIZxOgFkCprCu1ApBADpRlYEw0C3pkGVQABQ8B26Iih+B1UCVlSOJomCgbZ1gBWqqqoqgYIDFwbJgxUS
BxgYAGs4NknmoWGpAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="PB_Mark1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="PB_Mark1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
@ -1379,6 +1300,22 @@
wwAADsMBx2+oZAAAAGxJREFUKFNjQAbKysrGQJwGoqFCqEBVVVVJUVHxjJKS0n8YBvHl5OQEoUogAF0R
smKoErAiF2yKYBjuDJCbsCmAYaBBoTCFxtgUwDCKx3C5EYh3Q5VAAMh3IEF0RRi+hgFoMLmAaKgQqYCB
AQDOs0aM0tfjRAAAAABJRU5ErkJggg==
</value>
</data>
<data name="PB_Mark4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHBJREFUKFNjgAFlZWVjOTk5QRAbRCsqKrrA+GCgqqqqBATvgPg/iEbnwxUDOeVQ
QTAGmnQGmQ+0KQ2sECjRgSyBjkHyYIUgt2FTAMMgebBCEAA5HJsioHgoVAkCgASRFcHdhg2AJAkqggEU
N5EOGBgAEVY/pv9ltCoAAAAASUVORK5CYII=
</value>
</data>
<data name="PB_Mark4.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHBJREFUKFNjgAFlZWVjOTk5QRAbRCsqKrrA+GCgqqqqBATvgPg/iEbnwxUDOeVQ
QTAGmnQGmQ+0KQ2sECjRgSyBjkHyYIUgt2FTAMMgebBCEAA5HJsioHgoVAkCgASRFcHdhg2AJAkqggEU
N5EOGBgAEVY/pv9ltCoAAAAASUVORK5CYII=
</value>
</data>
<metadata name="GB_ExtraBytes.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -1444,9 +1381,6 @@
<metadata name="Label_EncryptionConstant.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Label_Diamond.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
@ -1903,9 +1837,6 @@
<metadata name="ppkx6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSecretBase.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_Daycare.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1921,9 +1852,6 @@
<metadata name="GB_SUBE.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSecretBase.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_Daycare.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -2077,48 +2005,99 @@
<metadata name="B_VerifyCHK.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenHallofFame.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OUTPasserby.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenPokepuffs.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenBoxLayout.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenOPowers.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenItemPouch.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenEventFlags.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenWondercards.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenTrainerInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenBerryField.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenPokedex.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_SAVtools.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSuperTraining.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="FLP_SAVtools.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="FLP_SAVtools.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenPokepuffs.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenItemPouch.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenTrainerInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OUTPasserby.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenBoxLayout.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenWondercards.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSuperTraining.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenHallofFame.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenOPowers.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenEventFlags.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenPokedex.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenBerryField.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSecretBase.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Pokeblocks.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenPokepuffs.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenItemPouch.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenTrainerInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OUTPasserby.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenBoxLayout.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenWondercards.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSuperTraining.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenHallofFame.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenOPowers.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenEventFlags.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenPokedex.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenBerryField.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_OpenSecretBase.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Pokeblocks.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dragout.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -10,6 +10,7 @@ namespace PKHeX
public MemoryAmie() // Keeping the form reference as a lot of control elements are required to operate.
{
InitializeComponent();
pk6 = Main.pkm as PK6;
cba = new[] { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4 };
mta = new[] { CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4, };
CB_Country0.DisplayMember = CB_Country1.DisplayMember = CB_Country2.DisplayMember = CB_Country3.DisplayMember = CB_Country4.DisplayMember = "Text";
@ -38,70 +39,69 @@ namespace PKHeX
getLangStrings();
loadFields();
}
public string[] feeling;
public string[] quality;
bool init;
private bool init;
private readonly ComboBox[] cba;
private readonly ComboBox[] mta;
private readonly PK6 pk6;
// Load/Save Actions
private void loadFields()
{
// Load the region/country values.
CB_Country0.SelectedValue = Main.pk6.Geo1_Country;
CB_Country1.SelectedValue = Main.pk6.Geo2_Country;
CB_Country2.SelectedValue = Main.pk6.Geo3_Country;
CB_Country3.SelectedValue = Main.pk6.Geo4_Country;
CB_Country4.SelectedValue = Main.pk6.Geo5_Country;
CB_Region0.SelectedValue = Main.pk6.Geo1_Region;
CB_Region1.SelectedValue = Main.pk6.Geo2_Region;
CB_Region2.SelectedValue = Main.pk6.Geo3_Region;
CB_Region3.SelectedValue = Main.pk6.Geo4_Region;
CB_Region4.SelectedValue = Main.pk6.Geo5_Region;
CB_Country0.SelectedValue = pk6.Geo1_Country;
CB_Country1.SelectedValue = pk6.Geo2_Country;
CB_Country2.SelectedValue = pk6.Geo3_Country;
CB_Country3.SelectedValue = pk6.Geo4_Country;
CB_Country4.SelectedValue = pk6.Geo5_Country;
CB_Region0.SelectedValue = pk6.Geo1_Region;
CB_Region1.SelectedValue = pk6.Geo2_Region;
CB_Region2.SelectedValue = pk6.Geo3_Region;
CB_Region3.SelectedValue = pk6.Geo4_Region;
CB_Region4.SelectedValue = pk6.Geo5_Region;
// Load the Fullness, and Enjoyment
M_Fullness.Text = Main.pk6.Fullness.ToString();
M_Enjoyment.Text = Main.pk6.Enjoyment.ToString();
M_Fullness.Text = pk6.Fullness.ToString();
M_Enjoyment.Text = pk6.Enjoyment.ToString();
// Load the CT Memories
M_CT_Friendship.Text = Main.pk6.HT_Friendship.ToString();
M_CT_Affection.Text = Main.pk6.HT_Affection.ToString();
CB_CTQual.SelectedIndex = Math.Max(0, Main.pk6.HT_Intensity - 1);
CB_CTMemory.SelectedValue = Main.pk6.HT_Memory;
CB_CTVar.SelectedValue = Main.pk6.HT_TextVar;
CB_CTFeel.SelectedIndex = Main.pk6.HT_Feeling;
M_CT_Friendship.Text = pk6.HT_Friendship.ToString();
M_CT_Affection.Text = pk6.HT_Affection.ToString();
CB_CTQual.SelectedIndex = Math.Max(0, pk6.HT_Intensity - 1);
CB_CTMemory.SelectedValue = pk6.HT_Memory;
CB_CTVar.SelectedValue = pk6.HT_TextVar;
CB_CTFeel.SelectedIndex = pk6.HT_Feeling;
// Load the OT Memories
M_OT_Friendship.Text = Main.pk6.OT_Friendship.ToString();
M_OT_Affection.Text = Main.pk6.OT_Affection.ToString();
CB_OTQual.SelectedIndex = Math.Max(0, Main.pk6.OT_Intensity - 1);
CB_OTMemory.SelectedValue = Main.pk6.OT_Memory;
CB_OTVar.SelectedValue = Main.pk6.OT_TextVar;
CB_OTFeel.SelectedIndex = Main.pk6.OT_Feeling;
M_OT_Friendship.Text = pk6.OT_Friendship.ToString();
M_OT_Affection.Text = pk6.OT_Affection.ToString();
CB_OTQual.SelectedIndex = Math.Max(0, pk6.OT_Intensity - 1);
CB_OTMemory.SelectedValue = pk6.OT_Memory;
CB_OTVar.SelectedValue = pk6.OT_TextVar;
CB_OTFeel.SelectedIndex = pk6.OT_Feeling;
CB_Handler.Items.Clear();
CB_Handler.Items.AddRange(new object[] {$"{Main.pk6.OT_Name} ({args[2]})"}); // OTNAME : OT
CB_Handler.Items.AddRange(new object[] {$"{pk6.OT_Name} ({args[2]})"}); // OTNAME : OT
if (Util.TrimFromZero(Main.pk6.HT_Name) != "")
CB_Handler.Items.AddRange(new object[] { Main.pk6.HT_Name });
if (Util.TrimFromZero(pk6.HT_Name) != "")
CB_Handler.Items.AddRange(new object[] { pk6.HT_Name });
else
Main.pk6.CurrentHandler = 0;
pk6.CurrentHandler = 0;
tabControl1.SelectedIndex = CB_Handler.SelectedIndex = Main.pk6.CurrentHandler;
tabControl1.SelectedIndex = CB_Handler.SelectedIndex = pk6.CurrentHandler;
GB_M_OT.Enabled = GB_M_CT.Enabled = GB_Residence.Enabled =
BTN_Save.Enabled = M_Fullness.Enabled = M_Enjoyment.Enabled =
L_Fullness.Enabled = L_Enjoyment.Enabled = !Main.pk6.IsEgg;
L_Fullness.Enabled = L_Enjoyment.Enabled = !pk6.IsEgg;
if (!Main.pk6.IsEgg)
if (!pk6.IsEgg)
{
bool enable;
if (!Main.pk6.Gen6)
if (!pk6.Gen6)
{
// Previous Generation Mon
GB_M_OT.Text = $"{args[3]} {Main.pk6.OT_Name}: {args[2]}"; // Past Gen OT : OTNAME
GB_M_CT.Text = $"{args[4]} {Main.pk6.HT_Name}"; // Memories with : HTNAME
GB_M_OT.Text = $"{args[3]} {pk6.OT_Name}: {args[2]}"; // Past Gen OT : OTNAME
GB_M_CT.Text = $"{args[4]} {pk6.HT_Name}"; // Memories with : HTNAME
enable = false;
// Reset to no memory
M_OT_Affection.Text = "0";
@ -111,9 +111,9 @@ namespace PKHeX
else
{
enable = true;
GB_M_OT.Text = $"{args[4]} {Main.pk6.OT_Name} ({args[2]})"; // Memories with : OTNAME
GB_M_CT.Text = $"{args[4]} {Main.pk6.HT_Name}"; // Memories with : HTNAME
if (Main.pk6.HT_Name == "")
GB_M_OT.Text = $"{args[4]} {pk6.OT_Name} ({args[2]})"; // Memories with : OTNAME
GB_M_CT.Text = $"{args[4]} {pk6.HT_Name}"; // Memories with : HTNAME
if (pk6.HT_Name == "")
{
CB_Country1.Enabled = CB_Country2.Enabled = CB_Country3.Enabled = CB_Country4.Enabled =
CB_Region1.Enabled = CB_Region2.Enabled = CB_Region3.Enabled = CB_Region4.Enabled =
@ -121,7 +121,7 @@ namespace PKHeX
GB_M_CT.Text = $"{args[1]} {args[2]} - {args[0]}"; // Never Left : OT : Disabled
}
else
GB_M_CT.Text = args[4] + " " + Main.pk6.HT_Name;
GB_M_CT.Text = args[4] + " " + pk6.HT_Name;
}
RTB_OT.Visible = CB_OTQual.Enabled = CB_OTMemory.Enabled = CB_OTFeel.Enabled = CB_OTVar.Enabled = M_OT_Affection.Enabled = enable;
}
@ -131,41 +131,43 @@ namespace PKHeX
init = true;
// Manually load the Memory Parse
RTB_CT.Text = getMemoryString(CB_CTMemory, CB_CTVar, CB_CTQual, CB_CTFeel, Main.pk6.HT_Name);
RTB_OT.Text = getMemoryString(CB_OTMemory, CB_OTVar, CB_OTQual, CB_OTFeel, Main.pk6.OT_Name);
RTB_CT.Text = getMemoryString(CB_CTMemory, CB_CTVar, CB_CTQual, CB_CTFeel, pk6.HT_Name);
RTB_OT.Text = getMemoryString(CB_OTMemory, CB_OTVar, CB_OTQual, CB_OTFeel, pk6.OT_Name);
}
private void saveFields()
{
// Save Region & Country Data
Main.pk6.Geo1_Region = Util.getIndex(CB_Region0);
Main.pk6.Geo2_Region = Util.getIndex(CB_Region1);
Main.pk6.Geo3_Region = Util.getIndex(CB_Region2);
Main.pk6.Geo4_Region = Util.getIndex(CB_Region3);
Main.pk6.Geo5_Region = Util.getIndex(CB_Region4);
Main.pk6.Geo1_Country = Util.getIndex(CB_Country0);
Main.pk6.Geo2_Country = Util.getIndex(CB_Country1);
Main.pk6.Geo3_Country = Util.getIndex(CB_Country2);
Main.pk6.Geo4_Country = Util.getIndex(CB_Country3);
Main.pk6.Geo5_Country = Util.getIndex(CB_Country4);
pk6.Geo1_Region = Util.getIndex(CB_Region0);
pk6.Geo2_Region = Util.getIndex(CB_Region1);
pk6.Geo3_Region = Util.getIndex(CB_Region2);
pk6.Geo4_Region = Util.getIndex(CB_Region3);
pk6.Geo5_Region = Util.getIndex(CB_Region4);
pk6.Geo1_Country = Util.getIndex(CB_Country0);
pk6.Geo2_Country = Util.getIndex(CB_Country1);
pk6.Geo3_Country = Util.getIndex(CB_Country2);
pk6.Geo4_Country = Util.getIndex(CB_Country3);
pk6.Geo5_Country = Util.getIndex(CB_Country4);
// Save 0-255 stats
Main.pk6.HT_Friendship = Util.ToInt32(M_CT_Friendship.Text);
Main.pk6.HT_Affection = Util.ToInt32(M_CT_Affection.Text);
Main.pk6.OT_Friendship = Util.ToInt32(M_OT_Friendship.Text);
Main.pk6.OT_Affection = Util.ToInt32(M_OT_Affection.Text);
Main.pk6.Fullness = (byte)Util.ToInt32(M_Fullness.Text);
Main.pk6.Enjoyment = (byte)Util.ToInt32(M_Enjoyment.Text);
pk6.HT_Friendship = Util.ToInt32(M_CT_Friendship.Text);
pk6.HT_Affection = Util.ToInt32(M_CT_Affection.Text);
pk6.OT_Friendship = Util.ToInt32(M_OT_Friendship.Text);
pk6.OT_Affection = Util.ToInt32(M_OT_Affection.Text);
pk6.Fullness = (byte)Util.ToInt32(M_Fullness.Text);
pk6.Enjoyment = (byte)Util.ToInt32(M_Enjoyment.Text);
// Save Memories
Main.pk6.HT_Memory = Util.getIndex(CB_CTMemory);
Main.pk6.HT_TextVar = CB_CTVar.Enabled ? Util.getIndex(CB_CTVar) : 0;
Main.pk6.HT_Intensity = CB_CTFeel.Enabled ? CB_CTQual.SelectedIndex + 1 : 0;
Main.pk6.HT_Feeling = CB_CTFeel.Enabled ? CB_CTFeel.SelectedIndex : 0;
pk6.HT_Memory = Util.getIndex(CB_CTMemory);
pk6.HT_TextVar = CB_CTVar.Enabled ? Util.getIndex(CB_CTVar) : 0;
pk6.HT_Intensity = CB_CTFeel.Enabled ? CB_CTQual.SelectedIndex + 1 : 0;
pk6.HT_Feeling = CB_CTFeel.Enabled ? CB_CTFeel.SelectedIndex : 0;
Main.pk6.OT_Memory = Util.getIndex(CB_OTMemory);
Main.pk6.OT_TextVar = CB_OTVar.Enabled ? Util.getIndex(CB_OTVar) : 0;
Main.pk6.OT_Intensity = CB_OTFeel.Enabled ? CB_OTQual.SelectedIndex + 1 : 0;
Main.pk6.OT_Feeling = CB_OTFeel.Enabled ? CB_OTFeel.SelectedIndex : 0;
pk6.OT_Memory = Util.getIndex(CB_OTMemory);
pk6.OT_TextVar = CB_OTVar.Enabled ? Util.getIndex(CB_OTVar) : 0;
pk6.OT_Intensity = CB_OTFeel.Enabled ? CB_OTQual.SelectedIndex + 1 : 0;
pk6.OT_Feeling = CB_OTFeel.Enabled ? CB_OTFeel.SelectedIndex : 0;
Main.pkm = pk6;
}
// Event Actions
@ -300,7 +302,7 @@ namespace PKHeX
private string getMemoryString(ComboBox m, ComboBox arg, ComboBox q, ComboBox f, string tr)
{
string result;
string nn = Main.pk6.Nickname;
string nn = pk6.Nickname;
string a = (Util.cbItem)arg.SelectedItem == null ? arg.Text ?? "ERROR" : ((Util.cbItem)arg.SelectedItem).Text;
int mem = Util.getIndex(m);
@ -403,8 +405,8 @@ namespace PKHeX
}
if (!init) return;
RTB_OT.Text = getMemoryString(CB_OTMemory, CB_OTVar, CB_OTQual, CB_OTFeel, Main.pk6.OT_Name);
RTB_CT.Text = getMemoryString(CB_CTMemory, CB_CTVar, CB_CTQual, CB_CTFeel, Main.pk6.HT_Name);
RTB_OT.Text = getMemoryString(CB_OTMemory, CB_OTVar, CB_OTQual, CB_OTFeel, pk6.OT_Name);
RTB_CT.Text = getMemoryString(CB_CTMemory, CB_CTVar, CB_CTQual, CB_CTFeel, pk6.HT_Name);
}
private void changeCountryIndex(object sender, EventArgs e)
{

View file

@ -14,7 +14,7 @@ namespace PKHeX
public RibbMedal()
{
InitializeComponent();
pk6 = Main.pk6; // cache copy
pk6 = Main.pkm as PK6; // cache copy
pba = new[] {
PB_10, PB_11, PB_12, PB_13,
PB_14, PB_15, PB_16, PB_17,
@ -283,7 +283,7 @@ namespace PKHeX
foreach (var chk in cba.Skip(32))
chk.Checked = b;
if (Main.pk6.Version >= 0x10) return; // No Memory Ribbons for Pokémon from Generation 4+
if (Main.pkm.Version >= 0x10) return; // No Memory Ribbons for Pokémon from Generation 4+
TB_PastContest.Text = (b ? 40 : 0).ToString();
TB_PastBattle.Text = (b ? 8 : 0).ToString();
}
@ -316,7 +316,7 @@ namespace PKHeX
private void B_Save_Click(object sender, EventArgs e)
{
setData();
Main.pk6 = pk6; // set back
Main.pkm = pk6; // set back
Close();
}
private void B_Cancel_Click(object sender, EventArgs e)

View file

@ -9070,6 +9070,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap about {
get {
object obj = ResourceManager.GetObject("about", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9260,6 +9270,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bak {
get {
object obj = ResourceManager.GetObject("bak", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9739,6 +9759,18 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to 60 Ash
///21 Test1
///22 Test2
///24 Test3.
/// </summary>
internal static string const_oras {
get {
return ResourceManager.GetString("const_oras", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9786,6 +9818,26 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap data {
get {
object obj = ResourceManager.GetObject("data", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap database {
get {
object obj = ResourceManager.GetObject("database", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9796,6 +9848,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap dump {
get {
object obj = ResourceManager.GetObject("dump", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9906,6 +9968,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap exit {
get {
object obj = ResourceManager.GetObject("exit", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9916,6 +9988,81 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap export {
get {
object obj = ResourceManager.GetObject("export", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to 0648 (OR) Groudon Defeated
///2839 (OR) Groudon Captured
///0647 (AS) Kyogre Defeated
///2840 (AS) Kyogre Captured
///0208 (OR) Ho-Oh Defeated
///2815 (OR) Ho-Oh Captured
///0209 (AS) Lugia Defeated
///2814 (AS) Lugia Captured
///2819 (AS) Dialga Captured
///2820 (OR) Palkia Captured
///2828 (OR) Tornadus Captured
///2829 (AS) Thundurus Captured
///2832 Landorus Captured
///0182 (OR) Reshiram Defeated
///2830 (OR) Reshiram Captured
///0183 (AS) Zekrom Defeated
///2831 (AS) Zekrom Captured
///0419 (OR) Latias Defeated
///2834 (OR) Latias Captured
///0420 (AS) Lati [rest of string was truncated]&quot;;.
/// </summary>
internal static string flags_oras {
get {
return ResourceManager.GetString("flags_oras", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 2237 2237
///2238 2238
///2239 2239
///0963 Mewtwo Defeated
///0115 Mewtwo Captured
///0114 Zygarde Captured
///0790 Zygarde Defeated
///0285 Singles Statuette
///0286 Doubles Statuette
///0287 Triples Statuette
///0288 Rotation Statuette
///0289 Multi Statuette
///0290 Super Singles Unlocked
///0291 Super Doubles Unlocked
///0292 Super Triples Unlocked
///0293 Super Rotation Unlocked
///0294 Super Multi Unlocked
///0675 50: Beat Chatelaine
///2546 Pokédex Obtained.
/// </summary>
internal static string flags_xy {
get {
return ResourceManager.GetString("flags_xy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder {
get {
object obj = ResourceManager.GetObject("folder", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -9976,6 +10123,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap import {
get {
object obj = ResourceManager.GetObject("import", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -14323,6 +14480,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap language {
get {
object obj = ResourceManager.GetObject("language", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to ID,Language
///1,JPN (日本語)
@ -14349,6 +14516,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap load {
get {
object obj = ResourceManager.GetObject("load", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -14379,6 +14556,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap main {
get {
object obj = ResourceManager.GetObject("main", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -14399,6 +14586,36 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap nocheck {
get {
object obj = ResourceManager.GetObject("nocheck", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap open {
get {
object obj = ResourceManager.GetObject("open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap other {
get {
object obj = ResourceManager.GetObject("other", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -14504,6 +14721,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap report {
get {
object obj = ResourceManager.GetObject("report", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -14584,6 +14811,36 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap savePKM {
get {
object obj = ResourceManager.GetObject("savePKM", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap saveSAV {
get {
object obj = ResourceManager.GetObject("saveSAV", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap settings {
get {
object obj = ResourceManager.GetObject("settings", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -14624,6 +14881,16 @@ namespace PKHeX.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap showdown {
get {
object obj = ResourceManager.GetObject("showdown", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -17379,7 +17646,7 @@ namespace PKHeX.Properties {
/// Looks up a localized string similar to ----------
///谜的地点
///遥远的地点
///\xf000Ā\x0001\x0000\xf000ą\x0001\x0001
///\xf000Ā\x0001\x0000\xf000ą\x0001\x0001
///鹿子镇
///唐草镇
///三曜市
@ -18668,19 +18935,19 @@ namespace PKHeX.Properties {
}
/// <summary>
/// Looks up a localized string similar to None
///Rock Smash (HGSS)
///Tall Grass
/// Looks up a localized string similar to æ— 
///碎岩 (HGSS)
///高草丛
///
///Dialga/Palkia
///Cave/Hall of Origin
///帝牙卢卡/帕路奇犽
///洞穴/初始之间
///
///Surfing/Fishing
///冲浪/钓鱼
///
///Building/Enigma Stone
///Marsh/Safari
///博物馆/神秘水晶
///大湿地/狩猎
///
///Starter/Fossil/Gift (DP)
///御三家/化石/礼物 (DP)
///
///
///
@ -18691,8 +18958,8 @@ namespace PKHeX.Properties {
///
///
///
///Distortion World (Pt)
///Starter/Fossil/Gift (Pt/DP Trio).
///破格的世界(Pt)
///御三家/化石/礼物 (Pt/DP Trio).
/// </summary>
internal static string text_encountertype_zh {
get {
@ -20741,7 +21008,7 @@ namespace PKHeX.Properties {
///
///
///
///あるすがた
///字母形态
///
///
///
@ -20793,7 +21060,8 @@ namespace PKHeX.Properties {
///
///
///
/// /// [rest of string was truncated]&quot;;.
///
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string text_forms_zh {
get {
@ -21080,8 +21348,8 @@ namespace PKHeX.Properties {
///黑2
///X
///Y
///AS
///OR
///始源蓝宝石
///终极红宝石
///.
/// </summary>
internal static string text_games_zh {
@ -21419,70 +21687,77 @@ namespace PKHeX.Properties {
}
/// <summary>
/// Looks up a localized string similar to どこか
///さいしょのまち
///うち
///ともだちのいえ
///ひとのうち
///にぎやかなまち
///ブティック
///ショップ
///そぼくなまち
///ポケモンセンター
///おしろ
///ホテル
///ふしぎなふんいきのまち
///かぜのふくまち
///ゲート
///かわべりのまち
///けんきゅうじょ
///すいぞくかん
///がけにあるまち
///はなやかなまち
///ポケモンジム
///がっこう
///きょだいなまち
///ビル
///オシャレなカフェ
///アジト
///びじゅつかん
///スタジオ
///えき
///たたかいのば
///びようしつ
///レストラン
///こうきゅうレストラン
///うみべのまち
///たかいたてもののなか
///ふしぎなふんいきのまち
///かわぞいのまち
///ゆきのふりつもるまち
///ポケモンリーグ
///きゅうでん
///どうくつ
///もり
///がいろじゅのつづくみち
///かわぞいのみち
///のどかなみち
///はなさくみち
///そだてや
///けわしいやまみち
///いしのたちならぶばしょ
///うみのみえるみち
///ぬかるんだみち
///すなのふきあれるみち
///おちばみち
///ゆきみち
///こうじょう
///チャンピオンロード
///ゆきやま
///はつでんしょ
///はたけ
///はいきょ
///すいどう
///サファリ
///ひみつきち
///コンテストライブかい [rest of string was truncated]&quot;;.
/// Looks up a localized string similar to 某处
///第一个城镇
///家
///朋友的家
///别人的房子
///热闹的小镇
///精品屋
///商店
///普通小镇
///精灵中心
///城堡
///酒店
///雾气的小镇
///微风吹过的小镇
///门
///河边小镇
///实验室
///水族馆
///悬崖上的小镇
///华丽的城市
///精灵健身房
///学校
///大城市
///建筑
///时尚咖啡厅
///藏身处
///博物馆
///工作室
///车站
///战场
///美容院
///餐厅
///高档餐厅
///海滨城市
///高大建筑物内
///神秘气息的城市
///河畔城市
///白雪皑皑的城市
///精灵联赛
///宫殿
///山洞
///森林
///绿树成荫的道路
///滨江路
///宁静的道路
///盛开的道路
///饲育屋
///崎岖山路
///满是石头的路
///海边道路
///泥泞的路
///沙子路
///落叶路
///雪扫路
///工厂
///冠军之路
///雪山
///发电厂
///田地
///废墟
///水路
///野生动物园
///秘密基地
///华丽大赛会场
///海洋深处
///幻之位置
///大船
///火山小径
///小岛
///神秘的地方
///天空.
/// </summary>
internal static string text_genloc_zh {
get {
@ -21889,7 +22164,7 @@ namespace PKHeX.Properties {
}
/// <summary>
/// Looks up a localized string similar to ----
/// Looks up a localized string similar to 迷之地方
///双叶镇
///真砂镇
///苑之镇
@ -23427,45 +23702,50 @@ namespace PKHeX.Properties {
/// <summary>
/// Looks up a localized string similar to
///
///おもいで らしいわ
///おもいで らしいわ
///おもいで らしいわ
///おもいで らしいわ
///きおくにのこる おもいで らしいわ
///かんがいぶかい おもいで だって
///さいこうの おもいで だって!
///神奇宝贝记得
///神奇宝贝记得
///神奇宝贝记得
///神奇宝贝记得
///神奇宝贝清晰得记得
///神奇宝贝肯定得记得
///神奇宝贝美美得记得
///
///うれしかった
///たのしかった
///よろこんだ
///ニヤニヤした
///たまらない きもちになった
///なんともいえない きもちだった
///いい きぶんになった
///うるうるした
///うかれてしまった
///きんちょうした
///きもちよかった
///もぞもぞした
///クセになりそうに なった
///もうしわけない きぶんになった
///せつない きもちになった
///なつかしい きもちになった
///てこずった
///きつかった
///すなおに なれなかった
///ほこらしく おもった
///けんあくな ムードになった
///おこってしまった
///しっとした
///ねむくなった
///它很高兴
///它玩的开心
///它很开心
///它咧嘴笑
///它变得不知所措
///它的感觉难以形容
///它感觉很好
///它变得饱含泪水
///它感到轻松
///它感到紧张了
///它感觉很舒服
///它感到焦躁不安
///它变得有点得意忘形
///它感到惋惜
///它变得很敏感
///它变得很怀旧
///它遇到了一些困难
///它感到精疲力尽
///它感觉不像是真的
///它感到骄傲
///他们以坏心情收场
///它变得愤怒
///它感到嫉妒
///它想睡觉
///
///なにかのどうぐ
///なにかのわざ
///だれか
///いい おもいでが あるようだけど ちょっと おもいおこせないみたい……
///{0}は {1}に {2}で であい  モンスターボールを なげられて いっしょに たびする ことになり  {3}ことが {4}
///{0}は {2}で  タマゴの からをやぶって [rest of string was truncated]&quot;;.
///某一道具
///某一技能
///神奇宝贝
///这只神奇宝贝好像有很美好的回忆,但是它似乎想不起来了……
///{0}和{1}的第一次相遇在……{2}。{1}朝它使用了神奇宝贝球,之后他们就开始一起旅行了。
///{0}从蛋中孵化并且看见{1}第一眼的地方是在……{2}。
///{0}和{1}相遇的地方是……{2}。
///{0}在{2}通过通讯交换遇见了{1},他们随后成了朋友。
///{0}和{1}一起去了宝可梦中心/友好商店,购买了{2}。
///{0}和{1}一起去了{2}的宝可梦中心并且恢复了它疲惫的身体。
///{0 [rest of string was truncated]&quot;;.
/// </summary>
internal static string text_memories_zh {
get {
@ -24270,29 +24550,29 @@ namespace PKHeX.Properties {
}
/// <summary>
/// Looks up a localized string similar to 努力/实干
///寂寞/孤僻
/// Looks up a localized string similar to 努力
///孤独
///勇敢
///固执
///顽皮/调皮
///调皮
///大胆
///
///
///悠闲
///淘气
///无虑
///乐天
///胆小
///急躁
///认真
///开朗
///天真
///谨慎/保守
///温和/稳重
///保守
///稳重
///冷静
///腼腆/害羞
///害羞
///马虎
///安静/沉着
///沉着
///温顺
///傲慢/狂妄
///狂妄
///慎重
///浮躁.
/// </summary>
@ -24528,37 +24808,57 @@ namespace PKHeX.Properties {
/// <summary>
/// Looks up a localized string similar to 能量方块盒
///树果混合器
///ポロックを あげる
///あげる
///ポロックを つくる
///つくる
///给与一个能量方块
///给与
///制作能量方块
///制作
///[~ 6]
///いろ
///颜色
///[VAR NUM3(0000)]
///[VAR PKNICK(0000)]
///[VAR MOVE(0000)]
///どのポケモンに あげますか
///[VAR PKNICK(0000)]に ポロックを あげた
///しぼりこむ いろを えらんでください
///ポロックを えらんでください
///ポロックを どうしますか
///まぜる きのみを えらんでください
///给哪个精灵
///你把能量块给了[VAR PKNICK(0000)]
///请选择筛选颜色
///选择一个能量方块
///要对能量方块做些什么
///选择需要混合的树果
///[~ 17]
///[VAR 01A3(0000)]が [VAR NUM1(0001)]コ できた![VAR BE05(0000)][VAR BE05(0001)]
///[VAR PKNICK(0000)]に ポロックをあげますか?
///タマゴは たべられません!
///どのポケモンに あげますか?
///4つ までしか いれられません!
///あか で しぼりこみました
///あお で しぼりこみました
///ももいろ で しぼりこみました
///みどり で しぼりこみました
///きいろ で しぼりこみました
///ブレンドスタート
///きのみを もどす
///ポケモンにあげる
///やめる
///はい /// [rest of string was truncated]&quot;;.
///你做出了[VAR 01A3(0000)]个[VAR NUM1(0001)][VAR BE05(0000)][VAR BE05(0001)]
///把能量方块给[VAR PKNICK(0000)]
///蛋不能吃能量方块!
///给哪个精灵?
///你不能混合超过4个树果
///按红色筛选
///按蓝色筛选
///按粉色筛选
///按绿色筛选
///按黄色筛选
///开始混合
///返回树果
///给与
///退出
///是
///否
///全部
///红
///蓝
///粉
///绿
///黄
///[~ 40]
///[~ 41]
///[~ 42]
///[~ 43]
///[~ 44]
///[~ 45]
///[~ 46]
///[~ 47]
///[~ 48]
///[~ 49]
///[~ 50]
///[VAR 01A3(0000)]
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string text_pokeblock_zh {
get {

View file

@ -5824,4 +5824,73 @@
<data name="wc6full" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\wc6full.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="const_oras" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\other\const_oras.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="flags_oras" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\other\flags_oras.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="flags_xy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\other\flags_xy.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="about" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\about.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bak" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\bak.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="data" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\data.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="database" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\database.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="dump" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\dump.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="exit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\exit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="export" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\export.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="import" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\import.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="language" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\language.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="load" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\load.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="main" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\main.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="nocheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\nocheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="other" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\other.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="report" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\report.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="savePKM" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\savePKM.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="saveSAV" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\saveSAV.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="settings" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="showdown" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\Program\showdown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

View file

@ -0,0 +1,4 @@
60 Ash
21 Test1
22 Test2
24 Test3

View file

@ -0,0 +1,66 @@
0648 (OR) Groudon Defeated
2839 (OR) Groudon Captured
0647 (AS) Kyogre Defeated
2840 (AS) Kyogre Captured
0208 (OR) Ho-Oh Defeated
2815 (OR) Ho-Oh Captured
0209 (AS) Lugia Defeated
2814 (AS) Lugia Captured
2819 (AS) Dialga Captured
2820 (OR) Palkia Captured
2828 (OR) Tornadus Captured
2829 (AS) Thundurus Captured
2832 Landorus Captured
0182 (OR) Reshiram Defeated
2830 (OR) Reshiram Captured
0183 (AS) Zekrom Defeated
2831 (AS) Zekrom Captured
0419 (OR) Latias Defeated
2834 (OR) Latias Captured
0420 (AS) Latios Defeated
2835 (AS) Latios Captured
0945 Deoxys Defeated @ Sky Tower
2842 Deoxys Captured @ Sky Tower
0173 Raikou Defeated
2811 Raikou Captured
0174 Entei Defeated
2812 Entei Captured
0175 Suicune Defeated
2813 Suicune Captured
0176 Cobalion Defeated
2825 Cobalion Captured
0177 Terrakion Defeated
2826 Terrakion Captured
0178 Virizion Defeated
2827 Virizion Captured
0184 Kyurem Defeated
2833 Kyurem Captured
0179 Uxie Defeated
2816 Uxie Captured
0180 Mesprit Defeated
2817 Mesprit Captured
0181 Azelf Defeated
2818 Azelf Captured
0172 Cresselia Defeated
2824 Cresselia Captured
2823 Giratina Captured
0260 Heatran Defeated
2821 Heatran Captured
0956 Regirock Defeated
2836 Regirock Captured
0957 Regice Defeated
2837 Regice Captured
0958 Registeel Defeated
2838 Registeel Captured
0252 Regigigas Defeated
2822 Regigigas Captured
0284 Singles Statuette
0285 Doubles Statuette
0286 Triples Statuette
0287 Rotation Statuette
0288 Multi Statuette
0289 Super Singles Unlocked
0290 Super Doubles Unlocked
0291 Super Triples Unlocked
0292 Super Rotation Unlocked
0293 Super Multi Unlocked

View file

@ -0,0 +1,19 @@
2237 2237
2238 2238
2239 2239
0963 Mewtwo Defeated
0115 Mewtwo Captured
0114 Zygarde Captured
0790 Zygarde Defeated
0285 Singles Statuette
0286 Doubles Statuette
0287 Triples Statuette
0288 Rotation Statuette
0289 Multi Statuette
0290 Super Singles Unlocked
0291 Super Doubles Unlocked
0292 Super Triples Unlocked
0293 Super Rotation Unlocked
0294 Super Multi Unlocked
0675 50: Beat Chatelaine
2546 Pokédex Obtained

View file

@ -11,21 +11,21 @@ namespace PKHeX
Util.TranslateInterface(this, Main.curlanguage);
listBox1.SelectedIndex = 0;
}
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private void changefield(object sender, EventArgs e)
{
// Change Berry Field
// Gather Data
int berry = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex*0x18 + 1 * 0);
int u1 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 1 * 2);
int u2 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 2 * 2);
int u3 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 3 * 2);
int u4 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 4 * 2);
int u5 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 5 * 2);
int u6 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 6 * 2);
int u7 = BitConverter.ToUInt16(sav, Main.SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 7 * 2);
int berry = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex*0x18 + 1 * 0);
int u1 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 1 * 2);
int u2 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 2 * 2);
int u3 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 3 * 2);
int u4 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 4 * 2);
int u5 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 5 * 2);
int u6 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 6 * 2);
int u7 = BitConverter.ToUInt16(SAV.Data, SAV.BerryField + 0xC + listBox1.SelectedIndex * 0x18 + 7 * 2);
// Display Data

View file

@ -18,28 +18,28 @@ namespace PKHeX
CB_BG.Items.Add(wallpaper);
// Go
MT_BG1.Text = sav.Data[sav.PCFlags + 0].ToString();
CB_Unlocked.SelectedIndex = sav.Data[sav.PCFlags + 1] - 1;
MT_BG2.Text = sav.Data[sav.PCFlags + 2].ToString();
MT_BG1.Text = SAV.Data[SAV.PCFlags + 0].ToString();
CB_Unlocked.SelectedIndex = SAV.Data[SAV.PCFlags + 1] - 1;
MT_BG2.Text = SAV.Data[SAV.PCFlags + 2].ToString();
LB_BoxSelect.SelectedIndex = box;
}
private readonly SAV6 sav = new SAV6((byte[])Main.SAV.Data.Clone());
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private bool editing;
private void changeBox(object sender, EventArgs e)
{
editing = true;
int bgoff = sav.PCBackgrounds + LB_BoxSelect.SelectedIndex;
CB_BG.SelectedIndex = sav.Data[bgoff];
TB_BoxName.Text = sav.getBoxName(LB_BoxSelect.SelectedIndex);
int bgoff = SAV.PCBackgrounds + LB_BoxSelect.SelectedIndex;
CB_BG.SelectedIndex = SAV.Data[bgoff];
TB_BoxName.Text = SAV.getBoxName(LB_BoxSelect.SelectedIndex);
editing = false;
}
private void changeBoxDetails(object sender, EventArgs e)
{
if (!editing)
sav.setBoxName(LB_BoxSelect.SelectedIndex, TB_BoxName.Text);
SAV.setBoxName(LB_BoxSelect.SelectedIndex, TB_BoxName.Text);
}
private void B_Cancel_Click(object sender, EventArgs e)
{
@ -47,11 +47,11 @@ namespace PKHeX
}
private void B_Save_Click(object sender, EventArgs e)
{
sav.Data[sav.PCFlags + 0] = (byte)Util.ToUInt32(MT_BG1.Text);
sav.Data[sav.PCFlags + 1] = (byte)Util.ToUInt32(CB_Unlocked.Text);
sav.Data[sav.PCFlags + 2] = (byte)Util.ToUInt32(MT_BG2.Text);
SAV.Data[SAV.PCFlags + 0] = (byte)Util.ToUInt32(MT_BG1.Text);
SAV.Data[SAV.PCFlags + 1] = (byte)Util.ToUInt32(CB_Unlocked.Text);
SAV.Data[SAV.PCFlags + 2] = (byte)Util.ToUInt32(MT_BG2.Text);
Array.Copy(sav.Data, Main.SAV.Data, sav.Data.Length);
Array.Copy(SAV.Data, Main.SAV.Data, SAV.Data.Length);
Main.SAV.Edited = true;
Close();
}
@ -59,9 +59,9 @@ namespace PKHeX
private void changeBoxBG(object sender, EventArgs e)
{
if (!editing)
sav.Data[Main.SAV.PCBackgrounds + LB_BoxSelect.SelectedIndex] = (byte)CB_BG.SelectedIndex;
SAV.Data[SAV.PCBackgrounds + LB_BoxSelect.SelectedIndex] = (byte)CB_BG.SelectedIndex;
string imagename = "box_wp" + (CB_BG.SelectedIndex + 1).ToString("00"); if (sav.ORAS && CB_BG.SelectedIndex + 1 > 16) imagename += "o";
string imagename = "box_wp" + (CB_BG.SelectedIndex + 1).ToString("00"); if (SAV.ORAS && CB_BG.SelectedIndex + 1 > 16) imagename += "o";
PAN_BG.BackgroundImage = (Image)Properties.Resources.ResourceManager.GetObject(imagename);
}
}

View file

@ -911,10 +911,11 @@
//
// Menu_Exit
//
this.Menu_Exit.Image = global::PKHeX.Properties.Resources.exit;
this.Menu_Exit.Name = "Menu_Exit";
this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
this.Menu_Exit.ShowShortcutKeys = false;
this.Menu_Exit.Size = new System.Drawing.Size(96, 22);
this.Menu_Exit.Size = new System.Drawing.Size(152, 22);
this.Menu_Exit.Text = "&Close";
this.Menu_Exit.Click += new System.EventHandler(this.Menu_Exit_Click);
//
@ -936,6 +937,7 @@
this.Menu_SearchDatabase,
this.Menu_SearchLegal,
this.Menu_SearchIllegal});
this.Menu_SearchSettings.Image = global::PKHeX.Properties.Resources.settings;
this.Menu_SearchSettings.Name = "Menu_SearchSettings";
this.Menu_SearchSettings.Size = new System.Drawing.Size(197, 22);
this.Menu_SearchSettings.Text = "Search Settings";
@ -978,6 +980,7 @@
//
// Menu_OpenDB
//
this.Menu_OpenDB.Image = global::PKHeX.Properties.Resources.folder;
this.Menu_OpenDB.Name = "Menu_OpenDB";
this.Menu_OpenDB.Size = new System.Drawing.Size(197, 22);
this.Menu_OpenDB.Text = "Open Database Folder";
@ -985,6 +988,7 @@
//
// Menu_Report
//
this.Menu_Report.Image = global::PKHeX.Properties.Resources.report;
this.Menu_Report.Name = "Menu_Report";
this.Menu_Report.Size = new System.Drawing.Size(197, 22);
this.Menu_Report.Text = "Create Data Report";
@ -992,6 +996,7 @@
//
// Menu_Export
//
this.Menu_Export.Image = global::PKHeX.Properties.Resources.export;
this.Menu_Export.Name = "Menu_Export";
this.Menu_Export.Size = new System.Drawing.Size(197, 22);
this.Menu_Export.Text = "Export Results to Folder";

View file

@ -81,13 +81,14 @@ namespace PKHeX
{
Version = 0,
Title = "Misc",
Description = "Individual pk6 files present in the db/sav.",
Description = "Individual pkm files present in the db/sav.",
});
// Load databases
foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories))
{
if (new FileInfo(file).Extension == ".pk6")
FileInfo fi = new FileInfo(file);
if (fi.Extension.Contains(".pk") && PKX.getIsPKM(fi.Length))
Database[0].Slot.Add(new PK6(File.ReadAllBytes(file), file));
else
loadDatabase(File.ReadAllBytes(file));
@ -109,8 +110,8 @@ namespace PKHeX
private readonly PictureBox[] PKXBOXES;
private readonly string DatabasePath = Main.DatabasePath;
private readonly List<DatabaseList> Database = new List<DatabaseList>();
private List<PK6> Results;
private List<PK6> RawDB;
private List<PKM> Results;
private List<PKM> RawDB;
private int slotSelected = -1; // = null;
private Image slotColor;
private const int RES_MAX = 66;
@ -129,7 +130,7 @@ namespace PKHeX
System.Media.SystemSounds.Exclamation.Play();
else
{
m_parent.populateFields(new PK6(dataArr[index].Data), false);
m_parent.populateFields(dataArr[index], false);
slotSelected = index + SCR_Box.Value * RES_MIN;
slotColor = Properties.Resources.slotView;
FillPKXBoxes(SCR_Box.Value);
@ -161,12 +162,12 @@ namespace PKHeX
int box = Convert.ToInt32(split[0].Substring(1)) - 1;
int slot = Convert.ToInt32(split[1]) - 1;
int spot = box*30 + slot;
int offset = Main.SAV.Box + spot*PK6.SIZE_STORED;
var pkSAV = Main.SAV.getPK6Stored(offset);
int offset = Main.SAV.getBoxOffset(0) + spot*Main.SAV.SIZE_STORED;
PKM pkSAV = Main.SAV.getStoredSlot(offset);
if (pkSAV.Data.SequenceEqual(pk.Data))
{
Main.SAV.setEK6Stored(Main.blankEK6, offset);
Main.SAV.setStoredSlot(Main.SAV.BlankPKM, offset);
m_parent.setPKXBoxes();
}
else
@ -191,7 +192,7 @@ namespace PKHeX
if (!m_parent.verifiedPKX())
return;
PK6 pk = m_parent.preparepkx();
PKM pk = m_parent.preparePKM();
if (!Directory.Exists(DatabasePath))
Directory.CreateDirectory(DatabasePath);
@ -203,12 +204,12 @@ namespace PKHeX
return;
}
File.WriteAllBytes(path, pk.Data.Take(PK6.SIZE_STORED).ToArray());
File.WriteAllBytes(path, pk.Data.Take(pk.SIZE_STORED).ToArray());
pk.Identifier = path;
int pre = RawDB.Count;
RawDB.Add(pk);
RawDB = new List<PK6>(RawDB.Distinct()); // just in case
RawDB = new List<PKM>(RawDB.Distinct()); // just in case
int post = RawDB.Count;
if (pre == post)
{ Util.Alert("Pokémon already exists in database."); return; }
@ -317,7 +318,7 @@ namespace PKHeX
// IO Usage
private class DatabaseList
{
public readonly List<PK6> Slot = new List<PK6>();
public readonly List<PKM> Slot = new List<PKM>();
public int Version;
private readonly bool Unicode;
private readonly byte[] Unused;
@ -380,13 +381,13 @@ namespace PKHeX
}
private void prepareDBForSearch()
{
RawDB = new List<PK6>();
RawDB = new List<PKM>();
foreach (var db in Database)
RawDB.AddRange(db.Slot);
RawDB = new List<PK6>(RawDB.Where(pk => pk.ChecksumValid && pk.Species != 0 && pk.Sanity == 0));
RawDB = new List<PK6>(RawDB.Distinct());
RawDB = new List<PKM>(RawDB.Where(pk => pk.ChecksumValid && pk.Species != 0 && pk.Sanity == 0));
RawDB = new List<PKM>(RawDB.Distinct());
setResults(RawDB);
}
private void openDB(object sender, EventArgs e)
@ -410,16 +411,16 @@ namespace PKHeX
if (!Directory.Exists(path)) // just in case...
Directory.CreateDirectory(path);
foreach (PK6 pk6 in Results)
File.WriteAllBytes(Path.Combine(path, Util.CleanFileName(pk6.FileName)),
pk6.Data.Take(0xE8).ToArray());
foreach (PKM pkm in Results)
File.WriteAllBytes(Path.Combine(path, Util.CleanFileName(pkm.FileName)),
pkm.Data.Take(0xE8).ToArray());
}
// View Updates
private void B_Search_Click(object sender, EventArgs e)
{
// Populate Search Query Result
IEnumerable<PK6> res = RawDB;
IEnumerable<PKM> res = RawDB;
// Primary Searchables
int species = Util.getIndex(CB_Species);
@ -534,9 +535,9 @@ namespace PKHeX
slotSelected = -1; // reset the slot last viewed
if (Menu_SearchLegal.Checked && !Menu_SearchIllegal.Checked) // Legal Only
res = res.Where(pk => pk.Gen6 && new LegalityAnalysis(pk).Valid);
res = res.Where(pk => pk.Gen6 && pk is PK6 && new LegalityAnalysis(pk as PK6).Valid);
if (!Menu_SearchLegal.Checked && Menu_SearchIllegal.Checked) // Illegal Only
res = res.Where(pk => pk.Gen6 && !new LegalityAnalysis(pk).Valid);
res = res.Where(pk => pk.Gen6 && pk is PK6 && !new LegalityAnalysis(pk as PK6).Valid);
var results = res.ToArray();
if (results.Length == 0)
@ -546,7 +547,7 @@ namespace PKHeX
else
Util.Alert("No results found!");
}
setResults(new List<PK6>(results)); // updates Count Label as well.
setResults(new List<PKM>(results)); // updates Count Label as well.
System.Media.SystemSounds.Asterisk.Play();
}
private void updateScroll(object sender, ScrollEventArgs e)
@ -554,9 +555,9 @@ namespace PKHeX
if (e.OldValue != e.NewValue)
FillPKXBoxes(e.NewValue);
}
private void setResults(List<PK6> res)
private void setResults(List<PKM> res)
{
Results = new List<PK6>(res);
Results = new List<PKM>(res);
SCR_Box.Maximum = (int)Math.Ceiling((decimal)Results.Count / RES_MIN);
if (SCR_Box.Maximum > 0) SCR_Box.Maximum -= 1;
@ -571,7 +572,7 @@ namespace PKHeX
if (Results == null)
for (int i = 0; i < RES_MAX; i++)
PKXBOXES[i].Image = null;
PK6[] data = Results.Skip(start * RES_MIN).Take(RES_MAX).ToArray();
PKM[] data = Results.Skip(start * RES_MIN).Take(RES_MAX).ToArray();
for (int i = 0; i < data.Length; i++)
PKXBOXES[i].Image = data[i].Sprite;
for (int i = data.Length; i < RES_MAX; i++)

382
SAV/SAV_EventFlags.Designer.cs generated Normal file
View file

@ -0,0 +1,382 @@
namespace PKHeX
{
partial class SAV_EventFlags
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_EventFlags));
this.c_CustomFlag = new System.Windows.Forms.CheckBox();
this.B_Cancel = new System.Windows.Forms.Button();
this.GB_FlagStatus = new System.Windows.Forms.GroupBox();
this.nud = new System.Windows.Forms.NumericUpDown();
this.CHK_CustomFlag = new System.Windows.Forms.Label();
this.L_Value = new System.Windows.Forms.Label();
this.CB_Stats = new System.Windows.Forms.ComboBox();
this.MT_Stat = new System.Windows.Forms.MaskedTextBox();
this.L_Stats = new System.Windows.Forms.Label();
this.B_Save = new System.Windows.Forms.Button();
this.GB_Researcher = new System.Windows.Forms.GroupBox();
this.L_UnSet = new System.Windows.Forms.Label();
this.L_IsSet = new System.Windows.Forms.Label();
this.TB_NewSAV = new System.Windows.Forms.TextBox();
this.TB_OldSAV = new System.Windows.Forms.TextBox();
this.TB_UnSet = new System.Windows.Forms.TextBox();
this.TB_IsSet = new System.Windows.Forms.TextBox();
this.B_LoadNew = new System.Windows.Forms.Button();
this.B_LoadOld = new System.Windows.Forms.Button();
this.GB_Flags = new System.Windows.Forms.GroupBox();
this.GB_Constants = new System.Windows.Forms.GroupBox();
this.TLP_Const = new System.Windows.Forms.TableLayoutPanel();
this.TLP_Flags = new System.Windows.Forms.TableLayoutPanel();
this.GB_FlagStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nud)).BeginInit();
this.GB_Researcher.SuspendLayout();
this.GB_Flags.SuspendLayout();
this.GB_Constants.SuspendLayout();
this.SuspendLayout();
//
// c_CustomFlag
//
this.c_CustomFlag.AutoSize = true;
this.c_CustomFlag.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.c_CustomFlag.Location = new System.Drawing.Point(138, 15);
this.c_CustomFlag.Name = "c_CustomFlag";
this.c_CustomFlag.Size = new System.Drawing.Size(15, 14);
this.c_CustomFlag.TabIndex = 1;
this.c_CustomFlag.UseVisualStyleBackColor = true;
this.c_CustomFlag.CheckedChanged += new System.EventHandler(this.changeCustomBool);
//
// B_Cancel
//
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_Cancel.Location = new System.Drawing.Point(289, 320);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(75, 23);
this.B_Cancel.TabIndex = 2;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// GB_FlagStatus
//
this.GB_FlagStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GB_FlagStatus.Controls.Add(this.nud);
this.GB_FlagStatus.Controls.Add(this.CHK_CustomFlag);
this.GB_FlagStatus.Controls.Add(this.L_Value);
this.GB_FlagStatus.Controls.Add(this.CB_Stats);
this.GB_FlagStatus.Controls.Add(this.MT_Stat);
this.GB_FlagStatus.Controls.Add(this.L_Stats);
this.GB_FlagStatus.Controls.Add(this.c_CustomFlag);
this.GB_FlagStatus.Location = new System.Drawing.Point(288, 228);
this.GB_FlagStatus.Name = "GB_FlagStatus";
this.GB_FlagStatus.Size = new System.Drawing.Size(159, 81);
this.GB_FlagStatus.TabIndex = 3;
this.GB_FlagStatus.TabStop = false;
this.GB_FlagStatus.Text = "Check Status";
//
// nud
//
this.nud.Location = new System.Drawing.Point(87, 12);
this.nud.Maximum = new decimal(new int[] {
3072,
0,
0,
0});
this.nud.Name = "nud";
this.nud.Size = new System.Drawing.Size(45, 20);
this.nud.TabIndex = 9;
this.nud.ValueChanged += new System.EventHandler(this.changeCustomFlag);
this.nud.KeyUp += new System.Windows.Forms.KeyEventHandler(this.changeCustomFlag);
//
// CHK_CustomFlag
//
this.CHK_CustomFlag.Location = new System.Drawing.Point(9, 12);
this.CHK_CustomFlag.Name = "CHK_CustomFlag";
this.CHK_CustomFlag.Size = new System.Drawing.Size(72, 20);
this.CHK_CustomFlag.TabIndex = 2;
this.CHK_CustomFlag.Text = "Flag:";
this.CHK_CustomFlag.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_Value
//
this.L_Value.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.L_Value.Location = new System.Drawing.Point(6, 56);
this.L_Value.Name = "L_Value";
this.L_Value.Size = new System.Drawing.Size(75, 20);
this.L_Value.TabIndex = 35;
this.L_Value.Text = "Value:";
this.L_Value.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CB_Stats
//
this.CB_Stats.DropDownHeight = 156;
this.CB_Stats.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_Stats.DropDownWidth = 180;
this.CB_Stats.FormattingEnabled = true;
this.CB_Stats.IntegralHeight = false;
this.CB_Stats.Location = new System.Drawing.Point(87, 35);
this.CB_Stats.Name = "CB_Stats";
this.CB_Stats.Size = new System.Drawing.Size(66, 21);
this.CB_Stats.TabIndex = 36;
this.CB_Stats.SelectedIndexChanged += new System.EventHandler(this.changeConstantIndex);
//
// MT_Stat
//
this.MT_Stat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.MT_Stat.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MT_Stat.Location = new System.Drawing.Point(87, 57);
this.MT_Stat.Mask = "00000";
this.MT_Stat.Name = "MT_Stat";
this.MT_Stat.Size = new System.Drawing.Size(34, 20);
this.MT_Stat.TabIndex = 34;
this.MT_Stat.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.MT_Stat.TextChanged += new System.EventHandler(this.changeCustomConst);
//
// L_Stats
//
this.L_Stats.Location = new System.Drawing.Point(9, 36);
this.L_Stats.Name = "L_Stats";
this.L_Stats.Size = new System.Drawing.Size(72, 20);
this.L_Stats.TabIndex = 37;
this.L_Stats.Text = "Constant:";
this.L_Stats.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// B_Save
//
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_Save.Location = new System.Drawing.Point(372, 320);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(75, 23);
this.B_Save.TabIndex = 9;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// GB_Researcher
//
this.GB_Researcher.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GB_Researcher.Controls.Add(this.L_UnSet);
this.GB_Researcher.Controls.Add(this.L_IsSet);
this.GB_Researcher.Controls.Add(this.TB_NewSAV);
this.GB_Researcher.Controls.Add(this.TB_OldSAV);
this.GB_Researcher.Controls.Add(this.TB_UnSet);
this.GB_Researcher.Controls.Add(this.TB_IsSet);
this.GB_Researcher.Controls.Add(this.B_LoadNew);
this.GB_Researcher.Controls.Add(this.B_LoadOld);
this.GB_Researcher.Location = new System.Drawing.Point(12, 228);
this.GB_Researcher.Name = "GB_Researcher";
this.GB_Researcher.Size = new System.Drawing.Size(268, 120);
this.GB_Researcher.TabIndex = 13;
this.GB_Researcher.TabStop = false;
this.GB_Researcher.Text = "FlagDiff Researcher";
//
// L_UnSet
//
this.L_UnSet.Location = new System.Drawing.Point(3, 94);
this.L_UnSet.Name = "L_UnSet";
this.L_UnSet.Size = new System.Drawing.Size(51, 21);
this.L_UnSet.TabIndex = 7;
this.L_UnSet.Text = "UnSet:";
this.L_UnSet.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_IsSet
//
this.L_IsSet.Location = new System.Drawing.Point(6, 73);
this.L_IsSet.Name = "L_IsSet";
this.L_IsSet.Size = new System.Drawing.Size(48, 20);
this.L_IsSet.TabIndex = 6;
this.L_IsSet.Text = "IsSet:";
this.L_IsSet.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// TB_NewSAV
//
this.TB_NewSAV.Location = new System.Drawing.Point(93, 47);
this.TB_NewSAV.Name = "TB_NewSAV";
this.TB_NewSAV.ReadOnly = true;
this.TB_NewSAV.Size = new System.Drawing.Size(169, 20);
this.TB_NewSAV.TabIndex = 5;
this.TB_NewSAV.TextChanged += new System.EventHandler(this.changeSAV);
//
// TB_OldSAV
//
this.TB_OldSAV.Location = new System.Drawing.Point(93, 21);
this.TB_OldSAV.Name = "TB_OldSAV";
this.TB_OldSAV.ReadOnly = true;
this.TB_OldSAV.Size = new System.Drawing.Size(169, 20);
this.TB_OldSAV.TabIndex = 4;
this.TB_OldSAV.TextChanged += new System.EventHandler(this.changeSAV);
//
// TB_UnSet
//
this.TB_UnSet.Location = new System.Drawing.Point(56, 94);
this.TB_UnSet.Name = "TB_UnSet";
this.TB_UnSet.ReadOnly = true;
this.TB_UnSet.Size = new System.Drawing.Size(206, 20);
this.TB_UnSet.TabIndex = 3;
//
// TB_IsSet
//
this.TB_IsSet.Location = new System.Drawing.Point(56, 73);
this.TB_IsSet.Name = "TB_IsSet";
this.TB_IsSet.ReadOnly = true;
this.TB_IsSet.Size = new System.Drawing.Size(206, 20);
this.TB_IsSet.TabIndex = 2;
//
// B_LoadNew
//
this.B_LoadNew.Location = new System.Drawing.Point(12, 45);
this.B_LoadNew.Name = "B_LoadNew";
this.B_LoadNew.Size = new System.Drawing.Size(75, 23);
this.B_LoadNew.TabIndex = 1;
this.B_LoadNew.Text = "Load New";
this.B_LoadNew.UseVisualStyleBackColor = true;
this.B_LoadNew.Click += new System.EventHandler(this.openSAV);
//
// B_LoadOld
//
this.B_LoadOld.Location = new System.Drawing.Point(12, 19);
this.B_LoadOld.Name = "B_LoadOld";
this.B_LoadOld.Size = new System.Drawing.Size(75, 23);
this.B_LoadOld.TabIndex = 0;
this.B_LoadOld.Text = "Load Old";
this.B_LoadOld.UseVisualStyleBackColor = true;
this.B_LoadOld.Click += new System.EventHandler(this.openSAV);
//
// GB_Flags
//
this.GB_Flags.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.GB_Flags.Controls.Add(this.TLP_Flags);
this.GB_Flags.Location = new System.Drawing.Point(12, 12);
this.GB_Flags.Name = "GB_Flags";
this.GB_Flags.Size = new System.Drawing.Size(212, 210);
this.GB_Flags.TabIndex = 39;
this.GB_Flags.TabStop = false;
this.GB_Flags.Text = "Event Flags";
//
// GB_Constants
//
this.GB_Constants.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.GB_Constants.Controls.Add(this.TLP_Const);
this.GB_Constants.Location = new System.Drawing.Point(235, 12);
this.GB_Constants.Name = "GB_Constants";
this.GB_Constants.Size = new System.Drawing.Size(212, 210);
this.GB_Constants.TabIndex = 40;
this.GB_Constants.TabStop = false;
this.GB_Constants.Text = "Event Constants";
//
// TLP_Const
//
this.TLP_Const.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TLP_Const.AutoScroll = true;
this.TLP_Const.ColumnCount = 2;
this.TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.TLP_Const.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.TLP_Const.Location = new System.Drawing.Point(6, 19);
this.TLP_Const.Name = "TLP_Const";
this.TLP_Const.RowCount = 1;
this.TLP_Const.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.TLP_Const.Size = new System.Drawing.Size(200, 184);
this.TLP_Const.TabIndex = 0;
//
// TLP_Flags
//
this.TLP_Flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TLP_Flags.AutoScroll = true;
this.TLP_Flags.ColumnCount = 2;
this.TLP_Flags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.TLP_Flags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.TLP_Flags.Location = new System.Drawing.Point(6, 19);
this.TLP_Flags.Name = "TLP_Flags";
this.TLP_Flags.RowCount = 2;
this.TLP_Flags.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.TLP_Flags.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.TLP_Flags.Size = new System.Drawing.Size(200, 184);
this.TLP_Flags.TabIndex = 0;
//
// SAV_EventFlags
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(454, 351);
this.Controls.Add(this.GB_Constants);
this.Controls.Add(this.GB_Flags);
this.Controls.Add(this.GB_Researcher);
this.Controls.Add(this.GB_FlagStatus);
this.Controls.Add(this.B_Save);
this.Controls.Add(this.B_Cancel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(470, 600);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(470, 390);
this.Name = "SAV_EventFlags";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Event Flag Editor";
this.GB_FlagStatus.ResumeLayout(false);
this.GB_FlagStatus.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nud)).EndInit();
this.GB_Researcher.ResumeLayout(false);
this.GB_Researcher.PerformLayout();
this.GB_Flags.ResumeLayout(false);
this.GB_Constants.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.CheckBox c_CustomFlag;
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.GroupBox GB_FlagStatus;
private System.Windows.Forms.Label CHK_CustomFlag;
private System.Windows.Forms.NumericUpDown nud;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.GroupBox GB_Researcher;
private System.Windows.Forms.Label L_UnSet;
private System.Windows.Forms.Label L_IsSet;
private System.Windows.Forms.TextBox TB_NewSAV;
private System.Windows.Forms.TextBox TB_OldSAV;
private System.Windows.Forms.TextBox TB_UnSet;
private System.Windows.Forms.TextBox TB_IsSet;
private System.Windows.Forms.Button B_LoadNew;
private System.Windows.Forms.Button B_LoadOld;
private System.Windows.Forms.Label L_Stats;
private System.Windows.Forms.ComboBox CB_Stats;
private System.Windows.Forms.Label L_Value;
private System.Windows.Forms.MaskedTextBox MT_Stat;
private System.Windows.Forms.GroupBox GB_Flags;
private System.Windows.Forms.GroupBox GB_Constants;
private System.Windows.Forms.TableLayoutPanel TLP_Const;
private System.Windows.Forms.TableLayoutPanel TLP_Flags;
}
}

358
SAV/SAV_EventFlags.cs Normal file
View file

@ -0,0 +1,358 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
{
public partial class SAV_EventFlags : Form
{
public SAV_EventFlags()
{
InitializeComponent();
DragEnter += tabMain_DragEnter;
DragDrop += tabMain_DragDrop;
flags = SAV.EventFlags;
Constants = SAV.EventConsts;
CB_Stats.Items.Clear();
for (int i = 0; i < Constants.Length; i++)
CB_Stats.Items.Add(i.ToString());
TLP_Flags.Controls.Clear();
TLP_Const.Controls.Clear();
addFlagList(getStringList("flags"));
addConstList(getStringList("const"));
Util.TranslateInterface(this, Main.curlanguage);
CB_Stats.SelectedIndex = 0;
nud.Maximum = flags.Length - 1;
nud.Text = "0";
}
private readonly SaveFile SAV = Main.SAV.Clone();
private readonly bool[] flags;
private readonly ushort[] Constants;
private const string flagTag = "bool_";
private const string constTag = "const_";
private const string flagLabelTag = "flag_";
private const string constLabelTag = "L_";
private bool editing;
private int constEntry = -1;
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void B_Save_Click(object sender, EventArgs e)
{
// Gather Updated Flags
foreach (CheckBox flag in TLP_Flags.Controls)
flags[getControlNum(flag)] = flag.Checked;
SAV.EventFlags = flags;
// Copy back Constants
changeConstantIndex(null, null); // Trigger Saving
SAV.EventConsts = Constants;
Close();
}
private string[] getStringList(string type)
{
string[] text = null;
if (SAV.ORAS)
text = Util.getStringList($"{type}_oras");
else if (SAV.XY)
text = Util.getStringList($"{type}_xy");
return text;
}
private void addFlagList(string[] list)
{
if (list == null || list.Length == 0)
{
TLP_Flags.Controls.Add(new Label { Text = "Needs more research.", Name = "TLP_Flags_Research", ForeColor = Color.Red, AutoSize = true }, 0, 0);
return;
}
// Get list
List<int> num = new List<int>();
List<string> desc = new List<string>();
foreach (string[] split in list.Select(s => s.Split('\t')).Where(split => split.Length == 2))
{
try
{
int n = Convert.ToInt32(split[0]);
if (num.Contains(n))
continue;
num.Add(n);
desc.Add(split[1]);
} catch { }
}
if (num.Count == 0)
{
TLP_Flags.Controls.Add(new Label { Text = "Needs more research.", Name = "TLP_Flags_Research", ForeColor = Color.Red, AutoSize = true }, 0, 0);
return;
}
for (int i = 0; i < num.Count; i++)
{
var lbl = new Label
{
Text = desc[i],
Name = flagLabelTag + num[i].ToString("0000"),
Margin = Padding.Empty,
AutoSize = true
};
var chk = new CheckBox
{
Name = flagTag + num[i].ToString("0000"),
CheckAlign = ContentAlignment.MiddleLeft,
Margin = Padding.Empty,
Checked = flags[num[i]],
AutoSize = true
};
chk.CheckStateChanged += toggleFlag;
TLP_Flags.Controls.Add(chk, 0, i);
TLP_Flags.Controls.Add(lbl, 1, i);
}
}
private void addConstList(string[] list)
{
if (list == null || list.Length == 0)
{
TLP_Const.Controls.Add(new Label { Text = "Needs more research.", Name = "TLP_Const_Research", ForeColor = Color.Red, AutoSize = true }, 0, 0);
return;
}
// Get list
List<int> num = new List<int>();
List<string> desc = new List<string>();
foreach (string[] split in list.Select(s => s.Split('\t')).Where(split => split.Length == 2))
{
try
{
int n = Convert.ToInt32(split[0]);
if (num.Contains(n))
continue;
num.Add(n);
desc.Add(split[1]);
} catch { }
}
if (num.Count == 0)
{
TLP_Const.Controls.Add(new Label { Text = "Needs more research.", Name = "TLP_Const_Research", ForeColor = Color.Red, AutoSize = true }, 0, 0);
return;
}
for (int i = 0; i < num.Count; i++)
{
var lbl = new Label
{
Text = desc[i],
Name = constLabelTag + num[i].ToString("0000"),
Margin = Padding.Empty,
AutoSize = true
};
var mtb = new NumericUpDown
{
Maximum = short.MaxValue,
Minimum = short.MinValue,
Value = Constants[num[i]],
Name = constTag + num[i].ToString("0000"),
Margin = Padding.Empty,
Width = 55,
};
mtb.TextChanged += toggleConst;
TLP_Const.Controls.Add(mtb, 0, i);
TLP_Const.Controls.Add(lbl, 1, i);
}
}
private int getControlNum(Control chk)
{
try
{
string source = chk.Name;
return Convert.ToInt32(source.Substring(Math.Max(0, source.Length - 4)));
}
catch { return 0; }
}
private void changeCustomBool(object sender, EventArgs e)
{
if (editing)
return;
editing = true;
flags[(int)nud.Value] = c_CustomFlag.Checked;
CheckBox c = TLP_Flags.Controls[flagTag + nud.Value.ToString("0000")] as CheckBox;
if (c != null)
{
c.Checked = c_CustomFlag.Checked;
}
editing = false;
}
private void changeCustomFlag(object sender, EventArgs e)
{
int flag = (int)nud.Value;
if (flag >= flags.Length)
{
c_CustomFlag.Checked = false;
c_CustomFlag.Enabled = false;
nud.BackColor = Color.Red;
}
else
{
c_CustomFlag.Enabled = true;
nud.BackColor = Main.defaultControlWhite;
c_CustomFlag.Checked = flags[flag];
}
}
private void changeCustomFlag(object sender, KeyEventArgs e)
{
changeCustomFlag(null, (EventArgs)e);
}
private void toggleFlag(object sender, EventArgs e)
{
if (editing)
return;
editing = true;
int flagnum = getControlNum((CheckBox) sender);
flags[flagnum] = ((CheckBox)sender).Checked;
if (nud.Value == flagnum)
c_CustomFlag.Checked = flags[flagnum];
editing = false;
}
private void changeCustomConst(object sender, EventArgs e)
{
if (editing)
return;
editing = true;
editing = true;
Constants[CB_Stats.SelectedIndex] = (ushort)(Util.ToUInt32(((MaskedTextBox)sender).Text) & 0xFFFF);
MaskedTextBox m = TLP_Flags.Controls[constTag + CB_Stats.SelectedIndex.ToString("0000")] as MaskedTextBox;
if (m != null)
m.Text = MT_Stat.Text;
editing = false;
}
private void changeConstantIndex(object sender, EventArgs e)
{
if (constEntry > -1) // Set Entry
Constants[constEntry] = (ushort)Math.Min(Util.ToUInt32(MT_Stat.Text), 0xFFFF);
constEntry = CB_Stats.SelectedIndex; // Get Entry
MT_Stat.Text = Constants[constEntry].ToString();
}
private void toggleConst(object sender, EventArgs e)
{
if (editing)
return;
editing = true;
int constnum = getControlNum((NumericUpDown)sender);
Constants[constnum] = (ushort)(Util.ToUInt32(((NumericUpDown)sender).Text) & 0xFFFF);
if (constnum == CB_Stats.SelectedIndex)
MT_Stat.Text = Constants[constnum].ToString();
editing = false;
}
private void changeSAV(object sender, EventArgs e)
{
if (TB_NewSAV.Text.Length > 0 && TB_OldSAV.Text.Length > 0)
diffSaves();
}
private void openSAV(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
loadSAV(sender, ofd.FileName);
}
private void loadSAV(object sender, string path)
{
if (sender == B_LoadOld)
TB_OldSAV.Text = path;
else
TB_NewSAV.Text = path;
}
private void diffSaves()
{
if (!File.Exists(TB_OldSAV.Text)) { Util.Alert("Save 1 path invalid."); return; }
if (!File.Exists(TB_NewSAV.Text)) { Util.Alert("Save 2 path invalid."); return; }
if (new FileInfo(TB_OldSAV.Text).Length > 0x100000) { Util.Alert("Save 1 file invalid."); return; }
if (new FileInfo(TB_NewSAV.Text).Length > 0x100000) { Util.Alert("Save 2 file invalid."); return; }
SaveFile s1 = SaveUtil.getVariantSAV(File.ReadAllBytes(TB_OldSAV.Text));
SaveFile s2 = SaveUtil.getVariantSAV(File.ReadAllBytes(TB_NewSAV.Text));
if (s1.GetType() != s2.GetType())
{ Util.Alert("Save types are different.", $"S1: {s1.GetType()}", $"S2: {s2.GetType()}"); return; }
string tbIsSet = "";
string tbUnSet = "";
try
{
bool[] oldBits = s1.EventFlags;
bool[] newBits = s2.EventFlags;
if (oldBits.Length != newBits.Length)
{ Util.Alert("Event flag lengths for games are different.", $"S1: {(GameVersion)s1.Game}", $"S2: {(GameVersion)s2.Game}"); return; }
for (int i = 0; i < oldBits.Length; i++)
{
if (oldBits[i] == newBits[i]) continue;
if (newBits[i])
tbIsSet += i.ToString("0000") + ",";
else
tbUnSet += i.ToString("0000") + ",";
}
}
catch (Exception e)
{
Util.Error(e.ToString());
Console.Write(e);
}
TB_IsSet.Text = tbIsSet;
TB_UnSet.Text = tbUnSet;
string r = "";
try
{
ushort[] oldConst = s1.EventConsts;
ushort[] newConst = s2.EventConsts;
if (oldConst.Length != newConst.Length)
{ Util.Alert("Event flag lengths for games are different.", $"S1: {(GameVersion)s1.Game}", $"S2: {(GameVersion)s2.Game}"); return; }
for (int i = 0; i < newConst.Length; i++)
if (oldConst[i] != newConst[i])
r += $"{i}: {oldConst[i]}->{newConst[i]}{Environment.NewLine}";
}
catch (Exception e)
{
Util.Error(e.ToString());
Console.Write(e);
}
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?"))
return;
Clipboard.SetText(r);
}
private void tabMain_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void tabMain_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
loadSAV(Util.Prompt(MessageBoxButtons.YesNo, "FlagDiff Researcher:", "Yes: Old Save" + Environment.NewLine + "No: New Save") == DialogResult.Yes ? B_LoadOld : B_LoadNew, files[0]);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,261 +0,0 @@
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
{
public partial class SAV_EventFlagsORAS : Form
{
public SAV_EventFlagsORAS()
{
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
AllowDrop = true;
DragEnter += tabMain_DragEnter;
DragDrop += tabMain_DragDrop;
Setup();
nud.Text = "0"; // Prompts an update for flag 0.
MT_Ash.Text = BitConverter.ToUInt16(Main.SAV.Data, Main.SAV.EventAsh).ToString();
}
private bool setup = true;
private CheckBox[] chka;
private readonly bool[] flags = new bool[3072];
private readonly ushort[] Constants = new ushort[(Main.SAV.EventFlag - Main.SAV.EventConst) / 2];
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void B_Save_Click(object sender, EventArgs e)
{
// Gather Updated Flags
foreach (CheckBox flag in chka)
flags[getFlagNum(flag)] = flag.Checked;
byte[] data = new byte[flags.Length / 8];
for (int i = 0; i < flags.Length; i++)
if (flags[i])
data[i / 8] |= (byte)(1 << i % 8);
Array.Copy(data, 0, Main.SAV.Data, Main.SAV.EventFlag, 0x180);
// Copy back Constants
changeConstantIndex(null, null); // Trigger Saving
for (int i = 0; i < Constants.Length; i++)
Array.Copy(BitConverter.GetBytes(Constants[i]), 0, Main.SAV.Data, Main.SAV.EventConst + 2 * i, 2);
// Copy back Volcanic Ash counter
Array.Copy(BitConverter.GetBytes(Util.ToUInt32(MT_Ash.Text)), 0, Main.SAV.Data, Main.SAV.EventAsh, 2);
Close();
}
private void Setup()
{
// Fill Bit arrays
chka = new[] {
flag_0173,flag_2811, // Raikou
flag_0174,flag_2812, // Entei
flag_0175,flag_2813, // Suicune
flag_0209,flag_2814, // Lugia
flag_0208,flag_2815, // Ho-Oh
flag_0179,flag_2816, // Uxie
flag_0180,flag_2817, // Mesprit
flag_0181,flag_2818, // Azelf
flag_2819, // Dialga
flag_2820, // Palkia
flag_0260,flag_2821, // Heatran
flag_0252,flag_2822, // Regigigas
flag_2823, // Giratina
flag_0172,flag_2824, // Cresselia
flag_0176,flag_2825, // Cobalion
flag_0177,flag_2826, // Terrakion
flag_0178,flag_2827, // Virizion
flag_2828, // Tornadus
flag_2829, // Thundurus
flag_0182,flag_2830, // Reshiram
flag_0183,flag_2831, // Zekrom
flag_2832, // Landorus
flag_0184,flag_2833, // Kyurem
flag_0419,flag_2834, // Latios
flag_0420,flag_2835, // Latias
flag_0956,flag_2836, // Regirock
flag_0957,flag_2837, // Regice
flag_0958,flag_2838, // Registeel
flag_0648,flag_2839, // Groudon
flag_0647,flag_2840, // Kyogre
// ??????
flag_0945,flag_2842, // Deoxys
// Cresselia, Regigigas
// Terrakion, Virizion
// Maison
flag_0284,flag_0285,flag_0286,flag_0287,flag_0288, // Statuettes
flag_0289,flag_0290,flag_0291,flag_0292,flag_0293, // Super Unlocks
//flag_0675, // Chatelaine 50
//flag_2546, // Pokedex
};
byte[] data = new byte[0x180];
Array.Copy(Main.SAV.Data, Main.SAV.EventFlag, data, 0, 0x180);
BitArray BitRegion = new BitArray(data);
BitRegion.CopyTo(flags, 0);
// Setup Event Constant Editor
CB_Stats.Items.Clear();
for (int i = 0; i < Constants.Length; i += 2)
{
CB_Stats.Items.Add($"0x{(i/2).ToString("X2")}");
Constants[i / 2] = BitConverter.ToUInt16(Main.SAV.Data, Main.SAV.EventConst + i);
}
CB_Stats.SelectedIndex = 0;
// Populate Flags
setup = true;
popFlags();
}
private void popFlags()
{
if (!setup) return;
foreach (CheckBox flag in chka)
flag.Checked = flags[getFlagNum(flag)];
changeCustomFlag(null, null);
}
private int getFlagNum(CheckBox chk)
{
try
{
string source = chk.Name;
return Convert.ToInt32(source.Substring(Math.Max(0, source.Length - 4)));
}
catch { return 0; }
}
private void changeCustomBool(object sender, EventArgs e)
{
flags[(int)nud.Value] = CHK_CustomFlag.Checked;
popFlags();
}
private void changeCustomFlag(object sender, EventArgs e)
{
int flag = (int)nud.Value;
if (flag >= 3072)
{
CHK_CustomFlag.Checked = false;
CHK_CustomFlag.Enabled = false;
nud.BackColor = Color.Red;
}
else
{
CHK_CustomFlag.Enabled = true;
nud.BackColor = Main.defaultControlWhite;
CHK_CustomFlag.Checked = flags[flag];
}
}
private void changeCustomFlag(object sender, KeyEventArgs e)
{
changeCustomFlag(null, (EventArgs)e);
}
private void toggleFlag(object sender, EventArgs e)
{
flags[getFlagNum((CheckBox)sender)] = ((CheckBox)sender).Checked;
changeCustomFlag(sender, e);
}
private void changeSAV(object sender, EventArgs e)
{
if (TB_NewSAV.Text.Length > 0 && TB_OldSAV.Text.Length > 0)
diffSaves();
}
private void diffSaves()
{
BitArray oldBits = new BitArray(oldFlags);
BitArray newBits = new BitArray(newFlags);
string tbIsSet = "";
string tbUnSet = "";
for (int i = 0; i < oldBits.Length; i++)
{
if (oldBits[i] == newBits[i]) continue;
if (newBits[i])
tbIsSet += i.ToString("0000") + ",";
else
tbUnSet += i.ToString("0000") + ",";
}
TB_IsSet.Text = tbIsSet;
TB_UnSet.Text = tbUnSet;
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?"))
return;
string r = "";
for (int i = 0; i < newConst.Length; i += 2)
{
ushort oldval = BitConverter.ToUInt16(oldConst, i);
ushort newval = BitConverter.ToUInt16(oldConst, i);
if (oldval != newval)
r += $"0x{(i/2).ToString("X2")}: {oldval}->{newval}{Environment.NewLine}";
}
Clipboard.SetText(r);
}
private byte[] oldFlags = new byte[0x180];
private byte[] newFlags = new byte[0x180];
private byte[] oldConst = new byte[Main.SAV.EventFlag - Main.SAV.EventConst];
private byte[] newConst = new byte[Main.SAV.EventFlag - Main.SAV.EventConst];
private void openSAV(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
loadSAV(sender, ofd.FileName);
}
private void loadSAV(object sender, string path)
{
FileInfo fi = new FileInfo(path);
if (fi.Length != SAV6.SIZE_ORAS)
{
Util.Error("Invalid SAV Size", string.Format("File Size: 0x{1} ({0} bytes)", fi.Length, fi.Length.ToString("X5")), "File Loaded: " + path);
return;
}
byte[] data = File.ReadAllBytes(path);
if (sender == B_LoadOld)
{
oldFlags = data.Skip(Main.SAV.EventFlag).Take(0x180).ToArray();
oldConst = data.Skip(Main.SAV.EventConst).Take(Constants.Length * 2).ToArray();
TB_OldSAV.Text = path;
}
else
{
newFlags = data.Skip(Main.SAV.EventFlag).Take(0x180).ToArray();
newConst = data.Skip(Main.SAV.EventConst).Take(Constants.Length * 2).ToArray();
TB_NewSAV.Text = path;
}
}
private int entry = -1;
private void changeConstantIndex(object sender, EventArgs e)
{
if (entry > -1) // Set Entry
Constants[entry] = (ushort)Math.Min(Util.ToUInt32(MT_Stat.Text), 0xFFFF);
entry = CB_Stats.SelectedIndex; // Get Entry
MT_Stat.Text = Constants[entry].ToString();
}
private void tabMain_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void tabMain_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
loadSAV(Util.Prompt(MessageBoxButtons.YesNo, "FlagDiff Researcher:", "Yes: Old Save" + Environment.NewLine + "No: New Save") == DialogResult.Yes ? B_LoadOld : B_LoadNew, files[0]);
}
}
}

View file

@ -1,701 +0,0 @@
namespace PKHeX
{
partial class SAV_EventFlagsXY
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_EventFlagsXY));
this.CHK_CustomFlag = new System.Windows.Forms.CheckBox();
this.B_Cancel = new System.Windows.Forms.Button();
this.GB_FlagStatus = new System.Windows.Forms.GroupBox();
this.nud = new System.Windows.Forms.NumericUpDown();
this.L_Flag = new System.Windows.Forms.Label();
this.flag_0001 = new System.Windows.Forms.CheckBox();
this.flag_0002 = new System.Windows.Forms.CheckBox();
this.flag_0003 = new System.Windows.Forms.CheckBox();
this.flag_0004 = new System.Windows.Forms.CheckBox();
this.flag_0005 = new System.Windows.Forms.CheckBox();
this.B_Save = new System.Windows.Forms.Button();
this.flag_2237 = new System.Windows.Forms.CheckBox();
this.flag_2238 = new System.Windows.Forms.CheckBox();
this.flag_2239 = new System.Windows.Forms.CheckBox();
this.GB_Researcher = new System.Windows.Forms.GroupBox();
this.L_UnSet = new System.Windows.Forms.Label();
this.L_IsSet = new System.Windows.Forms.Label();
this.TB_NewSAV = new System.Windows.Forms.TextBox();
this.TB_OldSAV = new System.Windows.Forms.TextBox();
this.TB_UnSet = new System.Windows.Forms.TextBox();
this.TB_IsSet = new System.Windows.Forms.TextBox();
this.B_LoadNew = new System.Windows.Forms.Button();
this.B_LoadOld = new System.Windows.Forms.Button();
this.flag_0963 = new System.Windows.Forms.CheckBox();
this.flag_0115 = new System.Windows.Forms.CheckBox();
this.GB_Rebattle = new System.Windows.Forms.GroupBox();
this.flag_0114 = new System.Windows.Forms.CheckBox();
this.flag_0790 = new System.Windows.Forms.CheckBox();
this.GB_Misc = new System.Windows.Forms.GroupBox();
this.flag_0289 = new System.Windows.Forms.CheckBox();
this.flag_0288 = new System.Windows.Forms.CheckBox();
this.flag_0287 = new System.Windows.Forms.CheckBox();
this.flag_0294 = new System.Windows.Forms.CheckBox();
this.flag_0293 = new System.Windows.Forms.CheckBox();
this.flag_0292 = new System.Windows.Forms.CheckBox();
this.flag_0291 = new System.Windows.Forms.CheckBox();
this.flag_0290 = new System.Windows.Forms.CheckBox();
this.flag_0675 = new System.Windows.Forms.CheckBox();
this.flag_0286 = new System.Windows.Forms.CheckBox();
this.flag_0285 = new System.Windows.Forms.CheckBox();
this.flag_2546 = new System.Windows.Forms.CheckBox();
this.L_Stats = new System.Windows.Forms.Label();
this.CB_Stats = new System.Windows.Forms.ComboBox();
this.L_Value = new System.Windows.Forms.Label();
this.MT_Stat = new System.Windows.Forms.MaskedTextBox();
this.GB_FlagStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nud)).BeginInit();
this.GB_Researcher.SuspendLayout();
this.GB_Rebattle.SuspendLayout();
this.GB_Misc.SuspendLayout();
this.SuspendLayout();
//
// CHK_CustomFlag
//
this.CHK_CustomFlag.AutoSize = true;
this.CHK_CustomFlag.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.CHK_CustomFlag.Enabled = false;
this.CHK_CustomFlag.Location = new System.Drawing.Point(12, 44);
this.CHK_CustomFlag.Name = "CHK_CustomFlag";
this.CHK_CustomFlag.Size = new System.Drawing.Size(59, 17);
this.CHK_CustomFlag.TabIndex = 1;
this.CHK_CustomFlag.Text = "Status:";
this.CHK_CustomFlag.UseVisualStyleBackColor = true;
this.CHK_CustomFlag.CheckedChanged += new System.EventHandler(this.changeCustomBool);
//
// B_Cancel
//
this.B_Cancel.Location = new System.Drawing.Point(287, 307);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(75, 23);
this.B_Cancel.TabIndex = 2;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// GB_FlagStatus
//
this.GB_FlagStatus.Controls.Add(this.nud);
this.GB_FlagStatus.Controls.Add(this.L_Flag);
this.GB_FlagStatus.Controls.Add(this.CHK_CustomFlag);
this.GB_FlagStatus.Location = new System.Drawing.Point(14, 135);
this.GB_FlagStatus.Name = "GB_FlagStatus";
this.GB_FlagStatus.Size = new System.Drawing.Size(108, 68);
this.GB_FlagStatus.TabIndex = 3;
this.GB_FlagStatus.TabStop = false;
this.GB_FlagStatus.Text = "Check Flag Status";
//
// nud
//
this.nud.Location = new System.Drawing.Point(56, 19);
this.nud.Maximum = new decimal(new int[] {
3072,
0,
0,
0});
this.nud.Name = "nud";
this.nud.Size = new System.Drawing.Size(45, 20);
this.nud.TabIndex = 9;
this.nud.Value = new decimal(new int[] {
3071,
0,
0,
0});
this.nud.ValueChanged += new System.EventHandler(this.changeCustomFlag);
this.nud.KeyUp += new System.Windows.Forms.KeyEventHandler(this.changeCustomFlag);
//
// L_Flag
//
this.L_Flag.AutoSize = true;
this.L_Flag.Location = new System.Drawing.Point(13, 21);
this.L_Flag.Name = "L_Flag";
this.L_Flag.Size = new System.Drawing.Size(30, 13);
this.L_Flag.TabIndex = 2;
this.L_Flag.Text = "Flag:";
//
// flag_0001
//
this.flag_0001.AutoSize = true;
this.flag_0001.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.flag_0001.Location = new System.Drawing.Point(12, 12);
this.flag_0001.Name = "flag_0001";
this.flag_0001.Size = new System.Drawing.Size(52, 17);
this.flag_0001.TabIndex = 4;
this.flag_0001.Text = "Flag1";
this.flag_0001.UseVisualStyleBackColor = true;
this.flag_0001.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0002
//
this.flag_0002.AutoSize = true;
this.flag_0002.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.flag_0002.Location = new System.Drawing.Point(12, 28);
this.flag_0002.Name = "flag_0002";
this.flag_0002.Size = new System.Drawing.Size(52, 17);
this.flag_0002.TabIndex = 5;
this.flag_0002.Text = "Flag2";
this.flag_0002.UseVisualStyleBackColor = true;
this.flag_0002.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0003
//
this.flag_0003.AutoSize = true;
this.flag_0003.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.flag_0003.Location = new System.Drawing.Point(12, 44);
this.flag_0003.Name = "flag_0003";
this.flag_0003.Size = new System.Drawing.Size(52, 17);
this.flag_0003.TabIndex = 6;
this.flag_0003.Text = "Flag3";
this.flag_0003.UseVisualStyleBackColor = true;
this.flag_0003.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0004
//
this.flag_0004.AutoSize = true;
this.flag_0004.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.flag_0004.Location = new System.Drawing.Point(12, 60);
this.flag_0004.Name = "flag_0004";
this.flag_0004.Size = new System.Drawing.Size(52, 17);
this.flag_0004.TabIndex = 7;
this.flag_0004.Text = "Flag4";
this.flag_0004.UseVisualStyleBackColor = true;
this.flag_0004.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0005
//
this.flag_0005.AutoSize = true;
this.flag_0005.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.flag_0005.Location = new System.Drawing.Point(12, 76);
this.flag_0005.Name = "flag_0005";
this.flag_0005.Size = new System.Drawing.Size(52, 17);
this.flag_0005.TabIndex = 8;
this.flag_0005.Text = "Flag5";
this.flag_0005.UseVisualStyleBackColor = true;
this.flag_0005.Click += new System.EventHandler(this.toggleFlag);
//
// B_Save
//
this.B_Save.Location = new System.Drawing.Point(366, 306);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(75, 23);
this.B_Save.TabIndex = 9;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// flag_2237
//
this.flag_2237.AutoSize = true;
this.flag_2237.Location = new System.Drawing.Point(72, 12);
this.flag_2237.Name = "flag_2237";
this.flag_2237.Size = new System.Drawing.Size(50, 17);
this.flag_2237.TabIndex = 10;
this.flag_2237.Text = "2237";
this.flag_2237.UseVisualStyleBackColor = true;
this.flag_2237.Click += new System.EventHandler(this.toggleFlag);
//
// flag_2238
//
this.flag_2238.AutoSize = true;
this.flag_2238.Location = new System.Drawing.Point(72, 28);
this.flag_2238.Name = "flag_2238";
this.flag_2238.Size = new System.Drawing.Size(50, 17);
this.flag_2238.TabIndex = 11;
this.flag_2238.Text = "2238";
this.flag_2238.UseVisualStyleBackColor = true;
this.flag_2238.Click += new System.EventHandler(this.toggleFlag);
//
// flag_2239
//
this.flag_2239.AutoSize = true;
this.flag_2239.Location = new System.Drawing.Point(72, 44);
this.flag_2239.Name = "flag_2239";
this.flag_2239.Size = new System.Drawing.Size(50, 17);
this.flag_2239.TabIndex = 12;
this.flag_2239.Text = "2239";
this.flag_2239.UseVisualStyleBackColor = true;
this.flag_2239.Click += new System.EventHandler(this.toggleFlag);
//
// GB_Researcher
//
this.GB_Researcher.Controls.Add(this.L_UnSet);
this.GB_Researcher.Controls.Add(this.L_IsSet);
this.GB_Researcher.Controls.Add(this.TB_NewSAV);
this.GB_Researcher.Controls.Add(this.TB_OldSAV);
this.GB_Researcher.Controls.Add(this.TB_UnSet);
this.GB_Researcher.Controls.Add(this.TB_IsSet);
this.GB_Researcher.Controls.Add(this.B_LoadNew);
this.GB_Researcher.Controls.Add(this.B_LoadOld);
this.GB_Researcher.Location = new System.Drawing.Point(14, 210);
this.GB_Researcher.Name = "GB_Researcher";
this.GB_Researcher.Size = new System.Drawing.Size(268, 120);
this.GB_Researcher.TabIndex = 13;
this.GB_Researcher.TabStop = false;
this.GB_Researcher.Text = "FlagDiff Researcher";
//
// L_UnSet
//
this.L_UnSet.AutoSize = true;
this.L_UnSet.Location = new System.Drawing.Point(10, 97);
this.L_UnSet.Name = "L_UnSet";
this.L_UnSet.Size = new System.Drawing.Size(37, 13);
this.L_UnSet.TabIndex = 7;
this.L_UnSet.Text = "UnSet";
//
// L_IsSet
//
this.L_IsSet.AutoSize = true;
this.L_IsSet.Location = new System.Drawing.Point(12, 77);
this.L_IsSet.Name = "L_IsSet";
this.L_IsSet.Size = new System.Drawing.Size(31, 13);
this.L_IsSet.TabIndex = 6;
this.L_IsSet.Text = "IsSet";
//
// TB_NewSAV
//
this.TB_NewSAV.Location = new System.Drawing.Point(93, 47);
this.TB_NewSAV.Name = "TB_NewSAV";
this.TB_NewSAV.ReadOnly = true;
this.TB_NewSAV.Size = new System.Drawing.Size(169, 20);
this.TB_NewSAV.TabIndex = 5;
this.TB_NewSAV.TextChanged += new System.EventHandler(this.changeSAV);
//
// TB_OldSAV
//
this.TB_OldSAV.Location = new System.Drawing.Point(93, 21);
this.TB_OldSAV.Name = "TB_OldSAV";
this.TB_OldSAV.ReadOnly = true;
this.TB_OldSAV.Size = new System.Drawing.Size(169, 20);
this.TB_OldSAV.TabIndex = 4;
this.TB_OldSAV.TextChanged += new System.EventHandler(this.changeSAV);
//
// TB_UnSet
//
this.TB_UnSet.Location = new System.Drawing.Point(56, 94);
this.TB_UnSet.Name = "TB_UnSet";
this.TB_UnSet.ReadOnly = true;
this.TB_UnSet.Size = new System.Drawing.Size(206, 20);
this.TB_UnSet.TabIndex = 3;
//
// TB_IsSet
//
this.TB_IsSet.Location = new System.Drawing.Point(56, 74);
this.TB_IsSet.Name = "TB_IsSet";
this.TB_IsSet.ReadOnly = true;
this.TB_IsSet.Size = new System.Drawing.Size(206, 20);
this.TB_IsSet.TabIndex = 2;
//
// B_LoadNew
//
this.B_LoadNew.Location = new System.Drawing.Point(12, 45);
this.B_LoadNew.Name = "B_LoadNew";
this.B_LoadNew.Size = new System.Drawing.Size(75, 23);
this.B_LoadNew.TabIndex = 1;
this.B_LoadNew.Text = "Load New";
this.B_LoadNew.UseVisualStyleBackColor = true;
this.B_LoadNew.Click += new System.EventHandler(this.openSAV);
//
// B_LoadOld
//
this.B_LoadOld.Location = new System.Drawing.Point(12, 19);
this.B_LoadOld.Name = "B_LoadOld";
this.B_LoadOld.Size = new System.Drawing.Size(75, 23);
this.B_LoadOld.TabIndex = 0;
this.B_LoadOld.Text = "Load Old";
this.B_LoadOld.UseVisualStyleBackColor = true;
this.B_LoadOld.Click += new System.EventHandler(this.openSAV);
//
// flag_0963
//
this.flag_0963.AutoSize = true;
this.flag_0963.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0963.Location = new System.Drawing.Point(16, 19);
this.flag_0963.Name = "flag_0963";
this.flag_0963.Size = new System.Drawing.Size(113, 17);
this.flag_0963.TabIndex = 14;
this.flag_0963.Text = "Mewtwo Defeated";
this.flag_0963.UseVisualStyleBackColor = true;
this.flag_0963.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0115
//
this.flag_0115.AutoSize = true;
this.flag_0115.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0115.Location = new System.Drawing.Point(16, 34);
this.flag_0115.Name = "flag_0115";
this.flag_0115.Size = new System.Drawing.Size(112, 17);
this.flag_0115.TabIndex = 15;
this.flag_0115.Text = "Mewtwo Captured";
this.flag_0115.UseVisualStyleBackColor = true;
this.flag_0115.Click += new System.EventHandler(this.toggleFlag);
//
// GB_Rebattle
//
this.GB_Rebattle.Controls.Add(this.flag_0114);
this.GB_Rebattle.Controls.Add(this.flag_0790);
this.GB_Rebattle.Controls.Add(this.flag_0115);
this.GB_Rebattle.Controls.Add(this.flag_0963);
this.GB_Rebattle.Location = new System.Drawing.Point(129, 12);
this.GB_Rebattle.Name = "GB_Rebattle";
this.GB_Rebattle.Size = new System.Drawing.Size(152, 191);
this.GB_Rebattle.TabIndex = 16;
this.GB_Rebattle.TabStop = false;
this.GB_Rebattle.Text = "Rebattle";
//
// flag_0114
//
this.flag_0114.AutoSize = true;
this.flag_0114.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0114.Location = new System.Drawing.Point(16, 72);
this.flag_0114.Name = "flag_0114";
this.flag_0114.Size = new System.Drawing.Size(111, 17);
this.flag_0114.TabIndex = 17;
this.flag_0114.Text = "Zygarde Captured";
this.flag_0114.UseVisualStyleBackColor = true;
this.flag_0114.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0790
//
this.flag_0790.AutoSize = true;
this.flag_0790.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0790.Location = new System.Drawing.Point(16, 57);
this.flag_0790.Name = "flag_0790";
this.flag_0790.Size = new System.Drawing.Size(112, 17);
this.flag_0790.TabIndex = 16;
this.flag_0790.Text = "Zygarde Defeated";
this.flag_0790.UseVisualStyleBackColor = true;
this.flag_0790.Click += new System.EventHandler(this.toggleFlag);
//
// GB_Misc
//
this.GB_Misc.Controls.Add(this.flag_0289);
this.GB_Misc.Controls.Add(this.flag_0288);
this.GB_Misc.Controls.Add(this.flag_0287);
this.GB_Misc.Controls.Add(this.flag_0294);
this.GB_Misc.Controls.Add(this.flag_0293);
this.GB_Misc.Controls.Add(this.flag_0292);
this.GB_Misc.Controls.Add(this.flag_0291);
this.GB_Misc.Controls.Add(this.flag_0290);
this.GB_Misc.Controls.Add(this.flag_0675);
this.GB_Misc.Controls.Add(this.flag_0286);
this.GB_Misc.Controls.Add(this.flag_0285);
this.GB_Misc.Location = new System.Drawing.Point(287, 12);
this.GB_Misc.Name = "GB_Misc";
this.GB_Misc.Size = new System.Drawing.Size(154, 215);
this.GB_Misc.TabIndex = 17;
this.GB_Misc.TabStop = false;
this.GB_Misc.Text = "Misc";
//
// flag_0289
//
this.flag_0289.AutoSize = true;
this.flag_0289.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0289.Location = new System.Drawing.Point(6, 79);
this.flag_0289.Name = "flag_0289";
this.flag_0289.Size = new System.Drawing.Size(94, 17);
this.flag_0289.TabIndex = 25;
this.flag_0289.Text = "Multi Statuette";
this.flag_0289.UseVisualStyleBackColor = true;
this.flag_0289.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0288
//
this.flag_0288.AutoSize = true;
this.flag_0288.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0288.Location = new System.Drawing.Point(6, 64);
this.flag_0288.Name = "flag_0288";
this.flag_0288.Size = new System.Drawing.Size(112, 17);
this.flag_0288.TabIndex = 24;
this.flag_0288.Text = "Rotation Statuette";
this.flag_0288.UseVisualStyleBackColor = true;
this.flag_0288.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0287
//
this.flag_0287.AutoSize = true;
this.flag_0287.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0287.Location = new System.Drawing.Point(6, 49);
this.flag_0287.Name = "flag_0287";
this.flag_0287.Size = new System.Drawing.Size(103, 17);
this.flag_0287.TabIndex = 23;
this.flag_0287.Text = "Triples Statuette";
this.flag_0287.UseVisualStyleBackColor = true;
this.flag_0287.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0294
//
this.flag_0294.AutoSize = true;
this.flag_0294.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0294.Location = new System.Drawing.Point(6, 159);
this.flag_0294.Name = "flag_0294";
this.flag_0294.Size = new System.Drawing.Size(128, 17);
this.flag_0294.TabIndex = 22;
this.flag_0294.Text = "Super Multi Unlocked";
this.flag_0294.UseVisualStyleBackColor = true;
this.flag_0294.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0293
//
this.flag_0293.AutoSize = true;
this.flag_0293.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0293.Location = new System.Drawing.Point(6, 144);
this.flag_0293.Name = "flag_0293";
this.flag_0293.Size = new System.Drawing.Size(146, 17);
this.flag_0293.TabIndex = 21;
this.flag_0293.Text = "Super Rotation Unlocked";
this.flag_0293.UseVisualStyleBackColor = true;
this.flag_0293.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0292
//
this.flag_0292.AutoSize = true;
this.flag_0292.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0292.Location = new System.Drawing.Point(6, 129);
this.flag_0292.Name = "flag_0292";
this.flag_0292.Size = new System.Drawing.Size(137, 17);
this.flag_0292.TabIndex = 20;
this.flag_0292.Text = "Super Triples Unlocked";
this.flag_0292.UseVisualStyleBackColor = true;
this.flag_0292.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0291
//
this.flag_0291.AutoSize = true;
this.flag_0291.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0291.Location = new System.Drawing.Point(6, 114);
this.flag_0291.Name = "flag_0291";
this.flag_0291.Size = new System.Drawing.Size(145, 17);
this.flag_0291.TabIndex = 19;
this.flag_0291.Text = "Super Doubles Unlocked";
this.flag_0291.UseVisualStyleBackColor = true;
this.flag_0291.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0290
//
this.flag_0290.AutoSize = true;
this.flag_0290.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0290.Location = new System.Drawing.Point(6, 99);
this.flag_0290.Name = "flag_0290";
this.flag_0290.Size = new System.Drawing.Size(140, 17);
this.flag_0290.TabIndex = 18;
this.flag_0290.Text = "Super Singles Unlocked";
this.flag_0290.UseVisualStyleBackColor = true;
this.flag_0290.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0675
//
this.flag_0675.AutoSize = true;
this.flag_0675.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0675.Location = new System.Drawing.Point(6, 182);
this.flag_0675.Name = "flag_0675";
this.flag_0675.Size = new System.Drawing.Size(119, 17);
this.flag_0675.TabIndex = 17;
this.flag_0675.Text = "50: Beat Chatelaine";
this.flag_0675.UseVisualStyleBackColor = true;
this.flag_0675.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0286
//
this.flag_0286.AutoSize = true;
this.flag_0286.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0286.Location = new System.Drawing.Point(6, 34);
this.flag_0286.Name = "flag_0286";
this.flag_0286.Size = new System.Drawing.Size(111, 17);
this.flag_0286.TabIndex = 16;
this.flag_0286.Text = "Doubles Statuette";
this.flag_0286.UseVisualStyleBackColor = true;
this.flag_0286.Click += new System.EventHandler(this.toggleFlag);
//
// flag_0285
//
this.flag_0285.AutoSize = true;
this.flag_0285.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.flag_0285.Location = new System.Drawing.Point(6, 19);
this.flag_0285.Name = "flag_0285";
this.flag_0285.Size = new System.Drawing.Size(106, 17);
this.flag_0285.TabIndex = 15;
this.flag_0285.Text = "Singles Statuette";
this.flag_0285.UseVisualStyleBackColor = true;
this.flag_0285.Click += new System.EventHandler(this.toggleFlag);
//
// flag_2546
//
this.flag_2546.AutoSize = true;
this.flag_2546.Location = new System.Drawing.Point(13, 112);
this.flag_2546.Name = "flag_2546";
this.flag_2546.Size = new System.Drawing.Size(114, 17);
this.flag_2546.TabIndex = 18;
this.flag_2546.Text = "Pokédex Obtained";
this.flag_2546.UseVisualStyleBackColor = true;
this.flag_2546.Click += new System.EventHandler(this.toggleFlag);
//
// L_Stats
//
this.L_Stats.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.L_Stats.AutoSize = true;
this.L_Stats.Location = new System.Drawing.Point(290, 230);
this.L_Stats.Name = "L_Stats";
this.L_Stats.Size = new System.Drawing.Size(85, 13);
this.L_Stats.TabIndex = 32;
this.L_Stats.Text = "Event Constants";
//
// CB_Stats
//
this.CB_Stats.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CB_Stats.DropDownHeight = 156;
this.CB_Stats.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_Stats.DropDownWidth = 180;
this.CB_Stats.FormattingEnabled = true;
this.CB_Stats.IntegralHeight = false;
this.CB_Stats.Location = new System.Drawing.Point(293, 246);
this.CB_Stats.Name = "CB_Stats";
this.CB_Stats.Size = new System.Drawing.Size(94, 21);
this.CB_Stats.TabIndex = 31;
this.CB_Stats.SelectedIndexChanged += new System.EventHandler(this.changeConstantIndex);
//
// L_Value
//
this.L_Value.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.L_Value.AutoSize = true;
this.L_Value.Location = new System.Drawing.Point(290, 270);
this.L_Value.Name = "L_Value";
this.L_Value.Size = new System.Drawing.Size(34, 13);
this.L_Value.TabIndex = 30;
this.L_Value.Text = "Value";
//
// MT_Stat
//
this.MT_Stat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.MT_Stat.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MT_Stat.Location = new System.Drawing.Point(349, 270);
this.MT_Stat.Mask = "00000";
this.MT_Stat.Name = "MT_Stat";
this.MT_Stat.Size = new System.Drawing.Size(38, 20);
this.MT_Stat.TabIndex = 29;
this.MT_Stat.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// SAV_EventFlagsXY
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(449, 342);
this.Controls.Add(this.L_Stats);
this.Controls.Add(this.CB_Stats);
this.Controls.Add(this.L_Value);
this.Controls.Add(this.MT_Stat);
this.Controls.Add(this.flag_2546);
this.Controls.Add(this.GB_Misc);
this.Controls.Add(this.GB_Rebattle);
this.Controls.Add(this.GB_Researcher);
this.Controls.Add(this.flag_2239);
this.Controls.Add(this.flag_2238);
this.Controls.Add(this.flag_2237);
this.Controls.Add(this.B_Save);
this.Controls.Add(this.flag_0005);
this.Controls.Add(this.flag_0004);
this.Controls.Add(this.flag_0003);
this.Controls.Add(this.flag_0002);
this.Controls.Add(this.flag_0001);
this.Controls.Add(this.GB_FlagStatus);
this.Controls.Add(this.B_Cancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SAV_EventFlagsXY";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Event Flag Editor";
this.GB_FlagStatus.ResumeLayout(false);
this.GB_FlagStatus.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nud)).EndInit();
this.GB_Researcher.ResumeLayout(false);
this.GB_Researcher.PerformLayout();
this.GB_Rebattle.ResumeLayout(false);
this.GB_Rebattle.PerformLayout();
this.GB_Misc.ResumeLayout(false);
this.GB_Misc.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox CHK_CustomFlag;
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.GroupBox GB_FlagStatus;
private System.Windows.Forms.Label L_Flag;
private System.Windows.Forms.CheckBox flag_0001;
private System.Windows.Forms.CheckBox flag_0002;
private System.Windows.Forms.CheckBox flag_0003;
private System.Windows.Forms.CheckBox flag_0004;
private System.Windows.Forms.CheckBox flag_0005;
private System.Windows.Forms.NumericUpDown nud;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.CheckBox flag_2237;
private System.Windows.Forms.CheckBox flag_2238;
private System.Windows.Forms.CheckBox flag_2239;
private System.Windows.Forms.GroupBox GB_Researcher;
private System.Windows.Forms.Label L_UnSet;
private System.Windows.Forms.Label L_IsSet;
private System.Windows.Forms.TextBox TB_NewSAV;
private System.Windows.Forms.TextBox TB_OldSAV;
private System.Windows.Forms.TextBox TB_UnSet;
private System.Windows.Forms.TextBox TB_IsSet;
private System.Windows.Forms.Button B_LoadNew;
private System.Windows.Forms.Button B_LoadOld;
private System.Windows.Forms.CheckBox flag_0963;
private System.Windows.Forms.CheckBox flag_0115;
private System.Windows.Forms.GroupBox GB_Rebattle;
private System.Windows.Forms.CheckBox flag_0114;
private System.Windows.Forms.CheckBox flag_0790;
private System.Windows.Forms.GroupBox GB_Misc;
private System.Windows.Forms.CheckBox flag_0289;
private System.Windows.Forms.CheckBox flag_0288;
private System.Windows.Forms.CheckBox flag_0287;
private System.Windows.Forms.CheckBox flag_0294;
private System.Windows.Forms.CheckBox flag_0293;
private System.Windows.Forms.CheckBox flag_0292;
private System.Windows.Forms.CheckBox flag_0291;
private System.Windows.Forms.CheckBox flag_0290;
private System.Windows.Forms.CheckBox flag_0675;
private System.Windows.Forms.CheckBox flag_0286;
private System.Windows.Forms.CheckBox flag_0285;
private System.Windows.Forms.CheckBox flag_2546;
private System.Windows.Forms.Label L_Stats;
private System.Windows.Forms.ComboBox CB_Stats;
private System.Windows.Forms.Label L_Value;
private System.Windows.Forms.MaskedTextBox MT_Stat;
}
}

View file

@ -1,230 +0,0 @@
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
{
public partial class SAV_EventFlagsXY : Form
{
public SAV_EventFlagsXY()
{
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
AllowDrop = true;
DragEnter += tabMain_DragEnter;
DragDrop += tabMain_DragDrop;
Setup();
nud.Text = "0"; // Prompts an update for flag 0.
// No Volcanic Ash in X/Y
}
private bool setup = true;
private CheckBox[] chka;
private readonly bool[] flags = new bool[3072];
private readonly ushort[] Constants = new ushort[(Main.SAV.EventFlag - Main.SAV.EventConst) / 2];
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void B_Save_Click(object sender, EventArgs e)
{
// Gather Updated Flags
foreach (CheckBox flag in chka)
flags[getFlagNum(flag)] = flag.Checked;
byte[] data = new byte[flags.Length / 8];
for (int i = 0; i < flags.Length; i++)
if (flags[i])
data[i / 8] |= (byte)(1 << i % 8);
Array.Copy(data, 0, Main.SAV.Data, Main.SAV.EventFlag, 0x180);
// No Volcanic Ash in X/Y
// Copy back Constants
changeConstantIndex(null, null); // Trigger Saving
for (int i = 0; i < Constants.Length; i++)
Array.Copy(BitConverter.GetBytes(Constants[i]), 0, Main.SAV.Data, Main.SAV.EventConst + 2 * i, 2);
Close();
}
private void Setup()
{
// Fill Bit arrays
chka = new[] {
flag_0001,flag_0002,flag_0003,flag_0004,flag_0005,
flag_2237,flag_2238,flag_2239,
flag_0115,flag_0963, // Mewtwo
flag_0114,flag_0790, // Zygarde
flag_0285,flag_0286,flag_0287,flag_0288,flag_0289, // Statuettes
flag_0290,flag_0291,flag_0292,flag_0293,flag_0294, // Super Unlocks
flag_0675, // Chatelaine 50
flag_2546, // Pokedex
};
byte[] data = new byte[0x180];
Array.Copy(Main.SAV.Data, Main.SAV.EventFlag, data, 0, 0x180);
BitArray BitRegion = new BitArray(data);
BitRegion.CopyTo(flags, 0);
// Setup Event Constant Editor
CB_Stats.Items.Clear();
for (int i = 0; i < Constants.Length; i += 2)
{
CB_Stats.Items.Add($"0x{(i/2).ToString("X2")}");
Constants[i / 2] = BitConverter.ToUInt16(Main.SAV.Data, Main.SAV.EventConst + i);
}
CB_Stats.SelectedIndex = 0;
// Populate Flags
setup = true;
popFlags();
}
private void popFlags()
{
if (!setup) return;
foreach (CheckBox flag in chka)
flag.Checked = flags[getFlagNum(flag)];
changeCustomFlag(null, null);
}
private int getFlagNum(CheckBox chk)
{
try
{
string source = chk.Name;
return Convert.ToInt32(source.Substring(Math.Max(0, source.Length - 4)));
}
catch { return 0; }
}
private void changeCustomBool(object sender, EventArgs e)
{
flags[(int)nud.Value] = CHK_CustomFlag.Checked;
popFlags();
}
private void changeCustomFlag(object sender, EventArgs e)
{
int flag = (int)nud.Value;
if (flag >= 3072)
{
CHK_CustomFlag.Checked = false;
CHK_CustomFlag.Enabled = false;
nud.BackColor = Color.Red;
}
else
{
CHK_CustomFlag.Enabled = true;
nud.BackColor = Main.defaultControlWhite;
CHK_CustomFlag.Checked = flags[flag];
}
}
private void changeCustomFlag(object sender, KeyEventArgs e)
{
changeCustomFlag(null, (EventArgs)e);
}
private void toggleFlag(object sender, EventArgs e)
{
flags[getFlagNum((CheckBox)sender)] = ((CheckBox)sender).Checked;
changeCustomFlag(sender, e);
}
private void changeSAV(object sender, EventArgs e)
{
if (TB_NewSAV.Text.Length > 0 && TB_OldSAV.Text.Length > 0)
{
diffSaves();
}
}
private void diffSaves()
{
BitArray oldBits = new BitArray(oldFlags);
BitArray newBits = new BitArray(newFlags);
string tbIsSet = "";
string tbUnSet = "";
for (int i = 0; i < oldBits.Length; i++)
{
if (oldBits[i] == newBits[i]) continue;
if (newBits[i])
tbIsSet += i.ToString("0000") + ",";
else
tbUnSet += i.ToString("0000") + ",";
}
TB_IsSet.Text = tbIsSet;
TB_UnSet.Text = tbUnSet;
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?"))
return;
string r = "";
for (int i = 0; i < newConst.Length; i += 2)
{
ushort oldval = BitConverter.ToUInt16(oldConst, i);
ushort newval = BitConverter.ToUInt16(oldConst, i);
if (oldval != newval)
r += $"0x{(i/2).ToString("X2")}: {oldval}->{newval}{Environment.NewLine}";
}
Clipboard.SetText(r);
}
private byte[] oldFlags = new byte[0x180];
private byte[] newFlags = new byte[0x180];
private byte[] oldConst = new byte[Main.SAV.EventFlag - Main.SAV.EventConst];
private byte[] newConst = new byte[Main.SAV.EventFlag - Main.SAV.EventConst];
private void openSAV(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
loadSAV(sender, ofd.FileName);
}
private void loadSAV(object sender, string path)
{
FileInfo fi = new FileInfo(path);
if (fi.Length != SAV6.SIZE_XY)
{
Util.Error("Invalid SAV Size", string.Format("File Size: 0x{1} ({0} bytes)", fi.Length, fi.Length.ToString("X5")), "File Loaded: " + path);
return;
}
byte[] data = File.ReadAllBytes(path);
if (sender == B_LoadOld)
{
oldFlags = data.Skip(Main.SAV.EventFlag).Take(0x180).ToArray();
oldConst = data.Skip(Main.SAV.EventConst).Take(Constants.Length * 2).ToArray();
TB_OldSAV.Text = path;
}
else
{
newFlags = data.Skip(Main.SAV.EventFlag).Take(0x180).ToArray();
newConst = data.Skip(Main.SAV.EventConst).Take(Constants.Length * 2).ToArray();
TB_NewSAV.Text = path;
}
}
private int entry = -1;
private void changeConstantIndex(object sender, EventArgs e)
{
if (entry > -1) // Set Entry
Constants[entry] = (ushort)Math.Min(Util.ToUInt32(MT_Stat.Text), 0xFFFF);
entry = CB_Stats.SelectedIndex; // Get Entry
MT_Stat.Text = Constants[entry].ToString();
}
// Drag & Drop Events
private void tabMain_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void tabMain_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
loadSAV(Util.Prompt(MessageBoxButtons.YesNo, "FlagDiff Researcher:", "Yes: Old Save" + Environment.NewLine + "No: New Save") == DialogResult.Yes ? B_LoadOld : B_LoadNew, files[0]);
}
}
}

View file

@ -1,216 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAE
AAAAAAAAAAAAAAAAAAAAAAAAIyMjAQAAAAALCwsPJiYmJysrKycqKionKSkpJykpKScpKSknKioqJyoq
KicrKysnJycnJw0ODQ8AAAAAJiYmAQAAAABpaWlHq6ur17+/v+6+vr7svr6+7b6+vu2+vr7tvr6+7b6+
vu2+vr7tvr6+7L+/v+6rq6vXampqSAAAAAAoKSgXvr++3eLi4v/g4OD94eHh/+Hh4f/i4uL/4uLi/+Li
4v/i4uL/4eHh/+Dh4P/g4OD94uLi/7+/v90sLCwXfn5+PNna2frg4OD/39/f/uHh4f7h4eH+39/f/uDg
4P7g4OD+39/f/uHh4f7h4OH+39/f/t/g3//a2tr6g4ODPoOCgz7X19f64+Pj/+Li4v7k5OT/4+Tj//Ly
8v/19fX/9PT0//T09P/k5OT/5OTk/+Pj4/7j4+P/19jX+4qLikCDhIM+2tra++Xl5f/k5eT+5OTk//Lz
8v+urq7/RUVF/z4+Pv+Zmpn/8fHx/+Xm5f/k5eT+5eXl/9ra2vyLi4tAhYWFPuXm5vvx8vP/7+/w/v//
//+sra3/AgIC/15eXv9tbG3/BQUF/4yMjP//////7+/w/vHy8//l5ub8jY2NQC4uLD5LS0f7UFBL/09P
Sv5YWVP/FBUS/29wcP///////////5SUlP8PDw//U1NO/1BQS/5PT0r/S0tH/DIyMEAAAAs+AAAM+wAA
Dv8AAA/+AwMS/wAAAP+UlJX///////////+3t7n/AAAA/wAAD/8BAQ/+AAAO/wAADPwCAg5ABARSPgoK
k/sNDab/DQ2o/hAQvP8CAmj/IiIW/7Kzrv/Cw8D/NDQm/wAATf8QELz/DQ2q/gwMp/8LC5T8Dg5bQAUF
Xj4KCpz7DQ2u/w0NsP4NDbX/Dw+//wUFYf8CAhL/AwMP/wMDTf8ODrj/Dg64/w0NsP4MDK7/Cwud/A8P
aEEGBmU9DAyl+w4Otf8ODrf+Dw+6/xAQvv8TE8v/EhK+/xAQvP8TE8v/EBDA/w8Puf8PD7f+Dg61/w0N
pvsREW9ACAhtQA8PsfsTE77/ExO//xQUwP8UFML/FBTD/xUVyP8WFsn/FRXE/xQUw/8UFMH/ExO//xMT
vv8QELL7ERF3QxkZdCgXF771ExPH/xUVyPwVFcn9FhbL/RcXzP0XF8z9FxfM/RcXy/0XF8v9FhbJ/RUV
yPwTE8f/Fxe+9RkZdykAAAAAIyOtghsbx/8ZGcj+GRnJ/xoayf8aGsn/GhrK/xoayv8aGsn/GhrJ/xkZ
yf8ZGcj+GxvH/yMjrYQAAAAAAADHAQAAAAAzM51FLCyscCoqrGwqKqxtKSmsbSoqrG0qKqxtKSmsbSoq
rG0qKqxsLCyscDMznUUAAAAAAAAAAP//AADAAwAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIAB
AACAAQAAgAEAAIABAACAAQAAgAEAAP//AAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKysrCR0dHSMWFhY3GBgYORgYGDkYGBg5GBgYORgY
GDkYGBg5GBgYORgYGDkYGBg5GBgYORgYGDkYGBg5GBgYORgYGDkYGBg5GBgYORgYGDkYGBg5FxcXNx4e
HiQuLi4JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASEhIARYWFis7OzuVkJCQ2ampqeqqqqrsqqqq7Kqq
quyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqqquyqqqrsqqqq7Kqq
quypqanqkZGR2j09PZcXFxcsUFBQAQAAAAAAAAAAAAAAAAAAAAASEhIuhISEytvb2/7W1tb/19fX/9jY
2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9jY
2P/Y2Nj/2NjY/9fX1//W1tb/29vb/oeHh8sTExMvAAAAAAAAAAAAAAAAPDw8DGtra6zZ2dn/2dnZ/9ra
2v/b29v/29vb/9vb2//c3Nz/3Nzc/9zc3P/c3Nz/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc
3P/c3Nz/3Nzc/9vb2//b29v/29vb/9ra2v/Z2dn/2dnZ/21tba5DQ0MNAAAAAAAAAAAiIiIx1NXU9tna
2f/c3Nz/3d3d/93e3f/e3t7/3t7e/9/f3//f39//39/f/9/g3//g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg
4P/g4OD/39/f/9/f3//f39//3t/e/97e3v/d3t3/3d3d/9zc3P/Z2tn/1dXV9icnJzMAAAAAAAAAAFhZ
WFzf4N//3Nzc/97e3v/f39//39/f/9/g3//g4OD/4ODg/+Hh4f/h4eH/4eHh/+Li4v/i4uL/4uLi/+Li
4v/i4uL/4uLi/+Hi4f/h4eH/4eHh/+Dg4P/g4OD/3+Df/9/f3//f39//3t7e/9zc3P/f39//XV1dXQAA
AAAAAAAAZmZmZdvc2//e3t7/3+Df/+Dg4P/g4eD/4eHh/+Hi4f/i4uL/4uPi/+Pj4//j4+P/5OTk/+Tk
5P/k5OT/5OTk/+Tk5P/k5OT/4+Pj/+Pj4//j4+P/4uLi/+Li4v/h4eH/4eHh/+Dg4P/f4N//3t7e/9vb
2/9wcHBoAAAAAAAAAABoaGhl3d3d/9/f3//h4eH/4eLh/+Li4v/j4+P/4+Pj/+Tk5P/k5OT/5eXl/+Xl
5f/l5uX/5ubm/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Tk5P/k5OT/4+Pj/+Pj4//i4uL/4uLi/+Hh
4f/f39//3N3c/3Nzc2kAAAAAAAAAAGhoaGXe3t7/4ODg/+Li4v/j4+P/4+Pj/+Tk5P/l5eX/5eXl/+bm
5v/m5+b/5+fn/+fn5//n6Of/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5ubm/+Xl5f/l5eX/5OTk/+Pk
4//j4+P/4uLi/+Dg4P/e3t7/c3NzaQAAAAAAAAAAaGhoZd/g3//i4uL/5OTk/+Tl5P/l5eX/5ebl/+bn
5v/n5+f/5+jn/+jp6P/p6en/7Ozs/8LCwv+Tk5P/ioqK/66urv/o6ej/6enp/+jp6P/o6Oj/5+jn/+bn
5v/m5ub/5ebl/+Tl5P/k5OT/4uLi/9/g3/9zdHNpAAAAAAAAAABoaWhl4eLh/+Pk4//m5ub/5ubm/+fn
5//n6Of/6Ojo/+np6f/p6un/6urq/8bGxv8yMjL/AAAA/wAAAP8AAAD/AAAA/xMTE/+ZmZn/7Ozs/+rq
6v/p6en/6Ojo/+jo6P/n5+f/5ubm/+bm5v/k5OT/4eHh/3R0dGkAAAAAAAAAAGhpaGXj4+P/5eXl/+fn
5//n6Of/6Ojo/+np6f/q6ur/6urq/+vr6//Dw8P/DAwM/wAAAP8AAAD/Gxsb/ygoKP8BAQH/AAAA/wAA
AP+FhYX/7O3s/+rr6v/q6ur/6enp/+jo6P/o6Oj/5+fn/+Xl5f/i4+L/dHR0aQAAAAAAAAAAYWFhZeTl
5P/m5+b/6Ono/+np6f/p6un/6uvq/+vr6//s7Oz/7e7t/ycnJ/8AAAD/Ghoa/7S0tP/m5ub/5OTk/9HR
0f9GRkb/AAAA/wICAv/IyMj/7Ozs/+vs6//q6+r/6urq/+nq6f/o6ej/5+fn/+Tk5P9sbGxpAAAAAAAA
AAA9Pj1lj4+P/5OTk/+VlZX/lpaW/5eXl/+YmJj/mZmZ/5qamv92dnb/AAAA/wEBAf+/wL//3Nzc/+Tk
5P/l5eX/3d3d/+Li4v8mJib/AAAA/0ZGRv+ampr/mZmZ/5iYmP+Xl5f/lpaW/5WVlf+Tk5P/j4+P/0ZG
RmoAAAAAAAAAAAwMDGUAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/Nzc3/+fn
5//q6ur/7O3s/+zt7P/v7+//39/f/4WFhf8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8AAAD/EBAQagAAAAAAAAAAAwMHZQAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP9NTU3/5ufm//Lz8v/z9PP/8/Tz//X19f/l5eX/nZ2d/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8AAAD/AAAA/wAAAP8GBgpqAAAAAAAAAAAAABZlAQEk/wEBJ/8CAin/AgIq/wICKv8CAiv/AgIs/wIC
LP8BAR3/AAAA/xwcHP/w8PD/6+zr//r6+v/6+vr/9PT0/+vr6/9lZWX/AAAA/wAAD/8CAi3/AgIs/wIC
K/8CAir/AgIq/wICKf8BASf/AQEl/wUFG2oAAAAAAAAAAAICQGUGBpL/Bwec/wgIo/8JCaf/CQmq/wkJ
rf8JCa//Cgqz/wkJqP8AAAL/AAAA/4CAgP/y8/L/6+zr/+3t7f/u7u7/xMTE/wcHB/8AAAD/BgZz/woK
s/8JCbD/CQmt/wkJqv8JCaj/CAik/wcHnf8HB5P/Dg5MagAAAAAAAAAAAwNHZQgIk/8JCZ3/Cgqj/wsL
p/8LC6n/Cwus/wsLr/8MDLL/DAy2/wYGW/8AAAD/AAAA/1JSUv+sraz/tra2/3h4eP8KCgr/AAAA/wIC
Iv8MDLb/DAyy/wsLsP8LC63/Cwuq/wsLp/8KCqT/CQmd/wgIk/8PD1VrAAAAAAAAAAAEBE1lCQmY/woK
ov8LC6j/DAyr/wwMrf8MDLD/DAyy/w0Ntf8NDbf/Dg67/wUFSv8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8CAiH/DQ2q/w0NuP8NDbX/DQ2z/wwMsP8MDK7/DAyr/wsLqP8KCqL/CQmZ/xAQWmsAAAAAAAAAAAQE
UGUKCp7/Cwum/wwMrP8NDa//DQ2w/w0Ns/8ODrX/Dg63/w4Ouf8ODrv/Dw/A/wwMiv8FBTj/AAAG/wAA
AP8DAyb/CQls/w8Pu/8PD7z/Dg66/w4OuP8ODrX/DQ2z/w0Nsf8NDa//DAys/wsLp/8KCp7/ERFeawAA
AAAAAAAABQVTZQsLpP8MDKv/DQ2w/w4Os/8ODrT/Dg62/w8PuP8PD7r/Dw+8/w8Pvf8QEL//EBDA/xER
w/8SEsn/ERHJ/xERxf8QEMD/EBC//w8Pvv8PD7z/Dw+6/w8PuP8ODrf/Dg61/w4Os/8NDbH/DAyr/wsL
pP8SEmFrAAAAAAAAAAAGBlZlDAyq/w4OsP8PD7X/Dw+3/w8PuP8QELr/EBC7/xAQvf8REb7/ERHA/xER
wf8REcL/EhLC/xISw/8SEsP/EhLC/xERwv8REcH/ERHA/xERvv8QEL3/EBC7/xAQuv8QELj/Dw+3/w8P
tf8ODrD/DAyq/xMTZWsAAAAAAAAAAAcHWmUODrD/EBC2/xERuv8REbz/ERG9/xISvv8SEr//EhLA/xMT
wf8TE8P/ExPD/xMTxP8TE8X/FBTF/xQUxf8UFMX/ExPE/xMTxP8TE8P/ExPC/xISwf8SEr//EhK+/xER
vf8REbz/ERG6/xAQtv8ODrD/FBRpawAAAAAAAAAACAhcYxAQtf8SErv/ExO+/xQUwP8UFMD/FBTB/xUV
wv8VFcP/FRXE/xUVxf8WFsb/FhbG/xYWx/8WFsf/FhbH/xYWx/8WFsf/FhbG/xYWxf8VFcT/FRXD/xUV
wv8UFMH/FBTB/xQUwP8TE77/EhK7/xAQtf8TE2hoAAAAAAAAAAAQEFNUFRXC/xMTv/8UFMP/FRXE/xUV
xP8VFcX/FRXG/xYWx/8WFsf/FhbI/xYWyf8XF8n/FxfK/xcXyv8XF8r/FxfK/xcXyf8XF8n/FhbI/xYW
yP8WFsf/FhbG/xUVxf8VFcT/FRXE/xQUw/8TE7//FRXB/xAQV1UAAAAAAAAAAA0NPxkjI8byFBTD/xUV
x/8WFsj/FxfJ/xcXyf8XF8r/FxfK/xcXy/8YGMz/GBjM/xgYzP8YGM3/GBjN/xgYzf8YGM3/GBjM/xgY
zP8YGMz/GBjL/xcXy/8XF8r/FxfJ/xcXyf8WFsj/FRXH/xQUw/8jI8f0Dg5GGwAAAAAAAAAAFhZxAiUl
eIUZGcr/FBTI/xUVyv8WFsv/FhbM/xYWzP8WFsz/FhbN/xcXzf8XF83/FxfN/xcXzv8XF87/FxfO/xcX
zv8XF87/FxfN/xcXzf8WFs3/FhbM/xYWzP8WFsz/FhbL/xUVyv8UFMj/GBjJ/yYmeogWFnYCAAAAAAAA
AAAAAAAAGBh1BzMzk50kJNP+FxfK/xgYzP8YGMz/GBjN/xgYzf8YGM3/GBjN/xgYzf8ZGc7/GRnO/xkZ
zv8ZGc7/GRnO/xkZzv8YGM3/GBjN/xgYzf8YGM3/GBjN/xgYzP8YGMz/FxfK/yMj0v4zM5WfFBRkBwAA
AAAAAAAAAAAAAAAAAAAAAAAAHBx7Ay0tdkg3N5emMTGpxSwsp8gsLKfILCynyCwsp8gsLKfILCynyCws
p8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyDExqcU2NpenLi54Shsb
ewMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////8AAAD+AAAAfAAAADwAAAA8AAAAPAAAADwAAAA8AA
AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA
AAPAAAADwAAAA8AAAAPAAAAD4AAAB/gAAB//////
</value>
</data>
</root>

View file

@ -13,7 +13,7 @@ namespace PKHeX
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
Array.Copy(Main.SAV.Data, Main.SAV.HoF, data, 0, data.Length); //Copy HoF section of save into Data
Array.Copy(SAV.Data, SAV.HoF, data, 0, data.Length); //Copy HoF section of save into Data
Setup();
editor_spec = new object[]{
GB_OT,
@ -49,6 +49,7 @@ namespace PKHeX
editing = true;
}
private bool editing;
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private readonly string[] gendersymbols = Main.gendersymbols;
private readonly byte[] data = new byte[0x1B40];
@ -98,7 +99,7 @@ namespace PKHeX
}
private void B_Close_Click(object sender, EventArgs e)
{
Array.Copy(data, 0, Main.SAV.Data, Main.SAV.HoF, data.Length);
Array.Copy(data, 0, Main.SAV.Data, SAV.HoF, data.Length);
Main.SAV.Edited = true;
Close();
}

View file

@ -28,49 +28,21 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_Inventory));
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.B_Cancel = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.GB_Pouch = new System.Windows.Forms.GroupBox();
this.B_DisplayBerries = new System.Windows.Forms.Button();
this.B_DisplayMedicine = new System.Windows.Forms.Button();
this.B_DisplayTMHM = new System.Windows.Forms.Button();
this.B_DisplayKeyItems = new System.Windows.Forms.Button();
this.B_DisplayItems = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.GB_Pouch.SuspendLayout();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.IL_Pouch = new System.Windows.Forms.ImageList(this.components);
this.B_GiveAll = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AllowUserToResizeColumns = false;
this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView1.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.ColumnHeadersVisible = false;
this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.dataGridView1.ShowEditingIcon = false;
this.dataGridView1.Size = new System.Drawing.Size(200, 190);
this.dataGridView1.TabIndex = 12;
this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dropclick);
//
// B_Cancel
//
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Cancel.Location = new System.Drawing.Point(221, 179);
this.B_Cancel.Location = new System.Drawing.Point(177, 328);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(48, 23);
this.B_Cancel.Size = new System.Drawing.Size(70, 23);
this.B_Cancel.TabIndex = 14;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
@ -79,117 +51,75 @@
// B_Save
//
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Save.Location = new System.Drawing.Point(275, 179);
this.B_Save.Location = new System.Drawing.Point(253, 328);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(48, 23);
this.B_Save.Size = new System.Drawing.Size(70, 23);
this.B_Save.TabIndex = 15;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// GB_Pouch
// tabControl1
//
this.GB_Pouch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.GB_Pouch.Controls.Add(this.B_DisplayBerries);
this.GB_Pouch.Controls.Add(this.B_DisplayMedicine);
this.GB_Pouch.Controls.Add(this.B_DisplayTMHM);
this.GB_Pouch.Controls.Add(this.B_DisplayKeyItems);
this.GB_Pouch.Controls.Add(this.B_DisplayItems);
this.GB_Pouch.Location = new System.Drawing.Point(221, 6);
this.GB_Pouch.Name = "GB_Pouch";
this.GB_Pouch.Size = new System.Drawing.Size(102, 167);
this.GB_Pouch.TabIndex = 16;
this.GB_Pouch.TabStop = false;
this.GB_Pouch.Text = "Pouches";
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.ImageList = this.IL_Pouch;
this.tabControl1.Location = new System.Drawing.Point(12, 12);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(311, 308);
this.tabControl1.TabIndex = 17;
//
// B_DisplayBerries
// IL_Pouch
//
this.B_DisplayBerries.Location = new System.Drawing.Point(14, 135);
this.B_DisplayBerries.Name = "B_DisplayBerries";
this.B_DisplayBerries.Size = new System.Drawing.Size(75, 23);
this.B_DisplayBerries.TabIndex = 4;
this.B_DisplayBerries.Text = "Berry";
this.B_DisplayBerries.UseMnemonic = false;
this.B_DisplayBerries.UseVisualStyleBackColor = true;
this.B_DisplayBerries.Click += new System.EventHandler(this.B_DisplayBerries_Click);
this.IL_Pouch.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("IL_Pouch.ImageStream")));
this.IL_Pouch.TransparentColor = System.Drawing.Color.Transparent;
this.IL_Pouch.Images.SetKeyName(0, "Bag_Items.png");
this.IL_Pouch.Images.SetKeyName(1, "Bag_Key.png");
this.IL_Pouch.Images.SetKeyName(2, "Bag_TMHM.png");
this.IL_Pouch.Images.SetKeyName(3, "Bag_Medicine.png");
this.IL_Pouch.Images.SetKeyName(4, "Bag_Berries.png");
this.IL_Pouch.Images.SetKeyName(5, "Bag_Balls.png");
this.IL_Pouch.Images.SetKeyName(6, "Bag_Battle.png");
this.IL_Pouch.Images.SetKeyName(7, "Bag_Mail.png");
//
// B_DisplayMedicine
// B_GiveAll
//
this.B_DisplayMedicine.Location = new System.Drawing.Point(14, 106);
this.B_DisplayMedicine.Name = "B_DisplayMedicine";
this.B_DisplayMedicine.Size = new System.Drawing.Size(75, 23);
this.B_DisplayMedicine.TabIndex = 3;
this.B_DisplayMedicine.Text = "Medicine";
this.B_DisplayMedicine.UseMnemonic = false;
this.B_DisplayMedicine.UseVisualStyleBackColor = true;
this.B_DisplayMedicine.Click += new System.EventHandler(this.B_DisplayMedicine_Click);
//
// B_DisplayTMHM
//
this.B_DisplayTMHM.Location = new System.Drawing.Point(14, 77);
this.B_DisplayTMHM.Name = "B_DisplayTMHM";
this.B_DisplayTMHM.Size = new System.Drawing.Size(75, 23);
this.B_DisplayTMHM.TabIndex = 2;
this.B_DisplayTMHM.Text = "TM/HM";
this.B_DisplayTMHM.UseMnemonic = false;
this.B_DisplayTMHM.UseVisualStyleBackColor = true;
this.B_DisplayTMHM.Click += new System.EventHandler(this.B_DisplayTMHM_Click);
//
// B_DisplayKeyItems
//
this.B_DisplayKeyItems.Location = new System.Drawing.Point(14, 48);
this.B_DisplayKeyItems.Name = "B_DisplayKeyItems";
this.B_DisplayKeyItems.Size = new System.Drawing.Size(75, 23);
this.B_DisplayKeyItems.TabIndex = 1;
this.B_DisplayKeyItems.Text = "Key Items";
this.B_DisplayKeyItems.UseMnemonic = false;
this.B_DisplayKeyItems.UseVisualStyleBackColor = true;
this.B_DisplayKeyItems.Click += new System.EventHandler(this.B_DisplayKeyItems_Click);
//
// B_DisplayItems
//
this.B_DisplayItems.Location = new System.Drawing.Point(14, 19);
this.B_DisplayItems.Name = "B_DisplayItems";
this.B_DisplayItems.Size = new System.Drawing.Size(75, 23);
this.B_DisplayItems.TabIndex = 0;
this.B_DisplayItems.Text = "Items";
this.B_DisplayItems.UseMnemonic = false;
this.B_DisplayItems.UseVisualStyleBackColor = true;
this.B_DisplayItems.Click += new System.EventHandler(this.B_DisplayItems_Click);
this.B_GiveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_GiveAll.Location = new System.Drawing.Point(12, 328);
this.B_GiveAll.Name = "B_GiveAll";
this.B_GiveAll.Size = new System.Drawing.Size(75, 23);
this.B_GiveAll.TabIndex = 18;
this.B_GiveAll.Text = "Give All";
this.B_GiveAll.UseVisualStyleBackColor = true;
this.B_GiveAll.Click += new System.EventHandler(this.B_GiveAll_Click);
//
// SAV_Inventory
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(334, 212);
this.Controls.Add(this.GB_Pouch);
this.ClientSize = new System.Drawing.Size(334, 361);
this.Controls.Add(this.B_GiveAll);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.B_Save);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.dataGridView1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(350, 750);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(350, 250);
this.MinimumSize = new System.Drawing.Size(350, 400);
this.Name = "SAV_Inventory";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Inventory Editor";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.GB_Pouch.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.GroupBox GB_Pouch;
private System.Windows.Forms.Button B_DisplayBerries;
private System.Windows.Forms.Button B_DisplayMedicine;
private System.Windows.Forms.Button B_DisplayTMHM;
private System.Windows.Forms.Button B_DisplayKeyItems;
private System.Windows.Forms.Button B_DisplayItems;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.Button B_GiveAll;
private System.Windows.Forms.ImageList IL_Pouch;
}
}

View file

@ -1,5 +1,5 @@
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
@ -11,52 +11,77 @@ namespace PKHeX
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
item_val = getItems(Main.SAV.ORAS ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY);
keyitem_val = getItems(Main.SAV.ORAS ? Legal.Pouch_Key_ORAS : Legal.Pouch_Key_XY);
tmhm_val = getItems(Main.SAV.ORAS ? Legal.Pouch_TMHM_ORAS : Legal.Pouch_TMHM_XY, sort: false);
medicine_val = getItems(Main.SAV.ORAS ? Legal.Pouch_Medicine_ORAS : Legal.Pouch_Medicine_XY);
berries_val = getItems(Legal.Pouch_Berry_XY);
B_DisplayItems.ForeColor = Color.Red;
// Load Items
populateList(item_val, Main.SAV.Items.HeldItem);
B_DisplayItems.Text = Main.itempouch[0];
B_DisplayMedicine.Text = Main.itempouch[1];
B_DisplayTMHM.Text = Main.itempouch[2];
B_DisplayBerries.Text = Main.itempouch[3];
B_DisplayKeyItems.Text = Main.itempouch[4];
Pouches = SAV.Inventory;
getBags();
}
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly string[] item_val, keyitem_val, tmhm_val, medicine_val, berries_val;
private readonly SaveFile SAV = Main.SAV.Clone();
private readonly InventoryPouch[] Pouches;
private const string TabPrefix = "TAB_";
private const string DGVPrefix = "DGV_";
// Initialize String Tables
private string[] getItems(ushort[] items, bool sort = true)
private void B_Cancel_Click(object sender, EventArgs e)
{
string[] res = new string[items.Length];
for (int i = 0; i < res.Length; i++)
res[i] = Main.itemlist[items[i]];
if (sort)
Array.Sort(res);
return res;
Close();
}
private void B_Save_Click(object sender, EventArgs e)
{
packBags();
SAV.Inventory = Pouches;
Array.Copy(SAV.Data, Main.SAV.Data, SAV.Data.Length);
Main.SAV.Edited = true;
Close();
}
// Populate DataGrid
private void populateList(string[] itemarr, int offset, int itemcount = -1)
private void getBags()
{
dataGridView1.Rows.Clear();
dataGridView1.Columns.Clear();
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
for (int i = 0; i < Pouches.Length; i++)
{
dgvIndex.HeaderText = "CNT";
dgvIndex.DisplayIndex = 1;
dgvIndex.Width = 45;
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
// Add Tab
tabControl1.TabPages.Add(new TabPage
{
// Text = Pouches[i].Type.ToString(),
ImageIndex = (int)Pouches[i].Type
});
// Add DataGrid
DataGridView dgv = new DataGridView
{
Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right, // All
Height = tabControl1.TabPages[i].Height,
Width = tabControl1.TabPages[i].Width,
Text = Pouches[i].Type.ToString(),
Name = DGVPrefix + Pouches[i].Type,
AllowUserToAddRows = false,
AllowUserToDeleteRows = false,
AllowUserToResizeRows = false,
AllowUserToResizeColumns = false,
RowHeadersVisible = false,
ColumnHeadersVisible = false,
MultiSelect = false,
ShowEditingIcon = false,
EditMode = DataGridViewEditMode.EditOnEnter,
ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single,
ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize,
SelectionMode = DataGridViewSelectionMode.CellSelect,
CellBorderStyle = DataGridViewCellBorderStyle.None,
};
tabControl1.TabPages[i].Controls.Add(dgv);
spillBag(dgv, i);
}
}
private void spillBag(DataGridView dgv, int bag)
{
var pouch = Pouches[bag];
var itemcount = Pouches[bag].Items.Length;
string[] itemarr = getItems(pouch.LegalItems);
dgv.Rows.Clear();
dgv.Columns.Clear();
DataGridViewComboBoxColumn dgvItemVal = new DataGridViewComboBoxColumn
{
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
@ -64,19 +89,27 @@ namespace PKHeX
Width = 135,
FlatStyle = FlatStyle.Flat
};
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
{
dgvIndex.HeaderText = "CNT";
dgvIndex.DisplayIndex = 1;
dgvIndex.Width = 45;
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
}
foreach (string t in itemarr)
dgvItemVal.Items.Add(t); // add only the Item Names
dataGridView1.Columns.Add(dgvItemVal);
dataGridView1.Columns.Add(dgvIndex);
dgv.Columns.Add(dgvItemVal);
dgv.Columns.Add(dgvIndex);
dataGridView1.Rows.Add(itemcount > 0 ? itemcount : itemarr.Length);
dataGridView1.CancelEdit();
dgv.Rows.Add(itemcount > 0 ? itemcount : itemarr.Length);
dgv.CancelEdit();
string itemname = "";
for (int i = 0; i < dataGridView1.Rows.Count; i++)
string err = "";
for (int i = 0; i < pouch.Items.Length; i++)
{
int itemvalue = BitConverter.ToUInt16(sav, offset + i*4);
int itemvalue = pouch.Items[i].Index;
try { itemname = Main.itemlist[itemvalue]; }
catch
{
@ -86,143 +119,95 @@ namespace PKHeX
int itemarrayval = Array.IndexOf(itemarr, itemname);
if (itemarrayval == -1)
{
dataGridView1.Rows[i].Cells[0].Value = itemarr[0];
dataGridView1.Rows[i].Cells[1].Value = 0;
Util.Alert(itemname + " removed from item pouch.", "If you save changes the item will no longer be in the pouch.");
dgv.Rows[i].Cells[0].Value = itemarr[0];
dgv.Rows[i].Cells[1].Value = 0;
err += itemname + ", ";
}
else
{
dataGridView1.Rows[i].Cells[0].Value = itemarr[itemarrayval];
dataGridView1.Rows[i].Cells[1].Value = BitConverter.ToUInt16(sav, offset + i * 4 + 2);
dgv.Rows[i].Cells[0].Value = itemname;
dgv.Rows[i].Cells[1].Value = pouch.Items[i].Count;
}
}
if (err.Length > 0)
Util.Alert($"The following items have been removed from {Pouches[bag].Type} pouch.", err,
"If you save changes, the item(s) will no longer be in the pouch.");
}
private void dropclick(object sender, DataGridViewCellEventArgs e)
private void packBags()
{
if (e.ColumnIndex != 0) return;
ComboBox comboBox = (ComboBox)dataGridView1.EditingControl;
comboBox.DroppedDown = true;
}
private void saveBag(object sender)
{
int offset = 0;
if (B_DisplayItems.ForeColor == Color.Red)
offset = Main.SAV.Items.HeldItem;
else if (B_DisplayKeyItems.ForeColor == Color.Red)
offset = Main.SAV.Items.KeyItem;
else if (B_DisplayTMHM.ForeColor == Color.Red)
offset = Main.SAV.Items.TMHM;
else if (B_DisplayMedicine.ForeColor == Color.Red)
offset = Main.SAV.Items.Medicine;
else if (B_DisplayBerries.ForeColor == Color.Red)
offset = Main.SAV.Items.Berry;
// Fetch Data
int itemcount = dataGridView1.Rows.Count;
int emptyslots = 0;
for (int i = 0; i < itemcount; i++)
for (int p = 0; p < Pouches.Length; p++)
{
string item = dataGridView1.Rows[i].Cells[0].Value.ToString();
int itemindex = Array.IndexOf(Main.itemlist, item);
int itemcnt;
try
{ itemcnt = Convert.ToUInt16(dataGridView1.Rows[i].Cells[1].Value.ToString()); }
catch { itemcnt = 0; }
// Get DataGridView
DataGridView dgv = Controls.Find(DGVPrefix + Pouches[p].Type, true).FirstOrDefault() as DataGridView;
if (itemindex == 0) // Compression of Empty Slots
int ctr = 0;
for (int i = 0; i < dgv.Rows.Count; i++)
{
emptyslots++;
continue;
string item = dgv.Rows[i].Cells[0].Value.ToString();
int itemindex = Array.IndexOf(Main.itemlist, item);
int itemcnt;
try
{ itemcnt = Convert.ToUInt16(dgv.Rows[i].Cells[1].Value.ToString()); }
catch { itemcnt = 0; }
if (itemcnt == 0)
itemcnt++; // No 0 count of items
else if (itemcnt > 995)
itemcnt = 995; // cap out
if (itemindex == 0) // Compression of Empty Slots
continue;
Pouches[p].Items[ctr++] = new InventoryItem {Index = itemindex, Count = itemcnt};
}
if (itemcnt == 0)
itemcnt++; // No 0 count of items
else if (itemcnt > 995)
itemcnt = 995; // cap out
// Write Data into Save File
BitConverter.GetBytes((ushort)itemindex).CopyTo(sav, offset + 4 * (i - emptyslots)); // item #
BitConverter.GetBytes((ushort)itemcnt).CopyTo(sav, offset + 4 * (i - emptyslots) + 2); // count
for (int i = ctr; i < Pouches[p].Items.Length; i++)
Pouches[p].Items[i] = new InventoryItem(); // Empty Slots at the end
}
}
// Delete Empty Trash
for (int i = itemcount - emptyslots; i < itemcount; i++)
// Initialize String Tables
private string[] getItems(ushort[] items, bool sort = true)
{
string[] res = new string[items.Length + 1];
for (int i = 0; i < res.Length - 1; i++)
res[i] = Main.itemlist[items[i]];
res[items.Length] = Main.itemlist[0];
if (sort)
Array.Sort(res);
return res;
}
// User Cheats
private void B_GiveAll_Click(object sender, EventArgs e)
{
// Get Current Pouch
int pouch = tabControl1.SelectedIndex;
if (pouch < 0)
return;
ushort[] legalitems = Pouches[pouch].LegalItems;
DataGridView dgv = Controls.Find(DGVPrefix + Pouches[pouch].Type, true).FirstOrDefault() as DataGridView;
if (ModifierKeys == Keys.Alt)
{
BitConverter.GetBytes((ushort)0).CopyTo(sav, offset + 4 * i + 0); // item #
BitConverter.GetBytes((ushort)0).CopyTo(sav, offset + 4 * i + 2); // count
for (int i = 0; i < legalitems.Length; i++)
{
dgv.Rows[i].Cells[0].Value = Main.itemlist[0];
dgv.Rows[i].Cells[1].Value = 0;
}
Util.Alert("Items cleared.");
return;
}
// Load New Button Color, after finished we'll load the new data.
B_DisplayItems.ForeColor =
B_DisplayKeyItems.ForeColor =
B_DisplayTMHM.ForeColor =
B_DisplayMedicine.ForeColor =
B_DisplayBerries.ForeColor = Main.defaultControlText;
(sender as Button).ForeColor = Color.Red;
}
private void giveAll(string[] inarray, int count)
{
for (int i = 0; i < inarray.Length - 1; i++)
int Count = ModifierKeys == Keys.Control ? 1 : Pouches[pouch].MaxCount;
for (int i = 0; i < legalitems.Length; i++)
{
string itemname = inarray[i+1];
int itemarrayval = Array.IndexOf(inarray, itemname);
dataGridView1.Rows[i].Cells[0].Value = inarray[itemarrayval];
dataGridView1.Rows[i].Cells[1].Value = count;
string itemname = Main.itemlist[legalitems[i]];
dgv.Rows[i].Cells[0].Value = itemname;
dgv.Rows[i].Cells[1].Value = Count;
}
}
private void B_DisplayItems_Click(object sender, EventArgs e)
{
// Store Current Items back to the save file
saveBag(sender);
populateList(item_val, Main.SAV.Items.HeldItem);
if (ModifierKeys == Keys.Alt)
giveAll(item_val, 995);
}
private void B_DisplayKeyItems_Click(object sender, EventArgs e)
{
// Store Current Items back to the save file
saveBag(sender);
populateList(keyitem_val, Main.SAV.Items.KeyItem);
if (ModifierKeys == Keys.Alt && Util.Prompt(MessageBoxButtons.YesNo,
$"Warning: Adding all {B_DisplayKeyItems.Text} is dangerous.", "Continue?") == DialogResult.Yes)
giveAll(keyitem_val, 1);
}
private void B_DisplayTMHM_Click(object sender, EventArgs e)
{
// Store Current Items back to the save file
saveBag(sender);
populateList(tmhm_val, Main.SAV.Items.TMHM);
if (ModifierKeys == Keys.Alt && Util.Prompt(MessageBoxButtons.YesNo,
$"Warning: Adding all {B_DisplayTMHM.Text} is dangerous.", "Continue?") == DialogResult.Yes)
giveAll(tmhm_val, 1);
}
private void B_DisplayMedicine_Click(object sender, EventArgs e)
{
// Store Current Items back to the save file
saveBag(sender);
populateList(medicine_val, Main.SAV.Items.Medicine);
if (ModifierKeys == Keys.Alt)
giveAll(medicine_val, 995);
}
private void B_DisplayBerries_Click(object sender, EventArgs e)
{
// Store Current Items back to the save file
saveBag(sender);
populateList(berries_val, Main.SAV.Items.Berry);
if (ModifierKeys == Keys.Alt)
giveAll(berries_val, 995);
}
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void B_Save_Click(object sender, EventArgs e)
{
saveBag(sender);
Array.Copy(sav, Main.SAV.Data, Main.SAV.Data.Length);
Main.SAV.Edited = true;
Close();
System.Media.SystemSounds.Asterisk.Play();
}
}
}

View file

@ -117,36 +117,169 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="dataGridView1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Cancel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_Save.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GB_Pouch.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_DisplayBerries.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_DisplayMedicine.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_DisplayTMHM.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_DisplayKeyItems.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="B_DisplayItems.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
<metadata name="IL_Pouch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="IL_Pouch.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADE
IwAAAk1TRnQBSQFMAgEBCAEAARgBAAEIAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABgAMAAWADAAEBAQABCAYAATAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8A/wD/AP8A
/wD/AP8A/wD/AP8A/wD/AP8AFAAT9BMADfQbAAf0CAAg9AMAAfQE/wn0BP8B9BMAAfQL/wH0GwAB9AL/
AfQC/wH0CAAe/wL0AQAD9AH/AvQCGQEJAtwB1QLcAQkBGQHzA/8D9A0ABPQB8wEZCdwBGQHzBPQHAAn0
AwAG9AEJAdUB3QH/AfQIAAH/ARkb3AEZAvQBAAH0Av8B9AIZAQkB3AHbAtQBzQLUAdsBCQEZA/QC/wH0
DQAB9AP/ARkB3AHUB80B1AHcARkD/wH0BwAB9Af/AfQDAAH0A/8B9AEZAdUBzQHcAf8B9AgAAf8B3BnN
AtQB3AL0AQAB9AH/AhkB3ALVA9QDzQLUAtUB3AEJAhkB/wH0CwAC9AHzARkC3AHVAtQHzQLUAdUC3AEZ
AfMC9AUAAfQB/wH1BPQB/wX0Af8C9AHcAdUB1AHNAdwB/wH0CAAB/wHcAc0a1AHcAvQBAAL0ARkB3AHU
C80C1AHbAdwBGQL0CwAB9AH/ARkB3AHUD80B1AHcARkB/wH0BQAB9AH/AfQEGQH0Bf8B9AIZAdUDzQHc
Af8B9AgAAf8B3AHNAdQB2xXcAdsB2gHUAdwD9ALzAQkB2wHUDM0C1AHcAQkB8wP0BwAC9AHzARkB3ALU
D80C1AHcARkB8wL0AwAB9AH/ARkB3AHbAdUB3AEJARkD8wEZAQkB3AHVAdQDzQHcAf8B9AgAAf8B3AHN
AdQB2xXcAdsB2gHUAdwD9ALzAdwC1A3NAdQB1QEJAfMB9AH/AfQHAAH0Af8BGQHcAdQTzQHUAdwBGQH/
AfQDAAL0AdwC1AHNAdQB2wHcA90B3AHbAdQFzQHcAf8B9AgAAf8B3AHNAdQB2xXcAdsB2gHUAdwC9AH/
ARkBCQHVAdQOzQLUAdwBGQHzAf8B9AcAAfQB/wHcAtQTzQLUAdwB/wH0AwAC9AEZAdwB1QTUA9UD1AXN
AdwB/wn0Af8B3AHNAdQB2xXcAdsB2gHUAdwC9AH/ARkB2wHUD80C1AHbAdwBGQL0BwAB9AH/AdwXzQHc
Af8B9AUAAfQB/wHcAtQNzQHcAv8I9AH/AdwBzQHUAdsV3AHbAdoB1AHcAvQB/wHcAtQEzQHUC80C1AHb
AQkC9AYAAfQB8wEZAdUHzQLUAdUD3AHVAtQHzQHVARkB8wL0AwAB9AH/AQkB2wHUBM0H1ALNAdUIGQH/
AfQB/wHcAc0B1AHbFdwB2wHaAdQB3AL0Af8B3AXNA9QLzQLUAdwC9AYAAf8BGQHcAdQHzQHUAdwBGQP/
ARkB3AHUB80B1AHcARkB/wH0AwAC9AEZAQkB1QPNCdQBzQHUB9wBGQH/AfQB/wHcAc0B1AHbFdwB2wHa
AdQB3AL0Af8B3AHUAs0BzgHUAdUB2wHVA9QHzQLUAdoB3AL0BgAB/wHcAtQFzQLUAdwBGQXcARkB3ALU
Bc0C1AHcAf8B9AMAAvQB8wEZAdwB1AHOAc0E1AHVA9sB1AHNBtQB1QHcAd0B/wH0Af8B3AHNAdQB2xXc
AdsB2gHUAdwC9AH/AdwC1AHNAdQB1QHcAQkB3AHbAdoC1AXNAtQB2gHbAQkC9AYAAf8B3AfNAdQB3AEZ
Af8B3APNAdwB/wEZAdwB1AfNAdwB/wH0BQAB9AH/AQkB1QHUAc0B1APVBNwB1AfNAdQB1QEJAvQB/wHc
Ac0B1AHbFdwB2wHaAdQB3AL0Af8BGQHcAdQBzgHUAdUB3AEZAtwB2wLUBc0C1AHbAdwBGQL0BgAB/wHc
B9QB3AEZAtwB1APNAdQC3AEZAdwH1AHcAf8B9AMABPQB3AHbAdQBzQTUAdsD3AHUBM0D1AHbAQkBGQL0
Af8B3AHNAdQB2wfcAdsB1QPUAdUB2wfcAdsB2gHUAdwD9AIZAdYBzgHUAdUB3AEZAQkB3AHbAtQFzQLU
AdwCGQL0BgAB/wEZB9wBGQH/AdwHzQHcAf8BGQfcARkB/wH0AwAC9AIZAdwB2wHUAc0E1AHbA9wB1APN
AtQB2gHbAQkC9AIAAf8B3AHNAdQB2wbcAdsC1APNAtQB2wbcAdsB2gHUAdwE9AEZAdwD1AHVAtwB2wLU
Bc0C1AHbAdwBGQP0BgAB/wH0BxkB9AH/AdwHzQHcAf8B9AcZAfQB/wH0AQAC9AEZAQkC3AHVAtQBzQHU
B9sB1AHNAtQB1QLcAQkBGQL0AgAB/wHcAc0B1AHbBdwB2wHVB9QB1QHbBdwB2wHaAdQB3AL0AQAC9AEJ
AdsB1AHNAdQB1QPUBc0C1AHbAdwBGQL0CAAL/wHcB80B3Av/AfQBAAL0AQkB1QPUA80B1APcAdsE1AHN
AdQB3AEJAhkC9AQAAf8B3AHNAdQB2wTcAdsC1AHVBdwB1QLUAdsE3AHbAdoB1AHcAvQBAAL0ARkB3AHb
AdQB1QHbA9QCzQPUAdUB2wHcARkB8wL0AQAH9AH/ARkI3AEZAtwB1APNAdQC3AEZCNwBGQH/AvQBGQEJ
AdUD1ATNAdQD3AHbBNQBzQHUAdwBCQT0BAAB/wHcAc0B1AHbA9wC2wHaAdsH3AHVAdQB1QHbA9wB2wHa
AdQB3AL0AQAC9AIZAQkC3AHbAdoC1AHNAtQB2gHbAdwBCQHxAvMC9AEAAfQC/wT0Af8B3AfNAdQB3AEZ
Af8B3APNAdwB/wEZAdwB1AfNAdwB/wL0AQkB1QHUB80B1ATcA9UB1AHNAdQB1QEJAf8B9AYAAf8B3AHN
AdQB2wLcAdsB1AHaAdsJ3AHVAtQB2wLcAdsB2gHUAdwC9AEAA/QDGQIJAdwB2wPUAdsB3AEJAhkB8wb0
Af8B9AEZA/QB/wHcAtQFzQLUAdwBGQXcARkB3ALUBc0C1AHcAf8B9AH/Ad0B3AbVAc4BzQHUA9sB1QTU
Ac0BzgHUAdwBGQHzAvQEAAH/AdwBzQHUBNsB2gHbC9wB2wHaBNsB2gHUAdwC9AMABPQC8wEZAtwB2wLc
ARkC8wH0Av8B9AEAAfQC/wH0AxkC9AH/ARkB3AHUB80B1AHcARkD/wEZAdwB1AfNAdQB3AEZAf8B9AH/
ARkHCQHVAc0J1APNAdUBCQEZAvQEAAH/AdwBzQHUAdsB2gHUAdoB2w3cAdsB2gHUAdoB2wHaAdQB3AL0
AwAE9ALzAQkB3AHbAdoB2wHcAQkC8wL0Af8B9ALzARkBCQPcARkD9AHzARkB1QfNAtQB1QPcAdUC1AfN
AdUBGQHzAvQB/wHzBxkB1QLNB9QEzQHUAdsBCQH/AfQEAAH/AdwBzQPUAdoB2w/cAdsB2gTUAdwC9AcA
AvQBCQHVAtQB2gHbAdwCGQP0AvMB8QEJAdsD1AHcAvQBAAH0Af8B3BfNAdwB/wH0AgAH9AL/AdwNzQLU
AdwB/wH0BAAB/wHcA80B1AHbEdwB2wHUAc0C1AHcAvQHAAL0Ad0B3AHVA9QB1QfcAtUD1AHbAQkC9AEA
AfQB/wHcAtQTzQLUAdwB/wH0AgAI9AH/AdwFzQPUA9UE1AHVAdwBGQL0AgAB/wHcAc0C1AHbE9wB2wPU
AdwC9AcAAvQBGQHcAdsC1AHNCdQDzQHUAdwBGQL0AQAB9AH/ARkB3AHUE80B1AHcARkB/wH0CQAB9AH/
AdwFzQHUAdsB3AMZAdwB2wHUAc0C1AHcAvQCAAH/AdwBzQHUAdsV3AHbAdoB1AHcAvQHAAH0Af8CGQHc
AdsO1AHcAhkB/wH0AQAC9AHzARkB3ALUD80C1AHcARkB8wL0CQAB9AH/AdwDzQHUAdUB3AEJARkD9AEZ
AQkB3AHVAdsB3AEZAf8B9AIAAf8B3AHNAdQB2xXcAdsB2gHUAdwC9AcAAfQC/wH0ARkB3AHbAtQHzQLU
AdsB3AEZAfQC/wH0AwAB9AH/ARkB3AHUD80B1AHcARkB/wH0CwAB9AH/AdwDzQHVAhkB9AX/AfQEGQH0
Af8B9AIAAf8B3AHNAdQB2xXcAdsB2gHUAdwC9AcAA/QB/wIZAQkB3AHbAtQEzQHUAdUB3AEJAhkB/wP0
AwAC9AHzARkC3AHVAtQHzQLUAdUC3AEZAfMC9AsAAfQB/wHcAc0B1AHVAQkC9AH/BfQB/wT0AfUB/wH0
AgAB/wHcAc0a1AHcAvQJAAH0Av8D9AEJAdsB1APNAtQB3AP0Av8B9AcAAfQD/wEZAdwB1AfNAdQB3AEZ
A/8B9A0AAfQB/wHcAc0B1QH0BP8B9AMAAfQH/wH0AgAB/wHcGc0C1AHcAvQJAAb0ARkBCQbcARkG9AcA
BPQB8wEZCdwBGQHzBPQNAAH0Af8BGQHcAd0G9AMACfQCAAH/ARkb3AEZAvQPAAL0Bf8C9BEAAfQL/wH0
EQAB9AP/AfQUAB7/AvQHABH0DQAJ9B0ACfQMACD0BwAC9A3/AvQNAAH0B/8B9B0AAfQH/wH0DAAe/wL0
AwAF9AIZAQkJ3AMZBfQFAAT0AfMBGQXcARkB8wT0FQAE9AEZB9wBGQT0CAAB/wEZGNwCGQT0AwAC9AL/
AfQBGQHcAdUB1AfNAdQB2wHcARkB9AL/AvQFAAH0A/8BGQHcAdQDzQHUAdwBGQP/AfQVAAH0A/8B3AfN
AdwD/wH0CAAB/wHcAtQVzQHUAdsB3AIZAvQBAAL0AfMBGQEJAtwB1QLUAc4HzQPUAdUC3AEJARkB8wL0
AwAB9AH/ARkB3AHVAtQDzQLUAdUB3AEZAf8B9BMAAvQBGQPcAdUB1AHVA9wB1QHUAdUD3AEZAvQGAAH/
AdwC1BXNAdQB2wHcAhkC9AEAAvQBGQEJAdsC1A/NAtQB2wEJARkC9AMAAfQB/wHcC80B3AH/AfQTAAH0
Af8B3APNAdQB3AEZA/8BGQHcAdQDzQHcAf8B9AYAAf8B3ALUFc0B1AHbAdwCGQL0AQAC9AEJAdsC1BHN
AdQB1QHcAd0C9AIAAfQB8wEZAdUDzQHUA9wB1APNAdUBGQHzAvQPAAL0ARkB3AHVAdQB1QLcARkB9AP/
ARkB3AHbA9QB1QHcARkC9AQAAf8B3ALUFc0B1AHbAdwCGQL0AQAC9AHcAtQTzQHUAdUBCQL0AgAB/wEZ
AdwB1APNAdwD/wHcA80B1AHcARkB/wH0DwAB9AH/AdwBzQHUAdwBGQf/ARkF3AHUAc0B3AH/AfQEAAH/
AdwC1BXNAdQB2wHcAhkD9AHzARkB2wLUE80C1AHcARkB8wL0Af8B3ALUAc0B1AHcARkD9AEZAdwB1AHN
AtQB3AH/AfQNAAL0ARkB3AHVAdQB3AEZAfQF/wH0ARkBCQXcAdsB1AHVAdwBGQL0AgAB/wHcAtQVzQHU
AdsB3AIZAvQB/wEZAdwB2wLUE80C1AHbAQkBGQL0Af8B3APNAdwB/wH0AwAB9AH/AdwDzQHcAf8B9A0A
AfQB/wHcAc0B1AHcARkH/wEZCdwB1AHNAdwB/wH0AgAB/wHcAtQVzQHUAdsB3AIZAvQB/wEJAdsC1BXN
AtQB2wEJAvQB/wHcA80B3AH/AfQDAAH0Af8B3APNAdwB/wH0DQAB9AH/AdwBzQHVARkB9Af/ARkJ3AHU
Ac0B3AH/AfQCAAH/AdwC1BXNAdQB2wHcAhkC9AH/AdwC1BfNAtQB3AL0Af8B3APNAdwB/wH0AwAB9AH/
AdwDzQHcAf8B9A0AAfQB/wHcAc0B3An/ARkJ3AHUAc0B3AH/AfQCAAH/AdwC1BXNAdQB2wHcAhkC9AH/
AdwC1BfNAtQB3AL0Af8B3ALUAc0B1AHcARkD9AEZAdwB1AHNAtQB3AH/AfQMAAH0ARkB3AHVAdQB3AX/
AfQBGQLcAdUB1AHbB9wB2wHUAdUB3AEZAvQB/wEJAdsB1RXUAdsC3AIZAvQB/wHcAtQXzQLUAdwC9AH/
ARkB3AHUA80B3AP/AdwDzQHUAdwBGQH/AfQMAAH/AdwBzQHUAdwBGQX/ARkB3AHUA80B1AncAdQBzQHc
Af8B9AH/ARkBCRjcAQkCGQL0Af8BCQHbAtQVzQLUAdsBCQP0AfMBGQHVA80B1APcAdQDzQHVARkB8wL0
AQAD9AgAAf8B3AHNAdUBGQH0Bf8B3AHUAdwDCQHcAdQB2wPcAQkDGQHVAc0B3AH/AfQB/wEZAQkY3AEJ
AhkC9AH/ARkB3AHbAtQTzQLUAdsBCQEZAvQBAAH0Af8B3AvNAdwB/wH0AwAB9AH/AfQIAAH/AdwBzQHc
B/8B3AHNAQkDAAEJAc0B1APcARkD/wHcAc0B3AH/AfQB/wEZAQkY3AEJAhkD9AHzARkB2wLUE80C1AHc
ARkB8wL0AQAB9AH/ARkB3AHVAtQFzQLUAdwB/wH0AQAC9AHzARkB8wL0BgAB/wHcAc0B3AP/AfQDGQHV
Ac0BCQMAAQkBzQHVAxkB9AP/AdwBzQHcAf8B9AH/AQkB2wHVFdQB2wLcAhkC9AEAAvQB3ALUE80B1AHV
AQkC9AMAAfQD/wEZAdwB1AXNAdQB3AEZAf8B9AEAAfQB/wEZAdwBGQH/AfQGAAH/AdwBzQHcA/8BGQPc
AdQBzQEJAwABCQHNAdwH/wHcAc0B3AH/AfQB/wHcAtQVzQHUAdsB3AIZAvQBAAL0AQkB2wLUEc0B1AHV
AdwB3QL0AwAE9AHzARkE3AHUAc0C1AHcARkB8wH0AfMBGQHcAdQB1QHcARkC9AQAAf8B3AHNAdUDGQEJ
A9wB2wHUAdwDCQHcAdQB3AX/AfQBGQHVAc0B3AH/AfQB/wHcAtQVzQHUAdsB3AIZAvQBAAL0ARkBCQHb
AtQPzQLUAdsBCQEZAvQHAAH0Bf8B3APNAdQB3AEZAf8BGQHcAdQDzQHcAf8B9AQAAf8B3AHNAdQJ3AHU
A80B1AHcARkF/wEZAdwB1AHNAdwB/wH0Af8B3ALUFc0B1AHbAdwCGQL0AQAC9AHzARkBCQLcAtUL1ALV
AtwBCQEZAfMC9AcABvQBGQHcAdQBzQLUAdwBGQHcAtQBzQHUAtwBGQHzAvQCAAH0ARkB3AHVAdQB2wfc
AdsB1AHVAtwBGQH0Bf8B3AHUAdUB3AEZAvQB/wHcAtQVzQHUAdsB3AIZAvQDAAL0Av8B9AEZAQkL3AEJ
ARkB9AL/AvQPAAH0Af8B3APNAdQB3AHUA80B3AH/ARkB3AEZAf8B9AMAAfQB/wHcAc0B1AncARkJ/wHc
Ac0B3AH/AfQCAAH/AdwC1BXNAdQB2wHcAhkC9AMAA/QB/wH0ARkC3AHVB9QB2wLcARkB9AH/A/QPAAL0
ARkB3AHUAc0D1AHNAdQC3AEZAdwB1AHVAdwBGQL0AQAB9AH/AdwBzQHUCdwBGQf/AfQBGQHVAc0B3AH/
AfQCAAH/ARkC3ALVE9QB2wHcARkE9AUAAvQCGQHcAdUB1AfNAdQB2wHcAhkC9BMAAfQB/wHcBc0B3AH/
ARkB3AHUA80B3AH/AfQBAAH0Af8B3AHNAdQJ3AEZB/8BGQHcAdQBzQHcAf8B9AIAA/8B9AEZAQkT3AEJ
ARkB9AL/AvQDAAL0AfMBGQLcAdUB1AHOB80C1AHVAdwCGQP0EQAC9AEZAdwB1APNAdUBGQHcAtQBzQHU
AdwBGQL0AQAC9AEZAdwB1QHUAdsF3AEJARkB9AX/AfQBGQHcAdQB1QHcARkC9AIAAvQB/wEZAdwB2w/U
AdUB2wLcAQkBGQH0Af8D9AMAAvQBGQEJAdsC1AvNAdQB1QHcAhkC9BMAAfQB/wHcA80B1AHcAdQDzQHc
Af8B9AUAAfQB/wHcAc0B1AXcARkH/wEZAdwB1AHNAdwB/wH0BQAC9AEJAdsB1A/NAtQB2wHcAQkCGQL0
AwAC9AHzARkBCQHbAtQMzQHOAdQB1QLcARkB8wL0EQAC9AEZAdwB1AHNA9QBzQHUAdwBGQL0BQAC9AEZ
AdwB1QPUAdsB3AEZA/8B9AEZAtwB1QHUAdUB3AEZAvQFAAL0AQkB2wHUD80C1AHbAdwBCQIZAvQDAAL0
ARkBCQHbAtQPzQLUAdsBCQEZAvQTAAH0Af8B3AXNAdwB/wH0CQAB9AH/AdwDzQHUAdwBGQP/ARkB3AHU
A80B3AH/AfQHAAL0AQkB2wHUD80C1AHbAdwBCQIZAvQDAAL0ARkBCQHbAtQPzQLUAdsBCQEZAvQTAAL0
ARkB3AHUAc0B1AHcARkC9AkAAvQBGQPcAdUB1AHVA9wB1QHUAdUD3AEZAvQHAAL0AQkB2wHUD80C1AHb
AdwBCQIZAvQDAAL0ARkBCQHbAtQPzQLUAdsBCQEZAvQVAAH0Af8B3AHNAdwB/wH0DQAB9AP/AdwHzQHc
A/8B9AkAAvQBCQHbAdQPzQLUAdsB3AEJAhkC9AMAAvQB8wEZAQkT3AEJARkB8wL0FQAC9AEZAdwBGQL0
DQAE9AEZB9wBGQT0CQAC9AIZEtwBCQIZBPQFAAL0Ff8C9BkAAfQB/wH0EwAB9Af/AfQNAAL0Gf8C9AIA
AUIBTQE+BwABPgMAASgDAAGAAwABYAMAAQEBAAEBBgABBhYAA///AP8AAwAB4AEAAQMC/wGAAQMD/wGA
Af8EAAHgAQABAwL/AYABAwP/AYAB/wQAAYACAAH/AfgCAAE/AYABOAEAAf8EAAGAAgAB/wH4AgABPwGA
ATgBAAH/BAABgAIAAf8B4AIAAQ8BgAIAAf8EAAGAAgAB/wHgAgABDwGAAgAB/wcAAT8BgAIAAQMBgAIA
Af8HAAE/AYACAAEDAYACAAH/BwABPwGAAgABAwGACgABPwGAAgABAwHgCgABPwQAAeAKAAE/BAAB4AoA
AT8EAAHgCgABPwQAAfgKAAE/BAAB4AoAAT8EAAHgAgABAwcAAT8EAAGAAgABAwQAAYACAAH/BAABgAIA
AQ8EAAGAAgABgAcAAQ8EAAGAAgABgAcAAT8EAAGACgABDwQAAeABAAECCAABDwQAAeAKAAEPBAAB/gMA
AYACAAEDAwABDwQAAf4DAAGAAgABAwMAAQMEAAH+AwABgAIAAQMB/gIAAQMEAAH+AwABgAIAAQMB/gIA
AQMEAAH+AwAB4AIAAQ8B/gIAAQMEAAH+AwAB4AIAAQ8B/gIAAQMEAAH/AYABAAEDAfgCAAE/Af4BAAE4
AQMEAAH/AYABAAEDAfgCAAE/Af4BAAE4AQMEAAH/Af4BAAL/AYABAwH/Af4BDwL/BAAB/gIAAf8B+AED
A/8B4AEPAf8EAAH+AgAB/wH4AQMD/wHgAQ8B/wQAAeACAAEPAYABAAE/Af8B/gIAAf8EAAHgAgABDwGA
AQABPwH/Af4CAAH/BAABgAIAAQMBgAEAAT8B/wH4AgABPwQAAYACAAEDAYABAAE/Af8B+AIAAT8EAAGA
AgABAwIAAQ8B/wHgAgABDwQAAYACAAEDAgABDwH/AeACAAEPCgABDwH/AYACAAEDCQAB4AEPAf8BgAIA
AQMJAAHgAQ8B/wGAAgABAwkAAeABDwH/AYACAAEDCgABDwH/DgABDwH/DgABCAH/DAABgAEAATgB/wEA
AQMBgAkAAYABAAEgAT8BAAEDAYAFAAGAAgABAwGAAQABIAE/AQABAwGABQABgAIAAQMBgAIAAQ8IAAGA
AgABAwH4AgABDwgAAYACAAEDAfgCAAEDCAAB4AIAAQ8B/wHgAQABAwGAAgABAwQAAeACAAEPAf8B4AIA
AYACAAEDBAAB+AIAAT8B/wH4AgABgAIAAQMEAAHgAgABDwH/AfgCAAGAAgABAwQAAeACAAEPAf8B/gEA
AQMB4AIAAQ8BgAIAAQMBgAIAAQMB/wH+AQABAwHgAgABDwGAAgABAwGAAgABAwL/AYABDwH4AgABPwGA
AgABAwGAAgABAwL/AYABDwH4AgABPwGAAgABAwGAAgABAwL/AeABPwH+AgAB/wGAAgABAwGAAgABAwL/
AeABPwH+AgAB/wGAAgABAwHgAgABDwL/AfgC/wHgAQ8B/wGAAgABAws=
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View file

@ -13,6 +13,7 @@ namespace PKHeX
LoadData();
}
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
@ -24,7 +25,7 @@ namespace PKHeX
}
private void LoadData()
{
int o = Main.SAV.OPower;
int o = SAV.OPower;
// Fill up the 17 o-powers
// 1 2 3 4 5 10 use 4 bytes, everything else uses 3
@ -52,15 +53,15 @@ namespace PKHeX
CB_17.SelectedIndex = getIndex(o, 3);//o += 3; // 3E-40
// Load Maxes
o = Main.SAV.OPower;
CHK_1.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x00]);
CHK_2.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x05]);
CHK_3.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x0A]);
CHK_4.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x0F]);
CHK_5.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x14]);
CHK_6.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x19]);
CHK_7.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x26]);
CHK_8.Checked = Convert.ToBoolean(Main.SAV.Data[o + 0x2B]);
o = SAV.OPower;
CHK_1.Checked = Convert.ToBoolean(SAV.Data[o + 0x00]);
CHK_2.Checked = Convert.ToBoolean(SAV.Data[o + 0x05]);
CHK_3.Checked = Convert.ToBoolean(SAV.Data[o + 0x0A]);
CHK_4.Checked = Convert.ToBoolean(SAV.Data[o + 0x0F]);
CHK_5.Checked = Convert.ToBoolean(SAV.Data[o + 0x14]);
CHK_6.Checked = Convert.ToBoolean(SAV.Data[o + 0x19]);
CHK_7.Checked = Convert.ToBoolean(SAV.Data[o + 0x26]);
CHK_8.Checked = Convert.ToBoolean(SAV.Data[o + 0x2B]);
}
private void SaveData()
{
@ -76,7 +77,7 @@ namespace PKHeX
0x27,
0x2C,0x2F,0x32,0x35,0x38,0x3B,0x3E,
};
int o = Main.SAV.OPower; // offset
int o = SAV.OPower; // offset
for (int i = 0; i < cba.Length; i++)
{
@ -90,14 +91,15 @@ namespace PKHeX
// Save Maxes
Main.SAV.Data[o + 0x00] = Convert.ToByte(CHK_1.Checked);
Main.SAV.Data[o + 0x05] = Convert.ToByte(CHK_2.Checked);
Main.SAV.Data[o + 0x0A] = Convert.ToByte(CHK_3.Checked);
Main.SAV.Data[o + 0x0F] = Convert.ToByte(CHK_4.Checked);
Main.SAV.Data[o + 0x14] = Convert.ToByte(CHK_5.Checked);
Main.SAV.Data[o + 0x19] = Convert.ToByte(CHK_6.Checked);
Main.SAV.Data[o + 0x26] = Convert.ToByte(CHK_7.Checked);
Main.SAV.Data[o + 0x2B] = Convert.ToByte(CHK_8.Checked);
SAV.Data[o + 0x00] = Convert.ToByte(CHK_1.Checked);
SAV.Data[o + 0x05] = Convert.ToByte(CHK_2.Checked);
SAV.Data[o + 0x0A] = Convert.ToByte(CHK_3.Checked);
SAV.Data[o + 0x0F] = Convert.ToByte(CHK_4.Checked);
SAV.Data[o + 0x14] = Convert.ToByte(CHK_5.Checked);
SAV.Data[o + 0x19] = Convert.ToByte(CHK_6.Checked);
SAV.Data[o + 0x26] = Convert.ToByte(CHK_7.Checked);
SAV.Data[o + 0x2B] = Convert.ToByte(CHK_8.Checked);
Array.Copy(SAV.Data, Main.SAV.Data, SAV.Data.Length);
Main.SAV.Edited = true;
}
private int getIndex(int o, int l)

View file

@ -1,6 +1,6 @@
namespace PKHeX
{
partial class SAV_BerryFieldORAS
partial class SAV_PokeBlockORAS
{
/// <summary>
/// Required designer variable.
@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_BerryFieldORAS));
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_PokeBlockORAS));
this.B_Cancel = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.NUP_Red = new System.Windows.Forms.NumericUpDown();
@ -466,7 +466,7 @@
this.MaximumSize = new System.Drawing.Size(420, 220);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(420, 220);
this.Name = "SAV_BerryFieldORAS";
this.Name = "SAV_PokeBlockORAS";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Berry Field Editor";
((System.ComponentModel.ISupportInitialize)(this.NUP_Red)).EndInit();

View file

@ -3,9 +3,9 @@ using System.Windows.Forms;
namespace PKHeX
{
public partial class SAV_BerryFieldORAS : Form
public partial class SAV_PokeBlockORAS : Form
{
public SAV_BerryFieldORAS()
public SAV_PokeBlockORAS()
{
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
@ -15,11 +15,11 @@ namespace PKHeX
for (int i = 0; i < lbl_spec.Length; i++)
{
lbl_spec[i].Text = $"{Main.pokeblocks[94 + i]}:";
nup_spec[i].Value = BitConverter.ToUInt32(sav, Main.SAV.Contest + i * 4);
nup_spec[i].Value = BitConverter.ToUInt32(SAV.Data, SAV.Contest + i * 4);
}
}
private readonly NumericUpDown[] nup_spec;
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private void B_Cancel_Click(object sender, EventArgs e)
{
@ -28,8 +28,8 @@ namespace PKHeX
private void B_Save_Click(object sender, EventArgs e)
{
for (int i = 0; i < nup_spec.Length; i++)
BitConverter.GetBytes((uint)nup_spec[i].Value).CopyTo(sav, Main.SAV.Contest + i * 4);
Main.SAV.Data = (byte[])sav.Clone();
BitConverter.GetBytes((uint)nup_spec[i].Value).CopyTo(SAV.Data, SAV.Contest + i * 4);
Main.SAV.Data = (byte[])SAV.Data.Clone();
Close();
}
@ -45,7 +45,7 @@ namespace PKHeX
{
ushort berry = plantable[Util.rnd32() % (plantable.Length - 1) + 1]; // get random berry item ID from list
BitConverter.GetBytes(berry).CopyTo(tree, 6); // put berry into tree.
tree.CopyTo(sav, Main.SAV.BerryField + 0x10 * i); // put tree into plot
tree.CopyTo(SAV.Data, SAV.BerryField + 0x10 * i); // put tree into plot
}
}
private void B_GiveAllBlocks_Click(object sender, EventArgs e)

View file

@ -32,12 +32,12 @@ namespace PKHeX
getData();
editing = false;
LB_Species.SelectedIndex = 0;
TB_Spinda.Text = BitConverter.ToUInt32(sav, Main.SAV.Spinda).ToString("X8");
TB_Spinda.Text = BitConverter.ToUInt32(SAV.Data, SAV.Spinda).ToString("X8");
}
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private readonly CheckBox[] CP;
private readonly CheckBox[] CL;
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly bool[,] specbools = new bool[9, 0x60 * 8];
private readonly bool[,] langbools = new bool[7, 0x60 * 8];
private BitArray formbools;
@ -123,13 +123,13 @@ namespace PKHeX
CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = gt != 0 && gt != 255; // Not Male-Only and Not Genderless
// Load Encountered Count
MT_Count.Text = BitConverter.ToUInt16(sav, Main.SAV.EncounterCount + (pk - 1) * 2).ToString();
MT_Count.Text = BitConverter.ToUInt16(SAV.Data, SAV.EncounterCount + (pk - 1) * 2).ToString();
CLB_FormsSeen.Items.Clear();
CLB_FormDisplayed.Items.Clear();
int fc = PKX.Personal[species].FormeCount;
int f = PKX.getDexFormIndexORAS(species, fc);
int f = SaveUtil.getDexFormIndexORAS(species, fc);
if (f < 0)
return;
string[] forms = PKX.getFormList(species, Main.types, Main.forms, Main.gendersymbols);
@ -170,10 +170,10 @@ namespace PKHeX
langbools[5, species - 1] = CHK_L6.Checked;
langbools[6, species - 1] = CHK_L7.Checked;
BitConverter.GetBytes((ushort)Math.Min(0xFFFF, Util.ToUInt32(MT_Count.Text))).CopyTo(sav, Main.SAV.EncounterCount + (species - 1) * 2);
BitConverter.GetBytes((ushort)Math.Min(0xFFFF, Util.ToUInt32(MT_Count.Text))).CopyTo(SAV.Data, SAV.EncounterCount + (species - 1) * 2);
int fc = PKX.Personal[species].FormeCount;
int f = PKX.getDexFormIndexORAS(species, fc);
int f = SaveUtil.getDexFormIndexORAS(species, fc);
if (f < 0)
return;
@ -196,8 +196,8 @@ namespace PKHeX
for (int i = 0; i < 9; i++)
{
byte[] data = new byte[0x60];
int offset = Main.SAV.PokeDex + 0x8 + 0x60 * i;
Array.Copy(sav, offset, data, 0, data.Length);
int offset = SAV.PokeDex + 0x8 + 0x60 * i;
Array.Copy(SAV.Data, offset, data, 0, data.Length);
BitArray BitRegion = new BitArray(data);
for (int b = 0; b < 0x60 * 8; b++)
specbools[i, b] = BitRegion[b];
@ -205,14 +205,14 @@ namespace PKHeX
// Fill Language arrays
byte[] langdata = new byte[0x280];
Array.Copy(sav, Main.SAV.PokeDexLanguageFlags, langdata, 0, langdata.Length);
Array.Copy(SAV.Data, SAV.PokeDexLanguageFlags, langdata, 0, langdata.Length);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < 721; b++) // 721 Species
for (int i = 0; i < 7; i++) // 7 Languages
langbools[i, b] = LangRegion[7 * b + i];
byte[] formdata = new byte[FormLen*4];
Array.Copy(sav, Main.SAV.PokeDex + 0x368, formdata, 0, formdata.Length);
Array.Copy(SAV.Data, SAV.PokeDex + 0x368, formdata, 0, formdata.Length);
formbools = new BitArray(formdata);
}
private void setData()
@ -227,7 +227,7 @@ namespace PKHeX
if (specbools[p, i])
sdata[i/8] |= (byte) (1 << i%8);
sdata.CopyTo(sav, Main.SAV.PokeDex + 8 + 0x60*p);
sdata.CopyTo(SAV.Data, SAV.PokeDex + 8 + 0x60*p);
}
// Build new bool array for the Languages
@ -243,13 +243,13 @@ namespace PKHeX
if (languagedata[i])
ldata[i/8] |= (byte) (1 << i%8);
ldata.CopyTo(sav, Main.SAV.PokeDexLanguageFlags);
ldata.CopyTo(SAV.Data, SAV.PokeDexLanguageFlags);
formbools.CopyTo(sav, Main.SAV.PokeDex + 0x368);
formbools.CopyTo(SAV.Data, SAV.PokeDex + 0x368);
// Store Spinda Spot
uint PID = Util.getHEXval(TB_Spinda.Text);
BitConverter.GetBytes(PID).CopyTo(sav, Main.SAV.Spinda);
BitConverter.GetBytes(PID).CopyTo(SAV.Data, SAV.Spinda);
}
private void B_Cancel_Click(object sender, EventArgs e)
@ -262,7 +262,7 @@ namespace PKHeX
setData();
// Return back to the parent savefile
Array.Copy(sav, Main.SAV.Data, sav.Length);
Array.Copy(SAV.Data, Main.SAV.Data, SAV.Data.Length);
Main.SAV.Edited = true;
Close();
}
@ -313,17 +313,17 @@ namespace PKHeX
if (mnuDexNav == sender)
{
for (int i = 0; i < 0x2D1; i++)
BitConverter.GetBytes((ushort)999).CopyTo(sav, Main.SAV.EncounterCount + i * 2);
BitConverter.GetBytes((ushort)999).CopyTo(SAV.Data, SAV.EncounterCount + i * 2);
return;
}
if (mnuResetNav == sender)
{
for (int i = 0; i < 0x2D1; i++)
BitConverter.GetBytes((ushort)0).CopyTo(sav, Main.SAV.EncounterCount + i * 2);
BitConverter.GetBytes((ushort)0).CopyTo(SAV.Data, SAV.EncounterCount + i * 2);
return;
}
int lang = Main.SAV.Language;
int lang = SAV.Language;
if (lang > 5) lang -= 1;
lang -= 1;
@ -392,7 +392,7 @@ namespace PKHeX
setEntry();
setData();
if (mnuComplete == sender) // Turn off Italian Petlil
sav[Main.SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
SAV.Data[SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
getData();
getEntry();

View file

@ -32,12 +32,12 @@ namespace PKHeX
getData();
editing = false;
LB_Species.SelectedIndex = 0;
TB_Spinda.Text = BitConverter.ToUInt32(sav, Main.SAV.Spinda).ToString("X8");
TB_Spinda.Text = BitConverter.ToUInt32(SAV.Data, SAV.Spinda).ToString("X8");
}
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private readonly CheckBox[] CP;
private readonly CheckBox[] CL;
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly bool[,] specbools = new bool[9, 0x60 * 8];
private readonly bool[,] langbools = new bool[7, 0x60 * 8];
private readonly bool[] foreignbools = new bool[0x52 * 8];
@ -130,7 +130,7 @@ namespace PKHeX
CLB_FormDisplayed.Items.Clear();
int fc = PKX.Personal[species].FormeCount;
int f = PKX.getDexFormIndexXY(species, fc);
int f = SaveUtil.getDexFormIndexXY(species, fc);
if (f < 0)
return;
string[] forms = PKX.getFormList(species, Main.types, Main.forms, Main.gendersymbols);
@ -174,7 +174,7 @@ namespace PKHeX
langbools[6, species - 1] = CHK_L7.Checked;
int fc = PKX.Personal[species].FormeCount;
int f = PKX.getDexFormIndexORAS(species, fc);
int f = SaveUtil.getDexFormIndexORAS(species, fc);
if (f < 0)
return;
@ -197,7 +197,7 @@ namespace PKHeX
for (int i = 0; i < 9; i++)
{
byte[] data = new byte[0x60];
Array.Copy(sav, Main.SAV.PokeDex + 8 + 0x60 * i, data, 0, 0x60);
Array.Copy(SAV.Data, SAV.PokeDex + 8 + 0x60 * i, data, 0, 0x60);
BitArray BitRegion = new BitArray(data);
for (int b = 0; b < 0x60 * 8; b++)
specbools[i, b] = BitRegion[b];
@ -205,7 +205,7 @@ namespace PKHeX
// Fill Language arrays
byte[] langdata = new byte[0x280];
Array.Copy(sav, Main.SAV.PokeDexLanguageFlags, langdata, 0, 0x280);
Array.Copy(SAV.Data, SAV.PokeDexLanguageFlags, langdata, 0, 0x280);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < 721; b++) // 721 Species
for (int i = 0; i < 7; i++) // 7 Languages
@ -213,13 +213,13 @@ namespace PKHeX
// Fill Foreign array
byte[] foreigndata = new byte[0x52];
Array.Copy(sav, Main.SAV.PokeDex + 0x64C, foreigndata, 0, 0x52);
Array.Copy(SAV.Data, SAV.PokeDex + 0x64C, foreigndata, 0, 0x52);
BitArray ForeignRegion = new BitArray(foreigndata);
for (int b = 0; b < 0x52 * 8; b++)
foreignbools[b] = ForeignRegion[b];
byte[] formdata = new byte[FormLen*4];
Array.Copy(sav, Main.SAV.PokeDex + 0x368, formdata, 0, formdata.Length);
Array.Copy(SAV.Data, SAV.PokeDex + 0x368, formdata, 0, formdata.Length);
formbools = new BitArray(formdata);
}
private void setData()
@ -234,7 +234,7 @@ namespace PKHeX
if (specbools[p, i])
sdata[i / 8] |= (byte)(1 << i % 8);
sdata.CopyTo(sav, Main.SAV.PokeDex + 8 + 0x60 * p);
sdata.CopyTo(SAV.Data, SAV.PokeDex + 8 + 0x60 * p);
}
// Build new bool array for the Languages
@ -251,10 +251,10 @@ namespace PKHeX
if (languagedata[i])
ldata[i / 8] |= (byte)(1 << i % 8);
ldata.CopyTo(sav, Main.SAV.PokeDexLanguageFlags);
ldata.CopyTo(SAV.Data, SAV.PokeDexLanguageFlags);
}
formbools.CopyTo(sav, Main.SAV.PokeDex + 0x368);
formbools.CopyTo(SAV.Data, SAV.PokeDex + 0x368);
// Return Foreign Array
{
@ -262,12 +262,12 @@ namespace PKHeX
for (int i = 0; i < 0x52 * 8; i++)
if (foreignbools[i])
foreigndata[i / 8] |= (byte)(1 << i % 8);
foreigndata.CopyTo(sav, Main.SAV.PokeDex + 0x64C);
foreigndata.CopyTo(SAV.Data, SAV.PokeDex + 0x64C);
}
// Store Spinda Spot
uint PID = Util.getHEXval(TB_Spinda.Text);
BitConverter.GetBytes(PID).CopyTo(sav, Main.SAV.Spinda);
BitConverter.GetBytes(PID).CopyTo(SAV.Data, SAV.Spinda);
}
private void B_Cancel_Click(object sender, EventArgs e)
@ -280,7 +280,7 @@ namespace PKHeX
setData();
// Return back to the parent savefile
Array.Copy(sav, Main.SAV.Data, sav.Length);
Array.Copy(SAV.Data, Main.SAV.Data, SAV.Data.Length);
Main.SAV.Edited = true;
Close();
}
@ -324,7 +324,7 @@ namespace PKHeX
}
private void modifyAll(object sender, EventArgs e)
{
int lang = Main.SAV.Language;
int lang = SAV.Language;
if (lang > 5) lang -= 1;
lang -= 1;
@ -393,7 +393,7 @@ namespace PKHeX
setEntry();
setData();
if (mnuComplete == sender) // Turn off Italian Petlil
sav[Main.SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
SAV.Data[SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
getData();
getEntry();

View file

@ -18,7 +18,7 @@ namespace PKHeX
new ToolTip().SetToolTip(B_All, "Hold CTRL to give Deluxe instead of Supreme.");
}
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private readonly string[] pfa;
private void Setup()
{
@ -52,9 +52,9 @@ namespace PKHeX
for (int i = 0; i < 100; i++)
{
dgv.Rows[i].Cells[0].Value = (i + 1).ToString();
dgv.Rows[i].Cells[1].Value = pfa[sav[Main.SAV.Puff + i]];
dgv.Rows[i].Cells[1].Value = pfa[SAV.Data[SAV.Puff + i]];
}
MT_CNT.Text = Main.SAV.PuffCount.ToString();
MT_CNT.Text = SAV.PuffCount.ToString();
}
private void dropclick(object sender, DataGridViewCellEventArgs e)
{
@ -79,7 +79,7 @@ namespace PKHeX
for (int i = 0; i < 100; i++)
newpuffs[i] = (byte)(Util.rnd32()%basemod + basepuff);
Array.Copy(newpuffs, 0, sav, Main.SAV.Puff, 100);
Array.Copy(newpuffs, 0, SAV.Data, SAV.Puff, 100);
Setup();
}
private void B_None_Click(object sender, EventArgs e)
@ -90,7 +90,7 @@ namespace PKHeX
newpuffs[2] = 3;
newpuffs[3] = 4;
newpuffs[4] = 5;
Array.Copy(newpuffs, 0, sav, Main.SAV.Puff, 100);
Array.Copy(newpuffs, 0, SAV.Data, SAV.Puff, 100);
Setup();
}
private void B_Sort_Click(object sender, EventArgs e)
@ -121,7 +121,7 @@ namespace PKHeX
Array.Sort(puffarray);
Array.Resize(ref puffarray, 100);
}
Array.Copy(puffarray, 0, sav, Main.SAV.Puff, 100);
Array.Copy(puffarray, 0, SAV.Data, SAV.Puff, 100);
Setup();
}
private void B_Save_Click(object sender, EventArgs e)
@ -138,8 +138,9 @@ namespace PKHeX
}
puffarray[i - emptyslots] = (byte)Array.IndexOf(pfa, puff);
}
Main.SAV.Puffs = puffarray;
Main.SAV.PuffCount = Util.ToInt32(MT_CNT.Text);
SAV.Puffs = puffarray;
SAV.PuffCount = Util.ToInt32(MT_CNT.Text);
Main.SAV.Data = SAV.Data;
Main.SAV.Edited = true;
Close();
}

View file

@ -18,11 +18,11 @@ namespace PKHeX
LB_Favorite.SelectedIndex = 0;
// MT_Flags.Text = BitConverter.ToUInt16(sav, 0x24800 + 0x140).ToString(); PSS Stat transmitted
MT_Flags.Text = BitConverter.ToUInt32(sav, Main.SAV.SecretBase + 0x62C).ToString(); // read counter
MT_Flags.Text = BitConverter.ToUInt32(SAV.Data, SAV.SecretBase + 0x62C).ToString(); // read counter
B_SAV2FAV(null, null);
}
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private bool editing;
private bool loading = true;
@ -53,13 +53,13 @@ namespace PKHeX
{
LB_Favorite.Items.Clear();
int playeroff = Main.SAV.SecretBase + 0x326;
int favoff = Main.SAV.SecretBase + 0x63A;
string OT = Util.TrimFromZero(Encoding.Unicode.GetString(sav, playeroff + 0x218, 0x1A));
int playeroff = SAV.SecretBase + 0x326;
int favoff = SAV.SecretBase + 0x63A;
string OT = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, playeroff + 0x218, 0x1A));
LB_Favorite.Items.Add("* " + OT);
for (int i = 0; i < 30; i++)
{
string BaseTrainer = Util.TrimFromZero(Encoding.Unicode.GetString(sav, favoff + i * 0x3E0 + 0x218, 0x1A));
string BaseTrainer = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, favoff + i * 0x3E0 + 0x218, 0x1A));
if (BaseTrainer.Length < 1 || BaseTrainer[0] == '\0')
BaseTrainer = "Empty";
LB_Favorite.Items.Add(i + " " + BaseTrainer);
@ -70,24 +70,24 @@ namespace PKHeX
loading = true;
int index = LB_Favorite.SelectedIndex;
if (index < 0) return;
int offset = Main.SAV.SecretBase + 0x25A;
int offset = SAV.SecretBase + 0x25A;
// Base Offset Changing
if (index == 0) offset = Main.SAV.SecretBase + 0x326;
if (index == 0) offset = SAV.SecretBase + 0x326;
else offset += 0x3E0 * index;
string TrainerName = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x218, 0x1A));
string TrainerName = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x218, 0x1A));
TB_FOT.Text = TrainerName;
TB_FT1.Text = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x232 + 0x22 * 0, 0x22));
TB_FT2.Text = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x232 + 0x22 * 1, 0x22));
TB_FT1.Text = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x232 + 0x22 * 0, 0x22));
TB_FT2.Text = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x232 + 0x22 * 1, 0x22));
string saying1 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x276 + 0x22 * 0, 0x22));
string saying2 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x276 + 0x22 * 1, 0x22));
string saying3 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x276 + 0x22 * 2, 0x22));
string saying4 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, offset + 0x276 + 0x22 * 3, 0x22));
string saying1 = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x276 + 0x22 * 0, 0x22));
string saying2 = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x276 + 0x22 * 1, 0x22));
string saying3 = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x276 + 0x22 * 2, 0x22));
string saying4 = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, offset + 0x276 + 0x22 * 3, 0x22));
int baseloc = BitConverter.ToInt16(sav, offset);
int baseloc = BitConverter.ToInt16(SAV.Data, offset);
NUD_FBaseLocation.Value = baseloc;
TB_FSay1.Text = saying1; TB_FSay2.Text = saying2; TB_FSay3.Text = saying3; TB_FSay4.Text = saying4;
@ -96,7 +96,7 @@ namespace PKHeX
objdata = new byte[25, 12];
for (int i = 0; i < 25; i++)
for (int z = 0; z < 12; z++)
objdata[i, z] = sav[offset + 2 + 12 * i + z];
objdata[i, z] = SAV.Data[offset + 2 + 12 * i + z];
NUD_FObject.Value = 1; // Trigger Update
changeObjectIndex(null, null);
@ -107,7 +107,7 @@ namespace PKHeX
if (index > 0)
for (int i = 0; i < 3; i++)
for (int z = 0; z < 0x34; z++)
pkmdata[i, z] = sav[offset + 0x32E + 0x34 * i + z];
pkmdata[i, z] = SAV.Data[offset + 0x32E + 0x34 * i + z];
NUD_FPKM.Value = 1;
changeFavPKM(null, null); // Trigger Update
@ -127,54 +127,54 @@ namespace PKHeX
if (LB_Favorite.Items[index].ToString().Substring(LB_Favorite.Items[index].ToString().Length - 5, 5) == "Empty")
{ Util.Error("Sorry, no overwriting an empty base with someone else's."); return; }
if (index < 0) return;
int offset = Main.SAV.SecretBase + 0x25A;
int offset = SAV.SecretBase + 0x25A;
// Base Offset Changing
if (index == 0)
offset = Main.SAV.SecretBase + 0x326;
offset = SAV.SecretBase + 0x326;
else offset += 0x3E0 * index;
string TrainerName = TB_FOT.Text;
byte[] tr = Encoding.Unicode.GetBytes(TrainerName);
Array.Resize(ref tr, 0x22); Array.Copy(tr, 0, sav, offset + 0x218, 0x1A);
Array.Resize(ref tr, 0x22); Array.Copy(tr, 0, SAV.Data, offset + 0x218, 0x1A);
string team1 = TB_FT1.Text;
string team2 = TB_FT2.Text;
byte[] t1 = Encoding.Unicode.GetBytes(team1);
Array.Resize(ref t1, 0x22); Array.Copy(t1, 0, sav, offset + 0x232 + 0x22 * 0, 0x22);
Array.Resize(ref t1, 0x22); Array.Copy(t1, 0, SAV.Data, offset + 0x232 + 0x22 * 0, 0x22);
byte[] t2 = Encoding.Unicode.GetBytes(team2);
Array.Resize(ref t2, 0x22); Array.Copy(t2, 0, sav, offset + 0x232 + 0x22 * 1, 0x22);
Array.Resize(ref t2, 0x22); Array.Copy(t2, 0, SAV.Data, offset + 0x232 + 0x22 * 1, 0x22);
string saying1 = TB_FSay1.Text;
string saying2 = TB_FSay2.Text;
string saying3 = TB_FSay3.Text;
string saying4 = TB_FSay4.Text;
byte[] s1 = Encoding.Unicode.GetBytes(saying1);
Array.Resize(ref s1, 0x22); Array.Copy(s1, 0, sav, offset + 0x276 + 0x22 * 0, 0x22);
Array.Resize(ref s1, 0x22); Array.Copy(s1, 0, SAV.Data, offset + 0x276 + 0x22 * 0, 0x22);
byte[] s2 = Encoding.Unicode.GetBytes(saying2);
Array.Resize(ref s2, 0x22); Array.Copy(s2, 0, sav, offset + 0x276 + 0x22 * 1, 0x22);
Array.Resize(ref s2, 0x22); Array.Copy(s2, 0, SAV.Data, offset + 0x276 + 0x22 * 1, 0x22);
byte[] s3 = Encoding.Unicode.GetBytes(saying3);
Array.Resize(ref s3, 0x22); Array.Copy(s3, 0, sav, offset + 0x276 + 0x22 * 2, 0x22);
Array.Resize(ref s3, 0x22); Array.Copy(s3, 0, SAV.Data, offset + 0x276 + 0x22 * 2, 0x22);
byte[] s4 = Encoding.Unicode.GetBytes(saying4);
Array.Resize(ref s4, 0x22); Array.Copy(s4, 0, sav, offset + 0x276 + 0x22 * 3, 0x22);
Array.Resize(ref s4, 0x22); Array.Copy(s4, 0, SAV.Data, offset + 0x276 + 0x22 * 3, 0x22);
int baseloc = (int)NUD_FBaseLocation.Value;
if (baseloc < 3) baseloc = 0; // skip 1/2 baselocs as they are dummied out ingame.
Array.Copy(BitConverter.GetBytes(baseloc), 0, sav, offset, 2);
Array.Copy(BitConverter.GetBytes(baseloc), 0, SAV.Data, offset, 2);
TB_FOT.Text = TrainerName; TB_FSay1.Text = saying1; TB_FSay2.Text = saying2; TB_FSay3.Text = saying3; TB_FSay4.Text = saying4;
// Copy back Objects
for (int i = 0; i < 25; i++)
for (int z = 0; z < 12; z++)
sav[offset + 2 + 12 * i + z] = objdata[i, z];
SAV.Data[offset + 2 + 12 * i + z] = objdata[i, z];
if (GB_PKM.Enabled) // Copy pkm data back in
{
saveFavPKM();
for (int i = 0; i < 3; i++)
for (int z = 0; z < 0x34; z++)
sav[offset + 0x32E + 0x34 * i + z] = pkmdata[i, z];
SAV.Data[offset + 0x32E + 0x34 * i + z] = pkmdata[i, z];
}
popFavorite();
LB_Favorite.SelectedIndex = index;
@ -188,9 +188,9 @@ namespace PKHeX
private void B_Save_Click(object sender, EventArgs e)
{
uint flags = Util.ToUInt32(MT_Flags.Text);
Array.Copy(BitConverter.GetBytes(flags), 0, sav, Main.SAV.PSSStats + 0x140, 4); // write pss
Array.Copy(BitConverter.GetBytes(flags), 0, sav, Main.SAV.SecretBase + 0x62C, 4); // write counter
Array.Copy(sav, Main.SAV.Data, sav.Length);
Array.Copy(BitConverter.GetBytes(flags), 0, SAV.Data, SAV.PSSStats + 0x140, 4); // write pss
Array.Copy(BitConverter.GetBytes(flags), 0, SAV.Data, SAV.SecretBase + 0x62C, 4); // write counter
Main.SAV.Data = SAV.Data;
Main.SAV.Edited = true;
Close();
}
@ -201,8 +201,8 @@ namespace PKHeX
// int qty = BitConverter.ToUInt16(sav, offset + i * 4);
// int has = BitConverter.ToUInt16(sav, offset + i * 4 + 2);
sav[Main.SAV.SecretBase + i * 4] = 25;
sav[Main.SAV.SecretBase + i * 4 + 2] = 1;
SAV.Data[SAV.SecretBase + i * 4] = 25;
SAV.Data[SAV.SecretBase + i * 4 + 2] = 1;
}
}
@ -454,8 +454,8 @@ namespace PKHeX
if (LB_Favorite.SelectedIndex < 1) { Util.Alert("Cannot delete your Secret Base."); return; }
int index = LB_Favorite.SelectedIndex - 1;
int favoff = Main.SAV.SecretBase + 0x63A;
string BaseTrainer = Util.TrimFromZero(Encoding.Unicode.GetString(sav, favoff + index * 0x3E0 + 0x218, 0x1A));
int favoff = SAV.SecretBase + 0x63A;
string BaseTrainer = Util.TrimFromZero(Encoding.Unicode.GetString(SAV.Data, favoff + index * 0x3E0 + 0x218, 0x1A));
if (string.IsNullOrEmpty(BaseTrainer))
BaseTrainer = "Empty";
@ -465,9 +465,9 @@ namespace PKHeX
const int max = 29;
const int size = 0x3E0;
int offset = favoff + index * size;
if (index != max) Array.Copy(sav, offset + size, sav, offset, size * (max - index));
if (index != max) Array.Copy(SAV.Data, offset + size, SAV.Data, offset, size * (max - index));
// Ensure Last Entry is Cleared
Array.Copy(new byte[size], 0, sav, size * max, size);
Array.Copy(new byte[size], 0, SAV.Data, size * max, size);
popFavorite();
}
}

View file

@ -9,9 +9,9 @@ namespace PKHeX
{
trba = Main.trainingbags;
trba[0] = "---";
offsetTime = Main.SAV.SuperTrain + 0x08;
offsetSpec = Main.SAV.SuperTrain + 0x188;
offsetVal = Main.SAV.SuperTrain + 0x18A;
offsetTime = SAV.SuperTrain + 0x08;
offsetSpec = SAV.SuperTrain + 0x188;
offsetVal = SAV.SuperTrain + 0x18A;
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
string[] stages = Main.trainingstage;
@ -22,7 +22,7 @@ namespace PKHeX
setup();
}
private readonly byte[] sav = (byte[])Main.SAV.Data.Clone();
private readonly SAV6 SAV = new SAV6(Main.SAV.Data);
private readonly string[] trba = {
"Empty",
"HP Bag S","HP Bag M","HP Bag L",
@ -54,9 +54,9 @@ namespace PKHeX
listBox1.SelectedIndex = 0;
fillTrainingBags();
CB_S2.SelectedValue = (int)BitConverter.ToUInt16(sav, offsetSpec + 4 * 30);
TB_Time1.Text = BitConverter.ToSingle(sav, offsetTime + 4 * 30).ToString();
TB_Time2.Text = BitConverter.ToSingle(sav, offsetTime + 4 * 31).ToString();
CB_S2.SelectedValue = (int)BitConverter.ToUInt16(SAV.Data, offsetSpec + 4 * 30);
TB_Time1.Text = BitConverter.ToSingle(SAV.Data, offsetTime + 4 * 30).ToString();
TB_Time2.Text = BitConverter.ToSingle(SAV.Data, offsetTime + 4 * 31).ToString();
}
private void fillTrainingBags()
{
@ -85,11 +85,11 @@ namespace PKHeX
dataGridView1.Columns.Add(dgvBag);
dataGridView1.Rows.Add(12);
int offset = Main.SAV.SuperTrain + 0x308;
int offset = SAV.SuperTrain + 0x308;
for (int i = 0; i < 12; i++)
{
dataGridView1.Rows[i].Cells[0].Value = (i + 1).ToString();
dataGridView1.Rows[i].Cells[1].Value = trba[sav[offset + i]];
dataGridView1.Rows[i].Cells[1].Value = trba[SAV.Data[offset + i]];
}
}
private void dropclick(object sender, DataGridViewCellEventArgs e)
@ -106,9 +106,9 @@ namespace PKHeX
{
int index = listBox1.SelectedIndex;
if (index < 0) return;
TB_Time.Text = BitConverter.ToSingle(sav, offsetTime + 4 * index).ToString();
TB_Unk.Text = BitConverter.ToUInt16(sav, offsetVal + 4 * index).ToString();
CB_Species.SelectedValue = (int)BitConverter.ToUInt16(sav, offsetSpec + 4 * index);
TB_Time.Text = BitConverter.ToSingle(SAV.Data, offsetTime + 4 * index).ToString();
TB_Unk.Text = BitConverter.ToUInt16(SAV.Data, offsetVal + 4 * index).ToString();
CB_Species.SelectedValue = (int)BitConverter.ToUInt16(SAV.Data, offsetSpec + 4 * index);
}
private void B_Save_Click(object sender, EventArgs e)
{
@ -125,11 +125,11 @@ namespace PKHeX
}
bagarray[i - emptyslots] = (byte)Array.IndexOf(trba, bag);
}
try { BitConverter.GetBytes(float.Parse(TB_Time1.Text)).CopyTo(sav, offsetTime + 4 * 30); } catch { }
try { BitConverter.GetBytes(float.Parse(TB_Time2.Text)).CopyTo(sav, offsetTime + 4 * 31); } catch { }
BitConverter.GetBytes((ushort)Util.getIndex(CB_S2)).CopyTo(sav, offsetSpec + 4 * 30);
bagarray.CopyTo(sav, Main.SAV.SuperTrain + 0x308);
Array.Copy(sav, Main.SAV.Data, Main.SAV.Data.Length);
try { BitConverter.GetBytes(float.Parse(TB_Time1.Text)).CopyTo(SAV.Data, offsetTime + 4 * 30); } catch { }
try { BitConverter.GetBytes(float.Parse(TB_Time2.Text)).CopyTo(SAV.Data, offsetTime + 4 * 31); } catch { }
BitConverter.GetBytes((ushort)Util.getIndex(CB_S2)).CopyTo(SAV.Data, offsetSpec + 4 * 30);
bagarray.CopyTo(SAV.Data, SAV.SuperTrain + 0x308);
Array.Copy(SAV.Data, Main.SAV.Data, Main.SAV.Data.Length);
Main.SAV.Edited = true;
Close();
}
@ -141,19 +141,19 @@ namespace PKHeX
{
int index = listBox1.SelectedIndex;
if (index < 0) return;
BitConverter.GetBytes(Util.getIndex(CB_Species)).CopyTo(sav, offsetSpec + 4 * index);
BitConverter.GetBytes(Util.getIndex(CB_Species)).CopyTo(SAV.Data, offsetSpec + 4 * index);
}
private void changeRecordVal(object sender, EventArgs e)
{
int index = listBox1.SelectedIndex;
if (index < 0) return;
try { BitConverter.GetBytes(ushort.Parse(TB_Unk.Text)).CopyTo(sav, offsetVal + 4 * index); } catch { }
try { BitConverter.GetBytes(ushort.Parse(TB_Unk.Text)).CopyTo(SAV.Data, offsetVal + 4 * index); } catch { }
}
private void changeRecordTime(object sender, EventArgs e)
{
int index = listBox1.SelectedIndex;
if (index < 0) return;
try { BitConverter.GetBytes(float.Parse(TB_Time.Text)).CopyTo(sav, offsetTime + 4 * index); } catch { }
try { BitConverter.GetBytes(float.Parse(TB_Time.Text)).CopyTo(SAV.Data, offsetTime + 4 * index); } catch { }
}
}
}

View file

@ -410,9 +410,9 @@ namespace PKHeX
TB_Style.Text = SAV.Style.ToString();
// Load Play Time
MT_Hours.Text = Main.SAV.PlayedHours.ToString();
MT_Minutes.Text = Main.SAV.PlayedMinutes.ToString();
MT_Seconds.Text = Main.SAV.PlayedSeconds.ToString();
MT_Hours.Text = SAV.PlayedHours.ToString();
MT_Minutes.Text = SAV.PlayedMinutes.ToString();
MT_Seconds.Text = SAV.PlayedSeconds.ToString();
// Load PSS Sprite
CB_MultiplayerSprite.SelectedValue = SAV.Sprite;

View file

@ -35,6 +35,8 @@
this.B_Output = new System.Windows.Forms.Button();
this.B_Import = new System.Windows.Forms.Button();
this.LB_Received = new System.Windows.Forms.ListBox();
this.mnuDel = new System.Windows.Forms.ContextMenuStrip(this.components);
this.flagDel = new System.Windows.Forms.ToolStripMenuItem();
this.L_Received = new System.Windows.Forms.Label();
this.RTB = new System.Windows.Forms.RichTextBox();
this.L_Details = new System.Windows.Forms.Label();
@ -72,8 +74,7 @@
this.L_r2 = new System.Windows.Forms.Label();
this.L_r3 = new System.Windows.Forms.Label();
this.L_r4 = new System.Windows.Forms.Label();
this.mnuDel = new System.Windows.Forms.ContextMenuStrip(this.components);
this.flagDel = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_Preview)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Card01)).BeginInit();
this.mnuVSD.SuspendLayout();
@ -100,7 +101,6 @@
((System.ComponentModel.ISupportInitialize)(this.PB_Card21)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Card20)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Card19)).BeginInit();
this.mnuDel.SuspendLayout();
this.SuspendLayout();
//
// B_Save
@ -132,7 +132,7 @@
this.B_Output.Name = "B_Output";
this.B_Output.Size = new System.Drawing.Size(75, 23);
this.B_Output.TabIndex = 2;
this.B_Output.Text = "Output .wc6";
this.B_Output.Text = "Output";
this.B_Output.UseVisualStyleBackColor = true;
this.B_Output.Click += new System.EventHandler(this.B_Output_Click);
//
@ -143,7 +143,7 @@
this.B_Import.Name = "B_Import";
this.B_Import.Size = new System.Drawing.Size(75, 23);
this.B_Import.TabIndex = 3;
this.B_Import.Text = "Import .wc6";
this.B_Import.Text = "Import";
this.B_Import.UseVisualStyleBackColor = true;
this.B_Import.Click += new System.EventHandler(this.B_Import_Click);
//
@ -159,6 +159,20 @@
this.LB_Received.Sorted = true;
this.LB_Received.TabIndex = 5;
//
// mnuDel
//
this.mnuDel.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.flagDel});
this.mnuDel.Name = "mnuVSD";
this.mnuDel.Size = new System.Drawing.Size(108, 26);
//
// flagDel
//
this.flagDel.Name = "flagDel";
this.flagDel.Size = new System.Drawing.Size(107, 22);
this.flagDel.Text = "Delete";
this.flagDel.Click += new System.EventHandler(this.clearRecievedFlag);
//
// L_Received
//
this.L_Received.AutoSize = true;
@ -663,20 +677,6 @@
this.L_r4.Text = "19-24:";
this.L_r4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// mnuDel
//
this.mnuDel.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.flagDel});
this.mnuDel.Name = "mnuVSD";
this.mnuDel.Size = new System.Drawing.Size(108, 26);
//
// flagDel
//
this.flagDel.Name = "flagDel";
this.flagDel.Size = new System.Drawing.Size(107, 22);
this.flagDel.Text = "Delete";
this.flagDel.Click += new System.EventHandler(this.clearRecievedFlag);
//
// SAV_Wondercard
//
this.AllowDrop = true;
@ -729,6 +729,7 @@
this.Name = "SAV_Wondercard";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Wonder Card I/O";
this.mnuDel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB_Preview)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Card01)).EndInit();
this.mnuVSD.ResumeLayout(false);
@ -755,7 +756,6 @@
((System.ComponentModel.ISupportInitialize)(this.PB_Card21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Card20)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Card19)).EndInit();
this.mnuDel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();

View file

@ -8,10 +8,11 @@ namespace PKHeX
{
public partial class SAV_Wondercard : Form
{
public SAV_Wondercard(byte[] wcdata = null)
public SAV_Wondercard(MysteryGift g = null)
{
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
mga = Main.SAV.GiftAlbum;
pba = new[]
{
PB_Card01, PB_Card02, PB_Card03, PB_Card04, PB_Card05, PB_Card06,
@ -25,8 +26,19 @@ namespace PKHeX
pb.AllowDrop = true;
// The PictureBoxes have their own drag&drop event handlers.
}
populateWClist();
populateReceived();
// Hide slots not present on game
for (int i = mga.Gifts.Length; i < pba.Length; i++)
pba[i].Visible = false;
if (mga.Gifts.Length < 7)
L_r2.Visible = false;
if (mga.Gifts.Length < 13)
L_r3.Visible = false;
if (mga.Gifts.Length < 19)
L_r4.Visible = false;
setGiftBoxes();
getReceivedFlags();
if (LB_Received.Items.Count > 0)
LB_Received.SelectedIndex = 0;
@ -34,60 +46,56 @@ namespace PKHeX
DragEnter += tabMain_DragEnter;
DragDrop += tabMain_DragDrop;
if (wcdata == null || wcdata.Length != WC6.Size)
return;
Array.Copy(wcdata, wc6.Data, wcdata.Length);
loadwcdata();
if (g == null)
clickView(PB_Card01, null);
else
viewGiftData(g);
}
private readonly SAV6 SAV = new SAV6((byte[])Main.SAV.Data.Clone());
private WC6 wc6 = new WC6();
private readonly SaveFile SAV = Main.SAV.Clone();
private MysteryGiftAlbum mga;
private MysteryGift mg;
private readonly PictureBox[] pba;
// Repopulation Functions
private int currentSlot;
private void setBackground(int index, Image bg)
{
for (int i = 0; i < 24; i++)
for (int i = 0; i < mga.Gifts.Length; i++)
pba[i].BackgroundImage = index == i ? bg : null;
currentSlot = index;
}
private void populateWClist()
private void setGiftBoxes()
{
for (int i = 0; i < 24; i++)
for (int i = 0; i < mga.Gifts.Length; i++)
{
WC6 wc = SAV.getWC6(i);
pba[i].Image = wc.CardID == 0 ? null : wc.Preview;
MysteryGift m = mga.Gifts[i];
pba[i].Image = m.Empty ? null : getSprite(m);
}
}
private void loadwcdata()
private void viewGiftData(MysteryGift g)
{
if (wc6 == null)
return;
try
{
if (wc6.GiftUsed && DialogResult.Yes ==
if (g.GiftUsed && DialogResult.Yes ==
Util.Prompt(MessageBoxButtons.YesNo,
"Wonder Card is marked as USED and will not be able to be picked up in-game.",
"Do you want to remove the USED flag so that it is UNUSED?"))
wc6.GiftUsed = false;
g.GiftUsed = false;
RTB.Text = wc6.Description;
PB_Preview.Image = wc6.Preview;
RTB.Text = getDescription(g);
PB_Preview.Image = getSprite(g);
mg = g;
}
catch (Exception e)
{
Util.Error("Loading of data failed... is this really a Wonder Card?", e.ToString());
wc6 = new WC6();
RTB.Clear();
}
}
private void populateReceived()
private void getReceivedFlags()
{
LB_Received.Items.Clear();
bool[] flags = SAV.WC6Flags;
for (int i = 1; i < flags.Length; i++)
if (flags[i])
for (int i = 1; i < mga.Flags.Length; i++)
if (mga.Flags[i])
LB_Received.Items.Add(i.ToString("0000"));
if (LB_Received.Items.Count > 0)
@ -104,28 +112,41 @@ namespace PKHeX
}
// Wonder Card IO (.wc6<->window)
private string getFilter()
{
switch (SAV.Generation)
{
case 4:
return "Gen4 Mystery Gift|*.pgt;*.pcd|All Files|*.*";
case 5:
return "Gen5 Mystery Gift|*.pgf|All Files|*.*";
case 6:
return "Gen6 Mystery Gift|*.wc6;*.wc6full|All Files|*.*";
default:
return "";
}
}
private void B_Import_Click(object sender, EventArgs e)
{
OpenFileDialog importwc6 = new OpenFileDialog {Filter = "Wonder Card|*.wc6;*.wc6full"};
if (importwc6.ShowDialog() != DialogResult.OK) return;
OpenFileDialog import = new OpenFileDialog {Filter = getFilter()};
if (import.ShowDialog() != DialogResult.OK) return;
string path = importwc6.FileName;
long len = new FileInfo(path).Length;
if (len != WC6.Size && len != WC6.SizeFull)
string path = import.FileName;
MysteryGift g = MysteryGift.getMysteryGift(File.ReadAllBytes(path), Path.GetExtension(path));
if (g == null)
{
Util.Error("File is not a Wonder Card:", path);
Util.Error("File is not a Mystery Gift:", path);
return;
}
wc6 = new WC6(File.ReadAllBytes(path));
loadwcdata();
viewGiftData(g);
}
private void B_Output_Click(object sender, EventArgs e)
{
SaveFileDialog outputwc6 = new SaveFileDialog();
int cardID = wc6.CardID;
string cardname = wc6.CardTitle;
outputwc6.FileName = Util.CleanFileName($"{cardID} - {cardname}.wc6");
outputwc6.Filter = "Wonder Card|*.wc6";
SaveFileDialog outputwc6 = new SaveFileDialog
{
Filter = getFilter(),
FileName = Util.CleanFileName($"{mg.CardID} - {mg.CardTitle}{mg.Extension}")
};
if (outputwc6.ShowDialog() != DialogResult.OK) return;
string path = outputwc6.FileName;
@ -133,7 +154,7 @@ namespace PKHeX
if (File.Exists(path)) // File already exists, save a .bak
File.WriteAllBytes(path + ".bak", File.ReadAllBytes(path));
File.WriteAllBytes(path, wc6.Data);
File.WriteAllBytes(path, mg.Data);
}
// Wonder Card RW (window<->sav)
@ -143,14 +164,11 @@ namespace PKHeX
int index = Array.IndexOf(pba, sender);
setBackground(index, Properties.Resources.slotView);
wc6 = SAV.getWC6(index);
loadwcdata();
viewGiftData(mga.Gifts[index]);
}
private void clickSet(object sender, EventArgs e)
{
if (wc6 == null)
return;
if (!checkSpecialWonderCard(wc6))
if (!checkSpecialWonderCard(mg))
return;
sender = ((sender as ToolStripItem)?.Owner as ContextMenuStrip)?.SourceControl ?? sender as PictureBox;
@ -160,11 +178,15 @@ namespace PKHeX
int lastUnfilled = Array.FindIndex(pba, p => p.Image == null);
if (lastUnfilled > -1 && lastUnfilled < index)
index = lastUnfilled;
if (mg.Data.Length != mga.Gifts[index].Data.Length)
{
Util.Alert("Can't set slot here.", $"{mg.GetType()} != {mga.Gifts[index].GetType()}");
return;
}
setBackground(index, Properties.Resources.slotSet);
SAV.setWC6(wc6, index);
populateWClist();
setCardID(wc6.CardID);
mga.Gifts[index] = mg;
setGiftBoxes();
setCardID(mg.CardID);
}
private void clickDelete(object sender, EventArgs e)
{
@ -172,8 +194,8 @@ namespace PKHeX
int index = Array.IndexOf(pba, sender);
setBackground(index, Properties.Resources.slotDel);
SAV.setWC6(new WC6(), index);
populateWClist();
mga.Gifts[index].Data = new byte[mga.Gifts[index].Data.Length];
setGiftBoxes();
}
// Close Window
@ -183,14 +205,14 @@ namespace PKHeX
}
private void B_Save_Click(object sender, EventArgs e)
{
int offset = Main.SAV.WondercardFlags;
// Make sure all of the Received Flags are flipped!
bool[] flags = new bool[(SAV.WondercardData - SAV.WondercardFlags)*8];
bool[] flags = new bool[mga.Flags.Length];
foreach (var o in LB_Received.Items)
flags[Util.ToUInt32(o.ToString())] = true;
SAV.WC6Flags = flags;
mga.Flags = flags;
SAV.GiftAlbum = mga;
Main.SAV.Data = SAV.Data;
Main.SAV.Edited = true;
Close();
@ -217,97 +239,77 @@ namespace PKHeX
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
// Check for multiple wondercards
int ctr = currentSlot;
if (Directory.Exists(files[0]))
files = Directory.GetFiles(files[0], "*", SearchOption.AllDirectories);
if (files.Length == 1 && !Directory.Exists(files[0]))
{
string path = files[0]; // open first D&D
long len = new FileInfo(path).Length;
if (len != WC6.Size && len != WC6.SizeFull)
if (len > 0x1000) // arbitrary
{
Util.Error("File is not a Wonder Card:", path);
Util.Alert("File is not a Mystery Gift.", path);
return;
}
byte[] newwc6 = File.ReadAllBytes(path);
if (newwc6.Length == WC6.SizeFull)
newwc6 = newwc6.Skip(WC6.SizeFull - WC6.Size).ToArray();
Array.Copy(newwc6, wc6.Data, newwc6.Length);
loadwcdata();
return;
}
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, $"Try to load {files.Length} Wonder Cards starting at Card {ctr + 1}?"))
return;
foreach (string file in files)
{
long len = new FileInfo(file).Length;
if (len != WC6.Size && len != WC6.SizeFull)
{ Util.Error("File is not a Wonder Card:", file); continue; }
// Load in WC
byte[] newwc6 = File.ReadAllBytes(file);
if (newwc6.Length == WC6.SizeFull)
newwc6 = newwc6.Skip(WC6.SizeFull - WC6.Size).ToArray();
if (checkSpecialWonderCard(new WC6(newwc6)))
MysteryGift g = MysteryGift.getMysteryGift(File.ReadAllBytes(path), Path.GetExtension(path));
if (g == null)
{
WC6 wc = new WC6(newwc6);
SAV.setWC6(wc, ctr++);
setCardID(wc.CardID);
Util.Error("File is not a Mystery Gift:", path);
return;
}
if (ctr >= 24)
break;
viewGiftData(g);
return;
}
populateWClist();
setGiftBoxes();
}
private bool checkSpecialWonderCard(WC6 wc)
private bool checkSpecialWonderCard(MysteryGift g)
{
if (wc6.CardID == 2048 && wc.Item == 726) // Eon Ticket (OR/AS)
if (SAV.Generation != 6)
return true;
if (g is WC6)
{
if (!Main.SAV.ORAS || Main.SAV.EonTicket < 0)
goto reject;
BitConverter.GetBytes(WC6.EonTicketConst).CopyTo(SAV.Data, Main.SAV.EonTicket);
if (g.CardID == 2048 && g.Item == 726) // Eon Ticket (OR/AS)
{
if (!Main.SAV.ORAS || ((SAV6)SAV).EonTicket < 0)
goto reject;
BitConverter.GetBytes(WC6.EonTicketConst).CopyTo(SAV.Data, ((SAV6)SAV).EonTicket);
}
}
return true;
reject: Util.Alert("Unable to insert the Wonder Card.", "Does this Wonder Card really belong to this game?");
reject: Util.Alert("Unable to insert the Mystery Gift.", "Does this Mystery Gift really belong to this game?");
return false;
}
private void L_QR_Click(object sender, EventArgs e)
{
if (SAV.Generation != 6)
{
Util.Alert("Feature not available for non Gen6 games.");
return;
}
if (ModifierKeys == Keys.Alt)
{
byte[] data = Util.getQRData();
byte[] data = QR.getQRData();
if (data == null) return;
if (data.Length != WC6.Size) { Util.Alert("Decoded data not 0x108 bytes.",
if (data.Length != WC6.Size) { Util.Alert($"Decoded data not 0x{WC6.Size.ToString("X")} bytes.",
$"QR Data Size: 0x{data.Length.ToString("X")}"); }
else try
{
wc6 = new WC6(data);
loadwcdata();
}
catch { Util.Alert("Error loading wondercard data."); }
else try { viewGiftData(new WC6(data)); }
catch { Util.Alert("Error loading wondercard data."); }
}
else
{
if (wc6.Data.SequenceEqual(new byte[wc6.Data.Length]))
if (mg.Data.SequenceEqual(new byte[mg.Data.Length]))
{ Util.Alert("No wondercard data found in loaded slot!"); return; }
if (wc6.Item == 726 && wc6.IsItem)
if (mg.Item == 726 && mg.IsItem)
{ Util.Alert("Eon Ticket Wonder Cards will not function properly", "Inject to the save file instead."); return; }
// Prep data
byte[] wcdata = wc6.Data;
// Ensure size
Array.Resize(ref wcdata, WC6.Size);
// Setup QR
const string server = "http://lunarcookies.github.io/wc.html#";
Image qr = Util.getQRImage(wcdata, server);
Image qr = QR.getQRImage(mg.Data, server);
if (qr == null) return;
string desc = wc6.Description;
string desc = getDescription(mg);
new QR(qr, PB_Preview.Image, desc, "", "", "PKHeX Wonder Card @ ProjectPokemon.org").ShowDialog();
}
@ -315,19 +317,14 @@ namespace PKHeX
private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e)
{
if (ModifierKeys == Keys.Control || ModifierKeys == Keys.Alt || ModifierKeys == Keys.Shift ||
ModifierKeys == (Keys.Control | Keys.Alt))
switch (ModifierKeys)
{
switch (ModifierKeys)
{
case Keys.Control: clickView(sender, e); break;
case Keys.Shift: clickSet(sender, e); break;
case Keys.Alt: clickDelete(sender, e); break;
}
return;
case Keys.Control: clickView(sender, e); return;
case Keys.Shift: clickSet(sender, e); return;
case Keys.Alt: clickDelete(sender, e); return;
}
PictureBox pb = (PictureBox)sender;
if (pb.Image == null)
PictureBox pb = sender as PictureBox;
if (pb?.Image == null)
return;
if (e.Button != MouseButtons.Left || e.Clicks != 1) return;
@ -338,7 +335,7 @@ namespace PKHeX
Cursor.Current = Cursors.Hand;
// Prepare Data
WC6 card = SAV.getWC6(index);
MysteryGift card = mga.Gifts[index];
string filename = Util.CleanFileName($"{card.CardID.ToString("0000")} - {card.CardTitle}.wc6");
// Make File
@ -361,34 +358,48 @@ namespace PKHeX
int lastUnfilled = Array.FindIndex(pba, p => p.Image == null);
if (lastUnfilled < index)
index = lastUnfilled;
// Check for In-Dropped files (PKX,SAV,ETC)
if (wc_slot == -1)
if (wc_slot == -1) // dropped
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files.Length < 1 || new FileInfo(files[0]).Length != WC6.Size)
if (files.Length < 1)
return;
if (PCD.Size < (int)new FileInfo(files[0]).Length)
{ Util.Alert("Data size invalid.", files[0]); return; }
WC6 wc = new WC6(File.ReadAllBytes(files[0]));
SAV.setWC6(wc, index);
setCardID(wc.CardID);
wc6 = wc;
loadwcdata();
byte[] data = File.ReadAllBytes(files[0]);
chk:
if (data.Length != mga.Gifts[index].Data.Length)
{
if (index < 8)
{
index = 8;
goto chk;
}
{ Util.Alert("Can't set slot here.", $"{data.Length} != {mga.Gifts[index].Data.Length}, {mga.Gifts[index].GetType()}", files[0]); return; }
}
mga.Gifts[index].Data = data;
setCardID(mga.Gifts[index].CardID);
viewGiftData(mga.Gifts[index]);
}
else // Swap Data
{
// Check to see if they copied beyond blank slots.
if (index > Math.Max(wc_slot, lastUnfilled - 1))
index = Math.Max(wc_slot, lastUnfilled - 1);
WC6 s1 = SAV.getWC6(index);
WC6 s2 = SAV.getWC6(wc_slot);
SAV.setWC6(s1, wc_slot);
SAV.setWC6(s2, index);
MysteryGift s1 = mga.Gifts[index];
MysteryGift s2 = mga.Gifts[wc_slot];
if (s1.Data.Length != s2.Data.Length)
{ Util.Alert("Can't swap these two slots."); return; }
mga.Gifts[wc_slot] = s1;
mga.Gifts[index] = s2;
}
setBackground(index, Properties.Resources.slotView);
populateWClist();
setGiftBoxes();
}
private void pbBoxSlot_DragEnter(object sender, DragEventArgs e)
{
@ -398,52 +409,47 @@ namespace PKHeX
e.Effect = DragDropEffects.Move;
}
private int wc_slot = -1;
}
// Extension Properties
public partial class WC6
{
public Image Preview
private static Image getSprite(MysteryGift gift)
{
get
{
Image img;
if (IsPokémon)
img = PKX.getSprite(Species, Form, Gender, HeldItem, IsEgg, PIDType == 2);
else if (IsItem)
img = (Image)(Properties.Resources.ResourceManager.GetObject("item_" + Item) ?? Properties.Resources.unknown);
else
img = Properties.Resources.unknown;
Image img;
if (gift.IsPokémon)
img = PKX.getSprite(gift.convertToPKM(Main.SAV));
else if (gift.IsItem)
img = (Image)(Properties.Resources.ResourceManager.GetObject("item_" + gift.Item) ?? Properties.Resources.unknown);
else
img = Properties.Resources.unknown;
if (GiftUsed)
img = Util.LayerImage(new Bitmap(img.Width, img.Height), img, 0, 0, 0.3);
return img;
}
if (gift.GiftUsed)
img = Util.LayerImage(new Bitmap(img.Width, img.Height), img, 0, 0, 0.3);
return img;
}
public string Description
private static string getDescription(MysteryGift gift)
{
get
if (gift.Empty)
return "Empty Slot. No data!";
string s = gift.getCardHeader();
if (gift.IsItem)
{
if (CardID == 0)
return "Empty Slot. No data!";
string s = $"Card #: {CardID.ToString("0000")} - {CardTitle.Trim()}" + Environment.NewLine;
switch (CardType)
{
case 1:
s += "Item: " + Main.itemlist[Item] + Environment.NewLine + "Quantity: " + Quantity;
return s;
case 0:
s +=
$"{Main.specieslist[Species]} @ {Main.itemlist[HeldItem]} --- {OT} - {TID.ToString("00000")}/{SID.ToString("00000")}" + Environment.NewLine +
$"{Main.movelist[Move1]} / {Main.movelist[Move2]} / {Main.movelist[Move3]} / {Main.movelist[Move4]}" + Environment.NewLine;
return s;
default:
s += "Unknown Wonder Card Type!";
return s;
}
s += "Item: " + Main.itemlist[gift.Item] + Environment.NewLine + "Quantity: " + gift.Quantity;
return s;
}
if (gift.IsPokémon)
{
PKM pk = gift.convertToPKM(Main.SAV);
try
{
s += $"{Main.specieslist[pk.Species]} @ {Main.itemlist[pk.HeldItem]} --- ";
s += (pk.IsEgg ? Main.eggname : $"{pk.OT_Name} - {pk.TID.ToString("00000")}/{pk.SID.ToString("00000")}") + Environment.NewLine;
s += $"{Main.movelist[pk.Move1]} / {Main.movelist[pk.Move2]} / {Main.movelist[pk.Move3]} / {Main.movelist[pk.Move4]}" + Environment.NewLine;
}
catch { s += "Unable to create gift description."; }
return s;
}
s += "Unknown Wonder Card Type!";
return s;
}
}
}

View file

@ -13,103 +13,101 @@ namespace PKHeX
{
public partial class frmReport : Form
{
private byte[] SaveData;
public class Preview
{
private readonly PK6 pk6;
public string Position => pk6.Identifier;
public Image Sprite => pk6.Sprite;
public string Nickname => pk6.Nickname;
public string Species => Main.specieslist[pk6.Species];
public string Nature => Main.natures[pk6.Nature];
public string Gender => Main.gendersymbols[pk6.Gender];
public string ESV => pk6.PSV.ToString("0000");
public string HP_Type => Main.types[pk6.HPType+1];
public string Ability => Main.abilitylist[pk6.Ability];
public string Move1 => Main.movelist[pk6.Move1];
public string Move2 => Main.movelist[pk6.Move2];
public string Move3 => Main.movelist[pk6.Move3];
public string Move4 => Main.movelist[pk6.Move4];
public string HeldItem => Main.itemlist[pk6.HeldItem];
public string MetLoc => PKX.getLocation(false, pk6.Version, pk6.Met_Location);
public string EggLoc => PKX.getLocation(true, pk6.Version, pk6.Egg_Location);
public string Ball => Main.balllist[pk6.Ball];
public string OT => pk6.OT_Name;
public string Version => Main.gamelist[pk6.Version];
public string OTLang => Main.gamelanguages[pk6.Language] ?? $"UNK {pk6.Language}";
public string CountryID => pk6.Country.ToString();
public string RegionID => pk6.Region.ToString();
public string DSRegionID => pk6.ConsoleRegion.ToString();
private readonly PKM pkm;
public string Position => pkm.Identifier;
public Image Sprite => pkm.Sprite;
public string Nickname => pkm.Nickname;
public string Species => Main.specieslist[pkm.Species];
public string Nature => Main.natures[pkm.Nature];
public string Gender => Main.gendersymbols[pkm.Gender];
public string ESV => pkm.PSV.ToString("0000");
public string HP_Type => Main.types[pkm.HPType+1];
public string Ability => Main.abilitylist[pkm.Ability];
public string Move1 => Main.movelist[pkm.Move1];
public string Move2 => Main.movelist[pkm.Move2];
public string Move3 => Main.movelist[pkm.Move3];
public string Move4 => Main.movelist[pkm.Move4];
public string HeldItem => Main.itemlist[pkm.HeldItem];
public string MetLoc => PKX.getLocation(pkm, egg: false);
public string EggLoc => PKX.getLocation(pkm, egg: true);
public string Ball => Main.balllist[pkm.Ball];
public string OT => pkm.OT_Name;
public string Version => Main.gamelist[pkm.Version];
public string OTLang => Main.gamelanguages[pkm.Language] ?? $"UNK {pkm.Language}";
public string CountryID => pkm.Format > 5 ? (pkm as PK6).Country.ToString() : "N/A";
public string RegionID => pkm.Format > 5 ? (pkm as PK6).Region.ToString() : "N/A";
public string DSRegionID => pkm.Format > 5 ? (pkm as PK6).ConsoleRegion.ToString() : "N/A";
#region Extraneous
public string EC => pk6.EncryptionConstant.ToString("X8");
public string PID => pk6.PID.ToString("X8");
public int HP_IV => pk6.IV_HP;
public int ATK_IV => pk6.IV_ATK;
public int DEF_IV => pk6.IV_DEF;
public int SPA_IV => pk6.IV_SPA;
public int SPD_IV => pk6.IV_SPD;
public int SPE_IV => pk6.IV_SPE;
public uint EXP => pk6.EXP;
public int Level => pk6.CurrentLevel;
public int HP_EV => pk6.EV_HP;
public int ATK_EV => pk6.EV_ATK;
public int DEF_EV => pk6.EV_DEF;
public int SPA_EV => pk6.EV_SPA;
public int SPD_EV => pk6.EV_SPD;
public int SPE_EV => pk6.EV_SPE;
public int Cool => pk6.CNT_Cool;
public int Beauty => pk6.CNT_Beauty;
public int Cute => pk6.CNT_Cute;
public int Smart => pk6.CNT_Smart;
public int Tough => pk6.CNT_Tough;
public int Sheen => pk6.CNT_Sheen;
public int Markings => pk6.Markings;
public string EC => pkm.EncryptionConstant.ToString("X8");
public string PID => pkm.PID.ToString("X8");
public int HP_IV => pkm.IV_HP;
public int ATK_IV => pkm.IV_ATK;
public int DEF_IV => pkm.IV_DEF;
public int SPA_IV => pkm.IV_SPA;
public int SPD_IV => pkm.IV_SPD;
public int SPE_IV => pkm.IV_SPE;
public uint EXP => pkm.EXP;
public int Level => pkm.CurrentLevel;
public int HP_EV => pkm.EV_HP;
public int ATK_EV => pkm.EV_ATK;
public int DEF_EV => pkm.EV_DEF;
public int SPA_EV => pkm.EV_SPA;
public int SPD_EV => pkm.EV_SPD;
public int SPE_EV => pkm.EV_SPE;
public int Cool => pkm.CNT_Cool;
public int Beauty => pkm.CNT_Beauty;
public int Cute => pkm.CNT_Cute;
public int Smart => pkm.CNT_Smart;
public int Tough => pkm.CNT_Tough;
public int Sheen => pkm.CNT_Sheen;
public int Markings => pkm.MarkByte;
public string NotOT => pk6.HT_Name;
public string NotOT => pkm.Format > 5 ? (pkm as PK6).HT_Name : "N/A";
public int AbilityNum => pk6.AbilityNumber;
public int GenderFlag => pk6.Gender;
public int AltForms => pk6.AltForm;
public int PKRS_Strain => pk6.PKRS_Strain;
public int PKRS_Days => pk6.PKRS_Days;
public int MetLevel => pk6.Met_Level;
public int OT_Gender => pk6.OT_Gender;
public int AbilityNum => pkm.Format > 5 ? (pkm as PK6).AbilityNumber : -1;
public int GenderFlag => pkm.Gender;
public int AltForms => pkm.AltForm;
public int PKRS_Strain => pkm.PKRS_Strain;
public int PKRS_Days => pkm.PKRS_Days;
public int MetLevel => pkm.Met_Level;
public int OT_Gender => pkm.OT_Gender;
public bool FatefulFlag => pk6.FatefulEncounter;
public bool IsEgg => pk6.IsEgg;
public bool IsNicknamed => pk6.IsNicknamed;
public bool IsShiny => pk6.IsShiny;
public bool FatefulFlag => pkm.FatefulEncounter;
public bool IsEgg => pkm.IsEgg;
public bool IsNicknamed => pkm.IsNicknamed;
public bool IsShiny => pkm.IsShiny;
public int TID => pk6.TID;
public int SID => pk6.SID;
public int TSV => pk6.TSV;
public int Move1_PP => pk6.Move1_PP;
public int Move2_PP => pk6.Move2_PP;
public int Move3_PP => pk6.Move3_PP;
public int Move4_PP => pk6.Move4_PP;
public int Move1_PPUp => pk6.Move1_PPUps;
public int Move2_PPUp => pk6.Move2_PPUps;
public int Move3_PPUp => pk6.Move3_PPUps;
public int Move4_PPUp => pk6.Move4_PPUps;
public string Relearn1 => Main.movelist[pk6.RelearnMove1];
public string Relearn2 => Main.movelist[pk6.RelearnMove2];
public string Relearn3 => Main.movelist[pk6.RelearnMove3];
public string Relearn4 => Main.movelist[pk6.RelearnMove4];
public ushort Checksum => pk6.Checksum;
public int mFriendship => pk6.OT_Friendship;
public int OT_Affection => pk6.OT_Affection;
public int Egg_Year => pk6.Egg_Year;
public int Egg_Month => pk6.Egg_Month;
public int Egg_Day => pk6.Egg_Day;
public int Met_Year => pk6.Met_Year;
public int Met_Month => pk6.Met_Month;
public int Met_Day => pk6.Met_Day;
public int Encounter => pk6.EncounterType;
public int TID => pkm.TID;
public int SID => pkm.SID;
public int TSV => pkm.TSV;
public int Move1_PP => pkm.Move1_PP;
public int Move2_PP => pkm.Move2_PP;
public int Move3_PP => pkm.Move3_PP;
public int Move4_PP => pkm.Move4_PP;
public int Move1_PPUp => pkm.Move1_PPUps;
public int Move2_PPUp => pkm.Move2_PPUps;
public int Move3_PPUp => pkm.Move3_PPUps;
public int Move4_PPUp => pkm.Move4_PPUps;
public string Relearn1 => Main.movelist[pkm.RelearnMove1];
public string Relearn2 => Main.movelist[pkm.RelearnMove2];
public string Relearn3 => Main.movelist[pkm.RelearnMove3];
public string Relearn4 => Main.movelist[pkm.RelearnMove4];
public ushort Checksum => pkm.Checksum;
public int mFriendship => pkm.OT_Friendship;
public int OT_Affection => pkm.OT_Affection;
public int Egg_Year => pkm.Egg_Year;
public int Egg_Month => pkm.Egg_Month;
public int Egg_Day => pkm.Egg_Day;
public int Met_Year => pkm.Met_Year;
public int Met_Month => pkm.Met_Month;
public int Met_Day => pkm.Met_Day;
public int Encounter => pkm.EncounterType;
#endregion
public Preview(PK6 p) { pk6 = p; }
public Preview(PKM p) { pkm = p; }
}
public frmReport()
{
@ -117,51 +115,24 @@ namespace PKHeX
dgData.DoubleBuffered(true);
CenterToParent();
}
public void PopulateData(byte[] InputData, int BoxDataOffset)
public void PopulateData(SaveFile SAV)
{
SaveData = (byte[])InputData.Clone();
PokemonList PL = new PokemonList();
BoxBar.Maximum = 930 + 100;
BoxBar.Step = 1;
for (int BoxNum = 0; BoxNum < 31; BoxNum++)
{
int boxoffset = BoxDataOffset + BoxNum*0xE8*30;
for (int SlotNum = 0; SlotNum < 30; SlotNum++)
{
BoxBar.PerformStep();
int offset = boxoffset + 0xE8 * SlotNum;
byte[] slotdata = new byte[0xE8];
Array.Copy(SaveData, offset, slotdata, 0, 0xE8);
byte[] dslotdata = PKX.decryptArray(slotdata);
if (BitConverter.ToUInt16(dslotdata, 0x8) == 0) continue;
string Identifier = $"B{(BoxNum + 1).ToString("00")}:{(SlotNum + 1).ToString("00")}";
PK6 pkm = new PK6(dslotdata, Identifier);
if (!pkm.ChecksumValid) continue;
pkm.Stat_Level = PKX.getLevel(pkm.Species, pkm.EXP); // recalc Level
PL.Add(new Preview(pkm));
}
}
dgData.DataSource = PL;
dgData.AutoGenerateColumns = true;
BoxBar.Maximum = 930 + dgData.Columns.Count;
for (int i = 0; i < dgData.Columns.Count; i++)
{
BoxBar.PerformStep();
if (dgData.Columns[i] is DataGridViewImageColumn) continue; // Don't add sorting for Sprites
dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic;
}
BoxBar.Visible = false;
PopulateData(SAV.BoxData);
}
public void PopulateData(PK6[] data)
public void PopulateData(PKM[] Data)
{
BoxBar.Step = 1;
PokemonList PL = new PokemonList();
foreach (PK6 p in data)
PL.Add(new Preview(p));
foreach (PKM pkm in Data.Where(pkm => pkm.ChecksumValid && pkm.Species != 0))
{
pkm.Stat_Level = PKX.getLevel(pkm.Species, pkm.EXP); // recalc Level
PL.Add(new Preview(pkm));
BoxBar.PerformStep();
}
dgData.DataSource = PL;
dgData.AutoGenerateColumns = true;
BoxBar.Maximum = data.Length + dgData.Columns.Count;
BoxBar.Maximum = Data.Length + dgData.Columns.Count;
for (int i = 0; i < dgData.Columns.Count; i++)
{
BoxBar.PerformStep();
@ -216,14 +187,7 @@ namespace PKHeX
private ListSortDirection listSortDirection;
private PropertyDescriptor propertyDescriptor;
protected SortableBindingList()
: base(new List<T>())
{
comparers = new Dictionary<Type, PropertyComparer<T>>();
}
public SortableBindingList(IEnumerable<T> enumeration)
: base(new List<T>(enumeration))
protected SortableBindingList() : base(new List<T>())
{
comparers = new Dictionary<Type, PropertyComparer<T>>();
}
@ -273,13 +237,8 @@ namespace PKHeX
{
int count = Count;
for (int i = 0; i < count; ++i)
{
T element = this[i];
if (property.GetValue(element).Equals(key))
{
if (property.GetValue(this[i]).Equals(key))
return i;
}
}
return -1;
}

25
Saves/BlockInfo.cs Normal file
View file

@ -0,0 +1,25 @@
namespace PKHeX
{
public sealed class BlockInfo
{
// General
public int Offset;
public int Length;
// Gen6
public ushort ID;
public ushort Checksum;
public BlockInfo() { }
// Gen4/5
public readonly int ChecksumOffset;
public readonly int ChecksumMirror;
public BlockInfo(int offset, int length, int chkOffset, int chkMirror)
{
Offset = offset;
Length = length;
ChecksumOffset = chkOffset;
ChecksumMirror = chkMirror;
}
}
}

64
Saves/Inventory.cs Normal file
View file

@ -0,0 +1,64 @@
using System;
namespace PKHeX
{
public enum InventoryType
{
Items,
KeyItems,
TMHMs,
Medicine,
Berries,
Balls,
BattleItems,
MailItems,
}
public class InventoryItem
{
public int Index, Count;
}
public class InventoryPouch
{
public readonly InventoryType Type;
public readonly ushort[] LegalItems;
public readonly int MaxCount;
private readonly int Offset;
private readonly int PouchDataSize;
public InventoryItem[] Items;
public InventoryPouch(InventoryType type, ushort[] legal, int maxcount, int offset, int size = -1)
{
Type = type;
LegalItems = legal;
MaxCount = maxcount;
Offset = offset;
PouchDataSize = size > -1 ? size : legal.Length;
}
public void getPouch(ref byte[] Data)
{
InventoryItem[] items = new InventoryItem[PouchDataSize];
for (int i = 0; i < items.Length; i++)
{
items[i] = new InventoryItem
{
Index = BitConverter.ToUInt16(Data, Offset + i*4),
Count = BitConverter.ToUInt16(Data, Offset + i*4 + 2)
};
}
Items = items;
}
public void setPouch(ref byte[] Data)
{
if (Items.Length != PouchDataSize)
throw new ArgumentException("Item array length does not match original pouch size.");
for (int i = 0; i < Items.Length; i++)
{
BitConverter.GetBytes((ushort)Items[i].Index).CopyTo(Data, Offset + i*4);
BitConverter.GetBytes((ushort)Items[i].Count).CopyTo(Data, Offset + i*4 + 2);
}
}
}
}

665
Saves/SAV4.cs Normal file
View file

@ -0,0 +1,665 @@
using System;
using System.Linq;
namespace PKHeX
{
public sealed class SAV4 : SaveFile
{
public override string BAKName => $"{FileName} [{OT} ({Version})" +/* - {LastSavedTime}*/ "].bak";
public SAV4(byte[] data = null)
{
Data = data == null ? new byte[SaveUtil.SIZE_G4RAW] : (byte[])data.Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
// Get Version
SaveVersion = Math.Max(SaveUtil.getIsG4SAV(Data), 0); // Empty file default to DP
getActiveBlock();
getSAVOffsets();
if (!Exportable)
resetBoxes();
}
// Configuration
public readonly int SaveVersion;
public override byte[] BAK { get; }
public override bool Exportable { get; }
public override SaveFile Clone() { return new SAV4(Data); }
public override int SIZE_STORED => PKX.SIZE_4STORED;
public override int SIZE_PARTY => PKX.SIZE_4PARTY;
public override PKM BlankPKM => new PK4();
protected override Type PKMType => typeof(PK4);
public override int BoxCount => 18;
public override int MaxEV => 255;
public override int Generation => 4;
protected override int EventFlagMax => int.MinValue;
protected override int EventConstMax => int.MinValue;
protected override int GiftCountMax => 11;
public override int OTLength => 8;
public override int NickLength => 10;
// Checksums
protected override void setChecksums()
{
switch (Version)
{
case GameVersion.DP:
// 0x0000-0xC0EC @ 0xC0FE
// 0xc100-0x1E2CC @ 0x1E2DE
BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xC0EC).ToArray())).CopyTo(Data, 0xC0FE + GBO);
BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0xc100 + SBO).Take(0x121CC).ToArray())).CopyTo(Data, 0x1E2DE + SBO);
break;
case GameVersion.Pt:
// 0x0000-0xCF18 @ 0xCF2A
// 0xCF2C-0x1F0FC @ 0x1F10E
BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xCF18).ToArray())).CopyTo(Data, 0xCF2A + GBO);
BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0xCF2C + SBO).Take(0x121D0).ToArray())).CopyTo(Data, 0x1F10E + SBO);
break;
case GameVersion.HGSS:
// 0x0000-0xF618 @ 0xF626
// 0xF700-0x219FC @ 0x21A0E
BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xF618).ToArray())).CopyTo(Data, 0xF626 + GBO);
BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0xF700 + SBO).Take(0x12300).ToArray())).CopyTo(Data, 0x21A0E + SBO);
break;
}
}
public override bool ChecksumsValid
{
get
{
switch (Version)
{
case GameVersion.DP:
// 0x0000-0xC0EC @ 0xC0FE
// 0xc100-0x1E2CC @ 0x1E2DE
if (SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xC0EC).ToArray()) != BitConverter.ToUInt16(Data, 0xC0FE + GBO))
return false; // Small Fail
if (SaveUtil.ccitt16(Data.Skip(0xc100 + SBO).Take(0x121CC).ToArray()) != BitConverter.ToUInt16(Data, 0x1E2DE + SBO))
return false; // Large Fail
break;
case GameVersion.Pt:
// 0x0000-0xCF18 @ 0xCF2A
// 0xCF2C-0x1F0FC @ 0x1F10E
if (SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xCF18).ToArray()) != BitConverter.ToUInt16(Data, 0xCF2A + GBO))
return false; // Small Fail
if (SaveUtil.ccitt16(Data.Skip(0xCF2C + SBO).Take(0x121D0).ToArray()) != BitConverter.ToUInt16(Data, 0x1F10E + SBO))
return false; // Large Fail
break;
case GameVersion.HGSS:
// 0x0000-0xF618 @ 0xF626
// 0xF700-0x219FC @ 0x21A0E
if (SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xF618).ToArray()) != BitConverter.ToUInt16(Data, 0xF626 + GBO))
return false; // Small Fail
if (SaveUtil.ccitt16(Data.Skip(0xF700 + SBO).Take(0x12300).ToArray()) != BitConverter.ToUInt16(Data, 0x21A0E + SBO))
return false; // Large Fail
break;
}
return true;
}
}
public override string ChecksumInfo
{
get
{
string r = "";
switch (Version)
{
case GameVersion.DP:
// 0x0000-0xC0EC @ 0xC0FE
// 0xc100-0x1E2CC @ 0x1E2DE
if (SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xC0EC).ToArray()) != BitConverter.ToUInt16(Data, 0xC0FE + GBO))
r += "Small block checksum is invalid" + Environment.NewLine;
if (SaveUtil.ccitt16(Data.Skip(0xc100 + SBO).Take(0x121CC).ToArray()) != BitConverter.ToUInt16(Data, 0x1E2DE + SBO))
r += "Large block checksum is invalid" + Environment.NewLine;
break;
case GameVersion.Pt:
// 0x0000-0xCF18 @ 0xCF2A
// 0xCF2C-0x1F0FC @ 0x1F10E
if (SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xCF18).ToArray()) != BitConverter.ToUInt16(Data, 0xCF2A + GBO))
r += "Small block checksum is invalid" + Environment.NewLine;
if (SaveUtil.ccitt16(Data.Skip(0xCF2C + SBO).Take(0x121D0).ToArray()) != BitConverter.ToUInt16(Data, 0x1F10E + SBO))
r += "Large block checksum is invalid" + Environment.NewLine;
break;
case GameVersion.HGSS:
// 0x0000-0xF618 @ 0xF626
// 0xF700-0x219FC @ 0x21A0E
if (SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xF618).ToArray()) != BitConverter.ToUInt16(Data, 0xF626 + GBO))
r += "Small block checksum is invalid" + Environment.NewLine;
if (SaveUtil.ccitt16(Data.Skip(0xF700 + SBO).Take(0x12300).ToArray()) != BitConverter.ToUInt16(Data, 0x21A0E + SBO))
r += "Large block checksum is invalid" + Environment.NewLine;
break;
}
return r.Length == 0 ? "Checksums valid." : r.TrimEnd();
}
}
// Blocks & Offsets
private int generalBlock = -1; // Small Block
private int storageBlock = -1; // Big Block
private int hofBlock = -1; // Hall of Fame Block
private int SBO => 0x40000 * storageBlock;
private int GBO => 0x40000 * generalBlock;
private int HBO => 0x40000 * hofBlock;
private void getActiveBlock()
{
if (SaveVersion < 0)
return;
int ofs = 0;
if (SaveVersion == 0) ofs = 0xC0F0; // DP
else if (SaveVersion == 1) ofs = 0xCF1C; // PT
else if (SaveVersion == 2) ofs = 0xF626; // HGSS
generalBlock = BitConverter.ToUInt16(Data, ofs) >= BitConverter.ToUInt16(Data, ofs + 0x40000) ? 0 : 1;
if (SaveVersion == 0) ofs = 0x1E2D0; // DP
else if (SaveVersion == 1) ofs = 0x1F100; // PT
else if (SaveVersion == 2) ofs = 0x21A00; // HGSS
storageBlock = BitConverter.ToUInt16(Data, ofs) >= BitConverter.ToUInt16(Data, ofs + 0x40000) ? 0 : 1;
}
private void getSAVOffsets()
{
if (SaveVersion < 0)
return;
switch (Version)
{
case GameVersion.DP:
AdventureInfo = 0 + GBO;
Trainer1 = 0x64 + GBO;
Party = 0x98 + GBO;
WondercardFlags = 0xA6D0 + GBO;
WondercardData = 0xA7fC + GBO;
OFS_PouchHeldItem = 0x624 + GBO;
OFS_PouchKeyItem = 0x8B8 + GBO;
OFS_PouchTMHM = 0x980 + GBO;
OFS_PouchMedicine = 0xB40 + GBO;
OFS_PouchBerry = 0xBE0 + GBO;
OFS_PouchBalls = 0xCE0 + GBO;
OFS_BattleItems = 0xD1C + GBO;
OFS_MailItems = 0xD50 + GBO;
LegalItems = Legal.Pouch_Items_DP;
LegalKeyItems = Legal.Pouch_Key_DP;
LegalTMHMs = Legal.Pouch_TMHM_DP;
LegalMedicine = Legal.Pouch_Medicine_DP;
LegalBerries = Legal.Pouch_Berries_DP;
LegalBalls = Legal.Pouch_Ball_DP;
LegalBattleItems = Legal.Pouch_Battle_DP;
LegalMailItems = Legal.Pouch_Mail_DP;
HeldItems = Legal.HeldItems_DP;
Daycare = 0x141C + GBO;
Box = 0xC104 + SBO;
break;
case GameVersion.Pt:
AdventureInfo = 0 + GBO;
Trainer1 = 0x68 + GBO;
Party = 0xA0 + GBO;
WondercardFlags = 0xB4C0 + GBO;
WondercardData = 0xB5C0 + GBO;
OFS_PouchHeldItem = 0x630 + GBO;
OFS_PouchKeyItem = 0x8C4 + GBO;
OFS_PouchTMHM = 0x98C + GBO;
OFS_MailItems = 0xB1C + GBO;
OFS_PouchMedicine = 0xB4C + GBO;
OFS_PouchBerry = 0xBEC + GBO;
OFS_PouchBalls = 0xCEC + GBO;
OFS_BattleItems = 0xD28 + GBO;
LegalItems = Legal.Pouch_Items_Pt;
LegalKeyItems = Legal.Pouch_Key_Pt;
LegalTMHMs = Legal.Pouch_TMHM_Pt;
LegalMedicine = Legal.Pouch_Medicine_Pt;
LegalBerries = Legal.Pouch_Berries_Pt;
LegalBalls = Legal.Pouch_Ball_Pt;
LegalBattleItems = Legal.Pouch_Battle_Pt;
LegalMailItems = Legal.Pouch_Mail_Pt;
HeldItems = Legal.HeldItems_Pt;
Daycare = 0x1654 + GBO;
Box = 0xCF30 + SBO;
break;
case GameVersion.HGSS:
AdventureInfo = 0 + GBO;
Trainer1 = 0x64 + GBO;
Party = 0x98 + GBO;
WondercardFlags = 0x9D3C + GBO;
WondercardData = 0x9E3C + GBO;
OFS_PouchHeldItem = 0x644 + GBO; // 0x644-0x8D7 (0x8CB)
OFS_PouchKeyItem = 0x8D8 + GBO; // 0x8D8-0x99F (0x979)
OFS_PouchTMHM = 0x9A0 + GBO; // 0x9A0-0xB33 (0xB2F)
OFS_MailItems = 0xB34 + GBO; // 0xB34-0xB63 (0xB63)
OFS_PouchMedicine = 0xB64 + GBO; // 0xB64-0xC03 (0xBFB)
OFS_PouchBerry = 0xC04 + GBO; // 0xC04-0xD03
OFS_PouchBalls = 0xD04 + GBO; // 0xD04-0xD63
OFS_BattleItems = 0xD64 + GBO; // 0xD64-0xD97
LegalItems = Legal.Pouch_Items_HGSS;
LegalKeyItems = Legal.Pouch_Key_HGSS;
LegalTMHMs = Legal.Pouch_TMHM_HGSS;
LegalMedicine = Legal.Pouch_Medicine_HGSS;
LegalBerries = Legal.Pouch_Berries_HGSS;
LegalBalls = Legal.Pouch_Ball_HGSS;
LegalBattleItems = Legal.Pouch_Battle_HGSS;
LegalMailItems = Legal.Pouch_Mail_HGSS;
HeldItems = Legal.HeldItems_HGSS;
Daycare = 0x15FC + GBO;
Box = 0xF700 + SBO;
break;
}
}
private int WondercardFlags = int.MinValue;
private int AdventureInfo = int.MinValue;
// Inventory
private ushort[] LegalItems, LegalKeyItems, LegalTMHMs, LegalMedicine, LegalBerries, LegalBalls, LegalBattleItems, LegalMailItems;
public override InventoryPouch[] Inventory
{
get
{
InventoryPouch[] pouch =
{
new InventoryPouch(InventoryType.Items, LegalItems, 995, OFS_PouchHeldItem),
new InventoryPouch(InventoryType.KeyItems, LegalKeyItems, 1, OFS_PouchKeyItem),
new InventoryPouch(InventoryType.TMHMs, LegalTMHMs, 95, OFS_PouchTMHM),
new InventoryPouch(InventoryType.Medicine, LegalMedicine, 995, OFS_PouchMedicine),
new InventoryPouch(InventoryType.Berries, LegalBerries, 995, OFS_PouchBerry),
new InventoryPouch(InventoryType.Balls, LegalBalls, 995, OFS_PouchBalls),
new InventoryPouch(InventoryType.BattleItems, LegalBattleItems, 995, OFS_BattleItems),
new InventoryPouch(InventoryType.MailItems, LegalMailItems, 995, OFS_MailItems),
};
foreach (var p in pouch)
p.getPouch(ref Data);
return pouch;
}
set
{
foreach (var p in value)
p.setPouch(ref Data);
}
}
// Storage
public override int PartyCount
{
get { return Data[Party - 4]; }
protected set { Data[Party - 4] = (byte)value; }
}
public override int getBoxOffset(int box)
{
return Box + SIZE_STORED*box*30 + (SaveVersion == 2 ? box * 0x10 : 0);
}
public override int getPartyOffset(int slot)
{
return Party + SIZE_PARTY*slot;
}
// Trainer Info
protected override GameVersion Version
{
get
{
switch (SaveVersion)
{
case 0: return GameVersion.DP;
case 1: return GameVersion.Pt;
case 2: return GameVersion.HGSS;
}
return GameVersion.Unknown;
}
}
public override string OT
{
get
{
return PKX.array2strG4(Data.Skip(Trainer1).Take(0x10).ToArray())
.Replace("\uE08F", "\u2640") // Nidoran ♂
.Replace("\uE08E", "\u2642") // Nidoran ♀
.Replace("\u2019", "\u0027"); // Farfetch'd
}
set
{
if (value.Length > 7)
value = value.Substring(0, 7); // Hard cap
string TempNick = value // Replace Special Characters and add Terminator
.Replace("\u2640", "\uE08F") // Nidoran ♂
.Replace("\u2642", "\uE08E") // Nidoran ♀
.Replace("\u0027", "\u2019"); // Farfetch'd
PKX.str2arrayG4(TempNick).CopyTo(Data, Trainer1);
}
}
public override ushort TID
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x10 + 0); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x10 + 0); }
}
public override ushort SID
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x12); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x12); }
}
public uint Money
{
get { return BitConverter.ToUInt32(Data, Trainer1 + 0x14); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14); }
}
public override int Gender
{
get { return Data[Trainer1 + 0x18]; }
set { Data[Trainer1 + 0x18] = (byte)value; }
}
public override int Language
{
get { return Data[Trainer1 + 0x19]; }
set { Data[Trainer1 + 0x19] = (byte)value; }
}
public int Badges
{
get { return Data[Trainer1 + 0x1A]; }
set { if (value < 0) return; Data[Trainer1 + 0x1A] = (byte)value; }
}
public int Sprite
{
get { return Data[Trainer1 + 0x1B]; }
set { if (value < 0) return; Data[Trainer1 + 0x1B] = (byte)value; }
}
public int Badges16
{
get
{
if (Version != GameVersion.HGSS)
return -1;
return Data[Trainer1 + 0x1F];
}
set
{
if (value < 0)
return;
if (Version != GameVersion.HGSS)
return;
Data[Trainer1 + 0x1F] = (byte)value;
}
}
public int PlayedHours
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x22); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x22); }
}
public int PlayedMinutes
{
get { return Data[Trainer1 + 0x24]; }
set { Data[Trainer1 + 0x24] = (byte)value; }
}
public int PlayedSeconds
{
get { return Data[Trainer1 + 0x25]; }
set { Data[Trainer1 + 0x25] = (byte)value; }
}
public int M
{
get
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP:
case GameVersion.HGSS: ofs = 0x1234; break;
case GameVersion.Pt: ofs = 0x1280; break;
}
return BitConverter.ToInt32(Data, ofs);
}
set
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP:
case GameVersion.HGSS: ofs = 0x1234; break;
case GameVersion.Pt: ofs = 0x1280; break;
}
BitConverter.GetBytes(value).CopyTo(Data, ofs);
}
}
public int X
{
get
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP: ofs = 0x25FA; break;
case GameVersion.Pt: ofs = 0x287E; break;
case GameVersion.HGSS: ofs = 0x236E; break;
}
return BitConverter.ToInt32(Data, ofs);
}
set
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP: ofs = 0x25FA; break;
case GameVersion.Pt: ofs = 0x287E; break;
case GameVersion.HGSS: ofs = 0x236E; break;
}
BitConverter.GetBytes(value).CopyTo(Data, ofs);
switch (Version)
{
case GameVersion.DP:
case GameVersion.HGSS:
BitConverter.GetBytes(value).CopyTo(Data, 0x123C);
break;
}
}
}
public int Z
{
get
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP: ofs = 0x2602; break;
case GameVersion.Pt: ofs = 0x2886; break;
case GameVersion.HGSS: ofs = 0x2376; break;
}
return BitConverter.ToInt32(Data, ofs);
}
set
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP: ofs = 0x2602; break;
case GameVersion.Pt: ofs = 0x2886; break;
case GameVersion.HGSS: ofs = 0x2376; break;
}
BitConverter.GetBytes(value).CopyTo(Data, ofs);
}
}
public int Y
{
get
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP: ofs = 0x25FE; break;
case GameVersion.Pt: ofs = 0x2882; break;
case GameVersion.HGSS: ofs = 0x2372; break;
}
return BitConverter.ToInt32(Data, ofs);
}
set
{
int ofs = 0;
switch (Version)
{
case GameVersion.DP: ofs = 0x25FE; break;
case GameVersion.Pt: ofs = 0x2882; break;
case GameVersion.HGSS: ofs = 0x2372; break;
}
BitConverter.GetBytes(value).CopyTo(Data, ofs);
switch (Version)
{
case GameVersion.DP:
case GameVersion.HGSS:
BitConverter.GetBytes(value).CopyTo(Data, 0x1240);
break;
}
}
}
public int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
public int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } }
// Storage
public int UnlockedBoxes
{
get { return Data[Box - 4]; }
set { Data[Box - 4] = (byte)value; }
}
public override int getBoxWallpaper(int box)
{
// Box Wallpaper is directly after the Box Names
int offset = getBoxOffset(BoxCount);
if (Version == GameVersion.HGSS) offset += 0x18;
offset += BoxCount*0x28;
return Data[offset];
}
public override string getBoxName(int box)
{
int offset = getBoxOffset(BoxCount);
if (Version == GameVersion.HGSS) offset += 0x8;
return PKX.array2strG4(Data.Skip(offset + box*0x28).Take(0x28).ToArray());
}
public override void setBoxName(int box, string value)
{
if (value.Length > 13)
value = value.Substring(0, 13); // Hard cap
int offset = getBoxOffset(BoxCount);
if (Version == GameVersion.HGSS) offset += 0x8;
PKX.str2arrayG4(value).CopyTo(Data, offset + box*0x28);
}
public override PKM getPKM(byte[] data)
{
return new PK4(data);
}
public override byte[] decryptPKM(byte[] data)
{
return PKX.decryptArray45(data);
}
// Daycare
public override int DaycareSeedSize => 8;
public override int getDaycareSlotOffset(int loc, int slot)
{
return Daycare + slot * SIZE_PARTY;
}
public override ulong? getDaycareRNGSeed(int loc)
{
return null;
}
public override uint? getDaycareEXP(int loc, int slot)
{
int ofs = Daycare + (slot+1)*SIZE_PARTY - 4;
return BitConverter.ToUInt32(Data, ofs);
}
public override bool? getDaycareOccupied(int loc, int slot)
{
return null;
}
public override void setDaycareEXP(int loc, int slot, uint EXP)
{
int ofs = Daycare + (slot+1)*SIZE_PARTY - 4;
BitConverter.GetBytes(EXP).CopyTo(Data, ofs);
}
public override void setDaycareOccupied(int loc, int slot, bool occupied)
{
}
// Mystery Gift
public override MysteryGiftAlbum GiftAlbum
{
get
{
return new MysteryGiftAlbum
{
Flags = MysteryGiftReceivedFlags,
Gifts = MysteryGiftCards,
};
}
set
{
MysteryGiftReceivedFlags = value.Flags;
MysteryGiftCards = value.Gifts;
}
}
protected override bool[] MysteryGiftReceivedFlags
{
get
{
if (WondercardData < 0 || WondercardFlags < 0)
return null;
bool[] r = new bool[GiftFlagMax];
for (int i = 0; i < r.Length; i++)
r[i] = (Data[WondercardFlags + (i >> 3)] >> (i & 7) & 0x1) == 1;
return r;
}
set
{
if (WondercardData < 0 || WondercardFlags < 0)
return;
if (GiftFlagMax != value?.Length)
return;
byte[] data = new byte[value.Length / 8];
for (int i = 0; i < value.Length; i++)
if (value[i])
data[i >> 3] |= (byte)(1 << (i & 7));
data.CopyTo(Data, WondercardFlags);
Edited = true;
}
}
protected override MysteryGift[] MysteryGiftCards
{
get
{
MysteryGift[] cards = new MysteryGift[8 + 3];
for (int i = 0; i < 8; i++) // 8 PGT
cards[i] = new PGT(Data.Skip(WondercardData + i * PGT.Size).Take(PGT.Size).ToArray());
for (int i = 8; i < 11; i++) // 3 PCD
cards[i] = new PCD(Data.Skip(WondercardData + 8 * PGT.Size+ (i-8) * PCD.Size).Take(PCD.Size).ToArray());
return cards;
}
set
{
if (value == null)
return;
for (int i = 0; i < 8; i++) // 8 PGT
{
if (value[i].GetType() != typeof(PGT))
continue;
value[i].Data.CopyTo(Data, WondercardData + i * PGT.Size);
}
for (int i = 8; i < 11; i++) // 3 PCD
{
if (value[i].GetType() != typeof(PCD))
continue;
value[i].Data.CopyTo(Data, WondercardData + 8 * PGT.Size + (i-8) * PGT.Size);
}
}
}
}
}

599
Saves/SAV5.cs Normal file
View file

@ -0,0 +1,599 @@
using System;
using System.Linq;
using System.Text;
namespace PKHeX
{
public sealed class SAV5 : SaveFile
{
// Save Data Attributes
public override string BAKName => $"{FileName} [{OT} ({Version})" +/* - {LastSavedTime}*/ "].bak";
public SAV5(byte[] data = null)
{
Data = data == null ? new byte[SaveUtil.SIZE_G5RAW] : (byte[])data.Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
// Get Version
SaveVersion = SaveUtil.getIsG5SAV(Data);
if (SaveVersion < 0) // Invalidate Data
Data = null;
// First blocks are always the same position/size
PCLayout = 0x0;
Box = 0x400;
Party = 0x18E00;
Trainer1 = 0x19400;
WondercardData = 0x1C800;
AdventureInfo = 0x1D900;
// Different Offsets for later blocks
switch (SaveVersion)
{
case 0: // BW
BattleBox = 0x20A00;
Trainer2 = 0x21200;
Daycare = 0x20E00;
// Inventory offsets are the same for each game.
OFS_PouchHeldItem = 0x18400; // 0x188D7
OFS_PouchKeyItem = 0x188D8; // 0x18A23
OFS_PouchTMHM = 0x18A24; // 0x18BD7
OFS_PouchMedicine = 0x18BD8; // 0x18C97
OFS_PouchBerry = 0x18C98; // 0x18DBF
LegalItems = Legal.Pouch_Items_BW;
LegalKeyItems = Legal.Pouch_Key_BW;
LegalTMHMs = Legal.Pouch_TMHM_BW;
LegalMedicine = Legal.Pouch_Medicine_BW;
LegalBerries = Legal.Pouch_Berries_BW;
break;
case 1: // B2W2
BattleBox = 0x20900;
Trainer2 = 0x21100;
EventConst = 0x1FF00;
EventFlag = EventConst + 0x35E;
Daycare = 0x20D00;
// Inventory offsets are the same for each game.
OFS_PouchHeldItem = 0x18400; // 0x188D7
OFS_PouchKeyItem = 0x188D8; // 0x18A23
OFS_PouchTMHM = 0x18A24; // 0x18BD7
OFS_PouchMedicine = 0x18BD8; // 0x18C97
OFS_PouchBerry = 0x18C98; // 0x18DBF
LegalItems = Legal.Pouch_Items_BW;
LegalKeyItems = Legal.Pouch_Key_B2W2;
LegalTMHMs = Legal.Pouch_TMHM_BW;
LegalMedicine = Legal.Pouch_Medicine_BW;
LegalBerries = Legal.Pouch_Berries_BW;
break;
}
HeldItems = Legal.HeldItems_BW;
getBlockInfo();
if (!Exportable)
resetBoxes();
}
// Configuration
private int SaveVersion { get; set; }
public override byte[] BAK { get; }
public override bool Exportable { get; }
public override SaveFile Clone() { return new SAV5(Data); }
public override int SIZE_STORED => PKX.SIZE_5STORED;
public override int SIZE_PARTY => PKX.SIZE_5PARTY;
public override PKM BlankPKM => new PK5();
protected override Type PKMType => typeof(PK5);
public override int BoxCount => 24;
public override int MaxEV => 255;
public override int Generation => 5;
public override int OTLength => 8;
public override int NickLength => 10;
protected override int EventConstMax => 0x35E/2;
protected override int GiftCountMax => 12;
// Blocks & Offsets
private BlockInfo[] Blocks;
private void getBlockInfo()
{
// Can be slick with just a list of block lengths, but oh well, precomputed.
if (SaveVersion == 0) // BW
{
Blocks = new[]
{
new BlockInfo(0x00000, 0x03E0, 0x003E2, 0x23F00), // Box Names
new BlockInfo(0x00400, 0x0FF0, 0x013F2, 0x23F02), // Box 1
new BlockInfo(0x01400, 0x0FF0, 0x023F2, 0x23F04), // Box 2
new BlockInfo(0x02400, 0x0FF0, 0x033F2, 0x23F06), // Box 3
new BlockInfo(0x03400, 0x0FF0, 0x043F2, 0x23F08), // Box 4
new BlockInfo(0x04400, 0x0FF0, 0x053F2, 0x23F0A), // Box 5
new BlockInfo(0x05400, 0x0FF0, 0x063F2, 0x23F0C), // Box 6
new BlockInfo(0x06400, 0x0FF0, 0x073F2, 0x23F0E), // Box 7
new BlockInfo(0x07400, 0x0FF0, 0x083F2, 0x23F10), // Box 8
new BlockInfo(0x08400, 0x0FF0, 0x093F2, 0x23F12), // Box 9
new BlockInfo(0x09400, 0x0FF0, 0x0A3F2, 0x23F14), // Box 10
new BlockInfo(0x0A400, 0x0FF0, 0x0B3F2, 0x23F16), // Box 11
new BlockInfo(0x0B400, 0x0FF0, 0x0C3F2, 0x23F18), // Box 12
new BlockInfo(0x0C400, 0x0FF0, 0x0D3F2, 0x23F1A), // Box 13
new BlockInfo(0x0D400, 0x0FF0, 0x0E3F2, 0x23F1C), // Box 14
new BlockInfo(0x0E400, 0x0FF0, 0x0F3F2, 0x23F1E), // Box 15
new BlockInfo(0x0F400, 0x0FF0, 0x103F2, 0x23F20), // Box 16
new BlockInfo(0x10400, 0x0FF0, 0x113F2, 0x23F22), // Box 17
new BlockInfo(0x11400, 0x0FF0, 0x123F2, 0x23F24), // Box 18
new BlockInfo(0x12400, 0x0FF0, 0x133F2, 0x23F26), // Box 19
new BlockInfo(0x13400, 0x0FF0, 0x143F2, 0x23F28), // Box 20
new BlockInfo(0x14400, 0x0FF0, 0x153F2, 0x23F2A), // Box 21
new BlockInfo(0x15400, 0x0FF0, 0x163F2, 0x23F2C), // Box 22
new BlockInfo(0x16400, 0x0FF0, 0x173F2, 0x23F2E), // Box 23
new BlockInfo(0x17400, 0x0FF0, 0x183F2, 0x23F30), // Box 24
new BlockInfo(0x18400, 0x09C0, 0x18DC2, 0x23F32), // Inventory
new BlockInfo(0x18E00, 0x0534, 0x19336, 0x23F34), // Party Pokemon
new BlockInfo(0x19400, 0x0068, 0x1946A, 0x23F36), // Trainer Data
new BlockInfo(0x19500, 0x009C, 0x1959E, 0x23F38), // ???
new BlockInfo(0x19600, 0x1338, 0x1A93A, 0x23F3A), // ???
new BlockInfo(0x1AA00, 0x07C4, 0x1B1C6, 0x23F3C), // ???
new BlockInfo(0x1B200, 0x0D54, 0x1BF56, 0x23F3E), // ???
new BlockInfo(0x1C000, 0x002C, 0x1C02E, 0x23F40), // ???
new BlockInfo(0x1C100, 0x0658, 0x1C75A, 0x23F42), // ??? Gym badge data
new BlockInfo(0x1C800, 0x0A94, 0x1D296, 0x23F44), // ???
new BlockInfo(0x1D300, 0x01AC, 0x1D4AE, 0x23F46), // ???
new BlockInfo(0x1D500, 0x03EC, 0x1D8EE, 0x23F48), // ???
new BlockInfo(0x1D900, 0x005C, 0x1D95E, 0x23F4A), // Adventure Info
new BlockInfo(0x1DA00, 0x01E0, 0x1DBE2, 0x23F4C), // ???
new BlockInfo(0x1DC00, 0x00A8, 0x1DCAA, 0x23F4E), // ???
new BlockInfo(0x1DD00, 0x0460, 0x1E162, 0x23F50), // ???
new BlockInfo(0x1E200, 0x1400, 0x1F602, 0x23F52), // ???
new BlockInfo(0x1F700, 0x02A4, 0x1F9A6, 0x23F54), // ???
new BlockInfo(0x1FA00, 0x02DC, 0x1FCDE, 0x23F56), // ???
new BlockInfo(0x1FD00, 0x034C, 0x2004E, 0x23F58), // ???
new BlockInfo(0x20100, 0x03EC, 0x204EE, 0x23F5A), // ???
new BlockInfo(0x20500, 0x00F8, 0x205FA, 0x23F5C), // ???
new BlockInfo(0x20600, 0x02FC, 0x208FE, 0x23F5E), // ???
new BlockInfo(0x20900, 0x0094, 0x20996, 0x23F60), // ???
new BlockInfo(0x20A00, 0x035C, 0x20D5E, 0x23F62), // ???
new BlockInfo(0x20E00, 0x01CC, 0x20FCE, 0x23F64), // ???
new BlockInfo(0x21000, 0x0168, 0x2116A, 0x23F66), // ???
new BlockInfo(0x21200, 0x00EC, 0x212EE, 0x23F68), // ???
new BlockInfo(0x21300, 0x01B0, 0x214B2, 0x23F6A), // ???
new BlockInfo(0x21500, 0x001C, 0x2151E, 0x23F6C), // ???
new BlockInfo(0x21600, 0x04D4, 0x21AD6, 0x23F6E), // ???
new BlockInfo(0x21B00, 0x0034, 0x21B36, 0x23F70), // ???
new BlockInfo(0x21C00, 0x003C, 0x21C3E, 0x23F72), // ???
new BlockInfo(0x21D00, 0x01AC, 0x21EAE, 0x23F74), // ???
new BlockInfo(0x21F00, 0x0B90, 0x22A92, 0x23F76), // ???
new BlockInfo(0x22B00, 0x009C, 0x22B9E, 0x23F78), // ???
new BlockInfo(0x22C00, 0x0850, 0x23452, 0x23F7A), // Entralink Forest pokémon data
new BlockInfo(0x23500, 0x0028, 0x2352A, 0x23F7C), // ???
new BlockInfo(0x23600, 0x0284, 0x23886, 0x23F7E), // ???
new BlockInfo(0x23900, 0x0010, 0x23912, 0x23F80), // ???
new BlockInfo(0x23A00, 0x005C, 0x23A5E, 0x23F82), // ???
new BlockInfo(0x23B00, 0x016C, 0x23C6E, 0x23F84), // ???
new BlockInfo(0x23D00, 0x0040, 0x23D42, 0x23F86), // ???
new BlockInfo(0x23E00, 0x00FC, 0x23EFE, 0x23F88), // ???
new BlockInfo(0x23F00, 0x008C, 0x23F9A, 0x23F9A), // Checksums */
};
}
else if (SaveVersion == 1) // B2W2
{
Blocks = new[]
{
// Offset, Length, CHKOfst, ChkMirror
new BlockInfo(0x00000, 0x03e0, 0x003E2, 0x25F00), // Box Names
new BlockInfo(0x00400, 0x0ff0, 0x013F2, 0x25F02), // Box 1
new BlockInfo(0x01400, 0x0ff0, 0x023F2, 0x25F04), // Box 2
new BlockInfo(0x02400, 0x0ff0, 0x033F2, 0x25F06), // Box 3
new BlockInfo(0x03400, 0x0ff0, 0x043F2, 0x25F08), // Box 4
new BlockInfo(0x04400, 0x0ff0, 0x053F2, 0x25F0A), // Box 5
new BlockInfo(0x05400, 0x0ff0, 0x063F2, 0x25F0C), // Box 6
new BlockInfo(0x06400, 0x0ff0, 0x073F2, 0x25F0E), // Box 7
new BlockInfo(0x07400, 0x0ff0, 0x083F2, 0x25F10), // Box 8
new BlockInfo(0x08400, 0x0ff0, 0x093F2, 0x25F12), // Box 9
new BlockInfo(0x09400, 0x0ff0, 0x0A3F2, 0x25F14), // Box 10
new BlockInfo(0x0A400, 0x0ff0, 0x0B3F2, 0x25F16), // Box 11
new BlockInfo(0x0B400, 0x0ff0, 0x0C3F2, 0x25F18), // Box 12
new BlockInfo(0x0C400, 0x0ff0, 0x0D3F2, 0x25F1A), // Box 13
new BlockInfo(0x0D400, 0x0ff0, 0x0E3F2, 0x25F1C), // Box 14
new BlockInfo(0x0E400, 0x0ff0, 0x0F3F2, 0x25F1E), // Box 15
new BlockInfo(0x0F400, 0x0ff0, 0x103F2, 0x25F20), // Box 16
new BlockInfo(0x10400, 0x0ff0, 0x113F2, 0x25F22), // Box 17
new BlockInfo(0x11400, 0x0ff0, 0x123F2, 0x25F24), // Box 18
new BlockInfo(0x12400, 0x0ff0, 0x133F2, 0x25F26), // Box 19
new BlockInfo(0x13400, 0x0ff0, 0x143F2, 0x25F28), // Box 20
new BlockInfo(0x14400, 0x0ff0, 0x153F2, 0x25F2A), // Box 21
new BlockInfo(0x15400, 0x0ff0, 0x163F2, 0x25F2C), // Box 22
new BlockInfo(0x16400, 0x0ff0, 0x173F2, 0x25F2E), // Box 23
new BlockInfo(0x17400, 0x0ff0, 0x183F2, 0x25F30), // Box 24
new BlockInfo(0x18400, 0x09ec, 0x18DEE, 0x25F32), // Inventory
new BlockInfo(0x18E00, 0x0534, 0x19336, 0x25F34), // Party Pokemon
new BlockInfo(0x19400, 0x00b0, 0x194B2, 0x25F36), // Trainer Data
new BlockInfo(0x19500, 0x00a8, 0x195AA, 0x25F38), // Trainer Position
new BlockInfo(0x19600, 0x1338, 0x1A93A, 0x25F3A), // Unity Tower and survey stuff
new BlockInfo(0x1AA00, 0x07c4, 0x1B1C6, 0x25F3C), // Pal Pad Player Data (30d)
new BlockInfo(0x1B200, 0x0d54, 0x1BF56, 0x25F3E), // Pal Pad Friend Data
new BlockInfo(0x1C000, 0x0094, 0x1C096, 0x25F40), // C-Gear
new BlockInfo(0x1C100, 0x0658, 0x1C75A, 0x25F42), // Card Signature Block & ????
new BlockInfo(0x1C800, 0x0a94, 0x1D296, 0x25F44), // Mystery Gift
new BlockInfo(0x1D300, 0x01ac, 0x1D4AE, 0x25F46), // Dream World Stuff (Catalog)
new BlockInfo(0x1D500, 0x03ec, 0x1D8EE, 0x25F48), // Chatter
new BlockInfo(0x1D900, 0x005c, 0x1D95E, 0x25F4A), // Adventure data
new BlockInfo(0x1DA00, 0x01e0, 0x1DBE2, 0x25F4C), // Trainer Card Records
new BlockInfo(0x1DC00, 0x00a8, 0x1DCAA, 0x25F4E), // ???
new BlockInfo(0x1DD00, 0x0460, 0x1E162, 0x25F50), // (40d)
new BlockInfo(0x1E200, 0x1400, 0x1F602, 0x25F52), // ???
new BlockInfo(0x1F700, 0x02a4, 0x1F9A6, 0x25F54), // Contains flags and references for downloaded data (Musical)
new BlockInfo(0x1FA00, 0x00e0, 0x1FAE2, 0x25F56), // Fused Reshiram/Zekrom Storage
new BlockInfo(0x1FB00, 0x034c, 0x1FE4E, 0x25F58), // ???
new BlockInfo(0x1FF00, 0x04e0, 0x203E2, 0x25F5A), // Const Data Block and Event Flag Block (0x35E is the split)
new BlockInfo(0x20400, 0x00f8, 0x204FA, 0x25F5C), // ???
new BlockInfo(0x20500, 0x02fc, 0x207FE, 0x25F5E), // Tournament Block
new BlockInfo(0x20800, 0x0094, 0x20896, 0x25F60), // ???
new BlockInfo(0x20900, 0x035c, 0x20C5E, 0x25F62), // Battle Box Block
new BlockInfo(0x20D00, 0x01d4, 0x20ED6, 0x25F64), // Daycare Block (50d)
new BlockInfo(0x20F00, 0x01e0, 0x201E2, 0x25F66), // Strength Boulder Status Block
new BlockInfo(0x21100, 0x00f0, 0x211F2, 0x25F68), // Badge Flags, Money, Trainer Sayings
new BlockInfo(0x21200, 0x01b4, 0x213B6, 0x25F6A), // Entralink (Level & Powers etc)
new BlockInfo(0x21400, 0x04dc, 0x218DE, 0x25F6C), // Pokedex
new BlockInfo(0x21900, 0x0034, 0x21936, 0x25F6E), // Swarm and other overworld info - 2C - swarm, 2D - repel steps, 2E repel type
new BlockInfo(0x21A00, 0x003c, 0x21A3E, 0x25F70), // ???
new BlockInfo(0x21B00, 0x01ac, 0x21CAE, 0x25F72), // ???
new BlockInfo(0x21D00, 0x0b90, 0x22892, 0x25F74), // ???
new BlockInfo(0x22900, 0x00ac, 0x229AE, 0x25F76), // Online Records
new BlockInfo(0x22A00, 0x0850, 0x23252, 0x25F78), // Area NPC data - encrypted (60d)
new BlockInfo(0x23300, 0x0284, 0x23586, 0x25F7A), // ???
new BlockInfo(0x23600, 0x0010, 0x23612, 0x25F7C), // ???
new BlockInfo(0x23700, 0x00a8, 0x237AA, 0x25F7E), // ???
new BlockInfo(0x23800, 0x016c, 0x2396E, 0x25F80), // ???
new BlockInfo(0x23A00, 0x0080, 0x23A82, 0x25F82), // ???
new BlockInfo(0x23B00, 0x00fc, 0x23BFE, 0x25F84), // Hollow/Rival Block
new BlockInfo(0x23C00, 0x16a8, 0x252AA, 0x25F86), // Join Avenue Block
new BlockInfo(0x25300, 0x0498, 0x2579A, 0x25F88), // Medal data
new BlockInfo(0x25800, 0x0060, 0x25862, 0x25F8A), // Key-related data
new BlockInfo(0x25900, 0x00fc, 0x259FE, 0x25F8C), // (70d)
new BlockInfo(0x25A00, 0x03e4, 0x25DE6, 0x25F8E), // ???
new BlockInfo(0x25E00, 0x00f0, 0x25EF2, 0x25F90), // ???
new BlockInfo(0x25F00, 0x0094, 0x25FA2, 0x25FA2), // Checksum Block (73d)
};
}
else
{
Blocks = new BlockInfo[] { };
}
}
protected override void setChecksums()
{
// Check for invalid block lengths
if (Blocks.Length < 3) // arbitrary...
{
Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
return;
}
// Apply checksums
foreach (BlockInfo b in Blocks)
{
byte[] array = Data.Skip(b.Offset).Take(b.Length).ToArray();
ushort chk = SaveUtil.ccitt16(array);
BitConverter.GetBytes(chk).CopyTo(Data, b.ChecksumOffset);
BitConverter.GetBytes(chk).CopyTo(Data, b.ChecksumMirror);
}
}
public override bool ChecksumsValid
{
get
{
// Check for invalid block lengths
if (Blocks.Length < 3) // arbitrary...
{
Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
return false;
}
foreach (BlockInfo b in Blocks)
{
byte[] array = Data.Skip(b.Offset).Take(b.Length).ToArray();
ushort chk = SaveUtil.ccitt16(array);
if (chk != BitConverter.ToUInt16(Data, b.ChecksumOffset))
return false;
if (chk != BitConverter.ToUInt16(Data, b.ChecksumMirror))
return false;
}
return true;
}
}
public override string ChecksumInfo
{
get
{
// Check for invalid block lengths
if (Blocks.Length < 3) // arbitrary...
{
Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
return "Not a valid save to check.";
}
string r = "";
int invalid = 0;
for (int i = 0; i < Blocks.Length; i++)
{
BlockInfo b = Blocks[i];
byte[] array = Data.Skip(b.Offset).Take(b.Length).ToArray();
ushort chk = SaveUtil.ccitt16(array);
if (chk != BitConverter.ToUInt16(Data, b.ChecksumOffset))
{
r += $"Block {i} has been modified." + Environment.NewLine;
invalid++;
}
else if (chk != BitConverter.ToUInt16(Data, b.ChecksumMirror))
{
r += $"Block {i} mirror does not match." + Environment.NewLine;
invalid++;
}
}
r += $"SAV: {Blocks.Length - invalid}/{Blocks.Length + Environment.NewLine}";
return r;
}
}
private const int wcSeed = 0x1D290;
private readonly int Trainer2, AdventureInfo;
public override bool HasBoxWallpapers => false;
// Daycare
public override int DaycareSeedSize => 16;
public override int getDaycareSlotOffset(int loc, int slot)
{
return Daycare + 4 + 0xE4 * slot;
}
public override ulong? getDaycareRNGSeed(int loc)
{
if (SaveVersion != 1)
return null;
return BitConverter.ToUInt64(Data, Daycare + 0x1CC);
}
public override uint? getDaycareEXP(int loc, int slot)
{
return BitConverter.ToUInt32(Data, Daycare + 4 + 0xDC + slot * 0xE4);
}
public override bool? getDaycareOccupied(int loc, int slot)
{
return BitConverter.ToUInt32(Data, Daycare + 0xE4*slot) == 1;
}
public override void setDaycareEXP(int loc, int slot, uint EXP)
{
if (SaveVersion != 1)
return;
BitConverter.GetBytes(EXP).CopyTo(Data, Daycare + 4 + 0xDC + slot * 0xE4);
}
public override void setDaycareOccupied(int loc, int slot, bool occupied)
{
BitConverter.GetBytes((uint)(occupied ? 1 : 0)).CopyTo(Data, Daycare + 0x1CC);
}
public override void setDaycareRNGSeed(int loc, ulong seed)
{
if (SaveVersion != 1)
return;
BitConverter.GetBytes(seed).CopyTo(Data, Daycare + 0x1CC);
}
// Inventory
private readonly ushort[] LegalItems, LegalKeyItems, LegalTMHMs, LegalMedicine, LegalBerries;
public override InventoryPouch[] Inventory
{
get
{
InventoryPouch[] pouch =
{
new InventoryPouch(InventoryType.Items, LegalItems, 995, OFS_PouchHeldItem),
new InventoryPouch(InventoryType.KeyItems, LegalKeyItems, 1, OFS_PouchKeyItem),
new InventoryPouch(InventoryType.TMHMs, LegalTMHMs, 1, OFS_PouchTMHM),
new InventoryPouch(InventoryType.Medicine, LegalMedicine, 995, OFS_PouchMedicine),
new InventoryPouch(InventoryType.Berries, LegalBerries, 995, OFS_PouchBerry),
};
foreach (var p in pouch)
p.getPouch(ref Data);
return pouch;
}
set
{
foreach (var p in value)
p.setPouch(ref Data);
}
}
// Storage
public override int PartyCount
{
get { return Data[Party]; }
protected set { Data[Party] = (byte)value; }
}
public override int getBoxOffset(int box)
{
return Box + SIZE_STORED * box * 30 + box * 0x10;
}
public override int getPartyOffset(int slot)
{
return Party + 8 + SIZE_PARTY*slot;
}
public override string getBoxName(int box)
{
if (box >= BoxCount)
return "";
return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, PCLayout + 0x28 * box + 4, 0x28));
}
public override void setBoxName(int box, string val)
{
if (val.Length > 38)
return;
val += '\uFFFF';
Encoding.Unicode.GetBytes(val.PadRight(0x14, '\0')).CopyTo(Data, PCLayout + 0x28 * box + 4);
Edited = true;
}
public override int getBoxWallpaper(int box)
{
return Data[PCLayout + 0x3C4 + box];
}
public override int CurrentBox
{
get { return Data[PCLayout]; }
set { Data[PCLayout] = (byte)value; }
}
public override bool BattleBoxLocked // TODO
{
get { return false; }
set { }
}
public override PKM getPKM(byte[] data)
{
return new PK5(data);
}
public override byte[] decryptPKM(byte[] data)
{
return PKX.decryptArray45(data);
}
// Mystery Gift
public override MysteryGiftAlbum GiftAlbum
{
get
{
uint seed = BitConverter.ToUInt32(Data, wcSeed);
MysteryGiftAlbum Info = new MysteryGiftAlbum { Seed = seed };
byte[] wcData = Data.Skip(WondercardData).Take(0xA90).ToArray(); // Encrypted, Decrypt
for (int i = 0; i < wcData.Length; i += 2)
BitConverter.GetBytes((ushort)(BitConverter.ToUInt16(wcData, i) ^ PKX.LCRNG(ref seed) >> 16)).CopyTo(wcData, i);
Info.Flags = new bool[GiftFlagMax];
Info.Gifts = new MysteryGift[GiftCountMax];
// 0x100 Bytes for Used Flags
for (int i = 0; i < GiftFlagMax; i++)
Info.Flags[i] = (wcData[i/8] >> i%8 & 0x1) == 1;
// 12 PGFs
for (int i = 0; i < Info.Gifts.Length; i++)
Info.Gifts[i] = new PGF(wcData.Skip(0x100 + i*PGF.Size).Take(PGF.Size).ToArray());
return Info;
}
set
{
byte[] wcData = new byte[0xA90];
// Toss back into byte[]
for (int i = 0; i < value.Flags.Length; i++)
if (value.Flags[i])
wcData[i/8] |= (byte)(1 << (i & 7));
for (int i = 0; i < value.Gifts.Length; i++)
value.Gifts[i].Data.CopyTo(wcData, 0x100 + i*PGF.Size);
// Decrypted, Encrypt
uint seed = value.Seed;
for (int i = 0; i < wcData.Length; i += 2)
BitConverter.GetBytes((ushort)(BitConverter.ToUInt16(wcData, i) ^ PKX.LCRNG(ref seed) >> 16)).CopyTo(wcData, i);
// Write Back
wcData.CopyTo(Data, WondercardData);
BitConverter.GetBytes(value.Seed).CopyTo(Data, wcSeed);
}
}
protected override bool[] MysteryGiftReceivedFlags { get { return null; } set { } }
protected override MysteryGift[] MysteryGiftCards { get { return new MysteryGift[0]; } set { } }
// Trainer Info
protected override GameVersion Version
{
get
{
switch (Game)
{
case 20: return GameVersion.W;
case 21: return GameVersion.B;
case 22: return GameVersion.W2;
case 23: return GameVersion.B2;
}
return GameVersion.Unknown;
}
}
public override string OT
{
get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, Trainer1 + 0x4, 16)); }
set
{
if (value.Length > 7)
value = value.Substring(0, 7); // Hard cap
Encoding.Unicode.GetBytes((value + '\uFFFF').PadRight(8, '\0')).CopyTo(Data, Trainer1 + 0x4); }
}
public override ushort TID
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 0); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 0); }
}
public override ushort SID
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 2); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 2); }
}
public uint Money
{
get { return BitConverter.ToUInt32(Data, Trainer2); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer2); }
}
public override int Gender
{
get { return Data[Trainer1 + 0x21]; }
set { Data[Trainer1 + 0x21] = (byte)value; }
}
public override int Language
{
get { return Data[Trainer1 + 0x1E]; }
set { Data[Trainer1 + 0x1E] = (byte)value; }
}
public override int Game
{
get { return Data[Trainer1 + 0x1F]; }
set { Data[Trainer1 + 0x1F] = (byte)value; }
}
public int Badges
{
get { return Data[Trainer2 + 0x4]; }
set { Data[Trainer2 + 0x4] = (byte)value; }
}
public int M
{
get { return BitConverter.ToInt32(Data, Trainer1 + 0x180); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x180); }
}
public int X
{
get { return BitConverter.ToInt32(Data, Trainer1 + 0x186); }
set { BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x186); }
}
public int Z
{
get { return BitConverter.ToInt32(Data, Trainer1 + 0x18A); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x18A); }
}
public int Y
{
get { return BitConverter.ToInt32(Data, Trainer1 + 0x18E); }
set { BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x18E); }
}
public int PlayedHours
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x24); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x24); }
}
public int PlayedMinutes
{
get { return Data[Trainer1 + 0x24 + 2]; }
set { Data[Trainer1 + 0x24 + 2] = (byte)value; }
}
public int PlayedSeconds
{
get { return Data[Trainer1 + 0x24 + 3]; }
set { Data[Trainer1 + 0x24 + 3] = (byte)value; }
}
public int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
public int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } }
}
}

File diff suppressed because it is too large Load diff

435
Saves/SaveFile.cs Normal file
View file

@ -0,0 +1,435 @@
using System;
using System.Linq;
namespace PKHeX
{
// Base Class for Save Files
public abstract class SaveFile
{
internal static bool SetUpdateDex = true;
internal static bool SetUpdatePKM = true;
// General Object Properties
public byte[] Data;
public bool Edited;
public string FileName, FilePath;
public abstract string BAKName { get; }
public abstract byte[] BAK { get; }
public abstract bool Exportable { get; }
public abstract SaveFile Clone();
// General PKM Properties
protected abstract Type PKMType { get; }
public abstract PKM getPKM(byte[] data);
public abstract PKM BlankPKM { get; }
public abstract byte[] decryptPKM(byte[] data);
public abstract int SIZE_STORED { get; }
public abstract int SIZE_PARTY { get; }
public abstract int MaxEV { get; }
public ushort[] HeldItems { get; protected set; }
// General SAV Properties
public byte[] Write()
{
setChecksums();
return Data;
}
public virtual string MiscSaveChecks() { return ""; }
public virtual string MiscSaveInfo() { return ""; }
protected abstract GameVersion Version { get; }
public abstract bool ChecksumsValid { get; }
public abstract string ChecksumInfo { get; }
public abstract int Generation { get; }
public bool ORASDEMO => Data.Length == SaveUtil.SIZE_G6ORASDEMO;
public bool ORAS => Version == GameVersion.OR || Version == GameVersion.AS;
public bool XY => Version == GameVersion.X || Version == GameVersion.Y;
// Flags
public bool HasWondercards => WondercardData > -1;
public bool HasSuperTrain => SuperTrain > -1;
public bool HasBerryField => BerryField > -1;
public bool HasHoF => HoF > -1;
public bool HasSecretBase => SecretBase > -1;
public bool HasPuff => Puff > -1;
public bool HasPSS => PSS > -1;
public bool HasOPower => OPower > -1;
public bool HasJPEG => JPEGData != null;
public bool HasBox => Box > -1;
public bool HasParty => Party > -1;
public bool HasBattleBox => BattleBox > -1;
public bool HasFused => Fused > -1;
public bool HasGTS => GTS > -1;
public bool HasDaycare => Daycare > -1;
public bool HasPokeDex => PokeDex > -1;
public virtual bool HasBoxWallpapers => PCLayout > -1;
public virtual bool HasSUBE => SUBE > -1 && !ORAS;
public virtual bool HasGeolocation => false;
public bool HasPokeBlock => ORAS && !ORASDEMO;
public bool HasEvents => EventFlags != null;
// Counts
protected virtual int GiftCountMax { get; } = int.MinValue;
protected virtual int GiftFlagMax { get; } = 0x800;
protected virtual int EventFlagMax { get; } = int.MinValue;
protected virtual int EventConstMax { get; } = int.MinValue;
public abstract int DaycareSeedSize { get; }
public abstract int OTLength { get; }
public abstract int NickLength { get; }
// Offsets
protected int Box { get; set; } = int.MinValue;
protected int Party { get; set; } = int.MinValue;
protected int Trainer1 { get; set; } = int.MinValue;
protected int Daycare { get; set; } = int.MinValue;
protected int WondercardData { get; set; } = int.MinValue;
protected int PCLayout { get; set; } = int.MinValue;
protected int EventFlag { get; set; } = int.MinValue;
protected int EventConst { get; set; } = int.MinValue;
public int GTS { get; protected set; } = int.MinValue;
public int BattleBox { get; protected set; } = int.MinValue;
public int Fused { get; protected set; } = int.MinValue;
public int SUBE { get; protected set; } = int.MinValue;
public int PokeDex { get; protected set; } = int.MinValue;
public int SuperTrain { get; protected set; } = int.MinValue;
public int SecretBase { get; protected set; } = int.MinValue;
public int Puff { get; protected set; } = int.MinValue;
public int PSS { get; protected set; } = int.MinValue;
public int BerryField { get; protected set; } = int.MinValue;
public int OPower { get; protected set; } = int.MinValue;
public int HoF { get; protected set; } = int.MinValue;
// SAV Properties
public PKM[] BoxData
{
get
{
PKM[] data = new PKM[BoxCount*30];
for (int i = 0; i < data.Length; i++)
{
data[i] = getStoredSlot(getBoxOffset(i/30) + SIZE_STORED*(i%30));
data[i].Identifier = $"{getBoxName(i/30)}:{(i%30 + 1).ToString("00")}";
}
return data;
}
set
{
if (value == null)
throw new ArgumentNullException();
if (value.Length != BoxCount*30)
throw new ArgumentException($"Expected {BoxCount*30}, got {value.Length}");
if (value.Any(pk => PKMType != pk.GetType()))
throw new ArgumentException($"Not {PKMType} array.");
for (int i = 0; i < value.Length; i++)
setStoredSlot(value[i], getBoxOffset(i/30) + SIZE_STORED*(i%30));
}
}
public PKM[] PartyData
{
get
{
PKM[] data = new PKM[PartyCount];
for (int i = 0; i < data.Length; i++)
data[i] = getPartySlot(Party + SIZE_PARTY * i);
return data;
}
set
{
if (value == null)
throw new ArgumentNullException();
if (value.Length == 0 || value.Length > 6)
throw new ArgumentException("Expected 1-6, got " + value.Length);
if (value.Any(pk => PKMType != pk.GetType()))
throw new ArgumentException($"Not {PKMType} array.");
if (value[0].Species == 0)
throw new ArgumentException("Can't have an empty first slot." + value.Length);
PKM[] newParty = value.Where(pk => pk.Species != 0).ToArray();
PartyCount = newParty.Length;
Array.Resize(ref newParty, 6);
for (int i = PartyCount; i < newParty.Length; i++)
newParty[i] = BlankPKM;
for (int i = 0; i < newParty.Length; i++)
setPartySlot(newParty[i], getPartyOffset(i));
}
}
public PKM[] BattleBoxData
{
get
{
if (Generation < 5)
return new PKM[0];
PKM[] data = new PKM[6];
for (int i = 0; i < data.Length; i++)
{
data[i] = getStoredSlot(BattleBox + SIZE_STORED * i);
if (data[i].Species == 0)
return data.Take(i).ToArray();
}
return data;
}
}
public bool[] EventFlags
{
get
{
if (EventFlagMax < 0)
return null;
bool[] Flags = new bool[EventFlagMax];
for (int i = 0; i < Flags.Length; i++)
Flags[i] = (Data[EventFlag + i / 8] >> i % 8 & 0x1) == 1;
return Flags;
}
set
{
if (EventFlagMax < 0)
return;
if (value.Length != EventFlagMax)
return;
byte[] data = new byte[value.Length / 8];
for (int i = 0; i < value.Length; i++)
if (value[i])
data[i >> 3] |= (byte)(1 << (i & 7));
data.CopyTo(Data, EventFlag);
}
}
public ushort[] EventConsts
{
get
{
if (EventConstMax < 0)
return null;
ushort[] Constants = new ushort[EventConstMax];
for (int i = 0; i < Constants.Length; i++)
Constants[i] = BitConverter.ToUInt16(Data, EventConst + i);
return Constants;
}
set
{
if (EventConstMax < 0)
return;
if (value.Length != EventConstMax)
return;
for (int i = 0; i < value.Length; i++)
BitConverter.GetBytes(value[i]).CopyTo(Data, EventConst + i * 2);
}
}
// Inventory
public abstract InventoryPouch[] Inventory { get; set; }
protected int OFS_PouchHeldItem { get; set; } = int.MinValue;
protected int OFS_PouchKeyItem { get; set; } = int.MinValue;
protected int OFS_PouchMedicine { get; set; } = int.MinValue;
protected int OFS_PouchTMHM { get; set; } = int.MinValue;
protected int OFS_PouchBerry { get; set; } = int.MinValue;
protected int OFS_PouchBalls { get; set; } = int.MinValue;
protected int OFS_BattleItems { get; set; } = int.MinValue;
protected int OFS_MailItems { get; set; } = int.MinValue;
// Mystery Gift
protected abstract bool[] MysteryGiftReceivedFlags { get; set; }
protected abstract MysteryGift[] MysteryGiftCards { get; set; }
public virtual MysteryGiftAlbum GiftAlbum
{
get
{
return new MysteryGiftAlbum
{
Flags = MysteryGiftReceivedFlags,
Gifts = MysteryGiftCards
};
}
set
{
MysteryGiftReceivedFlags = value.Flags;
MysteryGiftCards = value.Gifts;
}
}
public virtual bool BattleBoxLocked { get { return false; } set { } }
public virtual string JPEGTitle => null;
public virtual byte[] JPEGData => null;
public virtual int Country { get { return -1; } set { } }
public virtual int ConsoleRegion { get { return -1; } set { } }
public virtual int SubRegion { get { return -1; } set { } }
// Trainer Info
public abstract int Gender { get; set; }
public abstract int Language { get; set; }
public virtual int Game { get { return -1; } set { } }
public abstract ushort TID { get; set; }
public abstract ushort SID { get; set; }
public abstract string OT { get; set; }
public abstract int BoxCount { get; }
public abstract int PartyCount { get; protected set; }
public virtual int CurrentBox { get { return 0; } set { } }
// Varied Methods
protected abstract void setChecksums();
public abstract int getBoxOffset(int box);
public abstract int getPartyOffset(int slot);
public abstract int getBoxWallpaper(int box);
public abstract string getBoxName(int box);
public abstract void setBoxName(int box, string val);
// Daycare
public int DaycareIndex = 0;
public abstract int getDaycareSlotOffset(int loc, int slot);
public abstract uint? getDaycareEXP(int loc, int slot);
public virtual ulong? getDaycareRNGSeed(int loc) { return null; }
public virtual bool? getDaycareHasEgg(int loc) { return false; }
public abstract bool? getDaycareOccupied(int loc, int slot);
public abstract void setDaycareEXP(int loc, int slot, uint EXP);
public virtual void setDaycareRNGSeed(int loc, ulong seed) { }
public virtual void setDaycareHasEgg(int loc, bool hasEgg) { }
public abstract void setDaycareOccupied(int loc, int slot, bool occupied);
// Storage
public PKM getPartySlot(int offset)
{
return getPKM(decryptPKM(getData(offset, SIZE_PARTY)));
}
public PKM getStoredSlot(int offset)
{
return getPKM(decryptPKM(getData(offset, SIZE_STORED)));
}
public void setPartySlot(PKM pkm, int offset, bool? trade = null, bool? dex = null)
{
if (pkm == null) return;
if (pkm.GetType() != PKMType)
throw new InvalidCastException($"PKM Format needs to be {PKMType} when setting to a Gen{Generation} Save File.");
if (trade ?? SetUpdatePKM)
setPKM(pkm);
if (dex ?? SetUpdateDex)
setDex(pkm);
setData(pkm.EncryptedPartyData, offset);
Console.WriteLine("");
Edited = true;
}
public void setStoredSlot(PKM pkm, int offset, bool? trade = null, bool? dex = null)
{
if (pkm == null) return;
if (pkm.GetType() != PKMType)
throw new InvalidCastException($"PKM Format needs to be {PKMType} when setting to a Gen{Generation} Save File.");
if (trade ?? SetUpdatePKM)
setPKM(pkm);
if (dex ?? SetUpdateDex)
setDex(pkm);
setData(pkm.EncryptedBoxData, offset);
Edited = true;
}
public void setPartySlot(byte[] data, int offset, bool? trade = null, bool? dex = null)
{
if (data == null) return;
PKM pkm = getPKM(decryptPKM(data));
if (trade ?? SetUpdatePKM)
setPKM(pkm);
if (dex ?? SetUpdateDex)
setDex(pkm);
setData(pkm.EncryptedPartyData, offset);
Edited = true;
}
public void setStoredSlot(byte[] data, int offset, bool? trade = null, bool? dex = null)
{
if (data == null) return;
PKM pkm = getPKM(decryptPKM(data));
if (trade ?? SetUpdatePKM)
setPKM(pkm);
if (dex ?? SetUpdateDex)
setDex(pkm);
setData(pkm.EncryptedBoxData, offset);
Edited = true;
}
public void sortBoxes(int BoxStart = 0, int BoxEnd = -1)
{
PKM[] BD = BoxData;
var Section = BD.Skip(BoxStart*30);
if (BoxEnd > BoxStart)
Section = Section.Take(30*(BoxEnd - BoxStart));
var Sorted = Section
.OrderBy(p => p.Species == 0) // empty slots at end
.ThenBy(p => p.IsEgg) // eggs to the end
.ThenBy(p => p.Species) // species sorted
.ThenBy(p => p.IsNicknamed).ToArray();
Array.Copy(Sorted, 0, BD, BoxStart*30, Sorted.Length);
BoxData = BD;
}
public void resetBoxes(int BoxStart = 0, int BoxEnd = -1)
{
if (BoxEnd < 0)
BoxEnd = BoxCount;
for (int i = BoxStart; i < BoxEnd; i++)
{
int offset = getBoxOffset(i);
for (int p = 0; p < 30; p++)
setStoredSlot(BlankPKM, offset + SIZE_STORED * p);
}
}
public byte[] getPCBin() { return BoxData.SelectMany(pk => pk.EncryptedBoxData).ToArray(); }
public byte[] getBoxBin(int box) { return BoxData.Skip(box*30).Take(30).SelectMany(pk => pk.EncryptedBoxData).ToArray(); }
public bool setPCBin(byte[] data)
{
if (data.Length != getPCBin().Length)
return false;
// split up data to individual pkm
byte[][] pkdata = new byte[data.Length/SIZE_STORED][];
for (int i = 0; i < data.Length; i += SIZE_STORED)
pkdata[i] = data.Skip(i).Take(SIZE_STORED).ToArray();
PKM[] pkms = BoxData;
for (int i = 0; i < pkms.Length; i++)
pkms[i].Data = decryptPKM(pkdata[i]);
BoxData = pkms;
return true;
}
public bool setBoxBin(byte[] data, int box)
{
if (data.Length != getBoxBin(box).Length)
return false;
byte[][] pkdata = new byte[data.Length / SIZE_STORED][];
for (int i = 0; i < data.Length; i += SIZE_STORED)
pkdata[i] = data.Skip(i).Take(SIZE_STORED).ToArray();
PKM[] pkms = BoxData;
for (int i = 0; i < 30; i++)
pkms[box*30 + i].Data = decryptPKM(pkdata[i]);
BoxData = pkms;
return true;
}
protected virtual void setPKM(PKM pkm) { }
protected virtual void setDex(PKM pkm) { }
public byte[] getData(int Offset, int Length)
{
return Data.Skip(Offset).Take(Length).ToArray();
}
public void setData(byte[] input, int Offset)
{
input.CopyTo(Data, Offset);
Edited = true;
}
}
}

22
Saves/SaveObjects.cs Normal file
View file

@ -0,0 +1,22 @@
namespace PKHeX
{
public struct DaycareSlot
{
public uint Experience;
public PKM PKM;
public bool Occupied;
}
public struct Daycare
{
public DaycareSlot[] Slots;
public bool EggAvailable;
public ulong Seed;
}
public struct MysteryGiftAlbum
{
public MysteryGift[] Gifts;
public bool[] Flags;
public uint Seed;
}
}

Some files were not shown because too many files have changed in this diff Show more