示例#1
0
        private static FFXIVItem ReadReducedItem(System.Windows.Forms.TextBox iLogBox, JToken reducedToken)
        {
            FFXIVItem        item;
            FFXIVReducedItem reducedItem = new FFXIVReducedItem();

            reducedItem.Type = FFXIVItem.TypeItem.Reduced;

            string    idReducedFrom = reducedToken[0].Value <string>();
            FFXIVItem ingredient    = RecBuildCraftingTree(iLogBox, idReducedFrom, 5);

            if (null != ingredient)
            {
                reducedItem.ReducedFrom = ingredient;

                if (ingredient is FFXIVGatheredItem)
                {
                    FFXIVGatheredItem gatheredItem = ingredient as FFXIVGatheredItem;
                    if (null != gatheredItem)
                    {
                        gatheredItem.AsCollectable = true;
                    }
                }
            }
            else
            {
                Service_Misc.LogText(iLogBox, "Oups... failed to retrieve one reduced reference : ID=" + idReducedFrom);
            }

            item = reducedItem;
            return(item);
        }
示例#2
0
        public static List <string> GetAllGridsRawContentFromForum(string iURL, CookieCollection iLogCookies)
        {
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            HtmlDocument answer = Service_Misc.GetWebPageFromRequest("GET " + iURL + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Cache-Control: max-age=0|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/wp-login.php?redirect_to=https%3A%2F%2Fmiqobot.com%2Fforum%2Fforums%2Ftopic%2Fgrade-1-carbonized-matter-min-lv20%2F|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                     iLogCookies, ref oCookies, ref oCode);

            if (null == answer)
            {
                return(null);
            }

            List <string>   attachmentsList        = new List <string>();
            List <HtmlNode> listAllAttachmentsNode = answer.DocumentNode.Descendants("div").ToList();

            foreach (HtmlNode node in listAllAttachmentsNode)
            {
                if (node.GetAttributeValue("class", "") == "bbp-attachments")
                {
                    attachmentsList.Add(Service_Misc.ExtractLink(node));
                }
            }

            List <string> listGrids = new List <string>();

            foreach (string attachmentLink in attachmentsList)
            {
                string gridRawContent = Service_Misc.GetContentFromRequest("GET " + attachmentLink + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/forums/topic/grade-1-carbonized-matter-min-lv20/|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                           iLogCookies, ref oCookies, ref oCode);

                listGrids.Add(gridRawContent);
            }
            return(listGrids);
        }
示例#3
0
        public static List <MiqoItemPage> GetURLItem(string iItemName, CookieCollection iLogCookies, HtmlDocument iDocument)
        {
            List <MiqoItemPage> result = new List <MiqoItemPage>();

            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;
            HtmlDocument     answer   = iDocument;

            if (null == answer)
            {
                answer = Service_Misc.GetWebPageFromRequest("GET https://miqobot.com/forum/forums/topic/index-gathering-grids/ HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Cache-Control: max-age=0|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/forums/forum/grids-and-presets/|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: wordpress_test_cookie=WP+Cookie+check; _ga=GA1.2.1771485810.1566089776||",
                                                            iLogCookies, ref oCookies, ref oCode);
            }
            if (null == answer)
            {
                return(result);
            }

            HtmlNode firstAnswerNode = Service_Misc.GetChildNodeByID(answer.DocumentNode, "d4p-bbp-quote-1116");

            if (null == firstAnswerNode)
            {
                return(new List <MiqoItemPage>());
            }

            List <HtmlNode> listItemNodes = firstAnswerNode.Descendants("li").ToList();


            foreach (HtmlNode node in listItemNodes)
            {
                if (null == node)
                {
                    continue;
                }

                string nodeInnerTextLower = node.InnerText.ToLower();
                if (nodeInnerTextLower.Contains("by") && nodeInnerTextLower.Contains(iItemName.ToLower()))
                {
                    //Found node !

                    List <HtmlNode> listLinks = node.Descendants("a").ToList();
                    foreach (HtmlNode link in listLinks)
                    {
                        MiqoItemPage itempage = new MiqoItemPage();
                        itempage.URL         = link.GetAttributeValue("href", "");
                        itempage.Contributor = link.InnerText;
                        result.Add(itempage);
                    }
                }
            }

            return(result);
        }
示例#4
0
        /// <summary>
        /// Retrieves all aetheryte names and positions from https://ffxiv.consolegameswiki.com/wiki/Zone
        /// </summary>
        /// <returns></returns>
        public static List <FFXIVAetheryte> GetAetherytes()
        {
            List <FFXIVAetheryte> result = new List <FFXIVAetheryte>();

            //Main zone page
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;
            HtmlDocument     answer   = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Zone HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                                           oCookies, ref oCookies, ref oCode);

            if (null == answer)
            {
                return(result);
            }

            HtmlNode contentNode = answer.GetElementbyId("mw-content-text");

            if (null == contentNode)
            {
                return(result);
            }

            string currentRegion = "Unknown";

            foreach (HtmlNode childNode in contentNode.ChildNodes)
            {
                if (childNode.Name == "h3")
                {
                    currentRegion = childNode.InnerText.Trim();
                }
                else if (childNode.Name == "ul")
                {
                    foreach (HtmlNode liNode in childNode.ChildNodes)
                    {
                        foreach (HtmlNode aNode in liNode.ChildNodes)
                        {
                            if (aNode.Name != "a")
                            {
                                continue;
                            }

                            string link = Service_Misc.ExtractLink(aNode);
                            result.AddRange(GetAetherytesFromRegion(currentRegion, aNode.InnerText.Trim(), link));
                        }
                    }
                }
            }

            return(result);
        }
示例#5
0
        public static string GetLastGrid(string iItemName, CookieCollection iLogCookies, MiqoItemPage iPage, out string oGridName)
        {
            string gridItemName = iItemName + " Grid";

            oGridName = "";
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            //Looking into cache directory
            DirectoryInfo exeDirectory   = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo cacheDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "CacheGrid"));

            if (!cacheDirectory.Exists)
            {
                cacheDirectory.Create();
            }

            string   gridRawContent = "";
            FileInfo cacheGridFile  = new FileInfo(Path.Combine(cacheDirectory.FullName, gridItemName + ".txt"));

            if (cacheGridFile.Exists)
            {
                oGridName      = gridItemName;
                gridRawContent = System.IO.File.ReadAllText(cacheGridFile.FullName);
            }
            else
            {
                HtmlDocument answer = Service_Misc.GetWebPageFromRequest("GET " + iPage.URL + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Cache-Control: max-age=0|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/wp-login.php?redirect_to=https%3A%2F%2Fmiqobot.com%2Fforum%2Fforums%2Ftopic%2Fgrade-1-carbonized-matter-min-lv20%2F|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                         iLogCookies, ref oCookies, ref oCode);
                if (null == answer)
                {
                    return(null);
                }

                string          lastUrlAttachment      = "";
                List <HtmlNode> listAllAttachmentsNode = answer.DocumentNode.Descendants("div").ToList();
                foreach (HtmlNode node in listAllAttachmentsNode)
                {
                    if (node.GetAttributeValue("class", "") == "bbp-attachments")
                    {
                        lastUrlAttachment = Service_Misc.ExtractLink(node);
                    }
                }

                gridRawContent = Service_Misc.GetContentFromRequest("GET " + lastUrlAttachment + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/forums/topic/grade-1-carbonized-matter-min-lv20/|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                    iLogCookies, ref oCookies, ref oCode);
            }

            return(GetGridFromRawContent(iItemName, gridRawContent, out oGridName));
        }
示例#6
0
        /// <summary>
        /// Logs into miqoot forums
        /// </summary>
        /// <returns></returns>
        public static CookieCollection LogInForum()
        {
            CookieCollection iCookies = new CookieCollection();
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;
            string           answer   = Service_Misc.GetContentFromRequest("POST https://miqobot.com/forum/wp-login.php HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Content-Length: 128|Cache-Control: max-age=0|Origin: https://miqobot.com|Upgrade-Insecure-Requests: 1|Content-Type: application/x-www-form-urlencoded|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/wp-login.php|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: wordpress_test_cookie=WP+Cookie+check; _ga=GA1.2.1771485810.1566089776||",
                                                                           iCookies, ref oCookies, ref oCode,
                                                                           "log=miqocrafter%40gmail.com&pwd=.f%2Fg%24%5D%21zzNb4&wp-submit=Log+In&redirect_to=https%3A%2F%2Fmiqobot.com%2Fforum&testcookie=1");

            if (answer != "0" && oCode != HttpStatusCode.OK)
            {
                return(null);
            }
            return(oCookies);
        }
示例#7
0
        public static string GetCacheSolverPresets()
        {
            //Looking into cache directory
            DirectoryInfo exeDirectory   = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo cacheDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "CacheSolverPresets"));

            if (!cacheDirectory.Exists)
            {
                cacheDirectory.Create();
            }

            string result = "";

            foreach (FileInfo SolverPresetFile in cacheDirectory.GetFiles())
            {
                result += System.IO.File.ReadAllText(SolverPresetFile.FullName);
            }
            return(result);
        }
