-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathPlugin.cs
More file actions
146 lines (128 loc) · 5.72 KB
/
Copy pathPlugin.cs
File metadata and controls
146 lines (128 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
using System;
using System.Diagnostics;
using System.Reflection;
using SPT.Reflection.Patching;
using BackdoorBandit.Patches;
using BepInEx;
using BepInEx.Configuration;
using EFT;
using UnityEngine;
using VersionChecker;
namespace DoorBreach
{
[BepInPlugin("com.dvize.BackdoorBandit", "dvize.BackdoorBandit", "1.9.0")]
//[BepInDependency("com.spt-aki.core", "3.7.6")]
public class DoorBreachPlugin : BaseUnityPlugin
{
public static ConfigEntry<bool> PlebMode;
public static ConfigEntry<bool> SemiPlebMode;
public static ConfigEntry<bool> BreachingRoundsOpenMetalDoors;
public static ConfigEntry<bool> OpenLootableContainers;
public static ConfigEntry<bool> OpenCarDoors;
public static ConfigEntry<int> MinHitPoints;
public static ConfigEntry<int> MaxHitPoints;
public static ConfigEntry<int> explosiveTimerInSec;
public static ConfigEntry<bool> explosionDoesDamage;
public static ConfigEntry<int> explosionRadius;
public static ConfigEntry<int> explosionDamage;
public static int interactiveLayer;
private void Awake()
{
PlebMode = Config.Bind(
"1. Main Settings",
"Plebmode",
false,
new ConfigDescription("Enabled Means No Requirements To Breach Any Door/LootContainer",
null,
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 5 }));
SemiPlebMode = Config.Bind(
"1. Main Settings",
"Semi-Plebmode",
false,
new ConfigDescription("Enabled Means Any Round Breach Regular Doors, Not Reinforced doors",
null,
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 4 }));
BreachingRoundsOpenMetalDoors = Config.Bind(
"1. Main Settings",
"Breach Rounds Affects Metal Doors",
false,
new ConfigDescription("Enabled Means Any Breach Round opens a door",
null,
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 3 }));
OpenLootableContainers = Config.Bind(
"1. Main Settings",
"Breach Lootable Containers",
false,
new ConfigDescription("If enabled, can use shotgun breach rounds on safes",
null,
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
OpenCarDoors = Config.Bind(
"1. Main Settings",
"Breach Car Doors",
false,
new ConfigDescription("If Enabled, can use shotgun breach rounds on car doors",
null,
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 1 }));
MinHitPoints = Config.Bind(
"2. Hit Points",
"Min Hit Points",
100,
new ConfigDescription("Minimum Hit Points Required To Breach, Default 100",
new AcceptableValueRange<int>(0, 1000),
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
MaxHitPoints = Config.Bind(
"2. Hit Points",
"Max Hit Points",
200,
new ConfigDescription("Maximum Hit Points Required To Breach, Default 200",
new AcceptableValueRange<int>(0, 2000),
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 1 }));
explosiveTimerInSec = Config.Bind(
"3. Explosive",
"Explosive Timer In Sec",
10,
new ConfigDescription("Time in seconds for explosive breach to detonate",
new AcceptableValueRange<int>(1, 60),
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 4 }));
explosionDoesDamage = Config.Bind(
"3. Explosive",
"Enable Explosive Damage",
false,
new ConfigDescription("Enable damage from the explosive",
null,
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 3 }));
explosionRadius = Config.Bind(
"3. Explosive",
"Explosion Radius",
5,
new ConfigDescription("Sets the radius for the explosion",
new AcceptableValueRange<int>(0, 200),
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 2 }));
explosionDamage = Config.Bind(
"3. Explosive",
"Explosion Damage",
80,
new ConfigDescription("Amount of HP Damage the Explosion Causes",
new AcceptableValueRange<int>(0, 500),
new ConfigurationManagerAttributes { IsAdvanced = false, Order = 1 }));
new NewGamePatch().Enable();
new BackdoorBandit.ApplyHit().Enable();
new ActionMenuDoorPatch().Enable();
new ActionMenuKeyCardPatch().Enable();
new PerfectCullingNullRefPatch().Enable();
}
}
//re-initializes each new game
internal class NewGamePatch : ModulePatch
{
protected override MethodBase GetTargetMethod() => typeof(GameWorld).GetMethod(nameof(GameWorld.OnGameStarted));
[PatchPrefix]
public static void PatchPrefix()
{
//stolen from drakiaxyz - thanks
DoorBreachPlugin.interactiveLayer = LayerMask.NameToLayer("Interactive");
BackdoorBandit.DoorBreachComponent.Enable();
BackdoorBandit.ExplosiveBreachComponent.Enable();
}
}
}