Decompiled source of Bad West Official Beta v1.0.0

Greek pack/modshield.dll

Decompiled a day ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using Voxels.TowerDefense;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("modshield")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("modshield")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e7d36049-bee3-432d-95ae-e58f266d260e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace skinenglish;

[BepInPlugin("com.yourname.badnorth.shieldmod", "English Shield Swapper Greek Pack", "1.9.4")]
public class Class1 : BaseUnityPlugin
{
	private const string ShieldPalette1 = "my_shield_palette.png";

	private const string ShieldPalette2 = "my_shield_palette2.png";

	internal static Texture2D customShieldTex;

	internal static Texture2D customShieldTex2;

	internal static Dictionary<string, Mesh> MeshCache = new Dictionary<string, Mesh>();

	private void Awake()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		string directoryName = Path.GetDirectoryName(typeof(Class1).Assembly.Location);
		customShieldTex = LoadTex(Path.Combine(directoryName, "my_shield_palette.png"));
		customShieldTex2 = LoadTex(Path.Combine(directoryName, "my_shield_palette2.png"));
		Harmony val = new Harmony("com.yourname.badnorth.shieldmod");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"--- [ShieldMod] โหลดจากโฟลเดอร\u0e4cป\u0e31จจ\u0e38บ\u0e31นสำเร\u0e47จ! ---");
	}

	private Texture2D LoadTex(string fullPath)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		if (File.Exists(fullPath))
		{
			byte[] array = File.ReadAllBytes(fullPath);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			val.Apply();
			return val;
		}
		return null;
	}

	internal static Mesh FindMesh(string name)
	{
		if (MeshCache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
		{
			return value;
		}
		Mesh[] array = Resources.FindObjectsOfTypeAll<Mesh>();
		Mesh[] array2 = array;
		foreach (Mesh val in array2)
		{
			if (((Object)val).name == name)
			{
				MeshCache[name] = val;
				return val;
			}
		}
		return null;
	}
}
[HarmonyPatch(typeof(Shield), "Setup")]
public class ShieldMeshPatch
{
	private static readonly string[] Level3VikingPool = new string[9] { "Weapons_VikingShield_2", "Weapons_VikingShield_3", "Weapons_VikingShield_4", "Weapons_VikingShield_5", "Weapons_VikingShield_6", "Weapons_VikingShield_7", "Weapons_VikingShield_8", "Weapons_VikingShield_9", "Weapons_VikingShield_10" };

	[HarmonyPostfix]
	public static void Postfix(Shield __instance)
	{
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)((AgentComponent)__instance).agent != (Object)null) || !((AgentComponent)__instance).agent.isEnglish || !((Object)(object)__instance.shield != (Object)null))
		{
			return;
		}
		MeshFilter component = ((Component)__instance.shield).GetComponent<MeshFilter>();
		Renderer component2 = ((Component)__instance.shield).GetComponent<Renderer>();
		if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null)
		{
			return;
		}
		int level = ((AgentComponent)__instance).agent.squad.level;
		Texture2D val = null;
		if (level == 1)
		{
			Swap(component, "Weapons_VikingShield_1");
			val = Class1.customShieldTex;
		}
		else if (level == 2)
		{
			Swap(component, (Random.value > 0.5f) ? "Weapons_DropShield_1" : "Weapons_VikingShield_1");
			val = Class1.customShieldTex2 ?? Class1.customShieldTex;
		}
		else if (level >= 3)
		{
			Mesh val2 = Class1.FindMesh(Level3VikingPool[Random.Range(0, Level3VikingPool.Length)]) ?? Class1.FindMesh("Weapons_VikingShield_2");
			if ((Object)(object)val2 != (Object)null)
			{
				component.sharedMesh = val2;
			}
			val = Class1.customShieldTex;
		}
		if ((Object)(object)val != (Object)null)
		{
			MaterialPropertyBlock val3 = new MaterialPropertyBlock();
			component2.GetPropertyBlock(val3);
			val3.SetTexture("_MainTex", (Texture)(object)val);
			val3.SetColor("_Color", Color.white);
			component2.SetPropertyBlock(val3);
		}
	}

	private static void Swap(MeshFilter mf, string n)
	{
		Mesh val = Class1.FindMesh(n);
		if ((Object)(object)val != (Object)null)
		{
			mf.sharedMesh = val;
		}
	}
}

Greek pack/skinenglish.dll

