Esempio n. 1
0
        public static ModifyEvent Serdes(ModifyEvent genericEvent, ISerializer s)
        {
            var subType = s.EnumU8("SubType", genericEvent?.SubType ?? ModifyType.Unk2);

            switch (subType)
            {
            case ModifyType.SetTemporarySwitch:     return(SetTemporarySwitchEvent.Serdes((SetTemporarySwitchEvent)genericEvent, s));

            case ModifyType.DisableEventChain:      return(DisableEventChainEvent.Serdes((DisableEventChainEvent)genericEvent, s));

            case ModifyType.SetNpcActive:           return(SetNpcActiveEvent.Serdes((SetNpcActiveEvent)genericEvent, s));

            case ModifyType.AddPartyMember:         return(AddPartyMemberEvent.Serdes((AddPartyMemberEvent)genericEvent, s));

            case ModifyType.AddRemoveInventoryItem: return(AddRemoveInventoryItemEvent.Serdes((AddRemoveInventoryItemEvent)genericEvent, s));

            case ModifyType.SetMapLighting:         return(SetMapLightingEvent.Serdes((SetMapLightingEvent)genericEvent, s));

            case ModifyType.ChangePartyGold:        return(ChangePartyGoldEvent.Serdes((ChangePartyGoldEvent)genericEvent, s));

            case ModifyType.ChangePartyRations:     return(ChangePartyRationsEvent.Serdes((ChangePartyRationsEvent)genericEvent, s));

            case ModifyType.ChangeTime:             return(ChangeTimeEvent.Serdes((ChangeTimeEvent)genericEvent, s));

            case ModifyType.SetPartyLeader:         return(SetPartyLeaderEvent.Serdes((SetPartyLeaderEvent)genericEvent, s));

            case ModifyType.SetTicker:              return(SetTickerEvent.Serdes((SetTickerEvent)genericEvent, s));

            case ModifyType.Unk2:                   return(DummyModifyEvent.Serdes((DummyModifyEvent)genericEvent, s));

            default: throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        public static ModifyEvent Serdes(ModifyEvent genericEvent, ISerializer s)
        {
            var subType = s.EnumU8("SubType", genericEvent?.SubType ?? ModifyType.Unk2);

            return(subType switch
            {
                ModifyType.SetTemporarySwitch => SetTemporarySwitchEvent.Serdes((SetTemporarySwitchEvent)genericEvent, s),
                ModifyType.DisableEventChain => DisableEventChainEvent.Serdes((DisableEventChainEvent)genericEvent, s),
                ModifyType.SetNpcActive => SetNpcActiveEvent.Serdes((SetNpcActiveEvent)genericEvent, s),
                ModifyType.AddPartyMember => AddPartyMemberEvent.Serdes((AddPartyMemberEvent)genericEvent, s),
                ModifyType.AddRemoveInventoryItem => AddRemoveInventoryItemEvent.Serdes((AddRemoveInventoryItemEvent)genericEvent, s),
                ModifyType.SetMapLighting => SetMapLightingEvent.Serdes((SetMapLightingEvent)genericEvent, s),
                ModifyType.ChangePartyGold => ChangePartyGoldEvent.Serdes((ChangePartyGoldEvent)genericEvent, s),
                ModifyType.ChangePartyRations => ChangePartyRationsEvent.Serdes((ChangePartyRationsEvent)genericEvent, s),
                ModifyType.ChangeTime => ChangeTimeEvent.Serdes((ChangeTimeEvent)genericEvent, s),
                ModifyType.SetPartyLeader => SetPartyLeaderEvent.Serdes((SetPartyLeaderEvent)genericEvent, s),
                ModifyType.SetTicker => SetTickerEvent.Serdes((SetTickerEvent)genericEvent, s),
                ModifyType.Unk2 => DummyModifyEvent.Serdes((DummyModifyEvent)genericEvent, s),
                _ => throw new ArgumentOutOfRangeException()
            });
Esempio n. 3
0
        public static ModifyEvent BaseSerdes(ModifyEvent genericEvent, AssetMapping mapping, ISerializer s)
        {
            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }
            var subType = s.EnumU8("SubType", genericEvent?.SubType ?? ModifyType.Unk2);

            return(subType switch
            {
                ModifyType.SetTemporarySwitch => SetTemporarySwitchEvent.Serdes((SetTemporarySwitchEvent)genericEvent, mapping, s),
                ModifyType.DisableEventChain => DisableEventChainEvent.Serdes((DisableEventChainEvent)genericEvent, s),
                ModifyType.SetNpcActive => SetNpcActiveEvent.Serdes((SetNpcActiveEvent)genericEvent, s),
                ModifyType.AddPartyMember => AddPartyMemberEvent.Serdes((AddPartyMemberEvent)genericEvent, mapping, s),
                ModifyType.AddRemoveInventoryItem => AddRemoveInventoryItemEvent.Serdes((AddRemoveInventoryItemEvent)genericEvent, mapping, s),
                ModifyType.SetMapLighting => SetMapLightingEvent.Serdes((SetMapLightingEvent)genericEvent, s),
                ModifyType.ChangePartyGold => ChangePartyGoldEvent.Serdes((ChangePartyGoldEvent)genericEvent, s),
                ModifyType.ChangePartyRations => ChangePartyRationsEvent.Serdes((ChangePartyRationsEvent)genericEvent, s),
                ModifyType.ChangeTime => ChangeTimeEvent.Serdes((ChangeTimeEvent)genericEvent, s),
                ModifyType.SetPartyLeader => SetPartyLeaderEvent.Serdes((SetPartyLeaderEvent)genericEvent, mapping, s),
                ModifyType.SetTicker => SetTickerEvent.Serdes((SetTickerEvent)genericEvent, mapping, s),
                ModifyType.Unk2 => DummyModifyEvent.Serdes((DummyModifyEvent)genericEvent, s),
                _ => throw new InvalidEnumArgumentException(nameof(subType), (int)subType, typeof(ModifyType))
            });