-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.3.32825.248 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMount", "AutoMount\AutoMount.csproj", "{F3501134-B86C-49F5-9779-D700E83FAF1F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F3501134-B86C-49F5-9779-D700E83FAF1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F3501134-B86C-49F5-9779-D700E83FAF1F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F3501134-B86C-49F5-9779-D700E83FAF1F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F3501134-B86C-49F5-9779-D700E83FAF1F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {C53C5852-A5EC-49E2-9C37-51CFBF435D00} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net472</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
<PackageOutputPath>$(OutputPath)</PackageOutputPath> | ||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
<LangVersion>preview</LangVersion> | ||
<RunPostBuildEvent>Always</RunPostBuildEvent> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AssemblyPublicizer" Version="1.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="0Harmony"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityModManager\0Harmony.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>$(SolutionDir)lib\Assembly-CSharp_public.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp-firstpass"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Owlcat.Runtime.UI"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\Owlcat.Runtime.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.CoreModule.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="UnityEngine.IMGUIModule"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="UnityEngine.TextRenderingModule"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityModManager"> | ||
<HintPath>$(WrathPath)\Wrath_Data\Managed\UnityModManager\UnityModManager.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="Properties\Resources.Designer.cs"> | ||
<DesignTime>True</DesignTime> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Update="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Info.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<Exec Command="start XCOPY /Y /R "$(TargetDir)\$(TargetName).*" "$(WrathPath)\Mods\$(ProjectName)\"
start XCOPY /Y /R "$(ProjectDir)\Info.json" "$(WrathPath)\Mods\$(ProjectName)\"" /> | ||
</Target> | ||
|
||
<Target Name="Publicize" AfterTargets="Clean"> | ||
<ItemGroup> | ||
<Assemblies Include="$(WrathPath)\Wrath_Data\Managed\Assembly-CSharp.dll" /> | ||
</ItemGroup> | ||
|
||
<PublicizeTask InputAssemblies="@(Assemblies)" OutputDir="$(SolutionDir)lib/" /> | ||
</Target> | ||
|
||
<ProjectExtensions><VisualStudio><UserProperties info_1json__JsonSchema="https://json.schemastore.org/global.json" /></VisualStudio></ProjectExtensions> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"Id": "AutoMount", | ||
"DisplayName": "Auto Mount", | ||
"Author": "zepheon", | ||
"Version": "0.0.1", | ||
"ManagerVersion": "0.24.5.0", | ||
"GameVersion": "1.4.2", | ||
"Requirements": [], | ||
"AssemblyName": "AutoMount.dll", | ||
"EntryMethod": "AutoMount.Main.Load", | ||
"Repository": "https://raw.githubusercontent.com/zephe0n/AutoMount/main/AutoMount/Repository.json", | ||
"HomePage": "https://github.com/zephe0n/AutoMount" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using HarmonyLib; | ||
using UnityModManagerNet; | ||
using System.Reflection; | ||
using static UnityModManagerNet.UnityModManager.ModEntry; | ||
using Kingmaker.PubSubSystem; | ||
using Kingmaker.EntitySystem.Entities; | ||
using Kingmaker; | ||
using Kingmaker.UnitLogic.Parts; | ||
|
||
namespace AutoMount | ||
{ | ||
#if DEBUG | ||
[EnableReloading] | ||
#endif | ||
public static class Main | ||
{ | ||
public static Settings Settings; | ||
public static bool Enabled; | ||
public static ModLogger Logger; | ||
|
||
private static Harmony m_harmony; | ||
private static Guid m_mount_ability_guid = new Guid("d340d820867cf9741903c9be9aed1ccc"); | ||
|
||
public static bool Load(UnityModManager.ModEntry modEntry) | ||
{ | ||
Logger = modEntry.Logger; | ||
Settings = Settings.Load<Settings>(modEntry); | ||
modEntry.OnToggle = OnToggle; | ||
modEntry.OnGUI = OnGUI; | ||
modEntry.OnSaveGUI = OnSaveGUI; | ||
modEntry.OnUpdate = OnUpdate; | ||
#if DEBUG | ||
modEntry.OnUnload = Unload; | ||
#endif | ||
m_harmony = new Harmony(modEntry.Info.Id); | ||
m_harmony.PatchAll(Assembly.GetExecutingAssembly()); | ||
return true; | ||
} | ||
|
||
static bool OnToggle(UnityModManager.ModEntry modEntry, bool value) | ||
{ | ||
Enabled = value; | ||
return true; | ||
} | ||
|
||
#if DEBUG | ||
static bool Unload(UnityModManager.ModEntry modEntry) | ||
{ | ||
m_harmony.UnpatchAll(); | ||
return true; | ||
} | ||
#endif | ||
|
||
static void OnGUI(UnityModManager.ModEntry modEntry) | ||
{ | ||
Settings.Draw(); | ||
} | ||
|
||
static void OnSaveGUI(UnityModManager.ModEntry modEntry) | ||
{ | ||
Settings.Save(modEntry); | ||
} | ||
|
||
static void OnUpdate(UnityModManager.ModEntry modEntry, float delta) | ||
{ | ||
if (Settings.AutoMountHotKey.Up()) | ||
{ | ||
Mount(); | ||
} | ||
} | ||
|
||
static void Mount() | ||
{ | ||
foreach (var rider in Game.Instance.Player.Party) | ||
{ | ||
var pet = rider.GetPet(Kingmaker.Enums.PetType.AnimalCompanion); | ||
|
||
if (pet != null && (rider.State.Size < pet.State.Size)) | ||
{ | ||
var mount = rider.ActivatableAbilities.Enumerable.Find(a => a.Blueprint.AssetGuid.CompareTo(m_mount_ability_guid) == 0); | ||
|
||
if (mount != null) | ||
{ | ||
if (mount.IsOn) | ||
{ | ||
#if DEBUG | ||
Logger.Log(rider.CharacterName + " -> " + pet.CharacterName + " OFF"); | ||
#endif | ||
rider.RiderPart?.Dismount(); | ||
} | ||
else | ||
{ | ||
#if DEBUG | ||
Logger.Log(rider.CharacterName + " -> " + pet.CharacterName + " ON"); | ||
#endif | ||
rider.Ensure<UnitPartRider>().Mount(pet); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# About | ||
|
||
Mount all your pets automatically with a customizable keybind. By default: **Ctrl + Shift + A**. | ||
|
||
## How it works | ||
|
||
It detects which characters in your active party have pets and are able to mount them and just mounts/dismount it on keybind detection. This means that it actually **toggles** the mounted state. Maybe in future updates it may take into account a global desired mounted state and apply it to all elegible characters. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Releases": [ | ||
{ | ||
"Id": "AutoMount", | ||
"Version": "0.0.1" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using AutoMount; | ||
using UnityEngine; | ||
using UnityModManagerNet; | ||
|
||
namespace AutoMount | ||
{ | ||
public class Settings : UnityModManager.ModSettings | ||
{ | ||
public KeyBinding AutoMountHotKey = new() { keyCode = KeyCode.A, modifiers = 1 | 2 }; // ctrl+shift+A | ||
|
||
public override void Save(UnityModManager.ModEntry modEntry) | ||
{ | ||
Save(this, modEntry); | ||
} | ||
|
||
public static void Draw() | ||
{ | ||
GUILayout.Space(10); | ||
|
||
GUILayout.BeginHorizontal(GUILayout.Width(300)); | ||
GUILayout.Label("Hotkey"); | ||
UnityModManager.UI.DrawKeybinding(ref Main.Settings.AutoMountHotKey, "Hotkey"); | ||
GUILayout.EndHorizontal(); | ||
|
||
GUILayout.Space(10); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
EFB3C8766100E246CD10F62589AC3DA62FF51CD6 |