Beispiel #1
0
 public void HandleChat()
 {
     if (!(Chat.instance != null))
     {
         return;
     }
     if (Chat.instance.m_chatWindow.gameObject.activeInHierarchy)
     {
         string text = Chat.instance.m_input.text;
         _ = Chat.instance.m_output.text;
         if ((Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace) || Input.GetKeyDown(KeyCode.Escape)) && ((SkConfigEntry.CAllowExecuteOnClear != null && !SkConfigEntry.CAllowExecuteOnClear.Value) || SkConfigEntry.CAllowExecuteOnClear == null))
         {
             chatInLastMessage = string.Empty;
         }
         if (!text.Equals(string.Empty) && !text.Equals(consoleLastMessage))
         {
             chatInLastMessage = text;
         }
         if (text.Equals(string.Empty) && !chatInLastMessage.Equals(string.Empty))
         {
             SkCommandProcessor.ProcessCommands(chatInLastMessage, SkCommandProcessor.LogTo.Chat);
             chatInLastMessage = string.Empty;
         }
     }
     if (Input.GetKeyDown(KeyCode.Slash) && Player.m_localPlayer != null && SkConfigEntry.COpenConsoleWithSlash != null && !SkConfigEntry.COpenConsoleWithSlash.Value && SkConfigEntry.COpenChatWithSlash != null && SkConfigEntry.COpenChatWithSlash.Value && !Console.IsVisible() && !Chat.instance.IsChatDialogWindowVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible())
     {
         Chat.instance.SetPrivateField("m_hideTimer", 0f);
         Chat.instance.m_chatWindow.gameObject.SetActive(value: true);
         Chat.instance.m_input.gameObject.SetActive(value: true);
         Chat.instance.m_input.ActivateInputField();
     }
 }
Beispiel #2
0
 public void HandleConsole()
 {
     if (!(Console.instance != null))
     {
         return;
     }
     if (Console.instance.m_chatWindow.gameObject.activeInHierarchy)
     {
         string text = Console.instance.m_input.text;
         if (Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace) || Input.GetKeyDown(KeyCode.Escape))
         {
             consoleLastMessage = string.Empty;
         }
         if (!text.Equals(string.Empty) && !text.Equals(consoleLastMessage))
         {
             consoleLastMessage = text;
         }
         if (Input.GetKeyDown(KeyCode.Return) && text.Equals(string.Empty) && !consoleLastMessage.Equals(string.Empty))
         {
             consoleHistory.Add(consoleLastMessage);
             SkCommandProcessor.ProcessCommands(consoleLastMessage, SkCommandProcessor.LogTo.Console);
             consoleLastMessage = string.Empty;
         }
         if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             Console.instance.m_input.text          = consoleHistory.Fetch(text, next: true);
             Console.instance.m_input.caretPosition = Console.instance.m_input.text.Length;
         }
         if (Input.GetKeyDown(KeyCode.DownArrow))
         {
             Console.instance.m_input.text = consoleHistory.Fetch(text, next: false);
         }
     }
     if (Input.GetKeyDown(KeyCode.Slash) && SkConfigEntry.COpenConsoleWithSlash != null && SkConfigEntry.COpenConsoleWithSlash.Value && !Console.IsVisible() && !Chat.instance.IsChatDialogWindowVisible() && !TextInput.IsVisible())
     {
         Console.instance.m_chatWindow.gameObject.SetActive(value: true);
         Console.instance.m_input.caretPosition = Console.instance.m_input.text.Length;
     }
 }
