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.BundleModCore;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using SLMA;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Custom")]
[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 yanhua
{
public static class UManager
{
public static string modname;
public static string modder;
private static string com;
public static SLMABundleMod bundleMod;
public static SLMABundleMod bundleMod1;
static UManager()
{
modname = "SFT";
modder = "FhpSlime";
}
public static void SetRiders(UnitBlueprint me, UnitBlueprint[] riders)
{
s.SetField<UnitBlueprint>(me, "Riders", (object)riders);
}
public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_00d5: Expected O, but got Unknown
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Expected O, but got Unknown
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
if (unit.Entity.Name == "阿拉斯加外籍警督")
{
unit.health = 1000f;
SLMATool.UnitCost(unit, 2000);
unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepRangedDistance) };
unit.Entity.SpriteIcon = SCModTools.GetSprite("焰桦单位icon256×.png");
unit.RightWeapon = bundleMod.GetAssetBundle("yanhua").LoadAsset<GameObject>("Quickdraw_Revolver_AgainstHip_1 Weapons_VB 1");
unit.LeftWeapon = bundleMod.GetAssetBundle("yanhua").LoadAsset<GameObject>("GiantPunch_1 Weapons_VB 1");
GameObject obj = UPool.MyPool.AddObject("闪避2", (GameObject)SLMALoader.SDic["moves"]["Shogun_Dodge"], true, (HideFlags)52, (Sprite)null, 0, false);
UPool.MyPool.GetObject("闪避2").GetComponentInChildren<ConditionalEvent>().events[0].SetMoveConditionalValue((ConditionType)0, (ValueType)0, 2f);
obj.GetComponentInChildren<DodgeMove>().moves[0].force = 300f;
obj.GetComponentInChildren<ConditionalEvent>().events[0].stopWeaponAttacksFor = 0f;
obj.GetComponentInChildren<ConditionalEvent>().events[0].stunAllEventsFor = 0f;
obj.GetComponentInChildren<ConditionalEvent>().isStunnable = false;
obj.GetComponentInChildren<ConditionalEvent>().ignorePossession = true;
GameObject obj2 = UPool.MyPool.AddObject("闪避5", (GameObject)SLMALoader.SDic["moves"]["ProjectileDodge_Cool2"], true, (HideFlags)52, (Sprite)null, 0, false);
obj2.GetComponentInChildren<Cooldown>().cooldown = 0.3f;
obj2.GetComponentInChildren<Counter>().cooldown = 0.03f;
obj2.GetComponentInChildren<Counter>().counter = 0.01f;
obj2.GetComponentInChildren<DodgeMove>().moves[0].predictionAmount = 0f;
obj2.GetComponentInChildren<DodgeMove>().moves[0].includeWeapons = true;
obj2.GetComponentInChildren<DodgeMove>().forceMultiplier = 0.7f;
obj2.GetComponentInChildren<DodgeMove>().moves[0].randomizeDirection = true;
obj2.transform.localScale = new Vector3(5f, 5f, 5f);
obj2.transform.localScale = new Vector3(1f, 1f, 1f);
Transform val = obj2.transform.Find("Sphere");
if ((Object)(object)val != (Object)null)
{
val.localScale = new Vector3(10f, 10f, 10f);
}
unit.turnSpeed = 10000f;
ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[3]
{
UPool.MyPool.GetObject("闪避2"),
UPool.MyPool.GetObject("闪避5"),
bundleMod.GetAssetBundle("yanhua").LoadAsset<GameObject>("Superboxer_DodgPunch 1")
});
ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[3]
{
bundleMod.GetAssetBundle("yanhua").LoadAsset<GameObject>("下半身 1"),
bundleMod.GetAssetBundle("yanhua").LoadAsset<GameObject>("上半身 1"),
bundleMod.GetAssetBundle("yanhua").LoadAsset<GameObject>("头部")
});
}
}
public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
Debug.Log((object)"Hey");
if (unit.unitBlueprint.Entity.Name == "unit name")
{
Renderer[] componentsInChildren = cloth.GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].materials = (Material[])(object)new Material[1] { (Material)SLMALoader.SDic["materials"]["Glow_Neon_Green_143734"] };
}
}
}
public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db)
{
}
public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db)
{
//IL_0055: 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_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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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_00c1: Expected O, but got Unknown
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Expected O, but got Unknown
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Expected O, but got Unknown
if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 2)
{
move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f),
new Keyframe(2f, 1f),
new Keyframe(0f, 0f),
new Keyframe(0f, 0f)
});
move.GetComponentInChildren<DodgeMove>().forceMultiplier = -1f;
}
if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 3)
{
move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
{
new Keyframe(-1f, 1f),
new Keyframe(1f, 1f),
new Keyframe(5f, 4f),
new Keyframe(0f, 0f),
new Keyframe(0f, 0f)
});
move.GetComponentInChildren<DodgeMove>().forceMultiplier = -2f;
}
if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 4)
{
move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
{
new Keyframe(-1f, 1f),
new Keyframe(1f, 1f),
new Keyframe(5f, 4f),
new Keyframe(0f, 0f),
new Keyframe(0f, 0f)
});
}
}
public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (unit.unitBlueprint.Entity.Name == "unit name")
{
Transform head = unit.data.head;
head.localScale *= 2f;
}
}
public static void Init(LandfallContentDatabase db)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
com = "Bundle Mod Init";
com = "Bundle Mod Init";
AssetBundle val;
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("yanhua"))
{
val = AssetBundle.LoadFromStream(stream);
}
if (Loader.BundleMode)
{
SLMABundleMod obj = SLMABundleMod.CreatSLMABundleMod("TestMod1", "0.0.1");
obj.AddAssetBundle("yanhua", val);
obj.Dev_mode = true;
obj.LoadAssetBundle("yanhua");
bundleMod = obj;
}
Faction val2 = SLMATool.CreateFaction("焰桦生日", (UnitBlueprint[])null, SCModTools.GetSprite("焰桦.png.jpg"), 166584);
SLMATool.CreateUnit("阿拉斯加外籍警督", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_TRIBAL_CLUB"], val2, (Sprite)null);
com = "——————————Fations and Units——————————";
com = "——————————Clothes——————————";
com = "——————————Weapons——————————";
com = "——————————Effects——————————";
com = "——————————Explosions——————————";
com = "——————————UnitBases——————————";
com = "——————————Projectiles——————————";
com = "——————————Moves——————————";
}
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)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
bool flag = false;
EventCondition[] conditions = gameObject.conditions;
foreach (EventCondition val in conditions)
{
if (val.conditionType == type)
{
val.valueType = valuet;
val.value = value;
flag = true;
}
}
if (!flag)
{
List<EventCondition> list = gameObject.conditions.ToList();
list.Add(new EventCondition
{
conditionType = type,
valueType = valuet,
value = value
});
gameObject.conditions = list.ToArray();
}
}
private static Team GetRandomTeam()
{
if (!(Random.value >= 0.5f))
{
return (Team)0;
}
return (Team)1;
}
}
[BepInPlugin("yanhua", "fhp.cc.yanhua", "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 yanhua
{
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 ExplosionFixer : MonoBehaviour
{
private void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
Team team = ((Component)this).GetComponentInParent<Unit>().data.team;
if ((int)team == 0)
{
Explosion[] componentsInChildren = ((Component)this).GetComponentsInChildren<Explosion>();
foreach (Explosion obj in componentsInChildren)
{
s.SetField<Explosion>(obj, "team", (object)team);
obj.ignoreTeamMates = false;
obj.onlyTeamMates = true;
}
componentsInChildren = ((Component)((Component)this).transform.GetChild(0)).GetComponentsInChildren<Explosion>();
foreach (Explosion obj2 in componentsInChildren)
{
s.SetField<Explosion>(obj2, "team", (object)team);
obj2.ignoreTeamMates = false;
obj2.onlyTeamMates = true;
}
}
else
{
Explosion[] componentsInChildren = ((Component)this).GetComponentsInChildren<Explosion>();
foreach (Explosion obj3 in componentsInChildren)
{
s.SetField<Explosion>(obj3, "team", (object)team);
obj3.ignoreTeamMates = true;
obj3.onlyTeamMates = false;
}
componentsInChildren = ((Component)((Component)this).transform.GetChild(0)).GetComponentsInChildren<Explosion>();
foreach (Explosion obj4 in componentsInChildren)
{
s.SetField<Explosion>(obj4, "team", (object)team);
obj4.ignoreTeamMates = true;
obj4.onlyTeamMates = false;
}
}
}
}
}
public class Example : MonoBehaviour
{
public GameObject prefab;
private void Start()
{
if ((Object)(object)prefab != (Object)null)
{
Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>();
if (componentsInChildren.Length > 1)
{
_ = componentsInChildren[1];
}
}
}
}
namespace yanhua
{
public class AttackSpeedController
{
private AttackSpeedOverTimeEffect attackSpeedEffect;
private Unit unitInstance;
public float GetModifiedX()
{
return 1f * unitInstance.attackSpeedMultiplier;
}
public float GetDecaySpeed()
{
return attackSpeedEffect.decaySpeed;
}
public float GetDecaySpeed2()
{
return attackSpeedEffect.scalingDecaySpeed;
}
public float GetDecaySpeed3()
{
return attackSpeedEffect.dragWhenAdd;
}
public AttackSpeedController(AttackSpeedOverTimeEffect effect, Unit unitInstance)
{
attackSpeedEffect = effect;
this.unitInstance = unitInstance;
}
}
public class YourOtherClass
{
private AttackSpeedController attackSpeedController;
private AttackSpeedController unitattack;
public void UpdateX()
{
float modifiedX = attackSpeedController.GetModifiedX();
UManager.bundleMod.GetAssetBundle("sss").LoadAsset<GameObject>("Move_KnockBackArrow 1").GetComponentInChildren<ConditionalEvent>()
.events[0].SetMoveConditionalValue((ConditionType)0, (ValueType)0, modifiedX);
}
public YourOtherClass(AttackSpeedOverTimeEffect effect, Unit unit)
{
}
}
public class SCModTools
{
public static UnitBlueprint CloneUnit(DatabaseID targetID)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
Dictionary<DatabaseID, UnitBlueprint> dictionary = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().LandfallContentDatabase);
if (dictionary.TryGetValue(targetID, out var value))
{
UnitBlueprint val = Object.Instantiate<UnitBlueprint>(value);
((Object)val).name = value.Entity.Name + "_Clone";
val.Entity.Name = value.Entity.Name + "_Clone";
val.Entity.GenerateNewID();
dictionary.Add(val.Entity.GUID, val);
typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().LandfallContentDatabase, dictionary);
return val;
}
return null;
}
public extern void GetSprite();
public static Sprite GetSprite(string name)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
Texture2D val = new Texture2D(4, 4);
byte[] array = new byte[stream.Length];
stream.Read(array, 0, (int)stream.Length);
ImageConversion.LoadImage(val, array);
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
}
}