示例#1
0
        public override void onRecognized(SpeechRecognitionEngine engine, SpeechRecognizedEventArgs e)
        {
            String text = e.Result.Text;

            String bp = "";

            foreach (String key in items.Keys.OrderByDescending(x => x.Length))
            {
                if (text.Contains(key))
                {
                    bp = items[key];
                    break;
                }
            }

            int level = 150;

            try
            {
                level = GrammarUtils.wordsToNumber(String.Join(" ", text.Split(' ').ToList().Select(word => word.Trim()).Where(word => GrammarUtils.wordToNum.ContainsKey(word))));
            }
            catch
            {
                //no numeric words
            }

            MainWindow.sendCommand($"admincheat SpawnDino \"{bp}\" 1 1 0 {level}");
        }
示例#2
0
        public override void onRecognized(SpeechRecognitionEngine engine, SpeechRecognizedEventArgs e)
        {
            String text = e.Result.Text;

            text = text.Replace("once", "one").Replace("twice", "two");
            int times = GrammarUtils.extractNumber(text);

            repeatPriorCommand(times);
        }
示例#3
0
        public override void onRecognized(SpeechRecognitionEngine engine, SpeechRecognizedEventArgs e)
        {
            String text = e.Result.Text;

            var data = items[items.Keys.OrderByDescending(k => k.Length).Where(k => text.Contains(k)).First()];

            String bp = "";

            if (data is String)
            {
                bp = data;
            }
            else if (data is JObject)
            {
                bp = data["bp"];
            }
            else
            {
                throw new Exception("Unsupported class type " + data.GetType());
            }

            int quantity = 1;

            try
            {
                quantity = GrammarUtils.wordsToNumber(String.Join(" ", text.Split(' ').ToList().Select(word => word.Trim()).Where(word => GrammarUtils.wordToNum.ContainsKey(word))));
            }
            catch
            {
                //no numeric words
            }

            int numSpawns = 1;

            if (data is JObject && data["spawn_cap"] != null)
            {
                int spawnCount = data["spawn_cap"];
                numSpawns = quantity / spawnCount;
                quantity  = spawnCount;
            }

            int quality = 1;

            if (text.Contains("badass"))
            {
                quality = 100;
            }

            MainWindow.sendCommand($"admincheat GiveItem \"{bp}\" {quantity} {quality} 0");
            if (numSpawns > 1)
            {
                Thread.Sleep(100);
                RepeatCommand.repeatPriorCommand(numSpawns - 1);
            }
        }
示例#4
0
        static RepeatCommand()
        {
            GrammarBuilder gb = new GrammarBuilder();

            gb.Append("repeat command");
            gb.Append(GrammarUtils.number(), 0, 6);
            gb.Append("once", 0, 1);
            gb.Append("twice", 0, 1);
            gb.Append("times", 0, 1);
            Instance = new RepeatCommand(gb);
        }
示例#5
0
        static SpawnItemCommand()
        {
            items = JsonConvert.DeserializeObject <Dictionary <String, dynamic> >(System.IO.File.ReadAllText("config/ItemData.json"));

            GrammarBuilder gb = new GrammarBuilder();

            gb.Append("spawn");
            gb.Append(GrammarUtils.number(), 0, 6);
            gb.Append("badass", 0, 1);
            Choices choices = new Choices();

            foreach (String key in items.Keys)
            {
                choices.Add(key);
            }
            gb.Append(choices);
            Instance = new SpawnItemCommand(gb);
        }
示例#6
0
        static SummonDinoCommand()
        {
            items = JsonConvert.DeserializeObject <Dictionary <String, String> >(System.IO.File.ReadAllText("config/DinoData.json"));

            GrammarBuilder gb = new GrammarBuilder();

            gb.Append("summon");
            gb.Append("level", 0, 1);
            gb.Append(GrammarUtils.number(), 0, 6);
            Choices choices = new Choices();

            foreach (String key in items.Keys)
            {
                choices.Add(key);
            }
            gb.Append(choices);
            Instance = new SummonDinoCommand(gb);
        }