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 Characters;
using Characters.Abilities;
using Characters.Gear;
using Characters.Gear.Items;
using Characters.Gear.Synergy.Inscriptions;
using Characters.Player;
using CustomItems.CustomAbilities;
using GameResources;
using HarmonyLib;
using Level;
using Microsoft.CodeAnalysis;
using Services;
using Singletons;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Plugins.Common")]
[assembly: IgnoresAccessChecksTo("Plugins.Singletons")]
[assembly: IgnoresAccessChecksTo("Unity.Addressables")]
[assembly: AssemblyCompany("CustomItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Archlich has a fixed Death Trap skill. Infinite bone is happy again!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3a1355d4102e589326274b0336a681e4570f4db9")]
[assembly: AssemblyProduct("CustomItems")]
[assembly: AssemblyTitle("CustomItems")]
[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;
}
}
}
[Serializable]
public sealed class ChangeItemWhenKilledBoss : MonoBehaviour
{
[SerializeField]
private Item _item = null;
private void Awake()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
Character player = Singleton<Service>.Instance.levelManager.player;
player.onKilled = (OnKilledDelegate)Delegate.Combine((Delegate?)(object)player.onKilled, (Delegate?)new OnKilledDelegate(CheckUpdateCondition));
}
private void OnDestroy()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
Character player = Singleton<Service>.Instance.levelManager.player;
player.onKilled = (OnKilledDelegate)Delegate.Remove((Delegate?)(object)player.onKilled, (Delegate?)new OnKilledDelegate(CheckUpdateCondition));
}
private void CheckUpdateCondition(ITarget target, ref Damage damage)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Invalid comparison between Unknown and I4
//IL_0085: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
Character character = target.character;
ItemReference val = default(ItemReference);
if ((int)character.type == 3 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name.Substring(0, ((Object)_item).name.Length - 2), ref val))
{
ItemRequest val2 = val.LoadAsync();
((Request<Item>)(object)val2).WaitForCompletion();
if ((int)((Gear)_item).state == 1)
{
Item val3 = Singleton<Service>.Instance.levelManager.DropItem(val2, Vector3.zero);
val3.keyword1 = _item.keyword1;
val3.keyword2 = _item.keyword2;
((Gear)val3)._gearTag = ((Gear)_item)._gearTag;
_item.ChangeOnInventory(val3);
}
}
}
}
[Serializable]
public sealed class ChangeItemWhenLowHealth : MonoBehaviour
{
[SerializeField]
private Item _item = null;
private void Awake()
{
((Health)Singleton<Service>.Instance.levelManager.player.health).onChanged += CheckUpdateCondition;
}
private void OnDestroy()
{
((Health)Singleton<Service>.Instance.levelManager.player.health).onChanged -= CheckUpdateCondition;
}
private void CheckUpdateCondition()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
CharacterHealth health = Singleton<Service>.Instance.levelManager.player.health;
if (!(((Health)health).percent < 0.2))
{
return;
}
((Health)health).Heal(((Health)health).maximumHealth / 10.0 * 4.0, true);
ItemReference val = default(ItemReference);
if (GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_2", ref val))
{
ItemRequest val2 = val.LoadAsync();
((Request<Item>)(object)val2).WaitForCompletion();
if ((int)((Gear)_item).state == 1)
{
Item val3 = Singleton<Service>.Instance.levelManager.DropItem(val2, Vector3.zero);
val3.keyword1 = _item.keyword1;
val3.keyword2 = _item.keyword2;
((Gear)val3)._gearTag = ((Gear)_item)._gearTag;
_item.ChangeOnInventory(val3);
}
}
}
}
[Serializable]
public sealed class MysteriousScrollKeyWordRandomizer : KeywordRandomizer
{
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
((KeywordRandomizer)this).Awake();
base._item.keyword1 = (Key)29;
SecondInscriptionRandomizer();
}
private void SecondInscriptionRandomizer()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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)
Random random = new Random();
int num = random.Next(0, 4);
if (num >= 0 && num < 1)
{
base._item.keyword2 = (Key)5;
}
if (num >= 1 && num < 2)
{
base._item.keyword2 = (Key)18;
}
if (num >= 2 && num < 3)
{
base._item.keyword2 = (Key)25;
}
if (num == 3)
{
base._item.keyword2 = (Key)36;
}
}
}
[Serializable]
public sealed class UpgradeMysteriousScroll : MonoBehaviour
{
[SerializeField]
private Item _item = null;
private void Awake()
{
Singleton<Service>.Instance.levelManager.player.playerComponents.inventory.onUpdatedKeywordCounts += CheckUpdateCondition;
}
private void OnDestroy()
{
Singleton<Service>.Instance.levelManager.player.playerComponents.inventory.onUpdatedKeywordCounts -= CheckUpdateCondition;
}
private void CheckUpdateCondition()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Invalid comparison between Unknown and I4
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Invalid comparison between Unknown and I4
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Invalid comparison between Unknown and I4
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Invalid comparison between Unknown and I4
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Invalid comparison between Unknown and I4
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Invalid comparison between Unknown and I4
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
ItemReference val = default(ItemReference);
if ((int)_item.keyword2 == 5 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_1", ref val))
{
ItemRequest val2 = val.LoadAsync();
((Request<Item>)(object)val2).WaitForCompletion();
if ((int)((Gear)_item).state == 1)
{
Item val3 = Singleton<Service>.Instance.levelManager.DropItem(val2, Vector3.zero);
val3.keyword1 = _item.keyword1;
val3.keyword2 = _item.keyword2;
_item.ChangeOnInventory(val3);
}
}
ItemReference val4 = default(ItemReference);
if ((int)_item.keyword2 == 18 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_2", ref val4))
{
ItemRequest val5 = val4.LoadAsync();
((Request<Item>)(object)val5).WaitForCompletion();
if ((int)((Gear)_item).state == 1)
{
Item val6 = Singleton<Service>.Instance.levelManager.DropItem(val5, Vector3.zero);
val6.keyword1 = _item.keyword1;
val6.keyword2 = _item.keyword2;
_item.ChangeOnInventory(val6);
}
}
ItemReference val7 = default(ItemReference);
if ((int)_item.keyword2 == 25 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_3", ref val7))
{
ItemRequest val8 = val7.LoadAsync();
((Request<Item>)(object)val8).WaitForCompletion();
if ((int)((Gear)_item).state == 1)
{
Item val9 = Singleton<Service>.Instance.levelManager.DropItem(val8, Vector3.zero);
val9.keyword1 = _item.keyword1;
val9.keyword2 = _item.keyword2;
_item.ChangeOnInventory(val9);
}
}
ItemReference val10 = default(ItemReference);
if ((int)_item.keyword2 == 36 && GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_4", ref val10))
{
ItemRequest val11 = val10.LoadAsync();
((Request<Item>)(object)val11).WaitForCompletion();
if ((int)((Gear)_item).state == 1)
{
Item val12 = Singleton<Service>.Instance.levelManager.DropItem(val11, Vector3.zero);
val12.keyword1 = _item.keyword1;
val12.keyword2 = _item.keyword2;
_item.ChangeOnInventory(val12);
}
}
}
}
namespace CustomItems
{
[Serializable]
public class CustomItemReference : ItemReference
{
private string _originalName;
public string itemName;
public string itemDescription;
public string itemLore;
public Values stats;
public Ability[] abilities;
public Type[] extraComponents;
public string[] forbiddenDrops = new string[0];
public Sprite miniIcon;
private Item item = null;
private static GameObject rootObj;
public string name
{
get
{
return ((GearReference)this).name;
}
set
{
_originalName = value;
((GearReference)this).name = "Custom-" + _originalName;
((GearReference)this).guid = "custom_item://" + value;
((GearReference)this).displayNameKey = "item/" + ((GearReference)this).name + "/name";
}
}
public CustomItemReference()
{
((GearReference)this).obtainable = true;
((GearReference)this).needUnlock = false;
((GearReference)this).path = "Assets/Gear/Items/BasicCarleonSword.prefab";
}
public Item GetItem(Item baseItem)
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01a2: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Expected O, but got Unknown
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Expected O, but got Unknown
if ((Object)(object)item == (Object)null)
{
if ((Object)(object)rootObj == (Object)null)
{
rootObj = new GameObject("CustomItems");
rootObj.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)rootObj);
}
item = Object.Instantiate<Item>(baseItem, rootObj.transform);
Object.DontDestroyOnLoad((Object)(object)item);
((Object)((Component)item).gameObject).name = name;
item.keyword1 = base.prefabKeyword1;
item.keyword2 = base.prefabKeyword2;
((Gear)item)._stat = stats;
((Gear)item)._rarity = ((GearReference)this).rarity;
((Gear)item)._gearTag = ((GearReference)this).gearTag;
((Gear)item)._groupItemKeys = forbiddenDrops.Select((string name) => "Custom-" + name).ToArray();
LoadSprites();
if ((Object)(object)((GearReference)this).icon != (Object)null)
{
((Gear)item).dropped.spriteRenderer.sprite = ((GearReference)this).icon;
}
if (abilities != null && abilities.Length != 0)
{
GameObject val = new GameObject("Ability Attacher");
val.transform.parent = ((Component)item).gameObject.transform;
Item obj = item;
Subcomponents val2 = new Subcomponents();
Subcomponents val3 = val2;
obj._abilityAttacher = val2;
Subcomponents val4 = val3;
((SubcomponentArray<AbilityAttacher>)(object)val4)._container = val;
((SubcomponentArray<AbilityAttacher>)(object)val4)._components = (AbilityAttacher[])(object)new AbilityAttacher[abilities.Length];
abilities[0]._defaultIcon = miniIcon;
for (int i = 0; i < abilities.Length; i++)
{
GameObject val5 = new GameObject("[" + i + "]", new Type[1] { typeof(AlwaysAbilityAttacher) });
val5.transform.parent = val.transform;
AlwaysAbilityAttacher component = val5.GetComponent<AlwaysAbilityAttacher>();
component._abilityComponent = CreateAbilityObject(val5, abilities[i]);
((SubcomponentArray<AbilityAttacher>)(object)val4)._components[i] = (AbilityAttacher)(object)component;
}
}
if (extraComponents != null && extraComponents.Length != 0)
{
GameObject val6 = new GameObject("Extra Behaviors");
val6.transform.parent = ((Component)item).gameObject.transform;
Type[] array = extraComponents;
foreach (Type type in array)
{
Component obj2 = val6.AddComponent(type);
FieldInfo fieldInfo = AccessTools.Field(type, "_item");
if (fieldInfo != null)
{
fieldInfo.SetValue(obj2, item);
}
}
}
}
return item;
}
private static AbilityComponent CreateAbilityObject(GameObject parent, Ability ability)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
Type abilityType = ((object)ability).GetType();
Assembly assembly = abilityType.Assembly;
string componentName = abilityType.Name + "Component";
Type[] array = (from type in assembly.GetTypes()
where string.Equals(type.Namespace, abilityType.Namespace, StringComparison.Ordinal) && string.Equals(type.Name, componentName, StringComparison.Ordinal)
select type).ToArray();
if (array.Length == 1)
{
Type type2 = array[0];
GameObject val = new GameObject("Ability", new Type[1] { type2 });
val.transform.parent = parent.transform;
FieldInfo fieldInfo = AccessTools.Field(type2, "_ability");
Component component = val.GetComponent(type2);
fieldInfo.SetValue(component, ability);
return (AbilityComponent)component;
}
throw new NotImplementedException("Ability Component Type " + componentName + " not found.");
}
public void LoadSprites()
{
GetIcon();
GetThumbnail();
GetMiniIcon();
}
public Sprite GetIcon()
{
if ((Object)(object)((GearReference)this).icon == (Object)null)
{
((GearReference)this).icon = LoadSprite("Icon", 32f);
}
return ((GearReference)this).icon;
}
public Sprite GetThumbnail()
{
if ((Object)(object)((GearReference)this).thumbnail == (Object)null)
{
((GearReference)this).thumbnail = LoadSprite("Thumbnail", 32f);
if ((Object)(object)((GearReference)this).thumbnail != (Object)null)
{
((Object)((GearReference)this).thumbnail).name = name;
}
}
return ((GearReference)this).thumbnail;
}
public Sprite GetMiniIcon()
{
if ((Object)(object)miniIcon == (Object)null)
{
miniIcon = LoadSprite("AbilityIcon", 36f);
if ((Object)(object)miniIcon != (Object)null)
{
((Object)miniIcon).name = name;
}
}
return miniIcon;
}
private Sprite LoadSprite(string type, float pixelsPerUnit)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
Sprite result = null;
try
{
Assembly assembly = typeof(CustomItemReference).Assembly;
Stream manifestResourceStream = assembly.GetManifestResourceStream("CustomItems.Sprites." + _originalName + "." + type + ".png");
byte[] array = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array);
((Texture)val).filterMode = (FilterMode)0;
int num = Math.Max(((Texture)val).width, ((Texture)val).height);
result = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), pixelsPerUnit);
}
catch (Exception)
{
}
return result;
}
}
public class CustomItems
{
public static readonly List<CustomItemReference> Items = InitializeItems();
private static List<CustomItemReference> InitializeItems()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Expected O, but got Unknown
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Expected O, but got Unknown
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: 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_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Expected O, but got Unknown
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Expected O, but got Unknown
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Expected O, but got Unknown
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Expected O, but got Unknown
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Expected O, but got Unknown
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_039b: Expected O, but got Unknown
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Expected O, but got Unknown
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Expected O, but got Unknown
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_045b: Expected O, but got Unknown
//IL_0485: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
//IL_04f6: Expected O, but got Unknown
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Expected O, but got Unknown
//IL_0526: Unknown result type (might be due to invalid IL or missing references)
//IL_052c: Expected O, but got Unknown
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_0547: Expected O, but got Unknown
//IL_0547: Unknown result type (might be due to invalid IL or missing references)
//IL_0551: Expected O, but got Unknown
//IL_0573: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Unknown result type (might be due to invalid IL or missing references)
//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0610: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_0662: Unknown result type (might be due to invalid IL or missing references)
//IL_068e: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Unknown result type (might be due to invalid IL or missing references)
List<CustomItemReference> list = new List<CustomItemReference>();
CustomItemReference customItemReference = new CustomItemReference();
customItemReference.name = "CursedSword";
((GearReference)customItemReference).rarity = (Rarity)3;
customItemReference.itemName = "诅咒之刃";
customItemReference.itemDescription = "增加1000%<color=#F25D1C>物理攻击力</color>,增幅500%<color=#F25D1C>物理攻击力</color>。\n一击即死,除了格挡或无敌或疾驰闪避。";
customItemReference.itemLore = "菜就多练练!";
((ItemReference)customItemReference).prefabKeyword1 = (Key)10;
((ItemReference)customItemReference).prefabKeyword2 = (Key)2;
customItemReference.stats = new Values((Value[])(object)new Value[2]
{
new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 10.0),
new Value(Category.Percent, Kind.PhysicalAttackDamage, 5.0)
});
customItemReference.abilities = (Ability[])(object)new Ability[1]
{
new InstaKillIgnoringNegation()
};
list.Add(customItemReference);
CustomItemReference customItemReference2 = new CustomItemReference();
customItemReference2.name = "MysteriousScroll";
((GearReference)customItemReference2).rarity = (Rarity)2;
customItemReference2.itemName = "未知卷轴";
customItemReference2.itemDescription = "增加25%<color=#F25D1C>物理攻击力</color>,\n增加技能冷却速度25%,\n减少收到伤害10%,\n增加最大生命值20。\n该物品第二个刻印在勇气,复仇,魔力循环,神秘四个刻印中随机出现一个。\n该物品升级效果根据第二个刻印发生变化。";
customItemReference2.itemLore = "神秘使其神秘。";
((ItemReference)customItemReference2).prefabKeyword1 = (Key)29;
((ItemReference)customItemReference2).prefabKeyword2 = (Key)0;
customItemReference2.stats = new Values((Value[])(object)new Value[4]
{
new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.25),
new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, 0.25),
new Value(Category.Percent, Kind.TakingDamage, 0.9),
new Value(Category.Fixed, Kind.Health, 20.0)
});
customItemReference2.extraComponents = new Type[1] { typeof(MysteriousScrollKeyWordRandomizer) };
list.Add(customItemReference2);
CustomItemReference customItemReference3 = new CustomItemReference();
customItemReference3.name = "MysteriousScroll_2";
((GearReference)customItemReference3).obtainable = false;
((GearReference)customItemReference3).rarity = (Rarity)2;
customItemReference3.itemName = "Scroll of Power: Evolution";
customItemReference3.itemDescription = "你不应该获得这个物品。如果你的确获得了,那就是bug。";
customItemReference3.itemLore = "W-Where did you get this from...?";
((ItemReference)customItemReference3).prefabKeyword1 = (Key)29;
((ItemReference)customItemReference3).prefabKeyword2 = (Key)0;
customItemReference3.forbiddenDrops = new string[1] { "MysteriousScroll" };
customItemReference3.extraComponents = new Type[1] { typeof(UpgradeMysteriousScroll) };
list.Add(customItemReference3);
CustomItemReference customItemReference4 = new CustomItemReference();
customItemReference4.name = "MysteriousScroll_2_1";
((GearReference)customItemReference4).obtainable = false;
((GearReference)customItemReference4).rarity = (Rarity)2;
customItemReference4.itemName = "暴虐卷轴";
customItemReference4.itemDescription = "增加<color=#F25D1C>物理攻击力</color>75%,\n增加最大生命值55。";
customItemReference4.itemLore = "代表暴虐力量的卷轴,\n只有真正的斗士会理解此卷轴的用法。";
((ItemReference)customItemReference4).prefabKeyword1 = (Key)0;
((ItemReference)customItemReference4).prefabKeyword2 = (Key)0;
customItemReference4.forbiddenDrops = new string[1] { "MysteriousScroll" };
customItemReference4.stats = new Values((Value[])(object)new Value[2]
{
new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.75),
new Value(Category.Fixed, Kind.Health, 55.0)
});
list.Add(customItemReference4);
CustomItemReference customItemReference5 = new CustomItemReference();
customItemReference5.name = "MysteriousScroll_2_2";
((GearReference)customItemReference5).obtainable = false;
((GearReference)customItemReference5).rarity = (Rarity)2;
customItemReference5.itemName = "战术卷轴";
customItemReference5.itemDescription = "增加技能冷却速度75%,\n增加最大生命值40。";
customItemReference5.itemLore = "代表战术力量的卷轴,\n记住,耐心是克敌之道。";
((ItemReference)customItemReference5).prefabKeyword1 = (Key)0;
((ItemReference)customItemReference5).prefabKeyword2 = (Key)0;
customItemReference5.forbiddenDrops = new string[1] { "MysteriousScroll" };
customItemReference5.stats = new Values((Value[])(object)new Value[2]
{
new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, 0.75),
new Value(Category.Fixed, Kind.Health, 40.0)
});
list.Add(customItemReference5);
CustomItemReference customItemReference6 = new CustomItemReference();
customItemReference6.name = "MysteriousScroll_2_3";
((GearReference)customItemReference6).obtainable = false;
((GearReference)customItemReference6).rarity = (Rarity)2;
customItemReference6.itemName = "生存卷轴";
customItemReference6.itemDescription = "减少受到伤害30%,\n增加最大生命值60。";
customItemReference6.itemLore = "代表生存力量的卷轴,\n不是最强的才能活下来,活下来的才称得上最强。";
((ItemReference)customItemReference6).prefabKeyword1 = (Key)0;
((ItemReference)customItemReference6).prefabKeyword2 = (Key)0;
customItemReference6.forbiddenDrops = new string[1] { "MysteriousScroll" };
customItemReference6.stats = new Values((Value[])(object)new Value[2]
{
new Value(Category.Percent, Kind.TakingDamage, 0.7),
new Value(Category.Fixed, Kind.Health, 60.0)
});
list.Add(customItemReference6);
CustomItemReference customItemReference7 = new CustomItemReference();
customItemReference7.name = "MysteriousScroll_2_4";
((GearReference)customItemReference7).obtainable = false;
((GearReference)customItemReference7).rarity = (Rarity)2;
customItemReference7.itemName = "传奇卷轴";
customItemReference7.itemDescription = "增加<color=#F25D1C>物理攻击力</color>40%,\n增加技能冷却速度40%,\n减少受到伤害20%。\n增加最大生命值45。";
customItemReference7.itemLore = "这训练效率一下拉了三倍!";
((ItemReference)customItemReference7).prefabKeyword1 = (Key)0;
((ItemReference)customItemReference7).prefabKeyword2 = (Key)0;
customItemReference7.forbiddenDrops = new string[1] { "MysteriousScroll" };
customItemReference7.stats = new Values((Value[])(object)new Value[4]
{
new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, 0.4),
new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, 0.4),
new Value(Category.Percent, Kind.TakingDamage, 0.8),
new Value(Category.Fixed, Kind.Health, 45.0)
});
list.Add(customItemReference7);
CustomItemReference customItemReference8 = new CustomItemReference();
customItemReference8.name = "ShieldOfGreed";
((GearReference)customItemReference8).rarity = (Rarity)0;
customItemReference8.itemName = "贪婪盾";
customItemReference8.itemDescription = "每次受击获得15金币(每个房间最多获得5次)。";
customItemReference8.itemLore = "讲真吼,谁会想到挨打来挣钱?走起。";
((ItemReference)customItemReference8).prefabKeyword1 = (Key)8;
((ItemReference)customItemReference8).prefabKeyword2 = (Key)32;
customItemReference8.abilities = (Ability[])(object)new Ability[1]
{
new GainGoldUponHit()
};
list.Add(customItemReference8);
CustomItemReference customItemReference9 = new CustomItemReference();
customItemReference9.name = "EmergencyHealthFlask";
((GearReference)customItemReference9).rarity = (Rarity)1;
customItemReference9.itemName = "小血瓶";
customItemReference9.itemDescription = "当你生命值低于20%以下时,消耗小血瓶回复40%血量。";
customItemReference9.itemLore = "这玩意是一次性的,你小心点使。";
((ItemReference)customItemReference9).prefabKeyword1 = (Key)1;
((ItemReference)customItemReference9).prefabKeyword2 = (Key)14;
customItemReference9.extraComponents = new Type[1] { typeof(ChangeItemWhenLowHealth) };
list.Add(customItemReference9);
CustomItemReference customItemReference10 = new CustomItemReference();
customItemReference10.name = "EmergencyHealthFlask_2";
((GearReference)customItemReference10).obtainable = false;
((GearReference)customItemReference10).rarity = (Rarity)1;
customItemReference10.itemName = "空血瓶";
customItemReference10.itemDescription = "每击败一个boss,回满血瓶。";
customItemReference10.itemLore = "不是哥们,你喝那么快干啥...";
((ItemReference)customItemReference10).prefabKeyword1 = (Key)1;
((ItemReference)customItemReference10).prefabKeyword2 = (Key)14;
customItemReference10.extraComponents = new Type[1] { typeof(ChangeItemWhenKilledBoss) };
list.Add(customItemReference10);
return list;
}
internal static void LoadSprites()
{
Items.ForEach(delegate(CustomItemReference item)
{
item.LoadSprites();
});
}
internal static Dictionary<string, string> MakeStringDictionary()
{
Dictionary<string, string> dictionary = new Dictionary<string, string>(Items.Count * 8);
foreach (CustomItemReference item in Items)
{
dictionary.Add("item/" + item.name + "/name", item.itemName);
dictionary.Add("item/" + item.name + "/desc", item.itemDescription);
dictionary.Add("item/" + item.name + "/flavor", item.itemLore);
}
return dictionary;
}
internal static List<EnhancementMap> ListMasterpieces()
{
Dictionary<string, CustomItemReference> masterpieces = Items.Where((CustomItemReference i) => (int)((ItemReference)i).prefabKeyword1 == 29 || (int)((ItemReference)i).prefabKeyword2 == 29).ToDictionary((CustomItemReference i) => i.name);
return masterpieces.Where((KeyValuePair<string, CustomItemReference> item) => masterpieces.ContainsKey(item.Key + "_2")).Select((Func<KeyValuePair<string, CustomItemReference>, EnhancementMap>)((KeyValuePair<string, CustomItemReference> item) => new EnhancementMap
{
_from = new AssetReference(((GearReference)item.Value).guid),
_to = new AssetReference(((GearReference)masterpieces[item.Key + "_2"]).guid)
})).ToList();
}
}
[HarmonyPatch]
public class CustomItemsPatch
{
public delegate void ManatechPartDelegate();
public delegate void InventoryUpdateDelegate(Inventory inventory);
private static Dictionary<ItemRequest, CustomItemReference> currentRequests = new Dictionary<ItemRequest, CustomItemReference>();
private static Dictionary<GearRequest, CustomItemReference> currentGearRequests = new Dictionary<GearRequest, CustomItemReference>();
private static Dictionary<string, string> ItemStrings = new Dictionary<string, string>();
public static event ManatechPartDelegate OnManatechPart;
public static event InventoryUpdateDelegate OnInventoryUpdate;
[HarmonyPrefix]
[HarmonyPatch(typeof(GearResource), "Initialize")]
private static void InjectCustomItems(ref GearResource __instance)
{
ItemReference[] array = (ItemReference[])(object)CustomItems.Items.ToArray();
ItemReference[] array2 = array;
CustomItems.LoadSprites();
ItemStrings = CustomItems.MakeStringDictionary();
int num = __instance._items.Length;
Array.Resize(ref __instance._items, num + array2.Length);
array2.CopyTo(__instance._items, num);
Sprite[] array3 = (from item in array2
where (Object)(object)((GearReference)item).thumbnail != (Object)null
select ((GearReference)item).thumbnail).ToArray();
int num2 = __instance._gearThumbnails.Length;
Array.Resize(ref __instance._gearThumbnails, num2 + array3.Length);
array3.CopyTo(__instance._gearThumbnails, num2);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Masterpiece), "Initialize")]
private static void InjectMasterpieces(ref Masterpiece __instance)
{
EnhancementMap[] array = CustomItems.ListMasterpieces().ToArray();
int num = __instance._enhancementMaps.Length;
Array.Resize(ref __instance._enhancementMaps, num + array.Length);
array.CopyTo(__instance._enhancementMaps, num);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ItemReference), "LoadAsync")]
private static void RegisterGearRequest(ref ItemReference __instance, ref ItemRequest __result)
{
if (__instance is CustomItemReference value)
{
currentRequests.Add(__result, value);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GearReference), "LoadAsync")]
private static void RegisterGearRequest(ref GearReference __instance, ref GearRequest __result)
{
if (__instance is CustomItemReference value)
{
currentGearRequests.Add(__result, value);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LevelManager), "DropItem", new Type[]
{
typeof(ItemRequest),
typeof(Vector3)
})]
private static bool DropCustomItem(ref LevelManager __instance, ItemRequest gearRequest, Vector3 position, ref Item __result)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return ProcessDrop<ItemRequest, Item>(ref __instance, gearRequest, position, ref __result, currentRequests);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LevelManager), "DropGear", new Type[]
{
typeof(GearRequest),
typeof(Vector3)
})]
private static bool DropCustomGear(ref LevelManager __instance, GearRequest gearRequest, Vector3 position, ref Gear __result)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return ProcessDrop<GearRequest, Gear>(ref __instance, gearRequest, position, ref __result, currentGearRequests);
}
private static bool ProcessDrop<TRequest, TResult>(ref LevelManager __instance, TRequest request, Vector3 position, ref TResult __result, Dictionary<TRequest, CustomItemReference> requestDict) where TRequest : Request<TResult> where TResult : Gear
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (!requestDict.ContainsKey(request))
{
return true;
}
CustomItemReference customItemReference = requestDict[request];
Item item = customItemReference.GetItem(((Component)(object)((Request<TResult>)request).asset).gameObject.GetComponent<Item>());
__result = (TResult)(object)__instance.DropItem(item, position);
requestDict.Remove(request);
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Localization), "GetLocalizedString", new Type[] { typeof(string) })]
private static bool InjectCustomStrings(string key, ref string __result)
{
if (!ItemStrings.ContainsKey(key))
{
return true;
}
__result = ItemStrings[key];
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DroppedManatechPart), "PickedUpBy")]
private static void ManatechPickedupHook(Character character)
{
CustomItemsPatch.OnManatechPart?.Invoke();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Inventory), "UpdateSynergy")]
private static void InventoryUpdateHook(ref Inventory __instance)
{
CustomItemsPatch.OnInventoryUpdate?.Invoke(__instance);
}
}
[BepInPlugin("CustomItems", "CustomItems", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(CustomItemsPatch), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod CustomItems is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "CustomItems";
public const string PLUGIN_NAME = "CustomItems";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace CustomItems.CustomAbilities
{
public abstract class AbilityComponentHack<T> : AbilityComponent<T>, ISerializationCallbackReceiver where T : Ability, ICloneable
{
[SerializeReference]
private T _abilityReference;
public void OnAfterDeserialize()
{
if (base._ability == null && _abilityReference != null)
{
base._ability = (T)_abilityReference.Clone();
}
}
public void OnBeforeSerialize()
{
_abilityReference = base._ability;
}
}
[Serializable]
public class GainGoldUponHit : Ability, ICloneable
{
public class Instance : AbilityInstance<GainGoldUponHit>
{
private int _stacks;
private LevelManager _levelManager;
public override int iconStacks => _stacks;
public override Sprite icon
{
get
{
if (_stacks == 0)
{
return null;
}
return ((Ability)base.ability)._defaultIcon;
}
}
public Instance(Character owner, GainGoldUponHit ability)
: base(owner, ability)
{
_levelManager = Singleton<Service>.Instance.levelManager;
}
public override void OnAttach()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
((Health)((AbilityInstance)this).owner.health).onTakeDamage.Add(100000, new TakeDamageDelegate(HandleOnTakeDamage));
_levelManager.onMapLoadedAndFadedIn += ResetStack;
_stacks = 5;
}
public override void OnDetach()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
((Health)((AbilityInstance)this).owner.health).onTakeDamage.Remove(new TakeDamageDelegate(HandleOnTakeDamage));
_levelManager.onMapLoadedAndFadedIn -= ResetStack;
}
private bool HandleOnTakeDamage(ref Damage damage)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
if (((AbilityInstance)this).owner.invulnerable.value)
{
return false;
}
AttackType attackType = damage.attackType;
if (((object)(AttackType)(ref attackType)).Equals((object)(AttackType)0))
{
return false;
}
if (damage.@null)
{
return false;
}
if (((Damage)(ref damage)).amount < 1.0)
{
return false;
}
if (_stacks <= 0)
{
return false;
}
_stacks--;
Singleton<Service>.Instance.levelManager.DropGold(15, 5, ((Component)((AbilityInstance)this).owner).transform.position);
return false;
}
private void ResetStack()
{
_stacks = 5;
}
}
public override IAbilityInstance CreateInstance(Character owner)
{
return (IAbilityInstance)(object)new Instance(owner, this);
}
public object Clone()
{
return new GainGoldUponHit
{
_defaultIcon = base._defaultIcon
};
}
}
public sealed class GainGoldUponHitComponent : AbilityComponentHack<GainGoldUponHit>
{
}
[Serializable]
public class InstaKillIgnoringNegation : Ability, ICloneable
{
public class Instance : AbilityInstance<InstaKillIgnoringNegation>
{
public Instance(Character owner, InstaKillIgnoringNegation ability)
: base(owner, ability)
{
}
public override void OnAttach()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
((Health)((AbilityInstance)this).owner.health).onTakeDamage.Add(2000, new TakeDamageDelegate(HandleOnTakeDamage));
}
public override void OnDetach()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
((Health)((AbilityInstance)this).owner.health).onTakeDamage.Remove(new TakeDamageDelegate(HandleOnTakeDamage));
}
private bool HandleOnTakeDamage(ref Damage damage)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
if (((AbilityInstance)this).owner.invulnerable.value)
{
return false;
}
AttackType attackType = damage.attackType;
if (((object)(AttackType)(ref attackType)).Equals((object)(AttackType)0))
{
return false;
}
if (damage.@null)
{
return false;
}
if (((Damage)(ref damage)).amount < 1.0)
{
return false;
}
((Health)((AbilityInstance)this).owner.health).TryKill();
return false;
}
}
public override IAbilityInstance CreateInstance(Character owner)
{
return (IAbilityInstance)(object)new Instance(owner, this);
}
public object Clone()
{
return new InstaKillIgnoringNegation
{
_defaultIcon = base._defaultIcon
};
}
}
public sealed class InstaKillIgnoringNegationComponent : AbilityComponentHack<InstaKillIgnoringNegation>
{
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}