using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 FhpSLib.BundleModCore;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using TMPro;
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("clothsc")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("made in SFT by FhpSlime")]
[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 Clothsc
{
public static class UManager
{
public static string modname;
public static string modder;
private static string com;
public static SLMABundleMod bundleMod;
public static List<Unit> bases;
static UManager()
{
modname = "fixskin";
modder = "FhpSlime";
bases = new List<Unit>();
}
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_0005: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
new Harmony("clothsc").PatchAll();
new GameObject
{
hideFlags = (HideFlags)61,
name = "core"
}.AddComponent<ScenesManager>();
}
public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
{
}
public static void SetMoveConditionalValue(this ConditionalEventInstance gameObject, ConditionType type, ValueType valuet, float value)
{
}
}
[BepInPlugin("clothsc", "clothsc", "1.0.0")]
internal class Loader : BaseUnityPlugin
{
public static bool BundleMode;
private void Awake()
{
((MonoBehaviour)this).StartCoroutine("call");
}
private IEnumerator call()
{
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));
yield return (object)new WaitForSecondsRealtime(0.3f);
SLMALoader.GetInstance();
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
UManager.Init(landfallContentDatabase);
new Harmony(UManager.modname).PatchAll();
GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons) : ((Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons), GOSLMA.EditWeapons)));
GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes) : ((Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes), GOSLMA.EditClothes)));
GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves) : ((Action<GameObject, int, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves), GOSLMA.EditCombatMoves)));
GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn) : ((Action<Unit, LandfallContentDatabase>)Delegate.Combine(new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn)));
GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles) : ((Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles), GOSLMA.EditProjectiles)));
UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
for (int i = 0; i < array.Length; i++)
{
UManager.EditBlueprint(array[i], landfallContentDatabase);
}
Debug.Log((object)("Loaded " + UManager.modname + " Successfully"));
Debug.Log((object)(UManager.modname + "is made in SFT by FhpSlime"));
Debug.Log((object)(UManager.modder + "wished you a pleasant trip"));
}
static Loader()
{
BundleMode = true;
}
}
}
public class Item : MonoBehaviour
{
public enum kind
{
Weapon,
Cloth,
Skill,
Unit,
Projectile,
Other
}
public string name;
public kind Kind;
}
namespace Clothsc
{
public class MyModItems : MonoBehaviour
{
private static Dictionary<string, Item> items;
private static MyModItems instance { get; set; }
public static MyModItems GetInstance()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)instance == (Object)null)
{
instance = new GameObject("MyModItems").AddComponent<MyModItems>();
Object.DontDestroyOnLoad((Object)(object)instance);
}
return instance;
}
public void AddItem(Item item)
{
items.Add(item.name, item);
}
public Item GetItem(string name)
{
Item value = new Item
{
name = null,
Kind = Item.kind.Other
};
items.TryGetValue(name, out value);
return value;
}
}
}
public class ScenesManager : MonoBehaviour
{
public ScenesManager()
{
SceneManager.sceneLoaded += SceneLoaded;
}
public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
{
if (((Scene)(ref scene)).name == "UnitCreator_GamepadUI")
{
((MonoBehaviour)this).StartCoroutine(AddScroll());
}
}
public IEnumerator AddScroll()
{
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameObject.Find("Unit Editor UI/BigUI/AddContentPage/Scroll View") != (Object)null));
if (!Object.op_Implicit((Object)(object)GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponent<ScrollRect>()))
{
OtherLibrary.DeepCopyOf<ScrollRect>(GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").AddComponent<ScrollRect>(), GameObject.Find("Unit Editor UI/BigUI/AddContentPage/Scroll View").GetComponentInChildren<ScrollRect>());
GameObject val = Object.Instantiate<GameObject>(((Component)GameObject.Find("Unit Editor UI/BigUI/AddContentPage/Scroll View").transform.GetChild(1)).gameObject, GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").transform);
GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<ScrollRect>().verticalScrollbar = val.GetComponentInChildren<Scrollbar>();
GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<ScrollRect>().viewport = GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<RectTransform>();
OtherLibrary.SetField<ScrollRect>(GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<ScrollRect>(), "m_ViewRect", (object)GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<RectTransform>());
GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<ScrollRect>().Rebuild((CanvasUpdate)0);
GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<ScrollRect>().content = GameObject.Find("Unit Editor UI/BigUI/UnitPage/ClothesAndPropsTab/Content/Clothes").GetComponentInChildren<RectTransform>();
}
}
}
[HarmonyPatch(typeof(UnitEditorManager), "GetMaxClothingCount")]
internal class ClothNumPatch
{
[HarmonyPrefix]
public static bool Prefix(UnitEditorManager __instance, ref int __result)
{
__result = 114514;
return false;
}
}
[HarmonyPatch(typeof(UnitEditorManager), "EquipNewProp", new Type[] { typeof(CharacterItem) })]
internal class ClothSpawnPatch
{
private static int executionCount;
[HarmonyPrefix]
public static bool Prefix(UnitEditorManager __instance, CharacterItem prop, ref List<EquipedClothingWrapper> ___equipedClothes, ref UnitEditorUIManager ___UIManager)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
if (executionCount == 1)
{
executionCount = 0;
return false;
}
if (executionCount == 0)
{
executionCount++;
if (___equipedClothes.Count == 114514)
{
return false;
}
PropItemData val = new PropItemData();
CharacterItem val2 = __instance.SpawnProp(prop, val, (HandType)0);
val.m_colors = new int[val2.DefaultColors.Length];
val.m_isTeamColor = new bool[val2.DefaultColors.Length];
for (int i = 0; i < val.m_colors.Length; i++)
{
val.m_isTeamColor[i] = val2.DefaultColors[i].m_hasTeamColor;
val.m_colors[i] = val2.DefaultColors[i].m_paletteIndex;
}
EquipedClothingWrapper val3 = new EquipedClothingWrapper(prop, val2, val);
___equipedClothes.Add(val3);
val3.spawnedButton = ___UIManager.SpawnEquipedClothing(val3);
___UIManager.UpdateItemCounts();
}
return false;
}
}
[HarmonyPatch(typeof(PageCounter), "Set")]
internal class PageCounterPatch
{
[HarmonyPrefix]
public static bool Prefix(PageCounter __instance, int page, int count, ref TextMeshProUGUI ___Count, ref TextMeshProUGUI ___PageNumber)
{
page = Mathf.Clamp(page, 0, count);
((TMP_Text)___PageNumber).text = page.ToString();
((TMP_Text)___Count).text = "∞";
return false;
}
}