Decompiled source of KillThemAll v0.1.4

KillThemAll.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using KillThemAll.Extras;
using KillThemAll.Hooks;
using KillThemAll.Managers;
using KillThemAll.Models;
using KillThemAll.Network;
using LethalBestiary.Modules;
using LethalLib.Modules;
using Newtonsoft.Json;
using RuntimeNetcodeRPCValidator;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
using UnityEngine.VFX;
using UnityEngine.VFX.Utility;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("KillThemAll")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KillThemAll")]
[assembly: AssemblyTitle("KillThemAll")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KillThemAll
{
	[BepInPlugin("KillThemAll.Main", "KillThemAll", "0.1.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class KillThemAll : BaseUnityPlugin
	{
		private const string modGUID = "KillThemAll.Main";

		private const string modName = "KillThemAll";

		private const string modVersion = "0.1.4";

		public static KillThemAll instance;

		public static AssetBundle hitMarkAsset;

		public static AssetBundle hitMarkSfxAsset;

		public static AssetBundle vfxBundle;

		public static AssetBundle playerReactionsSfxAsset;

		public static AssetBundle notificationAsset;

		public static AssetBundle tombstoneAsset;

		public static AssetBundle colliderTest;

		private readonly Harmony harmony = new Harmony("KillThemAll.Main");

		private NetcodeValidator netcodeValidator;

		private Dictionary<string, ConfigEntry<int>> enemyConfigEntries = new Dictionary<string, ConfigEntry<int>>();

		public ConfigEntry<string> TombSaveEntry;

		private void Awake()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			Utils.SetupLog();
			Utils.DebugLog("Awaking");
			LoadAssetBundles();
			harmony.PatchAll(typeof(VanillaHook));
			netcodeValidator = new NetcodeValidator("KillThemAll.Main");
			netcodeValidator.PatchAll();
			netcodeValidator.BindToPreExistingObjectByBehaviour<KillableEnemyEmitter, PlayerControllerB>();
			netcodeValidator.BindToPreExistingObjectByBehaviour<UIEmitter, PlayerControllerB>();
			netcodeValidator.BindToPreExistingObjectByBehaviour<TombScrapEmitter, PlayerControllerB>();
			netcodeValidator.BindToPreExistingObjectByBehaviour<OnSpawnEnemiesEmitter, PlayerControllerB>();
			Utils.DebugLog("Awaken");
		}

		public static List<Type> FindAllDerivedTypes<T>()
		{
			return FindAllDerivedTypes<T>(Assembly.GetAssembly(typeof(T)));
		}

		public static List<Type> FindAllDerivedTypes<T>(Assembly assembly)
		{
			Type baseType = typeof(T);
			return (from t in assembly.GetTypes()
				where t != baseType && baseType.IsAssignableFrom(t)
				select t).ToList();
		}

		public void Initialise()
		{
			AddKillThemAllBaseConfigs();
			AddBountyConfigs();
			Utils.DebugLog("Finding all base enemies...");
			List<string> list = new List<string>();
			List<Type> list2 = FindAllDerivedTypes<EnemyAI>();
			foreach (Type item in list2)
			{
				if (!(item.Name == "TestEnemy") && !(item.Name == "LassoMan"))
				{
					string name = item.Name;
					name = name.Replace("Enemy", "");
					name = name.Replace("(Clone)", "");
					name = name.Replace(".prefab", "");
					name = name.Replace("AI", "");
					Utils.DebugLog("Found enemy: " + name);
					list.Add(name);
				}
			}
			Utils.DebugLog("Finding all LethalLib enemies...");
			foreach (SpawnableEnemy spawnableEnemy in Enemies.spawnableEnemies)
			{
				string enemyName = spawnableEnemy.enemy.enemyName;
				enemyName = enemyName.Replace("Enemy", "");
				enemyName = enemyName.Replace("(Clone)", "");
				enemyName = enemyName.Replace(".prefab", "");
				enemyName = enemyName.Replace("AI", "");
				Utils.DebugLog("Found enemy from LethalLib: " + enemyName);
				list.Add(enemyName);
			}
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			directoryName.Replace("OLO-KillThemAll", "");
			directoryName += "TheWeavers-LethalBestiary/LethalBestiary/LethalBestiary.dll";
			Utils.DebugLog("Finding all LethalBestiary enemies...");
			foreach (SpawnableEnemy spawnableEnemy2 in Enemies.spawnableEnemies)
			{
				string enemyName2 = spawnableEnemy2.enemy.enemyName;
				enemyName2 = enemyName2.Replace("Enemy", "");
				enemyName2 = enemyName2.Replace("(Clone)", "");
				enemyName2 = enemyName2.Replace(".prefab", "");
				enemyName2 = enemyName2.Replace("AI", "");
				Utils.DebugLog("Found enemy from LethalBestiary: " + enemyName2);
				list.Add(enemyName2);
			}
			Utils.DebugLog("Creating config entries based on enemies found...");
			foreach (string item2 in list)
			{
				string text = "Enemy Health";
				string text2 = item2 + " Health";
				int num = 3;
				ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(text, text2, num, "Health points for " + item2 + "s");
				enemyConfigEntries.Add(item2, val);
				KillableEnemyManager.Instance.enemyHealthDictionary.Add(item2, val.Value);
				Utils.DebugLog("Config entry created for: " + item2);
			}
			foreach (KeyValuePair<string, ConfigEntry<int>> entry in enemyConfigEntries)
			{
				entry.Value.SettingChanged += delegate(object sender, EventArgs value)
				{
					if (sender is ConfigEntry<int> val2)
					{
						KillableEnemyManager.Instance.SetEnemyHealth(entry.Key, val2.Value);
						Utils.DebugLog("Saved health value for: " + entry.Key + " to: " + val2.Value);
					}
					else
					{
						Utils.DebugLog("ERROR: Tried to save config entry but entry = NULL");
					}
				};
			}
			Utils.DebugLog("Finished creating config entries based on enemies found!");
			TombSaveEntry = ((BaseUnityPlugin)this).Config.Bind<string>("!IGNORE THIS!", "Tomb Saving", "", "DO NOT DELETE");
		}

		public void AddKillThemAllBaseConfigs()
		{
			ConfigEntry<bool> debugLogEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("KillThemAll", "Debug Log", true, " if checked, log from this mod is output in the console");
			ConfigEntry<bool> showHitmarkVfxEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("KillThemAll", "Hit Marker", true, "If enabled, show hitmarker effect when damaging an enemy");
			ConfigEntry<bool> playHitmarkSfxEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("KillThemAll", "Hit Marker Sound Effect", true, "If enabled, play hitmarker sound effect when damaging an enemy");
			ConfigEntry<bool> playerReactionAKSfxEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("KillThemAll", "Player Reaction", true, "If enabled, play random sound effect when you or others kill an enemy (Its random if it plays or not)");
			ConfigEntry<bool> showEnemyDeathEffectEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("KillThemAll", "Enemy Death Effect", true, "If enabled, play enemy death effect");
			KillableEnemyManager.Instance.debugLog = debugLogEntry.Value;
			KillableEnemyManager.Instance.showHitmarkVfx = showHitmarkVfxEntry.Value;
			KillableEnemyManager.Instance.playHitmarkSfx = playHitmarkSfxEntry.Value;
			KillableEnemyManager.Instance.playerReactionAKSfx = playerReactionAKSfxEntry.Value;
			KillableEnemyManager.Instance.showEnemyDeathEffect = showEnemyDeathEffectEntry.Value;
			debugLogEntry.SettingChanged += delegate
			{
				KillableEnemyManager.Instance.debugLog = debugLogEntry.Value;
			};
			showHitmarkVfxEntry.SettingChanged += delegate
			{
				KillableEnemyManager.Instance.showHitmarkVfx = showHitmarkVfxEntry.Value;
			};
			playHitmarkSfxEntry.SettingChanged += delegate
			{
				KillableEnemyManager.Instance.playHitmarkSfx = playHitmarkSfxEntry.Value;
			};
			playerReactionAKSfxEntry.SettingChanged += delegate
			{
				KillableEnemyManager.Instance.playerReactionAKSfx = playerReactionAKSfxEntry.Value;
			};
			showEnemyDeathEffectEntry.SettingChanged += delegate
			{
				KillableEnemyManager.Instance.showEnemyDeathEffect = showEnemyDeathEffectEntry.Value;
			};
		}

		public void AddBountyConfigs()
		{
			ConfigEntry<int> chanceToSpawnPerRoundEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Rarity per round", 75, " Chance to spawn a bounty that round, the number is used like a percentage, the higher it is the higher the chances!");
			ConfigEntry<int> chanceToSpawnPerHourEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Rarity per hour", 50, " Chances to spawn a bounty every hour if one has not spawned yet, , the number is used like a percentage, the higher it is the higher the chances!");
			ConfigEntry<int> timeBetweenRetryingBountiesEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Retry per failed bounty", 2, " How many hours should it wait before retrying to spawn a bounty that failed the rarity check, In-game hours.");
			ConfigEntry<int> timeBetweenSuccesfulBountiesEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Time between next bounty", 4, " How many hours should it wait before spawning another bounty if possible, In-game hours.");
			ConfigEntry<int> bountiesPerRoundEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Bounties per round", 2, " How many bounties can spawn per round if they pass the rarity checks");
			ConfigEntry<int> spawnAfterHourEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Spawn after specific hour", 11, " Start spawning bounties after a specific hour, 0 = it will try and spawn from that start of the round, this uses a 24 hour clock.");
			ConfigEntry<int> rewardMultiplierEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Bounty Settings", "Reward Multiplier", 4, " This value determines the end reward value for a bounty kill, (Enemy Health * Base Reward) * Reward Multiplier = Credit Reward");
			ConfigEntry<int> baseKillRewardMultiplierEntry = ((BaseUnityPlugin)this).Config.Bind<int>("KillThemAll", "Base Reward Multiplier", 4, " This value determines the end reward value for a kill, Enemy Health * Base Reward Multiplier = Credit Reward");
			BountyManager.Instance.chanceToSpawnPerRound = chanceToSpawnPerRoundEntry.Value;
			BountyManager.Instance.chanceToSpawnPerHour = chanceToSpawnPerHourEntry.Value;
			BountyManager.Instance.timeBetweenRetryingBounties = timeBetweenRetryingBountiesEntry.Value;
			BountyManager.Instance.timeBetweenSuccesfulBounties = timeBetweenSuccesfulBountiesEntry.Value;
			BountyManager.Instance.bountiesPerRound = bountiesPerRoundEntry.Value;
			BountyManager.Instance.spawnAfterHour = spawnAfterHourEntry.Value;
			BountyManager.Instance.rewardMultiplier = rewardMultiplierEntry.Value;
			KillableEnemyManager.Instance.baseKillRewardMultiplier = baseKillRewardMultiplierEntry.Value;
			chanceToSpawnPerRoundEntry.SettingChanged += delegate
			{
				BountyManager.Instance.chanceToSpawnPerRound = chanceToSpawnPerRoundEntry.Value;
				Utils.DebugLog("BM: chanceToSpawnPerRound to: " + chanceToSpawnPerRoundEntry.Value);
			};
			chanceToSpawnPerHourEntry.SettingChanged += delegate
			{
				BountyManager.Instance.chanceToSpawnPerHour = chanceToSpawnPerHourEntry.Value;
				Utils.DebugLog("BM: chanceToSpawnPerHourEntry to: " + chanceToSpawnPerHourEntry.Value);
			};
			timeBetweenRetryingBountiesEntry.SettingChanged += delegate
			{
				BountyManager.Instance.timeBetweenRetryingBounties = timeBetweenRetryingBountiesEntry.Value;
				Utils.DebugLog("BM: timeBetweenRetryingBountiesEntry to: " + timeBetweenRetryingBountiesEntry.Value);
			};
			timeBetweenSuccesfulBountiesEntry.SettingChanged += delegate
			{
				BountyManager.Instance.timeBetweenSuccesfulBounties = timeBetweenSuccesfulBountiesEntry.Value;
				Utils.DebugLog("BM: timeBetweenSuccesfulBountiesEntry to: " + timeBetweenSuccesfulBountiesEntry.Value);
			};
			bountiesPerRoundEntry.SettingChanged += delegate
			{
				BountyManager.Instance.bountiesPerRound = bountiesPerRoundEntry.Value;
				Utils.DebugLog("BM: bountiesPerRoundEntry to: " + bountiesPerRoundEntry.Value);
			};
			spawnAfterHourEntry.SettingChanged += delegate
			{
				BountyManager.Instance.spawnAfterHour = spawnAfterHourEntry.Value;
				Utils.DebugLog("BM: spawnAfterHourEntry to: " + spawnAfterHourEntry.Value);
			};
			rewardMultiplierEntry.SettingChanged += delegate
			{
				BountyManager.Instance.rewardMultiplier = rewardMultiplierEntry.Value;
				Utils.DebugLog("BM: rewardMultiplierEntry to: " + rewardMultiplierEntry.Value);
			};
			baseKillRewardMultiplierEntry.SettingChanged += delegate
			{
				KillableEnemyManager.Instance.baseKillRewardMultiplier = baseKillRewardMultiplierEntry.Value;
			};
		}

		private void LoadAssetBundles()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			hitMarkAsset = AssetBundle.LoadFromFile(Path.Combine(directoryName, "hitmarkassetbundle"));
			if ((Object)(object)hitMarkAsset == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load hitMarkAsset asset bundles");
				return;
			}
			KillableEnemyManager.Instance.hitmarkHUD = hitMarkAsset.LoadAsset<GameObject>("HitmarkImg");
			if (Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.hitmarkHUD))
			{
				Utils.DebugLog("Successfully found object in assetbundle ( hitmark HUD obj) " + ((Object)KillableEnemyManager.Instance.hitmarkHUD).name);
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( hitmark HUD obj)");
			}
			hitMarkSfxAsset = AssetBundle.LoadFromFile(Path.Combine(directoryName, "hitmarksfxassetbundle"));
			if ((Object)(object)hitMarkSfxAsset == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load hit mark sfx asset bundles");
				return;
			}
			KillableEnemyManager.Instance.hitmarkSfx = new List<AudioClip>();
			KillableEnemyManager.Instance.hitmarkSfx = hitMarkSfxAsset.LoadAllAssets<AudioClip>().ToList();
			if (Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.hitmarkSfx[0]))
			{
				Utils.DebugLog("Successfully found object in assetbundle ( sfx hitmark )");
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( sfx hitmark )");
			}
			vfxBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "vfxbundle.assets"));
			if ((Object)(object)vfxBundle == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load enemyExplosionEffect asset bundles");
				return;
			}
			KillableEnemyManager.Instance.enemyDeathEffect = vfxBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/VFX/Blood.prefab");
			KillableEnemyManager.Instance.tombDropEffect = vfxBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/VFX/Smoke.prefab");
			KillableEnemyManager.Instance.enemyBountyEffect = vfxBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/VFX/BountyAura.prefab");
			if (Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.enemyDeathEffect) && Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.tombDropEffect) && Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.enemyBountyEffect))
			{
				Utils.DebugLog("Successfully found objects in vfx bundle");
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in vfx bundle");
			}
			playerReactionsSfxAsset = AssetBundle.LoadFromFile(Path.Combine(directoryName, "reactionsfxassetbundle"));
			if ((Object)(object)playerReactionsSfxAsset == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load hit mark sfx asset bundles");
				return;
			}
			KillableEnemyManager.Instance.playerReactionSfx = new List<AudioClip>();
			KillableEnemyManager.Instance.playerReactionSfx = playerReactionsSfxAsset.LoadAllAssets<AudioClip>().ToList();
			if (Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.playerReactionSfx[0]))
			{
				Utils.DebugLog("Successfully found object in assetbundle ( playerReactionsSfxAsset )");
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( playerReactionsSfxAsset )");
			}
			notificationAsset = AssetBundle.LoadFromFile(Path.Combine(directoryName, "notificationassetbundle"));
			if ((Object)(object)notificationAsset == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load notificationAsset bundles");
				return;
			}
			UIManager.Instance.notificationElementObj = notificationAsset.LoadAllAssets<GameObject>().ToList();
			if (Object.op_Implicit((Object)(object)UIManager.Instance.notificationElementObj[0]))
			{
				Utils.DebugLog("Successfully found object in assetbundle ( notification element obj) " + ((Object)UIManager.Instance.notificationElementObj[0]).name);
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( notification element obj)");
			}
			if (Object.op_Implicit((Object)(object)UIManager.Instance.notificationElementObj[1]))
			{
				Utils.DebugLog("Successfully found object in assetbundle ( notification top element obj) " + ((Object)UIManager.Instance.notificationElementObj[1]).name);
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( notification top element obj)");
			}
			tombstoneAsset = AssetBundle.LoadFromFile(Path.Combine(directoryName, "tombstoneassetbundle.assets"));
			if ((Object)(object)tombstoneAsset == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load tombstoneAsset bundles");
				return;
			}
			Item val = tombstoneAsset.LoadAsset<Item>("Assets/LethalCompany/Mods/Scraps/Tombstones/Tombstones.asset");
			if (Object.op_Implicit((Object)(object)val))
			{
				Utils.DebugLog("Successfully found object in assetbundle ( tombScrapAsset ) ");
				if (!Object.op_Implicit((Object)(object)val.spawnPrefab.GetComponent<TombScrap>()))
				{
					((Behaviour)val.spawnPrefab.AddComponent<TombScrap>()).enabled = false;
					((GrabbableObject)val.spawnPrefab.GetComponent<TombScrap>()).itemProperties = val;
					((GrabbableObject)val.spawnPrefab.GetComponent<TombScrap>()).itemProperties.saveItemVariable = true;
					Utils.DebugLog(" TombScrap added to prefab ");
				}
				else
				{
					Utils.DebugLog(" TombScrap already on prefab ");
					Utils.DebugLog("TombScrap is enabled: " + ((Behaviour)val.spawnPrefab.GetComponent<TombScrap>()).enabled);
				}
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( tombScrapAsset )");
			}
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterScrap(val, 0, (LevelTypes)(-1));
			Utilities.FixMixerGroups(val.spawnPrefab);
			KillableEnemyManager.Instance.enemyTomb = val;
			colliderTest = AssetBundle.LoadFromFile(Path.Combine(directoryName, "colidertest"));
			if ((Object)(object)colliderTest == (Object)null)
			{
				Utils.DebugLog("ERROR: Failed to load colidertest asset bundles");
				return;
			}
			KillableEnemyManager.Instance.colliderTest = colliderTest.LoadAsset<GameObject>("Cube");
			if (Object.op_Implicit((Object)(object)KillableEnemyManager.Instance.colliderTest))
			{
				Utils.DebugLog("Successfully found object in assetbundle( colliderTest cube )" + (object)KillableEnemyManager.Instance.colliderTest);
			}
			else
			{
				Utils.DebugLog("ERROR: Not found object in assetbundle ( colliderTest cube )");
			}
		}

		public void SaveTombScrapOnShip(string fileSave, int id, int meshIndex, int matIndex, string enemyName, string playerThatKilled)
		{
			if (isIdInJason(id))
			{
				Utils.DebugLog("Tomb with id: " + id + " already exists, skipping save!");
				return;
			}
			Tomb tomb = new Tomb(fileSave, id, meshIndex, matIndex, enemyName, playerThatKilled);
			string text = JsonConvert.SerializeObject((object)tomb, (Formatting)0);
			string value = TombSaveEntry.Value + ((TombSaveEntry.Value == "") ? text : ("|" + text));
			Utils.DebugLog("Saving tomb: " + id + ", json: " + text);
			TombSaveEntry.Value = value;
		}

		public Tomb GetTombById(int id, string fileSave)
		{
			if (TombSaveEntry.Value.StartsWith('|'))
			{
				TombSaveEntry.Value = TombSaveEntry.Value.Substring(1);
			}
			string[] array = TombSaveEntry.Value.Split('|');
			List<Tomb> list = new List<Tomb>();
			if (array.Length == 0)
			{
				return null;
			}
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (text == "")
				{
					continue;
				}
				Tomb tomb = JsonConvert.DeserializeObject<Tomb>(text);
				if (text.Length != 0)
				{
					if (tomb == null)
					{
						return null;
					}
					list.Add(tomb);
				}
			}
			if (list.Count > 0)
			{
				list.RemoveAll((Tomb t) => t.fileSave != fileSave);
				Tomb tomb2 = list.FirstOrDefault((Tomb t) => t.id == id);
				if (tomb2 != null)
				{
					string oldValue = JsonConvert.SerializeObject((object)tomb2);
					TombSaveEntry.Value = TombSaveEntry.Value.Replace(oldValue, "");
					TombSaveEntry.Value = TombSaveEntry.Value.Replace("||", "|");
				}
				return tomb2;
			}
			Utils.DebugLog("Zero saved tombs found, returning null!");
			return null;
		}

		public void OnDeleteGameSave(string fileSave)
		{
			if (TombSaveEntry.Value.StartsWith('|'))
			{
				TombSaveEntry.Value = TombSaveEntry.Value.Substring(1);
			}
			string[] array = TombSaveEntry.Value.Split('|');
			if (array.Length == 0)
			{
				return;
			}
			List<Tomb> list = new List<Tomb>();
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (text.Length != 0)
				{
					Tomb tomb = JsonConvert.DeserializeObject<Tomb>(text);
					if (tomb == null)
					{
						Utils.DebugLog("Can not deserialize object to save tomb object!");
						return;
					}
					list.Add(tomb);
				}
			}
			if (list.Count > 0)
			{
				list.RemoveAll((Tomb t) => t.fileSave != fileSave);
				{
					foreach (Tomb item in list)
					{
						string oldValue = JsonConvert.SerializeObject((object)item);
						TombSaveEntry.Value = TombSaveEntry.Value.Replace(oldValue, "");
						TombSaveEntry.Value = TombSaveEntry.Value.Replace("||", "|");
						Utils.DebugLog("Removed Tomb from: " + fileSave + ", Tomb id: " + item.id);
					}
					return;
				}
			}
			Utils.DebugLog("No tombs saved to delete on: " + fileSave);
		}

		public void RemoveSavedTombThatDontExist(string fileSave)
		{
			if (TombSaveEntry.Value.StartsWith('|'))
			{
				TombSaveEntry.Value = TombSaveEntry.Value.Substring(1);
			}
			string[] array = TombSaveEntry.Value.Split('|');
			if (array.Length == 0)
			{
				return;
			}
			List<TombScrap> list = Object.FindObjectsByType<TombScrap>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList();
			List<Tomb> list2 = new List<Tomb>();
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (text == "")
				{
					continue;
				}
				bool flag = false;
				Tomb tomb = JsonConvert.DeserializeObject<Tomb>(text);
				if (tomb == null)
				{
					return;
				}
				foreach (TombScrap item in list)
				{
					if (tomb.id == item.id)
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					list2.Add(tomb);
				}
			}
			if (list2.Count <= 0)
			{
				return;
			}
			list2.RemoveAll((Tomb t) => t.fileSave != fileSave);
			foreach (Tomb item2 in list2)
			{
				string oldValue = JsonConvert.SerializeObject((object)item2);
				TombSaveEntry.Value = TombSaveEntry.Value.Replace(oldValue, "");
				TombSaveEntry.Value = TombSaveEntry.Value.Replace("||", "|");
				Utils.DebugLog("Removed (NULL)Tomb from: " + fileSave + ", Tomb id: " + item2.id);
			}
		}

		public bool isIdInJason(int id)
		{
			return TombSaveEntry.Value.Contains(id.ToString());
		}
	}
	public class Tomb
	{
		public string fileSave;

		public int id;

		public int meshIndex;

		public int matIndex;

		public string enemyName;

		public string playerThatKilled;

		public Tomb(string fileSave, int id, int meshIndex, int matIndex, string enemyName, string playerThatKilled)
		{
			this.fileSave = fileSave;
			this.id = id;
			this.meshIndex = meshIndex;
			this.matIndex = matIndex;
			this.enemyName = enemyName;
			this.playerThatKilled = playerThatKilled;
		}
	}
}
namespace KillThemAll.Network
{
	public class KillableEnemyEmitter : NetworkBehaviour
	{
		[ServerRpc(RequireOwnership = false)]
		public void DoDamageServerRpc(ulong enemyObjectId, ulong playerObjectId, int damage)
		{
			DoDamageClientRpc(enemyObjectId, playerObjectId, damage);
		}

