mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Added new equipment change packet. Renamed ChangeEquipmentPacket to EquipmentChangePacket. Renamed folder Actor to actor.
This commit is contained in:
parent
a81d6bb26a
commit
0f80fa12dc
@ -76,20 +76,21 @@
|
|||||||
<Compile Include="PacketProcessor.cs" />
|
<Compile Include="PacketProcessor.cs" />
|
||||||
<Compile Include="packets\BasePacket.cs" />
|
<Compile Include="packets\BasePacket.cs" />
|
||||||
<Compile Include="packets\receive\HandshakePacket.cs" />
|
<Compile Include="packets\receive\HandshakePacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\InventoryBeginChangePacket.cs" />
|
<Compile Include="packets\send\actor\inventory\EquipmentChangePacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\InventoryEndChangePacket.cs" />
|
<Compile Include="packets\send\actor\inventory\InventoryBeginChangePacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\InventoryItemEndPacket.cs" />
|
<Compile Include="packets\send\actor\inventory\InventoryEndChangePacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\InventoryItemPacket.cs" />
|
<Compile Include="packets\send\actor\inventory\InventoryItemEndPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\InventorySetBeginPacket.cs" />
|
<Compile Include="packets\send\actor\inventory\InventoryItemPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\InventorySetEndPacket.cs" />
|
<Compile Include="packets\send\actor\inventory\InventorySetBeginPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\inventory\SetInitialEquipmentPacket.cs" />
|
<Compile Include="packets\send\actor\inventory\InventorySetEndPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\SetActorNamePacket.cs" />
|
<Compile Include="packets\send\actor\inventory\EquipmentSetupPacket.cs" />
|
||||||
|
<Compile Include="packets\send\actor\SetActorNamePacket.cs" />
|
||||||
<Compile Include="packets\send\login\0x2Packet.cs" />
|
<Compile Include="packets\send\login\0x2Packet.cs" />
|
||||||
<Compile Include="packets\send\Actor\AddActorPacket.cs" />
|
<Compile Include="packets\send\actor\AddActorPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\MoveActorToPositionPacket.cs" />
|
<Compile Include="packets\send\actor\MoveActorToPositionPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\RemoveActorPacketPacket.cs" />
|
<Compile Include="packets\send\actor\RemoveActorPacketPacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\SetActorAppearancePacket.cs" />
|
<Compile Include="packets\send\actor\SetActorAppearancePacket.cs" />
|
||||||
<Compile Include="packets\send\Actor\SetActorPositionPacket.cs" />
|
<Compile Include="packets\send\actor\SetActorPositionPacket.cs" />
|
||||||
<Compile Include="packets\send\login\InitPacket.cs" />
|
<Compile Include="packets\send\login\InitPacket.cs" />
|
||||||
<Compile Include="packets\send\PongPacket.cs" />
|
<Compile Include="packets\send\PongPacket.cs" />
|
||||||
<Compile Include="packets\send\SetMapPacket.cs" />
|
<Compile Include="packets\send\SetMapPacket.cs" />
|
||||||
|
@ -259,13 +259,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
//client.queuePacket(keyitems);
|
//client.queuePacket(keyitems);
|
||||||
|
|
||||||
#region equipsetup
|
#region equipsetup
|
||||||
SetInitialEquipmentPacket initialEqupmentPacket = new SetInitialEquipmentPacket();
|
EquipmentSetupPacket initialEqupmentPacket = new EquipmentSetupPacket();
|
||||||
initialEqupmentPacket.setItem(SetInitialEquipmentPacket.SLOT_BODY, 5);
|
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_BODY, 5);
|
||||||
initialEqupmentPacket.setItem(SetInitialEquipmentPacket.SLOT_HEAD, 3);
|
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_HEAD, 3);
|
||||||
initialEqupmentPacket.setItem(SetInitialEquipmentPacket.SLOT_UNDERSHIRT, 6);
|
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERSHIRT, 6);
|
||||||
initialEqupmentPacket.setItem(SetInitialEquipmentPacket.SLOT_UNDERGARMENT, 7);
|
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERGARMENT, 7);
|
||||||
initialEqupmentPacket.setItem(SetInitialEquipmentPacket.SLOT_MAINHAND, 2);
|
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_MAINHAND, 2);
|
||||||
initialEqupmentPacket.setItem(SetInitialEquipmentPacket.SLOT_LEGS, 8);
|
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_LEGS, 8);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//Equip Init
|
//Equip Init
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
|
||||||
{
|
|
||||||
class ChangeEquipmentPacket
|
|
||||||
{
|
|
||||||
public const ushort OPCODE = 0x014D;
|
|
||||||
public const uint PACKET_SIZE = 0x28;
|
|
||||||
|
|
||||||
public const UInt16 SLOT_MAINHAND = 0x00;
|
|
||||||
public const UInt16 SLOT_OFFHAND = 0x01;
|
|
||||||
public const UInt16 SLOT_THROWINGWEAPON = 0x04;
|
|
||||||
public const UInt16 SLOT_PACK = 0x05;
|
|
||||||
public const UInt16 SLOT_POUCH = 0x06;
|
|
||||||
public const UInt16 SLOT_HEAD = 0x08;
|
|
||||||
public const UInt16 SLOT_UNDERSHIRT = 0x09;
|
|
||||||
public const UInt16 SLOT_BODY = 0x0A;
|
|
||||||
public const UInt16 SLOT_UNDERGARMENT = 0x0B;
|
|
||||||
public const UInt16 SLOT_LEGS = 0x0C;
|
|
||||||
public const UInt16 SLOT_HANDS = 0x0D;
|
|
||||||
public const UInt16 SLOT_BOOTS = 0x0E;
|
|
||||||
public const UInt16 SLOT_WAIST = 0x0F;
|
|
||||||
public const UInt16 SLOT_NECK = 0x10;
|
|
||||||
public const UInt16 SLOT_EARS = 0x11;
|
|
||||||
public const UInt16 SLOT_WRISTS = 0x13;
|
|
||||||
public const UInt16 SLOT_RIGHTFINGER = 0x15;
|
|
||||||
public const UInt16 SLOT_LEFTFINGER = 0x16;
|
|
||||||
|
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, ushort equipSlot, uint inventorySlot)
|
|
||||||
{
|
|
||||||
ulong combined = equipSlot | (inventorySlot << 32);
|
|
||||||
return new SubPacket(OPCODE, 0, playerActorID, BitConverter.GetBytes(combined));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,32 @@
|
|||||||
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
|
{
|
||||||
|
class EquipmentChangePacket
|
||||||
|
{
|
||||||
|
public const ushort OPCODE = 0x014D;
|
||||||
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
|
public static SubPacket buildPacket(uint playerActorID, ushort slot, uint itemSlot)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
binWriter.Write((UInt16)slot);
|
||||||
|
binWriter.Write((UInt32)itemSlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
||||||
|
{
|
||||||
|
class EquipmentSetupPacket
|
||||||
|
{
|
||||||
|
public const ushort OPCODE = 0x014E;
|
||||||
|
public const uint PACKET_SIZE = 0x58;
|
||||||
|
|
||||||
|
public const uint UNEQUIPPED = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
public const int SLOT_MAINHAND = 0x00;
|
||||||
|
public const int SLOT_OFFHAND = 0x01;
|
||||||
|
public const int SLOT_THROWINGWEAPON = 0x04;
|
||||||
|
public const int SLOT_PACK = 0x05;
|
||||||
|
public const int SLOT_POUCH = 0x06;
|
||||||
|
public const int SLOT_HEAD = 0x08;
|
||||||
|
public const int SLOT_UNDERSHIRT = 0x09;
|
||||||
|
public const int SLOT_BODY = 0x0A;
|
||||||
|
public const int SLOT_UNDERGARMENT = 0x0B;
|
||||||
|
public const int SLOT_LEGS = 0x0C;
|
||||||
|
public const int SLOT_HANDS = 0x0D;
|
||||||
|
public const int SLOT_BOOTS = 0x0E;
|
||||||
|
public const int SLOT_WAIST = 0x0F;
|
||||||
|
public const int SLOT_NECK = 0x10;
|
||||||
|
public const int SLOT_EARS = 0x11;
|
||||||
|
public const int SLOT_WRISTS = 0x13;
|
||||||
|
public const int SLOT_RIGHTFINGER = 0x15;
|
||||||
|
public const int SLOT_LEFTFINGER = 0x16;
|
||||||
|
|
||||||
|
private uint[] equipment = new uint[0x17];
|
||||||
|
|
||||||
|
public EquipmentSetupPacket()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < equipment.Length; i++)
|
||||||
|
equipment[i] = UNEQUIPPED; //We will use this as "Unequipped"
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItem(int slot, uint itemSlot)
|
||||||
|
{
|
||||||
|
if (slot >= equipment.Length)
|
||||||
|
return;
|
||||||
|
|
||||||
|
equipment[slot] = itemSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SubPacket> buildPackets(uint playerActorID)
|
||||||
|
{
|
||||||
|
List<SubPacket> packets = new List<SubPacket>();
|
||||||
|
int packetCount = 0;
|
||||||
|
int runningCount = 0;
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
MemoryStream mem = new MemoryStream(data);
|
||||||
|
BinaryWriter binWriter = new BinaryWriter(mem);
|
||||||
|
|
||||||
|
for (int i = 0; i < equipment.Length; i++)
|
||||||
|
{
|
||||||
|
if (equipment[i] == UNEQUIPPED)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
binWriter.Write((UInt16)i);
|
||||||
|
binWriter.Write((UInt32)equipment[i]);
|
||||||
|
|
||||||
|
packetCount++;
|
||||||
|
runningCount++;
|
||||||
|
|
||||||
|
//Create another packet
|
||||||
|
if (runningCount >= 8)
|
||||||
|
{
|
||||||
|
packetCount = 0;
|
||||||
|
binWriter.Write((UInt32)8);
|
||||||
|
binWriter.Dispose();
|
||||||
|
mem.Dispose();
|
||||||
|
packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
|
||||||
|
data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
mem = new MemoryStream(data);
|
||||||
|
binWriter = new BinaryWriter(mem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create any leftover subpacket
|
||||||
|
binWriter.BaseStream.Seek(0x30, SeekOrigin.Begin);
|
||||||
|
binWriter.Write((UInt32)packetCount);
|
||||||
|
binWriter.Dispose();
|
||||||
|
mem.Dispose();
|
||||||
|
packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
|
||||||
|
|
||||||
|
return packets;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user