Exemplo n.º 1
0
        private BuildingQueueItem GetBuildingQueueItem(IDomObject item)
        {
            CQ  trElement = item.OuterHTML;
            var timeUntillCompleeteStr = trElement.Select("td span").FirstElement().TextContent;
            var timeUntillCompleete    = RegExHelper.GetTimeFromString(timeUntillCompleeteStr);

            var builingName  = RegExHelper.GetTextWithRegEx("buildorder_([a-z]+)", item.ClassName);
            var buildingType = BuildingHelper.GetBuildingTypeFromString(builingName);

            var subString         = item.FirstElementChild.InnerText.Split('\n')[1];
            var lvl               = RegExHelper.GetNumberWithRegEx(@"([\d]+)", subString);
            var id                = GetBuildingQueueId(item);
            var buildingQueueItem = new BuildingQueueItem
            {
                Level    = lvl,
                Type     = buildingType,
                TimeLeft = timeUntillCompleete,
                Id       = id
            };

            return(buildingQueueItem);
        }