-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cs
57 lines (47 loc) · 1.68 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
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Bloodstone.API;
using Bloody.Core;
using Bloody.Core.API.v1;
using CrimsonQuest.Structs;
using CrimsonQuest.Utils;
using HarmonyLib;
using VampireCommandFramework;
namespace CrimsonQuest;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInDependency("gg.deca.VampireCommandFramework")]
[BepInDependency("gg.deca.Bloodstone")]
[Bloodstone.API.Reloadable]
public class Plugin : BasePlugin, IRunOnInitialized
{
private Harmony _harmony;
public static ManualLogSource LogInstance { get; private set; }
public static Settings Settings { get; private set; }
public static SystemsCore SystemsCore { get; private set; }
public override void Load()
{
LogInstance = Log;
Settings = new(Config);
Settings.InitConfig();
if (!VWorld.IsServer) Log.LogWarning("This plugin is a server-only plugin.");
CommandRegistry.RegisterAll();
}
public void OnGameInitialized()
{
if (VWorld.IsClient) return;
_harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
_harmony.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
CrimsonCore.InitializeAfterLoaded();
SystemsCore = Core.SystemsCore;
EventsHandlerSystem.OnDeathVBlood += CrimsonCore.Quest.UpdateVBloodQuestProgress;
EventsHandlerSystem.OnDeath += CrimsonCore.Quest.UpdatePVPKillQuestProgress;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
public override bool Unload()
{
CommandRegistry.UnregisterAssembly();
_harmony?.UnpatchSelf();
return true;
}
}