fix: Fixes boat movement & moves weapon ability out of core (#750)
* Fixes boats only moving once. * Removes event sink for weapon ability * Moves weapon ability packets out of the core.
This commit is contained in:
parent
c789a7f78a
commit
fd59b080f4
12 changed files with 142 additions and 130 deletions
|
|
@ -0,0 +1,50 @@
|
|||
using System.Buffers;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public static class WeaponAbilityPackets
|
||||
{
|
||||
public static void Configure()
|
||||
{
|
||||
IncomingPackets.RegisterEncoded(0x19, true, SetAbility);
|
||||
}
|
||||
|
||||
public static void SetAbility(NetState state, IEntity e, EncodedReader reader)
|
||||
{
|
||||
var m = state.Mobile;
|
||||
var index = reader.ReadInt32();
|
||||
|
||||
if (index >= 1 && index < WeaponAbility.Abilities.Length)
|
||||
{
|
||||
WeaponAbility.SetCurrentAbility(m, WeaponAbility.Abilities[index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
WeaponAbility.ClearCurrentAbility(m);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void SendClearWeaponAbility(this NetState ns) =>
|
||||
ns?.Send(stackalloc byte[] { 0xBF, 0x00, 0x5, 0x00, 0x21 });
|
||||
|
||||
public static void SendToggleSpecialAbility(this NetState ns, int abilityId, bool active)
|
||||
{
|
||||
if (ns == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(stackalloc byte[8]);
|
||||
writer.Write((byte)0xBF); // Packet ID
|
||||
writer.Write((ushort)8);
|
||||
writer.Write((short)0x25);
|
||||
writer.Write((short)abilityId);
|
||||
writer.Write(active);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue