Beispiel #1
0
        public static bool Prefix(LG_ComputerTerminal terminal, TerminalUplinkPuzzle __instance)
        {
            __instance.m_rounds                    = new Il2CppSystem.Collections.Generic.List <TerminalUplinkPuzzleRound>();
            __instance.TerminalUplinkIP            = SerialGenerator.GetIpAddress();
            __instance.m_roundIndex                = 0;
            __instance.m_lastRoundIndexToUpdateGui = -1;
            __instance.m_position                  = terminal.transform.position;
            int num = RandomUtil.TerminalRound.GetRound();

            for (int i = 0; i < num; i++)
            {
                int num2 = 6;
                TerminalUplinkPuzzleRound terminalUplinkPuzzleRound = new TerminalUplinkPuzzleRound();
                terminalUplinkPuzzleRound.CorrectIndex = Builder.SessionSeedRandom.Range(0, num2, "NO_TAG");
                terminalUplinkPuzzleRound.Prefixes     = new string[num2];
                terminalUplinkPuzzleRound.Codes        = new string[num2];
                for (int j = 0; j < num2; j++)
                {
                    terminalUplinkPuzzleRound.Codes[j]    = RandomUtil.GetPassword(5);
                    terminalUplinkPuzzleRound.Prefixes[j] = SerialGenerator.GetCodeWordPrefix();
                }
                __instance.m_rounds.Add(terminalUplinkPuzzleRound);
            }


            Log.Debug($"Terminal {terminal.PublicName} has {__instance.m_rounds.Count} rounds");
            return(false);
        }
Beispiel #2
0
        public static void Invoke(LG_ComputerTerminal __instance)
        {
            var listener = (Il2CppSystem.Action) new Action(() =>
            {
                OnUplinkSolved(__instance);
            });

            __instance.UplinkPuzzle.OnPuzzleSolved = __instance.UplinkPuzzle.OnPuzzleSolved == null ? listener : (Il2CppSystem.Action)__instance.UplinkPuzzle.OnPuzzleSolved.CombineImpl(listener);
        }
Beispiel #3
0
        public bool IsSameTerminal(LG_ComputerTerminal terminal)
        {
            if (VerifyTerminal == null || terminal == null)
            {
                return(false);
            }

            return(terminal.GetInstanceID() == VerifyTerminal.GetInstanceID());
        }
Beispiel #4
0
        public static void RegisterExitEvent(LG_ComputerTerminal terminal, Action onExit)
        {
            TerminalMessage.OnProximityExit += (LG_ComputerTerminal eTerminal) =>
            {
                if (!IsSame(terminal, eTerminal))
                {
                    return;
                }

                onExit?.Invoke();
            };
        }
Beispiel #5
0
        public static void RegisterEnterEvent(LG_ComputerTerminal terminal, Action <LG_ComputerTerminal> onEnter)
        {
            TerminalMessage.OnProximityEnter += (LG_ComputerTerminal eTerminal) =>
            {
                if (!IsSame(terminal, eTerminal))
                {
                    return;
                }

                onEnter?.Invoke(eTerminal);
            };
        }
        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;
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public static void AddCommand(LG_ComputerTerminal terminal, string cmdText, string helpText, Action <LG_ComputerTerminal, string, string> onCmdReceived)
        {
            if (terminal == null)
            {
                return;
            }

            if (terminal.m_command.m_commandsPerString.ContainsKey(cmdText.ToLower()))
            {
                return;
            }

            TerminalMessage.OnRecievedCustomCmd += (LG_ComputerTerminal eTerminal, string cmd, string arg1, string arg2) =>
            {
                if (!IsSame(terminal, eTerminal))
                {
                    return;
                }

                if (cmdText.Equals(cmd, StringComparison.OrdinalIgnoreCase))
                {
                    onCmdReceived?.Invoke(eTerminal, arg1, arg2);
                }
            };

            var id       = terminal.GetInstanceID();
            var newCmdId = 0;

            if (_CommandCustomIDDict.ContainsKey(id))
            {
                newCmdId = ++_CommandCustomIDDict[id];
            }
            else
            {
                newCmdId = 100000;
                _CommandCustomIDDict.Add(id, newCmdId);
            }

            terminal.m_command.AddCommand((TERM_Command)newCmdId, cmdText, helpText);
        }
 public static bool TryGetRandomTerminal(LG_Zone zone, out LG_ComputerTerminal terminal)
 {
     terminal = RandomUtil.PickFromList(zone.TerminalsSpawnedInZone);
     return(terminal != null);
 }
 public static void SetEndOfQueue(this LG_ComputerTerminal terminal, Action endOfQueue)
 {
     SetEndOfQueue(terminal.m_command, endOfQueue);
 }
Beispiel #10
0
 internal static void Postfix(LG_ComputerTerminal __instance)
 {
     TerminalMessage.OnProximityExit?.Invoke(__instance);
 }