		[ServerRpc(RequireOwnership = false)]
		public void DoKillServerRpc(ulong objectId, ulong playerObjectId)
		{
			DoKillClientRpc(objectId, playerObjectId);
		}

		[ClientRpc]
		public void DoDamageClientRpc(ulong objectId, ulong playerObjectId, int damage)
		{
			KillableEnemyManager.Instance.OnEnemyHit(objectId, playerObjectId, damage);
		}

		[ClientRpc]
		public void DoKillClientRpc(ulong objectId, ulong playerObjectId)
		{
			KillableEnemyManager.Instance.OnEnemyDeath(objectId, playerObjectId);
		}
	}
	public class OnSpawnEnemiesEmitter : NetworkBehaviour
	{
		[ServerRpc(RequireOwnership = false)]
		public void AddObjectServerRpc(ulong enemyObjectId)
		{
			AddObjectClientRpc(enemyObjectId);
		}

		[ClientRpc]
		public void AddObjectClientRpc(ulong objectId)
		{
			SpawnEnemyManager.Instance.AddAuraToBounty(objectId);
		}
	}
	internal class TombScrapEmitter : NetworkBehaviour
	{
		[ServerRpc(RequireOwnership = false)]
		public void SpawnTombServerRpc(ulong enemyKilled_Id, ulong playerThatKilled_Id, ulong tombScrap_Id, int scrapValue, int mesh, int mat)
		{
			SpawnTombClientRpc(enemyKilled_Id, playerThatKilled_Id, tombScrap_Id, scrapValue, mesh, mat);
		}

