-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cs
63 lines (58 loc) · 2.23 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
63
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
namespace MoreEducation;
[BepInPlugin(GUID, PluginName, PluginVersion)]
[BepInProcess("Digimon World Next Order.exe")]
public class Plugin : BasePlugin
{
public static ManualLogSource Logger;
internal const string GUID = "MoreEducation";
internal const string PluginName = "MoreEducation";
internal const string PluginVersion = "1.0.0";
public static ConfigEntry<float> extraTime;
public static float worldTimeTracker;
public static bool worldTimeTrackerFlag = false;
public override void Load()
{
extraTime = Config.Bind("#Education", "ExtraTimeUntilEducation", 120f, "How many extra in-game minutes until an education action is forcibly triggered, if education is no longer on the 2 hour cooldown (meaning education will be forced every 2 hours + the minutes set here).");
Logger = Log;
Harmony.CreateAndPatchAll(typeof(Plugin));
}
[HarmonyPatch(typeof(PlayerCtrl), "Walking")]
[HarmonyPostfix]
public static void Process_PostFix()
{
MainGameManager mainGameManager = MainGameManager.m_instance;
PartnerCtrl partnerCtrl1 = mainGameManager.m_PartnerCtrls[0];
float educationTime = StorageData.m_playerData.m_educationTime;
float worldDay = StorageData.m_worldData.m_totalDay;
float worldTime = StorageData.m_worldData.m_time;
float worldTimeMinutes = worldDay * 1440 + worldTime;
if (educationTime <= 0f)
{
if (extraTime.Value > 0f)
{
if (!worldTimeTrackerFlag)
{
worldTimeTracker = worldTimeMinutes;
worldTimeTrackerFlag = true;
}
else
{
if (worldTimeMinutes > worldTimeTracker + extraTime.Value)
{
worldTimeTrackerFlag = false;
partnerCtrl1.m_EmotionIdx = 101;
}
}
}
else
{
partnerCtrl1.m_EmotionIdx = 101;
}
}
}
}