| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using System.Text.Json;
- using System.Text.Json.Serialization;
- namespace SOTF_Struct.Generic {
- public class Module {
- public enum eModuleType : byte {
- Empty,
- Module_0,
- Module_1,
- Module_2,
- Module_3,
- Module_4,
- // Module_5,
- Module_6,
- Module_7
- }
- public string Version { get; set; } = "0.0.0";
- public int ModuleId { get; set; } = 0;
- // ModuleId = 0
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public RotationD<double>? ChannelWeights { get; set; }
- // Module = 1
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? SourceActorType { get; set; }
- // ModuleId = 2
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? IconIndex { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public bool? ShowBreadcrumbs { get; set; }
- // ModuleId = 3
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? CurrentState { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public double? TimeRemainingInState { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public bool? PauseDecay { get; set; }
- // ModuleId = 4
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? AmmoType { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? CurrentAmmo { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public List<int>? WeaponModIds { get; set; }
- // ModuleID = 6
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? VariantNumber { get; set; }
- // ModuleId = 7
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? RecipeId { get; set; }
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public int? CurrentVolume { get; set; }
- public static Module CreateModule(eModuleType mod) {
- if (mod == eModuleType.Module_0)
- return CreateModule(new RotationD<double>());
- if (mod == eModuleType.Module_1)
- return new Module() { ModuleId = 1, SourceActorType = 16, Version = "0.0.0" };
- else if (mod == eModuleType.Module_2)
- return CreateModule(0, false);
- else if (mod == eModuleType.Module_3)
- return CreateModule(0, 0.0f, false);
- else if (mod == eModuleType.Module_4)
- return CreateModule(0, 0, new int[] { });
- else if (mod == eModuleType.Module_6)
- return CreateModule(0);
- else if (mod == eModuleType.Module_7)
- return CreateModule(0, 0);
- return new Module() { Version = "0.0.0" };
- }
- public static Module CreateModule(RotationD<double> channelWeights) {
- return new Module() { ModuleId = 0, ChannelWeights = channelWeights, Version = "0.0.0" };
- }
- public static Module CreateModule(int IconIndex, bool ShowBreadcrumbs) {
- return new Module() { ModuleId = 2, Version = "0.0.0", IconIndex = IconIndex, ShowBreadcrumbs = ShowBreadcrumbs };
- }
- public static Module CreateModule(int CurrentState, float TimeRemaining, bool PauseDecay) {
- return new Module() { ModuleId = 3, Version = "0.0.0", CurrentState = CurrentState, TimeRemainingInState = TimeRemaining, PauseDecay = PauseDecay };
- }
- public static Module CreateModule(int AmmoType, int CurrentAmmo, int[] WeaponIDs) {
- return new Module() { ModuleId = 4, Version = "0.0.0", AmmoType = AmmoType, CurrentAmmo = CurrentAmmo, WeaponModIds = new List<int>(WeaponIDs) };
- }
- public static Module CreateModule(int VariantNumber) {
- return new Module() { ModuleId = 6, Version = "0.0.0", VariantNumber = VariantNumber };
- }
- public static Module CreateModule(int RecipeId, int CurrentVolume) {
- return new Module() { ModuleId = 7, Version = "0.0.0", RecipeId = RecipeId, CurrentVolume = CurrentVolume };
- }
- }
- }
|