Decompiled source of Zombiemod v1.2.0

Zombie.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms;
using BepInEx;
using DM;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.AI.Components.Tags;
using SLMA;
using TFBGames;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Zombie")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zombie")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7acfaef0-7669-4401-8bff-5a9a02e18c75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class MotherZombie : MonoBehaviour
{
	public void Start()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		Unit component = ((Component)this).GetComponent<Unit>();
		((Component)component).gameObject.GetComponentInChildren<Unit>().unitType = (UnitType)1;
		Balance componentInChildren = ((Component)component).gameObject.GetComponentInChildren<Balance>();
		componentInChildren.forceMultiplier *= 1.5f;
		Balance componentInChildren2 = ((Component)component).gameObject.GetComponentInChildren<Balance>();
		componentInChildren2.allowedLegAngle *= 2f;
		Balance componentInChildren3 = ((Component)component).gameObject.GetComponentInChildren<Balance>();
		componentInChildren3.allowedTorsoAngle *= 2f;
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[0]).transform.localScale = new Vector3(3f, 3f, 3f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[2]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[1]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[3]).transform.localScale = new Vector3(3f, 3f, 1f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[5]).transform.localScale = new Vector3(3f, 3f, 1f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[7]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[8]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[9]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
		((Component)((Component)component).gameObject.GetComponentInChildren<RigidbodyHolder>().AllRigs[10]).transform.localScale = new Vector3(3f, 1.15f, 3.5f);
	}
}
public class ZombieBite : MonoBehaviour
{
	private DataHandler data;

	private DataHandler targetData;

	private float counter;

	public UnitEffectBase effect;

	public void Update()
	{
		if ((Object)(object)data == (Object)null)
		{
			data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
		}
		if (!((Object)(object)data == (Object)null) && !((Object)(object)data.targetData == (Object)null) && !data.Dead)
		{
			targetData = data.targetData;
			counter += Time.deltaTime;
			if (counter >= 0.1f)
			{
				counter = 0f;
				CheckBite();
			}
		}
	}

	private void OnEnable()
	{
		data = ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>();
	}

	private void CheckBite()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		if (!data.Dead && Object.op_Implicit((Object)(object)targetData) && Vector3.Distance(data.head.position, targetData.mainRig.position + ((Component)targetData.mainRig).transform.up * 0.15f) < 0.6f)
		{
			DoAttack();
		}
	}

	private void DoAttack()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)targetData) && Object.op_Implicit((Object)(object)effect))
		{
			Type type = ((object)effect).GetType();
			UnitEffectBase val = (UnitEffectBase)((Component)((Component)targetData).transform.root).GetComponentInChildren(type);
			if ((Object)(object)val == (Object)null)
			{
				GameObject obj = Object.Instantiate<GameObject>(((Component)effect).gameObject, ((Component)targetData).transform.root);
				obj.transform.position = ((Component)targetData).transform.root.position;
				obj.GetComponent<UnitEffectBase>().DoEffect();
			}
			else
			{
				val.Ping();
			}
		}
	}
}
namespace Zombie;

[BepInPlugin("org.bepinex.plugins.Zombie", "Zombie", "1.0.0")]
internal class Loader : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		Debug.Log((object)"运行核心!");
		Debug.Log((object)("本模组制作by " + UManager.可修改作者));
		Debug.Log((object)"核心基于SLMAcore");
		GameObject val = new GameObject(UManager.可修改模组名字);
		Object.DontDestroyOnLoad((Object)val);
		val.AddComponent<Main>();
	}
}
[BepInPlugin("org.bepinex.plugins.Zombie", "Zombie", "1.0.0")]
public class Main : BaseUnityPlugin
{
	public LandfallUnitDatabase db;

	public void Awake()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		if (UManager.是否弹窗)
		{
			MessageBox.Show("本模组为" + UManager.可修改作者 + "制作\r\n模组名字为" + UManager.可修改模组名字, "SLMA", (MessageBoxButtons)0, (MessageBoxIcon)16, (MessageBoxDefaultButton)0, (MessageBoxOptions)131072);
		}
		Debug.Log((object)("Loaded " + UManager.可修改模组名字 + "....."));
		SLMALoader.GetInstance();
		UManager.Init(ContentDatabase.Instance().LandfallContentDatabase);
		Debug.Log((object)("Loaded " + UManager.可修改模组名字 + "............"));
		Debug.Log((object)("Loaded " + UManager.可修改模组名字 + " Successfully"));
		Debug.Log((object)(UManager.可修改作者 + "祝您玩的愉快"));
		Debug.Log((object)(UManager.可修改作者 + " wished you a pleasant trip"));
	}
}
public class MotherSummon : MonoBehaviour
{
	public static UnitBlueprint ZombieBlueprint;