示例#8
0
        public static bool HasGrid(string iItemName)
        {
            string gridItemName = iItemName + " Grid";

            //Looking into cache directory
            DirectoryInfo exeDirectory   = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo cacheDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "CacheGrid"));

            if (!cacheDirectory.Exists)
            {
                cacheDirectory.Create();
            }

            FileInfo cacheGridFile = new FileInfo(Path.Combine(cacheDirectory.FullName, gridItemName + ".txt"));

            if (cacheGridFile.Exists)
            {
                return(true);
            }
            return(false);
        }
示例#9
0
        /// <summary>
        /// Retrieve an item name from its ID
        /// </summary>
        /// <param name="iItemID"></param>
        /// <returns></returns>
        public static string GetItemName(string iItemID)
        {
            if (null == iItemID)
            {
                return("");
            }

            //https://www.garlandtools.org/db/doc/item/en/3/26498.json

            CookieCollection iCookies = new CookieCollection();
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            string searchResultContent = Service_Misc.GetContentFromRequest("GET https://www.garlandtools.org/db/doc/item/en/3/" + iItemID + ".json HTTP/1.1|Host: www.garlandtools.org|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: cross-site|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                            iCookies, ref oCookies, ref oCode);

            try
            {
                JToken mainToken = JObject.Parse(searchResultContent);
                if (null == mainToken)
                {
                    return("");
                }

                JToken itemToken = mainToken["item"];
                if (null == itemToken)
                {
                    return("");
                }

                return(itemToken["name"].Value <string>());
            }
            catch
            {
            }
            return("");
        }
示例#10
0
        /// <summary>
        /// Retrieves all aetheryte names and positions from https://ffxiv.consolegameswiki.com/wiki/Zone
        /// </summary>
        /// <returns></returns>
        public static List <FFXIVAetheryte> GetAetherytesFromRegion(string iRegion, string iZoneName, string iPageLink)
        {
            List <FFXIVAetheryte> result = new List <FFXIVAetheryte>();

            DirectoryInfo exeDirectory      = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo metadataDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "Metadata"));

            //Main zone page
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;
            HtmlDocument     answer   = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com" + iPageLink + " HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                                           oCookies, ref oCookies, ref oCode);

            if (null == answer)
            {
                return(result);
            }

            HtmlNode nodeInfobox = Service_Misc.GetFirstChildNode(answer.DocumentNode, "div", "infobox-n area");

            if (null == nodeInfobox)
            {
                return(result);
            }

            List <HtmlNode> dlNodes = nodeInfobox.Descendants("dl").ToList();

            if (dlNodes.Count != 1)
            {
                return(result);
            }

            foreach (HtmlNode aNode in dlNodes[0].ChildNodes)
            {
                if (aNode.Name != "dd")
                {
                    continue;
                }
                string        text           = aNode.InnerText;
                List <string> listAetherytes = text.Split(')').ToList();
                foreach (string aetheryteText in listAetherytes)
                {
                    if (aetheryteText.Contains("(X:") && aetheryteText.Contains("Y:"))
                    {
                        string xText = aetheryteText.Split(new string[] { "(X:" }, StringSplitOptions.None)[1].Split(',')[0].Trim();
                        string yText = aetheryteText.Split(new string[] { "Y:" }, StringSplitOptions.None)[1].Split(')')[0].Split(',')[0].Trim();
                        string nameText = aetheryteText.Split(new string[] { "(X:" }, StringSplitOptions.None)[0];
                        double x = 0, y = 0;
                        double.TryParse(xText, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out x);
                        double.TryParse(yText, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out y);

                        FFXIVAetheryte aetheryte = new FFXIVAetheryte();
                        aetheryte.Region = iRegion;
                        aetheryte.Zone   = iZoneName;
                        aetheryte.Name   = nameText;

                        //Conversion aetheryte position to map position
                        double   offsetX      = 0;
                        double   offsetY      = 0;
                        FileInfo metadataFile = new FileInfo(Path.Combine(metadataDirectory.FullName, aetheryte.Zone + ".txt"));
                        if (!metadataFile.Exists)
                        {
                            offsetX = 0;
                            offsetY = 0;
                            File.WriteAllText(metadataFile.FullName, "21.4;21.4");
                        }
                        else
                        {
                            string        metadata            = File.ReadAllText(metadataFile.FullName);
                            List <string> coordinatesMetadata = metadata.Replace(",", ".").Split(';').ToList();
                            double.TryParse(coordinatesMetadata[0], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out offsetX);
                            double.TryParse(coordinatesMetadata[1], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out offsetY);
                        }

                        aetheryte.Position = new FFXIVPosition((x - offsetX) * 50, (y - offsetY) * 50);
                        result.Add(aetheryte);
                    }
                }
            }

            return(result);
        }
示例#11
0
        public static string GetCraftingPreset(string gatheringType, string iSlot, FFXIVGatheredItem iGatheredItem, string iRotation, string iGridName, string iTime)
        {
            if (null == iGatheredItem)
            {
                return("");
            }

            //Looking into cache directory
            string        presetItemName = iGatheredItem.Name + " preset";
            DirectoryInfo exeDirectory   = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo cacheDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "CacheGatheringPreset"));

            if (!cacheDirectory.Exists)
            {
                cacheDirectory.Create();
            }

            FileInfo cacheGridFile = new FileInfo(Path.Combine(cacheDirectory.FullName, presetItemName + ".txt"));
            string   rawPreset     = "";

            if (cacheGridFile.Exists)
            {
                rawPreset = System.IO.File.ReadAllText(cacheGridFile.FullName);
            }
            else
            {
                string useCompass = "******";
                if (gatheringType == "1" || gatheringType == "3")
                {
                    useCompass = "******";
                }
                string useCompass2 = "false";
                if (gatheringType == "1" || gatheringType == "3")
                {
                    useCompass2 = "true";
                }
                rawPreset = "gatherpreset." + presetItemName + Environment.NewLine;
                string nodeName = "";
                string slot     = "";
                string useTruth = "false";
                if (iTime != "")
                {
                    useTruth = "true";
                    //fullScenario += "afkUntil(" + time.Split(',')[0] + ":00et)" + Environment.NewLine;
                }
                {
                    slot     = "0";
                    nodeName = iGatheredItem.Name;

                    {
                        nodeName = nodeName + "\",\"Crystal\",\"Shard";
                    }
                }
                rawPreset += "{\"owntab\":0,\"assistmode\":false,\"nodename\":\"\",\"slot\":" + slot + ",\"maxcount\":32,\"usecompass\":" + useCompass + ",\"usecompass2\":" + useCompass2 + ",\"usetruth\":" + useTruth + ",\"userotation\":true,\"usemacro\":false,\"macro\":\"\",\"speargig\":0,\"spearshadows\":0,\"usecordials\":true,\"usefavors\":false,\"spearcollect\":true,\"spearcollectability\":1,\"byname\":[\"" + nodeName + "\"],\"veterantradebyname\":[],\"gridname\":\"" + iGridName + "\",\"rotationname\":\"" + "" + "\"}" + Environment.NewLine;
            }

            //System.IO.File.WriteAllText(cacheGridFile.FullName, rawPreset);

            rawPreset = rawPreset.Replace("ROTATION_TO_USE", iRotation);

            return(rawPreset);
        }
