Skip to content

Commit

Permalink
Merge pull request #98 from BUTR/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Aragas authored Oct 27, 2022
2 parents aa54090 + e634cb7 commit 2c3c988
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 198 deletions.
44 changes: 12 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
name: Build for NexusMods
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.version.outputs.mod_version }}
mod_version: ${{ steps.version.outputs.mod_version }}
steps:
- name: Setup
uses: butr/[email protected]
Expand Down Expand Up @@ -54,38 +54,17 @@ jobs:
# STEAM #
###########################
publish-on-steam:
name: Publish on Steam
runs-on: ubuntu-latest
needs: ["build-module"]
if: ${{false}}
steps:
- name: Setup
uses: butr/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Download bannerlord folder
uses: actions/download-artifact@v3
with:
name: bannerlord
path: ./bannerlord

- name: Get Bannerlord.Harmony version
id: version
run: >-
$vers =(Get-Item './bannerlord/Modules/Bannerlord.Harmony/bin/Win64_Shipping_Client/Bannerlord.Harmony.dll').VersionInfo.ProductVersion.Split("+")[0];
echo "::set-output name=mod_version::$vers"
shell: pwsh

- uses: AnarkisGaming/workshop@v1
with:
appID: 261550
publishedFileID: 2859188632
path: ./bannerlord
changelog: Release ${{steps.version.outputs.mod_version}}
env:
STEAM_ACCOUNT_NAME: ${{secrets.STEAM_LOGIN}}
STEAM_PASSWORD: ${{secrets.STEAM_PASSWORD}}
uses: BUTR/workflows/.github/workflows/release-steam.yml@master
with:
workshop_id: 2859188632
mod_id: Bannerlord.Harmony
mod_description: Release v${{ needs.build-module.outputs.mod_version }}
artifact_name: bannerlord
secrets:
STEAM_LOGIN: ${{ secrets.STEAM_WORKSHOP_LOGIN }}
STEAM_PASSWORD: ${{ secrets.STEAM_WORKSHOP_PASSWORD }}
STEAM_AUTH_CODE: ${{ secrets.STEAM_WORKSHOP_AUTH_CODE }}

###########################
# GITHUB #
Expand All @@ -96,4 +75,5 @@ jobs:
with:
mod_id: Bannerlord.Harmony
mod_version: ${{ needs.build-module.outputs.mod_version }}
mod_description: Release v${{ needs.build-module.outputs.mod_version }}
artifact_name: bannerlord
8 changes: 4 additions & 4 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<!--Module Version-->
<Version>0.0.1.0</Version>
<!--Harmony Version-->
<HarmonyExtensionsVersion>3.1.0.61</HarmonyExtensionsVersion>
<HarmonyExtensionsVersion>3.1.0.67</HarmonyExtensionsVersion>
<HarmonyVersion>2.2.2.0</HarmonyVersion>
<HarmonyAnalyzerVersion>1.0.1.44</HarmonyAnalyzerVersion>
<BuildResourcesVersion>1.0.1.68</BuildResourcesVersion>
<BUTRAnalyzerVersion>1.0.1.12</BUTRAnalyzerVersion>
<BUTRSharedVersion>2.0.0.99</BUTRSharedVersion>
<BUTRModuleManagerVersion>4.0.123</BUTRModuleManagerVersion>
<BUTRSharedVersion>3.0.0.116</BUTRSharedVersion>
<BUTRModuleManagerVersion>4.0.149</BUTRModuleManagerVersion>
<!--Current Bannerlord Version-->
<GameVersion>1.1.0</GameVersion>
<GameVersion>1.0.0</GameVersion>
<!--Bannerlord's Root Folder. Leave empty if you want it to be tried to be autoresolved.-->
<GameFolder Condition="$(Configuration) == 'Stable_Debug' OR $(Configuration) == 'Stable_Release'">$(BANNERLORD_STABLE_DIR)</GameFolder>
<GameFolder Condition="$(Configuration) == 'Beta_Debug' OR $(Configuration) == 'Beta_Release'">$(BANNERLORD_BETA_DIR)</GameFolder>
Expand Down
6 changes: 2 additions & 4 deletions src/Bannerlord.Harmony/Bannerlord.Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
<PackageReference Include="Bannerlord.BUTR.Analyzers" Version="$(BUTRAnalyzerVersion)" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Bannerlord.BUTR.Shared" Version="$(BUTRSharedVersion)" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Bannerlord.ModuleManager.Source" Version="$(BUTRModuleManagerVersion)" />
<PackageReference Include="Bannerlord.ReferenceAssemblies.Core.EarlyAccess" Version="$(GameVersion).*" PrivateAssets="All" />
<PackageReference Include="Bannerlord.ReferenceAssemblies.Core" Version="$(GameVersion).*" PrivateAssets="All" />
<PackageReference Include="Harmony.Extensions" Version="$(HarmonyExtensionsVersion)" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)" />
<PackageReference Include="IsExternalInit" Version="1.0.3" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -70,4 +68,4 @@
</Task>
</UsingTask>