Beispiel #3
0
 private void Update()
 {
     HandleConsole();
     if ((SkConfigEntry.CAllowChatCommandInput != null && SkConfigEntry.CAllowChatCommandInput.Value) || SkConfigEntry.CAllowChatCommandInput == null)
     {
         HandleChat();
     }
     if (!anncounced1)
     {
         if (Console.instance != null && Player.m_localPlayer == null)
         {
             SkCommandProcessor.Announce();
             LoadConsoleCustomizations();
             anncounced1 = true;
         }
     }
     else if (Player.m_localPlayer != null)
     {
         anncounced1 = false;
     }
     if (!anncounced2)
     {
         if (Chat.instance != null)
         {
             SkCommandProcessor.Announce();
             LoadConsoleCustomizations();
             anncounced2 = true;
         }
     }
     else if (Chat.instance == null)
     {
         anncounced2 = false;
     }
     if (!SkConfigEntry.CAutoRunComplete)
     {
         if (SkConfigEntry.CAutoRun != null && SkConfigEntry.CAutoRun.Value)
         {
             if (Player.m_localPlayer != null && Chat.instance != null && Console.instance != null)
             {
                 try
                 {
                     SkUtilities.Logz(new string[2] {
                         "CMD", "AUTORUN"
                     }, new string[1] {
                         "Command List:" + SkConfigEntry.CAutoRunCommand.Value
                     });
                     SkCommandProcessor.PrintOut("==> AutoRun enabled! Command line: " + SkConfigEntry.CAutoRunCommand.Value, SkCommandProcessor.LogTo.Console);
                     SkCommandProcessor.ProcessCommands(SkConfigEntry.CAutoRunCommand.Value, SkCommandProcessor.LogTo.Console);
                 }
                 catch (Exception)
                 {
                     SkUtilities.Logz(new string[1] {
                         "Console"
                     }, new string[1] {
                         "AutoRun Failed. Something went wrong. Command line: " + SkConfigEntry.CAutoRunCommand.Value
                     }, LogType.Warning);
                     SkCommandProcessor.PrintOut("==> AutoRun Failed. Something went wrong. Command line: " + SkConfigEntry.CAutoRunCommand.Value, SkCommandProcessor.LogTo.Console);
                 }
                 finally
                 {
                     SkConfigEntry.CAutoRunComplete = true;
                 }
             }
         }
         else
         {
             SkConfigEntry.CAutoRunComplete = true;
         }
     }
     if (SkCommandProcessor.bTeleport && Input.GetKeyDown(KeyCode.BackQuote) && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hitInfo))
     {
         Vector3 point = hitInfo.point;
         Player.m_localPlayer.transform.position = point;
         Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Warp!");
     }
     if (!SkCommandProcessor.bDetectEnemies)
     {
         return;
     }
     try
     {
         List <Character> allCharacters = Character.GetAllCharacters();
         if (allCharacters.Count > 0)
         {
             foreach (Character item in allCharacters)
             {
                 if (item != null && !item.IsDead() && !item.IsPlayer())
                 {
                     if (Vector3.Distance(item.transform.position, Player.m_localPlayer.transform.position) < (float)SkCommandProcessor.bDetectRange)
                     {
                         if (!nearbyCharacters.Contains(item))
                         {
                             nearbyCharacters.Add(item);
                         }
                     }
                     else if (nearbyCharacters.Contains(item))
                     {
                         nearbyCharacters.Remove(item);
                     }
                 }
                 else if (nearbyCharacters.Contains(item))
                 {
                     nearbyCharacters.Remove(item);
                 }
             }
             if (nearbyCharacters.Count > 0)
             {
                 foreach (Character item2 in new List <Character>(nearbyCharacters))
                 {
                     if (!allCharacters.Contains(item2))
                     {
                         nearbyCharacters.Remove(item2);
                     }
                 }
             }
         }
         if (nearbyCharacters.Count > 0 && SkCommandProcessor.btDetectEnemiesSwitch)
         {
             Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Enemy nearby!");
             SkCommandProcessor.btDetectEnemiesSwitch = false;
         }
         else if (nearbyCharacters.Count == 0)
         {
             SkCommandProcessor.btDetectEnemiesSwitch = true;
         }
     }
     catch (Exception)
     {
     }
 }