SCHALE.GameServer/SCHALE.Common/NetworkProtocol/Packet.cs

65 lines
2.0 KiB
C#
Raw Normal View History

2024-04-25 03:50:09 +00:00
using SCHALE.Common.Database;
using SCHALE.Common.FlatData;
2024-04-20 05:24:36 +00:00
namespace SCHALE.Common.NetworkProtocol
2024-04-18 07:12:10 +00:00
{
public class SessionKey
{
public long AccountServerId { get; set; }
public required string MxToken { get; set; }
}
public abstract class BasePacket
{
public SessionKey? SessionKey { get; set; }
public abstract Protocol Protocol { get; }
public long AccountId => SessionKey?.AccountServerId ?? 0;
}
public abstract class RequestPacket : BasePacket
{
private static int _counter;
public int ClientUpTime { get; set; }
public bool Resendable { get; set; } = true;
public long Hash { get; set; }
public bool IsTest { get; set; }
public DateTime? ModifiedServerTime__DebugOnly { get; set; }
public static long CreateHash(Protocol protocol)
{
return _counter++ | ((int)protocol << 32);
}
}
2024-04-20 05:24:36 +00:00
// TODO: Fix properties
2024-04-18 07:12:10 +00:00
public abstract class ResponsePacket : BasePacket
{
2024-04-20 05:24:36 +00:00
public long ServerTimeTicks { get; set; } = DateTimeOffset.Now.Ticks;
2024-04-18 07:12:10 +00:00
public ServerNotificationFlag ServerNotification { get; set; }
2024-04-25 03:50:09 +00:00
public List<MissionProgressDB> MissionProgressDBs { get; set; }
public Dictionary<long, List<MissionProgressDB>> EventMissionProgressDBDict { get; set; }
2024-04-28 01:41:38 +00:00
public Dictionary<OpenConditionContent, OpenConditionLockReason> StaticOpenConditions { get; set; }
2024-04-18 07:12:10 +00:00
}
[Flags]
public enum ServerNotificationFlag
{
None = 0,
NewMailArrived = 4,
HasUnreadMail = 8,
NewToastDetected = 16,
CanReceiveArenaDailyReward = 32,
CanReceiveRaidReward = 64,
ServerMaintenance = 256,
CannotReceiveMail = 512,
InventoryFullRewardMail = 1024,
CanReceiveClanAttendanceReward = 2048,
HasClanApplicant = 4096,
HasFriendRequest = 8192,
CheckConquest = 16384,
CanReceiveEliminateRaidReward = 32768,
CanReceiveMultiFloorRaidReward = 65536
}
}