Skip to content

Commit 65fc5ab

Browse files
authored
Extract item, monster, and npc data from recordings (jo3bingham#12)
* Add CreatureStorage class * Add new extraction methods to Extract app * Remove unused imports * Add connection state to proxy * Remove Track app * Set correct connection stage when resetting connection * Rename proxy to connection to match class * Add minimap marker type to CyclopediaMapData * Add support for parsing the client Login packet * Add new unknown state and value to DepotTileState packet * Use more C# features in CreatureStorage class * Move ignore/replace items xml to a content folder * Check that an extraction option was provided * Fix parsing of "bad", old recordings * Move size check after reading size
1 parent a32b4a9 commit 65fc5ab

35 files changed

Lines changed: 814 additions & 308 deletions

Apps/Extract/Extract.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<ItemGroup>
1313
<None Include="$(SolutionDir)ClientData\**" CopyToOutputDirectory="PreserveNewest" LinkBase="ClientData\" />
14-
<None Include="$(SolutionDir)ItemsReplace.xml" CopyToOutputDirectory="PreserveNewest" />
15-
<None Include="$(SolutionDir)ItemsIgnore.xml" CopyToOutputDirectory="PreserveNewest" />
14+
<None Include="$(SolutionDir)Content\ItemsReplace.xml" CopyToOutputDirectory="PreserveNewest" />
15+
<None Include="$(SolutionDir)Content\ItemsIgnore.xml" CopyToOutputDirectory="PreserveNewest" />
1616
</ItemGroup>
1717
</Project>

Apps/Extract/Program.cs

Lines changed: 292 additions & 92 deletions
Large diffs are not rendered by default.

Apps/Record/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ static void Main(string[] args)
7676
_binaryWriter = new BinaryWriter(File.OpenWrite(Path.Combine(recordingDirectory, filename)));
7777
_binaryWriter.Write(client.Version);
7878

79-
client.Proxy.OnReceivedClientMessage += Proxy_OnReceivedClientMessage;
80-
client.Proxy.OnReceivedServerMessage += Proxy_OnReceivedServerMessage;
79+
client.Connection.OnReceivedClientMessage += Proxy_OnReceivedClientMessage;
80+
client.Connection.OnReceivedServerMessage += Proxy_OnReceivedServerMessage;
8181

8282
// Disable packet parsing as we only care about the raw, decrypted packets and speed.
83-
client.StartProxy(enablePacketParsing: false, httpPort: _httpPort);
83+
client.StartConnection(enablePacketParsing: false, httpPort: _httpPort);
8484

8585
while (Console.ReadLine() != "quit")
8686
{
8787
}
8888

89-
client.StopProxy();
89+
client.StopConnection();
9090

91-
client.Proxy.OnReceivedClientMessage -= Proxy_OnReceivedClientMessage;
92-
client.Proxy.OnReceivedServerMessage -= Proxy_OnReceivedServerMessage;
91+
client.Connection.OnReceivedClientMessage -= Proxy_OnReceivedClientMessage;
92+
client.Connection.OnReceivedServerMessage -= Proxy_OnReceivedServerMessage;
9393

9494
// Give the proxy time to quit, and any pending packets to be consumed.
9595
System.Threading.Thread.Sleep(1000);

Apps/Track/Program.cs

Lines changed: 0 additions & 76 deletions
This file was deleted.

Apps/Track/Track.csproj

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
<item fromid="21849" toid="21848" fromname="glooth data machine (inactive)" toname="glooth data machine (active)" />
144144
<item fromid="21854" toid="21851" fromname="dinky moss floret stalks (vertical)" toname="dinky moss floret (vertical)" />
145145
<item fromid="21855" toid="21852" fromname="dinky moss floret stalks (horizontal)" toname="dinky moss floret (horizontal)" />
146-
<item fromid="21855" toid="21852" fromname="dinky moss floret stalks" toname="dinky moss floret" />
147146
<item fromid="21878" toid="21832" fromname="spider (no silk)" toname="spider (silk)" />
148147
<item fromid="21934" toid="10797" fromname="black crystal shards" toname="large black crystal" />
149148
<item fromid="21935" toid="21388" fromname="grass" toname="lion's mane flower" />

TibiaAPI.sln

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.28010.2003
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TibiaAPI", "TibiaAPI\TibiaAPI.csproj", "{FEDE2A7B-8203-443E-9CF7-97A562AABB92}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TibiaAPI", "TibiaAPI\TibiaAPI.csproj", "{FEDE2A7B-8203-443E-9CF7-97A562AABB92}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{C086BFA7-CE77-4DDF-9474-C65709DBA8A8}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Track", "Apps\Track\Track.csproj", "{CFE7894A-D5A4-4C16-B2B4-51915BE0D4F6}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extract", "Apps\Extract\Extract.csproj", "{EE3A6146-B1A6-44F0-9C5D-CBD5D44CEF83}"
1111
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extract", "Apps\Extract\Extract.csproj", "{EE3A6146-B1A6-44F0-9C5D-CBD5D44CEF83}"
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Record", "Apps\Record\Record.csproj", "{75DB22C7-8FE1-4BF6-8778-AE67B236DFED}"
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Record", "Apps\Record\Record.csproj", "{75DB22C7-8FE1-4BF6-8778-AE67B236DFED}"
15-
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Watch", "Apps\Watch\Watch.csproj", "{D9E8B07D-C3D8-431D-8E1C-B52EE2AF49C9}"
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Watch", "Apps\Watch\Watch.csproj", "{D9E8B07D-C3D8-431D-8E1C-B52EE2AF49C9}"
1715
EndProject
1816
Global
1917
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,10 +23,6 @@ Global
2523
{FEDE2A7B-8203-443E-9CF7-97A562AABB92}.Debug|Any CPU.Build.0 = Debug|Any CPU
2624
{FEDE2A7B-8203-443E-9CF7-97A562AABB92}.Release|Any CPU.ActiveCfg = Release|Any CPU
2725
{FEDE2A7B-8203-443E-9CF7-97A562AABB92}.Release|Any CPU.Build.0 = Release|Any CPU
28-
{CFE7894A-D5A4-4C16-B2B4-51915BE0D4F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29-
{CFE7894A-D5A4-4C16-B2B4-51915BE0D4F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
30-
{CFE7894A-D5A4-4C16-B2B4-51915BE0D4F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
31-
{CFE7894A-D5A4-4C16-B2B4-51915BE0D4F6}.Release|Any CPU.Build.0 = Release|Any CPU
3226
{EE3A6146-B1A6-44F0-9C5D-CBD5D44CEF83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3327
{EE3A6146-B1A6-44F0-9C5D-CBD5D44CEF83}.Debug|Any CPU.Build.0 = Debug|Any CPU
3428
{EE3A6146-B1A6-44F0-9C5D-CBD5D44CEF83}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -46,7 +40,6 @@ Global
4640
HideSolutionNode = FALSE
4741
EndGlobalSection
4842
GlobalSection(NestedProjects) = preSolution
49-
{CFE7894A-D5A4-4C16-B2B4-51915BE0D4F6} = {C086BFA7-CE77-4DDF-9474-C65709DBA8A8}
5043
{EE3A6146-B1A6-44F0-9C5D-CBD5D44CEF83} = {C086BFA7-CE77-4DDF-9474-C65709DBA8A8}
5144
{75DB22C7-8FE1-4BF6-8778-AE67B236DFED} = {C086BFA7-CE77-4DDF-9474-C65709DBA8A8}
5245
{D9E8B07D-C3D8-431D-8E1C-B52EE2AF49C9} = {C086BFA7-CE77-4DDF-9474-C65709DBA8A8}

TibiaAPI/Appearances/AppearanceStorage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public OutfitInstance CreateOutfitInstance(uint id, byte colorHead, byte colorTo
3939

4040
public Utilities.Appearance GetObjectType(uint id)
4141
{
42-
if (id >= (uint)CreatureInstanceType.Creature && id <= lastObjectId)
42+
if (id > (uint)CreatureInstanceType.Creature && id <= lastObjectId)
4343
{
4444
return appearances.Object.FirstOrDefault(o => o.Id == id);
4545
}
@@ -48,7 +48,7 @@ public Utilities.Appearance GetObjectType(uint id)
4848

4949
public Utilities.Appearance GetOutfitType(uint id)
5050
{
51-
if (id >= 1 && id <= lastOutfitId)
51+
if (id > 0 && id <= lastOutfitId)
5252
{
5353
appearances.Outfit.FirstOrDefault(i => i.Id == id);
5454
}

TibiaAPI/Appearances/ObjectInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace OXGaming.TibiaAPI.Appearances
55
public class ObjectInstance : AppearanceInstance
66
{
77
public uint Data { get; set; }
8-
public uint LootContainerUnknown { get; set; }
8+
public uint LootCategoryFlags { get; set; }
99

1010
public bool IsLootContainer { get; set; } = false;
1111

0 commit comments

Comments
 (0)