Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Harmony/Harmony_EntityPlayerLocal.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

2273 lines
141 KiB
C#

using Audio;
using Microsoft.SqlServer.Server;
using System.Collections.Generic;
namespace Harmony.EntityPlayerLocalPatches
{
[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("SetupStartingItems")]
public class SetupStartingItemsPatch
{
private static bool Prefix(EntityPlayerLocal __instance)
{
__instance.inventory.Clear();
__instance.bag.Clear();
return false;
}
}
[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("MoveByInput")]
public class MoveByInputPatch
{
private static void Postfix(EntityPlayerLocal __instance)
{
if (__instance.MovementRunning)
{
if (__instance.MovementState != 3)
{
//Log.Out("EntityPlayerLocalPatches-MoveByInput PLAYER IS NOT RUNNING NORMALLY");
__instance.CurrentMovementTag = EntityAlive.MovementTagIdle;
}
/*else
{
Log.Out("EntityPlayerLocalPatches-MoveByInput PLAYER IS RUNNING");
}*/
}
}
}
[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("DamageEntity")]
public class DamageEntityPatch
{
private static bool Prefix(EntityPlayerLocal __instance, ref int __result, DamageSource _damageSource, int _strength, bool _criticalHit, float impulseScale)
{
if (_damageSource.AttackingItem != null && _damageSource.AttackingItem.ItemClass != null && _damageSource.AttackingItem.ItemClass.GetItemName().ToLower().Contains("wraith"))
{
Entity sourceEntity = __instance.world.GetEntity(_damageSource.getEntityId());
if (sourceEntity is EntityWraith wraith)
{
//Log.Out("EntityPlayerLocalPatches-DamageEntity REMOVE SHIELD");
/*var parent = wraith.gameObject.transform.parent;
if (parent != null)
{
Component[] componentsInChildren = wraith.GetComponentsInChildren<Component>();
Log.Out($"Parent: {parent.name} [" + wraith.EntityClass.entityClassName + "]" + " / particles: " + componentsInChildren.Length);
for (int i = 0; i < componentsInChildren.Length; i++)
{
var c = componentsInChildren[i];
Log.Out($" C: {c} - Layer: {c.gameObject.layer} - Tag: {c.tag} - Active: {c.gameObject.activeSelf} - Position: {c.gameObject.transform.position}");
if (c.name.StartsWith("Ptl_") || c.name.StartsWith("tempPrefab_"))
{
//Log.Out("RebirthUtilities-RemoveCommonParticles HAS PREFAB: " + c.name);
//entity.RemoveParticle(c.name);
UnityEngine.Object.Destroy(c.gameObject);
}
}
}*/
//wraith.Buffs.AddBuff("FuriousRamsayWraithProtection");
//wraith.Buffs.SetCustomVar("$FuriousRamsayAttacked", 0f);
}
}
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
//Log.Out("EntityPlayerLocalPatches-DamageEntity flag: " + flag);
if (flag && _damageSource.AttackingItem != null && _damageSource.AttackingItem.ItemClass != null && _damageSource.AttackingItem.ItemClass.GetItemName() == "otherExplosion")
{
//Log.Out("EntityPlayerLocalPatches-DamageEntity 1");
for (int i = 0; i < __instance.Buffs.ActiveBuffs.Count; i++)
{
//Log.Out("EntityPlayerLocalPatches-DamageEntity i: " + i);
BuffValue buffValue = __instance.Buffs.ActiveBuffs[i];
if (buffValue != null && buffValue.BuffClass != null)
{
//Log.Out("EntityPlayerLocalPatches-DamageEntity 2");
if (buffValue.BuffName.ToLower().Contains("offensiveragebuff") && !buffValue.BuffName.ToLower().Contains("cooldown"))
{
//Log.Out("EntityPlayerLocalPatches-DamageEntity 3");
var dmgSrcEnt = __instance.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
//Log.Out($"HarmonyPatch-EntityPlayerLocal::DamageEntity this: {__instance} - returning 0 damage false. offensiveragebuff, Dmg source: {dmgSrcEnt}");
__result = 0;
return false;
}
}
}
}
//Log.Out("EntityPlayerLocalPatches-DamageEntity 4");
return true;
}
}
/*[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("AfterPlayerRespawn")]
public class AfterPlayerRespawnPatch
{
private static void Postfix(EntityPlayerLocal __instance, RespawnType _type)
{
if (_type == RespawnType.Died)
{
if (__instance.Progression.Level >= 5)
{
int random = UnityEngine.Random.Range(60, 75);
__instance.Stats.Health.Value = __instance.Stats.Health.Max * random / 100;
random = UnityEngine.Random.Range(40, 60);
__instance.Stats.Water.Value = __instance.Stats.Water.Max * random / 100;
random = UnityEngine.Random.Range(40, 60);
__instance.Stats.Food.Value = __instance.Stats.Food.Max * random / 100;
random = UnityEngine.Random.Range(0, 1);
random = UnityEngine.Random.Range(0, 1);
Log.Out("random (Fatigue): " + random);
if (random == 1)
{
__instance.Buffs.AddBuff("triggerFatigued");
}
Log.Out("random (Sprained Arm): " + random);
if (random == 1)
{
__instance.Buffs.AddBuff("triggerSprainedArm");
}
Log.Out("random (Sprained Leg): " + random);
if (random == 1)
{
__instance.Buffs.AddBuff("triggerSprainedLeg");
}
Log.Out("random (Abrasion): " + random);
if (random == 1)
{
__instance.Buffs.AddBuff("triggerAbrasion");
}
Log.Out("random (laceration): " + random);
if (random == 1)
{
__instance.Buffs.AddBuff("triggerLaceration");
}
Log.Out("random (Infection): " + random);
if (random == 1)
{
__instance.Buffs.AddBuff("triggerInfection");
}
}
}
}
}*/
[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("AttachToEntity")]
public class AttachToEntityPatch
{
private static bool Prefix(EntityPlayerLocal __instance, Entity _other, int slot = -1)
{
for (int j = 0; j < __instance.Companions.Count; j++)
{
EntityNPCRebirth entity = __instance.Companions[j] as EntityNPCRebirth;
if (entity != null)
{
//Log.Out("EntityPlayerLocalPatches-AttachToEntity entity: " + entity.EntityName);
if (!entity.IsOnMission() && !(entity.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.Stay))
{
entity.Buffs.SetCustomVar("$traveling", 1f);
entity.HideNPC(true);
}
}
}
return true;
}
}
[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("Detach")]
public class DetachPatch
{
private static void Postfix(EntityPlayerLocal __instance)
{
for (int j = 0; j < __instance.Companions.Count; j++)
{
EntityNPCRebirth entity = __instance.Companions[j] as EntityNPCRebirth;
if (entity != null)
{
if (entity.IsOnMission())
{
entity.HideNPC(false);
entity.Buffs.SetCustomVar("$traveling", 0f);
entity.SetPosition(__instance.position);
}
}
}
}
private static bool Prefix(EntityPlayerLocal __instance)
{
if (__instance.AttachedToEntity)
{
__instance.Buffs.AddBuff("FuriousRamsayDelay-10");
RebirthVariables.autoRun = 0;
if (RebirthVariables.musicMode == 1 && !RebirthVariables.walkman)
{
RebirthVariables.musicMode = 0;
}
if (__instance.AttachedToEntity.HasAnyTags(FastTags<TagGroup.Global>.Parse("flying")))
{
BlockValue block = __instance.world.GetBlock(new Vector3i(__instance.AttachedToEntity.position.x, __instance.AttachedToEntity.position.y - 1, __instance.AttachedToEntity.position.z));
if (block.isair)
{
block = __instance.world.GetBlock(new Vector3i(__instance.AttachedToEntity.position.x, __instance.AttachedToEntity.position.y - 2, __instance.AttachedToEntity.position.z));
if (block.isair)
{
block = __instance.world.GetBlock(new Vector3i(__instance.AttachedToEntity.position.x, __instance.AttachedToEntity.position.y - 3, __instance.AttachedToEntity.position.z));
if (block.isair)
{
block = __instance.world.GetBlock(new Vector3i(__instance.AttachedToEntity.position.x, __instance.AttachedToEntity.position.y - 4, __instance.AttachedToEntity.position.z));
if (block.isair)
{
block = __instance.world.GetBlock(new Vector3i(__instance.AttachedToEntity.position.x, __instance.AttachedToEntity.position.y - 5, __instance.AttachedToEntity.position.z));
if (block.isair)
{
GameManager.ShowTooltip(__instance, Localization.Get("ttGetCloseToGround"), string.Empty, "ui_denied", null);
return false;
}
}
}
}
}
}
if (__instance.AttachedToEntity is global::EntityVehicleRebirth)
{
// UPDATE SERVER INO FOR VEHICLE PART DURABILITY AND OTHER STATS
}
}
return true;
}
}
[HarmonyPatch(typeof(EntityPlayerLocal))]
[HarmonyPatch("OnUpdateLive")]
public class OnUpdateLivePatch
{
public static bool Prefix(EntityPlayerLocal __instance)
{
if (__instance.IsSpawned() && __instance.IsAlive())
{
if (__instance.IsSpectator)
{
//Log.Out("SPECTATOR MODE TURNED ON");
return true;
}
if (!GameStats.GetBool(EnumGameStats.EnemySpawnMode))
{
//Log.Out("ENEMY SPAWNING TURNED OFF");
return true;
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive class level total:" + RebirthUtilities.ClassLevels(__instance));
bool isAttached = false;
if (__instance.AttachedToEntity != null)
{
isAttached = true;
}
float auraTick = 30f;
float variablesTick = 60f;
float biomeTick = 3f;
float forestTick = 50f;
float desertTick = 50f;
float snowTick = 50f;
float wastelandTick = 50f;
float heatMapTick = 1f;
float berserkerTick = 3f;
float companionsTick = 5f;
float hiresTick = 10f;
float craftingTick = 2f;
float walkmanTick = 10f;
float modelLayerTick = 15f;
float gamestageTick = 1.25f;
float scenarioTick = 1f;
float purgeProgressTick = 3f;
if (RebirthUtilities.ScenarioSkip() && ((Time.time - RebirthVariables.randomWeaponUpdateCheck) > RebirthVariables.randomWeaponUpdateTick || !RebirthVariables.randomWeaponInitiated))
{
RebirthVariables.randomWeaponUpdateCheck = Time.time;
RebirthUtilities.RefreshRandomWeapons(__instance);
RebirthVariables.refreshRandomWeapons = true;
}
if (RebirthVariables.purgeDisplay)
{
scenarioTick = 1f;
}
if (RebirthVariables.customScenario == "purge" && (Time.time - RebirthVariables.purgeProgressCheck) > purgeProgressTick)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive __instance.AttachedToEntity: " + __instance.AttachedToEntity);
RebirthVariables.purgeProgressCheck = Time.time;
if (!isAttached && !__instance.IsFlyMode.Value)
{
float numSupplyDrops = __instance.Buffs.GetCustomVar("$numSupplyDrops");
if (numSupplyDrops > 0)
{
if ((SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !GameManager.IsDedicatedServer) || SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
// Reset skipSupplyDrops before calling SpawnAirDrop()
RebirthVariables.skipSupplyDrops = false;
// Spawn the air drop
bool canSpawn = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorAirDropComponent>().SpawnAirDrop();
// Restore skipSupplyDrops to true after the air drop logic
RebirthVariables.skipSupplyDrops = true;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive canSpawn: " + canSpawn);
if (canSpawn)
{
RebirthVariables.playerAirDrops.Add(new Vector3(__instance.position.x, __instance.position.y, __instance.position.z));
numSupplyDrops--;
if (numSupplyDrops < 0)
{
numSupplyDrops = 0;
}
float numTotalSupplyDrops = __instance.Buffs.GetCustomVar("$numTotalSupplyDrops");
if (numTotalSupplyDrops == 0f)
{
if (RebirthUtilities.EnnemiesAround(__instance) > 0)
{
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("FuriousRamsayInfo_Purge3SuppliesUpdate"), __instance, 1, "");
}
else
{
GameEventManager.Current.HandleAction("info_purge_suppliesupdate", __instance, __instance, false, sequenceLink: "");
}
__instance.Buffs.SetCustomVar("FuriousRamsayInfo_Purge3SuppliesUpdate", 1f);
}
numTotalSupplyDrops++;
__instance.Buffs.SetCustomVar("$numTotalSupplyDrops", numTotalSupplyDrops);
__instance.Buffs.SetCustomVar("$numSupplyDrops", numSupplyDrops);
// Play the sound and show the tooltip
Manager.PlayInsidePlayerHead("purge_airdrop");
GameManager.ShowTooltip(__instance, "[936fbf]PURGE[-] OBJECTIVE REACHED. ADDITIONAL [bfbc7a]SUPPLIES[-] ARE ON THE WAY", string.Empty);
}
}
else
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageCheckPurgeSupplyDrops>().Setup(__instance.entityId));
}
}
GameManager.Instance.StartCoroutine(RebirthUtilities.CheckPurgeProgress(__instance));
}
}
if ((Time.time - RebirthVariables.scenarioCheck) > scenarioTick && __instance.biomeStandingOn != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive __instance.AttachedToEntity: " + __instance.AttachedToEntity);
RebirthVariables.scenarioCheck = Time.time;
RebirthUtilities.MoveToSpawnPoint(__instance, true);
if (RebirthVariables.customScenario == "none")
{
RebirthVariables.purgeDisplay = false;
}
else if (RebirthVariables.customScenario == "purge")
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PURGE");
if (!isAttached && !__instance.IsFlyMode.Value)
{
if (!__instance.world.IsEditor() && ((SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !GameManager.IsDedicatedServer) || SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer))
{
string biome = __instance.biomeStandingOn.m_sBiomeName;
int clearedPrefabs = RebirthManager.GetTotalClearedPrefabCount(biome);
int totalPrefabs = RebirthUtilities.GetTotalSpawnedPrefab(biome);
int currentClearedPrefabs = RebirthUtilities.GetPurgeBiome(biome);
RebirthUtilities.ChangePurgeBiome(biome, clearedPrefabs);
float percentage = ((float)currentClearedPrefabs / totalPrefabs) * 100;
RebirthVariables.purgeDisplayPercentage = ((float)clearedPrefabs / totalPrefabs) * 100;
int numPrefabs = clearedPrefabs;
if (clearedPrefabs > totalPrefabs)
{
numPrefabs = totalPrefabs;
}
RebirthVariables.purgeLabel = numPrefabs + "/" + totalPrefabs;
if (RebirthVariables.testPurge)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive percentage: " + percentage);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive currentClearedPrefabs: " + currentClearedPrefabs);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive clearedPrefabs: " + clearedPrefabs);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive totalPrefabs: " + totalPrefabs);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.purgeDisplayPercentage: " + RebirthVariables.purgeDisplayPercentage);
}
}
else if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IS CLIENT");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageCheckPurgeProgress>().Setup(__instance.entityId));
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PURGE 1");
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(__instance.position); // __instance.world.GetPOIAtPosition(__instance.position, false);
if (poiatPosition != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PURGE POI EXISTS");
RebirthVariables.purgePrefabName = poiatPosition.prefab.PrefabName;
RebirthVariables.purgePrefabPosition = new Vector3(poiatPosition.boundingBoxPosition.x, poiatPosition.boundingBoxPosition.y, poiatPosition.boundingBoxPosition.z);
bool isValid = true;
if (RebirthVariables.testPurge)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive poiatPosition.name: " + poiatPosition.name);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive poiatPosition.boundingBoxPosition: " + poiatPosition.boundingBoxPosition);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive poiatPosition.prefab.PrefabName: " + poiatPosition.prefab.PrefabName);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive poiatPosition.prefab.Tags: " + poiatPosition.prefab.Tags);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive poiatPosition.prefab.DifficultyTier: " + poiatPosition.prefab.DifficultyTier);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive poiatPosition.prefab.SleeperVolumes.Count: " + poiatPosition.prefab.SleeperVolumes.Count);
}
//if ((poiatPosition.prefab.PrefabName.ToLower().Contains("_tile_") || poiatPosition.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("rwgonly,streettile"))) && poiatPosition.prefab.SleeperVolumes.Count == 0)
if (poiatPosition.prefab.SleeperVolumes.Count == 0)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IS NOT VALID");
isValid = false;
}
if (isValid)
{
if ((SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !GameManager.IsDedicatedServer) || SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
int totalKills = RebirthManager.GetTotalKills(__instance.entityId);
__instance.Buffs.SetCustomVar("$totalPurgeKills", totalKills);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive totalKills: " + totalKills);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive $purgeKills: " + __instance.Buffs.GetCustomVar("$purgeKills"));
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive $ModPurge: " + __instance.Buffs.GetCustomVar("$ModPurge"));
int numKills = RebirthManager.AutoRedeemKills(__instance.entityId);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numKills: " + numKills);
int purgeAirDropNumKills = RebirthVariables.purgeAirDropNumKills - (int)__instance.Buffs.GetCustomVar("$ModPurge") * 10;
if (numKills > 0)
{
__instance.Buffs.SetCustomVar("$purgeKills", __instance.Buffs.GetCustomVar("$purgeKills") + numKills);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A $purgeKills: " + __instance.Buffs.GetCustomVar("$purgeKills"));
int numInterations = 0;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.purgeAirDropNumKills: " + purgeAirDropNumKills);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.purgeAirDropNumKillsIncrement: " + RebirthVariables.purgeAirDropNumKillsIncrement);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A $purgeKillsIncrement: " + __instance.Buffs.GetCustomVar("$purgeKillsIncrement"));
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive compared to: " + purgeAirDropNumKills + RebirthVariables.purgeAirDropNumKillsIncrement * (int)__instance.Buffs.GetCustomVar("$purgeKillsIncrement"));
// Enter the while loop as long as the condition holds true
while (__instance.Buffs.GetCustomVar("$purgeKills") >= (purgeAirDropNumKills + RebirthVariables.purgeAirDropNumKillsIncrement * (int)__instance.Buffs.GetCustomVar("$purgeKillsIncrement")))
{
// Recalculate target kills for each iteration
int numTargetKills = purgeAirDropNumKills + RebirthVariables.purgeAirDropNumKillsIncrement * (int)__instance.Buffs.GetCustomVar("$purgeKillsIncrement");
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numTargetKills: " + numTargetKills);
numInterations++;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numInterations: " + numInterations);
float purgeKillsIncrement = __instance.Buffs.GetCustomVar("$purgeKillsIncrement");
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive purgeKillsIncrement: " + purgeKillsIncrement);
// Reduce $purgeKills by the number of target kills
__instance.Buffs.SetCustomVar("$purgeKills", __instance.Buffs.GetCustomVar("$purgeKills") - numTargetKills);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B $purgeKills: " + __instance.Buffs.GetCustomVar("$purgeKills"));
// Check if the incremented kills are below the max and increase accordingly
if ((RebirthVariables.purgeAirDropNumKillsIncrement * purgeKillsIncrement) < RebirthVariables.purgeAirDropNumKillsMax)
{
__instance.Buffs.SetCustomVar("$purgeKillsIncrement", purgeKillsIncrement + 1);
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B $purgeKillsIncrement: " + __instance.Buffs.GetCustomVar("$purgeKillsIncrement"));
}
if (numInterations > 0)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numInterations: " + numInterations);
__instance.Buffs.SetCustomVar("$numSupplyDrops", numInterations);
}
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.checkSleeperVolumes: " + RebirthVariables.checkSleeperVolumes);
if (!RebirthVariables.checkSleeperVolumes)
{
GameManager.Instance.StartCoroutine(RebirthUtilities.checkSleeperVolumes(poiatPosition, __instance, RebirthVariables.maxSleeperVolumeCount));
}
}
else if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IS CLIENT");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageCheckSleeperVolumes>().Setup(__instance.entityId, RebirthVariables.maxSleeperVolumeCount));
}
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PURGE REMOVE DISPLAY 1");
RebirthVariables.purgeDisplay = false;
RebirthVariables.purgePrefabName = "";
RebirthVariables.purgePrefabPosition = Vector3.zero;
}
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PURGE REMOVE DISPLAY 2");
RebirthVariables.purgeDisplay = false;
RebirthVariables.purgePrefabName = "";
RebirthVariables.purgePrefabPosition = Vector3.zero;
}
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PURGE REMOVE DISPLAY 3");
RebirthVariables.purgeDisplay = false;
RebirthVariables.purgePrefabName = "";
RebirthVariables.purgePrefabPosition = Vector3.zero;
}
}
}
if ((Time.time - RebirthVariables.gamestageCheck) > gamestageTick && __instance.biomeStandingOn != null)
{
RebirthVariables.gamestageCheck = Time.time;
{
int gamestage = __instance.gameStage;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive gamestage: " + gamestage);
int prefabGamestage = 0;
if (!RebirthUtilities.IsHordeNight() && !__instance.world.IsEditor())
{
//PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(__instance.position); // __instance.world.GetPOIAtPosition(__instance.position, false);
//PrefabInstance poiatPosition = __instance.enteredPrefab;
PrefabInstance poiatPosition = __instance.prefab;
//PrefabInstance poiatPosition3 = __instance.world.GetPOIAtPosition(__instance.position, false);
/*if (poiatPosition != null)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive enteredPrefab: " + __instance.enteredPrefab.prefab.PrefabName);
}*/
if (poiatPosition == null)
{
poiatPosition = __instance.world.GetPOIAtPosition(__instance.position, false);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive prefab: " + __instance.prefab.prefab.PrefabName);
}
if (poiatPosition != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive PREFAB: " + poiatPosition.prefab.PrefabName);
int tier = poiatPosition.prefab.DifficultyTier;
if (tier > 0)
{
int biomeID = RebirthUtilities.GetCurrentBiomeID(__instance.biomeStandingOn.m_sBiomeName);
prefabGamestage = RebirthUtilities.AdjustGamestage((int)gamestage, tier, biomeID);
}
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive NO PREFAB");
}
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive prefabGamestage: " + prefabGamestage);
RebirthVariables.displayGamestage = gamestage + prefabGamestage;
string gamestageValue = RebirthVariables.displayGamestage.ToString();
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive gamestageValue: " + gamestageValue);
if (RebirthVariables.customInfested == "hidesurprise"
)
{
List<Quest> listCurrentQuests = __instance.QuestJournal.quests;
for (int index = 0; index < listCurrentQuests.Count; ++index)
{
if (listCurrentQuests[index].CurrentState == Quest.QuestState.InProgress && listCurrentQuests[index].RallyMarkerActivated)
{
gamestageValue = "N/A";
break;
}
}
}
RebirthVariables.displayGamestageLabel = gamestageValue;
}
}
if ((Time.time - RebirthVariables.modelLayerCheck) > heatMapTick && !isAttached)
{
RebirthVariables.modelLayerCheck = Time.time;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive __instance.entityId:" + __instance.entityId);
if (__instance.Buffs.GetCustomVar("$ModHeatMapDetection") == 1f)
{
if ((SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !GameManager.IsDedicatedServer) || SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
if (GameManager.Instance.World.aiDirector != null)
{
AIDirectorChunkEventComponent component = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorChunkEventComponent>();
AIDirectorChunkData dataFromPosition = component.GetChunkDataFromPosition(new Vector3i(__instance.position.x, __instance.position.y, __instance.position.z), false);
float percentage = 0f;
float cooldown = 0f;
if (dataFromPosition != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive dataFromPosition != null");
percentage = dataFromPosition.ActivityLevel;
if (dataFromPosition.cooldownDelay > 0.0)
{
cooldown = dataFromPosition.cooldownDelay;
}
}
__instance.Buffs.SetCustomVar("$ModHeatMapDetectionValue", percentage);
__instance.Buffs.SetCustomVar("$ModHeatMapDetectionCooldown", cooldown);
}
}
else if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IS CLIENT");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageGetHeatMapValue>().Setup(__instance.entityId));
}
}
if (RebirthVariables.noHit)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive NO HIT, modelLayer: " + __instance.GetModelLayer());
}
/*Log.Out("EntityPlayerLocalPatches-OnUpdateLive LOCAL PLAYER CHECK TICK, modelLayer: " + modelLayer);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive LOCAL PLAYER CHECK TICK, RebirthVariables.modelLayerCheck == 1: " + (RebirthVariables.modelLayerCheck == 1));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive LOCAL PLAYER CHECK TICK, modelLayer != 24: " + (modelLayer != 24));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive LOCAL PLAYER CHECK TICK, modelLayer != 10: " + (modelLayer != 10));*/
if (RebirthVariables.logModelLayerCheck)
{
List<Transform> setLayerRecursivelyList = new List<Transform>();
__instance.emodel.GetModelTransform().gameObject.GetComponentsInChildren<Transform>(true, setLayerRecursivelyList);
List<Transform> list = setLayerRecursivelyList;
bool foundLayer = false;
for (int i = list.Count - 1; i >= 0; i--)
{
if (list[i].gameObject.layer == 2)
{
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int numDays = valueTuple.Item1;
int numHours = valueTuple.Item2;
int numMinutes = valueTuple.Item3;
Log.Out("EntityPlayerLocalPatches-OnUpdateLive gameObject: " + list[i].gameObject.name + " / Layer: " + list[i].gameObject.layer + " / Game Time: " + numDays + "D: " + numHours + "H: " + numMinutes + "M");
foundLayer = true;
}
}
if (foundLayer)
{
GameManager.ShowTooltip(__instance, "Your Model Layer is set to 2, preventing hits");
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive modelLayer: " + modelLayer + " / Game Time: " + numDays + "D:" + numHours + "H:" + numMinutes + "M");
}
}
if (!RebirthUtilities.ScenarioSkip() && (Time.time - RebirthVariables.walkmanCheck) > walkmanTick && !isAttached)
{
RebirthVariables.walkmanCheck = Time.time;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive walkmanCheck START");
if (RebirthUtilities.HasMod(__instance, "FuriousRamsayWalkmanMod"))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive has Walkman Mod");
__instance.Buffs.SetCustomVar("$walkman_FR", 1f);
for (int i = 1; i < 4; i++)
{
float volume = __instance.Buffs.GetCustomVar("$volume" + i + "_FR");
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive volume: " + volume);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.musicMode: " + RebirthVariables.musicMode);
if (volume == 0)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive SET VOLUME");
List<ProgressionValue> skills = new List<ProgressionValue>();
__instance.Progression.GetDict().CopyValuesTo(skills);
bool isValid = true;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive skills.Count: " + skills.Count);
if (RebirthVariables.musicMode == 1)
{
if (skills.Count > 0)
{
foreach (ProgressionValue progressionValue in skills)
{
if (progressionValue.ProgressionClass.ParentName == "furiousramsayskillsynthwavevolume" + i)
{
if (progressionValue.Level == 0)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive Name: " + progressionValue.Name + ", Level: " + progressionValue.Level + ", Parent: " + progressionValue.ProgressionClass.ParentName);
isValid = false;
break;
}
}
}
}
}
else
{
isValid = false;
}
if (isValid)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive TURN SKILL ON");
__instance.Buffs.SetCustomVar("$volume" + i + "_FR", 1f);
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive TURN SKILL OFF");
__instance.Buffs.SetCustomVar("$volume" + i + "_FR", 0f);
}
}
else
{
if (RebirthVariables.musicMode != 1)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive TURN SKILL OFF");
__instance.Buffs.SetCustomVar("$volume" + i + "_FR", 0f);
}
}
}
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive des not have Walkman Mod");
__instance.Buffs.SetCustomVar("$walkman_FR", 0f);
}
}
if (!RebirthUtilities.ScenarioSkip() && (Time.time - RebirthVariables.craftingCheck) > craftingTick && !isAttached)
{
RebirthVariables.craftingCheck = Time.time;
RebirthUtilities.checkCraftingProgression(__instance.inventory, __instance);
if (RebirthVariables.cycleArea1 == 0)
{
RebirthVariables.cycleArea1 = 1;
}
else if (RebirthVariables.cycleArea1 == 1)
{
RebirthVariables.cycleArea1 = 0;
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CRAFTING CHECK, RebirthVariables.cycleArea1: " + RebirthVariables.cycleArea1);
}
if ((Time.time - RebirthVariables.companionsCheck) > companionsTick && !isAttached)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive HIRES CHECK");
RebirthVariables.companionsCheck = Time.time;
/*for (int j = 0; j < playerHires.Count; j++)
{
hireInfo hire = playerHires[j];
if (hire.playerID == __instance.entityId)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECKING HIRE: " + hire.hireID + " / entity: " + hire.className + " / order: " + hire.order + " / reSpawnPosition: " + hire.reSpawnPosition + " / spawnPosition: " + hire.spawnPosition);
EntityNPCRebirth hiredNPC = GameManager.Instance.World.GetEntity(hire.hireID) as EntityNPCRebirth;
if (hiredNPC == null)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CANNOT FIND THE ENTITY");
}
else if (hire.order == 1)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive hiredNPC.position: " + hiredNPC.position);
}
}
}*/
for (int i = 0; i < __instance.companions.MemberList.Count; i++)
{
//Log.Out("CompanionGroupPatches-Remove i: " + i);
//Log.Out("CompanionGroupPatches-Remove __instance.MemberList[" + i + "].entityId: " + __instance.companions.MemberList[i].entityId);
if (__instance.companions.MemberList[i] != null)
{
var myEntity = GameManager.Instance.World.GetEntity(__instance.companions.MemberList[i].entityId) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("CompanionGroupPatches-Remove CANNOT FIND ENTITY");
__instance.companions.MemberList.RemoveAt(i);
__instance.companions.OnGroupChanged();
break;
}
}
}
}
/*if ((Time.time - RebirthVariables.hiresCheck) > hiresTick && !isAttached)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive HIRES CHECK");
RebirthVariables.hiresCheck = Time.time;
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(__instance);
if (!spawnPoint.IsUndef())
{
float distance = Vector3.Distance(__instance.position, spawnPoint.position);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive distance: " + distance);
if (distance < 20)
{
for (int j = 0; j < playerHires.Count; j++)
{
hireInfo hire = playerHires[j];
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECKING HIRE: " + hire.hireID + " / entity: " + hire.className + " / resSpawnPosition: " + spawnPoint.position);
if (hire.playerID == __instance.entityId && hire.order == (int)EntityUtilities.Orders.Follow)
{
EntityNPCRebirth hiredNPC = GameManager.Instance.World.GetEntity(hire.hireID) as EntityNPCRebirth;
if (hiredNPC == null)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive Entity Not Found, Spawn it");
// SEND SPAWN NEW ENTITY TO SERVER
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRespawnHireRebirth>().Setup(hire.hireID,
spawnPoint.position
), false);
}
else
{
RebirthUtilities.SpawnHire(hire.hireID, spawnPoint.position);
}
}
}
}
}
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthManager.loadedHires: " + RebirthManager.loadedHires);
}*/
if ((Time.time - RebirthVariables.biomeCheck) > biomeTick && !__instance.world.IsEditor() && RebirthVariables.customRebirthWeather && !GameUtils.IsPlaytesting() && __instance.biomeStandingOn != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive BIOME TICK");
RebirthVariables.biomeCheck = Time.time;
RebirthVariables.currentBiome = __instance.biomeStandingOn.m_sBiomeName;
/*if (biomeAt != null && biomeAt.m_sBiomeName == "wasteland")
{
//SkyManager.SetFogDebugColor(new Color(0.015f, 0, 0.025f));
if (!RebirthVariables.inWasteland)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IN WASTELAND");
//WeatherManager.Instance.ForceWeather("rebirth_wasteland", 60f);
RebirthVariables.inWasteland = true;
RebirthVariables.inForest = false;
RebirthVariables.inSnow = false;
RebirthVariables.inDesert = false;
RebirthVariables.inBurntForest = false;
}
else
{
if ((Time.time - RebirthVariables.wastelandCheck) > wastelandTick)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RESET WASTELAND WEATHER");
RebirthVariables.wastelandCheck = Time.time;
//WeatherManager.Instance.ForceWeather("rebirth_wasteland", 60f);
}
}
//SkyManager.SetFogDensity(0);
}
else if (biomeAt != null && biomeAt.m_sBiomeName == "snow")
{
if (!RebirthVariables.inSnow)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IN SNOW");
//WeatherManager.Instance.ForceWeather("rebirth_snow", 60f);
RebirthVariables.inForest = false;
RebirthVariables.inDesert = false;
RebirthVariables.inWasteland = false;
RebirthVariables.inSnow = true;
RebirthVariables.inBurntForest = false;
}
else
{
if ((Time.time - RebirthVariables.snowCheck) > snowTick)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RESET SNOW WEATHER");
RebirthVariables.snowCheck = Time.time;
//WeatherManager.Instance.ForceWeather("rebirth_snow", 60f);
}
}
}
else if (biomeAt != null && biomeAt.m_sBiomeName == "desert")
{
if (!RebirthVariables.inDesert)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IN DESERT");
//WeatherManager.Instance.ForceWeather("default", 60f);
RebirthVariables.inForest = false;
RebirthVariables.inSnow = false;
RebirthVariables.inWasteland = false;
RebirthVariables.inDesert = true;
RebirthVariables.inBurntForest = false;
}
else
{
if ((Time.time - RebirthVariables.desertCheck) > desertTick)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RESET DESERT WEATHER");
RebirthVariables.desertCheck = Time.time;
//WeatherManager.Instance.ForceWeather("default", 60f);
}
}
}
else
{
if (!RebirthVariables.inForest)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IN FOREST");
//WeatherManager.Instance.ForceWeather("default", 5f);
RebirthVariables.inForest = true;
RebirthVariables.inDesert = false;
RebirthVariables.inSnow = false;
RebirthVariables.inWasteland = false;
RebirthVariables.inBurntForest = false;
}
}*/
}
if ((Time.time - RebirthVariables.variablesCheck) > variablesTick)
{
RebirthVariables.variablesCheck = Time.time;
if (__instance.Spawned)
{
GameManager.Instance.StartCoroutine(RebirthVariables.UpdateLocalVariables(__instance, 1));
}
}
if (!RebirthUtilities.ScenarioSkip() && (Time.time - RebirthVariables.auraCheck) > auraTick)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive AURA TICK");
RebirthVariables.auraCheck = Time.time;
string optionAuraRange = RebirthVariables.customAuraRange;
// AURAS ======================================================================================================================
foreach (string key in RebirthVariables.localAuras.Keys)
{
if (__instance.Buffs.HasBuff("FuriousRamsayBuff" + key + "Aura"))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive aura: " + key);
ProgressionValue progressionValue = __instance.Progression.GetProgressionValue(RebirthVariables.localAuras[key].progressionName);
int progressionLevel = progressionValue.Level;
if (progressionLevel > 0 && RebirthUtilities.HasMod(__instance, RebirthVariables.localAuras[key].modName))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 1");
// PARTY MEMBERS
if (__instance.Party != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 2");
if (__instance.Party.MemberList != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 3, HAS PARTY MEMBERS");
for (int j = 0; j < __instance.Party.MemberList.Count; j++)
{
EntityPlayer partyMember = __instance.Party.MemberList[j] as EntityPlayer;
bool isWithinRange = Vector3.Distance(partyMember.position, __instance.position) < (float)GameStats.GetInt(EnumGameStats.PartySharedKillRange);
if (optionAuraRange == "always")
{
isWithinRange = true;
}
else if (optionAuraRange == "never")
{
isWithinRange = false;
}
if (partyMember.entityId != __instance.entityId && isWithinRange)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 4, j: " + j + ", partyMember: " + partyMember.EntityName);
if (!partyMember.Buffs.HasBuff(RebirthVariables.localAuras[key].allyAura + progressionLevel))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 5, member doesn't have buff: " + key);
bool addBuff = true;
foreach (BuffValue buffValue in partyMember.Buffs.ActiveBuffs)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 6");
if (buffValue != null && buffValue.BuffClass != null)
{
BuffClass buffClass = buffValue.BuffClass;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 7, buffClass: " + buffClass.Name);
if (buffClass.Name.Contains(RebirthVariables.localAuras[key].allyAura))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 8, FOUND MATCHING BUFF");
if (int.Parse(buffClass.Name.Replace(RebirthVariables.localAuras[key].allyAura, "")) < progressionLevel)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 10");
partyMember.Buffs.RemoveBuff(buffClass.Name);
}
}
}
}
if (addBuff)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive 11");
partyMember.Buffs.AddBuff(RebirthVariables.localAuras[key].allyAura + progressionLevel);
}
}
}
}
}
}
for (int j = 0; j < __instance.Companions.Count; j++)
{
EntityNPCRebirth companion = __instance.Companions[j] as EntityNPCRebirth;
if (companion.HasAllTags(FastTags<TagGroup.Global>.Parse("ranged")))
{
if (!companion.Buffs.HasBuff(RebirthVariables.localAuras[key].allyAura + progressionLevel))
{
bool addBuff = true;
foreach (BuffValue buffValue in companion.Buffs.ActiveBuffs)
{
if (buffValue != null && buffValue.BuffClass != null)
{
BuffClass buffClass = buffValue.BuffClass;
if (buffClass.Name.Contains(RebirthVariables.localAuras[key].allyAura))
{
if (int.Parse(buffClass.Name.Replace(RebirthVariables.localAuras[key].allyAura, "")) < progressionLevel)
{
companion.Buffs.RemoveBuff(buffClass.Name);
}
}
}
}
if (addBuff)
{
companion.Buffs.AddBuff(RebirthVariables.localAuras[key].allyAura + progressionLevel);
}
}
}
}
}
}
}
}
// EVENTS ======================================================================================================================
float eventCheck = __instance.Buffs.GetCustomVar("$FuriousRamsayEventCheck");
float eventCheckEntity = __instance.Buffs.GetCustomVar("$FuriousRamsayEventCheckEntity");
float eventCheckEntityBloodMoon = __instance.Buffs.GetCustomVar("$FuriousRamsayEventCheckEntityBloodMoon");
float eventCheckCooldown = __instance.Buffs.GetCustomVar("$FuriousRamsayEventCheckCooldown");
float numEvents = __instance.Buffs.GetCustomVar("$FuriousRamsayNumEvents");
float eventTick = 60f;
float eventTickEntityBloodMoon = 30f;
float eventTickCooldown = 10f;
int eventCooldown = 0;
if (eventCheck > Time.time)
{
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheck", 0f);
eventCheck = 0f;
}
if (eventCheckEntity > Time.time)
{
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheckEntity", 0f);
eventCheckEntity = 0f;
}
if (eventCheckEntityBloodMoon > Time.time)
{
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheckEntityBloodMoon", 0f);
eventCheckEntityBloodMoon = 0f;
}
if (eventCheckCooldown > Time.time)
{
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheckCooldown", 0f);
eventCheckCooldown = 0f;
}
// EVENT COOLDOWN
if ((Time.time - eventCheckCooldown) > eventTickCooldown)
{
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheckCooldown", Time.time);
eventCooldown = (int)__instance.Buffs.GetCustomVar("$FuriousRamsayEventTotalCooldown") - 10;
if (eventCooldown < 0)
{
eventCooldown = 0;
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive eventCooldown: " + eventCooldown);
__instance.Buffs.SetCustomVar("$FuriousRamsayEventTotalCooldown", eventCooldown);
}
// ENTITY EVENTS - HORDE NIGHT
if (!RebirthUtilities.ScenarioSkip() && (Time.time - eventCheckEntityBloodMoon) > eventTickEntityBloodMoon && !isAttached)
{
int randomInt = 0;
if (RebirthVariables.customHordeNight && RebirthUtilities.IsHordeNight())
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive ENTITY - IS HORDE NIGHT");
randomInt = __instance.rand.RandomRange(1, 50);
int playerLevel = __instance.Progression.GetLevel();
// SEEKERS
if (randomInt == 1)
{
if (playerLevel >= 30 && playerLevel < 50)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker001", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 50 && playerLevel < 70)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker002", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 70 && playerLevel < 90)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker003", 2, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 90 && playerLevel < 110)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker004", 2, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 110 && playerLevel < 130)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker005", 3, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 130 && playerLevel < 150)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker006", 3, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 150)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker007", 4, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
}
// WRAITHS
/*if (randomInt == 2)
{
if (playerLevel >= 60 && playerLevel < 80)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith001", 1, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 80 && playerLevel < 100)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith002", 1, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 100 && playerLevel < 120)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith003", 2, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 120 && playerLevel < 140)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith004", 2, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 140)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith005", 3, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
}*/
}
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheckEntityBloodMoon", Time.time);
}
string frequency = RebirthVariables.customEventsFrequency;
if (frequency == "less")
{
frequency = "50";
}
else if (frequency == "normal")
{
frequency = "100";
}
else if (frequency == "more")
{
frequency = "150";
}
float optionEventsFrequency = float.Parse(frequency) / 100;
if (optionEventsFrequency == 0)
{
return true;
}
float eventTickEntity = 30f / optionEventsFrequency;
// ENTITY EVENTS - NOT HORDE NIGHT
if (!RebirthUtilities.ScenarioSkip() && ((Time.time - eventCheckEntity) > eventTickEntity) || (RebirthVariables.testEvents && RebirthVariables.testEventsCategory == 2) && !isAttached)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive ENTITY EVENT TICK");
int randomInt = 0;
float daringAdventurer = __instance.Progression.GetProgressionValue("perkDaringAdventurer").calculatedLevel + 1;
if (!RebirthUtilities.IsHordeNight())
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive ENTITY - IS NOT HORDE NIGHT");
bool isIndoors = RebirthUtilities.IsIndoors(__instance);
bool IsQuestingInPOI = RebirthUtilities.IsQuestingInPOI(__instance);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive isIndoors: " + isIndoors);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive IsQuestingInPOI: " + IsQuestingInPOI);
randomInt = __instance.rand.RandomRange(0, 500);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive randomInt: " + randomInt);
int playerLevel = __instance.Progression.Level;
if (RebirthVariables.testEvents)
{
randomInt = RebirthVariables.testEventsType;
playerLevel = RebirthVariables.testEventsPlayerLevel;
__instance.Buffs.RemoveBuff("FuriousRamsayBanditEvent");
__instance.Buffs.RemoveBuff("FuriousRamsayBanditEventInProgress");
eventCooldown = 0;
Log.Out("EntityPlayerLocalPatches-OnUpdateLive randomInt: " + randomInt);
}
bool skipEvent = false;
string optionEntityEvents = RebirthVariables.customEntityEvents;
bool customEventsBandits = RebirthVariables.customEventsBandits;
if (optionEntityEvents == "never")
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK ENTITY EVENTS 1");
skipEvent = true;
}
else if (optionEntityEvents == "notquesting" && RebirthUtilities.IsQuesting(__instance))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK ENTITY EVENTS 2");
skipEvent = true;
}
if (RebirthVariables.testEvents)
{
isIndoors = true;
skipEvent = false;
Log.Out("EntityPlayerLocalPatches-OnUpdateLive isIndoors: " + isIndoors);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK ENTITY EVENTS, optionEntityEvents: " + optionEntityEvents);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK ENTITY EVENTS, RebirthUtilities.IsQuesting(__instance): " + RebirthUtilities.IsQuesting(__instance));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive skipEvent: " + skipEvent);
}
if ((isIndoors || IsQuestingInPOI) && !skipEvent && customEventsBandits)
{
string navIconBoss = RebirthVariables.navIconBossEventNoHealth;
string navIconSupport = RebirthVariables.navIconSupportEventNoHealth;
if (RebirthVariables.customTargetBarVisibility == "always")
{
navIconBoss = RebirthVariables.navIconBossEvent;
navIconSupport = RebirthVariables.navIconSupportEvent;
}
if (!RebirthVariables.customEventsNotification)
{
navIconBoss = "";
navIconSupport = "";
}
navIconSupport = "";
navIconBoss = "";
float classLevels = RebirthUtilities.ClassLevels(__instance);
if (RebirthVariables.testEvents)
{
RebirthVariables.testEvents = false;
RebirthVariables.testEventsCategory = 0;
classLevels = RebirthVariables.testEventsClassLevel;
Log.Out("EntityPlayerLocalPatches-OnUpdateLive PLAYER TEST EVENT TURNED OFF");
Log.Out("EntityPlayerLocalPatches-OnUpdateLive navIconBoss: " + navIconBoss);
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive classLevels: " + classLevels);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive FuriousRamsayBanditEventInProgress: " + __instance.Buffs.HasBuff("FuriousRamsayBanditEventInProgress"));
// BANDITS
if (playerLevel >= 10 && !__instance.Buffs.HasBuff("FuriousRamsayBanditEventInProgress"))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive BANDIT EVENT 1");
bool forceEvent = false;
if (IsQuestingInPOI)
{
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(__instance.position); // __instance.world.GetPOIAtPosition(__instance.position, false);
if (poiatPosition != null)
{
int tier = poiatPosition.prefab.DifficultyTier;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive tier: " + tier);
forceEvent = RebirthUtilities.WillPOIBanditEventTrigger(tier);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive forceEvent: " + forceEvent);
}
}
if ((randomInt >= 6 && randomInt <= 8) || forceEvent)
{
bool hasBanditEvent = __instance.Buffs.HasBuff("FuriousRamsayBanditEvent");
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive hasBanditEvent: " + hasBanditEvent);
if (__instance.Party != null && __instance.Party.MemberList != null)
{
for (int j = 0; j < __instance.Party.MemberList.Count; j++)
{
EntityPlayer partyMember = __instance.Party.MemberList[j] as EntityPlayer;
float distance = partyMember.GetDistance(__instance);
if (distance < 100 && partyMember.Buffs.HasBuff("FuriousRamsayBanditEventInProgress"))
{
hasBanditEvent = true;
break;
}
}
}
if (!hasBanditEvent)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive BANDIT EVENT 2");
string minionBuff = "FuriousRamsayNPCMinionBuffTier1";
string supportBuff = "FuriousRamsayNPCSupportBuffTier1";
string buffBoss = "FuriousRamsayNPCBossBuffTier1";
string bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
if (classLevels >= 2.3f && classLevels < 3.4f)
{
__instance.Buffs.AddBuff("FuriousRamsayBanditEvent");
__instance.Buffs.AddBuff("FuriousRamsayBanditEventInProgress");
RebirthUtilities.PlayCompanionSpawnSound(__instance);
// Minions
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001cBat", 1, "", "", "40", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002hSpear", 1, "", "", "41", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002fKnife", 1, "", "", "42", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
// Support
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001gMachete", 1, "", "", "43", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002bBat", 1, "", "", "44", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
// Boss
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002dAxe", 1, "", "", "45", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 2, -1, "", bossCrate, 1, navIconBoss, buffBoss);
}
else if (classLevels >= 3.4f && classLevels < 4.7f)
{
minionBuff = "FuriousRamsayNPCMinionBuffTier2";
supportBuff = "FuriousRamsayNPCSupportBuffTier2";
buffBoss = "FuriousRamsayNPCBossBuffTier2";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
__instance.Buffs.AddBuff("FuriousRamsayBanditEvent");
__instance.Buffs.AddBuff("FuriousRamsayBanditEventInProgress");
RebirthUtilities.PlayCompanionSpawnSound(__instance);
// Minions
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001cBat", 1, "", "", "40", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001bAxe", 1, "", "", "41", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001gMachete", 1, "", "", "42", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002bBat", 1, "", "", "43", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002fKnife", 1, "", "", "44", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
// Support
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002dAxe", 1, "", "", "45", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002hSpear", 1, "", "", "46", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
// Boss
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001hPipeRifle", 1, "", "", "47", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 2, -1, "", bossCrate, 1, navIconBoss, buffBoss);
}
else if (classLevels >= 4.7f && classLevels < 6.2f)
{
minionBuff = "FuriousRamsayNPCMinionBuffTier3";
supportBuff = "FuriousRamsayNPCSupportBuffTier3";
buffBoss = "FuriousRamsayNPCBossBuffTier3";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
__instance.Buffs.AddBuff("FuriousRamsayBanditEvent");
__instance.Buffs.AddBuff("FuriousRamsayBanditEventInProgress");
RebirthUtilities.PlayCompanionSpawnSound(__instance);
// Minions
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001cBat", 1, "", "", "40", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001bAxe", 1, "", "", "41", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001gMachete", 1, "", "", "42", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002bBat", 1, "", "", "43", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002dAxe", 1, "", "", "44", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002fKnife", 1, "", "", "45", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002hSpear", 1, "", "", "46", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
// Support
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditWoman001bMachete", 1, "", "", "47", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001fPipeRifle", 1, "", "", "48", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
// Boss
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001aPipePistol", 1, "", "", "49", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 2, -1, "", bossCrate, 1, navIconBoss, buffBoss);
}
else if (classLevels >= 6.2f)
{
minionBuff = "FuriousRamsayNPCMinionBuffTier4";
supportBuff = "FuriousRamsayNPCSupportBuffTier4";
buffBoss = "FuriousRamsayNPCBossBuffTier4";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
__instance.Buffs.AddBuff("FuriousRamsayBanditEvent");
__instance.Buffs.AddBuff("FuriousRamsayBanditEventInProgress");
RebirthUtilities.PlayCompanionSpawnSound(__instance);
// Minions
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001cBat", 1, "", "", "40", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001bAxe", 1, "", "", "41", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001gMachete", 1, "", "", "42", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002bBat", 1, "", "", "43", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002dAxe", 1, "", "", "44", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002fKnife", 1, "", "", "45", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan002hSpear", 1, "", "", "46", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditWoman001bMachete", 1, "", "", "47", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//birthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditWoman001dBat", 1, "", "", "48", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditWoman001eSpear", 1, "", "", "49", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
//RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditWoman001gAxe", 1, "", "", "50", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001aPipePistol", 1, "", "", "51", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, -1, -1, "", "", 0, "", minionBuff);
// Support
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001fPipeRifle", 1, "", "", "52", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001hPipeRifle", 1, "", "", "53", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 99, -1, "", "", 0, navIconSupport, supportBuff);
// Boss
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditMan001cPipeMachineGun", 1, "", "", "54", "static", "", "", 1f, -1, true, false, true, __instance.entityId, -1, "", 20, 0, 40, 1, 1, 2, -1, "", bossCrate, 1, navIconBoss, buffBoss);
}
}
}
}
// SEEKERS
if (randomInt >= 0 && randomInt <= 1)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive playerLevel: " + playerLevel);
if (playerLevel >= 30 && playerLevel < 40)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker001", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 40 && playerLevel < 50)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker002", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 50 && playerLevel < 60)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker003", 2, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 60 && playerLevel < 70)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker004", 2, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 70 && playerLevel < 80)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker005", 3, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 80 && playerLevel < 90)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker006", 3, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
else if (playerLevel >= 90)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive playerLevel: " + playerLevel);
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsaySeeker007", 4, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
if (RebirthVariables.customEventsNotification)
GameManager.ShowTooltip(__instance, Localization.Get("ttSeeker"));
}
}
// WRAITHS
/*if (randomInt == 2)
{
if (playerLevel >= 50 && playerLevel < 70)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith001", 1, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 70 && playerLevel < 90)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith002", 1, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 90 && playerLevel < 110)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith003", 2, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 110 && playerLevel < 130)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith004", 2, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 130)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith005", 3, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
}*/
}
else
{
if (!isAttached)
{
// PAIRED DOWN, NPCs
/*randomInt = __instance.rand.RandomRange(1, 100);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive randomInt: " + randomInt);
// ROBOT
if (randomInt >= 1 && randomInt <= 2)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive ROBOT");
if (playerLevel >= 15 && playerLevel < 30)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditHumanoidRobot001", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 30 && playerLevel < 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive SPAWN ROBOT 2");
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditHumanoidRobot002", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 60)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditHumanoidRobot003", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
}
// CYBORG
if (randomInt >= 3 && randomInt <= 4)
{
if (playerLevel >= 10 && playerLevel < 25)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg003a", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 25 && playerLevel < 45)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg003b", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 45 && playerLevel < 65)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg003c", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 65)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg003d", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
}
// CYBORG 2
if (randomInt >= 5 && randomInt <= 6)
{
if (playerLevel >= 45 && playerLevel < 65)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg002a", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 65)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg002a", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
}
// BLACK SHIELD CYBORG
if (randomInt >= 7 && randomInt <= 8)
{
if (playerLevel >= 25 && playerLevel < 45)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg001b", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 45 && playerLevel < 65)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg001c", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 65)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayBanditCyborg001a", 1, "", "", "50", "static", "1", "", 1, -1, true, false, true, __instance.entityId);
}
}*/
// WRAITHS
/*if (randomInt == 8)
{
if (playerLevel >= 50 && playerLevel < 70)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith001", 1, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 70 && playerLevel < 90)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith002", 1, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 90 && playerLevel < 110)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith003", 2, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 110 && playerLevel < 130)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith004", 2, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
else if (playerLevel >= 130)
{
RebirthUtilities.SpawnEntity(__instance.entityId, "FuriousRamsayWraith005", 3, "", "", "30", "static", "100", "", 1, -1, true, false, true, __instance.entityId);
}
}*/
}
}
}
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheckEntity", Time.time);
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive Time.time: " + Time.time);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive eventCheck: " + eventCheck);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive eventTick: " + eventTick);
float tempEventTick = eventTick / optionEventsFrequency;
// NORMAL EVENTS
if (!RebirthUtilities.ScenarioSkip() && ((Time.time - eventCheck) > tempEventTick) || (RebirthVariables.testEvents && RebirthVariables.testEventsCategory == 1) && !isAttached)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive NORMAL EVENTS");
bool isHoldingTool = __instance.inventory.holdingItem.HasAnyTags(FastTags<TagGroup.Global>.Parse("shovel,auger"));
float daringAdventurer = __instance.Progression.GetProgressionValue("perkDaringAdventurer").calculatedLevel + 1;
int randomInt = 0;
if (!RebirthUtilities.IsHordeNight())
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive ISN'T HORDE NIGHT");
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int numDays = valueTuple.Item1;
int numHours = valueTuple.Item2;
int numMinutes = valueTuple.Item3;
int playerLevel = __instance.Progression.GetLevel();
float numEventsFrequency = 0.75f / optionEventsFrequency;
int numEventsMax = 1;
bool isActive = (numHours >= 4 && numHours < 22);
bool optionEventsNight = RebirthVariables.customEventsNight;
if (optionEventsNight)
{
isActive = (numHours >= 0 && numHours < 23);
}
if (optionEventsFrequency <= .5f)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive LESS: " + optionEventsFrequency);
if (playerLevel >= 20 && playerLevel < 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive LESS 1");
numEventsMax = 1;
}
else if (playerLevel >= 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive LESS 2");
numEventsMax = 1;
}
}
else if (optionEventsFrequency >= 1.5f)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive MORE: " + optionEventsFrequency);
numEventsMax = 1;
if (playerLevel >= 20 && playerLevel < 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive MORE 1");
numEventsMax = 2;
}
else if (playerLevel >= 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive MORE 2");
numEventsMax = 3;
}
}
else
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive NORMAL: " + optionEventsFrequency);
if (playerLevel >= 20 && playerLevel < 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive NORMAL 1");
numEventsMax = 1;
}
else if (playerLevel >= 60)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive NORMAL 2");
numEventsMax = 2;
}
}
//Log.Out("=========================================================================");
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numEvents: " + numEvents);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numEventsMax: " + numEventsMax);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive isActive: " + isActive);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numEventsFrequency: " + numEventsFrequency);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numHours >= 8 && numHours < 20: " + (numHours >= 8 && numHours < 20));
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numEvents < numEventsMax: " + (numEvents < numEventsMax));
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive isHoldingTool: " + isHoldingTool);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive isAttached: " + isAttached);
bool isBelowEventMax = numEvents < numEventsMax;
if (RebirthVariables.testEvents)
{
isActive = true;
isBelowEventMax = true;
playerLevel = RebirthVariables.testEventsPlayerLevel;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive playerLevel: " + playerLevel);
}
if (isActive && isBelowEventMax && !isHoldingTool && !isAttached)
{
if (playerLevel >= 8 && playerLevel < 15)
{
randomInt = (int)(__instance.rand.RandomRange(0, 1000 * numEventsFrequency));
}
else if (playerLevel >= 15 && playerLevel < 25)
{
randomInt = (int)(__instance.rand.RandomRange(0, 950 * numEventsFrequency));
}
else if (playerLevel >= 25 && playerLevel < 35)
{
randomInt = (int)(__instance.rand.RandomRange(0, 900 * numEventsFrequency));
}
else
{
randomInt = (int)(__instance.rand.RandomRange(0, 850 * numEventsFrequency));
}
string optionEventRestriction = RebirthVariables.customEventRestrictions;
bool skipEvent = false;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, optionEventRestriction: " + optionEventRestriction);
if (optionEventRestriction == "off")
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS 1");
skipEvent = true;
}
else if (optionEventRestriction == "onlyquesting" && !RebirthUtilities.IsQuesting(__instance))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS 2");
skipEvent = true;
}
else if (optionEventRestriction == "notquesting" && RebirthUtilities.IsQuesting(__instance))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS 3");
skipEvent = true;
}
else if (optionEventRestriction == "notinside" && RebirthUtilities.IsIndoors(__instance))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS 4");
skipEvent = true;
}
else if (optionEventRestriction == "notquestinginside")
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS 5");
if (RebirthUtilities.IsQuesting(__instance) || RebirthUtilities.IsIndoors(__instance))
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS 6");
skipEvent = true;
}
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, skipEvent: " + skipEvent);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, eventCooldown: " + eventCooldown);
if (RebirthVariables.testEvents && RebirthVariables.testEventsCategory == 1)
{
randomInt = RebirthVariables.testEventsType;
eventCooldown = 0;
skipEvent = false;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive randomInt: " + randomInt);
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive randomInt: " + randomInt);
if (eventCooldown <= 0 && !skipEvent)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A");
bool canSpawn = false;
bool hasSupport = true;
string buffMinion = "";
string buffSupport = "";
string buffBoss = "";
string bossCrate = "";
SpawnType spawnType = SpawnType.None;
int numSpawns = 10;
int numSupportSpawns = 2;
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive playerLevel: " + playerLevel);
if (playerLevel >= 8 && playerLevel < 20)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A1");
if (randomInt >= 0 && randomInt <= 5)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A1a");
buffMinion = "FuriousRamsayMinionBuffTier1";
buffBoss = "FuriousRamsayBossBuffTier1B";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
hasSupport = false;
spawnType = SpawnType.Zombies;
}
}
if (playerLevel >= 20 && playerLevel < 35)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A1");
if (randomInt >= 0 && randomInt <= 5)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A1a");
buffMinion = "FuriousRamsayMinionBuffTier1";
buffSupport = "FuriousRamsaySupportBuffTier1";
buffBoss = "FuriousRamsayBossBuffTier1B";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.Zombies;
}
}
else if (playerLevel >= 35 && playerLevel < 50)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A2");
if (randomInt >= 0 && randomInt <= 5)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A2a");
buffMinion = "FuriousRamsayMinionBuffTier2";
buffSupport = "FuriousRamsaySupportBuffTier2";
buffBoss = "FuriousRamsayBossBuffTier1C";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.Zombies;
}
else if (randomInt >= 6 && randomInt <= 7 && RebirthVariables.customEventsZombieAnimals)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A2b");
buffMinion = "FuriousRamsayMinionBuffTier2NoSpeed";
buffSupport = "";
buffBoss = "FuriousRamsayBossBuffTier2Animal";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
numSupportSpawns = 1;
spawnType = SpawnType.ZombieAnimals;
}
}
else if (playerLevel >= 50 && playerLevel < 80)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A3");
if (randomInt >= 0 && randomInt <= 5)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A3a");
buffMinion = "FuriousRamsayMinionBuffTier3";
buffSupport = "FuriousRamsaySupportBuffTier3";
buffBoss = "FuriousRamsayBossBuffTier1D";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.Zombies;
}
else if (randomInt >= 6 && randomInt <= 7 && RebirthVariables.customEventsZombieAnimals)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A3b");
buffMinion = "FuriousRamsayMinionBuffTier3NoSpeed";
buffSupport = "";
buffBoss = "FuriousRamsayBossBuffTier3Animal";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
numSupportSpawns = 1;
spawnType = SpawnType.ZombieAnimals;
}
}
else if (playerLevel >= 80 && playerLevel < 110)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A4");
if (randomInt >= 0 && randomInt <= 5)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A4a");
buffMinion = "FuriousRamsayMinionBuffTier4";
buffSupport = "FuriousRamsaySupportBuffTier4";
buffBoss = "FuriousRamsayBossBuffTier1E";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.Zombies;
}
else if (randomInt >= 6 && randomInt <= 7 && RebirthVariables.customEventsZombieAnimals)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A4b");
buffMinion = "FuriousRamsayMinionBuffTier4NoSpeed";
buffSupport = "";
buffBoss = "FuriousRamsayBossBuffTier4Animal";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.ZombieAnimals;
}
}
else if (playerLevel >= 110)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A5");
if (randomInt >= 0 && randomInt <= 5)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A5a");
buffMinion = "FuriousRamsayMinionBuffTier5";
buffSupport = "FuriousRamsaySupportBuffTier5";
buffBoss = "FuriousRamsayBossBuffTier1F";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.Zombies;
}
else if (randomInt >= 6 && randomInt <= 7 && RebirthVariables.customEventsZombieAnimals)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A5b");
buffMinion = "FuriousRamsayMinionBuffTier5NoSpeed";
buffSupport = "";
buffBoss = "FuriousRamsayBossBuffTier5Animal";
bossCrate = "FuriousRamsayEventLootContainerEntityTier" + daringAdventurer;
canSpawn = true;
spawnType = SpawnType.ZombieAnimals;
}
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive canSpawn: " + canSpawn);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive spawnType: " + spawnType);
if (canSpawn)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B");
string navIconBoss = RebirthVariables.navIconBossEventNoHealth;
string navIconSupport = RebirthVariables.navIconSupportEventNoHealth;
string navIconMinion = "";
if (RebirthVariables.customTargetBarVisibility == "always")
{
navIconBoss = RebirthVariables.navIconBossEvent;
navIconSupport = RebirthVariables.navIconSupportEvent;
}
if (!RebirthVariables.customEventsNotification)
{
navIconBoss = "";
navIconSupport = "";
}
List<int> entitiesMinions = null;
List<int> entitiesSupport = null;
List<int> entitiesBosses = null;
int gamestage = __instance.gameStage;
if (RebirthVariables.customEventsDifficulty.ToLower() == "less")
{
gamestage = __instance.gameStage - 30;
if (gamestage < 0)
{
gamestage = 10;
}
}
else if (RebirthVariables.customEventsDifficulty.ToLower() == "more")
{
gamestage = __instance.gameStage + 50;
}
else if (RebirthVariables.customEventsDifficulty.ToLower() == "random")
{
int randomIncrease = GameManager.Instance.World.GetGameRandom().RandomRange(15, 75);
gamestage = __instance.gameStage + randomIncrease;
}
bool useDuplicates = false;
if (spawnType == SpawnType.Zombies)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B1");
entitiesBosses = RebirthUtilities.BuildEntityGroup(gamestage);
entitiesSupport = RebirthUtilities.BuildZombieSupportGroup(gamestage);
entitiesMinions = RebirthUtilities.BuildEntityGroup(gamestage);
}
else if (spawnType == SpawnType.ZombieAnimals)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B2");
entitiesBosses = RebirthUtilities.BuildZombieAnimalBossGroup(gamestage);
entitiesSupport = RebirthUtilities.BuildZombieAnimalSupportGroup(gamestage);
entitiesMinions = RebirthUtilities.BuildZombieAnimalGroup(gamestage);
useDuplicates = true;
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive entitiesMinions != null: " + (entitiesMinions != null));
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive entitiesBosses != null: " + (entitiesBosses != null));
if (entitiesMinions != null && entitiesBosses != null)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive entitiesMinions: " + entitiesMinions.Count);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive entitiesBosses: " + entitiesBosses.Count);
// Remove Support entities from Boss Groups
entitiesBosses = RebirthUtilities.RemoveZombieSupportEntries(entitiesBosses);
if (entitiesMinions.Count > 0 && entitiesMinions.Count > 0)
{
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B3");
int random = GameManager.Instance.World.GetGameRandom().RandomRange(0, entitiesBosses.Count);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B3 random: " + random);
if (spawnType == SpawnType.ZombieAnimals)
{
numSpawns = numSpawns / 2;
}
if (RebirthVariables.customEventsDifficulty.ToLower() == "random")
{
int numAdditionalSpawns = numSpawns;
if (spawnType == SpawnType.ZombieAnimals)
{
numAdditionalSpawns = numAdditionalSpawns / 2;
}
int randomCount = GameManager.Instance.World.GetGameRandom().RandomRange(numSpawns, numSpawns + numAdditionalSpawns);
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B3 randomCount: " + randomCount);
numSpawns = randomCount;
}
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B3 numSpawns: " + numSpawns);
string bossClass = EntityClass.GetEntityClassName(entitiesBosses[random]);
while (bossClass.ToLower().Contains("stevecrawler") ||
bossClass.ToLower().Contains("fatcop") ||
bossClass.ToLower().Contains("zombie016") ||
bossClass.ToLower().Contains("kamikaze")
)
{
random = GameManager.Instance.World.GetGameRandom().RandomRange(0, entitiesBosses.Count);
bossClass = EntityClass.GetEntityClassName(entitiesBosses[random]);
}
string supportClasses = "";
List<int> excludeEntities = new List<int>();
excludeEntities.Add(entitiesBosses[random]);
if (entitiesSupport.Count > 0)
{
List<int> supportEntities = RebirthUtilities.GetEntityListInt(entitiesSupport, numSupportSpawns, excludeEntities, useDuplicates);
int count = 0;
foreach (int entityId in supportEntities)
{
string className = EntityClass.GetEntityClassName(entityId);
if (!className.ToLower().Contains("stevecrawler") &&
!className.ToLower().Contains("fatcop") &&
!className.ToLower().Contains("zombie016") &&
!className.ToLower().Contains("kamikaze")
)
{
if (count > 0)
{
supportClasses = supportClasses + "," + className;
}
else
{
supportClasses = className;
}
count++;
excludeEntities.Add(entityId);
}
}
}
string minionClasses = RebirthUtilities.GetEntityList(entitiesMinions, numSpawns, excludeEntities);
if (RebirthVariables.testEvents)
{
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, bossClass: " + bossClass);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, supportClasses: " + supportClasses);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, numSupportSpawns: " + numSupportSpawns);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, minionClasses: " + minionClasses);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive CHECK EVENTS, numSpawns: " + numSpawns);
RebirthVariables.testEvents = false;
RebirthVariables.testEventsCategory = 0;
}
// Boss
RebirthUtilities.SpawnEntity(__instance.entityId, bossClass, 1, "", "", "40", "static", "1", "", 1.5f, -1, true, false, true, __instance.entityId, -1, "", 1, 0, 40, 1, 0, 2, -1, "", bossCrate, 1, navIconBoss, buffBoss);
// Support
if (hasSupport && supportClasses != "")
{
if (spawnType == SpawnType.Zombies)
{
numSupportSpawns = 1; // Only one cycle, but all names
RebirthUtilities.SpawnEntity(__instance.entityId, supportClasses, 1, "", "", "40", "static", "1", "", 1.25f, -1, true, false, true, __instance.entityId, -1, "", -1, 0, 40, numSupportSpawns, 1, 99, -1, "", "ZombieLeaderTier1EntityLootContainer", 1, navIconSupport, buffSupport);
}
else
{
RebirthUtilities.SpawnEntity(__instance.entityId, supportClasses, 1, "", "", "40", "static", "1", "", 1.25f, -1, true, false, true, __instance.entityId, -1, "", -1, 0, 40, numSupportSpawns, 0, 99, -1, "", "ZombieLeaderTier1EntityLootContainer", 1, navIconSupport, buffSupport);
}
}
// Minions
RebirthUtilities.SpawnEntity(__instance.entityId, minionClasses, 1, "", "", "40", "static", "1", "", 1f, -1, true, false, true, __instance.entityId, -1, "", -1, 0, 40, numSpawns, 0, -1, -1, "", "", 1, navIconMinion, buffMinion);
numEvents++;
__instance.Buffs.SetCustomVar("$FuriousRamsayNumEvents", numEvents);
__instance.Buffs.SetCustomVar("$FuriousRamsayEventTotalCooldown", RebirthUtilities.GetEventCooldown(playerLevel, numEventsFrequency));
}
}
}
}
}
else if (!isActive)
{
//Log.Out("=========================================RESETTING EVENTS=========================================================");
__instance.Buffs.SetCustomVar("$FuriousRamsayNumEvents", 0f);
__instance.Buffs.SetCustomVar("$FuriousRamsayEventTotalCooldown", 0f);
}
}
__instance.Buffs.SetCustomVar("$FuriousRamsayEventCheck", Time.time);
//Log.Out("NUM EVENTS: " + __instance.Buffs.GetCustomVar("$FuriousRamsayNumEvents"));
}
}
return true;
}
}
}