diff --git a/Server/Protocol/Handlers/04-ObjectHandler/04-14-ObjectInteract.cs b/Server/Protocol/Handlers/04-ObjectHandler/04-14-ObjectInteract.cs index 9ef549a..f4f880e 100644 --- a/Server/Protocol/Handlers/04-ObjectHandler/04-14-ObjectInteract.cs +++ b/Server/Protocol/Handlers/04-ObjectHandler/04-14-ObjectInteract.cs @@ -80,7 +80,7 @@ namespace PSO2SERVER.Protocol.Handlers srcObj = null; } - //Logger.WriteInternal("[OBJ] {0} (ID {1}) <{2}> --> Ent {3} (ID {4})", srcObj.name, srcObj.Header.ID, command, (ObjectType)dstObject.ObjectType, dstObject.ID); + //Logger.WriteInternal("[OBJ] {0} (ID {1}) <{2}> --> Ent {3} (ID {4})", srcObj.name, srcObj.player.ID, command, (ObjectType)dstObject.ObjectType, dstObject.ID); // TODO: Delete this code and do this COMPLETELY correctly!!! if (pkt.Action == "Transfer" && context.CurrentMap.Name == "lobby") diff --git a/Server/Protocol/Packets/0E-PartyPacket/0E-02-PartyInitPacket.cs b/Server/Protocol/Packets/0E-PartyPacket/0E-02-PartyInitPacket.cs index 4affdf8..435bf00 100644 --- a/Server/Protocol/Packets/0E-PartyPacket/0E-02-PartyInitPacket.cs +++ b/Server/Protocol/Packets/0E-PartyPacket/0E-02-PartyInitPacket.cs @@ -94,7 +94,7 @@ namespace PSO2SERVER.Protocol.Packets // 队伍结构数据 for (int i = 0; i < players.Length; i++) { - entries[i].id = new ObjectHeader((uint)players[i].Account.AccountId, ObjectType.Player); // Header of player + entries[i].id = new ObjectHeader((uint)players[i].Account.AccountId, ObjectType.Player); // player of player entries[i].nickname = players[i].Account.Nickname; entries[i].char_name = players[i].Name; entries[i].level = (byte)players[i].Jobs.entries.hunter.level; @@ -150,7 +150,7 @@ namespace PSO2SERVER.Protocol.Packets //for(int i = 0; i < players.Length; i++) //{ // PartyEntry pe = new PartyEntry(); - // pkt.WriteStruct(new ObjectHeader((uint)players[i].Accounts.AccountId, ObjectType.Player)); // Header of player + // pkt.WriteStruct(new ObjectHeader((uint)players[i].Accounts.AccountId, ObjectType.Player)); // player of player // pkt.WriteUtf16(players[i].name, 0xD863, 0xA9); // pkt.WriteUtf16(players[i].Accounts.Nickname, 0xD863, 0xA9); // pkt.Write((byte)players[i].Jobs.entries.hunter.level); // Active class level @@ -175,7 +175,7 @@ namespace PSO2SERVER.Protocol.Packets //for(int i = 0; i < 4 - players.Length; i++) // Empty entries //{ - // pkt.WriteStruct(new ObjectHeader(0, 0)); // Header of player + // pkt.WriteStruct(new ObjectHeader(0, 0)); // player of player // pkt.WriteMagic(0, 0xD863, 0xA9); // pkt.WriteMagic(0, 0xD863, 0xA9); // pkt.Write((byte)0); // Active class level diff --git a/Server/Protocol/Packets/0F-ItemPacket/0F-21-EquipedWeaponPacket.cs b/Server/Protocol/Packets/0F-ItemPacket/0F-21-EquipedWeaponPacket.cs new file mode 100644 index 0000000..cb13c26 --- /dev/null +++ b/Server/Protocol/Packets/0F-ItemPacket/0F-21-EquipedWeaponPacket.cs @@ -0,0 +1,39 @@ +using PSO2SERVER.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace PSO2SERVER.Protocol.Packets +{ + public class EquipedWeaponPacket : Packet + { + /// Player changing the weapon. + public ObjectHeader player { get; set; } = new ObjectHeader(); + /// New weapon. + public PSO2Items Item { get; set; } = new PSO2Items(); + + public EquipedWeaponPacket(uint player_id, PSO2Items item) + { + player = new ObjectHeader(player_id, ObjectType.Player); + Item = item; + } + + #region implemented abstract members of Packet + + public override byte[] Build() + { + var pkt = new PacketWriter(); + pkt.WriteObjectHeader(player); + pkt.WriteStruct(Item); + return pkt.ToArray(); + } + + public override PacketHeader GetHeader() + { + return new PacketHeader(0x0F, 0x21, PacketFlags.None); + } + + #endregion + } +} \ No newline at end of file diff --git a/Server/Protocol/Packets/0F-ItemPacket/0F-22-UpdateStoragePacket.cs b/Server/Protocol/Packets/0F-ItemPacket/0F-22-UpdateStoragePacket.cs new file mode 100644 index 0000000..a32bd37 --- /dev/null +++ b/Server/Protocol/Packets/0F-ItemPacket/0F-22-UpdateStoragePacket.cs @@ -0,0 +1,56 @@ +using PSO2SERVER.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace PSO2SERVER.Protocol.Packets +{ + public class UpdateStoragePacket : Packet + { + // Unk field (can be a list of UpdatedStorageItem) + public List Unk { get; set; } + + // Already existing items being updated + public List Updated { get; set; } + + // New items added + public List NewItems { get; set; } + + // Additional unknown fields (uint and ulong) + public uint Unk2 { get; set; } + public ulong Unk3 { get; set; } + + public UpdateStoragePacket(List unk, List updated, List newItems, uint unk2, ulong unk3) + { + Unk = unk; + Updated = updated; + NewItems = newItems; + Unk2 = unk2; + Unk3 = unk3; + } + + #region implemented abstract members of Packet + + public override byte[] Build() + { + var pkt = new PacketWriter(); + pkt.WriteMagic(Unk.Count, 0x4DC2, 0x2A); + foreach(var u in Unk) { pkt.WriteStruct(u); } + pkt.WriteMagic(Updated.Count, 0x4DC2, 0x2A); + foreach (var u in Updated) { pkt.WriteStruct(u); } + pkt.WriteMagic(NewItems.Count, 0x4DC2, 0x2A); + foreach (var u in NewItems) { pkt.WriteStruct(u); } + pkt.Write(Unk2); + pkt.Write(Unk3); + return pkt.ToArray(); + } + + public override PacketHeader GetHeader() + { + return new PacketHeader(0x0F, 0x22, PacketFlags.PACKED); + } + + #endregion + } +} \ No newline at end of file diff --git a/Server/Server.csproj b/Server/Server.csproj index b1ee86d..6447754 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -422,6 +422,8 @@ + +