Skip to content

Commit

Permalink
Merge pull request #110 from Erol444/fix-29-04-2022
Browse files Browse the repository at this point in the history
Fix 29 04 2022
  • Loading branch information
vinaghost authored Apr 29, 2022
2 parents a65de3e + a0d326f commit 1f4029d
Show file tree
Hide file tree
Showing 189 changed files with 5,275 additions and 5,129 deletions.
7 changes: 4 additions & 3 deletions TbsCore/Core/PostLoadHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
using TbsCore.Models.AccModels;
using TbsCore.Models.JsObjects;
using TbsCore.Models.VillageModels;
using TbsCore.Helpers;
using TbsCore.Parsers;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.Others;
using TbsCore.Tasks.Sim;
using TbsCore.Tasks.Update;
using static TbsCore.Tasks.BotTask;

namespace TbsCore.Helpers
Expand Down Expand Up @@ -91,7 +92,7 @@ public static List<Action> GetPostLoadTasks(Account acc)
acc.Wb.Html.GetElementbyId("mentorTaskList") == null &&
acc.Quests.ClaimBeginnerQuests)
{
acc.Tasks.Add(new ClaimBeginnerTask2021() { ExecuteAt = DateTime.Now}, true);
acc.Tasks.Add(new ClaimBeginnerTask2021() { Vill = vill, ExecuteAt = DateTime.Now}, true); ;
return;
}

Expand Down
4 changes: 3 additions & 1 deletion TbsCore/Core/TaskExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
using TbsCore.Models.VillageModels;
using TbsCore.Parsers;
using TbsCore.Tasks;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.Browser;
using TbsCore.Tasks.Others;
using TbsCore.Tasks.Update;
using static TbsCore.Tasks.BotTask;

namespace TbsCore.Helpers
Expand Down
15 changes: 2 additions & 13 deletions TbsCore/Core/TaskTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Threading.Tasks;
using System.Timers;
using TbsCore.Helpers;
using TbsCore.Tasks;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.Browser;
using TbsCore.Tasks.Others;
using static TbsCore.Tasks.BotTask;

namespace TbsCore.Models.AccModels
Expand Down Expand Up @@ -100,17 +100,6 @@ private async void NewTick()
}

task.Stage = TaskStage.Executing;

//If correct village is selected, otherwise change village
if (task.Vill != null && task.GetType() != typeof(UpgradeBuilding))
{
var active = _acc.Villages.FirstOrDefault(x => x.Active);
if (active != null && active != task.Vill)
{
await VillageHelper.SwitchVillage(_acc, task.Vill.Id);
}
}

await TaskExecutor.Execute(_acc, task);

IsTaskExcuting = false;
Expand Down
11 changes: 3 additions & 8 deletions TbsCore/Core/WebBrowserInfo.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using RestSharp;
using OpenQA.Selenium.Chrome.ChromeDriverExtensions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Threading.Tasks;
using TbsCore.Database;
using TbsCore.Helpers;
using TbsCore.Models;
using TbsCore.Tasks.LowLevel;
using TbsCore.Helpers.ChromeExtension;
using static TbsCore.Tasks.BotTask;
using OpenQA.Selenium.Chrome.ChromeDriverExtensions;
using System.Collections.ObjectModel;
using TbsCore.Database;

