-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.cs
62 lines (54 loc) · 1.75 KB
/
Plugin.cs
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
using System.Collections.Generic;
using System.Reflection;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using OnwardAPIVRML.DTOS;
using OnwardAPIVRML.Networking;
using OnwardAPIVRML.Patches;
using HarmonyLib;
namespace OnwardAPIVRML;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
internal static RootDTO RootDTO;
internal new static ManualLogSource Log;
private readonly Server server;
public Plugin() {
server = new Server();
RootDTO = new RootDTO {
Teams = new List<TeamDTO>() {
new TeamDTO() {
Team = Faction.Marsoc,
Stats = new StatsDTO(),
Players = new List<PlayerDTO>(),
},
new TeamDTO() {
Team = Faction.Volk,
Stats = new StatsDTO(),
Players = new List<PlayerDTO>()
}
},
LastKill = new LastKillDTO() {
Killer = new KillerDTO(),
Victim = new VictimDTO()
},
};
}
public override void Load()
{
Log = base.Log;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded successfully!");
server.CreateAndStartServer();
Harmony.CreateAndPatchAll(typeof(GamePatch));
Harmony.CreateAndPatchAll(typeof(PlayerPatch));
// Affichage de toutes les méthodes qu'on a patché
foreach (MethodBase method in Harmony.GetAllPatchedMethods()) {
Log.LogInfo($"Hook: {method.Name}");
}
}
public override bool Unload() {
server.CloseServer();
return false;
}
}