		[ClientRpc]
		public void SpawnTombClientRpc(ulong enemyKilled_Id, ulong playerThatKilled_Id, ulong tombScrap_Id, int scrapValue, int mesh, int mat)
		{
			KillableEnemyManager.Instance.OnTombScrapSpawn(enemyKilled_Id, playerThatKilled_Id, tombScrap_Id, scrapValue, mesh, mat);
		}

		[ServerRpc]
		public void SendTombDataSaveServerRpc(ulong tombScrap_Id, string enemyKilled_Id, string playerKilled, int mesh, int mat)
		{
			SendTombDataSaveClientRpc(tombScrap_Id, enemyKilled_Id, playerKilled, mesh, mat);
		}

		[ClientRpc]
		public void SendTombDataSaveClientRpc(ulong tombScrap_Id, string enemyKilled_Id, string playerKilled, int mesh, int mat)
		{
			Utils.GetScrapObject(tombScrap_Id).GetComponent<TombScrap>().LoadItemSaveDataOnJoin(enemyKilled_Id, playerKilled, mesh, mat);
		}
	}
	internal class UIEmitter : NetworkBehaviour
	{
		[ServerRpc(RequireOwnership = false)]
		public void DoNotificationOnKillServerRpc(string enemyName, string playerThatKilledName, int rewardForKill, bool isBounty, int secondsOnScreen)
		{
			DoNotificationOnKillClientRpc(enemyName, playerThatKilledName, rewardForKill, isBounty, secondsOnScreen);
		}

		[ServerRpc(RequireOwnership = false)]
		public void DoNotificationOnBountyServerRpc(string enemyName, int rewardForKill, int secondsOnScreen)
		{
			DoNotificationOnBountyClientRpc(enemyName, rewardForKill, secondsOnScreen);
		}

		[ClientRpc]
		public void DoNotificationOnKillClientRpc(string enemyName, string playerThatKilledName, int rewardForKill, bool isBounty, int secondsOnScreen)
		{
			UIManager.Instance.ShowEnemyKilledNotfication(enemyName, playerThatKilledName, rewardForKill, isBounty, secondsOnScreen);
		}

		[ClientRpc]
		public void DoNotificationOnBountyClientRpc(string enemyName, int rewardForKill, int secondsOnScreen)
		{
			UIManager.Instance.ShowEnemyBountyNotfication(enemyName, rewardForKill, secondsOnScreen);
		}
	}
}
namespace KillThemAll.Models
{
	public class KillableEnemy : MonoBehaviour
	{
		private int startingHealth = 0;

		private int currentHealth = 0;

		private int reward = 0;

		private bool bounty = false;

		private ulong networkObjectId;

		private EnemyAI enemyAI;

		private GameObject collisionAIObject;

		public EnemyAI EnemyAI
		{
			get
			{
				return enemyAI;
			}
			set
			{
				enemyAI = value;
			}
		}

		public GameObject CollisionAIObject
		{
			get
			{
				return collisionAIObject;
			}
			set
			{
				collisionAIObject = value;
			}
		}

		public ulong NetworkObjectId
		{
			get
			{
				return networkObjectId;
			}
			set
			{
				networkObjectId = value;
			}
		}

		public int CurrentHealth
		{
			get
			{
				return currentHealth;
			}
			set
			{
				currentHealth = value;
			}
		}

		public int StartingHealth
		{
			get
			{
				return startingHealth;
			}
			set
			{
				startingHealth = value;
			}
		}

		public int Reward
		{
			get
			{
				return reward;
			}
			set
			{
				reward = value;
			}
		}

		public bool isBounty
		{
			get
			{
				return bounty;
			}
			set
			{
				bounty = value;
			}
		}

		public void DoDamage(int amount, ulong playerThatKilled_Id)
		{
			if (currentHealth != 0)
			{
				currentHealth -= amount;
				if (currentHealth < 0)
				{
					currentHealth = 0;
				}
				if (currentHealth == 0 && (((NetworkBehaviour)enemyAI).IsHost || ((NetworkBehaviour)enemyAI).IsServer))
				{
					((Behaviour)((Component)enemyAI).gameObject.GetComponentInChildren<EnemyAICollisionDetect>()).enabled = false;
					Utils.DebugLog("KillableEnemy: DoDamage() Enemy died sending ServerRPC");
					KillableEnemyManager.Instance.OnEnemyDeathPrepareServerRPC(((NetworkBehaviour)enemyAI).NetworkObjectId, playerThatKilled_Id);
				}
				else if (((NetworkBehaviour)enemyAI).IsHost || ((NetworkBehaviour)enemyAI).IsServer)
				{
					Utils.DebugLog("KillableEnemy: DoDamage() Enemy took damge sending ServerRPC");
					((Component)StartOfRound.Instance.allPlayerScripts[0]).gameObject.GetComponent<KillableEnemyEmitter>().DoDamageServerRpc(((NetworkBehaviour)enemyAI).NetworkObjectId, playerThatKilled_Id, amount);
				}
			}
		}

		public void DespawnEnemy()
		{
			((MonoBehaviour)this).StartCoroutine(DespawnEnemyOvertime());
		}

		public IEnumerator DespawnEnemyOvertime()
		{
			yield return (object)new WaitForSeconds(0.4f);
			if (Object.op_Implicit((Object)(object)((NetworkBehaviour)enemyAI).NetworkObject))
			{
				Utils.DebugLog("Despawning network object: " + ((Object)this).name);
				((NetworkBehaviour)enemyAI).NetworkObject.Despawn(true);
			}
		}
	}
	public enum EnemyType
	{
		default_
	}
}
namespace KillThemAll.Managers
{
	internal class BountyManager
	{
		public struct EnemyKilled
		{
			public string name;

