mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-09-30 21:26:43 -05:00
Gave GenV capabilities to Tower Restorer project.
This commit is contained in:
@@ -23,7 +23,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bvRestorer4", "bvRestorer4\
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bvRestorer5", "bvRestorer5\bvRestorer5.csproj", "{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "towerRestorer4", "towerRestorer4\towerRestorer4.csproj", "{750A0BFD-7258-4B32-A4F9-60EEEB0BA64A}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "towerRestorer", "towerRestorer4\towerRestorer.csproj", "{750A0BFD-7258-4B32-A4F9-60EEEB0BA64A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -8,7 +8,7 @@ using PkmnFoundations.Data;
|
||||
using PkmnFoundations.Structures;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
namespace towerRestorer4
|
||||
namespace towerRestorer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace towerRestorer4
|
||||
Console.WriteLine("Attempts to insert files in <path>");
|
||||
Console.WriteLine("into the database in app configuration.");
|
||||
Console.WriteLine("Only inserts files whose names match the naming pattern:");
|
||||
Console.WriteLine("g4_pid*_rank*_room*");
|
||||
Console.WriteLine("g*_pid*_rank*_room*");
|
||||
Console.WriteLine("Rank and room number are taken from the filename.");
|
||||
return;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace towerRestorer4
|
||||
byte rank, room;
|
||||
|
||||
if (split.Length != 4 ||
|
||||
split[0] != "g4" ||
|
||||
(split[0] != "g4" && split[0] != "g5") ||
|
||||
split[2].Substring(0, 4) != "rank" ||
|
||||
!Byte.TryParse(split[2].Substring(4), out rank) ||
|
||||
split[3].Substring(0, 4) != "room" ||
|
||||
@@ -68,62 +68,129 @@ namespace towerRestorer4
|
||||
continue;
|
||||
}
|
||||
|
||||
int gen = Convert.ToInt32(split[0].Substring(1));
|
||||
|
||||
rank--;
|
||||
room--;
|
||||
|
||||
FileStream fs = File.OpenRead(s);
|
||||
if (fs.Length != 0xa38)
|
||||
switch (gen)
|
||||
{
|
||||
Console.WriteLine("{0}: file size is wrong, skipped.", filename);
|
||||
failureCount++;
|
||||
continue;
|
||||
case 4:
|
||||
{
|
||||
continue;
|
||||
FileStream fs = File.OpenRead(s);
|
||||
if (fs.Length != 0xa38)
|
||||
{
|
||||
Console.WriteLine("{0}: file size is wrong, skipped.", filename);
|
||||
failureCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
byte[] data = new byte[0xa38];
|
||||
fs.ReadBlock(data, 0, 0xa38);
|
||||
fs.Close();
|
||||
|
||||
// battletower/download.asp response: 2616 bytes
|
||||
// 00-63b: BattleTowerRecord objects x7
|
||||
// 63c-a37: BattleTowerTrainerProfile objects x30
|
||||
for (int x = 0; x < 7; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(data, 0xe4 * x);
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
record.BattlesWon = 7;
|
||||
db.BattleTowerUpdateRecord4(record);
|
||||
opponentSuccessCount++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
opponentFailureCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < 30; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleTowerProfile4 profile = new BattleTowerProfile4(data, 0x63c + 0x22 * x);
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4();
|
||||
record.Profile = profile;
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
db.BattleTowerAddLeader4(record);
|
||||
leaderSuccessCount++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
leaderFailureCount++;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case 5:
|
||||
{
|
||||
FileStream fs = File.OpenRead(s);
|
||||
if (fs.Length != 0xab4)
|
||||
{
|
||||
Console.WriteLine("{0}: file size is wrong, skipped.", filename);
|
||||
failureCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
byte[] data = new byte[0xab4];
|
||||
fs.ReadBlock(data, 0, 0xab4);
|
||||
fs.Close();
|
||||
|
||||
//web/battletower/download.asp response: 2700 bytes
|
||||
//00-68f: BattleSubwayRecord objects x7
|
||||
//690-a8b: BattleSubwayTrainerProfile objects x30
|
||||
for (int x = 0; x < 7; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5(data, 0xf0 * x);
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
record.BattlesWon = 7;
|
||||
db.BattleSubwayUpdateRecord5(record);
|
||||
opponentSuccessCount++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
opponentFailureCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < 30; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleSubwayProfile5 profile = new BattleSubwayProfile5(data, 0x690 + 0x22 * x);
|
||||
BattleSubwayRecord5 record = new BattleSubwayRecord5();
|
||||
record.Profile = profile;
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
db.BattleSubwayAddLeader5(record);
|
||||
leaderSuccessCount++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
leaderFailureCount++;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
byte[] data = new byte[0xa38];
|
||||
fs.ReadBlock(data, 0, 0xa38);
|
||||
fs.Close();
|
||||
|
||||
// battletower/download.asp response: 2616 bytes
|
||||
// 00-63b: BattleTowerRecord objects x7
|
||||
// 63c-a37: BattleTowerTrainerProfile objects x30
|
||||
for (int x = 0; x < 7; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4(data, 0xe4 * x);
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
record.BattlesWon = 7;
|
||||
db.BattleTowerUpdateRecord4(record);
|
||||
opponentSuccessCount++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
opponentFailureCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < 30; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
BattleTowerProfile4 profile = new BattleTowerProfile4(data, 0x63c + 0x22 * x);
|
||||
BattleTowerRecord4 record = new BattleTowerRecord4();
|
||||
record.Profile = profile;
|
||||
record.PID = 0;
|
||||
record.Rank = rank;
|
||||
record.RoomNum = room;
|
||||
db.BattleTowerAddLeader4(record);
|
||||
leaderSuccessCount++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
leaderFailureCount++;
|
||||
}
|
||||
}
|
||||
Console.WriteLine("{0} complete", s);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{750A0BFD-7258-4B32-A4F9-60EEEB0BA64A}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>towerRestorer4</RootNamespace>
|
||||
<AssemblyName>towerRestorer4</AssemblyName>
|
||||
<RootNamespace>towerRestorer</RootNamespace>
|
||||
<AssemblyName>towerRestorer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
Reference in New Issue
Block a user