using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using DunGen;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoreEmotes.Patch;
using PiggyVarietyMod.Patches;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Piggy.PiggyVarietyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.28.0")]
[assembly: AssemblyInformationalVersion("1.1.28")]
[assembly: AssemblyProduct("PiggyVarietyMod")]
[assembly: AssemblyTitle("Piggy.PiggyVarietyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.28.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace PiggyVarietyMod
{
[BepInPlugin("Piggy.PiggyVarietyMod", "PiggyVarietyMod", "1.1.27")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "Piggy.PiggyVarietyMod";
private const string modName = "PiggyVarietyMod";
private const string modVersion = "1.1.27";
private readonly Harmony harmony = new Harmony("Piggy.PiggyVarietyMod");
private static Plugin Instance;
public static ManualLogSource mls;
public static AssetBundle Bundle;
public static GameObject teslaGateSpawn;
public static GameObject teslaGatePrefab;
public static AudioClip teslaIdleStart;
public static AudioClip teslaIdle;
public static AudioClip teslaIdleEnd;
public static AudioClip teslaCrack;
public static AudioClip teslaBeep;
public static AudioClip teslaWindUp;
public static AudioClip teslaUnderbass;
public static AudioClip teslaClimax;
public static Item revolverItem;
public static Item revolverAmmoItem;
public static int revolverRarity;
public static int revolverAmmoRarity;
public static int revolverMaxPlayerDamage;
public static int revolverMaxMonsterDamage;
public static bool revolverInfinityAmmo;
public static int revolverPrice;
public static int revolverAmmoPrice;
public static float teslaSpawnWeight;
public static float teslaSoundVolume;
public static bool teslaShake;
public static bool translateKorean;
public static AudioClip revolverAmmoInsert;
public static AudioClip revolverCylinderOpen;
public static AudioClip revolverCylinderClose;
public static AudioClip revolverDryFire;
public static AudioClip revolverBlast1;
public static AudioClip revolverBlast2;
public static RuntimeAnimatorController playerAnimator;
public static RuntimeAnimatorController otherPlayerAnimator;
public static bool foundMoreEmotes;
public static string PluginDirectory;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
LoadAssets();
mls = Logger.CreateLogSource("Piggy.PiggyVarietyMod");
mls.LogInfo((object)"Piggy's Variety Mod is loaded");
teslaSoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Generic", "TeslaGateVolume", 1f, "(Default 1) Sets the sound volume for Tesla Gate.").Value;
teslaShake = ((BaseUnityPlugin)this).Config.Bind<bool>("Generic", "TeslaGateShake", true, "(Default true) Enable camera shake for Tesla Gate.").Value;
revolverMaxPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Generic", "RevolverMaxPlayerDamage", 70, "(Default 70) Sets the maximum amount of damage the revolver can inflict on the player.").Value;
revolverMaxMonsterDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Generic", "RevolverMaxMonsterDamage", 4, "(Default 4) Sets the maximum amount of damage the revolver can inflict on the monster.").Value;
revolverInfinityAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Generic", "RevolverInfinityAmmo", false, "(Default false) If true, the revolver will not consume ammo.").Value;
teslaSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn", "TeslaGateWeight", 1f, "(Default 1) Sets the spawn weight for the Tesla Gate.").Value;
revolverRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "RevolverRarity", 20, "(Default 20) Sets the spawn rarity for the revolver.").Value;
revolverAmmoRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "RevolverAmmoRarity", 60, "(Default 60) Sets the spawn rarity for the revolver ammo.").Value;
revolverPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "RevolverPrice", -1, "(Recommended -1 or 550) Set the price of the revolver. If -1, removes the item from the store list.").Value;
revolverAmmoPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "RevolverAmmoPrice", -1, "(Recommended -1 or 30) Set the price of the revolver ammo. If -1, removes the item from the store list.").Value;
translateKorean = ((BaseUnityPlugin)this).Config.Bind<bool>("Translation", "Enable Korean", false, "Set language to Korean.").Value;
NetworkPrefabs.RegisterNetworkPrefab(teslaGatePrefab);
NetworkPrefabs.RegisterNetworkPrefab(revolverItem.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(revolverAmmoItem.spawnPrefab);
Utilities.FixMixerGroups(revolverItem.spawnPrefab);
Utilities.FixMixerGroups(revolverAmmoItem.spawnPrefab);
Items.RegisterItem(revolverItem);
Items.RegisterItem(revolverAmmoItem);
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
BepInPlugin metadata = pluginInfo.Value.Metadata;
if (metadata.GUID.Equals("MoreEmotes", StringComparison.OrdinalIgnoreCase) || metadata.GUID.Equals("BetterEmotes", StringComparison.OrdinalIgnoreCase))
{
foundMoreEmotes = true;
mls.LogInfo((object)"[Piggys Variety Mod] Detected More Emotes / Better Emotes!");
mls.LogInfo((object)"[Piggys Variety Mod] More Emotes / Better Emotes may not be compatible!");
}
}
if (translateKorean)
{
Translate();
}
CreateShopItem();
Items.RegisterScrap(revolverItem, revolverRarity, (LevelTypes)(-1));
Items.RegisterScrap(revolverAmmoItem, revolverAmmoRarity, (LevelTypes)(-1));
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
}
private void LoadAssets()
{
try
{
Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "piggyvarietymod"));
}
catch (Exception ex)
{
mls.LogError((object)("Couldn't load asset bundle: " + ex.Message));
return;
}
try
{
teslaGateSpawn = Bundle.LoadAsset<GameObject>("TeslaGateSpawn.prefab");
teslaGatePrefab = Bundle.LoadAsset<GameObject>("TeslaGate.prefab");
teslaGatePrefab.AddComponent<TeslaGate>();
teslaCrack = Bundle.LoadAsset<AudioClip>("Tesla_Crack.ogg");
teslaBeep = Bundle.LoadAsset<AudioClip>("Tesla_Beeps.ogg");
teslaWindUp = Bundle.LoadAsset<AudioClip>("Tesla_WindUp.ogg");
teslaUnderbass = Bundle.LoadAsset<AudioClip>("Tesla_Underbass.ogg");
teslaClimax = Bundle.LoadAsset<AudioClip>("Tesla_Climax.ogg");
teslaIdleStart = Bundle.LoadAsset<AudioClip>("Tesla_IdleStarts.ogg");
teslaIdle = Bundle.LoadAsset<AudioClip>("Tesla_IdleLoop.ogg");
teslaIdleEnd = Bundle.LoadAsset<AudioClip>("Tesla_IdleEnd.ogg");
Plugin.revolverItem = Bundle.LoadAsset<Item>("Revolver.asset");
revolverAmmoItem = Bundle.LoadAsset<Item>("RevolverAmmo.asset");
revolverAmmoInsert = Bundle.LoadAsset<AudioClip>("RevolverReload.wav");
revolverCylinderOpen = Bundle.LoadAsset<AudioClip>("RevolverCylinderOpen.wav");
revolverCylinderClose = Bundle.LoadAsset<AudioClip>("RevolverCylinderClose.wav");
revolverDryFire = Bundle.LoadAsset<AudioClip>("RevolverDryFire.wav");
revolverBlast1 = Bundle.LoadAsset<AudioClip>("RevolverBlast1.wav");
revolverBlast2 = Bundle.LoadAsset<AudioClip>("RevolverBlast2.wav");
playerAnimator = Bundle.LoadAsset<RuntimeAnimatorController>("PlayerAnimator.controller");
otherPlayerAnimator = Bundle.LoadAsset<RuntimeAnimatorController>("OtherPlayerAnimator.controller");
RevolverItem revolverItem = Plugin.revolverItem.spawnPrefab.AddComponent<RevolverItem>();
((GrabbableObject)revolverItem).grabbable = true;
((GrabbableObject)revolverItem).grabbableToEnemies = true;
revolverItem.gunReloadSFX = revolverAmmoInsert;
revolverItem.cylinderOpenSFX = revolverCylinderOpen;
revolverItem.cylinderCloseSFX = revolverCylinderClose;
revolverItem.gunShootSFX.Add(revolverBlast1);
revolverItem.gunShootSFX.Add(revolverBlast2);
revolverItem.noAmmoSFX = revolverDryFire;
revolverItem.gunSafetySFX = revolverDryFire;
revolverItem.switchSafetyOffSFX = revolverDryFire;
revolverItem.switchSafetyOnSFX = revolverDryFire;
revolverItem.gunAudio = ((Component)revolverItem).gameObject.GetComponent<AudioSource>();
revolverItem.gunShootAudio = ((Component)((Component)revolverItem).gameObject.transform.GetChild(1)).GetComponent<AudioSource>();
revolverItem.gunBulletsRicochetAudio = ((Component)((Component)revolverItem).gameObject.transform.GetChild(2)).GetComponent<AudioSource>();
revolverItem.gunAnimator = ((Component)revolverItem).gameObject.GetComponent<Animator>();
revolverItem.revolverRayPoint = ((Component)revolverItem).gameObject.transform.GetChild(3);
revolverItem.gunShootParticle = ((Component)((Component)revolverItem).gameObject.transform.GetChild(3).GetChild(0)).GetComponent<ParticleSystem>();
revolverItem.cylinderTransform = ((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0);
revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0)
.GetChild(0)).GetComponent<MeshRenderer>());
revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0)
.GetChild(1)).GetComponent<MeshRenderer>());
revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0)
.GetChild(2)).GetComponent<MeshRenderer>());
revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0)
.GetChild(3)).GetComponent<MeshRenderer>());
revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0)
.GetChild(4)).GetComponent<MeshRenderer>());
revolverItem.revolverAmmos.Add(((Component)((Component)revolverItem).gameObject.transform.GetChild(5).GetChild(0).GetChild(0)
.GetChild(5)).GetComponent<MeshRenderer>());
revolverItem.revolverAmmoInHandTransform = ((Component)revolverItem).gameObject.transform.GetChild(0);
revolverItem.revolverAmmoInHand = ((Component)((Component)revolverItem).gameObject.transform.GetChild(0).GetChild(0)).GetComponent<MeshRenderer>();
revolverItem.gunCompatibleAmmoID = 500;
((GrabbableObject)revolverItem).itemProperties = Plugin.revolverItem;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!");
}
catch (Exception ex2)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message));
}
}
private void Translate()
{
revolverItem.toolTips[0] = "격발 : [RMB]";
revolverItem.toolTips[1] = "탄약 삽탄하기 : [E]";
revolverItem.toolTips[2] = "실린더 열기 : [Q]";
revolverItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "리볼버";
revolverAmmoItem.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "총알";
}
private void CreateShopItem()
{
if (translateKorean)
{
revolverAmmoItem.itemName = "총알";
revolverItem.itemName = "리볼버";
}
else
{
revolverAmmoItem.itemName = "Bullet";
revolverItem.itemName = "Revolver";
}
TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
if (translateKorean)
{
val.displayText = "리볼버를 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n";
}
else
{
val.displayText = "You have requested to order revolvers. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
}
val.clearPreviousText = true;
val.isConfirmationNode = true;
val.maxCharactersToType = 15;
val.buyRerouteToMoon = -1;
val.displayPlanetInfo = -1;
val.shipUnlockableID = -1;
val.creatureFileID = -1;
val.storyLogFileID = -1;
TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
if (translateKorean)
{
val2.displayText = "[variableAmount]개의 리볼버를 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다..\n\n";
}
else
{
val2.displayText = "Ordered [variableAmount] revolvers. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n";
}
val2.clearPreviousText = true;
val2.maxCharactersToType = 15;
val2.buyRerouteToMoon = -1;
val2.displayPlanetInfo = -1;
val2.shipUnlockableID = -1;
val2.creatureFileID = -1;
val2.storyLogFileID = -1;
TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
if (translateKorean)
{
val3.displayText = "\n더욱 강력한 자기 보호를 위해!\n실린더를 열고 리볼버 탄약을 삽탄하여 장전하세요.\n\n";
}
else
{
val3.displayText = "\nFor more powerful self-defense!\nOpen the cylinder and insert revolver ammo to load it.\n\n";
}
val3.clearPreviousText = true;
val3.maxCharactersToType = 15;
val3.buyRerouteToMoon = -1;
val3.displayPlanetInfo = -1;
val3.shipUnlockableID = -1;
val3.creatureFileID = -1;
val3.storyLogFileID = -1;
TerminalNode val4 = ScriptableObject.CreateInstance<TerminalNode>();
if (translateKorean)
{
val4.displayText = "리볼버 탄약을 주문하려고 합니다. 수량: [variableAmount]. \r\n아이템의 총 가격: [totalCost].\n\nCONFIRM 또는 DENY를 입력하세요.\n\n";
}
else
{
val4.displayText = "You have requested to order revolver ammos. Amount: [variableAmount]. \r\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
}
val4.clearPreviousText = true;
val4.isConfirmationNode = true;
val4.maxCharactersToType = 15;
val4.buyRerouteToMoon = -1;
val4.displayPlanetInfo = -1;
val4.shipUnlockableID = -1;
val4.creatureFileID = -1;
val4.storyLogFileID = -1;
TerminalNode val5 = ScriptableObject.CreateInstance<TerminalNode>();
if (translateKorean)
{
val5.displayText = "[variableAmount]개의 리볼버 탄약을 주문했습니다. 당신의 현재 소지금은 [playerCredits]입니다.\n\n우리의 계약자는 작업 중에도 빠른 무료 배송 혜택을 누릴 수 있습니다! 구매한 모든 상품은 1시간마다 대략적인 위치에 도착합니다..\n\n";
}
else
{
val5.displayText = "Ordered [variableAmount] revolver ammos. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n";
}
val5.clearPreviousText = true;
val5.maxCharactersToType = 15;
val5.buyRerouteToMoon = -1;
val5.displayPlanetInfo = -1;
val5.shipUnlockableID = -1;
val5.creatureFileID = -1;
val5.storyLogFileID = -1;
TerminalNode val6 = ScriptableObject.CreateInstance<TerminalNode>();
if (translateKorean)
{
val6.displayText = "\n리볼버에 장전하고 <b>치명적인</b> 순간에 격발하세요!\n\n";
}
else
{
val6.displayText = "\nLoad to your revolver and fire at LETHAL moments!\n\n";
}
val6.clearPreviousText = true;
val6.maxCharactersToType = 15;
val6.buyRerouteToMoon = -1;
val6.displayPlanetInfo = -1;
val6.shipUnlockableID = -1;
val6.creatureFileID = -1;
val6.storyLogFileID = -1;
if (revolverPrice > -1)
{
Items.RegisterShopItem(revolverItem, val, val2, val3, revolverPrice);
}
if (revolverAmmoPrice > -1)
{
Items.RegisterShopItem(revolverAmmoItem, val4, val5, val6, revolverAmmoPrice);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Piggy.PiggyVarietyMod";
public const string PLUGIN_NAME = "PiggyVarietyMod";
public const string PLUGIN_VERSION = "1.1.28";
}
}
namespace PiggyVarietyMod.Patches
{
public class CustomTouchInteractTrigger : MonoBehaviour
{
public bool isIdleTrigger;
public bool isKillTrigger;
public TeslaGate teslaGate;
private void OnTriggerEnter(Collider collider)
{
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)((Component)collider).transform.parent).GetComponent<PlayerControllerB>() != (Object)null)
{
PlayerControllerB component = ((Component)((Component)collider).transform.parent).GetComponent<PlayerControllerB>();
if (!component.isPlayerDead)
{
if (isIdleTrigger)
{
teslaGate.activatePlayerList.Add(component);
teslaGate.activateList.Add(((Component)collider).gameObject);
}
else if (!isIdleTrigger && !isKillTrigger)
{
teslaGate.engagingPlayerList.Add(component);
teslaGate.engagingList.Add(((Component)collider).gameObject);
}
}
}
if (!((Object)(object)((Component)((Component)collider).transform.parent).GetComponent<EnemyAICollisionDetect>() != (Object)null) || !Object.op_Implicit((Object)(object)((Component)collider).gameObject.GetComponent<EnemyAICollisionDetect>()))
{
return;
}
EnemyAICollisionDetect component2 = ((Component)collider).gameObject.GetComponent<EnemyAICollisionDetect>();
IHittable val = default(IHittable);
if (((Component)((Component)component2).transform).TryGetComponent<IHittable>(ref val))
{
Plugin.mls.LogInfo((object)("Tesla gate detected enemy: " + component2.mainScript.enemyType.enemyName + ", Idle: " + isIdleTrigger + ", Kill: " + isKillTrigger));
if (isIdleTrigger)
{
}
if (isKillTrigger && (Object)(object)component2 != (Object)null && (Object)(object)component2.mainScript != (Object)null && ((NetworkBehaviour)component2.mainScript).IsOwner && component2.mainScript.enemyType.canDie && !component2.mainScript.isEnemyDead)
{
val.Hit(5, Vector3.zero, (PlayerControllerB)null, true, -1);
}
}
}
private void OnTriggerStay(Collider collider)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
if (!isKillTrigger)
{
return;
}
PlayerControllerB component = ((Component)collider).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController && !component.isPlayerDead)
{
GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.down * 17f, true, (CauseOfDeath)11, 0);
return;
}
EnemyAICollisionDetect component2 = ((Component)collider).gameObject.GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component2 != (Object)null && (Object)(object)component2.mainScript != (Object)null && ((NetworkBehaviour)component2.mainScript).IsOwner && component2.mainScript.enemyType.canDie && !component2.mainScript.isEnemyDead)
{
component2.mainScript.KillEnemyOnOwnerClient(false);
}
}
private void OnTriggerExit(Collider collider)
{
if ((Object)(object)((Component)((Component)collider).transform.parent).GetComponent<PlayerControllerB>() != (Object)null)
{
PlayerControllerB component = ((Component)((Component)collider).transform.parent).GetComponent<PlayerControllerB>();
teslaGate.engagingPlayerList.Remove(component);
teslaGate.engagingList.Remove(((Component)collider).gameObject);
if (isIdleTrigger)
{
teslaGate.activatePlayerList.Remove(component);
teslaGate.activateList.Remove(((Component)collider).gameObject);
}
}
}
}
[HarmonyPatch(typeof(Dungeon))]
internal class DungeonPatch
{
[HarmonyPrefix]
[HarmonyPatch("SpawnDoorPrefab")]
private static void SpawnDoorPrefab_Prefix(Doorway a, Doorway b, RandomStream randomStream)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
for (int i = 0; i < a.ConnectorPrefabWeights.Count; i++)
{
GameObjectWeight val = a.ConnectorPrefabWeights[i];
if (((Object)val.GameObject).name == "TeslaGateSpawn")
{
return;
}
if (((Object)val.GameObject).name == "BigDoorSpawn")
{
GameObjectWeight val2 = new GameObjectWeight();
a.ConnectorPrefabWeights.Add(val2);
val2.Weight = 0.05f * Plugin.teslaSpawnWeight;
val2.GameObject = Plugin.teslaGateSpawn;
Plugin.mls.LogInfo((object)("added tesla to " + ((Object)((Component)a).gameObject).name));
}
}
for (int j = 0; j < b.ConnectorPrefabWeights.Count; j++)
{
GameObjectWeight val3 = b.ConnectorPrefabWeights[j];
if (((Object)val3.GameObject).name == "TeslaGateSpawn")
{
break;
}
if (((Object)val3.GameObject).name == "BigDoorSpawn")
{
GameObjectWeight val4 = new GameObjectWeight();
b.ConnectorPrefabWeights.Add(val4);
val4.Weight = 0.07f * Plugin.teslaSpawnWeight;
val4.GameObject = Plugin.teslaGateSpawn;
Plugin.mls.LogInfo((object)("added tesla to " + ((Object)((Component)b).gameObject).name));
}
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
public static AnimationClip middleFinger;
public static AnimationClip middleFinger_D;
public static AnimationClip clap;
public static AnimationClip clap_D;
public static AnimationClip shy;
public static AnimationClip griddy;
public static AnimationClip twerk;
public static AnimationClip salute;
public static AnimationClip prisyadka;
public static AnimationClip sign;
public static AnimationClip sign_D;
private static bool pv_isPlayerFirstFrame;
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void Update_Postfix(PlayerControllerB __instance, ref Animator ___playerBodyAnimator)
{
if ((Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.playerAnimator && (Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.otherPlayerAnimator)
{
if (Plugin.foundMoreEmotes)
{
UpdateMoreEmotesAnimator(__instance, ___playerBodyAnimator);
}
else
{
UpdateAnimator(__instance, ___playerBodyAnimator);
}
}
if ((Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController)
{
if (pv_isPlayerFirstFrame)
{
OnFirstLocalPlayerFrameWithNewAnimator(__instance);
}
if (pv_isPlayerFirstFrame)
{
__instance.SpawnPlayerAnimation();
pv_isPlayerFirstFrame = false;
}
}
}
private static void UpdateAnimator(PlayerControllerB __instance, Animator ___playerBodyAnimator)
{
if ((Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.playerAnimator && (Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.otherPlayerAnimator)
{
if ((Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController)
{
___playerBodyAnimator.runtimeAnimatorController = Plugin.playerAnimator;
Plugin.mls.LogInfo((object)"Replace Player Animator!");
}
else
{
___playerBodyAnimator.runtimeAnimatorController = Plugin.otherPlayerAnimator;
Plugin.mls.LogInfo((object)"Replace Other Player Animator!");
}
}
}
private static void UpdateMoreEmotesAnimator(PlayerControllerB __instance, Animator ___playerBodyAnimator)
{
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Expected O, but got Unknown
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
if ((Object)(object)middleFinger == (Object)null || (Object)(object)middleFinger_D == (Object)null || (((Object)(object)clap == (Object)null) | ((Object)(object)clap_D == (Object)null)) || (((Object)(object)shy == (Object)null) | ((Object)(object)griddy == (Object)null)) || (Object)(object)twerk == (Object)null || (Object)(object)salute == (Object)null || (Object)(object)prisyadka == (Object)null || (Object)(object)sign == (Object)null || (Object)(object)sign_D == (Object)null)
{
GetMoreEmotes(___playerBodyAnimator.runtimeAnimatorController);
}
if (!((Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.playerAnimator) || !((Object)(object)___playerBodyAnimator.runtimeAnimatorController != (Object)(object)Plugin.otherPlayerAnimator))
{
return;
}
if ((Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController)
{
if ((Object)(object)middleFinger != (Object)null && (Object)(object)middleFinger_D != (Object)null && (Object)(object)clap != (Object)null && (Object)(object)clap_D != (Object)null && (Object)(object)shy != (Object)null && (Object)(object)griddy != (Object)null && (Object)(object)twerk != (Object)null && (Object)(object)salute != (Object)null && (Object)(object)prisyadka != (Object)null && (Object)(object)sign != (Object)null && (Object)(object)sign_D != (Object)null)
{
if (!(__instance.playerBodyAnimator.runtimeAnimatorController is AnimatorOverrideController))
{
__instance.playerBodyAnimator.runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(__instance.playerBodyAnimator.runtimeAnimatorController);
}
__instance.SpawnPlayerAnimation();
UpdateAnimatorVariable(Plugin.playerAnimator);
EmotePatch.local = Plugin.playerAnimator;
Plugin.mls.LogInfo((object)"Replace More Emotes Animator!");
}
}
else if ((Object)(object)middleFinger != (Object)null && (Object)(object)middleFinger_D != (Object)null && (Object)(object)clap != (Object)null && (Object)(object)clap_D != (Object)null && (Object)(object)shy != (Object)null && (Object)(object)griddy != (Object)null && (Object)(object)twerk != (Object)null && (Object)(object)salute != (Object)null && (Object)(object)prisyadka != (Object)null && (Object)(object)sign != (Object)null && (Object)(object)sign_D != (Object)null)
{
UpdateAnimatorVariable(Plugin.otherPlayerAnimator);
EmotePatch.others = Plugin.otherPlayerAnimator;
Plugin.mls.LogInfo((object)"Replace More Emotes Other Animator!");
if (!(__instance.playerBodyAnimator.runtimeAnimatorController is AnimatorOverrideController))
{
__instance.playerBodyAnimator.runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(__instance.playerBodyAnimator.runtimeAnimatorController);
}
}
}
private static void OnFirstLocalPlayerFrameWithNewAnimator(PlayerControllerB __instance)
{
pv_isPlayerFirstFrame = false;
__instance.SpawnPlayerAnimation();
}
private static void GetMoreEmotes(RuntimeAnimatorController animator)
{
AnimationClip[] animationClips = animator.animationClips;
foreach (AnimationClip val in animationClips)
{
if ((Object)(object)middleFinger == (Object)null && ((Object)val).name == "Middle_Finger")
{
middleFinger = val;
}
if ((Object)(object)middleFinger_D == (Object)null && ((Object)val).name == "D_Middle_Finger")
{
middleFinger_D = val;
}
if ((Object)(object)clap == (Object)null && ((Object)val).name == "Clap")
{
clap = val;
}
if ((Object)(object)clap_D == (Object)null && ((Object)val).name == "D_Clap")
{
clap_D = val;
}
if ((Object)(object)shy == (Object)null && ((Object)val).name == "Shy")
{
shy = val;
}
if ((Object)(object)griddy == (Object)null && ((Object)val).name == "The_Griddy")
{
griddy = val;
}
if ((Object)(object)twerk == (Object)null && ((Object)val).name == "Twerk")
{
twerk = val;
}
if ((Object)(object)salute == (Object)null && ((Object)val).name == "Salute")
{
salute = val;
}
if ((Object)(object)prisyadka == (Object)null && ((Object)val).name == "Prisyadka")
{
prisyadka = val;
}
if ((Object)(object)sign == (Object)null && ((Object)val).name == "Sign")
{
sign = val;
}
if ((Object)(object)sign_D == (Object)null && ((Object)val).name == "D_Sign")
{
sign_D = val;
}
}
}
private static void UpdateAnimatorVariable(RuntimeAnimatorController animator)
{
AnimationClip[] animationClips = animator.animationClips;
for (int i = 0; i < animationClips.Length; i++)
{
switch (((Object)animationClips[i]).name)
{
case "Middle_Finger":
animationClips[i] = middleFinger;
break;
case "D_Middle_Finger":
animationClips[i] = middleFinger_D;
break;
case "Clap":
animationClips[i] = clap;
break;
case "D_Clap":
animationClips[i] = clap_D;
break;
case "Shy":
animationClips[i] = shy;
break;
case "The_Griddy":
animationClips[i] = griddy;
break;
case "Twerk":
animationClips[i] = twerk;
break;
case "Salute":
animationClips[i] = salute;
break;
case "Prisyadka":
animationClips[i] = prisyadka;
break;
case "Sign":
animationClips[i] = sign;
break;
case "D_Sign":
animationClips[i] = sign_D;
break;
}
}
}
}
public class RevolverItem : GrabbableObject
{
public int gunCompatibleAmmoID = 1410;
public bool isReloading;
public bool cantFire;
public Transform cylinderTransform;
public bool isCylinderMoving;
public int ammosLoaded;
public Animator gunAnimator;
public AudioSource gunAudio;
public AudioSource gunShootAudio;
public AudioSource gunBulletsRicochetAudio;
private Coroutine gunCoroutine;
public List<AudioClip> gunShootSFX = new List<AudioClip>();
public AudioClip gunReloadSFX;
public AudioClip cylinderOpenSFX;
public AudioClip cylinderCloseSFX;
public AudioClip gunReloadFinishSFX;
public AudioClip noAmmoSFX;
public AudioClip gunSafetySFX;
public AudioClip switchSafetyOnSFX;
public AudioClip switchSafetyOffSFX;
private bool hasHitGroundWithSafetyOff = true;
private int ammoSlotToUse = -1;
private bool localClientSendingShootGunRPC;
private PlayerControllerB previousPlayerHeldBy;
public ParticleSystem gunShootParticle;
public Transform revolverRayPoint;
public List<MeshRenderer> revolverAmmos = new List<MeshRenderer>();
public MeshRenderer revolverAmmoInHand;
public Transform revolverAmmoInHandTransform;
private RaycastHit[] enemyColliders;
private RaycastHit[] playerColliders;
private EnemyAI heldByEnemy;
public override void Start()
{
((GrabbableObject)this).Start();
}
public override int GetItemDataToSave()
{
((GrabbableObject)this).GetItemDataToSave();
return ammosLoaded;
}
public override void LoadItemSaveData(int saveData)
{
((GrabbableObject)this).LoadItemSaveData(saveData);
ammosLoaded = saveData;
}
public override void Update()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: 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_00d5: 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_0105: 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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: 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_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
if (Plugin.revolverInfinityAmmo)
{
ammosLoaded = 6;
}
if (!isReloading)
{
switch (ammosLoaded)
{
case 0:
cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 0f, 0f)), Time.deltaTime * 25f);
break;
case 1:
cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 60f, 0f)), Time.deltaTime * 25f);
break;
case 2:
cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 120f, 0f)), Time.deltaTime * 25f);
break;
case 3:
cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 180f, 0f)), Time.deltaTime * 25f);
break;
case 4:
cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 240f, 0f)), Time.deltaTime * 25f);
break;
case 5:
cylinderTransform.localRotation = Quaternion.Lerp(cylinderTransform.localRotation, Quaternion.Euler(new Vector3(0f, 300f, 0f)), Time.deltaTime * 25f);
break;
case 6:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
break;
}
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
SyncRevolverAmmoServerRpc(ammosLoaded);
base.playerHeldBy.playerBodyAnimator.SetBool("ReloadRevolver", false);
gunAnimator.SetBool("Reloading", false);
((Renderer)revolverAmmoInHand).enabled = false;
previousPlayerHeldBy = base.playerHeldBy;
previousPlayerHeldBy.equippedUsableItemQE = true;
isCylinderMoving = false;
hasHitGroundWithSafetyOff = false;
foreach (MeshRenderer revolverAmmo in revolverAmmos)
{
((Renderer)revolverAmmo).enabled = false;
}
if (ammosLoaded > 0)
{
for (int i = 0; i <= ammosLoaded - 1; i++)
{
((Renderer)revolverAmmos[i]).enabled = true;
}
}
}
public override void GrabItemFromEnemy(EnemyAI enemy)
{
((GrabbableObject)this).GrabItemFromEnemy(enemy);
heldByEnemy = enemy;
hasHitGroundWithSafetyOff = false;
}
public override void DiscardItemFromEnemy()
{
((GrabbableObject)this).DiscardItemFromEnemy();
heldByEnemy = null;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
SyncRevolverAmmoServerRpc(ammosLoaded);
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!isReloading && !cantFire && !gunAnimator.GetBool("Reloading"))
{
if (ammosLoaded > 0)
{
gunAnimator.SetBool("Reloading", false);
ShootGunAndSync(heldByPlayer: true);
}
else
{
((MonoBehaviour)this).StartCoroutine(FireDelay());
gunAnimator.SetTrigger("Fire");
gunAudio.PlayOneShot(noAmmoSFX);
}
}
}
public void ShootGunAndSync(bool heldByPlayer)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
Vector3 revolverPosition;
Vector3 forward;
if (!heldByPlayer)
{
revolverPosition = revolverRayPoint.position;
forward = revolverRayPoint.forward;
}
else
{
revolverPosition = ((Component)base.playerHeldBy.gameplayCamera).transform.position - ((Component)base.playerHeldBy.gameplayCamera).transform.up * 0.45f;
forward = ((Component)base.playerHeldBy.gameplayCamera).transform.forward;
}
ShootGun(revolverPosition, forward);
}
public IEnumerator FireDelay()
{
cantFire = true;
yield return (object)new WaitForSeconds(0.2f);
cantFire = false;
}
public void ShootGun(Vector3 revolverPosition, Vector3 revolverForward)
{
//IL_021e: 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_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_0782: Unknown result type (might be due to invalid IL or missing references)
//IL_080d: Unknown result type (might be due to invalid IL or missing references)
//IL_081f: Unknown result type (might be due to invalid IL or missing references)
//IL_086c: Unknown result type (might be due to invalid IL or missing references)
//IL_0876: Unknown result type (might be due to invalid IL or missing references)
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_0552: Unknown result type (might be due to invalid IL or missing references)
//IL_0928: Unknown result type (might be due to invalid IL or missing references)
//IL_0932: 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_08e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0575: Unknown result type (might be due to invalid IL or missing references)
//IL_057a: Unknown result type (might be due to invalid IL or missing references)
//IL_057f: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Unknown result type (might be due to invalid IL or missing references)
//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
//IL_063a: Unknown result type (might be due to invalid IL or missing references)
//IL_063f: Unknown result type (might be due to invalid IL or missing references)
//IL_0651: Unknown result type (might be due to invalid IL or missing references)
//IL_0663: Unknown result type (might be due to invalid IL or missing references)
//IL_070a: Unknown result type (might be due to invalid IL or missing references)
CentipedeAI[] array = Object.FindObjectsByType<CentipedeAI>((FindObjectsSortMode)0);
FlowerSnakeEnemy[] array2 = Object.FindObjectsByType<FlowerSnakeEnemy>((FindObjectsSortMode)0);
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i].clingingToPlayer == (Object)(object)base.playerHeldBy)
{
((EnemyAI)array[i]).HitEnemy(5, base.playerHeldBy, true, -1);
}
}
for (int j = 0; j < array2.Length; j++)
{
if ((Object)(object)array2[j].clingingToPlayer == (Object)(object)base.playerHeldBy)
{
((EnemyAI)array2[j]).HitEnemy(5, base.playerHeldBy, true, -1);
}
}
((MonoBehaviour)this).StartCoroutine(FireDelay());
bool flag = false;
if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
base.playerHeldBy.playerBodyAnimator.SetTrigger("ShootRevolver");
flag = true;
}
gunAnimator.SetTrigger("Fire");
RoundManager.PlayRandomClip(gunShootAudio, gunShootSFX.ToArray(), true, 1f, 1840, 1000);
WalkieTalkie.TransmitOneShotAudio(gunShootAudio, gunShootSFX[0], 1f);
gunShootParticle.Play(true);
ammosLoaded = Mathf.Clamp(ammosLoaded - 1, 0, 6);
foreach (MeshRenderer revolverAmmo in revolverAmmos)
{
((Renderer)revolverAmmo).enabled = false;
}
if (ammosLoaded > 0)
{
for (int k = 0; k <= ammosLoaded - 1; k++)
{
((Renderer)revolverAmmos[k]).enabled = true;
}
}
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if ((Object)(object)localPlayerController == (Object)null)
{
return;
}
float num = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)revolverRayPoint).transform.position);
bool flag2 = false;
int num2 = 0;
float num3 = 0f;
Vector3 val = localPlayerController.playerCollider.ClosestPoint(revolverPosition);
if (!flag && !Physics.Linecast(revolverPosition, val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Vector3.Angle(revolverForward, val - revolverPosition) < 30f)
{
flag2 = true;
}
if (num < 5f)
{
num3 = 0.25f;
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
num2 = 100;
}
if (num < 15f)
{
num3 = 0.15f;
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
num2 = 100;
}
else if (num < 23f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
num2 = 40;
}
else if (num < 30f)
{
num2 = 20;
}
if (num3 > 0f && SoundManager.Instance.timeSinceEarsStartedRinging > 16f)
{
((MonoBehaviour)this).StartCoroutine(delayedEarsRinging(num3));
}
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward);
if (enemyColliders == null)
{
enemyColliders = (RaycastHit[])(object)new RaycastHit[35];
}
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward, ref val3, float.PositiveInfinity, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
((Component)gunBulletsRicochetAudio).transform.position = ((Ray)(ref val2)).GetPoint(((RaycastHit)(ref val3)).distance - 0.5f);
gunBulletsRicochetAudio.Play();
}
if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)
{
int num4 = Physics.SphereCastNonAlloc(val2, 0.25f, enemyColliders, float.PositiveInfinity, 524288, (QueryTriggerInteraction)2);
IHittable val4 = default(IHittable);
for (int l = 0; l < num4; l++)
{
Debug.Log((object)"Raycasting enemy");
if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref enemyColliders[l])).transform).GetComponent<EnemyAICollisionDetect>()))
{
continue;
}
EnemyAI mainScript = ((Component)((RaycastHit)(ref enemyColliders[l])).transform).GetComponent<EnemyAICollisionDetect>().mainScript;
if ((Object)(object)heldByEnemy != (Object)null && (Object)(object)heldByEnemy == (Object)(object)mainScript)
{
Debug.Log((object)"Shotgun is held by enemy, skipping enemy raycast");
continue;
}
Debug.Log((object)("Hit enemy " + mainScript.enemyType.enemyName));
if (((RaycastHit)(ref enemyColliders[l])).distance == 0f)
{
Debug.Log((object)"Spherecast started inside enemy collider");
}
else if (Physics.Linecast(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref enemyColliders[l])).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
Debug.DrawRay(((RaycastHit)(ref val3)).point, Vector3.up, Color.red, 15f);
Debug.DrawLine(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref enemyColliders[l])).point, Color.cyan, 15f);
Plugin.mls.LogInfo((object)("Raycast hit wall: " + ((Object)((Component)((RaycastHit)(ref val3)).collider).gameObject).name + ", distance: " + ((RaycastHit)(ref val3)).distance));
}
else if (((Component)((RaycastHit)(ref enemyColliders[l])).transform).TryGetComponent<IHittable>(ref val4))
{
Vector3 forward = ((Component)base.playerHeldBy.gameplayCamera).transform.forward;
float num5 = Vector3.Distance(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref enemyColliders[l])).point);
int num6 = ((num5 < 3f) ? Plugin.revolverMaxMonsterDamage : ((num5 < 12f) ? Mathf.RoundToInt((float)(Plugin.revolverMaxMonsterDamage / 2)) : ((!(num5 < 26f)) ? Mathf.RoundToInt((float)(Plugin.revolverMaxMonsterDamage / 4)) : Mathf.RoundToInt((float)(Plugin.revolverMaxMonsterDamage / 3)))));
Plugin.mls.LogInfo((object)("Damage to enemy, damage: " + num6 + ", distance:" + num5));
val4.Hit(num6, forward, base.playerHeldBy, true, -1);
}
else
{
Plugin.mls.LogInfo((object)("Could not get hittable script from collider, transform: " + ((Object)((RaycastHit)(ref enemyColliders[l])).transform).name));
}
}
}
if (playerColliders == null)
{
playerColliders = (RaycastHit[])(object)new RaycastHit[10];
}
int num7 = Physics.SphereCastNonAlloc(val2, 0.3f, playerColliders, float.PositiveInfinity, StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers, (QueryTriggerInteraction)2);
for (int m = 0; m < num7; m++)
{
if ((Object)(object)((Component)((RaycastHit)(ref playerColliders[m])).transform).GetComponent<PlayerControllerB>() != (Object)null && (Object)(object)((Component)((RaycastHit)(ref playerColliders[m])).transform).GetComponent<PlayerControllerB>() != (Object)(object)base.playerHeldBy)
{
float num8 = Vector3.Distance(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((RaycastHit)(ref playerColliders[m])).point);
if (num8 < 10f)
{
((Component)((RaycastHit)(ref playerColliders[m])).transform).GetComponent<PlayerControllerB>().DamagePlayer(Plugin.revolverMaxPlayerDamage, true, true, (CauseOfDeath)7, 0, false, ((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f);
}
else if (num8 < 25f)
{
((Component)((RaycastHit)(ref playerColliders[m])).transform).GetComponent<PlayerControllerB>().DamagePlayer(Mathf.RoundToInt((float)(Plugin.revolverMaxPlayerDamage - Plugin.revolverMaxPlayerDamage / 3)), true, true, (CauseOfDeath)7, 0, false, ((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f);
}
else
{
((Component)((RaycastHit)(ref playerColliders[m])).transform).GetComponent<PlayerControllerB>().DamagePlayer(Mathf.RoundToInt((float)(Plugin.revolverMaxPlayerDamage / 3)), true, true, (CauseOfDeath)7, 0, false, ((Component)base.playerHeldBy.gameplayCamera).transform.forward * 30f);
}
Debug.Log((object)"Revolver vs Player wtf lmao");
}
}
}
private IEnumerator delayedEarsRinging(float effectSeverity)
{
yield return (object)new WaitForSeconds(0.25f);
SoundManager.Instance.earsRingingTimer = effectSeverity;
}
public override void ItemInteractLeftRight(bool right)
{
((GrabbableObject)this).ItemInteractLeftRight(right);
foreach (MeshRenderer revolverAmmo in revolverAmmos)
{
((Renderer)revolverAmmo).enabled = false;
}
if (ammosLoaded > 0)
{
for (int i = 0; i <= ammosLoaded - 1; i++)
{
((Renderer)revolverAmmos[i]).enabled = true;
}
}
if (!((Object)(object)base.playerHeldBy == (Object)null))
{
Debug.Log((object)$"r/l activate: {right}");
if (!right)
{
StartOpenGunServerRpc();
}
else if (!isCylinderMoving && !isReloading && ammosLoaded < 6 && gunAnimator.GetBool("Reloading"))
{
StartReloadGunServerRpc();
}
}
}
public override void SetControlTipsForItem()
{
string[] toolTips = base.itemProperties.toolTips;
if (toolTips.Length <= 2)
{
Debug.LogError((object)"Shotgun control tips array length is too short to set tips!");
return;
}
if (base.playerHeldBy.playerBodyAnimator.GetBool("ReloadRevolver"))
{
if (Plugin.translateKorean)
{
toolTips[2] = "실린더 닫기: [Q]";
}
else
{
toolTips[2] = "Close cylinder: [Q]";
}
}
else if (Plugin.translateKorean)
{
toolTips[2] = "실린더 열기: [Q]";
}
else
{
toolTips[2] = "Open cylinder: [Q]";
}
HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, base.itemProperties);
}
private void SetSafetyControlTip()
{
string text = ((!Plugin.translateKorean) ? ((!base.playerHeldBy.playerBodyAnimator.GetBool("ReloadRevolver")) ? "Open cylinder: [Q]" : "Close cylinder: [Q]") : ((!base.playerHeldBy.playerBodyAnimator.GetBool("ReloadRevolver")) ? "실린더 열기: [Q]" : "실린더 닫기: [Q]"));
if (((NetworkBehaviour)this).IsOwner)
{
HUDManager.Instance.ChangeControlTip(3, text, false);
}
}
[ServerRpc(RequireOwnership = false)]
public void StartReloadGunServerRpc()
{
StartReloadGunClientRpc();
}
[ServerRpc(RequireOwnership = false)]
public void StartReloadGunClientRpc()
{
if (ReloadedGun() && !isReloading)
{
((MonoBehaviour)this).StartCoroutine(ReloadGunAnimation());
}
else
{
gunAudio.PlayOneShot(noAmmoSFX);
}
}
[ServerRpc(RequireOwnership = false)]
public void StartOpenGunServerRpc()
{
StartOpenGunClientRpc();
}
[ClientRpc]
public void StartOpenGunClientRpc()
{
if (!isCylinderMoving && !isReloading)
{
((MonoBehaviour)this).StartCoroutine(RevolverMoveCylinder());
}
else
{
gunAudio.PlayOneShot(noAmmoSFX);
}
}
private IEnumerator ReloadGunAnimation()
{
if (isCylinderMoving && !gunAnimator.GetBool("Reloading"))
{
yield break;
}
yield return (object)new WaitForSeconds(0.05f);
base.playerHeldBy.playerBodyAnimator.SetTrigger("RevolverInsertBullet");
isReloading = true;
gunAudio.PlayOneShot(gunReloadSFX);
if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)
{
WalkieTalkie.TransmitOneShotAudio(gunAudio, gunReloadSFX, 1f);
((Renderer)revolverAmmoInHand).enabled = true;
revolverAmmoInHandTransform.SetParent(base.playerHeldBy.leftHandItemTarget);
revolverAmmoInHandTransform.localPosition = new Vector3(0.0033f, 0.0732f, -0.0762f);
revolverAmmoInHandTransform.localEulerAngles = new Vector3(6.533f, 106.232f, -12.891f);
}
switch (ammosLoaded)
{
case 0:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
break;
case 1:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 60f, 0f));
break;
case 2:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 120f, 0f));
break;
case 3:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 180f, 0f));
break;
case 4:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 240f, 0f));
break;
case 5:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 300f, 0f));
break;
case 6:
cylinderTransform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
break;
}
gunAudio.PlayOneShot(gunReloadSFX);
yield return (object)new WaitForSeconds(0.75f);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)
{
base.playerHeldBy.DestroyItemInSlotAndSync(ammoSlotToUse);
}
ammoSlotToUse = -1;
ammosLoaded = Mathf.Clamp(ammosLoaded + 1, 0, 6);
}
yield return (object)new WaitForSeconds(0.1f);
if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)
{
foreach (MeshRenderer ammo in revolverAmmos)
{
((Renderer)ammo).enabled = false;
}
if (ammosLoaded > 0)
{
for (int i = 0; i <= ammosLoaded - 1; i++)
{
((Renderer)revolverAmmos[i]).enabled = true;
}
}
((Renderer)revolverAmmoInHand).enabled = false;
}
revolverAmmoInHandTransform.SetParent(((Component)this).transform);
yield return (object)new WaitForSeconds(1f);
gunAudio.PlayOneShot(gunReloadFinishSFX);
WalkieTalkie.TransmitOneShotAudio(gunAudio, gunReloadFinishSFX, 1f);
isReloading = false;
}
private IEnumerator RevolverMoveCylinder()
{
isCylinderMoving = true;
foreach (MeshRenderer ammo in revolverAmmos)
{
((Renderer)ammo).enabled = false;
}
if (ammosLoaded > 0)
{
for (int i = 0; i <= ammosLoaded - 1; i++)
{
((Renderer)revolverAmmos[i]).enabled = true;
}
}
base.playerHeldBy.playerBodyAnimator.SetBool("ReloadRevolver", !base.playerHeldBy.playerBodyAnimator.GetBool("ReloadRevolver"));
gunAnimator.SetBool("Reloading", !gunAnimator.GetBool("Reloading"));
if ((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)
{
if (base.playerHeldBy.playerBodyAnimator.GetBool("ReloadRevolver"))
{
gunAudio.PlayOneShot(cylinderOpenSFX);
}
else
{
gunAudio.PlayOneShot(cylinderCloseSFX);
}
((GrabbableObject)this).SetControlTipsForItem();
}
else if (gunAnimator.GetBool("Reloading"))
{
gunAudio.PlayOneShot(cylinderOpenSFX);
WalkieTalkie.TransmitOneShotAudio(gunAudio, cylinderOpenSFX, 1f);
gunAnimator.SetBool("Reloading", true);
}
else
{
gunAudio.PlayOneShot(cylinderCloseSFX);
WalkieTalkie.TransmitOneShotAudio(gunAudio, cylinderCloseSFX, 1f);
gunAnimator.SetBool("Reloading", false);
}
yield return (object)new WaitForSeconds(0.45f);
isCylinderMoving = false;
}
private bool ReloadedGun()
{
int num = FindAmmoInInventory();
if (num == -1)
{
Debug.Log((object)"not reloading");
return false;
}
Debug.Log((object)"reloading!");
ammoSlotToUse = num;
return true;
}
private int FindAmmoInInventory()
{
for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++)
{
if (!((Object)(object)base.playerHeldBy.ItemSlots[i] == (Object)null))
{
GrabbableObject obj = base.playerHeldBy.ItemSlots[i];
GunAmmo val = (GunAmmo)(object)((obj is GunAmmo) ? obj : null);
Debug.Log((object)$"Ammo null in slot #{i}?: {(Object)(object)val == (Object)null}");
if ((Object)(object)val != (Object)null)
{
Debug.Log((object)$"Ammo in slot #{i} id: {val.ammoType}");
}
if ((Object)(object)val != (Object)null && val.ammoType == gunCompatibleAmmoID)
{
return i;
}
}
}
return -1;
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
StopUsingGun();
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
StopUsingGun();
}
[ServerRpc(RequireOwnership = false)]
public void SyncRevolverAmmoServerRpc(int ammoCount)
{
if (((NetworkBehaviour)this).IsOwner)
{
SyncRevolverAmmoClientRpc(ammoCount);
}
}
[ClientRpc]
public void SyncRevolverAmmoClientRpc(int ammoCount)
{
ammosLoaded = ammoCount;
}
private void StopUsingGun()
{
SyncRevolverAmmoServerRpc(ammosLoaded);
isCylinderMoving = false;
previousPlayerHeldBy.equippedUsableItemQE = false;
if (isReloading)
{
((MonoBehaviour)this).StopCoroutine(ReloadGunAnimation());
isReloading = false;
}
if ((Object)(object)previousPlayerHeldBy != (Object)null)
{
previousPlayerHeldBy.playerBodyAnimator.SetBool("ReloadRevolver", false);
}
if (gunAnimator.GetBool("Reloading"))
{
if (gunCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(gunCoroutine);
}
gunAnimator.SetBool("Reloading", false);
gunAudio.Stop();
revolverAmmoInHandTransform.SetParent(((Component)this).transform);
((Renderer)revolverAmmoInHand).enabled = false;
isReloading = false;
}
}
}
[HarmonyPatch(typeof(RoundManager))]
internal class RoundManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(ref DungeonFlow[] ___dungeonFlowTypes)
{
}
private static void FindBigDoorRoomInTileSet(TileSet tileSet)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
Plugin.mls.LogInfo((object)("[TESLA GATE] Found Tileset: " + ((Object)tileSet).name));
if (tileSet.TileWeights.Weights == null)
{
return;
}
foreach (GameObjectChance weight in tileSet.TileWeights.Weights)
{
Plugin.mls.LogInfo((object)("[TESLA GATE] Found weight in Tileset: " + ((Object)tileSet).name));
if (!((Object)(object)weight.Value.transform != (Object)null))
{
continue;
}
foreach (Transform item in weight.Value.transform)
{
Transform val = item;
if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent<Doorway>()))
{
continue;
}
Plugin.mls.LogInfo((object)("[TESLA GATE] Find Doorway: " + ((Object)((Component)val).gameObject).name));
Doorway component = ((Component)val).GetComponent<Doorway>();
foreach (GameObjectWeight connectorPrefabWeight in component.ConnectorPrefabWeights)
{
if (((Object)connectorPrefabWeight.GameObject).name == "BigDoorSpawn")
{
if (((Object)connectorPrefabWeight.GameObject).name == "TeslaGateSpawn")
{
return;
}
GameObjectWeight val2 = new GameObjectWeight();
val2.Weight = 100f;
val2.GameObject = Plugin.teslaGateSpawn;
component.ConnectorPrefabWeights.Add(val2);
Plugin.mls.LogInfo((object)("added tesla to " + ((Object)((Component)val).gameObject).name));
}
}
}
}
}
}
public class TeslaGate : MonoBehaviour
{
public ParticleSystem telegraphParticle;
public ParticleSystem idleParticle;
public GameObject killTrigger;
public CustomTouchInteractTrigger idleCTI;
public CustomTouchInteractTrigger crackCTI;
public AudioSource windUpSource;
public AudioSource idleSource;
public AudioSource crackSource;
public List<PlayerControllerB> activatePlayerList = new List<PlayerControllerB>();
public List<GameObject> activateList = new List<GameObject>();
public List<PlayerControllerB> engagingPlayerList = new List<PlayerControllerB>();
public List<GameObject> engagingList = new List<GameObject>();
public bool coroutineRunning;
public bool idleIntroPlayed;
private void Start()
{
telegraphParticle = ((Component)((Component)this).transform.GetChild(0)).GetComponent<ParticleSystem>();
idleParticle = ((Component)((Component)this).transform.GetChild(1)).GetComponent<ParticleSystem>();
windUpSource = ((Component)((Component)this).transform.GetChild(4).GetChild(0)).GetComponent<AudioSource>();
idleSource = ((Component)((Component)this).transform.GetChild(4).GetChild(1)).GetComponent<AudioSource>();
crackSource = ((Component)((Component)this).transform.GetChild(4).GetChild(2)).GetComponent<AudioSource>();
killTrigger = ((Component)((Component)this).transform.GetChild(5)).gameObject;
CustomTouchInteractTrigger customTouchInteractTrigger = killTrigger.AddComponent<CustomTouchInteractTrigger>();
customTouchInteractTrigger.isKillTrigger = true;
crackCTI = ((Component)((Component)this).transform.GetChild(2)).gameObject.AddComponent<CustomTouchInteractTrigger>();
crackCTI.teslaGate = this;
idleCTI = ((Component)((Component)this).transform.GetChild(3)).gameObject.AddComponent<CustomTouchInteractTrigger>();
idleCTI.teslaGate = this;
idleCTI.isIdleTrigger = true;
killTrigger.SetActive(false);
windUpSource.volume = 0.45f * Plugin.teslaSoundVolume;
idleSource.volume = 0.45f * Plugin.teslaSoundVolume;
crackSource.volume = 0.45f * Plugin.teslaSoundVolume;
}
private void Update()
{
if (activateList.Count > 0)
{
if (!idleIntroPlayed)
{
idleSource.clip = Plugin.teslaIdleStart;
idleSource.Play();
idleSource.loop = false;
idleIntroPlayed = true;
idleParticle.Play();
}
else if (idleIntroPlayed && !idleSource.isPlaying)
{
idleSource.clip = Plugin.teslaIdle;
idleSource.loop = true;
idleSource.Play();
idleIntroPlayed = true;
}
}
else if (idleSource.isPlaying && idleIntroPlayed)
{
idleSource.loop = false;
idleSource.Stop();
idleParticle.Stop();
idleSource.PlayOneShot(Plugin.teslaIdleEnd);
idleIntroPlayed = false;
}
if (engagingList.Count > 0)
{
if (!coroutineRunning)
{
((MonoBehaviour)this).StartCoroutine(EngageTeslaCoroutine());
}
}
else
{
((MonoBehaviour)this).StopCoroutine(EngageTeslaCoroutine());
}
}
private IEnumerator EngageTeslaCoroutine()
{
coroutineRunning = true;
killTrigger.SetActive(false);
windUpSource.PlayOneShot(Plugin.teslaBeep);
windUpSource.PlayOneShot(Plugin.teslaWindUp);
windUpSource.PlayOneShot(Plugin.teslaUnderbass);
windUpSource.PlayOneShot(Plugin.teslaClimax);
yield return (object)new WaitForSeconds(0.75f);
killTrigger.SetActive(true);
foreach (PlayerControllerB player in engagingPlayerList)
{
if ((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController && Plugin.teslaShake)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
telegraphParticle.Play();
windUpSource.Stop();
crackSource.PlayOneShot(Plugin.teslaCrack);
yield return (object)new WaitForSeconds(0.65f);
killTrigger.SetActive(false);
yield return (object)new WaitForSeconds(0.6f);
coroutineRunning = false;
}
[ServerRpc(RequireOwnership = false)]
public void ForceTeslaTriggerServerRpc()
{
ForceTeslaTriggerClientRpc();
}
[ClientRpc]
public void ForceTeslaTriggerClientRpc()
{
((MonoBehaviour)this).StartCoroutine(InstantTeslaCoroutine());
}
public void ForceTeslaTrigger(PlayerControllerB player)
{
ForceTeslaTriggerServerRpc();
}
private IEnumerator InstantTeslaCoroutine()
{
killTrigger.SetActive(true);
foreach (PlayerControllerB player in engagingPlayerList)
{
if ((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController && Plugin.teslaShake)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
crackSource.PlayOneShot(Plugin.teslaCrack);
yield return (object)new WaitForSeconds(0.65f);
killTrigger.SetActive(false);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}