1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-21 04:07:48 +00:00

Added the two new datatypes to get the inventory commands to parse properly.

This commit is contained in:
Filip Maj 2016-02-13 16:33:33 -05:00
parent 69b34fdce7
commit 1f3cd8eaf3
5 changed files with 93 additions and 15 deletions

View file

@ -509,7 +509,7 @@ namespace FFXIVClassic_Lobby_Server
uint uniqueId = reader.GetUInt32(0); uint uniqueId = reader.GetUInt32(0);
uint itemId = reader.GetUInt32(1); uint itemId = reader.GetUInt32(1);
int quantity = reader.GetInt32(2); int quantity = reader.GetInt32(2);
uint slot = reader.GetUInt32(3); ushort slot = reader.GetUInt16(3);
bool isUntradeable = reader.GetBoolean(4); bool isUntradeable = reader.GetBoolean(4);
byte qualityNumber = reader.GetByte(5); byte qualityNumber = reader.GetByte(5);
@ -576,7 +576,7 @@ namespace FFXIVClassic_Lobby_Server
cmd.Parameters.AddWithValue("@durability", durability); cmd.Parameters.AddWithValue("@durability", durability);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
insertedItem = new Item((uint)cmd.LastInsertedId, itemId, quantity, (uint)player.inventories[type].getNextEmptySlot(), isUntradeable, quality, durability, 0, 0, 0, 0, 0, 0); insertedItem = new Item((uint)cmd.LastInsertedId, itemId, quantity, (ushort)player.inventories[type].getNextEmptySlot(), isUntradeable, quality, durability, 0, 0, 0, 0, 0, 0);
} }
catch (MySqlException e) catch (MySqlException e)
{ Console.WriteLine(e); } { Console.WriteLine(e); }

View file

@ -431,14 +431,15 @@ namespace FFXIVClassic_Map_Server.Actors
queuePacket(InventoryBeginChangePacket.buildPacket(actorId)); queuePacket(InventoryBeginChangePacket.buildPacket(actorId));
inventories[Inventory.NORMAL].sendFullInventory(); inventories[Inventory.NORMAL].sendFullInventory();
inventories[Inventory.CURRANCY].sendFullInventory();
#region equipsetup #region equipsetup
EquipmentListX08Packet initialEqupmentPacket = new EquipmentListX08Packet(); // EquipmentListX08Packet initialEqupmentPacket = new EquipmentListX08Packet();
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_BODY, 5); // initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_BODY, 5);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_HEAD, 3); // initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_HEAD, 3);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_UNDERSHIRT, 6); // initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_UNDERSHIRT, 6);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_UNDERGARMENT, 7); // initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_UNDERGARMENT, 7);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_MAINHAND, 2); // initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_MAINHAND, 2);
initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_LEGS, 8); // initialEqupmentPacket.setItem(EquipmentListX08Packet.SLOT_LEGS, 8);
//Equip Init //Equip Init
// playerSession.queuePacket(InventorySetBeginPacket.buildPacket(actorId, 0x23, InventorySetBeginPacket.CODE_EQUIPMENT), true, false); // playerSession.queuePacket(InventorySetBeginPacket.buildPacket(actorId, 0x23, InventorySetBeginPacket.CODE_EQUIPMENT), true, false);

View file

