using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ComputerysModdingUtilities;
using FishNet;
using FishNet.Managing.Timing;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: StraftatMod(false)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("sudden_death")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Create walls that close in on a timer")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f20225dcbb4dfa56a958e53b7770ff8e6ed0edbd")]
[assembly: AssemblyProduct("com.koki.suddendeath")]
[assembly: AssemblyTitle("sudden_death")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace straftat_sudden_death
{
[BepInPlugin("sudden_death", "com.koki.suddendeath", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static BeforeSpawnAction <0>__ResetTimer;
public static Action <1>__TickCountdown;
public static Action <2>__TickSD;
}
private static ManualLogSource log;
private static int ticksUntilSD;
private static bool isSD;
private static Vector3 center;
private static float radius;
private static ConfigEntry<float> startRadius;
private static ConfigEntry<float> minRadius;
private static ConfigEntry<float> shrinkRate;
private static ConfigEntry<int> secUntilSD;
private static GameObject SDCylinder;
private static PlayerHealth[] players;
private static ConfigEntry<float> damagePerSec;
private static ConfigEntry<string> zoneColor;
private void Awake()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
string text = ":3";
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
log = ((BaseUnityPlugin)this).Logger;
ConfigInit();
object obj = <>O.<0>__ResetTimer;
if (obj == null)
{
BeforeSpawnAction val = ResetTimer;
<>O.<0>__ResetTimer = val;
obj = (object)val;
}
PauseManager.OnBeforeSpawn += (BeforeSpawnAction)obj;
}
public static void ResetTimer()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
radius = startRadius.Value;
ticksUntilSD = secUntilSD.Value * 60;
isSD = false;
center = Vector3.zero;
if (Object.op_Implicit((Object)(object)SDCylinder))
{
Object.Destroy((Object)(object)SDCylinder);
}
InstanceFinder.TimeManager.OnTick -= TickCountdown;
InstanceFinder.TimeManager.OnTick -= TickSD;
InstanceFinder.TimeManager.OnTick += TickCountdown;
InstanceFinder.TimeManager.OnTick += TickSD;
}
public static void TickCountdown()
{
if (ticksUntilSD > 0)
{
ticksUntilSD--;
}
else if (!isSD)
{
isSD = true;
if (Object.op_Implicit((Object)(object)SDCylinder))
{
Object.Destroy((Object)(object)SDCylinder);
}
SpawnSDCylinder();
}
}
public static void TickSD()
{
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_0096: Unknown result type (might be due to invalid IL or missing references)
if (!isSD)
{
return;
}
TimeManager timeManager = InstanceFinder.TimeManager;
if (timeManager.Tick % 60 == 0 && InstanceFinder.IsServer)
{
PlayerHealth[] array = players;
foreach (PlayerHealth val in array)
{
if (Object.op_Implicit((Object)(object)val))
{
Vector3 position = ((Component)val).transform.position;
float num = Vector3.Distance(new Vector3(position.x, 0f, position.z), new Vector3(center.x, 0f, center.z));
if (num > radius)
{
val.RemoveHealth(damagePerSec.Value / 25f);
}
}
}
}
if (Object.op_Implicit((Object)(object)SDCylinder))
{
if (radius > minRadius.Value)
{
radius -= shrinkRate.Value / 60f;
}
SDCylinder.transform.localScale = new Vector3(radius * 2f, 200f, radius * 2f);
}
}
public static void SpawnSDCylinder()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00c7: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
SDCylinder = GameObject.CreatePrimitive((PrimitiveType)2);
players = Object.FindObjectsOfType<PlayerHealth>();
Collider component = SDCylinder.GetComponent<Collider>();
component.enabled = false;
component.isTrigger = false;
PlayerHealth[] array = players;
foreach (PlayerHealth val in array)
{
if ((Object)(object)val != (Object)null && !val.isKilled)
{
center += ((Component)val).transform.position;
}
}
center /= (float)players.Length;
SDCylinder.transform.position = new Vector3(center.x, 0f, center.z);
MeshRenderer component2 = SDCylinder.GetComponent<MeshRenderer>();
Material material = ((Renderer)component2).material;
Shader val2 = Shader.Find("UI/Default");
material.shader = (Object.op_Implicit((Object)(object)val2) ? val2 : Shader.Find("Unlit/Transparent"));
string[] array2 = zoneColor.Value.Split(", ");
float[] array3 = new float[3];
for (int j = 0; j < 3; j++)
{
array3[j] = float.Parse(array2[j]) / 255f;
}
material.SetColor("_Color", new Color(array3[0], array3[1], array3[2], 1f));
material.SetInt("_Cull", 0);
}
public void ConfigInit()
{
zoneColor = ((BaseUnityPlugin)this).Config.Bind<string>("general", "Death Zone Color", "110, 53, 45", "R, G, B");
startRadius = ((BaseUnityPlugin)this).Config.Bind<float>("general", "Death Zone Starting Radius", 37.5f, "zone is a cylinder, radius measured in arbitrary in game units");
minRadius = ((BaseUnityPlugin)this).Config.Bind<float>("general", "Death Zone Minimum Radius", 10f, "zone is a cylinder, radius measured in arbitrary in game units");
shrinkRate = ((BaseUnityPlugin)this).Config.Bind<float>("general", "Units / Second that the Zone Shrinks at", 1f, "zone is a cylinder, radius measured in arbitrary in game units");
secUntilSD = ((BaseUnityPlugin)this).Config.Bind<int>("general", "Seconds until Zone Appears", 45, "");
damagePerSec = ((BaseUnityPlugin)this).Config.Bind<float>("general", "Damage per Second while in Zone", 10f, "");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "sudden_death";
public const string PLUGIN_NAME = "com.koki.suddendeath";
public const string PLUGIN_VERSION = "1.0.0";
}
}