示例#12
0
        //220680762635-qg38qgp1g1bbmkdjma1o50df199sbsjm.apps.googleusercontent.com
        //3Iub0pwzrs3-tCB4UyP4dgig
        //220680762635-qg38qgp1g1bbmkdjma1o50df199sbsjm.apps.googleusercontent.com
        public static void DownloadGrids()
        {
            FileStream fileStream = null;

            try
            {
                UserCredential credential;

                using (var stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
                {
                    // The file token.json stores the user's access and refresh tokens, and is created
                    // automatically when the authorization flow completes for the first time.
                    string credPath = "token.json";
                    credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                        GoogleClientSecrets.Load(stream).Secrets,
                        Scopes,
                        "user",
                        CancellationToken.None,
                        new FileDataStore(credPath, true)).Result;
                }

                // Create Drive API service.
                var service = new DriveService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName       = "miqocrafter",
                });

                // Define parameters of request.
                FilesResource.ListRequest listRequest = service.Files.List();
                listRequest.PageSize = 10;
                listRequest.Fields   = "nextPageToken, files(id, name)";

                // List files.
                IList <Google.Apis.Drive.v3.Data.File> files = listRequest.Execute().Files;

                if (files != null && files.Count > 0)
                {
                    foreach (var file in files)
                    {
                        if (file.Name == "Release.zip")
                        {
                            //Delete old zip if any
                            FileInfo zipPath = new FileInfo(Path.Combine(Service_Misc.GetExecutionPath(), "Release.zip"));
                            if (zipPath.Exists)
                            {
                                zipPath.Delete();
                            }

                            //Download new zip
                            String fileId = file.Id;
                            fileStream = File.Create(zipPath.FullName);
                            Stream stream = fileStream;
                            service.Files.Get(fileId).Download(stream);
                            fileStream.Close();
                            fileStream = null;

                            //Unzip
                            fileStream = File.OpenRead(zipPath.FullName);
                            using (ZipArchive archive = new ZipArchive(fileStream))
                            {
                                archive.ExtractToDirectory(Service_Misc.GetExecutionPath(), true);
                            }
                            fileStream.Close();
                            fileStream = null;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
            if (null != fileStream)
            {
                fileStream.Close();
            }
        }
示例#13
0
        public static string GenerateScenario(List <FFXIVItem> iItemToGenerate, MiqobotScenarioOption iOptions, System.Windows.Forms.TextBox iLogBox, out string fullScenario)
        {
            fullScenario = "";
            if (null == iOptions)
            {
                Service_Misc.LogText(iLogBox, "Whoooops wrong options selected...");
                return(null);
            }
            Service_Misc.LogText(iLogBox, "Let's whisper to miqobot ears...");

            MiqoCraftOptions options = new MiqoCraftOptions();

            options.Load(OptionLocation.UserOption);

            //Login to miqobot forums
            CookieCollection logMiqobotCookies = Miqobot.LogInForum();

            if (null != logMiqobotCookies)
            {
                Service_Misc.LogText(iLogBox, "I'm logged into miqobot forum !");
            }
            else
            {
                Service_Misc.LogText(iLogBox, "Failed to log into miqobot forum... well you'll have to manually gather stuff, sorry !");
            }

            //Listing items
            List <FFXIVItem> allItems         = new List <FFXIVItem>();
            List <int>       allItemsQuantity = new List <int>();
            string           scenarioName     = "";

            foreach (FFXIVItem iItem in iItemToGenerate)
            {
                if (null == iItem)
                {
                    continue;
                }
                if (scenarioName != "")
                {
                    scenarioName += ",";
                }
                scenarioName += iItem.Name;
                RecFindItems(iItem, iOptions.Quantity, ref allItems, ref allItemsQuantity, iOptions.CustomQuantities);
            }
            if (iItemToGenerate.Count > 5)
            {
                scenarioName = iItemToGenerate.Count + " Items";
            }

            fullScenario = "";
            string allGrids     = "";
            string allRotations = "";
            string allPreset    = "";

            List <string> catalysts = GetCatalysts();

            if (!iOptions.IgnoreCatalysts)
            {
                catalysts.Clear();
            }

            //Creating rotations
            allRotations += "gatherrotation.Collect Gathering +15%" + Environment.NewLine;
            allRotations += "[31,9,22,26,25,[34,[35,29,36,26]],25,[34,[35,29,36,26]],23,1,32]" + Environment.NewLine;
            allRotations += "gatherrotation.Collect Gathering +5%" + Environment.NewLine;
            allRotations += "[31,9,22,26,25,[34,[35,29,36,26]],25,[34,[35,29,36,26]],23,0]" + Environment.NewLine;
            allRotations += "gatherrotation.Gathering +15%/HQ +10%" + Environment.NewLine;
            allRotations += "[31,1,3]" + Environment.NewLine;
            allRotations += "gatherrotation.HQ +10%" + Environment.NewLine;
            allRotations += "[31,3]" + Environment.NewLine;
            allRotations += "gatherrotation.Gathering +5%/HQ +10%" + Environment.NewLine;
            allRotations += "[31,0,3]" + Environment.NewLine;
            allRotations += MiqoCraftCore.GetCacheRotations() + Environment.NewLine;;

            //Creating default preset
            allPreset += "solverpreset.recommended" + Environment.NewLine;
            allPreset += "{\"cpchunk\":4,\"skillinnovation\":true,\"skillmanipulation\":false,\"skillwastenot1\":false,\"skillwastenot2\":false,\"skillwhistle\":false,\"progresssolver\":true,\"enforcebb100\":true,\"enforcepbp100\":true,\"ignorequality\":false,\"reclaimhqon\":false,\"reclaimhqvalue\":85,\"reclaimqualityon\":false,\"reclaimqualityvalue\":4000}" + Environment.NewLine;
            allPreset += MiqoCraftCore.GetCacheSolverPresets() + Environment.NewLine;;

            //Header
            Service_Misc.LogText(iLogBox, "Creating scenario header...");
            fullScenario += "\"";
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;
            fullScenario += "// " + scenarioName + Environment.NewLine;
            fullScenario += "// Script Generated by MiqoCrafter" + Environment.NewLine;
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;
            fullScenario += "// Copyright 2019 - Shishio Valentine" + Environment.NewLine;
            fullScenario += "// [email protected]" + Environment.NewLine;
            fullScenario += "// http://patreon.com/miqocrafter" + Environment.NewLine;
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;

            //Prerequisite
            fullScenario += Environment.NewLine;
            fullScenario += Environment.NewLine;
            fullScenario += "// Prerequisite" + Environment.NewLine;
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;
            fullScenario += "//" + Environment.NewLine;
            if (iOptions.IgnoreCatalysts)
            {
                fullScenario += "// You will need to buy or obtain those items using external means, cause Miqocrafter can't automate it [Yet], or they are ignored catalysts" + Environment.NewLine;
            }
            else
            {
                fullScenario += "// You will need to buy or obtain those items using external means, cause Miqocrafter can't automate it [Yet]" + Environment.NewLine;
            }
            for (int i = 0; i < allItems.Count && i < allItemsQuantity.Count; i++)
            {
                FFXIVItem iItem = allItems[i];
                if (null == iItem)
                {
                    continue;
                }
                int quantity = allItemsQuantity[i];

                FFXIVCraftingOptions itemOptions = options.GetOption(iItem);

                if (iItem.Type == FFXIVItem.TypeItem.NPC || iItem.Type == FFXIVItem.TypeItem.Unkwown || null != catalysts.Find(x => x != null && x.ToLower() == iItem.Name.ToLower()) || (null != itemOptions && itemOptions.IgnoreItem))
                {
                    fullScenario += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                }
            }

            //Reduced
            fullScenario += Environment.NewLine;
            fullScenario += Environment.NewLine;
            fullScenario += "// Reduced Items" + Environment.NewLine;
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;
            fullScenario += "//" + Environment.NewLine;
            fullScenario += "// You will need to manually reduce those items, cause Miqocrafter can't automate it [Yet]" + Environment.NewLine;
            fullScenario += "// However Miqocrafter will try to gather/craft/retrieve the items that need to be reduced." + Environment.NewLine;
            for (int i = 0; i < allItems.Count && i < allItemsQuantity.Count; i++)
            {
                FFXIVItem iItem = allItems[i];
                if (null == iItem)
                {
                    continue;
                }
                int quantity = allItemsQuantity[i];
                FFXIVReducedItem reducedItem = null;
                if (iItem is FFXIVReducedItem)
                {
                    reducedItem = iItem as FFXIVReducedItem;
                }
                if (null != reducedItem)
                {
                    if (null != reducedItem.ReducedFrom)
                    {
                        fullScenario += "//    - " + iItem.Name + " (Reduced from " + reducedItem.ReducedFrom + " - " + iItem.UrlGarland + ")" + Environment.NewLine;
                    }
                    else
                    {
                        fullScenario += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                    }
                }
            }

            //Errors
            fullScenario += "ERRORS_ITEMS_DUMMY";

            fullScenario += "\",";

            //Getting miqo preset content
            string miqoPresetContent = "";

            if (null != iOptions.MiqoPresetPath && "" != iOptions.MiqoPresetPath)
            {
                FileInfo presetFile = new FileInfo(Path.Combine(iOptions.MiqoPresetPath, "presets.miqo"));
                if (presetFile.Exists)
                {
                    miqoPresetContent = File.ReadAllText(presetFile.FullName);
                }
            }
            if (miqoPresetContent == "" && null != options.MiqoPresetPath && "" != options.MiqoPresetPath)
            {
                FileInfo presetFile = new FileInfo(Path.Combine(options.MiqoPresetPath, "presets.miqo"));
                if (presetFile.Exists)
                {
                    miqoPresetContent = File.ReadAllText(presetFile.FullName);
                }
            }

            //Gathering stuff
            string lastTeleport = "";
            string errorContent = "";

            Service_Misc.LogText(iLogBox, "Creating gathering grids...");
            fullScenario += "\"";
            fullScenario += Environment.NewLine;
            fullScenario += Environment.NewLine;
            fullScenario += "// Gathered Items" + Environment.NewLine;
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;
            fullScenario += "//" + Environment.NewLine;
            fullScenario += "// Miqocrafter will use the gathering scenario from https://miqobot.com/forum/forums/topic/index-gathering-grids/ to retrieve those." + Environment.NewLine;
            for (int i = 0; i < allItems.Count && i < allItemsQuantity.Count; i++)
            {
                FFXIVItem iItem = allItems[i];
                if (null == iItem)
                {
                    continue;
                }
                int quantity = allItemsQuantity[i] / iOptions.NbPerNode + 1;

                if (!(iItem is FFXIVGatheredItem))
                {
                    continue;
                }
                FFXIVGatheredItem gatheredItem = iItem as FFXIVGatheredItem;

                if (null != catalysts.Find(x => x != null && x.ToLower() == iItem.Name.ToLower()))
                {
                    continue;
                }
                FFXIVCraftingOptions itemOptions = options.GetOption(iItem);
                if (null != itemOptions && itemOptions.IgnoreItem)
                {
                    continue;
                }

                if (null != gatheredItem)
                {
                    Service_Misc.LogText(iLogBox, "Searching for item grid : " + iItem + "");
                    if (gatheredItem.Slot.Count <= 0)
                    {
                        errorContent += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                        fullScenario += "// Failed to retrieve item gathering slot from FGarlandTool, can't gather this item " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                        continue;
                    }
                    if (null != logMiqobotCookies)
                    {
                        List <MiqoItemPage> listItemPage = Miqobot.GetURLItem(iItem.Name, logMiqobotCookies, null);
                        if (listItemPage.Count <= 0)
                        {
                            errorContent += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                            fullScenario += "// Failed to retrieve item gathering scenario from miqobot forums, can't gather this item " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                        }
                        else
                        {
                            string initName = "";
                            string grid     = null;
                            for (int j = 0; j < listItemPage.Count && null == grid; j++)
                            {
                                grid = Miqobot.GetLastGrid(iItem.Name, logMiqobotCookies, listItemPage[j], out initName);
                            }
                            if (null != grid)
                            {
                                //Finding right zone
                                string zone          = "";
                                string type          = "";
                                string slot          = "";
                                string time          = "";
                                string gatheringType = "";

                                if (gatheredItem.Slot.Count == 1)
                                {
                                    //No ambiguity
                                    zone          = gatheredItem.Zones[0];
                                    type          = gatheredItem.Types[0];
                                    slot          = gatheredItem.Slot[0];
                                    time          = gatheredItem.Times[0];
                                    gatheringType = gatheredItem.GatheringTypes[0];
                                }
                                else
                                {
                                    if (zone == "")
                                    {
                                        foreach (string zoneName in gatheredItem.Zones)
                                        {
                                            string initNameCorrected = initName.Replace(" ", "").ToLower();
                                            string gridDataCorrected = grid.Replace(" ", "").ToLower();
                                            string zoneNameCorrected = zoneName.ToLower().Replace("the ", "").Replace(" ", "").Trim();
                                            if (initNameCorrected.Contains(zoneNameCorrected))
                                            {
                                                int index = gatheredItem.Zones.IndexOf(zoneName);

                                                zone          = gatheredItem.Zones[index];
                                                type          = gatheredItem.Types[index];
                                                slot          = gatheredItem.Slot[index];
                                                time          = gatheredItem.Times[index];
                                                gatheringType = gatheredItem.GatheringTypes[index];
                                                break;
                                            }
                                            if (gridDataCorrected.Contains(zoneNameCorrected))
                                            {
                                                int index = gatheredItem.Zones.IndexOf(zoneName);

                                                zone          = gatheredItem.Zones[index];
                                                type          = gatheredItem.Types[index];
                                                slot          = gatheredItem.Slot[index];
                                                time          = gatheredItem.Times[index];
                                                gatheringType = gatheredItem.GatheringTypes[index];
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (zone == "")
                                {
                                    errorContent += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                                    fullScenario += "// Failed to retrieve item gathering zone from miqobot grid, can't gather this item " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                                    continue;
                                }

                                //Find teleport item
                                string teleportTo = GarlandTool.GetTeleportName(zone, grid, gatheredItem);

                                //Compute grid name from miqo presets, to avoid duplicates
                                string gridName  = iItem.Name + " Grid";
                                int    indexGrid = 1;
                                while (miqoPresetContent.Contains("grid." + gridName + Environment.NewLine))
                                {
                                    string oldGridName = gridName;
                                    gridName = iItem.Name + " Grid" + indexGrid;
                                    grid     = grid.Replace("grid." + oldGridName + Environment.NewLine, "grid." + gridName + Environment.NewLine);
                                    indexGrid++;
                                }

                                //Embed grid
                                allGrids += grid + Environment.NewLine;

                                //Get preset
                                string preset = MiqoCraftCore.GetCraftingPreset(gatheringType, slot, gatheredItem, iOptions.GatheringRotation, gridName, time);

                                //Compute preset name from miqo presets, to avoid duplicates
                                string presetName  = iItem.Name + " preset";
                                int    indexpreset = 1;
                                while (miqoPresetContent.Contains("gatherpreset." + presetName + Environment.NewLine))
                                {
                                    string oldpresetName = presetName;
                                    presetName = iItem.Name + " preset" + indexpreset;
                                    preset     = preset.Replace("gatherpreset." + oldpresetName + Environment.NewLine, "gatherpreset." + presetName + Environment.NewLine);
                                    indexpreset++;
                                }

                                //Embed a new preset
                                allPreset += preset;

                                //Add gathering rotation to scenario
                                //Add gathering rotation to scenario
                                //teleportIf(Black Brush Station)\r\nunstealth()\r\nchangeJob(Miner)\r\nselectGrid(Min5-Copper Ore)\r\nselectGatherPreset(Metal Worm Jar- Copper Ore)\r\nstartGathering(4)
                                //teleportIfNotThere
                                fullScenario += "// Gathering " + iItem.Name + Environment.NewLine;
                                if (lastTeleport == "" || lastTeleport == teleportTo)
                                {
                                    fullScenario += "teleport(" + teleportTo + ")" + Environment.NewLine;
                                }
                                else
                                {
                                    fullScenario += "teleportIfNotThere(" + teleportTo + ")" + Environment.NewLine;
                                }
                                lastTeleport = teleportTo;

                                //Adding custom scenario after teleport
                                DirectoryInfo customDirectory = new DirectoryInfo(Path.Combine(Service_Misc.GetExecutionPath(), "CustomTeleport"));
                                if (!customDirectory.Exists)
                                {
                                    customDirectory.Create();
                                }
                                FileInfo customTeleportScenarioFile = new FileInfo(Path.Combine(customDirectory.FullName, teleportTo + " Scenario.txt"));
                                if (customTeleportScenarioFile.Exists)
                                {
                                    fullScenario += File.ReadAllText(customTeleportScenarioFile.FullName) + Environment.NewLine;
                                }

                                FileInfo customTeleportGridFile = new FileInfo(Path.Combine(customDirectory.FullName, teleportTo + " Grid.txt"));
                                if (customTeleportGridFile.Exists)
                                {
                                    allGrids += File.ReadAllText(customTeleportGridFile.FullName) + Environment.NewLine;
                                }


                                //fullScenario += "unstealth()" + Environment.NewLine;
                                fullScenario += "changeJob(" + GarlandTool.GetGatheringJobName(gatheringType, iItem) + ")" + Environment.NewLine;
                                fullScenario += "selectGrid(" + gridName + ")" + Environment.NewLine;
                                fullScenario += "selectGatherPreset(" + presetName + ")" + Environment.NewLine;
                                if (null != gatheredItem && gatheredItem.AsCollectable)
                                {
                                    fullScenario += "rotationIfGP(470 Collect 5% Gathering)" + Environment.NewLine;
                                    fullScenario += "rotationIfGP(470 Collect 15% Gathering)" + Environment.NewLine;
                                }
                                else
                                {
                                    fullScenario += "rotationIfGP(" + iOptions.GatheringRotation + ")" + Environment.NewLine;
                                }
                                fullScenario += "startGathering(" + quantity + ")" + Environment.NewLine;
                                fullScenario += Environment.NewLine;
                            }
                            else
                            {
                                errorContent += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                                fullScenario += "// Failed to retrieve the grid from miqobot forums, can't gather this item " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                            }
                        }
                    }
                    else
                    {
                        errorContent += "//    - " + quantity + "x " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                        fullScenario += "// Failed to log into miqobot forums, can't gather this item " + iItem.Name + " (see " + iItem.UrlGarland + ")" + Environment.NewLine;
                    }
                }
            }
            fullScenario += "\",";

            //Crafting stuff
            Service_Misc.LogText(iLogBox, "Generating craft scenario...");
            fullScenario += "\"";
            fullScenario += Environment.NewLine;
            fullScenario += Environment.NewLine;
            fullScenario += "// Crafted Items" + Environment.NewLine;
            fullScenario += "//--------------------------------------------------------------" + Environment.NewLine;
            fullScenario += "//" + Environment.NewLine;
            fullScenario += "solverPreset(" + iOptions.CraftPreset + ")" + Environment.NewLine;
            fullScenario += "nqhq(" + iOptions.NQHQPreset + ")" + Environment.NewLine;
            fullScenario += "reclaimOff()" + Environment.NewLine;

            string teleportCraft = iOptions.CustomTeleport;

            if (teleportCraft != "")
            {
                fullScenario += "teleport(" + teleportCraft + ")" + Environment.NewLine;
            }

            List <FFXIVCraftedItem> listAllCraftedItems = new List <FFXIVCraftedItem>();

            for (int i = 0; i < allItems.Count && i < allItemsQuantity.Count; i++)
            {
                FFXIVItem iItem = allItems[i];
                if (null == iItem)
                {
                    continue;
                }
                int quantity = allItemsQuantity[i];
                FFXIVCraftedItem craftedItem = null;
                if (iItem is FFXIVCraftedItem)
                {
                    craftedItem = iItem as FFXIVCraftedItem;
                }
                if (null != craftedItem)
                {
                    listAllCraftedItems.Add(craftedItem);
                }
            }
            for (int i = 0; i < allItems.Count && i < allItemsQuantity.Count; i++)
            {
                FFXIVItem iItem = allItems[i];
                if (null == iItem)
                {
                    continue;
                }
                int quantity = allItemsQuantity[i];
                FFXIVCraftedItem craftedItem = null;
                if (iItem is FFXIVCraftedItem)
                {
                    craftedItem = iItem as FFXIVCraftedItem;
                }
                FFXIVCraftingOptions itemOptions = options.GetOption(iItem);
                if (null != itemOptions && itemOptions.IgnoreItem)
                {
                    continue;
                }

                if (null != craftedItem)
                {
                    fullScenario += "// " + craftedItem + Environment.NewLine;

                    int indexCraftedItem = listAllCraftedItems.IndexOf(craftedItem);
                    if (listAllCraftedItems.IndexOf(craftedItem) >= listAllCraftedItems.Count - 1 && iOptions.Collectable)
                    {
                        fullScenario += "setCraftCollect(on)" + Environment.NewLine;
                    }
                    else
                    {
                        fullScenario += "setCraftCollect(off)" + Environment.NewLine;
                    }

                    fullScenario += "job(" + craftedItem.Class + ")" + Environment.NewLine;
                    fullScenario += "recipe(" + craftedItem.Name + ")" + Environment.NewLine;

                    if (null != itemOptions && itemOptions.CustomCraftingMacro != "")
                    {
                        fullScenario += "selectCraftMacro(" + itemOptions.CustomCraftingMacro + ")" + Environment.NewLine;
                    }

                    fullScenario += "craft(" + quantity + ")" + Environment.NewLine;

                    if (listAllCraftedItems.IndexOf(craftedItem) >= listAllCraftedItems.Count - 1 && iOptions.Collectable)
                    {
                        fullScenario += "setCraftCollect(off)" + Environment.NewLine;
                    }

                    if (null != itemOptions && itemOptions.CustomCraftingMacro != "")
                    {
                        fullScenario += "solverPreset(" + iOptions.CraftPreset + ")" + Environment.NewLine;
                    }
                    fullScenario += Environment.NewLine;
                }
            }
            fullScenario += "\"";

            if (errorContent == "")
            {
                fullScenario = fullScenario.Replace("ERRORS_ITEMS_DUMMY", "");
            }
            else
            {
                string scenarioError = "";
                scenarioError += Environment.NewLine;
                scenarioError += Environment.NewLine;
                scenarioError += "// Items without grid / Miqocrafter couldn't automate" + Environment.NewLine;
                scenarioError += "//--------------------------------------------------------------" + Environment.NewLine;
                scenarioError += "//" + Environment.NewLine;
                scenarioError += "// You will need to buy or obtain those items using external means, cause Miqocrafter can't automate it [Yet]" + Environment.NewLine;
                scenarioError += errorContent;
                scenarioError += Environment.NewLine;
                fullScenario   = fullScenario.Replace("ERRORS_ITEMS_DUMMY", scenarioError);
            }

            string textFileContent = "scenario.Craft " + scenarioName + Environment.NewLine;

            textFileContent += "{ \"chapters\":[";
            textFileContent += fullScenario.Replace(Environment.NewLine, "\\r\\n").Replace("/", "\\/");
            textFileContent += "]}" + Environment.NewLine;

            textFileContent += allRotations + Environment.NewLine;
            textFileContent += allGrids + Environment.NewLine;
            textFileContent += allPreset + Environment.NewLine;

            while (textFileContent.Contains(Environment.NewLine + Environment.NewLine))
            {
                textFileContent = textFileContent.Replace(Environment.NewLine + Environment.NewLine, Environment.NewLine);
            }

            return(textFileContent);
        }
示例#14
0
        /// <summary>
        /// Retrieve all gathering nodes from an item
        /// </summary>
        /// <param name="iItemID"></param>
        /// <returns></returns>
        public static List <FFXIVGatheringNode> GetGatheringNodesFromItem(string iItemID)
        {
            List <FFXIVGatheringNode> result = new List <FFXIVGatheringNode>();

            if (null == iItemID)
            {
                return(result);
            }

            //https://www.garlandtools.org/db/doc/item/en/3/26498.json

            CookieCollection iCookies = new CookieCollection();
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            string searchResultContent = Service_Misc.GetContentFromRequest("GET https://www.garlandtools.org/db/doc/item/en/3/" + iItemID + ".json HTTP/1.1|Host: www.garlandtools.org|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: cross-site|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                            iCookies, ref oCookies, ref oCode);

            try
            {
                string logName2 = Path.Combine(Service_Misc.GetExecutionPath(), "Searchlog.log");
                File.WriteAllText(logName2, searchResultContent);
            }
            catch
            {
            }

            string logName           = Path.Combine(Service_Misc.GetExecutionPath(), "GeneralDataBase.log");
            string dataResultContent = "";

            if (File.Exists(logName))
            {
                dataResultContent = File.ReadAllText(logName);
            }

            if (dataResultContent == "")
            {
                dataResultContent = Service_Misc.RemoveIllegalCharacters(Service_Misc.GetContentFromRequest("GET http://garlandtools.org/db/doc/core/en/3/data.json HTTP/1.1|Host: garlandtools.org|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Accept: application/json, text/javascript, */*; q=0.01|X-Requested-With: XMLHttpRequest|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Referer: http://garlandtools.org/db/|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                                                            iCookies, ref oCookies, ref oCode));

                try
                {
                    File.WriteAllText(logName, dataResultContent);
                }
                catch
                {
                }
            }
            try
            {
                JToken mainToken = JObject.Parse(searchResultContent);
                if (null == mainToken)
                {
                    return(result);
                }

                JToken dataToken = JObject.Parse(dataResultContent);
                if (null == dataToken)
                {
                    return(result);
                }

                JToken itemToken = mainToken["item"];
                if (null == itemToken)
                {
                    return(result);
                }

                JToken nodeToken = itemToken["nodes"];
                if (null != nodeToken)
                {
                    return(ReadGatheredNodes(iCookies, ref oCookies, ref oCode, dataToken, itemToken, nodeToken));
                }
            }
            catch
            {
            }

            return(result);
        }
示例#15
0
        public static List <FFXIVGatheringNode> GetFFXIVGatheringNodesFromTable(HtmlNode iNode, string iJobName, FFXIVGatheringNode.NodeType iType = FFXIVGatheringNode.NodeType.Standard)
        {
            List <FFXIVGatheringNode> result = new List <FFXIVGatheringNode>();

            if (null == iNode)
            {
                return(result);
            }

            DirectoryInfo exeDirectory      = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo metadataDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "Metadata"));


            int indexItems    = -1;
            int indexLocation = -1;
            int indexName     = -1;

            List <HtmlNode> listthNodes = iNode.Descendants("th").ToList();

            for (int i = 0; i < listthNodes.Count; i++)
            {
                HtmlNode thNode = listthNodes[i];
                if (null == thNode)
                {
                    continue;
                }

                string thText = thNode.InnerText.Trim().ToLower();
                if (thText == "item" || thText == "items" || thText == "fish name" || thText == "fish")
                {
                    indexItems = i;
                }
                else if (thText == "coordinate" || thText == "coordinates")
                {
                    indexLocation = i;
                }
                else if (thText == "location" || thText == "zone")
                {
                    indexName = i;
                }
            }

            if (indexItems < 0)
            {
                return(result);
            }
            if (indexName < 0)
            {
                return(result);
            }
            if (indexLocation < 0)
            {
                return(result);
            }

            foreach (HtmlNode trNode in iNode.Descendants("tr"))
            {
                List <HtmlNode> listtdNodes = trNode.Descendants("td").ToList();
                if (listtdNodes.Count <= indexItems)
                {
                    continue;
                }
                if (listtdNodes.Count <= indexLocation)
                {
                    continue;
                }
                if (listtdNodes.Count <= indexName)
                {
                    continue;
                }
                string        coordinates = listtdNodes[indexLocation].InnerText.Trim().ToLower().Replace(":", "").Replace("x", "").Replace("y", "");
                string        nameZone    = listtdNodes[indexName].InnerText.Trim();
                List <string> items       = listtdNodes[indexItems].InnerText.Trim().Split(new string[] { Environment.NewLine, ",", "\n" }, StringSplitOptions.None).ToList();

                double x = 0, y = 0;
                if (coordinates == "(shore)")
                {
                }
                else
                {
                    if (!coordinates.Contains("("))
                    {
                        coordinates = "(" + coordinates;
                    }
                    if (!coordinates.Contains(")"))
                    {
                        coordinates = coordinates + ")";
                    }
                    if (!coordinates.Contains(","))
                    {
                        coordinates = coordinates.Replace(" ", ",");
                    }

                    string xText = coordinates.Split(new string[] { "(" }, StringSplitOptions.None)[1].Split(',')[0].Trim();
                    string yText = coordinates.Split(new string[] { "," }, StringSplitOptions.None)[1].Split(')')[0].Trim();
                    double.TryParse(xText, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out x);
                    double.TryParse(yText, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out y);
                }

                string nameNode = nameZone.Replace(" ", "_") + "_" + x + "_" + y;

                FFXIVGatheringNode gatheringNode = null;
                foreach (FFXIVGatheringNode node in result)
                {
                    if (node.Name == nameNode)
                    {
                        gatheringNode = node;
                    }
                }
                if (null == gatheringNode)
                {
                    gatheringNode      = new FFXIVGatheringNode();
                    gatheringNode.Name = nameNode;

                    //Conversion aetheryte position to map position
                    double offsetX = 0;
                    double offsetY = 0;
                    if (nameZone == "Greytail Falls")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "South Banepool")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "West Banepool")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Unfrozen Pond")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Ashpool")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Riversmeet")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Dragonspit")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Clearpool")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }

                    if (nameZone == "Voor Sian Siran")
                    {
                        nameZone = "The Sea of Clouds";
                    }
                    if (nameZone == "Mok Oogl Island")
                    {
                        nameZone = "The Sea of Clouds";
                    }
                    if (nameZone == "Cloudtop")
                    {
                        nameZone = "The Sea of Clouds";
                    }
                    if (nameZone == "The Blue Window")
                    {
                        nameZone = "The Sea of Clouds";
                    }
                    if (nameZone == "The Eddies")
                    {
                        nameZone = "The Sea of Clouds";
                    }

                    if (nameZone == "Riversmeet")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Riversmeet")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    if (nameZone == "Riversmeet")
                    {
                        nameZone = "Coerthas Western Highlands";
                    }
                    FileInfo metadataFile = new FileInfo(Path.Combine(metadataDirectory.FullName, nameZone + ".txt"));
                    if (!metadataFile.Exists)
                    {
                        metadataFile = new FileInfo(Path.Combine(metadataDirectory.FullName, "The " + nameZone + ".txt"));
                        if (metadataFile.Exists)
                        {
                            nameZone = "The " + nameZone;
                        }
                    }
                    if (!metadataFile.Exists)
                    {
                        offsetX = 0;
                        offsetY = 0;
                        //File.WriteAllText(metadataFile.FullName, "21.4;21.4");
                    }
                    else
                    {
                        string        metadata            = File.ReadAllText(metadataFile.FullName);
                        List <string> coordinatesMetadata = metadata.Replace(",", ".").Split(';').ToList();
                        double.TryParse(coordinatesMetadata[0], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out offsetX);
                        double.TryParse(coordinatesMetadata[1], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out offsetY);
                    }
                    gatheringNode.Zone       = nameZone;
                    gatheringNode.Position   = new FFXIVPosition((x - offsetX) * 50, (y - offsetY) * 50);
                    gatheringNode.JobTrigram = iJobName;
                    gatheringNode.Type       = iType;
                    result.Add(gatheringNode);
                }
                gatheringNode.NodeItems.AddRange(items);
            }


            return(result);
        }
示例#16
0
        public static List <FFXIVGatheringNode> GetFFXIVGatheringNodes()
        {
            List <FFXIVGatheringNode> result = new List <FFXIVGatheringNode>();

            //MIN Node
            CookieCollection iCookies = new CookieCollection();
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            HtmlDocument answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Mining_Node_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                                     iCookies, ref oCookies, ref oCode);

            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "MIN", FFXIVGatheringNode.NodeType.Standard));
                }
            }
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Unspoiled_Mining_Nodes HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "MIN", FFXIVGatheringNode.NodeType.Unspoiled));
                }
            }

            //BTN Node
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Botanist_Node_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "BTN", FFXIVGatheringNode.NodeType.Standard));
                }
            }
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Unspoiled_Botanist_Nodes HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "BTN", FFXIVGatheringNode.NodeType.Unspoiled));
                }
            }

            //FSH Node
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Heavensward_Fishing_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "FSH", FFXIVGatheringNode.NodeType.Standard));
                }
            }
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Stormblood_Spearfishing_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "FSH", FFXIVGatheringNode.NodeType.Standard));
                }
            }
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Stormblood_Fishing_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "FSH", FFXIVGatheringNode.NodeType.Standard));
                }
            }
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Shadowbringers_Spearfishing_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "FSH", FFXIVGatheringNode.NodeType.Standard));
                }
            }
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Shadowbringers_Fishing_Locations HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                foreach (HtmlNode node in answer.DocumentNode.Descendants("table"))
                {
                    result.AddRange(GetFFXIVGatheringNodesFromTable(node, "FSH", FFXIVGatheringNode.NodeType.Standard));
                }
            }

            //Ephemeral Node
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Ephemeral_Nodes HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                HtmlNode contentNode = answer.GetElementbyId("mw-content-text");
                if (null == contentNode)
                {
                    return(result);
                }

                string currentRegion = "Unknown";
                foreach (HtmlNode childNode in contentNode.ChildNodes)
                {
                    if (childNode.Name == "h3")
                    {
                        currentRegion = childNode.InnerText.Trim();
                        if (currentRegion.ToLower().Contains("fish"))
                        {
                            currentRegion = "FSH";
                        }
                        else if (currentRegion.ToLower().Contains("min"))
                        {
                            currentRegion = "MIN";
                        }
                        else if (currentRegion.ToLower().Contains("bot") || currentRegion.ToLower().Contains("btn"))
                        {
                            currentRegion = "BTN";
                        }
                    }
                    else if (childNode.Name == "table" && (currentRegion == "BTN" || currentRegion == "MIN" || currentRegion == "FSH"))
                    {
                        result.AddRange(GetFFXIVGatheringNodesFromTable(childNode, currentRegion, FFXIVGatheringNode.NodeType.Ephemeral));
                    }
                }
            }

            //Folklore Node
            answer = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Folklore_Nodes HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                        iCookies, ref oCookies, ref oCode);
            if (null != answer)
            {
                HtmlNode contentNode = answer.GetElementbyId("mw-content-text");
                if (null == contentNode)
                {
                    return(result);
                }

                string currentRegion = "Unknown";
                foreach (HtmlNode childNode in contentNode.ChildNodes)
                {
                    if (childNode.Name == "h2")
                    {
                        currentRegion = childNode.InnerText.Trim();
                        if (currentRegion.ToLower().Contains("fish"))
                        {
                            currentRegion = "FSH";
                        }
                        else if (currentRegion.ToLower().Contains("min"))
                        {
                            currentRegion = "MIN";
                        }
                        else if (currentRegion.ToLower().Contains("bot") || currentRegion.ToLower().Contains("btn"))
                        {
                            currentRegion = "BTN";
                        }
                    }
                    else if (childNode.Name == "table" && (currentRegion == "BTN" || currentRegion == "MIN" || currentRegion == "FSH"))
                    {
                        result.AddRange(GetFFXIVGatheringNodesFromTable(childNode, currentRegion, FFXIVGatheringNode.NodeType.Folklore));
                    }
                }
            }


            return(result);
        }
