using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EntityStates.TeleporterHealNovaController;
using Microsoft.CodeAnalysis;
using On.EntityStates.TeleporterHealNovaController;
using R2API;
using RoR2;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[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 ExamplePlugin
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Phorg.Redemption", "Redemption", "1.0.0")]
public class ExamplePlugin : BaseUnityPlugin
{
public const string PluginGUID = "Phorg.Redemption";
public const string PluginAuthor = "Phorg";
public const string PluginName = "Redemption";
public const string PluginVersion = "1.0.0";
private static bool pulseHooked;
public void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
GameObject val = new GameObject("InputMonitor");
val.AddComponent<InputMonitor>();
Object.DontDestroyOnLoad((Object)(object)val);
Language.onCurrentLanguageChanged += RegisterLanguage;
try
{
if (!pulseHooked)
{
TeleporterHealNovaGeneratorMain.Pulse += new hook_Pulse(RestoreConsumedItem);
pulseHooked = true;
}
}
catch (Exception ex)
{
Log.Error(ex.Message + " - " + ex.StackTrace);
}
}
private void RegisterLanguage()
{
Log.Info("Registering language tokens");
LanguageAPI.Add("ITEM_TPHEALINGNOVA_NAME", "Redemption");
LanguageAPI.Add("ITEM_TPHEALINGNOVA_PICKUP", "Calls down a healing aura. Restores a broken item upon activation.");
LanguageAPI.Add("ITEM_TPHEALINGNOVA_DESC", "Release a <style=cIsHealing>healing nova</style> during the Teleporter event, <style=cIsHealing>healing</style> all nearby allies for <style=cIsHealing>50%</style> of their maximum health and <style=cIsUtility>restores one broken item</style>. Occurs <style=cIsHealing>1</style> <style=cStack>(+1 per stack)</style> times.");
}
private void RestoreConsumedItem(orig_Pulse orig, TeleporterHealNovaGeneratorMain self)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Expected I4, but got Unknown
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Expected I4, but got Unknown
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
try
{
foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
{
if (!Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) || (int)readOnlyInstances.teamComponent.teamIndex != 1)
{
continue;
}
Inventory inventory = readOnlyInstances.inventory;
Dictionary<ItemIndex, ItemIndex> dictionary = new Dictionary<ItemIndex, ItemIndex>();
try
{
dictionary[Items.FragileDamageBonusConsumed.itemIndex] = Items.FragileDamageBonus.itemIndex;
dictionary[Items.HealingPotionConsumed.itemIndex] = Items.HealingPotion.itemIndex;
dictionary[Items.ExtraLifeConsumed.itemIndex] = Items.ExtraLife.itemIndex;
dictionary[Items.LowerPricedChestsConsumed.itemIndex] = Items.LowerPricedChests.itemIndex;
dictionary[Items.TeleportOnLowHealthConsumed.itemIndex] = Items.TeleportOnLowHealth.itemIndex;
dictionary[Items.ExtraLifeVoidConsumed.itemIndex] = Items.ExtraLifeVoid.itemIndex;
dictionary[Items.RegeneratingScrapConsumed.itemIndex] = Items.RegeneratingScrap.itemIndex;
}
catch (Exception ex)
{
Log.Error("Error building item map: " + ex);
break;
}
List<(string, int)> list = new List<(string, int)>();
foreach (KeyValuePair<ItemIndex, ItemIndex> item in dictionary)
{
int itemCount = inventory.GetItemCount(item.Key);
for (int i = 0; i < itemCount; i++)
{
list.Add(("item", (int)item.Key));
}
}
if (inventory.GetEquipmentIndex() == Equipment.BossHunterConsumed.equipmentIndex)
{
list.Add(("equipment", (int)Equipment.BossHunterConsumed.equipmentIndex));
}
(string, int) tuple = list[Random.Range(0, list.Count)];
if (tuple.Item1 == "item")
{
ItemIndex val = (ItemIndex)tuple.Item2;
ItemIndex val2 = dictionary[val];
inventory.RemoveItem(val, 1);
inventory.GiveItem(val2, 1);
Chat.AddMessage("Restored item: " + Language.GetString(ItemCatalog.GetItemDef(val2).nameToken));
}
else if (tuple.Item1 == "equipment")
{
inventory.SetEquipmentIndex(Equipment.BossHunter.equipmentIndex);
Chat.AddMessage("Restored equipment");
}
}
}
catch (Exception ex2)
{
Debug.LogError((object)("[Redemption] Static init crash: " + ex2.Message + "\n " + ex2.StackTrace));
}
}
}
public class InputMonitor : MonoBehaviour
{
public void Update()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: 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)
if (Input.GetKeyDown((KeyCode)283))
{
Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform;
Log.Info($"Player pressed F2. Spawning redemption at coordinates {transform.position}");
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.TPHealingNova.itemIndex), transform.position, transform.forward * 20f);
}
Vector3 spawnPosition;
Vector3 forward;
if (Input.GetKeyDown((KeyCode)284))
{
Transform transform2 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform;
spawnPosition = transform2.position;
forward = transform2.forward;
Log.Info("Player pressed F3. Dropping Consumed Item");
DropItem(Items.ExtraLifeConsumed.itemIndex, 0f);
DropItem(Items.FragileDamageBonusConsumed.itemIndex, 30f);
DropItem(Items.HealingPotionConsumed.itemIndex, 60f);
DropItem(Items.RegeneratingScrapConsumed.itemIndex, 90f);
DropItem(Items.LowerPricedChestsConsumed.itemIndex, 120f);
}
void DropItem(ItemIndex index, float offsetAngle)
{
//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_000c: 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)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = Quaternion.AngleAxis(offsetAngle, Vector3.up);
Vector3 val2 = val * forward;
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(index), spawnPosition, val2 * 20f);
}
}
}
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);
}
}
}