	public float interval = 5f;

	public int maxAlive = 8;

	public float detectRadius = 30f;

	public LayerMask enemyLayerMask = LayerMask.op_Implicit(-1);

	private Unit unit;

	private float timer = 2f;

	private float detectTimer;

	private readonly List<GameObject> summoned = new List<GameObject>();

	private void Start()
	{
		unit = ((Component)this).GetComponent<Unit>();
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)this).GetComponentInParent<Unit>();
		}
		Debug.Log((object)("[Zombie] MotherSummon.Start unit=" + (((Object)(object)unit != (Object)null) ? ((Object)((Component)unit).gameObject).name : "NULL") + " blueprint=" + (((Object)(object)ZombieBlueprint != (Object)null) ? ((Object)ZombieBlueprint).name : "NULL")));
	}

	private void Update()
	{
		if ((Object)(object)unit == (Object)null || (Object)(object)ZombieBlueprint == (Object)null || (Object)(object)unit.data == (Object)null || unit.data.Dead)
		{
			return;
		}
		for (int num = summoned.Count - 1; num >= 0; num--)
		{
			if ((Object)(object)summoned[num] == (Object)null)
			{
				summoned.RemoveAt(num);
			}
		}
		timer += Time.deltaTime;
		if (timer < interval || summoned.Count >= maxAlive)
		{
			return;
		}
		detectTimer += Time.deltaTime;
		if (!(detectTimer < 0.5f))
		{
			detectTimer = 0f;
			if (HasNearbyEnemy())
			{
				timer = 0f;
				SpawnZombie();
			}
		}
	}

	private bool HasNearbyEnemy()
	{
		//IL_0010: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Collider[] array = Physics.OverlapSphere(unit.data.mainRig.position, detectRadius, LayerMask.op_Implicit(enemyLayerMask));
			for (int i = 0; i < array.Length; i++)
			{
				Unit componentInParent = ((Component)array[i]).GetComponentInParent<Unit>();
				if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)unit && componentInParent.Team != unit.Team && !componentInParent.data.Dead)
				{
					return true;
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("[Zombie] MotherSummon.HasNearbyEnemy 异常: " + ex.Message));
		}
		return false;
	}

	private void SpawnZombie()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: 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)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Vector3 val = unit.data.mainRig.position + ((Component)unit.data.mainRig).transform.forward * 2f + Random.insideUnitSphere * 1f;
			val.y = unit.data.mainRig.position.y;
			GameObject val2 = ZombieBlueprint.Spawn(val, Quaternion.LookRotation(((Component)unit.data.mainRig).transform.forward), unit.Team, 1f, (UnitPoolInfo?)null)[0];
			Unit component = val2.GetComponent<Unit>();
			if ((Object)(object)component != (Object)null)
			{
				component.data.fallTime = 0.3f;
			}
			summoned.Add(val2);
			Debug.Log((object)("[Zombie] 母体召唤了僵尸, 当前存活召唤物: " + summoned.Count));
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[Zombie] 母体召唤失败: " + ex));
		}
	}
}
public static class STools
{
	public static void RendererColorChanger(Renderer[] renderers, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < renderers.Length; i++)
		{
			Material[] materials = renderers[i].materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = color;
			}
		}
	}

	public static List<T> ToList<T>(T[] ts)
	{
		List<T> list = new List<T>();
		foreach (T item in ts)
		{
			list.Add(item);
		}
		return list;
	}

	public static void RendererColorChanger(MeshRenderer[] renderers, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < renderers.Length; i++)
		{
			Material[] materials = ((Renderer)renderers[i]).materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = color;
			}
		}
	}

	public static void RendererColorChanger(SkinnedMeshRenderer[] renderers, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < renderers.Length; i++)
		{
			Material[] materials = ((Renderer)renderers[i]).materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = color;
			}
		}
	}

	public static void RendererColorChanger(Renderer[] renderers, Material[] color)
	{
		for (int i = 0; i < renderers.Length; i++)
		{
			renderers[i].materials = color;
		}
	}

	public static void RendererColorChanger(MeshRenderer[] renderers, Material[] color)
	{
		for (int i = 0; i < renderers.Length; i++)
		{
			((Renderer)renderers[i]).materials = color;
		}
	}

	public static void RendererColorChanger(SkinnedMeshRenderer[] renderers, Material[] color)
	{
		for (int i = 0; i < renderers.Length; i++)
		{
			((Renderer)renderers[i]).materials = color;
		}
	}
}
public static class UManager
{
	public static string 可修改作者 = "Fhp史莱姆";

