public static ModifyUnk2Event Serdes(ModifyUnk2Event e, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } e ??= new ModifyUnk2Event(); e.Unk2 = s.UInt8(nameof(Unk2), e.Unk2); e.Unk3 = s.UInt8(nameof(Unk3), e.Unk3); e.Unk4 = s.UInt8(nameof(Unk4), e.Unk4); e.Unk5 = s.UInt8(nameof(Unk5), e.Unk5); e.Unk6 = s.UInt16(nameof(Unk6), e.Unk6); e.Unk8 = s.UInt16(nameof(Unk8), e.Unk8); return(e); }
public static ModifyEvent BaseSerdes(ModifyEvent genericEvent, AssetMapping mapping, AssetId eventSource, ISerializer s) { if (s == null) { throw new ArgumentNullException(nameof(s)); } var subType = s.EnumU8("SubType", genericEvent?.SubType ?? ModifyType.Unk2); return(subType switch { ModifyType.Switch => SwitchEvent.Serdes((SwitchEvent)genericEvent, mapping, s), // 0 ModifyType.DisableEventChain => DisableEventChainEvent.Serdes((DisableEventChainEvent)genericEvent, eventSource, s), // 1 ModifyType.Unk2 => ModifyUnk2Event.Serdes((ModifyUnk2Event)genericEvent, s), // 2 ModifyType.NpcActive => DisableNpcEvent.Serdes((DisableNpcEvent)genericEvent, s), // 4 ModifyType.AddPartyMember => AddPartyMemberEvent.Serdes((AddPartyMemberEvent)genericEvent, mapping, s), // 5 ModifyType.InventoryItem => AddRemoveInventoryItemEvent.Serdes((AddRemoveInventoryItemEvent)genericEvent, mapping, s), // 6 ModifyType.MapLighting => SetMapLightingEvent.Serdes((SetMapLightingEvent)genericEvent, s), // B ModifyType.PartyGold => ChangePartyGoldEvent.Serdes((ChangePartyGoldEvent)genericEvent, s), // F ModifyType.PartyRations => ChangePartyRationsEvent.Serdes((ChangePartyRationsEvent)genericEvent, s), // 10 ModifyType.Time => ChangeTimeEvent.Serdes((ChangeTimeEvent)genericEvent, s), // 12 ModifyType.Leader => SetPartyLeaderEvent.Serdes((SetPartyLeaderEvent)genericEvent, mapping, s), // 1A ModifyType.Ticker => TickerEvent.Serdes((TickerEvent)genericEvent, mapping, s), // 1C _ => throw new InvalidEnumArgumentException(nameof(subType), (int)subType, typeof(ModifyType)) });