@ -67,6 +67,18 @@ namespace FFXIVClassic_Lobby_Server.common
return unixTimeStamp; return unixTimeStamp;
} }
public static ulong swapEndian(ulong input)
{
return ((0x00000000000000FF) & (input >> 56) |
(0x000000000000FF00) & (input >> 40) |
(0x0000000000FF0000) & (input >> 24) |
(0x00000000FF000000) & (input >> 8) |
(0x000000FF00000000) & (input << 8) |
(0x0000FF0000000000) & (input << 24) |
(0x00FF000000000000) & (input << 40) |
(0xFF00000000000000) & (input << 56));
}
public static uint swapEndian(uint input) public static uint swapEndian(uint input)
{ {
return ((input >> 24) & 0xff) | return ((input >> 24) & 0xff) |

View file

@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public uint uniqueId; public uint uniqueId;
public uint itemId; public uint itemId;
public int quantity = 1; public int quantity = 1;
public uint slot; public ushort slot;
public bool isUntradeable = false; public bool isUntradeable = false;
public byte quality = 1; public byte quality = 1;
@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public byte materia5 = 0; public byte materia5 = 0;
//Bare Minimum //Bare Minimum
public Item(uint id, uint itemId, uint slot) public Item(uint id, uint itemId, ushort slot)
{ {
this.uniqueId = id; this.uniqueId = id;
this.itemId = itemId; this.itemId = itemId;
@ -35,7 +35,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
this.slot = slot; this.slot = slot;
} }
public Item(uint uniqueId, uint itemId, int quantity, uint slot, bool isUntradeable, byte qualityNumber, uint durability, ushort spiritbind, byte materia1, byte materia2, byte materia3, byte materia4, byte materia5) public Item(uint uniqueId, uint itemId, int quantity, ushort slot, bool isUntradeable, byte qualityNumber, uint durability, ushort spiritbind, byte materia1, byte materia2, byte materia3, byte materia4, byte materia5)
{ {
this.uniqueId = uniqueId; this.uniqueId = uniqueId;
this.itemId = itemId; this.itemId = itemId;
@ -64,8 +64,9 @@ namespace FFXIVClassic_Map_Server.dataobjects
binWriter.Write((UInt32)0x00000000); binWriter.Write((UInt32)0x00000000);
binWriter.Write((Int32)quantity); binWriter.Write((Int32)quantity);
binWriter.Write((UInt32)itemId); binWriter.Write((UInt32)itemId);
binWriter.Write((UInt32)slot); binWriter.Write((UInt16)slot);
binWriter.Write((UInt16)0x0000);
binWriter.Write((UInt32)0x00000000); binWriter.Write((UInt32)0x00000000);
binWriter.Write((UInt32)0x00000000); binWriter.Write((UInt32)0x00000000);
binWriter.Write((UInt32)0x00000000); binWriter.Write((UInt32)0x00000000);

View file

@ -15,6 +15,22 @@ namespace FFXIVClassic_Map_Server
class LuaUtils class LuaUtils
{ {
public class Type7Param
{
public uint actorId;
public byte unknown;
public byte slot;
public byte inventoryType;
public Type7Param(uint actorId, byte unknown, byte slot, byte inventoryType)
{
this.actorId = actorId;
this.unknown = unknown;
this.slot = slot;
this.inventoryType = inventoryType;
}
}
public static List<LuaParam> readLuaParams(BinaryReader reader) public static List<LuaParam> readLuaParams(BinaryReader reader)
{ {
List<LuaParam> luaParams = new List<LuaParam>(); List<LuaParam> luaParams = new List<LuaParam>();
@ -56,6 +72,17 @@ namespace FFXIVClassic_Map_Server
case 0x6: //Actor (By Id) case 0x6: //Actor (By Id)
value = Utils.swapEndian(reader.ReadUInt32()); value = Utils.swapEndian(reader.ReadUInt32());
break; break;
case 0x7: //Weird one used for inventory
uint type7ActorId = Utils.swapEndian(reader.ReadUInt32());
byte type7Unknown = reader.ReadByte();
byte type7Slot = reader.ReadByte();
byte type7InventoryType = reader.ReadByte();
value = new Type7Param(type7ActorId, type7Unknown, type7Slot, type7InventoryType);
break;
case 0x9: //Two Longs (only storing first one)
value = Utils.swapEndian(reader.ReadUInt64());
reader.ReadUInt64();
break;
case 0xC: //Byte case 0xC: //Byte
value = reader.ReadByte(); value = reader.ReadByte();
break; break;
@ -106,6 +133,17 @@ namespace FFXIVClassic_Map_Server
case 0x6: //Actor (By Id) case 0x6: //Actor (By Id)
writer.Write((UInt32)Utils.swapEndian((UInt32)l.value)); writer.Write((UInt32)Utils.swapEndian((UInt32)l.value));
break; break;
case 0x7: //Weird one used for inventory
Type7Param type7 = (Type7Param)l.value;
writer.Write((UInt32)Utils.swapEndian((UInt32)type7.actorId));
writer.Write((Byte)type7.unknown);
writer.Write((Byte)type7.slot);
writer.Write((Byte)type7.inventoryType);
break;
case 0x9: //Two Longs (only storing first one)
writer.Write((UInt64)Utils.swapEndian((UInt64)l.value));
writer.Write((UInt64)0);
break;
case 0xC: //Byte case 0xC: //Byte
writer.Write((Byte)l.value); writer.Write((Byte)l.value);
break; break;
@ -165,6 +203,17 @@ namespace FFXIVClassic_Map_Server
case 0x6: //Actor (By Id) case 0x6: //Actor (By Id)
value = Utils.swapEndian(reader.ReadUInt32()); value = Utils.swapEndian(reader.ReadUInt32());
break; break;
case 0x7: //Weird one used for inventory
uint type7ActorId = Utils.swapEndian(reader.ReadUInt32());
byte type7Unknown = reader.ReadByte();
byte type7Slot = reader.ReadByte();
byte type7InventoryType = reader.ReadByte();
value = new Type7Param(type7ActorId, type7Unknown, type7Slot, type7InventoryType);
break;
case 0x9: //Two Longs (only storing first one)
value = Utils.swapEndian(reader.ReadUInt64());
reader.ReadUInt64();
break;
case 0xC: //Byte case 0xC: //Byte
value = reader.ReadByte(); value = reader.ReadByte();
break; break;
@ -290,6 +339,14 @@ namespace FFXIVClassic_Map_Server
{ {
luaParams.Add(new LuaParam(0x6, ((Actor)o).actorId)); luaParams.Add(new LuaParam(0x6, ((Actor)o).actorId));
} }
else if (o is Type7Param)
{
luaParams.Add(new LuaParam(0x7, (Type7Param)o));
}
else if (o is ulong)
{
luaParams.Add(new LuaParam(0x9, (ulong)o));
}
else if (o is byte) else if (o is byte)
{ {
luaParams.Add(new LuaParam(0xC, (byte)o)); luaParams.Add(new LuaParam(0xC, (byte)o));
@ -338,9 +395,16 @@ namespace FFXIVClassic_Map_Server
case 0x6: //Actor (By Id) case 0x6: //Actor (By Id)
dumpString += String.Format("0x{0:X}", (uint)lParams[i].value); dumpString += String.Format("0x{0:X}", (uint)lParams[i].value);
break; break;
case 0x7: //Weird one used for inventory
Type7Param type7Param = ((Type7Param)lParams[i].value);
dumpString += String.Format("Type7 Param: (0x{0:X}, 0x{1:X}, 0x{2:X}, 0x{3:X})", type7Param.actorId, type7Param.unknown, type7Param.slot, type7Param.inventoryType);
break;
case 0xC: //Byte case 0xC: //Byte
dumpString += String.Format("0x{0:X}", (byte)lParams[i].value); dumpString += String.Format("0x{0:X}", (byte)lParams[i].value);
break; break;
case 0x9: //Long (+ 8 bytes ignored)
dumpString += String.Format("0x{0:X}", (ulong)lParams[i].value);
break;
case 0x1B: //Short? case 0x1B: //Short?
dumpString += String.Format("0x{0:X}", (ushort)lParams[i].value); dumpString += String.Format("0x{0:X}", (ushort)lParams[i].value);
break; break;