Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions SubModule.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Module>
<Name value="PostMortemPossession"/>
<Id value="PostMortemPossession"/>
<Version value="v1.5.10"/>
<Version value="v1.0.3.9055"/>
<SingleplayerModule value="true"/>
<MultiplayerModule value="false"/>
<DependedModules>
<DependedModule Id="Native"/>
<DependedModule Id="SandBoxCore"/>
<DependedModule Id="Sandbox"/>
<DependedModule Id="CustomBattle"/>
<DependedModule Id="StoryMode" />
<DependedModule Id="Native" DependentVersion="v1.0.3.9055"/>
<DependedModule Id="SandBoxCore" DependentVersion="v1.0.3.9055"/>
<DependedModule Id="Sandbox" DependentVersion="v1.0.3.9055"/>
<DependedModule Id="CustomBattle" DependentVersion="v1.0.3.9055"/>
<DependedModule Id="StoryMode" DependentVersion="v1.0.3.9055" />
</DependedModules>
<SubModules>
<SubModule>
Expand Down
34 changes: 17 additions & 17 deletions source/PostMortemPossession/PostMortemPossession.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;
using System.Linq;
using System.IO;
using Newtonsoft.Json.Linq;
using TaleWorlds.Core;
using TaleWorlds.InputSystem;
using TaleWorlds.Library;
using TaleWorlds.MountAndBlade;
using TaleWorlds.MountAndBlade.View.Missions;
using TaleWorlds.MountAndBlade.ViewModelCollection;
using TaleWorlds.MountAndBlade.View.MissionViews;
using SandBox.ViewModelCollection;
using Newtonsoft.Json.Linq;

namespace PostMortemPossession
{
Expand Down Expand Up @@ -54,13 +54,13 @@ protected override void OnSubModuleLoad()
var manualControlHotkeyString = (string)jobject.Property("hotKey").Value;
if (!String.IsNullOrEmpty(manualControlHotkeyString))
{
if (Enum.TryParse(manualControlHotkeyString, out InputKey tempKey))
if (Enum.TryParse(manualControlHotkeyString, out InputKey tempKey))
{
_manualControlHotkey = tempKey;
}
else
{
_upstartErrors += $"Could not read 'hotKey'. Value '{ manualControlHotkeyString }'{ Environment.NewLine }Using default key 'O' instead" + Environment.NewLine;
_upstartErrors += $"Could not read 'hotKey'. Value '{manualControlHotkeyString}'{Environment.NewLine}Using default key 'O' instead" + Environment.NewLine;
_manualControlHotkey = InputKey.O;
}
}
Expand All @@ -73,7 +73,7 @@ protected override void OnSubModuleLoad()
}
else
{
_upstartErrors += $"Could not read 'autoSelectPriorityHotKey'. Value '{ autoSelectPriorityHotKeyString }'{ Environment.NewLine }Using default key 'U' instead" + Environment.NewLine;
_upstartErrors += $"Could not read 'autoSelectPriorityHotKey'. Value '{autoSelectPriorityHotKeyString}'{Environment.NewLine}Using default key 'U' instead" + Environment.NewLine;
_autoControlHotkey = InputKey.U;
}
}
Expand Down Expand Up @@ -101,12 +101,12 @@ protected override void OnSubModuleLoad()
}
catch (Exception e)
{
_upstartErrors += $"Unable to read content of options file: '{ e.Message }'" + Environment.NewLine;
_upstartErrors += $"Unable to read content of options file: '{e.Message}'" + Environment.NewLine;
}
}
else
{
_upstartErrors += $"PostMortemPossession: Unable to open (or find) options file: { optionsFile }" + Environment.NewLine;
_upstartErrors += $"PostMortemPossession: Unable to open (or find) options file: {optionsFile}" + Environment.NewLine;
}
}

Expand Down Expand Up @@ -153,7 +153,7 @@ protected override void OnApplicationTick(float dt)
}
catch (Exception e)
{
PrintException($"PostMortemPossession: An exception was thrown: '{ e.Message }'");
PrintException($"PostMortemPossession: An exception was thrown: '{e.Message}'");
}
}

