Пример #1
0
 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);
 }
Пример #2
0
        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),
                ModifyType.DisableEventChain => DisableEventChainEvent.Serdes((DisableEventChainEvent)genericEvent, eventSource, s),
                ModifyType.NpcActive => NpcActiveEvent.Serdes((NpcActiveEvent)genericEvent, s),
                ModifyType.AddPartyMember => AddPartyMemberEvent.Serdes((AddPartyMemberEvent)genericEvent, mapping, s),
                ModifyType.InventoryItem => AddRemoveInventoryItemEvent.Serdes((AddRemoveInventoryItemEvent)genericEvent, mapping, s),
                ModifyType.MapLighting => SetMapLightingEvent.Serdes((SetMapLightingEvent)genericEvent, s),
                ModifyType.PartyGold => ChangePartyGoldEvent.Serdes((ChangePartyGoldEvent)genericEvent, s),
                ModifyType.PartyRations => ChangePartyRationsEvent.Serdes((ChangePartyRationsEvent)genericEvent, s),
                ModifyType.Time => ChangeTimeEvent.Serdes((ChangeTimeEvent)genericEvent, s),
                ModifyType.Leader => SetPartyLeaderEvent.Serdes((SetPartyLeaderEvent)genericEvent, mapping, s),
                ModifyType.Ticker => TickerEvent.Serdes((TickerEvent)genericEvent, mapping, s),
                ModifyType.Unk2 => ModifyUnk2Event.Serdes((ModifyUnk2Event)genericEvent, s),
                _ => throw new InvalidEnumArgumentException(nameof(subType), (int)subType, typeof(ModifyType))
            });