</Project>
</Project>
8 changes: 4 additions & 4 deletions src/Bannerlord.Harmony/DebugUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class DebugUI
{
private record HarmonyPatches
{
public ICollection<Patch> Prefixes { get; init; } = new List<Patch>();
public ICollection<Patch> Postfixes { get; init; } = new List<Patch>();
public ICollection<Patch> Transpilers { get; init; } = new List<Patch>();
public ICollection<Patch> Finalizers { get; init; } = new List<Patch>();
public ICollection<Patch> Prefixes { get; } = new List<Patch>();
public ICollection<Patch> Postfixes { get; } = new List<Patch>();
public ICollection<Patch> Transpilers { get; } = new List<Patch>();
public ICollection<Patch> Finalizers { get; } = new List<Patch>();
}

private static readonly string _windowTitle = "Harmony Debug UI";
Expand Down
37 changes: 14 additions & 23 deletions src/Bannerlord.Harmony/SubModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,13 @@ public class SubModule : MBSubModuleBase

private readonly DebugUI _debugUI = new();

private static TextObject? GetExpectIssuesWarning() =>
TextObjectHelper.Create(SWarningExpectIssues)?.SetTextVariable2("NL", Environment.NewLine);
private static TextObject? GetExpectIssuesWarning() => new TextObject(SWarningExpectIssues)?.SetTextVariable("NL", Environment.NewLine);

protected override void OnSubModuleLoad()
{
base.OnSubModuleLoad();

ValidateHarmony();

if (ApplicationVersionHelper.GameVersion() is { } gameVersion)
{
if (gameVersion.Major is 1 && gameVersion.Minor is 8 && gameVersion.Revision >= 0)
{
LocalizedTextManagerUtils.LoadLanguageData();
}
}
}

protected override void OnBeforeInitialModuleScreenSetAsRoot()
Expand Down Expand Up @@ -102,11 +93,11 @@ private static void ValidateLoadOrder()
var harmonyModule = loadedModules.SingleOrDefault(x => x.Id == "Bannerlord.Harmony");
var harmonyModuleIndex = harmonyModule is not null ? loadedModules.IndexOf(harmonyModule) : -1;
if (harmonyModuleIndex == -1)
InformationManagerUtils.DisplayMessage(InformationMessageUtils.Create(TextObjectHelper.Create(SErrorHarmonyNotFound)?.ToString() ?? "ERROR", Color.FromUint(COLOR_RED)));
InformationManager.DisplayMessage(new InformationMessage(new TextObject(SErrorHarmonyNotFound)?.ToString() ?? "ERROR", Color.FromUint(COLOR_RED)));
if (harmonyModuleIndex != 0)
{
var textObject = TextObjectHelper.Create(SErrorHarmonyNotFirst)?.SetTextVariable2("EXPECT_ISSUES_WARNING", GetExpectIssuesWarning());
InformationManagerUtils.DisplayMessage(InformationMessageUtils.Create(textObject?.ToString() ?? "ERROR", Color.FromUint(COLOR_RED)));
var textObject = new TextObject(SErrorHarmonyNotFirst)?.SetTextVariable("EXPECT_ISSUES_WARNING", GetExpectIssuesWarning());
InformationManager.DisplayMessage(new InformationMessage(textObject?.ToString() ?? "ERROR", Color.FromUint(COLOR_RED)));
}
}

