Don't show Trainer Rankings replay responses on production.

This commit is contained in:
Greg Edwards
2021-04-22 01:29:00 -04:00
parent 65ebfe13e2
commit 2d4d945057

View File

@@ -42,7 +42,7 @@ namespace PkmnFoundations.GlobalTerminalService
s.Close();
}
}
protected override byte[] ProcessRequest(byte[] data, TcpClient c)
{
int length = BitConverter.ToInt32(data, 0);
@@ -337,6 +337,9 @@ namespace PkmnFoundations.GlobalTerminalService
#region Trainer Rankings
case RequestTypes4.TrainerRankingsHead:
{
#if !DEBUG
goto default;
#endif
if (data.Length != 0x140)
{
logEntry.AppendLine("Length did not validate.");
@@ -353,12 +356,17 @@ namespace PkmnFoundations.GlobalTerminalService
// 0x28: Completed GTS trades
// 0x43: Facilities challenged at battle frontier
// The purpose of 0x1c is unclear to me.
// todo: See if we can ask for more than 3 different records. Would be neat to have all of them on the web!
response.Write(new byte[] { 0x01, 0x28, 0x43, 0x1c }, 0, 4);
} break;
case RequestTypes4.TrainerRankingsSearch:
{
#if !DEBUG
goto default;
#endif
if (data.Length != 0x164)
{
logEntry.AppendLine("Length did not validate.");
@@ -371,6 +379,27 @@ namespace PkmnFoundations.GlobalTerminalService
// It also (presumably) conveys which teams the player is a part of.
// (Trainer Class, Birth Month, Favourite Pokémon)
// AdmiralCurtiss's request:
// 0140: 0c02050900000000 1800303b01000000
// 0150: 0100000028000000 0000000043000000
// 0160: 00000000
// Hikari's request:
// Platinum EN July [I forget] Gallade
// 0140: 0c02070bdb010000 e200350f01000000
// 0150: 0300000028000000 0800000043000000
// 0160: 28000000
// 140: Version
// 141: Language
// 142: Birth Month
// 143: Trainer Class
// 144-145: Favourite Pokémon
// 146-14b: Unknown
// 14c-163: Three record records
// Record record contains 4 bytes of category and 4 bytes of my score in the category.
// The response is biig and contains all the records for both this week and last week.
// This week lacks numbers because they're still growing and to make it a surprise.
@@ -378,27 +407,30 @@ namespace PkmnFoundations.GlobalTerminalService
response.Write(new byte[] { 0x00, 0x00 }, 0, 2);
response.WriteBytes(new byte[] {
0x1c, 0x00, 0x00, 0x00, 0x02, 0x07, 0x06, 0x00,
0x04, 0x01, 0x05, 0x03, 0x0c, 0x09, 0x0f, 0x0e,
0x0d, 0x08, 0x0a, 0x0b, 0x89, 0xe9, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x8a, 0x66, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x8f, 0x04, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb1, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x31, 0xa4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf5, 0xa0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xa8, 0x9d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x71, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd6, 0x51, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc9, 0x46, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x17, 0x2a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb2, 0x26, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x58, 0x22, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x99, 0x1e, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6b, 0x12, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x09, 0x05, 0x0c,
0x07, 0x04, 0x08, 0x0a, 0x02, 0x03, 0x06, 0x0b,
0xd3, 0x16, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
// Last week comes first:
0x1c, 0x00, 0x00, 0x00, // 0x1c is a record type here.
0x02, 0x07, 0x06, 0x00, 0x04, 0x01, 0x05, 0x03, // Then we have 16 bytes for trainer classes
0x0c, 0x09, 0x0f, 0x0e, 0x0d, 0x08, 0x0a, 0x0b,
0x89, 0xe9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Then 16 longs for their scores
0x8a, 0x66, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8f, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb1, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x31, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf5, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa8, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd6, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc9, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x17, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb2, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x99, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6b, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x09, 0x05, 0x0c, 0x07, 0x04, 0x08, 0x0a, // Now the 12 months begin...
0x02, 0x03, 0x06, 0x0b,
0xd3, 0x16, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // And the 12 longs for their scores
0xf0, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa4, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x17, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -410,12 +442,13 @@ namespace PkmnFoundations.GlobalTerminalService
0x7b, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x89, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x9d, 0x00, 0xc0, 0x01, 0xf9, 0x00, 0x5e, 0x01,
0x9d, 0x00, 0xc0, 0x01, 0xf9, 0x00, 0x5e, 0x01, // And 20 pokemon numbers.
0xf8, 0x00, 0x06, 0x00, 0x95, 0x01, 0xa0, 0x00,
0x97, 0x00, 0x95, 0x00, 0xbd, 0x01, 0x7f, 0x01,
0x5f, 0x00, 0xd8, 0x01, 0x88, 0x01, 0x94, 0x00,
0xed, 0x01, 0x19, 0x00, 0x93, 0x00, 0x96, 0x00,
0xb6, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb6, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // And 20 longs for their scores
0x95, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x61, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb1, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -435,6 +468,8 @@ namespace PkmnFoundations.GlobalTerminalService
0xeb, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xdf, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4c, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x2b is the second record category.
0x2b, 0x00, 0x00, 0x00, 0x07, 0x03, 0x0f, 0x02,
0x05, 0x0e, 0x04, 0x01, 0x09, 0x00, 0x0a, 0x0c,
0x06, 0x0d, 0x0b, 0x08, 0x01, 0x00, 0x00, 0x00,
@@ -492,6 +527,8 @@ namespace PkmnFoundations.GlobalTerminalService
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// 0x4a is the last record category.
0x4a, 0x00, 0x00, 0x00, 0x02, 0x06, 0x07, 0x05,
0x00, 0x03, 0x04, 0x01, 0x08, 0x09, 0x0e, 0x0c,
0x0d, 0x0a, 0x0b, 0x0f, 0x5e, 0x76, 0x00, 0x00,
@@ -549,8 +586,10 @@ namespace PkmnFoundations.GlobalTerminalService
0xcd, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x04, 0x06, 0x0f,
0x03, 0x05, 0x07, 0x00, 0x08, 0x09, 0x01, 0x0c,
// Current week begins:
0x01, 0x00, 0x00, 0x00, 0x02, 0x04, 0x06, 0x0f, // ** 0x01 **
0x03, 0x05, 0x07, 0x00, 0x08, 0x09, 0x01, 0x0c, // 16 (trainer classes) + 12 (months) + 20 * 2 (pokemon) = 68 byte payload
0x0e, 0x0b, 0x0d, 0x0a, 0x03, 0x06, 0x01, 0x04,
0x0a, 0x05, 0x08, 0x0c, 0x09, 0x0b, 0x02, 0x07,
0x8e, 0x00, 0x7c, 0x01, 0x75, 0x01, 0x8e, 0x01,
@@ -558,7 +597,7 @@ namespace PkmnFoundations.GlobalTerminalService
0xfe, 0x00, 0xaf, 0x00, 0xe3, 0x01, 0x88, 0x01,
0xe7, 0x01, 0x82, 0x00, 0x5e, 0x01, 0xeb, 0x01,
0xe5, 0x00, 0xe8, 0x01, 0x93, 0x00, 0x96, 0x00,
0x28, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x0c,
0x28, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x0c, // ** 0x28 **
0x04, 0x02, 0x05, 0x06, 0x0b, 0x01, 0x0f, 0x0d,
0x08, 0x09, 0x0e, 0x0a, 0x0a, 0x07, 0x0c, 0x06,
0x01, 0x02, 0x08, 0x03, 0x05, 0x09, 0x0b, 0x04,
@@ -567,7 +606,7 @@ namespace PkmnFoundations.GlobalTerminalService
0x5e, 0x01, 0xc0, 0x01, 0x8e, 0x00, 0x9a, 0x00,
0xe7, 0x01, 0xbd, 0x01, 0xfe, 0x00, 0x82, 0x00,
0xbb, 0x00, 0x04, 0x01, 0xb0, 0x00, 0x9d, 0x00,
0x43, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04,
0x43, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04, // ** 0x43 **
0x03, 0x08, 0x07, 0x05, 0x0f, 0x01, 0x0c, 0x09,
0x0b, 0x0e, 0x0d, 0x0a, 0x0a, 0x05, 0x04, 0x07,
0x01, 0x03, 0x0b, 0x0c, 0x09, 0x06, 0x08, 0x02,
@@ -579,7 +618,7 @@ namespace PkmnFoundations.GlobalTerminalService
});
} break;
#endregion
#endregion
default:
logEntry.AppendLine("Unrecognized request type.");