Skip to content

Commit

Permalink
Merge pull request #106 from BUTR/dev
Browse files Browse the repository at this point in the history
v1.5.3
  • Loading branch information
Aragas authored Apr 30, 2024
2 parents 1f0a756 + e90623e commit d706796
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
# STEAM #
###########################
publish-on-steam:
if: github.ref == 'refs/heads/master'
if: false && github.ref == 'refs/heads/master'
needs: [get-changelog, build]
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<!--Development Variables-->
<PropertyGroup>
<Version>1.5.2</Version>
<Version>1.5.3</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<BUTRSharedVersion>3.0.0.139</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.222</BUTRModuleManagerVersion>
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.5.3
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.x
* BETA Release!
* Update Recommendations now display the current and recommended compatibility score
---------------------------------------------------------------------------------------------------
Version: 1.5.2
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.x
* BETA Release!
Expand Down
5 changes: 2 additions & 3 deletions src/Bannerlord.LauncherEx/Mixins/LauncherModsVMMixin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void ExecuteUpdateCheck()
Modules = selectedModules
}));

var responseDefinition = new { Modules = new[] { new { ModuleId = "", Compatibility = 0d, RecommendedModuleVersion = "" } } };
var responseDefinition = new { Modules = new[] { new { ModuleId = "", Compatibility = 0d, RecommendedCompatibility = (double?) null, RecommendedModuleVersion = (string?) null } } };

var httpWebRequest = WebRequest.CreateHttp(uploadUrlAttr.Value);
httpWebRequest.Method = "POST";
Expand All @@ -285,8 +285,7 @@ public void ExecuteUpdateCheck()
foreach (var module in result.Modules)
{
if (Modules2.FirstOrDefault(x => x.ModuleInfoExtended.Id == module.ModuleId) is not { } moduleVM) continue;
if (module.Compatibility > 0d)
moduleVM.SetUpdateInfo(module.Compatibility, module.RecommendedModuleVersion);
moduleVM.SetUpdateInfo(module.Compatibility, module.RecommendedCompatibility, module.RecommendedModuleVersion);
}
}
catch (Exception) { /* ignore */ }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Bannerlord.LauncherManager.Localization;
using Bannerlord.LauncherManager.Localization;

using HarmonyLib;
using HarmonyLib.BUTR.Extensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@


<string id="HdnFwgVA" text="Based on BUTR analytics:{NL}{NL}Update is not requiured.{NL}Compatibility Score {SCORE}%{NL}{NL}{CURRENTVERSION} is one of the best version for game {GAMEVERSION}" />
<string id="HdnFwgVB" text="Based on BUTR analytics:{NL}{NL}Suggesting to update to {RECOMMENDEDVERSION}.{NL}Compatibility Score {SCORE}%{NL}{NL}{RECOMMENDEDVERSION} has a better compatibility for game {GAMEVERSION} rather than {CURRENTVERSION}!" />
<string id="HdnFwgVB" text="Based on BUTR analytics:{NL}{NL}Compatibility Score {SCORE}%{NL}{NL}Suggesting to update to {RECOMMENDEDVERSION}.{NL}Compatibility Score {RECOMMENDEDSCORE}%{NL}{NL}{RECOMMENDEDVERSION} has a better compatibility for game {GAMEVERSION} rather than {CURRENTVERSION}!" />

<string id="q5quVWMI" text="Toggle All Modules" />
<string id="H5nMY4WU" text="Refresh Modules" />
Expand Down
25 changes: 12 additions & 13 deletions src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,23 @@ public string IssuesText
private bool _updateInfoAvailable;

[BUTRDataSourceProperty]
public double CompatibilityScore { get => _compatibilityScore; set => SetField(ref _compatibilityScore, value); }
private double _compatibilityScore = 1d;

[BUTRDataSourceProperty]
public string RecommendedVersion { get => _recommendedVersion; set => SetField(ref _recommendedVersion, value); }
private string _recommendedVersion = string.Empty;
public double CompatibilityScore { get; set; }
public double RecommendedCompatibilityScore { get; set; }
public string RecommendedVersion { get; set; }

