diff --git a/.github/workflows/hotfix.yml b/.github/workflows/hotfix.yml
index 107ef132c..b8a15d28f 100644
--- a/.github/workflows/hotfix.yml
+++ b/.github/workflows/hotfix.yml
@@ -112,7 +112,7 @@ jobs:
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_BOT }}
- title: New hotfix
+ title: New patch
nodetail: true
description: |
Version `TBS-${{needs.version.outputs.version}}`
diff --git a/.gitignore b/.gitignore
index ea3bbe348..296b22e2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -376,4 +376,6 @@ data/
Web/Client/
Web/Server/
-Web/Shared/
\ No newline at end of file
+Web/Shared/
+/TBS.db-shm
+/TBS.db-wal
diff --git a/MainCore/AppDbContext.cs b/MainCore/AppDbContext.cs
index 198b12e77..752989b96 100644
--- a/MainCore/AppDbContext.cs
+++ b/MainCore/AppDbContext.cs
@@ -507,6 +507,8 @@ public void AddVersionInfo()
KeyValuePair.Create(202210061322,"NPCMigrations"),
KeyValuePair.Create(202210162304,"TroopsMigrations"),
KeyValuePair.Create(202210181120,"UpgradeTroopMigrations"),
+ KeyValuePair.Create(202210271504,"NPCForWarhouse"),
+ KeyValuePair.Create(2022102716038,"IgnoreRomanAdvantage"),
};
foreach (var migration in migrations)
{
diff --git a/MainCore/Helper/BuildingsHelper.cs b/MainCore/Helper/BuildingsHelper.cs
index 2333decb8..3e296be40 100644
--- a/MainCore/Helper/BuildingsHelper.cs
+++ b/MainCore/Helper/BuildingsHelper.cs
@@ -1,6 +1,6 @@
using MainCore.Enums;
using MainCore.Models.Runtime;
-using MainCore.Services;
+using MainCore.Services.Interface;
using System.Collections.Generic;
using System.Linq;
diff --git a/MainCore/Helper/CheckHelper.cs b/MainCore/Helper/CheckHelper.cs
index 4526f027a..27a8b7892 100644
--- a/MainCore/Helper/CheckHelper.cs
+++ b/MainCore/Helper/CheckHelper.cs
@@ -1,7 +1,7 @@
using HtmlAgilityPack;
using MainCore.Enums;
-using MainCore.Services;
using System.Linq;
+using MainCore.Services.Interface;
#if TRAVIAN_OFFICIAL
diff --git a/MainCore/Helper/ClickHelper.cs b/MainCore/Helper/ClickHelper.cs
index 106db9895..ca4f1a159 100644
--- a/MainCore/Helper/ClickHelper.cs
+++ b/MainCore/Helper/ClickHelper.cs
@@ -1,5 +1,5 @@
using HtmlAgilityPack;
-using MainCore.Services;
+using MainCore.Services.Interface;
using OpenQA.Selenium;
using System;
diff --git a/MainCore/Helper/HeroHelper.cs b/MainCore/Helper/HeroHelper.cs
index 92c1216fd..7dc6d3ed0 100644
--- a/MainCore/Helper/HeroHelper.cs
+++ b/MainCore/Helper/HeroHelper.cs
@@ -1,6 +1,6 @@
using HtmlAgilityPack;
using MainCore.Enums;
-using MainCore.Services;
+using MainCore.Services.Interface;
using OpenQA.Selenium;
using System;
diff --git a/MainCore/Helper/NavigateHelper.cs b/MainCore/Helper/NavigateHelper.cs
index 263054e66..eb50c5331 100644
--- a/MainCore/Helper/NavigateHelper.cs
+++ b/MainCore/Helper/NavigateHelper.cs
@@ -1,9 +1,9 @@
-using MainCore.Services;
-using System;
+using System;
using OpenQA.Selenium;
using MainCore.Exceptions;
using System.Threading;
using System.Collections.ObjectModel;
+using MainCore.Services.Interface;
#if TRAVIAN_OFFICIAL
diff --git a/MainCore/Helper/UpdateHelper.cs b/MainCore/Helper/UpdateHelper.cs
index eb37766df..e5fed96e8 100644
--- a/MainCore/Helper/UpdateHelper.cs
+++ b/MainCore/Helper/UpdateHelper.cs
@@ -1,6 +1,6 @@
using MainCore.Enums;
using MainCore.Models.Database;
-using MainCore.Services;
+using MainCore.Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/MainCore/Helper/UpgradeBuildingHelper.cs b/MainCore/Helper/UpgradeBuildingHelper.cs
index 7e315bb37..c0f1b0079 100644
--- a/MainCore/Helper/UpgradeBuildingHelper.cs
+++ b/MainCore/Helper/UpgradeBuildingHelper.cs
@@ -1,7 +1,7 @@
using MainCore.Enums;
using MainCore.Models.Database;
using MainCore.Models.Runtime;
-using MainCore.Services;
+using MainCore.Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -27,17 +27,18 @@ public static PlanTask NextBuildingTask(AppDbContext context, IPlanManager planM
var accountInfo = context.AccountsInfo.Find(accountId);
var tribe = accountInfo.Tribe;
var hasPlusAccount = accountInfo.HasPlusAccount;
+ var setting = context.VillagesSettings.Find(villageId);
var maxBuild = 1;
if (hasPlusAccount) maxBuild++;
- if (tribe == TribeEnums.Romans) maxBuild++;
+ if (tribe == TribeEnums.Romans && !setting.IsIgnoreRomanAdvantage) maxBuild++;
if (totalBuild == maxBuild)
{
logManager.Information(accountId, "Amount of currently building is equal with maximum building can build in same time");
return null;
}
- if (tribe == TribeEnums.Romans && maxBuild - totalBuild == 1)
+ if (tribe == TribeEnums.Romans && !setting.IsIgnoreRomanAdvantage && maxBuild - totalBuild == 1)
{
var numRes = currentList.Count(x => x.Type.IsResourceField());
var numInfra = totalBuild - numRes;
diff --git a/MainCore/Migrations/202210271504_NPCForWarhouse.cs b/MainCore/Migrations/202210271504_NPCForWarhouse.cs
new file mode 100644
index 000000000..d9777ae3f
--- /dev/null
+++ b/MainCore/Migrations/202210271504_NPCForWarhouse.cs
@@ -0,0 +1,22 @@
+using FluentMigrator;
+
+namespace MainCore.Migrations
+{
+ [Migration(202210271504)]
+ public class NPCForWarhouse : Migration
+ {
+ public override void Down()
+ {
+ Delete
+ .Column("IsNPCOverflow")
+ .Column("AutoNPCWarehousePercent").FromTable("VillagesSettings");
+ }
+
+ public override void Up()
+ {
+ Alter.Table("VillagesSettings")
+ .AddColumn("IsNPCOverflow").AsBoolean().WithDefaultValue(false)
+ .AddColumn("AutoNPCWarehousePercent").AsInt32().WithDefaultValue(90);
+ }
+ }
+}
\ No newline at end of file
diff --git a/MainCore/Migrations/2022102716038_IgnoreRomanAdvantage.cs b/MainCore/Migrations/2022102716038_IgnoreRomanAdvantage.cs
new file mode 100644
index 000000000..719ff9396
--- /dev/null
+++ b/MainCore/Migrations/2022102716038_IgnoreRomanAdvantage.cs
@@ -0,0 +1,20 @@
+using FluentMigrator;
+
+namespace MainCore.Migrations
+{
+ [Migration(2022102716038)]
+ public class IgnoreRomanAdvantage : Migration
+ {
+ public override void Down()
+ {
+ Delete
+ .Column("IsIgnoreRomanAdvantage").FromTable("VillagesSettings");
+ }
+
+ public override void Up()
+ {
+ Alter.Table("VillagesSettings")
+ .AddColumn("IsIgnoreRomanAdvantage").AsBoolean().WithDefaultValue(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/MainCore/Models/Database/VillageSetting.cs b/MainCore/Models/Database/VillageSetting.cs
index e2bd594e2..0a83b7f11 100644
--- a/MainCore/Models/Database/VillageSetting.cs
+++ b/MainCore/Models/Database/VillageSetting.cs
@@ -6,7 +6,7 @@ public class VillageSetting
{
public int VillageId { get; set; }
public bool IsUseHeroRes { get; set; }
-
+ public bool IsIgnoreRomanAdvantage { get; set; }
public bool IsInstantComplete { get; set; }
public int InstantCompleteTime { get; set; }
@@ -18,7 +18,9 @@ public class VillageSetting
public int AutoRefreshTimeMax { get; set; }
public bool IsAutoNPC { get; set; }
+ public bool IsNPCOverflow { get; set; }
public int AutoNPCPercent { get; set; }
+ public int AutoNPCWarehousePercent { get; set; }
public int AutoNPCWood { get; set; }
public int AutoNPCClay { get; set; }
public int AutoNPCIron { get; set; }
diff --git a/MainCore/Services/ChromeBrowser.cs b/MainCore/Services/Implementations/ChromeBrowser.cs
similarity index 98%
rename from MainCore/Services/ChromeBrowser.cs
rename to MainCore/Services/Implementations/ChromeBrowser.cs
index 0fb0d86dd..fa38a4007 100644
--- a/MainCore/Services/ChromeBrowser.cs
+++ b/MainCore/Services/Implementations/ChromeBrowser.cs
@@ -1,5 +1,6 @@
using HtmlAgilityPack;
using MainCore.Models.Database;
+using MainCore.Services.Interface;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Chrome.ChromeDriverExtensions;
@@ -7,7 +8,7 @@
using System;
using System.IO;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class ChromeBrowser : IChromeBrowser
{
diff --git a/MainCore/Services/ChromeDriverInstaller.cs b/MainCore/Services/Implementations/ChromeDriverInstaller.cs
similarity index 99%
rename from MainCore/Services/ChromeDriverInstaller.cs
rename to MainCore/Services/Implementations/ChromeDriverInstaller.cs
index 4c33d6556..b93878cbb 100644
--- a/MainCore/Services/ChromeDriverInstaller.cs
+++ b/MainCore/Services/Implementations/ChromeDriverInstaller.cs
@@ -8,7 +8,7 @@
using System.Runtime.InteropServices;
using System.Threading.Tasks;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public static class ChromeDriverInstaller
{
diff --git a/MainCore/Services/ChromeManager.cs b/MainCore/Services/Implementations/ChromeManager.cs
similarity index 96%
rename from MainCore/Services/ChromeManager.cs
rename to MainCore/Services/Implementations/ChromeManager.cs
index 35c81c78a..416852e8b 100644
--- a/MainCore/Services/ChromeManager.cs
+++ b/MainCore/Services/Implementations/ChromeManager.cs
@@ -3,8 +3,9 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
+using MainCore.Services.Interface;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class ChromeManager : IChromeManager
{
diff --git a/MainCore/Services/EventManager.cs b/MainCore/Services/Implementations/EventManager.cs
similarity index 98%
rename from MainCore/Services/EventManager.cs
rename to MainCore/Services/Implementations/EventManager.cs
index 817c367d8..a05dd582b 100644
--- a/MainCore/Services/EventManager.cs
+++ b/MainCore/Services/Implementations/EventManager.cs
@@ -1,7 +1,7 @@
using MainCore.Models.Runtime;
using System;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class EventManager
{
diff --git a/MainCore/Services/LogManager.cs b/MainCore/Services/Implementations/LogManager.cs
similarity index 97%
rename from MainCore/Services/LogManager.cs
rename to MainCore/Services/Implementations/LogManager.cs
index 44e7960cb..042719d43 100644
--- a/MainCore/Services/LogManager.cs
+++ b/MainCore/Services/Implementations/LogManager.cs
@@ -1,11 +1,12 @@
using MainCore.Enums;
using MainCore.Models.Runtime;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using Serilog;
using System;
using System.Collections.Generic;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class LogManager : ILogManager
{
diff --git a/MainCore/Services/PlanManager.cs b/MainCore/Services/Implementations/PlanManager.cs
similarity index 99%
rename from MainCore/Services/PlanManager.cs
rename to MainCore/Services/Implementations/PlanManager.cs
index a65f6be2f..5bebfebd5 100644
--- a/MainCore/Services/PlanManager.cs
+++ b/MainCore/Services/Implementations/PlanManager.cs
@@ -1,11 +1,12 @@
using MainCore.Helper;
using MainCore.Models.Runtime;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class PlanManager : IPlanManager
{
diff --git a/MainCore/Services/RestClientManager.cs b/MainCore/Services/Implementations/RestClientManager.cs
similarity index 97%
rename from MainCore/Services/RestClientManager.cs
rename to MainCore/Services/Implementations/RestClientManager.cs
index 4d94cf76e..aaba56042 100644
--- a/MainCore/Services/RestClientManager.cs
+++ b/MainCore/Services/Implementations/RestClientManager.cs
@@ -1,4 +1,5 @@
using MainCore.Models.Runtime;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using RestSharp;
using System;
@@ -7,7 +8,7 @@
using System.Security.Cryptography;
using System.Text;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class RestClientManager : IRestClientManager
{
diff --git a/MainCore/Services/TaskManager.cs b/MainCore/Services/Implementations/TaskManager.cs
similarity index 99%
rename from MainCore/Services/TaskManager.cs
rename to MainCore/Services/Implementations/TaskManager.cs
index f90edb443..186874dd8 100644
--- a/MainCore/Services/TaskManager.cs
+++ b/MainCore/Services/Implementations/TaskManager.cs
@@ -2,6 +2,7 @@
using MainCore.Exceptions;
using MainCore.Helper;
using MainCore.Models.Database;
+using MainCore.Services.Interface;
using MainCore.Tasks;
using MainCore.Tasks.Misc;
using Microsoft.EntityFrameworkCore;
@@ -10,7 +11,7 @@
using System.Linq;
using System.Threading;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class TaskManager : ITaskManager
{
diff --git a/MainCore/Services/TimerManager.cs b/MainCore/Services/Implementations/TimerManager.cs
similarity index 89%
rename from MainCore/Services/TimerManager.cs
rename to MainCore/Services/Implementations/TimerManager.cs
index 08c3b6d58..62971e82c 100644
--- a/MainCore/Services/TimerManager.cs
+++ b/MainCore/Services/Implementations/TimerManager.cs
@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Timers;
+using MainCore.Services.Interface;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class TimerManager : ITimerManager
{
@@ -23,7 +24,7 @@ public void Start(int index)
if (!_dictTimer.ContainsKey(index))
{
var timer = new Timer(100) { AutoReset = false };
- timer.Elapsed += (object sender, ElapsedEventArgs e) =>
+ timer.Elapsed += (sender, e) =>
{
try
{
diff --git a/MainCore/Services/UseragentManager.cs b/MainCore/Services/Implementations/UseragentManager.cs
similarity index 96%
rename from MainCore/Services/UseragentManager.cs
rename to MainCore/Services/Implementations/UseragentManager.cs
index e87fba130..3bcc955e2 100644
--- a/MainCore/Services/UseragentManager.cs
+++ b/MainCore/Services/Implementations/UseragentManager.cs
@@ -1,11 +1,12 @@
-using RestSharp;
+using MainCore.Services.Interface;
+using RestSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;
-namespace MainCore.Services
+namespace MainCore.Services.Implementations
{
public sealed class UseragentManager : IUseragentManager
{
diff --git a/MainCore/Services/IChromeBrowser.cs b/MainCore/Services/Interface/IChromeBrowser.cs
similarity index 93%
rename from MainCore/Services/IChromeBrowser.cs
rename to MainCore/Services/Interface/IChromeBrowser.cs
index 02c20b037..78837fd59 100644
--- a/MainCore/Services/IChromeBrowser.cs
+++ b/MainCore/Services/Interface/IChromeBrowser.cs
@@ -3,7 +3,7 @@
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface IChromeBrowser
{
diff --git a/MainCore/Services/IChromeManager.cs b/MainCore/Services/Interface/IChromeManager.cs
similarity index 81%
rename from MainCore/Services/IChromeManager.cs
rename to MainCore/Services/Interface/IChromeManager.cs
index d682a4411..61ddfb7e7 100644
--- a/MainCore/Services/IChromeManager.cs
+++ b/MainCore/Services/Interface/IChromeManager.cs
@@ -1,6 +1,6 @@
using System;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface IChromeManager : IDisposable
{
diff --git a/MainCore/Services/ILogManager.cs b/MainCore/Services/Interface/ILogManager.cs
similarity index 92%
rename from MainCore/Services/ILogManager.cs
rename to MainCore/Services/Interface/ILogManager.cs
index 1a4266842..7734dcaa2 100644
--- a/MainCore/Services/ILogManager.cs
+++ b/MainCore/Services/Interface/ILogManager.cs
@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface ILogManager : IDisposable
{
diff --git a/MainCore/Services/IPlanManager.cs b/MainCore/Services/Interface/IPlanManager.cs
similarity index 92%
rename from MainCore/Services/IPlanManager.cs
rename to MainCore/Services/Interface/IPlanManager.cs
index e3acc0fef..170ff9d8d 100644
--- a/MainCore/Services/IPlanManager.cs
+++ b/MainCore/Services/Interface/IPlanManager.cs
@@ -1,7 +1,7 @@
using MainCore.Models.Runtime;
using System.Collections.Generic;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface IPlanManager
{
diff --git a/MainCore/Services/IRestClientManager.cs b/MainCore/Services/Interface/IRestClientManager.cs
similarity index 83%
rename from MainCore/Services/IRestClientManager.cs
rename to MainCore/Services/Interface/IRestClientManager.cs
index ce73fe276..afe87cb5a 100644
--- a/MainCore/Services/IRestClientManager.cs
+++ b/MainCore/Services/Interface/IRestClientManager.cs
@@ -2,7 +2,7 @@
using RestSharp;
using System;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface IRestClientManager : IDisposable
{
diff --git a/MainCore/Services/ITaskManager.cs b/MainCore/Services/Interface/ITaskManager.cs
similarity index 94%
rename from MainCore/Services/ITaskManager.cs
rename to MainCore/Services/Interface/ITaskManager.cs
index 866182b6c..1394240a7 100644
--- a/MainCore/Services/ITaskManager.cs
+++ b/MainCore/Services/Interface/ITaskManager.cs
@@ -2,7 +2,7 @@
using MainCore.Tasks;
using System.Collections.Generic;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface ITaskManager
{
diff --git a/MainCore/Services/ITimerManager.cs b/MainCore/Services/Interface/ITimerManager.cs
similarity index 75%
rename from MainCore/Services/ITimerManager.cs
rename to MainCore/Services/Interface/ITimerManager.cs
index 4fbcd98e6..e6bec667e 100644
--- a/MainCore/Services/ITimerManager.cs
+++ b/MainCore/Services/Interface/ITimerManager.cs
@@ -1,6 +1,6 @@
using System;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface ITimerManager : IDisposable
{
diff --git a/MainCore/Services/IUseragentManager.cs b/MainCore/Services/Interface/IUseragentManager.cs
similarity index 79%
rename from MainCore/Services/IUseragentManager.cs
rename to MainCore/Services/Interface/IUseragentManager.cs
index 48f6cca30..309d7b6fe 100644
--- a/MainCore/Services/IUseragentManager.cs
+++ b/MainCore/Services/Interface/IUseragentManager.cs
@@ -1,6 +1,6 @@
using System.Threading.Tasks;
-namespace MainCore.Services
+namespace MainCore.Services.Interface
{
public interface IUseragentManager
{
diff --git a/MainCore/Tasks/Attack/StartFarmList.cs b/MainCore/Tasks/Attack/StartFarmList.cs
index 13ea5d580..3894346b1 100644
--- a/MainCore/Tasks/Attack/StartFarmList.cs
+++ b/MainCore/Tasks/Attack/StartFarmList.cs
@@ -1,5 +1,6 @@
using MainCore.Helper;
-using MainCore.Services;
+using MainCore.Services.Implementations;
+using MainCore.Services.Interface;
using MainCore.Tasks.Update;
using Microsoft.EntityFrameworkCore;
using OpenQA.Selenium;
diff --git a/MainCore/Tasks/BotTask.cs b/MainCore/Tasks/BotTask.cs
index bf795d1d6..d1de1d87a 100644
--- a/MainCore/Tasks/BotTask.cs
+++ b/MainCore/Tasks/BotTask.cs
@@ -1,5 +1,6 @@
using MainCore.Enums;
-using MainCore.Services;
+using MainCore.Services.Implementations;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using System;
using System.Threading;
diff --git a/MainCore/Tasks/Misc/SleepTask.cs b/MainCore/Tasks/Misc/SleepTask.cs
index 4be8832a9..97f289d50 100644
--- a/MainCore/Tasks/Misc/SleepTask.cs
+++ b/MainCore/Tasks/Misc/SleepTask.cs
@@ -51,21 +51,35 @@ public override void Execute()
var time = TimeSpan.FromMinutes(random.Next(min, max));
_chromeBrowser.Close();
_logManager.Information(AccountId, $"Bot is sleeping in {time} minute(s)");
- Task.Delay(time, Cts.Token).Wait();
+ try
+ {
+ Task.Delay(time, Cts.Token).Wait();
+ }
+ catch
+ {
+ return;
+ }
if (Cts.IsCancellationRequested) return;
}
else
{
_chromeBrowser.Close();
_logManager.Information(AccountId, $"Bot is sleeping in {3} minute(s)");
- Task.Delay(TimeSpan.FromMinutes(3), Cts.Token).Wait();
+ try
+ {
+ Task.Delay(TimeSpan.FromMinutes(3), Cts.Token).Wait();
+ }
+ catch
+ {
+ return;
+ }
}
_chromeBrowser.Setup(selectedAccess, setting);
var currentAccount = context.Accounts.Find(AccountId);
_chromeBrowser.Navigate(currentAccount.Server);
_taskManager.Add(AccountId, new LoginTask(AccountId), true);
- var nextExecute = Random.Shared.Next(setting.WorkTimeMin, setting.SleepTimeMax);
+ var nextExecute = Random.Shared.Next(setting.SleepTimeMin, setting.SleepTimeMax);
ExecuteAt = DateTime.Now.AddMinutes(nextExecute);
}
}
diff --git a/MainCore/Tasks/Update/UpdateVillage.cs b/MainCore/Tasks/Update/UpdateVillage.cs
index 6280f25c3..f60393510 100644
--- a/MainCore/Tasks/Update/UpdateVillage.cs
+++ b/MainCore/Tasks/Update/UpdateVillage.cs
@@ -129,10 +129,13 @@ private void AutoNPC(AppDbContext context)
var setting = context.VillagesSettings.Find(VillageId);
if (!setting.IsAutoNPC) return;
if (setting.AutoNPCPercent == 0) return;
+ if (setting.AutoNPCWarehousePercent == 0) return;
var resource = context.VillagesResources.Find(VillageId);
- var ratio = resource.Crop * 100.0f / resource.Granary;
- if (ratio > setting.AutoNPCPercent) return;
+ var ratioGranary = resource.Crop * 100.0f / resource.Granary;
+ var maxResource = Math.Max(resource.Wood, Math.Max(resource.Clay, resource.Iron));
+ var ratioWarehouse = maxResource * 100.0f / resource.Warehouse;
+ if (ratioGranary < setting.AutoNPCPercent && ratioWarehouse < setting.AutoNPCWarehousePercent) return;
_taskManager.Add(AccountId, new NPCTask(VillageId, AccountId));
}
diff --git a/MainCore/Tasks/VillageBotTask.cs b/MainCore/Tasks/VillageBotTask.cs
index 43fc9ae48..67e8d6292 100644
--- a/MainCore/Tasks/VillageBotTask.cs
+++ b/MainCore/Tasks/VillageBotTask.cs
@@ -1,4 +1,5 @@
-using MainCore.Services;
+using MainCore.Services.Implementations;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
namespace MainCore.Tasks
diff --git a/README.md b/README.md
index bef49c7de..15994921c 100644
--- a/README.md
+++ b/README.md
@@ -23,3 +23,7 @@ You can read our docs from this [link](https://tbs-docs.readthedocs.io/)
## Tech specification
Currently, TBS only runs on Windows. It will be cross-platform in the future.
+
+## Credits
+
+- [Xceed Extended WPF Toolkit™](https://github.com/xceedsoftware/wpftoolkit)
diff --git a/WPFUI/App.xaml.cs b/WPFUI/App.xaml.cs
index f849dea29..8c272c8a6 100644
--- a/WPFUI/App.xaml.cs
+++ b/WPFUI/App.xaml.cs
@@ -1,7 +1,8 @@
using FluentMigrator.Runner;
using MainCore;
using MainCore.Migrations;
-using MainCore.Services;
+using MainCore.Services.Implementations;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
@@ -9,7 +10,7 @@
using System.Threading.Tasks;
using System.Windows;
using WPFUI.Views;
-using EventManager = MainCore.Services.EventManager;
+using EventManager = MainCore.Services.Implementations.EventManager;
namespace WPFUI
{
diff --git a/WPFUI/Models/TroopInfo.cs b/WPFUI/Models/TroopInfo.cs
index 300b55b47..c515d8443 100644
--- a/WPFUI/Models/TroopInfo.cs
+++ b/WPFUI/Models/TroopInfo.cs
@@ -21,9 +21,9 @@ public bool IsChecked
public class TroopInfoText : TroopInfo
{
- private string _text;
+ private int _text;
- public string Text
+ public int Text
{
get => _text;
set => this.RaiseAndSetIfChanged(ref _text, value);
diff --git a/WPFUI/Models/VillageSetting.cs b/WPFUI/Models/VillageSetting.cs
index 35d34fdef..b3f61c926 100644
--- a/WPFUI/Models/VillageSetting.cs
+++ b/WPFUI/Models/VillageSetting.cs
@@ -9,6 +9,7 @@ public class VillageSetting : ReactiveObject
public void CopyFrom(MainCore.Models.Database.VillageSetting settings)
{
IsUseHeroRes = settings.IsUseHeroRes;
+ IsIgnoreRomanAdvantage = settings.IsIgnoreRomanAdvantage;
IsInstantComplete = settings.IsInstantComplete;
InstantCompleteTime = settings.InstantCompleteTime.ToString();
IsAdsUpgrade = settings.IsAdsUpgrade;
@@ -19,7 +20,10 @@ public void CopyFrom(MainCore.Models.Database.VillageSetting settings)
AutoRefreshTimeTolerance = $"{(settings.AutoRefreshTimeMax - settings.AutoRefreshTimeMin) / 2}";
IsAutoNPC = settings.IsAutoNPC;
+ IsNPCOverflow = settings.IsNPCOverflow;
+
AutoNPCPercent = settings.AutoNPCPercent.ToString();
+ AutoNPCWarehousePercent = settings.AutoNPCWarehousePercent.ToString();
AutoNPCWood = settings.AutoNPCWood.ToString();
AutoNPCClay = settings.AutoNPCClay.ToString();
AutoNPCIron = settings.AutoNPCIron.ToString();
@@ -32,6 +36,7 @@ public void CopyFrom(MainCore.Models.Database.VillageSetting settings)
public void CopyTo(MainCore.Models.Database.VillageSetting settings)
{
settings.IsUseHeroRes = IsUseHeroRes;
+ settings.IsIgnoreRomanAdvantage = IsIgnoreRomanAdvantage;
settings.IsInstantComplete = IsInstantComplete;
settings.InstantCompleteTime = int.Parse(InstantCompleteTime);
if (settings.InstantCompleteTime < 0) settings.InstantCompleteTime = 0;
@@ -47,7 +52,9 @@ public void CopyTo(MainCore.Models.Database.VillageSetting settings)
settings.AutoRefreshTimeMax = autoRefreshTime + autoRefreshTimeTolerance;
settings.IsAutoNPC = IsAutoNPC;
+ settings.IsNPCOverflow = IsNPCOverflow;
settings.AutoNPCPercent = int.Parse(AutoNPCPercent);
+ settings.AutoNPCWarehousePercent = int.Parse(AutoNPCWarehousePercent);
if (settings.AutoRefreshTimeMin < 4) settings.AutoRefreshTimeMin = 4;
settings.AutoNPCWood = int.Parse(AutoNPCWood);
settings.AutoNPCClay = int.Parse(AutoNPCClay);
@@ -117,6 +124,14 @@ public bool IsUseHeroRes
set => this.RaiseAndSetIfChanged(ref _isUseHeroRes, value);
}
+ private bool _isIgnoreRomanAdvantage;
+
+ public bool IsIgnoreRomanAdvantage
+ {
+ get => _isIgnoreRomanAdvantage;
+ set => this.RaiseAndSetIfChanged(ref _isIgnoreRomanAdvantage, value);
+ }
+
private bool _isInstantComplete;
public bool IsInstantComplete
@@ -181,6 +196,14 @@ public bool IsAutoNPC
set => this.RaiseAndSetIfChanged(ref _isAutoNPC, value);
}
+ private bool _isNPCOverflow;
+
+ public bool IsNPCOverflow
+ {
+ get => _isNPCOverflow;
+ set => this.RaiseAndSetIfChanged(ref _isNPCOverflow, value);
+ }
+
private string _autoNPCPercent;
public string AutoNPCPercent
@@ -189,6 +212,14 @@ public string AutoNPCPercent
set => this.RaiseAndSetIfChanged(ref _autoNPCPercent, value);
}
+ private string _autoNPCWarehousePercent;
+
+ public string AutoNPCWarehousePercent
+ {
+ get => _autoNPCWarehousePercent;
+ set => this.RaiseAndSetIfChanged(ref _autoNPCWarehousePercent, value);
+ }
+
private string _autoNPCWood;
public string AutoNPCWood
diff --git a/WPFUI/ViewModels/Abstract/TabBaseViewModel.cs b/WPFUI/ViewModels/Abstract/TabBaseViewModel.cs
index 91e7392e8..9dc22f8fb 100644
--- a/WPFUI/ViewModels/Abstract/TabBaseViewModel.cs
+++ b/WPFUI/ViewModels/Abstract/TabBaseViewModel.cs
@@ -1,5 +1,6 @@
using MainCore;
-using MainCore.Services;
+using MainCore.Services.Implementations;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using ReactiveUI;
using WPFUI.Views;
diff --git a/WPFUI/ViewModels/MainWindowViewModel.cs b/WPFUI/ViewModels/MainWindowViewModel.cs
index 7d05f7bd6..6537694d7 100644
--- a/WPFUI/ViewModels/MainWindowViewModel.cs
+++ b/WPFUI/ViewModels/MainWindowViewModel.cs
@@ -1,7 +1,8 @@
using MainCore;
using MainCore.Enums;
using MainCore.Models.Database;
-using MainCore.Services;
+using MainCore.Services.Implementations;
+using MainCore.Services.Interface;
using Microsoft.EntityFrameworkCore;
using ReactiveUI;
using System;
diff --git a/WPFUI/ViewModels/Tabs/Villages/TroopsViewModel.cs b/WPFUI/ViewModels/Tabs/Villages/TroopsViewModel.cs
index 8064f9c6d..a3426ac25 100644
--- a/WPFUI/ViewModels/Tabs/Villages/TroopsViewModel.cs
+++ b/WPFUI/ViewModels/Tabs/Villages/TroopsViewModel.cs
@@ -59,7 +59,7 @@ private void LoadCurrent(int villageId)
CurrentLevel.Add(new TroopInfoText
{
Troop = (TroopEnums)troop.Id,
- Text = troop.Level.ToString()
+ Text = troop.Level,
});
}
}
diff --git a/WPFUI/ViewModels/Uc/ButtonPanelViewModel.cs b/WPFUI/ViewModels/Uc/ButtonPanelViewModel.cs
index c0941bfb2..cb564fc04 100644
--- a/WPFUI/ViewModels/Uc/ButtonPanelViewModel.cs
+++ b/WPFUI/ViewModels/Uc/ButtonPanelViewModel.cs
@@ -2,7 +2,7 @@
using MainCore.Enums;
using MainCore.Helper;
using MainCore.Models.Database;
-using MainCore.Services;
+using MainCore.Services.Interface;
using MainCore.Tasks.Misc;
using Microsoft.EntityFrameworkCore;
using ReactiveUI;
@@ -16,7 +16,7 @@
using WPFUI.Models;
using WPFUI.Views;
using Access = MainCore.Models.Database.Access;
-using EventManager = MainCore.Services.EventManager;
+using EventManager = MainCore.Services.Implementations.EventManager;
namespace WPFUI.ViewModels.Uc
{
diff --git a/WPFUI/ViewModels/Uc/CheckBoxWithInputViewModel.cs b/WPFUI/ViewModels/Uc/CheckBoxWithInputViewModel.cs
index 07a63f2c8..067b7ad3b 100644
--- a/WPFUI/ViewModels/Uc/CheckBoxWithInputViewModel.cs
+++ b/WPFUI/ViewModels/Uc/CheckBoxWithInputViewModel.cs
@@ -26,9 +26,9 @@ public bool IsChecked
set => this.RaiseAndSetIfChanged(ref _isChecked, value);
}
- private string _value;
+ private int _value;
- public string Value
+ public int Value
{
get => _value;
set => this.RaiseAndSetIfChanged(ref _value, value);
diff --git a/WPFUI/ViewModels/Uc/ResourcesViewModel.cs b/WPFUI/ViewModels/Uc/ResourcesViewModel.cs
index 9b8141390..3c3578065 100644
--- a/WPFUI/ViewModels/Uc/ResourcesViewModel.cs
+++ b/WPFUI/ViewModels/Uc/ResourcesViewModel.cs
@@ -17,33 +17,33 @@ public string Text
set => this.RaiseAndSetIfChanged(ref _text, value);
}
- private string _wood;
+ private int _wood;
- public string Wood
+ public int Wood
{
get => _wood;
set => this.RaiseAndSetIfChanged(ref _wood, value);
}
- private string _clay;
+ private int _clay;
- public string Clay
+ public int Clay
{
get => _clay;
set => this.RaiseAndSetIfChanged(ref _clay, value);
}
- private string _iron;
+ private int _iron;
- public string Iron
+ public int Iron
{
get => _iron;
set => this.RaiseAndSetIfChanged(ref _iron, value);
}
- private string _crop;
+ private int _crop;
- public string Crop
+ public int Crop
{
get => _crop;
set => this.RaiseAndSetIfChanged(ref _crop, value);
diff --git a/WPFUI/ViewModels/Uc/ResourcesWithStorageViewModel.cs b/WPFUI/ViewModels/Uc/ResourcesWithStorageViewModel.cs
index 598ea70af..0abf1a431 100644
--- a/WPFUI/ViewModels/Uc/ResourcesWithStorageViewModel.cs
+++ b/WPFUI/ViewModels/Uc/ResourcesWithStorageViewModel.cs
@@ -4,49 +4,49 @@ namespace WPFUI.ViewModels.Uc
{
public class ResourcesWithStorageViewModel : ReactiveObject
{
- private string _warehouse;
+ private int _warehouse;
- public string Warehouse
+ public int Warehouse
{
get => _warehouse;
set => this.RaiseAndSetIfChanged(ref _warehouse, value);
}
- private string _granary;
+ private int _granary;
- public string Granary
+ public int Granary
{
get => _granary;
set => this.RaiseAndSetIfChanged(ref _granary, value);
}
- private string _wood;
+ private int _wood;
- public string Wood
+ public int Wood
{
get => _wood;
set => this.RaiseAndSetIfChanged(ref _wood, value);
}
- private string _clay;
+ private int _clay;
- public string Clay
+ public int Clay
{
get => _clay;
set => this.RaiseAndSetIfChanged(ref _clay, value);
}
- private string _iron;
+ private int _iron;
- public string Iron
+ public int Iron
{
get => _iron;
set => this.RaiseAndSetIfChanged(ref _iron, value);
}
- private string _crop;
+ private int _crop;
- public string Crop
+ public int Crop
{
get => _crop;
set => this.RaiseAndSetIfChanged(ref _crop, value);
diff --git a/WPFUI/ViewModels/Uc/ToleranceViewModel.cs b/WPFUI/ViewModels/Uc/ToleranceViewModel.cs
index 34b42d83a..7bb2dde2b 100644
--- a/WPFUI/ViewModels/Uc/ToleranceViewModel.cs
+++ b/WPFUI/ViewModels/Uc/ToleranceViewModel.cs
@@ -1,4 +1,5 @@
using ReactiveUI;
+using System;
namespace WPFUI.ViewModels.Uc
{
@@ -8,6 +9,11 @@ public ToleranceViewModel(string text, string unit) : base()
{
Text = text;
Unit = unit;
+ this.WhenAnyValue(vm => vm.MainValue).Subscribe(x =>
+ {
+ ToleranceMax = x;
+ if (ToleranceValue > x) ToleranceValue = x;
+ });
}
private string _text;
@@ -26,20 +32,28 @@ public string Unit
set => this.RaiseAndSetIfChanged(ref _unit, value);
}
- private string _mainValue;
+ private int _mainValue;
- public string MainValue
+ public int MainValue
{
get => _mainValue;
set => this.RaiseAndSetIfChanged(ref _mainValue, value);
}
- private string _toleranceValue;
+ private int _toleranceValue;
- public string ToleranceValue
+ public int ToleranceValue
{
get => _toleranceValue;
set => this.RaiseAndSetIfChanged(ref _toleranceValue, value);
}
+
+ private int _toleranceMax;
+
+ public int ToleranceMax
+ {
+ get => _toleranceMax;
+ set => this.RaiseAndSetIfChanged(ref _toleranceMax, value);
+ }
}
}
\ No newline at end of file
diff --git a/WPFUI/Views/Tabs/Villages/SettingsPage.xaml b/WPFUI/Views/Tabs/Villages/SettingsPage.xaml
index 30680a9c0..93661e251 100644
--- a/WPFUI/Views/Tabs/Villages/SettingsPage.xaml
+++ b/WPFUI/Views/Tabs/Villages/SettingsPage.xaml
@@ -21,32 +21,36 @@
-
-
+
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Tabs/Villages/SettingsPage.xaml.cs b/WPFUI/Views/Tabs/Villages/SettingsPage.xaml.cs
index e6312fdd4..b2527f3fa 100644
--- a/WPFUI/Views/Tabs/Villages/SettingsPage.xaml.cs
+++ b/WPFUI/Views/Tabs/Villages/SettingsPage.xaml.cs
@@ -17,6 +17,7 @@ public SettingsPage()
WatchAds.ViewModel = new("Using ads upgrade button when building time is longer than", "min(s)");
Refresh.ViewModel = new("Refresh interval", "min(s)");
AutoNPC.ViewModel = new("Auto NPC when crop is more than", "% of granary");
+ AutoNPCWarehouse.ViewModel = new("Auto NPC when any resource is more than", "% of warehouse");
AutoNPCRatio.ViewModel = new("Ratio");
TroopUpgrade.ViewModel = new("Troop will be upgraded");
this.WhenActivated(d =>
@@ -26,6 +27,7 @@ public SettingsPage()
this.BindCommand(ViewModel, vm => vm.SaveCommand, v => v.SaveButton).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.IsUseHeroRes, v => v.UseHeroResCheckBox.IsChecked).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Settings.IsIgnoreRomanAdvantage, v => v.IgnoreRomanAdvantageCheckBox.IsChecked).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.IsInstantComplete, v => v.Complete.ViewModel.IsChecked).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.InstantCompleteTime, v => v.Complete.ViewModel.Value).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.IsAdsUpgrade, v => v.WatchAds.ViewModel.IsChecked).DisposeWith(d);
@@ -36,7 +38,9 @@ public SettingsPage()
this.Bind(ViewModel, vm => vm.Settings.AutoRefreshTimeTolerance, v => v.Refresh.ViewModel.ToleranceValue).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.IsAutoNPC, v => v.AutoNPC.ViewModel.IsChecked).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Settings.IsNPCOverflow, v => v.NPCCheckBox.IsChecked).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.AutoNPCPercent, v => v.AutoNPC.ViewModel.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Settings.AutoNPCWarehousePercent, v => v.AutoNPCWarehouse.ViewModel.Value).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.AutoNPCWood, v => v.AutoNPCRatio.ViewModel.Wood).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.AutoNPCClay, v => v.AutoNPCRatio.ViewModel.Clay).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Settings.AutoNPCIron, v => v.AutoNPCRatio.ViewModel.Iron).DisposeWith(d);
diff --git a/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml b/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml
index a2e83f8b4..0ff2666c4 100644
--- a/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml
+++ b/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml
@@ -4,10 +4,11 @@
xmlns:rxui="http://reactiveui.net"
xmlns:vms="clr-namespace:WPFUI.ViewModels.Uc"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml.cs b/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml.cs
index 550a07c74..52955bb28 100644
--- a/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml.cs
+++ b/WPFUI/Views/Uc/CheckBoxWithInputUc.xaml.cs
@@ -16,7 +16,7 @@ public CheckBoxWithInputUc()
{
this.Bind(ViewModel, vm => vm.IsChecked, v => v.IsChecked.IsChecked).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Text, v => v.IsChecked.Content).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Value, v => v.Value.Text).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Value, v => v.Value.Value).DisposeWith(d);
this.Bind(ViewModel, vm => vm.Unit, v => v.UnitLabel.Content).DisposeWith(d);
});
}
diff --git a/WPFUI/Views/Uc/FarmListControllerUc.xaml b/WPFUI/Views/Uc/FarmListControllerUc.xaml
index f64ac1440..ce1642ca6 100644
--- a/WPFUI/Views/Uc/FarmListControllerUc.xaml
+++ b/WPFUI/Views/Uc/FarmListControllerUc.xaml
@@ -7,8 +7,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
+ d:DesignHeight="450" d:DesignWidth="800"
+ xmlns:controls="clr-namespace:WPFUI.Views.Uc">
@@ -19,12 +21,7 @@
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Uc/FarmListControllerUc.xaml.cs b/WPFUI/Views/Uc/FarmListControllerUc.xaml.cs
index 407e7d3b1..32ad031a4 100644
--- a/WPFUI/Views/Uc/FarmListControllerUc.xaml.cs
+++ b/WPFUI/Views/Uc/FarmListControllerUc.xaml.cs
@@ -13,17 +13,17 @@ public FarmListControllerUc()
{
ViewModel = new();
InitializeComponent();
+ Interval.ViewModel = new("Time for next send", "sec(s)");
this.WhenActivated(d =>
{
this.BindCommand(ViewModel, vm => vm.SaveCommand, v => v.SaveButton).DisposeWith(d);
this.Bind(ViewModel, vm => vm.FarmSetting.IsActive, v => v.ActiveCheckBox.IsChecked).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.FarmSetting.IntervalTime, v => v.IntervalTimeText.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.FarmSetting.IntervalDiffTime, v => v.IntervalTimeDiffText.Text).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.FarmSetting.IntervalTime, v => v.Interval.ViewModel.MainValue).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.FarmSetting.IntervalDiffTime, v => v.Interval.ViewModel.ToleranceValue).DisposeWith(d);
this.Bind(ViewModel, vm => vm.IsActive, v => v.ActiveCheckBox.IsEnabled).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.IsActive, v => v.IntervalTimeText.IsEnabled).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.IsActive, v => v.IntervalTimeDiffText.IsEnabled).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.IsActive, v => v.Interval.IsEnabled).DisposeWith(d);
});
}
}
diff --git a/WPFUI/Views/Uc/NormalBuildUc.xaml b/WPFUI/Views/Uc/NormalBuildUc.xaml
index 30f912c7d..eceac70e8 100644
--- a/WPFUI/Views/Uc/NormalBuildUc.xaml
+++ b/WPFUI/Views/Uc/NormalBuildUc.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:WPFUI.Views.Uc"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="75" d:DesignWidth="250">
@@ -26,7 +26,7 @@
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Uc/ResBuildUc.xaml b/WPFUI/Views/Uc/ResBuildUc.xaml
index c7ac67734..a44dd506e 100644
--- a/WPFUI/Views/Uc/ResBuildUc.xaml
+++ b/WPFUI/Views/Uc/ResBuildUc.xaml
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:WPFUI.Views.Uc"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="75" d:DesignWidth="250">
@@ -20,7 +20,7 @@
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Uc/ResourcesUc.xaml b/WPFUI/Views/Uc/ResourcesUc.xaml
index 65d7bf8e1..57c5359d7 100644
--- a/WPFUI/Views/Uc/ResourcesUc.xaml
+++ b/WPFUI/Views/Uc/ResourcesUc.xaml
@@ -4,7 +4,8 @@
xmlns:rxui="http://reactiveui.net"
xmlns:vms="clr-namespace:WPFUI.ViewModels.Uc"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
@@ -12,24 +13,24 @@
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Uc/ResourcesUc.xaml.cs b/WPFUI/Views/Uc/ResourcesUc.xaml.cs
index 2ecc23f57..00f216783 100644
--- a/WPFUI/Views/Uc/ResourcesUc.xaml.cs
+++ b/WPFUI/Views/Uc/ResourcesUc.xaml.cs
@@ -15,10 +15,10 @@ public ResourcesUc()
this.WhenActivated(d =>
{
this.Bind(ViewModel, vm => vm.Text, v => v.Text.Content).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Wood, v => v.Wood.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Clay, v => v.Clay.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Iron, v => v.Iron.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Crop, v => v.Crop.Text).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Wood, v => v.Wood.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Clay, v => v.Clay.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Iron, v => v.Iron.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Crop, v => v.Crop.Value).DisposeWith(d);
});
}
}
diff --git a/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml b/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml
index d2a61bbc3..861a22348 100644
--- a/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml
+++ b/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml
@@ -1,46 +1,47 @@
-
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
-
+
-
+
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml.cs b/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml.cs
index 9c65f0c9a..957a3b81f 100644
--- a/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml.cs
+++ b/WPFUI/Views/Uc/ResourcesWithStorageUc.xaml.cs
@@ -14,12 +14,12 @@ public ResourcesWithStorageUc()
InitializeComponent();
this.WhenActivated(d =>
{
- this.Bind(ViewModel, vm => vm.Warehouse, v => v.Warehouse.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Wood, v => v.Wood.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Clay, v => v.Clay.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Iron, v => v.Iron.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Granary, v => v.Granary.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.Crop, v => v.Crop.Text).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Warehouse, v => v.Warehouse.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Wood, v => v.Wood.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Clay, v => v.Clay.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Iron, v => v.Iron.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Granary, v => v.Granary.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.Crop, v => v.Crop.Value).DisposeWith(d);
});
}
}
diff --git a/WPFUI/Views/Uc/ToleranceUc.xaml b/WPFUI/Views/Uc/ToleranceUc.xaml
index 3d4972917..b91380020 100644
--- a/WPFUI/Views/Uc/ToleranceUc.xaml
+++ b/WPFUI/Views/Uc/ToleranceUc.xaml
@@ -4,12 +4,13 @@
xmlns:rxui="http://reactiveui.net"
xmlns:vms="clr-namespace:WPFUI.ViewModels.Uc"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
-
+
-
+
\ No newline at end of file
diff --git a/WPFUI/Views/Uc/ToleranceUc.xaml.cs b/WPFUI/Views/Uc/ToleranceUc.xaml.cs
index 12487f751..aebceeeb2 100644
--- a/WPFUI/Views/Uc/ToleranceUc.xaml.cs
+++ b/WPFUI/Views/Uc/ToleranceUc.xaml.cs
@@ -16,8 +16,9 @@ public ToleranceUc()
{
this.OneWayBind(ViewModel, vm => vm.Text, v => v.TextLabel.Content).DisposeWith(d);
this.OneWayBind(ViewModel, vm => vm.Unit, v => v.UnitLabel.Content).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.MainValue, v => v.MainValue.Text).DisposeWith(d);
- this.Bind(ViewModel, vm => vm.ToleranceValue, v => v.Tolerance.Text).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.MainValue, v => v.MainValue.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.ToleranceValue, v => v.Tolerance.Value).DisposeWith(d);
+ this.Bind(ViewModel, vm => vm.ToleranceMax, v => v.Tolerance.Maximum).DisposeWith(d);
});
}
}
diff --git a/WPFUI/Views/Uc/TroopsUc.xaml b/WPFUI/Views/Uc/TroopsUc.xaml
index aeab937b2..3af1dadfa 100644
--- a/WPFUI/Views/Uc/TroopsUc.xaml
+++ b/WPFUI/Views/Uc/TroopsUc.xaml
@@ -4,7 +4,8 @@
xmlns:rxui="http://reactiveui.net"
xmlns:vms="clr-namespace:WPFUI.ViewModels.Uc"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
@@ -21,7 +22,7 @@
-
+
diff --git a/WPFUI/WPFUI.csproj b/WPFUI/WPFUI.csproj
index eedf8d2ca..3b19d4628 100644
--- a/WPFUI/WPFUI.csproj
+++ b/WPFUI/WPFUI.csproj
@@ -51,6 +51,7 @@
+