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 BepInEx;
using CASA.AbilityScripts;
using CASA.AssetBundleMangement;
using CASA.BaseModContent;
using CASA.EasierSystems;
using CASA.HelperComponets;
using CASA.Main;
using CASA.ObjectManagement;
using CASA.Tools;
using CASA.UnitSerializing;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameMode;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using ModIO.UI;
using Photon.Bolt.Utils;
using TFBGames;
using TMPro;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("IDK")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CASA, A Modding template")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CASA
{
public class IfStateEvent : MonoBehaviour
{
public StateMachine stateMachine;
public string stateName;
public UnityEvent output;
public void Check()
{
if (stateMachine?.state.name == stateName)
{
UnityEvent obj = output;
if (obj != null)
{
obj.Invoke();
}
}
}
}
}
namespace CASA.VoiceTools
{
public static class VoiceExtensions
{
public static void CopyVoiceFromUnit(this UnitBlueprint unitBlueprint, UnitBlueprint voiceToCopy)
{
unitBlueprint.voiceBundle = voiceToCopy.voiceBundle;
unitBlueprint.SetField("vocalPathData", voiceToCopy.VocalPathData);
}
}
}
namespace CASA.UnitSerializing
{
public static class UnitSerializer
{
public class CASASerializedUnit
{
public DatabaseID[] props;
public PropItemData[] propDatas;
public DatabaseID rightWeapon;
public DatabaseID leftWeapon;
public PropItemData rightWeaponData;
public PropItemData leftWeaponData;
public DatabaseID[] abilites;
public DatabaseID leftProjectile;
public DatabaseID rightProjectile;
public float health;
public float damageMultiplier;
public float unitWeight;
public float unitSize;
public float attackSpeedMultiplier;
public DatabaseID voiceBundle;
public DatabaseID unitBase;
public float voicePitch;
public float cost;
public bool holdingWithTwoHands;
public string name;
public CASASerializedUnit(SerializedUnitBlueprint serializedUnitBlueprint)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
attackSpeedMultiplier = serializedUnitBlueprint.attackSpeedMultiplier;
abilites = serializedUnitBlueprint.m_combatMoves;
damageMultiplier = serializedUnitBlueprint.damageMultiplier;
voiceBundle = serializedUnitBlueprint.voiceBundle;
unitSize = serializedUnitBlueprint.m_sizeMultiplier;
health = serializedUnitBlueprint.m_health;
voicePitch = serializedUnitBlueprint.voicePitch;
cost = serializedUnitBlueprint.customCost;
leftProjectile = serializedUnitBlueprint.leftProjectile;
rightProjectile = serializedUnitBlueprint.rightProjectile;
_ = serializedUnitBlueprint.m_leftWeapon;
if (serializedUnitBlueprint.m_leftWeapon != DatabaseID.DefaultUnassignedID)
{
leftWeapon = serializedUnitBlueprint.m_leftWeapon;
leftWeaponData = serializedUnitBlueprint.m_leftWeaponData;
}
_ = serializedUnitBlueprint.m_rightWeapon;
if (true)
{
rightWeapon = serializedUnitBlueprint.m_rightWeapon;
rightWeaponData = serializedUnitBlueprint.m_rightWeaponData;
}
unitBase = serializedUnitBlueprint.m_unitBase;
unitWeight = serializedUnitBlueprint.m_massMultiplier;
propDatas = serializedUnitBlueprint.m_propData;
holdingWithTwoHands = serializedUnitBlueprint.m_holdingWithTwoHands;
name = serializedUnitBlueprint.m_name;
}
}
public static CASASerializedUnit SerializeUnit(UnitBlueprint unitBlueprint)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)("Serializing Unit of Name: " + unitBlueprint.Entity.Name + " "));
SerializedUnitBlueprint serializedUnitBlueprint = ((!(unitBlueprint.FilePath == "")) ? JsonUtility.FromJson<SerializedUnitBlueprint>(File.ReadAllText(unitBlueprint.FilePath)) : unitBlueprint.SerializedUnit(unitBlueprint.voiceBundle.Entity.GUID));
CASASerializedUnit cASASerializedUnit = new CASASerializedUnit(serializedUnitBlueprint)
{
props = (from n in unitBlueprint.m_props.ToList()
select ((CharacterItem)n.GetComponent<PropItem>()).Entity.GUID).ToArray()
};
if (Object.op_Implicit((Object)(object)unitBlueprint.RightWeapon) && ((CharacterItem)unitBlueprint.RightWeapon.GetComponent<WeaponItem>()).Entity.GUID == DatabaseID.DefaultUnassignedID)
{
cASASerializedUnit.rightWeapon = ((CharacterItem)unitBlueprint.RightWeapon.GetComponent<WeaponItem>()).Entity.GUID;
}
if (Object.op_Implicit((Object)(object)unitBlueprint.LeftWeapon))
{
cASASerializedUnit.leftWeapon = ((CharacterItem)unitBlueprint.LeftWeapon.GetComponent<WeaponItem>()).Entity.GUID;
}
string contents = JsonUtility.ToJson((object)cASASerializedUnit, true);
if (!Directory.Exists(Loader.path + "/Units/"))
{
Directory.CreateDirectory(Loader.path + "/Units/");
}
File.WriteAllText(Loader.path + "/Units/" + cASASerializedUnit.name + ".CASASerializedUnit", contents);
Debug.Log((object)("Serialized Unit " + unitBlueprint.Entity.Name + " under location " + Loader.path + "/Units/" + cASASerializedUnit.name + ".CASASerializedUnit "));
return cASASerializedUnit;
}
public static UnitBlueprint GetEmbeddedUnitBlueprint(string UnitName)
{
for (int i = 0; i < Assembly.GetCallingAssembly().GetManifestResourceNames().Length; i++)
{
string text = Assembly.GetCallingAssembly().GetManifestResourceNames()[i];
if (text.Contains(UnitName) && text.Contains(".CASASerializedUnit"))
{
using (Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream(text))
{
return LoadUnitBlueprint(JsonUtility.FromJson<CASASerializedUnit>(ReadStream(stream)));
}
}
}
return null;
}
public static UnitBlueprint LoadUnitBlueprint(CASASerializedUnit serializedUnit)
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
ContentDatabase databse = ContentDatabase.Instance();
UnitBlueprint val = Object.Instantiate<UnitBlueprint>(ObjectSearcher.FindUnit("Clubber"));
val.attackSpeedMultiplier = serializedUnit.attackSpeedMultiplier;
val.objectsToSpawnAsChildren = serializedUnit.abilites.Select((DatabaseID n) => databse.LandfallContentDatabase.GetCombatMove(n)).ToArray();
val.damageMultiplier = serializedUnit.damageMultiplier;
val.sizeMultiplier = serializedUnit.unitSize;
val.health = serializedUnit.health;
val.VoicePitch = serializedUnit.voicePitch;
val.customCost = (int)serializedUnit.cost;
if (serializedUnit.leftProjectile != DatabaseID.DefaultUnassignedID)
{
val.leftProjectile = Object.Instantiate<ProjectileEntity>(EasyLandfallContentDatabse.Projectiles[serializedUnit.leftProjectile].GetComponent<ProjectileEntity>());
}
if (serializedUnit.rightProjectile != DatabaseID.DefaultUnassignedID)
{
val.rightProjectile = Object.Instantiate<ProjectileEntity>(EasyLandfallContentDatabse.Projectiles[serializedUnit.rightProjectile].GetComponent<ProjectileEntity>());
}
val.massMultiplier = serializedUnit.unitWeight;
val.m_propData = serializedUnit.propDatas;
val.holdinigWithTwoHands = serializedUnit.holdingWithTwoHands;
val.m_props = serializedUnit.props.Select((DatabaseID n) => databse.LandfallContentDatabase.GetCharacterProp(n)).ToArray();
try
{
val.UnitBase = EasyLandfallContentDatabse.UnitBases[serializedUnit.unitBase];
}
catch (Exception)
{
val.UnitBase = ObjectSearcher.FindUnitBase("Humanoid");
}
((Object)val).name = serializedUnit.name;
val.RightWeapon = null;
val.LeftWeapon = null;
if (serializedUnit.rightWeapon != DatabaseID.DefaultUnassignedID)
{
val.RightWeapon = databse.LandfallContentDatabase.GetWeapon(serializedUnit.rightWeapon);
val.RightWeaponData = serializedUnit.rightWeaponData;
}
if (serializedUnit.leftWeapon != DatabaseID.DefaultUnassignedID)
{
val.LeftWeapon = databse.LandfallContentDatabase.GetWeapon(serializedUnit.leftWeapon);
val.LeftWeaponData = serializedUnit.leftWeaponData;
}
val.useCustomCost = true;
return val;
}
private static string ReadStream(Stream stream)
{
using StreamReader streamReader = new StreamReader(stream);
return streamReader.ReadToEnd();
}
}
}
namespace CASA.Tools
{
public class CASARunner : MonoBehaviour
{
public bool Instilaized;
public void Init()
{
WhiteBoard[] array = Object.FindObjectsOfType<WhiteBoard>();
if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>()))
{
Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
if ((Object)(object)component.unitBlueprint != (Object)null)
{
for (int i = 0; i < array.Length; i++)
{
array[i].OnAnyUnitSpawned(component, component.data, component.data.healthHandler);
}
}
}
if (Instilaized)
{
return;
}
if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<MeleeWeapon>()))
{
for (int j = 0; j < array.Length; j++)
{
array[j].ChangeMeleeWeapon(((Component)((Component)this).transform.root).gameObject, ((Component)((Component)this).transform.root).GetComponent<MeleeWeapon>());
}
}
if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<RangeWeapon>()))
{
for (int k = 0; k < array.Length; k++)
{
array[k].ChangeRangeWeapon(((Component)((Component)this).transform.root).gameObject, ((Component)((Component)this).transform.root).GetComponent<RangeWeapon>());
}
}
if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<SpecialAbility>()))
{
for (int l = 0; l < array.Length; l++)
{
array[l].ChangeAbility(((Component)((Component)this).transform.root).gameObject, ((Component)((Component)this).transform.root).GetComponent<SpecialAbility>(), ((Component)((Component)this).transform.root).GetComponent<ConditionalEvent>());
}
}
if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<PropItem>()))
{
for (int m = 0; m < array.Length; m++)
{
array[m].ChangeCloth(((Component)((Component)this).transform.root).gameObject, ((Component)((Component)this).transform.root).GetComponent<PropItem>());
}
}
if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<ProjectileEntity>()))
{
for (int n = 0; n < array.Length; n++)
{
array[n].ChangeProjectile(((Component)((Component)this).transform.root).gameObject, ((Component)((Component)this).transform.root).GetComponent<ProjectileEntity>(), ((Component)((Component)this).transform.root).GetComponent<ProjectileHit>());
}
}
Instilaized = true;
}
}
public static class CASATools
{
public static TField GetField<TField>(this object self, string name)
{
FieldInfo field = self.GetType().GetField(name, (BindingFlags)(-1));
object obj;
if (field != null)
{
obj = field.GetValue(self);
}
else
{
obj = null;
Debug.Log((object)"Null Result with reflection!");
}
return (TField)obj;
}
public static void SetField(this object self, string name, object value)
{
FieldInfo field = self.GetType().GetField(name, (BindingFlags)(-1));
if (field != null)
{
field.SetValue(self, value);
}
}
public static void SetHideFlags(this GameObject gameObject, HideFlags hideFlags)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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)
if (!Object.op_Implicit((Object)(object)gameObject.transform))
{
((Object)gameObject).hideFlags = hideFlags;
return;
}
foreach (object item in gameObject.transform)
{
((Component)(Transform)item).gameObject.SetHideFlags(hideFlags);
}
((Object)gameObject).hideFlags = hideFlags;
}
public static void AddObjectToContentDatabase(Object obj)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null);
if (val != null)
{
AddToNonStreamableAssets((Object)(object)val);
if (Object.op_Implicit((Object)(object)val.GetComponent<Unit>()))
{
Dictionary<DatabaseID, GameObject> field = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_unitBases");
field.Add(val.GetComponent<IDatabaseEntity>().Entity.GUID, val);
landfallContentDatabase.SetField("m_unitBases", field);
}
if (Object.op_Implicit((Object)(object)val.GetComponent<SpecialAbility>()))
{
Dictionary<DatabaseID, GameObject> field2 = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_combatMoves");
field2.Add(val.GetComponent<CharacterItem>().Entity.GUID, val);
landfallContentDatabase.SetField("m_combatMoves", field2);
}
if (Object.op_Implicit((Object)(object)val.GetComponent<PropItem>()))
{
Dictionary<DatabaseID, GameObject> field3 = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_characterProps");
field3.Add(val.GetComponent<CharacterItem>().Entity.GUID, val);
landfallContentDatabase.SetField("m_characterProps", field3);
}
if (Object.op_Implicit((Object)(object)val.GetComponent<WeaponItem>()))
{
Dictionary<DatabaseID, GameObject> field4 = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_weapons");
field4.Add(val.GetComponent<IDatabaseEntity>().Entity.GUID, val);
landfallContentDatabase.SetField("m_weapons", field4);
}
if (Object.op_Implicit((Object)(object)val.GetComponent<ProjectileEntity>()))
{
Dictionary<DatabaseID, GameObject> field5 = landfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_projectiles");
field5.Add(val.GetComponent<IDatabaseEntity>().Entity.GUID, val);
landfallContentDatabase.SetField("m_projectiles", field5);
}
}
}
public static void AddToNonStreamableAssets(Object @object)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
AssetLoader assetLoader = ContentDatabase.Instance().AssetLoader;
Dictionary<DatabaseID, Object> field = assetLoader.GetField<Dictionary<DatabaseID, Object>>("m_nonStreamableAssets");
field.Add(((GameObject)@object).GetComponent<IDatabaseEntity>().Entity.GUID, @object);
assetLoader.SetField("m_nonStreamableAssets", field);
}
public static UnitBlueprint CreateUnit(string unitName, int databaseID = 0, Faction faction = null, Sprite sprite = null, UnitBlueprint unitToCopy = null)
{
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
UnitBlueprint val;
if (!Object.op_Implicit((Object)(object)unitToCopy))
{
val = Object.Instantiate<UnitBlueprint>(ObjectSearcher.FindUnit("Clubber"));
val.m_props = (GameObject[])(object)new GameObject[0];
val.RightWeapon = null;
val.LeftWeapon = null;
}
else
{
val = Object.Instantiate<UnitBlueprint>(unitToCopy);
}
val.Entity.Name = unitName;
((Object)val).name = unitName;
if (databaseID == 0)
{
val.Entity.Name = unitName;
val.Entity.GUID = new DatabaseID(-1, DatabaseID.NewID().m_ID);
}
else
{
val.Entity.Name = unitName;
val.Entity.GUID = new DatabaseID(-1, databaseID);
}
val.Entity.SetSpriteIcon(sprite);
Dictionary<DatabaseID, UnitBlueprint> field = landfallContentDatabase.GetField<Dictionary<DatabaseID, UnitBlueprint>>("m_unitBlueprints");
field.Add(val.Entity.GUID, val);
landfallContentDatabase.SetField("m_unitBlueprints", field);
if (Object.op_Implicit((Object)(object)faction))
{
faction.Units = BoltUtils.AddFirst<UnitBlueprint>(faction.Units, val);
faction.Units = faction.GetRearrangedUnits();
}
return val;
}
public static Faction CreateFaction(string factionName, int databaseID = 0, Sprite sprite = null)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_006d: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
Faction val = Object.Instantiate<Faction>(ObjectSearcher.FindFaction("Tribal"));
val.Units = (UnitBlueprint[])(object)new UnitBlueprint[0];
val.FactionIcon = new FactionIcon
{
Entity = new DatabaseEntity((WorkshopContentType)5)
{
GUID = new DatabaseID
{
m_ID = -75457314,
m_modID = -1
},
SpriteIcon = sprite
}
};
if (databaseID == 0)
{
val.Init(new DatabaseID(-1, DatabaseID.NewID().m_ID));
}
else
{
val.Init(new DatabaseID(-1, databaseID));
}
val.Entity.SetSpriteIcon(sprite);
val.Entity.Name = factionName;
((Object)val).name = factionName;
Dictionary<DatabaseID, Faction> field = landfallContentDatabase.GetField<Dictionary<DatabaseID, Faction>>("m_factions");
field.Add(val.Entity.GUID, val);
landfallContentDatabase.SetField("m_factions", field);
return val;
}
public static T DeepCopy<T>(this T obj, bool skipPrivate = false)
{
FieldInfo[] fields = typeof(T).GetFields((BindingFlags)(-1));
T val = (T)new object();
for (int i = 0; i < fields.Length; i++)
{
if (!fields[i].IsStatic && (!skipPrivate || !fields[i].IsPrivate))
{
fields[i].SetValue(obj, val);
}
}
return val;
}
public static string GetNiceName(this DatabaseEntity databaseEntity)
{
return ObjectSearcher.CleanUpName(databaseEntity.Name);
}
public static Sprite LoadSprite(string fileName)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0056: 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)
using Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream(Assembly.GetCallingAssembly().GetName().Name + "." + fileName);
try
{
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, readAllBytes(stream));
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
catch (Exception)
{
return null;
}
}
private static byte[] readAllBytes(Stream stream)
{
if (stream is MemoryStream memoryStream)
{
return memoryStream.ToArray();
}
MemoryStream memoryStream2;
using (memoryStream2 = new MemoryStream())
{
stream.CopyTo(memoryStream2);
return memoryStream2.ToArray();
}
}
public static void ForceCost(this UnitBlueprint unitBlueprint, float cost)
{
unitBlueprint.customCost = (int)cost;
unitBlueprint.useCustomCost = true;
}
}
}
namespace CASA.ObjectManagement
{
public class ModContent
{
public string Name;
private static List<ModContent> instances = new List<ModContent>();
public Dictionary<string, object> content = new Dictionary<string, object>();
public static ModContent Mod
{
get
{
string name = Assembly.GetCallingAssembly().GetName().Name;
for (int i = 0; i < instances.Count; i++)
{
if (instances[i].Name == name)
{
return instances[i];
}
}
instances.Add(new ModContent(name));
return instances.Find((ModContent conditon) => conditon.Name == name);
}
}
public ModContent(string name)
{
Name = name;
}
public static ModContent FindMod(string name)
{
return instances.Find((ModContent n) => n.Name == name);
}
}
public class CASAPool
{
public string poolName;
public GameObject parentObject;
public Dictionary<string, GameObject> objects = new Dictionary<string, GameObject>();
private static List<CASAPool> instances = new List<CASAPool>();
public static CASAPool Pool
{
get
{
string name = Assembly.GetCallingAssembly().GetName().Name;
for (int i = 0; i < instances.Count; i++)
{
if (instances[i].poolName == name)
{
return instances[i];
}
}
instances.Add(new CASAPool(name));
return instances.Find((CASAPool conditon) => conditon.poolName == name);
}
}
public CASAPool(string name)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
poolName = name;
GameObject val = new GameObject(name)
{
hideFlags = (HideFlags)61
};
val.SetActive(false);
parentObject = val;
}
public static CASAPool ModPool(Assembly assembly)
{
string name = assembly.GetName().Name;
for (int i = 0; i < instances.Count; i++)
{
if (instances[i].poolName == name)
{
return instances[i];
}
}
instances.Add(new CASAPool(name));
return instances.Find((CASAPool conditon) => conditon.poolName == name);
}
public GameObject AddObject(GameObject gameObject, string name, DatabaseID databaseID, bool makeCopy = true, Sprite sprite = null, string catagory = "", bool showInEditor = true)
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if (makeCopy)
{
gameObject = Object.Instantiate<GameObject>(gameObject, parentObject.transform);
}
((Object)gameObject).name = poolName + "." + name;
gameObject.SetHideFlags((HideFlags)61);
gameObject.transform.parent = parentObject.transform;
objects.Add(name, gameObject);
if (Object.op_Implicit((Object)(object)gameObject.GetComponent<CharacterItem>()))
{
if (catagory != "")
{
gameObject.GetComponent<CharacterItem>().tags = new List<Tag>
{
new Tag((TagType)0, catagory)
};
}
else
{
gameObject.GetComponent<CharacterItem>().tags = new List<Tag>
{
new Tag((TagType)0, poolName.Split(".".ToArray())[poolName.Split(".".ToArray()).Length - 1])
};
}
}
if (gameObject.GetComponent<IDatabaseEntity>() == null)
{
return gameObject;
}
gameObject.GetComponent<IDatabaseEntity>().Entity.GUID = new DatabaseID(-1, databaseID.m_ID);
gameObject.GetComponent<IDatabaseEntity>().Entity.Name = name;
gameObject.GetComponent<IDatabaseEntity>().Entity.SetSpriteIcon(sprite);
if (showInEditor)
{
CASATools.AddObjectToContentDatabase((Object)(object)gameObject);
}
return gameObject;
}
public GameObject GetObject(string name)
{
return objects[name];
}
public void RemoveObject(string name)
{
//IL_001e: 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)
foreach (object item in parentObject.transform)
{
if (((Object)(Transform)item).name == name)
{
Object.Destroy((Object)(object)((Component)(Transform)item).gameObject);
}
}
}
}
public static class ObjectSearcher
{
private static Dictionary<string, string> English = Localizer.GetLanguage((Language)0);
private static bool IsInstalized = false;
public static Dictionary<string, Dictionary<string, Object>> dictionary = new Dictionary<string, Dictionary<string, Object>>();
public static void Instalize()
{
if (!IsInstalized)
{
GenerateDictionaries();
}
}
private static string MakeUniqueKey(string baseKey, HashSet<string> existingKeys)
{
string text = baseKey;
while (existingKeys.Contains(text))
{
text += "-";
}
existingKeys.Add(text);
return text;
}
private static Dictionary<string, Object> GetProjectiles()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
ProjectileEntity[] array = Resources.FindObjectsOfTypeAll<ProjectileEntity>();
foreach (ProjectileEntity val in array)
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(val.Entity.Name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
return dictionary;
}
private static Dictionary<string, Object> GetWeapons()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
WeaponItem[] array = Resources.FindObjectsOfTypeAll<WeaponItem>();
foreach (WeaponItem val in array)
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(((CharacterItem)val).Entity.Name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
return dictionary;
}
private static Dictionary<string, Object> GetMoves()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
SpecialAbility[] array = Resources.FindObjectsOfTypeAll<SpecialAbility>();
foreach (SpecialAbility val in array)
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(((CharacterItem)val).Entity.Name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
return dictionary;
}
private static Dictionary<string, Object> GetUnits()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
foreach (UnitBlueprint val in array)
{
Object value = (Object)(object)val;
string baseKey = CleanUpName(val.Entity.Name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = value;
}
return dictionary;
}
private static Dictionary<string, Object> GetEffects()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
UnitEffectBase[] array = Resources.FindObjectsOfTypeAll<UnitEffectBase>();
foreach (UnitEffectBase val in array)
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(((Object)((Component)val).gameObject).name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
return dictionary;
}
private static Dictionary<string, Object> GetProps()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
PropItem[] array = Resources.FindObjectsOfTypeAll<PropItem>();
foreach (PropItem val in array)
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(((CharacterItem)val).Entity.Name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
return dictionary;
}
private static Dictionary<string, Object> GetMaterials()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
Material[] array = Resources.FindObjectsOfTypeAll<Material>();
foreach (Material val in array)
{
Object value = (Object)(object)val;
string baseKey = CleanUpName(((Object)val).name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = value;
}
return dictionary;
}
private static Dictionary<string, Object> GetFactions()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
Faction[] array = Resources.FindObjectsOfTypeAll<Faction>();
foreach (Faction val in array)
{
Object value = (Object)(object)val;
string baseKey = CleanUpName(val.Entity.Name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = value;
}
return dictionary;
}
private static Dictionary<string, Object> GetSprites()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>();
foreach (Sprite val in array)
{
Object value = (Object)(object)val;
string baseKey = CleanUpName(((Object)val).name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = value;
}
return dictionary;
}
private static Dictionary<string, Object> GetUnitbases()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
Unit[] array = Resources.FindObjectsOfTypeAll<Unit>();
foreach (Unit val in array)
{
if (!((Object)(object)val.unitBlueprint != (Object)null))
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(((Object)val).name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
}
return dictionary;
}
private static Dictionary<string, Object> GetExplosions()
{
Dictionary<string, Object> dictionary = new Dictionary<string, Object>();
HashSet<string> existingKeys = new HashSet<string>();
Explosion[] array = Resources.FindObjectsOfTypeAll<Explosion>();
foreach (Explosion val in array)
{
Object gameObject = (Object)(object)((Component)val).gameObject;
string baseKey = CleanUpName(((Object)val).name);
string key = MakeUniqueKey(baseKey, existingKeys);
dictionary[key] = gameObject;
}
return dictionary;
}
public static void GenerateDictionaries()
{
dictionary.Add("projectile", GetProjectiles());
dictionary.Add("unitbase", GetUnitbases());
dictionary.Add("weapon", GetWeapons());
dictionary.Add("move", GetMoves());
dictionary.Add("unit", GetUnits());
dictionary.Add("effect", GetEffects());
dictionary.Add("prop", GetProps());
dictionary.Add("material", GetMaterials());
dictionary.Add("faction", GetFactions());
dictionary.Add("sprite", GetSprites());
dictionary.Add("explosion", GetExplosions());
GenDicts();
}
private static void GenDicts()
{
Directory.CreateDirectory(Loader.path);
Directory.CreateDirectory(Loader.path + "/CASAPrints");
Dictionary<string, Dictionary<string, Object>> dictionary = ObjectSearcher.dictionary;
for (int i = 0; i < dictionary.Count; i++)
{
KeyValuePair<string, Dictionary<string, Object>> keyValuePair = ObjectSearcher.dictionary.ToArray()[i];
WriteDict(keyValuePair);
}
}
private static void WriteDict(KeyValuePair<string, Dictionary<string, Object>> keyValuePair)
{
string text = "Objects in dictionary " + keyValuePair.Key + " \n";
for (int i = 0; i < keyValuePair.Value.Count; i++)
{
text = text + i + "> " + keyValuePair.Value.ToArray()[i].Key + "\n";
}
File.WriteAllText(Loader.path + "/CASAPrints/" + keyValuePair.Key + ".txt", text);
}
public static T FindObjectWithName<T>(string VanillaName, Func<T, string> GetObjectNameFunction) where T : Object
{
Object[] array = (Object[])(object)Resources.FindObjectsOfTypeAll<T>();
Object[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
if (GetObjectNameFunction((T)(object)array2[i]).ToLower() == VanillaName.ToLower())
{
return (T)(object)array2[i];
}
}
return default(T);
}
public static string CleanUpName(string str)
{
if (English.ContainsKey(str))
{
return English[str];
}
string[] array = new string[10] { "P_", " Effects_VB", " Prefabs_VB", " Weapons_VB", "Move_", "CP_", "E_", "Effects_", " Projectiles_VB", "(Clone)" };
for (int i = 0; i < array.Length; i++)
{
if (str.Contains(array[i]))
{
str = str.Replace(array[i], "");
}
}
return str;
}
public static GameObject FindMove(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<SpecialAbility>(VanillaName, (Func<SpecialAbility, string>)((SpecialAbility obj) => CleanUpName(((CharacterItem)obj).Entity.Name)))).gameObject;
}
public static Sprite FindSprite(string VanillaName)
{
return ObjectSearcher.FindObjectWithName<Sprite>(VanillaName, (Func<Sprite, string>)((Sprite obj) => CleanUpName(((Object)obj).name)));
}
public static GameObject FindProp(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<PropItem>(VanillaName, (Func<PropItem, string>)((PropItem obj) => CleanUpName(((CharacterItem)obj).Entity.Name)))).gameObject;
}
public static GameObject FindWeapon(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<WeaponItem>(VanillaName, (Func<WeaponItem, string>)((WeaponItem obj) => CleanUpName(((CharacterItem)obj).Entity.Name)))).gameObject;
}
public static UnitBlueprint FindUnit(string VanillaName)
{
return ObjectSearcher.FindObjectWithName<UnitBlueprint>(VanillaName, (Func<UnitBlueprint, string>)((UnitBlueprint obj) => CleanUpName(obj.Entity.Name)));
}
public static GameObject FindEffect(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<UnitEffectBase>(VanillaName, (Func<UnitEffectBase, string>)((UnitEffectBase obj) => CleanUpName(((Object)obj).name)))).gameObject;
}
public static GameObject FindProjectile(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<ProjectileEntity>(VanillaName, (Func<ProjectileEntity, string>)((ProjectileEntity obj) => CleanUpName(obj.Entity.Name)))).gameObject;
}
public static Material FindMaterial(string VanillaName)
{
return ObjectSearcher.FindObjectWithName<Material>(VanillaName, (Func<Material, string>)((Material obj) => CleanUpName(((Object)obj).name)));
}
public static Faction FindFaction(string VanillaName)
{
return ObjectSearcher.FindObjectWithName<Faction>(VanillaName, (Func<Faction, string>)((Faction obj) => CleanUpName(obj.Entity.Name)));
}
public static GameObject FindUnitBase(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<Unit>(VanillaName, (Func<Unit, string>)((Unit obj) => CleanUpName(((Object)((Component)obj).gameObject).name)))).gameObject;
}
public static GameObject FindExplosion(string VanillaName)
{
return ((Component)ObjectSearcher.FindObjectWithName<Explosion>(VanillaName, (Func<Explosion, string>)((Explosion obj) => CleanUpName(((Object)((Component)obj).gameObject).name)))).gameObject;
}
}
}
namespace CASA.Main
{
public abstract class CASAMod : BaseUnityPlugin
{
public class ModPropreties
{
public string modName;
public string modCreator;
public string modDiscription;
public string modIntro;
public Sprite modIcon;
public ModPropreties(string modName, string modCreator, string modDiscription, string modIntro, Sprite modIcon)
{
this.modCreator = modCreator;
this.modName = modName;
this.modDiscription = modDiscription;
this.modIcon = modIcon;
this.modIntro = modIntro;
}
}
public abstract ModPropreties GetModPropreties();
public abstract void Init();
public static CASAMod[] GetCASAMods()
{
return Object.FindObjectsOfType<CASAMod>();
}
public void ShowModIcon()
{
ModPropreties modPropreties = GetModPropreties();
ServiceLocator.GetService<ModalPanel>().OpenUnlockPanel(modPropreties.modIntro ?? "", modPropreties.modIcon);
}
}
public abstract class WhiteBoard : GameStateListener
{
private static bool Instilaized;
public Assembly assembly;
public static void Instilaize()
{
if (Instilaized)
{
return;
}
WhiteBoard[] array = Object.FindObjectsOfType<WhiteBoard>();
foreach (WhiteBoard whiteBoard in array)
{
whiteBoard.Init();
}
GameObject[] array2 = Resources.FindObjectsOfTypeAll<GameObject>();
foreach (GameObject val in array2)
{
if (Object.op_Implicit((Object)(object)val.GetComponent<Unit>()) | Object.op_Implicit((Object)(object)val.GetComponent<ProjectileHit>()) | Object.op_Implicit((Object)(object)val.GetComponent<Weapon>()) | Object.op_Implicit((Object)(object)val.GetComponent<SpecialAbility>()) | Object.op_Implicit((Object)(object)val.GetComponent<PropItem>()) | Object.op_Implicit((Object)(object)val.GetComponent<ProjectileHit>()))
{
val.AddComponent<CASARunner>().Init();
}
}
UnitBlueprint[] array3 = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
for (int k = 0; k < array3.Length; k++)
{
WhiteBoard[] array4 = Object.FindObjectsOfType<WhiteBoard>();
foreach (WhiteBoard whiteBoard2 in array4)
{
whiteBoard2.ChangeUnit(array3[k]);
}
}
Instilaized = true;
}
public virtual void Init()
{
SceneManager.activeSceneChanged += OnEnterNewSceneFixed;
}
public virtual void OnAnyUnitSpawned(Unit unit, DataHandler dataHandler, HealthHandler healthHandler)
{
}
public virtual void ChangeUnit(UnitBlueprint unitBlueprint)
{
}
public virtual void ChangeMeleeWeapon(GameObject weaponGameObject, MeleeWeapon data)
{
}
public virtual void ChangeRangeWeapon(GameObject weaponGameObject, RangeWeapon data)
{
}
public virtual void ChangeAbility(GameObject abilityGameObject, SpecialAbility data, ConditionalEvent @event)
{
}
public virtual void ChangeCloth(GameObject clothPeice, PropItem data)
{
}
public virtual void ChangeProjectile(GameObject projObject, ProjectileEntity projectileEntity, ProjectileHit projectileHit)
{
}
public override void OnEnterBattleState()
{
}
public override void OnEnterPlacementState()
{
}
public virtual void OnEnterNewSceneFixed(Scene oldscene, Scene newscene)
{
}
}
}
namespace CASA.HelperComponets
{
public class KillSelf : MonoBehaviour
{
public enum Severity
{
Low,
Medium,
High
}
public Severity severity;
public bool playOnAwake = true;
public void Awake()
{
if (playOnAwake)
{
Kill();
}
}
public void Kill()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Invalid comparison between Unknown and I4
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Invalid comparison between Unknown and I4
if (severity == Severity.Low)
{
((Damagable)((Component)((Component)this).transform.root).GetComponent<Unit>().data.healthHandler).TakeDamage(float.PositiveInfinity, Vector3.zero, (Unit)null, (DamageType)0);
}
if (severity == Severity.Medium)
{
((Component)((Component)this).transform.root).GetComponent<Unit>().data.healthHandler.Die((Unit)null);
}
if (severity != Severity.High)
{
return;
}
GameModeService service = ServiceLocator.GetService<GameModeService>();
Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
((Component)component).GetComponentInChildren<DataHandler>().Dead = true;
string winDescription = service.CurrentGameMode.WinConditionPropagator.GetWinConditionsForTeam(TeamUtlity.GetOtherTeam(component.Team))[0].GetWinDescription();
service.CurrentGameMode.WinConditionPropagator.OnUnitDied(component);
TeamSystem orCreateManager = World.Active.GetOrCreateManager<TeamSystem>();
GooglyEye[] componentsInChildren = ((Component)component).GetComponentsInChildren<GooglyEye>();
foreach (GooglyEye val in componentsInChildren)
{
val.Die();
}
if ((int)component.Team == 0)
{
int num = (from u in orCreateManager.GetTeamUnits((Team)0)
where !u.data.Dead
select u).Count();
if (num <= 1)
{
service.CurrentGameMode.OnWinnerDecided((Team)1, winDescription);
service.CurrentGameMode.DecideWinner((Team)1, winDescription);
}
}
if ((int)component.Team == 1)
{
int num2 = (from u in orCreateManager.GetTeamUnits((Team)1)
where !u.data.Dead
select u).Count();
if (num2 <= 1)
{
service.CurrentGameMode.OnWinnerDecided((Team)0, winDescription);
service.CurrentGameMode.DecideWinner((Team)0, winDescription);
}
}
}
}
public class StateMachine : MonoBehaviour
{
[Serializable]
public struct State
{
public string name;
public float changeStateAfterSeconds;
public UnityEvent onEnterStateEvent;
public UnityEvent updateEvent;
public UnityEvent onLeaveStateEvent;
}
public State[] states;
private State m_state;
public bool scaleWithDeltatime = true;
private bool started;
private int current;
public State state => m_state;
public void EnterState(State state)
{
if (!state.Equals(null))
{
UnityEvent onLeaveStateEvent = state.onLeaveStateEvent;
if (onLeaveStateEvent != null)
{
onLeaveStateEvent.Invoke();
}
}
m_state = state;
UnityEvent onEnterStateEvent = state.onEnterStateEvent;
if (onEnterStateEvent != null)
{
onEnterStateEvent.Invoke();
}
}
public void EnterState(string stateName)
{
EnterState(states.ToList().Find((State state) => state.name == stateName));
}
public void NextState()
{
if (states.Length >= current + 1)
{
EnterState(states[current + 1]);
}
else
{
EnterState(states[0]);
}
}
private void Awake()
{
if (states == null)
{
states = new State[1]
{
new State
{
name = "Start"
}
};
}
}
private void Update()
{
UnityEvent updateEvent = state.updateEvent;
if (updateEvent != null)
{
updateEvent.Invoke();
}
}
private IEnumerator Start()
{
if (!started)
{
EnterState(states[0]);
}
State oldState = m_state;
if (m_state.changeStateAfterSeconds != 0f)
{
if (scaleWithDeltatime)
{
yield return (object)new WaitForSeconds(m_state.changeStateAfterSeconds);
}
else
{
yield return (object)new WaitForSecondsRealtime(m_state.changeStateAfterSeconds);
}
}
else
{
yield return (object)new WaitUntil((Func<bool>)(() => oldState.name != m_state.name));
}
((MonoBehaviour)this).StartCoroutine(Start());
}
}
}
namespace CASA.EasierSystems
{
public static class EasyLandfallContentDatabse
{
public static Dictionary<DatabaseID, GameObject> Moves
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_combatMoves");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_combatMoves", value);
}
}
public static Dictionary<DatabaseID, UnitBlueprint> Units
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, UnitBlueprint>>("m_unitBlueprints");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_unitBlueprints", value);
}
}
public static Dictionary<DatabaseID, Faction> Factions
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, Faction>>("m_factions");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_factions", value);
}
}
public static Dictionary<DatabaseID, GameObject> UnitBases
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_unitBases");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_unitBases", value);
}
}
public static Dictionary<DatabaseID, GameObject> Props
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_characterProps");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_characterProps", value);
}
}
public static Dictionary<DatabaseID, GameObject> Weapons
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_weapons");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_weapons", value);
}
}
public static Dictionary<DatabaseID, GameObject> Projectiles
{
get
{
return ContentDatabase.Instance().LandfallContentDatabase.GetField<Dictionary<DatabaseID, GameObject>>("m_projectiles");
}
set
{
ContentDatabase.Instance().LandfallContentDatabase.SetField("m_projectiles", value);
}
}
}
public class QuickLanguageManager : MonoBehaviour
{
public static string GetPhraseFromSpeceficLanguage(string phrase, Language language)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (Localizer.GetLanguage(language).ContainsKey(phrase))
{
return Localizer.GetLanguage(language)[phrase];
}
return phrase;
}
public static string GetPhraseFromSelectedLanguage(string phrase)
{
QuickSettingsManager.OptionsSettingValue optionsSettingValue = QuickSettingsManager.GetSetting("VIDEO_LANGUAGE") as QuickSettingsManager.OptionsSettingValue;
try
{
if (optionsSettingValue.value == "LANG_EN_US")
{
return Localizer.GetLanguage((Language)0)[phrase];
}
if (optionsSettingValue.value == "LANG_IT")
{
return Localizer.GetLanguage((Language)2)[phrase];
}
if (optionsSettingValue.value == "LANG_FR")
{
return Localizer.GetLanguage((Language)1)[phrase];
}
if (optionsSettingValue.value == "LANG_ES")
{
return Localizer.GetLanguage((Language)4)[phrase];
}
if (optionsSettingValue.value == "LANG_DE")
{
return Localizer.GetLanguage((Language)3)[phrase];
}
if (optionsSettingValue.value == "LANG_CH")
{
return Localizer.GetLanguage((Language)7)[phrase];
}
if (optionsSettingValue.value == "LANG_JA")
{
return Localizer.GetLanguage((Language)8)[phrase];
}
if (optionsSettingValue.value == "LANG_PT_BR")
{
return Localizer.GetLanguage((Language)5)[phrase];
}
return Localizer.GetLanguage((Language)6)[phrase];
}
catch (Exception)
{
Debug.LogWarning((object)("WARNING: Phrase was not found in langauge, phrase:" + phrase));
return phrase;
}
}
}
public class QuickSettingsManager
{
public enum SettingTabs
{
Video,
Audio,
Gameplay,
Controls,
Bugs,
Twitch
}
public class Setting
{
public string name;
public string toolTip;
}
public class Slider : Setting
{
public float deafultValue = 0.5f;
public float maxValue = 1f;
public float minValue = 0f;
}
public class Options : Setting
{
public string[] options;
}
public class SettingValue
{
}
public class SliderSettingValue : SettingValue
{
public float value;
}
public class OptionsSettingValue : SettingValue
{
public string value;
}
private static SettingsInstance[] settingsInstances;
private static bool instalized = false;
public static SettingsInstance[] modedSettingsInstances = (SettingsInstance[])(object)new SettingsInstance[0];
public static void Instalize()
{
if (!instalized)
{
GlobalSettingsHandler service = ServiceLocator.GetService<GlobalSettingsHandler>();
List<SettingsInstance> list = new List<SettingsInstance>();
list.AddRange(service.GetField<SettingsInstance[]>("m_videoSettings"));
list.AddRange(service.GetField<SettingsInstance[]>("m_audioSettings"));
list.AddRange(service.GetField<SettingsInstance[]>("m_gameplaySettings"));
list.AddRange(service.GetField<SettingsInstance[]>("m_controlSettings"));
list.AddRange(service.GetField<SettingsInstance[]>("m_bugsSettings"));
list.AddRange(service.GetField<SettingsInstance[]>("m_twitchSettings"));
settingsInstances = list.ToArray();
instalized = true;
}
}
public static SettingValue GetSetting(string settingName)
{
for (int i = 0; i < settingsInstances.Length; i++)
{
if (settingsInstances[i].settingName.ToLower() == settingName.ToLower())
{
return GetSettingValue(settingsInstances[i]);
}
if (settingsInstances[i].m_settingsKey.ToLower() == settingName.ToLower())
{
return GetSettingValue(settingsInstances[i]);
}
if (QuickLanguageManager.GetPhraseFromSpeceficLanguage(settingsInstances[i].settingName, (Language)0).ToLower() == settingName.ToLower())
{
return GetSettingValue(settingsInstances[i]);
}
if (QuickLanguageManager.GetPhraseFromSpeceficLanguage(settingsInstances[i].m_settingsKey, (Language)0).ToLower() == settingName.ToLower())
{
return GetSettingValue(settingsInstances[i]);
}
}
return null;
}
private static SettingValue GetSettingValue(SettingsInstance settingsInstance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)settingsInstance.settingsType == 0)
{
return new OptionsSettingValue
{
value = settingsInstance.options[settingsInstance.currentValue]
};
}
return new SliderSettingValue
{
value = settingsInstance.currentSliderValue
};
}
public static void AddSetting(SettingTabs settingTabs, Setting setting)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
string name = "";
if (settingTabs == SettingTabs.Video)
{
name = "m_videoSettings";
}
if (SettingTabs.Audio == settingTabs)
{
name = "m_audioSettings";
}
if (SettingTabs.Gameplay == settingTabs)
{
name = "m_gameplaySettings";
}
if (SettingTabs.Controls == settingTabs)
{
name = "m_controlSettings";
}
if (SettingTabs.Bugs == settingTabs)
{
name = "m_bugsSettings";
}
if (SettingTabs.Twitch == settingTabs)
{
name = "m_twitchSettings";
}
SettingsInstance[] field = ServiceLocator.GetService<GlobalSettingsHandler>().GetField<SettingsInstance[]>(name);
SettingsInstance val = new SettingsInstance();
if (setting is Slider slider)
{
val = new SettingsInstance
{
defaultSliderValue = slider.deafultValue,
max = slider.maxValue,
min = slider.minValue,
settingsType = (SettingsType)1,
settingName = slider.name,
m_settingsKey = slider.name,
toolTip = slider.toolTip
};
}
else if (setting is Options options)
{
val = new SettingsInstance
{
options = options.options,
settingsType = (SettingsType)0,
settingName = options.name,
m_settingsKey = options.name,
toolTip = options.toolTip
};
}
field = CollectionExtensions.AddItem<SettingsInstance>((IEnumerable<SettingsInstance>)field, val).ToArray();
settingsInstances = BoltUtils.AddFirst<SettingsInstance>(settingsInstances, val);
modedSettingsInstances = BoltUtils.AddFirst<SettingsInstance>(modedSettingsInstances, val);
ServiceLocator.GetService<GlobalSettingsHandler>().SetField(name, field);
}
}
public class SaveSettings : MonoBehaviour
{
[Serializable]
public class CASASave
{
public string[] lastMods;
public string[] modedSettings;
}
private static CASASave m_casaSave;
public static CASASave CasaSave => m_casaSave;
public static void Save()
{
CASASave cASASave = new CASASave
{
lastMods = (from n in CASAMod.GetCASAMods()
select n.GetModPropreties().modName).ToArray(),
modedSettings = QuickSettingsManager.modedSettingsInstances.Select((SettingsInstance n) => TurnToString(n)).ToArray()
};
File.WriteAllText(Loader.path + "/SAVE", JsonUtility.ToJson((object)cASASave));
}
public static void Load()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Invalid comparison between Unknown and I4
try
{
if (!File.Exists(Loader.path + "/SAVE"))
{
return;
}
CASASave cASASave = (m_casaSave = JsonUtility.FromJson<CASASave>(File.ReadAllText(Loader.path + "/SAVE")));
for (int i = 0; i < cASASave.modedSettings.Length; i++)
{
string[] splt = cASASave.modedSettings[i].Split("=".ToArray(), StringSplitOptions.RemoveEmptyEntries);
SettingsInstance val = QuickSettingsManager.modedSettingsInstances.ToList().Find((SettingsInstance n) => n.settingName == splt[0]);
if ((int)val.settingsType == 0)
{
try
{
val.currentValue = int.Parse(splt[1]);
}
catch
{
Debug.Log((object)val.currentValue);
}
}
else
{
try
{
val.currentSliderValue = float.Parse(splt[1]);
}
catch
{
Debug.Log((object)val.currentSliderValue);
}
}
}
}
catch (Exception)
{
}
}
private static string TurnToString(SettingsInstance n)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)n.settingsType == 0)
{
return n.settingName + "=" + n.currentValue;
}
return n.settingName + "=" + n.currentSliderValue;
}
public void OnApplicationQuit()
{
Save();
}
public IEnumerator Start()
{
yield return (object)new WaitForSecondsRealtime(3f);
Save();
((MonoBehaviour)this).StartCoroutine(Start());
}
}
}
namespace CASA.BaseModContent
{
public class AddModMenu : MonoBehaviour
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<bool> <>9__1_0;
public static UnityAction <>9__1_1;
public static Action <>9__1_2;
internal bool <LoadScene>b__1_0()
{
return Object.op_Implicit((Object)(object)GameObject.Find("ModListing"));
}
internal void <LoadScene>b__1_1()
{
TABSSceneManager.LoadMainMenu(false);
}
internal void <LoadScene>b__1_2()
{
Debug.Log((object)"done");
}
}
public void AddButton()
{
((MonoBehaviour)this).StartCoroutine(Enumerator());
}
public IEnumerator LoadScene()
{
TABSSceneManager.LoadScene("Assets/Scenes/ModList.unity", false);
yield return (object)new WaitForSecondsRealtime(1f);
yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)GameObject.Find("ModListing"))));
Debug.Log((object)"modlst");
Debug.Log((object)"modlst");
ButtonClickedEvent onClick = GameObject.Find("GoToTabs").GetComponent<Button>().onClick;
object obj2 = <>c.<>9__1_1;
if (obj2 == null)
{
UnityAction val = delegate
{
TABSSceneManager.LoadMainMenu(false);
};
<>c.<>9__1_1 = val;
obj2 = (object)val;
}
((UnityEvent)onClick).AddListener((UnityAction)obj2);
GameObject modListing = GameObject.Find("ModListing");
for (int i = 0; i < CASAMod.GetCASAMods().Length; i++)
{
CASAMod mod = CASAMod.GetCASAMods()[i];
GameObject obj = Object.Instantiate<GameObject>(modListing, modListing.transform.parent);
obj.GetComponentsInChildren<Image>(true)[1].sprite = mod.GetModPropreties().modIcon;
((TMP_Text)obj.GetComponentsInChildren<TextMeshProUGUI>(true)[0]).text = mod.GetModPropreties().modName;
((TMP_Text)obj.GetComponentsInChildren<TextMeshProUGUI>(true)[2]).text = mod.GetModPropreties().modCreator;
((TMP_Text)obj.GetComponentsInChildren<TextMeshProUGUI>(true)[1]).text = mod.GetModPropreties().modDiscription;
((UnityEvent)obj.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
mod.ShowModIcon();
});
}
Object.Destroy((Object)(object)modListing);
ServiceLocator.GetService<LoadingScreenHandler>().HideLoadingScreen((Action)delegate
{
Debug.Log((object)"done");
});
}
public IEnumerator Enumerator()
{
yield return (object)new WaitForEndOfFrame();
if (!Object.op_Implicit((Object)(object)GameObject.Find("CASAMods")))
{
GameObject button = Object.Instantiate<GameObject>(GameObject.Find("CustomContent"), GameObject.Find("CustomContent").transform.parent);
((Object)button).name = "CASAMods";
((UnityEventBase)button.GetComponent<Button>().onClick).RemoveAllListeners();
((UnityEvent)button.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
((MonoBehaviour)this).StartCoroutine(LoadScene());
});
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)button.GetComponentInChildren<TextMeshProUGUI>(true) != (Object)null));
yield return (object)new WaitForEndOfFrame();
yield return (object)new WaitForEndOfFrame();
yield return (object)new WaitForEndOfFrame();
Object.Destroy((Object)(object)button.GetComponent<LocalizeText>());
Object.Destroy((Object)(object)button.GetComponent<SelectableColorApplicator>());
Object.Destroy((Object)(object)((Component)button.GetComponentInChildren<GraphicColorApplicator>(true)).gameObject);
TextMeshProUGUI[] componentsInChildren = button.GetComponentsInChildren<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI item in componentsInChildren)
{
((TMP_Text)item).text = "CASA Mods";
}
button.AddComponent<RainbowText>();
button.transform.SetSiblingIndex(6);
}
}
}
public class RainbowText : MonoBehaviour
{
public TextMeshProUGUI text;
private void Awake()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
text = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(true);
((Graphic)text).color = Color.red;
}
private void Update()
{
//IL_0007: 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)
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(((Graphic)text).color, ref num, ref num2, ref num3);
((Graphic)text).color = Color.HSVToRGB(num + 0.15f * Time.fixedDeltaTime, num2, num3);
((TMP_Text)text).text = "CASA Mods";
}
}
[BepInPlugin("AlterCreature.CASA", "CASA", "1.0.0")]
public class Loader : CASAMod
{
public const string ModCreator = "AlterCreature";
public const string ModName = "CASA";
public static string path = GamePaths.DataPath + "/CASA";
public override ModPropreties GetModPropreties()
{
Sprite modIcon = CASATools.LoadSprite("CASA.png");
return new ModPropreties("CASA", "AlterCreature", "For all your modding needs, Weather you are a new Mod Creator looking for a way to make modding easier and cleaner, or if you are downloading this mod for the factions and plenty of abilites this mod offers, Welcome to CASA!", "Welcome to CASA!", modIcon);
}
private void Awake()
{
Debug.Log((object)"Loading CASA...");
((MonoBehaviour)this).StartCoroutine(AwaitedAwake());
}
private IEnumerator AwaitedAwake()
{
yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
yield return (object)new WaitUntil((Func<bool>)(() => Resources.FindObjectsOfTypeAll<UnitBlueprint>().Length != 0));
yield return (object)new WaitForSecondsRealtime(0.3f);
if (!File.Exists(path + "/SAVE"))
{
File.WriteAllText(contents: JsonUtility.ToJson((object)new SaveSettings.CASASave
{
lastMods = new string[0],
modedSettings = new string[0]
}), path: path + "/SAVE");
}
ObjectSearcher.Instalize();
QuickSettingsManager.Instalize();
AssetBundleLoader.Manager.LoadAllAssetBundles();
GameObject ModObject = new GameObject("AlterCreature.CASA");
Object.DontDestroyOnLoad((Object)(object)ModObject);
ModObject.AddComponent<MyWhiteBoard>();
ModObject.AddComponent<AddModMenu>().AddButton();
for (int i = 0; i < CASAMod.GetCASAMods().Length; i++)
{
CASAMod.GetCASAMods()[i].Init();
}
yield return (object)new WaitForSecondsRealtime(1f);
WhiteBoard.Instilaize();
yield return (object)new WaitForSecondsRealtime(0.5f);
SaveSettings.Load();
yield return (object)new WaitForSecondsRealtime(0.5f);
CASAMod[] cASAMods = CASAMod.GetCASAMods();
foreach (CASAMod item in cASAMods)
{
if (!SaveSettings.CasaSave.lastMods.Contains(item.GetModPropreties().modName))
{
item.ShowModIcon();
}
}
ModObject.AddComponent<SaveSettings>();
}
public override void Init()
{
}
}
public class MyWhiteBoard : WhiteBoard
{
private string comment;
public override void Init()
{
//IL_0037: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Expected O, but got Unknown
//IL_0171: 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_01bb: Expected O, but got Unknown
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
base.Init();
Sprite sprite = CASATools.LoadSprite("C.png");
comment = "Projectiles-------------------------";
GameObject val = CASAPool.Pool.AddObject(ObjectSearcher.FindProjectile("Pirate Queen's Bomb"), "Mini Big Bomb", new DatabaseID(59894131), makeCopy: true, sprite);
Transform transform = val.transform;
transform.localScale *= 5f;
val.GetComponent<MoveTransform>().drag = 3f;
val.GetComponent<MoveTransform>().gravity = 60f;
val.GetComponent<MoveTransform>().selfImpulse = new Vector3(0f, 0f, 70f);
val.GetComponent<DelayEvent>().delay = 0.4f;
comment = "Materials---------------------------";
ModContent.Mod.content.Add("ZombieMat1", (object)new Material(Shader.Find("Standard"))
{
color = new Color(0f, 0.5f, 0f, 1f)
});
ModContent.Mod.content.Add("ZombieMat2", (object)new Material(Shader.Find("Standard"))
{
color = new Color(0f, 0.35f, 0f, 1f)
});
comment = "Unit Bases--------------------------";
GameObject val2 = CASAPool.Pool.AddObject(Object.Instantiate<GameObject>(ObjectSearcher.FindUnitBase("Humanoid")), "Zombie", new DatabaseID(-83548123), makeCopy: false, sprite);
TeamColor[] componentsInChildren = val2.GetComponentsInChildren<TeamColor>(true);
foreach (TeamColor val3 in componentsInChildren)
{
val3.redMaterial = (Material)ModContent.Mod.content["ZombieMat1"];
val3.blueMaterial = (Material)ModContent.Mod.content["ZombieMat2"];
}
comment = "Effects-----------------------------";
GameObject val4 = CASAPool.Pool.AddObject(ObjectSearcher.FindEffect("Leg_Flag_Stay"), "CASA_Flag_Smart", new DatabaseID(813869742), makeCopy: true, sprite);
for (int j = 0; j < val4.GetComponentsInChildren<MeshRenderer>(true).Length; j++)
{
Material val5 = Object.Instantiate<Material>(((Renderer)val4.GetComponentsInChildren<MeshRenderer>(true)[j]).material);
val5.color = new Color(0.3f, 0.7f, 0.3f, 1f);
((Renderer)val4.GetComponentsInChildren<MeshRenderer>(true)[j]).material = val5;
}
((UnitEffectBase)val4.GetComponent<GenericBaseEffect>()).effectID = -874512;
Object.Destroy((Object)(object)val4.GetComponent<UnitDontWalkFor>());
val4.AddComponent<SmartMovement>();
val4.AddComponent<RemoveAfterSeconds>().seconds = 2f;
comment = "Abilites----------------------------";
GameObject val6 = CASAPool.Pool.AddObject(ObjectSearcher.FindMove("Self Copy"), "Insanity", new DatabaseID(-485474971), makeCopy: true, sprite);
Object.Destroy((Object)(object)val6.GetComponent<AddMeleeCopy>());
val6.AddComponent<Insanity>();
GameObject val7 = CASAPool.Pool.AddObject(ObjectSearcher.FindMove("Self Copy"), "AddRandomCloth", new DatabaseID(-485474972), makeCopy: true, sprite);
Object.Destroy((Object)(object)val7.GetComponent<AddMeleeCopy>());
val7.AddComponent<AddRandomClothes>();
GameObject val8 = CASAPool.Pool.AddObject(ObjectSearcher.FindMove("Order Units Stay"), "Order Units Smart", new DatabaseID(-485474973), makeCopy: true, sprite);
for (int k = 0; k < val8.GetComponentsInChildren<MeshRenderer>(true).Length; k++)
{
Material val9 = Object.Instantiate<Material>(((Renderer)val8.GetComponentsInChildren<MeshRenderer>(true)[k]).material);
val9.color = new Color(0.3f, 0.7f, 0.3f, 1f);
((Renderer)val8.GetComponentsInChildren<MeshRenderer>(true)[k]).material = val9;
}
val8.GetComponentInChildren<ExplosionAddEffect>().EffectPrefab = (UnitEffectBase)(object)val4.GetComponent<GenericBaseEffect>();
val8.GetComponentInChildren<ConditionalEvent>().events[0].conditions[0].value = 2f;
GameObject val10 = CASAPool.Pool.AddObject(AssetBundleLoader.Manager.LoadObjectFromAssetBundle<GameObject>("Assets/Abilites/LaserEyes.prefab"), "IMMACULATE LASER EYES OF DOOM AND DESPAIR AND DESTRUCTION, IT REALLY IS ALL THAT AND MORE, NO CAP, TRUST", new DatabaseID(-485474937), makeCopy: true, sprite, "", showInEditor: false);
comment = "Clothes------------------------------";
GameObject gameObject = AssetBundleLoader.Manager.LoadObjectFromAssetBundle<GameObject>("Assets/Props/CP_MilitarySuit001.prefab");
CASAPool.Pool.AddObject(gameObject, "Military Suit", new DatabaseID(-78517421), makeCopy: true, sprite);
comment = "Weapons------------------------------";
GameObject gameObject2 = AssetBundleLoader.Manager.LoadObjectFromAssetBundle<GameObject>("Assets/Weapons/CASA_Banner_Smart_1 Weapons_VB.prefab");
GameObject gameObject3 = AssetBundleLoader.Manager.LoadObjectFromAssetBundle<GameObject>("Assets/Weapons/CASA_ArmCanon_1 Weapons_VB.prefab");
CASAPool.Pool.AddObject(gameObject2, "Banner Smart", new DatabaseID(-78517422), makeCopy: true, sprite);
CASAPool.Pool.AddObject(gameObject3, "Arm Canon", new DatabaseID(-1851742112), makeCopy: true, sprite);
comment = "Faction-----------------------------";
Faction faction = CASATools.CreateFaction("CASA", 874874854, sprite);
comment = "Unit--------------------------------";
CASATools.CreateUnit("Zombie", -489514721, faction, sprite);
CASATools.CreateUnit("Star Bearer", -489514723, faction, sprite);
CASATools.CreateUnit("Cyber-Solider", -489514724, faction, sprite, UnitSerializer.GetEmbeddedUnitBlueprint("Cyber-Solider"));
}
public override void ChangeUnit(UnitBlueprint unitBlueprint)
{
if (unitBlueprint.Entity.Name == "Zombie")
{
unitBlueprint.UnitBase = CASAPool.Pool.GetObject("Zombie");
unitBlueprint.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[2]
{
CASAPool.Pool.GetObject("Insanity"),
CASAPool.Pool.GetObject("AddRandomCloth")
};
}
if (unitBlueprint.Entity.Name == "Star Bearer")
{
unitBlueprint.m_props = (GameObject[])(object)new GameObject[1] { CASAPool.Pool.GetObject("Military Suit") };
unitBlueprint.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { CASAPool.Pool.GetObject("Order Units Smart") };
unitBlueprint.RightWeapon = CASAPool.Pool.GetObject("Banner Smart");
unitBlueprint.holdinigWithTwoHands = true;
}
if (unitBlueprint.Entity.Name == "LarryGamer2013")
{
unitBlueprint.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { CASAPool.Pool.GetObject("IMMACULATE LASER EYES OF DOOM AND DESPAIR AND DESTRUCTION, IT REALLY IS ALL THAT AND MORE, NO CAP, TRUST") };
}
if (unitBlueprint.Entity.Name == "Cyber-Solider")
{
unitBlueprint.leftProjectile = CASAPool.Pool.GetObject("Mini Big Bomb").GetComponent<ProjectileEntity>();
unitBlueprint.rightProjectile = CASAPool.Pool.GetObject("Mini Big Bomb").GetComponent<ProjectileEntity>();
unitBlueprint.attackSpeedMultiplier *= 4f;
}
}
public override void OnAnyUnitSpawned(Unit unit, DataHandler dataHandler, HealthHandler healthHandler)
{
if (unit.unitBlueprint.Entity.Name == "Star Bearer")
{
((Component)unit).gameObject.AddComponent<UnitDontWalkFor>().time = 100000000f;
((Component)unit).gameObject.GetComponent<UnitDontWalkFor>().Go();
}
}
public override void OnEnterNewSceneFixed(Scene oldScene, Scene newScene)
{
Debug.Log((object)"new scene");
if (TABSSceneManager.IsInMainMenuScene())
{
Debug.Log((object)"MainMenu!!");
Object.FindObjectOfType<AddModMenu>().AddButton();
}
}
public override void ChangeAbility(GameObject abilityGameObject, SpecialAbility data, ConditionalEvent @event)
{
}
}
}
namespace CASA.AssetBundleMangement
{
public class AssetBundleLoader
{
public string name = "";
public AssetBundle[] allAssetBundles = (AssetBundle[])(object)new AssetBundle[0];
public Assembly assembly;
private static List<AssetBundleLoader> instances = new List<AssetBundleLoader>();
public static AssetBundleLoader Manager
{
get
{
string name = Assembly.GetCallingAssembly().GetName().Name;
for (int i = 0; i < instances.Count; i++)
{
if (instances[i].name == name)
{
return instances[i];
}
}
instances.Add(new AssetBundleLoader
{
name = name,
assembly = Assembly.GetCallingAssembly()
});
return instances.Find((AssetBundleLoader conditon) => conditon.name == name);
}
}
public AssetBundle LoadBundle(string bundleName)
{
using Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream(bundleName);
AssetBundle val = AssetBundle.LoadFromStream(stream);
if ((Object)(object)val == (Object)null)
{
return null;
}
allAssetBundles = BoltUtils.AddFirst<AssetBundle>(allAssetBundles, val);
Debug.Log((object)("Assetbundle Loaded:" + bundleName));
return val;
}
public AssetBundle[] LoadAllAssetBundles()
{
AssetBundle[] array = (AssetBundle[])(object)new AssetBundle[0];
string[] manifestResourceNames = Assembly.GetCallingAssembly().GetManifestResourceNames();
for (int i = 0; i < manifestResourceNames.Length; i++)
{
using (Assembly.GetCallingAssembly().GetManifestResourceStream(manifestResourceNames[i]))
{
try
{
array = BoltUtils.AddFirst<AssetBundle>(array, LoadBundle(manifestResourceNames[i]));
}
catch
{
}
}
}
return array;
}
public T LoadObjectFromAssetBundle<T>(string objectName) where T : Object
{
for (int i = 0; i < allAssetBundles.Length; i++)
{
try
{
return allAssetBundles[i].LoadAsset<T>(objectName);
}
catch
{
}
}
return default(T);
}
}
public class BundleProccesor : MonoBehaviour
{
public static void LoadBundleStuff(AssetBundle assetBundle, bool AddToPool = false)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
GameObject[] array = assetBundle.LoadAllAssets<GameObject>();
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
CASAPool.ModPool(Assembly.GetCallingAssembly()).AddObject(val, val.GetComponent<IDatabaseEntity>().Entity.Name, val.GetComponent<CharacterItem>().Entity.GUID, makeCopy: false, val.GetComponent<CharacterItem>().Entity.GetSpriteIcon());
}
UnitBlueprint[] array3 = assetBundle.LoadAllAssets<UnitBlueprint>();
if (array3 != null)
{
Dictionary<DatabaseID, UnitBlueprint> field = landfallContentDatabase.GetField<Dictionary<DatabaseID, UnitBlueprint>>("m_unitBlueprints");
for (int j = 0; j < array3.Length; j++)
{
field.Add(array3[j].Entity.GUID, array3[j]);
}
landfallContentDatabase.SetField("m_unitBlueprints", field);
}
Faction[] array4 = assetBundle.LoadAllAssets<Faction>();
if (array4 != null)
{
Dictionary<DatabaseID, Faction> field2 = landfallContentDatabase.GetField<Dictionary<DatabaseID, Faction>>("m_factions");
for (int k = 0; k < array4.Length; k++)
{
field2.Add(array4[k].Entity.GUID, array4[k]);
}
landfallContentDatabase.SetField("m_factions", field2);
}
}
}
}
namespace CASA.AbilityScripts
{
public class AddRandomClothes : MonoBehaviour
{
private void Start()
{
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
//IL_0120: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Invalid comparison between Unknown and I4
if (!Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponent<Unit>()))
{
return;
}
GameObject val = null;
while ((Object)(object)val == (Object)null)
{
try
{
val = (GameObject)ObjectSearcher.dictionary["prop"].Values.ToArray()[Random.Range(0, ObjectSearcher.dictionary["prop"].Values.Count)];
if (!((CharacterItem)val.GetComponent<PropItem>()).UnitbaseAllowed((UnitBaseRestrictions)1))
{
val = null;
}
else if ((int)((CharacterItem)val.GetComponent<PropItem>()).GearT != 7)
{
val = null;
}
else if (!((CharacterItem)val.GetComponent<PropItem>()).ShowInEditor)
{
val = null;
}
}
catch (Exception)
{
}
}
((CharacterItem)Object.Instantiate<GameObject>(val).GetComponent<PropItem>()).Equip(((Component)((Component)this).transform.root).gameObject, new PropItemData(), new TransformCatalog(((Component)((Component)this).transform.root).gameObject, (RigType)1, ""), ((Component)((Component)this).transform.root).GetComponent<Unit>().Team, false);
}
}
public class GameStateEvents : MonoBehaviour
{
}
public class Insanity : GameStateListener
{
public IEnumerator loop()
{
yield return (object)new WaitForSeconds(0.5f * (Random.Range(0f, 150f) / 100f));
FlipUnitTeam(((Component)((Component)this).transform.root).GetComponent<Unit>());
((MonoBehaviour)this).StartCoroutine(loop());
}
public override void OnEnterBattleState()
{
((MonoBehaviour)this).StartCoroutine(loop());
}
public override void OnEnterPlacementState()
{
((MonoBehaviour)this).StopAllCoroutines();
}
public static void FlipUnitTeam(Unit unit)
{
//IL_0002: 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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected I4, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
Team team = unit.Team;
unit.Team = TeamUtlity.GetOtherTeam(team);
unit.data.team = TeamUtlity.GetOtherTeam(team);
GameObjectEntity component = ((Component)((Component)unit).transform.root).GetComponent<GameObjectEntity>();
component.EntityManager.RemoveComponent<Team>(component.Entity);
component.EntityManager.AddSharedComponentData<Team>(component.Entity, new Team
{
Value = (int)TeamUtlity.GetOtherTeam(team)
});
World.Active.GetOrCreateManager<TeamSystem>().RemoveEntity(component.Entity, team, unit);
World.Active.GetOrCreateManager<TeamSystem>().AddUnit(component.Entity, ((Component)((Component)unit).transform.root).gameObject, ((Component)unit).transform.root, unit.data.mainRig, unit.data, TeamUtlity.GetOtherTeam(team), unit, true);
if (!Object.op_Implicit((Object)(object)((Component)((Component)unit).transform.root).GetComponentInChildren<TeamHolder>()))
{
}
}
}
public class SmartMovement : MonoBehaviour
{
private void Awake()
{
Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
if (component.data.inRange)
{
((Component)this).gameObject.AddComponent<UnitDontWalkFor>().time = 1.2f;
((Component)this).gameObject.GetComponent<UnitDontWalkFor>().Go();
}
DataHandler data = component.data;
data.health += component.data.maxHealth * 1.1f;
DataHandler data2 = component.data;
data2.immunityForSeconds += 0.8f;
}
}
}