OrangeGuidanceTomestone/client/Message.cs

136 lines
4.2 KiB
C#
Raw Normal View History

2022-09-04 02:23:35 +00:00
using System.Numerics;
2022-09-03 23:45:16 +00:00
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace OrangeGuidanceTomestone;
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class Message {
public required Guid Id { get; init; }
public required float X { get; init; }
public required float Y { get; init; }
public required float Z { get; init; }
public required float Yaw { get; init; }
2022-09-03 23:45:16 +00:00
[JsonProperty("message")]
2024-07-22 07:44:30 +00:00
public required string Text { get; init; }
2022-09-04 02:23:35 +00:00
2024-07-22 07:44:30 +00:00
public required int PositiveVotes { get; set; }
public required int NegativeVotes { get; set; }
public required int UserVote { get; set; }
2022-09-04 02:23:35 +00:00
2024-07-22 07:44:30 +00:00
public required EmoteData? Emote { get; set; }
2024-07-22 07:44:30 +00:00
public required int Glyph { get; set; }
2022-09-06 04:24:32 +00:00
2022-09-04 02:23:35 +00:00
internal Vector3 Position => new(this.X, this.Y, this.Z);
2022-09-03 23:45:16 +00:00
}
2022-09-04 05:03:59 +00:00
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class MessageWithTerritory {
2022-09-04 05:03:59 +00:00
public Guid Id { get; init; }
public uint Territory { get; init; }
2023-02-20 02:41:17 +00:00
public uint? Ward { get; init; }
2023-02-20 03:13:29 +00:00
public uint? Plot { get; init; }
2023-02-20 04:52:04 +00:00
public uint? World { get; init; }
2022-09-04 05:03:59 +00:00
public float X { get; init; }
public float Y { get; init; }
public float Z { get; init; }
2022-09-04 21:02:13 +00:00
public float Yaw { get; init; }
2022-09-04 05:03:59 +00:00
[JsonProperty("message")]
public string Text { get; init; }
public int PositiveVotes { get; init; }
public int NegativeVotes { get; init; }
2022-09-04 07:12:51 +00:00
public int UserVote { get; set; }
2022-09-04 05:03:59 +00:00
2024-07-22 07:44:30 +00:00
public EmoteData? Emote { get; set; }
2022-09-06 04:24:32 +00:00
public int Glyph { get; set; }
2022-09-09 10:19:14 +00:00
public bool IsHidden { get; set; }
2022-09-06 04:24:32 +00:00
2022-09-04 05:03:59 +00:00
internal Vector3 Position => new(this.X, this.Y, this.Z);
internal static MessageWithTerritory From(Message message, uint territory) {
return new MessageWithTerritory {
Id = message.Id,
Territory = territory,
X = message.X,
Y = message.Y,
Z = message.Z,
2022-09-04 21:10:03 +00:00
Yaw = message.Yaw,
2022-09-04 05:03:59 +00:00
Text = message.Text,
PositiveVotes = message.PositiveVotes,
NegativeVotes = message.NegativeVotes,
2022-09-04 07:12:51 +00:00
UserVote = message.UserVote,
Emote = message.Emote,
2022-09-06 04:24:32 +00:00
Glyph = message.Glyph,
2022-09-09 10:19:14 +00:00
IsHidden = false,
2022-09-04 05:03:59 +00:00
};
}
}
2022-09-05 08:21:45 +00:00
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class EmoteData {
public required uint Id { get; set; }
2024-07-22 09:49:51 +00:00
public required List<byte> Customise { get; set; }
2024-07-22 07:44:30 +00:00
public required EquipmentData[] Equipment { get; set; }
public required WeaponData[] Weapon { get; set; }
public required uint Glasses { get; set; }
public required bool HatHidden { get; set; }
public required bool VisorToggled { get; set; }
public required bool WeaponHidden { get; set; }
}
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class EquipmentData {
public required ushort Id { get; set; }
public required byte Variant { get; set; }
2024-07-22 09:49:51 +00:00
[JsonProperty("stain_0")]
2024-07-22 07:44:30 +00:00
public required byte Stain0 { get; set; }
2024-07-22 09:49:51 +00:00
[JsonProperty("stain_1")]
2024-07-22 07:44:30 +00:00
public required byte Stain1 { get; set; }
}
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class WeaponData {
public required WeaponModelId ModelId { get; set; }
public required byte State { get; set; }
2024-07-22 09:49:51 +00:00
[JsonProperty("flags_1")]
2024-07-22 07:44:30 +00:00
public required ushort Flags1 { get; set; }
2024-07-22 09:49:51 +00:00
[JsonProperty("flags_2")]
2024-07-22 07:44:30 +00:00
public required byte Flags2 { get; set; }
}
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class WeaponModelId {
public required ushort Id { get; set; }
public required ushort Kind { get; set; }
public required ushort Variant { get; set; }
2024-07-22 09:49:51 +00:00
[JsonProperty("stain_0")]
2024-07-22 07:44:30 +00:00
public required byte Stain0 { get; set; }
2024-07-22 09:49:51 +00:00
[JsonProperty("stain_1")]
2024-07-22 07:44:30 +00:00
public required byte Stain1 { get; set; }
}
2022-09-05 08:21:45 +00:00
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class ErrorMessage {
2022-09-05 08:21:45 +00:00
public string Code { get; set; }
public string Message { get; set; }
}
[Serializable]
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
2024-07-22 07:44:30 +00:00
public class MyMessages {
2022-09-05 08:21:45 +00:00
public uint Extra { get; set; }
public MessageWithTerritory[] Messages { get; set; }
}