try to autodetect tiledata format
This commit is contained in:
parent
6441f12907
commit
27abe81af0
2 changed files with 46 additions and 29 deletions
|
|
@ -39,7 +39,6 @@ namespace Server.Misc
|
|||
|
||||
TileMatrixPatch.Enabled = false; // OSI Client Patch 6.0.0.0
|
||||
|
||||
TileData.PostHSFormat = true; // OSI Client Patch 7.0.9.0
|
||||
MultiData.PostHSFormat = true; // OSI Client Patch 7.0.9.0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ namespace Server
|
|||
}
|
||||
|
||||
[Flags]
|
||||
public enum TileFlag
|
||||
public enum TileFlag : long
|
||||
{
|
||||
None = 0x00000000,
|
||||
Background = 0x00000001,
|
||||
|
|
@ -170,7 +170,7 @@ namespace Server
|
|||
Wall = 0x00000010,
|
||||
Damaging = 0x00000020,
|
||||
Impassable = 0x00000040,
|
||||
Wet = 0x00000080,
|
||||
Wet = 0x00000080,
|
||||
Unknown1 = 0x00000100,
|
||||
Surface = 0x00000200,
|
||||
Bridge = 0x00000400,
|
||||
|
|
@ -183,7 +183,7 @@ namespace Server
|
|||
Foliage = 0x00020000,
|
||||
PartialHue = 0x00040000,
|
||||
Unknown2 = 0x00080000,
|
||||
Map = 0x00100000,
|
||||
Map = 0x00100000,
|
||||
Container = 0x00200000,
|
||||
Wearable = 0x00400000,
|
||||
LightSource = 0x00800000,
|
||||
|
|
@ -194,18 +194,11 @@ namespace Server
|
|||
Roof = 0x10000000,
|
||||
Door = 0x20000000,
|
||||
StairBack = 0x40000000,
|
||||
StairRight = unchecked( (int)0x80000000 )
|
||||
StairRight = 0x80000000
|
||||
}
|
||||
|
||||
public class TileData
|
||||
{
|
||||
public static bool PostHSFormat {
|
||||
get { return _PostHSFormat; }
|
||||
set { _PostHSFormat = value; }
|
||||
}
|
||||
|
||||
private static bool _PostHSFormat = false;
|
||||
|
||||
private static LandData[] m_LandData;
|
||||
private static ItemData[] m_ItemData;
|
||||
|
||||
|
|
@ -248,7 +241,7 @@ namespace Server
|
|||
{
|
||||
BinaryReader bin = new BinaryReader( fs );
|
||||
|
||||
if ( _PostHSFormat ) {
|
||||
if ( fs.Length == 3188736 ) { // 7.0.9.0
|
||||
m_LandData = new LandData[0x4000];
|
||||
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
|
|
@ -302,27 +295,52 @@ namespace Server
|
|||
m_LandData[i] = new LandData( ReadNameString( bin ), flags );
|
||||
}
|
||||
|
||||
m_ItemData = new ItemData[0x4000];
|
||||
if ( fs.Length == 1644544 ) { // 7.0.0.0
|
||||
m_ItemData = new ItemData[0x8000];
|
||||
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
if ( (i & 0x1F) == 0 )
|
||||
for ( int i = 0; i < 0x8000; ++i )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
if ( (i & 0x1F) == 0 )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
int weight = bin.ReadByte();
|
||||
int quality = bin.ReadByte();
|
||||
bin.ReadInt16();
|
||||
bin.ReadByte();
|
||||
int quantity = bin.ReadByte();
|
||||
bin.ReadInt32();
|
||||
bin.ReadByte();
|
||||
int value = bin.ReadByte();
|
||||
int height = bin.ReadByte();
|
||||
|
||||
m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height );
|
||||
}
|
||||
} else {
|
||||
m_ItemData = new ItemData[0x4000];
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
int weight = bin.ReadByte();
|
||||
int quality = bin.ReadByte();
|
||||
bin.ReadInt16();
|
||||
bin.ReadByte();
|
||||
int quantity = bin.ReadByte();
|
||||
bin.ReadInt32();
|
||||
bin.ReadByte();
|
||||
int value = bin.ReadByte();
|
||||
int height = bin.ReadByte();
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
if ( (i & 0x1F) == 0 )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
}
|
||||
|
||||
m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height );
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
int weight = bin.ReadByte();
|
||||
int quality = bin.ReadByte();
|
||||
bin.ReadInt16();
|
||||
bin.ReadByte();
|
||||
int quantity = bin.ReadByte();
|
||||
bin.ReadInt32();
|
||||
bin.ReadByte();
|
||||
int value = bin.ReadByte();
|
||||
int height = bin.ReadByte();
|
||||
|
||||
m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue