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

@ -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;
}