Update to 3.10 plus additional fixes and new feature. #1

Open
CathieNova wants to merge 3 commits from (deleted):master into master
5 changed files with 87 additions and 31 deletions

View File

@ -11,6 +11,6 @@ A BepInEx plugin for SPT-AKI that allows you to skip quests in-game.
### How to build from source
1. Download/clone this repository
2. Open your current SPT directory and copy all files from `\EscapeFromTarkov_Data\Managed` into this solution's `\References\EFT_Managed` folder.
2. In the `Terkoiz.Skipper.csproj` under `PathToSPT` Change `D:\SP-AKI\Server-3.10-DEVELOPMENT` to your SPT folder.
3. Rebuild the project in the Release configuration.
4. Grab the `Terkoiz.Skipper.dll` file from the `bin/Release` folder and use it wherever. Refer to the "How to install" section if you need help here.
4. The `Terkoiz.Skipper.dll` will now be in your `\BepInEx\plugins` folder.

View File

@ -1,11 +1,11 @@
using System.Linq;
using System.Reflection;
using Aki.Reflection.Patching;
using EFT;
using EFT.Quests;
using EFT.UI;
using HarmonyLib;
using JetBrains.Annotations;
using SPT.Reflection.Patching;
using UnityEngine;
namespace Terkoiz.Skipper
@ -53,15 +53,15 @@ namespace Terkoiz.Skipper
var skipButton = Object.Instantiate(____handoverButton, ____handoverButton.transform.parent.transform);
skipButton.SetRawText("SKIP", 22);
skipButton.SetRawText("SKIP OBJECTIVE", 22);
skipButton.gameObject.name = SkipperPlugin.SkipButtonName;
skipButton.gameObject.GetComponent<UnityEngine.UI.LayoutElement>().minWidth = 100f;
skipButton.gameObject.SetActive(SkipperPlugin.AlwaysDisplay.Value && !quest.IsConditionDone(condition));
skipButton.OnClick.RemoveAllListeners();
skipButton.OnClick.AddListener(() => ItemUiContext.Instance.ShowMessageWindow(
description: "Are you sure you want to autocomplete this quest objective?",
acceptAction: () =>
if (SkipperPlugin.SkipConfirmation.Value)
{
skipButton.OnClick.AddListener(() =>
{
if (quest.IsConditionDone(condition))
{
@ -79,9 +79,34 @@ namespace Terkoiz.Skipper
AccessTools.DeclaredMethod(conditionController.GetType().BaseType, "SetConditionCurrentValue").Invoke(conditionController, new object[] { quest, EQuestStatus.AvailableForFinish, condition, condition.value, true });
skipButton.gameObject.SetActive(false);
},
cancelAction: () => {},
caption: "Confirmation"));
});
}
else
{
skipButton.OnClick.AddListener(() => ItemUiContext.Instance.ShowMessageWindow(
description: "Are you sure you want to complete this quest objective?",
acceptAction: () =>
{
if (quest.IsConditionDone(condition))
{
skipButton.gameObject.SetActive(false);
return;
}
SkipperPlugin.Logger.LogDebug($"Setting condition {condition.id} value to {condition.value}");
// This line will force any condition checker to pass, as the 'condition.value' field contains the "goal" of any quest condition
quest.ProgressCheckers[condition].SetCurrentValueGetter(_ => condition.value);
// We call 'SetConditionCurrentValue' to trigger all the code needed to make the condition completion appear visually in-game
var conditionController = AccessTools.Field(questController.GetType(), $"{UnderlyingQuestControllerClassName.ToLowerInvariant()}_0").GetValue(questController);
AccessTools.DeclaredMethod(conditionController.GetType().BaseType, "SetConditionCurrentValue").Invoke(conditionController, new object[] { quest, EQuestStatus.AvailableForFinish, condition, condition.value, true });
skipButton.gameObject.SetActive(false);
},
cancelAction: () => {},
caption: "Confirmation"));
}
}
}
}

View File

@ -17,6 +17,7 @@ namespace Terkoiz.Skipper
private const string MainSectionName = "Main";
internal static ConfigEntry<bool> ModEnabled;
internal static ConfigEntry<bool> AlwaysDisplay;
internal static ConfigEntry<bool> SkipConfirmation;
internal static ConfigEntry<KeyboardShortcut> DisplayHotkey;
[UsedImplicitly]
@ -47,6 +48,12 @@ namespace Terkoiz.Skipper
"3. Display hotkey",
new KeyboardShortcut(KeyCode.LeftControl),
"Holding down this key will make the Skip buttons appear.");
SkipConfirmation = Config.Bind(
MainSectionName,
"4. Skip confirmation",
true,
"If disabled, a confirmation dialog will appear when you press the Skip button.");
}
[UsedImplicitly]
@ -54,6 +61,11 @@ namespace Terkoiz.Skipper
{
if (!ModEnabled.Value || AlwaysDisplay.Value)
{
if (AlwaysDisplay.Value && QuestObjectiveViewPatch.LastSeenObjectivesBlock != null && !QuestObjectiveViewPatch.LastSeenObjectivesBlock.activeSelf)
{
ChangeButtonVisibility(true);
}
return;
}

View File

@ -12,47 +12,66 @@
</PackageReference>
</ItemGroup>
<PropertyGroup>
<PathToSPT>D:\SP-AKI\Server-3.10-DEVELOPMENT</PathToSPT>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aki.Reflection">
<HintPath>..\References\EFT_Managed\Aki.Reflection.dll</HintPath>
<Private>False</Private>
<Reference Include="bsg.console.core">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\bsg.console.core.dll</HintPath>
</Reference>
<Reference Include="spt-common">
<HintPath>$(PathToSPT)\BepInEx\plugins\spt\spt-common.dll</HintPath>
</Reference>
<Reference Include="spt-reflection">
<HintPath>$(PathToSPT)\BepInEx\plugins\spt\spt-reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\References\EFT_Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Comfort">
<HintPath>..\References\EFT_Managed\Comfort.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
</Reference>
<Reference Include="Comfort.Unity">
<HintPath>..\References\EFT_Managed\Comfort.Unity.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.Unity.dll</HintPath>
</Reference>
<Reference Include="ItemComponent.Types">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization">
<HintPath>..\References\EFT_Managed\Sirenix.Serialization.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Sirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>..\References\EFT_Managed\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\References\EFT_Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\References\EFT_Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>..\References\EFT_Managed\UnityEngine.InputLegacyModule.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\References\EFT_Managed\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec
Command='if $(ConfigurationName) == Debug (
xcopy /F /Y "$(TargetPath)" "$(PathToSPT)\BepInEx\plugins\"
)' />
</Target>
</Project>