first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class AcceptPartyInvitation : BasePacket
|
||||
{
|
||||
public AcceptPartyInvitation( int partyLeaderSerial )
|
||||
{
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 10 );
|
||||
_writer.Write( (short) 0x06 );
|
||||
_writer.Write( (byte) 0x08 );
|
||||
_writer.Write( partyLeaderSerial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class AttackRequest : BasePacket
|
||||
{
|
||||
public AttackRequest( int serial )
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0x05 );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public abstract class BasePacket
|
||||
{
|
||||
protected PacketWriter _writer;
|
||||
|
||||
protected BasePacket()
|
||||
{
|
||||
}
|
||||
|
||||
protected BasePacket( int length )
|
||||
{
|
||||
_writer = new PacketWriter( length );
|
||||
}
|
||||
|
||||
protected BasePacket( PacketDirection direction )
|
||||
{
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
public PacketDirection Direction { get; set; } = PacketDirection.Any;
|
||||
|
||||
public virtual byte[] ToArray()
|
||||
{
|
||||
return _writer?.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class BatchQueryProperties : BasePacket
|
||||
{
|
||||
public BatchQueryProperties( int serial )
|
||||
{
|
||||
_writer = new PacketWriter();
|
||||
_writer.Write( (byte) 0xD6 );
|
||||
_writer.Write( (short) 7 );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
|
||||
public BatchQueryProperties( IReadOnlyCollection<int> serials )
|
||||
{
|
||||
_writer = new PacketWriter();
|
||||
_writer.Write( (byte) 0xD6 );
|
||||
_writer.Write( (short) ( 3 + serials.Count * 4 ) );
|
||||
|
||||
foreach ( int serial in serials )
|
||||
{
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class CancelTargetCursor : BasePacket
|
||||
{
|
||||
public CancelTargetCursor( uint senderSerial )
|
||||
{
|
||||
_writer = new PacketWriter( 19 );
|
||||
_writer.Write( (byte) 0x6C );
|
||||
_writer.Write( (byte) 0 );
|
||||
_writer.Write( senderSerial );
|
||||
_writer.Write( (byte) 3 );
|
||||
_writer.Fill();
|
||||
}
|
||||
|
||||
public CancelTargetCursor( int senderSerial )
|
||||
{
|
||||
_writer = new PacketWriter( 19 );
|
||||
_writer.Write( (byte) 0x6C );
|
||||
_writer.Write( (byte) 0 );
|
||||
_writer.Write( senderSerial );
|
||||
_writer.Write( (byte) 3 );
|
||||
_writer.Fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using ClassicAssist.Data.Spells;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class CastSpell : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public CastSpell()
|
||||
{
|
||||
}
|
||||
|
||||
public CastSpell( int id )
|
||||
{
|
||||
_writer = new PacketWriter( 9 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 9 );
|
||||
_writer.Write( (short) 0x1C );
|
||||
_writer.Write( (short) 0x02 );
|
||||
_writer.Write( (short) id );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xBF || packet[4] != 0x1C || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int spellId = ( packet[7] << 8 ) | packet[8];
|
||||
|
||||
SpellManager manager = SpellManager.GetInstance();
|
||||
|
||||
SpellData sd = manager.GetSpellData( spellId ) ?? manager.GetMasteryData( spellId );
|
||||
|
||||
return sd != null ? $"Cast(\"{sd.Name}\")\r\n" : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ChangeCombatant : BasePacket
|
||||
{
|
||||
public ChangeCombatant( int serial ) : base( PacketDirection.Incoming )
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0xAA );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using ClassicAssist.Data.Skills;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ChangeSkillLock : BasePacket
|
||||
{
|
||||
public ChangeSkillLock( SkillEntry skill, LockStatus lockStatus )
|
||||
{
|
||||
_writer = new PacketWriter( 6 );
|
||||
_writer.Write( (byte) 0x3A );
|
||||
_writer.Write( (short) 6 );
|
||||
_writer.Write( (byte) 0 );
|
||||
_writer.Write( (byte) skill.Skill.ID );
|
||||
_writer.Write( (byte) lockStatus );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ChangeStatLock : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public ChangeStatLock()
|
||||
{
|
||||
}
|
||||
|
||||
public ChangeStatLock( StatType stat, LockStatus lockStatus )
|
||||
{
|
||||
_writer = new PacketWriter( 7 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 7 );
|
||||
_writer.Write( (short) 0x1A );
|
||||
_writer.Write( (byte) stat );
|
||||
_writer.Write( (byte) lockStatus );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( direction != PacketDirection.Outgoing || packet[0] != 0xBF || packet[4] != 0x1A )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
StatType stat = (StatType) packet[5];
|
||||
LockStatus lockStatus = (LockStatus) packet[6];
|
||||
|
||||
return $"SetStatus(\"{stat.ToString().ToLower()}\", \"{lockStatus.ToString().ToLower()}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ClearWeaponAbility : BasePacket
|
||||
{
|
||||
public ClearWeaponAbility()
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 5 );
|
||||
_writer.Write( (short) 0x21 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class CloseClientGump : BasePacket
|
||||
{
|
||||
public CloseClientGump( uint gumpID )
|
||||
{
|
||||
_writer = new PacketWriter( 13 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 13 );
|
||||
_writer.Write( (short) 0x04 );
|
||||
_writer.Write( gumpID );
|
||||
_writer.Fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class CompressedGump : IMacroCommandParser
|
||||
{
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xDD || direction != PacketDirection.Incoming )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int serial = ( packet[7] << 24 ) | ( packet[8] << 16 ) | ( packet[9] << 8 ) | packet[10];
|
||||
|
||||
return $"WaitForGump(0x{serial:x}, 5000)\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ContainerContentUpdate : BasePacket
|
||||
{
|
||||
public ContainerContentUpdate( int serial, int id, Direction direction, int amount, int x, int y, int grid,
|
||||
int parentSerial, int hue ) : base( PacketDirection.Incoming )
|
||||
{
|
||||
bool isNew = Engine.ClientVersion == null || Engine.ClientVersion >= new Version( 6, 0, 1, 7 );
|
||||
|
||||
_writer = new PacketWriter( isNew ? 21 : 20 );
|
||||
_writer.Write( (byte) 0x25 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) id );
|
||||
_writer.Write( (byte) direction );
|
||||
_writer.Write( (short) amount );
|
||||
_writer.Write( (short) x );
|
||||
_writer.Write( (short) y );
|
||||
|
||||
if ( isNew )
|
||||
{
|
||||
_writer.Write( (byte) grid );
|
||||
}
|
||||
|
||||
_writer.Write( parentSerial );
|
||||
_writer.Write( (short) hue );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Objects;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ContainerContentsPacket : BasePacket
|
||||
{
|
||||
public ContainerContentsPacket( ItemCollection collection )
|
||||
{
|
||||
_writer = new PacketWriter( 5 + collection.GetTotalItemCount() * 20 );
|
||||
|
||||
_writer.Write( (byte) 0x3C );
|
||||
_writer.Write( (short) ( collection.GetTotalItemCount() * 20 ) );
|
||||
_writer.Write( (short) collection.GetTotalItemCount() );
|
||||
|
||||
foreach ( Item item in collection.GetItems() )
|
||||
{
|
||||
_writer.Write( item.Serial );
|
||||
_writer.Write( (short) item.ID );
|
||||
_writer.Write( (byte) 0 ); // itemid offset
|
||||
_writer.Write( (short) item.Count );
|
||||
_writer.Write( (short) item.X );
|
||||
_writer.Write( (short) item.Y );
|
||||
_writer.Write( (byte) item.Grid );
|
||||
_writer.Write( collection.Serial );
|
||||
_writer.Write( (short) item.Hue );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ContextMenuClick : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public ContextMenuClick()
|
||||
{
|
||||
}
|
||||
|
||||
public ContextMenuClick( int serial, int index )
|
||||
{
|
||||
_writer = new PacketWriter( 11 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 11 );
|
||||
_writer.Write( (short) 0x15 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) index );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xBF || packet[4] != 0x15 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
PacketReader reader = new PacketReader( packet, length, false );
|
||||
|
||||
reader.ReadInt16();
|
||||
|
||||
int serial = reader.ReadInt32();
|
||||
int index = reader.ReadInt16();
|
||||
|
||||
return $"WaitForContext(0x{serial:x}, {index}, 5000)\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ContextMenuRequest : BasePacket
|
||||
{
|
||||
public ContextMenuRequest( int serial )
|
||||
{
|
||||
_writer = new PacketWriter( 9 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 9 );
|
||||
_writer.Write( (short) 0x13 );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class DisarmRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public DisarmRequest()
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 5 );
|
||||
_writer.Write( (short) 0x09 );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( direction == PacketDirection.Outgoing && packet[0] == 0xBF && packet[4] == 0x09 )
|
||||
{
|
||||
return "SetAbility(\"Disarm\")\r\n";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class DisplayQuestPointer : BasePacket
|
||||
{
|
||||
public DisplayQuestPointer( bool active, int x, int y, int serial = 0 )
|
||||
{
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0xBA );
|
||||
_writer.Write( (byte) ( active ? 1 : 0 ) );
|
||||
_writer.Write( (short) x );
|
||||
_writer.Write( (short) y );
|
||||
|
||||
if ( Engine.ClientVersion >= new Version( 7, 0, 9, 0 ) )
|
||||
{
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Objects;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class DragItem : BasePacket
|
||||
{
|
||||
public DragItem( int serial, int amount, bool checkAmount = false )
|
||||
{
|
||||
if ( checkAmount && amount == -1 )
|
||||
{
|
||||
Item item = Engine.Items.GetItem( serial );
|
||||
|
||||
if ( item != null )
|
||||
{
|
||||
amount = item.Count;
|
||||
}
|
||||
}
|
||||
|
||||
_writer = new PacketWriter( 7 );
|
||||
_writer.Write( (byte) 0x07 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) amount );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class DropItem : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public DropItem()
|
||||
{
|
||||
}
|
||||
|
||||
public DropItem( int serial, int containerSerial, int x, int y, int z )
|
||||
{
|
||||
_writer = new PacketWriter( 15 );
|
||||
_writer.Write( (byte) 0x08 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) x );
|
||||
_writer.Write( (short) y );
|
||||
_writer.Write( (sbyte) z );
|
||||
|
||||
if ( Engine.ClientVersion == null || Engine.ClientVersion >= new Version( 6, 0, 1, 7 ) )
|
||||
{
|
||||
_writer.Write( (byte) 0 );
|
||||
}
|
||||
|
||||
_writer.Write( containerSerial );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x08 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int serial = ( packet[1] << 24 ) | ( packet[2] << 16 ) | ( packet[3] << 8 ) | packet[4];
|
||||
int containerSerial = ( packet[11] << 24 ) | ( packet[12] << 16 ) | ( packet[13] << 8 ) | packet[14];
|
||||
|
||||
if ( serial == 0 || containerSerial == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $"MoveItem(0x{serial:x}, 0x{containerSerial:x})\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class EquipLastWeapon : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public EquipLastWeapon()
|
||||
{
|
||||
if ( Engine.Player == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0xD7 );
|
||||
_writer.Write( (short) 10 ); // size
|
||||
_writer.Write( Engine.Player.Serial );
|
||||
_writer.Write( (short) 0x1E );
|
||||
_writer.Write( (byte) 0x0A );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xD7 || packet[8] != 0x1E || packet[9] != 0x0A || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return "EquipLastWeapon()\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class EquipRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public EquipRequest()
|
||||
{
|
||||
}
|
||||
|
||||
public EquipRequest( int serial, Layer layer, int containerSerial )
|
||||
{
|
||||
_writer = new PacketWriter( 10 );
|
||||
|
||||
_writer.Write( (byte) 0x13 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (byte) layer );
|
||||
_writer.Write( containerSerial );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x13 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int serial = ( packet[1] << 24 ) | ( packet[2] << 16 ) | ( packet[3] << 8 ) | packet[4];
|
||||
Layer layer = (Layer) packet[5];
|
||||
|
||||
return $"EquipItem(0x{serial:x}, \"{layer.ToString()}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class GuildButtonRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public GuildButtonRequest()
|
||||
{
|
||||
if ( Engine.Player == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0xD7 );
|
||||
_writer.Write( (short) 10 ); // size
|
||||
_writer.Write( Engine.Player.Serial );
|
||||
_writer.Write( (short) 0x28 );
|
||||
_writer.Write( (byte) 0x0A );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xD7 || packet[8] != 0x28 || packet[9] != 0x0A || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return "OpenGuildGump()\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class GumpButtonClick : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public GumpButtonClick()
|
||||
{
|
||||
}
|
||||
|
||||
public GumpButtonClick( int gumpID, int serial, int buttonID, IReadOnlyCollection<int> switches = null )
|
||||
{
|
||||
//TODO switches etc
|
||||
_writer = new PacketWriter( 23 + ( switches?.Count * 4 ?? 0 ) );
|
||||
_writer.Write( (byte) 0xB1 );
|
||||
_writer.Write( (short) ( 23 + ( switches?.Count * 4 ?? 0 ) ) );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( gumpID );
|
||||
_writer.Write( buttonID );
|
||||
|
||||
if ( switches != null )
|
||||
{
|
||||
_writer.Write( switches.Count );
|
||||
|
||||
foreach ( int @switch in switches )
|
||||
{
|
||||
_writer.Write( @switch );
|
||||
}
|
||||
}
|
||||
|
||||
_writer.Fill();
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xB1 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
uint gumpId = (uint) ( ( packet[7] << 24 ) | ( packet[8] << 16 ) | ( packet[9] << 8 ) | packet[10] );
|
||||
int buttonId = ( packet[11] << 24 ) | ( packet[12] << 16 ) | ( packet[13] << 8 ) | packet[14];
|
||||
|
||||
return $"ReplyGump(0x{gumpId:x}, {buttonId})\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public interface IMacroCommandParser
|
||||
{
|
||||
string Parse( byte[] packet, int length, PacketDirection direction );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class InvokeVirtue : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public InvokeVirtue()
|
||||
{
|
||||
}
|
||||
|
||||
public InvokeVirtue( Virtues virtue )
|
||||
{
|
||||
_writer = new PacketWriter( 6 );
|
||||
_writer.Write( (byte) 0x12 );
|
||||
_writer.Write( (short) 6 );
|
||||
_writer.Write( (byte) 0xF4 );
|
||||
_writer.Write( (byte) virtue );
|
||||
_writer.Write( (byte) 0 );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x12 || packet[3] != 0xF4 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $"InvokeVirtue(\"{(Virtues) packet[4]}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ItemListMenu : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x7C || direction != PacketDirection.Incoming )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int gumpId = ( packet[7] << 8 ) | packet[8];
|
||||
return $"WaitForMenu(0x{gumpId:x}, 5000)\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class LookRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public LookRequest()
|
||||
{
|
||||
}
|
||||
|
||||
public LookRequest( int serial )
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0x09 );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
//if ( basePacket[0] != 0x09 || direction != PacketDirection.Outgoing )
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
|
||||
//int serial = ( basePacket[1] << 24 ) | ( basePacket[2] << 16 ) | ( basePacket[3] << 8 ) | basePacket[4];
|
||||
|
||||
//return $"ClickObject(0x{serial:x})\r\nPause({Options.CurrentOptions.ActionDelayMS})\r\n";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
using ClassicAssist.UO.Objects;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MenuButtonClick : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public MenuButtonClick()
|
||||
{
|
||||
}
|
||||
|
||||
public MenuButtonClick( int gumpId, int serial, int index, int id = 0, int hue = 0 )
|
||||
{
|
||||
if ( serial == -1 )
|
||||
{
|
||||
if ( !Engine.Menus.GetMenu( gumpId, out Menu menu ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
serial = menu.Serial;
|
||||
}
|
||||
|
||||
_writer = new PacketWriter( 13 );
|
||||
_writer.Write( (byte) 0x7D );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) gumpId );
|
||||
_writer.Write( (short) index );
|
||||
_writer.Write( (short) id );
|
||||
_writer.Write( (short) hue );
|
||||
|
||||
Engine.Menus?.Remove( gumpId );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x7D || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int gumpId = ( packet[5] << 8 ) | packet[6];
|
||||
int index = ( packet[7] << 8 ) | packet[8];
|
||||
int id = ( packet[9] << 8 ) | packet[10];
|
||||
int hue = ( packet[11] << 8 ) | packet[12];
|
||||
|
||||
return $"ReplyMenu(0x{gumpId:x}, {index}, 0x{id:x}, {hue})\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Objects;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MobileIncoming : BasePacket
|
||||
{
|
||||
public MobileIncoming( Mobile mobile, ItemCollection equipment, int overrideHue = 0 )
|
||||
{
|
||||
bool useNewIncoming = Engine.ClientVersion == null || Engine.ClientVersion >= new Version( 7, 0, 33, 1 );
|
||||
|
||||
int len = 23 + equipment.Count() * 9;
|
||||
|
||||
_writer = new PacketWriter( len );
|
||||
_writer.Write( (byte) 0x78 );
|
||||
_writer.Write( (short) len );
|
||||
_writer.Write( mobile.Serial );
|
||||
_writer.Write( (short) mobile.ID );
|
||||
_writer.Write( (short) mobile.X );
|
||||
_writer.Write( (short) mobile.Y );
|
||||
_writer.Write( (sbyte) mobile.Z );
|
||||
_writer.Write( (byte) mobile.Direction );
|
||||
_writer.Write( (short) ( overrideHue > 0 ? overrideHue : mobile.Hue ) );
|
||||
_writer.Write( (byte) mobile.Status );
|
||||
_writer.Write( (byte) mobile.Notoriety );
|
||||
|
||||
foreach ( Item item in equipment.GetItems() )
|
||||
{
|
||||
_writer.Write( item.Serial );
|
||||
_writer.Write( (short) ( useNewIncoming ? item.ID : item.ID | 0x8000 ) );
|
||||
_writer.Write( (byte) item.Layer );
|
||||
_writer.Write( (short) ( overrideHue > 0 ? overrideHue : item.Hue ) );
|
||||
}
|
||||
|
||||
_writer.Write( 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Objects;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MobileMoving : BasePacket
|
||||
{
|
||||
public MobileMoving( Mobile mobile, int hueOverride = 0 )
|
||||
{
|
||||
_writer = new PacketWriter( 17 );
|
||||
_writer.Write( (byte) 0x77 );
|
||||
_writer.Write( mobile.Serial );
|
||||
_writer.Write( (short) mobile.ID );
|
||||
_writer.Write( (short) mobile.X );
|
||||
_writer.Write( (short) mobile.Y );
|
||||
_writer.Write( (sbyte) mobile.Z );
|
||||
_writer.Write( (byte) mobile.Direction );
|
||||
_writer.Write( (short) ( hueOverride > 0 ? hueOverride : mobile.Hue ) );
|
||||
_writer.Write( (byte) mobile.Status );
|
||||
_writer.Write( (byte) mobile.Notoriety );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MobileQuery : BasePacket
|
||||
{
|
||||
public MobileQuery( int serial, MobileQueryType queryType = MobileQueryType.StatsRequest )
|
||||
{
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0x34 );
|
||||
_writer.Write( 0xEDEDEDED );
|
||||
_writer.Write( (byte) queryType );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MobileUpdate : BasePacket
|
||||
{
|
||||
public MobileUpdate( int serial, int id, int hue, MobileStatus flags, int x, int y, int z, Direction direction )
|
||||
{
|
||||
_writer = new PacketWriter( 19 );
|
||||
_writer.Write( (byte) 0x20 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) id );
|
||||
_writer.Write( (byte) 0 );
|
||||
_writer.Write( (short) hue );
|
||||
_writer.Write( (byte) flags );
|
||||
_writer.Write( (short) x );
|
||||
_writer.Write( (short) y );
|
||||
_writer.Write( (short) 0 );
|
||||
_writer.Write( (byte) direction );
|
||||
_writer.Write( (sbyte) z );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MovementRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x02 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Direction d = (Direction) packet[1];
|
||||
|
||||
return $"Walk(\"{d.ToString()}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class MultiTarget : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x99 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return direction == PacketDirection.Incoming ? "WaitForTarget(5000)\r\n" : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class Ping : BasePacket
|
||||
{
|
||||
public Ping( byte value ) : base( 2 )
|
||||
{
|
||||
_writer.Write( (byte) 0x73 );
|
||||
_writer.Write( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class PlaySound : BasePacket
|
||||
{
|
||||
public PlaySound( int id )
|
||||
{
|
||||
_writer = new PacketWriter( 12 );
|
||||
_writer.Write( (byte) 0x54 );
|
||||
_writer.Write( (byte) 0x01 );
|
||||
_writer.Write( (short) id );
|
||||
_writer.Write( (short) 0 );
|
||||
_writer.Write( (short) ( Engine.Player?.X ?? 0 ) );
|
||||
_writer.Write( (short) ( Engine.Player?.Y ?? 0 ) );
|
||||
_writer.Write( (short) ( Engine.Player?.Z ?? 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class QueryProperties : BasePacket
|
||||
{
|
||||
public QueryProperties( int serial )
|
||||
{
|
||||
_writer = new PacketWriter( 9 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 9 );
|
||||
_writer.Write( (short) 0x10 );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class QuestsButtonRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public QuestsButtonRequest()
|
||||
{
|
||||
if ( Engine.Player == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0xD7 );
|
||||
_writer.Write( (short) 10 ); // size
|
||||
_writer.Write( Engine.Player.Serial );
|
||||
_writer.Write( (short) 0x32 );
|
||||
_writer.Write( (byte) 0x0A );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xD7 || packet[8] != 0x32 || packet[9] != 0x0A || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return "OpenQuestsGump()\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class RejectPartyInvitation : BasePacket
|
||||
{
|
||||
public RejectPartyInvitation( int partyLeaderSerial )
|
||||
{
|
||||
_writer = new PacketWriter( 10 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 10 );
|
||||
_writer.Write( (short) 0x06 );
|
||||
_writer.Write( (byte) 0x09 );
|
||||
_writer.Write( partyLeaderSerial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class RemoveObject : BasePacket
|
||||
{
|
||||
public RemoveObject( int serial )
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0x1D );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class RenameRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public RenameRequest()
|
||||
{
|
||||
}
|
||||
|
||||
public RenameRequest( int serial, string name )
|
||||
{
|
||||
_writer = new PacketWriter( 35 );
|
||||
_writer.Write( (byte) 0x75 );
|
||||
_writer.Write( serial );
|
||||
_writer.WriteAsciiFixed( name, 30 );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x75 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
PacketReader reader = new PacketReader( packet, length, true );
|
||||
|
||||
int serial = reader.ReadInt32();
|
||||
string name = reader.ReadString( 30 );
|
||||
|
||||
return $"Rename(0x{serial:x}, \"{name}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class Resync : BasePacket
|
||||
{
|
||||
public Resync()
|
||||
{
|
||||
_writer = new PacketWriter( 3 );
|
||||
_writer.Write( (byte) 0x22 );
|
||||
_writer.Write( (short) 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.IO;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class SAWorldItem : BasePacket
|
||||
{
|
||||
public SAWorldItem( byte[] packet, int length, int hueOverride )
|
||||
{
|
||||
_writer = new PacketWriter( length );
|
||||
_writer.Write( packet, 0, length );
|
||||
|
||||
if ( hueOverride <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_writer.Seek( 21, SeekOrigin.Begin );
|
||||
_writer.Write( (short) hueOverride );
|
||||
_writer.Seek( 0, SeekOrigin.End );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class SetWeaponAbility : BasePacket
|
||||
{
|
||||
public SetWeaponAbility( int abilityIndex )
|
||||
{
|
||||
_writer = new PacketWriter( 15 );
|
||||
|
||||
_writer.Write( (byte) 0xD7 );
|
||||
_writer.Write( (short) 15 );
|
||||
_writer.Write( Engine.Player?.Serial ?? 0 );
|
||||
_writer.Write( (short) 0x19 );
|
||||
_writer.Write( (byte) 0 );
|
||||
_writer.Write( abilityIndex );
|
||||
_writer.Write( (byte) 0x0A );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class StunRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public StunRequest()
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 5 );
|
||||
_writer.Write( (short) 0x0A );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( direction == PacketDirection.Outgoing && packet[0] == 0xBF && packet[4] == 0x0A )
|
||||
{
|
||||
return "SetAbility(\"Stun\")\r\n";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.Data;
|
||||
using ClassicAssist.Data.Macros.Commands;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using ClassicAssist.Shared.UO;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
using ClassicAssist.UO.Objects;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class Target : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public Target()
|
||||
{
|
||||
}
|
||||
|
||||
public Target( int senderSerial, Entity entity, bool cancelClientCursor ) : this( TargetType.Object,
|
||||
senderSerial, TargetFlags.None, entity.Serial, -1, -1, -1, entity.ID, cancelClientCursor )
|
||||
{
|
||||
}
|
||||
|
||||
public Target( TargetType targetType, int senderSerial, TargetFlags flags, int targetSerial, int x, int y,
|
||||
int z, int id, bool cancelClientCursor )
|
||||
{
|
||||
if ( senderSerial == -1 )
|
||||
{
|
||||
senderSerial = Engine.TargetSerial;
|
||||
}
|
||||
|
||||
if ( targetSerial > 0 )
|
||||
{
|
||||
Engine.Player.LastTargetSerial = targetSerial;
|
||||
Engine.Player.LastTargetType = targetType;
|
||||
}
|
||||
|
||||
if ( Engine.TargetFlags == TargetFlags.Harmful &&
|
||||
Options.CurrentOptions.PreventTargetingFriendsWithHarmful &&
|
||||
MobileCommands.InFriendList( targetSerial ) )
|
||||
{
|
||||
Commands.SystemMessage( Strings.Target_blocked____try_again___ );
|
||||
Commands.ResendTargetToClient();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_writer = new PacketWriter( 19 );
|
||||
_writer.Write( (byte) 0x6C );
|
||||
_writer.Write( (byte) targetType );
|
||||
_writer.Write( senderSerial );
|
||||
_writer.Write( (byte) flags );
|
||||
_writer.Write( targetSerial );
|
||||
_writer.Write( (short) x );
|
||||
_writer.Write( (short) y );
|
||||
_writer.Write( (short) z );
|
||||
_writer.Write( (short) id );
|
||||
|
||||
Engine.TargetExists = false;
|
||||
|
||||
if ( cancelClientCursor )
|
||||
{
|
||||
Engine.SendPacketToClient( new Target( targetType, senderSerial, TargetFlags.Cancel, targetSerial, x, y,
|
||||
z, id, false ) );
|
||||
Engine.AddSendPreFilter( new PacketFilterInfo( 0x6C,
|
||||
new[] { PacketFilterConditions.IntAtPositionCondition( senderSerial, 2 ) },
|
||||
( p, pfi ) => { Engine.RemoveSendPreFilter( pfi ); } ) );
|
||||
}
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x6C )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( direction == PacketDirection.Incoming )
|
||||
{
|
||||
return "WaitForTarget(5000)\r\n";
|
||||
}
|
||||
|
||||
if ( packet[1] == 0 )
|
||||
{
|
||||
uint serial = (uint) ( ( packet[7] << 24 ) | ( packet[8] << 16 ) | ( packet[9] << 8 ) | packet[10] );
|
||||
|
||||
return $"Target(0x{serial:x})\r\n";
|
||||
}
|
||||
|
||||
int x = ( packet[11] << 8 ) | packet[12];
|
||||
int y = ( packet[13] << 8 ) | packet[14];
|
||||
int z = (sbyte) ( packet[15] << 8 ) | (sbyte) packet[16];
|
||||
int id = ( packet[17] << 8 ) | packet[18];
|
||||
|
||||
return id == 0 ? $"TargetXYZ({x}, {y}, {z})\r\n" : $"TargetXYZ({x}, {y}, {z}, {id})\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class TargetByResource : BasePacket
|
||||
{
|
||||
public TargetByResource( int serial, int resourceType )
|
||||
{
|
||||
_writer = new PacketWriter( 11 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 11 );
|
||||
_writer.Write( (short) 0x30 );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (short) resourceType );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class ToggleGargoyleFlying : BasePacket
|
||||
{
|
||||
public ToggleGargoyleFlying()
|
||||
{
|
||||
_writer = new PacketWriter( 11 );
|
||||
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 11 );
|
||||
_writer.Write( (short) 0x32 );
|
||||
_writer.Write( (short) 1 );
|
||||
_writer.Write( 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UnicodePromptCancel : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public UnicodePromptCancel()
|
||||
{
|
||||
}
|
||||
|
||||
public UnicodePromptCancel( int senderSerial, int promptId )
|
||||
{
|
||||
_writer = new PacketWriter( 20 );
|
||||
_writer.Write( (byte) 0xC2 );
|
||||
_writer.Write( (short) 20 );
|
||||
_writer.Write( senderSerial );
|
||||
_writer.Write( promptId );
|
||||
_writer.Write( 0 );
|
||||
_writer.WriteAsciiFixed( Strings.UO_LOCALE, 4 );
|
||||
_writer.Fill();
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xC2 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return packet[14] != 0x00 ? null : "CancelPrompt()\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UnicodePromptRequest : BasePacket, IMacroCommandParser
|
||||
{
|
||||
// ReSharper disable once EmptyConstructor
|
||||
public UnicodePromptRequest()
|
||||
{
|
||||
// TODO
|
||||
// byte[] packet = new byte[] { 0xC2, 0x00, 0x15, 0x00, 0x00, 0x04, 0x82, 0x00, 0x00, 0x04, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] == 0xC2 && direction == PacketDirection.Incoming )
|
||||
{
|
||||
return "WaitForPrompt(5000)\r\n";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Text;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UnicodePromptResponse : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public UnicodePromptResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public UnicodePromptResponse( int senderSerial, int promptId, string text )
|
||||
{
|
||||
byte[] textBytes = Encoding.Unicode.GetBytes( text );
|
||||
|
||||
int len = 19 + textBytes.Length;
|
||||
|
||||
_writer = new PacketWriter( len );
|
||||
_writer.Write( (byte) 0xC2 );
|
||||
_writer.Write( (short) len );
|
||||
_writer.Write( senderSerial );
|
||||
_writer.Write( promptId );
|
||||
_writer.Write( 1 );
|
||||
_writer.WriteAsciiFixed( Strings.UO_LOCALE, 4 );
|
||||
_writer.Write( textBytes, 0, textBytes.Length );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0xC2 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( packet[14] == 0x00 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string text = Encoding.Unicode.GetString( packet, 19, packet.Length - 20 ).Trim( '\0' );
|
||||
|
||||
return $"PromptMsg(\"{text}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Text;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UnicodeText : BasePacket
|
||||
{
|
||||
public UnicodeText( int serial, int graphic, JournalSpeech speechType, int hue, int font, string lang,
|
||||
string name, string text )
|
||||
{
|
||||
byte[] textBytes = Encoding.BigEndianUnicode.GetBytes( text );
|
||||
int len = 48 + textBytes.Length;
|
||||
|
||||
_writer = new PacketWriter( len );
|
||||
_writer.Write( (byte) 0xAE );
|
||||
_writer.Write( (short) len );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( (ushort) graphic );
|
||||
_writer.Write( (byte) speechType );
|
||||
_writer.Write( (short) hue );
|
||||
_writer.Write( (short) font );
|
||||
_writer.WriteAsciiFixed( lang, 4 );
|
||||
_writer.WriteAsciiFixed( name, 30 );
|
||||
_writer.Write( textBytes, 0, textBytes.Length );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UseObject : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public UseObject()
|
||||
{
|
||||
}
|
||||
|
||||
public UseObject( int serial )
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0x06 );
|
||||
_writer.Write( serial );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x06 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int serial = ( packet[1] << 24 ) | ( packet[2] << 16 ) | ( packet[3] << 8 ) | packet[4];
|
||||
|
||||
return $"UseObject(0x{serial:x})\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
using static System.Text.Encoding;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UseSkill : BasePacket, IMacroCommandParser
|
||||
{
|
||||
public UseSkill()
|
||||
{
|
||||
}
|
||||
|
||||
public UseSkill( int index )
|
||||
{
|
||||
string args = $"{index} 0";
|
||||
|
||||
_writer = new PacketWriter( 5 + args.Length );
|
||||
_writer.Write( (byte) 0x12 );
|
||||
_writer.Write( (short) ( 5 + args.Length ) );
|
||||
_writer.Write( (byte) 0x24 );
|
||||
_writer.WriteAsciiFixed( args, args.Length );
|
||||
_writer.Write( (byte) 0 );
|
||||
}
|
||||
|
||||
public string Parse( byte[] packet, int length, PacketDirection direction )
|
||||
{
|
||||
if ( packet[0] != 0x12 || packet[3] != 0x24 || direction != PacketDirection.Outgoing )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int len = packet.Length - 4;
|
||||
byte[] skillPart = new byte[len];
|
||||
Buffer.BlockCopy( packet, 4, skillPart, 0, len );
|
||||
string skill = ASCII.GetString( skillPart );
|
||||
|
||||
if ( !int.TryParse( skill.Substring( 0, skill.IndexOf( ' ' ) ), out int id ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string skillName = Skills.GetSkillName( id );
|
||||
|
||||
return string.IsNullOrEmpty( skillName ) ? null : $"UseSkill(\"{skillName}\")\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#region License
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class UseTargetedItem : BasePacket
|
||||
{
|
||||
public UseTargetedItem( int serial, int targetSerial )
|
||||
{
|
||||
_writer = new PacketWriter( 13 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 13 );
|
||||
_writer.Write( (short) 0x2C );
|
||||
_writer.Write( serial );
|
||||
_writer.Write( targetSerial );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ClassicAssist.Data.Vendors;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class VendorBuy : BasePacket
|
||||
{
|
||||
public VendorBuy( IReadOnlyCollection<ShopListEntry> entries )
|
||||
{
|
||||
int len = 8 + entries.Count * 7;
|
||||
|
||||
_writer = new PacketWriter( len );
|
||||
_writer.Write( (byte) 0x3B );
|
||||
_writer.Write( (short) len );
|
||||
_writer.Write( entries.FirstOrDefault()?.VendorSerial ?? 0 );
|
||||
_writer.Write( (byte) 2 ); // item list
|
||||
|
||||
foreach ( ShopListEntry entry in entries )
|
||||
{
|
||||
_writer.Write( (byte) Layer.ShopBuy );
|
||||
_writer.Write( entry.Item.Serial );
|
||||
_writer.Write( (short) entry.Amount );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public class WarMode : BasePacket
|
||||
{
|
||||
public WarMode( bool onOff )
|
||||
{
|
||||
_writer = new PacketWriter( 5 );
|
||||
_writer.Write( (byte) 0x72 );
|
||||
_writer.Write( onOff );
|
||||
_writer.Write( (byte) 0x00 );
|
||||
_writer.Write( (byte) 0x32 );
|
||||
_writer.Write( (byte) 0x00 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UO.Network.Packets
|
||||
{
|
||||
public enum BoatSpeed : byte
|
||||
{
|
||||
Stop,
|
||||
OneTile,
|
||||
Normal
|
||||
}
|
||||
|
||||
public class WheelBoatMoving : BasePacket
|
||||
{
|
||||
public WheelBoatMoving( Direction direction, BoatSpeed speed )
|
||||
{
|
||||
_writer = new PacketWriter( 12 );
|
||||
_writer.Write( (byte) 0xBF );
|
||||
_writer.Write( (short) 12 );
|
||||
_writer.Write( (short) 0x33 );
|
||||
_writer.Write( Engine.Player.Serial );
|
||||
_writer.Write( (byte) direction );
|
||||
_writer.Write( (byte) direction );
|
||||
_writer.Write( (byte) speed );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user