示例#17
0
        /// <summary>
        /// Recursively build an item craft tree
        /// </summary>
        /// <param name="iItem"></param>
        public static FFXIVItem RecBuildCraftingTree(System.Windows.Forms.TextBox iLogBox, string iItemID, int quantity = 1)
        {
            if (null == iItemID)
            {
                return(null);
            }

            //https://www.garlandtools.org/db/doc/item/en/3/26498.json

            FFXIVItem item = null;

            CookieCollection iCookies = new CookieCollection();
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            string searchResultContent = Service_Misc.GetContentFromRequest("GET https://www.garlandtools.org/db/doc/item/en/3/" + iItemID + ".json HTTP/1.1|Host: www.garlandtools.org|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: cross-site|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                            iCookies, ref oCookies, ref oCode);

            try
            {
                string logName2 = Path.Combine(Service_Misc.GetExecutionPath(), "Searchlog.log");
                File.WriteAllText(logName2, searchResultContent);
            }
            catch
            {
            }

            string logName           = Path.Combine(Service_Misc.GetExecutionPath(), "GeneralDataBase.log");
            string dataResultContent = "";

            if (File.Exists(logName))
            {
                dataResultContent = File.ReadAllText(logName);
            }

            if (dataResultContent == "")
            {
                dataResultContent = Service_Misc.RemoveIllegalCharacters(Service_Misc.GetContentFromRequest("GET http://garlandtools.org/db/doc/core/en/3/data.json HTTP/1.1|Host: garlandtools.org|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Accept: application/json, text/javascript, */*; q=0.01|X-Requested-With: XMLHttpRequest|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Referer: http://garlandtools.org/db/|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                                                            iCookies, ref oCookies, ref oCode));

                try
                {
                    File.WriteAllText(logName, dataResultContent);
                }
                catch
                {
                }
            }

            try
            {
                JToken mainToken = JObject.Parse(searchResultContent);
                if (null == mainToken)
                {
                    return(item);
                }

                JToken dataToken = JObject.Parse(dataResultContent);
                if (null == dataToken)
                {
                    return(item);
                }

                JToken itemToken = mainToken["item"];
                if (null == itemToken)
                {
                    return(item);
                }

                JToken        mainIngredientToken = mainToken["ingredients"];
                List <JToken> allIngredientsToken = new List <JToken>();
                List <string> allIngredientsIDs   = new List <string>();
                if (null != mainIngredientToken)
                {
                    //Listing ingredients nodes and ID

                    foreach (JToken ingredientToken in mainIngredientToken.Children())
                    {
                        if (null == ingredientToken)
                        {
                            continue;
                        }

                        string ID = ingredientToken["id"].Value <string>();
                        allIngredientsIDs.Add(ID);
                        allIngredientsToken.Add(ingredientToken);
                    }
                }

                item = CreateItemFromNode(iLogBox, iCookies, ref oCookies, ref oCode, itemToken, dataToken, allIngredientsToken, allIngredientsIDs);
                if (null != item)
                {
                    item.Quantity = quantity;
                }
            }
            catch (Exception exc)
            {
                Service_Misc.LogText(iLogBox, "Ouch I failed !");
                Service_Misc.LogText(iLogBox, exc.Message);
            }

            if (null != item)
            {
                Service_Misc.LogText(iLogBox, "Got this item ! " + item);
            }
            return(item);
        }
示例#18
0
        private static FFXIVItem CreateItemFromNode(System.Windows.Forms.TextBox iLogBox, CookieCollection iCookies, ref CookieCollection oCookies, ref HttpStatusCode oCode, JToken iItemNode, JToken iDataNode, List <JToken> iIngredientsToken, List <string> iIngredienstIDs)
        {
            FFXIVItem item = null;

            if (null == iItemNode)
            {
                return(null);
            }

            JToken itemToken = iItemNode;

            if (null == itemToken)
            {
                return(item);
            }

            JToken craftToken   = itemToken["craft"];
            JToken nodeToken    = itemToken["nodes"];
            JToken reducedToken = itemToken["reducedFrom"];
            JToken tradeShop    = itemToken["tradeShops"];
            JToken vendor       = itemToken["vendors"];

            if (null != craftToken)
            {
                FFXIVCraftedItem craftedItem = new FFXIVCraftedItem();
                craftedItem.Type = FFXIVItem.TypeItem.Crafted;

                string jobID = craftToken[0]["job"].Value <string>();
                craftedItem.Class    = GetJobName(jobID);
                craftedItem.UrlClass = "http://garlandtools.org/files/icons/job/" + craftedItem.Class + ".png";
                craftedItem.Level    = craftToken[0]["lvl"].Value <string>();

                int    yieldQuantity = 1;
                JToken yieldToken    = craftToken[0]["yield"];
                if (null != yieldToken)
                {
                    yieldQuantity = yieldToken.Value <int>();
                }
                craftedItem.RecipeQuantity = yieldQuantity;

                //Building craft requirement list
                foreach (JToken ingredientToken in craftToken[0]["ingredients"].Children())
                {
                    if (null == ingredientToken)
                    {
                        continue;
                    }

                    string ingredientID = ingredientToken["id"].Value <string>();

                    //Finding right ingredient token from input list, with all informations
                    JToken    fullIngredientNode = ingredientToken;
                    int       indexInList        = iIngredienstIDs.IndexOf(ingredientID);
                    FFXIVItem ingredient         = null;
                    if (indexInList >= 0 && indexInList < iIngredientsToken.Count)
                    {
                        fullIngredientNode = iIngredientsToken[indexInList];
                        ingredient         = CreateItemFromNode(iLogBox, iCookies, ref oCookies, ref oCode, fullIngredientNode, iDataNode, iIngredientsToken, iIngredienstIDs);
                    }
                    else
                    {
                        ingredient = RecBuildCraftingTree(iLogBox, ingredientID, 1);
                    }

                    //Adding Item
                    if (null != ingredient)
                    {
                        ingredient.Quantity = ingredientToken["amount"].Value <int>();
                        craftedItem.ListNeededItems.Add(ingredient);
                    }
                    else
                    {
                        Service_Misc.LogText(iLogBox, "Oups... failed to retrieve one ingredient : ID=" + ingredientToken["id"].Value <string>());
                    }
                }

                item = craftedItem;
            }
            else if (null != nodeToken)
            {
                FFXIVGatheredItem gatheredItem = ReadGatheredItem(iCookies, ref oCookies, ref oCode, iDataNode, itemToken, nodeToken);
                item      = gatheredItem;
                item.Type = FFXIVItem.TypeItem.Gathered;
            }
            else if (null != reducedToken)
            {
                item = ReadReducedItem(iLogBox, reducedToken);
            }
            else if (null != tradeShop || null != vendor)
            {
                item      = new FFXIVItem();
                item.Type = FFXIVItem.TypeItem.NPC;
            }
            else
            {
                item      = new FFXIVItem();
                item.Type = FFXIVItem.TypeItem.Unkwown;
                Service_Misc.LogText(iLogBox, "Oups... one ingredient is unknown, don't know how to get this one.");
            }

            if (null != item)
            {
                try
                {
                    item.Name       = itemToken["name"].Value <string>();
                    item.UrlImage   = "http://garlandtools.org/files/icons/item/" + itemToken["icon"].Value <string>() + ".png";
                    item.UrlGarland = "http://garlandtools.org/db/#item/" + itemToken["id"].Value <string>();
                    item.ID         = itemToken["id"].Value <string>();
                }
                catch (Exception)
                {
                    Service_Misc.LogText(iLogBox, "Oups... failed to retrieve one item : Token=" + Environment.NewLine + iItemNode.ToString());
                }
            }

            return(item);
        }
示例#19
0
        private static FFXIVGatheredItem ReadGatheredItem(CookieCollection iCookies, ref CookieCollection oCookies, ref HttpStatusCode oCode, JToken dataToken, JToken itemToken, JToken nodeToken)
        {
            FFXIVGatheredItem gatheredItem = new FFXIVGatheredItem();

            //Adding nodes info
            foreach (JToken gatherNodeToken in nodeToken.Children())
            {
                try
                {
                    string nodeSearchContent = Service_Misc.GetContentFromRequest("GET http://garlandtools.org/db/doc/node/en/2/" + gatherNodeToken.Value <string>() + ".json HTTP/1.1|Host: garlandtools.org|Connection: keep-alive|Accept: application/json, text/javascript, */*; q=0.01|X-Requested-With: XMLHttpRequest|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Referer: http://garlandtools.org/db/|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                                  iCookies, ref oCookies, ref oCode);

                    try
                    {
                        string logName2 = Path.Combine(Service_Misc.GetExecutionPath(), "Node.log");
                        File.WriteAllText(logName2, nodeSearchContent);
                    }
                    catch
                    {
                    }

                    JToken gatherResultToken = JObject.Parse(nodeSearchContent);
                    if (null == gatherResultToken)
                    {
                        continue;
                    }

                    JToken gatherResultNodeToken = gatherResultToken.Children().ToList()[0].Children().ToList()[0];
                    if (null == gatherResultNodeToken)
                    {
                        continue;
                    }

                    string zoneID = gatherResultNodeToken["zoneid"].Value <string>();

                    JToken locationToken = dataToken["locationIndex"];
                    if (null == locationToken)
                    {
                        continue;
                    }

                    JToken zoneIDToken = locationToken[zoneID];
                    if (null == zoneIDToken)
                    {
                        continue;
                    }

                    JToken zoneNameToken = zoneIDToken["name"];
                    if (null == zoneNameToken)
                    {
                        continue;
                    }

                    string zone          = zoneNameToken.Value <string>();
                    string gatheringType = gatherResultNodeToken["type"].Value <string>();
                    string type          = "";
                    if (null != gatherResultNodeToken["limitType"])
                    {
                        type = gatherResultNodeToken["limitType"].Value <string>();
                    }
                    string slot = "";
                    foreach (JToken slotToken in gatherResultNodeToken["items"])
                    {
                        if (null == slotToken)
                        {
                            continue;
                        }
                        if (null == slotToken["slot"])
                        {
                            continue;
                        }
                        if (null == slotToken["id"])
                        {
                            continue;
                        }
                        string id            = slotToken["id"].Value <string>();
                        string slotCandidate = slotToken["slot"].Value <string>();
                        if (id == itemToken["id"].Value <string>())
                        {
                            slot = slotCandidate;
                            break;
                        }
                    }
                    string time = "";
                    if (null != gatherResultNodeToken["time"])
                    {
                        foreach (JToken timeToken in gatherResultNodeToken["time"])
                        {
                            if (null == timeToken)
                            {
                                continue;
                            }
                            if (time != "")
                            {
                                time += ",";
                            }
                            time += timeToken.Value <string>();
                        }
                    }

                    gatheredItem.Zones.Add(zone);
                    gatheredItem.NodeType.Add("");
                    gatheredItem.Slot.Add(slot);
                    gatheredItem.Times.Add(time);
                    gatheredItem.Types.Add(type);
                    gatheredItem.GatheringTypes.Add(gatheringType);
                }
                catch (Exception exc)
                {
                    string msg = exc.Message;
                }
            }

            return(gatheredItem);
        }
示例#20
0
        public void SaveAsGrids()
        {
            if (!IsValid)
            {
                return;
            }

            BuildPicture();

            DirectoryInfo exeDirectory           = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo newGridDirectory       = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "NewGrids"));
            DirectoryInfo newGridBitmapDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "NewGridsBitmap"));

            if (!newGridDirectory.Exists)
            {
                newGridDirectory.Create();
            }
            if (!newGridBitmapDirectory.Exists)
            {
                newGridBitmapDirectory.Create();
            }
            if (null != ClosestNode)
            {
                foreach (string itemName in ClosestNode.NodeItems)
                {
                    string fileName = Service_Misc.UppercaseWords(itemName).Replace(" (Hidden)", "").Replace(" (Rare)", "").Trim() + " Grid";
                    fileName = fileName.Split(new string[] { "---" }, StringSplitOptions.None)[0] + ".txt";

                    Picture.Save(Path.Combine(newGridBitmapDirectory.FullName, fileName) + "_" + ClosestNodeDistance + ".png", ImageFormat.Png);

                    string contentGrid          = File.ReadAllText(GridFile.FullName);
                    string correctedGrid        = contentGrid;
                    string correctedDescription = "[" + ClosestAetheryte.Zone.Trim() + " @" + ClosestAetheryte.Name.Trim() + "]";

                    string startDescription = "{\"description\":";
                    string endDescription   = ",\"maxaway\"";
                    if (!correctedGrid.Contains(startDescription) || !correctedGrid.Contains(endDescription))
                    {
                        Status = "Bad format for automatic description";
                        return;
                    }

                    string beginGrid = contentGrid.Split(new string[] { startDescription }, StringSplitOptions.None)[0];
                    string endGrid   = contentGrid.Split(new string[] { endDescription }, StringSplitOptions.None)[1];

                    ComputedDescription = correctedDescription;
                    correctedGrid       = beginGrid + startDescription + "\"" + correctedDescription + "\"" + endDescription + endGrid;
                    File.WriteAllText(Path.Combine(newGridDirectory.FullName, Service_Misc.UppercaseWords(fileName)), correctedGrid);
                }
            }
            else
            {
                string fileName = Service_Misc.UppercaseWords(ItemName).Replace(" (Hidden)", "").Replace(" (Rare)", "").Trim() + " Grid";
                fileName = fileName.Split(new string[] { "---" }, StringSplitOptions.None)[0] + ".txt";

                Picture.Save(Path.Combine(newGridBitmapDirectory.FullName, fileName) + "_" + ClosestNodeDistance + ".png", ImageFormat.Png);

                string contentGrid          = File.ReadAllText(GridFile.FullName);
                string correctedGrid        = contentGrid;
                string correctedDescription = "[" + ClosestAetheryte.Zone.Trim() + " @" + ClosestAetheryte.Name.Trim() + "]";

                string startDescription = "{\"description\":";
                string endDescription   = ",\"maxaway\"";
                if (!correctedGrid.Contains(startDescription) || !correctedGrid.Contains(endDescription))
                {
                    Status = "Bad format for automatic description";
                    return;
                }

                string beginGrid = contentGrid.Split(new string[] { startDescription }, StringSplitOptions.None)[0];
                string endGrid   = contentGrid.Split(new string[] { endDescription }, StringSplitOptions.None)[1];

                ComputedDescription = correctedDescription;
                correctedGrid       = beginGrid + startDescription + "\"" + correctedDescription + "\"" + endDescription + endGrid;
                File.WriteAllText(Path.Combine(newGridDirectory.FullName, Service_Misc.UppercaseWords(fileName)), correctedGrid);
            }
        }
