mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-23 19:10:28 +02:00
Implemented equipment packets as well as actor name/appearance packets. Appearance and name is now retrieved for the chara id.
This commit is contained in:
parent
b0ab527550
commit
a81d6bb26a
16 changed files with 862 additions and 98 deletions
|
@ -38,14 +38,15 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
public uint modelID;
|
||||
public uint[] appearanceIDs;
|
||||
|
||||
public SetActorAppearancePacket(uint monsterModelID)
|
||||
public SetActorAppearancePacket(uint modelID)
|
||||
{
|
||||
modelID = monsterModelID;
|
||||
appearanceIDs = new uint[22];
|
||||
this.modelID = modelID;
|
||||
appearanceIDs = new uint[0x1D];
|
||||
}
|
||||
|
||||
public SetActorAppearancePacket(uint[] appearanceTable)
|
||||
public SetActorAppearancePacket(uint modelID, uint[] appearanceTable)
|
||||
{
|
||||
this.modelID = modelID;
|
||||
appearanceIDs = appearanceTable;
|
||||
}
|
||||
|
||||
|
@ -58,7 +59,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((uint)modelID);
|
||||
for (int i = 0; i < 0x1A; i++)
|
||||
for (int i = 0; i <= 0x1A; i++)
|
||||
{
|
||||
binWriter.Write((uint)i);
|
||||
binWriter.Write((uint)appearanceIDs[i]);
|
||||
|
@ -68,12 +69,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
binWriter.Write((uint) 0x1C);
|
||||
binWriter.Write((uint) 0x00);
|
||||
}
|
||||
data = mem.GetBuffer();
|
||||
|
||||
}
|
||||
|
||||
SubPacket packet = new SubPacket(OPCODE, playerActorID, actorID, data);
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor
|
|||
}
|
||||
|
||||
}
|
||||
data = mem.GetBuffer();
|
||||
}
|
||||
|
||||
SubPacket packet = new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
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 InventoryBeginChangePacket
|
||||
{
|
||||
public const ushort OPCODE = 0x016D;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID)
|
||||
{
|
||||
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
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 InventoryEndChangePacket
|
||||
{
|
||||
public const ushort OPCODE = 0x016E;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID)
|
||||
{
|
||||
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
|||
public const ushort CODE_ITEMS = 0x0000;
|
||||
public const ushort CODE_CURRANCYITEMS = 0x0063;
|
||||
public const ushort CODE_KEYITEMS = 0x0064;
|
||||
public const ushort CODE_EQUIPMENT = 0x00FE;
|
||||
public const ushort CODE_EQUIPMENT = 0x00FE;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, ushort size, ushort code)
|
||||
{
|
||||
|
|
|
@ -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 SetInitialEquipmentPacket
|
||||
{
|
||||
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 SetInitialEquipmentPacket()
|
||||
{
|
||||
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…
Add table
Add a link
Reference in a new issue