Decompiled source of BadnorthModcolorBanner v2.0.0

color banner.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using Voxels.TowerDefense;
using Voxels.TowerDefense.CampaignGeneration;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("color banner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("color banner")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a15d0b10-d3c7-4196-85a4-15f0dffdc54b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DarkRainbowFlagMod;

[BepInPlugin("com.yourname.darkrainbowflag", "Dark Rainbow Flag", "1.0.0")]
public class ModMain : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.yourname.darkrainbowflag");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Dark Rainbow Flag Mod loaded successfully! (Full Spectrum)");
	}
}
[HarmonyPatch(typeof(HeroGeneratorUI), "RandomizeStartingHero")]
public class HeroGeneratorUI_Color_Patch
{
	private static void Postfix(HeroDefinition heroDef)
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: 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)
		try
		{
			int hashCode = heroDef.nameTerm.GetHashCode();
			long num = (long)hashCode * 131071L;
			Random random = new Random((int)num);
			float num2 = (float)random.NextDouble();
			float num3 = (float)(random.NextDouble() * 0.8 + 0.1);
			float num4 = (float)(random.NextDouble() * 0.8 + 0.1);
			Color color = Color.HSVToRGB(num2, num3, num4);
			FieldInfo fieldInfo = AccessTools.Field(typeof(HeroDefinition), "hue");
			fieldInfo.SetValue(heroDef, num2);
			heroDef.color = color;
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("Error in DarkRainbowFlagMod Color Patch: " + ex.Message));
		}
	}
}