Expand All @@ -178,12 +178,12 @@ protected void ManualControl()
TakeControlOfFriendlyAgent(lastFollowedAgent);
}
else
PrintInformation($"You can't take control of ally '{ lastFollowedAgent.Name }'");
PrintInformation($"You can't take control of ally '{lastFollowedAgent.Name}'");
}
else if (lastFollowedAgent.Team.IsEnemyOf(_playerTeam))
{
// inform player that they can't take control of enemy soldiers
PrintInformation($"You can't take control of enemy '{ lastFollowedAgent.Name }'");
PrintInformation($"You can't take control of enemy '{lastFollowedAgent.Name}'");
}
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ protected void AutomaticControl()
if (nextAgent != null)
{
TakeControlOfFriendlyAgent(nextAgent);
PrintInformation($"Soldier found in group { priorityUnitCategory }");
PrintInformation($"Soldier found in group {priorityUnitCategory}");
return;
}
}
Expand All @@ -239,7 +239,7 @@ protected void TakeControlOfFriendlyAgent(Agent pAgent)
{
if (pAgent != null)
{
PrintInformation($"You are now controlling '{ pAgent.Name }'");
PrintInformation($"You are now controlling '{pAgent.Name}'");
if (_allowControlFormations)
TakeControlOfPlayersFormations(pAgent);
pAgent.Controller = Agent.ControllerType.Player;
Expand All @@ -250,7 +250,7 @@ protected void TakeControlOfFriendlyAgent(Agent pAgent)
_mission.SetFastForwardingFromUI(false);

var battleObserverMissionLogic = _mission.GetMissionBehavior<BattleObserverMissionLogic>();
if (battleObserverMissionLogic?.BattleObserver is ScoreboardVM scoreBoard)
if (battleObserverMissionLogic?.BattleObserver is SPScoreboardVM scoreBoard)
{
// do not display the "you are dead" message at the bottom of the screen
scoreBoard.IsMainCharacterDead = false;
Expand All @@ -275,21 +275,21 @@ protected void PrintInformation(string pMessage)
{
var color = _messageColor != null ? _messageColor.Value : new Color(128, 128, 128);
if (_verbose && !String.IsNullOrEmpty(pMessage))
InformationManager.DisplayMessage(new InformationMessage($"PostMortemPossession: { pMessage }", color));
InformationManager.DisplayMessage(new InformationMessage($"PostMortemPossession: {pMessage}", color));
}

protected void PrintError(string pMessage)
{
var color = _errorColor != null ? _errorColor.Value : new Color(128, 0, 0);
if (_verbose && !String.IsNullOrEmpty(pMessage))
InformationManager.DisplayMessage(new InformationMessage($"PostMortemPossession: { pMessage }", color));
InformationManager.DisplayMessage(new InformationMessage($"PostMortemPossession: {pMessage}", color));
}

protected void PrintException(string pMessage)
{
var color = _errorColor != null ? _errorColor.Value : new Color(128, 0, 0);
if (!_muteExceptions && !String.IsNullOrEmpty(pMessage))
InformationManager.DisplayMessage(new InformationMessage($"PostMortemPossession: { pMessage }", color));
InformationManager.DisplayMessage(new InformationMessage($"PostMortemPossession: {pMessage}", color));
}

#endregion
Expand Down
48 changes: 25 additions & 23 deletions source/PostMortemPossession/PostMortemPossession.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>E:\SteamLibrary\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\PostMortemPossession\bin\Win64_Shipping_Client\</OutputPath>
<OutputPath>..\..\bin\Win64_Shipping_Client\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -34,35 +34,37 @@
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="TaleWorlds.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\Win64_Shipping_Client\TaleWorlds.Core.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.DotNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="TaleWorlds.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="TaleWorlds.InputSystem, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<Reference Include="SandBox.ViewModelCollection, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\Win64_Shipping_Client\TaleWorlds.InputSystem.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\SandBox\bin\Win64_Shipping_Client\SandBox.ViewModelCollection.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.Library, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\Win64_Shipping_Client\TaleWorlds.Library.dll</HintPath>
<Reference Include="TaleWorlds.Core">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.Core.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.dll</HintPath>
<Reference Include="TaleWorlds.DotNet">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.DotNet.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade.View, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Native\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.View.dll</HintPath>
<Reference Include="TaleWorlds.Engine">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.Engine.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade.ViewModelCollection, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.ViewModelCollection.dll</HintPath>
<Reference Include="TaleWorlds.InputSystem">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.InputSystem.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.Library">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.Library.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade.View">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\Modules\Native\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.View.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade.ViewModelCollection">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.ViewModelCollection.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions source/PostMortemPossession/app.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
2 changes: 1 addition & 1 deletion source/PostMortemPossession/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net472" />
</packages>