			public string killerName;

			public bool wasBounty;

			public int reward;
		}

		private const string modGUID = "KillThemAll.BManager";

		private static BountyManager _instance;

		public Terminal __terminal;

		public bool isRoundActive = false;

		public int chanceToSpawnPerRound = 100;

		public int chanceToSpawnPerHour = 100;

		public int timeBetweenRetryingBounties = 1;

		public int timeBetweenSuccesfulBounties = 3;

		public int bountiesPerRound = 1;

		public int spawnAfterHour = 12;

		public int rewardMultiplier = 16;

		public bool isHost = false;

		private int bountiesSpawnedThisRound = 0;

		private int retryAtThisHour = 0;

		private bool shouldSpawnThisRound = false;

		private bool checkedIfItShouldSpawn = false;

		public List<EnemyKilled> enemyKilledList = new List<EnemyKilled>();

		private bool once = false;

		public static BountyManager Instance => _instance ?? (_instance = new BountyManager());

		static BountyManager()
		{
		}

		public void ServerUpdateOnRoundStart()
		{
			if (!checkedIfItShouldSpawn)
			{
				if (CheckIfBountyShouldSpawnThisRound())
				{
					Utils.DebugLog("Bounty will spawn this round!");
				}
				else
				{
					Utils.DebugLog("Bounty will not spawn this round!");
				}
				checkedIfItShouldSpawn = true;
			}
			if (!shouldSpawnThisRound || retryAtThisHour >= 24 || bountiesPerRound == 0 || bountiesSpawnedThisRound >= bountiesPerRound || Utils.GetTimeOfRound() < spawnAfterHour)
			{
				return;
			}
			if (Utils.GetTimeOfRound() >= retryAtThisHour)
			{
				Utils.DebugLog("Its time to try again and its: " + Utils.GetTimeOfRound());
				once = false;
				int num = Random.Range(0, 100);
				Utils.DebugLog("Chance = " + num + ", need below" + chanceToSpawnPerHour);
				if (num > chanceToSpawnPerHour)
				{
					retryAtThisHour = Utils.GetTimeOfRound() + timeBetweenRetryingBounties;
					Utils.DebugLog("Didnt pass rarity check retrying bounty at: " + retryAtThisHour);
				}
				else if (bountiesSpawnedThisRound < bountiesPerRound)
				{
					bountiesSpawnedThisRound++;
					retryAtThisHour = Utils.GetTimeOfRound() + timeBetweenSuccesfulBounties;
					Utils.DebugLog("Bounty spawned | count: " + bountiesSpawnedThisRound);
					Utils.DebugLog("Next spawn try at: " + retryAtThisHour);
					OnSpawnBounty();
				}
			}
			else if (!once)
			{
				Utils.DebugLog("Need to wait till " + retryAtThisHour + ", and its: " + Utils.GetTimeOfRound());
				once = true;
			}
		}

		public void ServerUpdateOnRoundEnd()
		{
			once = false;
			checkedIfItShouldSpawn = false;
			shouldSpawnThisRound = false;
			bountiesSpawnedThisRound = 0;
			retryAtThisHour = 0;
			enemyKilledList.Clear();
			Utils.DebugLog("ServerUpdateOnRoundEnd: resetting values");
		}

		public bool CheckIfBountyShouldSpawnThisRound()
		{
			int num = Random.Range(0, 100);
			return shouldSpawnThisRound = num <= chanceToSpawnPerRound;
		}

		public void OnSpawnBounty()
		{
			int reward = 0;
			string enemyName = SpawnEnemyManager.Instance.SpawnRandomEnemy(out reward);
			UIManager.Instance.PrepareOnBountyServerRPC_Notification(enemyName, reward);
		}

		public void SaveKilledEnemy(string name, string player, bool wasBounty, int reward)
		{
			EnemyKilled item = default(EnemyKilled);
			item.name = name;
			item.killerName = player;
			item.wasBounty = wasBounty;
			item.reward = reward;
			Utils.DebugLog("Added killed enemy: " + item.name + " that died by: " + item.killerName + " for " + item.reward + (item.wasBounty ? " and was a bounty" : " and was not a bounty"));
			enemyKilledList.Add(item);
		}

		private void GiveCreditsToCrew(int reward)
		{
			if (!Object.op_Implicit((Object)(object)__terminal))
			{
				Utils.DebugLog("ERROR: Reference to terminal is null! Cant give credits");
				return;
			}
			Terminal _terminal = __terminal;
			_terminal.groupCredits += reward;
			__terminal.SyncGroupCreditsServerRpc(__terminal.groupCredits, __terminal.numberOfItemsInDropship);
		}
	}
	internal class KillableEnemyManager
	{
		private const string modGUID = "KillThemAll.KEManager";

		private static KillableEnemyManager _instance;

		public Dictionary<string, int> enemyHealthDictionary = new Dictionary<string, int>();

		public PlayerControllerB localPlayer;

		public bool debugLog = true;

		public bool showHitmarkVfx = true;

		public bool playHitmarkSfx = true;

		public bool showEnemyDeathEffect = true;

		public bool playerReactionAKSfx = true;

		public int baseKillRewardMultiplier = 10;

		public Animator playerHitmarkAnimator;

		private AudioSource playerAudioSource;

		public GameObject hitmarkHUD;

		public List<AudioClip> hitmarkSfx;

		public GameObject enemyDeathEffect;

		public GameObject tombDropEffect;

		public GameObject enemyBountyEffect;

		public List<AudioClip> playerReactionSfx;

		public Item enemyTomb;

		public GameObject colliderTest;

		private GameObject hitMarkerHud;

		public static KillableEnemyManager Instance => _instance ?? (_instance = new KillableEnemyManager());

		public Dictionary<ulong, EnemyAI> NetworkObjectIDToEnemyAI { get; } = new Dictionary<ulong, EnemyAI>();


		public Dictionary<EnemyAI, ulong> EnemyAIToNetworkObjectID { get; } = new Dictionary<EnemyAI, ulong>();


		static KillableEnemyManager()
		{
		}

		public void SetEnemyHealth(string enemyName, int newHealth)
		{
			if (enemyHealthDictionary.ContainsKey(enemyName))
			{
				enemyHealthDictionary[enemyName] = newHealth;
			}
		}