namespace TbsCore.Models.AccModels
{
Expand Down
1 change: 0 additions & 1 deletion TbsCore/Database/DbRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using TbsCore.Models.AccModels;
using TbsCore.Models.Database;
using TbsCore.Helpers;

namespace TbsCore.Database
{
Expand Down
2 changes: 1 addition & 1 deletion TbsCore/Database/TbsContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System.IO;
using TbsCore.Models.Database;
using TbsCore.Helpers;
using TbsCore.Models.Database;

namespace TbsCore.Database
{
Expand Down
6 changes: 1 addition & 5 deletions TbsCore/Extensions/AccountExtension.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using TbsCore.Models.AccModels;
using TbsCore.Models.AccModels;

namespace TbsCore.Extensions
{
Expand Down
9 changes: 1 addition & 8 deletions TbsCore/Extensions/RallyPointNavigationHelper.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System.Threading.Tasks;
using TbsCore.Helpers;
using TbsCore.Models.AccModels;
using TbsCore.Models.VillageModels;
using static TbsCore.Helpers.Classificator;
using System;

namespace TbsCore.Extensions
namespace TbsCore.Extensions
{
/// <summary>
/// WIP!
Expand Down
10 changes: 6 additions & 4 deletions TbsCore/Helpers/AccountHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
using System.Threading.Tasks;
using TbsCore.Models.AccModels;
using TbsCore.Models.VillageModels;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.SecondLevel;
using TbsCore.Tasks.Browser;
using TbsCore.Tasks.Farming;
using TbsCore.Tasks.Sim;
using TbsCore.Tasks.Update;

namespace TbsCore.Helpers
{
public static class AccountHelper
{
private static Random rnd = new Random();
private static readonly Random rnd = new Random();

public static Village GetMainVillage(Account acc)
{
Expand Down Expand Up @@ -56,7 +58,7 @@ public static Village GetQuestsClaimVillage(Account acc)
/// <returns>Random delay in milliseconds</returns>
public static int Delay(Account acc) => rnd.Next(acc.Settings.DelayClickingMin, acc.Settings.DelayClickingMax);

public static Task DelayWait(Account acc) => Task.Delay(Delay(acc));
public static Task DelayWait(Account acc, int multiple = 1) => Task.Delay(Delay(acc) * multiple);

public static void StartAccountTasks(Account acc)
{
Expand Down
5 changes: 1 addition & 4 deletions TbsCore/Helpers/AttackHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using TbsCore.Parsers;
using TbsCore.Parsers;

namespace TbsCore.Helpers
{
Expand Down
4 changes: 1 addition & 3 deletions TbsCore/Helpers/BuildingHelper.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using TbsCore.Helpers;
using TbsCore.Models.AccModels;
using TbsCore.Models.BuildingModels;
using TbsCore.Models.VillageModels;
using TbsCore.Tasks;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.Sim;
using TbsCore.TravianData;
using static TbsCore.Helpers.Classificator;

Expand Down
2 changes: 0 additions & 2 deletions TbsCore/Helpers/ChromeExtension/DisableWebRTCLeak.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.IO;
using System.IO.Compression;
using TbsCore.Models.Access;

namespace TbsCore.Helpers.ChromeExtension
{
Expand Down
4 changes: 2 additions & 2 deletions TbsCore/Helpers/GithubHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Octokit;
using System;
using System.Threading.Tasks;
using Octokit;

namespace TbsCore.Helpers
{
Expand Down
6 changes: 2 additions & 4 deletions TbsCore/Helpers/HeroHelper.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TbsCore.Helpers;
using TbsCore.Models.AccModels;
using TbsCore.Models.MapModels;
using TbsCore.Models.ResourceModels;
using TbsCore.Models.VillageModels;
using TbsCore.Parsers;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.Farming;
using TbsCore.Tasks.Others;
using TbsCore.TravianData;
using static TbsCore.Helpers.Classificator;

Expand Down
1 change: 0 additions & 1 deletion TbsCore/Helpers/HttpHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Net;
using System.Threading.Tasks;
using TbsCore.Database;
using TbsCore.Models.Access;
using TbsCore.Models.AccModels;

namespace TbsCore.Helpers
Expand Down
3 changes: 0 additions & 3 deletions TbsCore/Helpers/IoHelperCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Discord.Webhook;
using TbsCore.Database;
using TbsCore.Models.Access;
using TbsCore.Models.Logging;
using TbsCore.Models.AccModels;
using TbsCore.Models.BuildingModels;
using TbsCore.Models.VillageModels;
Expand Down
7 changes: 2 additions & 5 deletions TbsCore/Helpers/MapHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using TbsCore.Helpers;
using System.Threading.Tasks;
using TbsCore.Models.AccModels;
using TbsCore.Models.MapModels;
using TbsCore.Models.VillageModels;
using TbsCore.TravianData;
using TbsCore.Parsers;
using TbsCore.Models.TroopsModels;
using System.Threading.Tasks;
using TbsCore.Parsers;

namespace TbsCore.Helpers
{
Expand Down
4 changes: 2 additions & 2 deletions TbsCore/Helpers/MarketHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

using TbsCore.Parsers;
using TbsCore.Tasks;
using TbsCore.Tasks.LowLevel;
using TbsCore.Tasks.Others;

namespace TbsCore.Helpers
{
Expand Down Expand Up @@ -183,7 +183,7 @@ public static async Task<TimeSpan> MarketSendResource(Account acc, long[] resour
// Error "Abuse! You have not enough resources." is displayed.
}
//get duration of transit
// Class destination when ok.
// Class destination when ok.

var dur = durNode.Descendants("td").ToList()[3].InnerText.Replace("\t", "").Replace("\n", "");

Expand Down
Loading

0 comments on commit 1f4029d

Please sign in to comment.