2016-06-08 22:29:04 +01:00
|
|
|
|
using System;
|
2016-02-21 14:06:23 -05:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace FFXIVClassic_Map_Server.dataobjects
|
|
|
|
|
{
|
|
|
|
|
class InventoryItem
|
|
|
|
|
{
|
2016-03-12 02:52:34 -05:00
|
|
|
|
public ulong uniqueId;
|
2016-02-21 14:06:23 -05:00
|
|
|
|
public uint itemId;
|
|
|
|
|
public int quantity = 1;
|
|
|
|
|
public ushort slot;
|
|
|
|
|
|
2016-02-21 21:44:11 -05:00
|
|
|
|
public byte itemType;
|
2016-02-21 14:06:23 -05:00
|
|
|
|
public byte quality = 1;
|
|
|
|
|
|
2016-02-22 22:33:52 -05:00
|
|
|
|
public int durability = 0;
|
2016-02-21 14:06:23 -05:00
|
|
|
|
public ushort spiritbind = 0;
|
|
|
|
|
|
|
|
|
|
public byte materia1 = 0;
|
|
|
|
|
public byte materia2 = 0;
|
|
|
|
|
public byte materia3 = 0;
|
|
|
|
|
public byte materia4 = 0;
|
|
|
|
|
public byte materia5 = 0;
|
|
|
|
|
|
|
|
|
|
//Bare Minimum
|
|
|
|
|
public InventoryItem(uint id, uint itemId, ushort slot)
|
|
|
|
|
{
|
|
|
|
|
this.uniqueId = id;
|
|
|
|
|
this.itemId = itemId;
|
2016-03-12 02:52:34 -05:00
|
|
|
|
this.quantity = 1;
|
2016-02-21 21:44:11 -05:00
|
|
|
|
this.slot = slot;
|
|
|
|
|
|
2016-06-14 21:29:10 +01:00
|
|
|
|
Item gItem = Server.GetItemGamedata(itemId);
|
2016-02-21 21:44:11 -05:00
|
|
|
|
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
2016-02-21 14:06:23 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-12 02:52:34 -05:00
|
|
|
|
//For check command
|
|
|
|
|
public InventoryItem(InventoryItem item, ushort equipSlot)
|
|
|
|
|
{
|
|
|
|
|
this.uniqueId = item.uniqueId;
|
|
|
|
|
this.itemId = item.itemId;
|
|
|
|
|
this.quantity = item.quantity;
|
|
|
|
|
this.slot = equipSlot;
|
|
|
|
|
|
|
|
|
|
this.itemType = item.itemType;
|
|
|
|
|
this.quality = item.quality;
|
|
|
|
|
|
|
|
|
|
this.durability = item.durability;
|
|
|
|
|
this.spiritbind = item.spiritbind;
|
|
|
|
|
|
|
|
|
|
this.materia1 = item.materia1;
|
|
|
|
|
this.materia2 = item.materia2;
|
|
|
|
|
this.materia3 = item.materia3;
|
|
|
|
|
this.materia4 = item.materia4;
|
|
|
|
|
this.materia5 = item.materia5;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-22 22:33:52 -05:00
|
|
|
|
public InventoryItem(uint uniqueId, uint itemId, int quantity, ushort slot, byte itemType, byte qualityNumber, int durability, ushort spiritbind, byte materia1, byte materia2, byte materia3, byte materia4, byte materia5)
|
2016-02-21 14:06:23 -05:00
|
|
|
|
{
|
|
|
|
|
this.uniqueId = uniqueId;
|
|
|
|
|
this.itemId = itemId;
|
|
|
|
|
this.quantity = quantity;
|
|
|
|
|
this.slot = slot;
|
2016-02-21 21:44:11 -05:00
|
|
|
|
this.itemType = itemType;
|
2016-02-21 14:06:23 -05:00
|
|
|
|
this.quality = qualityNumber;
|
|
|
|
|
this.durability = durability;
|
|
|
|
|
this.spiritbind = spiritbind;
|
|
|
|
|
this.materia1 = materia1;
|
|
|
|
|
this.materia2 = materia2;
|
|
|
|
|
this.materia3 = materia3;
|
|
|
|
|
this.materia4 = materia4;
|
|
|
|
|
this.materia5 = materia5;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 21:29:10 +01:00
|
|
|
|
public byte[] ToPacketBytes()
|
2016-02-21 14:06:23 -05:00
|
|
|
|
{
|
|
|
|
|
byte[] data = new byte[0x70];
|
|
|
|
|
|
|
|
|
|
using (MemoryStream mem = new MemoryStream(data))
|
|
|
|
|
{
|
|
|
|
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
|
|
|
|
{
|
2016-03-12 02:52:34 -05:00
|
|
|
|
binWriter.Write((UInt64)uniqueId);
|
2016-02-21 14:06:23 -05:00
|
|
|
|
binWriter.Write((Int32)quantity);
|
|
|
|
|
binWriter.Write((UInt32)itemId);
|
|
|
|
|
binWriter.Write((UInt16)slot);
|
|
|
|
|
|
2016-03-12 02:52:34 -05:00
|
|
|
|
binWriter.Write((UInt16)0x0001);
|
2016-02-21 14:06:23 -05:00
|
|
|
|
binWriter.Write((UInt32)0x00000000);
|
|
|
|
|
binWriter.Write((UInt32)0x00000000);
|
|
|
|
|
binWriter.Write((UInt32)0x00000000);
|
|
|
|
|
|
2016-02-21 21:44:11 -05:00
|
|
|
|
binWriter.Write((UInt32)itemType);
|
2016-02-21 14:06:23 -05:00
|
|
|
|
|
|
|
|
|
binWriter.Write((UInt32)0x00000000);
|
|
|
|
|
|
|
|
|
|
binWriter.Write((byte)quality);
|
|
|
|
|
binWriter.Write((byte)0x01);
|
|
|
|
|
binWriter.Write((uint)durability);
|
|
|
|
|
|
|
|
|
|
binWriter.BaseStream.Seek(0x10-0x06, SeekOrigin.Current);
|
|
|
|
|
|
|
|
|
|
binWriter.Write((byte)0x01);
|
|
|
|
|
binWriter.Write((byte)0x01);
|
|
|
|
|
binWriter.Write((byte)0x01);
|
|
|
|
|
binWriter.Write((byte)0x01);
|
|
|
|
|
|
|
|
|
|
binWriter.BaseStream.Seek(0x10, SeekOrigin.Current);
|
|
|
|
|
|
|
|
|
|
binWriter.Write((ushort)spiritbind);
|
|
|
|
|
|
|
|
|
|
binWriter.Write((byte)materia1);
|
|
|
|
|
binWriter.Write((byte)materia2);
|
|
|
|
|
binWriter.Write((byte)materia3);
|
|
|
|
|
binWriter.Write((byte)materia4);
|
|
|
|
|
binWriter.Write((byte)materia5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|