using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using TombRushHalloween;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("TombRush")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A special Halloween mod made for Slop Crew.")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("TombRush")]
[assembly: AssemblyTitle("TombRush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class CoroutineHelper : MonoBehaviour
{
public int currentZombieAmount;
public int currentSatelliteAmount;
public IEnumerator LoadScene()
{
currentZombieAmount = 0;
currentSatelliteAmount = 13;
Debug.Log((object)"Making scene adjustments...");
yield return (object)new WaitForSeconds(1f);
((Behaviour)Object.FindObjectOfType<AmbientManager>()).enabled = false;
Shader.SetGlobalColor("ShadowColor", new Color(0.1f, 0.15f, 0.2f, 1f));
Shader.SetGlobalColor("LightColor", new Color(0.4f, 0.2f, 0.4f, 1f));
GameObject satellites = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Satellites"));
Transform[] componentsInChildren = satellites.GetComponentsInChildren<Transform>();
foreach (Transform sat in componentsInChildren)
{
if (((Object)sat).name.Contains("Satellite"))
{
((Component)sat).gameObject.AddComponent<Satellite>();
}
}
try
{
Plugin.hitSoundObject = Object.Instantiate<GameObject>(Plugin.hitSoundPrefab, GameObject.Find("Player_HUMAN0").transform);
Plugin.hitSoundSource = Plugin.hitSoundObject.GetComponent<AudioSource>();
}
catch (Exception)
{
}
}
public void Test()
{
Plugin.isKing = true;
((MonoBehaviour)this).StartCoroutine(AddCrown());
}
public IEnumerator AddCrown()
{
yield return (object)new WaitForSeconds(3f);
try
{
if (!Plugin.isKing)
{
yield break;
}
bool hasCrown = false;
Transform[] componentsInChildren = GameObject.Find("Player_HUMAN0").GetComponentsInChildren<Transform>();
foreach (Transform t in componentsInChildren)
{
if (!(((Object)t).name == "head"))
{
continue;
}
Transform[] componentsInChildren2 = ((Component)t).GetComponentsInChildren<Transform>();
foreach (Transform child in componentsInChildren2)
{
if (((Object)child).name.Contains("CrownProp"))
{
hasCrown = true;
}
}
if (!hasCrown)
{
Object.Instantiate<GameObject>(Plugin.crown, t.position, Quaternion.identity, t);
}
}
}
catch (Exception)
{
}
}
public void DecreaseZombieCount(int amount)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
currentZombieAmount -= amount;
if (currentZombieAmount <= 20 && currentSatelliteAmount > 0)
{
Vector3 position = default(Vector3);
((Vector3)(ref position))..ctor(327.7377f, -1.6446f, -80.3011f);
Vector3 position2 = default(Vector3);
((Vector3)(ref position2))..ctor(280.0308f, -5.4126f, -2.5014f);
Vector3 position3 = default(Vector3);
((Vector3)(ref position3))..ctor(373.2899f, -8.8528f, -41.7996f);
((MonoBehaviour)this).StartCoroutine(SpawnZombies(30, position, Plugin.characterShader));
((MonoBehaviour)this).StartCoroutine(SpawnZombies(30, position2, Plugin.characterShader));
((MonoBehaviour)this).StartCoroutine(SpawnZombies(30, position3, Plugin.characterShader));
}
else if (currentZombieAmount <= 0 && currentSatelliteAmount <= 0)
{
Debug.Log((object)"All satellites and zombies defeated! YOU DID ITTTTTT");
Plugin.isKing = true;
((MonoBehaviour)this).StartCoroutine(AddCrown());
}
else
{
Debug.Log((object)(currentZombieAmount + " zombies remaining..."));
}
}
public void DecreaseSatelliteCount(int amount)
{
currentSatelliteAmount -= amount;
if (currentSatelliteAmount <= 0 && currentZombieAmount > 0)
{
Debug.Log((object)"ALL SATELLITES DESTROYED. Zombies can no longer respawn!");
}
else if (currentSatelliteAmount <= 0 && currentZombieAmount <= 0)
{
Debug.Log((object)"All satellites and zombies defeated! YOU DID ITTTTTT");
Plugin.isKing = true;
((MonoBehaviour)this).StartCoroutine(AddCrown());
}
else
{
Debug.Log((object)(currentSatelliteAmount + " satellites remaining..."));
}
}
public IEnumerator SpawnZombies(int amount, Vector3 position, Shader characterShader)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < amount; i++)
{
GameObject newZombie = Object.Instantiate<GameObject>(Plugin.zombie, position, Quaternion.identity, GameObject.Find("stageChunks").transform.Find("openHill"));
newZombie.AddComponent<Zombie>();
currentZombieAmount++;
Transform head = TransformExtentions.FindRecursive(newZombie.transform, "head");
int headPick = Random.Range(0, 3);
MeshRenderer[] possibleHeads = ((Component)head).GetComponentsInChildren<MeshRenderer>();
MeshRenderer[] array = possibleHeads;
foreach (MeshRenderer mesh in array)
{
if ((Object)(object)mesh != (Object)(object)possibleHeads[headPick])
{
Object.Destroy((Object)(object)mesh);
}
else
{
((Renderer)mesh).sharedMaterial.shader = characterShader;
}
}
int bodyPick = Random.Range(0, 3);
SkinnedMeshRenderer[] possibleBodies = newZombie.GetComponentsInChildren<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] array2 = possibleBodies;
foreach (SkinnedMeshRenderer mesh2 in array2)
{
if ((Object)(object)mesh2 != (Object)(object)possibleBodies[bodyPick])
{
Object.Destroy((Object)(object)mesh2);
}
else
{
((Renderer)mesh2).sharedMaterial.shader = characterShader;
}
}
yield return (object)new WaitForSeconds(0.5f);
}
}
}
namespace TombRushHalloween
{
public class DestroyOnTimer : MonoBehaviour
{
public float seconds = 5f;
private void Start()
{
Object.Destroy((Object)(object)((Component)this).gameObject, seconds);
}
}
[BepInPlugin("TombRush", "TombRush", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
public static GameObject zombie;
public static AnimationClip thrillerDance;
public static Shader characterShader;
public static AssetBundle bundle;
public static GameObject explodeEffect;
public static GameObject crown;
public static GameObject hitSoundPrefab;
public static GameObject hitSoundObject;
public static AudioSource hitSoundSource;
public static List<AudioClip> zombieSounds = new List<AudioClip>();
public static bool isKing = false;
private void Awake()
{
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
if (File.Exists(Path.Combine(Paths.PluginPath, "SlopBrew-TombRush", "tombrush")))
{
bundle = AssetBundle.LoadFromFile(Path.Combine(Paths.PluginPath, "SlopBrew-TombRush", "tombrush"));
zombie = bundle.LoadAsset<GameObject>("Zombie");
explodeEffect = bundle.LoadAsset<GameObject>("ExplodeEffect");
crown = bundle.LoadAsset<GameObject>("CrownProp");
hitSoundPrefab = bundle.LoadAsset<GameObject>("HitSound");
AudioClip[] array = bundle.LoadAllAssets<AudioClip>();
AudioClip[] array2 = array;
foreach (AudioClip val in array2)
{
if (((Object)val).name.Contains("zombie"))
{
zombieSounds.Add(val);
}
}
AnimationClip[] array3 = bundle.LoadAllAssets<AnimationClip>();
AnimationClip[] array4 = array3;
foreach (AnimationClip val2 in array4)
{
if (((Object)val2).name == "Thriller Part 2")
{
thrillerDance = val2;
}
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TombRush is loaded. Pull up!");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Plugin TombRush couldn't be loaded.");
}
Harmony val3 = new Harmony("io.SlopBrew.TombRush");
val3.PatchAll();
}
}
[HarmonyPatch(typeof(ASceneSetupInstruction))]
[HarmonyPatch("SetSceneActive")]
internal class patch_StageManager_OnPostRender
{
public static Texture2D[] bundleTextures;
private static void Prefix(string sceneToSetActive)
{
}
private static void Postfix(string sceneToSetActive)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
if (sceneToSetActive == "downhill")
{
GameObject val = new GameObject("SceneController");
CoroutineHelper coroutineHelper = val.AddComponent<CoroutineHelper>();
((MonoBehaviour)coroutineHelper).StartCoroutine(coroutineHelper.LoadScene());
Plugin.characterShader = ((Renderer)GameObject.Find("meshLank1").GetComponent<SkinnedMeshRenderer>()).sharedMaterial.shader;
Vector3 position = default(Vector3);
((Vector3)(ref position))..ctor(327.7377f, -1.6446f, -80.3011f);
Vector3 position2 = default(Vector3);
((Vector3)(ref position2))..ctor(280.0308f, -5.4126f, -2.5014f);
Vector3 position3 = default(Vector3);
((Vector3)(ref position3))..ctor(373.2899f, -8.8528f, -41.7996f);
((MonoBehaviour)coroutineHelper).StartCoroutine(coroutineHelper.SpawnZombies(20, position, Plugin.characterShader));
((MonoBehaviour)coroutineHelper).StartCoroutine(coroutineHelper.SpawnZombies(40, position2, Plugin.characterShader));
((MonoBehaviour)coroutineHelper).StartCoroutine(coroutineHelper.SpawnZombies(30, position3, Plugin.characterShader));
ChangeSkybox();
AddPrefabs();
}
}
private static void AddPrefabs()
{
GameObject val = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Skelly"));
bundleTextures = Plugin.bundle.LoadAllAssets<Texture2D>();
MeshRenderer[] componentsInChildren = GameObject.Find("openHill").GetComponentsInChildren<MeshRenderer>();
Shader shader = null;
MeshRenderer[] array = componentsInChildren;
foreach (MeshRenderer val2 in array)
{
if (!((Object)((Component)val2).gameObject).name.Contains("CombinedMeshes"))
{
continue;
}
Texture mainTexture = ((Renderer)val2).sharedMaterial.mainTexture;
Texture2D[] array2 = bundleTextures;
foreach (Texture2D val3 in array2)
{
if (((Object)val3).name.Contains(((Object)mainTexture).name))
{
((Renderer)val2).sharedMaterial.SetTexture("_MainTex", (Texture)(object)val3);
shader = ((Renderer)val2).sharedMaterial.shader;
}
}
}
MeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren<MeshRenderer>();
MeshRenderer[] array3 = componentsInChildren2;
foreach (MeshRenderer val4 in array3)
{
((Renderer)val4).sharedMaterial.shader = shader;
}
}
private static void ChangeSkybox()
{
RenderSettings.skybox = Plugin.bundle.LoadAsset<Material>("Skybox");
}
}
[HarmonyPatch(typeof(Player), "PlayAnim")]
public class DancePatch
{
public static AnimatorOverrideController thrillerOverride;
public static void Postfix(int newAnim, bool forceOverwrite, bool instant, float atTime, ref Player __instance)
{
}
}
public class Satellite : MonoBehaviour
{
private int health = 2;
private bool dead = false;
private void OnTriggerEnter(Collider other)
{
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0074: Unknown result type (might be due to invalid IL or missing references)
if (((Object)other).name == "autoAimCheck")
{
health--;
if (health <= 0 && !dead)
{
dead = true;
Object.FindObjectOfType<CoroutineHelper>().DecreaseSatelliteCount(1);
GameObject val = Object.Instantiate<GameObject>(Plugin.explodeEffect, ((Component)this).transform.position + Vector3.up, ((Component)this).transform.rotation);
val.AddComponent<DestroyOnTimer>();
Object.Destroy((Object)(object)((Component)this).gameObject);
}
else
{
GameObject val2 = Object.Instantiate<GameObject>(Plugin.explodeEffect, ((Component)this).transform.position + Vector3.up, ((Component)this).transform.rotation);
val2.AddComponent<DestroyOnTimer>();
}
}
}
}
public class Zombie : MonoBehaviour
{
private int health = 3;
public Transform targetedPlayer;
private Rigidbody rb;
private float speed;
private Vector3 lookPos;
private Animator animator;
private bool dead = false;
private bool stopped = false;
private AudioSource audio;
private void Start()
{
audio = ((Component)this).GetComponent<AudioSource>();
audio.pitch = Random.Range(0.7f, 1.1f);
}
private void OnEnable()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
rb = ((Component)this).GetComponent<Rigidbody>();
rb.velocity = Vector3.zero;
speed = Random.Range(0.3f, 1f);
animator = ((Component)this).GetComponent<Animator>();
animator.speed = speed * 2.5f;
lookPos = new Vector3(0f, ((Component)this).transform.position.y, 0f);
((MonoBehaviour)this).StopCoroutine(TimedZombieLogic());
((MonoBehaviour)this).StartCoroutine(TimedZombieLogic());
}
private void Update()
{
//IL_0033: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)targetedPlayer != (Object)null)
{
if (!dead && !stopped)
{
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(targetedPlayer.position.x, ((Component)this).transform.position.y, targetedPlayer.position.z);
lookPos = Vector3.MoveTowards(lookPos, val, 10f);
((Component)this).transform.LookAt(lookPos);
}
}
else
{
targetedPlayer = GameObject.Find("Player_HUMAN0").transform;
}
}
private void FixedUpdate()
{
//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)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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)
if (!dead && !stopped)
{
Vector3 val = rb.position + ((Component)this).transform.forward * Time.deltaTime * speed;
rb.MovePosition(val);
}
}
private void OnTriggerEnter(Collider other)
{
//IL_001f: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
if (!(((Object)other).name == "autoAimCheck") || !(Vector3.Distance(((Component)this).transform.position, ((Component)targetedPlayer).transform.position) <= 2f))
{
return;
}
if ((Object)(object)Plugin.hitSoundSource != (Object)null && !Plugin.hitSoundSource.isPlaying)
{
Plugin.hitSoundSource.pitch = Random.Range(0.7f, 1.2f);
Plugin.hitSoundSource.Play();
}
rb.AddForce((((Component)this).transform.up + -((Component)this).transform.forward) * 5f, (ForceMode)1);
health--;
if (health <= 0 && !dead)
{
animator.SetBool("Dead", true);
dead = true;
if (Random.Range(0, 10) > 7)
{
int index = Random.Range(0, Plugin.zombieSounds.Count);
audio.clip = Plugin.zombieSounds[index];
audio.Play();
}
((MonoBehaviour)this).StartCoroutine(Disappear());
Object.FindObjectOfType<CoroutineHelper>().DecreaseZombieCount(1);
}
else if (!dead)
{
animator.Play("Hurt", 0, 0f);
if (Random.Range(0, 10) > 7)
{
int index2 = Random.Range(0, Plugin.zombieSounds.Count);
audio.clip = Plugin.zombieSounds[index2];
audio.Play();
}
}
}
private IEnumerator Disappear()
{
yield return (object)new WaitForSeconds(3f);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
private IEnumerator TimedZombieLogic()
{
while (true)
{
stopped = false;
yield return (object)new WaitForSeconds(Random.Range(3f, 10f));
if (Random.Range(0, 10) >= 7)
{
if (!dead)
{
if (Random.Range(0, 10) > 7)
{
int newClip2 = Random.Range(0, Plugin.zombieSounds.Count);
audio.clip = Plugin.zombieSounds[newClip2];
audio.Play();
}
animator.Play("Idle");
stopped = true;
}
}
else if ((Object)(object)targetedPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)targetedPlayer).transform.position) <= 2f && !dead)
{
animator.Play("Hit");
((Component)targetedPlayer).GetComponent<Player>().GetHit(1, -((Component)this).transform.forward, (KnockbackType)3);
if (Random.Range(0, 10) > 5)
{
int newClip = Random.Range(0, Plugin.zombieSounds.Count);
audio.clip = Plugin.zombieSounds[newClip];
audio.Play();
}
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TombRush";
public const string PLUGIN_NAME = "TombRush";
public const string PLUGIN_VERSION = "0.0.1";
}
}