Decompiled source of CoDZ Multiplayer v1.0.0
CoDZ_Multiplayer.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using Atlas; using Atlas.MappingComponents.Sandbox; using BepInEx; using BepInEx.Logging; using CustomScripts; using CustomScripts.Gamemode; using CustomScripts.Gamemode.GMDebug; using CustomScripts.Managers; using CustomScripts.Multiplayer; using CustomScripts.Objects; using CustomScripts.Objects.Weapons; using CustomScripts.Player; using CustomScripts.Powerups; using CustomScripts.Powerups.Perks; using CustomScripts.Zombie; using FistVR; using H3MP; using H3MP.Networking; using H3MP.Scripts; using HarmonyLib; using OtherLoader; using Sodalite.Api; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using Valve.VR; [assembly: AssemblyTitle("CustomScripts")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CustomScripts")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7ac675fa-8ffe-4c1b-8787-a764e1845c24")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CustomScripts { [RequireComponent(typeof(IPurchasable))] public class CanPurchaseTextChanger : MonoBehaviour { private IPurchasable _purchasable; private IRequiresPower _requiresPower; [SerializeField] private List<Text> _texts; private void Start() { _purchasable = ((Component)this).GetComponent<IPurchasable>(); _requiresPower = ((Component)this).GetComponent<IRequiresPower>(); GMgr.OnPointsChanged = (Action)Delegate.Combine(GMgr.OnPointsChanged, new Action(UpdateTexts)); GMgr.OnPowerEnabled = (Action)Delegate.Combine(GMgr.OnPowerEnabled, new Action(UpdateTexts)); UpdateTexts(); } private void UpdateTexts() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (_requiresPower != null && !_requiresPower.IsPowered) { for (int i = 0; i < _texts.Count; i++) { _texts[i].text = "No power"; ((Graphic)_texts[i]).color = MonoBehaviourSingleton<GameRefs>.Instance.CannotBuyColor; } } else if (_purchasable.IsOneTimeOnly && _purchasable.AlreadyBought) { for (int j = 0; j < _texts.Count; j++) { _texts[j].text = "Out of stock"; ((Graphic)_texts[j]).color = MonoBehaviourSingleton<GameRefs>.Instance.CannotBuyColor; } } else if (MonoBehaviourSingleton<GMgr>.Instance.Points >= _purchasable.PurchaseCost) { for (int k = 0; k < _texts.Count; k++) { Text obj = _texts[k]; string text = _purchasable.PurchaseCost.ToString(); _texts[k].text = text; obj.text = text; ((Graphic)_texts[k]).color = MonoBehaviourSingleton<GameRefs>.Instance.CanBuyColor; } } else { for (int l = 0; l < _texts.Count; l++) { Text obj2 = _texts[l]; string text = _purchasable.PurchaseCost.ToString(); _texts[l].text = text; obj2.text = text; ((Graphic)_texts[l]).color = MonoBehaviourSingleton<GameRefs>.Instance.CannotBuyColor; } } } private void OnDestroy() { GMgr.OnPointsChanged = (Action)Delegate.Remove(GMgr.OnPointsChanged, new Action(UpdateTexts)); GMgr.OnPowerEnabled = (Action)Delegate.Remove(GMgr.OnPowerEnabled, new Action(UpdateTexts)); } } } namespace CustomScripts.Gamemode.GMDebug { public class CheatItemSpawner : MonoBehaviour { private void Awake() { RoundManager.OnGameStarted = (Action)Delegate.Combine(RoundManager.OnGameStarted, new Action(TrySpawning)); } private void OnDrawGizmos() { //IL_0015: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0.4f, 0.4f, 0.9f, 0.5f); Gizmos.matrix = ((Component)this).transform.localToWorldMatrix; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 0.7f, 0.25f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(2.3f, 1.2f, 0.5f); Vector3 forward = Vector3.forward; Gizmos.DrawCube(val, val2); Gizmos.DrawLine(val, val + forward * 0.5f); } public void TrySpawning() { if (GameSettings.ItemSpawnerEnabled) { ((MonoBehaviour)this).StartCoroutine(InitializeAsync()); } } private IEnumerator InitializeAsync() { yield return null; GameObject itemSpawner = IM.Prefab_ItemSpawner; Object.Instantiate<GameObject>(itemSpawner, ((Component)this).transform.position, ((Component)this).transform.rotation).SetActive(true); Object.Destroy((Object)(object)this); } private void OnDestroy() { RoundManager.OnGameStarted = (Action)Delegate.Remove(RoundManager.OnGameStarted, new Action(TrySpawning)); } } } namespace CustomScripts { public static class Delegates { public delegate void VoidDelegate(); } public static class Extensions { public static void Shuffle<T>(this IList<T> list) { Random random = new Random(); int num = list.Count; while (num > 1) { num--; int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } public interface IModifier { void ApplyModifier(); } public interface IPowerUp : IModifier { void Spawn(Vector3 pos); } public abstract class PowerUp : MonoBehaviour, IPowerUp, IModifier { public AudioClip ApplyAudio; public abstract void ApplyModifier(); public abstract void OnCollect(); public abstract void Spawn(Vector3 pos); public void SyncData() { if (!Networking.IsSolo()) { int indexOf = MonoBehaviourSingleton<PowerUpManager>.Instance.GetIndexOf(this); if (Networking.IsHostOrSolo()) { MonoBehaviourSingleton<CodZNetworking>.Instance.PowerUpCollected_Send(indexOf); } else { MonoBehaviourSingleton<CodZNetworking>.Instance.Client_PowerUpCollected_Send(indexOf); } } } } public interface IPurchasable { int PurchaseCost { get; } bool IsOneTimeOnly { get; } bool AlreadyBought { get; } } public interface IRequiresPower { bool IsPowered { get; } } public interface ITrap { void OnEnemyEntered(ZombieController controller); } public class MonoBehaviourSingleton<T> : MonoBehaviour where T : Component { public static T Instance { get; private set; } public virtual void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = (T)(object)((this is T) ? this : null); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class Speech : MonoBehaviour { public AudioClip RaygunRolled; public AudioClip T33Rolled; public AudioClip JuggernogConsumed; public AudioClip GettingHit; public AudioClip BeingRevived; public AudioClip BuyingStaminUp; public AudioClip DoublePointsPickedUp; public AudioClip UsingPackAPunch; public AudioClip Barricading; public AudioClip RoundEnd; public AudioClip StartingGame; public AudioClip SwitchingPower; private void Awake() { MysteryBox.WeaponSpawnedEvent = (Action<WeaponData>)Delegate.Combine(MysteryBox.WeaponSpawnedEvent, new Action<WeaponData>(OnWeaponSpawned)); JuggerNogPerkBottle.ConsumedEvent = (Action)Delegate.Combine(JuggerNogPerkBottle.ConsumedEvent, new Action(OnJuggernogConsumed)); StaminUpPerkBottle.ConsumedEvent = (Action)Delegate.Combine(StaminUpPerkBottle.ConsumedEvent, new Action(OnStaminUpConsumed)); PlayerData.GettingHitEvent = (Action)Delegate.Combine(PlayerData.GettingHitEvent, new Action(OnGettingHit)); PlayerSpawner.BeingRevivedEvent = (Action)Delegate.Combine(PlayerSpawner.BeingRevivedEvent, new Action(OnBeingRevived)); PowerUpDoublePoints.PickedUpEvent = (Action)Delegate.Combine(PowerUpDoublePoints.PickedUpEvent, new Action(OnDoublePointsPickedUp)); PackAPunch.PurchaseEvent = (Action)Delegate.Combine(PackAPunch.PurchaseEvent, new Action(OnPackAPunchPurchase)); RoundManager.OnRoundChanged = (Action)Delegate.Combine(RoundManager.OnRoundChanged, new Action(OnRoundChanged)); RoundManager.OnGameStarted = (Action)Delegate.Combine(RoundManager.OnGameStarted, new Action(OnGameStarted)); GMgr.OnPowerEnabled = (Action)Delegate.Combine(GMgr.OnPowerEnabled, new Action(OnPowerTurnedOn)); } private void Start() { Window.BarricadedEvent = (Action)Delegate.Combine(Window.BarricadedEvent, new Action(OnBarricading)); } private void OnGameStarted() { if (Random.Range(0, 2000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(StartingGame, 0.5f, 9f); RoundManager.OnGameStarted = (Action)Delegate.Remove(RoundManager.OnGameStarted, new Action(OnGameStarted)); } } private void OnRoundChanged() { if (Random.Range(0, 2500) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(RoundEnd, 0.5f, 9f); RoundManager.OnRoundChanged = (Action)Delegate.Remove(RoundManager.OnRoundChanged, new Action(OnRoundChanged)); } } private void OnBarricading() { if (Random.Range(0, 3000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(Barricading, 0.5f, 1f); Window.BarricadedEvent = (Action)Delegate.Remove(Window.BarricadedEvent, new Action(OnBarricading)); } } private void OnPackAPunchPurchase() { if (Random.Range(0, 1500) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(UsingPackAPunch, 0.5f, 1f); PackAPunch.PurchaseEvent = (Action)Delegate.Remove(PackAPunch.PurchaseEvent, new Action(OnPackAPunchPurchase)); } } private void OnWeaponSpawned(WeaponData weapon) { if (Random.Range(0, 850) == 0) { if (weapon.Id == "aftr_raygunmk1") { MonoBehaviourSingleton<AudioManager>.Instance.Play(RaygunRolled, 0.5f); MysteryBox.WeaponSpawnedEvent = (Action<WeaponData>)Delegate.Remove(MysteryBox.WeaponSpawnedEvent, new Action<WeaponData>(OnWeaponSpawned)); } if (weapon.Id == "TT33") { MonoBehaviourSingleton<AudioManager>.Instance.Play(T33Rolled, 0.5f); MysteryBox.WeaponSpawnedEvent = (Action<WeaponData>)Delegate.Remove(MysteryBox.WeaponSpawnedEvent, new Action<WeaponData>(OnWeaponSpawned)); } } } private void OnJuggernogConsumed() { if (Random.Range(0, 1000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(JuggernogConsumed, 0.5f, 3f); JuggerNogPerkBottle.ConsumedEvent = (Action)Delegate.Remove(JuggerNogPerkBottle.ConsumedEvent, new Action(OnJuggernogConsumed)); } } private void OnStaminUpConsumed() { if (Random.Range(0, 1000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(BuyingStaminUp, 0.5f, 3f); StaminUpPerkBottle.ConsumedEvent = (Action)Delegate.Remove(StaminUpPerkBottle.ConsumedEvent, new Action(OnStaminUpConsumed)); } } private void OnGettingHit() { if (Random.Range(0, 2000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(GettingHit, 0.5f, 1f); PlayerData.GettingHitEvent = (Action)Delegate.Remove(PlayerData.GettingHitEvent, new Action(OnGettingHit)); } } private void OnBeingRevived() { if (Random.Range(0, 1000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(BeingRevived, 0.5f, 1f); PlayerSpawner.BeingRevivedEvent = (Action)Delegate.Remove(PlayerSpawner.BeingRevivedEvent, new Action(OnBeingRevived)); } } private void OnDoublePointsPickedUp() { if (Random.Range(0, 1500) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(DoublePointsPickedUp, 0.5f, 1.5f); PowerUpDoublePoints.PickedUpEvent = (Action)Delegate.Remove(PowerUpDoublePoints.PickedUpEvent, new Action(OnDoublePointsPickedUp)); } } private void OnPowerTurnedOn() { if (Random.Range(0, 1000) == 0) { MonoBehaviourSingleton<AudioManager>.Instance.Play(SwitchingPower, 0.5f, 1.5f); GMgr.OnPowerEnabled = (Action)Delegate.Remove(GMgr.OnPowerEnabled, new Action(OnPowerTurnedOn)); } } private void OnDestroy() { MysteryBox.WeaponSpawnedEvent = (Action<WeaponData>)Delegate.Remove(MysteryBox.WeaponSpawnedEvent, new Action<WeaponData>(OnWeaponSpawned)); JuggerNogPerkBottle.ConsumedEvent = (Action)Delegate.Remove(JuggerNogPerkBottle.ConsumedEvent, new Action(OnJuggernogConsumed)); StaminUpPerkBottle.ConsumedEvent = (Action)Delegate.Remove(StaminUpPerkBottle.ConsumedEvent, new Action(OnStaminUpConsumed)); PlayerData.GettingHitEvent = (Action)Delegate.Remove(PlayerData.GettingHitEvent, new Action(OnGettingHit)); PlayerSpawner.BeingRevivedEvent = (Action)Delegate.Remove(PlayerSpawner.BeingRevivedEvent, new Action(OnBeingRevived)); PowerUpDoublePoints.PickedUpEvent = (Action)Delegate.Remove(PowerUpDoublePoints.PickedUpEvent, new Action(OnDoublePointsPickedUp)); PackAPunch.PurchaseEvent = (Action)Delegate.Remove(PackAPunch.PurchaseEvent, new Action(OnPackAPunchPurchase)); Window.BarricadedEvent = (Action)Delegate.Remove(Window.BarricadedEvent, new Action(OnBarricading)); RoundManager.OnRoundChanged = (Action)Delegate.Remove(RoundManager.OnRoundChanged, new Action(OnRoundChanged)); RoundManager.OnGameStarted = (Action)Delegate.Remove(RoundManager.OnGameStarted, new Action(OnGameStarted)); GMgr.OnPowerEnabled = (Action)Delegate.Remove(GMgr.OnPowerEnabled, new Action(OnPowerTurnedOn)); } } public class StartSpawner : MonoBehaviour { public ItemSpawner WeaponSpawner; public ItemSpawner AmmoSpawner; public void Spawn() { WeaponSpawner.SpawnItem(); AmmoSpawner.SpawnItem(); } } } namespace CustomScripts.Gamemode.GMDebug { public class CustomItemSpawner : MonoBehaviour { public string ObjectId; [HideInInspector] public GameObject SpawnedObject; private void OnDrawGizmos() { //IL_0015: 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_002f: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0f, 0f, 0.6f, 0.5f); Gizmos.matrix = ((Component)this).transform.localToWorldMatrix; Gizmos.DrawSphere(Vector3.zero, 0.1f); } public GameObject Spawn() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) FVRObject val = IM.OD[ObjectId]; GameObject gameObject = ((AnvilAsset)val).GetGameObject(); GameObject val2 = Object.Instantiate<GameObject>(gameObject, ((Component)this).transform.position, ((Component)this).transform.rotation); val2.SetActive(true); SpawnedObject = val2; return val2; } } } public class DisableOnAwake : MonoBehaviour { private void Awake() { ((Component)this).gameObject.SetActive(false); } } namespace CustomScripts.Gamemode.GMDebug { public class ErrorShower : MonoBehaviourSingleton<ErrorShower> { public Text ErrorText; public void Show(string message) { ErrorText.text = message; ((Component)ErrorText).gameObject.SetActive(true); } } public class CustomDebug : MonoBehaviour { public Transform Point; public PowerUpCarpenter Carpenter; public PowerUpInstaKill InstaKill; public PowerUpDeathMachine DeathMachine; public PowerUpMaxAmmo MaxAmmo; public PowerUpDoublePoints DoublePoints; public PowerUpNuke Nuke; public Blockade TrapBlockade; public ElectroTrap ElectroTrap; public Teleport TeleportToSecondArea; public Teleport TeleportToMainArea; public DeadShotPerkBottle DeadShotPerkBottle; public Text IFFText; public Text LayerText; private bool _forcingSpecialEnemy; public GameObject Prefab; private void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)97)) { MonoBehaviourSingleton<RoundManager>.Instance.StartGame(); } if (Input.GetKeyDown((KeyCode)98) && MonoBehaviourSingleton<ZombieManager>.Instance.ExistingZombies.Count > 0) { Damage val = new Damage(); val.Class = (DamageClass)1; val.Dam_Piercing += 1f; val.Dam_TotalKinetic = 60000f; val.hitNormal = Vector3.back; } if (Input.GetKeyDown((KeyCode)100)) { DeadShotPerkBottle.ApplyModifier(); } if (Input.GetKeyDown((KeyCode)101)) { ((MonoBehaviour)this).StartCoroutine(MonoBehaviourSingleton<PlayerData>.Instance.ActivateStun()); } if (Input.GetKeyDown((KeyCode)109)) { MonoBehaviourSingleton<GMgr>.Instance.AddPoints(300); } if (Input.GetKeyDown((KeyCode)107)) { } if (Input.GetKeyDown((KeyCode)108)) { ElectroTrap.OnLeverPull(); } if (Input.GetKeyDown((KeyCode)47)) { MonoBehaviourSingleton<GMgr>.Instance.TurnOnPower(); } if (Input.GetKeyDown((KeyCode)105)) { Debug.Log((object)"I pressed"); int index = Random.Range(0, GameRefs.Windows.Count); if (!GameRefs.Windows[index].IsBroken()) { GameRefs.Windows[index].TearPlank(); } } if (Input.GetKeyDown((KeyCode)111)) { int index2 = Random.Range(0, GameRefs.Windows.Count); if (!GameRefs.Windows[index2].IsFullyRepaired()) { GameRefs.Windows[index2].RepairWindow(); } } if (Input.GetKeyDown((KeyCode)109)) { SpawnTestObject(); } IFFText.text = "IFF: " + GM.CurrentPlayerBody.GetPlayerIFF(); } public void SpawnCarpenter() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Carpenter.Spawn(Point.position); } public void SpawnInstaKill() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) InstaKill.Spawn(Point.position); } public void SpawnDeathMachine() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) DeathMachine.Spawn(Point.position); } public void SpawnMaxAmmo() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) MaxAmmo.Spawn(Point.position); } public void SpawnDoublePoints() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) DoublePoints.Spawn(Point.position); } public void SpawnNuke() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Nuke.Spawn(Point.position); } public void KillRandom() { if (MonoBehaviourSingleton<ZombieManager>.Instance.ExistingZombies.Count > 0) { MonoBehaviourSingleton<ZombieManager>.Instance.ExistingZombies[0].OnHit(99999f); } } public void ToggleForceSpecialRound() { if (_forcingSpecialEnemy) { MonoBehaviourSingleton<RoundManager>.Instance.SpecialRoundInterval = 8; _forcingSpecialEnemy = false; } else { MonoBehaviourSingleton<RoundManager>.Instance.SpecialRoundInterval = 1; _forcingSpecialEnemy = true; } } public void SpawnTestObject() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate<GameObject>(Prefab, Point.position, Quaternion.identity); } } } namespace CustomScripts { public class EndPanel : MonoBehaviourSingleton<EndPanel> { public Text KillsText; public Text RoundText; public void UpdatePanel() { KillsText.text = "Kills: " + MonoBehaviourSingleton<GMgr>.Instance.Kills; RoundText.text = "Rounds: " + MonoBehaviourSingleton<RoundManager>.Instance.RoundNumber; } } public class GameRefs : MonoBehaviourSingleton<GameRefs> { public Color CanBuyColor; public Color CannotBuyColor; [HideInInspector] public Transform Player; [SerializeField] private Transform DebugPlayer; [HideInInspector] public Transform PlayerHead; [SerializeField] private Transform DebugPlayerHead; private List<Window> _windows; private MysteryBox _mysteryBox; private MysteryBoxMover _mysteryBoxMover; private Radio _radio; private PackAPunch _packAPunch; public static List<Window> Windows => MonoBehaviourSingleton<GameRefs>.Instance._windows; public static MysteryBox MysteryBox => MonoBehaviourSingleton<GameRefs>.Instance._mysteryBox; public static MysteryBoxMover MysteryBoxMover => MonoBehaviourSingleton<GameRefs>.Instance._mysteryBoxMover; public static Radio Radio => MonoBehaviourSingleton<GameRefs>.Instance._radio; public static PackAPunch PackAPunch => MonoBehaviourSingleton<GameRefs>.Instance._packAPunch; public override void Awake() { base.Awake(); Player = DebugPlayer; PlayerHead = DebugPlayerHead; _mysteryBox = Object.FindObjectOfType<MysteryBox>(); _mysteryBoxMover = Object.FindObjectOfType<MysteryBoxMover>(); _radio = Object.FindObjectOfType<Radio>(); _packAPunch = Object.FindObjectOfType<PackAPunch>(); _windows = Object.FindObjectsOfType<Window>().ToList(); } private IEnumerator Start() { while ((Object)(object)GM.CurrentPlayerBody == (Object)null) { yield return null; } Player = ((Component)GM.CurrentPlayerBody).transform; PlayerHead = ((Component)GM.CurrentPlayerBody.Head).transform; } public bool IsPlayerClose(Transform pos, float dist) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(pos.position, Player.position) <= dist; } } public class GameSettings : MonoBehaviourSingleton<GameSettings> { public static Action OnSettingsChanged; public static bool HardMode; public static bool SpecialRoundDisabled; public static bool ItemSpawnerEnabled; public static bool WeakerEnemiesEnabled; public static bool WonderWeaponEnabled; public Text OptionDescriptionText; private void Start() { OptionDescriptionText.text = "Call of Duty\nZOMBIES"; if (Random.Range(0, 500) == 0) { switch (Random.Range(0, 7)) { case 0: OptionDescriptionText.text = "You are my sunshine,\nMy only sunshine"; break; case 1: OptionDescriptionText.text = "I missed you"; break; case 2: OptionDescriptionText.text = "Play with me"; break; case 3: OptionDescriptionText.text = "It's just a game, mostly"; break; case 4: OptionDescriptionText.text = "I have granted kids to hell"; break; case 5: OptionDescriptionText.text = "It's only partially your fault"; break; } } } public void RestoreDefaultSettings() { HardMode = false; ItemSpawnerEnabled = false; SpecialRoundDisabled = false; WeakerEnemiesEnabled = false; WonderWeaponEnabled = false; OptionDescriptionText.text = "Default settings restored."; if (OnSettingsChanged != null) { OnSettingsChanged(); } } public void DifficultyNormalClicked() { HardMode = false; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Normal mode: Normal Enemy speed, HP and numbers."; } public void DifficultyHardClicked() { HardMode = true; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Hard mode: Increased Enemy speed, HP and numbers."; } public void EnableSpecialRoundClicked() { SpecialRoundDisabled = false; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Special round inspired by Hellhounds, occurs every 8 rounds."; } public void DisableSpecialRoundClicked() { SpecialRoundDisabled = true; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Special round disabled."; } public void EnableItemSpawnerClicked() { ItemSpawnerEnabled = true; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Item Spawner will appear at the starting location. Scoring will be disabled for that game."; } public void DisableItemSpawnerClicked() { ItemSpawnerEnabled = false; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "No Item Spawner. Scoring enabled"; } public void EnableWeakerEnemiesClicked() { WeakerEnemiesEnabled = true; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Enemies have reduced HP"; } public void DisableWeakerEnemiesClicked() { WeakerEnemiesEnabled = false; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Enemies have normal HP"; } public void EnableWonderWeaponsClicked() { WonderWeaponEnabled = true; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Wonder weapons might spawn in MysteryBox. If playing Multiplayer, check first in other scenes if modded weapons work correctly for both players."; } public void DisableWonderWeaponsClicked() { WonderWeaponEnabled = false; if (OnSettingsChanged != null) { OnSettingsChanged(); } OptionDescriptionText.text = "Wonder weapons will not spawn in MysteryBox"; } public void ToggleBackgroundMusic() { if (OnSettingsChanged != null) { OnSettingsChanged(); } } } public class GameSettingsPanel : MonoBehaviour { public Text DifficultyNormalText; public Text DifficultyHardText; public Text SpecialRoundEnabledText; public Text SpecialRoundDisabledText; public Text ItemSpawnerEnabledText; public Text ItemSpawnerDisabledText; public Text WeakerZombiesEnabledText; public Text WeakerZombiesDisabledText; public Text WonderWeaponsEnabledText; public Text WonderWeaponsDisabledText; public Color EnabledColor; public Color DisabledColor; private void Awake() { GameSettings.OnSettingsChanged = (Action)Delegate.Combine(GameSettings.OnSettingsChanged, new Action(UpdateText)); } private void Start() { UpdateText(); } private void OnDestroy() { GameSettings.OnSettingsChanged = (Action)Delegate.Remove(GameSettings.OnSettingsChanged, new Action(UpdateText)); } private void UpdateText() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) ((Graphic)DifficultyNormalText).color = ((!GameSettings.HardMode) ? EnabledColor : DisabledColor); ((Graphic)DifficultyHardText).color = ((!GameSettings.HardMode) ? DisabledColor : EnabledColor); ((Graphic)SpecialRoundEnabledText).color = ((!GameSettings.SpecialRoundDisabled) ? EnabledColor : DisabledColor); ((Graphic)SpecialRoundDisabledText).color = ((!GameSettings.SpecialRoundDisabled) ? DisabledColor : EnabledColor); ((Graphic)ItemSpawnerEnabledText).color = ((!GameSettings.ItemSpawnerEnabled) ? DisabledColor : EnabledColor); ((Graphic)ItemSpawnerDisabledText).color = ((!GameSettings.ItemSpawnerEnabled) ? EnabledColor : DisabledColor); ((Graphic)WeakerZombiesEnabledText).color = ((!GameSettings.WeakerEnemiesEnabled) ? DisabledColor : EnabledColor); ((Graphic)WeakerZombiesDisabledText).color = ((!GameSettings.WeakerEnemiesEnabled) ? EnabledColor : DisabledColor); ((Graphic)WonderWeaponsEnabledText).color = ((!GameSettings.WonderWeaponEnabled) ? DisabledColor : EnabledColor); ((Graphic)WonderWeaponsDisabledText).color = ((!GameSettings.WonderWeaponEnabled) ? EnabledColor : DisabledColor); } } public class GameStart : MonoBehaviourSingleton<GameStart> { private void OnDrawGizmos() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.red; Gizmos.DrawSphere(((Component)this).transform.position, 0.5f); } } public class LeverWrapper : MonoBehaviour { public UnityEvent LeverToggleEvent; public UnityEvent LeverOnEvent; public UnityEvent LeverOffEvent; public UnityEvent LeverHoldStartEvent; public UnityEvent LeverHoldEndEvent; private TrapLever _lever; private bool _isOn; private bool _isHeld; private void Awake() { _lever = ((Component)this).GetComponent<TrapLever>(); _lever.MessageTargets.Add(((Component)this).gameObject); } private void Update() { if (!_isHeld && ((FVRInteractiveObject)_lever).IsHeld) { OnHoldStart(); } else if (_isHeld && !((FVRInteractiveObject)_lever).IsHeld) { OnHoldEnd(); } } private void OnHoldStart() { _isHeld = true; if (LeverHoldStartEvent != null) { LeverHoldStartEvent.Invoke(); } } private void OnHoldEnd() { _isHeld = false; if (LeverHoldEndEvent != null) { LeverHoldEndEvent.Invoke(); } } public void ON() { if (!_isOn) { _isOn = true; if (LeverToggleEvent != null) { LeverToggleEvent.Invoke(); } if (LeverOnEvent != null) { LeverOnEvent.Invoke(); } } } public void OFF() { if (_isOn) { _isOn = false; if (LeverToggleEvent != null) { LeverToggleEvent.Invoke(); } if (LeverOffEvent != null) { LeverOffEvent.Invoke(); } } } } } namespace CustomScripts.Gamemode { public class PointsView : MonoBehaviour { public Text PointsText; private void Awake() { GMgr.OnPointsChanged = (Action)Delegate.Combine(GMgr.OnPointsChanged, new Action(OnPointsChanged)); } private void Start() { OnPointsChanged(); } private void OnDestroy() { GMgr.OnPointsChanged = (Action)Delegate.Remove(GMgr.OnPointsChanged, new Action(OnPointsChanged)); } private void OnPointsChanged() { PointsText.text = "Points: " + MonoBehaviourSingleton<GMgr>.Instance.Points; } } public class RoundView : MonoBehaviour { public Text RoundText; private void Awake() { RoundManager.OnRoundChanged = (Action)Delegate.Remove(RoundManager.OnRoundChanged, new Action(UpdateRoundText)); RoundManager.OnRoundChanged = (Action)Delegate.Combine(RoundManager.OnRoundChanged, new Action(UpdateRoundText)); } private void Start() { UpdateRoundText(); } private void OnDestroy() { RoundManager.OnRoundChanged = (Action)Delegate.Remove(RoundManager.OnRoundChanged, new Action(UpdateRoundText)); } private void UpdateRoundText() { RoundText.text = "Round: " + MonoBehaviourSingleton<RoundManager>.Instance.RoundNumber; } } } public class Location : MonoBehaviour { public List<Transform> ZombieSpawnPoints; public List<Transform> SpecialZombieSpawnPoints; private void Start() { if (ZombieSpawnPoints.Count == 0) { Debug.LogError((object)"ZombieSpawnPoints is empty, zombies don't have a place to spawn"); } if (SpecialZombieSpawnPoints.Count == 0) { Debug.LogError((object)"SpecialZombieSpawnPoints is empty, special zombies don't have a place to spawn"); } } } namespace CustomScripts.Gamemode { public class MagazineWrapper : MonoBehaviour { private FVRFireArmMagazine _magazine; private FVRFireArmClip _clip; private Speedloader _speedloader; public FireArmRoundClass RoundClass; public void Initialize(FVRFireArmMagazine magazine) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) _magazine = magazine; RoundClass = magazine.DefaultLoadingPattern.Classes[0]; } public void InitialzieWithAmmo(FVRFireArmMagazine magazine, FireArmRoundClass roundClass) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) _magazine = magazine; RoundClass = roundClass; } public void InitialzieWithAmmo(FVRFireArmClip clip, FireArmRoundClass roundClass) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) _clip = clip; RoundClass = roundClass; } public void InitialzieWithAmmo(Speedloader speedloader, FireArmRoundClass roundClass) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) _speedloader = speedloader; RoundClass = roundClass; } } } namespace CustomScripts { public class GMgr : MonoBehaviourSingleton<GMgr> { public static Action OnPointsChanged; public static Action OnPowerEnabled; [HideInInspector] public List<Blockade> Blockades; [HideInInspector] public int Points; [HideInInspector] public int TotalPoints; [HideInInspector] public bool GameStarted = false; [HideInInspector] public bool GameEnded = false; public bool PowerEnabled; public Transform PowerSwitchLever; [HideInInspector] public int Kills; private Harmony _harmony; public override void Awake() { base.Awake(); _harmony = Harmony.CreateAndPatchAll(typeof(PlayerData), (string)null); _harmony.PatchAll(typeof(PlayerSpawner)); _harmony.PatchAll(typeof(ZombieManager)); } public void PowerLeverPulled() { if (Networking.IsSolo()) { TurnOnPower(); } else if (Networking.IsHost()) { MonoBehaviourSingleton<CodZNetworking>.Instance.CustomData_Send(3); } else { MonoBehaviourSingleton<CodZNetworking>.Instance.Client_CustomData_Send(3); } } public void TurnOnPower() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Turning on power"); if (!PowerEnabled) { PowerEnabled = true; MonoBehaviourSingleton<AudioManager>.Instance.Play(MonoBehaviourSingleton<AudioManager>.Instance.PowerOnSound, 0.4f); if (OnPowerEnabled != null) { OnPowerEnabled(); } PowerSwitchLever.localEulerAngles = new Vector3(0f, 45f, 0f); } } public void AddPoints(int amount) { float num = (float)amount * MonoBehaviourSingleton<PlayerData>.Instance.MoneyModifier; MonoBehaviourSingleton<PlayerData>.Instance.MoneyModifier.ToString(); amount = (int)num; Points += amount; TotalPoints += amount; if (OnPointsChanged != null) { OnPointsChanged(); } } public bool TryRemovePoints(int amount) { if (Points >= amount) { Points -= amount; if (OnPointsChanged != null) { OnPointsChanged(); } return true; } return false; } public void RemovePoints(int amount) { Points -= amount; if (OnPointsChanged != null) { OnPointsChanged(); } } public void KillPlayer() { if (!GameEnded) { GM.CurrentPlayerBody.KillPlayer(false); } } public void EndGame() { if (GameEnded) { return; } GameEnded = true; MonoBehaviourSingleton<AudioManager>.Instance.PlayMusic(MonoBehaviourSingleton<AudioManager>.Instance.EndMusic, 0.25f, 1f); MonoBehaviourSingleton<EndPanel>.Instance.UpdatePanel(); if (Networking.IsHostOrSolo()) { for (int num = MonoBehaviourSingleton<ZombieManager>.Instance.ExistingZombies.Count - 1; num >= 0; num--) { MonoBehaviourSingleton<ZombieManager>.Instance.ExistingZombies[num].OnHit(9999f); } } } private void OnDestroy() { _harmony.UnpatchSelf(); } } public class PowerUpManager : MonoBehaviourSingleton<PowerUpManager> { public float ChanceForAmmo = 2.5f; public float ChanceForPowerUp = 6f; public float AmmoCooldownTime; public float PowerUpCooldownTime; public PowerUpMaxAmmo MaxAmmo; public List<PowerUp> PowerUps; private readonly List<int> _randomIndexes = new List<int>(); private bool _isPowerUpCooldown; private bool _isMaxAmmoCooldown; public int GetIndexOf(PowerUp powerUp) { return PowerUps.IndexOf(powerUp); } private void Start() { if (Networking.IsHostOrSolo()) { RoundManager.OnZombieKilled = (Action<GameObject>)Delegate.Remove(RoundManager.OnZombieKilled, new Action<GameObject>(RollForPowerUp)); RoundManager.OnZombieKilled = (Action<GameObject>)Delegate.Combine(RoundManager.OnZombieKilled, new Action<GameObject>(RollForPowerUp)); ShuffleIndexes(); } } private void OnDestroy() { RoundManager.OnZombieKilled = (Action<GameObject>)Delegate.Remove(RoundManager.OnZombieKilled, new Action<GameObject>(RollForPowerUp)); } public void RollForPowerUp(GameObject spawnPos) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Networking.ServerRunning() && Networking.IsClient()) || _isPowerUpCooldown) { return; } float num = Random.Range(0f, 100f); if (num < ChanceForPowerUp) { if (_randomIndexes.Count == 0) { ShuffleIndexes(); } SpawnPowerUp(PowerUps[_randomIndexes[0]], spawnPos.transform.position); MonoBehaviourSingleton<CodZNetworking>.Instance.PowerUpSpawned_Send(_randomIndexes[0], spawnPos.transform.position); _randomIndexes.RemoveAt(0); } } private void ShuffleIndexes() { _randomIndexes.Clear(); for (int i = 0; i < PowerUps.Count; i++) { _randomIndexes.Add(i); } _randomIndexes.Shuffle(); } public void SpawnPowerUp(PowerUp powerUp, Vector3 pos) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)powerUp == (Object)null) { Debug.LogWarning((object)"PowerUp spawn failed! PowerUp == null"); return; } ((MonoBehaviour)this).StartCoroutine(PowerUpCooldown()); powerUp.Spawn(pos + Vector3.up); } private IEnumerator PowerUpCooldown() { _isPowerUpCooldown = true; yield return (object)new WaitForSeconds(PowerUpCooldownTime); _isPowerUpCooldown = false; } } public class RoundManager : MonoBehaviourSingleton<RoundManager> { public static Action RoundStarted; public static Action RoundEnded; public static Action OnRoundChanged; public static Action OnZombiesLeftChanged; public static Action<GameObject> OnZombieKilled; public static Action OnGameStarted; public int SpecialRoundInterval; [HideInInspector] public int RoundNumber = 0; private Coroutine _roundDelayCoroutine; public bool IsRoundSpecial { get { if (GameSettings.SpecialRoundDisabled) { return false; } return RoundNumber % SpecialRoundInterval == 0; } } public void SendStartGame() { StartGame(); MonoBehaviourSingleton<CodZNetworking>.Instance.StartGame_Send(); } public void StartGame() { if (!Application.isEditor) { MonoBehaviourSingleton<PlayerSpawner>.Instance.SpawnPlayer(); } MonoBehaviourSingleton<GMgr>.Instance.GameStarted = true; RoundNumber = 0; if (OnGameStarted != null) { OnGameStarted(); } AdvanceRound(); } public void AdvanceRound() { if (!MonoBehaviourSingleton<GMgr>.Instance.GameEnded) { RoundNumber++; MonoBehaviourSingleton<ZombieManager>.Instance.BeginSpawningEnemies(); if (OnZombiesLeftChanged != null) { OnZombiesLeftChanged(); } if (OnRoundChanged != null) { OnRoundChanged(); } } } public void EndRound() { MonoBehaviourSingleton<AudioManager>.Instance.Play(MonoBehaviourSingleton<AudioManager>.Instance.RoundEndSound, 0.2f, 1f); if (RoundEnded != null) { RoundEnded(); } _roundDelayCoroutine = ((MonoBehaviour)this).StartCoroutine(DelayedAdvanceRound(17f)); } private IEnumerator DelayedAdvanceRound(float delay) { yield return (object)new WaitForSeconds(delay); AdvanceRound(); if (RoundStarted != null) { RoundStarted(); } } public void PauseGame() { ((MonoBehaviour)this).StopCoroutine(_roundDelayCoroutine); } public void ResumeGame() { _roundDelayCoroutine = ((MonoBehaviour)this).StartCoroutine(DelayedAdvanceRound(0f)); } } public class AudioManager : MonoBehaviourSingleton<AudioManager> { public AudioSource MainAudioSource; public AudioSource MusicAudioSource; [Space(20f)] public AudioClip BuySound; public AudioClip DrinkSound; public AudioClip HellHoundSpawnSound; public AudioClip HellHoundDeathSound; public AudioClip RoundStartSound; public AudioClip RoundEndSound; public AudioClip HellHoundRoundStartSound; public AudioClip PowerOnSound; public AudioClip EndMusic; public AudioClip TeleportingSound; public AudioClip PlayerHitSound; public AudioClip BarricadeRepairSound; private Coroutine _musicRepetition; public void Play(AudioClip audioClip, float volume = 1f, float delay = 0f) { if (delay != 0f) { ((MonoBehaviour)this).StartCoroutine(PlayDelayed(audioClip, volume, delay)); } else { MainAudioSource.PlayOneShot(audioClip, volume); } } private IEnumerator PlayDelayed(AudioClip audioClip, float volume, float delay) { yield return (object)new WaitForSeconds(delay); MainAudioSource.PlayOneShot(audioClip, volume); } public void PlayMusic(AudioClip audioClip, float volume = 1f, float delay = 0f) { MusicAudioSource.clip = audioClip; MusicAudioSource.volume = volume; MusicAudioSource.PlayDelayed(delay); } } } namespace CustomScripts.Managers.Sound { public class MusicManager : MonoBehaviourSingleton<MusicManager> { } } namespace CustomScripts.Managers { public class ZombieManager : MonoBehaviourSingleton<ZombieManager> { public static Action LocationChangedEvent; public Location CurrentLocation; public AnimationCurve ZombieCountCurve; public AnimationCurve ZosigHPCurve; public AnimationCurve ZosigLinkIntegrityCurve; public AnimationCurve ZosigPerRoundSpeed; public int PointsOnHit = 10; public int PointsOnKill = 100; [HideInInspector] public List<ZombieController> ExistingZombies; public ParticleSystem HellhoundExplosionPS; public int ExtraZombiesPerPlayer = 3; public int BaseZombieLimit = 20; [HideInInspector] public int ZombiesRemaining; private Coroutine _spawningCoroutine; public int ExistingZombieLimit { get { if (Networking.IsSolo()) { return BaseZombieLimit; } return BaseZombieLimit + ExtraZombiesPerPlayer * (MonoBehaviourSingleton<PlayersMgr>.Instance.Players.Count - 1); } } private int ZombiesToSpawnThisRound { get { int num = ((!Networking.IsSolo()) ? (ExtraZombiesPerPlayer * (MonoBehaviourSingleton<PlayersMgr>.Instance.Players.Count - 1)) : 0); if (GameSettings.HardMode) { return Mathf.CeilToInt(ZombieCountCurve.Evaluate((float)MonoBehaviourSingleton<RoundManager>.Instance.RoundNumber) + 1f + (float)num); } return Mathf.CeilToInt(ZombieCountCurve.Evaluate((float)MonoBehaviourSingleton<RoundManager>.Instance.RoundNumber) + (float)num); } } public void BeginSpawningEnemies() { ZombiesRemaining = ZombiesToSpawnThisRound; if (MonoBehaviourSingleton<RoundManager>.Instance.IsRoundSpecial) { StartSpawningZombies(6f); MonoBehaviourSingleton<AudioManager>.Instance.Play(MonoBehaviourSingleton<AudioManager>.Instance.HellHoundRoundStartSound, 0.35f); } else { StartSpawningZombies(2f); MonoBehaviourSingleton<AudioManager>.Instance.Play(MonoBehaviourSingleton<AudioManager>.Instance.RoundStartSound, 0.2f, 1f); } } public void StartSpawningZombies(float initialDelay) { _spawningCoroutine = ((MonoBehaviour)this).StartCoroutine(DelayedZombieSpawn(initialDelay)); } private IEnumerator DelayedZombieSpawn(float delay) { yield return (object)new WaitForSeconds(delay); while (ZombiesRemaining > ExistingZombies.Count) { if (ExistingZombies.Count >= ExistingZombieLimit || ExistingZombies.Count >= ZombiesRemaining) { yield return (object)new WaitForSeconds(4f); continue; } SpawnZosig(); if (!GameSettings.HardMode || MonoBehaviourSingleton<RoundManager>.Instance.IsRoundSpecial) { yield return (object)new WaitForSeconds(3f); } else { yield return (object)new WaitForSeconds(2f); } } } public void SpawnZosig() { if (MonoBehaviourSingleton<RoundManager>.Instance.IsRoundSpecial) { CustomSosigSpawnPoint component = ((Component)CurrentLocation.SpecialZombieSpawnPoints[Random.Range(0, CurrentLocation.SpecialZombieSpawnPoints.Count)]).GetComponent<CustomSosigSpawnPoint>(); component.Spawn(); } else { CustomSosigSpawnPoint component2 = ((Component)CurrentLocation.ZombieSpawnPoints[Random.Range(0, CurrentLocation.ZombieSpawnPoints.Count)]).GetComponent<CustomSosigSpawnPoint>(); component2.Spawn(); } } [HarmonyPatch(typeof(Sosig), "Start")] [HarmonyPostfix] private static void OnSosigSpawned(Sosig __instance) { MonoBehaviourSingleton<ZombieManager>.Instance.OnZosigSpawned(__instance); } public void OnZosigSpawned(Sosig zosig) { ZombieController zombieController = ((Component)zosig).gameObject.AddComponent<ZosigZombieController>(); zombieController.Initialize(); ExistingZombies.Add(zombieController); if (MonoBehaviourSingleton<RoundManager>.Instance.IsRoundSpecial) { zombieController.InitializeSpecialType(); } } public void ChangeLocation(Location newLocation) { if (_spawningCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_spawningCoroutine); } CurrentLocation = newLocation; for (int num = ExistingZombies.Count - 1; num >= 0; num--) { ExistingZombies[num].OnKill(awardPoints: false); } StartSpawningZombies(5f); if (LocationChangedEvent != null) { LocationChangedEvent(); } } public void ForceKillZosig(Sosig sosig) { sosig.DeSpawnSosig(); } public void OnZombieDied(ZombieController controller) { ExistingZombies.Remove(controller); ZombiesRemaining--; if (!MonoBehaviourSingleton<GMgr>.Instance.GameEnded) { if (ZombiesRemaining <= 0) { MonoBehaviourSingleton<RoundManager>.Instance.EndRound(); } if (RoundManager.OnZombiesLeftChanged != null) { RoundManager.OnZombiesLeftChanged(); } if (RoundManager.OnZombieKilled != null) { RoundManager.OnZombieKilled(((Component)controller).gameObject); } } } [HarmonyPatch(typeof(Sosig), "SosigDies")] [HarmonyPostfix] private static void OnSosigDied(Sosig __instance, DamageClass damClass, SosigDeathType deathType) { ((Component)__instance).GetComponent<ZosigZombieController>().OnKill(); } [HarmonyPatch(typeof(Sosig), "ProcessDamage", new Type[] { typeof(Damage), typeof(SosigLink) })] [HarmonyPrefix] private static void BeforeZombieHit(Damage d, SosigLink link) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)d.Class == 3 && d.Source_IFF != GM.CurrentSceneSettings.DefaultPlayerIFF) { d.Dam_Blinding = 0f; d.Dam_TotalKinetic = 0f; d.Dam_TotalEnergetic = 0f; d.Dam_Blunt = 0f; d.Dam_Chilling = 0f; d.Dam_Cutting = 0f; d.Dam_Thermal = 0f; d.Dam_EMP = 0f; d.Dam_Piercing = 0f; d.Dam_Stunning = 0f; } d.Dam_Stunning = 0f; } [HarmonyPatch(typeof(Sosig), "ProcessDamage", new Type[] { typeof(Damage), typeof(SosigLink) })] [HarmonyPostfix] private static void AfterZombieHit(Sosig __instance, Damage d, SosigLink link) { ((Component)__instance).GetComponent<ZosigZombieController>().OnHit(__instance, d); } } } namespace CustomScripts.Multiplayer { public class CodZNetworking : MonoBehaviourSingleton<CodZNetworking> { private int gameStarted_ID = -1; private int mysteryBoxMoved_ID = -1; private int blockadeCleared_ID = -1; private int blockadeCleared_Client_ID = -1; private int powerUpSpawned_ID = -1; private int powerUpCollected_ID = -1; private int powerUpCollected_Client_ID = -1; private int papPurchased_ID = -1; private int papPurchased_Client_ID = -1; private int windowStateChanged_ID = -1; private int windowStateChanged_Client_ID = -1; private int customData_ID = -1; private int customData_Client_ID = -1; private int customData_playerID_ID = -1; private int customData_playerID_Client_ID = -1; private IEnumerator Start() { yield return null; StartNetworking(); } private void StartNetworking() { Mod.customPacketHandlers = (CustomPacketHandler[])(object)new CustomPacketHandler[20]; if (Networking.ServerRunning()) { SetupPacketTypes(); GM.CurrentPlayerBody.SetPlayerIFF(GameManager.ID + 5); } } private void SetupPacketTypes() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002a: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0053: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007c: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00a5: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00ce: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00f7: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0120: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0149: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0172: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_019b: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01c4: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_01ed: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0216: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_023f: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0268: Expected O, but got Unknown RegisterPacket("CodZ_GameStarted", new CustomPacketHandler(StartGame_Handler), new CustomPacketHandlerReceivedDelegate(StartGame_Received), ref gameStarted_ID); RegisterPacket("CodZ_MysteryBoxMoved", new CustomPacketHandler(MysteryBoxMoved_Handler), new CustomPacketHandlerReceivedDelegate(MysteryBoxMoved_Received), ref mysteryBoxMoved_ID); RegisterPacket("CodZ_BlockadeCleared", new CustomPacketHandler(BlockadeCleared_Handler), new CustomPacketHandlerReceivedDelegate(BlockadeCleared_Received), ref blockadeCleared_ID); RegisterPacket("CodZ_Client_BlockadeCleared", new CustomPacketHandler(Client_BlockadeCleared_Handler), new CustomPacketHandlerReceivedDelegate(Client_BlockadeCleared_Received), ref blockadeCleared_Client_ID); RegisterPacket("CodZ_PowerUpSpawned", new CustomPacketHandler(PowerUpSpawned_Handler), new CustomPacketHandlerReceivedDelegate(PowerUpSpawned_Received), ref powerUpSpawned_ID); RegisterPacket("CodZ_PowerUpCollected", new CustomPacketHandler(PowerUpCollected_Handler), new CustomPacketHandlerReceivedDelegate(PowerUpCollected_Received), ref powerUpCollected_ID); RegisterPacket("CodZ_Client_PowerUpCollected", new CustomPacketHandler(Client_PowerUpCollected_Handler), new CustomPacketHandlerReceivedDelegate(Client_PowerUpCollected_Received), ref powerUpCollected_Client_ID); RegisterPacket("CodZ_PaPPurchased", new CustomPacketHandler(PaPPurchased_Handler), new CustomPacketHandlerReceivedDelegate(PaPPurchased_Received), ref papPurchased_ID); RegisterPacket("CodZ_Client_PaPPurchased", new CustomPacketHandler(Client_PaPPurchased_Handler), new CustomPacketHandlerReceivedDelegate(Client_PaPPurchased_Received), ref papPurchased_Client_ID); RegisterPacket("CodZ_WindowStateChanged", new CustomPacketHandler(WindowStateChanged_Handler), new CustomPacketHandlerReceivedDelegate(WindowStateChanged_Received), ref windowStateChanged_ID); RegisterPacket("CodZ_Client_WindowStateChanged", new CustomPacketHandler(Client_WindowStateChanged_Handler), new CustomPacketHandlerReceivedDelegate(Client_WindowStateChanged_Received), ref windowStateChanged_Client_ID); RegisterPacket("CodZ_CustomData", new CustomPacketHandler(CustomData_Handler), new CustomPacketHandlerReceivedDelegate(CustomData_Received), ref customData_ID); RegisterPacket("CodZ_Client_CustomData", new CustomPacketHandler(Client_CustomData_Handler), new CustomPacketHandlerReceivedDelegate(Client_CustomData_Received), ref customData_Client_ID); RegisterPacket("CodZ_CustomData_PlayerID", new CustomPacketHandler(CustomData_PlayerID_Handler), new CustomPacketHandlerReceivedDelegate(CustomData_PlayerID_Received), ref customData_playerID_ID); RegisterPacket("CodZ_Client_CustomData_PlayerID", new CustomPacketHandler(Client_CustomData_PlayerID_Handler), new CustomPacketHandlerReceivedDelegate(Client_CustomData_PlayerID_Received), ref customData_playerID_Client_ID); } private void RegisterPacket(string packetName, CustomPacketHandler hostHandler, CustomPacketHandlerReceivedDelegate clientHandler, ref int packetID) { if (Networking.IsHost()) { if (Mod.registeredCustomPacketIDs.ContainsKey(packetName)) { packetID = Mod.registeredCustomPacketIDs[packetName]; } else { packetID = Networking.RegisterCustomPacketType(packetName); } Mod.customPacketHandlers[packetID] = hostHandler; } else if (Mod.registeredCustomPacketIDs.ContainsKey(packetName)) { packetID = Mod.registeredCustomPacketIDs[packetName]; Mod.customPacketHandlers[packetID] = hostHandler; } else { ClientSend.RegisterCustomPacketType(packetName); Mod.CustomPacketHandlerReceived += clientHandler; } } public void StartGame_Send() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(gameStarted_ID); val.Write(GameSettings.HardMode); val.Write(GameSettings.WeakerEnemiesEnabled); val.Write(GameSettings.SpecialRoundDisabled); val.Write(GameSettings.ItemSpawnerEnabled); val.Write(GameSettings.WonderWeaponEnabled); ServerSend.SendTCPDataToAll(val, true); } } private void StartGame_Handler(int clientID, Packet packet) { GameSettings.HardMode = packet.ReadBool(true); GameSettings.WeakerEnemiesEnabled = packet.ReadBool(true); GameSettings.SpecialRoundDisabled = packet.ReadBool(true); GameSettings.ItemSpawnerEnabled = packet.ReadBool(true); GameSettings.WonderWeaponEnabled = packet.ReadBool(true); GameSettings.OnSettingsChanged(); MonoBehaviourSingleton<RoundManager>.Instance.StartGame(); } private void StartGame_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_GameStarted") { gameStarted_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(StartGame_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(StartGame_Received); } } public void MysteryBoxMoved_Send(int newWayPointID, bool immediate) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(mysteryBoxMoved_ID); val.Write(newWayPointID); val.Write(immediate); ServerSend.SendTCPDataToAll(val, true); } } private void MysteryBoxMoved_Handler(int clientID, Packet packet) { int nextWaypoint = packet.ReadInt(true); bool flag = packet.ReadBool(true); GameRefs.MysteryBoxMover.SetNextWaypoint(nextWaypoint); if (flag) { GameRefs.MysteryBoxMover.Teleport(); } else { GameRefs.MysteryBoxMover.StartTeleportAnim(); } } private void MysteryBoxMoved_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_MysteryBoxMoved") { mysteryBoxMoved_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(MysteryBoxMoved_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(MysteryBoxMoved_Received); } } public void BlockadeCleared_Send(int blockadeId) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(blockadeCleared_ID); val.Write(blockadeId); ServerSend.SendTCPDataToAll(val, true); } } private void BlockadeCleared_Handler(int clientID, Packet packet) { int index = packet.ReadInt(true); MonoBehaviourSingleton<GMgr>.Instance.Blockades[index].Unlock(); } private void BlockadeCleared_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_BlockadeCleared") { blockadeCleared_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(BlockadeCleared_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(BlockadeCleared_Received); } } public void Client_BlockadeCleared_Send(int blockadeId) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Packet val = new Packet(blockadeCleared_Client_ID); val.Write(blockadeId); ClientSend.SendTCPData(val, true); } } private void Client_BlockadeCleared_Handler(int clientID, Packet packet) { int num = packet.ReadInt(true); MonoBehaviourSingleton<GMgr>.Instance.Blockades[num].Unlock(); BlockadeCleared_Send(num); } private void Client_BlockadeCleared_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_Client_BlockadeCleared") { blockadeCleared_Client_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(Client_BlockadeCleared_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(Client_BlockadeCleared_Received); } } public void PowerUpSpawned_Send(int powerUpId, Vector3 pos) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(powerUpSpawned_ID); val.Write(powerUpId); val.Write(pos); ServerSend.SendTCPDataToAll(val, true); } } private void PowerUpSpawned_Handler(int clientID, Packet packet) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) int index = packet.ReadInt(true); Vector3 pos = packet.ReadVector3(true); MonoBehaviourSingleton<PowerUpManager>.Instance.SpawnPowerUp(MonoBehaviourSingleton<PowerUpManager>.Instance.PowerUps[index], pos); } private void PowerUpSpawned_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_PowerUpSpawned") { powerUpSpawned_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(PowerUpSpawned_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(PowerUpSpawned_Received); } } public void PowerUpCollected_Send(int powerUpId) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(powerUpCollected_ID); val.Write(powerUpId); ServerSend.SendTCPDataToAll(val, true); } } private void PowerUpCollected_Handler(int clientID, Packet packet) { int index = packet.ReadInt(true); PowerUp powerUp = MonoBehaviourSingleton<PowerUpManager>.Instance.PowerUps[index]; powerUp.OnCollect(); } private void PowerUpCollected_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_PowerUpCollected") { powerUpCollected_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(PowerUpCollected_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(PowerUpCollected_Received); } } public void Client_PowerUpCollected_Send(int powerUpId) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Packet val = new Packet(powerUpCollected_Client_ID); val.Write(powerUpId); ClientSend.SendTCPData(val, true); } } private void Client_PowerUpCollected_Handler(int clientID, Packet packet) { int num = packet.ReadInt(true); PowerUp powerUp = MonoBehaviourSingleton<PowerUpManager>.Instance.PowerUps[num]; powerUp.OnCollect(); PowerUpCollected_Send(num); } private void Client_PowerUpCollected_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_Client_PowerUpCollected") { powerUpCollected_Client_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(Client_PowerUpCollected_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(Client_PowerUpCollected_Received); } } public void PaPPurchased_Send() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(papPurchased_ID); ServerSend.SendTCPDataToAll(val, true); } } private void PaPPurchased_Handler(int clientID, Packet packet) { GameRefs.PackAPunch.OnBuying(); } private void PaPPurchased_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_PaPPurchased") { papPurchased_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(PaPPurchased_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(PaPPurchased_Received); } } public void Client_PaPPurchased_Send() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Packet val = new Packet(papPurchased_Client_ID); ClientSend.SendTCPData(val, true); } } private void Client_PaPPurchased_Handler(int clientID, Packet packet) { GameRefs.PackAPunch.OnBuying(); PaPPurchased_Send(); } private void Client_PaPPurchased_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_Client_PaPPurchased") { papPurchased_Client_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(Client_PaPPurchased_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(Client_PaPPurchased_Received); } } public void WindowStateChanged_Send(int windowId, int plankId, WindowAction windowAction) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { Packet val = new Packet(windowStateChanged_ID); val.Write(windowId); val.Write(plankId); val.Write((int)windowAction); ServerSend.SendTCPDataToAll(val, true); } } private void WindowStateChanged_Handler(int clientID, Packet packet) { int index = packet.ReadInt(true); int plankId = packet.ReadInt(true); switch ((WindowAction)packet.ReadInt(true)) { case WindowAction.Repair: GameRefs.Windows[index].OnWindowRepaired(plankId); break; case WindowAction.Tear: GameRefs.Windows[index].OnPlankTeared(plankId); break; } } private void WindowStateChanged_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_WindowStateChanged") { windowStateChanged_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(WindowStateChanged_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(WindowStateChanged_Received); } } public void Client_WindowStateChanged_Send(int windowId, int plankId) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Packet val = new Packet(windowStateChanged_Client_ID); val.Write(windowId); val.Write(plankId); ClientSend.SendTCPData(val, true); } } private void Client_WindowStateChanged_Handler(int clientID, Packet packet) { int num = packet.ReadInt(true); int plankId = packet.ReadInt(true); GameRefs.Windows[num].OnWindowRepaired(plankId); WindowStateChanged_Send(num, plankId, WindowAction.Repair); } private void Client_WindowStateChanged_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_Client_WindowStateChanged") { windowStateChanged_Client_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(Client_WindowStateChanged_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(Client_WindowStateChanged_Received); } } public void CustomData_Send(int customDataID) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { HandleCustomData(customDataID); Packet val = new Packet(customData_ID); val.Write(customDataID); ServerSend.SendTCPDataToAll(val, true); } } private void CustomData_Handler(int clientID, Packet packet) { int customDataId = packet.ReadInt(true); HandleCustomData(customDataId); } private void CustomData_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_CustomData") { customData_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(CustomData_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(CustomData_Received); } } public void Client_CustomData_Send(int customDataId) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Packet val = new Packet(customData_Client_ID); val.Write(customDataId); ClientSend.SendTCPData(val, true); } } private void Client_CustomData_Handler(int clientID, Packet packet) { int customDataID = packet.ReadInt(true); CustomData_Send(customDataID); } private void Client_CustomData_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_Client_CustomData") { customData_Client_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(Client_CustomData_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(Client_CustomData_Received); } } public void CustomData_PlayerID_Send(int playerID, int customDataID) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsClient()) { HandlePlayerCustomData(playerID, customDataID); Packet val = new Packet(customData_playerID_ID); val.Write(playerID); val.Write(customDataID); ServerSend.SendTCPDataToAll(val, true); } } private void CustomData_PlayerID_Handler(int clientID, Packet packet) { int playerID = packet.ReadInt(true); int customDataId = packet.ReadInt(true); HandlePlayerCustomData(playerID, customDataId); } private void CustomData_PlayerID_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_CustomData_PlayerID") { customData_playerID_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(CustomData_PlayerID_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(CustomData_PlayerID_Received); } } public void Client_CustomData_PlayerID_Send(int playerID, int customDataID) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (Networking.ServerRunning() && !Networking.IsHost()) { Packet val = new Packet(customData_playerID_Client_ID); val.Write(playerID); val.Write(customDataID); ClientSend.SendTCPData(val, true); } } private void Client_CustomData_PlayerID_Handler(int clientID, Packet packet) { int playerID = packet.ReadInt(true); int customDataID = packet.ReadInt(true); CustomData_PlayerID_Send(playerID, customDataID); } private void Client_CustomData_PlayerID_Received(string handlerID, int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (handlerID == "CodZ_Client_CustomData_PlayerID") { customData_playerID_Client_ID = index; Mod.customPacketHandlers[index] = new CustomPacketHandler(Client_CustomData_PlayerID_Handler); Mod.CustomPacketHandlerReceived -= new CustomPacketHandlerReceivedDelegate(Client_CustomData_PlayerID_Received); } } private void HandleCustomData(int customDataId) { switch (customDataId) { case 0: GameRefs.MysteryBox.OnBuying(); break; case 1: GameRefs.MysteryBox.WillTeleport = true; break; case 3: MonoBehaviourSingleton<GMgr>.Instance.TurnOnPower(); break; case 4: MonoBehaviourSingleton<PlayerSpawner>.Instance.MoveToEndGameArea(); break; case 5: GameRefs.Radio.ToggleMusic(); break; } } private void HandlePlayerCustomData(int playerID, int customDataId) { //IL_004a: 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_0051: Unknown result type (might be due to invalid IL or missing references) switch (customDataId) { case 0: if (Networking.IsHost() && MonoBehaviourSingleton<PlayersMgr>.Instance.AllPlayersDowned()) { CustomData_Send(4); } if (playerID != GameManager.ID) { Vector3 position = ((Component)GameManager.players[playerID]).transform.position; PlayersMgr.SpawnReviveButton(playerID, position); PlayersMgr.GetPlayerExcludingMe(playerID).IsDowned = true; } break; case 1: if (playerID != GameManager.ID) { if (Networking.IsHost() && MonoBehaviourSingleton<PlayersMgr>.Instance.AllPlayersDowned()) { CustomData_Send(4); } PlayersMgr.GetPlayerExcludingMe(playerID).IsDowned = false; PlayersMgr.GetPlayerExcludingMe(playerID).IsDead = true; PlayersMgr.DespawnReviveButton(playerID); } break; case 2: if (playerID == GameManager.ID) { MonoBehaviourSingleton<PlayerSpawner>.Instance.Revive(); break; } PlayersMgr.GetPlayerExcludingMe(playerID).IsDowned = false; PlayersMgr.DespawnReviveButton(playerID); break; case 3: if (playerID == GM.CurrentPlayerBody.GetPlayerIFF()) { MonoBehaviourSingleton<GMgr>.Instance.AddPoints(MonoBehaviourSingleton<ZombieManager>.Instance.PointsOnHit); } break; case 4: if (playerID == GM.CurrentPlayerBody.GetPlayerIFF()) { MonoBehaviourSingleton<GMgr>.Instance.AddPoints(MonoBehaviourSingleton<ZombieManager>.Instance.PointsOnKill); MonoBehaviourSingleton<GMgr>.Instance.Kills++; } break; case 5: if (playerID != GameManager.ID) { PlayersMgr.GetPlayerExcludingMe(playerID).IsDowned = false; PlayersMgr.GetPlayerExcludingMe(playerID).IsDead = false; } break; } } } public enum CustomDataType { MYSTERY_BOX_ROLLED = 0, MYSTERY_BOX_TELEPORT = 1, POWER_ENABLED = 3, EVERY_PLAYER_DEAD = 4, RADIO_TOGGLE = 5 } public enum CustomPlayerDataType { PLAYER_DOWNED, PLAYER_DEAD, PLAYER_REVIVED, ZOMBIE_HIT, ZOMBIE_KILLED, PLAYER_SPAWNED } public class HideIfNotHost : MonoBehaviour { private void Start() { if (!Networking.IsHostOrSolo()) { ((Component)this).gameObject.SetActive(false); } } } public class Networking : MonoBehaviourSingleton<Networking> { public static int CustomIndex = 0; public override void Awake() { base.Awake(); CustomIndex = 0; } public static bool IsHostOrSolo() { if (ServerRunning()) { if (IsHost()) { return true; } return false; } return true; } public static bool ServerRunning() { return (Object)(object)GameManager.singleton != (Object)null; } public static bool IsClient() { if (!ThreadManager.host) { return true; } return false; } public static bool IsHost() { if (ThreadManager.host) { return true; } return false; } public static bool IsSolo() { if (ServerRunning()) { if (IsHost() && MonoBehaviourSingleton<PlayersMgr>.Instance.Players.Count == 1) { return true; } return false; } return true; } public static int RegisterCustomPacketType(string handlerID, int clientID = 0) { int value = -1; if (Mod.registeredCustomPacketIDs.TryGetValue(handlerID, out value)) { Mod.LogWarning("Client " + clientID + " requested for " + handlerID + " custom packet handler to be registered but this ID already exists."); } else { value = CustomIndex; CustomIndex++; Mod.registeredCustomPacketIDs.Add(handlerID, value); Mod.CustomPacketHandlerReceivedInvoke(handlerID, value); } ServerSend.RegisterCustomPacketType(handlerID, value); return value; } public static bool IsMineIFF(int iff) { if (GM.CurrentPlayerBody.GetPlayerIFF() == iff) { return true; } return false; } } } public class PlayersMgr : MonoBehaviourSingleton<PlayersMgr> { public List<PlayerH3MPData> Players = new List<PlayerH3MPData>(); public static PlayerH3MPData Me; public ReviveButton ReviveButtonPrefab; public List<ReviveButton> ReviveButtons = new List<ReviveButton>(); private void Start() { AddMe(); RoundManager.OnGameStarted = (Action)Delegate.Combine(RoundManager.OnGameStarted, new Action(AddClients)); RoundManager.RoundStarted = (Action)Delegate.Combine(RoundManager.RoundStarted, new Action(SetAllToAlive)); } private void AddClients() { foreach (KeyValuePair<int, PlayerManager> player in GameManager.players) { AddClient(player.Value); } Debug.Log((object)"Connected Players"); foreach (PlayerH3MPData player2 in Players) { if (player2.IsMe) { Debug.Log((object)("Me " + GameManager.ID)); } else { Debug.Log((object)(player2.PlayerManager.username + " " + player2.PlayerManager.ID)); } } foreach (PlayerH3MPData player3 in Players) { if (!player3.IsMe) { Debug.Log((object)("IFF: " + (player3.PlayerManager.ID + 5))); } } } public PlayerH3MPData GetRandomPlayer() { int index = Random.Range(0, Players.Count); return Players[index]; } public PlayerH3MPData GetRandomAlivePlayer() { List<PlayerH3MPData> list = Players.FindAll((PlayerH3MPData player) => player.IsAlive); int index = Random.Range(0, list.Count); return list[index]; } public PlayerH3MPData GetClosestAlivePlayer(Vector3 origin) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) PlayerH3MPData result = null; float num = float.MaxValue; foreach (PlayerH3MPData player in Players) { if (player.IsAlive) { Vector3 val = player.GetHead().position - origin; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = player; } } } return result; } public PlayerH3MPData GetClosestPlayer(Vector3 origin) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references) PlayerH3MPData result = null; float num = float.MaxValue; foreach (PlayerH3MPData player in Players) { Vector3 val = player.GetHead().position - origin; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = player; } } return result; } public bool AllPlayersDowned() { return Players.All((PlayerH3MPData player) => !player.IsAlive); } public void AddMe() { Players.Add(new PlayerH3MPData { IsMe = true, PlayerManager = null }); Me = Players[Players.Count - 1]; } public void AddClient(PlayerManager playerManager) { Players.Add(new PlayerH3MPData { IsMe = false, PlayerManager = playerManager }); } private void OnDestroy() { RoundManager.OnGameStarted = (Action)Delegate.Remove(RoundManager.OnGameStarted, new Action(AddClients)); RoundManager.RoundStarted = (Action)Delegate.Remove(RoundManager.RoundStarted, new Action(SetAllToAlive)); } public static PlayerH3MPData GetPlayerExcludingMe(int playerID) { return MonoBehaviourSingleton<PlayersMgr>.Instance.Players.Find((PlayerH3MPData player) => !player.IsMe && player.PlayerManager.ID == playerID); } public static void SpawnReviveButton(int playerID, Vector3 pos) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) ReviveButton reviveButton = Object.Instantiate<ReviveButton>(MonoBehaviourSingleton<PlayersMgr>.Instance.ReviveButtonPrefab, pos, Quaternion.identity); reviveButton.Spawn(playerID, pos); } public static void DespawnReviveButton(int playerID) { ReviveButton reviveButton = MonoBehaviourSingleton<PlayersMgr>.Instance.ReviveButtons.Find((ReviveButton button) => button.AffectedPlayerID == playerID); reviveButton.Despawn(); } public void SetAllToAlive() { foreach (PlayerH3MPData player in Players) { player.IsDowned = false; player.IsDead = false; } } } public class PlayerH3MPData { public bool IsMe; public PlayerManager PlayerManager; public bool IsDowned; public bool IsDead; public bool Exists => IsMe || (Object)(object)PlayerManager != (Object)null; public bool IsAlive => !IsDowned && !IsDead && Exists; public Transform GetHead() { if (IsMe) { return GM.CurrentPlayerBody.Head; } return PlayerManager.head; } } public class ReviveButton : MonoBehaviourSingleton<ReviveButton> { public Image ReviveIcon; public int AffectedPlayerID; private FVRViveHand _handReviving; private float _timer = 0f; private Color _defaultColor = Color.yellow; private Color _reviveColor = Color.white; private bool _available = false; private float ReviveTime => (!MonoBehaviourSingleton<PlayerData>.Instance.QuickRevivePerkActivated) ? 5f : 2.5f; public void Spawn(int playerID, Vector3 pos) { //IL_001a: 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_003c: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.SetActive(true); AffectedPlayerID = playerID; ((Component)this).transform.position = pos + Vector3.up; _timer = 0f; ((Graphic)ReviveIcon).color = _defaultColor; MonoBehaviourSingleton<PlayersMgr>.Instance.ReviveButtons.Add(this); _available = true; } public void Despawn() { ((Component)this).gameObject.SetActive(false); MonoBehaviourSingleton<PlayersMgr>.Instance.ReviveButtons.Remove(this); _available = false; Object.Destroy((Object)(object)((Component)this).gameObject); } private void OnTriggerStay(Collider other) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((Component)other).GetComponent<FVRViveHand>())) { return; } if ((Object)(object)_handReviving == (Object)null) { _handReviving = ((Component)other).GetComponent<FVRViveHand>(); } if (_handReviving.Input.GripPressed) { ((Graphic)ReviveIcon).color = _reviveColor; _timer += Time.fixedDeltaTime; if (_timer >= ReviveTime) { if (Networking.IsHost()) { MonoBehaviourSingleton<CodZNetworking>.Instance.CustomData_PlayerID_Send(AffectedPlayerID, 2); } else { MonoBehaviourSingleton<CodZNetworking>.Instance.Client_CustomData_PlayerID_Send(AffectedPlayerID, 2); } _timer = 0f; _available = false; } } else { _timer = 0f; ((Graphic)ReviveIcon).color = _defaultColor; } } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) ((Component)this).transform.LookAt(((Component)this).transform.position + ((Component)GM.CurrentPlayerBody.Head).transform.rotation * Vector3.forward, ((Component)GM.CurrentPlayerBody.Head).transform.rotation * Vector3.up); } private void OnTriggerExit(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).GetComponent<FVRViveHand>())) { } } } namespace CustomScripts { public class Blockade : MonoBehaviour, IPurchasable { private int _id; public Action OnPurchase; public List<Transform> UnlockableZombieSpawnPoints; public List<Transform> UnlockableSpecialZombieSpawnPoints; public List<Text> CostTexts; public int Cost; [SerializeField] private bool _isOneTimeOnly = true; private bool _alreadyBought; private bool _alreadyUsed; public int PurchaseCost => Cost; public bool IsOneTimeOnly => _isOneTimeOnly; public bool AlreadyBought => _alreadyBought; private void OnValidate() { foreach (Text costText in CostTexts) { costText.text = Cost.ToString(); } } private void Start() { MonoBehaviourSingleton<GMgr>.Instance.Blockades.Add(this); _id = MonoBehaviourSingleton<GMgr>.Instance.Blockades.Count - 1; } public void TryBuying() { if (_alreadyUsed || !MonoBehaviourSingleton<GMgr>.Instance.TryRemovePoints(Cost)) { return; } if (Networking.IsHostOrSolo()) { Unlock(); if (Networking.IsHost()) { MonoBehaviourSingleton<CodZNetworking>.Instance.BlockadeCleared_Send(_id); } } else { MonoBehaviourSingleton<CodZNetworking>.Instance.Client_BlockadeCleared_Send(_id); } } public void Unlock() { _alreadyUsed = true; foreach (Transform unlockableZombieSpawnPoint in UnlockableZombieSpawnPoints) { if (!MonoBehaviourSingleton<ZombieManager>.Instance.CurrentLocation.ZombieSpawnPoints.Contains(unlockableZombieSpawnPoint)) { MonoBehaviourSingleton<ZombieManager>.Instance.CurrentLocation.ZombieSpawnPoints.Add(unlockableZombieSpawnPoint); } } foreach (Transform unlockableSpecialZombieSpawnPoint in UnlockableSpecialZombieSpawnPoints) { if (!MonoBehaviourSingleton<ZombieManager>.Instance.CurrentLocation.SpecialZombieSpawnPoints.Contains(unlockableSpecialZombieSpawnPoint)) { MonoBehaviourSingleton<ZombieManager>.Instance.CurrentLocation.SpecialZombieSpawnPoints.Add(unlockableSpecialZombieSpawnPoint); } } MonoBehaviourSingleton<AudioManager>.Instance.Play(MonoBehaviourSingleton<AudioManager>.Instance.BuySound, 0.5f); ((Component)this).gameObject.SetActive(false); if (OnPurchase != null) { OnPurchase(); } } } public class MysteryBox : MonoBehaviour, IPurchasable { public static Action<WeaponData> WeaponSpawnedEvent; public int Cost = 950; [SerializeField] private bool _isOneTimeOnly; private bool _alreadyBought; public List<WeaponData> Loot; public List<WeaponData> RareLoot; [Range(0f, 1f)] public float StartRareChance = 0.01f; public float ChanceIncreasePerRound = 0.003f; public float MaxRareChance = 0.1f; public CustomItemSpawner WeaponSpawner; public CustomItemSpawner AmmoSpawner; public AudioClip RollSound; [HideInInspector] public bool InUse = false; private MysteryBoxMover _mysteryBoxMover; [HideInInspector] public bool WillTeleport; [HideInInspector] public bool DidIRoll; public int PurchaseCost => Cost; public bool IsOneTimeOnly => _isOneTimeOnly; public bool AlreadyBought => _alreadyBought; private void Awake() { _mysteryBoxMover = ((Component)this).GetComponent<MysteryBoxMover>(); } public void TryBuy() { if (!InUse && MonoBehaviourSingleton<GMgr>.Instance.TryRemovePoints(Cost)) { DidIRoll = true; if (Networking.IsSolo()) { OnBuying(); } else if (Networking.IsHost()) { MonoBehaviourSingleton<CodZNetworking>.Instance.CustomData_Send(0); } else { MonoBehaviourSingleton<CodZNetworking>.Instance.Client_CustomData_Send(0); } } } public void OnBuying() { InUse = true; WillTeleport = false; MonoBehaviourSingleton<AudioManager>.Instance.Play(RollSound, 0.25f); if (Networking.IsHostOrSolo() && _mysteryBoxMover.CheckForTeleport()) { if (Networking.IsSolo()) { WillTeleport = true; } else { MonoBehaviourSingleton<CodZNetworking>.Instance.CustomData_Send(1); } } ((MonoBehaviour)this).StartCoroutine(DelayedSpawn()); } private IEnumerator DelayedSpawn() { yield return (object)new WaitForSeconds(5.5f); if (WillTeleport) { if (Networking.IsHostOrSolo()) { _mysteryBoxMover.StartTeleporting(); } } else { if (DidIRoll) { DidIRoll = false; float num = Mathf.Min(StartRareChance + ChanceIncreasePerRound * (float)MonoBehaviourSingleton<RoundManager>.Instance.RoundNumber, MaxRareChance); bool flag = Random.Range(0f, 1f) <= num; if (!GameSettings.WonderWeaponEnabled) { flag = false; } WeaponData weaponData; if (flag) { int index = Random.Range(0, RareLoot.Count); weaponData = RareLoot[index]; } else { int index2 = Random.Range(0, Loot.Count); weaponData = Loot[index2]; } WeaponSpawner.ObjectId = weaponData.DefaultSpawners[0]; AmmoSpawner.ObjectId = weaponData.DefaultSpawners[1]; GameObject val = WeaponSpawner.Spawn(); AmmoSpawner.Spawn(); val.GetComponent<WeaponWrapper>().SetOwner(GameManager.ID); if (WeaponSpawnedEvent != null) { WeaponSpawnedEvent(weaponData); } } InUse = false; } if (Networking.IsHostOrSolo()) { _mysteryBoxMover.CurrentRoll++; } } } public class MysteryBoxMover : MonoBehaviour { public bool MoveRandomlyOnStart = true; public List<Transform> SpawnPoints; public int CurrentSpawnPoint; [Range(0f, 100f)] public float TeleportChance = 20f; public int SafeRollsProvided = 3; public AudioClip TeddyBearSound; public AudioClip SecretTeddyBearSound; public Transform TeddyBear; [HideInInspector] public Transform CurrentPos; [HideInInspector] public int CurrentRoll = 0; private Animator _animator; private MysteryBox _mysteryBox; private Transform _parent; private int _nextTeleportWaypoint = -1; private void Awake() { _parent = ((Component)this).transform.parent; _animator = ((Component)_parent).GetComponent<Animator>(); _mysteryBox = ((Component)this).GetComponent<MysteryBox>(); } private void Start() { RoundManager.OnGameStarted = (Action)Delegate.Combine(RoundManager.OnGameStarted, new Action(TeleportOnStart)); } public void TeleportOnStart() { if (Networking.IsHostOrSolo() && MoveRandomlyOnStart) { int newWayPointID = (_nextTeleportWaypoint = GetRandomMovePoint()); Teleport(); if (Networking.IsHost()) { MonoBehaviourSingleton<CodZNetworking>.Instance.MysteryBoxMoved_Send(newWayPointID, immediate: true); } } } public void Teleport() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Transform val = SpawnPoints[_nextTeleportWaypoint]; CurrentSpawnPoint = _nextTeleportWaypoint; CurrentPos = val; ((Component)_parent).transform.position = val.position; ((Component)_parent).transform.rotation = val.rotation; CurrentRoll = 0; _mysteryBox.InUse = false; } public bool CheckForTeleport() { if (CurrentRoll <= SafeRollsProvided) { return false; } if ((float)Random.Range(0, 100) <= TeleportChance) { return true; } return false; } public void StartTeleporting() { int randomMovePoint = GetRandomMovePoint(); SetNextWaypoint(randomMovePoint); StartTeleportAnim(); if (Networking.IsHost()) { MonoBehaviourSingleton<CodZNetworking>.Instance.MysteryBoxMoved_Send(randomMovePoint, immediate: false); } } public void StartTeleportAnim() { GameObject gameObject; if (Random.Range(0, 1000) == 0) { gameObject = ((Component)TeddyBear.GetChild(1)).gameObject; MonoBehaviourSingleton<AudioManager>.Instance.Play(SecretTeddyBearSound); } else { gameObject = ((Component)TeddyBear.GetChild(0)).gameObject; MonoBehaviourSingleton<AudioManager>.Instance.Play(TeddyBearSound); } ((Component)TeddyBear).GetComponent<Animator>().Play("Activation"); gameObject.SetActive(true); ((MonoBehaviour)this).StartCoroutine(DelayedAnimation(gameObject)); } private IEnumerator DelayedAnimation(GameObject teddy) { yield return (object)new WaitForSeconds(3f); teddy.SetActive(false); yield return (object)new WaitForSeconds(1.2f); _animator.Play("Teleport"); ((MonoBehaviour)this).StartCoroutine(DelayedTeleport()); } private IEnumerator DelayedTeleport() { yield return (object)new WaitForSeconds(4.2f); Teleport(); } public int GetRandomMovePoint() { List<int> list = new List<int>(); for (int i = 0; i < SpawnPoints.Count; i++) { if (i != CurrentSpawnPoint) { list.Add(i); } } return list[Random.Range(0, list.Count)]; } public void SetNextWaypoint(int waypointID) { _nextTeleportWaypoint = waypointID; } private void OnDestroy() { RoundManager.OnGameStarted = (Action)Delegate.Remove(RoundManager.OnGameStarted, new Action(TeleportOnStart)); } } public class QuestionMarkBlinking : MonoBehaviour { public Renderer QuestionMark1; public Renderer QuestionMark2; private float _emissionValue; private int _emissionWeight; private bool _emit; private float _time; private void Awake() { _emissionWeight = Shader.PropertyToID("_EmissionWeight"); } private void Update() { if (_emit) { if (_time >= 1.5f) { _emit = false; ((MonoBehaviour)this).StartCoroutine(SmoothEmissionChange(0f, 1f, 1f)); _time = 0f; } } else if (_time >= 3f) { _emit = true; ((MonoBehaviour)this)