using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RingsGaloreApi;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("MeuModMuck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MeuModMuck")]
[assembly: AssemblyTitle("MeuModMuck")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("davipereiraoliveira_DaviRing", "Davi Ring", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MeuMod : BaseUnityPlugin
{
[HarmonyPatch(typeof(ItemManager), "InitAllItems")]
private class Patch_Items
{
[HarmonyPatch(typeof(CraftingUI), "Start")]
private class Patch_Crafting
{
public static bool jacrido;
private static void Postfix(CraftingUI __instance)
{
if (jacrido)
{
return;
}
Debug.Log((object)"Injetando receitas custom...");
Tab[] tabs = __instance.tabs;
foreach (Tab val in tabs)
{
if (Array.TrueForAll(val.items, (InventoryItem item) => (int)item.type == 3))
{
if (!val.items.Contains(meuItem))
{
val.items = val.items.Concat(anvilWeapons).ToArray();
Debug.Log((object)"Craft adicionado!");
}
break;
}
}
}
}
private static void Postfix(ItemManager __instance)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0074: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: 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_0176: Expected O, but got Unknown
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Expected O, but got Unknown
meuItem = CriarAnel(__instance, "Speed Ring", "Run like the wind", delegate(AccessoryComponent effects)
{
effects.FlatSpeed = 0.2f;
effects.AttackSpeedMult = 1.1f;
}, 75);
InventoryItem item = __instance.allItems[89];
InventoryItem item2 = __instance.allItems[7];
meuItem.requirements = (CraftRequirement[])(object)new CraftRequirement[2]
{
new CraftRequirement
{
item = item,
amount = 10
},
new CraftRequirement
{
item = item2,
amount = 1
}
};
meuItem2 = CriarAnel(__instance, "Tank Ring", "Become a walking wall", delegate(AccessoryComponent effects)
{
effects.FlatDefense = 20f;
effects.FlatExtraHP = 50f;
}, 81);
InventoryItem item3 = __instance.allItems[28];
meuItem2.requirements = (CraftRequirement[])(object)new CraftRequirement[2]
{
new CraftRequirement
{
item = item,
amount = 10
},
new CraftRequirement
{
item = item3,
amount = 1
}
};
meuItem3 = CriarAnel(__instance, "Vampire Ring", "Steal life from enemies", delegate(AccessoryComponent effects)
{
effects.FlatLifeSteal = 0.05f;
effects.FlatAttackSpeed = 0.3f;
}, 74);
InventoryItem item4 = __instance.allItems[62];
meuItem3.requirements = (CraftRequirement[])(object)new CraftRequirement[2]
{
new CraftRequirement
{
item = item,
amount = 10
},
new CraftRequirement
{
item = item4,
amount = 1
}
};
}
}
private static HashSet<string> efeitosRegistrados = new HashSet<string>();
public static bool efeitojaregistrado = false;
public static int meuItemId;
public static InventoryItem meuItem;
public static int meuItemId2;
public static InventoryItem meuItem2;
public static int meuItemId3;
public static InventoryItem meuItem3;
public static List<InventoryItem> anvilWeapons = new List<InventoryItem>();
private static InventoryItem CriarAnel(ItemManager __instance, string nome, string descricao, Action<AccessoryComponent> aplicarEfeito, int idvisual)
{
InventoryItem val = ((IEnumerable<InventoryItem>)__instance.allItems.Values).FirstOrDefault((Func<InventoryItem, bool>)((InventoryItem i) => i.name == nome));
if ((Object)(object)val != (Object)null)
{
Debug.Log((object)(nome + " já existe!"));
return val;
}
InventoryItem val2 = __instance.allItems[118];
InventoryItem val3 = __instance.allItems[47];
InventoryItem val4 = __instance.allItems[idvisual];
InventoryItem item = Object.Instantiate<InventoryItem>(val4);
item.name = nome;
item.description = descricao;
item.stackable = false;
item.material = val4.material;
item.unlockWithFirstRequirementOnly = true;
item.stationRequirement = val3.stationRequirement;
item.craftable = true;
item.requirements = ((IEnumerable<CraftRequirement>)val3.requirements).Select((Func<CraftRequirement, CraftRequirement>)((CraftRequirement r) => new CraftRequirement
{
item = r.item,
amount = r.amount
})).ToArray();
int count = __instance.allItems.Count;
item.id = count;
__instance.allItems.Add(count, item);
if (!anvilWeapons.Any((InventoryItem i) => i.name == item.name))
{
anvilWeapons.Add(item);
}
Main.AddItemToRingSlot(item);
AccessoryComponent val5 = ScriptableObject.CreateInstance<AccessoryComponent>();
aplicarEfeito(val5);
if (!efeitosRegistrados.Contains(item.name))
{
Main.AddItemEffects(item.name, val5);
efeitosRegistrados.Add(item.name);
}
Debug.Log((object)("Anel criado: " + nome));
return item;
}
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("meu.mod.aneispoderosos");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod carregado.");
}
}
namespace DaviRings
{
public class Class1
{
}
}