using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WendigoTrench")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WendigoTrench")]
[assembly: AssemblyTitle("WendigoTrench")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
public class AddSpeedToUnit : MonoBehaviour
{
public float speed;
public void Start()
{
((Component)((Component)this).transform.parent).GetComponentInChildren<MovementHandler>().multiplier = speed;
}
}
namespace WendigoTrench
{
[BepInPlugin("org.bepinex.plugins.WendigoTrench", "WendigoTrench", "1.0.0")]
internal class Loader : BaseUnityPlugin
{
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
Harmony val = new Harmony("WendigoTrench");
val.PatchAll();
GameObject val2 = new GameObject("WendigoTrench");
Object.DontDestroyOnLoad((Object)(object)val2);
val2.AddComponent<LoadStuff>();
val2.AddComponent<Main>();
}
}
public class LoadStuff : MonoBehaviour
{
public static void LoadAssets(bool reload)
{
//IL_0439: Unknown result type (might be due to invalid IL or missing references)
//IL_0454: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0564: Unknown result type (might be due to invalid IL or missing references)
//IL_057f: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Unknown result type (might be due to invalid IL or missing references)
//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0630: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
//IL_075b: Unknown result type (might be due to invalid IL or missing references)
//IL_065f: Unknown result type (might be due to invalid IL or missing references)
//IL_064a: Unknown result type (might be due to invalid IL or missing references)
//IL_054e: Unknown result type (might be due to invalid IL or missing references)
//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
//IL_08fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0886: Unknown result type (might be due to invalid IL or missing references)
//IL_078a: Unknown result type (might be due to invalid IL or missing references)
//IL_0775: Unknown result type (might be due to invalid IL or missing references)
//IL_0679: Unknown result type (might be due to invalid IL or missing references)
//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
//IL_08a0: Unknown result type (might be due to invalid IL or missing references)
//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
//IL_09c1: Unknown result type (might be due to invalid IL or missing references)
//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "WendigoTrench");
if (!Directory.Exists(path))
{
Debug.LogError((object)"No WendigoTrench Folder Exists!!!");
return;
}
string[] files = Directory.GetFiles(path);
if (files.Count() < 1)
{
Debug.LogError((object)"No Bundles in WendigoTrench Folder!!!");
return;
}
string[] array = files;
foreach (string text in array)
{
if (reload)
{
AssetBundle.UnloadAllAssetBundles(true);
}
AssetBundle val = AssetBundle.LoadFromFile(text);
List<GameObject> list = val.LoadAllAssets<GameObject>().ToList();
List<WeaponItem> list2 = (from x in list
where (Object)(object)x.GetComponent<WeaponItem>() != (Object)null
select x.GetComponent<WeaponItem>()).ToList();
List<ProjectileEntity> list3 = (from x in list
where (Object)(object)x.GetComponent<ProjectileEntity>() != (Object)null
select x.GetComponent<ProjectileEntity>()).ToList();
List<SpecialAbility> list4 = (from x in list
where (Object)(object)x.GetComponent<SpecialAbility>() != (Object)null
select x.GetComponent<SpecialAbility>()).ToList();
List<PropItem> list5 = (from x in list
where (Object)(object)x.GetComponent<PropItem>() != (Object)null
select x.GetComponent<PropItem>()).ToList();
List<UnitBlueprint> list6 = val.LoadAllAssets<UnitBlueprint>().ToList();
List<Faction> list7 = val.LoadAllAssets<Faction>().ToList();
Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
if (list.Count > 0)
{
Dictionary<DatabaseID, GameObject> dictionary2 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_unitBases", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (GameObject item in list)
{
Unit component = item.GetComponent<Unit>();
if (!((Object)(object)component != (Object)null))
{
continue;
}
if (reload)
{
if (dictionary2.ContainsKey(component.Entity.GUID))
{
dictionary2.Remove(component.Entity.GUID);
}
if (dictionary.ContainsKey(component.Entity.GUID))
{
dictionary.Remove(component.Entity.GUID);
}
}
dictionary2.Add(component.Entity.GUID, item.gameObject);
dictionary.Add(component.Entity.GUID, (Object)(object)item.gameObject);
}
typeof(LandfallContentDatabase).GetField("m_unitBases", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary2);
}
if (list2.Count > 0)
{
Dictionary<DatabaseID, GameObject> dictionary3 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_weapons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (WeaponItem item2 in list2)
{
if (reload)
{
if (dictionary3.ContainsKey(((CharacterItem)item2).Entity.GUID))
{
dictionary3.Remove(((CharacterItem)item2).Entity.GUID);
}
if (dictionary.ContainsKey(((CharacterItem)item2).Entity.GUID))
{
dictionary.Remove(((CharacterItem)item2).Entity.GUID);
}
}
dictionary3.Add(((CharacterItem)item2).Entity.GUID, ((Component)item2).gameObject);
dictionary.Add(((CharacterItem)item2).Entity.GUID, (Object)(object)((Component)item2).gameObject);
}
typeof(LandfallContentDatabase).GetField("m_weapons", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary3);
}
if (list3.Count > 0)
{
Dictionary<DatabaseID, GameObject> dictionary4 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_projectiles", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (ProjectileEntity item3 in list3)
{
if (reload)
{
if (dictionary4.ContainsKey(item3.Entity.GUID))
{
dictionary4.Remove(item3.Entity.GUID);
}
if (dictionary.ContainsKey(item3.Entity.GUID))
{
dictionary.Remove(item3.Entity.GUID);
}
}
dictionary4.Add(item3.Entity.GUID, ((Component)item3).gameObject);
dictionary.Add(item3.Entity.GUID, (Object)(object)((Component)item3).gameObject);
}
typeof(LandfallContentDatabase).GetField("m_projectiles", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary4);
}
if (list4.Count > 0)
{
Dictionary<DatabaseID, GameObject> dictionary5 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_combatMoves", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (SpecialAbility item4 in list4)
{
if (reload)
{
if (dictionary5.ContainsKey(((CharacterItem)item4).Entity.GUID))
{
dictionary5.Remove(((CharacterItem)item4).Entity.GUID);
}
if (dictionary.ContainsKey(((CharacterItem)item4).Entity.GUID))
{
dictionary.Remove(((CharacterItem)item4).Entity.GUID);
}
}
dictionary5.Add(((CharacterItem)item4).Entity.GUID, ((Component)item4).gameObject);
dictionary.Add(((CharacterItem)item4).Entity.GUID, (Object)(object)((Component)item4).gameObject);
}
typeof(LandfallContentDatabase).GetField("m_combatMoves", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary5);
}
if (list5.Count > 0)
{
Dictionary<DatabaseID, GameObject> dictionary6 = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_characterProps", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (PropItem item5 in list5)
{
if (reload)
{
if (dictionary6.ContainsKey(((CharacterItem)item5).Entity.GUID))
{
dictionary6.Remove(((CharacterItem)item5).Entity.GUID);
}
if (dictionary.ContainsKey(((CharacterItem)item5).Entity.GUID))
{
dictionary.Remove(((CharacterItem)item5).Entity.GUID);
}
}
dictionary6.Add(((CharacterItem)item5).Entity.GUID, ((Component)item5).gameObject);
dictionary.Add(((CharacterItem)item5).Entity.GUID, (Object)(object)((Component)item5).gameObject);
}
typeof(LandfallContentDatabase).GetField("m_characterProps", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary6);
}
if (list6.Count > 0)
{
Dictionary<DatabaseID, UnitBlueprint> dictionary7 = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (UnitBlueprint item6 in list6)
{
if (reload)
{
if (dictionary7.ContainsKey(item6.Entity.GUID))
{
dictionary7.Remove(item6.Entity.GUID);
}
if (dictionary.ContainsKey(item6.Entity.GUID))
{
dictionary.Remove(item6.Entity.GUID);
}
}
dictionary7.Add(item6.Entity.GUID, item6);
dictionary.Add(item6.Entity.GUID, (Object)(object)item6);
}
typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary7);
}
if (list7.Count <= 0)
{
continue;
}
Dictionary<DatabaseID, Faction> dictionary8 = (Dictionary<DatabaseID, Faction>)typeof(LandfallContentDatabase).GetField("m_factions", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(landfallContentDatabase);
foreach (Faction item7 in list7)
{
if (reload)
{
if (dictionary8.ContainsKey(item7.Entity.GUID))
{
dictionary8.Remove(item7.Entity.GUID);
}
if (dictionary.ContainsKey(item7.Entity.GUID))
{
dictionary.Remove(item7.Entity.GUID);
}
}
dictionary8.Add(item7.Entity.GUID, item7);
dictionary.Add(item7.Entity.GUID, (Object)(object)item7);
}
typeof(LandfallContentDatabase).GetField("m_factions", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(landfallContentDatabase, dictionary8);
}
}
}
public class Main : MonoBehaviour
{
public void Awake()
{
Debug.Log((object)"Loaded WendigoTrench Successfully!");
LoadStuff.LoadAssets(reload: false);
}
}
public class WeaponSwap : MonoBehaviour
{
private DataHandler Data;
public float DistanceTillSwap = 5f;
public GameObject rangedWeapon;
public GameObject meleeWeapon;
public GameObject meleeOffhand;
public bool swapToAxe = false;
private void Start()
{
Data = ((Component)((Component)this).transform.parent).GetComponentInChildren<DataHandler>();
}
private void Update()
{
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Expected O, but got Unknown
//IL_00e8: 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_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
if ((Object)(object)Data == (Object)null)
{
Debug.LogError((object)"DATA IS NULL!!!!");
}
else
{
if (!((Object)(object)Data.targetData != (Object)null))
{
return;
}
if (Data.distanceToTarget < DistanceTillSwap)
{
if (!swapToAxe)
{
GameObject gameObject = ((Component)Data.unit.holdingHandler.rightObject).gameObject;
Data.unit.holdingHandler.LetGoOfWeapon(gameObject);
gameObject.AddComponent<RemoveAfterSeconds>().seconds = 0f;
Data.unit.unitBlueprint.holdinigWithTwoHands = false;
Data.unit.unitBlueprint.SetWeapon(Data.unit, Data.unit.Team, meleeWeapon, new PropItemData(), (HandType)1, Data.mainRig.rotation, new List<GameObject>(), false);
swapToAxe = true;
}
}
else if (swapToAxe)
{
GameObject gameObject2 = ((Component)Data.unit.holdingHandler.leftObject).gameObject;
Data.unit.holdingHandler.LetGoOfWeapon(gameObject2);
gameObject2.AddComponent<RemoveAfterSeconds>().seconds = 0f;
Data.unit.unitBlueprint.holdinigWithTwoHands = true;
Data.unit.unitBlueprint.SetWeapon(Data.unit, Data.unit.Team, rangedWeapon, new PropItemData(), (HandType)0, Data.mainRig.rotation, new List<GameObject>(), false);
swapToAxe = false;
}
}
}
}
}