using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
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("AzzymoofHistoricalWeaponPack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GeeztJeez")]
[assembly: AssemblyProduct("AzzymoofHistoricalWeaponPack")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7acfaef0-7669-4401-8bff-5a9a02e18c75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace AzzymoofMoreItems;
public static class UManager
{
public class Utility : MonoBehaviour
{
public static class PrimitiveHelper
{
private static Dictionary<PrimitiveType, Mesh> primitiveMeshes;
public static GameObject CreatePrimitive(PrimitiveType type, bool withCollider)
{
//IL_0017: 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_0022: 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)
//IL_0035: Expected O, but got Unknown
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
if (withCollider)
{
return GameObject.CreatePrimitive(type);
}
GameObject val = new GameObject(((object)(PrimitiveType)(ref type)).ToString());
val.AddComponent<MeshFilter>().sharedMesh = GetPrimitiveMesh(type);
val.AddComponent<MeshRenderer>();
return val;
}
public static Mesh GetPrimitiveMesh(PrimitiveType type)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if (!primitiveMeshes.ContainsKey(type))
{
CreatePrimitiveMesh(type);
}
return primitiveMeshes[type];
}
private static Mesh CreatePrimitiveMesh(PrimitiveType type)
{
//IL_0000: 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)
GameObject obj = GameObject.CreatePrimitive(type);
Mesh sharedMesh = obj.GetComponent<MeshFilter>().sharedMesh;
Object.Destroy((Object)(object)obj);
primitiveMeshes[type] = sharedMesh;
return sharedMesh;
}
static PrimitiveHelper()
{
primitiveMeshes = new Dictionary<PrimitiveType, Mesh>();
}
}
public static class ItemCategorizer
{
public static GameObject SetTag(GameObject item, string categoryName = "AzzyMoofMoreItems", TagType tagType = 0)
{
//IL_0018: 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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
try
{
CharacterItem componentInChildren = item.GetComponentInChildren<CharacterItem>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
componentInChildren.tags = new List<Tag>
{
new Tag
{
tagType = tagType,
value = categoryName
}
};
}
return item;
}
catch (Exception ex)
{
Debug.Log((object)ex);
return item;
}
}
}
public static Sprite LoadBundleTextureToSprite(string name)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0031: 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)
Texture2D val = (Texture2D)bundle.LoadAsset(name);
((Texture)val).filterMode = (FilterMode)0;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
public static GameObject LoadBundleGameObject(string name)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
return (GameObject)bundle.LoadAsset(name);
}
public static AudioClip LoadBundleAudioClip(string name)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
return (AudioClip)bundle.LoadAsset(name);
}
public static Material LoadBundleMaterial(string name)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
return (Material)bundle.LoadAsset(name);
}
public static RuntimeAnimatorController LoadBundleController(string name)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
return (RuntimeAnimatorController)bundle.LoadAsset(name);
}
public static void AddToUnitLib(GameObject UnitBaseObject)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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)
Unit component = UnitBaseObject.GetComponent<Unit>();
if ((Object)(object)component == (Object)null || component.Entity == null)
{
Debug.LogError((object)"UnitBaseObject does not contain a valid Unit or Entity component.");
return;
}
DatabaseID gUID = component.Entity.GUID;
Debug.Log((object)$"Attempting to add Unit with GUID: {gUID}");
unitBases.Add(UnitBaseObject.GetComponentInChildren<Unit>());
}
}
public static string comment;
public static AssetBundle bundle;
public static List<Unit> unitBases;
public static void Init(LandfallContentDatabase db)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
LoadBundle("azzymoofmoreitemsbundle");
Sprite val = (Sprite)SLMALoader.SDic["sprites"]["button_prompts_spritesheet_45"];
comment = "----------------------------------------------------------------------------------------------------------------------------";
comment = "Custom Weapons";
comment = "----------------------------------------------------------------------------------------------------------------------------";
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("BeardedAxe", Utility.LoadBundleGameObject("BeardedAxe"), true, (HideFlags)52, val, 63324232, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Naginata", Utility.LoadBundleGameObject("Naginata"), true, (HideFlags)52, val, 624432423, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VikingSpearMelee", Utility.LoadBundleGameObject("VikingSpearMelee"), true, (HideFlags)52, val, 65234322, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VikingSpearRanged", Utility.LoadBundleGameObject("VikingSpearRanged"), true, (HideFlags)52, val, 512321121, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LongAxe", Utility.LoadBundleGameObject("LongAxe"), true, (HideFlags)52, val, 512231221, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LongAxeSideway", Utility.LoadBundleGameObject("LongAxeSideway"), true, (HideFlags)52, val, 534321342, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("MedievalClub", Utility.LoadBundleGameObject("MedievalClub"), true, (HideFlags)52, val, 74352334, true), "AzzyMoofMoreItems", (TagType)0);
comment = "----------------------------------------------------------------------------------------------------------------------------";
comment = "Custom Clothing";
comment = "----------------------------------------------------------------------------------------------------------------------------";
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Jingasa", Utility.LoadBundleGameObject("Jingasa"), true, (HideFlags)52, val, 513421343, true), "AzzyMoofMoreItems", (TagType)0);
Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("MedievalKettleHelmet", Utility.LoadBundleGameObject("MedievalKettleHelmet"), true, (HideFlags)52, val, 53243241, true), "AzzyMoofMoreItems", (TagType)0);
}
public static void SetBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
{
}
public static void SetEffects(GameObject effect)
{
}
public static void SetExplosion(GameObject explosion)
{
}
public static void SetUnits(Unit unit, LandfallContentDatabase db)
{
}
public static void SetWeapon(GameObject weapon, HandType hand, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
{
}
public static void SetProjectile(GameObject proj, ProjectileHit projhit, LandfallContentDatabase db)
{
}
public static void SetCombatMove(GameObject move, DodgeMove dodge, BlockMove block, SpawnObject spawn, Cost cost, Wings wings, ReaperWings reaper, LandfallContentDatabase db)
{
}
public static void SetClothes(GameObject cloth, CharacterItem ci, Renderer render, MeshRenderer mesh, SkinnedMeshRenderer skinnedMesh, LandfallContentDatabase db)
{
}
public static void SetAllGameObject(GameObject all, LandfallContentDatabase db)
{
}
public static void LoadBundle(string assetBundleName)
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
bundle = AssetBundle.LoadFromStream(stream);
}
static UManager()
{
unitBases = new List<Unit>();
}
}
[BepInPlugin("GeeztJeez.AzzymoofMoreItems", "AzzymoofMoreItems", "1.0.1")]
internal class Loader : BaseUnityPlugin
{
public bool debug;
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 WaitForSeconds(0.01f);
Debug.Log((object)"Loading AzzymoofMoreItems!");
SLMALoader.GetInstance();
LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
UManager.Init(landfallContentDatabase);
new Harmony("AzzymoofMoreItems").PatchAll();
UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
for (int i = 0; i < array.Length; i++)
{
if (debug)
{
Debug.Log((object)("Blueprint currently debugged : " + array[i].Entity.Name));
}
UManager.SetBlueprint(array[i], landfallContentDatabase);
array[i].Validate();
}
GameObject[] array2 = Resources.FindObjectsOfTypeAll<GameObject>();
for (int j = 0; j < array2.Length; j++)
{
if (debug)
{
Debug.Log((object)("Current Debugged Game Object : " + ((Object)array2[j]).name));
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<Explosion>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Explosion : " + ((Object)array2[j]).name));
}
UManager.SetExplosion(array2[j]);
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<WeaponItem>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Weapon : " + ((Object)array2[j]).name));
}
UManager.SetWeapon(array2[j], array2[j].GetComponent<HandType>(), array2[j].GetComponent<Team>(), array2[j].GetComponent<Unit>(), array2[j].GetComponent<MeleeWeapon>(), array2[j].GetComponent<RangeWeapon>(), landfallContentDatabase);
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<MeleeWeapon>()))
{
array2[j].GetComponentInChildren<MeleeWeapon>().Validate();
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<RangeWeapon>()))
{
array2[j].GetComponentInChildren<RangeWeapon>().Validate();
}
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<ProjectileHit>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Projectile : " + ((Object)array2[j]).name));
}
UManager.SetProjectile(array2[j], array2[j].GetComponent<ProjectileHit>(), landfallContentDatabase);
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<PlaySoundEffect>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Effect : " + ((Object)array2[j]).name));
}
UManager.SetEffects(array2[j]);
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<Unit>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Unit : " + ((Object)array2[j]).name));
}
UManager.SetUnits(array2[j].GetComponent<Unit>(), landfallContentDatabase);
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<SpecialAbility>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Movement : " + ((Object)array2[j]).name));
}
UManager.SetCombatMove(array2[j], array2[j].GetComponent<DodgeMove>(), array2[j].GetComponent<BlockMove>(), array2[j].GetComponentInChildren<SpawnObject>(), array2[j].GetComponent<Cost>(), array2[j].GetComponent<Wings>(), array2[j].GetComponent<ReaperWings>(), landfallContentDatabase);
}
if (Object.op_Implicit((Object)(object)array2[j].GetComponent<PropItem>()))
{
if (debug)
{
Debug.Log((object)("Currently editing Clothing : " + ((Object)array2[j]).name));
}
UManager.SetClothes(array2[j], array2[j].GetComponent<CharacterItem>(), array2[j].GetComponent<Renderer>(), array2[j].GetComponent<MeshRenderer>(), array2[j].GetComponent<SkinnedMeshRenderer>(), landfallContentDatabase);
}
UManager.SetAllGameObject(array2[j], landfallContentDatabase);
if (Object.op_Implicit((Object)(object)array2[j].GetComponentInChildren<PlaySoundEffect>()))
{
if (debug)
{
Debug.Log((object)("Current Validated Sound Effect : " + ((Object)array2[j]).name));
}
PlaySoundEffect[] componentsInChildren = array2[j].GetComponentsInChildren<PlaySoundEffect>();
for (int k = 0; k < componentsInChildren.Length; k++)
{
componentsInChildren[k].Validate();
}
}
}
ServiceLocator.GetService<CustomContentLoaderModIO>().QuickRefresh((WorkshopContentType)5, (Action)null);
Debug.Log((object)"Successfully loaded AzzymoofMoreItems!");
}
}