fix: Fixes buffs don't start/stop properly. Streamlines constructor and Add/Remove buffs. (#2082)
This commit is contained in:
parent
c8f13b2933
commit
d5160bd6db
50 changed files with 651 additions and 616 deletions
|
|
@ -1,71 +0,0 @@
|
|||
using System.Buffers;
|
||||
|
||||
namespace Server.Network;
|
||||
|
||||
public static class BuffIconPackets
|
||||
{
|
||||
public static void SendAddBuffPacket(
|
||||
this NetState ns, Serial mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, long ticks
|
||||
)
|
||||
{
|
||||
if (ns.CannotSendPackets())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var hasArgs = args != null;
|
||||
var length = hasArgs ? args.ToString()!.Length * 2 + 52 : 46;
|
||||
var writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0xDF); // Packet ID
|
||||
writer.Write((ushort)length);
|
||||
writer.Write(mob);
|
||||
writer.Write((short)iconID);
|
||||
writer.Write((short)0x1); // command (0 = remove, 1 = add, 2 = data)
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write((short)iconID);
|
||||
writer.Write((short)0x1); // command (0 = remove, 1 = add, 2 = data)
|
||||
writer.Write(0);
|
||||
|
||||
// Truncate to whole seconds - The packet should be delayed by the partial seconds and then sent "on the second"
|
||||
writer.Write((short)(ticks / 1000));
|
||||
writer.Clear(3);
|
||||
writer.Write(titleCliloc);
|
||||
writer.Write(secondaryCliloc);
|
||||
|
||||
if (hasArgs)
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write((short)0x1);
|
||||
writer.Write((ushort)0);
|
||||
writer.WriteLE('\t');
|
||||
writer.WriteLittleUniNull(args);
|
||||
writer.Write((short)0x1);
|
||||
writer.Write((ushort)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Clear(10);
|
||||
}
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendRemoveBuffPacket(this NetState ns, Serial mob, BuffIcon iconID)
|
||||
{
|
||||
if (ns.CannotSendPackets())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(stackalloc byte[15]);
|
||||
writer.Write((byte)0xDF); // Packet ID
|
||||
writer.Write((ushort)15);
|
||||
writer.Write(mob);
|
||||
writer.Write((short)iconID);
|
||||
writer.Write((short)0x0); // command (0 = remove, 1 = add, 2 = data)
|
||||
writer.Write(0);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue