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 EntityStates;
using EntityStates.Bandit2.Weapon;
using HG;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.RoR2;
using On.RoR2.Items;
using R2API;
using RoR2;
using RoR2.Skills;
using RockeryPlugin.Artifacts;
using RockeryPlugin.AssetBundles;
using RockeryPlugin.Buffs;
using RockeryPlugin.Equipment;
using RockeryPlugin.Items;
using RockeryPlugin.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("RockeryPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RockeryPlugin")]
[assembly: AssemblyTitle("RockeryPlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RockeryPlugin
{
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);
}
}
[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.*/)]
[BepInPlugin("RobRocke.RockeryPlugin", "RockeryPlugin", "0.1.6")]
public class RockeryPlugin : BaseUnityPlugin
{
public const string PluginGUID = "RobRocke.RockeryPlugin";
public const string PluginAuthor = "RobRocke";
public const string PluginName = "RockeryPlugin";
public const string PluginVersion = "0.1.6";
public List<ArtifactBase> Artifacts = new List<ArtifactBase>();
public List<BuffBase> Buffs = new List<BuffBase>();
public List<ItemBase> Items = new List<ItemBase>();
public List<EquipmentBase> Equipment = new List<EquipmentBase>();
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
PInfo = ((BaseUnityPlugin)this).Info;
Assets.Init();
DesertEagle desertEagle = new DesertEagle();
desertEagle.Init(((BaseUnityPlugin)this).Config);
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(BuffBase))
select type;
foreach (Type item in enumerable)
{
BuffBase buffBase = (BuffBase)Activator.CreateInstance(item);
if (ValidateBuff(buffBase, Buffs))
{
buffBase.Init(((BaseUnityPlugin)this).Config);
}
}
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
select type;
foreach (Type item2 in enumerable2)
{
ItemBase itemBase = (ItemBase)Activator.CreateInstance(item2);
if (ValidateItem(itemBase, Items))
{
itemBase.Init(((BaseUnityPlugin)this).Config);
}
}
IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase))
select type;
foreach (Type item3 in enumerable3)
{
EquipmentBase equipmentBase = (EquipmentBase)Activator.CreateInstance(item3);
if (ValidateEquipment(equipmentBase, Equipment))
{
equipmentBase.Init(((BaseUnityPlugin)this).Config);
}
}
IEnumerable<Type> enumerable4 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase))
select type;
foreach (Type item4 in enumerable4)
{
ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item4);
if (ValidateArtifact(artifactBase, Artifacts))
{
artifactBase.Init(((BaseUnityPlugin)this).Config);
}
}
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)283))
{
Log.Info("Player pressed F2. Spawning items...");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("ITEM_RETROVIRUS");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
PlayerCharacterMasterController.instances[0].master.inventory.GiveItemString("BleedOnHit");
}
}
public bool ValidateArtifact(ArtifactBase artifact, List<ArtifactBase> artifactList)
{
bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifact: " + artifact.ArtifactName, "Enable Artifact?", true, "Should this artifact appear for selection?").Value;
if (value)
{
artifactList.Add(artifact);
}
return value;
}
public bool ValidateBuff(BuffBase buff, List<BuffBase> buffList)
{
bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Buff: " + buff.BuffName, "Enable Buff?", true, "Should this buff be registered for use in the game?").Value;
if (value)
{
buffList.Add(buff);
}
return value;
}
public bool ValidateEquipment(EquipmentBase equipment, List<EquipmentBase> equipmentList)
{
bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Equpment: " + equipment.EquipmentName, "Enable Equipment?", true, "Should this equipment be registered for use in the game?").Value;
if (value)
{
equipmentList.Add(equipment);
}
return value;
}
public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
{
bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + item.ItemName, "Enable Item?", true, "Should this item appear in runs?").Value;
bool value2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + item.ItemName, "Blacklist Item from AI Use?", false, "Should the AI not be able to obtain this item?").Value;
if (value)
{
itemList.Add(item);
if (value2)
{
item.AIBlacklisted = true;
}
}
return value;
}
}
}
namespace RockeryPlugin.Skills
{
public class DesertEagle : SkillBase
{
public class PrepSidearmEagleRevolver : BasePrepSidearmRevolverState
{
public PrepSidearmEagleRevolver()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
((BaseSidearmState)this).baseDuration = 0.7f;
((BaseSidearmState)this).crosshairOverridePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2CrosshairPrepRevolverFire.prefab").WaitForCompletion();
base.enterSoundString = "Play_bandit2_R_load";
}
public override EntityState GetNextState()
{
return (EntityState)(object)new FireSidearmEagleRevolver();
}
}
public class FireSidearmEagleRevolver : BaseFireSidearmRevolverState
{
public FireSidearmEagleRevolver()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
base.effectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/MuzzleflashBandit2.prefab").WaitForCompletion();
base.hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/HitsparkBandit2Pistol.prefab").WaitForCompletion();
base.tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/TracerBanditPistol.prefab").WaitForCompletion();
base.damageCoefficient = 6f;
base.force = 1500f;
base.minSpread = 0f;
base.maxSpread = 0f;
base.attackSoundString = "Play_bandit2_R_fire";
base.recoilAmplitude = 1f;
base.bulletRadius = 1f;
((BaseSidearmState)this).baseDuration = 1f;
((BaseSidearmState)this).crosshairOverridePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2CrosshairPrepRevolverFire.prefab").WaitForCompletion();
}
public override void ModifyBullet(BulletAttack bulletAttack)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
DamageAPI.AddModdedDamageType(bulletAttack, GiveEagleOnKill);
}
}
public override string SkillName => "Desert Eagle";
public override string SkillLangTokenName => "DESERT_EAGLE";
public override string SkillDescription => "Kills provide a perminent increase to base damage.";
public override string Survivor => "BANDIT2";
public override string SkillType => "SPECIAL";
public override SerializableEntityStateType ActivationState => new SerializableEntityStateType(typeof(PrepSidearmEagleRevolver));
public override float BaseRechargeInterval => 4f;
public override InterruptPriority InterruptPriority => (InterruptPriority)1;
public override bool CanceledFromSprinting => true;
public override bool MustKeyPress => true;
public override SkillFamily SkillFamily => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Body.prefab").WaitForCompletion().GetComponent<SkillLocator>()
.special.skillFamily;
public override Sprite SkillIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Skill/texDesertEagleIcon.png");
public static ModdedDamageType GiveEagleOnKill { get; set; }
public override void Init(ConfigFile config)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
CreateLang();
CreateSkill();
GiveEagleOnKill = DamageAPI.ReserveDamageType();
GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GlobalEventManager_OnCharacterDeath);
}
private void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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)
//IL_0066: Expected O, but got Unknown
if (NetworkServer.active && damageReport != null)
{
DamageInfo damageInfo = damageReport.damageInfo;
CharacterBody attackerBody = damageReport.attackerBody;
if (DamageAPI.HasModdedDamageType(damageInfo, GiveEagleOnKill) && Object.op_Implicit((Object)(object)damageReport.victimMaster))
{
EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/Bandit2KillEffect"), new EffectData
{
origin = damageInfo.position
}, true);
attackerBody.inventory.GiveItemString("ITEM_SPENT_CASING");
}
orig.Invoke(self, damageReport);
}
}
}
public abstract class SkillBase
{
public abstract string SkillName { get; }
public abstract string SkillLangTokenName { get; }
public abstract string SkillDescription { get; }
public abstract string Survivor { get; }
public abstract string SkillType { get; }
public abstract SerializableEntityStateType ActivationState { get; }
public virtual string ActivationStateMachineName { get; } = "Weapon";
public virtual int BaseMaxStock { get; } = 1;
public virtual float BaseRechargeInterval { get; } = 0f;
public virtual bool BeginSkillCooldownOnSkillEnd { get; } = true;
public virtual bool CanceledFromSprinting { get; } = false;
public virtual bool CancelSprintingOnActivation { get; } = true;
public virtual bool FullRestockOnAssign { get; } = true;
public virtual InterruptPriority InterruptPriority { get; } = (InterruptPriority)0;
public virtual bool IsCombatSkill { get; } = true;
public virtual bool MustKeyPress { get; } = false;
public virtual int RechargeStock { get; } = 1;
public virtual int RequiredStock { get; } = 1;
public virtual int StockToConsume { get; } = 1;
public abstract SkillFamily SkillFamily { get; }
public abstract Sprite SkillIcon { get; }
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add(Survivor + "_" + SkillType + "_" + SkillLangTokenName + "_" + SkillName + "_NAME", SkillName);
LanguageAPI.Add(Survivor + "_" + SkillType + "_" + SkillLangTokenName + "_DESCRIPTION", SkillDescription);
}
protected void CreateSkill()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Expected O, but got Unknown
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
val.activationState = ActivationState;
val.activationStateMachineName = ActivationStateMachineName;
val.baseMaxStock = BaseMaxStock;
val.baseRechargeInterval = BaseRechargeInterval;
val.beginSkillCooldownOnSkillEnd = BeginSkillCooldownOnSkillEnd;
val.canceledFromSprinting = CanceledFromSprinting;
val.cancelSprintingOnActivation = CancelSprintingOnActivation;
val.fullRestockOnAssign = FullRestockOnAssign;
val.interruptPriority = InterruptPriority;
val.isCombatSkill = IsCombatSkill;
val.mustKeyPress = MustKeyPress;
val.rechargeStock = RechargeStock;
val.requiredStock = RequiredStock;
val.stockToConsume = StockToConsume;
val.icon = SkillIcon;
val.skillDescriptionToken = Survivor + "_" + SkillType + "_" + SkillLangTokenName + "_DESCRIPTION";
val.skillName = Survivor + "_" + SkillType + "_" + SkillLangTokenName + "_" + SkillName + "_NAME";
val.skillNameToken = Survivor + "_" + SkillType + "_" + SkillLangTokenName + "_" + SkillName + "_NAME";
ContentAddition.AddSkillDef(val);
Array.Resize(ref SkillFamily.variants, SkillFamily.variants.Length + 1);
Variant[] variants = SkillFamily.variants;
int num = SkillFamily.variants.Length - 1;
Variant val2 = new Variant
{
skillDef = val
};
((Variant)(ref val2)).viewableNode = new Node(val.skillNameToken, false, (Node)null);
variants[num] = val2;
}
}
}
namespace RockeryPlugin.Items
{
public class BirthdayBalloon : ItemBase
{
public override string ItemName => "BirthdayBalloon";
public override string ItemLangTokenName => "BIRTHDAY_BALLOON";
public override string ItemPickupDesc => "Slightly increase jump power.";
public override string ItemFullDescription => "Increases jump power by <style=cIsDamage>15%</style> <style=cStack>(<style=cIsDamage>15%</style> per stack)</style>.";
public override string ItemLore => "Suprise!!";
public override ItemTierDef ItemTierDef => Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier1Def.asset").WaitForCompletion();
public override ItemTier Tier => (ItemTier)0;
public override Sprite ItemIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/texBirthdayBalloonIcon.png");
public override GameObject ItemModel => Assets.mainBundle.LoadAsset<GameObject>("Assets/Models/Prefabs/Items/BirthdayBalloon.fbx");
public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 };
public override void Init(ConfigFile config)
{
CreateLang();
CreateItem();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (GetItemCount(sender, out var items) > 0)
{
args.jumpPowerMultAdd += 0.15f * (float)items;
}
}
}
public class InertiaSink : ItemBase
{
public override string ItemName => "InertiaSink";
public override string ItemLangTokenName => "INERTIA_SINK";
public override string ItemPickupDesc => "Greatly decrease damage taken, but immensely increase knockback taken.";
public override string ItemFullDescription => "Increase armor by <style=cIsDamage>100</style> <style=cStack>(<style=cIsDamage>+100</style> per stack)</style>, but increase knockback revieced by <style=cIsDamage>500%</style> <style=cStack>(<style=cIsDamage>500%</style> per stack)</style>.";
public override string ItemLore => "Cool to the touch";
public override ItemTierDef ItemTierDef => Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/LunarTierDef.asset").WaitForCompletion();
public override ItemTier Tier => (ItemTier)3;
public override Sprite ItemIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/texInertiaSinkIcon.png");
public override GameObject ItemModel => Assets.mainBundle.LoadAsset<GameObject>("Assets/Models/Prefabs/Items/InertiaSink.fbx");
public override bool CanRemove => false;
public override void Init(ConfigFile config)
{
CreateLang();
CreateItem();
Hooks();
}
public override void Hooks()
{
//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
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (GetItemCount(sender, out var items) > 0)
{
args.armorAdd += (float)(100 * items);
}
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)self.body) && GetItemCount(self.body, out var items) > 0)
{
damageInfo.force *= 5f * (float)items;
}
orig.Invoke(self, damageInfo);
}
private float HyperScaling(float value, int times)
{
if (times <= 0)
{
return value;
}
return value * HyperScaling(value, times - 1);
}
}
public abstract class ItemBase
{
public ItemDef ItemDef;
public abstract string ItemName { get; }
public abstract string ItemLangTokenName { get; }
public abstract string ItemPickupDesc { get; }
public abstract string ItemFullDescription { get; }
public abstract string ItemLore { get; }
public abstract ItemTierDef ItemTierDef { get; }
public abstract ItemTier Tier { get; }
public abstract GameObject ItemModel { get; }
public abstract Sprite ItemIcon { get; }
public virtual bool Hidden { get; } = false;
public virtual bool CanRemove { get; } = true;
public virtual bool AIBlacklisted { get; set; } = false;
public virtual ItemTag[] ItemTags { get; set; } = (ItemTag[])(object)new ItemTag[0];
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescription);
LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore);
}
protected void CreateItem()
{
//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_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
if (AIBlacklisted)
{
ItemTags = new List<ItemTag>(ItemTags) { (ItemTag)4 }.ToArray();
}
ItemDef = ScriptableObject.CreateInstance<ItemDef>();
((Object)ItemDef).name = "ITEM_" + ItemLangTokenName;
ItemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME";
ItemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP";
ItemDef.descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION";
ItemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE";
ItemDef.deprecatedTier = Tier;
ItemDef.pickupModelPrefab = ItemModel;
ItemDef.pickupIconSprite = ItemIcon;
ItemDef.hidden = Hidden;
ItemDef.canRemove = CanRemove;
if (ItemTags.Length != 0)
{
ItemDef.tags = ItemTags;
}
ItemAPI.Add(new CustomItem(ItemDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
}
public abstract void Hooks();
protected int MaxItems(int items, int max)
{
return (items > max) ? max : items;
}
protected int GetItemCount(CharacterBody body, out int items)
{
items = 0;
if (Object.op_Implicit((Object)(object)body.inventory))
{
items = body.inventory.GetItemCount(ItemDef);
}
return items;
}
protected T Store<T>(T input, out T store)
{
store = input;
return store;
}
}
public class MoonBoots : ItemBase
{
public override string ItemName => "MoonBoots";
public override string ItemLangTokenName => "MOON_BOOTS";
public override string ItemPickupDesc => "Crits give you extra jumps.";
public override string ItemFullDescription => "Critical hits give you a buff up to a max of <style=cIsDamage>10</style> <style=cStack>(<style=cIsDamage>+10</style> max per stack)</style> upon jumping 1 instance of the buff is consumed to reset your jump cooldown.";
public override string ItemLore => "Shoot for the moon (TM)";
public override ItemTierDef ItemTierDef => Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion();
public override ItemTier Tier => (ItemTier)2;
public override Sprite ItemIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/texMoonBootsIcon.png");
public override GameObject ItemModel => Assets.mainBundle.LoadAsset<GameObject>("Assets/Models/Prefabs/Items/MoonBoots.fbx");
public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[2]
{
(ItemTag)4,
(ItemTag)3
};
public override void Init(ConfigFile config)
{
CreateLang();
CreateItem();
Hooks();
}
public override void Hooks()
{
//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
GlobalEventManager.OnCrit += new hook_OnCrit(GlobalEventManager_OnCrit);
CharacterMotor.FixedUpdate += new hook_FixedUpdate(CharacterMotor_FixedUpdate);
}
private void CharacterMotor_FixedUpdate(orig_FixedUpdate orig, CharacterMotor self)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
if (((ButtonState)(ref self.body.inputBank.jump)).justReleased && Store(self.body.GetBuffCount(BuffCatalog.FindBuffIndex("bdMoonJump")), out var store) > 0)
{
self.body.SetBuffCount(BuffCatalog.FindBuffIndex("bdMoonJump"), store - 1);
self.jumpCount--;
}
orig.Invoke(self);
}
private void GlobalEventManager_OnCrit(orig_OnCrit orig, GlobalEventManager self, CharacterBody body, DamageInfo damageInfo, CharacterMaster master, float procCoefficient, ProcChainMask procChainMask)
{
//IL_004b: 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)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (GetItemCount(body, out var items) > 0)
{
int buffCount = body.GetBuffCount(BuffCatalog.FindBuffIndex("bdMoonJump"));
body.SetBuffCount(BuffCatalog.FindBuffIndex("bdMoonJump"), MaxItems(buffCount + items, items * 10));
}
orig.Invoke(self, body, damageInfo, master, procCoefficient, procChainMask);
}
}
public class PrismaticCrystal : ItemBase
{
public override string ItemName => "PrismaticCrystal";
public override string ItemLangTokenName => "PRISMATIC_CRYSTAL";
public override string ItemPickupDesc => "The farther away an enemy is the more damage you do. <style=cIsVoid>Corrupts all Focus Crystals</style>.";
public override string ItemFullDescription => "Increase damage to enemies at least 13m away by <style=cIsDamage>1%</style> per meter away <style=cStack>(<style=cIsDamage>+1%</style> per meter per stack)</style>. <style=cIsVoid>Corrupts all Focus Crystals</style>.";
public override string ItemLore => "When you shine light through it only wiggling shadows are refracted out.";
public override ItemTierDef ItemTierDef => Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/DLC1/Common/VoidTier1Def.asset").WaitForCompletion();
public override ItemTier Tier => (ItemTier)6;
public override Sprite ItemIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/texPrismaticCrystalIcon.png");
public override GameObject ItemModel => Assets.mainBundle.LoadAsset<GameObject>("Assets/Models/Prefabs/Items/PrismaticCrystal/PrismaticCrystal.fbx");
public override bool CanRemove => false;
public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 };
public override void Init(ConfigFile config)
{
CreateLang();
CreateItem();
Hooks();
}
public override void Hooks()
{
//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
ContagiousItemManager.Init += new hook_Init(ContagiousItemManager_Init);
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = default(CharacterBody);
if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref body) && GetItemCount(body, out var items) > 0 && Store(Vector3.Distance(damageInfo.position, damageInfo.attacker.transform.position), out var store) >= 13f)
{
damageInfo.damageColorIndex = (DamageColorIndex)9;
damageInfo.damage *= 1f + store * ((float)items / 100f);
}
orig.Invoke(self, damageInfo);
}
private void ContagiousItemManager_Init(orig_Init orig)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
List<Pair> list = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem].ToList();
list.Add(new Pair
{
itemDef1 = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex("NearbyDamageBonus")),
itemDef2 = ItemDef
});
ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = list.ToArray();
orig.Invoke();
}
}
public class SpentCasing : ItemBase
{
public override string ItemName => "Spent Casing";
public override string ItemLangTokenName => "SPENT_CASING";
public override string ItemPickupDesc => "Increase Bandit's base damage.";
public override string ItemFullDescription => "Increase Bandit's base damage by <style=cIsDamage>1%</style> <style=cStack>(<style=cIsDamage>1%</style> per stack)</style>.";
public override string ItemLore => "A spent casing from Bandit's Desert Eagle.";
public override ItemTierDef ItemTierDef => Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/NoTierDef.asset").WaitForCompletion();
public override ItemTier Tier => (ItemTier)5;
public override Sprite ItemIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/texSpentCasingIcon.png");
public override GameObject ItemModel => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion();
public override bool CanRemove => false;
public override bool AIBlacklisted => false;
public override void Init(ConfigFile config)
{
CreateLang();
CreateItem();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
}
public void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender.inventory))
{
args.damageMultAdd += 0.01f * (float)sender.inventory.GetItemCount(ItemDef);
}
}
}
public class SpringLoadedHammer : ItemBase
{
public override string ItemName => "SpringLoadedHammer";
public override string ItemLangTokenName => "SPRING_LOADED_HAMMER";
public override string ItemPickupDesc => "Increases your knockback.";
public override string ItemFullDescription => "Increases knockback by <style=cIsDamage>150%</style> <style=cStack>(<style=cIsDamage>150%</style> per stack)</style>.";
public override string ItemLore => "BONK!";
public override ItemTierDef ItemTierDef => Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion();
public override ItemTier Tier => (ItemTier)1;
public override Sprite ItemIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Item/texSpringLoadedHammerIcon.png");
public override GameObject ItemModel => Assets.mainBundle.LoadAsset<GameObject>("Assets/Models/Prefabs/Items/SpringLoadedHammer.fbx");
public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)3 };
public override void Init(ConfigFile config)
{
CreateLang();
CreateItem();
Hooks();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = default(CharacterBody);
if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref body) && GetItemCount(body, out var items) > 0)
{
damageInfo.force *= 1f + 1.5f * (float)items;
}
orig.Invoke(self, damageInfo);
}
}
}
namespace RockeryPlugin.Equipment
{
public abstract class EquipmentBase
{
public EquipmentDef EquipmentDef;
public abstract string EquipmentName { get; }
public abstract string EquipmentLangTokenName { get; }
public abstract string EquipmentPickupDesc { get; }
public abstract string EquipmentFullDescription { get; }
public abstract string EquipmentLore { get; }
public abstract GameObject EquipmentModel { get; }
public abstract Sprite EquipmentIcon { get; }
public virtual bool AppearsInSinglePlayer { get; } = true;
public virtual bool AppearsInMultiPlayer { get; } = true;
public virtual bool CanDrop { get; } = true;
public virtual float Cooldown { get; } = 60f;
public virtual bool EnigmaCompatible { get; } = true;
public virtual bool IsBoss { get; } = false;
public virtual bool IsLunar { get; } = false;
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_NAME", EquipmentName);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP", EquipmentPickupDesc);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION", EquipmentFullDescription);
LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore);
}
protected void CreateEquipment()
{
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Expected O, but got Unknown
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
((Object)EquipmentDef).name = "EQUIPMENT_" + EquipmentLangTokenName;
EquipmentDef.nameToken = "EQUIPMENT_" + EquipmentLangTokenName + "_NAME";
EquipmentDef.pickupToken = "EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP";
EquipmentDef.descriptionToken = "EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION";
EquipmentDef.loreToken = "EQUIPMENT_" + EquipmentLangTokenName + "_LORE";
EquipmentDef.pickupModelPrefab = EquipmentModel;
EquipmentDef.pickupIconSprite = EquipmentIcon;
EquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
EquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
EquipmentDef.canDrop = CanDrop;
EquipmentDef.cooldown = Cooldown;
EquipmentDef.enigmaCompatible = EnigmaCompatible;
EquipmentDef.isBoss = IsBoss;
EquipmentDef.isLunar = IsLunar;
ItemAPI.Add(new CustomEquipment(EquipmentDef, new ItemDisplayRuleDict((ItemDisplayRule[])null)));
EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction);
}
private bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
{
if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef)
{
return ActivateEquipment(self);
}
return orig.Invoke(self, equipmentDef);
}
protected abstract bool ActivateEquipment(EquipmentSlot slot);
}
public class ProjectileAccelerator : EquipmentBase
{
public override string EquipmentName => "Projectile Accelerator";
public override string EquipmentLangTokenName => "PROJECTILE_ACCELERATOR";
public override string EquipmentPickupDesc => "Go pew pew.";
public override string EquipmentFullDescription => "Increase Base Damage by <style=cIsDamage>50%</style>, double range, and reduce all bullet spread for <style=cIsDamage>8 seconds</style>.";
public override string EquipmentLore => "Pew Pew";
public override Sprite EquipmentIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Equipment/texProjectileAcceleratorIcon.png");
public override GameObject EquipmentModel => Assets.mainBundle.LoadAsset<GameObject>("Assets/Models/Prefabs/Equipment/ProjectileAccelerator.fbx");
public override float Cooldown => 70f;
public override void Init(ConfigFile config)
{
CreateLang();
CreateEquipment();
}
protected override bool ActivateEquipment(EquipmentSlot slot)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
slot.characterBody.AddTimedBuff(BuffCatalog.FindBuffIndex("bdProjectileAcceleration"), 8f);
return true;
}
}
}
namespace RockeryPlugin.Buffs
{
public abstract class BuffBase
{
public BuffDef BuffDef;
public abstract string BuffName { get; }
public abstract Color Color { get; }
public virtual bool CanStack { get; set; } = false;
public virtual bool IsDebuff { get; set; } = false;
public abstract Sprite BuffIcon { get; }
public abstract void Init(ConfigFile config);
public void CreateBuff()
{
//IL_0025: 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)
BuffDef = ScriptableObject.CreateInstance<BuffDef>();
((Object)BuffDef).name = BuffName;
BuffDef.buffColor = Color;
BuffDef.canStack = CanStack;
BuffDef.isDebuff = IsDebuff;
BuffDef.iconSprite = BuffIcon;
ContentAddition.AddBuffDef(BuffDef);
}
public abstract void Hooks();
protected T Store<T>(T input, out T store)
{
store = input;
return store;
}
}
public class MoonJump : BuffBase
{
public override string BuffName => "bdMoonJump";
public override Color Color => Color.blue;
public override bool CanStack => true;
public override Sprite BuffIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Buff/texMoonJumpIcon.png");
public override void Init(ConfigFile config)
{
CreateBuff();
}
public override void Hooks()
{
}
}
public class ProjectileAcceleration : BuffBase
{
public override string BuffName => "bdProjectileAcceleration";
public override Color Color => Color.red;
public override bool CanStack => true;
public override Sprite BuffIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Buff/texProjectileAccelerationIcon.png");
public override void Init(ConfigFile config)
{
CreateBuff();
Hooks();
}
public override void Hooks()
{
//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
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
GenericBulletBaseState.ModifyBullet += new hook_ModifyBullet(GenericBulletBaseState_ModifyBullet);
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (Store(sender.GetBuffCount(BuffCatalog.FindBuffIndex("bdProjectileAcceleration")), out var _) > 0)
{
args.damageMultAdd += 0.5f;
}
}
public void GenericBulletBaseState_ModifyBullet(orig_ModifyBullet orig, GenericBulletBaseState self, BulletAttack bulletAttack)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
if (Store(((EntityState)self).characterBody.GetBuffCount(BuffCatalog.FindBuffIndex("bdProjectileAcceleration")), out var _) > 0)
{
bulletAttack.spreadPitchScale = 0f;
bulletAttack.spreadYawScale = 0f;
bulletAttack.maxSpread = 0f;
bulletAttack.minSpread = 0f;
bulletAttack.falloffModel = (FalloffModel)0;
bulletAttack._maxDistance *= 1.5f;
}
orig.Invoke(self, bulletAttack);
}
}
}
namespace RockeryPlugin.AssetBundles
{
public static class Assets
{
public static AssetBundle mainBundle;
public const string bundleName = "rockery";
public const string assetBundleFolder = "AssetBundles";
public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(RockeryPlugin.PInfo.Location), "AssetBundles", "rockery");
public static void Init()
{
mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
if ((Object)(object)mainBundle != (Object)null)
{
Log.Debug("Assets loaded");
}
else
{
Log.Debug("Assets failed to load");
}
}
}
}
namespace RockeryPlugin.Artifacts
{
public abstract class ArtifactBase
{
public ArtifactDef ArtifactDef;
public abstract string ArtifactName { get; }
public abstract string ArtifactLangTokenName { get; }
public abstract string ArtifactDescription { get; }
public abstract Sprite ArtifactEnabledIcon { get; }
public abstract Sprite ArtifactDisabledIcon { get; }
public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
public abstract void Init(ConfigFile config);
protected void CreateLang()
{
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription);
}
protected void CreateArtifact()
{
ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
ArtifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
ArtifactDef.smallIconSelectedSprite = ArtifactEnabledIcon;
ArtifactDef.smallIconDeselectedSprite = ArtifactDisabledIcon;
ContentAddition.AddArtifactDef(ArtifactDef);
}
public abstract void Hooks();
}
public class ArtifactOfGreed : ArtifactBase
{
public class GreedBehavior : MonoBehaviour
{
private const int delayBalanceCycle = 6;
private const float secondsPerBalance = 60f;
private int previousBalanceCycle;
private Run run;
private Xoroshiro128Plus greedRng;
private void Awake()
{
Chat.AddMessage("Greedy!");
}
private void Update()
{
int currentBalanceCycle = GetCurrentBalanceCycle();
if (previousBalanceCycle < currentBalanceCycle - 6)
{
previousBalanceCycle = currentBalanceCycle;
PerformBalance();
}
}
private void PerformBalance()
{
//IL_013c: 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_0129: Expected O, but got Unknown
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Invalid comparison between Unknown and I4
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Invalid comparison between Unknown and I4
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
CharacterBody val = null;
CharacterBody val2 = null;
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (!Object.op_Implicit((Object)(object)instance.master) || !Object.op_Implicit((Object)(object)instance.master.inventory))
{
return;
}
if (!Object.op_Implicit((Object)(object)((val != null) ? val.inventory : null)) || ItemScore(val.inventory) < ItemScore(instance.master.inventory))
{
val = instance.master.GetBody();
}
if (!Object.op_Implicit((Object)(object)((val2 != null) ? val2.inventory : null)) || ItemScore(val2.inventory) > ItemScore(instance.master.inventory))
{
val2 = instance.master.GetBody();
}
}
if (greedRng == null)
{
greedRng = new Xoroshiro128Plus(Run.instance.seed);
}
List<ItemIndex> list = new List<ItemIndex>(val.inventory.itemAcquisitionOrder);
ItemIndex val3 = (ItemIndex)(-1);
Util.ShuffleList<ItemIndex>(list, greedRng);
foreach (ItemIndex item in list)
{
ItemDef itemDef = ItemCatalog.GetItemDef(item);
if (Object.op_Implicit((Object)(object)itemDef) && (int)itemDef.tier != 5)
{
val3 = item;
break;
}
}
if ((int)val3 != -1)
{
Chat.AddMessage("Moving " + ((Object)ItemCatalog.GetItemDef(val3)).name + " from " + ((Object)val).name + " to " + ((Object)val2).name);
val.inventory.RemoveItem(val3, 1);
val2.inventory.GiveItem(val3, 1);
}
}
private int GetCurrentBalanceCycle()
{
return Mathf.FloorToInt(run.GetRunStopwatch() / 60f);
}
private int ItemScore(Inventory inventory)
{
return inventory.GetTotalItemCountOfTier((ItemTier)0) + inventory.GetTotalItemCountOfTier((ItemTier)1) * 3 + inventory.GetTotalItemCountOfTier((ItemTier)2) * 12 + inventory.GetTotalItemCountOfTier((ItemTier)3) * 4 + inventory.GetTotalItemCountOfTier((ItemTier)6) + inventory.GetTotalItemCountOfTier((ItemTier)7) * 3 + inventory.GetTotalItemCountOfTier((ItemTier)8) * 12 + inventory.GetTotalItemCountOfTier((ItemTier)4) * 4 + inventory.GetTotalItemCountOfTier((ItemTier)9) * 4;
}
}
public override string ArtifactName => "Artifact of Greed";
public override string ArtifactLangTokenName => "ARTIFACT_OF_GREED";
public override string ArtifactDescription => "Every 30s the player with the highest item score will have a random item transfered to the player with the lowest item score.";
public override Sprite ArtifactEnabledIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifact/texArtifactGreedEnabled.png");
public override Sprite ArtifactDisabledIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifact/texArtifactGreedDisabled.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateArtifact();
Hooks();
}
private void CreateConfig(ConfigFile config)
{
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
Run.Start += new hook_Start(Run_Start);
}
private void Run_Start(orig_Start orig, Run self)
{
if (NetworkServer.active && base.ArtifactEnabled)
{
((Component)self).gameObject.AddComponent<GreedBehavior>();
}
orig.Invoke(self);
}
}
public class ArtifactOfRobbery : ArtifactBase
{
private Xoroshiro128Plus robberyRng;
public override string ArtifactName => "Artifact of Rob Rockery";
public override string ArtifactLangTokenName => "ARTIFACT_OF_ROBBERY";
public override string ArtifactDescription => "Scrap a random stack of items on death.";
public override Sprite ArtifactEnabledIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifact/texArtifactRobberyEnabled.png");
public override Sprite ArtifactDisabledIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifact/texArtifactRobberyDisabled.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateArtifact();
Hooks();
}
private void CreateConfig(ConfigFile config)
{
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
GlobalEventManager.OnPlayerCharacterDeath += new hook_OnPlayerCharacterDeath(GlobalEventManager_OnPlayerCharacterDeath);
}
private void GlobalEventManager_OnPlayerCharacterDeath(orig_OnPlayerCharacterDeath orig, GlobalEventManager self, DamageReport damageReport, NetworkUser victimNetworkUser)
{
//IL_004b: 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_0032: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Invalid comparison between Unknown and I4
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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_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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Expected I4, but got Unknown
//IL_00a0: 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)
if (base.ArtifactEnabled)
{
if (robberyRng == null)
{
robberyRng = new Xoroshiro128Plus(Run.instance.seed);
}
List<ItemIndex> list = new List<ItemIndex>(victimNetworkUser.GetCurrentBody().inventory.itemAcquisitionOrder);
ItemIndex val = (ItemIndex)(-1);
Util.ShuffleList<ItemIndex>(list, robberyRng);
foreach (ItemIndex item in list)
{
ItemDef itemDef = ItemCatalog.GetItemDef(item);
if (Object.op_Implicit((Object)(object)itemDef) && (int)itemDef.tier != 5 && !itemDef.ContainsTag((ItemTag)10))
{
val = item;
break;
}
}
if ((int)val != -1)
{
int itemCount = victimNetworkUser.GetCurrentBody().inventory.GetItemCount(val);
victimNetworkUser.GetCurrentBody().inventory.RemoveItem(val, itemCount);
ItemTier tier = ItemCatalog.GetItemDef(val).tier;
ItemTier val2 = tier;
switch ((int)val2)
{
case 3:
victimNetworkUser.GetCurrentBody().inventory.GiveItemString("Pearl", itemCount);
break;
case 4:
case 9:
victimNetworkUser.GetCurrentBody().inventory.GiveItemString("ScrapYellow", itemCount);
break;
case 2:
case 8:
victimNetworkUser.GetCurrentBody().inventory.GiveItemString("ScrapRed", itemCount);
break;
case 1:
case 7:
victimNetworkUser.GetCurrentBody().inventory.GiveItemString("ScrapGreen", itemCount);
break;
default:
victimNetworkUser.GetCurrentBody().inventory.GiveItemString("ScrapWhite", itemCount);
break;
}
}
}
orig.Invoke(self, damageReport, victimNetworkUser);
}
}
public class ArtifactOfTheSlayer : ArtifactBase
{
public override string ArtifactName => "Artifact of The Slayer";
public override string ArtifactLangTokenName => "ARTIFACT_OF_THE_SLAYER";
public override string ArtifactDescription => "Only spawn champions.";
public override Sprite ArtifactEnabledIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifact/texArtifactSlayerEnabled.png");
public override Sprite ArtifactDisabledIcon => Assets.mainBundle.LoadAsset<Sprite>("Assets/Textures/Icons/Artifact/texArtifactSlayerDisabled.png");
public override void Init(ConfigFile config)
{
CreateConfig(config);
CreateLang();
CreateArtifact();
Hooks();
}
private void CreateConfig(ConfigFile config)
{
}
public override void Hooks()
{
//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.Start += new hook_Start(Run_Start);
CombatDirector.Awake += new hook_Awake(CombatDirector_Awake);
ClassicStageInfo.HandleMixEnemyArtifact += new hook_HandleMixEnemyArtifact(ClassicStageInfo_HandleMixEnemyArtifact);
}
private void ClassicStageInfo_HandleMixEnemyArtifact(orig_HandleMixEnemyArtifact orig, DirectorCardCategorySelection monsterCategories, Xoroshiro128Plus rng)
{
monsterCategories.CopyFrom(RoR2Content.mixEnemyMonsterCards);
if (monsterCategories.categories.Length == 0)
{
Debug.LogError((object)"MixEnemy monster cards are size 0!");
}
if (base.ArtifactEnabled)
{
TrimCategory("Basic Monsters", 0);
TrimCategory("Minibosses", 0);
TrimCategory("Champions", 9);
}
else
{
TrimCategory("Basic Monsters", 3);
TrimCategory("Minibosses", 3);
TrimCategory("Champions", 3);
}
void TrimCategory(string categoryName, int requiredCount)
{
Category[] categories = monsterCategories.categories;
for (int j = 0; j < categories.Length; j++)
{
if (string.CompareOrdinal(categoryName, categories[j].name) == 0)
{
Debug.LogFormat("Trimming {0} from {1} to {2}", new object[3]
{
categoryName,
categories[j].cards.Length,
requiredCount
});
TrimSelection(ref categories[j].cards, requiredCount);
}
}
}
void TrimSelection(ref DirectorCard[] cards, int requiredCount)
{
if (cards.Length > requiredCount)
{
DirectorCard[] array = ArrayUtils.Clone<DirectorCard>(cards);
Util.ShuffleArray<DirectorCard>(array, rng);
int num = array.Length - 1;
while (num >= 0 && array.Length > requiredCount)
{
if (!array[num].IsAvailable())
{
ArrayUtils.ArrayRemoveAtAndResize<DirectorCard>(ref array, num, 1);
}
num--;
}
if (array.Length > requiredCount)
{
Array.Resize(ref array, requiredCount);
}
cards = array;
DirectorCard[] array2 = cards;
DirectorCard[] array3 = array2;
foreach (DirectorCard val in array3)
{
Debug.LogFormat("Selected {0}", new object[1] { ((Object)val.spawnCard).name });
}
}
}
}
private void CombatDirector_Awake(orig_Awake orig, CombatDirector self)
{
if (base.ArtifactEnabled)
{
self.monsterCredit = 1000f;
self.creditMultiplier += 0.5f;
self.maxConsecutiveCheapSkips = 4;
}
orig.Invoke(self);
}
private void Run_Start(orig_Start orig, Run self)
{
if (NetworkServer.active && base.ArtifactEnabled)
{
List<string> list = new List<string>();
list.Add(MonsterNames.AlloyVulture);
list.Add(MonsterNames.AlphaConstruct);
list.Add(MonsterNames.Beetle);
list.Add(MonsterNames.BeetleGuard);
list.Add(MonsterNames.BighornBison);
list.Add(MonsterNames.BlindPest);
list.Add(MonsterNames.BlindPestSnowy);
list.Add(MonsterNames.BlindVermin);
list.Add(MonsterNames.BlindVerminSnowy);
list.Add(MonsterNames.BrassContraption);
list.Add(MonsterNames.ClayApothecary);
list.Add(MonsterNames.ClayTemplar);
list.Add(MonsterNames.ElderLemurian);
list.Add(MonsterNames.Geep);
list.Add(MonsterNames.Gip);
list.Add(MonsterNames.GreaterWisp);
list.Add(MonsterNames.Gup);
list.Add(MonsterNames.HermitCrab);
list.Add(MonsterNames.Imp);
list.Add(MonsterNames.Jellyfish);
list.Add(MonsterNames.Larva);
list.Add(MonsterNames.Lemurian);
list.Add(MonsterNames.LesserWisp);
list.Add(MonsterNames.LunarChimeraExploder);
list.Add(MonsterNames.LunarChimeraGolem);
list.Add(MonsterNames.LunarChimeraWisp);
list.Add(MonsterNames.MiniMushrum);
list.Add(MonsterNames.Parent);
list.Add(MonsterNames.SolusProbe);
list.Add(MonsterNames.StoneGolem);
list.Add(MonsterNames.StoneGolem + "nature");
list.Add(MonsterNames.StoneGolem + "snowy");
list.Add(MonsterNames.VoidBarnacle);
list.Add(MonsterNames.VoidInfestor);
list.Add(MonsterNames.VoidJailer);
list.Add(MonsterNames.VoidReaver);
list.ForEach((Action<string>)Helpers.RemoveExistingMonster);
}
orig.Invoke(self);
}
}
}