Expand All @@ -123,28 +114,28 @@ private static void ValidateHarmony()
if (harmonyModule is null)
{
if (sb.Length != 0) sb.AppendLine();
var textObject = TextObjectHelper.Create(SErrorHarmonyLoadedFromAnotherPlace);
textObject?.SetTextVariable2("LOCATION", TextObjectHelper.Create(string.IsNullOrEmpty(currentexistingHarmony.Location) ? string.Empty : Path.GetFullPath(currentexistingHarmony.Location)));
textObject?.SetTextVariable2("EXPECT_ISSUES_WARNING", GetExpectIssuesWarning());
textObject?.SetTextVariable2("NL", Environment.NewLine);
var textObject = new TextObject(SErrorHarmonyLoadedFromAnotherPlace);
textObject?.SetTextVariable("LOCATION", new TextObject(string.IsNullOrEmpty(currentexistingHarmony.Location) ? string.Empty : Path.GetFullPath(currentexistingHarmony.Location)));
textObject?.SetTextVariable("EXPECT_ISSUES_WARNING", GetExpectIssuesWarning());
textObject?.SetTextVariable("NL", Environment.NewLine);
sb.AppendLine(textObject?.ToString() ?? "ERROR");
}

if (requiredHarmonyVersion.Version.CompareTo(currentHarmonyName.Version) != 0)
{
if (sb.Length != 0) sb.AppendLine();
var textObject = TextObjectHelper.Create(SErrorHarmonyWrongVersion);
textObject?.SetTextVariable2("P_VERSION", TextObjectHelper.Create(requiredHarmonyVersion.Version.ToString()));
textObject?.SetTextVariable2("E_VERSION", TextObjectHelper.Create(currentHarmonyName.Version.ToString()));
textObject?.SetTextVariable2("EXPECT_ISSUES_WARNING", GetExpectIssuesWarning());
textObject?.SetTextVariable2("NL", Environment.NewLine);
var textObject = new TextObject(SErrorHarmonyWrongVersion);
textObject?.SetTextVariable("P_VERSION", new TextObject(requiredHarmonyVersion.Version.ToString()));
textObject?.SetTextVariable("E_VERSION", new TextObject(currentHarmonyName.Version.ToString()));
textObject?.SetTextVariable("EXPECT_ISSUES_WARNING", GetExpectIssuesWarning());
textObject?.SetTextVariable("NL", Environment.NewLine);
sb.AppendLine(textObject?.ToString() ?? "ERROR");
}

if (sb.Length > 0)
{
Task.Run(() => MessageBox.Show(sb.ToString(),
TextObjectHelper.Create(SWarningTitle)?.ToString() ?? "ERROR", MessageBoxButtons.OK,
new TextObject(SWarningTitle)?.ToString() ?? "ERROR", MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions) 0x40000));
}
}
Expand Down
40 changes: 0 additions & 40 deletions src/Bannerlord.Harmony/Utils/InformationManagerUtils.cs

This file was deleted.

40 changes: 0 additions & 40 deletions src/Bannerlord.Harmony/Utils/InformationMessageUtils.cs

This file was deleted.

7 changes: 0 additions & 7 deletions src/Bannerlord.Harmony/Utils/InformationMessageWrapper.cs

This file was deleted.

35 changes: 0 additions & 35 deletions src/Bannerlord.Harmony/Utils/LocalizedTextManagerUtils.cs

This file was deleted.

12 changes: 3 additions & 9 deletions src/Bannerlord.Harmony/_Module/SubModule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
<Id value="$moduleid$" />
<Name value="$modulename$" />
<Version value="v$version$" />
<Official value="false" />
<DefaultModule value="false" />
<SingleplayerModule value="true" />
<MultiplayerModule value="false" />
<ModuleCategory value="Singleplayer" />
<ModuleType value ="Community" />
<Url value="https://www.nexusmods.com/mountandblade2bannerlord/mods/2006" />
<DependedModules />
<ModulesToLoadAfterThis>
Expand All @@ -33,11 +31,7 @@
<Name value="Harmony" />
<DLLName value="$moduleid$.dll" />
<SubModuleClassType value="$moduleid$.SubModule" />
<!-- For compatibility with Legacy versions-->
<Tags>
<Tag key="DedicatedServerType" value="none" />
<Tag key="IsNoRenderModeElement" value="false" />
</Tags>
<Tags/>
</SubModule>
</SubModules>
</Module>
</Module>

0 comments on commit 2c3c988

Please sign in to comment.