Adds BufferReader and BufferWriter. Updates UOP handling. (#101)
This commit is contained in:
parent
2c0d97cd36
commit
038c3be258
98 changed files with 2458 additions and 2185 deletions
|
|
@ -183,116 +183,7 @@ namespace Server
|
|||
{
|
||||
string filePath = Core.FindDataFile("tiledata.mul");
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
BinaryReader bin = new BinaryReader(fs);
|
||||
|
||||
if (fs.Length == 3188736)
|
||||
{
|
||||
// 7.0.9.0
|
||||
LandTable = new LandData[0x4000];
|
||||
|
||||
for (int i = 0; i < 0x4000; ++i)
|
||||
{
|
||||
if (i == 1 || i > 0 && (i & 0x1F) == 0) bin.ReadInt32(); // header
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt64();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
|
||||
LandTable[i] = new LandData(ReadNameString(bin), flags);
|
||||
}
|
||||
|
||||
ItemTable = new ItemData[0x10000];
|
||||
|
||||
for (int i = 0; i < 0x10000; ++i)
|
||||
{
|
||||
if ((i & 0x1F) == 0) bin.ReadInt32(); // header
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt64();
|
||||
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();
|
||||
|
||||
ItemTable[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value,
|
||||
height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LandTable = new LandData[0x4000];
|
||||
|
||||
for (int i = 0; i < 0x4000; ++i)
|
||||
{
|
||||
if ((i & 0x1F) == 0) bin.ReadInt32(); // header
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
|
||||
LandTable[i] = new LandData(ReadNameString(bin), flags);
|
||||
}
|
||||
|
||||
if (fs.Length == 1644544)
|
||||
{
|
||||
// 7.0.0.0
|
||||
ItemTable = new ItemData[0x8000];
|
||||
|
||||
for (int i = 0; i < 0x8000; ++i)
|
||||
{
|
||||
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();
|
||||
|
||||
ItemTable[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value,
|
||||
height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemTable = new ItemData[0x4000];
|
||||
|
||||
for (int i = 0; i < 0x4000; ++i)
|
||||
{
|
||||
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();
|
||||
|
||||
ItemTable[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value,
|
||||
height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MaxLandValue = LandTable.Length - 1;
|
||||
MaxItemValue = ItemTable.Length - 1;
|
||||
}
|
||||
else
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("tiledata.mul was not found");
|
||||
|
|
@ -302,6 +193,111 @@ namespace Server
|
|||
|
||||
throw new Exception($"TileData: {filePath} not found");
|
||||
}
|
||||
|
||||
using FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
BinaryReader bin = new BinaryReader(fs);
|
||||
|
||||
if (fs.Length == 3188736)
|
||||
{
|
||||
// 7.0.9.0
|
||||
LandTable = new LandData[0x4000];
|
||||
|
||||
for (int i = 0; i < 0x4000; ++i)
|
||||
{
|
||||
if (i == 1 || i > 0 && (i & 0x1F) == 0) bin.ReadInt32(); // header
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt64();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
|
||||
LandTable[i] = new LandData(ReadNameString(bin), flags);
|
||||
}
|
||||
|
||||
ItemTable = new ItemData[0x10000];
|
||||
|
||||
for (int i = 0; i < 0x10000; ++i)
|
||||
{
|
||||
if ((i & 0x1F) == 0) bin.ReadInt32(); // header
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt64();
|
||||
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();
|
||||
|
||||
ItemTable[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value,
|
||||
height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LandTable = new LandData[0x4000];
|
||||
|
||||
for (int i = 0; i < 0x4000; ++i)
|
||||
{
|
||||
if ((i & 0x1F) == 0) bin.ReadInt32(); // header
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
|
||||
LandTable[i] = new LandData(ReadNameString(bin), flags);
|
||||
}
|
||||
|
||||
if (fs.Length == 1644544)
|
||||
{
|
||||
// 7.0.0.0
|
||||
ItemTable = new ItemData[0x8000];
|
||||
|
||||
for (int i = 0; i < 0x8000; ++i)
|
||||
{
|
||||
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();
|
||||
|
||||
ItemTable[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value,
|
||||
height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemTable = new ItemData[0x4000];
|
||||
|
||||
for (int i = 0; i < 0x4000; ++i)
|
||||
{
|
||||
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();
|
||||
|
||||
ItemTable[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value,
|
||||
height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MaxLandValue = LandTable.Length - 1;
|
||||
MaxItemValue = ItemTable.Length - 1;
|
||||
}
|
||||
|
||||
public static LandData[] LandTable{ get; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue