using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using R2API;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BetterRunicLens")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterRunicLens")]
[assembly: AssemblyTitle("BetterRunicLens")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BetterRunicLens;
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("BetterRunicLens.AssetBundle." + "BetterRunicLens".ToLower() + "assets");
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
using Stream stream2 = executingAssembly.GetManifestResourceStream("BetterRunicLens.BetterRunicLens.bnk");
byte[] array = new byte[stream2.Length];
stream2.Read(array, 0, array.Length);
SoundBanks.Add(array);
}
}
internal class DisableOnTimer : MonoBehaviour
{
public GameObject target;
public float duration = 2f;
private float stopwatch;
private void OnEnable()
{
stopwatch = 0f;
target.SetActive(true);
}
private void FixedUpdate()
{
stopwatch += Time.fixedDeltaTime;
if (stopwatch >= duration)
{
target.SetActive(false);
}
}
}
internal class Hook
{
internal static void Hooks()
{
}
}
[BepInPlugin("com.Dragonyck.BetterRunicLens", "BetterRunicLens", "1.0.3")]
public class MainPlugin : BaseUnityPlugin
{
public const string MODUID = "com.Dragonyck.BetterRunicLens";
public const string MODNAME = "BetterRunicLens";
public const string VERSION = "1.0.3";
private void Awake()
{
Assets.PopulateAssets();
Prefabs.CreatePrefabs();
Hook.Hooks();
}
}
internal class Prefabs
{
internal static GameObject prefab;
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 void CreatePrefabs()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Load<GameObject>("RoR2/DLC2/Items/MeteorAttackOnHighDamage/RunicMeteorStrikePredictionEffect.prefab");
Object.DontDestroyOnLoad((Object)(object)val);
val.GetComponent<DestroyOnTimer>().duration = 2.65f;
((Component)val.GetComponentInChildren<MeshRenderer>()).gameObject.SetActive(false);
GameObject val2 = Object.Instantiate<GameObject>(Load<GameObject>("RoR2/Base/Huntress/HuntressArrowRainIndicator.prefab"), val.transform.position, Quaternion.identity);
val2.transform.parent = val.transform;
val2.transform.localScale = Vector3.one * 1.25f;
ObjectScaleCurve componentInChildren = val2.GetComponentInChildren<ObjectScaleCurve>();
GameObject gameObject = ((Component)componentInChildren).gameObject;
val.AddComponent<DisableOnTimer>().target = gameObject;
Object.Destroy((Object)(object)componentInChildren);
gameObject.transform.localScale = Vector3.one;
Utils.AddScaleComponent(gameObject, 2f);
Material val3 = new Material(Load<Material>("RoR2/Base/Captain/matCaptainAirstrikeAltAreaIndicatorOuter.mat"));
val3.SetFloat("_DstBlendFloat", 1f);
val3.SetTextureScale("_Cloud1Tex", Vector2.one * 0.4f);
val3.SetTexture("_Cloud1Tex", (Texture)(object)Load<Texture2D>("RoR2/DLC2/meridian/Assets/texPMStormCloud.png"));
val3.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampFlamingSmoke.png"));
Material val4 = Load<Material>("RoR2/Base/Captain/matCaptainAirstrikeAreaIndicator.mat");
val3.SetFloat("_InvFade", 0.35f);
val3.SetFloat("_SoftPower", 0.74f);
val3.SetFloat("_Boost", 1.8f);
val3.SetFloat("_RimPower", 2.42f);
val3.SetFloat("_RimStrength", 1.9f);
MeshRenderer componentInChildren2 = gameObject.GetComponentInChildren<MeshRenderer>();
((Renderer)componentInChildren2).materials = (Material[])(object)new Material[2] { val3, val4 };
GameObject val5 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Meteor"), val.transform.position, Quaternion.identity);
val5.transform.parent = val.transform;
GameObject val6 = Load<GameObject>("RoR2/DLC2/Items/MeteorAttackOnHighDamage/RunicMeteorStrikeImpact.prefab");
ShakeEmitter val7 = Utils.CopyComponent<ShakeEmitter>(Load<GameObject>("RoR2/Base/Meteor/MeteorStrikeImpact.prefab").GetComponent<ShakeEmitter>(), val6);
val7.shakeOnEnable = true;
val7.duration = 0.35f;
Object.DontDestroyOnLoad((Object)(object)val6);
val6.GetComponent<EffectComponent>().soundName = "Play_BetterRunicLens_Explosion";
Object.Destroy((Object)(object)val6.GetComponent<DestroyOnParticleEnd>());
val6.AddComponent<DestroyOnTimer>().duration = 1.3f;
ParticleSystemRenderer[] componentsInChildren = val6.GetComponentsInChildren<ParticleSystemRenderer>(true);
foreach (ParticleSystemRenderer val8 in componentsInChildren)
{
((Renderer)val8).enabled = false;
((Component)val8).gameObject.SetActive(false);
}
GameObject val9 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("MetorImpact"), val6.transform.position, Quaternion.identity);
val9.transform.parent = val6.transform;
}
}
internal class Sounds
{
public static readonly uint Play_BetterRunicLens_Explosion = 3172447435u;
}
internal static class Extensions
{
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
{
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 skillDescriptionToken, string skillName, 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 GameObject NewDisplayModel(GameObject model, string name)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
GameObject val = PrefabAPI.InstantiateClone(model, name, false);
val.GetComponentInChildren<Animator>().runtimeAnimatorController = Assets.Load<RuntimeAnimatorController>("displayAnimator");
((Behaviour)val.GetComponentInChildren<CharacterModel>()).enabled = false;
SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer val2 in componentsInChildren)
{
((Renderer)val2).material = new Material(((Renderer)val2).material);
((Renderer)val2).material.DisableKeyword("DITHER");
}
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 == 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_0073: 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.identity;
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_0039: 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.identity;
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 InstantiateMaterial(Texture tex)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
Material val = Object.Instantiate<Material>(Prefabs.Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat"));
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 InstantiateMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
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;
}
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;
}
}