private async Task ProcessImageVoy(SocketUserMessage message, string url, bool debug)
        {
            var result = _voyImage.SearchUrl(url);

            if (!result.valid)
            {
                if (debug)
                {
                    await message.Channel.SendMessageAsync($"That was not a valid voyage screen image (or I couldn't process it).");
                }
                return;
            }

            if ((result.cmd.SkillValue == 0) ||
                (result.dip.SkillValue == 0) ||
                (result.eng.SkillValue == 0) ||
                (result.med.SkillValue == 0) ||
                (result.sci.SkillValue == 0) ||
                (result.sec.SkillValue == 0))
            {
                if (debug)
                {
                    await message.Channel.SendMessageAsync($"Unable to process voyage screen image (AM: {result.antimatter}; cmd: {result.cmd.SkillValue}, {result.cmd.Primary}; dip: {result.dip.SkillValue}, {result.dip.Primary}; eng: {result.eng.SkillValue}, {result.eng.Primary}; med: {result.med.SkillValue}, {result.med.Primary}; sci: {result.sci.SkillValue}, {result.sci.Primary}; sec: {result.sec.SkillValue}, {result.sec.Primary}).");
                }
                return;
            }

            var searchString = result.AsSearchString();

            if (!string.IsNullOrEmpty(searchString))
            {
                await HandleMessageVoytime(searchString, message, true);
            }
        }
Exemple #2
0
        static int PerformTest(Test opts)
        {
            var voyImage = new VoyImage(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "..", ".."));

            VoyImageResult result;

            if (opts.TestString.StartsWith("http"))
            {
                result = voyImage.SearchUrl(opts.TestString);
            }
            else
            {
                result = voyImage.SearchImage(opts.TestString);
            }

            Console.WriteLine(result);

            /*var botHelper = new BotHelper(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "..", ".."));
             * botHelper.ParseData();
             * var result = botHelper.BestCrew(opts.TestString, 0);
             * if (result.Count == 0)
             * {
             *  Console.WriteLine("Not found");
             * }
             * else
             * {
             *  Console.WriteLine(result[0].name);
             * }*/

            return(0);
        }
Exemple #3
0
        static int PerformTest(Test opts)
        {
            if (opts.TestType == 0)
            {
                var voyImage = new VoyImage(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "..", ".."));

                VoyImageResult result;

                if (opts.TestString.StartsWith("http"))
                {
                    result = voyImage.SearchUrl(opts.TestString);
                }
                else
                {
                    result = voyImage.SearchImage(opts.TestString);
                }

                Console.WriteLine(result);
            }
            else if (opts.TestType == 1)
            {
                var botHelper = new BotHelper("https://datacore.app/", System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "..", "..", "data"));
                botHelper.ParseData();
                var result = botHelper.BestCrew(opts.TestString, 0);
                if (result.Count == 0)
                {
                    Console.WriteLine("Not found");
                }
                else
                {
                    Console.WriteLine(result[0].name);
                }
            }
            else if (opts.TestType == 2)
            {
                var botHelper = new BotHelper("https://datacore.app/", System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "..", "..", "data"));
                botHelper.ParseData();
                var result = botHelper.Gauntlet(opts.TestString.Split(' '));
                if (!string.IsNullOrEmpty(result.ErrorMessage) || result.Results.Count() == 0)
                {
                    Console.WriteLine("Not found");
                }
                else
                {
                    Console.WriteLine(string.Join(", ", result.Results.Select(gresult => $"{gresult.Crew.name} [{string.Join(", ", gresult.MatchingTraits)}]")));
                }
            }

            return(0);
        }