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 DM;
using FhpSLib;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using MoreContent;
using UnityEngine;
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("MoreContent")]
[assembly: AssemblyDescription("just some new things")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("FhpK")]
[assembly: AssemblyProduct("by FhpStudio")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[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: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MoreContent
{
public static class UManager
{
public static string modname;
public static string modder;
private static string com;
public static List<GameObject> weapons;
private static string[] Fan;
static UManager()
{
modname = "More Content";
modder = "FhpStudio";
weapons = new List<GameObject>();
}
public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
{
}
public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db)
{
}
public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db)
{
}
public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db)
{
}
public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db)
{
}
public static void Init(LandfallContentDatabase db)
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_062e: Unknown result type (might be due to invalid IL or missing references)
//IL_0633: Unknown result type (might be due to invalid IL or missing references)
//IL_063e: Unknown result type (might be due to invalid IL or missing references)
//IL_058e: Unknown result type (might be due to invalid IL or missing references)
AssetBundle bundle;
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("more"))
{
bundle = AssetBundle.LoadFromStream(stream);
}
MoreContentDatas.AddAssetBundle("weapons", bundle);
Object[] array = MoreContentDatas.GetAssetBundle("weapons").LoadAllAssets<Object>();
foreach (Object val in array)
{
MoreContentDatas.Tools.Debug.LogWarning("load:" + val);
}
GameObject[] array2 = MoreContentDatas.GetAssetBundle("weapons").LoadAllAssets<GameObject>();
foreach (GameObject val2 in array2)
{
if (Object.op_Implicit((Object)(object)val2.GetComponent<WeaponItem>()) && !HelpLibrary.m_weapons.ContainsKey(((CharacterItem)val2.GetComponent<WeaponItem>()).Entity.GUID))
{
GameObject gameObject = val2.gameObject;
weapons.Add(gameObject);
MoreContentDatas.Tools.Debug.LogError("Weapon:" + ((Object)gameObject).name);
gameObject.AddComponent<NumberofMoreContent>().Init(weapons.IndexOf(gameObject), ((Object)gameObject).name);
Setthing(gameObject.GetComponent<NumberofMoreContent>());
Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_weapons;
dictionary.Add(((CharacterItem)val2.GetComponentInChildren<WeaponItem>()).Entity.GUID, val2.gameObject);
HelpLibrary.m_weapons = dictionary;
Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
dictionary2.Add(((CharacterItem)val2.GetComponentInChildren<WeaponItem>()).Entity.GUID, (Object)(object)val2.gameObject);
typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary2);
}
if (Object.op_Implicit((Object)(object)val2.GetComponent<PropItem>()) && !HelpLibrary.m_characterProps.ContainsKey(((CharacterItem)val2.GetComponent<PropItem>()).Entity.GUID))
{
GameObject gameObject2 = val2.gameObject;
MoreContentDatas.Tools.Debug.LogError("Prop:" + ((Object)gameObject2).name);
gameObject2.AddComponent<NumberofMoreContent>().Init(-2, ((Object)gameObject2).name);
Setthing(gameObject2.GetComponent<NumberofMoreContent>());
Dictionary<DatabaseID, GameObject> characterProps = HelpLibrary.m_characterProps;
characterProps.Add(((CharacterItem)val2.GetComponentInChildren<PropItem>()).Entity.GUID, val2.gameObject);
HelpLibrary.m_characterProps = characterProps;
Dictionary<DatabaseID, Object> dictionary3 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
dictionary3.Add(((CharacterItem)val2.GetComponentInChildren<PropItem>()).Entity.GUID, (Object)(object)val2.gameObject);
typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary3);
}
if (Object.op_Implicit((Object)(object)val2.GetComponent<Unit>()) && !HelpLibrary.m_unitBases.ContainsKey(val2.GetComponent<Unit>().Entity.GUID))
{
GameObject gameObject3 = val2.gameObject;
MoreContentDatas.UnitBasesData.bases.Add(val2.GetComponent<Unit>());
gameObject3.AddComponent<NumberofMoreContent>().Init(-1, ((Object)gameObject3).name);
MoreContentDatas.Tools.Debug.LogError("Unit:" + ((Object)gameObject3).name);
Setthing(gameObject3.GetComponent<NumberofMoreContent>());
Dictionary<DatabaseID, GameObject> unitBases = HelpLibrary.m_unitBases;
unitBases.Add(val2.GetComponentInChildren<Unit>().Entity.GUID, val2.gameObject);
HelpLibrary.m_unitBases = unitBases;
Dictionary<DatabaseID, Object> dictionary4 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
dictionary4.Add(val2.GetComponentInChildren<Unit>().Entity.GUID, (Object)(object)val2.gameObject);
typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary4);
}
}
SoundBank[] array3 = MoreContentDatas.GetAssetBundle("weapons").LoadAllAssets<SoundBank>();
foreach (SoundBank obj in array3)
{
SoundBank soundBank = ServiceLocator.GetService<SoundPlayer>().soundBank;
List<SoundBankCategory> list = soundBank.Categories.ToList();
SoundBankCategory[] categories = obj.Categories;
foreach (SoundBankCategory item in categories)
{
list.Add(item);
}
soundBank.Categories = list.ToArray();
}
ServiceLocator.GetService<CustomContentLoaderModIO>().QuickRefresh((WorkshopContentType)0, (Action)null);
Dictionary<int, Language> dictionary5 = new Dictionary<int, Language>();
dictionary5.Add(0, (Language)7);
dictionary5.Add(1, (Language)0);
dictionary5.Add(2, (Language)8);
dictionary5.Add(3, (Language)3);
dictionary5.Add(4, (Language)1);
dictionary5.Add(5, (Language)6);
dictionary5.Add(6, (Language)4);
dictionary5.Add(7, (Language)2);
TextAsset obj2 = MoreContentDatas.GetAssetBundle("weapons").LoadAsset<TextAsset>("翻译");
Dictionary<Language, Dictionary<string, string>> dictionary6 = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
Fan = obj2.text.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries);
string[] fan = Fan;
foreach (string text in fan)
{
for (int num = 0; num < text.Split(new char[1] { '=' }).Length; num++)
{
if (num <= 7)
{
MoreContentDatas.Tools.Debug.LogWarning("add" + num + ":" + text.Split(new char[1] { '=' })[0] + " " + text.Split(new char[1] { '=' })[num]);
dictionary6[dictionary5[num]].TryAdd(text.Split(new char[1] { '=' })[0], text.Split(new char[1] { '=' })[num]);
}
}
}
typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).SetValue(typeof(Localizer), dictionary6);
MoreContentDatas.HiddenWeapons.LoadAssets(MoreContentDatas.GetAssetBundle("weapons"));
new GameObject
{
name = "WeaponsCore",
hideFlags = (HideFlags)52
}.AddComponent<ScenesManager>();
}
public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
{
}
public static void Setthing(NumberofMoreContent number)
{
if (Object.op_Implicit((Object)(object)((Component)number).gameObject.GetComponent<TextMesh>()) && ((Component)number).gameObject.GetComponent<TextMesh>().text == "CRBZ")
{
((Component)number).gameObject.AddComponent<BZSL>();
}
}
}
[BepInPlugin("MoreContent", "fhp.cc.mc", "0.0.1")]
internal class Loader : BaseUnityPlugin
{
private void Awake()
{
((MonoBehaviour)this).StartCoroutine("call");
}
private IEnumerator call()
{
Debug.Log((object)"here");
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
SLMALoader.GetInstance();
UManager.Init(ContentDatabase.Instance().LandfallContentDatabase);
new Harmony(UManager.modname).PatchAll();
Debug.Log((object)("Loaded " + UManager.modname + " Successfully"));
Debug.Log((object)(UManager.modname + "is made by FhpStudio"));
Debug.Log((object)(UManager.modder + "wished you a pleasant trip"));
}
}
public static class MoreContentDatas
{
public static class Tools
{
public static class Debug
{
public static void Log(object con)
{
if (Dev_mode)
{
Debug.Log(con);
}
}
public static void LogWarning(object con)
{
if (Dev_mode)
{
Debug.LogWarning(con);
}
}
public static void LogError(object con)
{
if (Dev_mode)
{
Debug.LogError(con);
}
}
}
}
public static class HiddenWeapons
{
public static List<SecretUnlock> unlocks;
public static List<string> scences;
public static Dictionary<string, GameObject[]> secrets;
public static void LoadAssets(AssetBundle bundle)
{
Tools.Debug.Log(((Object)bundle).name);
Tools.Debug.Log(bundle.LoadAllAssets<SecretUnlock>().Length);
GameObject[] array = bundle.LoadAllAssets<GameObject>();
foreach (GameObject val in array)
{
if (Object.op_Implicit((Object)(object)val.GetComponent<SecretUnlock>()))
{
SecretUnlock component = val.GetComponent<SecretUnlock>();
unlocks.Add(component);
Tools.Debug.Log(((Object)((Component)component).gameObject).name);
string[] array2 = ((Object)((Component)component).gameObject).name.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries);
((Object)((Component)component).gameObject).name = array2[1];
if (!scences.Contains(array2[0]))
{
scences.Add(array2[0]);
}
if (secrets.ContainsKey(array2[0]))
{
List<GameObject> list = secrets[array2[0]].ToList();
list.Add(((Component)component).gameObject);
secrets[array2[0]] = list.ToArray();
}
else
{
secrets.Add(array2[0], (GameObject[])(object)new GameObject[1] { ((Component)component).gameObject });
}
}
}
}
static HiddenWeapons()
{
unlocks = new List<SecretUnlock>();
scences = new List<string>();
secrets = new Dictionary<string, GameObject[]>();
}
}
public static class UnitBasesData
{
public static List<Unit> bases;
static UnitBasesData()
{
bases = new List<Unit>();
}
}
public static Dictionary<string, AssetBundle> bundlepools;
public static bool Dev_mode;
public static AssetBundle GetAssetBundle(string name)
{
if (name == null)
{
return null;
}
if (bundlepools.ContainsKey(name))
{
return bundlepools[name];
}
return null;
}
public static void AddAssetBundle(string name, AssetBundle bundle)
{
if (name != null && !((Object)(object)bundle == (Object)null))
{
if (bundlepools.ContainsKey(name))
{
bundlepools.Add(name + "-", bundle);
}
else
{
bundlepools.Add(name, bundle);
}
}
}
static MoreContentDatas()
{
bundlepools = new Dictionary<string, AssetBundle>();
Dev_mode = false;
}
}
public class NumberofMoreContent : MonoBehaviour
{
public int id;
public string name;
public void Init(int id, string name)
{
this.id = id;
this.name = name;
}
}
}
public class SZ : MonoBehaviour
{
public void Start()
{
Object.Destroy((Object)(object)((Component)((Component)this).transform).gameObject, 5f);
}
}
public class BZSL : MeleeWeaponAddEffect
{
public override void DoEffect(Transform hitTransform, Collision hit)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0017: 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_0050: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
val.transform.position = ((Component)this).gameObject.transform.position;
Object.Instantiate<GameObject>(MoreContentDatas.GetAssetBundle("weapons").LoadAsset<GameObject>("SZ"), ((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.rotation, val.transform).AddComponent<SZ>();
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
namespace MoreContent
{
public class ScenesManager : MonoBehaviour
{
public class CellMono : MonoBehaviour
{
public static List<string> texts;
public void Update()
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
GameObject gameObject = ((Component)this).gameObject;
if (texts.Contains(((UnitEditorItemCell)gameObject.GetComponentInChildren<UnitEditorWeaponCell>()).Item.Entity.UnlockKey) && !ServiceLocator.GetService<ISaveLoaderService>().HasUnlockedSecret(((UnitEditorItemCell)gameObject.GetComponentInChildren<UnitEditorWeaponCell>()).Item.Entity.UnlockKey))
{
gameObject.GetComponentInChildren<UnitEditorWeaponCell>().weaponTypeIcon.sprite = (Sprite)SLMALoader.SDic["sprites"]["Secret_Icon1"];
((Behaviour)gameObject.GetComponentInChildren<Button>()).enabled = false;
((Behaviour)gameObject.GetComponentInChildren<ScaleJiggleAnimation>()).enabled = false;
((Behaviour)gameObject.GetComponentInChildren<UnitEditorWeaponCell>()).enabled = false;
}
}
public void Start()
{
if (texts != null)
{
return;
}
texts = new List<string>();
foreach (SecretUnlock unlock in MoreContentDatas.HiddenWeapons.unlocks)
{
MoreContentDatas.Tools.Debug.LogWarning(((Object)((Component)unlock).gameObject).name);
texts.Add(((Object)((Component)unlock).gameObject).name);
}
}
}
public ScenesManager()
{
SceneManager.sceneLoaded += SceneLoaded;
}
public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
{
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//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_00dd: 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)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
if (((Scene)(ref scene)).name == "UnitCreator_GamepadUI")
{
((MonoBehaviour)this).StartCoroutine(Set());
UnitEditorManager component = ((Scene)(ref scene)).GetRootGameObjects().ToList().Find((GameObject x) => Object.op_Implicit((Object)(object)x.GetComponent<UnitEditorManager>()))
.GetComponent<UnitEditorManager>();
List<UnitBaseWrapper> list = component.UnitBases.ToList();
foreach (Unit basis in MoreContentDatas.UnitBasesData.bases)
{
UnitBlueprint val = SLMATool.CreateUnit("MoreContent Custom:" + basis.Entity.Name, (UnitBlueprint)SLMALoader.SDic["blueprints"]["CustomWobbler"], (Faction)null, (Sprite)null);
val.UnitBase = ((Component)basis).gameObject;
list.Add(new UnitBaseWrapper
{
BaseDisplayName = basis.Entity.Name,
BaseIcon = basis.Entity.SpriteIcon,
UnitBaseBlueprint = val,
UnitBaseRestriction = (UnitBaseRestrictions)0
});
}
component.UnitBases = list.ToArray();
}
if (MoreContentDatas.HiddenWeapons.scences.Contains(((Scene)(ref scene)).name))
{
GameObject val2 = new GameObject("Core");
GameObject[] array = MoreContentDatas.HiddenWeapons.secrets[((Scene)(ref scene)).name];
for (int i = 0; i < array.Length; i++)
{
Object.Instantiate<GameObject>(array[i], val2.transform);
}
}
}
public IEnumerator Set()
{
yield return (object)new WaitUntil((Func<bool>)(() => Resources.FindObjectsOfTypeAll<UnitEditorWeaponCell>().Length > 1));
UnitEditorWeaponCell[] array = Resources.FindObjectsOfTypeAll<UnitEditorWeaponCell>();
for (int i = 0; i < array.Length; i++)
{
((Component)array[i]).gameObject.AddComponent<CellMono>();
}
}
}
}