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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HG;
using On.RoR2.UI.LogBook;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.UI.LogBook;
using UnityEngine;
using UnityEngine.AddressableAssets;
[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 = "")]
[assembly: AssemblyCompany("AspectRecipes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AspectRecipes")]
[assembly: AssemblyTitle("AspectRecipes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ExamplePlugin
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}
namespace AspectRecipes
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("liquedator.AspectRecipes", "AspectRecipes", "1.0.7")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AspectRecipes : BaseUnityPlugin
{
public class myContentPack : IContentPackProvider
{
internal ContentPack contentPack = new ContentPack();
public static List<CraftableDef> Craftables = new List<CraftableDef>();
public string identifier => "liquedator.AspectRecipes";
public void Initialise()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddSelf);
}
private void AddSelf(AddContentPackProviderDelegate add)
{
add.Invoke((IContentPackProvider)(object)this);
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
contentPack.identifier = identifier;
contentPack.craftableDefs.Add(Craftables.ToArray());
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
}
public const string PluginGUID = "liquedator.AspectRecipes";
public const string PluginAuthor = "liquedator";
public const string PluginName = "AspectRecipes";
public const string PluginVersion = "1.0.7";
private const int numCraftables = 11;
public void Awake()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
createBlankCraftables();
new myContentPack().Initialise();
((ResourceAvailability)(ref PickupCatalog.availability)).CallWhenAvailable((Action)DefineRecipes);
LogBookController.BuildPickupEntries += new hook_BuildPickupEntries(addLogbookEntries);
LogBookController.BuildPickupEntries += new hook_BuildPickupEntries(moveAspectsToEnd);
((ResourceAvailability)(ref PickupCatalog.availability)).CallWhenAvailable((Action)addLogbookDescriptions);
}
private void DefineRecipes()
{
fillCraftable(myContentPack.Craftables[0], "EliteFireEquipment", 1, "HeadHunter", "FireballsOnHit");
fillCraftable(myContentPack.Craftables[1], "EliteAurelioniteEquipment", 1, "HeadHunter", "BoostAllStats");
fillCraftable(myContentPack.Craftables[2], "EliteIceEquipment", 1, "HeadHunter", "Icicle");
fillCraftable(myContentPack.Craftables[3], "EliteEarthEquipment", 1, "HeadHunter", "Plant");
fillCraftable(myContentPack.Craftables[4], "EliteBeadEquipment", 1, "HeadHunter", "LunarTrinket");
fillCraftable(myContentPack.Craftables[5], "ElitePoisonEquipment", 1, "HeadHunter", "NovaOnHeal");
fillCraftable(myContentPack.Craftables[6], "EliteLunarEquipment", 1, "HeadHunter", "ShinyPearl");
fillCraftable(myContentPack.Craftables[7], "EliteLightningEquipment", 1, "HeadHunter", "ShockNearby");
fillCraftable(myContentPack.Craftables[8], "EliteHauntedEquipment", 1, "HeadHunter", "GhostOnKill");
fillCraftable(myContentPack.Craftables[9], "EliteVoidEquipment", 1, "HeadHunter", "ExtraLifeVoid");
fillCraftable(myContentPack.Craftables[10], "EliteSecretSpeedEquipment", 1, "HeadHunter", "UtilitySkillMagazine");
}
private void fillCraftable(CraftableDef craftable, string aspect, int amount, string vultures, string itemB)
{
//IL_0003: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
ItemDef itemDef = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(vultures));
ItemDef itemDef2 = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(itemB));
EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex(aspect));
if (!Object.op_Implicit((Object)(object)itemDef) || !Object.op_Implicit((Object)(object)itemDef2) || !Object.op_Implicit((Object)(object)equipmentDef))
{
Debug.LogError((object)("[AspectRecipes] Missing def: equip=" + aspect + ", a=" + vultures + ", b=" + itemB));
craftable.recipes = Array.Empty<Recipe>();
craftable.pickup = null;
return;
}
Recipe[] array = (Recipe[])(object)new Recipe[1];
Recipe val = new Recipe();
val.amountToDrop = amount;
val.ingredients = (RecipeIngredient[])(object)new RecipeIngredient[2]
{
new RecipeIngredient
{
pickup = (Object)(object)ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(vultures))
},
new RecipeIngredient
{
pickup = (Object)(object)ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(itemB))
}
};
Recipe val2 = val;
craftable.pickup = (Object)(object)EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex(aspect));
array[0] = val2;
craftable.recipes = (Recipe[])(object)new Recipe[1] { val2 };
Debug.Log((object)("Added recipe " + vultures + " + " + itemB + " = " + aspect));
}
private void createBlankCraftables()
{
for (int i = 0; i < 11; i++)
{
CraftableDef val = ScriptableObject.CreateInstance<CraftableDef>();
((Object)val).name = "AspectRecipe #" + (i + 1);
myContentPack.Craftables.Add(val);
Debug.Log((object)("Added blank recipe " + ((Object)val).name));
}
}
private Entry[] addLogbookEntries(orig_BuildPickupEntries orig, Dictionary<ExpansionDef, bool> expansionAvailability)
{
List<EquipmentDef> list = new List<EquipmentDef>();
getEquipDefFromName("EliteGoldEquipment").dropOnDeathChance = 0f;
getEquipDefFromName("EliteVoidEquipment").dropOnDeathChance = 0f;
if (!Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetAspects") && !Chainloader.PluginInfos.ContainsKey("Wolfo.WolfoQoL"))
{
for (int i = 0; i < EliteCatalog.eliteDefs.Length; i++)
{
EquipmentDef eliteEquipmentDef = EliteCatalog.eliteDefs[i].eliteEquipmentDef;
if (eliteEquipmentDef.dropOnDeathChance != 0f)
{
list.Add(eliteEquipmentDef);
}
}
Debug.Log((object)"Done adding default aspects to list");
}
list.Add(getEquipDefFromName("EliteSecretSpeedEquipment"));
list.Add(getEquipDefFromName("EliteVoidEquipment"));
for (int j = 0; j < list.Count; j++)
{
list[j].canDrop = true;
}
Debug.Log((object)"Done enabling canDrop on aspects");
getEquipDefFromName("EliteLunarEquipment").isLunar = false;
Entry[] result = orig.Invoke(expansionAvailability);
for (int k = 0; k < list.Count; k++)
{
list[k].canDrop = false;
}
Debug.Log((object)"Done disabling canDrop on aspects");
getEquipDefFromName("EliteLunarEquipment").isLunar = true;
Debug.Log((object)"Done adding default aspects to logbook");
return result;
}
private Entry[] moveAspectsToEnd(orig_BuildPickupEntries orig, Dictionary<ExpansionDef, bool> expansionAvailability)
{
//IL_002d: 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)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_0049: Invalid comparison between Unknown and I4
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Entry[] array = orig.Invoke(expansionAvailability);
List<Entry> list = new List<Entry>(array.Length);
List<Entry> list2 = new List<Entry>();
for (int i = 0; i < array.Length; i++)
{
Entry item = array[i];
PickupIndex val = (PickupIndex)array[i].extraData;
PickupDef pickupDef = ((PickupIndex)(ref val)).pickupDef;
EquipmentIndex equipmentIndex = pickupDef.equipmentIndex;
if ((int)equipmentIndex != -1)
{
EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex);
if ((Object)(object)equipmentDef != (Object)null && ((Object)(object)equipmentDef.passiveBuffDef != (Object)null || equipmentDef.isBoss))
{
list2.Add(item);
}
else
{
list.Add(item);
}
}
else
{
list.Add(item);
}
}
list.AddRange(list2);
Debug.Log((object)"Done moving aspects to the end of the logbook");
return list.ToArray();
}
private void addLogbookDescriptions()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
string text = Path.Combine(Paths.PluginPath, "liquedator-AspectRecipes", "AspectRecipes", "voidelitepickupicon.png");
Debug.Log((object)("Obtaining sprite file from: " + text));
byte[] array = File.ReadAllBytes(text);
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
ImageConversion.LoadImage(val, array);
Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
getEquipDefFromName("EliteVoidEquipment").pickupIconSprite = val2;
PickupIndex val3 = PickupCatalog.FindPickupIndex(getEquipDefFromName("EliteVoidEquipment").equipmentIndex);
PickupDef pickupDef = PickupCatalog.GetPickupDef(val3);
pickupDef.iconSprite = val2;
pickupDef.iconTexture = (Texture)(object)val2.texture;
setVoidInfestorModel();
updateText("EQUIPMENT_AFFIXVOID_NAME", "From One Thousand Miles Under");
updateText("EQUIPMENT_AFFIXVOID_PICKUP", "Become an aspect of the Void.");
updateText("EQUIPMENT_AFFIXVOID_DESC", "Gain <style=cIsHealing>50% maximum health</style> but <style=cIsDamage>reduce base damage</style> by <style=cIsDamage>30%</style>.<br><style=cIsDamage>100%</style> chance on hit to apply a stack of <style=cIsDamage>collapse</style> on enemies for <style=cIsDamage>400%</style> TOTAL damage per stack after <style=cIsDamage>3</style> seconds.<br>Gain a <style=cIsUtility>bubble shield</style> which <style=cIsUtility>blocks</style> any single instance of damage. Recharges after <style=cIsUtility>15</style> seconds.");
updateText("EQUIPMENT_AFFIXSECRETSPEED_DESC", "Increase <style=cIsUtility>movement speed</style> and <style=cIsDamage>attack speed</style> by <style=cIsUtility>200%</style> and <style=cIsUtility>negate all fall damage</style>.<br>Allies within <style=cIsUtility>40m</style> also gain these buffs, which last for a further <style=cIsUtility>10</style> seconds upon leaving the radius.<br>Enemies within the same <style=cIsUtility>40m</style> radius have <style=cIsUtility>50%</style> reduced <style=cIsUtility>movement speed</style> and <style=cIsDamage>1%</style> reduced <style=cIsDamage>attack speed</style> for <style=cIsUtility>every percentage of movement speed</style> you have.<br>These debuffs last a further <style=cIsUtility>10</style> seconds upon leaving the radius.");
updateText("EQUIPMENT_AFFIXAURELIONITE_DESC", "Enemies drop a treasure on hit worth <style=cIsUtility>8 gold</style>, which <style=cIsUtility>scales over time</style>.<br>On activation, summon a golden <style=cIsDamage>spike attack</style> consisting of <style=cIsDamage>2 pulses</style>.<br>The outer ring does <style=cIsDamage>15% damage</style>, followed by the inner ring which does <style=cIsDamage>150% damage</style>.");
updateText("EQUIPMENT_AFFIXBEAD_DESC", "<style=cIsUtility>Tether</style> to <style=cIsUtility>5 nearby allies</style> in a <style=cIsUtility>35m</style> radius.<br>Tethered allies gain <style=cIsHealing>300 armor</style> and when hit, begin to charge a <style=cIsDamage>lunar spike ball</style>.<br>After being hit <style=cIsDamage>10</style> times, the ball is <style=cIsDamage>fired</style>, locking on to a target and dealing <style=cIsDamage>100%</style> damage. Applies <style=cIsDamage>lunar ruin</style>.");
updateText("EQUIPMENT_AFFIXRED_DESC", "Leave behind a <style=cIsDamage>trail of fire</style> which deals <style=cIsDamage>150%</style> damage <style=cIsDamage>per second</style>.<br><style=cIsDamage>100%</style> chance on hit to <style=cIsDamage>burn</style> enemies for <style=cIsDamage>50%</style> TOTAL damage over time.");
updateText("EQUIPMENT_AFFIXBLUE_DESC", "<style=cIsHealing>Convert 50%</style> of your <style=cIsHealing>maximum health</style> into <style=cIsHealing>regenerating shields</style>.<br><style=cIsDamage>100%</style> chance on hit to attach <style=cIsDamage>lightning bombs</style> to enemies which <style=cIsDamage>explode</style> after a short delay, dealing <style=cIsDamage>50%</style> TOTAL damage.");
updateText("EQUIPMENT_AFFIXWHITE_DESC", "<style=cIsUtility>100%</style> chance on hit to <style=cIsUtility>greatly slow</style> enemies, reducing their <style=cIsUtility>movement speed</style> by <style=cIsUtility>80%</style>.<br><color=#FF7F7F>On death</color>, <style=cIsDamage>explode</style> in a small area, dealing <style=cIsDamage>150%</style> damage and <style=cIsDamage>freezing</style> enemies in the explosion.");
updateText("EQUIPMENT_AFFIXPOISON_DESC", "Disable <style=cIsHealing>healing</style> on hit for <style=cIsHealing>8</style> seconds.<br>Periodically release <style=cIsDamage>spiky balls</style>, which deal <style=cIsDamage>100%</style> damage and sprout <style=cIsDamage>spike pits</style> which deal <style=cIsDamage>100%</style> contact damage.<br><color=#FF7F7F>On death</color>, spawn a <style=cIsDamage>Malachite Urchin</style> which shoots at nearby enemies.");
updateText("EQUIPMENT_AFFIXHAUNTED_DESC", "<style=cIsUtility>100%</style> chance on hit to <style=cIsUtility>greatly slow</style> enemies, reducing their <style=cIsUtility>movement speed</style> by <style=cIsUtility>80%</style>.<br>Gain a <style=cIsUtility>30m</style> aura which <style=cIsUtility>cloaks</style> allies within and makes them <style=cIsUtility>invisible</style>.");
updateText("EQUIPMENT_AFFIXEARTH_DESC", "<style=cIsHealing>Heal</style> the nearest damaged ally within <style=cIsHealing>30m</style> for <style=cIsHealing>40%</style> base damage <style=cIsHealing>4 times</style> per second.<br><color=#FF7F7F>On death</color>, spawn a destructible <style=cIsHealing>healing core</style> which explodes after a few seconds, <style=cIsHealing>healing</style> all entities within for <style=cIsHealing>80 hp</style>.");
updateText("EQUIPMENT_AFFIXLUNAR_DESC", "<style=cIsDamage>100%</style> chance on hit to <style=cIsDamage>cripple</style> enemies, reducing their <style=cIsDamage>armor</style> by <style=cIsDamage>20%</style> and their <style=cIsUtility>movement speed</style> by <style=cIsUtility>50%</style>.<br>Gain <style=cIsHealing>25% maximum health</style>. <style=cIsHealing>Convert</style> all but <style=cIsHealing>1 health</style> into <style=cIsHealing>regenerating shields</style>.<br>Gain <style=cIsUtility>30% movement speed</style>.");
updateText("EQUIPMENT_AFFIXCOLLECTIVE_DESC", "Gain a <style=cIsUtility>30m</style> dome which <style=cIsUtility>blocks projectiles</style> and <style=cIsUtility>reduces</style> ally and self cooldowns by <style=cIsUtility>20%</style>.<br><color=#FF7F7F>On death</color>, <style=cIsDamage>explode</style> for <style=cIsDamage>100%</style> damage and <style=cIsUtility>disable</style> items for <style=cIsUtility>2.5</style> seconds.");
}
private void updateText(string token, string desc)
{
LanguageAPI.Add(token, desc);
}
private EquipmentDef getEquipDefFromName(string name)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(name);
EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val);
Debug.Log((object)("Returning " + name + " as an equipmentDef"));
return equipmentDef;
}
private void setVoidInfestorModel()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
EquipmentDef equipDefFromName = getEquipDefFromName("EliteVoidEquipment");
PickupIndex val = PickupCatalog.FindPickupIndex(equipDefFromName.equipmentIndex);
PickupDef pickupDef = PickupCatalog.GetPickupDef(val);
GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteVoid/DisplayAffixVoid.prefab").WaitForCompletion();
GameObject val3 = PrefabAPI.InstantiateClone(val2, "PickupAffixVoid_AspectRecipes", false);
val3.transform.GetChild(0).GetChild(2).SetAsFirstSibling();
val3.transform.GetChild(1).localPosition = new Vector3(0f, 0.7f, 0f);
val3.transform.GetChild(1).GetChild(0).localPosition = new Vector3(0f, -0.5f, -0.6f);
val3.transform.GetChild(1).GetChild(0).localScale = new Vector3(1.5f, 1.5f, 1.5f);
((Component)val3.transform.GetChild(1).GetChild(1)).gameObject.SetActive(false);
((Component)val3.transform.GetChild(1).GetChild(3)).gameObject.SetActive(false);
val3.transform.GetChild(0).eulerAngles = new Vector3(310f, 0f, 0f);
val3.transform.GetChild(0).localScale = new Vector3(0.75f, 0.75f, 0.75f);
ItemDisplay component = val3.GetComponent<ItemDisplay>();
ItemDisplay component2 = val3.GetComponent<ItemDisplay>();
ArrayUtils.ArrayRemoveAtAndResize<RendererInfo>(ref component2.rendererInfos, 4, 1);
ModelPanelParameters val4 = val3.AddComponent<ModelPanelParameters>();
val4.modelRotation = Quaternion.Euler(-20f, -45f, 0f);
equipDefFromName.pickupModelReference = new AssetReferenceT<GameObject>("");
equipDefFromName.pickupModelPrefab = val3;
pickupDef.displayPrefab = val3;
}
}
}