	public static string 可修改模组名字 = "僵尸mod";

	public static string 注释;

	public static string 不准修改Path = "SLMApackage\\image";

	public static bool 是否弹窗 = false;

	public static GameObject MasterObject { get; private set; }

	public static GameObject ZombieBiteMove { get; private set; }

	public static void Init(LandfallContentDatabase db)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: 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_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Expected O, but got Unknown
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Expected O, but got Unknown
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Expected O, but got Unknown
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Expected O, but got Unknown
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Expected O, but got Unknown
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Expected O, but got Unknown
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Expected O, but got Unknown
		//IL_0422: Unknown result type (might be due to invalid IL or missing references)
		//IL_0437: Expected O, but got Unknown
		//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Expected O, but got Unknown
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Expected O, but got Unknown
		//IL_0621: Unknown result type (might be due to invalid IL or missing references)
		//IL_0636: Expected O, but got Unknown
		//IL_0667: Unknown result type (might be due to invalid IL or missing references)
		//IL_066d: Expected O, but got Unknown
		//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e1: Expected O, but got Unknown
		//IL_075e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0773: Expected O, but got Unknown
		//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bd: Expected O, but got Unknown
		//IL_0810: Unknown result type (might be due to invalid IL or missing references)
		//IL_0820: Expected O, but got Unknown
		//IL_084a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0850: Expected O, but got Unknown
		//IL_0889: Unknown result type (might be due to invalid IL or missing references)
		//IL_088f: Expected O, but got Unknown
		GameObject val = new GameObject
		{
			hideFlags = (HideFlags)61
		};
		val.SetActive(false);
		MasterObject = val;
		RegisterTranslations();
		Sprite val2 = LoadIcon("faction_zombie");
		Sprite val3 = LoadIcon("unit_zombie");
		Sprite val4 = LoadIcon("unit_fast_zombie");
		Sprite val5 = LoadIcon("unit_fly_zombie");
		Sprite val6 = LoadIcon("unit_giant_zombie");
		Sprite val7 = LoadIcon("unit_mother");
		Sprite val8 = LoadIcon("unit_fly_mother");
		Sprite val9 = LoadIcon("weapon_claw");
		Sprite val10 = LoadIcon("weapon_punch");
		Sprite val11 = LoadIcon("weapon_harpoon");
		Sprite val12 = LoadIcon("ability_bite");
		Sprite val13 = LoadIcon("ability_wings");
		GameObject val14 = UPool.MyPool.AddObject("僵尸撕咬", (GameObject)SLMALoader.SDic["moves"]["Vampirebite"], true, (HideFlags)52, val12, 48970001, true);
		SetZombieTag(val14);
		DodgeMove component = val14.GetComponent<DodgeMove>();
		CombatMoveDataInstance obj = component.moves[0];
		obj.force /= 3f;
		component.moves[0].forceDirection = (ForceDirection)1;
		DodgeMove val15 = val14.AddComponent<DodgeMove>();
		((Object)val15).hideFlags = (HideFlags)61;
		val15.moves = (CombatMoveDataInstance[])(object)new CombatMoveDataInstance[1]
		{
			new CombatMoveDataInstance
			{
				rigidbodyToMove = (RigidBodyToMove)7,
				forceDirection = (ForceDirection)10,
				force = component.moves[0].force,
				forceCurve = component.moves[0].forceCurve
			}
		};
		DodgeMove val16 = val14.AddComponent<DodgeMove>();
		((Object)val16).hideFlags = (HideFlags)61;
		val16.moves = (CombatMoveDataInstance[])(object)new CombatMoveDataInstance[1]
		{
			new CombatMoveDataInstance
			{
				rigidbodyToMove = (RigidBodyToMove)6,
				forceDirection = (ForceDirection)10,
				force = component.moves[0].force,
				forceCurve = component.moves[0].forceCurve
			}
		};
		DodgeMove obj2 = val14.AddComponent<DodgeMove>();
		((Object)obj2).hideFlags = (HideFlags)61;
		obj2.moves = (CombatMoveDataInstance[])(object)new CombatMoveDataInstance[1]
		{
			new CombatMoveDataInstance
			{
				rigidbodyToMove = (RigidBodyToMove)0,
				forceDirection = (ForceDirection)10,
				force = component.moves[0].force,
				forceCurve = component.moves[0].forceCurve
			}
		};
		Object.Destroy((Object)(object)val14.GetComponent<VapireBite>());
		ConditionalEvent component2 = val14.GetComponent<ConditionalEvent>();
		ConditionalEventInstance[] array = new ConditionalEventInstance[1];
		ConditionalEventInstance val17 = new ConditionalEventInstance();
		val17.conditions = (EventCondition[])(object)new EventCondition[2]
		{
			new EventCondition
			{
				valueType = (ValueType)1,
				value = 1f,
				conditionType = (ConditionType)1
			},
			new EventCondition
			{
				value = 1.1f,
				conditionType = (ConditionType)0
			}
		};
		val17.moves = (Move[])(object)new Move[3]
		{
			(Move)component,
			(Move)val16,
			(Move)val15
		};
		array[0] = val17;
		component2.events = (ConditionalEventInstance[])(object)array;
		val14.AddComponent<ZombieBite>().effect = ((Component)Zombification.ConvenientInstance(100f)).GetComponent<UnitEffectBase>();
		StripVampirebiteDamageChildren(val14);
		ZombieBiteMove = val14;
		Unit component3 = UPool.MyPool.AddObject("僵尸", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, (Sprite)null, 0, false).GetComponent<Unit>();
		Renderer[] componentsInChildren = ((Component)component3).gameObject.GetComponentsInChildren<Renderer>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			TeamColor val18 = ((Component)componentsInChildren[i]).GetComponent<TeamColor>();
			if ((Object)(object)val18 == (Object)null)
			{
				val18 = ((Component)componentsInChildren[i]).gameObject.AddComponent<TeamColor>();
			}
			val18.redMaterial = (Material)SLMALoader.SDic["materials"]["pineapplegreen"];
			val18.blueMaterial = (Material)SLMALoader.SDic["materials"]["pineapplegreen"];
		}
		Unit component4 = UPool.MyPool.AddObject("僵尸母体", ((Component)component3).gameObject, true, (HideFlags)52, (Sprite)null, 0, false).GetComponent<Unit>();
		component4.data.canFall = false;
		((Component)component4).gameObject.AddComponent<MotherZombie>();
		((Component)component4).gameObject.AddComponent<MotherSummon>();
		GameObject obj3 = UPool.MyPool.AddObject("僵尸之爪", (GameObject)SLMALoader.SDic["weapons"]["MinoTaurGrab"], true, (HideFlags)52, val9, 48970002, true);
		SetZombieTag(obj3);
		((Weapon)obj3.GetComponent<MeleeWeapon>()).internalCooldown = 1f;
		MeleeWeapon component5 = obj3.GetComponent<MeleeWeapon>();
		component5.curveForce *= 0.8f;
		obj3.GetComponent<MeleeWeapon>().canDealDamageOutSideOfSwing = true;
		obj3.GetComponentInChildren<Holdable>().ignoreDissarm = false;
		obj3.AddComponent<MeleeWeaponAddEffect>().EffectPrefab = ((Component)Zombification.ConvenientInstance(100f)).GetComponent<UnitEffectBase>();
		obj3.GetComponent<CollisionWeapon>().ignoreTeamMates = true;
		CollisionWeapon component6 = obj3.GetComponent<CollisionWeapon>();
		component6.damage *= 0.25f;
		obj3.GetComponent<Holdable>().holdableData.forwardRotation = Vector3.right;
		obj3.GetComponent<Holdable>().holdableData.relativePosition = Vector3.forward * 0.3f;
		obj3.GetComponent<Holdable>().holdableData.lookAtTargetWhenWithin = 3f;
		Renderer[] componentsInChildren2 = obj3.GetComponentsInChildren<Renderer>();
		for (int j = 0; j < componentsInChildren2.Length; j++)
		{
			componentsInChildren2[j].enabled = false;
		}
		Faction val19 = SLMATool.CreateFaction("Zombie", (UnitBlueprint[])null, val2, 48974896);
		UnitBlueprint val20 = SLMATool.CreateUnit("僵尸", (UnitBlueprint)null, val19, val3);
		val20.forceCost = 100u;
		val20.health = 120f;
		val20.damageMultiplier = 2.5f;
		val20.maxSizeRandom = 1f;
		val20.minSizeRandom = 1f;
		val20.UnitBase = UPool.MyPool.GetObject("僵尸");
		val20.movementSpeedMuiltiplier = 1f;
		val20.turnSpeed = float.MaxValue;
		val20.holdinigWithTwoHands = false;
		val20.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
		val20.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
		val20.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val14 };
		MotherSummon.ZombieBlueprint = val20;
		GameObject val21 = UPool.MyPool.AddObject("僵尸之翼", (GameObject)SLMALoader.SDic["moves"]["Wings"], true, (HideFlags)52, val13, 48970004, true);
		SetZombieTag(val21);
		STools.RendererColorChanger(val21.GetComponentsInChildren<SkinnedMeshRenderer>(), (Material[])(object)new Material[1] { (Material)SLMALoader.SDic["materials"]["pineapplegreen"] });
		UnitBlueprint obj4 = SLMATool.CreateUnit("飞行僵尸", val20, val19, val5);
		obj4.forceCost = 200u;
		List<GameObject> list = STools.ToList(obj4.objectsToSpawnAsChildren);
		list.Add(val21);
		obj4.objectsToSpawnAsChildren = list.ToArray();
		GameObject val22 = UPool.MyPool.AddObject("僵尸爆炸", (GameObject)SLMALoader.SDic["explosions"]["E_ExplosionIceGiant"], true, (HideFlags)52, (Sprite)null, 0, false);
		Explosion componentInChildren = val22.GetComponentInChildren<Explosion>();
		componentInChildren.damage *= 2f;
		Explosion componentInChildren2 = val22.GetComponentInChildren<Explosion>();
		componentInChildren2.radius *= 1.5f;
		val22.GetComponentInChildren<Explosion>().ignoreTeamMates = true;
		val22.AddComponent<ExplosionAddEffect>().EffectPrefab = ((Component)Zombification.ConvenientInstance(100f)).GetComponent<UnitEffectBase>();
		GameObject obj5 = UPool.MyPool.AddObject("僵尸重拳", (GameObject)SLMALoader.SDic["weapons"]["GiantPunch"], true, (HideFlags)52, val10, 48970003, true);
		SetZombieTag(obj5);
		obj5.AddComponent<MeleeWeaponSpawn>().objectToSpawn = val22;
		GameObject val23 = UPool.MyPool.AddObject("母体召唤枪", (GameObject)SLMALoader.SDic["weapons"]["HarpoonGun"], true, (HideFlags)52, val11, 48970005, true);
		SetZombieTag(val23);
		Renderer[] componentsInChildren3 = val23.GetComponentsInChildren<Renderer>();
		for (int k = 0; k < componentsInChildren3.Length; k++)
		{
			componentsInChildren3[k].enabled = false;
		}
		GameObject val24 = UPool.MyPool.AddObject("感染鱼叉", (GameObject)SLMALoader.SDic["projectiles"]["P_Harpoon"], true, (HideFlags)52, (Sprite)null, 0, false);
		STools.RendererColorChanger(val24.GetComponentsInChildren<MeshRenderer>(), (Material[])(object)new Material[1] { (Material)SLMALoader.SDic["materials"]["pineapplegreen"] });
		LineRenderer[] componentsInChildren4 = val24.GetComponentsInChildren<LineRenderer>();
		for (int l = 0; l < componentsInChildren4.Length; l++)
		{
			((Renderer)componentsInChildren4[l]).materials = (Material[])(object)new Material[1] { (Material)SLMALoader.SDic["materials"]["pineapplegreen"] };
		}
		val23.GetComponent<RangeWeapon>().ObjectToSpawn = val24;
		((Weapon)val23.GetComponent<RangeWeapon>()).internalCooldown = 2.5f;
		((Weapon)val23.GetComponent<RangeWeapon>()).internalCounter = 2.5f;
		UnitBlueprint obj6 = SLMATool.CreateUnit("巨型僵尸", val20, val19, val6);
		obj6.forceCost = 1000u;
		obj6.sizeMultiplier = 2f;
		obj6.maxSizeRandom = 3f;
		obj6.minSizeRandom = 2f;
		obj6.health = 750f;
		obj6.RightWeapon = UPool.MyPool.GetObject("僵尸重拳");
		obj6.LeftWeapon = UPool.MyPool.GetObject("僵尸重拳");
		UnitBlueprint obj7 = SLMATool.CreateUnit("僵尸母体", val20, val19, val7);
		obj7.UnitBase = ((Component)component4).gameObject;
		obj7.RightWeapon = val23;
		obj7.LeftWeapon = val23;
		obj7.forceCost = 7000u;
		obj7.sizeMultiplier = 2f;
		obj7.health = 1000f;
		UnitBlueprint obj8 = SLMATool.CreateUnit("飞行僵尸母体", val20, val19, val8);
		obj8.UnitBase = ((Component)component4).gameObject;
		obj8.RightWeapon = val23;
		obj8.LeftWeapon = val23;
		obj8.forceCost = 7000u;
		obj8.sizeMultiplier = 2f;
		obj8.health = 1000f;
		List<GameObject> list2 = STools.ToList(obj8.objectsToSpawnAsChildren);
		list2.Add(val21);
		obj8.objectsToSpawnAsChildren = list2.ToArray();
		UnitBlueprint obj9 = SLMATool.CreateUnit("疾行僵尸", val20, val19, val4);
		obj9.forceCost = 150u;
		obj9.health = 140f;
		obj9.damageMultiplier *= 1.5f;
		obj9.movementSpeedMuiltiplier = 3f;
		obj9.maxSizeRandom = 0.89f;
		obj9.minSizeRandom = 0.8f;
		obj9.turnSpeed = float.MaxValue;
		obj9.holdinigWithTwoHands = false;
		obj9.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
		obj9.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
	}

	private static void SetZombieTag(GameObject go)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		CharacterItem componentInChildren = go.GetComponentInChildren<CharacterItem>();
		if ((Object)(object)componentInChildren != (Object)null)
		{
			componentInChildren.tags = new List<Tag>
			{
				new Tag((TagType)0, "Zombie")
			};
		}
	}

	private static void StripVampirebiteDamageChildren(GameObject biteMove)
	{
		try
		{
			CollisionWeapon[] componentsInChildren = biteMove.GetComponentsInChildren<CollisionWeapon>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren[i]);
			}
			Component[] componentsInChildren2 = biteMove.GetComponentsInChildren<Component>(true);
			foreach (Component val in componentsInChildren2)
			{
				if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "MoveCollisionWeapon")
				{
					Object.Destroy((Object)(object)val);
				}
			}
			CollisionSound[] componentsInChildren3 = biteMove.GetComponentsInChildren<CollisionSound>(true);
			for (int k = 0; k < componentsInChildren3.Length; k++)
			{
				Object.Destroy((Object)(object)componentsInChildren3[k]);
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("[Zombie] StripVampirebiteDamageChildren 异常: " + ex.Message));
		}
	}

	public static Sprite LoadIcon(string fileName)
	{
		Sprite obj = LoadEmbeddedIcon(fileName);
		if ((Object)(object)obj == (Object)null)
		{
			Debug.LogWarning((object)("[Zombie] 嵌入图标缺失: " + fileName));
		}
		return obj;
	}

	private static Sprite LoadEmbeddedIcon(string fileName)
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Assembly assembly = typeof(UManager).Assembly;
			string name = "Zombie.Icons." + fileName + ".png";
			using Stream stream = assembly.GetManifestResourceStream(name);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)1;
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[Zombie] 读取嵌入图标失败 " + fileName + ": " + ex.Message));
			return null;
		}
	}

	private static void AddTransl(string key, string trans)
	{
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Dictionary<int, Language> dictionary = new Dictionary<int, Language>
			{
				{
					0,
					(Language)7
				},
				{
					1,
					(Language)0
				},
				{
					2,
					(Language)8
				},
				{
					3,
					(Language)3
				},
				{
					4,
					(Language)1
				},
				{
					5,
					(Language)6
				},
				{
					6,
					(Language)4
				},
				{
					7,
					(Language)2
				}
			};
			Dictionary<Language, Dictionary<string, string>> dictionary2 = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			string[] array = trans.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < dictionary.Count && i < array.Length; i++)
			{
				if (dictionary2.TryGetValue(dictionary[i], out var value) && !value.ContainsKey(key))
				{
					value.Add(key, array[i]);
				}
			}
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("[Zombie] 翻译注册失败 " + key + ": " + ex.Message));
		}
	}

	private static void RegisterTranslations()
	{
		AddTransl("Zombie", "僵尸#Zombie#ゾンビ#Zombie#Zombie#Зомби#Zombi#Zombi");
		AddTransl("僵尸", "僵尸#Zombie#ゾンビ#Zombie#Zombie#Зомби#Zombi#Zombi");
		AddTransl("疾行僵尸", "疾行僵尸#Fast Zombie#疾走ゾンビ#Schneller Zombie#Zombie rapide#Быстрый зомби#Zombi rápido#Zombi veloce");
		AddTransl("飞行僵尸", "飞行僵尸#Fly Zombie#飛行ゾンビ#Fliegender Zombie#Zombie volant#Летающий зомби#Zombi volador#Zombi volante");
		AddTransl("巨型僵尸", "巨型僵尸#Giant Zombie#巨大ゾンビ#Riesen-Zombie#Zombie géant#Гигантский зомби#Zombi gigante#Zombi gigante");
		AddTransl("僵尸母体", "僵尸母体#Zombie Mother#ゾンビマザー#Zombie-Mutter#Mère zombie#Мать зомби#Madre zombi#Madre zombi");
		AddTransl("飞行僵尸母体", "飞行僵尸母体#Fly Zombie Mother#飛行ゾンビマザー#Fliegende Zombie-Mutter#Mère zombie volante#Летающая мать зомби#Madre zombi voladora#Madre zombi volante");
		AddTransl("僵尸之爪", "僵尸之爪#Zombie Claw#ゾンビの爪#Zombie-Klaue#Griffe de zombie#Коготь зомби#Garra de zombi#Artiglio di zombi");
		AddTransl("僵尸重拳", "僵尸重拳#Zombie Smash#ゾンビ重撃#Zombie-Hieb#Coup de zombie#Удар зомби#Golpe de zombi#Pugno di zombi");
		AddTransl("母体召唤枪", "母体召唤枪#Mother's Call#母体の呼び声#Ruf der Mutter#Appel de la mère#Зов матери#Llamada de la madre#Richiamo della madre");
		AddTransl("僵尸撕咬", "僵尸撕咬#Zombie Bite#ゾンビバイト#Zombie-Biss#Morsure de zombie#Укус зомби#Mordisco de zombi#Morso di zombi");
		AddTransl("僵尸之翼", "僵尸之翼#Zombie Wings#ゾンビの翼#Zombie-Flügel#Ailes de zombie#Крылья зомби#Alas de zombi#Ali di zombi");
	}
}
public class Zombification : UnitEffectBase
{
	private static readonly List<GameObject> blacklist = new List<GameObject> { (GameObject)SLMALoader.SDic["bases"]["Stiffy"] };

