public async Task drop(params string[] shipNameArr) { p.doAction(Context.User, Context.Guild.Id, Program.Module.Kancolle); if (shipNameArr.Length == 0) { await ReplyAsync(Sentences.kancolleHelp(Context.Guild.Id)); return; } string shipName = Program.cleanWord(Program.addArgs(shipNameArr)); using (WebClient wc = new WebClient()) { wc.Encoding = Encoding.UTF8; string html = wc.DownloadString("http://kancolle.wikia.com/wiki/Internals/Translations"); List <string> allShipsName = html.Split(new string[] { "<tr" }, StringSplitOptions.None).ToList(); allShipsName.RemoveAt(0); string shipContain = allShipsName.Find(x => Program.cleanWord(Program.getElementXml("\">", x, '<')) == shipName); if (shipContain == null) { await ReplyAsync(Sentences.shipgirlDontExist(Context.Guild.Id)); return; } shipName = Program.getElementXml("<td>", shipContain, '<'); html = wc.DownloadString("https://wikiwiki.jp/kancolle/%E8%89%A6%E5%A8%98%E3%83%89%E3%83%AD%E3%83%83%E3%83%97%E9%80%86%E5%BC%95%E3%81%8D"); html = html.Split(new string[] { "<thead>" }, StringSplitOptions.None)[1]; html = html.Split(new string[] { "艦種別表" }, StringSplitOptions.None)[0]; string[] shipgirls = html.Split(new string[] { "<tr>" }, StringSplitOptions.None); string shipgirl = shipgirls.ToList().Find(x => x.Contains(shipName)); string finalStr = ""; if (shipgirl == null) { await ReplyAsync(Sentences.shipNotReferencedMap(Context.Guild.Id)); } else { string[] cathegories = shipgirl.Split(new string[] { "<td class=\"style_td\"" }, StringSplitOptions.RemoveEmptyEntries); int[] toKeep = new int[] { 4, 5, 6, 7, 8, 9, // World 1 11, 12, 13, 14, 15, // world 2 17, 18, 19, 20, 21, // World 3 23, 24, 25, 26, 27, // World 4 29, 30, 31, 32, 33, // World 5 35, 36, 37, 38, 39 }; // World 6 int level = 1; int world = 1; foreach (int i in toKeep) { string node = Program.getElementXml(">", cathegories[i], '<'); if (node.Length > 0) { switch (node[0]) { case '●': finalStr += world + "-" + level + ": Only on normal nodes" + Environment.NewLine; break; case '○': finalStr += world + "-" + level + ": Only on boss node" + Environment.NewLine; break; case '◎': finalStr += world + "-" + level + ": Anywhere on the map" + Environment.NewLine; break; default: finalStr += world + "-" + level + ": Findable on the map" + Environment.NewLine; break; } } level++; if ((world == 1 && level > 6) || (world > 1 && level > 5)) { world++; level = 1; } } if (finalStr.Length > 0) { string rarity = Program.getElementXml(">", cathegories[1], '<'); await ReplyAsync("Rarity: " + ((rarity.Length > 0) ? (rarity) : ("?")) + "/7" + Environment.NewLine + finalStr); } else { await ReplyAsync(Sentences.dontDropOnMaps(Context.Guild.Id)); } } wc.Headers.Add("User-Agent: Sanara"); html = wc.DownloadString("http://unlockacgweb.galstars.net/KanColleWiki/viewCreateShipLogList"); html = Regex.Replace( html, @"\\[Uu]([0-9A-Fa-f]{4})", m => char.ToString( (char)ushort.Parse(m.Groups[1].Value, NumberStyles.AllowHexSpecifier))); // Replace \\u1313 by \u1313 string[] htmlSplit = html.Split(new string[] { shipName }, StringSplitOptions.None); if (htmlSplit.Length == 1) { await ReplyAsync(Sentences.shipNotReferencedConstruction(Context.Guild.Id)); return; } string[] allIds = htmlSplit[htmlSplit.Length - 2].Split(new string[] { "\",\"" }, StringSplitOptions.None); wc.Headers.Add("User-Agent: Sanara"); html = wc.DownloadString("http://unlockacgweb.galstars.net/KanColleWiki/viewCreateShipLog?sid=" + (allIds[allIds.Length - 1].Split('"')[0])); html = html.Split(new string[] { "order_by_probability" }, StringSplitOptions.None)[1]; html = html.Split(new string[] { "flagship_order" }, StringSplitOptions.None)[0]; string[] allElements = html.Split(new string[] { "{\"item1\":" }, StringSplitOptions.None); finalStr = "Ship Construction:" + Environment.NewLine; for (int i = 1; i < ((allElements.Length > 6) ? (6) : (allElements.Length)); i++) { string[] ressources = allElements[i].Split(new string[] { ",\"" }, StringSplitOptions.None); finalStr += Program.getElementXml(":", ressources[7], '}') + "% -- Fuel: " + ressources[0] + ", Ammos: " + Program.getElementXml(":", ressources[1], '?') + ", Iron: " + Program.getElementXml(":", ressources[2], '?') + ", Bauxite: " + Program.getElementXml(":", ressources[3], '?') + ", Dev mat: " + Program.getElementXml(":", ressources[4], '?') + Environment.NewLine; } await ReplyAsync(finalStr); } }