		public void SetupHitmarkerHUD(PlayerControllerB __instance)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)__instance) || Object.op_Implicit((Object)(object)hitMarkerHud))
			{
				return;
			}
			localPlayer = __instance;
			Transform transform = GameObject.Find("Systems/UI/Canvas/PlayerCursor/Cursor").transform;
			if (!Object.op_Implicit((Object)(object)transform))
			{
				Utils.DebugLog("ERROR: SetupHitmarkerHUD() => parentCanvas = NULL");
				return;
			}
			hitMarkerHud = Object.Instantiate<GameObject>(hitmarkHUD, transform.parent, false);
			if (!Object.op_Implicit((Object)(object)hitMarkerHud))
			{
				Utils.DebugLog("ERROR: SetupHitmarkerHUD() => hitMarkerHudObject = NULL");
				return;
			}
			hitMarkerHud.SetActive(true);
			hitMarkerHud.transform.localScale = new Vector3(1f, 1f, 1f);
			playerHitmarkAnimator = hitMarkerHud.GetComponent<Animator>();
			if (!Object.op_Implicit((Object)(object)playerHitmarkAnimator))
			{
				Utils.DebugLog("ERROR: SetupHitmarkerHUD() => playerHitmarkAnimator = NULL");
				return;
			}
			playerHitmarkAnimator.speed = 1.9f;
			Utils.DebugLog("HUD Instantiated for local player: " + localPlayer.playerUsername);
		}

		public KillableEnemy AssignKillableClassToEnemy(EnemyAI __instance)
		{
			if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<KillableEnemy>()))
			{
				return ((Component)__instance).gameObject.GetComponent<KillableEnemy>();
			}
			int num = 10000;
			string name = ((Object)__instance).name;
			name = name.Replace("Enemy", "");
			name = name.Replace("(Clone)", "");
			name = name.Replace(".prefab", "");
			double num2 = 0.0;
			string text = "null";
			if (enemyHealthDictionary.Count == 0)
			{
				Utils.DebugLog("enemyHealthDictionary is empty");
			}
			foreach (KeyValuePair<string, int> item in enemyHealthDictionary)
			{
				double num3 = Utils.SimilarityRatio(name, item.Key);
				if (num3 > num2)
				{
					num2 = num3;
					if (item.Value > 0)
					{
						num = item.Value;
					}
					text = item.Key;
					Utils.DebugLog("Comparing name: " + name + ", against: " + item.Key + " | Similarity = " + num3);
				}
			}
			if (text == "null")
			{
				Utils.DebugLog("Not found similar name for: " + name + "!!!");
				return null;
			}
			KillableEnemy killableEnemy = InitializeKillableData(__instance);
			killableEnemy.StartingHealth = num;
			killableEnemy.CurrentHealth = num;
			killableEnemy.Reward = num * baseKillRewardMultiplier;
			killableEnemy.EnemyAI = __instance;
			killableEnemy.NetworkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId;
			killableEnemy.CollisionAIObject = ((Component)((Component)((Component)__instance).gameObject.transform.root).GetComponentInChildren<EnemyAICollisionDetect>()).gameObject;
			bool flag = false;
			MeshRenderer val = null;
			bool flag2 = false;
			Utils.DebugLog("Registering enemy: " + ((Object)((Component)__instance).gameObject).name + ", new HP: " + num);
			return killableEnemy;
		}

		private KillableEnemy InitializeKillableData(EnemyAI enemyAI)
		{
			EnemyAIToNetworkObjectID[enemyAI] = ((NetworkBehaviour)enemyAI).NetworkObjectId;
			NetworkObjectIDToEnemyAI[((NetworkBehaviour)enemyAI).NetworkObjectId] = enemyAI;
			return ((Component)enemyAI).gameObject.AddComponent<KillableEnemy>();
		}

		public void OnEnemyDeathPrepareServerRPC(ulong enemyHit_Id, ulong playerThatKilled_Id)
		{
			EnemyAI enemyAIClassFromNetID = Utils.GetEnemyAIClassFromNetID(enemyHit_Id);
			KillableEnemy component = ((Component)enemyAIClassFromNetID).GetComponent<KillableEnemy>();
			OnServerEnemyDropItem(enemyAIClassFromNetID);
			BountyManager.Instance.SaveKilledEnemy(Utils.GetEnemyName(enemyAIClassFromNetID), Utils.GetPlayerClassFromNetID(playerThatKilled_Id).playerUsername, component.isBounty, component.Reward);
			UIManager.Instance.PrepareOnKillServerRPC_Notification(((NetworkBehaviour)enemyAIClassFromNetID).NetworkObjectId, playerThatKilled_Id);
			((Component)StartOfRound.Instance.allPlayerScripts[0]).gameObject.GetComponent<KillableEnemyEmitter>().DoKillServerRpc(((NetworkBehaviour)enemyAIClassFromNetID).NetworkObjectId, playerThatKilled_Id);
		}

		private void OnServerEnemyDropItem(EnemyAI enemyAI)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)enemyAI).transform.position + new Vector3(0.2f, 5f, 0.2f);
			if (Object.op_Implicit((Object)(object)((Component)enemyAI).gameObject.GetComponent<NutcrackerEnemyAI>()))
			{
				Object.Instantiate<GameObject>(((Component)enemyAI).gameObject.GetComponent<NutcrackerEnemyAI>().gunPrefab, val, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false);
				val.x += 0.5f;
				val.z += 0.2f;
				Object.Instantiate<GameObject>(((Component)enemyAI).gameObject.GetComponent<NutcrackerEnemyAI>().shotgunShellPrefab, val, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false);
				val.z += 0.2f;
				Object.Instantiate<GameObject>(((Component)enemyAI).gameObject.GetComponent<NutcrackerEnemyAI>().shotgunShellPrefab, val, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false);
				Utils.DebugLog("Nutcracker Died: Spawned Shotgun and Ammo!");
			}
			if (Object.op_Implicit((Object)(object)((Component)enemyAI).gameObject.GetComponent<ButlerEnemyAI>()))
			{
				val.x += 0.5f;
				val.z += 0.5f;
				Object.Instantiate<GameObject>(((Component)enemyAI).gameObject.GetComponent<ButlerEnemyAI>().knifePrefab, val, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false);
				Utils.DebugLog("Butler Died: Spawned Knife!");
			}
		}

		public void OnEnemyHitPrepareServerRPC(ulong enemyHit_Id, ulong playerThatHit_Id, int damageHit)
		{
			EnemyAI enemyAIClassFromNetID = Utils.GetEnemyAIClassFromNetID(enemyHit_Id);
			if (Object.op_Implicit((Object)(object)enemyAIClassFromNetID))
			{
				KillableEnemy component = ((Component)enemyAIClassFromNetID).gameObject.GetComponent<KillableEnemy>();
				if ((Object)(object)component != (Object)null)
				{
					((Component)enemyAIClassFromNetID).gameObject.GetComponent<KillableEnemy>().DoDamage(damageHit, playerThatHit_Id);
				}
			}
		}

		public void OnEnemyHit(ulong enemyHit_Id, ulong playerThatHit_Id, int damageHit)
		{
			EnemyAI enemyAIClassFromNetID = Utils.GetEnemyAIClassFromNetID(enemyHit_Id);
			PlayerControllerB playerClassFromNetID = Utils.GetPlayerClassFromNetID(playerThatHit_Id);
			if (!Object.op_Implicit((Object)(object)enemyAIClassFromNetID))
			{
				Utils.DebugLog("ERROR: OnEnemyHit() => enemyAI = NULL");
				return;
			}
			if (!Object.op_Implicit((Object)(object)playerClassFromNetID))
			{
				Utils.DebugLog("ERROR: OnEnemyHit() => playerThatHit = NULL");
				return;
			}
			Utils.DebugLog("OnEnemyHit: " + ((Object)enemyAIClassFromNetID).name + " hit for " + damageHit + " damage! by: " + playerClassFromNetID.playerUsername);
		}

		public void OnEnemyDeath(ulong enemyKilled_Id, ulong playerThatKilled_Id)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			EnemyAI enemyAIClassFromNetID = Utils.GetEnemyAIClassFromNetID(enemyKilled_Id);
			PlayerControllerB playerClassFromNetID = Utils.GetPlayerClassFromNetID(playerThatKilled_Id);
			if (!Object.op_Implicit((Object)(object)enemyAIClassFromNetID))
			{
				Utils.DebugLog("ERROR: OnEnemyDeath() => enemyAI = NULL");
				return;
			}
			if (!Object.op_Implicit((Object)(object)playerClassFromNetID))
			{
				Utils.DebugLog("ERROR: OnEnemyDeath() => playerThatKilled = NULL");
				return;
			}
			enemyAIClassFromNetID.KillEnemy(false);
			if (Object.op_Implicit((Object)(object)enemyAIClassFromNetID.creatureSFX))
			{
				enemyAIClassFromNetID.creatureSFX.Stop();
			}
			if (Object.op_Implicit((Object)(object)enemyAIClassFromNetID.creatureVoice))
			{
				enemyAIClassFromNetID.creatureVoice.Stop();
			}
			if (showEnemyDeathEffect)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(((Component)enemyAIClassFromNetID).transform.position.x, ((Component)enemyAIClassFromNetID).transform.position.y + 2f, ((Component)enemyAIClassFromNetID).transform.position.z);
				GameObject val2 = Object.Instantiate<GameObject>(enemyDeathEffect, val, enemyDeathEffect.transform.rotation);
				val2.transform.localScale = val2.transform.localScale * 0.75f;
				val2.AddComponent<VfxDespawn>();
			}
			Utils.DebugLog("OnEnemyDeath: " + ((Object)enemyAIClassFromNetID).name + " Killed by " + playerClassFromNetID.playerUsername);
			PlayReactionAfterKillLocal(playerClassFromNetID);
			if (Utils.isHost)
			{
				KillableEnemy component = ((Component)enemyAIClassFromNetID).GetComponent<KillableEnemy>();
				Vector3 pos = default(Vector3);
				((Vector3)(ref pos))..ctor(((Component)enemyAIClassFromNetID).transform.position.x, ((Component)enemyAIClassFromNetID).transform.position.y + 2f, ((Component)enemyAIClassFromNetID).transform.position.z);
				Vector3 val3 = ((Component)playerClassFromNetID).transform.position - ((Component)enemyAIClassFromNetID).transform.position;
				val3.y = 0f;
				Quaternion rot = Quaternion.LookRotation(val3);
				ServerPrepareTombScrapSpawn(enemyKilled_Id, playerThatKilled_Id, component.Reward, pos, rot);
				component.DespawnEnemy();
			}
			((Component)enemyAIClassFromNetID).transform.position = new Vector3(((Component)enemyAIClassFromNetID).transform.position.x, -10000f, ((Component)enemyAIClassFromNetID).transform.position.z);
			Utils.DebugLog("Moved enemy more than 6feet under");
		}

		public void ServerPrepareTombScrapSpawn(ulong enemyKilled_Id, ulong playerThatKilled_Id, int scrapValue, Vector3 pos, Quaternion rot)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Utilities.FixMixerGroups(enemyTomb.spawnPrefab);
			GameObject val = Object.Instantiate<GameObject>(enemyTomb.spawnPrefab, pos, rot);
			int mesh = Random.Range(0, 3);
			int mat = Random.Range(0, 3);
			val.GetComponent<NetworkObject>().Spawn(false);
			Utils.DebugLog("KEM: ServerPrepareTombScrapSpawn() Sending Server RPC");
			((Component)StartOfRound.Instance.allPlayerScripts[0]).gameObject.GetComponent<TombScrapEmitter>().SpawnTombServerRpc(enemyKilled_Id, playerThatKilled_Id, val.GetComponent<NetworkObject>().NetworkObjectId, scrapValue, mesh, mat);
		}

		public void OnTombScrapSpawn(ulong enemyKilled_Id, ulong playerThatKilled_Id, ulong tombScrap_Id, int scrapValue, int mesh, int mat)
		{
			PlayerControllerB playerClassFromNetID = Utils.GetPlayerClassFromNetID(playerThatKilled_Id);
			GameObject scrapObject = Utils.GetScrapObject(tombScrap_Id);
			if (!Object.op_Implicit((Object)(object)scrapObject))
			{
				Utils.DebugLog("tombObj not found in spawned objects list");
			}
			if (!Object.op_Implicit((Object)(object)scrapObject.GetComponent<TombScrap>()))
			{
				Utils.DebugLog("TombScrap not found on: " + ((Object)scrapObject).name);
			}
			else
			{
				TombScrap component = scrapObject.GetComponent<TombScrap>();
				component.scrapVal = scrapValue;
				component.enemyName = Utils.GetEnemyName(enemyKilled_Id);
				component.playerName = playerClassFromNetID.playerUsername;
				component.meshIndex = mesh;
				component.matIndex = mat;
				component.OnSpawnInit();
			}
			Utils.DebugLog("Tombstone Spawned! Killer: " + playerClassFromNetID.playerUsername + ", Enemy: " + Utils.GetEnemyName(enemyKilled_Id));
		}

		public void PlayHitmarkerLocal(PlayerControllerB playerController)
		{
			if (playHitmarkSfx)
			{
				if (!Object.op_Implicit((Object)(object)hitmarkSfx[0]))
				{
					Utils.DebugLog("ERROR: PlayHitmarkerLocal() => hitmarkSfx[0] = NULL");
					return;
				}
				if (!Object.op_Implicit((Object)(object)playerAudioSource))
				{
					if (!Object.op_Implicit((Object)(object)playerController.movementAudio))
					{
						Utils.DebugLog("ERROR: PlayHitmarkerLocal() => playerController.movementAudio = NULL");
						return;
					}
					playerAudioSource = playerController.movementAudio;
				}
				playerAudioSource.PlayOneShot(hitmarkSfx[0], 3f);
				Utils.DebugLog("Play Hitmark sound effect on local client");
			}
			if (showHitmarkVfx)
			{
				if (!Object.op_Implicit((Object)(object)playerHitmarkAnimator))
				{
					Utils.DebugLog("ERROR: PlayHitmarkerLocal() => playerHitmarkAnimator = NULL");
					return;
				}
				playerHitmarkAnimator.Play("HitmarkAnim", 0, 0f);
				Utils.DebugLog("Play Hitmark effect on local client");
			}
		}

		public void PlayReactionAfterKillLocal(PlayerControllerB playerController)
		{
			if (playerReactionAKSfx)
			{
				if (!Object.op_Implicit((Object)(object)playerController))
				{
					Utils.DebugLog("ERROR: PlayReactionAfterKillLocal() => playerController = NULL");
					return;
				}
				if (!Object.op_Implicit((Object)(object)playerReactionSfx[0]))
				{
					Utils.DebugLog("ERROR: PlayReactionAfterKillLocal() => playerReactionSfx[0] = NULL");
					return;
				}
				if (!Object.op_Implicit((Object)(object)playerController.movementAudio))
				{
					Utils.DebugLog("ERROR: PlayReactionAfterKillLocal() => playerController.movementAudio = NULL");
					return;
				}
				playerController.movementAudio.PlayOneShot(playerReactionSfx[0], 1f);
				Utils.DebugLog("Playing reaction for killing an enemy: " + playerController.playerUsername);
			}
		}
	}
	internal class SpawnEnemyManager
	{
		public struct Enemy
		{
			public string name;

			public GameObject prefab;

			public bool isOutside;
		}

		private const string modGUID = "KillThemAll.SManager";

		private static SpawnEnemyManager _instance;

		public static List<Enemy> listOfSpawnableEnemies;

		public static SpawnEnemyManager Instance => _instance ?? (_instance = new SpawnEnemyManager());

		static SpawnEnemyManager()
		{
			listOfSpawnableEnemies = new List<Enemy>();
		}

		public string SpawnRandomEnemy(out int reward)
		{
			Enemy enemy = listOfSpawnableEnemies[Random.Range(0, listOfSpawnableEnemies.Count)];
			reward = SpawnEnemy(enemy);
			return enemy.name;
		}

		private int SpawnEnemy(Enemy enemy)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			zero = ((!enemy.isOutside) ? RoundManager.Instance.allEnemyVents[Random.Range(0, RoundManager.Instance.allEnemyVents.Length)].floorNode.position : RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length)].transform.position);
			if (!Object.op_Implicit((Object)(object)enemy.prefab))
			{
				Utils.DebugLog("enemy.prefab null");
			}
			GameObject val = Object.Instantiate<GameObject>(enemy.prefab, zero, Quaternion.identity);
			NetworkObject componentInChildren = val.GetComponentInChildren<NetworkObject>();
			componentInChildren.Spawn(true);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<KillableEnemy>()))
			{
				if (Object.op_Implicit((Object)(object)val.GetComponent<EnemyAI>()))
				{
					Utils.DebugLog("ERROR: Cant find EnemyAI Class on " + ((Object)val).name);
				}
				EnemyAI component = val.GetComponent<EnemyAI>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					Utils.DebugLog("ERROR: Cant find EnemyAI Class on " + ((Object)val).name);
					return 0;
				}
				KillableEnemy killableEnemy = KillableEnemyManager.Instance.AssignKillableClassToEnemy(component);
				killableEnemy.isBounty = true;
				killableEnemy.Reward = killableEnemy.StartingHealth * KillableEnemyManager.Instance.baseKillRewardMultiplier * BountyManager.Instance.rewardMultiplier;
				Utils.DebugLog("(had to attach KE class) spawned bounty: " + ((Object)val).name + ", reward: " + killableEnemy.Reward);
				((Component)StartOfRound.Instance.allPlayerScripts[0]).gameObject.GetComponent<OnSpawnEnemiesEmitter>().AddObjectServerRpc(componentInChildren.NetworkObjectId);
				return killableEnemy.Reward;
			}
			KillableEnemy component2 = val.GetComponent<KillableEnemy>();
			component2.isBounty = true;
			component2.Reward = component2.StartingHealth * KillableEnemyManager.Instance.baseKillRewardMultiplier * BountyManager.Instance.rewardMultiplier;
			Utils.DebugLog("(class already attached) spawned bounty: " + ((Object)val).name + ", reward: " + component2.Reward);
			((Component)StartOfRound.Instance.allPlayerScripts[0]).gameObject.GetComponent<OnSpawnEnemiesEmitter>().AddObjectServerRpc(componentInChildren.NetworkObjectId);
			return component2.Reward;
		}

		public void AddAuraToBounty(ulong enemy_Id)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			EnemyAI enemyAIClassFromNetID = Utils.GetEnemyAIClassFromNetID(enemy_Id);
			if (Object.op_Implicit((Object)(object)enemyAIClassFromNetID))
			{
				GameObject val = Object.Instantiate<GameObject>(KillableEnemyManager.Instance.enemyBountyEffect, Vector3.zero, Quaternion.identity);
				val.transform.SetParent(((Component)enemyAIClassFromNetID).transform, false);
				val.transform.localRotation = Quaternion.identity;
				val.transform.localPosition = Vector3.zero;
			}
			else
			{
				Utils.DebugLog("Could not find bounty enemy class to spawn aura!");
			}
		}
	}
	internal class UIManager
	{
		private const string modGUID = "KillThemAll.UIManager";

		private static UIManager _instance;

		public List<GameObject> notificationElementObj;

		private Transform topNotificationParent;

		private Transform sideNotificationParent;

		public static UIManager Instance => _instance ?? (_instance = new UIManager());

		static UIManager()
		{
		}

		public void PrepareOnKillServerRPC_Notification(ulong objectKilled_Id, ulong playerThatKilled_Id)
		{
			Utils.DebugLog("Preparing server rpc call for kill notification");
			KillableEnemy component = ((Component)GeneralExtensions.GetValueSafe<ulong, EnemyAI>(KillableEnemyManager.Instance.NetworkObjectIDToEnemyAI, objectKilled_Id)).gameObject.GetComponent<KillableEnemy>();
			string name = ((Object)((Component)component).gameObject).name;
			string playerUsername = Utils.GetPlayerClassFromNetID(playerThatKilled_Id).playerUsername;
			name = name.Replace("Enemy", "");
			name = name.Replace("(Clone)", "");
			name = name.Replace(".prefab", "");
			((Component)StartOfRound.Instance.allPlayerScripts[0]).GetComponent<UIEmitter>().DoNotificationOnKillServerRpc(name, playerUsername, component.Reward, component.isBounty, component.isBounty ? 6 : 4);
		}

		public void PrepareOnBountyServerRPC_Notification(string enemyName, int rewardAmount)
		{
			Utils.DebugLog("Preparing server rpc call for bounty notification");
			((Component)StartOfRound.Instance.allPlayerScripts[0]).GetComponent<UIEmitter>().DoNotificationOnBountyServerRpc(enemyName, rewardAmount, 8);
		}

		public void Initialise()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)sideNotificationParent))
			{
				GameObject val = new GameObject("SideNotificationParent");
				val.transform.SetParent(GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/Self").transform, false);
				VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
				((Component)val2).transform.localPosition = new Vector3(-30f, -75f, 0f);
				((Component)val2).transform.localScale = new Vector3(-0.2f, 0.2f, -0.2f);
				((HorizontalOrVerticalLayoutGroup)val2).spacing = 15f;
				((LayoutGroup)val2).childAlignment = (TextAnchor)4;
				((HorizontalOrVerticalLayoutGroup)val2).reverseArrangement = true;
				((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false;
				sideNotificationParent = val.transform;
				Utils.DebugLog("sideNotificationParent added " + ((Object)sideNotificationParent).name + ", its parent is " + ((Object)((Component)sideNotificationParent).transform.parent).name);
			}
			if (!Object.op_Implicit((Object)(object)topNotificationParent))
			{
				GameObject val3 = new GameObject("topNotificationParent");
				Transform parent = ((Component)HUDManager.Instance.Inventory.canvasGroup).transform.parent;
				val3.transform.SetParent(parent, false);
				VerticalLayoutGroup val4 = val3.AddComponent<VerticalLayoutGroup>();
				((Component)val4).transform.localPosition = new Vector3(0f, 150f, 0f);
				((Component)val4).transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
				((HorizontalOrVerticalLayoutGroup)val4).spacing = 15f;
				((LayoutGroup)val4).childAlignment = (TextAnchor)4;
				((HorizontalOrVerticalLayoutGroup)val4).reverseArrangement = true;
				((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = false;
				((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = false;
				topNotificationParent = val3.transform;
				Utils.DebugLog("topNotificationParent added " + ((Object)topNotificationParent).name + ", its parent is " + ((Object)((Component)topNotificationParent).transform.parent).name);
			}
		}

		public void ShowEnemyKilledNotfication(string enemyName, string playerThatKilledName, int rewardForKill, bool isBounty, int secondsOnScreen)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)sideNotificationParent))
			{
				Utils.DebugLog("ERROR: UIManager() => sideNotificationParent = NULL");
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(notificationElementObj[0], sideNotificationParent, false);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Utils.DebugLog("ERROR: UIManager() => notificationElement = NULL");
				return;
			}
			val.SetActive(true);
			val.transform.localPosition = new Vector3(0f, 0f, 0f);
			if (!isBounty)
			{
				((Component)val.transform.GetChild(0)).gameObject.SetActive(false);
				((Component)val.transform.GetChild(1)).GetComponent<TMP_Text>().fontSize = 50f;
				((Component)val.transform.GetChild(2)).GetComponent<TMP_Text>().fontSize = 50f;
				((Component)val.transform.GetChild(1)).GetComponent<TMP_Text>().text = playerThatKilledName + " killed " + enemyName;
				((Component)val.transform.GetChild(2)).GetComponent<TMP_Text>().text = "The Company values its tomb at " + rewardForKill;
				((Component)val.transform.GetChild(1)).gameObject.SetActive(true);
				((Component)val.transform.GetChild(2)).gameObject.SetActive(true);
			}
			else
			{
				((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>().fontSize = 55f;
				((Component)val.transform.GetChild(1)).GetComponent<TMP_Text>().fontSize = 45f;
				((Component)val.transform.GetChild(2)).GetComponent<TMP_Text>().fontSize = 38f;
				((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>().text = "BOUNTY " + enemyName.ToUpper() + " KILLED";
				((Component)val.transform.GetChild(1)).GetComponent<TMP_Text>().text = playerThatKilledName + " stompped it 6 feet down!";
				((Component)val.transform.GetChild(2)).GetComponent<TMP_Text>().text = "The Company values it at " + rewardForKill;
				((Component)val.transform.GetChild(0)).gameObject.SetActive(true);
				((Component)val.transform.GetChild(1)).gameObject.SetActive(true);
				((Component)val.transform.GetChild(2)).gameObject.SetActive(true);
			}
			Animator component = val.GetComponent<Animator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Utils.DebugLog("ERROR: UIManager() => notificationElementAnimator = NULL");
			}
			else
			{
				val.AddComponent<ElementDespawn>().StartTimer(secondsOnScreen, component);
			}
		}

		public void ShowEnemyBountyNotfication(string enemyName, int rewardForKill, int secondsOnScreen)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)topNotificationParent))
			{
				Utils.DebugLog("ERROR: UIManager() => topNotificationParent = NULL");
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(notificationElementObj[1], topNotificationParent, false);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Utils.DebugLog("ERROR: UIManager() => notificationElement = NULL");
				return;
			}
			val.SetActive(true);
			val.transform.localPosition = new Vector3(0f, 0f, 0f);
			((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>().fontSize = 80f;
			((Component)val.transform.GetChild(1)).GetComponent<TMP_Text>().fontSize = 50f;
			((Component)val.transform.GetChild(2)).GetComponent<TMP_Text>().fontSize = 50f;
			((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>().text = "bounty Has Awoken".ToUpper();
			((Component)val.transform.GetChild(1)).GetComponent<TMP_Text>().text = "Find and kill " + enemyName;
			((Component)val.transform.GetChild(2)).GetComponent<TMP_Text>().text = "The Company will reward with " + rewardForKill + " for its tomb!";
			((Component)val.transform.GetChild(0)).gameObject.SetActive(true);
			((Component)val.transform.GetChild(1)).gameObject.SetActive(true);
			((Component)val.transform.GetChild(2)).gameObject.SetActive(true);
			Animator component = val.GetComponent<Animator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Utils.DebugLog("ERROR: UIManager() => notificationElementAnimator = NULL");
			}
			else
			{
				val.AddComponent<ElementDespawn>().StartTimer(secondsOnScreen, component);
			}
		}
	}
}
namespace KillThemAll.Hooks
{
	internal class UnityHook
	{
		private const string modGUID = "KillThemAll.Unity";

		static UnityHook()
		{
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(NetworkManager), "DespawnObject")]
		private static void PrefixDespawn(NetworkSpawnManager __instance, NetworkObject networkObject, bool destroyObject)
		{
			if (Object.op_Implicit((Object)(object)networkObject))
			{
				EnemyAI component = ((Component)networkObject).GetComponent<EnemyAI>();
				if ((Object)(object)component != (Object)null)
				{
					KillableEnemyManager.Instance.EnemyAIToNetworkObjectID.Remove(component);
					KillableEnemyManager.Instance.NetworkObjectIDToEnemyAI.Remove(((NetworkBehaviour)component).NetworkObjectId);
					Utils.DebugLog("Removed " + ((Object)component).name + "'s network object");
				}
			}
		}
	}
	internal class VanillaHook
	{
		private const string modGUID = "KillThemAll.Vanilla";

		static VanillaHook()
		{
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		private static void GameNetworkManagerPostStart(GameNetworkManager __instance)
		{
			KillThemAll.instance.Initialise();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "SaveItemsInShip")]
		private static void SaveItemsInShipPost()
		{
			Utils.DebugLog("Items saved!------------------------");
			if (Utils.isHost)
			{
				KillThemAll.instance.RemoveSavedTombThatDontExist(GameNetworkManager.Instance.currentSaveFileName);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
		private static void OnClientConnectPostfix(ulong clientId)
		{
			if (!Utils.isHost)
			{
				return;
			}
			List<TombScrap> list = Object.FindObjectsByType<TombScrap>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList();
			foreach (TombScrap item in list)
			{
				ulong networkObjectId = ((Component)item).GetComponent<NetworkObject>().NetworkObjectId;
				((Component)StartOfRound.Instance.allPlayerScripts[0]).gameObject.GetComponent<TombScrapEmitter>().SendTombDataSaveServerRpc(networkObjectId, item.enemyName, item.playerName, item.meshIndex, item.matIndex);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DeleteFileButton), "DeleteFile")]
		private static void PrefixDeleteFileButton()
		{
			int fileToDelete = Object.FindAnyObjectByType<DeleteFileButton>().fileToDelete;
			if (1 == 0)
			{
			}
			string text = fileToDelete switch
			{
				0 => "LCSaveFile1", 
				1 => "LCSaveFile2", 
				2 => "LCSaveFile3", 
				_ => "LCSaveFile1", 
			};
			if (1 == 0)
			{
			}
			string text2 = text;
			KillThemAll.instance.OnDeleteGameSave(text2);
			Utils.DebugLog("Delete saved = " + text2);
		}

		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPrefix]
		private static void GetHost()
		{
			Utils.isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
			Utils.DebugLog("RoundManager start=> Round Started");
		}

		[HarmonyPatch(typeof(RoundManager), "Update")]
		[HarmonyPrefix]
		private static void OnRoundManagerUpdate()
		{
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance) && Utils.isHost && RoundManager.Instance.isSpawningEnemies && !StartOfRound.Instance.shipIsLeaving)
			{
				BountyManager.Instance.ServerUpdateOnRoundStart();
			}
		}

		[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
		[HarmonyPrefix]
		private static void OnRoundManagerEnd()
		{
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance) && Utils.isHost)
			{
				BountyManager.Instance.ServerUpdateOnRoundEnd();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		private static void PostfixStartPlayer(PlayerControllerB __instance)
		{
			if (Utils.IsLocalPlayer(__instance))
			{
				KillableEnemyManager.Instance.SetupHitmarkerHUD(__instance);
				UIManager.Instance.Initialise();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAI), "Start")]
		private static void PostfixStartEnemy(EnemyAI __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance) && Utils.isHost && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<KillableEnemy>()))
			{
				KillableEnemyManager.Instance.AssignKillableClassToEnemy(__instance);
				Utils.DebugLog("Assigned values on host?: " + Utils.isHost);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAI), "Update")]
		private static void PostfixUpdateEnemy(EnemyAI __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance) && Utils.isHost && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<KillableEnemy>()))
			{
				KillableEnemyManager.Instance.AssignKillableClassToEnemy(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAI), "HitEnemy")]
		private static void HitPostfix(EnemyAI __instance, int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
		{
			if (Object.op_Implicit((Object)(object)playerWhoHit))
			{
				if (Utils.IsLocalPlayer(playerWhoHit))
				{
					KillableEnemyManager.Instance.PlayHitmarkerLocal(playerWhoHit);
				}
				if (Utils.isHost)
				{
					Utils.DebugLog("Hook: OnEnemyHit() Prepare ServerRPC");
					KillableEnemyManager.Instance.OnEnemyHitPrepareServerRPC(((NetworkBehaviour)__instance).NetworkObjectId, ((NetworkBehaviour)playerWhoHit).NetworkObjectId, force);
				}
			}
		}

		[HarmonyPatch(typeof(Terminal), "Start")]
		[HarmonyPostfix]
		private static void GetAllEnemies(ref SelectableLevel[] ___moonsCatalogueList, Terminal __instance)
		{
			SelectableLevel[] array = ___moonsCatalogueList;
			SpawnEnemyManager.Enemy item = default(SpawnEnemyManager.Enemy);
			SelectableLevel[] array2 = array;
			foreach (SelectableLevel level in array2)
			{
				int e;
				for (e = 0; e < level.Enemies.Count; e++)
				{
					if (!SpawnEnemyManager.listOfSpawnableEnemies.Any((SpawnEnemyManager.Enemy x) => x.name == level.Enemies[e].enemyType.enemyName) && !(level.Enemies[e].enemyType.enemyName == "Lasso"))
					{
						item.name = level.Enemies[e].enemyType.enemyName;
						item.prefab = level.Enemies[e].enemyType.enemyPrefab;
						item.isOutside = level.Enemies[e].enemyType.isOutsideEnemy;
						Utils.DebugLog("Terminal start=> Enemy Found: " + item.name);
						SpawnEnemyManager.listOfSpawnableEnemies.Add(item);
					}
				}
				int i;
				for (i = 0; i < level.OutsideEnemies.Count; i++)
				{
					if (!SpawnEnemyManager.listOfSpawnableEnemies.Any((SpawnEnemyManager.Enemy x) => x.name == level.OutsideEnemies[i].enemyType.enemyName) && !(level.Enemies[i].enemyType.enemyName == "Lasso"))
					{
						item.name = level.OutsideEnemies[i].enemyType.enemyName;
						item.prefab = level.OutsideEnemies[i].enemyType.enemyPrefab;
						item.isOutside = level.OutsideEnemies[i].enemyType.isOutsideEnemy;
						Utils.DebugLog("Terminal start=> Enemy Found: " + item.name);
						SpawnEnemyManager.listOfSpawnableEnemies.Add(item);
					}
				}
			}
			BountyManager.Instance.__terminal = __instance;
			Utils.DebugLog("server BountyManager.Instance.__terminal " + (object)BountyManager.Instance.__terminal);
		}
	}
}
namespace KillThemAll.Extras
{
	internal class ElementDespawn : MonoBehaviour
	{
		private float waittimer = 3f;