Beispiel #11
0
 internal static void Post_ProxEnter(LG_ComputerTerminal __instance)
 {
     TerminalMessage.OnProximityEnter?.Invoke(__instance);
 }
Beispiel #12
0
        public void DoorCommandHandler(LG_DoorMultiWave manager, string CmdText, LG_ComputerTerminal terminal, string param1, string param2)
        {
            var cmd  = terminal.m_command;
            var info = manager.CurrentWaveInfo;

            //Parameter Count Filter
            if (string.IsNullOrEmpty(param1))
            {
                cmd.AddOutput("Argument length mismatching!", true);
                cmd.AddOutput($"Command Usage: {CmdText} -File <FileName>", true);
                return;
            }

            //Parameter Filter
            if (!param1.ToLower().Equals("-file"))
            {
                cmd.AddOutput($"There is no such argument named: '{param1.ToUpper()}'", true);
                cmd.AddOutput($"Command Usage: {CmdText} -File <FileName>", true);
                return;
            }

            if (string.IsNullOrEmpty(param2))
            {
                cmd.AddOutput("FileName Argument is missing!", true);
                cmd.AddOutput($"Command Usage: {CmdText} -File <FileName>", true);
                return;
            }

            //FileName Filter
            if (!terminal.GetLocalLogs().ContainsKey(param2.ToUpper()))
            {
                cmd.AddOutput($"There is no such file named: '{param2.ToUpper()}'", true);
                return;
            }

            cmd.AddOutput("", true);
            cmd.AddOutput(TerminalLineType.SpinningWaitNoDone, "Opening connection towards Master Door Controller", 4f);

            if (manager.State.PhaseStatus != PhaseType.Searching)
            {
                cmd.AddOutput("", true);
                cmd.AddOutput(TerminalLineType.Warning, "ACCESS DENIED :: Push URL is closed from Door Controller. Try again when session is opened!", 0.0f);
                return;
            }

            if (!info.IsSameTerminal(terminal))
            {
                cmd.AddOutput("", true);
                cmd.AddOutput(TerminalLineType.Warning, "ACCESS DENIED :: Push URL is blocked from Door Controller. Try again with other allowed Terminal.", 0.0f);
                return;
            }

            cmd.AddOutput(TerminalLineType.ProgressWait, "Pushing Key file content", 3.5f);
            cmd.AddOutput("", true);
            cmd.AddOutput(TerminalLineType.SpinningWaitNoDone, "Waiting for Controllers respond", 2f);

            if (!info.ValidFileName.ToUpper().Equals(param2.ToUpper()))
            {
                cmd.AddOutput(TerminalLineType.Warning, "ACCESS DENIED :: Given Key file was not correct!");
                return;
            }

            cmd.AddOutput(TerminalLineType.ProgressWait, "Parsing the Controllers respond", 1.0f);
            cmd.AddOutput("", true);
            if (info.PuzzleToVerify != null && !info.PuzzleToVerify.IsSolved)
            {
                var puzzle = info.PuzzleToVerify;
                if (puzzle.Instance.Data.TriggerAlarmOnActivate)
                {
                    cmd.AddOutput(TerminalLineType.Warning, $"Security Scan with [{puzzle.Instance.Data.PublicAlarmName}] is required!");
                }
                else
                {
                    cmd.AddOutput("Security Scan is required!", true);
                }
                cmd.AddOutput("", true);
                cmd.OnEndOfQueue = new Action(() =>
                {
                    puzzle.Trigger();
                });

                puzzle.Solved = () =>
                {
                    if (manager.TryJumpToNextWave())
                    {
                        cmd.AddOutput("SUCCESS! Master Door's Security Scan will be resume in few moment...");
                    }
                    else
                    {
                        cmd.AddOutput(TerminalLineType.Warning, "FAILED! Master Door's Connection has closed due to timeout! Please Try Again!");
                    }
                };
            }
            else
            {
                cmd.OnEndOfQueue = new Action(() =>
                {
                    if (manager.TryJumpToNextWave())
                    {
                        cmd.AddOutput("SUCCESS! Master Door's Security Scan will be resume in few moment...");
                    }
                    else
                    {
                        cmd.AddOutput(TerminalLineType.Warning, "FAILED! Master Door's Connection has closed due to timeout! Please Try Again!");
                    }
                });
            }
        }
Beispiel #13
0
 public static void AddStandardCommand(LG_ComputerTerminal terminal, string cmdText, string helpText, TERM_Command type)
 {
     terminal.m_command.AddCommand(type, cmdText, helpText);
 }
Beispiel #14
0
 private static bool IsSame(LG_ComputerTerminal a, LG_ComputerTerminal b)
 {
     return(a.GetInstanceID() == b.GetInstanceID());
 }