2013-03-16 19:56:09 +00:00

79 lines
2.3 KiB
C#

using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using EQExtractor2.InternalTypes;
using EQExtractor2.OpCodes;
using EQPacket;
using MyUtils;
namespace EQExtractor2.Patches
{
class PatchMarch132013Decoder : PatchFebruary112013Decoder
{
public PatchMarch132013Decoder()
{
Version = "EQ Client Build Date March 13 2013.";
PatchConfFileName = "patch_Mar13-2013.conf";
SupportsSQLGeneration = false;
}
override public List<Door> GetDoors()
{
List<Door> DoorList = new List<Door>();
List<byte[]> SpawnDoorPacket = GetPacketsOfType("OP_SpawnDoor", PacketDirection.ServerToClient);
if ((SpawnDoorPacket.Count == 0) || (SpawnDoorPacket[0].Length == 0))
return DoorList;
int DoorCount = SpawnDoorPacket[0].Length / 100;
ByteStream Buffer = new ByteStream(SpawnDoorPacket[0]);
for (int d = 0; d < DoorCount; ++d)
{
string DoorName = Buffer.ReadFixedLengthString(32, false);
float YPos = Buffer.ReadSingle();
float XPos = Buffer.ReadSingle();
float ZPos = Buffer.ReadSingle();
float Heading = Buffer.ReadSingle();
UInt32 Incline = Buffer.ReadUInt32();
Int32 Size = Buffer.ReadInt32();
Buffer.SkipBytes(4); // Skip Unknown
Byte DoorID = Buffer.ReadByte();
Byte OpenType = Buffer.ReadByte();
Byte StateAtSpawn = Buffer.ReadByte();
Byte InvertState = Buffer.ReadByte();
Int32 DoorParam = Buffer.ReadInt32();
// Skip past the trailing unknowns in the door struct, moving to the next door in the packet.
Buffer.SkipBytes(32);
string DestZone = "NONE";
Door NewDoor = new Door(DoorName, YPos, XPos, ZPos, Heading, Incline, Size, DoorID, OpenType, StateAtSpawn, InvertState,
DoorParam, DestZone, 0, 0, 0, 0);
DoorList.Add(NewDoor);
}
return DoorList;
}
}
}