		private Animator animator;

		private bool isPlayingEnd = false;

		public void StartTimer(float time, Animator animator)
		{
			Utils.DebugLog("StartTimer for despawn ui " + ((Object)this).name);
			waittimer = time;
			this.animator = animator;
		}

		private void Update()
		{
			waittimer -= Time.deltaTime;
			if (waittimer <= 0f && !isPlayingEnd)
			{
				animator.Play("NotificationEnd", 0);
				isPlayingEnd = true;
				waittimer = 1f;
			}
			else if (isPlayingEnd && waittimer <= 0f)
			{
				Utils.DebugLog("Destroying notificationElement");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class TombScrap : GrabbableObject
	{
		public bool HasJustSpawned = false;

		public int id = -1;

		public int meshIndex = -1;

		public int matIndex = -1;

		public int scrapVal = -1;

		public string enemyName = "";

		public string playerName = "";

		public void OnSpawnInit(bool saveLoaded = false)
		{
			base.fallTime = 1f;
			base.grabbable = true;
			base.isInFactory = true;
			base.grabbableToEnemies = true;
			if (saveLoaded)
			{
				base.scrapPersistedThroughRounds = true;
				base.isInElevator = true;
				base.isInShipRoom = true;
			}
			if (!Object.op_Implicit((Object)(object)base.itemProperties))
			{
				base.itemProperties = KillableEnemyManager.Instance.enemyTomb;
			}
			base.itemProperties.saveItemVariable = true;
			base.customGrabTooltip = "Grab Tomb : [E]";
			base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
			HasJustSpawned = true;
			if (id == -1)
			{
				id = Random.Range(0, 99999);
			}
			UpdateObject();
			((Behaviour)this).enabled = true;
		}

		public override int GetItemDataToSave()
		{
			KillThemAll.instance.SaveTombScrapOnShip(GameNetworkManager.Instance.currentSaveFileName, id, meshIndex, matIndex, enemyName, playerName);
			return id;
		}

		public override void LoadItemSaveData(int saveDataID)
		{
			Tomb tombById = KillThemAll.instance.GetTombById(saveDataID, GameNetworkManager.Instance.currentSaveFileName);
			if (tombById == null)
			{
				if (!Utils.isHost)
				{
					return;
				}
				Utils.DebugLog("not found saved tomb with id of: " + saveDataID);
			}
			enemyName = tombById.enemyName;
			playerName = tombById.playerThatKilled;
			meshIndex = tombById.meshIndex;
			matIndex = tombById.matIndex;
			Utils.DebugLog("Tomb saved loaded: " + saveDataID);
			OnSpawnInit(saveLoaded: true);
		}

		public void LoadItemSaveDataOnJoin(string enemyName, string playerName, int meshIndex, int matIndex)
		{
			if (!(this.enemyName != ""))
			{
				this.enemyName = enemyName;
				this.playerName = playerName;
				this.meshIndex = meshIndex;
				this.matIndex = matIndex;
				Utils.DebugLog("Tomb saved loaded");
				OnSpawnInit(saveLoaded: true);
			}
		}

		public override void Update()
		{
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentUseCooldown >= 0f)
			{
				base.currentUseCooldown -= Time.deltaTime;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.isBeingUsed && base.itemProperties.requiresBattery)
				{
					if (base.insertedBattery.charge > 0f)
					{
						if (!base.itemProperties.itemIsTrigger)
						{
							Battery insertedBattery = base.insertedBattery;
							insertedBattery.charge -= Time.deltaTime / base.itemProperties.batteryUsage;
						}
					}
					else if (!base.insertedBattery.empty)
					{
						base.insertedBattery.empty = true;
						if (base.isBeingUsed)
						{
							Debug.Log((object)"Use up batteries local");
							base.isBeingUsed = false;
							((GrabbableObject)this).UseUpBatteries();
						}
					}
				}
				if (!base.wasOwnerLastFrame)
				{
					base.wasOwnerLastFrame = true;
				}
			}
			else if (base.wasOwnerLastFrame)
			{
				base.wasOwnerLastFrame = false;
			}
			if (base.isHeld || !((Object)(object)base.parentObject == (Object)null))
			{
				return;
			}
			if (base.fallTime < 1f)
			{
				base.reachedFloorTarget = false;
				((GrabbableObject)this).FallWithCurve();
				if (((Component)this).transform.localPosition.y - base.targetFloorPosition.y < 0.1f && !base.hasHitGround)
				{
					((GrabbableObject)this).PlayDropSFX();
					((GrabbableObject)this).OnHitGround();
				}
				return;
			}
			if (!base.reachedFloorTarget)
			{
				base.reachedFloorTarget = true;
				if (base.floorYRot == -1)
				{
				}
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.y - 0.5f, ((Component)this).transform.position.z);
				GameObject val2 = Object.Instantiate<GameObject>(KillableEnemyManager.Instance.tombDropEffect, val, KillableEnemyManager.Instance.tombDropEffect.transform.rotation);
				val2.AddComponent<VfxDespawn>();
			}
			((Component)this).transform.localPosition = base.targetFloorPosition;
		}

