public int GetBuildingLevel(BuildingTypes builing) { const string str = "#main_buildrow_"; var html = GetHeadQScreenHtml(); var id = $"{str}{BuildingHelper.GetNameForType(builing)}"; var hqTableElement = html.Select(id); return(HtmlParse.GetCurrentLevelOfBuilingFromTableRow(hqTableElement)); }
private static List <UnitQueueItem> GetActiveQueue(RequestManager reqManager, int village, BuildingTypes building) { var typeStr = BuildingHelper.GetNameForType(building); var url = $"https://sv36.tribalwars.se/game.php?village={village}&screen={typeStr}"; var res = reqManager.SendGETRequest(url, null, null, true); CQ htmlString = RequestManager.GetResponseStringFromResponse(res); var list = htmlString .Select($"#trainqueue_wrap_{typeStr} tbody tr") .Where(ele => ele.ClassName.Length > 0) .Select(ele => GetUnitQueueItem(ele, typeStr)); return(list.ToList()); }
public bool AddBuildingUppgradeToActiveQeueu(BuildingTypes building, string csrfToken, int currentVillage) { var uppgradeUrl = UpgradeBuildingUrl .Replace("__village__", currentVillage.ToString()) .Replace("__type__", "main") .Replace("__csrfToken__", csrfToken); var url = $"{BaseUrl}{uppgradeUrl}"; var postData = $"id={BuildingHelper.GetNameForType(building)}&force=1&destroy=0&source={currentVillage}"; var resNotParsed = _reqManager.GeneratePOSTRequest(url, postData, null, null, true); var res = _reqManager.GetResponse(resNotParsed); var htmlStr = RequestManager.GetResponseStringFromResponse(res); return(htmlStr.Contains("Byggnationen har beordrats")); }