Exemplo n.º 1
0
        public static void Invoke(pWardenObjectiveState oldState, pWardenObjectiveState newState)
        {
            bool mainComplete   = oldState.main_status != newState.main_status && newState.main_status == eWardenObjectiveStatus.WardenObjectiveItemSolved;
            bool secondComplete = oldState.second_status != newState.second_status && newState.second_status == eWardenObjectiveStatus.WardenObjectiveItemSolved;
            bool thirdComplete  = oldState.third_status != newState.third_status && newState.third_status == eWardenObjectiveStatus.WardenObjectiveItemSolved;

            var blocks = EventListenerDataBlock.GetAllBlocks();
            var exp    = RundownManager.GetActiveExpeditionData();

            foreach (var block in blocks)
            {
                if (block.Type == EventListenerType.ObjectiveComplete)
                {
                    foreach (var expedition in block.ForExpeditions)
                    {
                        if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                        {
                            if ((!block.CompleteObjective_Layers.Contains(LG_LayerType.MainLayer) || mainComplete) && (!block.CompleteObjective_Layers.Contains(LG_LayerType.SecondaryLayer) || secondComplete) && (!block.CompleteObjective_Layers.Contains(LG_LayerType.ThirdLayer) || thirdComplete))
                            {
                                EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                            }

                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void Invoke(ES_HibernateWakeUp __instance)
        {
            var blocks = EventListenerDataBlock.GetAllBlocks();
            var exp    = RundownManager.GetActiveExpeditionData();

            foreach (var block in blocks)
            {
                if (block.Type == EventListenerType.EnemyWakeUp)
                {
                    foreach (var expedition in block.ForExpeditions)
                    {
                        if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                        {
                            var enemy = __instance.m_enemyAgent;
                            if (block.EnemyWakeup_EnemyID == enemy.EnemyDataID)
                            {
                                var lg_area = enemy.CourseNode.m_area;
                                var area    = lg_area.m_navInfo.Suffix.ToLower();

                                var lg_zone = lg_area.m_zone;
                                var zone    = lg_zone.LocalIndex;

                                var lg_layer = lg_zone.Layer;
                                var layer    = lg_layer.m_type;

                                bool valid = block.EnemyWakeUp_ForLayers.Count == 0;
                                foreach (var validLayer in block.EnemyWakeUp_ForLayers)
                                {
                                    if (validLayer.Layer == layer)
                                    {
                                        valid = validLayer.Whitelist;
                                        foreach (var validZone in validLayer.Zones)
                                        {
                                            if (validZone.ZoneIndex == zone)
                                            {
                                                valid = validZone.Whitelist;
                                                foreach (var validArea in validZone.Areas)
                                                {
                                                    if (validArea.AreaName.ToLower() == area)
                                                    {
                                                        valid = validArea.Whitelist;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if (valid)
                                {
                                    EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
        public static void Invoke(LG_SecurityDoor __instance, pDoorState state)
        {
            bool valid;
            EventListenerType validListenerType;

            switch (state.status)
            {
            case eDoorStatus.Open:
                valid             = true;
                validListenerType = EventListenerType.SecurityDoorOpen;
                break;

            case eDoorStatus.Unlocked:
                valid             = true;
                validListenerType = EventListenerType.SecurityDoorUnlock;
                break;

            case eDoorStatus.ChainedPuzzleActivated:
                valid             = true;
                validListenerType = EventListenerType.SecurityDoorActivateChainedPuzzle;
                break;

            default:
                valid             = false;
                validListenerType = (EventListenerType)0;
                break;
            }

            if (valid)
            {
                var blocks = EventListenerDataBlock.GetAllBlocks();
                var exp    = RundownManager.GetActiveExpeditionData();
                foreach (var block in blocks)
                {
                    if (block.Type == validListenerType)
                    {
                        foreach (var expedition in block.ForExpeditions)
                        {
                            if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                            {
                                var data = __instance.LinkedToZoneData;
                                if (__instance.LinksToLayerType == block.SecurityDoor_Layer && data.LocalIndex == block.SecurityDoor_ZoneIndex && data.BuildFromLocalIndex == block.SecurityDoor_BuildFromIndex)
                                {
                                    EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
        public static void Invoke(LG_ComputerTerminal __instance)
        {
            if (__instance.m_chainPuzzleForWardenObjective != null)
            {
                __instance.m_chainPuzzleForWardenObjective.add_OnPuzzleSolved(new Action(() =>
                {
                    __instance.ObjectiveItemSolved = true;
                    Invoke(__instance);
                }));
                return;
            }

            var blocks = EventListenerDataBlock.GetAllBlocks();
            var exp    = RundownManager.GetActiveExpeditionData();

            foreach (var block in blocks)
            {
                if (block.Type == EventListenerType.ObjectiveItemSolved)
                {
                    foreach (var expedition in block.ForExpeditions)
                    {
                        if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                        {
                            if (__instance.SpawnNode.LayerType == block.ObjectiveItemSolved_Layer)
                            {
                                var items = WardenObjectiveManager.Current.m_objectiveItemCollection[__instance.SpawnNode.LayerType];
                                int count = 0;

                                foreach (var item in items)
                                {
                                    if (item != null && item.ObjectiveItemSolved)
                                    {
                                        count++;
                                    }
                                }

                                if (block.ObjectiveItemSolved_RequiredCount == count)
                                {
                                    EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        public static void Invoke(LG_PickupItem_Sync __instance, pPickupItemState oldState, pPickupItemState newState)
        {
            if (oldState.status != newState.status && newState.status == ePickupItemStatus.PickedUp)
            {
                AIG_CourseNode spawnNode = __instance.item.TryCast <CarryItemPickup_Core>()?.SpawnNode ?? __instance.item.TryCast <GenericSmallPickupItem_Core>()?.SpawnNode;
                if (spawnNode == null)
                {
                    return;
                }

                var blocks = EventListenerDataBlock.GetAllBlocks();
                var exp    = RundownManager.GetActiveExpeditionData();

                foreach (var block in blocks)
                {
                    if (block.Type == EventListenerType.ObjectiveItemSolved)
                    {
                        foreach (var expedition in block.ForExpeditions)
                        {
                            if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                            {
                                if (spawnNode.LayerType == block.ObjectiveItemSolved_Layer)
                                {
                                    var items = WardenObjectiveManager.Current.m_objectiveItemCollection[spawnNode.LayerType];
                                    int count = 0;

                                    foreach (var item in items)
                                    {
                                        if (item != null && item.ObjectiveItemSolved)
                                        {
                                            count++;
                                        }
                                    }

                                    if (block.ObjectiveItemSolved_RequiredCount == count)
                                    {
                                        EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public static void Invoke(LG_PowerGenerator_Core __instance, pPowerGeneratorState oldState, pPowerGeneratorState newState)
        {
            if (oldState.status != newState.status && newState.status == ePowerGeneratorStatus.Powered && __instance.ObjectiveItemSolved)
            {
                var blocks = EventListenerDataBlock.GetAllBlocks();
                var exp    = RundownManager.GetActiveExpeditionData();

                foreach (var block in blocks)
                {
                    if (block.Type == EventListenerType.ObjectiveItemSolved)
                    {
                        foreach (var expedition in block.ForExpeditions)
                        {
                            if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                            {
                                if (__instance.SpawnNode.LayerType == block.ObjectiveItemSolved_Layer)
                                {
                                    var items = WardenObjectiveManager.Current.m_objectiveItemCollection[__instance.SpawnNode.LayerType];
                                    int count = 0;

                                    foreach (var item in items)
                                    {
                                        if (item != null && item.ObjectiveItemSolved)
                                        {
                                            count++;
                                        }
                                    }

                                    if (block.ObjectiveItemSolved_RequiredCount == count)
                                    {
                                        EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
        public static void Invoke()
        {
            GameInfo.State = GameState.InLevel;

            foreach (var light in UnityEngine.Object.FindObjectsOfType <LevelGeneration.LG_Light>())
            {
                if (light.AvailableInLevel)
                {
                    if (light.gameObject.GetComponent <Lights.LightController>() == null)
                    {
                        light.gameObject.AddComponent <Lights.LightController>();
                    }
                }
            }

            var blocks = EventListenerDataBlock.GetAllBlocks();
            var exp    = RundownManager.GetActiveExpeditionData();

            foreach (var block in blocks)
            {
                if (block.Type == EventListenerType.LevelLoad)
                {
                    foreach (var expedition in block.ForExpeditions)
                    {
                        if (expedition.ExpeditionIndex == exp.expeditionIndex && expedition.Tier == exp.tier)
                        {
                            Log.Message($"Start Level Load Event Sequence for listener id {block.persistentID} ({block.name})!");
                            if (block.LevelLoad_IncludeInitialDrop)
                            {
                                Log.Message("Peforming event sequence...");
                                EventSequenceManager.StartSequence(block.EventSequenceOnActivate);
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
 public void Activate(uint sequenceID)
 {
     EventSequenceManager.StartSequence(sequenceID);
 }