	private Unit unit;

	private List<Tuple<Material, Color>> tuplist;

	private float infectionRate;

	private Color infectionColor;

	private string DeathRef = "";

	private string VocalRef = "";

	private GameObject grabWeapon;

	private float curLerpTime;

	private float maxLerpTime = 30f;

	private bool isLerping;

	public Zombification()
	{
		infectionRate = 0.5f;
		tuplist = new List<Tuple<Material, Color>>();
	}

	public static Zombification ConvenientInstance(float infectionPower = 3E+28f)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return new GameObject
		{
			hideFlags = (HideFlags)61
		}.AddComponent<Zombification>();
	}

	public override void DoEffect()
	{
		isLerping = false;
		unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
	}

	public override void Ping()
	{
	}

	private void Update()
	{
		if ((Object)(object)unit == (Object)null)
		{
			unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		}
		if (!((Object)(object)unit == (Object)null) && !isLerping && (Object)(object)unit.data != (Object)null && unit.data.Dead && !((Object)(object)unit.unitBlueprint.UnitBase == (Object)null) && !blacklist.Contains(unit.unitBlueprint.UnitBase))
		{
			((MonoBehaviour)this).StartCoroutine(OnDeathConvert());
			isLerping = true;
		}
	}

	private void LerpColors(float lerp)
	{
	}

	private void Scream(Unit unit, bool death = false)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			UnitSounds componentInChildren = ((Component)unit).GetComponentInChildren<UnitSounds>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				if (death)
				{
					componentInChildren.PlayDeathSound(100f, unit.data.mainRig.position);
				}
				else
				{
					componentInChildren.PlayVocalSound(4, 100f, unit.data.mainRig.position);
				}
			}
		}
		catch (NullReferenceException)
		{
		}
	}

	private void Start()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		try
		{
			DeathRef = (string)s.GetField<UnitBlueprint>((UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_ANCIENT_MINOTAUR"], "deathRef");
			VocalRef = (string)s.GetField<UnitBlueprint>((UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_ANCIENT_MINOTAUR"], "vocalRef");
		}
		catch (Exception)
		{
		}
	}

	private IEnumerator OnDeathConvert()
	{
		yield return (object)new WaitForSeconds(Random.Range(2f, 5f));
		if ((Object)(object)unit.WeaponHandler.rightWeapon != (Object)null)
		{
			((Component)unit.WeaponHandler.rightWeapon).transform.SetParent((Transform)null);
		}
		if ((Object)(object)unit.WeaponHandler.leftWeapon != (Object)null)
		{
			((Component)unit.WeaponHandler.leftWeapon).transform.SetParent((Transform)null);
		}
		UnitBlueprint val = Object.Instantiate<UnitBlueprint>(unit.unitBlueprint);
		val.Mount = null;
		s.SetField<UnitBlueprint>(val, "Riders", (object)new UnitBlueprint[0]);
		val.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepPreferredDistance) };
		val.TargetingComponent = (ITargetingComponent)(object)default(EnemyLeastWeightTargeting);
		s.SetField<UnitBlueprint>(val, "deathRef", (object)DeathRef);
		s.SetField<UnitBlueprint>(val, "vocalRef", (object)VocalRef);
		val.health = unit.unitBlueprint.health * 0.35f;
		val.holdinigWithTwoHands = val.holdinigWithTwoHands;
		if ((Object)(object)UManager.ZombieBiteMove != (Object)null)
		{
			if (val.objectsToSpawnAsChildren == null)
			{
				val.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { UManager.ZombieBiteMove };
			}
			else if (!val.objectsToSpawnAsChildren.Contains(UManager.ZombieBiteMove))
			{
				List<GameObject> list = val.objectsToSpawnAsChildren.ToList();
				list.Add(UManager.ZombieBiteMove);
				val.objectsToSpawnAsChildren = list.ToArray();
			}
		}
		val.UnitBase = unit.unitBlueprint.UnitBase;
		val.RightWeapon = UPool.MyPool.GetObject("僵尸之爪");
		val.LeftWeapon = UPool.MyPool.GetObject("僵尸之爪");
		val.m_props = unit.unitBlueprint.m_props;
		GameObject val2 = val.Spawn(unit.data.mainRig.position + Vector3.up * 1000f, unit.data.mainRig.rotation, OppositeTeam(unit.Team), 1f, (UnitPoolInfo?)null)[0];
		Unit component = val2.GetComponent<Unit>();
		SkinnedMeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<SkinnedMeshRenderer>();
		foreach (SkinnedMeshRenderer val3 in componentsInChildren)
		{
			SkinnedMeshRenderer[] componentsInChildren2 = unit.unitBlueprint.UnitBase.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val4 in componentsInChildren2)
			{
				List<Material> list2 = new List<Material>();
				if (((Object)val3).name == ((Object)val4).name)
				{
					for (int k = 0; k < ((Renderer)val3).materials.Length; k++)
					{
						list2.Add((Material)SLMALoader.SDic["materials"]["pineapplegreen"]);
					}
					((Renderer)val3).materials = list2.ToArray();
					if (Object.op_Implicit((Object)(object)((Component)val3).GetComponentInChildren<TeamColor>()))
					{
						((Component)val3).GetComponentInChildren<TeamColor>().blueMaterial = (Material)SLMALoader.SDic["materials"]["pineapplegreen"];
						((Component)val3).GetComponentInChildren<TeamColor>().redMaterial = (Material)SLMALoader.SDic["materials"]["pineapplegreen"];
					}
				}
			}
		}
		TeamColor[] componentsInChildren3 = val2.GetComponentsInChildren<TeamColor>();
		for (int l = 0; l < componentsInChildren3.Length; l++)
		{
			componentsInChildren3[l].SetTeamColor(unit.Team);
		}
		Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
		Rigidbody[] allRigs2 = component.data.allRigs.AllRigs;
		((Component)unit).GetComponentsInChildren<Rigidbody>();
		val2.transform.localScale = ((Component)unit).transform.localScale;
		for (int m = 0; m < allRigs2.Length; m++)
		{
			((Component)allRigs2[m]).transform.localScale = ((Component)allRigs[m]).transform.localScale;
			((Component)allRigs2[m]).transform.position = ((Component)allRigs[m]).transform.position;
			((Component)allRigs2[m]).transform.rotation = ((Component)allRigs[m]).transform.rotation;
			allRigs2[m].velocity = allRigs[m].velocity;
		}
		component.data.fallTime = 0.3f;
		Scream(component);
		Object.Destroy((Object)(object)((Component)unit).gameObject);
	}

	public Team OppositeTeam(Team originalTeam)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Invalid comparison between Unknown and I4
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		Team result = (Team)0;
		if ((int)originalTeam == 1)
		{
			result = (Team)0;
		}
		else if ((int)originalTeam == 0)
		{
			result = (Team)1;
		}
		return result;
	}
}