示例#21
0
        public static List <FFXIVSearchItem> Search(string iElemToSearch, System.Windows.Forms.TextBox iLogBox = null, FFXIVItem.TypeItem iType = FFXIVItem.TypeItem.Crafted, List <string> iJobs = null, int iMinLevel = 0, int iMaxLevel = 0)
        {
            Service_Misc.LogText(iLogBox, "Let me search this item for you : " + iElemToSearch);
            CookieCollection iCookies = new CookieCollection();
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            bool itemAdded = true;
            int  pageNb    = 0;
            List <FFXIVSearchItem> listItems = new List <FFXIVSearchItem>();

            while (itemAdded)
            {
                itemAdded = false;

                string searchString = iElemToSearch.ToLower().Replace(" ", "+");
                //http://garlandtools.org/api/search.php?lang=en&ilvlMax=5&craftable=1
                string lvlMinString = "";
                string lvlMaxString = "";
                string category     = "";
                //if (iMinLevel > 0) lvlMinString = "&ilvlMin=" + iMinLevel;
                //if (iMaxLevel > 0) lvlMaxString = "&ilvlMax=" + iMaxLevel;
                if (iType == FFXIVItem.TypeItem.Crafted)
                {
                    category = "&craftable=1";
                }
                string searchResultContent = Service_Misc.GetContentFromRequest("GET http://garlandtools.org/api/search.php?text=" + searchString + "&lang=en&page=" + pageNb + lvlMinString + lvlMaxString + category + " HTTP/1.1|Host: garlandtools.org|Connection: keep-alive|Accept: application/json, text/javascript, */*; q=0.01|X-Requested-With: XMLHttpRequest|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Referer: http://garlandtools.org/db/|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                                iCookies, ref oCookies, ref oCode);
                pageNb++;

                string innerHTML = "{\"Result\":" + searchResultContent + "}";

                JToken mainToken = null;
                try
                {
                    mainToken = JObject.Parse(innerHTML);
                    if (null == mainToken)
                    {
                        throw new Exception("Impossible de récupérer l'identifiant de connexion à partir du site");
                    }
                }
                catch (Exception)
                {
                    continue;
                }

                JToken listToken = mainToken["Result"];
                if (listToken.Count() > 0)
                {
                    Service_Misc.LogText(iLogBox, "Hey I found some items !");
                    itemAdded = true;
                }
                else
                {
                    Service_Misc.LogText(iLogBox, "Looks like there is no more items to find... (Page " + pageNb + ")");
                    return(listItems);
                }
                foreach (JToken childToken in listToken.Children())
                {
                    if (null == childToken)
                    {
                        continue;
                    }

                    string itemName  = "Unknown Item";
                    JToken dataToken = childToken["obj"];
                    if (null != dataToken && null != dataToken["n"])
                    {
                        itemName = dataToken["n"].Value <string>();
                    }
                    string type = childToken["type"].Value <string>();
                    if (type != "item")
                    {
                        Service_Misc.LogText(iLogBox, "Found something but it ain't an item : " + itemName + " - " + type);
                        continue;
                    }

                    try
                    {
                        FFXIVSearchItem item = new FFXIVSearchItem();

                        item.Name       = itemName;
                        item.UrlImage   = "http://garlandtools.org/files/icons/item/" + dataToken["c"].Value <string>() + ".png";
                        item.UrlGarland = "http://garlandtools.org/db/#item/" + dataToken["i"].Value <string>();

                        if (dataToken["f"] != null && iType == FFXIVItem.TypeItem.Crafted)
                        {
                            string jobID     = dataToken["f"][0]["job"].Value <string>();
                            string itemClass = GetJobName(jobID);
                            string itemLevel = dataToken["f"][0]["lvl"].Value <string>();
                            int    level     = 0;
                            int.TryParse(itemLevel, out level);
                            if (iMinLevel > 0 && level < iMinLevel)
                            {
                                Service_Misc.LogText(iLogBox, "Found something but its level is under the requested min level : " + itemName + " - Level : " + itemLevel);
                                continue;
                            }
                            if (iMaxLevel > 0 && level > iMaxLevel)
                            {
                                Service_Misc.LogText(iLogBox, "Found something but its level is over the requested max level : " + itemName + " - Level : " + itemLevel);
                                continue;
                            }

                            if (null != iJobs && iJobs.Count > 0 && !iJobs.Contains(itemClass.ToUpper()) && !iJobs.Contains(itemClass.ToLower()))
                            {
                                Service_Misc.LogText(iLogBox, "Found something but its job is not in the requested list : " + itemName + " - Job : " + itemClass);
                                continue;
                            }
                            item.Class = itemClass;
                            item.Level = itemLevel;
                        }
                        else if (iType == FFXIVItem.TypeItem.Crafted)
                        {
                            Service_Misc.LogText(iLogBox, "Found something but it ain't for crafting : " + itemName);
                            continue;
                        }

                        item.ID = childToken["id"].Value <string>();

                        Service_Misc.LogText(iLogBox, "Found this item : " + item.ToString());

                        listItems.Add(item);
                        itemAdded = true;
                    }
                    catch (Exception exc)
                    {
                        Service_Misc.LogText(iLogBox, "Oh man, I failed to retrieve an item from the list : ");
                        Service_Misc.LogText(iLogBox, itemName);
                        Service_Misc.LogText(iLogBox, exc.Message);
                    }
                }
            }

            listItems.Sort();
            return(listItems);
        }