Decompiled a day ago
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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("skinenglish")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("skinenglish")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("29b8c893-ed4b-46a6-bcdd-b7eb2ce1d5c9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace skinenglish;

[BepInPlugin("com.yourname.badnorth.englishskin", "English Soldier Reskin Greek Pack", "1.8.2")]
public class Class1 : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <WaitAndPatch>d__5 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Class1 <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <WaitAndPatch>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			<>4__this.PatchEverything();
			<>2__current = (object)new WaitForSeconds(3f);
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private const string MyImageFile = "my_english_atlas.png";

	private const string TargetAtlasName = "PartTex_Spriteshop";

	private Texture2D replacementAtlas;

	private bool settingsSynced = false;

	private void Awake()
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Expected O, but got Unknown
		string directoryName = Path.GetDirectoryName(typeof(Class1).Assembly.Location);
		string text = Path.Combine(directoryName, "my_english_atlas.png");
		if (!File.Exists(text))
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("--- [Reskin] หาไฟล\u0e4cภาพไม\u0e48เจอใน: " + text + " ---"));
			return;
		}
		try
		{
			byte[] array = File.ReadAllBytes(text);
			replacementAtlas = new Texture2D(1024, 1024, (TextureFormat)4, true);
			ImageConversion.LoadImage(replacementAtlas, array);
			((Object)replacementAtlas).name = "Custom_English_Atlas_Final";
			((Texture)replacementAtlas).filterMode = (FilterMode)1;
			replacementAtlas.Apply(true);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"--- [Reskin] โหลดภาพต\u0e31วละครสำเร\u0e47จ! ---");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Error: " + ex.Message));
		}
		((MonoBehaviour)this).StartCoroutine(WaitAndPatch());
	}

	[IteratorStateMachine(typeof(<WaitAndPatch>d__5))]
	private IEnumerator WaitAndPatch()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <WaitAndPatch>d__5(0)
		{
			<>4__this = this
		};
	}

	private void PatchEverything()
	{
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: 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_0141: 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_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		Material[] array = Resources.FindObjectsOfTypeAll<Material>();
		Material[] array2 = array;
		foreach (Material val in array2)
		{
			if ((Object)(object)((val != null) ? val.mainTexture : null) != (Object)null && ((Object)val.mainTexture).name.Contains("PartTex_Spriteshop") && (Object)(object)val.mainTexture != (Object)(object)replacementAtlas)
			{
				if (!settingsSynced)
				{
					SyncSettings(val.mainTexture);
					settingsSynced = true;
				}
				val.mainTexture = (Texture)(object)replacementAtlas;
			}
		}
		SpriteRenderer[] array3 = Resources.FindObjectsOfTypeAll<SpriteRenderer>();
		SpriteRenderer[] array4 = array3;
		Vector2 val3 = default(Vector2);
		foreach (SpriteRenderer val2 in array4)
		{
			Sprite sprite = val2.sprite;
			if ((Object)(object)((sprite != null) ? sprite.texture : null) != (Object)null && ((Object)val2.sprite.texture).name.Contains("PartTex_Spriteshop") && (Object)(object)val2.sprite.texture != (Object)(object)replacementAtlas)
			{
				Sprite sprite2 = val2.sprite;
				float x = sprite2.pivot.x;
				Rect rect = sprite2.rect;
				float num = x / ((Rect)(ref rect)).width;
				float y = sprite2.pivot.y;
				rect = sprite2.rect;
				((Vector2)(ref val3))..ctor(num, y / ((Rect)(ref rect)).height);
				val2.sprite = Sprite.Create(replacementAtlas, sprite2.rect, val3, sprite2.pixelsPerUnit, 0u, (SpriteMeshType)0, sprite2.border);
			}
		}
	}

	private void SyncSettings(Texture o)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		((Texture)replacementAtlas).filterMode = o.filterMode;
		((Texture)replacementAtlas).anisoLevel = o.anisoLevel;
		replacementAtlas.Apply(true, false);
	}
}

Greek pack/vikingskin.dll

Decompiled a day ago
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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("vikingskin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("vikingskin")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1ceba66e-f496-4dd0-bf86-3cb47dc76deb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace skinviking;

[BepInPlugin("reskin.badnorth.viking", "Viking Atlas Reskin Greek Pack", "1.3.1")]
public class ReskinMod : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <WaitAndPatch>d__5 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public ReskinMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <WaitAndPatch>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (!<>4__this.patched)
			{
				<>4__this.TryPatchAtlas();
				<>2__current = (object)new WaitForSeconds(3f);
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private const string ImageFileName = "my_enemy_atlas.png";

	private const string AtlasName = "PartTex_Median_BlurAlpha";

	private Texture2D replacementAtlas;

	private bool patched = false;

	private void Awake()
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		string directoryName = Path.GetDirectoryName(typeof(ReskinMod).Assembly.Location);
		string text = Path.Combine(directoryName, "my_enemy_atlas.png");
		if (!File.Exists(text))
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("--- [VikingMod] ไม\u0e48พบไฟล\u0e4cภาพท\u0e35\u0e48: " + text + " ---"));
			return;
		}
		try
		{
			byte[] array = File.ReadAllBytes(text);
			replacementAtlas = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(replacementAtlas, array);
			replacementAtlas.Apply();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"--- [VikingMod] โหลดภาพสำเร\u0e47จ! กำล\u0e31งรอ Patch เข\u0e49าต\u0e31วเกม... ---");
			((MonoBehaviour)this).StartCoroutine(WaitAndPatch());
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("โหลดร\u0e39ปพลาด: " + ex.Message));
		}
	}

	[IteratorStateMachine(typeof(<WaitAndPatch>d__5))]
	private IEnumerator WaitAndPatch()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <WaitAndPatch>d__5(0)
		{
			<>4__this = this
		};
	}

	private void TryPatchAtlas()
	{
		Texture2D[] array = Resources.FindObjectsOfTypeAll<Texture2D>();
		Texture2D[] array2 = array;
		foreach (Texture2D val in array2)
		{
			if (((Object)val).name == "PartTex_Median_BlurAlpha" && (Object)(object)val != (Object)(object)replacementAtlas)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("เจอ Atlas ของเกมแล\u0e49ว: " + ((Object)val).name));
				val.Resize(((Texture)replacementAtlas).width, ((Texture)replacementAtlas).height, (TextureFormat)4, false);
				Color32[] pixels = replacementAtlas.GetPixels32();
				val.SetPixels32(pixels);
				val.Apply(false, false);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"--- [VikingMod] Patch สก\u0e34นไวก\u0e34\u0e49งสำเร\u0e47จ! ---");
				patched = true;
				break;
			}
		}
	}
}