Decompiled source of WILDCARD REPO v0.16.3
BepInEx/plugins/WildCardMod/REPOWildCardMod.dll
Decompiled 7 hours 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MoreUpgrades; using MoreUpgrades.Classes; using Photon.Pun; using REPOLib.Extensions; using REPOLib.Modules; using REPOWildCardMod.Config; using REPOWildCardMod.Items; using REPOWildCardMod.NetcodePatcher; using REPOWildCardMod.Patches; using REPOWildCardMod.Utils; using REPOWildCardMod.Valuables; using TMPro; using UnityEditor; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPOWildCardMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Scan Computers")] [assembly: AssemblyProduct("REPOWildCardMod")] [assembly: AssemblyCopyright("Copyright © Scan Computers 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a4fd09a5-2078-4f37-ae81-44c02af535da")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace REPOWildCardMod { [BepInPlugin("deB.WildCard", "WILDCARD REPO", "0.16.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WildCardMod : BaseUnityPlugin { internal const string modGUID = "deB.WildCard"; internal const string modName = "WILDCARD REPO"; internal const string modVersion = "0.16.3"; private readonly Harmony harmony = new Harmony("deB.WildCard"); internal ManualLogSource log = null; public WildCardUtils utils; public static WildCardMod instance; public bool moreUpgradesPresent = false; public List<GameObject> valList = new List<GameObject>(); public List<Item> itemList = new List<Item>(); public List<Reskin> reskinList = new List<Reskin>(); public List<GameObject> miscPrefabsList = new List<GameObject>(); internal WildCardConfig ModConfig { get; private set; } = null; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } log = ((BaseUnityPlugin)this).Logger; utils = new WildCardUtils(); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); for (int j = 0; j < methods.Length; j++) { object[] customAttributes; try { customAttributes = methods[j].GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); } catch { continue; } if (customAttributes.Length != 0) { methods[j].Invoke(null, null); } } } if (Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades")) { moreUpgradesPresent = true; } AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "wildcardmod")); string[] allAssetNames = val.GetAllAssetNames(); for (int k = 0; k < allAssetNames.Length; k++) { string text = allAssetNames[k].Substring(0, allAssetNames[k].LastIndexOf("/")); switch (text) { case "assets/my creations/resources/valuables": valList.Add(val.LoadAsset<GameObject>(allAssetNames[k])); break; case "assets/my creations/resources/items": itemList.Add(val.LoadAsset<Item>(allAssetNames[k])); break; case "assets/my creations/resources/reskins": reskinList.Add(val.LoadAsset<Reskin>(allAssetNames[k])); break; case "assets/my creations/resources/misc": { Object val2 = val.LoadAsset(allAssetNames[k]); Object val3 = val2; Object val4 = val3; GameObject val5 = (GameObject)(object)((val4 is GameObject) ? val4 : null); if (val5 != null) { miscPrefabsList.Add(val5); } else { log.LogWarning((object)("\"" + allAssetNames[k] + "\" was not a valid type, skipping.")); } break; } default: log.LogWarning((object)("\"" + text + "\" is not a known asset path, skipping.")); break; } } ModConfig = new WildCardConfig(((BaseUnityPlugin)this).Config, valList, itemList, reskinList); DummyValuable dummyValuable = default(DummyValuable); for (int l = 0; l < valList.Count; l++) { if (ModConfig.isValEnabled[l].Value) { bool flag = true; if (valList[l].TryGetComponent<DummyValuable>(ref dummyValuable)) { ScriptableObject script = dummyValuable.script; ScriptableObject val6 = script; Item val7 = (Item)(object)((val6 is Item) ? val6 : null); if (val7 != null) { itemList.Add(val7); } else { flag = false; } } if (flag) { Valuables.RegisterValuable(valList[l]); log.LogDebug((object)(((Object)valList[l]).name + " valuable was loaded!")); } else { log.LogInfo((object)(((Object)valList[l]).name + " dummy did not have a valid setup")); } } else { log.LogInfo((object)(((Object)valList[l]).name + " valuable was disabled!")); } } for (int m = 0; m < itemList.Count; m++) { if (m >= ModConfig.isItemEnabled.Count || ModConfig.isItemEnabled[m].Value) { Items.RegisterItem(itemList[m]); log.LogDebug((object)(((Object)itemList[m]).name + " item was loaded!")); } else { log.LogInfo((object)(((Object)itemList[m]).name + " item was disabled!")); } } for (int n = 0; n < reskinList.Count; n++) { if (!ModConfig.isReskinEnabled[n].Value || ModConfig.reskinChance[n].Value <= 0f) { log.LogInfo((object)(reskinList[n].identifier + " reskin was disabled!")); } } for (int num = 0; num < miscPrefabsList.Count; num++) { NetworkPrefabs.RegisterNetworkPrefab("Misc/" + ((Object)miscPrefabsList[num]).name, miscPrefabsList[num]); Utilities.FixAudioMixerGroups(miscPrefabsList[num]); } log.LogDebug((object)"Patching Game"); harmony.PatchAll(typeof(CameraGlitchPatches)); harmony.PatchAll(typeof(EnemyParentPatches)); harmony.PatchAll(typeof(HurtColliderPatch)); harmony.PatchAll(typeof(PhysGrabObjectPatches)); harmony.PatchAll(typeof(PlayerAvatarPatch)); harmony.PatchAll(typeof(StatsManagerPatches)); harmony.PatchAll(typeof(WorldSpaceUIValueLostPatches)); if (ModConfig.harmonyPatches.Value) { harmony.PatchAll(typeof(PhysGrabberRayCheckPatch)); } else { log.LogInfo((object)"Disabled Giwi's Transpilers"); } log.LogInfo((object)"WILDCARD REPO Successfully Loaded"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "REPOWildCardMod"; public const string PLUGIN_NAME = "REPOWildCardMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace REPOWildCardMod.Valuables { public class AlolanVulpixie : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; private readonly WildCardUtils utils = WildCardMod.instance.utils; public PhotonView photonView; public PhysGrabObject physGrabObject; public GameObject[] pixieMeshes; public Sound[] pixieSounds; public PhysicMaterial physMat; public Animator animator; public bool scrungle = false; public float voiceTimer; public void Start() { physGrabObject.OverrideMaterial(physMat, -123f); } public void Update() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (physGrabObject.grabbed) { if (voiceTimer > 0f) { voiceTimer -= Time.deltaTime; return; } voiceTimer = Random.Range(0.5f, 2.5f); int num = utils.BoolToInt(scrungle); pixieSounds[num].Play(((Component)pixieSounds[num].Source).transform.position, 1f, 1f, 1f, 1f); } } public void PixieImpact(bool sad) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) int num = utils.BoolToInt(sad); scrungle = !scrungle; pixieMeshes[1].SetActive(scrungle); pixieMeshes[0].SetActive(!scrungle); pixieSounds[num].Play(((Component)pixieSounds[num].Source).transform.position, 1f, 1f, 1f, 1f); log.LogDebug((object)$"Vulpixie Scrungle: {scrungle}, Vulpixie Sadge: {sad}"); } public void ImpactSquish() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { photonView.RPC("SquishRPC", (RpcTarget)0, new object[1] { impactForce }); } else { SquishRPC(impactForce); } } } [PunRPC] public void SquishRPC(float force) { animator.SetLayerWeight(1, Mathf.Clamp01(force / 150f)); animator.SetTrigger("Squish"); } } public class Ari : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; private readonly WildCardUtils utils = WildCardMod.instance.utils; public PhotonView photonView; public PhysGrabObject physGrabObject; public Animator animator; public PhysicMaterial physMat; public Sound ariSounds; public Sound flapLoop; public float balanceForce = 0.1f; public float chirpTimer; public void Start() { physGrabObject.OverrideMaterial(physMat, -123f); } public void FixedUpdate() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) //IL_00c9: 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_00db: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || !physGrabObject.grabbed) { return; } bool flag = false; for (int i = 0; i < physGrabObject.playerGrabbing.Count; i++) { if (physGrabObject.playerGrabbing[i].isRotating) { flag = true; break; } } if (!flag) { physGrabObject.OverrideTorqueStrengthX(0f, 0.1f); physGrabObject.OverrideTorqueStrengthZ(0f, 0.1f); Quaternion val = Quaternion.FromToRotation(((Component)this).transform.up, Vector3.up); physGrabObject.rb.AddTorque(new Vector3(val.x, val.y, val.z) * balanceForce); } physGrabObject.rb.AddForce(Random.insideUnitSphere / 2f + ((Component)this).transform.up / 1.3f, (ForceMode)1); } public void Update() { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) flapLoop.PlayLoop(animator.GetBool("Grabbed"), 1f, 1f, 1f); if (physGrabObject.grabbed) { if (!animator.GetBool("Grabbed")) { animator.SetBool("Grabbed", true); } } else if (animator.GetBool("Grabbed")) { animator.SetBool("Grabbed", false); } if (!ariSounds.Source.isPlaying && chirpTimer <= 0f) { if (physGrabObject.grabbed) { EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 15f); log.LogDebug((object)"Ari Chirp Alert!"); } ariSounds.Play(physGrabObject.rb.worldCenterOfMass, 1f, 1f, 1f, 1f); animator.SetTrigger("Chirp"); chirpTimer = (Random.value + 1f) * 2f; } else if (chirpTimer > 0f) { chirpTimer -= Time.deltaTime * (float)(utils.BoolToInt(physGrabObject.grabbed) + 1); } } public void ImpactSquish() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { photonView.RPC("SquishRPC", (RpcTarget)0, new object[1] { impactForce }); } else { SquishRPC(impactForce); } } } [PunRPC] public void SquishRPC(float force) { animator.SetLayerWeight(1, Mathf.Clamp01(force / 150f)); animator.SetTrigger("Squish"); } } public class ChaosEmerald : MonoBehaviour { private static readonly ManualLogSource log = WildCardMod.instance.log; public PhotonView photonView; public ValuableObject valuableObject; public PhysGrabObject physGrabObject; public Color[] colors; public MeshRenderer meshRenderer; public Sound sonicLoop; public void Start() { if (SemiFunc.IsMasterClientOrSingleplayer()) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("PickColorRPC", (RpcTarget)0, new object[1] { Random.Range(0, colors.Length) }); } else { PickColorRPC(Random.Range(0, colors.Length)); } } } [PunRPC] public void PickColorRPC(int index) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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) ((Renderer)meshRenderer).material.SetColor("_BaseColor", colors[index]); GradientColorKey[] colorKeys = valuableObject.particleColors.colorKeys; for (int i = 0; i < colorKeys.Length; i++) { colorKeys[i] = new GradientColorKey(colors[index], colorKeys[i].time); } valuableObject.particleColors.colorKeys = colorKeys; if (index == 6) { ((Renderer)meshRenderer).material.SetColor("_EmissionColor", new Color(0.4f, 0.4f, 0.4f, 1f)); } else { ((Renderer)meshRenderer).material.SetColor("_EmissionColor", new Color(colors[index].r / 2f, colors[index].g / 2f, colors[index].b / 2f, 1f)); } } public void Update() { if (!physGrabObject.grabbed) { return; } for (int i = 0; i < physGrabObject.playerGrabbing.Count; i++) { if (physGrabObject.playerGrabbing[i].isLocal) { PlayerController.instance.OverrideSpeed(2f, 0.1f); } } } public void AddPlayerEmerald() { //IL_0150: Unknown result type (might be due to invalid IL or missing references) log.LogDebug((object)"Adding a Chaos Emerald point"); if (SemiFunc.IsMasterClientOrSingleplayer()) { string text = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal()); StatsManager.instance.dictionaryOfDictionaries["playerUpgradeChaosEmeralds"][text]++; if (StatsManager.instance.dictionaryOfDictionaries["playerUpgradeChaosEmeralds"][text] >= 7) { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeChaosEmeralds"][text] = 0; SuperSonic(); } if (SemiFunc.IsMultiplayer()) { photonView.RPC("PropogateEmeraldsRPC", (RpcTarget)1, new object[2] { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeChaosEmeralds"][text], text }); } } List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); for (int i = 0; i < list.Count; i++) { if (list[i].isLocal) { StatsUI.instance.Fetch(); StatsUI.instance.ShowStats(); CameraGlitch.Instance.PlayUpgrade(); } GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, list[i].clientPosition, 0.2f); if (SemiFunc.IsMasterClientOrSingleplayer()) { list[i].playerHealth.MaterialEffectOverride((Effect)0); } } } public void SuperSonic() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(((Component)CameraGlitch.Instance).gameObject); Component[] components = val.GetComponents<Component>(); for (int i = 0; i < components.Length; i++) { if (((object)components[i]).GetType() == typeof(Animator)) { Object.Destroy((Object)(object)components[i]); } else if (((object)components[i]).GetType() == typeof(AudioSource)) { ref AudioSource source = ref sonicLoop.Source; Component obj = components[i]; source = (AudioSource)(object)((obj is AudioSource) ? obj : null); } } val.transform.parent = ((Component)PlayerController.instance).transform; val.transform.localPosition = Vector3.zero; SuperSonic superSonic = val.AddComponent<SuperSonic>(); superSonic.sonicLoop = new Sound { Source = sonicLoop.Source, Sounds = sonicLoop.Sounds, Type = sonicLoop.Type, Volume = sonicLoop.Volume, VolumeRandom = sonicLoop.VolumeRandom, Pitch = sonicLoop.Pitch, PitchRandom = sonicLoop.PitchRandom, SpatialBlend = sonicLoop.SpatialBlend, ReverbMix = sonicLoop.ReverbMix, Doppler = sonicLoop.Doppler }; } [PunRPC] public void PropogateEmeraldsRPC(int emeralds, string masterID) { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeChaosEmeralds"][masterID] = emeralds; string text = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal()); if (emeralds != StatsManager.instance.dictionaryOfDictionaries["playerUpgradeChaosEmeralds"][text]) { photonView.RPC("SetEmeraldsRPC", (RpcTarget)0, new object[2] { text, emeralds }); } } [PunRPC] public void SetEmeraldsRPC(string steamID, int emeralds) { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][steamID] = emeralds; } } public class SuperSonic : MonoBehaviour { public float overrideTimer; public Sound sonicLoop; public PlayerAvatar[] playersList; public void Start() { overrideTimer = 120f; playersList = SemiFunc.PlayerGetAll().ToArray(); sonicLoop.LowPassIgnoreColliders.Add(PlayerController.instance.col); } public void Update() { for (int i = 0; i < playersList.Length; i++) { if (!((Object)(object)playersList[i] != (Object)null)) { continue; } if (playersList[i].isLocal) { sonicLoop.PlayLoop(overrideTimer > 10f, 2f, 0.5f, 1f); if (SemiFunc.IsMultiplayer()) { PlayerAvatar.instance.voiceChat.OverridePitch(1.5f, 1f, 0.25f, 0.1f, true); } PlayerAvatar.instance.OverridePupilSize(0.3f, 4, 0.25f, 1f, 5f, 0.5f, 0.1f); PlayerController.instance.OverrideSpeed(3f, 0.1f); PlayerController.instance.OverrideAnimationSpeed(2.5f, 1f, 0.5f, 0.1f); if (!PlayerAvatar.instance.isTumbling) { PlayerController.instance.OverrideTimeScale(2.5f, 0.1f); } if ((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)null) { PhysGrabber.instance.grabbedPhysGrabObject.OverrideTorqueStrength(1.5f, 0.1f); } CameraZoom.Instance.OverrideZoomSet(90f, 0.1f, 1f, 0.5f, (GameObject)null, 0); PostProcessing.Instance.SaturationOverride(50f, 0.5f, 0.1f, 0.1f, (GameObject)null); } else { playersList[i].voiceChat.OverridePitch(1.5f, 1f, 0.25f, 0.1f, true); } } overrideTimer -= Time.deltaTime; if (!SemiFunc.RunIsLevel() && overrideTimer > 5f) { overrideTimer = 5f; } if (overrideTimer <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class ChiikawaValuable : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public PhotonView photonView; public ValuableObject valuableObject; public PhysGrabObject physGrabObject; public ChiikawaType[] types; public ChiikawaType chiikawa; public bool chiikawaChosen; public MeshRenderer faceRenderer; public Material faceMaterial; public Sound chiikawaSounds; public Animator animator; public float faceTimer; public void Awake() { for (int i = 0; i < types.Length; i++) { types[i].chosenTransforms = (Transform[])(object)new Transform[9] { types[i].chosenBody, types[i].chosenHead, types[i].chosenLeftEar, types[i].chosenRightEar, types[i].chosenLeftArm, types[i].chosenRightArm, types[i].chosenLeftLeg, types[i].chosenRightLeg, types[i].chosenTail }; } } public void Start() { if (SemiFunc.IsMasterClientOrSingleplayer()) { int num = Random.Range(0, types.Length); while (types[num].audioClips.Length == 0) { log.LogDebug((object)(types[num].name + " has not been set up, selecting a new chiikawa")); num = Random.Range(0, types.Length); } if (SemiFunc.IsMultiplayer()) { photonView.RPC("SelectTypeRPC", (RpcTarget)0, new object[1] { num }); } else { SelectTypeRPC(num); } } ((MonoBehaviour)this).StartCoroutine(ChiikawaSetup()); } public IEnumerator ChiikawaSetup() { yield return (object)new WaitUntil((Func<bool>)(() => chiikawaChosen)); log.LogDebug((object)("Chiikawa character selected: \"" + chiikawa.name + "\"")); for (int i = 0; i < chiikawa.chosenTransforms.Length; i++) { ((Component)chiikawa.chosenTransforms[i]).gameObject.SetActive(true); } PhysAudio newAudio = ScriptableObject.CreateInstance<PhysAudio>(); newAudio.impactLight = valuableObject.audioPreset.impactLight; newAudio.impactMedium = valuableObject.audioPreset.impactMedium; newAudio.impactHeavy = valuableObject.audioPreset.impactHeavy; newAudio.breakLight = valuableObject.audioPreset.breakLight; newAudio.breakMedium = valuableObject.audioPreset.breakMedium; newAudio.breakHeavy = valuableObject.audioPreset.breakHeavy; newAudio.destroy = valuableObject.audioPreset.destroy; newAudio.breakLight.Sounds = chiikawa.audioClips; newAudio.breakMedium.Sounds = chiikawa.audioClips; newAudio.breakHeavy.Sounds = chiikawa.audioClips; valuableObject.audioPreset = newAudio; chiikawaSounds.Sounds = chiikawa.audioClips; ((Object)((Component)this).gameObject).name = "Valuable " + chiikawa.name; physGrabObject.OverrideMaterial(new PhysicMaterial { dynamicFriction = 0.25f, staticFriction = 0.05f, bounciness = chiikawa.bounciness, frictionCombine = (PhysicMaterialCombine)0, bounceCombine = (PhysicMaterialCombine)3 }, -123f); animator.SetLayerWeight(1, chiikawa.wiggle * 0.5f + 0.5f); faceRenderer = ((Component)chiikawa.chosenHead).GetComponent<MeshRenderer>(); if (!((Object)(object)chiikawa.newMainMaterial != (Object)null)) { yield break; } GradientColorKey[] colorKeys = valuableObject.particleColors.colorKeys; for (int k = 0; k < colorKeys.Length; k++) { colorKeys[k] = new GradientColorKey(chiikawa.newMainMaterial.color, colorKeys[k].time); } valuableObject.particleColors.colorKeys = colorKeys; MeshRenderer renderer = default(MeshRenderer); for (int j = 0; j < chiikawa.chosenTransforms.Length; j++) { Transform[] children = ((Component)chiikawa.chosenTransforms[j]).GetComponentsInChildren<Transform>(); for (int l = 0; l < children.Length; l++) { if (((Component)children[l]).TryGetComponent<MeshRenderer>(ref renderer)) { if (((Renderer)renderer).materials.Length == 0) { ((Renderer)renderer).materials = (Material[])(object)new Material[1] { chiikawa.newMainMaterial }; } else if (((Renderer)renderer).materials.Length == 2) { Material newMaterial = chiikawa.newMainMaterial; if ((Object)(object)chiikawa.overrideHeadMaterial != (Object)null) { newMaterial = chiikawa.overrideHeadMaterial; } ((Renderer)renderer).materials = (Material[])(object)new Material[2] { newMaterial, faceMaterial }; } } renderer = null; } } } [PunRPC] public void SelectTypeRPC(int i) { chiikawa = types[i]; chiikawaChosen = true; } public void Update() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (chiikawaSounds.Sounds.Length == 0) { return; } if (physGrabObject.grabbed) { if (!chiikawaSounds.Source.isPlaying) { chiikawaSounds.Play(chiikawa.chosenHead.position, 1f, 1f, 1f, 1f); } if (!animator.GetBool("Grabbed")) { animator.SetBool("Grabbed", true); } if ((Object)(object)((Renderer)faceRenderer).materials[1].mainTexture != (Object)(object)chiikawa.upsetFace) { ((Renderer)faceRenderer).materials[1].mainTexture = (Texture)(object)chiikawa.upsetFace; } if (faceTimer != 2f) { faceTimer = 2f; } } else { if (animator.GetBool("Grabbed")) { animator.SetBool("Grabbed", false); } if (faceTimer <= 0f && (Object)(object)((Renderer)faceRenderer).materials[1].mainTexture != (Object)(object)chiikawa.neutralFace) { ((Renderer)faceRenderer).materials[1].mainTexture = (Texture)(object)chiikawa.neutralFace; } if (faceTimer > 0f) { faceTimer -= Time.deltaTime; } } } public void FixedUpdate() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) //IL_005f: 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) if (SemiFunc.IsMasterClientOrSingleplayer() && physGrabObject.grabbed && chiikawaChosen) { physGrabObject.rb.AddForce(Random.insideUnitSphere * chiikawa.wiggle / 4f, (ForceMode)1); physGrabObject.rb.AddTorque(Random.insideUnitSphere * chiikawa.wiggle, (ForceMode)1); } } } [Serializable] public class ChiikawaType { public string name; [Space(20f)] [Header("Body Parts")] public Transform[] chosenTransforms; public Transform chosenBody; public Transform chosenHead; public Transform chosenLeftEar; public Transform chosenRightEar; public Transform chosenLeftArm; public Transform chosenRightArm; public Transform chosenLeftLeg; public Transform chosenRightLeg; public Transform chosenTail; public Material newMainMaterial; public Material overrideHeadMaterial; [Space(10f)] [Header("Face Textures")] public Texture2D neutralFace; public Texture2D upsetFace; [Space(10f)] [Header("Attributes")] public AudioClip[] audioClips; [Range(0.01f, 1f)] public float wiggle; [Range(0.01f, 0.8f)] public float bounciness; } public class CloverBee : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public PhotonView photonView; public PhysGrabObject physGrabObject; public Texture2D[] eyeTextures; public MeshRenderer meshRenderer; public Sound angryBees; public Sound happyBees; public Animator animator; public Color originalEmission; public Color originalFresnelEmission; public float blinkTimer; public float unblinkTimer; public float balanceForce = 4f; public float angerTimer; public float playerDamageTimer; public float floatHeight = 0.75f; public float floatPower = 5f; public void Start() { //IL_0014: 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) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) originalEmission = ((Renderer)meshRenderer).materials[0].GetColor("_EmissionColor"); originalFresnelEmission = ((Renderer)meshRenderer).materials[0].GetColor("_FresnelEmissionColor"); } public void FixedUpdate() { //IL_005a: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } bool flag = false; for (int i = 0; i < physGrabObject.playerGrabbing.Count; i++) { if (physGrabObject.playerGrabbing[i].isRotating) { flag = true; break; } } Quaternion val = Quaternion.FromToRotation(((Component)this).transform.up, Vector3.up); if (!flag) { if (physGrabObject.grabbed) { physGrabObject.OverrideTorqueStrengthX(0f, 0.1f); physGrabObject.OverrideTorqueStrengthZ(0f, 0.1f); } physGrabObject.rb.AddTorque(new Vector3(val.x, val.y, val.z) * balanceForce); } RaycastHit val2 = default(RaycastHit); if (physGrabObject.grabbed) { physGrabObject.rb.AddForce(Random.insideUnitSphere / 2f + ((Component)this).transform.up / 1.3f, (ForceMode)1); } else if (Physics.Raycast(physGrabObject.rb.worldCenterOfMass, -((Component)this).transform.up, ref val2, floatHeight, LayerMask.GetMask(new string[6] { "Default", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "Enemy", "Player" }), (QueryTriggerInteraction)1)) { physGrabObject.rb.AddForce(((Component)this).transform.up * (floatPower / ((RaycastHit)(ref val2)).distance) * (1.1f - Quaternion.Angle(Quaternion.identity, val) / 360f)); } } public void Update() { //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) bool flag = angerTimer > 0f; angryBees.PlayLoop(flag, 2f, 1f, 1f); happyBees.PlayLoop(!flag, 2f, 1f, 1f); if (physGrabObject.impactHappenedTimer > 0f) { if (animator.GetFloat("Wing Speed") != 0f) { animator.SetFloat("Wing Speed", 0f); } } else if (animator.GetFloat("Wing Speed") != 1f) { animator.SetFloat("Wing Speed", 1f); } if (angerTimer > 0f) { if (physGrabObject.grabbedLocal && playerDamageTimer <= 0f) { PlayerAvatar.instance.playerHealth.Hurt(1, true, -1); playerDamageTimer = 0.5f; } else if (playerDamageTimer > 0f) { playerDamageTimer -= Time.deltaTime; } angerTimer -= Time.deltaTime; return; } if ((Object)(object)((Renderer)meshRenderer).materials[0].GetTexture("_BaseTexture") == (Object)(object)eyeTextures[2]) { SetFresnelTexture(((Renderer)meshRenderer).materials[0], (Texture)(object)eyeTextures[0]); SetEmission(((Renderer)meshRenderer).materials[0], original: true); SetEmission(((Renderer)meshRenderer).materials[1], original: true); log.LogDebug((object)"Clover Bee Calm"); return; } if (blinkTimer > 0f) { blinkTimer -= Time.deltaTime; } else if ((Object)(object)((Renderer)meshRenderer).materials[0].GetTexture("_BaseTexture") == (Object)(object)eyeTextures[0]) { SetFresnelTexture(((Renderer)meshRenderer).materials[0], (Texture)(object)eyeTextures[1]); unblinkTimer = 0.25f; } if (unblinkTimer > 0f) { unblinkTimer -= Time.deltaTime; } else if ((Object)(object)((Renderer)meshRenderer).materials[0].GetTexture("_BaseTexture") == (Object)(object)eyeTextures[1]) { SetFresnelTexture(((Renderer)meshRenderer).materials[0], (Texture)(object)eyeTextures[0]); blinkTimer = Random.Range(0.75f, 2f); } } public void OnBreak() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) SetFresnelTexture(((Renderer)meshRenderer).materials[0], (Texture)(object)eyeTextures[2]); SetEmission(((Renderer)meshRenderer).materials[0], original: false, Color.red / 2f); SetEmission(((Renderer)meshRenderer).materials[1], original: false, Color.red / 2f); log.LogDebug((object)"Clover Bee Angry"); angerTimer = Random.Range(0.5f, 1.5f); } public void SetFresnelTexture(Material mat, Texture texture) { mat.SetTexture("_BaseTexture", texture); mat.SetTexture("_EmissionTexture", texture); } public void SetEmission(Material mat, bool original, Color colour = default(Color)) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) if (original) { mat.SetColor("_EmissionColor", originalEmission); mat.SetColor("_FresnelEmissionColor", originalFresnelEmission); } else { mat.SetColor("_EmissionColor", colour); mat.SetColor("_FresnelEmissionColor", colour); } } } public class DragonBall : MonoBehaviour { private static readonly ManualLogSource log = WildCardMod.instance.log; public PhotonView photonView; public Mesh[] starMeshes; public MeshFilter meshFilter; public List<string> wishableUpgrades; public void Start() { if (SemiFunc.IsMasterClientOrSingleplayer()) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("ChooseStarsRPC", (RpcTarget)0, new object[1] { Random.Range(0, starMeshes.Length) }); } else { ChooseStarsRPC(Random.Range(0, starMeshes.Length)); } wishableUpgrades = StatsManager.instance.FetchPlayerUpgrades(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal())).Keys.ToList(); wishableUpgrades.Remove("Dragon Balls"); wishableUpgrades.Remove("Chaos Emeralds"); wishableUpgrades.Remove("Map Player Count"); wishableUpgrades.Remove("Throw"); } } [PunRPC] public void ChooseStarsRPC(int index) { meshFilter.mesh = starMeshes[index]; } public void AddPlayerBall() { //IL_0150: Unknown result type (might be due to invalid IL or missing references) log.LogDebug((object)"Adding a Dragon Ball point"); if (SemiFunc.IsMasterClientOrSingleplayer()) { string text = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal()); StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][text]++; if (StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][text] >= 7) { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][text] = 0; DragonBallWish(); } if (SemiFunc.IsMultiplayer()) { photonView.RPC("PropogateBallsRPC", (RpcTarget)1, new object[2] { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][text], text }); } } List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); for (int i = 0; i < list.Count; i++) { if (list[i].isLocal) { StatsUI.instance.Fetch(); StatsUI.instance.ShowStats(); CameraGlitch.Instance.PlayUpgrade(); } GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, list[i].clientPosition, 0.2f); if (SemiFunc.IsMasterClientOrSingleplayer()) { list[i].playerHealth.MaterialEffectOverride((Effect)0); } } } public void DragonBallWish() { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (SemiFunc.IsMultiplayer()) { List<string> list = wishableUpgrades; List<PlayerAvatar> list2 = SemiFunc.PlayerGetAll(); for (int i = 0; i < list2.Count; i++) { if (list.Count == 0) { list = wishableUpgrades; } int index = Random.Range(0, list.Count); MegaUpgrade(SemiFunc.PlayerGetSteamID(list2[i]), list[index]); list.RemoveAt(index); } } else { MegaUpgrade(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal()), wishableUpgrades[Random.Range(0, wishableUpgrades.Count)]); } } public void MegaUpgrade(string steamID, string upgrade) { log.LogDebug((object)("Dragon Ball Mega Upgrading: \"" + upgrade + "\"")); switch (upgrade) { case "Health": { for (int i = 0; i < 11; i++) { PunManager.instance.UpgradePlayerHealth(steamID); } return; } case "Stamina": { for (int l = 0; l < 11; l++) { PunManager.instance.UpgradePlayerEnergy(steamID); } return; } case "Launch": { for (int n = 0; n < 11; n++) { PunManager.instance.UpgradePlayerTumbleLaunch(steamID); } return; } case "Speed": { for (int j = 0; j < 11; j++) { PunManager.instance.UpgradePlayerSprintSpeed(steamID); } return; } case "Strength": { for (int num = 0; num < 11; num++) { PunManager.instance.UpgradePlayerGrabStrength(steamID); } return; } case "Range": { for (int m = 0; m < 11; m++) { PunManager.instance.UpgradePlayerGrabRange(steamID); } return; } case "Extra Jump": { for (int k = 0; k < 11; k++) { PunManager.instance.UpgradePlayerExtraJump(steamID); } return; } } if (WildCardMod.instance.moreUpgradesPresent) { MoreUpgradesUpgrade(steamID, upgrade); return; } log.LogWarning((object)("Dragon Ball wish for upgrade: " + upgrade + " failed, retrying...")); wishableUpgrades.Remove(upgrade); DragonBallWish(); } [MethodImpl(MethodImplOptions.NoInlining)] public void MoreUpgradesUpgrade(string steamID, string upgrade) { if (Plugin.instance.upgradeItems.Find((UpgradeItem x) => x.name == upgrade) == null) { log.LogWarning((object)("Dragon Ball wish upgrade tried to use MoreUpgrades' \"" + upgrade + "\" but something went wrong")); return; } log.LogDebug((object)("Using MoreUpgrades to upgrade \"" + upgrade + "\"!")); MoreUpgradesManager.instance.Upgrade(upgrade, steamID, 10); } [PunRPC] public void PropogateBallsRPC(int balls, string masterID) { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][masterID] = balls; string text = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal()); if (balls != StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][text]) { photonView.RPC("SetBallsRPC", (RpcTarget)0, new object[2] { text, balls }); } } [PunRPC] public void SetBallsRPC(string steamID, int balls) { StatsManager.instance.dictionaryOfDictionaries["playerUpgradeDragonBalls"][steamID] = balls; } } public class DummyValuable : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public ScriptableObject script; public void Awake() { //IL_0067: 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) if (SemiFunc.IsMasterClientOrSingleplayer()) { ScriptableObject val = script; ScriptableObject val2 = val; Item val3 = (Item)(object)((val2 is Item) ? val2 : null); if (val3 != null) { val3 = StatsManager.instance.itemDictionary[val3.itemAssetName]; log.LogDebug((object)("Spawning " + val3.itemName + " from dummy!")); GameObject val4 = Items.SpawnItem(val3, ((Component)this).transform.position, ((Component)this).transform.rotation); val4.SetActive(true); log.LogDebug((object)("Spawned " + ((Object)val4).name + "!")); } else { log.LogWarning((object)(((Object)this).name + " was unable to spawn!")); } ValuableDirector instance = ValuableDirector.instance; instance.totalMaxAmount++; ValuableDirector instance2 = ValuableDirector.instance; instance2.valuableTargetAmount--; } } public void Start() { if (SemiFunc.IsMasterClientOrSingleplayer()) { ((Component)((Component)this).transform).GetComponent<PhysGrabObject>().DestroyPhysGrabObject(); } } } public class FixatedNoseTrap : Trap { private readonly ManualLogSource log = WildCardMod.instance.log; public ParticleScriptExplosion explodeScript; public PhysicMaterial physMat; public Animator animator; public override void Start() { ((Trap)this).Start(); base.physGrabObject.OverrideMaterial(physMat, -123f); } public override void Update() { ((Trap)this).Update(); if (base.trapStart && SemiFunc.IsMasterClientOrSingleplayer()) { base.physGrabObject.impactDetector.DestroyObject(true); } } public void ImpactSquish() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = base.physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { base.photonView.RPC("SquishRPC", (RpcTarget)0, new object[1] { impactForce }); } else { SquishRPC(impactForce); } if (!base.physGrabObject.impactDetector.inCart && !base.physGrabObject.roomVolumeCheck.inExtractionPoint) { ((Trap)this).TrapStart(); } } } [PunRPC] public void SquishRPC(float force) { animator.SetLayerWeight(1, Mathf.Clamp01(force / 150f)); animator.SetTrigger("Squish"); } public void NoseExplode() { //IL_0007: 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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, PlayerAvatar.instance.clientPosition) < 10f && !base.physGrabObject.grabbedLocal) { CameraGlitch.Instance.PlayShort(); } base.enemyInvestigate = true; base.enemyInvestigateRange = 10f; log.LogDebug((object)(((Object)((Component)this).gameObject).name + " is exploding!")); if (Random.value < 0.9f) { explodeScript.Spawn(((Component)this).transform.position, 0.245f, 5, 5, 2.5f, false, false, 1f); } else { explodeScript.Spawn(((Component)this).transform.position, 2f, 20, 20, 5f, false, false, 1f); } } } public class GiwiWormValuable : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public GiwiRigidbody[] giwiRigidbodies; public Sound giwiSounds; public PhysGrabObject physGrabObject; public PhotonView photonView; public Animator animator; public float animTimer = 0f; public float animLerp; public float startTime = 0.5f; public float targetTime = 0.5f; public float animSpeed; public float dropTimer; public void Start() { if (SemiFunc.IsMultiplayer()) { if (!SemiFunc.IsMasterClient()) { for (int i = 0; i < giwiRigidbodies.Length; i++) { giwiRigidbodies[i].rb.collisionDetectionMode = (CollisionDetectionMode)0; } } } else { PhotonTransformView[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<PhotonTransformView>(); for (int j = 0; j < componentsInChildren.Length; j++) { ((Behaviour)componentsInChildren[j]).enabled = false; } } } public void Update() { //IL_0074: 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) if (physGrabObject.grabbedLocal) { PhysGrabber.instance.OverridePullDistanceIncrement(-0.5f * Time.deltaTime); physGrabObject.OverrideGrabStrength(40f, 0.1f); } if (physGrabObject.grabbed) { if (!giwiSounds.Source.isPlaying) { EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 10f); giwiSounds.Play(((Component)giwiRigidbodies[10].rb).transform.position, 1f, 1f, 1f, 1f); log.LogDebug((object)(((Object)giwiSounds.Source.clip).name ?? "")); } } else if (giwiSounds.Source.isPlaying) { giwiSounds.Stop(); } if (animTimer <= 0f) { animLerp = 0f; if (SemiFunc.IsMasterClientOrSingleplayer()) { animTimer = Random.Range(0.5f, 2f); float num = Mathf.Max(Random.value, 0.125f) * 2f; float value = Random.value; if (GameManager.Multiplayer()) { photonView.RPC("TargetTimeRPC", (RpcTarget)0, new object[4] { value, targetTime, num, animTimer }); } else { TargetTimeRPC(value, targetTime, num, animTimer); } } } else if (animLerp < 1f) { animator.SetFloat("Motion Time", Mathf.Lerp(startTime, targetTime, Mathf.Clamp01(animLerp))); animLerp += Time.deltaTime * animSpeed; } else { animTimer -= Time.deltaTime; } } public void FixedUpdate() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (physGrabObject.grabbed || dropTimer > 0f) { Vector3 val = default(Vector3); for (int i = 1; i < giwiRigidbodies.Length; i++) { giwiRigidbodies[i].newDirTimer -= Time.fixedDeltaTime; if (giwiRigidbodies[i].newDirTimer <= 0f) { if (physGrabObject.grabbed) { ((Vector3)(ref val))..ctor(1f, 1f, 1f); } else { ((Vector3)(ref val))..ctor(1f, 0.1f, 1f); } giwiRigidbodies[i].direction = Vector3.Scale(Random.onUnitSphere, val); giwiRigidbodies[i].newDirTimer = Random.Range(0.05f, 0.25f); } giwiRigidbodies[i].Wiggle(Random.Range(4f, 10f) * ((float)Mathf.Max(i, 3) / 2f), Random.Range(3f, 8f) * -1f); } if (physGrabObject.grabbed && dropTimer != 5f) { dropTimer = 5f; } } if (!physGrabObject.grabbed) { dropTimer -= Time.fixedDeltaTime; } } [PunRPC] public void TargetTimeRPC(float tTime, float sTime, float speed, float animTime) { targetTime = tTime; startTime = sTime; animSpeed = speed; animTimer = animTime; } } [Serializable] public class GiwiRigidbody { public Rigidbody rb; public Vector3 direction; public float newDirTimer; public void Wiggle(float forceIntensity, float torqueIntensity) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) rb.AddForce(direction * forceIntensity); rb.AddTorque(Random.onUnitSphere * torqueIntensity); } } public class MarioDice : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public PhysGrabObject physGrabObject; public ParticleScriptExplosion explodeScript; public Transform[] diceNumbers; public Sound diceSound; public float diceTimer; public bool grabReset = false; public GameObject[] colliders; public bool hasSettled; public bool wasGrabbed; public bool beingThrown; public void Update() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } physGrabObject.OverrideIndestructible(0.1f); if (((Vector3)(ref physGrabObject.rbAngularVelocity)).magnitude > 0.01f) { if (hasSettled) { hasSettled = false; } } else if (!hasSettled) { hasSettled = true; } if (physGrabObject.grabbed) { if (!wasGrabbed) { wasGrabbed = true; } if (hasSettled) { hasSettled = false; } } else if (wasGrabbed) { wasGrabbed = false; beingThrown = true; physGrabObject.rb.AddTorque(Random.onUnitSphere * 5f, (ForceMode)1); physGrabObject.rb.AddForce(Vector3.up * Random.Range(0.5f, 2f) + new Vector3((Random.value * 2f - 1f) * 2f, 0f, Random.value * 2f - 1f) * 2f, (ForceMode)1); hasSettled = false; ToggleCollider(grabbable: false); } if (hasSettled && beingThrown) { if (diceTimer > 0f) { diceTimer -= Time.deltaTime; } else { RollDice(); } } else if (diceTimer != 1f) { diceTimer = 1f; } if (physGrabObject.rb.freezeRotation != hasSettled) { FreezeRotation(hasSettled); } } public void FreezeRotation(bool freeze) { if (SemiFunc.IsMultiplayer()) { physGrabObject.photonView.RPC("FreezeRotationRPC", (RpcTarget)0, new object[1] { freeze }); } else { FreezeRotationRPC(freeze); } } [PunRPC] public void FreezeRotationRPC(bool freeze) { physGrabObject.rb.freezeRotation = freeze; } public void RollDice() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) diceTimer = 1f; beingThrown = false; ToggleCollider(grabbable: true); float num = 0f; int num2 = 0; for (int i = 0; i < diceNumbers.Length; i++) { float y = diceNumbers[i].position.y; if (y > num) { num = y; num2 = i; } } num2++; float num3 = 0f; switch (num2) { case 1: if (physGrabObject.impactDetector.valuableObject.dollarValueCurrent >= physGrabObject.impactDetector.valuableObject.dollarValueOriginal * 45f) { if (SemiFunc.IsMultiplayer()) { physGrabObject.impactDetector.photonView.RPC("BreakRPC", (RpcTarget)0, new object[4] { physGrabObject.impactDetector.valuableObject.dollarValueCurrent, physGrabObject.centerPoint, 2, true }); } else { physGrabObject.impactDetector.BreakRPC(physGrabObject.impactDetector.valuableObject.dollarValueCurrent, physGrabObject.centerPoint, 2, true); } return; } num3 = 0.75f; break; case 2: num3 = 2f / 3f; break; case 3: num3 = 0.5f; break; case 4: num3 = -1f; break; case 5: num3 = -2f; break; case 6: num3 = -3f; break; } PhysGrabObjectImpactDetector impactDetector = physGrabObject.impactDetector; if (Mathf.Abs(num3) * impactDetector.valuableObject.dollarValueCurrent > impactDetector.valuableObject.dollarValueOriginal * 50f) { num3 = 1f - impactDetector.valuableObject.dollarValueOriginal * 50f / impactDetector.valuableObject.dollarValueCurrent; } log.LogDebug((object)$"Dice Value Changing from: \"{impactDetector.valuableObject.dollarValueCurrent}\", to: \"{impactDetector.valuableObject.dollarValueCurrent - num3 * impactDetector.valuableObject.dollarValueCurrent}\""); if (SemiFunc.IsMultiplayer()) { impactDetector.photonView.RPC("BreakRPC", (RpcTarget)0, new object[4] { num3 * impactDetector.valuableObject.dollarValueCurrent, physGrabObject.centerPoint, 2, true }); } else { impactDetector.BreakRPC(num3 * impactDetector.valuableObject.dollarValueCurrent, physGrabObject.centerPoint, 2, true); } if (Mathf.Abs(num3) < 1f) { diceSound.Pitch = 0.75f; } else { diceSound.Pitch = 1f; } diceSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } public void ToggleCollider(bool grabbable) { if (SemiFunc.IsMultiplayer()) { physGrabObject.photonView.RPC("ToggleColliderRPC", (RpcTarget)0, new object[1] { grabbable }); } else { ToggleColliderRPC(grabbable); } } [PunRPC] public void ToggleColliderRPC(bool grabbable) { if (grabbable) { colliders[0].SetActive(true); colliders[1].SetActive(false); } else { colliders[0].SetActive(false); colliders[1].SetActive(true); } } public void AntiGamblingLaws() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) explodeScript.Spawn(((Component)this).transform.position, 2f, 20, 20, 5f, false, false, 1f); } } public class MooCowValuable : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public PhotonView photonView; public PhysGrabObject physGrabObject; public Animator animator; public PhysicMaterial physMat; public Sound cowSounds; public float balanceForce = 0.1f; public float mooTimer; public bool mooTrigger; public void Start() { physGrabObject.OverrideMaterial(physMat, -123f); } public void FixedUpdate() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) //IL_00c9: 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_00db: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || !physGrabObject.grabbed) { return; } bool flag = false; for (int i = 0; i < physGrabObject.playerGrabbing.Count; i++) { if (physGrabObject.playerGrabbing[i].isRotating) { flag = true; break; } } if (!flag) { physGrabObject.OverrideTorqueStrengthX(0f, 0.1f); physGrabObject.OverrideTorqueStrengthZ(0f, 0.1f); Quaternion val = Quaternion.FromToRotation(((Component)this).transform.up, Vector3.up); physGrabObject.rb.AddTorque(new Vector3(val.x, val.y, val.z) * balanceForce); } physGrabObject.rb.AddForce(Random.insideUnitSphere / 2f + ((Component)this).transform.up / 1.3f, (ForceMode)1); } public void Update() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && physGrabObject.grabbedLocal && PlayerVoiceChat.instance.isTalking && mooTrigger) { int num = new Random().Next(-3, 4); if (num <= 0) { num = 1; } string text = ""; for (int i = 1; i < num; i++) { int num2 = new Random().Next(2, 6); string text2 = "m"; for (int j = 0; j < num2; j++) { text2 += "o"; } text2 += " "; text += text2; } text = text.Trim(); log.LogDebug((object)("Moo Cow making player chat: \"" + text + "\"")); ChatManager.instance.PossessChatScheduleStart(9); ChatManager.instance.PossessChat((PossessChatID)1, text, 2f, Color.blue, 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); mooTrigger = false; } if (!ChatManager.instance.chatActive && ChatManager.instance.spamTimer <= 0f && !mooTrigger) { mooTrigger = true; } if (physGrabObject.grabbed) { if (!animator.GetBool("Grabbed")) { animator.SetBool("Grabbed", true); } if (!cowSounds.Source.isPlaying && mooTimer <= 0f) { EnemyDirector.instance.SetInvestigate(((Component)this).transform.position, 15f); cowSounds.Play(physGrabObject.rb.worldCenterOfMass, 1f, 1f, 1f, 1f); mooTimer = (Random.value + 0.25f) * 2f; } else if (mooTimer > 0f) { mooTimer -= Time.deltaTime; } } else if (animator.GetBool("Grabbed")) { animator.SetBool("Grabbed", false); } } public void ImpactSquish() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { photonView.RPC("SquishRPC", (RpcTarget)0, new object[1] { impactForce }); } else { SquishRPC(impactForce); } } } [PunRPC] public void SquishRPC(float force) { animator.SetLayerWeight(1, Mathf.Clamp01(force / 150f)); animator.SetTrigger("Squish"); } } public enum JarFloater { Other, V0, V1, V2 } public class PixelJar : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; public ParticleSystem particle; public ParticleSystemRenderer particleRenderer; public Animator animator; public bool settled = true; public PhysGrabObject physGrabObject; public Texture2D[] floaterVariants; public JarFloater floater; public float bobLerp; public float verticalSpeed; public float horizontalSpeed; public bool pickingUp = true; public PhotonView photonView; public void Start() { if (SemiFunc.IsMasterClientOrSingleplayer()) { int num = Random.Range(0, floaterVariants.Length); if (SemiFunc.IsMultiplayer()) { photonView.RPC("FloaterTextureRPC", (RpcTarget)0, new object[1] { num }); } else { SetTexture(num); } } } public void FixedUpdate() { //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) if (bobLerp > 0.25f) { if (settled) { settled = false; } animator.SetFloat("Vertical Speed", Mathf.Clamp(bobLerp * verticalSpeed, 1f, 2f)); animator.SetFloat("Horizontal Speed", Mathf.Clamp(bobLerp * horizontalSpeed, 1f, 2f)); animator.SetLayerWeight(1, bobLerp); animator.SetLayerWeight(2, bobLerp); bobLerp -= Time.deltaTime / 2f; } else if (!settled) { settled = true; animator.SetFloat("Vertical Speed", 1f); animator.SetFloat("Horizontal Speed", 1f); animator.SetLayerWeight(1, 0.25f); animator.SetLayerWeight(2, 0.25f); bobLerp = 0.25f; } if (physGrabObject.grabbedLocal && pickingUp && SemiFunc.IsMultiplayer()) { pickingUp = false; string[] array = new string[11] { "ON TOP", "ON BOT", "are my people!", "is so me", "... more like pee", "is so cute I wanna die!", "sucks", "... I spit on you", "speaks to me in, like, a spiritual way", "is so sick nasty", "better watch out" }; string text = array[Random.Range(0, array.Length)]; Color val = default(Color); switch (floater) { case JarFloater.V0: text = "V0 " + text; val = Color.green; break; case JarFloater.V1: text = "V1 " + text; val = Color.cyan; break; case JarFloater.V2: text = "V2 " + text; ((Color)(ref val))..ctor(0.5f, 0f, 1f); break; case JarFloater.Other: return; } log.LogDebug((object)(((Object)((Component)this).gameObject).name + " making player chat: \"" + text + "\"")); ChatManager.instance.PossessChatScheduleStart(9); ChatManager.instance.PossessChat((PossessChatID)1, text, 2f, val, 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); } else if (!physGrabObject.grabbedLocal && !pickingUp) { pickingUp = true; } } public void ImpactBob() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { photonView.RPC("BobRPC", (RpcTarget)0, new object[1] { impactForce }); } else { BobRPC(impactForce); } } } [PunRPC] public void BobRPC(float force) { bobLerp = Mathf.Clamp(force / 75f, 0.5f, 2f); RandomSpeed(); } public void DestroyParticle() { particle.Stop(); particle.Clear(); } public void RandomSpeed() { if (Random.value > 0.5f) { verticalSpeed = (Random.value + 1f) * -1f; horizontalSpeed = Random.value + 1f; } else { verticalSpeed = Random.value + 1f; horizontalSpeed = (Random.value + 1f) * -1f; } log.LogDebug((object)$"{((Object)((Component)this).gameObject).name} selecting new speeds: Up/Down \"{verticalSpeed}\", Left/Right \"{horizontalSpeed}\""); } public void SetTexture(int index) { string name = ((Object)floaterVariants[index]).name; log.LogDebug((object)(((Object)((Component)this).gameObject).name + "'s selected floater was \"" + name + "\"")); switch (name) { case "v0": floater = JarFloater.V0; break; case "v1": floater = JarFloater.V1; break; case "v2": floater = JarFloater.V2; break; default: floater = JarFloater.Other; break; } ((Renderer)particleRenderer).material.mainTexture = (Texture)(object)floaterVariants[index]; ((Renderer)particleRenderer).material.SetTexture("_EmissionMap", (Texture)(object)floaterVariants[index]); RandomSpeed(); } [PunRPC] public void FloaterTextureRPC(int index) { SetTexture(index); } } public class Sleepyhead : Trap { public int state = 0; public PhotonView sleepyPhotonView; public Sound[] mouseSounds; public Texture[] faceTextures; public Texture[] particleTextures; public MeshRenderer meshRenderer; public ParticleSystem particleSystem; public ParticleSystemRenderer particleSystemRenderer; public PhysicMaterial physMat; public Animator animator; public ParticleScriptExplosion explodeScript; public bool angry = false; public float angerTimer = 0f; public bool impulse = true; public bool pickingUp = true; public bool explodeMode = false; public int explodeCounter = 0; public int timesAngered = 0; public override void Start() { ((Trap)this).Start(); base.physGrabObject.OverrideMaterial(physMat, -123f); } public override void Update() { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Update(); if (base.physGrabObject.grabbed && !base.trapTriggered && pickingUp) { ((Trap)this).TrapStart(); pickingUp = false; } else if (!base.physGrabObject.grabbed) { pickingUp = true; } if (SemiFunc.IsMasterClientOrSingleplayer()) { if (base.trapStart && !angry && !explodeMode) { SetState(1); } else if (angerTimer <= 0f && angry && !explodeMode) { SetState(0); } if (angerTimer > 0f) { angerTimer -= Time.deltaTime; } } if (impulse) { StateImpulse(state, angry); impulse = false; } if ((explodeMode && (Object)(object)base.physGrabObject.impactDetector.impactAudio.impactLight.Source == (Object)null) || ((Object)(object)base.physGrabObject.impactDetector.impactAudio.impactLight.Source != (Object)null && !base.physGrabObject.impactDetector.impactAudio.impactLight.Source.isPlaying)) { ImpactSquish(); base.physGrabObject.impactDetector.impactAudio.impactLight.Play(((Component)this).transform.position, 1f + (float)explodeCounter / 25f, 1f, 1f, 1f); explodeCounter++; if (explodeCounter >= 26) { explodeScript.Spawn(((Component)this).transform.position, 0.75f, 20, 40, 2.5f, false, false, 1f); explodeCounter = 0; explodeMode = false; } } mouseSounds[0].PlayLoop(!angry, 1f, 2f, 1f); mouseSounds[1].PlayLoop(angry, 1f, 2f, 1f); } public void StateImpulse(int id, bool angerState) { ((Renderer)meshRenderer).materials[1].mainTexture = faceTextures[id]; ((Renderer)particleSystemRenderer).material.mainTexture = particleTextures[id]; if (angerState && id == 0) { base.trapStart = false; angry = false; base.enemyInvestigate = false; base.trapActive = false; base.trapTriggered = false; } else if (!angerState && id == 1) { timesAngered++; if (timesAngered >= 5) { explodeMode = true; } angry = true; base.enemyInvestigateRange = 10f; base.enemyInvestigate = true; base.trapActive = true; base.trapTriggered = true; if (SemiFunc.IsMasterClientOrSingleplayer()) { angerTimer = Random.Range(7.5f, 20f); } } } public void SetState(int index) { if (SemiFunc.IsMultiplayer()) { sleepyPhotonView.RPC("SetStateRPC", (RpcTarget)0, new object[1] { index }); } else { SetStateRPC(index); } } [PunRPC] public void SetStateRPC(int index) { if (state != index) { impulse = true; } state = index; } public void ImpactSquish() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = base.physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { base.photonView.RPC("SquishRPC", (RpcTarget)0, new object[1] { impactForce }); } else { SquishRPC(impactForce); } if (!explodeMode && !base.physGrabObject.roomVolumeCheck.inExtractionPoint && !base.physGrabObject.impactDetector.inCart) { ((Trap)this).TrapStart(); } } } [PunRPC] public void SquishRPC(float force) { animator.SetLayerWeight(1, Mathf.Clamp01(force / 150f)); animator.SetTrigger("Squish"); } } public class Tigerbun : MonoBehaviour { private readonly ManualLogSource log = WildCardMod.instance.log; private readonly WildCardUtils utils = WildCardMod.instance.utils; public PhotonView photonView; public PhysGrabObject physGrabObject; public ValuableObject valuableObject; public Sound ravenousLoop; public Texture2D[] faceTextures; public MeshRenderer meshRenderer; public Animator animator; public void Update() { bool flag = physGrabObject.grabbed && valuableObject.dollarValueCurrent <= valuableObject.dollarValueOriginal / 2f; ravenousLoop.PlayLoop(flag, 2f, 1f, 1f); if ((Object)(object)((Renderer)meshRenderer).materials[1].mainTexture != (Object)(object)faceTextures[utils.BoolToInt(flag)]) { log.LogDebug((object)$"Tigerbun angry: {flag}"); ((Renderer)meshRenderer).materials[1].mainTexture = (Texture)(object)faceTextures[utils.BoolToInt(flag)]; } if (animator.GetBool("Angry") != flag) { animator.SetBool("Angry", flag); } } public void FixedUpdate() { //IL_0049: 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_006a: 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 (SemiFunc.IsMasterClientOrSingleplayer() && physGrabObject.grabbed && valuableObject.dollarValueCurrent <= valuableObject.dollarValueOriginal / 2f) { physGrabObject.rb.AddForce(Random.insideUnitSphere * 0.5f, (ForceMode)1); physGrabObject.rb.AddTorque(Random.insideUnitSphere * 2f, (ForceMode)1); } } public void OnBreak() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || !(valuableObject.dollarValueCurrent <= valuableObject.dollarValueOriginal / 2f)) { return; } if (physGrabObject.grabbed) { for (int i = 0; i < physGrabObject.playerGrabbing.Count; i++) { PlayerAvatar playerAvatar = physGrabObject.playerGrabbing[i].playerAvatar; playerAvatar.playerHealth.HurtOther(5, ((Component)playerAvatar).transform.position, true, -1); } } else if ((Object)(object)physGrabObject.lastPlayerGrabbing != (Object)null) { PlayerAvatar lastPlayerGrabbing = physGrabObject.lastPlayerGrabbing; lastPlayerGrabbing.playerHealth.HurtOther(2, ((Component)lastPlayerGrabbing).transform.position, true, -1); } } public void ImpactSquish() { if (SemiFunc.IsMasterClientOrSingleplayer()) { float impactForce = physGrabObject.impactDetector.impactForce; if (GameManager.Multiplayer()) { photonView.RPC("SquishRPC", (RpcTarget)0, new object[1] { impactForce }); } else { SquishRPC(impactForce); } } } [PunRPC] public void SquishRPC(float force) { animator.SetLayerWeight(1, Mathf.Clamp01(force / 150f)); animator.SetTrigger("Squish"); } } } namespace REPOWildCardMod.Utils { public class WildCardUtils { private readonly ManualLogSource log = WildCardMod.instance.log; public Transform FindEnemyTransform(string enemy, string type) { Transform result = null; EnemyParent val = EnemyDirector.instance.enemiesSpawned.Find((EnemyParent x) => x.enemyName == enemy); if ((Object)(object)val == (Object)null) { log.LogWarning((object)("Enemy \"" + enemy + "\" is not spawned!")); return null; } List<Transform> list = ((Component)val).GetComponentsInChildren<Transform>().ToList(); bool flag = true; switch (enemy) { case "Animal": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "Eyes"); } else { flag = false; } break; case "Apex Predator": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM Head"); } else { flag = false; } break; case "Banger": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "[ANIM BODY TOP]"); } else { flag = false; } break; case "Bowtie": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM EYES"); } else { flag = false; } break; case "Chef": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "hat"); } else { flag = false; } break; case "Clown": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "[ANIM HAT]"); } else { flag = false; } break; case "Gnome": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM HEAD"); } else { flag = false; } break; case "Headman": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "Top Mesh"); } else { flag = false; } break; case "Hidden": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "Breath Source"); } else { flag = false; } break; case "Huntsman": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM HEAD"); } else { flag = false; } break; case "Mentalist": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM head_raw"); } else { flag = false; } break; case "Peeper": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "Pupil"); } else { flag = false; } break; case "Reaper": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM head"); } else { flag = false; } break; case "Robe": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "Head"); } else { flag = false; } break; case "Rugrat": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM HEAD"); } else { flag = false; } break; case "Shadow Child": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "Thin man head"); } else { flag = false; } break; case "Spewer": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "enemy slow mouth flying top"); } else { flag = false; } break; case "Trudge": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "ANIM head_top"); } else { flag = false; } break; case "Upscream": if (type == "Head") { result = list.Find((Transform x) => ((Object)x).name == "head"); } else { flag = false; } break; default: result = list[0]; log.LogWarning((object)("Enemy \"" + enemy + "\" has not been set up")); break; } if (!flag) { log.LogWarning((object)("Transform of type \"" + type + "\" for enemy \"" + enemy + "\" has not been set up")); } return result; } public bool TextIsSimilar(string first, string second) { string text = first.Replace(" ", string.Empty); string text2 = second.Replace(" ", string.Empty); if (first == second) { return true; } if (first == second.ToLower() || first == second.ToUpper()) { return true; } if (first == second.TrimStart() || first == second.TrimEnd()) { return true; } string text3 = second; if (first == text3.Substring(1, text3.Length - 1) || first == second.Substring(0, second.Length - 2)) { return true; } if (text == text2) { return true; } if (text == text2.ToLower() || text == text2.ToUpper()) { return true; } if (text == text2.TrimStart() || text == text2.TrimEnd()) { return true; } text3 = text2; if (text == text3.Substring(1, text3.Length - 1) || text == text2.Substring(0, text2.Length - 2)) { return true; } return false; } public string CleanText(string text) { string text2 = Regex.Replace(text, "[^\\u0000-\\u007F]+", string.Empty); if (text2 == string.Empty) { text2 = $"this is nicer {text.Length}"; } return text2; } public bool IntToBool(int binary) { if (binary > 1) { binary = 1; } else if (binary < 0) { binary = 0; } if (binary == 1) { return true; } return false; } public int BoolToInt(bool binary) { if (binary) { return 1; } return 0; } } [Serializable] public class Chance { [Range(0f, 1f)] [Delayed] public float value; } [Serializable] public class Replacer { public List<BodyParts> bodyParts = new List<BodyParts>(); } [Serializable] public class BodyParts { public string transformName = ""; public Mesh newMesh; public List<Material> newMaterials = new List<Material>(); } [CreateAssetMenu(menuName = "WCScriptableObjects/Reskin", order = 1)] public class Reskin : ScriptableObject { public string identifier = ""; [Space] public Chance replaceChance = new Chance { value = 1f }; public Chance[] variantChances = new Chance[0]; public AnimationCurve variantsCurve; [Space] public List<Replacer> replacers = new List<Replacer>(); [MethodImpl(MethodImplOptions.NoInlining)] public void OnValidate() { //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown for (int i = 0; i < variantChances.Length; i++) { if (replacers.Count < i + 1) { replacers.Add(new Replacer()); } else if (replacers.Count > variantChances.Length) { replacers.RemoveAt(replacers.Count - 1); } } float num = 0f; for (int j = 0; j < variantChances.Length; j++) { num += variantChances[j].value; } if (num > 1f) { for (int k = 0; k < variantChances.Length; k++) { variantChances[k].value -= (float)Math.Round((decimal)((num - 1f) / (float)variantChances.Length), 2); if (variantChances[k].value < 0.001f) { variantChances[k].value = 0f; } } } else if (num < 1f) { for (int l = 0; l < variantChances.Length; l++) { variantChances[l].value += (float)Math.Round((decimal)((1f - num) / (float)variantChances.Length), 2); if ((double)variantChances[l].value > 0.999) { variantChances[l].value = 1f; } } } variantsCurve = new AnimationCurve(); variantsCurve.AddKey(0f, 0f); float num2 = 0f; for (int m = 0; m < variantChances.Length; m++) { variantsCurve.AddKey(num2 + variantChances[m].value, (float)m + 1f); num2 += variantChances[m].value; } ref Keyframe reference = ref variantsCurve.keys[^1]; ((Keyframe)(ref reference)).value = ((Keyframe)(ref reference)).value - 1f; for (int n = 0; n < variantsCurve.length; n++) { AnimationUtility.SetKeyLeftTangentMode(variantsCurve, n, (TangentMode)2); AnimationUtility.SetKeyRightTangentMode(variantsCurve, n, (TangentMode)2); } } } } namespace REPOWildCardMod.Patches { [HarmonyPatch(typeof(CameraGlitch))] public static class CameraGlitchPatches { [HarmonyPatch("Awake")] [HarmonyPrefix] public static bool InstanceProtection(CameraGlitch __instance) { if ((Object)(object)CameraGlitch.Instance != (Object)null) { Object.Destroy((Object)(object)__instance); return false; } return true; } } [HarmonyPatch(typeof(EnemyParent))] public static class EnemyParentPatches { private static readonly ManualLogSource log = WildCardMod.instance.log; [HarmonyPatch("SpawnRPC")] [HarmonyPostfix] public static void AddEnemyToList(EnemyParent __instance) { SmithNote[] array = Object.FindObjectsOfType<SmithNote>(); if (array != null && array.Length != 0) { for (int i = 0; i < array.Length; i++) { ((MonoBehaviour)array[i]).StartCoroutine(array[i].FirstSpawnCoroutine(__instance)); } } } [HarmonyPatch("DespawnRPC")] [HarmonyPostfix] public static void RemoveEnemyFromList(EnemyParent __instance) { SmithNote[] array = Object.FindObjectsOfType<SmithNote>(); if (array != null && array.Length != 0) { for (int i = 0; i < array.Length; i++) { array[i].RemoveEnemy(__instance); } } } [HarmonyPatch("Awake")] [HarmonyPrefix] public static bool ReskinEnemy(EnemyParent __instance) { WildCardConfig modConfig = WildCardMod.instance.ModConfig; List<Reskin> reskinList = WildCardMod.instance.reskinList; int index = -1; Reskin reskin = null; for (int i = 0; i < reskinList.Count; i++) { if (reskinList[i].identifier == __instance.enemyName && modConfig.isReskinEnabled[i].Value && modConfig.reskinChance[i].Value > 0f) { reskin = reskinList[i]; index = i; break; } } if ((Object)(object)reskin != (Object)null) { log.LogDebug((object)("Reskin for " + __instance.enemyName + " found!")); if (Random.value <= modConfig.reskinChance[index].Value) { log.LogDebug((object)("New skin for " + reskin.identifier + " is being applied!")); int num = 0; if (reskin.variantChances.Length > 1) { AnimationCurve variantsCurve = reskin.variantsCurve; float num2 = 0f; for (int j = 0; j < modConfig.reskinVariantChance[index].Count; j++) { ((Keyframe)(ref variantsCurve.keys[j + 1])).time = num2; num2 += modConfig.reskinVariantChance[index][j].Value; } num = Mathf.FloorToInt(variantsCurve.Evaluate(Random.value)); if (num == reskin.variantChances.Length) { num--; } log.LogDebug((object)$"{__instance.enemyName} reskin selected variant {num + 1}"); } bool flag = true; string enemyName = __instance.enemyName; string text = enemyName; if (text == "Rugrat") { MeshFilter[] componentsInChildren = ((Component)((Component)__instance).transform).GetComponentsInChildren<MeshFilter>(true); List<Transform> list = new List<Transform>(); for (int k = 0; k < componentsInChildren.Length; k++) { list.Add(((Component)componentsInChildren[k]).transform); } for (int l = 0; l < reskin.replacers[num].bodyParts.Count; l++) { List<Transform> list2 = new List<Transform>(); for (int m = 0; m < list.Count; m++) { if (!list2.Contains(list[m]) && ((Object)list[m]).name == reskin.replacers[num].bodyParts[l].transformName) { ((Component)list[m]).GetComponent<MeshFilter>().mesh = reskin.replacers[num].bodyParts[l].newMesh; ((Renderer)((Component)list[m]).GetComponent<MeshRenderer>()).materials = reskin.replacers[num].bodyParts[l].newMaterials.ToArray(); list2.Add(list[m]); log.LogDebug((object)(__instance.enemyName + ": " + ((Object)list[m]).name + " successfully replaced!")); break; } } } } else { flag = false; } if (flag) { log.LogInfo((object)("Successfully reskinned " + __instance.enemyName + "!")); } else { log.LogWarning((object)("Attempted to reskin " + __instance.enemyName + " but something went wrong!")); } } } return true; } } [HarmonyPatch(typeof(HurtCollider))] public static class HurtColliderPatch { private static readonly ManualLogSource log = WildCardMod.instance.log; [HarmonyPatch("CanHit")] [HarmonyPrefix] public static bool CheckForNecklaceHolding(HurtCollider __instance, ref GameObject hitObject, ref bool __result) { PlayerAvatar val = default(PlayerAvatar); CloverNecklace cloverNecklace = default(CloverNecklace); FyrusStar fyrusStar = default(FyrusStar); if (hitObject.TryGetComponent<PlayerAvatar>(ref val) && __instance.ignoreObjects.Count > 0 && ((((Component)__instance.ignoreObjects[0]).TryGetComponent<CloverNecklace>(ref cloverNecklace) && ((Object)(object)val.physGrabber.grabbedPhysGrabObject == (Object)(object)cloverNecklace || (Object)(object)val == (Object)(object)cloverNecklace.lastHolder)) || (((Component)__instance.ignoreObjects[0]).TryGetComponent<FyrusStar>(ref fyrusStar) && (Object)(object)fyrusStar.lastRider == (Object)(object)val))) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(PhysGrabber))] public static class PhysGrabberRayCheckPatch { private static readonly ManualLogSource log = WildCardMod.instance.log; [HarmonyPatch("RayCheck")] [HarmonyPrefix] public static bool GiwiRayCheck(PhysGrabber __instance, ref bool _grab) { //IL_005e: 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_008c: 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) //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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) //IL_083b: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Unknown result type (might be due to invalid IL or missing references) //IL_0851: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_0878: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_08c7: Unknown result type (might be due to invalid IL or missing references) //IL_08d1: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08db: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07da: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_0922: Unknown result type (might be due to invalid IL or missing references) //IL_0930: Unknown result type (might be due to invalid IL or missing references) if (__instance.playerAvatar.isDisabled || __instance.playerAvatar.isTumbling || __instance.playerAvatar.deadSet) { return false; } float num = 10f; if (_grab) { __instance.grabDisableTimer = 0.1f; } Vector3 val = ((Component)__instance.playerCamera).transform.forward; if (__instance.overrideGrab && Object.op_Implicit((Object)(object)__instance.overrideGrabTarget)) { Vector3 val2 = ((Component)__instance.overrideGrabTarget).transform.position - ((Component)__instance.playerCamera).transform.position; val = ((Vector3)(ref val2)).normalized; } if (!_grab) { RaycastHit[] array = Physics.SphereCastAll(((Component)__instance.playerCamera).transform.position, 1f, val, num, LayerMask.op_Implicit(__instance.mask), (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; ValuableObject component = ((Component)((RaycastHit)(ref val3)).transform).GetComponent<ValuableObject>(); if (!Object.op_Implicit((Object)(object)component)) { continue; } if (!component.discovered) { Vector3 val4 = ((Component)__instance.playerCamera).transform.position - ((RaycastHit)(ref val3)).point; RaycastHit[] array2 = Physics.SphereCastAll(((RaycastHit)(ref val3)).point, 0.01f, val4, ((Vector3)(ref val4)).magnitude, LayerMask.op_Implicit(__instance.mask), (QueryTriggerInteraction)2); bool flag = true; RaycastHit[] array3 = array2; for (int j = 0; j < array3.Length; j++) { RaycastHit val5 = array3[j]; if (!((Component)((RaycastHit)(ref val5)).transform).CompareTag("Player") && (Object)(object)((RaycastHit)(ref val5)).transform != (Object)(object)((RaycastHit)(ref val3)).transform) { flag = false; break; } } if (flag) { component.Discover((State)0); } } else { if (!component.discoveredReminder) { continue; } Vector3 val6 = ((Component)__instance.playerCamera).transform.position - ((RaycastHit)(ref val3)).point; RaycastHit[] array4 = Physics.RaycastAll(((RaycastHit)(ref val3)).point, val6, ((Vector3)(ref val6)).magnitude, LayerMask.op_Implicit(__instance.mask), (QueryTriggerInteraction)2); bool flag2 = true; RaycastHit[] array5 = array4; RaycastHit[] array6 = array5; for (int k = 0; k < array6.Length; k++) { RaycastHit val7 = array6[k]; if (((Component)((Component)((RaycastHit)(ref val7)).collider).transform).CompareTag("Wall")) { flag2 = false; break; } } if (flag2) { component.discoveredReminder = false; component.Discover((State)1); } } } } RaycastHit val8 = default(RaycastHit); if (!Physics.Raycast(((Component)__instance.playerCamera).transform.position, val, ref val8, num, LayerMask.op_Implicit(__instance.mask), (QueryTriggerInteraction)1)) { return false; } Transform transform = ((RaycastHit)(ref val8)).transform; Collider val9 = ((RaycastHit)(ref val8)).collider; Rigidbody grabbedObject = ((RaycastHit)(ref val8)).rigidbody; Vector3 val10 = ((RaycastHit)(ref val8)).point; GiwiWormValuable componentInParent = ((Component)((RaycastHit)(ref val8)).transform).GetComponentInParent<GiwiWormValuable>(); if ((Object)(object)componentInParent != (Object)null) { transform = ((Component)componentInParent).transform; val9 = ((Component)((Component)componentInParent).transform).GetComponentInChildren<Collider>(); grabbedObject = componentInParent.physGrabObject.rb; val10 = componentInParent.physGrabObject.forceGrabPoint.position; } bool flag3 = false; flag3 = __instance.overrideGrab && !Object.op_Implicit((Object)(object)__instance.overrideGrabTarget); flag3 = __instance.overrideGrab && Object.op_Implicit((Object)(object)__instance.overrideGrabTarget) && (Object)(object)((Component)transform).GetComponentInParent<PhysGrabObject>() == (Object)(object)__instance.overrideGrabTarget; if (!__instance.overrideGrab) { flag3 = true; } if (!(((Component)val9).CompareTag("Phys Grab Object") && flag3) || ((RaycastHit)(ref val8)).distance > __instance.grabRange) { return false; } if (_grab) { __instance.grabbedPhysGrabObject = ((Comp