		public override void FallWithCurve()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			float num = base.startFallingPosition.y - base.targetFloorPosition.y;
			if (!HasJustSpawned)
			{
				((Component)this).transform.rotation = Quaternion.Euler(base.itemProperties.restingRotation.x, (float)(base.floorYRot + base.itemProperties.floorYOffset) + 90f, base.itemProperties.restingRotation.z);
			}
			if (base.floorYRot == -1)
			{
			}
			if (num > 5f)
			{
				((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, StartOfRound.Instance.objectFallToGroundCurveNoBounce.Evaluate(base.fallTime));
			}
			else
			{
				((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, StartOfRound.Instance.objectFallToGroundCurve.Evaluate(base.fallTime));
			}
			base.fallTime += Mathf.Abs(Time.deltaTime * 6f / num);
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			if (HasJustSpawned)
			{
				HasJustSpawned = false;
			}
		}

		public void UpdateObject()
		{
			if (scrapVal != -1)
			{
				base.scrapValue = scrapVal;
			}
			((GrabbableObject)this).SetScrapValue(base.scrapValue);
			((Component)this).GetComponent<MeshFilter>().mesh = base.itemProperties.meshVariants[meshIndex];
			((Renderer)((Component)this).GetComponent<MeshRenderer>()).material = base.itemProperties.materialVariants[matIndex];
			Transform transform = ((Component)((Component)((Component)this).transform.GetChild(1)).transform.GetChild(0)).transform;
			((Component)transform.GetChild(0)).GetComponent<TMP_Text>().text = enemyName;
			((Component)transform.GetChild(2)).GetComponent<TMP_Text>().text = playerName;
		}
	}
	[VFXBinder("Transform/TransformBinder")]
	public class TransformBinder : VFXBinderBase
	{
		[VFXPropertyBinding(new string[] { "UnityEditor.VFX.Transform" })]
		[SerializeField]
		[FormerlySerializedAs("m_Parameter")]
		protected ExposedProperty m_Property = ExposedProperty.op_Implicit("Transform");

