using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JoshsItems")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bb62809721ca8ba1d04869556b22a00aaf5040ac")]
[assembly: AssemblyProduct("JoshsItems")]
[assembly: AssemblyTitle("JoshsItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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;
}
}
}
namespace JoshsItems
{
internal static class JoshsEquipment
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<ExpansionDef, bool> <>9__3_0;
public static hook_PerformEquipmentAction <>9__5_0;
internal bool <GenerateEquipment>b__3_0(ExpansionDef def)
{
return def.nameToken == "DLC1_NAME";
}
internal bool <Hooks>b__5_0(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
{
if ((Object)(object)equipmentDef == (Object)(object)joshsWatchRepairKit)
{
return ActivateEquipment(self);
}
return orig.Invoke(self, equipmentDef);
}
}
private static EquipmentDef joshsWatchRepairKit;
private static int timesUsed;
public static void Init()
{
GenerateEquipment();
}
private static void GenerateEquipment()
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
joshsWatchRepairKit = ScriptableObject.CreateInstance<EquipmentDef>();
((Object)joshsWatchRepairKit).name = "JoshsWatchRepairKit";
joshsWatchRepairKit.nameToken = "EQUIPMENT_JOSHSWATCHREPAIRKIT_NAME";
joshsWatchRepairKit.pickupToken = "EQUIPMENT_JOSHSWATCHREPAIRKIT_PICKUP";
joshsWatchRepairKit.descriptionToken = "EQUIPMENT_JOSHSWATCHREPAIRKIT_DESC";
joshsWatchRepairKit.loreToken = "EQUIPMENT_JOSHSWATCHREPAIRKIT_LORE";
AssetBundle val = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("JoshsItems.dll", "joshsitems"));
GameObject pickupModelPrefab = val.LoadAsset<GameObject>("watch repair kit2.prefab");
joshsWatchRepairKit.pickupIconSprite = val.LoadAsset<Sprite>("watch repair kit icon2.png");
joshsWatchRepairKit.pickupModelPrefab = pickupModelPrefab;
joshsWatchRepairKit.equipmentIndex = (EquipmentIndex)(-1);
joshsWatchRepairKit.requiredExpansion = ((IEnumerable<ExpansionDef>)(object)ExpansionCatalog.expansionDefs).FirstOrDefault((Func<ExpansionDef, bool>)((ExpansionDef def) => def.nameToken == "DLC1_NAME"));
joshsWatchRepairKit.unlockableDef = null;
joshsWatchRepairKit.canDrop = true;
joshsWatchRepairKit.cooldown = 100f;
ItemDisplayRuleDict val2 = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomEquipment(joshsWatchRepairKit, val2));
LanguageAPI.Add(joshsWatchRepairKit.nameToken, "Josh's Watch Repair Kit");
LanguageAPI.Add(joshsWatchRepairKit.pickupToken, "<style=cIsHealing>Restores</style> 1 broken <style=cIsUtility>Delicate Watch</style> on use. Cooldown <style=cIsDamage>increases</style> after 6 uses.");
LanguageAPI.Add(joshsWatchRepairKit.descriptionToken, "<style=cIsHealing>Restores</style> 1 broken <style=cIsUtility>Delicate Watch</style> on use. After 6 uses, the equipment cooldown <style=cIsDamage>increases</style> by <style=cStack>30%</style>.");
LanguageAPI.Add(joshsWatchRepairKit.loreToken, "<style=cMono>Friday-1500. Titanic Plains.</style>\r\n\r\nJ - Is that- a watch printer?\r\n\r\nM - Doooon't dude you're throwing the run just like last time!\r\n\r\nJ - Oh yeahhhh we're goin' all in.\r\n\r\n\r\n<style=cMono>Friday-1600. Siren's Call.</style>\r\n\r\n<style=cIsDamage>*CRACK*</style>.\r\n\r\nM - You just haaaaaad to get them didn't you.\r\n\r\nJ - Bad game bad game bad game bad game bad game bad game.......");
Hooks();
SetEquipmentVariables();
}
private static void SetEquipmentVariables()
{
timesUsed = 0;
}
private static void Hooks()
{
//IL_0014: 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_001f: Expected O, but got Unknown
object obj = <>c.<>9__5_0;
if (obj == null)
{
hook_PerformEquipmentAction val = (orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) => ((Object)(object)equipmentDef == (Object)(object)joshsWatchRepairKit) ? ActivateEquipment(self) : orig.Invoke(self, equipmentDef);
<>c.<>9__5_0 = val;
obj = (object)val;
}
EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)obj;
}
private static bool ActivateEquipment(EquipmentSlot self)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
CharacterBody characterBody = self.characterBody;
Inventory val = ((characterBody != null) ? characterBody.inventory : null);
if (!Object.op_Implicit((Object)(object)val))
{
return false;
}
ItemIndex itemIndex = Items.FragileDamageBonus._itemIndex;
ItemIndex itemIndex2 = Items.FragileDamageBonusConsumed._itemIndex;
PickupIndex val2 = PickupCatalog.FindPickupIndex(itemIndex);
if (val.GetItemCount(itemIndex2) > 0)
{
timesUsed++;
val.RemoveItem(itemIndex2, 1);
val.GiveItem(itemIndex, 1);
GenericPickupController.SendPickupMessage(PlayerCharacterMasterController.instances[0].master, val2);
if (timesUsed % 5 == 0)
{
float num = 1.3f;
EquipmentDef obj = joshsWatchRepairKit;
obj.cooldown *= num;
}
return true;
}
return false;
}
public static void Debug(string option)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
if (option == "F2")
{
Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform;
Log.Info($"Player pressed F2. Spawning our custom item at coordinates {transform.position}");
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(joshsWatchRepairKit.equipmentIndex), transform.position, transform.forward * 20f);
}
if (option == "F3")
{
ItemIndex itemIndex = Items.FragileDamageBonusConsumed._itemIndex;
Log.Info("Player pressed F3. Adding a Delicate Watch to the players inventory.");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItem(itemIndex, 1);
}
if (option == "F4")
{
Transform transform2 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform;
Log.Info("Player pressed F4.");
_ = PlayerCharacterMasterController.instances[0].master.inventory;
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Equipment.Blackhole._equipmentIndex), transform2.position, transform2.forward * 20f);
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Equipment.Cleanse._equipmentIndex), transform2.position, transform2.forward * 20f);
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Equipment.DroneBackup._equipmentIndex), transform2.position, transform2.forward * 20f);
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("romdotzip.JoshsItems", "JoshsItems", "1.0.0")]
public class JoshsItems : BaseUnityPlugin
{
public const string PluginGUID = "romdotzip.JoshsItems";
public const string PluginAuthor = "romdotzip";
public const string PluginName = "JoshsItems";
public const string PluginVersion = "1.0.0";
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
JoshsEquipment.Init();
((BaseUnityPlugin)this).Logger.LogMessage((object)"All items initialized");
}
}
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);
}
}
}