[BUTRDataSourceProperty]
public LauncherHintVM? UpdateHint { get => _updateHint; set => SetField(ref _updateHint, value); }
private LauncherHintVM? _updateHint;

[BUTRDataSourceProperty]
public bool IsUpdateHintHigh => UpdateInfoAvailable && CompatibilityScore >= 75d;

[BUTRDataSourceProperty]
public bool IsUpdateHintMedium => UpdateInfoAvailable && CompatibilityScore is >= 50d and < 75d;

[BUTRDataSourceProperty]
public bool IsUpdateHintLow => UpdateInfoAvailable && CompatibilityScore is >= 0d and < 50d;

public BUTRLauncherModuleVM(ModuleInfoExtendedWithMetadata moduleInfoExtended, Action<BUTRLauncherModuleVM> select, Func<BUTRLauncherModuleVM, IEnumerable<string>> validate,

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Win64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 128 in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherModuleVM.cs

View workflow job for this annotation

GitHub Actions / Build Bannerlord.BLSE.Shared (Gaming.Desktop.x64_Shipping_Client)

Non-nullable property 'RecommendedVersion' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
Func<ModuleInfoExtendedWithMetadata, ICollection<ModuleProviderType>> getPossibleProviders)
{
Expand Down Expand Up @@ -202,22 +199,24 @@ public void ExecuteOpen()
Process.Start(ModuleInfoExtended.Path);
}

public void SetUpdateInfo(double compatibilityScore, string? recommendedVersion)
public void SetUpdateInfo(double compatibilityScore, double? recommendedCompatibilityScore, string? recommendedVersion)
{
UpdateInfoAvailable = true;
CompatibilityScore = compatibilityScore;
RecommendedCompatibilityScore = recommendedCompatibilityScore ?? 0d;
RecommendedVersion = recommendedVersion ?? string.Empty;

var hasRecommendedVersion = !string.IsNullOrEmpty(recommendedVersion);

UpdateHint = new LauncherHintVM(new BUTRTextObject(hasRecommendedVersion
? "{=HdnFwgVB}Based on BUTR analytics:{NL}{NL}Suggesting to update to {RECOMMENDEDVERSION}.{NL}Compatibility Score {SCORE}%{NL}{NL}{RECOMMENDEDVERSION} has a better compatibility for game {GAMEVERSION} rather than {CURRENTVERSION}!"
? "{=HdnFwgVB}Based on BUTR analytics:{NL}{NL}Compatibility Score {SCORE}%{NL}{NL}Suggesting to update to {RECOMMENDEDVERSION}.{NL}Compatibility Score {RECOMMENDEDSCORE}%{NL}{NL}{RECOMMENDEDVERSION} has a better compatibility for game {GAMEVERSION} rather than {CURRENTVERSION}!"
: "{=HdnFwgVA}Based on BUTR analytics:{NL}{NL}Update is not requiured.{NL}Compatibility Score {SCORE}%{NL}{NL}{CURRENTVERSION} is one of the best version for game {GAMEVERSION}")
.SetTextVariable("SCORE", CompatibilityScore.ToString(CultureInfo.InvariantCulture))
.SetTextVariable("RECOMMENDEDSCORE", RecommendedCompatibilityScore.ToString(CultureInfo.InvariantCulture))
.SetTextVariable("CURRENTVERSION", VersionText)
.SetTextVariable("RECOMMENDEDVERSION", RecommendedVersion)
.SetTextVariable("GAMEVERSION", ApplicationVersionHelper.GameVersionStr()).ToString());

OnPropertyChanged(nameof(IsUpdateHintHigh));
OnPropertyChanged(nameof(IsUpdateHintMedium));
OnPropertyChanged(nameof(IsUpdateHintLow));
Expand All @@ -229,7 +228,7 @@ public void RemoveUpdateInfo()
CompatibilityScore = 0d;
RecommendedVersion = string.Empty;
UpdateHint = null;

OnPropertyChanged(nameof(IsUpdateHintHigh));
OnPropertyChanged(nameof(IsUpdateHintMedium));
OnPropertyChanged(nameof(IsUpdateHintLow));
Expand Down

0 comments on commit d706796

Please sign in to comment.