More inventory fixing after I broke it. Added preliminary final trade code. Moved recalc stats to the end of equipcommand, not on every modification of the referred item package.

This commit is contained in:
Filip Maj 2019-06-04 00:11:36 -04:00
parent 88ff22e55e
commit 69d4b19979
13 changed files with 388 additions and 170 deletions

View file

@ -2,6 +2,7 @@
using System.IO;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.dataobjects;
namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
{
@ -10,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
public const ushort OPCODE = 0x014D;
public const uint PACKET_SIZE = 0x28;
public static SubPacket BuildPacket(uint playerActorID, ushort position, uint linkedItem)
public static SubPacket BuildPacket(uint playerActorID, ushort position, InventoryItem linkedItem)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -19,28 +20,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((UInt16)position);
binWriter.Write((UInt32)linkedItem);
binWriter.Write((UInt16)linkedItem.slot);
binWriter.Write((UInt16)linkedItem.itemPackage);
}
}
return new SubPacket(OPCODE, playerActorID, data);
}
public static SubPacket BuildPacket(uint playerActorID, ushort position, ushort itemSlot, ushort itemPackageCode)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((UInt16)position);
binWriter.Write((UInt16)itemSlot);
binWriter.Write((UInt16)itemPackageCode);
}
}
return new SubPacket(OPCODE, playerActorID, data);
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
public const ushort OPCODE = 0x14E;
public const uint PACKET_SIZE = 0x58;
public static SubPacket BuildPacket(uint playerActorId, uint[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -29,7 +29,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
for (int i = 0; i < max; i++)
{
binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot
binWriter.Write((UInt32)linkedItemList[slotsToUpdate[i]]); //ItemPackage Slot + ItemPackage Code
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code
listOffset++;
}

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
public const ushort OPCODE = 0x14F;
public const uint PACKET_SIZE = 0x80;
public static SubPacket BuildPacket(uint playerActorId, uint[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -29,7 +29,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
for (int i = 0; i < max; i++)
{
binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot
binWriter.Write((UInt32)linkedItemList[slotsToUpdate[i]]); //ItemPackage Slot + ItemPackage Code
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code
listOffset++;
}

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
public const ushort OPCODE = 0x150;
public const uint PACKET_SIZE = 0xE0;
public static SubPacket BuildPacket(uint playerActorId, uint[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -29,7 +29,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
for (int i = 0; i < max; i++)
{
binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot
binWriter.Write((UInt32)linkedItemList[slotsToUpdate[i]]); //ItemPackage Slot + ItemPackage Code
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code
listOffset++;
}

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
public const ushort OPCODE = 0x151;
public const uint PACKET_SIZE = 0x194;
public static SubPacket BuildPacket(uint playerActorId, uint[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] linkedItemList, List<ushort> slotsToUpdate, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -29,7 +29,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.inventory
for (int i = 0; i < max; i++)
{
binWriter.Write((UInt16)slotsToUpdate[i]); //LinkedItemPackageSlot
binWriter.Write((UInt32)linkedItemList[slotsToUpdate[i]]); //ItemPackage Slot + ItemPackage Code
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].slot); //ItemPackage Slot
binWriter.Write((UInt16)linkedItemList[slotsToUpdate[i]].itemPackage); //ItemPackage Code
listOffset++;
}