PSO2SERVER/Server/Protocol/Packets/0B-QuestPacket/0B-16-QuestAvailablePacket.cs

224 lines
7.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PSO2SERVER.Models;
using System.Runtime.InteropServices;
using System.IO;
namespace PSO2SERVER.Protocol.Packets
{
public class QuestAvailablePacket : Packet
{
public ushort Unk1 { get; set; }
public ushort ExtremeCount { get; set; }
public ushort Unk2 { get; set; }
public ushort ArksCount { get; set; }
public ushort LimitedTimeCount { get; set; }
public ushort ExtremeDebugCount { get; set; }
public ushort Blank1Count { get; set; }
public ushort Unk3 { get; set; }
public ushort NetCafeCount { get; set; }
public ushort WarmingDebugCount { get; set; }
public ushort Blank2Count { get; set; }
public ushort AdvanceCount { get; set; }
public ushort ExpeditionCount { get; set; }
public ushort ExpeditionDebugCount { get; set; }
public ushort ArksDebugCount { get; set; }
public ushort Unk4Count { get; set; }
public ushort ChallengeCount { get; set; }
public ushort UrgentCount { get; set; }
public ushort UrgentDebugCount { get; set; }
public ushort TimeAttackCount { get; set; }
public ushort TimeAttackDebugCount { get; set; }
// Array of 9 ushort values (arks_debug2_count)
public ushort[] ArksDebug2Count { get; set; } = new ushort[9];
public ushort Blank3Count { get; set; }
public ushort Unk5 { get; set; }
public ushort RecommendedCount { get; set; }
public ushort Unk6 { get; set; }
public ushort UltimateDebugCount { get; set; }
public ushort AgpCount { get; set; }
public ushort BonusCount { get; set; }
public ushort Unk7 { get; set; }
// Array of 10 ushort values (training_count)
public ushort[] TrainingCount { get; set; } = new ushort[10];
public ushort TriggerCount { get; set; }
public ushort RidroidCount { get; set; }
public ushort NetCafeAgpCount { get; set; }
public ushort BattleBrokenCount { get; set; }
public ushort BusterDebugCount { get; set; }
public ushort Poka12Count { get; set; }
public ushort Unk8 { get; set; }
public ushort Unk9 { get; set; }
public ushort BusterCount { get; set; }
public ushort HeroTrainingCount { get; set; }
public ushort AmplifiedCount { get; set; }
public ushort Unk10 { get; set; }
public ushort Unk11 { get; set; }
public ushort DarkBlastTrainingCount { get; set; }
public ushort EndlessCount { get; set; }
public ushort Unk12 { get; set; }
public ushort Unk13 { get; set; }
public ushort PhantomTrainingCount { get; set; }
public ushort AisTrainingCount { get; set; }
public ushort Unk14 { get; set; }
public ushort DamageCalcCount { get; set; }
public ushort EtoileTrainingCount { get; set; }
public ushort DivideCount { get; set; }
// Unsure fields (stars1_count, stars2_count, stars3_count)
public ushort Stars1Count { get; set; }
public ushort Stars2Count { get; set; }
public ushort Stars3Count { get; set; }
// Array of 2 ushort values (unk15)
public ushort[] Unk15 { get; set; } = new ushort[2];
// NotOn attribute is specific to certain frameworks (e.g., Vita platform)
// You can use attributes like [Obsolete] in C# if needed
public ushort[] Unk16 { get; set; } = new ushort[2];
// AvailableQuestType values
public AvailableQuestType AvailableTypes { get; set; }
public AvailableQuestType Unk19 { get; set; }
// Round boost active flag
public uint RoundBoost { get; set; }
public uint Unk21 { get; set; }
// Constructor
public QuestAvailablePacket()
{
}
//public short[] amount = new short[Enum.GetValues(typeof(QuestType)).Length];
//AvailableQuestType available = AvailableQuestType.ARKS;
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.Write(Unk1);
writer.Write(ExtremeCount);
writer.Write(Unk2);
writer.Write(ArksCount);
writer.Write(LimitedTimeCount);
writer.Write(ExtremeDebugCount);
writer.Write(Blank1Count);
writer.Write(Unk3);
writer.Write(NetCafeCount);
writer.Write(WarmingDebugCount);
writer.Write(Blank2Count);
writer.Write(AdvanceCount);
writer.Write(ExpeditionCount);
writer.Write(ExpeditionDebugCount);
writer.Write(ArksDebugCount);
writer.Write(Unk4Count);
writer.Write(ChallengeCount);
writer.Write(UrgentCount);
writer.Write(UrgentDebugCount);
writer.Write(TimeAttackCount);
writer.Write(TimeAttackDebugCount);
// 写入 ArksDebug2Count 数组
foreach (var count in ArksDebug2Count)
{
writer.Write(count);
}
writer.Write(Blank3Count);
writer.Write(Unk5);
writer.Write(RecommendedCount);
writer.Write(Unk6);
writer.Write(UltimateDebugCount);
writer.Write(AgpCount);
writer.Write(BonusCount);
writer.Write(Unk7);
// 写入 TrainingCount 数组
foreach (var count in TrainingCount)
{
writer.Write(count);
}
writer.Write(TriggerCount);
writer.Write(RidroidCount);
writer.Write(NetCafeAgpCount);
writer.Write(BattleBrokenCount);
writer.Write(BusterDebugCount);
writer.Write(Poka12Count);
writer.Write(Unk8);
writer.Write(Unk9);
writer.Write(BusterCount);
writer.Write(HeroTrainingCount);
writer.Write(AmplifiedCount);
writer.Write(Unk10);
writer.Write(Unk11);
writer.Write(DarkBlastTrainingCount);
writer.Write(EndlessCount);
writer.Write(Unk12);
writer.Write(Unk13);
writer.Write(PhantomTrainingCount);
writer.Write(AisTrainingCount);
writer.Write(Unk14);
writer.Write(DamageCalcCount);
writer.Write(EtoileTrainingCount);
writer.Write(DivideCount);
writer.Write(Stars1Count);
writer.Write(Stars2Count);
writer.Write(Stars3Count);
// 写入 Unk15 数组
foreach (var count in Unk15)
{
writer.Write(count);
}
// 写入 Unk16 数组
foreach (var count in Unk16)
{
writer.Write(count);
}
// 写入 AvailableTypes 和 Unk19 (作为枚举类型,转换为整数)
writer.Write((ulong)AvailableTypes);
writer.Write((ulong)Unk19);
writer.Write(RoundBoost);
writer.Write(Unk21);
//// Filler/Padding?
//writer.Write((UInt16)0);
//// Amounts
//for (int i = 0; i < amount.Length; i++)
//{
// amount[i] = 1; // Just for testing
// writer.Write(amount[i]);
//}
//// Padding/Blank entries?
//for (int i = 0; i < 2; i++)
// writer.Write((int)0);
//// Available Bitfield
//writer.Write((UInt64)available);
//// Filler/Padding?
//for (int i = 0; i < 2; i++)
// writer.Write((int)0);
return writer.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x0B, 0x16, PacketFlags.None);
}
}
}