mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-08-26 20:24:09 -05:00
Added base class for Battle Tower Pokémon, derived from our abstract base Pokémon class, and plumbed the change through.
This commit is contained in:
@@ -536,8 +536,8 @@ namespace PkmnFoundations.GTS
|
||||
return;
|
||||
}
|
||||
|
||||
BattleTowerRecord4[] opponents = Database.Instance.BattleTowerGetOpponents4(pid, rank, roomNum);
|
||||
BattleTowerProfile4[] leaders = Database.Instance.BattleTowerGetLeaders4(rank, roomNum);
|
||||
BattleTowerRecord4[] opponents = Database.Instance.BattleTowerGetOpponents4(pokedex, pid, rank, roomNum);
|
||||
BattleTowerProfile4[] leaders = Database.Instance.BattleTowerGetLeaders4(pokedex, rank, roomNum);
|
||||
BattleTowerRecord4[] fakeOpponents = FakeOpponentGenerator4.GenerateFakeOpponents(7 - opponents.Length);
|
||||
|
||||
foreach (BattleTowerRecord4 record in fakeOpponents)
|
||||
@@ -590,7 +590,7 @@ namespace PkmnFoundations.GTS
|
||||
return;
|
||||
}
|
||||
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(data, 0);
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(pokedex, data, 0);
|
||||
|
||||
record.Rank = data[0xe4];
|
||||
record.RoomNum = data[0xe5];
|
||||
|
||||
@@ -30,23 +30,24 @@ namespace PkmnFoundations.GTS
|
||||
BattleTowerRecord4[] result = new BattleTowerRecord4[count];
|
||||
|
||||
Random rand = new Random();
|
||||
var pokedex = AppStateHelper.Pokedex(HttpContext.Current.Application);
|
||||
|
||||
for (int x = 0; x < count; x++)
|
||||
{
|
||||
int index = rand.Next(values.Count);
|
||||
int index2 = values[index];
|
||||
values.RemoveAt(index);
|
||||
result[x] = GenerateFakeOpponent(index2);
|
||||
result[x] = GenerateFakeOpponent(pokedex, index2);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static BattleTowerRecord4 GenerateFakeOpponent(int index)
|
||||
public static BattleTowerRecord4 GenerateFakeOpponent(Pokedex.Pokedex pokedex, int index)
|
||||
{
|
||||
if (index >= FAKE_OPPONENTS_COUNT) throw new ArgumentOutOfRangeException("index");
|
||||
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4();
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(pokedex);
|
||||
record.Party = new BattleTowerPokemon4[3];
|
||||
record.Unknown3 = 7983;
|
||||
|
||||
@@ -54,7 +55,7 @@ namespace PkmnFoundations.GTS
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
9, // Blastoise
|
||||
234, // Leftovers
|
||||
new ushort[] {
|
||||
@@ -64,13 +65,13 @@ namespace PkmnFoundations.GTS
|
||||
156 // Rest
|
||||
},
|
||||
0x01020304, 15, // Modest
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 20, 31, 31, 20),
|
||||
IvStatValues.PackIVs(31, 10, 20, 31, 31, 20),
|
||||
new byte[] { 6, 0, 0, 252, 252, 0 },
|
||||
0, Languages.English, 67, // Torrent
|
||||
255, new EncodedString4("Leonardo", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
389, // Torterra
|
||||
287, // Choice scarf
|
||||
new ushort[] {
|
||||
@@ -80,13 +81,13 @@ namespace PkmnFoundations.GTS
|
||||
242 // Crunch
|
||||
},
|
||||
0x01020304, 13, // Jolly
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
new byte[] { 6, 252, 0, 252, 0, 0 },
|
||||
0, Languages.English, 65, // Overgrow
|
||||
255, new EncodedString4("Donatello", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
324, // Torkoal
|
||||
217, // Quick claw
|
||||
new ushort[] {
|
||||
@@ -96,7 +97,7 @@ namespace PkmnFoundations.GTS
|
||||
90 // Fissure
|
||||
},
|
||||
0x01020304, 23, // Careful
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 31, 20, 10, 31),
|
||||
IvStatValues.PackIVs(31, 10, 31, 20, 10, 31),
|
||||
new byte[] { 252, 0, 6, 0, 0, 252 },
|
||||
0, Languages.English, 73, // White smoke
|
||||
255, new EncodedString4("Raphael", 22)
|
||||
@@ -111,12 +112,12 @@ namespace PkmnFoundations.GTS
|
||||
);
|
||||
|
||||
record.PhraseChallenged = new TrendyPhrase4(0, 16, 291, 7);
|
||||
record.PhraseWon = new TrendyPhrase4(1, 11, 766, 65535);
|
||||
record.PhraseLost = new TrendyPhrase4(2, 8, 1406, 65535);
|
||||
record.PhraseWon = new TrendyPhrase4(1, 11, 766, 65535); // I might have won with HELPING HAND!
|
||||
record.PhraseLost = new TrendyPhrase4(2, 8, 1406, 65535); // You're INCREDIBLE, aren't you?
|
||||
break;
|
||||
|
||||
case 1:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
376, // Metagross
|
||||
268, // Expert belt
|
||||
new ushort[] {
|
||||
@@ -132,7 +133,7 @@ namespace PkmnFoundations.GTS
|
||||
255, new EncodedString4("Goldfinger", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
282, // Gardevoir
|
||||
297, // Choice specs
|
||||
new ushort[] {
|
||||
@@ -148,7 +149,7 @@ namespace PkmnFoundations.GTS
|
||||
255, new EncodedString4("Curly", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
134, // Vaporeon
|
||||
234, // Leftovers
|
||||
new ushort[] {
|
||||
@@ -165,7 +166,7 @@ namespace PkmnFoundations.GTS
|
||||
);
|
||||
|
||||
record.Profile = new BattleTowerProfile4(
|
||||
new EncodedString4("Kate", 16),
|
||||
new EncodedString4("Megan", 16),
|
||||
Versions.Platinum, Languages.English,
|
||||
0, 0, 0x02030405,
|
||||
new TrendyPhrase4(3, 8, 1487, 65535), // There's only WI-FI left!
|
||||
@@ -173,12 +174,12 @@ namespace PkmnFoundations.GTS
|
||||
);
|
||||
|
||||
record.PhraseChallenged = new TrendyPhrase4(3, 8, 1487, 65535);
|
||||
record.PhraseWon = new TrendyPhrase4(3, 3, 1439, 65535); // This BATTLE TOWER is DIFFICULT, isn't it?
|
||||
record.PhraseWon = new TrendyPhrase4(3, 3, 1492, 1439); // This BATTLE TOWER is DIFFICULT, isn't it?
|
||||
record.PhraseLost = new TrendyPhrase4(3, 2, 1493, 1492); // I love GTS! I love BATTLE TOWER too!
|
||||
break;
|
||||
|
||||
case 2:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
392, // Infernape
|
||||
275, // Focus sash
|
||||
new ushort[] {
|
||||
@@ -188,13 +189,13 @@ namespace PkmnFoundations.GTS
|
||||
7 // Fire punch
|
||||
},
|
||||
0x02030405, 13, // Jolly
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
new byte[] { 6, 252, 0, 252, 0, 0 },
|
||||
0, Languages.English, 66, // Blaze
|
||||
255, new EncodedString4("FunkyMunky", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
235, // Smeargle
|
||||
210, // Custap
|
||||
new ushort[] {
|
||||
@@ -204,13 +205,13 @@ namespace PkmnFoundations.GTS
|
||||
144 // Transform
|
||||
},
|
||||
0x02030405, 10, // Timid
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 31, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 10, 31, 31, 10, 20),
|
||||
new byte[] { 252, 0, 6, 252, 0, 0 },
|
||||
0, Languages.English, 101, // Technician
|
||||
255, new EncodedString4("Yourself", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
365, // Walrein
|
||||
217, // Quick claw
|
||||
new ushort[] {
|
||||
@@ -220,7 +221,7 @@ namespace PkmnFoundations.GTS
|
||||
329 // Sheer cold
|
||||
},
|
||||
5, 5, // Bold, shiny
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 20, 31, 10, 31),
|
||||
IvStatValues.PackIVs(31, 10, 20, 31, 10, 31),
|
||||
new byte[] { 252, 0, 0, 252, 0, 6 },
|
||||
0, Languages.English, 47, // Thick fat
|
||||
255, new EncodedString4("Problem?", 22)
|
||||
@@ -240,7 +241,7 @@ namespace PkmnFoundations.GTS
|
||||
break;
|
||||
|
||||
case 3:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
248, // Tyranitar
|
||||
189, // Chople
|
||||
new ushort[] {
|
||||
@@ -250,13 +251,13 @@ namespace PkmnFoundations.GTS
|
||||
444 // Stone edge
|
||||
},
|
||||
13, 13, // Jolly, shiny
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
new byte[] { 6, 252, 0, 252, 0, 0 },
|
||||
0, Languages.English, 45, // Sand stream
|
||||
255, new EncodedString4("Tyranitar", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
212, // Scizor
|
||||
270, // Life orb
|
||||
new ushort[] {
|
||||
@@ -266,13 +267,13 @@ namespace PkmnFoundations.GTS
|
||||
355 // Roost
|
||||
},
|
||||
0x03040506, 3, // Adamant
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
new byte[] { 6, 252, 0, 252, 0, 0 },
|
||||
0, Languages.English, 101, // Technician
|
||||
255, new EncodedString4("Scizor", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
485, // Heatran
|
||||
234, // Leftovers
|
||||
new ushort[] {
|
||||
@@ -283,7 +284,7 @@ namespace PkmnFoundations.GTS
|
||||
},
|
||||
0x03040506, 3, // Modest
|
||||
// fixme: these IVs are unreasonably high for Soft Resetting.
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 20, 20, 31, 31),
|
||||
IvStatValues.PackIVs(31, 10, 20, 20, 31, 31),
|
||||
new byte[] { 250, 0, 0, 0, 56, 204 },
|
||||
0, Languages.English, 18, // Flash fire
|
||||
255, new EncodedString4("Heatran", 22)
|
||||
@@ -303,7 +304,7 @@ namespace PkmnFoundations.GTS
|
||||
break;
|
||||
|
||||
case 4:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
460, // Abomasnow
|
||||
287, // Scarf
|
||||
new ushort[] {
|
||||
@@ -313,7 +314,7 @@ namespace PkmnFoundations.GTS
|
||||
89 // EQ
|
||||
},
|
||||
0x04050607, 11, // Hasty
|
||||
BattleTowerPokemon4.PackIVs(19, 31, 18, 30, 28, 19), // HP:fire base 59
|
||||
IvStatValues.PackIVs(19, 31, 18, 30, 28, 19), // HP:fire base 59
|
||||
// Original EVs: 228Spe/164Atk/116SAtk
|
||||
// Adjusted for Hidden Power IVs, sacrificing some Attack
|
||||
new byte[] { 0, 148, 0, 234, 128, 0 },
|
||||
@@ -321,7 +322,7 @@ namespace PkmnFoundations.GTS
|
||||
255, new EncodedString4("Abomasnow", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
471, // Glaceon
|
||||
246, // Nevermeltice
|
||||
new ushort[] {
|
||||
@@ -331,13 +332,13 @@ namespace PkmnFoundations.GTS
|
||||
182 // Protect
|
||||
},
|
||||
15, 15, // Modest, shiny
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 20, 31, 31, 20),
|
||||
IvStatValues.PackIVs(31, 10, 20, 31, 31, 20),
|
||||
new byte[] { 6, 0, 0, 252, 252, 0 },
|
||||
0, Languages.English, 81, // Snow cloak
|
||||
255, new EncodedString4("Glaceon", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
461, // Weavile
|
||||
275, // Focus sash
|
||||
new ushort[] {
|
||||
@@ -347,7 +348,7 @@ namespace PkmnFoundations.GTS
|
||||
67 // Low kick
|
||||
},
|
||||
13, 13, // Jolly, shiny
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
new byte[] { 40, 252, 0, 218, 0, 0 },
|
||||
0, Languages.English, 46, // Pressure
|
||||
255, new EncodedString4("Weavile", 22)
|
||||
@@ -367,7 +368,7 @@ namespace PkmnFoundations.GTS
|
||||
break;
|
||||
|
||||
case 5:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
437, // Bronzong
|
||||
234, // Leftovers
|
||||
new ushort[] {
|
||||
@@ -377,13 +378,13 @@ namespace PkmnFoundations.GTS
|
||||
153 // Explosion
|
||||
},
|
||||
22, 22, // Sassy, shiny
|
||||
BattleTowerPokemon4.PackIVs(31, 20, 31, 0, 10, 20),
|
||||
IvStatValues.PackIVs(31, 20, 31, 0, 10, 20),
|
||||
new byte[] { 252, 0, 252, 0, 0, 6 },
|
||||
0, Languages.English, 26, // Levitate
|
||||
255, new EncodedString4("Bronzong", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
464, // Rhyperior
|
||||
270, // Life orb
|
||||
new ushort[] {
|
||||
@@ -393,13 +394,13 @@ namespace PkmnFoundations.GTS
|
||||
224 // Megahorn
|
||||
},
|
||||
0x05060708, 2, // Brave
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 31, 10, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 31, 10, 10, 20),
|
||||
new byte[] { 248, 252, 10, 0, 0, 0 },
|
||||
0, Languages.English, 116, // Solid rock
|
||||
255, new EncodedString4("Rhyperior", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
462, // Magnezone
|
||||
268, // Expert belt
|
||||
new ushort[] {
|
||||
@@ -409,7 +410,7 @@ namespace PkmnFoundations.GTS
|
||||
393 // Magnet rise
|
||||
},
|
||||
0x05060708, 17, // Quiet
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 31, 10, 31, 20),
|
||||
IvStatValues.PackIVs(31, 10, 31, 10, 31, 20),
|
||||
new byte[] { 252, 0, 6, 0, 252, 0 },
|
||||
0, Languages.English, 42, // Magnet pull
|
||||
255, new EncodedString4("Magnezone", 22)
|
||||
@@ -429,7 +430,7 @@ namespace PkmnFoundations.GTS
|
||||
break;
|
||||
|
||||
case 6:
|
||||
record.Party[0] = new BattleTowerPokemon4(
|
||||
record.Party[0] = new BattleTowerPokemon4(pokedex,
|
||||
65, // Alakazam
|
||||
275, // Focus sash
|
||||
new ushort[] {
|
||||
@@ -439,13 +440,13 @@ namespace PkmnFoundations.GTS
|
||||
324 // Signal beam
|
||||
},
|
||||
15, 15, // Modest, shiny
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 20, 31, 31, 20),
|
||||
IvStatValues.PackIVs(31, 10, 20, 31, 31, 20),
|
||||
new byte[] { 6, 0, 0, 252, 252, 6 },
|
||||
0, Languages.English, 39, // Inner focus
|
||||
255, new EncodedString4("Alakazam", 22)
|
||||
);
|
||||
|
||||
record.Party[1] = new BattleTowerPokemon4(
|
||||
record.Party[1] = new BattleTowerPokemon4(pokedex,
|
||||
445, // Garchomp
|
||||
270, // Life orb
|
||||
new ushort[] {
|
||||
@@ -455,13 +456,13 @@ namespace PkmnFoundations.GTS
|
||||
424 // Fire fang
|
||||
},
|
||||
0x06070809, 13, // Jolly
|
||||
BattleTowerPokemon4.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
IvStatValues.PackIVs(31, 31, 20, 31, 10, 20),
|
||||
new byte[] { 6, 252, 0, 252, 0, 0 },
|
||||
0, Languages.English, 8, // Sand veil
|
||||
255, new EncodedString4("Garchomp", 22)
|
||||
);
|
||||
|
||||
record.Party[2] = new BattleTowerPokemon4(
|
||||
record.Party[2] = new BattleTowerPokemon4(pokedex,
|
||||
242, // Blissey
|
||||
234, // Leftovers
|
||||
new ushort[] {
|
||||
@@ -471,7 +472,7 @@ namespace PkmnFoundations.GTS
|
||||
69 // Seismic toss
|
||||
},
|
||||
0x06070809, 5, // Bold
|
||||
BattleTowerPokemon4.PackIVs(31, 10, 31, 31, 20, 20),
|
||||
IvStatValues.PackIVs(31, 10, 31, 31, 20, 20),
|
||||
new byte[] { 252, 0, 252, 6, 0, 0 },
|
||||
0, Languages.English, 30, // Natural cure
|
||||
255, new EncodedString4("Blissey", 22)
|
||||
|
||||
@@ -495,8 +495,8 @@ namespace PkmnFoundations.GTS
|
||||
return;
|
||||
}
|
||||
|
||||
BattleSubwayRecord5[] opponents = Database.Instance.BattleSubwayGetOpponents5(pid, rank, roomNum);
|
||||
BattleSubwayProfile5[] leaders = Database.Instance.BattleSubwayGetLeaders5(rank, roomNum);
|
||||
BattleSubwayRecord5[] opponents = Database.Instance.BattleSubwayGetOpponents5(pokedex, pid, rank, roomNum);
|
||||
BattleSubwayProfile5[] leaders = Database.Instance.BattleSubwayGetLeaders5(pokedex, rank, roomNum);
|
||||
|
||||
if (opponents.Length != 7)
|
||||
{
|
||||
@@ -542,7 +542,7 @@ namespace PkmnFoundations.GTS
|
||||
return;
|
||||
}
|
||||
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5(request, 0);
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5(pokedex, request, 0);
|
||||
|
||||
record.Rank = request[0xf0];
|
||||
record.RoomNum = request[0xf1];
|
||||
|
||||
@@ -739,21 +739,21 @@ namespace PkmnFoundations.Data
|
||||
private List<MySqlParameter> ParamsFromBattleTowerPokemon4(BattleTowerPokemon4 pokemon)
|
||||
{
|
||||
List<MySqlParameter> result = new List<MySqlParameter>(15);
|
||||
result.Add(new MySqlParameter("@species", pokemon.Species));
|
||||
result.Add(new MySqlParameter("@held_item", pokemon.HeldItem));
|
||||
result.Add(new MySqlParameter("@species", pokemon.SpeciesID));
|
||||
result.Add(new MySqlParameter("@held_item", pokemon.HeldItemID));
|
||||
result.Add(new MySqlParameter("@move1", pokemon.Moveset[0]));
|
||||
result.Add(new MySqlParameter("@move2", pokemon.Moveset[1]));
|
||||
result.Add(new MySqlParameter("@move3", pokemon.Moveset[2]));
|
||||
result.Add(new MySqlParameter("@move4", pokemon.Moveset[3]));
|
||||
result.Add(new MySqlParameter("@trainer_id", pokemon.OT));
|
||||
result.Add(new MySqlParameter("@trainer_id", pokemon.TrainerID));
|
||||
result.Add(new MySqlParameter("@personality", pokemon.Personality));
|
||||
result.Add(new MySqlParameter("@ivs", pokemon.IVs));
|
||||
result.Add(new MySqlParameter("@evs", pokemon.EVs));
|
||||
result.Add(new MySqlParameter("@ivs", pokemon.IVs.ToInt32() | (int)pokemon.IvFlags));
|
||||
result.Add(new MySqlParameter("@evs", pokemon.EVs.ToArray()));
|
||||
result.Add(new MySqlParameter("@unknown1", pokemon.Unknown1));
|
||||
result.Add(new MySqlParameter("@language", (byte)pokemon.Language));
|
||||
result.Add(new MySqlParameter("@ability", pokemon.Ability));
|
||||
result.Add(new MySqlParameter("@ability", pokemon.AbilityID));
|
||||
result.Add(new MySqlParameter("@happiness", pokemon.Happiness));
|
||||
result.Add(new MySqlParameter("@nickname", pokemon.Nickname.RawData));
|
||||
result.Add(new MySqlParameter("@nickname", pokemon.NicknameEncoded.RawData));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ namespace PkmnFoundations.Data
|
||||
return (ulong)(oPkey ?? 0UL);
|
||||
}
|
||||
|
||||
public BattleTowerRecord4[] BattleTowerGetOpponents4(MySqlTransaction tran, int pid, byte rank, byte roomNum)
|
||||
public BattleTowerRecord4[] BattleTowerGetOpponents4(MySqlTransaction tran, Pokedex.Pokedex pokedex, int pid, byte rank, byte roomNum)
|
||||
{
|
||||
List<BattleTowerRecord4> records = new List<BattleTowerRecord4>(7);
|
||||
List<ulong> keys = new List<ulong>(7);
|
||||
@@ -864,7 +864,7 @@ namespace PkmnFoundations.Data
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
BattleTowerRecord4 record = BattleTowerRecord4FromReader(reader);
|
||||
BattleTowerRecord4 record = BattleTowerRecord4FromReader(reader, pokedex);
|
||||
record.Party = new BattleTowerPokemon4[3];
|
||||
records.Add(record);
|
||||
keys.Add(reader.GetUInt64(0));
|
||||
@@ -884,7 +884,7 @@ namespace PkmnFoundations.Data
|
||||
while (reader.Read())
|
||||
{
|
||||
BattleTowerRecord4 record = records[keys.IndexOf(reader.GetUInt64(0))];
|
||||
record.Party[reader.GetByte(1)] = BattleTowerPokemon4FromReader(reader);
|
||||
record.Party[reader.GetByte(1)] = BattleTowerPokemon4FromReader(reader, pokedex);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
@@ -892,15 +892,15 @@ namespace PkmnFoundations.Data
|
||||
return Enumerable.Reverse(records).ToArray();
|
||||
}
|
||||
|
||||
public override BattleTowerRecord4[] BattleTowerGetOpponents4(int pid, byte rank, byte roomNum)
|
||||
public override BattleTowerRecord4[] BattleTowerGetOpponents4(Pokedex.Pokedex pokedex, int pid, byte rank, byte roomNum)
|
||||
{
|
||||
return WithTransaction(tran => BattleTowerGetOpponents4(tran, pid, rank, roomNum));
|
||||
return WithTransaction(tran => BattleTowerGetOpponents4(tran, pokedex, pid, rank, roomNum));
|
||||
}
|
||||
|
||||
private BattleTowerRecord4 BattleTowerRecord4FromReader(MySqlDataReader reader)
|
||||
private BattleTowerRecord4 BattleTowerRecord4FromReader(MySqlDataReader reader, Pokedex.Pokedex pokedex)
|
||||
{
|
||||
// xxx: Stop using ordinals everywhere.
|
||||
BattleTowerRecord4 result = new BattleTowerRecord4();
|
||||
BattleTowerRecord4 result = new BattleTowerRecord4(pokedex);
|
||||
result.PID = reader.GetInt32(1);
|
||||
|
||||
if (reader.FieldCount > 11) result.PhraseChallenged = new TrendyPhrase4(reader.GetByteArray(11, 8));
|
||||
@@ -924,30 +924,31 @@ namespace PkmnFoundations.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
private BattleTowerPokemon4 BattleTowerPokemon4FromReader(MySqlDataReader reader)
|
||||
private BattleTowerPokemon4 BattleTowerPokemon4FromReader(MySqlDataReader reader, Pokedex.Pokedex pokedex)
|
||||
{
|
||||
BattleTowerPokemon4 result = new BattleTowerPokemon4();
|
||||
result.Species = reader.GetUInt16(2);
|
||||
result.HeldItem = reader.GetUInt16(3);
|
||||
BattleTowerPokemon4 result = new BattleTowerPokemon4(pokedex);
|
||||
result.SpeciesID = reader.GetUInt16(2);
|
||||
result.HeldItemID = reader.GetUInt16(3);
|
||||
result.Moveset = new ushort[4];
|
||||
result.Moveset[0] = reader.GetUInt16(4);
|
||||
result.Moveset[1] = reader.GetUInt16(5);
|
||||
result.Moveset[2] = reader.GetUInt16(6);
|
||||
result.Moveset[3] = reader.GetUInt16(7);
|
||||
result.OT = reader.GetUInt32(8);
|
||||
result.TrainerID = reader.GetUInt32(8);
|
||||
result.Personality = reader.GetUInt32(9);
|
||||
result.IVs = reader.GetUInt32(10);
|
||||
result.EVs = reader.GetByteArray(11, 6);
|
||||
result.IVs = new IvStatValues((int)(reader.GetUInt32(10) & 0x3fffffff));
|
||||
result.IvFlags = reader.GetUInt32(10) & 0xc0000000u;
|
||||
result.EVs = new ByteStatValues(reader.GetByteArray(11, 6));
|
||||
result.Unknown1 = reader.GetByte(12);
|
||||
result.Language = (Languages)reader.GetByte(13);
|
||||
result.Ability = reader.GetByte(14);
|
||||
result.AbilityID = reader.GetByte(14);
|
||||
result.Happiness = reader.GetByte(15);
|
||||
result.Nickname = new EncodedString4(reader.GetByteArray(16, 22));
|
||||
result.NicknameEncoded = new EncodedString4(reader.GetByteArray(16, 22));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public BattleTowerProfile4[] BattleTowerGetLeaders4(MySqlTransaction tran, byte rank, byte roomNum)
|
||||
public BattleTowerProfile4[] BattleTowerGetLeaders4(MySqlTransaction tran, Pokedex.Pokedex pokedex, byte rank, byte roomNum)
|
||||
{
|
||||
List<BattleTowerProfile4> profiles = new List<BattleTowerProfile4>(30);
|
||||
using (MySqlDataReader reader = (MySqlDataReader)tran.ExecuteReader(
|
||||
@@ -960,7 +961,7 @@ namespace PkmnFoundations.Data
|
||||
new MySqlParameter("@room", roomNum)))
|
||||
{
|
||||
while (reader.Read())
|
||||
profiles.Add(BattleTowerRecord4FromReader(reader).Profile);
|
||||
profiles.Add(BattleTowerRecord4FromReader(reader, pokedex).Profile);
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
@@ -968,9 +969,9 @@ namespace PkmnFoundations.Data
|
||||
return profiles.ToArray();
|
||||
}
|
||||
|
||||
public override BattleTowerProfile4[] BattleTowerGetLeaders4(byte rank, byte roomNum)
|
||||
public override BattleTowerProfile4[] BattleTowerGetLeaders4(Pokedex.Pokedex pokedex, byte rank, byte roomNum)
|
||||
{
|
||||
return WithTransaction(tran => BattleTowerGetLeaders4(tran, rank, roomNum));
|
||||
return WithTransaction(tran => BattleTowerGetLeaders4(tran, pokedex, rank, roomNum));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1742,21 +1743,21 @@ namespace PkmnFoundations.Data
|
||||
private List<MySqlParameter> ParamsFromBattleSubwayPokemon5(BattleSubwayPokemon5 pokemon)
|
||||
{
|
||||
List<MySqlParameter> result = new List<MySqlParameter>(15);
|
||||
result.Add(new MySqlParameter("@species", pokemon.Species));
|
||||
result.Add(new MySqlParameter("@held_item", pokemon.HeldItem));
|
||||
result.Add(new MySqlParameter("@species", pokemon.SpeciesID));
|
||||
result.Add(new MySqlParameter("@held_item", pokemon.HeldItemID));
|
||||
result.Add(new MySqlParameter("@move1", pokemon.Moveset[0]));
|
||||
result.Add(new MySqlParameter("@move2", pokemon.Moveset[1]));
|
||||
result.Add(new MySqlParameter("@move3", pokemon.Moveset[2]));
|
||||
result.Add(new MySqlParameter("@move4", pokemon.Moveset[3]));
|
||||
result.Add(new MySqlParameter("@trainer_id", pokemon.OT));
|
||||
result.Add(new MySqlParameter("@trainer_id", pokemon.TrainerID));
|
||||
result.Add(new MySqlParameter("@personality", pokemon.Personality));
|
||||
result.Add(new MySqlParameter("@ivs", pokemon.IVs));
|
||||
result.Add(new MySqlParameter("@evs", pokemon.EVs));
|
||||
result.Add(new MySqlParameter("@ivs", pokemon.IVs.ToInt32() | (int)pokemon.IvFlags));
|
||||
result.Add(new MySqlParameter("@evs", pokemon.EVs.ToArray()));
|
||||
result.Add(new MySqlParameter("@unknown1", pokemon.Unknown1));
|
||||
result.Add(new MySqlParameter("@language", (byte)pokemon.Language));
|
||||
result.Add(new MySqlParameter("@ability", pokemon.Ability));
|
||||
result.Add(new MySqlParameter("@ability", pokemon.AbilityID));
|
||||
result.Add(new MySqlParameter("@happiness", pokemon.Happiness));
|
||||
result.Add(new MySqlParameter("@nickname", pokemon.Nickname.RawData));
|
||||
result.Add(new MySqlParameter("@nickname", pokemon.NicknameEncoded.RawData));
|
||||
result.Add(new MySqlParameter("@unknown2", pokemon.Unknown2));
|
||||
return result;
|
||||
}
|
||||
@@ -1851,12 +1852,12 @@ namespace PkmnFoundations.Data
|
||||
return (ulong)(oPkey ?? 0UL);
|
||||
}
|
||||
|
||||
public override BattleSubwayRecord5[] BattleSubwayGetOpponents5(int pid, byte rank, byte roomNum)
|
||||
public override BattleSubwayRecord5[] BattleSubwayGetOpponents5(Pokedex.Pokedex pokedex, int pid, byte rank, byte roomNum)
|
||||
{
|
||||
return WithTransaction(tran => BattleSubwayGetOpponents5(tran, pid, rank, roomNum));
|
||||
return WithTransaction(tran => BattleSubwayGetOpponents5(tran, pokedex, pid, rank, roomNum));
|
||||
}
|
||||
|
||||
public BattleSubwayRecord5[] BattleSubwayGetOpponents5(MySqlTransaction tran, int pid, byte rank, byte roomNum)
|
||||
public BattleSubwayRecord5[] BattleSubwayGetOpponents5(MySqlTransaction tran, Pokedex.Pokedex pokedex, int pid, byte rank, byte roomNum)
|
||||
{
|
||||
List<BattleSubwayRecord5> records = new List<BattleSubwayRecord5>(7);
|
||||
List<ulong> keys = new List<ulong>(7);
|
||||
@@ -1874,7 +1875,7 @@ namespace PkmnFoundations.Data
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
BattleSubwayRecord5 record = BattleSubwayRecord5FromReader(reader);
|
||||
BattleSubwayRecord5 record = BattleSubwayRecord5FromReader(reader, pokedex);
|
||||
record.Party = new BattleSubwayPokemon5[3];
|
||||
records.Add(record);
|
||||
keys.Add(reader.GetUInt64(0));
|
||||
@@ -1894,7 +1895,7 @@ namespace PkmnFoundations.Data
|
||||
while (reader.Read())
|
||||
{
|
||||
BattleSubwayRecord5 record = records[keys.IndexOf(reader.GetUInt64(0))];
|
||||
record.Party[reader.GetByte(1)] = BattleSubwayPokemon5FromReader(reader);
|
||||
record.Party[reader.GetByte(1)] = BattleSubwayPokemon5FromReader(reader, pokedex);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
@@ -1902,10 +1903,10 @@ namespace PkmnFoundations.Data
|
||||
return Enumerable.Reverse(records).ToArray();
|
||||
}
|
||||
|
||||
private BattleSubwayRecord5 BattleSubwayRecord5FromReader(MySqlDataReader reader)
|
||||
private BattleSubwayRecord5 BattleSubwayRecord5FromReader(MySqlDataReader reader, Pokedex.Pokedex pokedex)
|
||||
{
|
||||
// todo: Stop using ordinals everywhere.
|
||||
BattleSubwayRecord5 result = new BattleSubwayRecord5();
|
||||
BattleSubwayRecord5 result = new BattleSubwayRecord5(pokedex);
|
||||
result.PID = reader.GetInt32(1);
|
||||
// this is unsustainable. What happens if I add columns to Leaders?
|
||||
if (reader.FieldCount > 11) result.PhraseChallenged = new TrendyPhrase5(reader.GetByteArray(11, 8));
|
||||
@@ -1930,37 +1931,38 @@ namespace PkmnFoundations.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
private BattleSubwayPokemon5 BattleSubwayPokemon5FromReader(MySqlDataReader reader)
|
||||
private BattleSubwayPokemon5 BattleSubwayPokemon5FromReader(MySqlDataReader reader, Pokedex.Pokedex pokedex)
|
||||
{
|
||||
// xxx: Don't use ordinals
|
||||
BattleSubwayPokemon5 result = new BattleSubwayPokemon5();
|
||||
result.Species = reader.GetUInt16(2);
|
||||
result.HeldItem = reader.GetUInt16(3);
|
||||
BattleSubwayPokemon5 result = new BattleSubwayPokemon5(pokedex);
|
||||
result.SpeciesID = reader.GetUInt16(2);
|
||||
result.HeldItemID = reader.GetUInt16(3);
|
||||
result.Moveset = new ushort[4];
|
||||
result.Moveset[0] = reader.GetUInt16(4);
|
||||
result.Moveset[1] = reader.GetUInt16(5);
|
||||
result.Moveset[2] = reader.GetUInt16(6);
|
||||
result.Moveset[3] = reader.GetUInt16(7);
|
||||
result.OT = reader.GetUInt32(8);
|
||||
result.TrainerID = reader.GetUInt32(8);
|
||||
result.Personality = reader.GetUInt32(9);
|
||||
result.IVs = reader.GetUInt32(10);
|
||||
result.EVs = reader.GetByteArray(11, 6);
|
||||
result.IVs = new IvStatValues((int)(reader.GetUInt32(10) & 0x3fffffff));
|
||||
result.IvFlags = reader.GetUInt32(10) & 0xc0000000u;
|
||||
result.EVs = new ByteStatValues(reader.GetByteArray(11, 6));
|
||||
result.Unknown1 = reader.GetByte(12);
|
||||
result.Language = (Languages)reader.GetByte(13);
|
||||
result.Ability = reader.GetByte(14);
|
||||
result.AbilityID = reader.GetByte(14);
|
||||
result.Happiness = reader.GetByte(15);
|
||||
result.Nickname = new EncodedString5(reader.GetByteArray(16, 22));
|
||||
result.NicknameEncoded = new EncodedString5(reader.GetByteArray(16, 22));
|
||||
result.Unknown2 = reader.GetUInt32(17);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override BattleSubwayProfile5[] BattleSubwayGetLeaders5(byte rank, byte roomNum)
|
||||
public override BattleSubwayProfile5[] BattleSubwayGetLeaders5(Pokedex.Pokedex pokedex, byte rank, byte roomNum)
|
||||
{
|
||||
return WithTransaction(tran => BattleSubwayGetLeaders5(tran, rank, roomNum));
|
||||
return WithTransaction(tran => BattleSubwayGetLeaders5(tran, pokedex, rank, roomNum));
|
||||
}
|
||||
|
||||
public BattleSubwayProfile5[] BattleSubwayGetLeaders5(MySqlTransaction tran, byte rank, byte roomNum)
|
||||
public BattleSubwayProfile5[] BattleSubwayGetLeaders5(MySqlTransaction tran, Pokedex.Pokedex pokedex, byte rank, byte roomNum)
|
||||
{
|
||||
List<BattleSubwayProfile5> profiles = new List<BattleSubwayProfile5>(30);
|
||||
using (MySqlDataReader reader = (MySqlDataReader)tran.ExecuteReader(
|
||||
@@ -1973,7 +1975,7 @@ namespace PkmnFoundations.Data
|
||||
new MySqlParameter("@room", roomNum)))
|
||||
{
|
||||
while (reader.Read())
|
||||
profiles.Add(BattleSubwayRecord5FromReader(reader).Profile);
|
||||
profiles.Add(BattleSubwayRecord5FromReader(reader, pokedex).Profile);
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ namespace PkmnFoundations.Data
|
||||
#region Battle Tower 4
|
||||
public abstract ulong BattleTowerUpdateRecord4(BattleTowerRecord4 record);
|
||||
public abstract ulong BattleTowerAddLeader4(BattleTowerRecord4 record);
|
||||
public abstract BattleTowerRecord4[] BattleTowerGetOpponents4(int pid, byte rank, byte roomNum);
|
||||
public abstract BattleTowerProfile4[] BattleTowerGetLeaders4(byte rank, byte roomNum);
|
||||
public abstract BattleTowerRecord4[] BattleTowerGetOpponents4(Pokedex.Pokedex pokedex, int pid, byte rank, byte roomNum);
|
||||
public abstract BattleTowerProfile4[] BattleTowerGetLeaders4(Pokedex.Pokedex pokedex, byte rank, byte roomNum);
|
||||
#endregion
|
||||
|
||||
#region Wi-fi Plaza
|
||||
@@ -124,8 +124,8 @@ namespace PkmnFoundations.Data
|
||||
#region Battle Subway 5
|
||||
public abstract ulong BattleSubwayUpdateRecord5(BattleSubwayRecord5 record);
|
||||
public abstract ulong BattleSubwayAddLeader5(BattleSubwayRecord5 record);
|
||||
public abstract BattleSubwayRecord5[] BattleSubwayGetOpponents5(int pid, byte rank, byte roomNum);
|
||||
public abstract BattleSubwayProfile5[] BattleSubwayGetLeaders5(byte rank, byte roomNum);
|
||||
public abstract BattleSubwayRecord5[] BattleSubwayGetOpponents5(Pokedex.Pokedex pokedex, int pid, byte rank, byte roomNum);
|
||||
public abstract BattleSubwayProfile5[] BattleSubwayGetLeaders5(Pokedex.Pokedex pokedex, byte rank, byte roomNum);
|
||||
#endregion
|
||||
|
||||
#region Global Terminal 4
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
<Compile Include="Structures\BattleSubwayProfile5.cs" />
|
||||
<Compile Include="Structures\BattleSubwayRecord5.cs" />
|
||||
<Compile Include="Structures\BattleTowerPokemon4.cs" />
|
||||
<Compile Include="Structures\BattleTowerPokemonBase.cs" />
|
||||
<Compile Include="Structures\BattleTowerRecord4.cs" />
|
||||
<Compile Include="Structures\BattleTowerProfile4.cs" />
|
||||
<Compile Include="Structures\BattleVideoHeader4.cs" />
|
||||
|
||||
@@ -7,121 +7,149 @@ using PkmnFoundations.Support;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleSubwayPokemon5
|
||||
public class BattleSubwayPokemon5 : BattleTowerPokemonBase
|
||||
{
|
||||
public BattleSubwayPokemon5()
|
||||
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex) : base(pokedex)
|
||||
{
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5(byte[] data)
|
||||
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex, ushort species, ushort held_item, ushort[] moveset,
|
||||
uint ot, uint personality, uint ivs, byte[] evs, byte unknown1,
|
||||
Languages language, byte ability, byte happiness, EncodedString5 nickname, uint unknown2) : base(pokedex)
|
||||
{
|
||||
Load(data, 0);
|
||||
if (moveset == null) throw new ArgumentNullException("moveset");
|
||||
if (moveset.Length != 4) throw new ArgumentException("moveset");
|
||||
if (evs == null) throw new ArgumentNullException("evs");
|
||||
if (evs.Length != 6) throw new ArgumentException("evs");
|
||||
if (nickname == null) throw new ArgumentNullException("nickname");
|
||||
if (nickname.Size != 22) throw new ArgumentException("nickname");
|
||||
|
||||
SpeciesID = species;
|
||||
HeldItemID = held_item;
|
||||
Moveset = moveset.ToArray();
|
||||
TrainerID = ot;
|
||||
Personality = personality;
|
||||
IVs = new IvStatValues((int)ivs & 0x3fffffff);
|
||||
IvFlags = ivs & 0xc0000000u;
|
||||
EVs = new ByteStatValues(evs);
|
||||
Unknown1 = unknown1;
|
||||
Language = language;
|
||||
AbilityID = ability;
|
||||
Happiness = happiness;
|
||||
NicknameEncoded = nickname; // todo: clone
|
||||
Unknown2 = unknown2;
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5(byte[] data, int start)
|
||||
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex, BinaryReader data) : base(pokedex)
|
||||
{
|
||||
Load(data, start);
|
||||
Load(data);
|
||||
}
|
||||
|
||||
public ushort Species;
|
||||
public ushort HeldItem;
|
||||
public ushort[] Moveset;
|
||||
public uint OT;
|
||||
public uint Personality;
|
||||
public uint IVs;
|
||||
public byte[] EVs;
|
||||
public byte Unknown1; // probably a bitmask of applied PP ups
|
||||
public Languages Language;
|
||||
public byte Ability;
|
||||
public byte Happiness;
|
||||
public EncodedString5 Nickname;
|
||||
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex, byte[] data) : base(pokedex)
|
||||
{
|
||||
Load(data);
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex, byte[] data, int offset) : base(pokedex)
|
||||
{
|
||||
Load(data, offset);
|
||||
}
|
||||
|
||||
public EncodedString5 NicknameEncoded;
|
||||
public uint Unknown2;
|
||||
|
||||
// todo: add IVs class with indexer?
|
||||
// byte myHp = myPokemon.IVs[Stats.HP];
|
||||
public byte IV(Stats stat)
|
||||
public override string Nickname
|
||||
{
|
||||
return BattleTowerPokemon4.UnpackIV(IVs, stat);
|
||||
get
|
||||
{
|
||||
return (NicknameEncoded == null) ? null : NicknameEncoded.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
// xxx: This comes straight from Pokemon4. What we logically need here is an inheritance diamond.
|
||||
if (Nickname == value) return;
|
||||
if (NicknameEncoded == null) NicknameEncoded = new EncodedString5(value, 22);
|
||||
else NicknameEncoded.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Save()
|
||||
[Obsolete("Use IVs[] indexer.")]
|
||||
public byte IV(Stats stat)
|
||||
{
|
||||
byte[] data = new byte[0x3c];
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
return IVs[stat];
|
||||
}
|
||||
|
||||
writer.Write(Species);
|
||||
writer.Write(HeldItem);
|
||||
protected override void Save(BinaryWriter writer)
|
||||
{
|
||||
writer.Write((ushort)SpeciesID);
|
||||
writer.Write((ushort)HeldItemID);
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
writer.Write(Moveset[x]);
|
||||
}
|
||||
writer.Write(OT);
|
||||
writer.Write(TrainerID);
|
||||
writer.Write(Personality);
|
||||
writer.Write(IVs);
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
writer.Write(EVs[x]);
|
||||
}
|
||||
writer.Write(IVs.ToInt32() | (int)IvFlags);
|
||||
writer.Write(EVs.ToArray(), 0, 6);
|
||||
writer.Write(Unknown1);
|
||||
writer.Write((byte)Language);
|
||||
writer.Write(Ability);
|
||||
writer.Write((byte)AbilityID);
|
||||
writer.Write(Happiness);
|
||||
writer.Write(Nickname.RawData, 0, 0x16);
|
||||
writer.Write(NicknameEncoded.RawData, 0, 22);
|
||||
writer.Write(Unknown2); // new to G5
|
||||
|
||||
writer.Flush();
|
||||
ms.Flush();
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, int start)
|
||||
protected override void Load(BinaryReader reader)
|
||||
{
|
||||
if (start + 0x3c > data.Length) throw new ArgumentOutOfRangeException("start");
|
||||
|
||||
Species = BitConverter.ToUInt16(data, 0x00 + start);
|
||||
HeldItem = BitConverter.ToUInt16(data, 0x02 + start);
|
||||
SpeciesID = reader.ReadUInt16();
|
||||
HeldItemID = reader.ReadUInt16();
|
||||
Moveset = new ushort[4];
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
Moveset[x] = BitConverter.ToUInt16(data, 0x04 + x * 2 + start);
|
||||
Moveset[x] = reader.ReadUInt16();
|
||||
}
|
||||
OT = BitConverter.ToUInt32(data, 0x0c + start);
|
||||
Personality = BitConverter.ToUInt32(data, 0x10 + start);
|
||||
IVs = BitConverter.ToUInt32(data, 0x14 + start);
|
||||
TrainerID = reader.ReadUInt32();
|
||||
Personality = reader.ReadUInt32();
|
||||
uint ivs = reader.ReadUInt32();
|
||||
IVs = new IvStatValues((int)ivs & 0x3fffffff);
|
||||
IvFlags = ivs & 0xc0000000u;
|
||||
|
||||
EVs = new byte[6];
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
EVs[x] = data[0x18 + x + start];
|
||||
}
|
||||
Unknown1 = data[0x1e + start];
|
||||
Language = (Languages)data[0x1f + start];
|
||||
Ability = data[0x20 + start];
|
||||
Happiness = data[0x21 + start];
|
||||
Nickname = new EncodedString5(data, 0x22 + start, 0x16);
|
||||
Unknown2 = BitConverter.ToUInt32(data, 0x38);
|
||||
EVs = new ByteStatValues(reader.ReadBytes(6));
|
||||
Unknown1 = reader.ReadByte();
|
||||
Language = (Languages)reader.ReadByte();
|
||||
AbilityID = reader.ReadByte();
|
||||
Happiness = reader.ReadByte();
|
||||
NicknameEncoded = new EncodedString5(reader.ReadBytes(22));
|
||||
Unknown2 = reader.ReadUInt32(); // new to G5
|
||||
}
|
||||
|
||||
public BattleSubwayPokemon5 Clone()
|
||||
{
|
||||
BattleSubwayPokemon5 result = new BattleSubwayPokemon5();
|
||||
result.Species = Species;
|
||||
result.HeldItem = HeldItem;
|
||||
result.Moveset = Moveset.ToArray();
|
||||
result.OT = OT;
|
||||
result.Personality = Personality;
|
||||
result.IVs = IVs;
|
||||
result.EVs = EVs.ToArray();
|
||||
result.Unknown1 = Unknown1;
|
||||
result.Language = Language;
|
||||
result.Ability = Ability;
|
||||
result.Happiness = Happiness;
|
||||
result.Nickname = new EncodedString5(Nickname.RawData.ToArray());
|
||||
result.Unknown2 = Unknown2;
|
||||
uint ivsField = (uint)(IVs.ToInt32() & 0x3fffffffu) | (IvFlags & 0xc0000000u);
|
||||
BattleSubwayPokemon5 result = new BattleSubwayPokemon5(m_pokedex,
|
||||
(ushort)SpeciesID, (ushort)HeldItemID, Moveset.ToArray(),
|
||||
TrainerID, Personality, ivsField, EVs.ToArray(), Unknown1,
|
||||
Language, (byte)AbilityID, Happiness, NicknameEncoded, Unknown2);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override Generations Generation
|
||||
{
|
||||
get
|
||||
{
|
||||
return Generations.Generation5;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,25 @@ namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleSubwayRecord5
|
||||
{
|
||||
public BattleSubwayRecord5()
|
||||
public BattleSubwayRecord5(Pokedex.Pokedex pokedex)
|
||||
{
|
||||
|
||||
Pokedex = pokedex;
|
||||
}
|
||||
|
||||
public BattleSubwayRecord5(byte[] data)
|
||||
public BattleSubwayRecord5(Pokedex.Pokedex pokedex, byte[] data)
|
||||
{
|
||||
Pokedex = pokedex;
|
||||
Load(data, 0);
|
||||
}
|
||||
|
||||
public BattleSubwayRecord5(byte[] data, int start)
|
||||
public BattleSubwayRecord5(Pokedex.Pokedex pokedex, byte[] data, int start)
|
||||
{
|
||||
Pokedex = pokedex;
|
||||
Load(data, start);
|
||||
}
|
||||
|
||||
public Pokedex.Pokedex Pokedex { get; set; }
|
||||
|
||||
public BattleSubwayPokemon5[] Party;
|
||||
public BattleSubwayProfile5 Profile;
|
||||
|
||||
@@ -67,7 +71,7 @@ namespace PkmnFoundations.Structures
|
||||
Party = new BattleSubwayPokemon5[3];
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
Party[x] = new BattleSubwayPokemon5(data, start + x * 0x3c);
|
||||
Party[x] = new BattleSubwayPokemon5(Pokedex, data, start + x * 0x3c);
|
||||
}
|
||||
Profile = new BattleSubwayProfile5(data, 0xb4 + start);
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@ using PkmnFoundations.Support;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleTowerPokemon4
|
||||
public class BattleTowerPokemon4 : BattleTowerPokemonBase
|
||||
{
|
||||
public BattleTowerPokemon4()
|
||||
public BattleTowerPokemon4(Pokedex.Pokedex pokedex) : base(pokedex)
|
||||
{
|
||||
}
|
||||
|
||||
public BattleTowerPokemon4(ushort species, ushort held_item, ushort[] moveset,
|
||||
public BattleTowerPokemon4(Pokedex.Pokedex pokedex, ushort species, ushort held_item, ushort[] moveset,
|
||||
uint ot, uint personality, uint ivs, byte[] evs, byte unknown1,
|
||||
Languages language, byte ability, byte happiness, EncodedString4 nickname)
|
||||
Languages language, byte ability, byte happiness, EncodedString4 nickname) : base(pokedex)
|
||||
{
|
||||
if (moveset == null) throw new ArgumentNullException("moveset");
|
||||
if (moveset.Length != 4) throw new ArgumentException("moveset");
|
||||
@@ -24,142 +24,141 @@ namespace PkmnFoundations.Structures
|
||||
if (nickname == null) throw new ArgumentNullException("nickname");
|
||||
if (nickname.Size != 22) throw new ArgumentException("nickname");
|
||||
|
||||
Species = species;
|
||||
HeldItem = held_item;
|
||||
SpeciesID = species;
|
||||
HeldItemID = held_item;
|
||||
Moveset = moveset.ToArray();
|
||||
OT = ot;
|
||||
TrainerID = ot;
|
||||
Personality = personality;
|
||||
IVs = ivs;
|
||||
EVs = evs.ToArray();
|
||||
IVs = new IvStatValues((int)ivs & 0x3fffffff);
|
||||
IvFlags = ivs & 0xc0000000u;
|
||||
EVs = new ByteStatValues(evs);
|
||||
Unknown1 = unknown1;
|
||||
Language = language;
|
||||
Ability = ability;
|
||||
AbilityID = ability;
|
||||
Happiness = happiness;
|
||||
Nickname = nickname; // todo: clone
|
||||
NicknameEncoded = nickname; // todo: clone
|
||||
}
|
||||
|
||||
public BattleTowerPokemon4(byte[] data)
|
||||
public BattleTowerPokemon4(Pokedex.Pokedex pokedex, BinaryReader data) : base(pokedex)
|
||||
{
|
||||
Load(data, 0);
|
||||
Load(data);
|
||||
}
|
||||
|
||||
public BattleTowerPokemon4(byte[] data, int start)
|
||||
public BattleTowerPokemon4(Pokedex.Pokedex pokedex, byte[] data) : base(pokedex)
|
||||
{
|
||||
Load(data, start);
|
||||
Load(data);
|
||||
}
|
||||
|
||||
public ushort Species;
|
||||
public ushort HeldItem;
|
||||
public ushort[] Moveset;
|
||||
public uint OT;
|
||||
public uint Personality;
|
||||
public uint IVs;
|
||||
public byte[] EVs;
|
||||
public byte Unknown1; // probably a bitmask of applied PP ups
|
||||
public Languages Language;
|
||||
public byte Ability;
|
||||
public byte Happiness;
|
||||
public EncodedString4 Nickname;
|
||||
public BattleTowerPokemon4(Pokedex.Pokedex pokedex, byte[] data, int offset) : base(pokedex)
|
||||
{
|
||||
Load(data, offset);
|
||||
}
|
||||
|
||||
// todo: add IVs class with indexer?
|
||||
// byte myHp = myPokemon.IVs[Stats.HP];
|
||||
public EncodedString4 NicknameEncoded;
|
||||
public override string Nickname
|
||||
{
|
||||
get
|
||||
{
|
||||
return (NicknameEncoded == null) ? null : NicknameEncoded.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
// xxx: This comes straight from Pokemon4. What we logically need here is an inheritance diamond.
|
||||
if (Nickname == value) return;
|
||||
if (NicknameEncoded == null) NicknameEncoded = new EncodedString4(value, 22);
|
||||
else NicknameEncoded.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use IVs[] indexer.")]
|
||||
public byte IV(Stats stat)
|
||||
{
|
||||
return UnpackIV(IVs, stat);
|
||||
return IVs[stat];
|
||||
}
|
||||
|
||||
public byte[] Save()
|
||||
protected override void Save(BinaryWriter writer)
|
||||
{
|
||||
byte[] data = new byte[0x38];
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BinaryWriter writer = new BinaryWriter(ms);
|
||||
|
||||
writer.Write(Species);
|
||||
writer.Write(HeldItem);
|
||||
writer.Write((ushort)SpeciesID);
|
||||
writer.Write((ushort)HeldItemID);
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
writer.Write(Moveset[x]);
|
||||
}
|
||||
writer.Write(OT);
|
||||
writer.Write(TrainerID);
|
||||
writer.Write(Personality);
|
||||
writer.Write(IVs);
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
writer.Write(EVs[x]);
|
||||
}
|
||||
writer.Write(IVs.ToInt32() | (int)IvFlags);
|
||||
writer.Write(EVs.ToArray(), 0, 6);
|
||||
writer.Write(Unknown1);
|
||||
writer.Write((byte)Language);
|
||||
writer.Write(Ability);
|
||||
writer.Write((byte)AbilityID);
|
||||
writer.Write(Happiness);
|
||||
writer.Write(Nickname.RawData, 0, 0x16);
|
||||
writer.Write(NicknameEncoded.RawData, 0, 22);
|
||||
|
||||
writer.Flush();
|
||||
ms.Flush();
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, int start)
|
||||
protected override void Load(BinaryReader reader)
|
||||
{
|
||||
if (start + 0x38 > data.Length) throw new ArgumentOutOfRangeException("start");
|
||||
|
||||
Species = BitConverter.ToUInt16(data, 0x00 + start);
|
||||
HeldItem = BitConverter.ToUInt16(data, 0x02 + start);
|
||||
SpeciesID = reader.ReadUInt16();
|
||||
HeldItemID = reader.ReadUInt16();
|
||||
Moveset = new ushort[4];
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
Moveset[x] = BitConverter.ToUInt16(data, 0x04 + x * 2 + start);
|
||||
Moveset[x] = reader.ReadUInt16();
|
||||
}
|
||||
OT = BitConverter.ToUInt32(data, 0x0c + start);
|
||||
Personality = BitConverter.ToUInt32(data, 0x10 + start);
|
||||
IVs = BitConverter.ToUInt32(data, 0x14 + start);
|
||||
TrainerID = reader.ReadUInt32();
|
||||
Personality = reader.ReadUInt32();
|
||||
uint ivs = reader.ReadUInt32();
|
||||
IVs = new IvStatValues((int)ivs & 0x3fffffff);
|
||||
IvFlags = ivs & 0xc0000000u;
|
||||
|
||||
EVs = new byte[6];
|
||||
for (int x = 0; x < 6; x++)
|
||||
{
|
||||
EVs[x] = data[0x18 + x + start];
|
||||
}
|
||||
Unknown1 = data[0x1e + start];
|
||||
Language = (Languages)data[0x1f + start];
|
||||
Ability = data[0x20 + start];
|
||||
Happiness = data[0x21 + start];
|
||||
Nickname = new EncodedString4(data, 0x22 + start, 0x16);
|
||||
EVs = new ByteStatValues(reader.ReadBytes(6));
|
||||
Unknown1 = reader.ReadByte();
|
||||
Language = (Languages)reader.ReadByte();
|
||||
AbilityID = reader.ReadByte();
|
||||
Happiness = reader.ReadByte();
|
||||
NicknameEncoded = new EncodedString4(reader.ReadBytes(22));
|
||||
}
|
||||
|
||||
public BattleTowerPokemon4 Clone()
|
||||
{
|
||||
BattleTowerPokemon4 result = new BattleTowerPokemon4();
|
||||
result.Species = Species;
|
||||
result.HeldItem = HeldItem;
|
||||
result.Moveset = Moveset.ToArray();
|
||||
result.OT = OT;
|
||||
result.Personality = Personality;
|
||||
result.IVs = IVs;
|
||||
result.EVs = EVs.ToArray();
|
||||
result.Unknown1 = Unknown1;
|
||||
result.Language = Language;
|
||||
result.Ability = Ability;
|
||||
result.Happiness = Happiness;
|
||||
result.Nickname = new EncodedString4(Nickname.RawData.ToArray());
|
||||
uint ivsField = (uint)(IVs.ToInt32() & 0x3fffffffu) | (IvFlags & 0xc0000000u);
|
||||
BattleTowerPokemon4 result = new BattleTowerPokemon4(m_pokedex,
|
||||
(ushort)SpeciesID, (ushort)HeldItemID, Moveset.ToArray(),
|
||||
TrainerID, Personality, ivsField, EVs.ToArray(), Unknown1,
|
||||
Language, (byte)AbilityID, Happiness, NicknameEncoded);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// todo: move me to the actual pokemon class once it's made.
|
||||
public static byte UnpackIV(uint ivs, Stats stat)
|
||||
public override Generations Generation
|
||||
{
|
||||
int shift = (int)stat * 5 - 5;
|
||||
return (byte)(ivs << shift & 0x1f);
|
||||
get
|
||||
{
|
||||
return Generations.Generation4;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return 56;
|
||||
}
|
||||
}
|
||||
|
||||
// todo: move me to the actual pokemon class once it's made.
|
||||
[Obsolete("Use IvStatValues.UnpackIV or IvStatValues indexer, depending on context.")]
|
||||
public static byte UnpackIV(uint ivs, Stats stat)
|
||||
{
|
||||
return IvStatValues.UnpackIV(ivs, stat);
|
||||
}
|
||||
|
||||
[Obsolete("Use IvStatValues.PackIVs")]
|
||||
// todo: Move to IVs class
|
||||
public static uint PackIVs(byte HP, byte Attack, byte Defense, byte Speed, byte SpAttack, byte SpDefense)
|
||||
{
|
||||
return (uint)((HP & 31) |
|
||||
((Attack & 31) << 5) |
|
||||
((Defense & 31) << 10) |
|
||||
((Speed & 31) << 15) |
|
||||
((SpAttack & 31) << 20) |
|
||||
((SpDefense & 31) << 25));
|
||||
return IvStatValues.PackIVs(HP, Attack, Defense, Speed, SpAttack, SpDefense);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
library/Structures/BattleTowerPokemonBase.cs
Normal file
39
library/Structures/BattleTowerPokemonBase.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PkmnFoundations.Pokedex;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
namespace PkmnFoundations.Structures
|
||||
{
|
||||
public abstract class BattleTowerPokemonBase : PokemonBase
|
||||
{
|
||||
public BattleTowerPokemonBase(Pokedex.Pokedex pokedex) : base(pokedex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ushort[] Moveset;
|
||||
public byte Unknown1; // probably a bitmask of applied PP ups
|
||||
// In the main PKM structure, the remaining 2 bits on the IVs field
|
||||
// represents whether it's nicknamed and if it's an egg. Clearly, eggs
|
||||
// shouldn't be brought into Battle Tower.
|
||||
public uint IvFlags;
|
||||
|
||||
public override byte Level
|
||||
{
|
||||
get
|
||||
{
|
||||
// todo: fact check that everything's lv50?
|
||||
return 50;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,21 +9,25 @@ namespace PkmnFoundations.Structures
|
||||
{
|
||||
public class BattleTowerRecord4
|
||||
{
|
||||
public BattleTowerRecord4()
|
||||
public BattleTowerRecord4(Pokedex.Pokedex pokedex)
|
||||
{
|
||||
|
||||
Pokedex = pokedex;
|
||||
}
|
||||
|
||||
public BattleTowerRecord4(byte[] data)
|
||||
public BattleTowerRecord4(Pokedex.Pokedex pokedex, byte[] data)
|
||||
{
|
||||
Pokedex = pokedex;
|
||||
Load(data, 0);
|
||||
}
|
||||
|
||||
public BattleTowerRecord4(byte[] data, int start)
|
||||
public BattleTowerRecord4(Pokedex.Pokedex pokedex, byte[] data, int start)
|
||||
{
|
||||
Pokedex = pokedex;
|
||||
Load(data, start);
|
||||
}
|
||||
|
||||
public Pokedex.Pokedex Pokedex { get; set; }
|
||||
|
||||
public BattleTowerPokemon4[] Party;
|
||||
public BattleTowerProfile4 Profile;
|
||||
|
||||
@@ -66,7 +70,7 @@ namespace PkmnFoundations.Structures
|
||||
Party = new BattleTowerPokemon4[3];
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
Party[x] = new BattleTowerPokemon4(data, start + x * 0x38);
|
||||
Party[x] = new BattleTowerPokemon4(Pokedex, data, start + x * 0x38);
|
||||
}
|
||||
Profile = new BattleTowerProfile4(data, 0xa8 + start);
|
||||
|
||||
|
||||
@@ -54,6 +54,22 @@ namespace PkmnFoundations.Structures
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte UnpackIV(uint ivs, Stats stat)
|
||||
{
|
||||
int shift = (int)stat * 5 - 5;
|
||||
return (byte)(ivs << shift & 0x1f);
|
||||
}
|
||||
|
||||
public static uint PackIVs(byte HP, byte Attack, byte Defense, byte Speed, byte SpAttack, byte SpDefense)
|
||||
{
|
||||
return (uint)((HP & 31) |
|
||||
((Attack & 31) << 5) |
|
||||
((Defense & 31) << 10) |
|
||||
((Speed & 31) << 15) |
|
||||
((SpAttack & 31) << 20) |
|
||||
((SpDefense & 31) << 25));
|
||||
}
|
||||
|
||||
public JudgeSummary JudgeSummary
|
||||
{
|
||||
get
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using PkmnFoundations.Data;
|
||||
using PkmnFoundations.Pokedex;
|
||||
using PkmnFoundations.Structures;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
@@ -34,6 +35,8 @@ namespace towerRestorer
|
||||
int leaderSuccessCount = 0;
|
||||
int leaderFailureCount = 0;
|
||||
|
||||
Pokedex pokedex = new Pokedex(db, false);
|
||||
|
||||
foreach (String s in filenames)
|
||||
{
|
||||
String filename = s;
|
||||
@@ -95,7 +98,7 @@ namespace towerRestorer
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(data, 0xe4 * x);
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(pokedex, data, 0xe4 * x);
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
@@ -115,7 +118,7 @@ namespace towerRestorer
|
||||
try
|
||||
{
|
||||
BattleTowerProfile4 profile = new BattleTowerProfile4(data, 0x63c + 0x22 * x);
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4();
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(pokedex);
|
||||
record.Profile = profile;
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
@@ -152,7 +155,7 @@ namespace towerRestorer
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5(data, 0xf0 * x);
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5(pokedex, data, 0xf0 * x);
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
@@ -173,7 +176,7 @@ namespace towerRestorer
|
||||
try
|
||||
{
|
||||
BattleSubwayProfile5 profile = new BattleSubwayProfile5(data, 0x690 + 0x22 * x);
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5();
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5(pokedex);
|
||||
record.Profile = profile;
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Web.UI.WebControls;
|
||||
using PkmnFoundations.Data;
|
||||
using PkmnFoundations.Structures;
|
||||
using PkmnFoundations.Support;
|
||||
using PkmnFoundations.Web;
|
||||
|
||||
namespace PkmnFoundations.GTS
|
||||
{
|
||||
@@ -42,11 +43,13 @@ namespace PkmnFoundations.GTS
|
||||
rank--;
|
||||
room--;
|
||||
|
||||
Pokedex.Pokedex pokedex = AppStateHelper.Pokedex(Context.Application);
|
||||
|
||||
switch (rbGeneration.SelectedValue)
|
||||
{
|
||||
case "4":
|
||||
{
|
||||
BattleTowerProfile4[] results = Database.Instance.BattleTowerGetLeaders4(rank, room);
|
||||
BattleTowerProfile4[] results = Database.Instance.BattleTowerGetLeaders4(pokedex, rank, room);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@@ -60,7 +63,7 @@ namespace PkmnFoundations.GTS
|
||||
}
|
||||
builder.Append("</ul><p>Opponents:</p><ul>");
|
||||
|
||||
BattleTowerRecord4[] opponents = Database.Instance.BattleTowerGetOpponents4(-1, rank, room);
|
||||
BattleTowerRecord4[] opponents = Database.Instance.BattleTowerGetOpponents4(pokedex, -1, rank, room);
|
||||
foreach (BattleTowerRecord4 record in opponents)
|
||||
{
|
||||
builder.Append("<li>");
|
||||
@@ -79,7 +82,7 @@ namespace PkmnFoundations.GTS
|
||||
} break;
|
||||
case "5":
|
||||
{
|
||||
BattleSubwayProfile5[] results = Database.Instance.BattleSubwayGetLeaders5(rank, room);
|
||||
BattleSubwayProfile5[] results = Database.Instance.BattleSubwayGetLeaders5(pokedex, rank, room);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@@ -93,7 +96,7 @@ namespace PkmnFoundations.GTS
|
||||
}
|
||||
builder.Append("</ul><p>Opponents:</p><ul>");
|
||||
|
||||
BattleSubwayRecord5[] opponents = Database.Instance.BattleSubwayGetOpponents5(-1, rank, room);
|
||||
BattleSubwayRecord5[] opponents = Database.Instance.BattleSubwayGetOpponents5(pokedex, -1, rank, room);
|
||||
foreach (BattleSubwayRecord5 record in opponents)
|
||||
{
|
||||
builder.Append("<li>");
|
||||
|
||||
Reference in New Issue
Block a user