mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +02:00
Implemented mode trade methods. Figured out the modifiers portion of the item packet and rewrote how they are stored.
This commit is contained in:
parent
94491903f7
commit
59e3b2379a
6 changed files with 300 additions and 116 deletions
|
@ -10,17 +10,94 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||
public int quantity = 1;
|
||||
public ushort slot;
|
||||
|
||||
public byte itemType;
|
||||
public uint dealingAttached1 = 0;
|
||||
public uint dealingAttached2 = 0;
|
||||
public uint dealingAttached3 = 0;
|
||||
|
||||
public byte[] tags = new byte[4];
|
||||
public byte[] tagValues = new byte[4];
|
||||
|
||||
public byte quality = 1;
|
||||
|
||||
public int durability = 0;
|
||||
public ushort spiritbind = 0;
|
||||
public ItemModifier modifiers;
|
||||
|
||||
public byte materia1 = 0;
|
||||
public byte materia2 = 0;
|
||||
public byte materia3 = 0;
|
||||
public byte materia4 = 0;
|
||||
public byte materia5 = 0;
|
||||
public class ItemModifier
|
||||
{
|
||||
public uint durability;
|
||||
public ushort use = 0;
|
||||
public uint materiaId = 0;
|
||||
public uint materiaLife = 0;
|
||||
public byte mainQuality;
|
||||
public byte[] subQuality = new byte[3];
|
||||
public uint polish;
|
||||
public uint param1;
|
||||
public uint param2;
|
||||
public uint param3;
|
||||
public ushort spiritbind;
|
||||
public byte[] materiaType = new byte[5];
|
||||
public byte[] materiaGrade = new byte[5];
|
||||
|
||||
public ItemModifier()
|
||||
{
|
||||
}
|
||||
|
||||
public ItemModifier(MySql.Data.MySqlClient.MySqlDataReader reader)
|
||||
{
|
||||
durability = reader.GetUInt32("durability");
|
||||
mainQuality = reader.GetByte("mainQuality");
|
||||
subQuality[0] = reader.GetByte("subQuality1");
|
||||
subQuality[1] = reader.GetByte("subQuality2");
|
||||
subQuality[2] = reader.GetByte("subQuality3");
|
||||
param1 = reader.GetUInt32("param1");
|
||||
param2 = reader.GetUInt32("param2");
|
||||
param3 = reader.GetUInt32("param3");
|
||||
spiritbind = reader.GetUInt16("spiritbind");
|
||||
|
||||
ushort materia1 = reader.GetUInt16("materia1");
|
||||
ushort materia2 = reader.GetUInt16("materia2");
|
||||
ushort materia3 = reader.GetUInt16("materia3");
|
||||
ushort materia4 = reader.GetUInt16("materia4");
|
||||
ushort materia5 = reader.GetUInt16("materia5");
|
||||
|
||||
materiaType[0] = (byte)(materia1 & 0xFF);
|
||||
materiaGrade[0] = (byte)((materia1 >> 8) & 0xFF);
|
||||
materiaType[1] = (byte)(materia2 & 0xFF);
|
||||
materiaGrade[1] = (byte)((materia2 >> 8) & 0xFF);
|
||||
materiaType[2] = (byte)(materia3 & 0xFF);
|
||||
materiaGrade[2] = (byte)((materia3 >> 8) & 0xFF);
|
||||
materiaType[3] = (byte)(materia4 & 0xFF);
|
||||
materiaGrade[3] = (byte)((materia4 >> 8) & 0xFF);
|
||||
materiaType[4] = (byte)(materia5 & 0xFF);
|
||||
materiaGrade[4] = (byte)((materia5 >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
public void WriteBytes(BinaryWriter binWriter)
|
||||
{
|
||||
binWriter.Write((UInt32) durability);
|
||||
binWriter.Write((UInt16) use);
|
||||
binWriter.Write((UInt32) materiaId);
|
||||
binWriter.Write((UInt32) materiaLife);
|
||||
binWriter.Write((Byte) mainQuality);
|
||||
binWriter.Write((Byte) subQuality[0]);
|
||||
binWriter.Write((Byte) subQuality[1]);
|
||||
binWriter.Write((Byte) subQuality[2]);
|
||||
binWriter.Write((UInt32) polish);
|
||||
binWriter.Write((UInt32) param1);
|
||||
binWriter.Write((UInt32) param2);
|
||||
binWriter.Write((UInt32) param3);
|
||||
binWriter.Write((UInt16) spiritbind);
|
||||
binWriter.Write((Byte) materiaType[0]);
|
||||
binWriter.Write((Byte) materiaType[1]);
|
||||
binWriter.Write((Byte) materiaType[2]);
|
||||
binWriter.Write((Byte) materiaType[3]);
|
||||
binWriter.Write((Byte) materiaType[4]);
|
||||
binWriter.Write((Byte) materiaGrade[0]);
|
||||
binWriter.Write((Byte) materiaGrade[1]);
|
||||
binWriter.Write((Byte) materiaGrade[2]);
|
||||
binWriter.Write((Byte) materiaGrade[3]);
|
||||
binWriter.Write((Byte) materiaGrade[4]);
|
||||
}
|
||||
}
|
||||
|
||||
//Bare Minimum
|
||||
public InventoryItem(uint id, uint itemId)
|
||||
|
@ -30,7 +107,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||
this.quantity = 1;
|
||||
|
||||
ItemData gItem = Server.GetItemGamedata(itemId);
|
||||
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
||||
tags[1] = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
||||
}
|
||||
|
||||
//For check command
|
||||
|
@ -41,33 +118,27 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||
this.quantity = item.quantity;
|
||||
this.slot = equipSlot;
|
||||
|
||||
this.itemType = item.itemType;
|
||||
this.tags = item.tags;
|
||||
this.tagValues = item.tagValues;
|
||||
|
||||
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;
|
||||
this.modifiers = item.modifiers;
|
||||
}
|
||||
|
||||
public InventoryItem(uint uniqueId, uint itemId, int quantity, byte itemType, byte qualityNumber, int durability, ushort spiritbind, byte materia1, byte materia2, byte materia3, byte materia4, byte materia5)
|
||||
public InventoryItem(uint uniqueId, uint itemId, int quantity, byte[] tags, byte[] tagValues, byte qualityNumber, ItemModifier modifiers = null)
|
||||
{
|
||||
this.uniqueId = uniqueId;
|
||||
this.itemId = itemId;
|
||||
this.quantity = quantity;
|
||||
this.itemType = itemType;
|
||||
|
||||
if (tags != null)
|
||||
this.tags = tags;
|
||||
if (tagValues != null)
|
||||
this.tagValues = tagValues;
|
||||
|
||||
this.quality = qualityNumber;
|
||||
this.durability = durability;
|
||||
this.spiritbind = spiritbind;
|
||||
this.materia1 = materia1;
|
||||
this.materia2 = materia2;
|
||||
this.materia3 = materia3;
|
||||
this.materia4 = materia4;
|
||||
this.materia5 = materia5;
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
public byte[] ToPacketBytes()
|
||||
|
@ -83,35 +154,25 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||
binWriter.Write((UInt32)itemId);
|
||||
binWriter.Write((UInt16)slot);
|
||||
|
||||
binWriter.Write((UInt16)0x0001);
|
||||
binWriter.Write((UInt32)0x00000000);
|
||||
binWriter.Write((UInt32)0x00000000);
|
||||
binWriter.Write((UInt32)0x00000000);
|
||||
binWriter.Write((Byte)0x01);
|
||||
binWriter.Write((Byte)0x00);
|
||||
|
||||
binWriter.Write((UInt32)itemType);
|
||||
binWriter.Write((UInt32)dealingAttached1);
|
||||
binWriter.Write((UInt32)dealingAttached2);
|
||||
binWriter.Write((UInt32)dealingAttached3);
|
||||
|
||||
binWriter.Write((UInt32)0x00000000);
|
||||
for (int i = 0; i < tags.Length; i++)
|
||||
binWriter.Write((Byte) tags[i]);
|
||||
for (int i = 0; i < tagValues.Length; i++)
|
||||
binWriter.Write((Byte) tagValues[i]);
|
||||
|
||||
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);
|
||||
binWriter.Write((Byte)quality);
|
||||
|
||||
if (modifiers != null)
|
||||
{
|
||||
binWriter.Write((Byte)0x01);
|
||||
modifiers.WriteBytes(binWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue