Decompiled source of ReTurn World v1.0.0

ReTurnWorld.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
using stickfightlevellib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("StickFightTheGameMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StickFightTheGameMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("07ad7751-658e-41ea-b1ee-8a7e59ffbe73")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace turnworldmod;

[BepInPlugin("sftg.bayturtleking.returnworld", "returnworld", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class turnworldoverlord : BaseUnityPlugin
{
	public static turnworldoverlord thebigcheese;

	public static AssetBundle thegoods;

	public static ConfigEntry<float> howfartospin;

	public static ConfigEntry<float> howoftentospin;

	public static ConfigEntry<float> howfasttospin;

	public static int[] thefakeids;

	public static readonly string[] therealdeal = new string[20]
	{
		"Assets/00 Levels/9 Turn World/Turn1.unity", "Assets/00 Levels/9 Turn World/Turn2.unity", "Assets/00 Levels/9 Turn World/Turn3.unity", "Assets/00 Levels/9 Turn World/Turn4.unity", "Assets/00 Levels/9 Turn World/Turn5.unity", "Assets/00 Levels/9 Turn World/Turn6.unity", "Assets/00 Levels/9 Turn World/Turn7.unity", "Assets/00 Levels/9 Turn World/Turn8.unity", "Assets/00 Levels/9 Turn World/Turn9.unity", "Assets/00 Levels/9 Turn World/Turn10.unity",
		"Assets/00 Levels/9 Turn World/Turn11.unity", "Assets/00 Levels/9 Turn World/Turn12.unity", "Assets/00 Levels/9 Turn World/Turn13.unity", "Assets/00 Levels/9 Turn World/Turn14.unity", "Assets/00 Levels/9 Turn World/Turn15.unity", "Assets/00 Levels/9 Turn World/Turn16.unity", "Assets/00 Levels/9 Turn World/Turn17.unity", "Assets/00 Levels/9 Turn World/Turn18.unity", "Assets/00 Levels/9 Turn World/Turn19.unity", "Assets/00 Levels/9 Turn World/Turn20.unity"
	};

	private void Awake()
	{
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		thebigcheese = this;
		howfartospin = ((BaseUnityPlugin)this).Config.Bind<float>("turner", "turnangle", 90f, "how much the turn world platforms actually rotate");
		howoftentospin = ((BaseUnityPlugin)this).Config.Bind<float>("turner", "turninterval", 10f, "how long between the turn world platforms' turns");
		howfasttospin = ((BaseUnityPlugin)this).Config.Bind<float>("turner", "turnspeed", 15f, "how fast the turn world platforms turn");
		SceneManager.sceneLoaded += stuffstuffturner.oiwhatsloading;
		string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "turnworld-maps");
		if (!File.Exists(text))
		{
			yap("we couldnt find bundle :( " + text);
			return;
		}
		thegoods = AssetBundle.LoadFromFile(text);
		if (!((Object)(object)thegoods == (Object)null))
		{
			thefakeids = thelibrary.addworld("Turn", thegoods, therealdeal, (string[])null, (byte[][])null, "Halloween");
			new Harmony("sftg.bayturtleking.returnworld").PatchAll();
		}
	}

	public void yap(string msg)
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)msg);
	}
}
[HarmonyPatch(typeof(WeaponPickUp), "ChangeToPresent")]
public static class stopmakingthemgifts
{
	private static bool Prefix()
	{
		if (thelibrary.howmanyfakescenesrn > 0)
		{
			return false;
		}
		return true;
	}
}
public static class stuffstuffturner
{
	public static void oiwhatsloading(Scene scene, LoadSceneMode mode)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		if (Array.IndexOf(turnworldoverlord.therealdeal, ((Scene)(ref scene)).path) >= 0)
		{
			((MonoBehaviour)turnworldoverlord.thebigcheese).StartCoroutine(theydostuff2(scene));
		}
	}

	private static IEnumerator theydostuff2(Scene scene)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		yield return null;
		GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
		for (int i = 0; i < rootGameObjects.Length; i++)
		{
			diggethedeeper(rootGameObjects[i].transform);
		}
	}

	private static int diggethedeeper(Transform thisguy)
	{
		//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_0065: 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)
		int num = 0;
		Component[] components = ((Component)thisguy).gameObject.GetComponents<Component>();
		for (int i = 0; i < components.Length; i++)
		{
			if ((Object)(object)components[i] == (Object)null)
			{
				makeemturnagain makeemturnagain2 = ((Component)thisguy).gameObject.AddComponent<makeemturnagain>();
				makeemturnagain2.thespots = new float[2]
				{
					0f,
					turnworldoverlord.howfartospin.Value
				};
				makeemturnagain2.restcolor = new Color(0f, 1f, 0.959f, 1f);
				makeemturnagain2.movecolor = Color.yellow;
				makeemturnagain2.waitttdude = turnworldoverlord.howoftentospin.Value;
				makeemturnagain2.howzoommm = turnworldoverlord.howfasttospin.Value;
				num++;
			}
		}
		for (int j = 0; j < thisguy.childCount; j++)
		{
			num += diggethedeeper(thisguy.GetChild(j));
		}
		return num;
	}
}
public class makeemturnagain : MonoBehaviour
{
	public float[] thespots;

	public Color restcolor;

	public Color movecolor;

	public float waitttdude = 10f;

	public float howzoommm = 1f;

	private readonly float thefrictionlie = 5f;

	private readonly float thebounceback = 3f;

	private readonly float dontoverdoit = 10f;

	private float zoomstuff1;

	private float spinnything;

	private float clocktiktoktiktok;

	private int theidrn;

	private bool alreadywarned = true;

	private bool ismovingrn;

	private const float warningleadtime = 1.5f;

	private const float settlethreshold = 0.5f;

	private const float velthreshold = 0.05f;

	private Transform theplatformbit;

	private SpriteRenderer[] thecirclesprites;

	private SpriteRenderer[] thestripesprites;

	private ParticleSystem theaboutparticles;

	private ParticleSystem theturnparticles;

	private void Start()
	{
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		Transform val = ((Component)this).transform.Find("TurnerStuff < DONT MOVE");
		theplatformbit = ((Component)this).transform.Find("Stone_Platform_small");
		if ((Object)(object)theplatformbit == (Object)null)
		{
			theplatformbit = ((Component)this).transform;
		}
		spinnything = thespots[0];
		theplatformbit.localEulerAngles = new Vector3(spinnything, 0f, 0f);
		if ((Object)(object)val != (Object)null)
		{
			thecirclesprites = findbyname<SpriteRenderer>(val, "circle");
			theaboutparticles = findonebyname<ParticleSystem>(val, "abouttoturneffect");
			theturnparticles = findonebyname<ParticleSystem>(val, "turneffect");
		}
		thestripesprites = findbyname<SpriteRenderer>(theplatformbit, "stripe");
		ismovingrn = false;
		lightstuffthingfortheplatform(restcolor);
	}

	private T[] findbyname<T>(Transform root, string namehas) where T : Component
	{
		return Array.FindAll(((Component)root).GetComponentsInChildren<T>(true), (T r) => ((Object)((Component)r).gameObject).name.ToLowerInvariant().Contains(namehas));
	}

	private T findonebyname<T>(Transform root, string namehas) where T : Component
	{
		return Array.Find(((Component)root).GetComponentsInChildren<T>(true), (T r) => ((Object)((Component)r).gameObject).name.ToLowerInvariant().Contains(namehas));
	}

	private void Update()
	{
		//IL_010c: 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)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		clocktiktoktiktok += Time.deltaTime;
		if (clocktiktoktiktok > waitttdude)
		{
			clocktiktoktiktok = 0f;
			theidrn++;
			if (theidrn >= thespots.Length)
			{
				theidrn = 0;
			}
			whenturnnn();
			alreadywarned = false;
		}
		if (clocktiktoktiktok + 1.5f > waitttdude && !alreadywarned)
		{
			imabouttaturnn();
			alreadywarned = true;
		}
		zoomstuff1 = Mathf.Lerp(zoomstuff1, Mathf.Clamp(thespots[theidrn] - spinnything, 0f - dontoverdoit, dontoverdoit) * thebounceback, Time.deltaTime * thefrictionlie);
		spinnything += zoomstuff1 * Time.deltaTime * howzoommm * 0.05f;
		theplatformbit.localEulerAngles = new Vector3(spinnything, 0f, 0f);
		bool flag = Mathf.Abs(thespots[theidrn] - spinnything) > 0.5f || Mathf.Abs(zoomstuff1) > 0.05f;
		if (flag != ismovingrn)
		{
			ismovingrn = flag;
			lightstuffthingfortheplatform(ismovingrn ? movecolor : restcolor);
		}
	}

	private void whenturnnn()
	{
		if ((Object)(object)theturnparticles != (Object)null)
		{
			theturnparticles.Play();
		}
	}

	private void imabouttaturnn()
	{
		if ((Object)(object)theaboutparticles != (Object)null)
		{
			theaboutparticles.Play();
		}
	}

	private void lightstuffthingfortheplatform(Color c)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		if (thecirclesprites != null)
		{
			for (int i = 0; i < thecirclesprites.Length; i++)
			{
				if ((Object)(object)thecirclesprites[i] != (Object)null)
				{
					thecirclesprites[i].color = c;
				}
			}
		}
		if (thestripesprites == null)
		{
			return;
		}
		for (int j = 0; j < thestripesprites.Length; j++)
		{
			if ((Object)(object)thestripesprites[j] != (Object)null)
			{
				thestripesprites[j].color = c;
			}
		}
	}
}