Skip to content

Commit b31d45c

Browse files
authored
Merge pull request #1 from SleepingPills/main
Update to 3.11
2 parents 2cc45c8 + 34acdab commit b31d45c

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

SkeletonKey/KeycardDoorPatch.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System.Reflection;
2-
using SPT.Reflection.Patching;
2+
using EFT;
33
using EFT.Interactive;
44
using EFT.InventoryLogic;
5-
using Diz.LanguageExtensions;
6-
using EFT;
5+
using SPT.Reflection.Patching;
76

87
namespace Boogle
98
{
@@ -17,30 +16,32 @@ protected override MethodBase GetTargetMethod()
1716

1817
[PatchPrefix]
1918
private static bool PatchPrefix(
20-
ref GStruct448<GClass3344> __result,
19+
ref GStruct457<GClass3424> __result,
2120
KeyComponent key,
2221
Player player,
2322
KeycardDoor __instance)
2423
{
2524
// Check if the player can interact
26-
Error canInteract = player.MovementContext.CanInteract;
25+
var canInteract = player.MovementContext.CanInteract;
26+
2727
if (canInteract != null)
2828
{
2929
__result = canInteract;
3030
return false;
3131
}
3232

3333
// Dynamically allow the "BoogleSkeletonKeycard"
34-
bool isAuthorized = key.Template.KeyId == __instance.KeyId || key.Template.KeyId == "673e213fc6be39d06423d6b7";
34+
var isAuthorized = key.Template.KeyId == __instance.KeyId || key.Template.KeyId == "673e213fc6be39d06423d6b7";
3535

3636
if (!isAuthorized)
3737
{
38-
__result = new GClass3344(key, null, false);
38+
__result = new GClass3424(key, null, false);
3939
return false;
4040
}
4141

4242
// Simulate usage logic
4343
key.NumberOfUsages++;
44+
4445
if (key.NumberOfUsages >= key.Template.MaximumNumberOfUsage && key.Template.MaximumNumberOfUsage > 0)
4546
{
4647
var discardResult = InteractionsHandlerClass.Discard(
@@ -57,7 +58,7 @@ private static bool PatchPrefix(
5758
}
5859

5960
// Return successful interaction
60-
__result = new GClass3344(key, null, true);
61+
__result = new GClass3424(key, null, true);
6162
return false;
6263
}
6364
}

SkeletonKey/Method0Patch.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@ public class Method0Patch : ModulePatch
1010
protected override MethodBase GetTargetMethod()
1111
{
1212
// Target the method_0 function in Class1544
13-
return typeof(Class1650).GetMethod("method_0", BindingFlags.Public | BindingFlags.Instance);
13+
return typeof(Class1674).GetMethod("method_0", BindingFlags.Public | BindingFlags.Instance);
1414
}
1515

1616
[PatchPrefix]
17-
private static bool PatchPrefix(KeyComponent x, Class1650 __instance, ref bool __result)
17+
private static bool PatchPrefix(KeyComponent x, Class1674 __instance, ref bool __result)
1818
{
1919
// Check if the key has the correct KeyId or is "BoogleSkeletonKey"
20-
if (x.Template.KeyId == __instance.worldInteractiveObject.KeyId || x.Template.KeyId == "673e1f10aaf0fe810c488218")
21-
{
22-
__result = true; // Allow unlock
23-
return false; // Skip the original method
24-
}
20+
if (x.Template.KeyId != __instance.worldInteractiveObject.KeyId && x.Template.KeyId != "673e1f10aaf0fe810c488218") return true;
21+
22+
__result = true; // Allow unlock
23+
return false; // Skip the original method
2524

2625
// Otherwise, let the original logic handle it
27-
return true;
2826
}
2927
}
3028
}

SkeletonKey/Plugin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace Boogle
55
{
6-
[BepInPlugin("com.boogle.skeletonkey", "Adds the Skeleton Key Item", "1.0.3")]
7-
public class skeletonkey : BaseUnityPlugin
6+
[BepInPlugin("com.boogle.skeletonkey", "Adds the Skeleton Key Item", "1.0.4")]
7+
public class SkeletonKey : BaseUnityPlugin
88
{
99
public void Awake()
1010
{

SkeletonKey/UnlockOperationPatch.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System.Reflection;
2-
using SPT.Reflection.Patching;
3-
using EFT.Interactive;
42
using EFT;
3+
using EFT.Interactive;
54
using EFT.InventoryLogic;
6-
using Diz.LanguageExtensions;
5+
using SPT.Reflection.Patching;
76

87
namespace Boogle
98
{
@@ -18,21 +17,24 @@ protected override MethodBase GetTargetMethod()
1817

1918
[PatchPrefix]
2019
private static bool PatchPrefix(
21-
ref GStruct448<GClass3344> __result,
20+
ref GStruct457<GClass3424> __result,
2221
KeyComponent key,
2322
Player player,
2423
WorldInteractiveObject __instance)
2524
{
26-
Error canInteract = player.MovementContext.CanInteract;
25+
var canInteract = player.MovementContext.CanInteract;
26+
2727
if (canInteract != null)
2828
{
2929
__result = canInteract;
3030
}
3131
if (!(key.Template.KeyId == __instance.KeyId || key.Template.KeyId == "673e1f10aaf0fe810c488218"))
3232
{
33-
__result = new GClass3757("Key doesn't match");
33+
__result = new GClass3854("Key doesn't match");
3434
}
35-
GStruct446<GClass3129> gstruct = default(GStruct446<GClass3129>);
35+
36+
var gstruct = default(GStruct455<GClass3200>);
37+
3638
key.NumberOfUsages++;
3739
if (key.NumberOfUsages >= key.Template.MaximumNumberOfUsage && key.Template.MaximumNumberOfUsage > 0)
3840
{
@@ -42,7 +44,7 @@ private static bool PatchPrefix(
4244
__result = gstruct.Error;
4345
}
4446
}
45-
__result = new GClass3344(key, gstruct.Value, true);
47+
__result = new GClass3424(key, gstruct.Value, true);
4648

4749
return false;
4850
}

0 commit comments

Comments
 (0)