Example #1
0
        private static void CCSpawnAs(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                return;
            }

            string bodyString   = ArgsHelper.GetValue(args.userArgs, 0);
            string playerString = ArgsHelper.GetValue(args.userArgs, 1);

            SpawnAs(args.sender, bodyString, playerString);
        }
Example #2
0
        private string UserChatMessage_ConstructChatString(On.RoR2.Chat.UserChatMessage.orig_ConstructChatString orig, Chat.UserChatMessage self)
        {
            List <string> split       = new List <string>(self.text.Split(Char.Parse(" ")));
            string        commandName = ArgsHelper.GetValue(split, 0);

            if (commandName.Equals("spawn_as", StringComparison.CurrentCultureIgnoreCase))
            {
                string bodyString = ArgsHelper.GetValue(split, 1);
                string userString = ArgsHelper.GetValue(split, 2);


                SpawnAs(self.sender.GetComponent <NetworkUser>(), bodyString, userString);
            }
            return(orig(self));
        }
Example #3
0
        private void CheckforJoinAsRequest(On.RoR2.Console.orig_RunCmd orig, RoR2.Console self, RoR2.Console.CmdSender sender, string concommandName, List <string> userArgs)
        {
            orig(self, sender, concommandName, userArgs);

            if (concommandName.Equals("say", StringComparison.OrdinalIgnoreCase))
            {
                var userMsg   = ArgsHelper.GetValue(userArgs, 0).ToLower();
                var isRequest = userMsg.StartsWith("join_as");
                if (isRequest)
                {
                    var    argsRequest = userMsg.Split(' ').ToList();
                    string bodyString  = ArgsHelper.GetValue(argsRequest, 1);
                    string userString  = ArgsHelper.GetValue(argsRequest, 2);

                    JoinAs(sender.networkUser, bodyString, userString);
                }
            }
        }