diff --git a/Server/Models/Mission.cs b/Server/Models/Mission.cs index adab830..a7e794a 100644 --- a/Server/Models/Mission.cs +++ b/Server/Models/Mission.cs @@ -35,4 +35,44 @@ namespace PSO2SERVER.Models public uint Unk14; public uint Unk15; } + + public struct MissionPassItem + { + /// Reward ID (?). + public uint Id { get; set; } + + /// Reward tier. + public uint Tier { get; set; } + + /// Gold pass only flag. + public uint IsGold { get; set; } + + public uint Unk4 { get; set; } + + /// Group ID. + public uint Group { get; set; } + + public uint Unk6 { get; set; } + + public uint Unk7 { get; set; } + + public uint Unk8 { get; set; } + + /// Item data. + public PSO2Items Item { get; set; } + + // Constructor for struct + public MissionPassItem(uint id, uint tier, uint isGold, uint unk4, uint group, uint unk6, uint unk7, uint unk8, PSO2Items item) + { + Id = id; + Tier = tier; + IsGold = isGold; + Unk4 = unk4; + Group = group; + Unk6 = unk6; + Unk7 = unk7; + Unk8 = unk8; + Item = item; + } + } } diff --git a/Server/Protocol/Handlers/1A-MailHandler/1A-00-MailListRequest.cs b/Server/Protocol/Handlers/1A-MailHandler/1A-00-MailListRequest.cs index ee6c6d4..f13cd6b 100644 --- a/Server/Protocol/Handlers/1A-MailHandler/1A-00-MailListRequest.cs +++ b/Server/Protocol/Handlers/1A-MailHandler/1A-00-MailListRequest.cs @@ -27,10 +27,10 @@ namespace PSO2SERVER.Protocol.Handlers List Headers = new List { - new MailHeader(1234, 5678, 1001, new byte[0x14], 1111, 2222, TimeSpan.FromDays(1), 3333, "SenderName", "MailSubject") + new MailHeader(1, 0, (uint)context._account.AccountId, new byte[0x14], 0, 0, TimeSpan.FromDays(1), 0, context.Character.Name, "MailSubject") }; - MailListPacket packet = new MailListPacket(1, 2, 3, 4, new byte[0x4], 100, "PlayerName", "CharacterName", Headers); + MailListPacket packet = new MailListPacket(1, 2, 3, 4, new byte[0x4], 100, context.Character.Name, context._account.Nickname, Headers); context.SendPacket(packet); } diff --git a/Server/Protocol/Handlers/1A-MailHandler/1A-06-MailBodyRequest.cs b/Server/Protocol/Handlers/1A-MailHandler/1A-06-MailBodyRequest.cs new file mode 100644 index 0000000..c520a01 --- /dev/null +++ b/Server/Protocol/Handlers/1A-MailHandler/1A-06-MailBodyRequest.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using PSO2SERVER.Models; +using PSO2SERVER.Protocol.Packets; + +namespace PSO2SERVER.Protocol.Handlers +{ + [PacketHandlerAttr(0x1A, 0x06)] + public class MailBodyRequest : PacketHandler + { + public struct MailBodyRequestPacket + { + public MailId id; + } + + public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size) + { + var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length); + Logger.WriteHex(info, data); + + var reader = new PacketReader(data, position, size); + var pkt = reader.ReadStruct(); + + Logger.WriteObj(pkt); + + context.SendPacket(new MailBodyPacket(pkt.id, "????", 0)); + } + } +} diff --git a/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-00-MissionPassInfoRequest.cs b/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-00-MissionPassInfoRequest.cs index 197e7fa..3a9ccd7 100644 --- a/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-00-MissionPassInfoRequest.cs +++ b/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-00-MissionPassInfoRequest.cs @@ -15,9 +15,7 @@ namespace PSO2SERVER.Protocol.Handlers var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length); Logger.WriteHex(info, data); - //Mission mission = new Mission(); - - //context.SendPacket(new ARKSMissionListPacket(mission)); + context.SendPacket(new MissionPassInfoPacket()); } } } diff --git a/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-02-MissionPassRequest.cs b/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-02-MissionPassRequest.cs index e884cf8..1411266 100644 --- a/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-02-MissionPassRequest.cs +++ b/Server/Protocol/Handlers/4D-ClassicMissionPassHandler/4D-02-MissionPassRequest.cs @@ -15,9 +15,7 @@ namespace PSO2SERVER.Protocol.Handlers var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length); Logger.WriteHex(info, data); - //Mission mission = new Mission(); - - //context.SendPacket(new ARKSMissionListPacket(mission)); + context.SendPacket(new MissionPassPacket()); } } } diff --git a/Server/Protocol/Packets/1A-MailPacket/1A-07-MailBodyPacket.cs b/Server/Protocol/Packets/1A-MailPacket/1A-07-MailBodyPacket.cs index 68f4688..25e429e 100644 --- a/Server/Protocol/Packets/1A-MailPacket/1A-07-MailBodyPacket.cs +++ b/Server/Protocol/Packets/1A-MailPacket/1A-07-MailBodyPacket.cs @@ -8,9 +8,20 @@ namespace PSO2SERVER.Protocol.Packets { public class MailBodyPacket : Packet { + public MailId Id { get; set; } = new MailId(); + public string Messaga { get; set; } = string.Empty; + public uint Unk3 { get; set; } = 0; public MailBodyPacket() { + Id = new MailId(); + } + + public MailBodyPacket(MailId id, string messaga, uint unk3) + { + Id = id; + Messaga = messaga; + Unk3 = unk3; } #region implemented abstract members of Packet @@ -18,12 +29,15 @@ namespace PSO2SERVER.Protocol.Packets public override byte[] Build() { var pkt = new PacketWriter(); + pkt.WriteStruct(Id); + pkt.WriteUtf16(Messaga, 0x5913, 0x82); + pkt.Write(Unk3); return pkt.ToArray(); } public override PacketHeader GetHeader() { - return new PacketHeader(0x1A, 0x07, PacketFlags.None); + return new PacketHeader(0x1A, 0x07, PacketFlags.PACKED); } #endregion diff --git a/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-01-MissionPassInfoPacket.cs b/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-01-MissionPassInfoPacket.cs index c4a253a..3abf9ca 100644 --- a/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-01-MissionPassInfoPacket.cs +++ b/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-01-MissionPassInfoPacket.cs @@ -8,9 +8,11 @@ namespace PSO2SERVER.Protocol.Packets { public class MissionPassInfoPacket : Packet { + public FixedList unk { get; set; } = new FixedList(0x2F); public MissionPassInfoPacket() { + unk = new FixedList(0x2F); } #region implemented abstract members of Packet @@ -18,6 +20,7 @@ namespace PSO2SERVER.Protocol.Packets public override byte[] Build() { var pkt = new PacketWriter(); + pkt.WriteList(unk); return pkt.ToArray(); } diff --git a/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-03-MissionPassPacket.cs b/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-03-MissionPassPacket.cs index a3f5106..38a5307 100644 --- a/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-03-MissionPassPacket.cs +++ b/Server/Protocol/Packets/4D-ClassicMissionPassPacket/4D-03-MissionPassPacket.cs @@ -8,16 +8,165 @@ namespace PSO2SERVER.Protocol.Packets { public class MissionPassPacket : Packet { + public uint Unk1 { get; set; } + // Ongoing season ID. + public uint CurSeasonId { get; set; } + + // Ongoing season name. + public string CurSeason { get; set; } + + // Stars required to advance to the next tier. + public uint StarsPerTier { get; set; } + + // Regular tier count. + public uint Tiers { get; set; } + + // Overrun tier count. + public uint OverrunTiers { get; set; } + + // Total tier count. + public uint TotalTiers { get; set; } + + // Pass start timestamp. + public uint StartDate { get; set; } + + // Pass end timestamp. + public uint EndDate { get; set; } + + // Catchup period start timestamp. + public uint CatchupStart { get; set; } + + public uint Unk11 { get; set; } + + // Banner ID for the ongoing season. + public string CurBanner { get; set; } + + // SG price per tier. + public uint PricePerTier { get; set; } + + // SG price for gold pass. + public uint GoldPassPrice { get; set; } + + // Mission Pass rewards. + public List CurItems { get; set; } + + // Previous season ID. + public uint LastSeasonId { get; set; } + + // Previous season name. + public string LastSeason { get; set; } + + // Stars required to advance to the next tier (previous season). + public uint LastStarsPerTier { get; set; } + + // Regular tier count (previous season). + public uint LastTiers { get; set; } + + // Overrun tier count (previous season). + public uint LastOverrunTiers { get; set; } + + // Total tier count (previous season). + public uint LastTotalTiers { get; set; } + + // Pass start timestamp (previous season). + public uint LastStartDate { get; set; } + + // Pass end timestamp (previous season). + public uint LastEndDate { get; set; } + + // Catchup period start timestamp (previous season). + public uint LastCatchupStart { get; set; } + + // Catchup period end timestamp (previous season). + public uint LastCatchupEnd { get; set; } + + // Banner ID for the previous season. + public string LastBanner { get; set; } + + // SG price per tier (previous season). + public uint LastPricePerTier { get; set; } + + // SG price for gold pass (previous season). + public uint LastGoldPassPrice { get; set; } + + // Mission Pass rewards (previous season). + public List LastItems { get; set; } + + public uint Unk30 { get; set; } + + public uint Unk31 { get; set; } + + // Default constructor public MissionPassPacket() { + CurItems = new List(); + LastItems = new List(); } + #region implemented abstract members of Packet public override byte[] Build() { var pkt = new PacketWriter(); + pkt.Write(Unk1); + pkt.Write(CurSeasonId); + pkt.WriteUtf16(CurSeason, 0xB0C, 0x35); + // Stars required to advance to the next tier. + pkt.Write(StarsPerTier); + // Regular tier count. + pkt.Write(Tiers); + // Overrun tier count. + pkt.Write(OverrunTiers); + // Total tier count. + pkt.Write(TotalTiers); + // Pass start timestamp. + pkt.Write(StartDate); + // Pass end timestamp. + pkt.Write(EndDate); + // Catchup period start timestamp. + pkt.Write(CatchupStart); + pkt.Write(Unk11); + // Banner ID for the ongoing season. + pkt.WriteUtf16(CurBanner, 0xB0C, 0x35); + // SG price per tier. + pkt.Write(PricePerTier); + // SG price for gold pass. + pkt.Write(GoldPassPrice); + + // Write CurItems count and each item + pkt.WriteMagic(CurItems.Count, 0xB0C, 0x35); + foreach (var item in CurItems) + { + pkt.WriteStruct(item); + } + + // Write other properties + pkt.Write(LastSeasonId); + pkt.WriteUtf16(LastSeason, 0xB0C, 0x35); + pkt.Write(LastStarsPerTier); + pkt.Write(LastTiers); + pkt.Write(LastOverrunTiers); + pkt.Write(LastTotalTiers); + pkt.Write(LastStartDate); + pkt.Write(LastEndDate); + pkt.Write(LastCatchupStart); + pkt.Write(LastCatchupEnd); + pkt.WriteUtf16(LastBanner, 0xB0C, 0x35); + pkt.Write(LastPricePerTier); + pkt.Write(LastGoldPassPrice); + + // Write LastItems count and each item + pkt.WriteMagic(LastItems.Count, 0xB0C, 0x35); + foreach (var item in LastItems) + { + pkt.WriteStruct(item); + } + + // Write Unk30 and Unk31 + pkt.Write(Unk30); + pkt.Write(Unk31); return pkt.ToArray(); } diff --git a/Server/Server.csproj b/Server/Server.csproj index 5998040..db10fe8 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -353,6 +353,7 @@ +