using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Configuration;
using BepInEx.Logging;
using Fnaf2FoxyJumpScare;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using WinnersDoDrugs.Configuration;
using WinnersDoDrugs.Equipment;
using WinnersDoDrugs.Items;
[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("WinnersDoDrugs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4b0a31c744b9b73589be44b03e01172509d2a425")]
[assembly: AssemblyProduct("WinnersDoDrugs")]
[assembly: AssemblyTitle("WinnersDoDrugs")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 WinnersDoDrugs
{
public static class Helpers
{
public static GameObject PrepareItemDisplayModel(GameObject itemDisplayModel)
{
//IL_0022: 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_0041: 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)
ItemDisplay val = itemDisplayModel.AddComponent<ItemDisplay>();
List<RendererInfo> list = new List<RendererInfo>();
Renderer[] componentsInChildren = itemDisplayModel.GetComponentsInChildren<Renderer>();
foreach (Renderer val2 in componentsInChildren)
{
RendererInfo val3 = default(RendererInfo);
val3.renderer = val2;
val3.defaultMaterial = val2.material;
RendererInfo item = val3;
list.Add(item);
}
val.rendererInfos = list.ToArray();
return itemDisplayModel;
}
}
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);
}
}
[BepInPlugin("com.Hex3.WinnersDoDrugs", "WinnersDoDrugs", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_OnMainMenuControllerInitialized <>9__8_0;
internal void <Awake>b__8_0(orig_OnMainMenuControllerInitialized orig, RoR2Application self)
{
ItemInit.FormatDescriptions();
orig.Invoke(self);
}
}
public const string WINNERSDODRUGS_GUID = "com.Hex3.WinnersDoDrugs";
public const string WINNERSDODRUGS_NAME = "WinnersDoDrugs";
public const string WINNERSDODRUGS_VER = "1.0.0";
public static Main Instance;
public static ExpansionDef Expansion;
public static AssetBundle Assets;
public static AssetBundle Assets2;
public static ConfigEntry<bool> Config_Enabled;
public void Awake()
{
//IL_0072: 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_008d: Expected O, but got Unknown
//IL_008d: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
Log.Info("Init WinnersDoDrugs 1.0.0");
Instance = this;
Log.Info("Creating assets...");
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WinnersDoDrugs.drugsvfx"))
{
Assets = AssetBundle.LoadFromStream(stream);
}
Log.Info("Creating config...");
Config_Enabled = ((BaseUnityPlugin)Instance).Config.Bind<bool>(new ConfigDefinition("CONFIG - IMPORTANT", "Enable custom config"), false, new ConfigDescription("Set to 'true' to enable custom configuration for this mod. False by default to allow balance changes to take effect.", (AcceptableValueBase)null, Array.Empty<object>()));
ModSettingsManager.SetModDescription("Adds several game-breaking and unbalanced items.");
ModSettingsManager.SetModIcon(Assets.LoadAsset<Sprite>("Assets/icons/expansionWdd.png"));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Config_Enabled, true));
Log.Info("Creating expansion...");
Expansion = ScriptableObject.CreateInstance<ExpansionDef>();
((Object)Expansion).name = "WinnersDoDrugs";
Expansion.nameToken = "WDD_EXPANSION_NAME";
Expansion.descriptionToken = "WDD_EXPANSION_DESC";
Expansion.iconSprite = Assets.LoadAsset<Sprite>("Assets/icons/expansionWdd.png");
Expansion.disabledIconSprite = Assets.LoadAsset<Sprite>("Assets/icons/expansionWdd-inactive.png");
Expansion.requiredEntitlement = null;
ContentAddition.AddExpansionDef(Expansion);
Log.Info("Creating equipments...");
EquipInit.Init();
Log.Info("Creating items...");
ItemInit.Init();
object obj = <>c.<>9__8_0;
if (obj == null)
{
hook_OnMainMenuControllerInitialized val = delegate(orig_OnMainMenuControllerInitialized orig, RoR2Application self)
{
ItemInit.FormatDescriptions();
orig.Invoke(self);
};
<>c.<>9__8_0 = val;
obj = (object)val;
}
RoR2Application.OnMainMenuControllerInitialized += (hook_OnMainMenuControllerInitialized)obj;
Log.Info("Killing Foxy...");
Main.chance.Value = 0f;
Main.interval.Value = 999999f;
Log.Info("Done");
}
}
}
namespace WinnersDoDrugs.Items
{
public static class ItemInit
{
public static DemonTime DemonTime = new DemonTime("DemonTime", (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 }, (ItemTier)0);
public static FactorialPearl FactorialPearl = new FactorialPearl("FactorialPearl", (ItemTag[])(object)new ItemTag[1] { (ItemTag)2 }, (ItemTier)0);
public static Smike Smike = new Smike("Smike", (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 }, (ItemTier)0);
private static List<ItemBase> _itemList;
public static Spear Spear = new Spear("Spear", (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }, (ItemTier)2);
public static Gambler Gambler;
public static MoonWeed MoonWeed;
public static Spope Spope;
public static PackingPeanut PackingPeanut;
public static TacticalPots TacticalPots;
public static List<ItemBase> ItemList
{
get
{
if (_itemList == null)
{
_itemList = new List<ItemBase>();
}
return _itemList;
}
set
{
_itemList = value;
}
}
public static void Init()
{
foreach (ItemBase item in ItemList)
{
if (item.RegisterItem())
{
Log.Info("Added definition for item " + item.Name);
item.RegisterHooks();
}
}
}
public static void FormatDescriptions()
{
foreach (ItemBase item in ItemList)
{
if (item.Enabled)
{
item.FormatDescriptionTokens();
}
}
}
static ItemInit()
{
ItemTag[] array = new ItemTag[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
Gambler = new Gambler("Gambler", (ItemTag[])(object)array, (ItemTier)3);
ItemTag[] array2 = new ItemTag[4];
RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
MoonWeed = new MoonWeed("MoonWeed", (ItemTag[])(object)array2, (ItemTier)3);
Spope = new Spope("Spope", (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }, (ItemTier)3);
PackingPeanut = new PackingPeanut("PackingPeanut", (ItemTag[])(object)new ItemTag[2]
{
(ItemTag)3,
(ItemTag)14
}, (ItemTier)0);
TacticalPots = new TacticalPots("TacticalPots", (ItemTag[])(object)new ItemTag[2]
{
(ItemTag)3,
(ItemTag)1
}, (ItemTier)1);
}
}
public class DemonTime : ItemBase
{
public static ConfigItem<bool> DemonTime_Enabled = new ConfigItem<bool>("Common: Demon Time", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<float> DemonTime_TimeScale = new ConfigItem<float>("Common: Demon Time", "Percent timescale increase", "How much faster (or slower) game time should be per stack of this item.", 0.2f, -1f, 1f, 0.1f);
public override bool Enabled => DemonTime_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/crystalworld/matTimeCrystalSolid.mat").WaitForCompletion();
public Material material1 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matDebugBlack.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/demonTime.png");
public DemonTime(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/demonTime.prefab");
Material[] materialArray = (Material[])(object)new Material[2] { material0, material1 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), DemonTime_TimeScale.Value * 100f));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
Inventory.GiveItemPermanent_ItemIndex_int += (hook_GiveItemPermanent_ItemIndex_int)delegate(orig_GiveItemPermanent_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, itemIndex, count);
int num = 0;
num += GetDemonsInTeam((TeamIndex)1);
num += GetDemonsInTeam((TeamIndex)2);
Time.timeScale = 1f + DemonTime_TimeScale.Value * (float)num;
};
}
public int GetDemonsInTeam(TeamIndex teamIndex)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(teamIndex))
{
if (Object.op_Implicit((Object)(object)teamMember.body))
{
num += GetItemCountEffective(teamMember.body);
}
}
return num;
}
}
public class FactorialPearl : ItemBase
{
public static ConfigItem<bool> DemonTime_Enabled = new ConfigItem<bool>("Common: Pearl", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public override bool Enabled => DemonTime_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/ShinyPearl/matShinyPearl.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/factorialPearl.png");
public FactorialPearl(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/factorialPearl.prefab");
Material[] materialArray = (Material[])(object)new Material[1] { material0 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)delegate(CharacterBody orig, StatHookEventArgs self)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
int itemCountEffective = GetItemCountEffective(orig);
if (itemCountEffective > 0)
{
int num = itemCountEffective;
for (int num2 = itemCountEffective - 1; num2 > 0; num2--)
{
num *= num2;
}
self.baseHealthAdd += (float)num;
if (Object.op_Implicit((Object)(object)orig.modelLocator))
{
orig.modelLocator.modelTransform.localScale = new Vector3((float)itemCountEffective, 1f, 1f);
}
}
};
}
}
public class Smike : ItemBase
{
public static ConfigItem<bool> Smike_Enabled = new ConfigItem<bool>("Common: Smike", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<float> Smike_StunChance = new ConfigItem<float>("Common: Smike", "Activation chance", "Percent chance of activating on hit.", 0.1f, 1f, 0.01f, 0.01f);
public static ConfigItem<float> Smike_StunChanceStack = new ConfigItem<float>("Common: Smike", "Activation chance (per stack)", "Percent chance of activating on hit, per additional stack.", 0.1f, 1f, 0.01f, 0.01f);
public static ConfigItem<float> Smike_StunLength = new ConfigItem<float>("Common: Smike", "Stun length", "Length of the stun in seconds.", 10f, 1f, 10f, 1f);
public static ConfigItem<float> Smike_StunRadius = new ConfigItem<float>("Common: Smike", "Stun radius", "Radius of the stun in meters.", 200f, 10f, 1000f, 10f);
public override bool Enabled => Smike_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/smike.png");
public Smike(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
return Main.Assets.LoadAsset<GameObject>("Assets/prefabs/smike.prefab");
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), Smike_StunChance.Value, Smike_StunChanceStack.Value, Smike_StunRadius.Value, Smike_StunLength.Value));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)delegate(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victimObject)
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, damageInfo, victimObject);
CharacterBody val = default(CharacterBody);
CharacterBody val2 = default(CharacterBody);
if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.master) && victimObject.TryGetComponent<CharacterBody>(ref val2))
{
int itemCountEffective = GetItemCountEffective(val);
if (itemCountEffective > 0 && Object.op_Implicit((Object)(object)val.teamComponent) && Object.op_Implicit((Object)(object)val2.teamComponent) && Util.CheckRoll((Smike_StunChance.Value + Smike_StunChanceStack.Value * (float)(itemCountEffective - 1)) * damageInfo.procCoefficient, val.master.luck, val.master))
{
Object.Instantiate<GameObject>(Main.Fnaf2FoxyJumpscare);
List<Collider> list = Physics.OverlapSphere(val2.corePosition, Smike_StunRadius.Value).ToList();
SetStateOnHurt val3 = default(SetStateOnHurt);
foreach (Collider item in list)
{
GameObject gameObject = ((Component)item).gameObject;
if (Object.op_Implicit((Object)(object)gameObject.GetComponentInChildren<CharacterBody>()))
{
CharacterBody componentInChildren = gameObject.GetComponentInChildren<CharacterBody>();
if (Object.op_Implicit((Object)(object)componentInChildren.healthComponent) && Object.op_Implicit((Object)(object)componentInChildren.teamComponent) && componentInChildren.teamComponent.teamIndex != val.teamComponent.teamIndex)
{
((Component)componentInChildren.healthComponent).gameObject.TryGetComponent<SetStateOnHurt>(ref val3);
if (Object.op_Implicit((Object)(object)val3))
{
val3.SetStun(Smike_StunLength.Value);
}
}
}
}
}
}
};
}
}
public abstract class ItemBase
{
public ItemDef ItemDef;
public string Name;
public ItemTag[] Tags;
public ItemTier Tier;
public bool CanRemove;
public bool IsConsumed;
public bool Hidden;
public ItemIndex ItemIndex => ItemCatalog.FindItemIndex(((Object)ItemDef).name);
public abstract bool Enabled { get; }
public abstract GameObject itemPrefab { get; }
public abstract Sprite itemIcon { get; }
public ItemBase(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove, bool _isConsumed, bool _hidden)
{
//IL_0017: 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)
Name = _name;
Tags = _tags;
Tier = _tier;
CanRemove = _canRemove;
IsConsumed = _isConsumed;
Hidden = _hidden;
ItemInit.ItemList.Add(this);
}
public bool RegisterItem()
{
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Expected O, but got Unknown
if (!Enabled)
{
return Enabled;
}
ItemDef = ScriptableObject.CreateInstance<ItemDef>();
ItemDef.nameToken = "WDD_ITEM_" + Name.ToUpper() + "_NAME";
ItemDef.pickupToken = "WDD_ITEM_" + Name.ToUpper() + "_PICKUP";
ItemDef.descriptionToken = "WDD_ITEM_" + Name.ToUpper() + "_DESC";
ItemDef.loreToken = "WDD_ITEM_" + Name.ToUpper() + "_LORE";
((Object)ItemDef).name = "wdd" + Name;
ItemDef.tags = Tags;
ItemDef.tier = Tier;
ItemDef.deprecatedTier = Tier;
ItemDef.canRemove = CanRemove;
ItemDef.isConsumed = IsConsumed;
ItemDef.hidden = Hidden;
ItemDef.requiredExpansion = Main.Expansion;
ItemDef.pickupModelPrefab = itemPrefab;
ItemDef.pickupIconSprite = itemIcon;
if (Object.op_Implicit((Object)(object)itemPrefab))
{
Transform child = itemPrefab.transform.GetChild(0);
ModelPanelParameters val = itemPrefab.AddComponent<ModelPanelParameters>();
val.minDistance = 1f;
val.maxDistance = 2f;
val.focusPointTransform = child;
val.cameraPositionTransform = child;
}
ItemAPI.Add(new CustomItem(ItemDef, Array.Empty<ItemDisplayRule>()));
return Enabled;
}
public int GetItemCountEffective(CharacterBody body)
{
int result = 0;
if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory))
{
result = body.inventory.GetItemCountEffective(ItemDef);
}
return result;
}
public int GetItemCountPermanent(CharacterBody body)
{
int result = 0;
if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory))
{
result = body.inventory.GetItemCountPermanent(ItemDef);
}
return result;
}
public abstract void FormatDescriptionTokens();
public abstract void RegisterHooks();
}
public class Spear : ItemBase
{
public static ConfigItem<bool> Spear_Enabled = new ConfigItem<bool>("Legendary: Spear of the Seven Dark Flames of the Nights Eclipse Forged by the Gods Under the Watch of Ten Thousand Honored Knights Receive This Item to Wield Untold Powers Beyond All Others", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<bool> Spear_True = new ConfigItem<bool>("Legendary: Spear of the Seven Dark Flames of the Nights Eclipse Forged by the Gods Under the Watch of Ten Thousand Honored Knights Receive This Item to Wield Untold Powers Beyond All Others", "True", "Can I get a 'True'?", _defaultValue: true);
public override bool Enabled => Spear_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC2/matShrineofRebirth.mat").WaitForCompletion();
public Material material1 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC2/meridian/Assets/matPMGlow.mat").WaitForCompletion();
public Material material2 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC2/meridian/Assets/matPMGlow.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/spear.png");
public Spear(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/spear.prefab");
Material[] materialArray = (Material[])(object)new Material[3] { material0, material1, material2 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamageProcess += (hook_TakeDamageProcess)delegate(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
{
CharacterBody body = self.body;
CharacterBody body2 = default(CharacterBody);
if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref body2) && Object.op_Implicit((Object)(object)body))
{
int itemCountEffective = GetItemCountEffective(body2);
if (itemCountEffective > 0)
{
damageInfo.damage += 1f;
}
}
orig.Invoke(self, damageInfo);
};
}
}
public class Gambler : ItemBase
{
public class GamblerBehavior : ItemBehavior
{
public float convertInterval = 0.5f;
public float convertTimer = 0f;
private void FixedUpdate()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
convertTimer += Time.fixedDeltaTime;
if (!(convertTimer > convertInterval))
{
return;
}
List<ChestBehavior> list = Object.FindObjectsByType<ChestBehavior>((FindObjectsSortMode)0).ToList();
foreach (ChestBehavior item in list)
{
if (Vector3.Distance(((Component)item).gameObject.transform.position, base.body.corePosition) <= Gambler_Radius.Value)
{
Object.Instantiate<GameObject>(ItemInit.Gambler.ShrinePrefab, ((Component)item).gameObject.transform.position, Quaternion.identity);
EffectData val = new EffectData
{
origin = ((Component)item).gameObject.transform.position,
scale = 3f
};
EffectManager.SpawnEffect(ItemInit.Gambler.ConvertEffectPrefab, val, true);
Util.PlaySound("Play_UI_podImpact", ((Component)base.body).gameObject);
Util.PlaySound(Opening.soundEntryEvent, ((Component)base.body).gameObject);
Object.Destroy((Object)(object)((Component)item).gameObject);
}
}
convertTimer = 0f;
}
}
private GameObject _convertEffectPrefab;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private GameObject <ConvertEffectPrefab>k__BackingField;
private GameObject _shrinePrefab;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private GameObject <ShrinePrefab>k__BackingField;
public static ConfigItem<bool> Gambler_Enabled = new ConfigItem<bool>("Lunar: 0808-8020-133", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<float> Gambler_Radius = new ConfigItem<float>("Lunar: 0808-8020-133", "Conversion radius", "Convert chests in this meters radius to chance shrines.", 20f, 1f, 40f, 1f);
public override bool Enabled => Gambler_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Titan/matTitanPebble.mat").WaitForCompletion();
public Material material1 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/gauntlets/matGTVoidTerrain.mat").WaitForCompletion();
public Material material2 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/gauntlets/matGTVoidTerrain.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/gambler.png");
public GameObject ConvertEffectPrefab
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_convertEffectPrefab == (Object)null)
{
_convertEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/EquipmentRestockEffect.prefab").WaitForCompletion();
}
return _convertEffectPrefab;
}
[CompilerGenerated]
set
{
<ConvertEffectPrefab>k__BackingField = value;
}
}
public GameObject ShrinePrefab
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_shrinePrefab == (Object)null)
{
_shrinePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ShrineChance/ShrineChance.prefab").WaitForCompletion();
}
return _shrinePrefab;
}
[CompilerGenerated]
set
{
<ShrinePrefab>k__BackingField = value;
}
}
public ExpansionDef voidExpansion => Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
public ExpansionDef stormExpansion => Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion();
public Gambler(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/gambler.prefab");
Material[] materialArray = (Material[])(object)new Material[3] { material0, material1, material2 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), Gambler_Radius.Value));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)delegate(orig_OnInventoryChanged orig, CharacterBody self)
{
orig.Invoke(self);
GamblerBehavior gamblerBehavior = ((Component)self).GetComponent<GamblerBehavior>();
int itemCountEffective = GetItemCountEffective(self);
if (GetItemCountEffective(self) > 0 && !Object.op_Implicit((Object)(object)gamblerBehavior))
{
gamblerBehavior = self.AddItemBehavior<GamblerBehavior>(itemCountEffective);
}
if (GetItemCountEffective(self) <= 0 && Object.op_Implicit((Object)(object)gamblerBehavior))
{
Object.Destroy((Object)(object)((Component)self).GetComponent<GamblerBehavior>());
}
};
Inventory.GiveItemPermanent_ItemIndex_int += (hook_GiveItemPermanent_ItemIndex_int)delegate(orig_GiveItemPermanent_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count)
{
//IL_0007: 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_001f: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
int num2 = 0;
num = self.GetItemCountPermanent(base.ItemIndex);
orig.Invoke(self, itemIndex, count);
num2 = self.GetItemCountPermanent(base.ItemIndex);
if (num2 > num)
{
if (Run.instance.IsExpansionEnabled(voidExpansion))
{
self.GiveItemPermanent(Items.GoldOnHurt, 1);
}
self.GiveItemPermanent(Items.BonusGoldPackOnKill, 1);
if (Run.instance.IsExpansionEnabled(voidExpansion))
{
self.GiveItemPermanent(Items.ExtraShrineItem, 1);
}
}
};
}
}
public class MoonWeed : ItemBase
{
public static ConfigItem<bool> MoonWeed_Enabled = new ConfigItem<bool>("Lunar: Moon Weed (Weed from the Moon)", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<float> MoonWeed_ProcCoefficient = new ConfigItem<float>("Lunar: Moon Weed (Weed from the Moon)", "Proc coefficient multiplier", "Multiply proc chance by this much.", 3f, 1.5f, 5f, 0.1f);
public static ConfigItem<float> MoonWeed_ProcCoefficientStack = new ConfigItem<float>("Lunar: Moon Weed (Weed from the Moon)", "Proc coefficient multiplier (per stack)", "Multiply proc chance by this much more per additional stack.", 1f, 0.1f, 3f, 0.1f);
public static ConfigItem<float> MoonWeed_Rotation = new ConfigItem<float>("Lunar: Moon Weed (Weed from the Moon)", "Camera rotation on hit", "Rotate the camera by this many degrees on hit, per stack.", 1f, 0.1f, 5f, 0.1f);
public static ConfigItem<float> MoonWeed_RotationCrit = new ConfigItem<float>("Lunar: Moon Weed (Weed from the Moon)", "Critical camera rotation on hit", "Rotate the camera in the opposite direction by this many degrees on critical hit, per stack.", 2f, 0.1f, 5f, 0.1f);
public override bool Enabled => MoonWeed_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Vagrant/matVagrantCannonGreen.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/moonWeed.png");
public MoonWeed(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/moonWeed.prefab");
Material[] materialArray = (Material[])(object)new Material[1] { material0 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), MoonWeed_ProcCoefficient.Value * 100f, MoonWeed_ProcCoefficientStack.Value * 100f, MoonWeed_Rotation.Value, MoonWeed_RotationCrit.Value));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamageProcess += (hook_TakeDamageProcess)delegate(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = self.body;
GameObject attacker = damageInfo.attacker;
CharacterBody val = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
int itemCountEffective = GetItemCountEffective(val);
if (Object.op_Implicit((Object)(object)val) && itemCountEffective > 0)
{
damageInfo.procCoefficient *= MoonWeed_ProcCoefficient.Value + MoonWeed_ProcCoefficientStack.Value * (float)(itemCountEffective - 1);
}
orig.Invoke(self, damageInfo);
if (!damageInfo.rejected && damageInfo.damage > 0f && damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)val) && itemCountEffective > 0 && Object.op_Implicit((Object)(object)val.teamComponent) && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.teamComponent))
{
LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedBody == (Object)(object)val && Object.op_Implicit((Object)(object)firstLocalUser.cameraRigController) && Object.op_Implicit((Object)(object)firstLocalUser.cameraRigController.sceneCam) && val.teamComponent.teamIndex != body.teamComponent.teamIndex)
{
float num = MoonWeed_Rotation.Value * (float)itemCountEffective;
if (damageInfo.crit)
{
num = (0f - MoonWeed_RotationCrit.Value) * (float)itemCountEffective;
}
Transform transform = ((Component)firstLocalUser.cameraRigController.sceneCam).transform;
transform.Rotate(new Vector3(0f, 0f, num));
}
}
};
}
}
public class Spope : ItemBase
{
public static ConfigItem<bool> Spope_Enabled = new ConfigItem<bool>("Lunar: Spope", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<float> Spope_Damage = new ConfigItem<float>("Lunar: Spope", "Percent damage increase", "Increase damage by this percentage.", 100000f, 50000f, 500000f, 10000f);
public override bool Enabled => Spope_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Tonic/matTonicCrystal.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/spope.png");
public Spope(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/spope.prefab");
Material[] materialArray = (Material[])(object)new Material[1] { material0 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), Spope_Damage.Value));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamageProcess += (hook_TakeDamageProcess)delegate(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
{
CharacterBody body = self.body;
CharacterBody body2 = default(CharacterBody);
if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref body2) && Object.op_Implicit((Object)(object)body))
{
int itemCountEffective = GetItemCountEffective(body2);
int itemCountEffective2 = GetItemCountEffective(body);
if (itemCountEffective > 0)
{
damageInfo.damage *= Spope_Damage.Value / 100f * (float)itemCountEffective;
}
if (itemCountEffective2 > 0)
{
Application.Quit();
}
}
orig.Invoke(self, damageInfo);
};
}
}
public class PackingPeanut : ItemBase
{
public static ConfigItem<bool> PackingPeanut_Enabled = new ConfigItem<bool>("Common: Packing Peanut", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<float> PackingPeanut_Chance = new ConfigItem<float>("Common: Packing Peanut", "Chance of discovery", "Percent chance of finding this item whenever another item is picked up.", 5f, 1f, 99f, 0.1f);
public override bool Enabled => PackingPeanut_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Bison/matBisonMetalBall.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/packingPeanut.png");
public PackingPeanut(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/packingPeanut.prefab");
Material[] materialArray = (Material[])(object)new Material[1] { material0 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), PackingPeanut_Chance.Value));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
Run.IsItemAvailable += (hook_IsItemAvailable)((orig_IsItemAvailable orig, Run self, ItemIndex itemIndex) => itemIndex != base.ItemIndex && orig.Invoke(self, itemIndex));
Inventory.GiveItemPermanent_ItemIndex_int += (hook_GiveItemPermanent_ItemIndex_int)delegate(orig_GiveItemPermanent_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, itemIndex, count);
if (Util.CheckRoll(PackingPeanut_Chance.Value, 0f, (CharacterMaster)null))
{
self.GiveItemPermanent(base.ItemIndex, 1);
if (Object.op_Implicit((Object)(object)((Component)self).gameObject.GetComponentInChildren<CharacterMaster>()))
{
CharacterMasterNotificationQueue.PushItemNotification(((Component)self).gameObject.GetComponentInChildren<CharacterMaster>(), base.ItemIndex);
}
}
};
Inventory.GiveItemTemp += (hook_GiveItemTemp)delegate(orig_GiveItemTemp orig, Inventory self, ItemIndex itemIndex, float count)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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)
orig.Invoke(self, itemIndex, count);
if (Util.CheckRoll(PackingPeanut_Chance.Value, 0f, (CharacterMaster)null))
{
self.GiveItemTemp(base.ItemIndex, 1f);
if (Object.op_Implicit((Object)(object)((Component)self).gameObject.GetComponentInChildren<CharacterMaster>()))
{
CharacterMasterNotificationQueue.PushItemNotification(((Component)self).gameObject.GetComponentInChildren<CharacterMaster>(), base.ItemIndex, true, 0);
}
}
};
}
}
public class TacticalPots : ItemBase
{
public class PotBehavior : ItemBehavior
{
public float convertInterval = TacticalPots_Interval.Value;
public float convertTimer = 0f;
public float internalInterval = 0.05f;
public float internalTimer = 0f;
public int storedPots = 0;
private void FixedUpdate()
{
//IL_006e: 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_0094: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
convertTimer += Time.fixedDeltaTime;
internalTimer += Time.fixedDeltaTime;
if (convertTimer >= convertInterval)
{
storedPots += ItemInit.TacticalPots.GetItemCountEffective(base.body) * TacticalPots_Pots.Value;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(base.body.corePosition.x, base.body.corePosition.y + 3f, base.body.corePosition.z);
for (int i = 0; i < ItemInit.TacticalPots.GetItemCountEffective(base.body) * TacticalPots_Pots.Value; i++)
{
GameObject val2 = Object.Instantiate<GameObject>(ItemInit.TacticalPots.PotPrefab, Random.insideUnitSphere * 2f + val, Quaternion.identity);
DestroyOnTimer val3 = val2.AddComponent<DestroyOnTimer>();
val3.SetDuration(1f);
Util.PlaySound("Play_voidBarnacle_m1_chargeUp", val2);
}
convertTimer = 0f;
}
}
}
private GameObject _potPrefab;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private GameObject <PotPrefab>k__BackingField;
public static ConfigItem<bool> TacticalPots_Enabled = new ConfigItem<bool>("Uncommon: 100 Mired Urns", "Item enabled", "Should this item appear in runs?", _defaultValue: true);
public static ConfigItem<int> TacticalPots_Pots = new ConfigItem<int>("Uncommon: 100 Mired Urns", "Pot count", "Amount of tactical pots emitted in the interval per stack.", 50, 10f, 100f, 1f);
public static ConfigItem<float> TacticalPots_Interval = new ConfigItem<float>("Uncommon: 100 Mired Urns", "Pot interval", "How often tactical pots are deployed in seconds.", 10f, 1f, 10f, 0.5f);
public override bool Enabled => TacticalPots_Enabled.Value;
public override GameObject itemPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Titan/matTitanPebble.mat").WaitForCompletion();
public Material material1 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/gauntlets/matGTVoidTerrain.mat").WaitForCompletion();
public Material material2 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/gauntlets/matGTVoidTerrain.mat").WaitForCompletion();
public override Sprite itemIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/tacticalPots.png");
public GameObject PotPrefab
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_potPrefab == (Object)null)
{
_potPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/SpawnPointExplosivePotBody.prefab").WaitForCompletion();
}
return _potPrefab;
}
[CompilerGenerated]
set
{
<PotPrefab>k__BackingField = value;
}
}
public TacticalPots(string _name, ItemTag[] _tags, ItemTier _tier, bool _canRemove = true, bool _isConsumed = false, bool _hidden = false)
: base(_name, _tags, _tier, _canRemove, _isConsumed, _hidden)
{
}//IL_0003: Unknown result type (might be due to invalid IL or missing references)
public GameObject OverwritePrefabMaterials()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/SiphonOnLowHealth/DisplaySiphonOnLowHealth.prefab").WaitForCompletion(), "Jesus of Nazareth");
}
public override void FormatDescriptionTokens()
{
string descriptionToken = ItemDef.descriptionToken;
LanguageAPI.AddOverlay(descriptionToken, string.Format(Language.currentLanguage.GetLocalizedStringByToken(descriptionToken), TacticalPots_Pots.Value, TacticalPots_Interval.Value));
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)delegate(orig_OnInventoryChanged orig, CharacterBody self)
{
orig.Invoke(self);
PotBehavior potBehavior = ((Component)self).GetComponent<PotBehavior>();
int itemCountEffective = GetItemCountEffective(self);
if (GetItemCountEffective(self) > 0 && !Object.op_Implicit((Object)(object)potBehavior))
{
potBehavior = self.AddItemBehavior<PotBehavior>(itemCountEffective);
}
if (GetItemCountEffective(self) <= 0 && Object.op_Implicit((Object)(object)potBehavior))
{
Object.Destroy((Object)(object)((Component)self).GetComponent<PotBehavior>());
}
};
}
}
}
namespace WinnersDoDrugs.Equipment
{
public abstract class EquipBase
{
public EquipmentDef EquipmentDef;
public string Name;
public bool CanBeRandomlyTriggered;
public bool EnigmaCompatible;
public bool IsLunar;
public EquipmentIndex EquipmentIndex => EquipmentCatalog.FindEquipmentIndex(((Object)EquipmentDef).name);
public abstract bool Enabled { get; }
public abstract float Cooldown { get; }
public abstract GameObject equipPrefab { get; }
public abstract Sprite equipIcon { get; }
public EquipBase(string _name, bool _canBeRandomlyTriggered, bool _enigmaCompatible, bool _isLunar)
{
Name = _name;
CanBeRandomlyTriggered = _canBeRandomlyTriggered;
EnigmaCompatible = _enigmaCompatible;
IsLunar = _isLunar;
EquipInit.EquipList.Add(this);
}
public bool RegisterEquip()
{
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Expected O, but got Unknown
if (!Enabled)
{
return Enabled;
}
EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
((Object)EquipmentDef).name = Name;
EquipmentDef.nameToken = "WDD_EQUIP_" + Name.ToUpper() + "_NAME";
EquipmentDef.pickupToken = "WDD_EQUIP_" + Name.ToUpper() + "_PICKUP";
EquipmentDef.descriptionToken = "WDD_EQUIP_" + Name.ToUpper() + "_DESC";
EquipmentDef.loreToken = "WDD_EQUIP_" + Name.ToUpper() + "_LORE";
EquipmentDef.requiredExpansion = Main.Expansion;
EquipmentDef.pickupModelPrefab = equipPrefab;
EquipmentDef.pickupIconSprite = equipIcon;
EquipmentDef.appearsInSinglePlayer = true;
EquipmentDef.appearsInMultiPlayer = true;
EquipmentDef.canDrop = true;
EquipmentDef.cooldown = Cooldown;
EquipmentDef.isBoss = false;
EquipmentDef.isConsumed = false;
EquipmentDef.isLunar = IsLunar;
EquipmentDef.canBeRandomlyTriggered = CanBeRandomlyTriggered;
EquipmentDef.enigmaCompatible = EnigmaCompatible;
if (Object.op_Implicit((Object)(object)equipPrefab))
{
Transform child = equipPrefab.transform.GetChild(0);
ModelPanelParameters val = equipPrefab.AddComponent<ModelPanelParameters>();
val.minDistance = 0.5f;
val.maxDistance = 1f;
val.focusPointTransform = child;
val.cameraPositionTransform = child;
}
ItemAPI.Add(new CustomEquipment(EquipmentDef, CreateItemDisplayRules()));
return Enabled;
}
public abstract void FormatDescriptionTokens();
public abstract void RegisterHooks();
public abstract ItemDisplayRuleDict CreateItemDisplayRules();
}
public static class EquipInit
{
private static List<EquipBase> _equipList;
public static TheBomb TheBomb = new TheBomb("TheBomb", canBeRandomlyTriggered: false, enigmaCompatible: false, isLunar: true);
public static List<EquipBase> EquipList
{
get
{
if (_equipList == null)
{
_equipList = new List<EquipBase>();
}
return _equipList;
}
set
{
_equipList = value;
}
}
public static void Init()
{
foreach (EquipBase equip in EquipList)
{
if (equip.RegisterEquip())
{
Log.Info("Added definition for equipment " + equip.Name);
equip.RegisterHooks();
}
}
}
public static void FormatDescriptions()
{
foreach (EquipBase equip in EquipList)
{
if (equip.Enabled)
{
equip.FormatDescriptionTokens();
}
}
}
}
public class TheBomb : EquipBase
{
private GameObject _explodeEffect;
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private GameObject <ExplodeEffect>k__BackingField;
public static ConfigItem<bool> TheBomb_Enabled = new ConfigItem<bool>("Lunar equipment: The Bomb", "Equipment enabled", "Should this equipment appear in runs?", _defaultValue: true);
public static ConfigItem<float> TheBomb_Cooldown = new ConfigItem<float>("Lunar equipment: The Bomb", "Equipment cooldown", "Seconds until the equipment cooldown is finished.", 300f, 1f, 600f, 1f);
public override bool Enabled => TheBomb_Enabled.Value;
public override float Cooldown => TheBomb_Cooldown.Value;
public override GameObject equipPrefab => OverwritePrefabMaterials();
public Material material0 => Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Titan/matTitanPebble.mat").WaitForCompletion();
public Material material1 => Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/gauntlets/matGTVoidTerrain.mat").WaitForCompletion();
public override Sprite equipIcon => Main.Assets.LoadAsset<Sprite>("Assets/icons/theBomb.png");
public GameObject ExplodeEffect
{
get
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_explodeEffect == (Object)null)
{
_explodeEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/CritGlassesVoid/CritGlassesVoidExecuteEffect.prefab").WaitForCompletion();
}
return _explodeEffect;
}
[CompilerGenerated]
set
{
<ExplodeEffect>k__BackingField = value;
}
}
public TheBomb(string _name, bool canBeRandomlyTriggered = true, bool enigmaCompatible = true, bool isLunar = false)
: base(_name, canBeRandomlyTriggered, enigmaCompatible, isLunar)
{
}
public GameObject OverwritePrefabMaterials()
{
GameObject val = Main.Assets.LoadAsset<GameObject>("Assets/prefabs/theBomb.prefab");
Material[] materialArray = (Material[])(object)new Material[2] { material0, material1 };
((Renderer)val.GetComponentInChildren<MeshRenderer>()).SetMaterialArray(materialArray);
return val;
}
public override void FormatDescriptionTokens()
{
}
public override void RegisterHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
EquipmentSlot.PerformEquipmentAction += (hook_PerformEquipmentAction)delegate(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00df: 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_00ef: 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: 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)
//IL_0170: Expected O, but got Unknown
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
Debug.LogWarning((object)"[Server] function 'System.Boolean RoR2.EquipmentSlot::PerformEquipmentAction(RoR2.EquipmentDef)' called on client");
return false;
}
if (self.equipmentDisabled)
{
return false;
}
if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef && Object.op_Implicit((Object)(object)self.characterBody))
{
EffectData val = new EffectData
{
origin = self.characterBody.corePosition,
scale = 99f
};
EffectManager.SpawnEffect(ExplodeEffect, val, true);
for (int i = 0; i < 10; i++)
{
Util.PlaySound("Play_artifactBoss_attack1_explode", ((Component)self.characterBody).gameObject);
Util.PlaySound("Play_UI_podImpact", ((Component)self.characterBody).gameObject);
}
BlastAttack val2 = new BlastAttack
{
position = self.characterBody.corePosition,
baseDamage = 1E+09f,
baseForce = 100f,
radius = 2000f,
attacker = ((Component)self.characterBody).gameObject,
inflictor = null,
teamIndex = (TeamIndex)(-1),
crit = false,
procChainMask = default(ProcChainMask),
procCoefficient = 0f,
damageColorIndex = (DamageColorIndex)0,
falloffModel = (FalloffModel)0,
damageType = DamageTypeCombo.op_Implicit((DamageType)262144),
attackerFiltering = (AttackerFiltering)3,
losType = (LoSType)0
};
val2.Fire();
self.subcooldownTimer = 1f;
return true;
}
return orig.Invoke(self, equipmentDef);
};
}
public override ItemDisplayRuleDict CreateItemDisplayRules()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
GameObject val = Helpers.PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipPrefab, ((Object)EquipmentDef).name + "Display", false));
return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
}
}
}
namespace WinnersDoDrugs.Configuration
{
public class ConfigItem<T>
{
private ConfigEntry<T> configEntry;
private readonly string header;
private readonly string name;
private readonly string desc;
private readonly T defaultValue;
private readonly float minValue;
private readonly float maxValue;
private readonly float increment;
public T Value
{
get
{
if (Main.Config_Enabled.Value)
{
return configEntry.Value;
}
return defaultValue;
}
}
public Type Type => typeof(T);
public ConfigItem(string _header, string _name, string _desc, T _defaultValue, float _minValue = float.MinValue, float _maxValue = float.MinValue, float _increment = float.MinValue)
{
header = _header;
name = _name;
desc = _desc;
defaultValue = _defaultValue;
minValue = _minValue;
maxValue = _maxValue;
increment = _increment;
InitConfigItem();
}
public void InitConfigItem()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0039: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Expected O, but got Unknown
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
configEntry = ((BaseUnityPlugin)Main.Instance).Config.Bind<T>(new ConfigDefinition(header, name), defaultValue, new ConfigDescription(desc, (AcceptableValueBase)null, Array.Empty<object>()));
if (Type == typeof(bool))
{
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry as ConfigEntry<bool>, true));
}
else if (Type == typeof(string))
{
ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(configEntry as ConfigEntry<string>, true));
}
else if (Type == typeof(int))
{
int num = Convert.ToInt32(defaultValue);
float num2 = ((minValue == float.MinValue) ? 0f : minValue);
float num3 = ((maxValue == float.MinValue) ? ((float)num * 10f) : maxValue);
ModSettingsManager.AddOption((BaseOption)new IntSliderOption(configEntry as ConfigEntry<int>, new IntSliderConfig
{
min = (int)num2,
max = (int)num3,
restartRequired = true
}));
}
else if (Type == typeof(float))
{
float num4 = Convert.ToSingle(defaultValue);
float min = ((minValue == float.MinValue) ? 0f : minValue);
float max = ((maxValue == float.MinValue) ? (num4 * 10f) : maxValue);
float num5 = ((increment == float.MinValue) ? (num4 / 10f) : increment);
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntry as ConfigEntry<float>, new StepSliderConfig
{
min = min,
max = max,
increment = num5,
restartRequired = true
}));
}
}
}
}