Got aetheryte map and completed quest work values... working.

This commit is contained in:
Filip Maj 2022-02-19 01:17:50 -05:00
parent a2c4d077e9
commit 306f4ef346
11 changed files with 546 additions and 382 deletions

View file

@ -26,7 +26,7 @@ using System.Text;
namespace Meteor.Map.packets.receive
{
class ParameterDataRequestPacket
class WorkSyncRequestPacket
{
public const ushort OPCODE = 0x012F;
public const uint PACKET_SIZE = 0x48;
@ -34,9 +34,11 @@ namespace Meteor.Map.packets.receive
public bool invalidPacket = false;
public uint actorID;
public string paramName;
public string propertyName;
public ushort from, to;
public bool requestingBitfield = false;
public ParameterDataRequestPacket(byte[] data)
public WorkSyncRequestPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
@ -44,13 +46,22 @@ namespace Meteor.Map.packets.receive
{
try{
actorID = binReader.ReadUInt32();
List<byte> strList = new List<byte>();
byte curByte;
while ((curByte = binReader.ReadByte()) != 0 && strList.Count<=0x20)
if (binReader.PeekChar() == 9)
{
strList.Add(curByte);
binReader.ReadByte();
from = binReader.ReadUInt16();
to = binReader.ReadUInt16();
}
paramName = Encoding.ASCII.GetString(strList.ToArray());
byte currentByte;
int size = 0;
long strPos = binReader.BaseStream.Position;
while ((currentByte = binReader.ReadByte()) != 0 && size <= 0x20)
size++;
binReader.BaseStream.Seek(strPos, SeekOrigin.Begin);
byte[] str = binReader.ReadBytes(size);
propertyName = Encoding.ASCII.GetString(str);
}
catch (Exception){
invalidPacket = true;

View file

@ -44,6 +44,10 @@ namespace Meteor.Map.packets.send.actor
string currentTarget;
bool isBitfield = false;
ushort from;
ushort to;
private MemoryStream mem;
private BinaryWriter binWriter;
@ -54,6 +58,16 @@ namespace Meteor.Map.packets.send.actor
binWriter.Seek(1, SeekOrigin.Begin);
currentTarget = startingTarget;
}
public SetActorPropetyPacket(ushort from, ushort to, string startingTarget)
{
mem = new MemoryStream(data);
binWriter = new BinaryWriter(mem);
binWriter.Seek(1, SeekOrigin.Begin);
currentTarget = startingTarget;
this.from = from;
this.to = to;
isBitfield = true;
}
public void CloseStreams()
{
@ -100,6 +114,19 @@ namespace Meteor.Map.packets.send.actor
return true;
}
public bool AddBitfield(uint id, byte[] data)
{
if (runningByteTotal + 5 + data.Length + 1 + (1 + 5 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
return false;
binWriter.Write((byte) (data.Length));
binWriter.Write((UInt32)id);
binWriter.Write(data);
runningByteTotal += (ushort)(5 + data.Length);
return true;
}
public bool AddBuffer(uint id, byte[] buffer)
{
if (runningByteTotal + 5 + buffer.Length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
@ -208,10 +235,22 @@ namespace Meteor.Map.packets.send.actor
public void SetTarget(string target)
{
currentTarget = target;
isBitfield = false;
}
public void AddTarget()
{
if (isBitfield)
{
binWriter.Write((byte)(isMore ? 0x60 + currentTarget.Length + 5 : 0x82 + currentTarget.Length + 5));
binWriter.Write((byte)9);
binWriter.Write(from);
binWriter.Write(to);
binWriter.Write(Encoding.ASCII.GetBytes(currentTarget));
runningByteTotal += (ushort)(6 + Encoding.ASCII.GetByteCount(currentTarget));
return;
}
if (isArrayMode)
binWriter.Write((byte)(0xA4 + currentTarget.Length));
else
@ -236,6 +275,7 @@ namespace Meteor.Map.packets.send.actor
CloseStreams();
SubPacket packet = new SubPacket(OPCODE, sourceActorId, data);
packet.DebugPrintSubPacket();
return packet;
}