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 EntityStates;
using On.RoR2;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("KusanagiItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KusanagiItems")]
[assembly: AssemblyTitle("KusanagiItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace KusanagiItems;
internal class Assets
{
public static AssetBundle MainAssetBundle;
public static T Load<T>(string name) where T : Object
{
return MainAssetBundle.LoadAsset<T>(name);
}
public static void PopulateAssets()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = executingAssembly.GetManifestResourceStream("KusanagiItems.AssetBundle." + "KusanagiItems".ToLower() + "assets"))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
internal class Behaviour : MonoBehaviour
{
private CharacterBody body;
private void Awake()
{
body = ((Component)this).GetComponent<CharacterBody>();
}
}
internal class OverlapHitboxBehaviour : MonoBehaviour
{
public HitBoxGroup hitbox;
private Vector3[] originalScale;
private Inventory inventory;
private HitBox[] hitboxes;
private int itemCount;
public void SetScale(HitBoxGroup h, Inventory inv)
{
//IL_0068: 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)
inventory = inv;
inventory.onInventoryChanged += Inventory_onInventoryChanged;
hitbox = h;
hitboxes = hitbox.hitBoxes;
int num = hitboxes.Length;
originalScale = (Vector3[])(object)new Vector3[num];
for (int i = 0; i < num; i++)
{
HitBox val = hitboxes[i];
originalScale[i] = ((Component)val).transform.localScale;
}
SetScale();
}
private void SetScale()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)hitbox) || !Object.op_Implicit((Object)(object)inventory))
{
return;
}
itemCount = inventory.GetItemCountEffective(Prefabs.extender);
if (itemCount == 0)
{
Object.Destroy((Object)(object)this);
return;
}
float num = 1f + MainPlugin.extenderCoef.Value * (float)itemCount;
for (int i = 0; i < hitboxes.Length; i++)
{
((Component)hitboxes[i]).transform.localScale = originalScale[i] * num;
}
}
private void OnDisable()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)hitbox))
{
for (int i = 0; i < hitboxes.Length; i++)
{
((Component)hitboxes[i]).transform.localScale = originalScale[i];
}
}
if (Object.op_Implicit((Object)(object)inventory))
{
inventory.onInventoryChanged -= Inventory_onInventoryChanged;
}
}
private void Inventory_onInventoryChanged()
{
SetScale();
}
}
internal class Hook
{
internal static 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
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
ProjectileController.Start += new hook_Start(ProjectileController_Start);
BulletAttack.Fire += new hook_Fire(BulletAttack_Fire);
BlastAttack.Fire += new hook_Fire(BlastAttack_Fire);
CharacterMaster.TryRegenerateScrap += new hook_TryRegenerateScrap(CharacterMaster_TryRegenerateScrap);
PurchaseInteraction.CanBeAffordedByInteractor += new hook_CanBeAffordedByInteractor(PurchaseInteraction_CanBeAffordedByInteractor);
PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
GenericDamageOrb.Begin += new hook_Begin(GenericDamageOrb_Begin);
LightningOrb.Begin += new hook_Begin(LightningOrb_Begin);
OverlapAttack.Fire += new hook_Fire(OverlapAttack_Fire);
}
private static void EffectManager_SpawnEffect_EffectIndex_EffectData_bool(orig_SpawnEffect_EffectIndex_EffectData_bool orig, EffectIndex effectIndex, EffectData effectData, bool transmit)
{
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
if (RoR2Application.isInSinglePlayer && effectData.scale > 1f)
{
int num = 0;
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (Object.op_Implicit((Object)(object)instance.body) && Object.op_Implicit((Object)(object)instance.body.inventory))
{
num += instance.body.inventory.GetItemCountEffective(Prefabs.extender);
}
}
if (num > 0)
{
effectData.scale *= 1f + 0.05f * (float)num;
}
}
orig.Invoke(effectIndex, effectData, transmit);
}
private static void LightningOrb_Begin(orig_Begin orig, LightningOrb self)
{
if (Object.op_Implicit((Object)(object)self.attacker))
{
CharacterBody component = self.attacker.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.extender);
if (itemCountEffective > 0)
{
float num = 1f + MainPlugin.extenderCoef.Value * (float)itemCountEffective;
self.speed *= num;
}
}
}
orig.Invoke(self);
}
private static bool OverlapAttack_Fire(orig_Fire orig, OverlapAttack self, List<HurtBox> hitResults)
{
bool flag = !Object.op_Implicit((Object)(object)self.attacker);
if (Object.op_Implicit((Object)(object)self.inflictor) && Object.op_Implicit((Object)(object)self.inflictor.GetComponent<ProjectileController>()))
{
flag = true;
}
if (!flag)
{
OverlapHitboxBehaviour[] components = self.attacker.GetComponents<OverlapHitboxBehaviour>();
foreach (OverlapHitboxBehaviour overlapHitboxBehaviour in components)
{
if ((Object)(object)overlapHitboxBehaviour.hitbox == (Object)(object)self.hitBoxGroup)
{
flag = true;
break;
}
}
}
if (!flag)
{
CharacterBody component = self.attacker.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.extender);
if (itemCountEffective > 0)
{
self.attacker.AddComponent<OverlapHitboxBehaviour>().SetScale(self.hitBoxGroup, component.inventory);
}
}
}
return orig.Invoke(self, hitResults);
}
private static void GenericDamageOrb_Begin(orig_Begin orig, GenericDamageOrb self)
{
if (Object.op_Implicit((Object)(object)self.attacker))
{
CharacterBody component = self.attacker.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.extender);
if (itemCountEffective > 0)
{
float num = 1f + MainPlugin.extenderCoef.Value * (float)itemCountEffective;
self.speed *= num;
}
}
}
orig.Invoke(self);
}
private static void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: 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)
int cost = self.cost;
if (Object.op_Implicit((Object)(object)activator) && self.CanBeAffordedByInteractor(activator) && (int)self.costType == 4)
{
CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.regenWhiteScrap);
if (itemCountEffective > 0)
{
int num = self.cost;
ItemTransformation val = default(ItemTransformation);
((ItemTransformation)(ref val)).originalItemIndex = Prefabs.regenWhiteScrap.itemIndex;
((ItemTransformation)(ref val)).newItemIndex = Prefabs.regenWhiteScrapConsumed.itemIndex;
((ItemTransformation)(ref val)).maxToTransform = self.cost;
((ItemTransformation)(ref val)).allowWhenDisabled = true;
val.transformationType = (ItemTransformationTypeIndex)0;
TryTransformResult val2 = default(TryTransformResult);
((ItemTransformation)(ref val)).TryTransform(component.inventory, ref val2);
if (itemCountEffective < cost)
{
self.cost = cost - itemCountEffective;
num = itemCountEffective;
}
for (int i = 0; i < num; i++)
{
PurchaseInteraction.CreateItemTakenOrb(component.corePosition, ((Component)self).gameObject, Prefabs.regenWhiteScrap.itemIndex);
}
if (itemCountEffective >= cost)
{
IEnumerable<StatDef> enumerable = ((IEnumerable<string>)self.purchaseStatNames).Select((Func<string, StatDef>)StatDef.Find);
StatManager.OnPurchase<IEnumerable<StatDef>>(component, self.costType, enumerable);
((UnityEvent<Interactor>)(object)self.onPurchase).Invoke(activator);
self.lastActivator = activator;
return;
}
}
}
}
orig.Invoke(self, activator);
if (self.cost != cost)
{
self.cost = cost;
}
}
private static bool PurchaseInteraction_CanBeAffordedByInteractor(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
if (Object.op_Implicit((Object)(object)activator) && (int)self.costType == 4)
{
CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.regenWhiteScrap);
if (itemCountEffective > 0)
{
return true;
}
}
}
return orig.Invoke(self, activator);
}
private static void CharacterMaster_TryRegenerateScrap(orig_TryRegenerateScrap orig, CharacterMaster self)
{
//IL_000b: 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_002a: 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)
orig.Invoke(self);
ItemTransformation val = default(ItemTransformation);
((ItemTransformation)(ref val)).originalItemIndex = Prefabs.regenWhiteScrapConsumed.itemIndex;
((ItemTransformation)(ref val)).newItemIndex = Prefabs.regenWhiteScrap.itemIndex;
((ItemTransformation)(ref val)).maxToTransform = int.MaxValue;
val.transformationType = (ItemTransformationTypeIndex)5;
TryTransformResult val2 = default(TryTransformResult);
((ItemTransformation)(ref val)).TryTransform(self.inventory, ref val2);
}
private static Result BlastAttack_Fire(orig_Fire orig, BlastAttack self)
{
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (Object.op_Implicit((Object)(object)self.inflictor) && Object.op_Implicit((Object)(object)self.inflictor.GetComponent<ProjectileController>()))
{
flag = true;
}
if (Object.op_Implicit((Object)(object)self.attacker) && !flag)
{
CharacterBody component = self.attacker.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.extender);
if (itemCountEffective > 0)
{
float num = 1f + MainPlugin.extenderCoef.Value * (float)itemCountEffective;
self.radius *= num;
}
}
}
return orig.Invoke(self);
}
private static void BulletAttack_Fire(orig_Fire orig, BulletAttack self)
{
if (Object.op_Implicit((Object)(object)self.owner))
{
CharacterBody component = self.owner.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory))
{
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.extender);
if (itemCountEffective > 0)
{
float num = 1f + MainPlugin.extenderCoef.Value * (float)itemCountEffective;
self.maxDistance *= num;
}
}
}
orig.Invoke(self);
}
private static void ProjectileController_Start(orig_Start orig, ProjectileController self)
{
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
GameObject owner = self.owner;
if (!Object.op_Implicit((Object)(object)owner))
{
return;
}
CharacterBody component = owner.GetComponent<CharacterBody>();
if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory))
{
return;
}
int itemCountEffective = component.inventory.GetItemCountEffective(Prefabs.extender);
if (itemCountEffective <= 0)
{
return;
}
float num = 1f + MainPlugin.extenderCoef.Value * (float)itemCountEffective;
ProjectileSimple component2 = ((Component)self).GetComponent<ProjectileSimple>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.lifetime *= num;
component2.desiredForwardSpeed *= num;
component2.SetForwardSpeed(component2.desiredForwardSpeed);
}
MissileController component3 = ((Component)self).GetComponent<MissileController>();
if (Object.op_Implicit((Object)(object)component3))
{
component3.maxVelocity *= num;
component3.acceleration *= num;
component3.rollVelocity *= num;
component3.deathTimer *= num;
component3.maxSeekDistance *= num;
}
ProjectileCharacterController component4 = ((Component)self).GetComponent<ProjectileCharacterController>();
if (Object.op_Implicit((Object)(object)component4))
{
component4.lifetime *= num;
component4.velocity *= num;
}
ProjectileExplosion component5 = ((Component)self).GetComponent<ProjectileExplosion>();
if (Object.op_Implicit((Object)(object)component5))
{
component5.blastRadius *= num;
}
ProjectileOverlapAttack component6 = ((Component)self).GetComponent<ProjectileOverlapAttack>();
if (Object.op_Implicit((Object)(object)component6))
{
Transform[] hitboxTransforms = component6.HitboxTransforms;
foreach (Transform val in hitboxTransforms)
{
Transform transform = ((Component)val).transform;
transform.localScale *= num;
}
for (int j = 0; j < component6.HitboxOriginalScales.Length; j++)
{
ref Vector3 reference = ref component6.HitboxOriginalScales[j];
reference *= num;
}
}
ProjectileDotZone component7 = ((Component)self).GetComponent<ProjectileDotZone>();
if (Object.op_Implicit((Object)(object)component7))
{
Transform transform2 = ((Component)self).transform;
transform2.localScale *= num;
}
}
}
[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("com.Dragonyck.KusanagiItems", "KusanagiItems", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
public const string MODUID = "com.Dragonyck.KusanagiItems";
public const string MODNAME = "KusanagiItems";
public const string VERSION = "1.0.0";
internal const string MODKEY = "KUSANAGIITEMS_";
internal static ConfigEntry<float> extenderCoef;
private void Awake()
{
extenderCoef = ((BaseUnityPlugin)this).Config.Bind<float>("Magnifying Glass", "Coefficient", 0.05f, (ConfigDescription)null);
Assets.PopulateAssets();
Prefabs.CreatePrefabs();
Hook.Hooks();
}
}
internal class Prefabs
{
internal const string Prefix = "KUSANAGI_";
internal static Material baseMaterial = Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat");
internal static ItemDef regenWhiteScrap;
internal static ItemDef regenWhiteScrapConsumed;
internal static GameObject regenWhiteScrapPickupModel;
internal static ItemDef extender;
internal static GameObject extenderPickupModel;
internal static void CreatePrefabs()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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)
regenWhiteScrapPickupModel = Instantiate("RoR2/DLC1/RegeneratingScrap/PickupRegeneratingScrap.prefab", "regenWhiteScrapPickupModel");
MeshRenderer[] componentsInChildren = regenWhiteScrapPickupModel.GetComponentsInChildren<MeshRenderer>();
Material val = new Material(((Renderer)componentsInChildren[0]).material);
((Renderer)componentsInChildren[0]).material = val;
val.DisableKeyword("SPLATMAP");
val = new Material(((Renderer)componentsInChildren[1]).material);
((Renderer)componentsInChildren[1]).material = val;
val.SetColor("_Color", Color32.op_Implicit(new Color32((byte)103, (byte)84, (byte)61, byte.MaxValue)));
val.SetColor("_EmColor", Color.cyan);
ItemDef val2 = Load<ItemDef>("RoR2/DLC1/RegeneratingScrap/RegeneratingScrap.asset");
string text = "REGENWHITESCRAP";
regenWhiteScrap = NewItemDef(text, regenWhiteScrapPickupModel, (ItemTier)0, val2.tags);
LanguageAPI.Add("KUSANAGI_" + text + "_NAME", "Regenerating White Scrap");
LanguageAPI.Add("KUSANAGI_" + text + "_DESCRIPTION", "Does nothing. Prioritized when used with <style=cStack>Common</style> 3D Printers. At the start of each stage, it regenerates.");
LanguageAPI.Add("KUSANAGI_" + text + "_PICKUP", "Prioritized when used with <style=cStack>Common</style> 3D Printers. Usable once per stage.");
LanguageAPI.Add("KUSANAGI_" + text + "_LORE", "\"Hey, Joe, how's the work in engineering?\"\r\n\r\n\"once again, Terrible. We have a shipment of another weird, prototype material. another weird metal, like last time, it doesn't seem to run out, it seems more fragile than last time. Thing is, no matter how much I take, there always seems to be more. Did you know I made five hundred metal plates from a 2 kilo crate of metal?\"\r\n\r\n\"crazy stuff..\"\r\n\r\n\"you don't say, it never runs out\"\r\n\r\n\"with this, and the previous material, perhaps there can be a lot of more things to be made.\"");
text = "REGENWHITESCRAPCONSUMED";
regenWhiteScrapConsumed = NewItemDef(text, regenWhiteScrapPickupModel, (ItemTier)5, (ItemTag)3, (ItemTag)20);
LanguageAPI.Add("KUSANAGI_" + text + "_NAME", "Regenerating White Scrap (Consumed)");
LanguageAPI.Add("KUSANAGI_" + text + "_DESCRIPTION", "At the start of each stage, it transforms into Regenerating White Scrap.");
LanguageAPI.Add("KUSANAGI_" + text + "_PICKUP", "At the start of each stage, it transforms into Regenerating White Scrap.");
extenderPickupModel = Instantiate(Assets.Load<GameObject>("ItemMdl"), "ExtenderPickupModel");
ChildLocator component = extenderPickupModel.GetComponent<ChildLocator>();
ModelPanelParameters val3 = extenderPickupModel.AddComponent<ModelPanelParameters>();
val3.focusPointTransform = component.FindChild("FocusPoint");
val3.cameraPositionTransform = component.FindChild("CameraPosition");
((Renderer)((Component)component.FindChild("handle")).GetComponent<MeshRenderer>()).material = Load<Material>("RoR2/Base/Common/TrimSheets/matTrimSheetMetalNoEmission.mat");
((Renderer)((Component)component.FindChild("glass")).GetComponent<MeshRenderer>()).material = Load<Material>("RoR2/Base/artifactworld/matArtifactGlassOverlay.mat");
text = "EXTENDER";
string name = text;
GameObject pickupModelPrefab = extenderPickupModel;
ItemTag[] array = new ItemTag[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
extender = NewItemDef(name, pickupModelPrefab, (ItemTier)0, (ItemTag[])(object)array);
LanguageAPI.Add("KUSANAGI_" + text + "_NAME", "Magnifying Glass");
LanguageAPI.Add("KUSANAGI_" + text + "_DESCRIPTION", "Increases <style=cIsDamage>range</style>, <style=cIsDamage>AOE</style>, and <style=cIsUtility>projectile speed</style> by <style=cIsDamage>" + MainPlugin.extenderCoef.Value * 100f + "%</style> <style=cStack>(+" + MainPlugin.extenderCoef.Value * 100f + "% per stack)</style>.");
LanguageAPI.Add("KUSANAGI_" + text + "_PICKUP", "Increases range, AOE, and projectile speed.");
LanguageAPI.Add("KUSANAGI_" + text + "_LORE", "Shipment Details\r\nID: #8841-GLS\r\nDestination: Unspecified Research Outpost, Sector Delta\r\nContents: 1× Optical Instrument – Handheld (Magnifying Glass)\r\nNotes: Prototype marked “Field Amplifier Lens – Iteration 3.” Handle with care.\r\n\r\nRecorded Correspondence\r\n\r\nFrom: Dr. L. Kessler\r\nTo: Logistics\r\n\r\nYou asked what this thing does. The short answer: it makes everything bigger.\r\n\r\nThe lens compound isn’t normal glass. It bends more than light—it bends trajectories. Projectiles passing through its focal corridor accelerate and expand slightly, like they’ve been convinced they were always meant to be larger.\r\n\r\nRange tests are… concerning.\r\n\r\nA standard test round maintained cohesion nearly three times the expected distance. Explosive payloads detonated with an expanded blast radius. Even particulate emissions grew denser.\r\n\r\nThe interns are calling it the “Magnifying Glass.” I told them that name undersells the physics violation happening here.\r\n\r\nThe real issue is the feedback effect. The longer you hold the lens in alignment with a target, the more the environment seems to cooperate—distance shrinks, projectiles surge forward faster, impacts bloom wider.\r\n\r\nIt’s as if the universe briefly agrees with your aim.\r\n\r\nPlease stop asking if we can weaponize it further. We already have.\r\n\r\nJust make sure the next crate includes gloves. Someone tried looking through the lens during a live test.\r\n\r\nWe still haven't found the bullet.\r\n\r\n");
}
internal static ItemDef NewItemDef(string name, GameObject pickupModelPrefab, ItemTier tier, params ItemTag[] tags)
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Invalid comparison between Unknown and I4
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
((Object)val).name = "KUSANAGI_" + name;
val.nameToken = "KUSANAGI_" + name + "_NAME";
val.descriptionToken = "KUSANAGI_" + name + "_DESCRIPTION";
val.pickupToken = "KUSANAGI_" + name + "_PICKUP";
val.loreToken = "KUSANAGI_" + name + "_LORE";
val.pickupIconSprite = Assets.Load<Sprite>(name);
val.pickupModelPrefab = pickupModelPrefab;
if ((int)tier == 0)
{
val._itemTierDef = Load<ItemTierDef>("RoR2/Base/Common/Tier1Def.asset");
}
val.tier = tier;
val.deprecatedTier = tier;
val.tags = tags;
ContentAddition.AddItemDef(val);
return val;
}
internal static T Load<T>(string path)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
}
internal static GameObject Instantiate(string path, string name, bool registerNetwork = false)
{
return PrefabAPI.InstantiateClone(Load<GameObject>(path), name, registerNetwork);
}
internal static GameObject Instantiate(GameObject obj, string name, bool registerNetwork = false)
{
return PrefabAPI.InstantiateClone(obj, name, registerNetwork);
}
public static Material InstantiateDefaultSurvivorMaterial(Texture tex)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_001d: 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)
Material val = new Material(baseMaterial);
if (Object.op_Implicit((Object)(object)val))
{
val.SetColor("_Color", Color.white);
val.SetTexture("_MainTex", tex);
val.SetColor("_EmColor", Color.black);
val.SetFloat("_EmPower", 0f);
val.SetTexture("_EmTex", (Texture)null);
val.SetFloat("_NormalStrength", 1f);
val.SetTexture("_NormalTex", (Texture)null);
return val;
}
return val;
}
public static Material InstantiateDefaultSurvivorMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
Material val = new Material(baseMaterial);
if (Object.op_Implicit((Object)(object)val))
{
val.SetColor("_Color", color);
val.SetTexture("_MainTex", tex);
val.SetColor("_EmColor", emColor);
val.SetFloat("_EmPower", emPower);
val.SetTexture("_EmTex", emTex);
val.SetFloat("_NormalStrength", 1f);
val.SetTexture("_NormalTex", normTex);
return val;
}
return val;
}
}
internal static class Extensions
{
public static GameObject GetGameObject(this EntityState state)
{
return state.gameObject;
}
public static GameObject NewSyringe(this GameObject g, params Material[] m)
{
((Renderer)g.GetComponentsInChildren<MeshRenderer>(false)[0]).material = m[0];
((Renderer)g.GetComponent<TrailRenderer>()).material = m[1];
((Renderer)g.GetComponent<ParticleSystemRenderer>()).material = m[2];
return g;
}
public static Material SwapTexture(this Material m, Texture2D t)
{
m.mainTexture = (Texture)(object)t;
return m;
}
public static GameObject SwapMaterials(this GameObject g, Material[] m)
{
Renderer[] componentsInChildren = g.GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (Object.op_Implicit((Object)(object)m[i]))
{
componentsInChildren[i].material = m[i];
}
}
return g;
}
public static float Mult(this float f, float mult = 100f)
{
return f * mult;
}
public static Color ToRGB255(this Color c, string title, string body)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
return new Color(c.r / 255f, c.g / 255f, c.b / 255f);
}
public static void SetStrings(this TooltipProvider t, string title, string body)
{
t.overrideTitleText = title;
t.overrideBodyText = body;
}
}
internal class Utils
{
internal static void RecolorEffect(GameObject obj, Color color)
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)obj))
{
return;
}
OmniEffect component = obj.GetComponent<OmniEffect>();
if (Object.op_Implicit((Object)(object)component))
{
Object.DestroyImmediate((Object)(object)obj.GetComponent<OmniEffect>());
}
Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>(Object.op_Implicit((Object)(object)component));
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Component)componentsInChildren[i]).gameObject.SetActive(true);
if (Object.op_Implicit((Object)(object)componentsInChildren[i].material) && componentsInChildren[i].material.HasProperty("_TintColor"))
{
componentsInChildren[i].material.SetColor("_TintColor", color);
}
}
}
public static Vector3 FindNearestNodePosition(Vector3 targetPosition, GraphType nodeGraphType)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
val.hullSize = (HullClassification)1;
val.nodeGraphType = nodeGraphType;
val.prefab = Prefabs.Load<GameObject>("RoR2/Base/Common/DirectorSpawnProbeHelperPrefab.prefab");
Vector3 result = targetPosition;
GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule
{
placementMode = (PlacementMode)3,
position = targetPosition
}, RoR2Application.rng));
if (Object.op_Implicit((Object)(object)val2))
{
result = val2.transform.position;
}
if (Object.op_Implicit((Object)(object)val2))
{
Object.Destroy((Object)(object)val2);
}
Object.Destroy((Object)(object)val);
return result;
}
public static Vector3 GetForwardDirection(Vector3 dir)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_0039: 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_0045: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Util.Vector3XZToVector2XY(dir);
if (val != Vector2.zero)
{
((Vector2)(ref val)).Normalize();
Vector3 val2 = new Vector3(val.x, 0f, val.y);
return ((Vector3)(ref val2)).normalized;
}
return dir;
}
public static void PlayAnimation(GameObject g, string layerName, string animationStateName)
{
Animator component = g.GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component))
{
int layerIndex = component.GetLayerIndex(layerName);
component.speed = 1f;
component.Update(0f);
component.PlayInFixedTime(animationStateName, layerIndex, 0f);
}
}
public static void PlayAnimation(GameObject g, string layerName, string animationStateName, string playbackRateParam, float duration)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
Animator component = g.GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component))
{
component.speed = 1f;
component.Update(0f);
int layerIndex = component.GetLayerIndex(layerName);
component.SetFloat(playbackRateParam, 1f);
component.PlayInFixedTime(animationStateName, layerIndex, 0f);
component.Update(0f);
AnimatorStateInfo currentAnimatorStateInfo = component.GetCurrentAnimatorStateInfo(layerIndex);
float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
component.SetFloat(playbackRateParam, length / duration);
}
}
public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName)
{
int layerIndex = modelAnimator.GetLayerIndex(layerName);
modelAnimator.speed = 1f;
modelAnimator.Update(0f);
modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
}
public static void AnimatorPlayAnimation(Animator modelAnimator, string layerName, string animationStateName, string playbackRateParam, float duration)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
modelAnimator.speed = 1f;
modelAnimator.Update(0f);
int layerIndex = modelAnimator.GetLayerIndex(layerName);
modelAnimator.SetFloat(playbackRateParam, 1f);
modelAnimator.PlayInFixedTime(animationStateName, layerIndex, 0f);
modelAnimator.Update(0f);
AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex);
float length = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length;
modelAnimator.SetFloat(playbackRateParam, length / duration);
}
public static SkillDef NewSkillDef<T>(Type activationState, string activationStateMachineName, int baseMaxStock, float baseRechargeInterval, bool beginSkillCooldownOnSkillEnd, bool canceledFromSprinting, bool fullRestockOnAssign, InterruptPriority interruptPriority, bool isCombatSkill, bool mustKeyPress, bool cancelSprintingOnActivation, int rechargeStock, int requiredStock, int stockToConsume, Sprite icon, string skillName, string skillDescriptionToken, params string[] keywordTokens) where T : SkillDef
{
//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_0069: 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)
T val = ScriptableObject.CreateInstance<T>();
((SkillDef)val).activationState = new SerializableEntityStateType(activationState);
((SkillDef)val).activationStateMachineName = activationStateMachineName;
((SkillDef)val).baseMaxStock = baseMaxStock;
((SkillDef)val).baseRechargeInterval = baseRechargeInterval;
((SkillDef)val).beginSkillCooldownOnSkillEnd = beginSkillCooldownOnSkillEnd;
((SkillDef)val).canceledFromSprinting = canceledFromSprinting;
((SkillDef)val).fullRestockOnAssign = fullRestockOnAssign;
((SkillDef)val).interruptPriority = interruptPriority;
((SkillDef)val).isCombatSkill = isCombatSkill;
((SkillDef)val).mustKeyPress = mustKeyPress;
((SkillDef)val).cancelSprintingOnActivation = cancelSprintingOnActivation;
((SkillDef)val).rechargeStock = rechargeStock;
((SkillDef)val).requiredStock = requiredStock;
((SkillDef)val).stockToConsume = stockToConsume;
((SkillDef)val).icon = icon;
((SkillDef)val).skillDescriptionToken = skillDescriptionToken;
((SkillDef)val).skillName = skillName;
((SkillDef)val).skillNameToken = ((SkillDef)val).skillName;
((SkillDef)val).keywordTokens = keywordTokens;
ContentAddition.AddSkillDef((SkillDef)(object)val);
return (SkillDef)(object)val;
}
public static Color HexTo10(string hexColor)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0039: Unknown result type (might be due to invalid IL or missing references)
char[] array = hexColor.ToCharArray();
return new Color((float)(array[0] + array[1]), (float)(array[2] + array[3]), (float)(array[4] + array[5]), 255f) / 255f;
}
public static EntityStateMachine NewStateMachine<T>(GameObject obj, string customName) where T : EntityState
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references)
SerializableEntityStateType val = default(SerializableEntityStateType);
((SerializableEntityStateType)(ref val))..ctor(typeof(T));
EntityStateMachine val2 = obj.AddComponent<EntityStateMachine>();
val2.customName = customName;
val2.initialStateType = val;
val2.mainStateType = val;
return val2;
}
public static GenericSkill NewGenericSkill(GameObject obj, SkillDef skill)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0054: 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)
GenericSkill val = obj.AddComponent<GenericSkill>();
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
val2.variants = (Variant[])(object)new Variant[1];
val._skillFamily = val2;
SkillFamily skillFamily = val.skillFamily;
Variant[] variants = skillFamily.variants;
Variant val3 = new Variant
{
skillDef = skill
};
((Variant)(ref val3)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
variants[0] = val3;
ContentAddition.AddSkillFamily(skillFamily);
return val;
}
public static void AddAlt(SkillFamily skillFamily, SkillDef SkillDef)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val = new Variant
{
skillDef = SkillDef
};
((Variant)(ref val)).viewableNode = new Node(SkillDef.skillNameToken, false, (Node)null);
variants[num] = val;
}
public static BuffDef NewBuffDef(string name, bool stack, bool hidden, Sprite sprite, Color color)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = name;
val.canStack = stack;
val.isHidden = hidden;
val.iconSprite = sprite;
val.buffColor = color;
ContentAddition.AddBuffDef(val);
return val;
}
public static ObjectScaleCurve AddScaleComponent(GameObject target, float timeMax)
{
ObjectScaleCurve val = target.AddComponent<ObjectScaleCurve>();
val.useOverallCurveOnly = true;
val.timeMax = timeMax;
val.overallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
return val;
}
public static RotateAroundAxis AddRotationComponent(GameObject target, float speed, RotationAxis axis)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
RotateAroundAxis val = target.AddComponent<RotateAroundAxis>();
val.speed = (Speed)2;
val.fastRotationSpeed = speed;
val.rotateAroundAxis = axis;
return val;
}
public static AnimateShaderAlpha AddShaderAlphaComponent(GameObject target, float timeMax, AnimationCurve curve, bool destroyOnEnd = true, bool disableOnEnd = false)
{
AnimateShaderAlpha val = target.AddComponent<AnimateShaderAlpha>();
val.timeMax = timeMax;
val.alphaCurve = curve;
val.destroyOnEnd = destroyOnEnd;
val.disableOnEnd = disableOnEnd;
return val;
}
internal static Sprite CreateSprite(Texture2D tex)
{
//IL_001a: 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)
return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 128f);
}
internal static SkinDefInfo CreateNewSkinDefInfo(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos, UnlockableDef unlockableDef = null)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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)
SkinDefInfo result = default(SkinDefInfo);
result.BaseSkins = Array.Empty<SkinDef>();
result.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
result.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
List<GameObjectActivation> list = new List<GameObjectActivation>();
foreach (SkinnedMeshRenderer val in childList)
{
GameObjectActivation val2 = default(GameObjectActivation);
val2.gameObject = ((Component)val).gameObject;
val2.shouldActivate = ((Object)val).name.Contains(objectToEnable);
GameObjectActivation item = val2;
list.Add(item);
}
result.GameObjectActivations = list.ToArray();
result.Icon = Assets.MainAssetBundle.LoadAsset<Sprite>(objectToEnable);
result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
result.Name = skinName;
result.NameToken = skinName;
result.RendererInfos = rendererInfos;
result.RootObject = rootObject;
result.UnlockableDef = unlockableDef;
return result;
}
internal static T CopyComponent<T>(T original, GameObject destination) where T : Component
{
Type type = ((object)original).GetType();
Component val = destination.AddComponent(type);
FieldInfo[] fields = type.GetFields();
FieldInfo[] array = fields;
foreach (FieldInfo fieldInfo in array)
{
fieldInfo.SetValue(val, fieldInfo.GetValue(original));
}
return (T)(object)((val is T) ? val : null);
}
public static Sprite CreateSpriteFromTexture(Texture2D texture)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)texture))
{
return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
}
return null;
}
public static GameObject FindInActiveObjectByName(string name)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
for (int i = 0; i < array.Length; i++)
{
if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
{
return ((Component)array[i]).gameObject;
}
}
return null;
}
public static void CreateHitboxes(string name, Transform parent, Vector3[] sizes, Vector3[] positions)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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)
HitBoxGroup val = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
val.groupName = name;
List<HitBox> list = new List<HitBox>();
for (int i = 0; i < sizes.Length; i++)
{
GameObject val2 = new GameObject(name + (i + 1));
val2.transform.SetParent(parent);
val2.transform.localPosition = positions[i];
val2.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
val2.transform.localScale = sizes[i];
HitBox item = val2.AddComponent<HitBox>();
val2.layer = LayerIndex.projectile.intVal;
list.Add(item);
}
val.hitBoxes = list.ToArray();
}
public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale, Vector3 localPosition)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001b: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(parent);
val.transform.localPosition = localPosition;
val.transform.localRotation = Quaternion.Euler(Vector3.forward * 45f);
val.transform.localScale = scale;
HitBoxGroup val2 = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
HitBox val3 = val.AddComponent<HitBox>();
val.layer = LayerIndex.projectile.intVal;
val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
val2.groupName = name;
return val;
}
internal static EffectComponent RegisterEffect(GameObject effect, float duration, string soundName = "", bool applyScale = false, bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
EffectComponent val = effect.GetComponent<EffectComponent>();
if (!Object.op_Implicit((Object)(object)val))
{
val = effect.AddComponent<EffectComponent>();
}
if (duration != -1f)
{
DestroyOnTimer component = effect.GetComponent<DestroyOnTimer>();
if (!Object.op_Implicit((Object)(object)component))
{
effect.AddComponent<DestroyOnTimer>().duration = duration;
}
else
{
component.duration = duration;
}
}
if (!Object.op_Implicit((Object)(object)effect.GetComponent<NetworkIdentity>()))
{
effect.AddComponent<NetworkIdentity>();
}
if (!Object.op_Implicit((Object)(object)effect.GetComponent<VFXAttributes>()))
{
effect.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
}
val.applyScale = applyScale;
val.effectIndex = (EffectIndex)(-1);
val.parentToReferencedTransform = parentToReferencedTransform;
val.positionAtReferencedTransform = positionAtReferencedTransform;
val.soundName = soundName;
ContentAddition.AddEffect(effect);
return val;
}
public static Material FindMaterial(string name)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
Material[] array = Resources.FindObjectsOfTypeAll<Material>();
for (int i = 0; i < array.Length; i++)
{
if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
{
return array[i];
}
}
return null;
}
}