75 lines
2.6 KiB
C#
75 lines
2.6 KiB
C#
|
|
namespace Harmony.AIDirectorBloodMoonComponentPatches
|
|
{
|
|
[HarmonyPatch(typeof(AIDirectorBloodMoonComponent))]
|
|
[HarmonyPatch("CalcNextDay")]
|
|
public class CalcNextDayPatch
|
|
{
|
|
public static bool Prefix(AIDirectorBloodMoonComponent __instance, bool isSeek = false)
|
|
{
|
|
//Log.Out("AIDirectorBloodMoonComponentPatches-CalcNextDay START");
|
|
if (RebirthVariables.skipHordeNight)
|
|
{
|
|
//Log.Out("AIDirectorBloodMoonComponentPatches-CalcNextDay SKIP HORDE NIGHT");
|
|
__instance.SetDay(0);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(AIDirectorBloodMoonComponent))]
|
|
[HarmonyPatch("StartBloodMoon")]
|
|
public class StartBloodMoonPatch
|
|
{
|
|
public static void Postfix()
|
|
{
|
|
RebirthVariables.isHordeNight = true;
|
|
RebirthVariables.wasHordeNight = true;
|
|
RebirthUtilities.setHordeNightActiveValue(RebirthVariables.isHordeNight);
|
|
RebirthVariables.localConstants["$varFuriousRamsayHNKills_Cst"] = 0;
|
|
RebirthVariables.localConstants["$varFuriousRamsayHNHeadShots_Cst"] = 0;
|
|
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
|
{
|
|
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageResetHNStats>().Setup());
|
|
}
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(AIDirectorBloodMoonComponent))]
|
|
[HarmonyPatch("EndBloodMoon")]
|
|
public class EndBloodMoonPatch
|
|
{
|
|
public static void Postfix()
|
|
{
|
|
RebirthVariables.isHordeNight = false;
|
|
RebirthUtilities.setHordeNightActiveValue(RebirthVariables.isHordeNight);
|
|
|
|
RebirthVariables.forceHerd = true;
|
|
|
|
bool runHerd = false;
|
|
|
|
if (RebirthVariables.customWanderingHordeHerdHN == "100")
|
|
{
|
|
runHerd = true;
|
|
}
|
|
else
|
|
{
|
|
GameRandom gameRandom = GameManager.Instance.World.GetGameRandom();
|
|
int random = gameRandom.RandomRange(1, RebirthVariables.maxWanderingHordeFrequency + 1);
|
|
|
|
if (random <= int.Parse(RebirthVariables.customWanderingHordeHerdHN))
|
|
{
|
|
runHerd = true;
|
|
}
|
|
}
|
|
|
|
if (runHerd)
|
|
{
|
|
GameManager.Instance.World.aiDirector.GetComponent<AIDirectorWanderingHordeComponent>().StartSpawning(AIWanderingHordeSpawner.SpawnType.Horde);
|
|
}
|
|
}
|
|
}
|
|
}
|