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 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("Shovel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Shovel")]
[assembly: AssemblyTitle("Shovel")]
[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_Shovel", "Shovel", "1.0")]
public class MeuMod : BaseUnityPlugin
{
[HarmonyPatch(typeof(ItemManager), "InitAllItems")]
private class Patch_Items
{
[HarmonyPatch(typeof(CraftingUI), "Awake")]
private class Patch_Crafting
{
public static bool jacrido;
private static void Postfix(CraftingUI __instance)
{
Debug.Log((object)"Injetando receitas custom...");
Tab[] tabs = __instance.tabs;
foreach (Tab val in tabs)
{
bool flag = Array.TrueForAll(val.items, (InventoryItem item) => (int)item.type == 3);
if (flag)
{
val.items = val.items.Concat(anvilWeapons).ToArray();
break;
}
if (!flag)
{
val.items = val.items.Concat(anvilTools).ToArray();
break;
}
}
}
}
private static void Postfix(ItemManager __instance)
{
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//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_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Expected O, but got Unknown
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Expected O, but got Unknown
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
meuItem = CriarItem(__instance, "Shovell", "its shovel dig dig");
anvilWeapons.Add(meuItem);
meuItem2 = CriarItem(__instance, "Milkk", "testing item lol");
anvilTools.Add(meuItem2);
InventoryItem val = __instance.allItems[124];
meuItem.sprite = val.sprite;
meuItem.mesh = val.mesh;
meuItem.material = val.material;
InventoryItem val2 = __instance.allItems[130];
meuItem2.sprite = val2.sprite;
meuItem2.mesh = val2.mesh;
meuItem2.material = val2.material;
meuItem2.attackDamage = 15;
meuItem2.attackSpeed = 1.5f;
meuItem2.resourceDamage = 500;
InventoryItem item = __instance.allItems[94];
InventoryItem item2 = __instance.allItems[86];
InventoryItem item3 = __instance.allItems[65];
InventoryItem item4 = __instance.allItems[50];
meuItem.requirements = (CraftRequirement[])(object)new CraftRequirement[3]
{
new CraftRequirement
{
item = item,
amount = 10
},
new CraftRequirement
{
item = item2,
amount = 10
},
new CraftRequirement
{
item = item3,
amount = 1
}
};
meuItem2.requirements = (CraftRequirement[])(object)new CraftRequirement[1]
{
new CraftRequirement
{
item = item4,
amount = 100
}
};
Debug.Log((object)"Requirements definidos para Shovel!");
}
}
public static InventoryItem meuItem;
public static InventoryItem meuItem2;
public static List<InventoryItem> anvilWeapons = new List<InventoryItem>();
public static List<InventoryItem> anvilTools = new List<InventoryItem>();
private static InventoryItem CriarItem(ItemManager __instance, string nome, string descricao)
{
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
InventoryItem val = ((IEnumerable<InventoryItem>)__instance.allItems.Values).FirstOrDefault((Func<InventoryItem, bool>)((InventoryItem i) => i.name == nome));
if ((Object)(object)val != (Object)null)
{
return val;
}
InventoryItem val2 = __instance.allItems[128];
InventoryItem val3 = __instance.allItems[75];
InventoryItem val4 = Object.Instantiate<InventoryItem>(val3);
val4.name = nome;
val4.description = descricao;
val4.stackable = false;
val4.attackDamage = 110;
val4.attackSpeed = 0.95f;
val4.attackRange = 2.2f;
val4.unlockWithFirstRequirementOnly = true;
val4.stationRequirement = val3.stationRequirement;
val4.craftable = true;
val4.requirements = ((IEnumerable<CraftRequirement>)val2.requirements).Select((Func<CraftRequirement, CraftRequirement>)((CraftRequirement r) => new CraftRequirement
{
item = r.item,
amount = r.amount
})).ToArray();
val4.material = val2.material;
val4.mesh = val2.mesh;
val4.sprite = val2.sprite;
val4.scale = 2f;
val4.type = val2.type;
int key = (val4.id = __instance.allItems.Keys.Max() + 1);
__instance.allItems.Add(key, val4);
return val4;
}
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.shovel");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod carregado.");
}
}