		public Transform Target = null;

		private ExposedProperty Position;

		private ExposedProperty Angles;

		private ExposedProperty Scale;

		public string Property
		{
			get
			{
				return (string)m_Property;
			}
			set
			{
				m_Property = ExposedProperty.op_Implicit(value);
				UpdateSubProperties();
			}
		}

		protected override void OnEnable()
		{
			((VFXBinderBase)this).OnEnable();
			UpdateSubProperties();
		}

		private void OnValidate()
		{
			UpdateSubProperties();
		}

		private void UpdateSubProperties()
		{
			Position = m_Property + ExposedProperty.op_Implicit("_position");
			Angles = m_Property + ExposedProperty.op_Implicit("_angles");
			Scale = m_Property + ExposedProperty.op_Implicit("_scale");
		}

		public override bool IsValid(VisualEffect component)
		{
			return (Object)(object)Target != (Object)null && component.HasVector3(ExposedProperty.op_Implicit(Position)) && component.HasVector3(ExposedProperty.op_Implicit(Angles)) && component.HasVector3(ExposedProperty.op_Implicit(Scale));
		}

		public override void UpdateBinding(VisualEffect component)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			component.SetVector3(ExposedProperty.op_Implicit(Position), Target.position);
			component.SetVector3(ExposedProperty.op_Implicit(Angles), Target.eulerAngles);
			component.SetVector3(ExposedProperty.op_Implicit(Scale), Target.localScale);
		}

		public override string ToString()
		{
			return string.Format("Transform : '{0}' -> {1}", m_Property, ((Object)(object)Target == (Object)null) ? "(null)" : ((Object)Target).name);
		}
	}
	internal class Utils
	{
		public static bool isHost;

		private static ManualLogSource mls;

		private const string modGUID = "KillThemAll";

		public static void SetupLog()
		{
			mls = Logger.CreateLogSource("KillThemAll");
		}

		public static void DebugLog(string log)
		{
			if (KillableEnemyManager.Instance.debugLog)
			{
				mls.LogInfo((object)("--KillThemAll | " + log));
			}
		}

		public static bool IsLocalPlayer(PlayerControllerB playerControllerClass)
		{
			return (Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)playerControllerClass;
		}

		internal static void DebugLog(object p)
		{
			throw new NotImplementedException();
		}

		public static PlayerControllerB GetPlayerClassFromNetID(ulong clientID)
		{
			if (clientID < 0 || !Object.op_Implicit((Object)(object)NetworkManager.Singleton) || !Object.op_Implicit((Object)(object)((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[clientID]).gameObject))
			{
				return null;
			}
			return ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[clientID]).gameObject.GetComponent<PlayerControllerB>();
		}

		public static EnemyAI GetEnemyAIClassFromNetID(ulong enemyID)
		{
			if (enemyID < 0 || !Object.op_Implicit((Object)(object)NetworkManager.Singleton) || !Object.op_Implicit((Object)(object)((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[enemyID]).gameObject))
			{
				return null;
			}
			return ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[enemyID]).gameObject.GetComponent<EnemyAI>();
		}

		public static string GetEnemyName(ulong enemyID)
		{
			if (enemyID < 0 || !Object.op_Implicit((Object)(object)NetworkManager.Singleton) || !Object.op_Implicit((Object)(object)((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[enemyID]).gameObject))
			{
				return null;
			}
			EnemyAI component = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[enemyID]).gameObject.GetComponent<EnemyAI>();
			string name = ((Object)component).name;
			name = name.Replace("Enemy", "");
			name = name.Replace("(Clone)", "");
			name = name.Replace(".prefab", "");
			name = name.Replace("default_", "");
			name = name.Replace("Obj", "");
			name = name.Replace("(", "");
			return name.Replace(")", "");
		}

		public static string GetEnemyName(EnemyAI enemyClass)
		{
			string name = ((Object)enemyClass).name;
			name = name.Replace("Enemy", "");
			name = name.Replace("(Clone)", "");
			name = name.Replace(".prefab", "");
			name = name.Replace("default_", "");
			name = name.Replace("Obj", "");
			name = name.Replace("(", "");
			return name.Replace(")", "");
		}

		public static double SimilarityRatio(string str1, string str2)
		{
			int num = LevenshteinDistance(str1, str2);
			int num2 = Math.Max(str1.Length, str2.Length);
			return 1.0 - (double)num / (double)num2;
		}

		public static int LevenshteinDistance(string str1, string str2)
		{
			int[,] array = new int[str1.Length + 1, str2.Length + 1];
			for (int i = 0; i <= str1.Length; i++)
			{
				for (int j = 0; j <= str2.Length; j++)
				{
					if (i == 0)
					{
						array[i, j] = j;
						continue;
					}
					if (j == 0)
					{
						array[i, j] = i;
						continue;
					}
					int num = ((str1[i - 1] != str2[j - 1]) ? 1 : 0);
					array[i, j] = Math.Min(array[i - 1, j] + 1, Math.Min(array[i, j - 1] + 1, array[i - 1, j - 1] + num));
				}
			}
			return array[str1.Length, str2.Length];
		}

		public static GameObject GetScrapObject(ulong scrapID)
		{
			if (scrapID < 0 || !Object.op_Implicit((Object)(object)NetworkManager.Singleton) || !Object.op_Implicit((Object)(object)((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[scrapID]).gameObject))
			{
				DebugLog("Scrap ID: " + scrapID + " Not found or Network Manager does not exist");
				return null;
			}
			return ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[scrapID]).gameObject;
		}

		public static int GetTimeOfRound()
		{
			int num = (int)(TimeOfDay.Instance.normalizedTimeOfDay * (60f * (float)TimeOfDay.Instance.numberOfHours)) + 360;
			return (int)Mathf.Floor((float)(num / 60));
		}
	}
	public class VfxDespawn : MonoBehaviour
	{
		private float waittimer = 3f;

		private void Start()
		{
			waittimer = 3f;
		}

		private void Update()
		{
			waittimer -= Time.deltaTime;
			if (waittimer <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
}