Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Widowmaker v1.0.3
Widowmaker.dll
Decompiled 9 months agousing 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 JetBrains.Annotations; using KinematicCharacterController; using R2API; using R2API.Utils; using Rewired.ComponentControls.Effects; using RoR2; using RoR2.Achievements; using RoR2.HudOverlay; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [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("Widowmaker")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Widowmaker")] [assembly: AssemblyTitle("Widowmaker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Widowmaker; public static class Achievements { [RegisterAchievement("WIDOWMAKER_MASTERY", "ACHIEVEMENT_WIDOWMAKER_MASTERY_UNLOCKABLE_ID", null, 10u, null)] public class MasteryUnlockable : BasePerSurvivorClearGameMonsoonAchievement { public override BodyIndex LookUpRequiredBodyIndex() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex("WidowmakerBody"); } } internal static UnlockableDef masteryUnlock; public static void RegisterUnlockables() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) masteryUnlock = NewUnlockable<MasteryUnlockable>("MASTERY", Skins.CreateSkinIcon(Color32.op_Implicit(new Color32((byte)30, (byte)30, (byte)30, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)169, (byte)169, (byte)177, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)147, (byte)138, (byte)254, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)96, (byte)72, (byte)134, byte.MaxValue))), "WIDOWMAKER: Mastery", "As Widowmaker, beat the game or obliterate on Monsoon."); } private static UnlockableDef NewUnlockable<T>(string AchievementIdentifier, Sprite Icon, string Title, string Description) where T : BaseAchievement { string text = "ACHIEVEMENT_WIDOWMAKER_"; UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); string langName = text + AchievementIdentifier + "_NAME"; string langDesc = text + AchievementIdentifier + "_DESCRIPTION"; LanguageAPI.Add(langName, Title); LanguageAPI.Add(langDesc, Description); Func<string> func = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(langName), Language.GetString(langDesc) }); Type typeFromHandle = typeof(T); val.cachedName = text + AchievementIdentifier + "_UNLOCKABLE_ID"; val.getHowToUnlockString = func; val.getUnlockedString = func; val.achievementIcon = Icon; val.sortScore = 200; val.hidden = false; ContentAddition.AddUnlockableDef(val); return val; } } 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("Widowmaker.AssetBundle.widowmakerassets"); MainAssetBundle = AssetBundle.LoadFromStream(stream); } using Stream stream2 = executingAssembly.GetManifestResourceStream("Widowmaker.Widowmaker.bnk"); byte[] array = new byte[stream2.Length]; stream2.Read(array, 0, array.Length); SoundBanks.Add(array); } } internal class DisplayBehaviour : MonoBehaviour { public GameObject line; private float stopwatch; private uint ID; public Animator sniperAnimator; private void Start() { ID = AkSoundEngine.PostEvent("Play_Widowmaker_Intro", ((Component)this).gameObject); } private void OnDisable() { AkSoundEngine.StopPlayingID(ID); } public void ActivateSniper() { sniperAnimator.SetBool("scope", true); } private void FixedUpdate() { stopwatch += Time.fixedDeltaTime; if (stopwatch >= 0.4f && !line.activeInHierarchy) { line.SetActive(true); } } } internal class HookBehaviour : MonoBehaviour { private bool collided; private WidowBehaviour behaviour; private GameObject owner; private Transform muzzle; private LineRenderer line; private ProjectileSimple simple; private Rigidbody rb; private Collider collider; private uint ID; private void Awake() { line = ((Component)this).GetComponent<LineRenderer>(); simple = ((Component)this).GetComponent<ProjectileSimple>(); rb = ((Component)this).GetComponent<Rigidbody>(); collider = ((Component)this).GetComponent<Collider>(); } private void Start() { owner = ((Component)this).GetComponent<ProjectileController>().owner; behaviour = owner.GetComponent<WidowBehaviour>(); behaviour.hookProjectile = ((Component)this).gameObject; muzzle = ((Component)owner.GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>().FindChild("hookMuzzle"); ID = AkSoundEngine.PostEvent("Play_Widowmaker_Hook_Loop", ((Component)this).gameObject); } private void OnDisable() { AkSoundEngine.StopPlayingID(ID); } public void RpcProjectileImpact() { } public void OnCollisionEnter(Collision collision) { //IL_000a: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) ContactPoint[] contacts = collision.contacts; ProjectileImpactInfo val = default(ProjectileImpactInfo); val.collider = collision.collider; val.estimatedPointOfImpact = ProjectileController.EstimateContactPoint(contacts, collision.collider); val.estimatedImpactNormal = ProjectileController.EstimateContactNormal(contacts); ProjectileImpactInfo val2 = val; if (collided || !Object.op_Implicit((Object)(object)val2.collider)) { return; } collided = true; if (Object.op_Implicit((Object)(object)((Component)val2.collider).GetComponent<HurtBox>())) { ((Component)this).transform.parent = ((Component)val2.collider).transform; } if (Object.op_Implicit((Object)(object)behaviour)) { behaviour.hookPos = val2.estimatedPointOfImpact; ((Behaviour)simple).enabled = false; rb.velocity = Vector3.zero; if (Util.HasEffectiveAuthority(owner)) { owner.GetComponent<EntityStateMachine>().SetNextState((EntityState)(object)new HookState()); } } EffectManager.SimpleEffect(Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/OmniImpactVFXSlash.prefab"), val2.estimatedPointOfImpact, Quaternion.identity, false); AkSoundEngine.PostEvent("Play_gravekeeper_attack2_impact", ((Component)this).gameObject); } private void UpdateLine() { //IL_0035: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)line) && Object.op_Implicit((Object)(object)muzzle)) { line.SetPositions((Vector3[])(object)new Vector3[2] { ((Component)this).transform.position, muzzle.position }); } } private void FixedUpdate() { UpdateLine(); } private void Update() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)owner)) { Object.Destroy((Object)(object)((Component)this).gameObject); } if (!Object.op_Implicit((Object)(object)line) || !Object.op_Implicit((Object)(object)muzzle)) { return; } UpdateLine(); if (Object.op_Implicit((Object)(object)behaviour) && simple.stopwatch >= behaviour.hookDuration) { collider.enabled = false; Transform transform = ((Component)this).transform; Vector3 val = muzzle.position - ((Component)this).transform.position; transform.forward = ((Vector3)(ref val)).normalized; if (Vector3.Distance(muzzle.position, ((Component)this).transform.position) <= 5f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } internal class TracerEmit : MonoBehaviour { public int particleAmount = 1000; private void Start() { ((Component)this).GetComponent<Tracer>().beamObject.GetComponent<ParticleSystem>().Emit(particleAmount); } } internal class VisualizerPrefabSetter : MonoBehaviour { private SniperTargetViewer target; private WidowBehaviour behaviour; private GameObject visualizerPrefab; private void Awake() { target = ((Component)this).GetComponent<SniperTargetViewer>(); visualizerPrefab = target.visualizerPrefab; } private void Update() { if (!Object.op_Implicit((Object)(object)behaviour) && Object.op_Implicit((Object)(object)target.hud) && Object.op_Implicit((Object)(object)target.hud.targetBodyObject)) { behaviour = target.hud.targetBodyObject.GetComponent<WidowBehaviour>(); return; } GameObject val = (behaviour.emp ? Prefabs.targetVisualizerEmp : Prefabs.targetVisualizer); if ((Object)(object)visualizerPrefab != (Object)(object)val) { visualizerPrefab = val; target.SetDisplayedTargets((IReadOnlyList<HurtBox>)Array.Empty<HurtBox>()); target.hurtBoxToVisualizer.Clear(); } target.visualizerPrefab = visualizerPrefab; } } internal class WidowBehaviour : MonoBehaviour { private CharacterBody body; public bool emp; public bool scoping; public float charge; public float maxCharge = 1f; private float stopwatch; private float baseCooldown = 0.5f; private float cooldownStopwatch = 0.5f; public string path = "RoR2/Junk/Bandit/MuzzleflashBanditPistol.prefab"; public Vector3 hookPos; public float maxHookDistance = 8f; public float hookSpeed = 0.25f; public float hookForce = 10f; public float hookDuration = 0.3f; public float minHookSpeed = 7f; public float maxHookSpeed = 15f; public float hookUpForceMult = 0.5f; public GameObject hookProjectile; private uint ID; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private void Update() { if (Object.op_Implicit((Object)(object)body)) { if (body.hasEffectiveAuthority) { body.skillLocator.primary.skillDef.icon = ((!scoping) ? Prefabs.smg : (emp ? Prefabs.sniperEmp : Prefabs.sniper)); } int num = (Object.op_Implicit((Object)(object)body.inventory) ? body.inventory.GetItemCount(Items.SecondarySkillMagazine) : 0); GenericSkill primary = body.skillLocator.primary; primary.maxStock = primary.skillDef.GetMaxStock(primary) + primary.bonusStockFromBody + num * 5; } } private void FixedUpdate() { if (!Object.op_Implicit((Object)(object)body)) { return; } cooldownStopwatch += Time.fixedDeltaTime; if (scoping && cooldownStopwatch >= baseCooldown / body.attackSpeed) { if (stopwatch == 0f && body.hasEffectiveAuthority) { ID = AkSoundEngine.PostEvent("Play_Widowmaker_Scope_Charge", ((Component)this).gameObject); } stopwatch += Time.fixedDeltaTime; } else { AkSoundEngine.StopPlayingID(ID); stopwatch = 0f; } charge = Mathf.Clamp01(stopwatch / (maxCharge / body.attackSpeed)); } public void ResetCharge() { cooldownStopwatch = 0f; stopwatch = 0f; charge = 0f; } } internal class WidowScopeBehaviour : MonoBehaviour { public WidowBehaviour behaviour; public GameObject indicator1; public GameObject indicator2; public GameObject indicator3; public GameObject fullcharge; public TextMeshProUGUI text; private bool playedSound; private void FixedUpdate() { if (Object.op_Implicit((Object)(object)behaviour) && Object.op_Implicit((Object)(object)indicator1) && Object.op_Implicit((Object)(object)text) && Object.op_Implicit((Object)(object)fullcharge)) { indicator1.SetActive(behaviour.charge >= 0.3f); indicator2.SetActive(behaviour.charge >= 0.66f); indicator3.SetActive(behaviour.charge >= 1f); fullcharge.SetActive(behaviour.charge >= 1f); if (fullcharge.activeInHierarchy && !playedSound) { playedSound = true; } else { playedSound = false; } ((TMP_Text)text).text = Mathf.CeilToInt(behaviour.charge * 100f) + "%"; } } } 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 RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(Prefabs.visor)) { args.critDamageMultAdd += sender.critMultiplier; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Dragonyck.Widowmaker", "Widowmaker", "1.0.3")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MainPlugin : BaseUnityPlugin { public const string MODUID = "com.Dragonyck.Widowmaker"; public const string MODNAME = "Widowmaker"; public const string VERSION = "1.0.3"; public const string SURVIVORNAME = "Widowmaker"; public const string SURVIVORNAMEKEY = "WIDOWMAKER"; public static GameObject characterPrefab; public static readonly Color characterColor = Color32.op_Implicit(new Color32((byte)212, (byte)7, (byte)64, byte.MaxValue)); private void Awake() { Assets.PopulateAssets(); Achievements.RegisterUnlockables(); Prefabs.CreatePrefabs(); CreatePrefab(); RegisterStates(); RegisterCharacter(); Hook.Hooks(); } internal static void CreatePrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_097b: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_09ae: Unknown result type (might be due to invalid IL or missing references) //IL_09b3: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/CommandoBody.prefab").WaitForCompletion(); characterPrefab = PrefabAPI.InstantiateClone(val, "WidowmakerBody", true); characterPrefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true; characterPrefab.AddComponent<WidowBehaviour>(); Object.Destroy((Object)(object)((Component)characterPrefab.transform.Find("ModelBase")).gameObject); Object.Destroy((Object)(object)((Component)characterPrefab.transform.Find("CameraPivot")).gameObject); Object.Destroy((Object)(object)((Component)characterPrefab.transform.Find("AimOrigin")).gameObject); GameObject val2 = Assets.MainAssetBundle.LoadAsset<GameObject>("widowMdl"); Utils.UpdateMaterial(Assets.MainAssetBundle.LoadAsset<Material>("line")); Utils.UpdateMaterial(Assets.MainAssetBundle.LoadAsset<Material>("hook")); GameObject val3 = new GameObject("ModelBase"); val3.transform.parent = characterPrefab.transform; val3.transform.localPosition = new Vector3(0f, -0.94f, 0f); val3.transform.localRotation = Quaternion.identity; val3.transform.localScale = Vector3.one * 1.2f; GameObject val4 = new GameObject("AimOrigin"); val4.transform.parent = val3.transform; val4.transform.localPosition = new Vector3(0f, 1f, 0f); val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = Vector3.one; Transform transform = val2.transform; transform.parent = val3.transform; transform.localPosition = Vector3.zero; transform.localScale = Vector3.one; transform.localRotation = Quaternion.identity; CharacterDirection component = characterPrefab.GetComponent<CharacterDirection>(); component.targetTransform = val3.transform; component.modelAnimator = val2.GetComponentInChildren<Animator>(); component.turnSpeed = 720f; CharacterBody component2 = characterPrefab.GetComponent<CharacterBody>(); ((Object)component2).name = "WidowmakerBody"; component2.baseNameToken = "WIDOWMAKER_NAME"; component2.subtitleNameToken = "WIDOWMAKER_SUBTITLE"; component2.bodyFlags = (BodyFlags)17; component2.rootMotionInMainState = false; component2.mainRootSpeed = 0f; component2.baseMaxHealth = 110f; component2.levelMaxHealth = 35f; component2.baseRegen = 1.5f; component2.levelRegen = 0.2f; component2.baseMaxShield = 0f; component2.levelMaxShield = 0f; component2.baseMoveSpeed = 7f; component2.levelMoveSpeed = 0f; component2.baseAcceleration = 110f; component2.baseJumpPower = 15f; component2.levelJumpPower = 0f; component2.baseDamage = 12f; component2.levelDamage = 2.4f; component2.baseAttackSpeed = 1f; component2.levelAttackSpeed = 0f; component2.baseCrit = 1f; component2.levelCrit = 0f; component2.baseArmor = 0f; component2.levelArmor = 0f; component2.baseJumpCount = 1; component2.sprintingSpeedMultiplier = 1.45f; component2.wasLucky = false; component2.hideCrosshair = false; component2.aimOriginTransform = val4.transform; component2.hullClassification = (HullClassification)0; component2.portraitIcon = (Texture)(object)Assets.MainAssetBundle.LoadAsset<Sprite>("portrait1x128").texture; component2.isChampion = false; component2.currentVehicle = null; component2.skinIndex = 0u; component2.bodyColor = characterColor; CharacterMotor component3 = characterPrefab.GetComponent<CharacterMotor>(); component3.walkSpeedPenaltyCoefficient = 1f; component3.characterDirection = component; component3.muteWalkMotion = false; component3.mass = 160f; component3.airControl = 0.25f; component3.disableAirControlUntilCollision = false; component3.generateParametersOnAwake = true; InputBankTest component4 = characterPrefab.GetComponent<InputBankTest>(); component4.moveVector = Vector3.zero; CameraTargetParams component5 = characterPrefab.GetComponent<CameraTargetParams>(); component5.cameraParams = val.GetComponent<CameraTargetParams>().cameraParams; component5.cameraPivotTransform = null; component5.recoil = Vector2.zero; component5.dontRaycastToPivot = false; ModelLocator component6 = characterPrefab.GetComponent<ModelLocator>(); component6.modelTransform = transform; component6.modelBaseTransform = val3.transform; component6.dontReleaseModelOnDeath = false; component6.autoUpdateModelTransform = true; component6.dontDetatchFromParent = false; component6.noCorpse = false; component6.normalizeToFloor = false; component6.preserveModel = false; ChildLocator component7 = val2.GetComponent<ChildLocator>(); CharacterModel val5 = val2.AddComponent<CharacterModel>(); SkinnedMeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<SkinnedMeshRenderer>(); List<RendererInfo> list = new List<RendererInfo>(); for (int i = 0; i < componentsInChildren.Length; i++) { list.Add(new RendererInfo { renderer = (Renderer)(object)componentsInChildren[i], defaultMaterial = Utils.InstantiateMaterial(((Renderer)componentsInChildren[i]).material), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }); } RendererInfo[] array = list.ToArray(); val5.body = component2; val5.baseRendererInfos = array; val5.autoPopulateLightInfos = true; val5.invisibilityCount = 0; val5.temporaryOverlays = new List<TemporaryOverlayInstance>(); val5.mainSkinnedMeshRenderer = componentsInChildren[0]; GameObject gameObject = ((Component)transform).gameObject; CharacterModel component8 = gameObject.GetComponent<CharacterModel>(); ModelSkinController val6 = gameObject.AddComponent<ModelSkinController>(); ChildLocator component9 = gameObject.GetComponent<ChildLocator>(); LanguageAPI.Add("WIDOWMAKERBODY_DEFAULT_SKIN_NAME", "Default"); LanguageAPI.Add("WIDOWMAKERBODY_MASTERY_SKIN_NAME", "Overwatch 1"); val6.skins = (SkinDef[])(object)new SkinDef[2] { Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "WIDOWMAKERBODY_DEFAULT_SKIN_NAME", "base", array, Color32.op_Implicit(new Color32((byte)30, (byte)30, (byte)30, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)169, (byte)169, (byte)177, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)147, (byte)138, (byte)254, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)96, (byte)72, (byte)134, byte.MaxValue)))), Skins.CreateNewSkinDef(Utils.CreateNewSkinDefInfo(componentsInChildren, gameObject, "WIDOWMAKERBODY_MASTERY_SKIN_NAME", "skin", array, Color32.op_Implicit(new Color32((byte)249, (byte)197, (byte)250, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)231, (byte)4, (byte)4, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)103, (byte)110, (byte)167, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)75, (byte)75, (byte)75, byte.MaxValue)))) }; SkinnedMeshRenderer[] array2 = componentsInChildren; foreach (SkinnedMeshRenderer val7 in array2) { if (((Object)val7).name.Contains("skin")) { ((Component)val7).gameObject.SetActive(false); } } HealthComponent component10 = characterPrefab.GetComponent<HealthComponent>(); component10.health = component2.baseMaxHealth; component10.shield = 0f; component10.barrier = 0f; component10.magnetiCharge = 0f; component10.body = null; component10.dontShowHealthbar = false; characterPrefab.GetComponent<Interactor>().maxInteractionDistance = 3f; characterPrefab.GetComponent<InteractionDriver>().highlightInteractor = true; SfxLocator component11 = characterPrefab.GetComponent<SfxLocator>(); component11.deathSound = "Play_ui_player_death"; component11.barkSound = ""; component11.openSound = ""; component11.landingSound = "Play_char_land"; component11.fallDamageSound = "Play_char_land_fall_damage"; component11.aliveLoopStart = ""; component11.aliveLoopStop = ""; characterPrefab.GetComponent<Rigidbody>().mass = 100f; Collider[] componentsInChildren2 = val2.GetComponentsInChildren<Collider>(); HurtBoxGroup val8 = val2.AddComponent<HurtBoxGroup>(); List<HurtBox> list2 = new List<HurtBox>(); Collider[] array3 = componentsInChildren2; foreach (Collider val9 in array3) { HurtBox val10 = ((Component)val9).gameObject.AddComponent<HurtBox>(); ((Component)val10).gameObject.layer = LayerIndex.entityPrecise.intVal; val10.healthComponent = component10; val10.isBullseye = true; val10.damageModifier = (DamageModifier)0; val10.hurtBoxGroup = val8; val10.indexInGroup = 0; val8.mainHurtBox = val10; val8.bullseyeCount = 1; list2.Add(val10); } val8.hurtBoxes = list2.ToArray(); KinematicCharacterMotor component12 = characterPrefab.GetComponent<KinematicCharacterMotor>(); component12.CharacterController = (ICharacterController)(object)component3; FootstepHandler val11 = val2.AddComponent<FootstepHandler>(); val11.baseFootstepString = "Play_player_footstep"; val11.sprintFootstepOverrideString = ""; val11.enableFootstepDust = true; val11.footstepDustPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/GenericFootstepDust.prefab").WaitForCompletion(); Utils.NewStateMachine<Idle>(characterPrefab, "Scope"); Utils.NewStateMachine<Idle>(characterPrefab, "Visor"); EntityStateMachine component13 = ((Component)component2).GetComponent<EntityStateMachine>(); component13.mainStateType = new SerializableEntityStateType(typeof(CharacterMain)); CharacterDeathBehavior component14 = characterPrefab.GetComponent<CharacterDeathBehavior>(); component14.deathStateMachine = characterPrefab.GetComponent<EntityStateMachine>(); component14.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath)); NetworkStateMachine component15 = ((Component)component2).GetComponent<NetworkStateMachine>(); component15.stateMachines = ((Component)component2).GetComponents<EntityStateMachine>(); ContentAddition.AddBody(characterPrefab); } private void RegisterCharacter() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) string text = "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > "; string text2 = "..and so she left."; string text3 = "..and so she vanished."; LanguageAPI.Add("WIDOWMAKER_NAME", "Widowmaker"); LanguageAPI.Add("WIDOWMAKER_DESCRIPTION", text); LanguageAPI.Add("WIDOWMAKER_SUBTITLE", "Assassin"); LanguageAPI.Add("WIDOWMAKER_OUTRO", text2); LanguageAPI.Add("WIDOWMAKER_FAIL", text3); SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); val.cachedName = "WIDOWMAKER_NAME"; val.unlockableDef = null; val.descriptionToken = "WIDOWMAKER_DESCRIPTION"; val.primaryColor = characterColor; val.bodyPrefab = characterPrefab; val.displayPrefab = Utils.NewDisplayModel(((Component)characterPrefab.GetComponent<ModelLocator>().modelBaseTransform).gameObject, "WidowmakerDisplay"); val.outroFlavorToken = "WIDOWMAKER_OUTRO"; val.desiredSortPosition = 20f; val.mainEndingEscapeFailureFlavorToken = "WIDOWMAKER_FAIL"; ContentAddition.AddSurvivorDef(val); SkillSetup(); GameObject val2 = PrefabAPI.InstantiateClone(Prefabs.Load<GameObject>("RoR2/Base/Commando/CommandoMonsterMaster.prefab"), "WidowmakerMaster", true); ContentAddition.AddMaster(val2); CharacterMaster component = val2.GetComponent<CharacterMaster>(); component.bodyPrefab = characterPrefab; } private void RegisterStates() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) bool flag = default(bool); ContentAddition.AddEntityState<Primary>(ref flag); ContentAddition.AddEntityState<PrimaryReloadWait>(ref flag); ContentAddition.AddEntityState<Reload>(ref flag); ContentAddition.AddEntityState<Secondary>(ref flag); ContentAddition.AddEntityState<Utility>(ref flag); ContentAddition.AddEntityState<Special>(ref flag); ContentAddition.AddEntityState<CharacterMain>(ref flag); ContentAddition.AddEntityState<HookState>(ref flag); } private void SkillSetup() { GenericSkill[] componentsInChildren = characterPrefab.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } PassiveSetup(); PrimarySetup(); SecondarySetup(); UtilitySetup(); SpecialSetup(); } private void PassiveSetup() { SkillLocator component = characterPrefab.GetComponent<SkillLocator>(); LanguageAPI.Add("WIDOWMAKER_PASSIVE_NAME", "Widow's Kiss"); LanguageAPI.Add("WIDOWMAKER_PASSIVE_DESCRIPTION", "All <style=cIsDamage>critical strike chance</style> is converted to <style=cIsDamage>critical damage</style> instead."); PassiveItemSkillDef val = Object.Instantiate<PassiveItemSkillDef>(Prefabs.Load<PassiveItemSkillDef>("RoR2/DLC1/Railgunner/RailgunnerBodyPassiveConvertCrit.asset")); ((SkillDef)val).icon = Assets.MainAssetBundle.LoadAsset<Sprite>("passive"); ((SkillDef)val).skillDescriptionToken = "WIDOWMAKER_PASSIVE_DESCRIPTION"; ((SkillDef)val).skillName = "WIDOWMAKER_PASSIVE_NAME"; ((SkillDef)val).skillNameToken = "WIDOWMAKER_PASSIVE_NAME"; Utils.NewGenericSkill(characterPrefab, (SkillDef)(object)val); } private void PrimarySetup() { //IL_003d: 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_007c: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = characterPrefab.GetComponent<SkillLocator>(); LanguageAPI.Add("WIDOWMAKER_M1", "Machine Gun"); LanguageAPI.Add("WIDOWMAKER_M1_DESCRIPTION", "Fire a Automatic assault weapon for <style=cIsDamage>120% damage</style>. Automatically <style=cIsUtility>recharges</style> after firing all bullets."); SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.activationState = new SerializableEntityStateType(typeof(Primary)); val.activationStateMachineName = "Weapon"; val.baseMaxStock = 35; val.baseRechargeInterval = 0f; val.beginSkillCooldownOnSkillEnd = true; val.canceledFromSprinting = false; val.fullRestockOnAssign = true; val.interruptPriority = (InterruptPriority)0; val.isCombatSkill = true; val.mustKeyPress = false; val.cancelSprintingOnActivation = true; val.rechargeStock = 0; val.requiredStock = 1; val.stockToConsume = 1; val.icon = Prefabs.smg; val.skillDescriptionToken = "WIDOWMAKER_M1_DESCRIPTION"; val.skillName = "WIDOWMAKER_M1"; val.skillNameToken = "WIDOWMAKER_M1"; ContentAddition.AddSkillDef(val); component.primary = Utils.NewGenericSkill(characterPrefab, val); } private void SecondarySetup() { //IL_003d: 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_007b: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = characterPrefab.GetComponent<SkillLocator>(); LanguageAPI.Add("WIDOWMAKER_M2", "Sniper"); LanguageAPI.Add("WIDOWMAKER_M2_DESCRIPTION", "Hold for long-ranged sniper weapon, charging up over time. Highlights <style=cIsDamage>Weak Points</style>. Fire a piercing shot for <style=cIsDamage>200%-1000% damage</style>. Consumes <style=cIsDamage>5</style> bullets."); WidowSkillDef widowSkillDef = ScriptableObject.CreateInstance<WidowSkillDef>(); ((SkillDef)widowSkillDef).activationState = new SerializableEntityStateType(typeof(Secondary)); ((SkillDef)widowSkillDef).activationStateMachineName = "Scope"; ((SkillDef)widowSkillDef).baseMaxStock = 0; ((SkillDef)widowSkillDef).baseRechargeInterval = 0f; ((SkillDef)widowSkillDef).beginSkillCooldownOnSkillEnd = true; ((SkillDef)widowSkillDef).canceledFromSprinting = false; ((SkillDef)widowSkillDef).fullRestockOnAssign = false; ((SkillDef)widowSkillDef).interruptPriority = (InterruptPriority)0; ((SkillDef)widowSkillDef).isCombatSkill = true; ((SkillDef)widowSkillDef).mustKeyPress = true; ((SkillDef)widowSkillDef).cancelSprintingOnActivation = true; ((SkillDef)widowSkillDef).rechargeStock = 0; ((SkillDef)widowSkillDef).requiredStock = 0; ((SkillDef)widowSkillDef).stockToConsume = 0; ((SkillDef)widowSkillDef).icon = Assets.MainAssetBundle.LoadAsset<Sprite>("secondary"); ((SkillDef)widowSkillDef).skillDescriptionToken = "WIDOWMAKER_M2_DESCRIPTION"; ((SkillDef)widowSkillDef).skillName = "WIDOWMAKER_M2"; ((SkillDef)widowSkillDef).skillNameToken = "WIDOWMAKER_M2"; ContentAddition.AddSkillDef((SkillDef)(object)widowSkillDef); component.secondary = Utils.NewGenericSkill(characterPrefab, (SkillDef)(object)widowSkillDef); } private void UtilitySetup() { //IL_003d: 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_007b: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = characterPrefab.GetComponent<SkillLocator>(); LanguageAPI.Add("WIDOWMAKER_UTIL", "Grappling Hook"); LanguageAPI.Add("WIDOWMAKER_UTIL_DESCRIPTION", "Launch a hook that pulls you towards a ledge. Can be cancelled by pressing the Jump key."); SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.activationState = new SerializableEntityStateType(typeof(Utility)); val.activationStateMachineName = "Slide"; val.baseMaxStock = 1; val.baseRechargeInterval = 5f; val.beginSkillCooldownOnSkillEnd = true; val.canceledFromSprinting = false; val.fullRestockOnAssign = false; val.interruptPriority = (InterruptPriority)0; val.isCombatSkill = false; val.mustKeyPress = true; val.cancelSprintingOnActivation = false; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("utility"); val.skillDescriptionToken = "WIDOWMAKER_UTIL_DESCRIPTION"; val.skillName = "WIDOWMAKER_UTIL"; val.skillNameToken = "WIDOWMAKER_UTIL"; ContentAddition.AddSkillDef(val); component.utility = Utils.NewGenericSkill(characterPrefab, val); } private void SpecialSetup() { //IL_003d: 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_007b: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = characterPrefab.GetComponent<SkillLocator>(); LanguageAPI.Add("WIDOWMAKER_SPEC", "Infra-Sight"); LanguageAPI.Add("WIDOWMAKER_SPEC_DESCRIPTION", "Highlights <style=cIsHealth>True Weak Points</style> for <style=cIsUtility>8s</style>, doubling <style=cIsDamage>critical damage</style>."); SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.activationState = new SerializableEntityStateType(typeof(Special)); val.activationStateMachineName = "Visor"; val.baseMaxStock = 1; val.baseRechargeInterval = 18f; val.beginSkillCooldownOnSkillEnd = true; val.canceledFromSprinting = false; val.fullRestockOnAssign = false; val.interruptPriority = (InterruptPriority)0; val.isCombatSkill = true; val.mustKeyPress = true; val.cancelSprintingOnActivation = false; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("special"); val.skillDescriptionToken = "WIDOWMAKER_SPEC_DESCRIPTION"; val.skillName = "WIDOWMAKER_SPEC"; val.skillNameToken = "WIDOWMAKER_SPEC"; ContentAddition.AddSkillDef(val); component.special = Utils.NewGenericSkill(characterPrefab, val); } } internal class Prefabs { internal static GameObject scope; internal static GameObject targetVisualizer; internal static GameObject targetVisualizerEmp; internal static GameObject hook; internal static GameObject critEffect; internal static GameObject critEffectEmp; internal static GameObject sniperTracer; internal static GameObject sniperTracerCharged; internal static GameObject sniperTracerEmp; internal static GameObject sniperMuzzle; internal static CharacterCameraParams scopeParamsData; internal static BuffDef visor; internal static Material scanMat; internal static Sprite smg; internal static Sprite sniper; internal static Sprite sniperEmp; 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 void CreatePrefabs() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Expected O, but got Unknown //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) smg = Assets.Load<Sprite>("primary"); sniper = Assets.Load<Sprite>("sniper"); sniperEmp = Assets.Load<Sprite>("sniperEmp"); scanMat = new Material(Load<Material>("RoR2/InDev/matEcho.mat")); scanMat.SetTexture("_RemapTex", (Texture)null); scanMat.SetColor("_TintColor", Color.red); scanMat.SetFloat("_ZTest", 8f); scopeParamsData = Load<CharacterCameraParams>("RoR2/DLC1/Railgunner/ccpRailgunnerScopeHeavy.asset"); visor = Utils.NewBuffDef("Infra-Sight", stack: false, hidden: false, Load<Sprite>("RoR2/Base/CritOnUse/texBuffFullCritIcon.tif"), MainPlugin.characterColor); sniperMuzzle = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Common/VFX/Muzzleflash1.prefab"), "WidowmakerSniperMuzzle", false); ParticleSystemRenderer[] componentsInChildren = sniperMuzzle.GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val in componentsInChildren) { ((Renderer)val).material = new Material(((Renderer)val).material); ((Renderer)val).material.DisableKeyword("VERTEXCOLOR"); ((Renderer)val).material.SetColor("_TintColor", Color.red); } ContentAddition.AddEffect(sniperMuzzle); critEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Common/VFX/CritsparkHeavy.prefab"), "WidowmakerCritEffect", false); critEffect.GetComponent<EffectComponent>().soundName = "Play_Widowmaker_Sniper_Crit"; ParticleSystem[] componentsInChildren2 = critEffect.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren2) { MainModule main = val2.main; ((MainModule)(ref main)).simulationSpeed = 0.25f; } ContentAddition.AddEffect(critEffect); critEffectEmp = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Golem/ExplosionGolem.prefab"), "WidowmakerCritEffectEmp", false); critEffectEmp.GetComponent<EffectComponent>().soundName = "Play_Widowmaker_Sniper_CritEmp"; ParticleSystem[] componentsInChildren3 = critEffectEmp.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val3 in componentsInChildren3) { MainModule main2 = val3.main; ((MainModule)(ref main2)).simulationSpeed = 0.25f; } ContentAddition.AddEffect(critEffectEmp); sniperTracer = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/ClayBruiser/TracerClayBruiserMinigun.prefab"), "WidowmakerSniperTracer", false); LineRenderer component = sniperTracer.GetComponent<LineRenderer>(); component.startColor = Color.red; component.endColor = Color.red; ((Renderer)sniperTracer.GetComponent<Tracer>().beamObject.GetComponent<LineRenderer>()).material = Load<Material>("RoR2/Base/Common/VFX/matEquipmentTrail.mat"); ContentAddition.AddEffect(sniperTracer); sniperTracerCharged = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Huntress/TracerHuntressSnipe.prefab"), "WidowmakerSniperTracerCharged", false); ((Component)sniperTracerCharged.GetComponentInChildren<LineRenderer>()).gameObject.SetActive(false); Material val4 = new Material(Load<Material>("RoR2/Base/Huntress/matHuntressSwingTrail.mat")); val4.SetColor("_TintColor", Color.red); val4.SetTexture("_MainTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/VFX/ParticleMasks/texLightning3Mask.tif")); val4.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampMageFire.png")); val4.SetFloat("_Boost", 3.5f); val4.SetFloat("_AlphaBoost", 1.5f); GameObject beamObject = sniperTracerCharged.GetComponent<Tracer>().beamObject; beamObject.AddComponent<DestroyOnParticleEnd>(); ParticleSystemRenderer component2 = beamObject.GetComponent<ParticleSystemRenderer>(); component2.trailMaterial = val4; ContentAddition.AddEffect(sniperTracerCharged); sniperTracerEmp = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Golem/TracerGolem.prefab"), "WidowmakerTracerEmp", false); ParticleSystemRenderer componentInChildren = sniperTracerEmp.GetComponentInChildren<ParticleSystemRenderer>(); ((Component)componentInChildren).transform.localScale = new Vector3(1f, 0.3f, 0.3f); ((Renderer)componentInChildren).material = new Material(((Renderer)componentInChildren).material); ((Renderer)componentInChildren).material.SetTexture("_MainTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/VFX/texOmniHitspark2Mask.png")); ContentAddition.AddEffect(sniperTracerEmp); targetVisualizer = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/DLC1/Railgunner/RailgunnerSniperTargetVisualizerHeavy.prefab"), "WidowmakerScopeTargetVisualizer", false); Image[] componentsInChildren4 = targetVisualizer.GetComponentsInChildren<Image>(); foreach (Image val5 in componentsInChildren4) { if (((Component)val5).transform.GetSiblingIndex() == 0) { ((Component)val5).transform.localScale = Vector3.one * 0.7f; ((Component)val5).transform.localRotation = Quaternion.Euler(0f, 0f, 45f); } else { val5.sprite = Assets.Load<Sprite>("target"); } } targetVisualizerEmp = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/DLC1/Railgunner/RailgunnerSniperTargetVisualizerHeavy.prefab"), "WidowmakerScopeTargetVisualizerEmp", false); Image[] componentsInChildren5 = targetVisualizerEmp.GetComponentsInChildren<Image>(); foreach (Image val6 in componentsInChildren5) { if (((Component)val6).transform.GetSiblingIndex() == 0) { ((Component)val6).transform.localScale = Vector3.one * 0.7f; ((Component)val6).transform.localRotation = Quaternion.Euler(0f, 0f, 45f); } else { val6.sprite = Assets.Load<Sprite>("targetEmp"); ((Graphic)val6).color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)200)); } } scope = PrefabAPI.InstantiateClone(Assets.Load<GameObject>("Scope"), "WidowmakerScope", false); ChildLocator component3 = scope.GetComponent<ChildLocator>(); GameObject gameObject = ((Component)component3.FindChild("targetViewer")).gameObject; RectTransform val7 = (RectTransform)gameObject.transform; ((Transform)val7).localScale = Vector3.one; ((Transform)val7).localPosition = Vector3.zero; val7.anchorMax = Vector2.one; val7.pivot = Vector2.one * 0.5f; gameObject.AddComponent<SniperTargetViewer>().visualizerPrefab = targetVisualizer; gameObject.AddComponent<VisualizerPrefabSetter>(); WidowScopeBehaviour widowScopeBehaviour = scope.AddComponent<WidowScopeBehaviour>(); widowScopeBehaviour.indicator1 = ((Component)component3.FindChild("indicator1")).gameObject; widowScopeBehaviour.indicator2 = ((Component)component3.FindChild("indicator2")).gameObject; widowScopeBehaviour.indicator3 = ((Component)component3.FindChild("indicator3")).gameObject; widowScopeBehaviour.fullcharge = ((Component)component3.FindChild("fullCharge")).gameObject; widowScopeBehaviour.text = ((Component)component3.FindChild("text")).GetComponent<TextMeshProUGUI>(); Utils.AddScaleComponent(((Component)component3.FindChild("mid")).gameObject, 0.08f); Utils.AddScaleComponent(((Component)component3.FindChild("dots")).gameObject, 0.12f); Utils.AddScaleComponent(((Component)component3.FindChild("inner")).gameObject, 0.22f); Utils.AddScaleComponent(((Component)component3.FindChild("outer")).gameObject, 0.35f); ObjectScaleCurve val8 = Utils.AddScaleComponent(widowScopeBehaviour.fullcharge, 0.15f); val8.overallCurve = AnimationCurve.EaseInOut(0f, 1.6f, 1f, 1f); hook = PrefabAPI.InstantiateClone(Assets.Load<GameObject>("hookProjectile"), "WidowmakerHook", false); hook.AddComponent<NetworkIdentity>(); hook.layer = LayerIndex.projectile.intVal; hook.AddComponent<ProjectileNetworkTransform>(); hook.AddComponent<ProjectileController>(); ProjectileSimple val9 = hook.AddComponent<ProjectileSimple>(); val9.desiredForwardSpeed = 270f; val9.lifetime = 999f; val9.updateAfterFiring = true; Utils.AddScaleComponent(((Component)hook.transform.GetChild(0)).gameObject, 0.2f); hook.AddComponent<HookBehaviour>(); ContentAddition.AddProjectile(hook); } } internal class CharacterMain : GenericCharacterMain { } internal class HookState : GenericCharacterMain { private WidowBehaviour behaviour; private Vector3 pos; private float moveSpeedScale; private uint ID; public override void OnEnter() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) ((GenericCharacterMain)this).OnEnter(); behaviour = ((EntityState)this).GetComponent<WidowBehaviour>(); pos = behaviour.hookPos; moveSpeedScale = Util.Remap(((BaseState)this).moveSpeedStat, 7f, 25f, behaviour.minHookSpeed, behaviour.maxHookSpeed); ((EntityState)this).PlayAnimation("Body", "Hook"); ((BaseCharacterMain)this).modelAnimator.SetBool("hook", true); ID = AkSoundEngine.PostEvent("Play_Widowmaker_Hook_Pull", ((EntityState)this).gameObject); Vector3 val = pos - ((EntityState)this).transform.position; Vector2 val2 = Util.Vector3XZToVector2XY(((Vector3)(ref val)).normalized); if (val2 != Vector2.zero) { ((Vector2)(ref val2)).Normalize(); val = new Vector3(val2.x, 0f, val2.y); Vector3 normalized = ((Vector3)(ref val)).normalized; ((EntityState)this).characterDirection.moveVector = normalized; } } public override void OnExit() { AkSoundEngine.PostEvent("Play_Widowmaker_Hook_End", ((EntityState)this).gameObject); AkSoundEngine.StopPlayingID(ID); ((BaseCharacterMain)this).modelAnimator.SetBool("hook", false); ((GenericCharacterMain)this).OnExit(); } public override void HandleMovements() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0083: 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) //IL_0093: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!((EntityState)this).isAuthority) { return; } Vector3 val = pos - ((EntityState)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; bool down = ((EntityState)this).inputBank.jump.down; if (Vector3.Distance(((EntityState)this).transform.position, pos) <= behaviour.maxHookDistance || down) { ((EntityState)this).characterMotor.velocity = normalized * behaviour.hookForce * moveSpeedScale; if (down) { CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += Vector3.up * behaviour.hookForce * moveSpeedScale * behaviour.hookUpForceMult; } ((EntityState)this).outer.SetNextStateToMain(); } else { ((EntityState)this).characterMotor.velocity = Vector3.zero; CharacterMotor characterMotor2 = ((EntityState)this).characterMotor; characterMotor2.rootMotion += normalized * behaviour.hookSpeed * moveSpeedScale; } } } internal class Primary : BaseSkillState { private float duration; private float baseDuration; private WidowBehaviour behaviour; private float minSsniperDamageCoefficient = 2f; private float maxSniperDamageCoefficient = 10f; private float smgDamageCoefficient = 1.2f; private GameObject sniperMuzzle = Prefabs.sniperMuzzle; private GameObject smgTracer = Prefabs.Load<GameObject>("RoR2/Base/Commando/TracerCommandoDefault.prefab"); private GameObject smgMuzzle = Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/Muzzleflash1.prefab"); private GameObject impactEffect = Prefabs.Load<GameObject>("RoR2/Base/Common/VFX/OmniImpactVFX.prefab"); private GameObject bulletSniperTargetHitEffect; public override void OnEnter() { ((BaseState)this).OnEnter(); behaviour = ((EntityState)this).GetComponent<WidowBehaviour>(); ((BaseState)this).StartAimMode(1f, false); baseDuration = (behaviour.scoping ? 0.35f : 0.1f); duration = baseDuration / ((BaseState)this).attackSpeedStat; if (((EntityState)this).isAuthority && behaviour.scoping) { ((EntityState)this).skillLocator.primary.DeductStock(4); } ((EntityState)this).PlayAnimation("Gesture, Override", behaviour.scoping ? "Sniper_Fire" : "SMG_Fire"); if (behaviour.scoping) { bool flag = behaviour.charge >= behaviour.maxCharge; if (((EntityState)this).isAuthority) { AkSoundEngine.PostEvent(flag ? "Play_Widowmaker_Sniper_Fire_Strong_UI" : "Play_Widowmaker_Sniper_Fire_Weak_UI", ((EntityState)this).gameObject); } else { AkSoundEngine.PostEvent(flag ? "Play_Widowmaker_Sniper_Fire_Strong" : "Play_Widowmaker_Sniper_Fire_Weak", ((EntityState)this).gameObject); } } else { AkSoundEngine.PostEvent("Play_Widowmaker_SMG_Fire", ((EntityState)this).gameObject); } Fire(); behaviour.ResetCharge(); } private void Fire() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) float num = (behaviour.scoping ? 8f : 1.2f); ((BaseState)this).AddRecoil(-1f * num, -1.5f * num, -0.25f * num, 0.25f * num); ((EntityState)this).characterBody.AddSpreadBloom(2f); EffectManager.SimpleMuzzleFlash(behaviour.scoping ? sniperMuzzle : smgMuzzle, ((EntityState)this).gameObject, "weaponMuzzle", false); if (behaviour.scoping) { bulletSniperTargetHitEffect = BulletAttack.sniperTargetHitEffect; BulletAttack.sniperTargetHitEffect = (behaviour.emp ? Prefabs.critEffectEmp : ((behaviour.charge >= 1f) ? Prefabs.critEffect : impactEffect)); } if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); float num2 = 0.0425f; new BulletAttack { bulletCount = 1u, aimVector = ((Ray)(ref aimRay)).direction, origin = ((Ray)(ref aimRay)).origin, damage = ((BaseState)this).damageStat * (behaviour.scoping ? Util.Remap(behaviour.charge, 0f, 1f, minSsniperDamageCoefficient, maxSniperDamageCoefficient) : smgDamageCoefficient), damageColorIndex = (DamageColorIndex)0, damageType = DamageTypeCombo.op_Implicit((DamageType)0), falloffModel = (FalloffModel)((!behaviour.scoping) ? 1 : 0), maxDistance = (behaviour.scoping ? 9999 : 250), force = 80f, minSpread = 0f - num2, maxSpread = num2, isCrit = ((BaseState)this).RollCrit(), owner = ((EntityState)this).gameObject, muzzleName = (behaviour.scoping ? "" : "weaponMuzzle"), smartCollision = true, procChainMask = default(ProcChainMask), procCoefficient = (behaviour.scoping ? 0.4f : 0.12f), radius = 0.05f, sniper = behaviour.scoping, stopperMask = ((behaviour.scoping & behaviour.emp) ? ((LayerIndex)(ref LayerIndex.world)).mask : CommonMasks.bullet), weapon = null, tracerEffectPrefab = ((!behaviour.scoping) ? smgTracer : (behaviour.emp ? Prefabs.sniperTracerEmp : ((behaviour.charge >= 1f) ? Prefabs.sniperTracerCharged : Prefabs.sniperTracer))), spreadPitchScale = 1f, spreadYawScale = 1f, hitEffectPrefab = impactEffect }.Fire(); } BulletAttack.sniperTargetHitEffect = bulletSniperTargetHitEffect; } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { if (((EntityState)this).skillLocator.primary.stock == 0) { ((EntityState)this).outer.SetNextState((EntityState)(object)new Reload()); } else { ((EntityState)this).outer.SetNextState((EntityState)(object)new PrimaryReloadWait()); } } } public override void OnExit() { ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } internal class PrimaryReloadWait : BaseSkillState { public float duration = 3f; public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority) { if (((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextState((EntityState)(object)new Reload()); } if (((BaseSkillState)this).IsKeyDownAuthority()) { ((EntityState)this).outer.SetNextStateToMain(); } } } } internal class Reload : BaseSkillState { private float duration; private float baseDuration = 1.5f; private uint ID = 0u; public override void OnEnter() { ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; ((EntityState)this).PlayAnimation("Gesture, Override", "Reload", "Reload", duration, 0f); AkSoundEngine.PostEvent("Play_Widowmaker_Reload", ((EntityState)this).gameObject); Animator component = ((Component)((BaseState)this).FindModelChild("sniper")).GetComponent<Animator>(); component.SetFloat("reload", ((BaseState)this).attackSpeedStat); component.Play("Reload", 1); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= duration * 0.65f && ID == 0) { ID = Util.PlayAttackSpeedSound("Play_bandit2_m1_reload_finish", ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); } if (((EntityState)this).isAuthority) { if (((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } else if (((EntityState)this).inputBank.skill1.down && ((EntityState)this).skillLocator.primary.stock > 0) { ((EntityState)this).outer.SetNextStateToMain(); } } } public override void OnExit() { AkSoundEngine.StopPlayingID(ID); ((EntityState)this).skillLocator.primary.Reset(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } internal class Secondary : BaseSkillState { private float duration = 0.12f; private WidowBehaviour behaviour; private OverlayController overlayController; private CameraParamsOverrideHandle cameraParamsOverrideHandle; private OverrideRequest crosshairOverrideRequest; private Animator sniperAnimator; private uint ID; public override void OnEnter() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); ((EntityState)this).PlayAnimation("Aim, Override", "AimUp"); behaviour = ((EntityState)this).GetComponent<WidowBehaviour>(); behaviour.scoping = true; if (((EntityState)this).isAuthority) { Prefabs.scope.GetComponent<WidowScopeBehaviour>().behaviour = behaviour; overlayController = HudOverlayManager.AddOverlay(((EntityState)this).gameObject, new OverlayCreationParams { prefab = Prefabs.scope, childLocatorEntry = "ScopeContainer" }); crosshairOverrideRequest = CrosshairUtils.RequestOverrideForBody(((EntityState)this).characterBody, Prefabs.Load<GameObject>("RoR2/Base/UI/SimpleDotCrosshair.prefab"), (OverridePriority)1); cameraParamsOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(new CameraParamsOverrideRequest { cameraParamsData = Prefabs.scopeParamsData.data, priority = 1f }, duration); } sniperAnimator = ((Component)((BaseState)this).FindModelChild("sniper")).GetComponent<Animator>(); sniperAnimator.SetBool("scope", true); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); ((BaseState)this).StartAimMode(1f, false); ((EntityState)this).characterBody.isSprinting = false; if ((((EntityState)this).isAuthority && !((BaseSkillState)this).IsKeyDownAuthority()) || ((EntityState)this).skillLocator.primary.stock == 0) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) behaviour.scoping = false; AkSoundEngine.PostEvent("Play_railgunner_m2_scope_out", ((EntityState)this).gameObject); AkSoundEngine.StopPlayingID(ID); if (Object.op_Implicit((Object)(object)sniperAnimator)) { sniperAnimator.SetBool("scope", false); } ((EntityState)this).GetModelAnimator().SetTrigger("aim"); if (((EntityState)this).isAuthority) { ((EntityState)this).cameraTargetParams.RemoveParamsOverride(cameraParamsOverrideHandle, duration); if (crosshairOverrideRequest != null) { crosshairOverrideRequest.Dispose(); } if (overlayController != null) { HudOverlayManager.RemoveOverlay(overlayController); } } ((EntityState)this).OnExit(); } } internal class Special : BaseSkillState { private float duration = 8f; private WidowBehaviour behaviour; private Dictionary<HurtBox, GameObject> targetDict = new Dictionary<HurtBox, GameObject>(); private uint ID; public override void OnEnter() { ((BaseState)this).OnEnter(); behaviour = ((EntityState)this).GetComponent<WidowBehaviour>(); behaviour.emp = true; ((EntityState)this).GetModelAnimator().SetBool("visor", true); ((EntityState)this).PlayAnimation("Gesture, Override", behaviour.scoping ? "ActivateHelmet_Aim" : "ActivateHelmet_NoAim"); if (NetworkServer.active) { ((EntityState)this).characterBody.AddBuff(Prefabs.visor); } if (((EntityState)this).isAuthority) { AkSoundEngine.PostEvent("Play_Widowmaker_Scan_Activate", ((EntityState)this).gameObject); ID = AkSoundEngine.PostEvent("Play_Widowmaker_Scan_Loop", ((EntityState)this).gameObject); } } public override void FixedUpdate() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); foreach (HurtBox readOnlySniperTargets in HurtBox.readOnlySniperTargetsList) { GameObject value = null; if (Object.op_Implicit((Object)(object)readOnlySniperTargets.healthComponent) && readOnlySniperTargets.healthComponent.alive && FriendlyFireManager.ShouldDirectHitProceed(readOnlySniperTargets.healthComponent, ((EntityState)this).teamComponent.teamIndex) && (Object)(object)readOnlySniperTargets.healthComponent.body != (Object)(object)((EntityState)this).characterBody && !targetDict.TryGetValue(readOnlySniperTargets, out value) && !Object.op_Implicit((Object)(object)value)) { CharacterBody body = readOnlySniperTargets.healthComponent.body; value = ((Component)readOnlySniperTargets.healthComponent).gameObject; targetDict.Add(readOnlySniperTargets, value); if (Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((Component)body.modelLocator.modelTransform).gameObject); val.duration = duration - ((EntityState)this).fixedAge; val.animateShaderAlpha = true; val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); val.destroyComponentOnEnd = true; val.originalMaterial = Prefabs.scanMat; val.AddToCharacterModel(((Component)body.modelLocator.modelTransform).GetComponent<CharacterModel>()); } } } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { if (((EntityState)this).isAuthority) { AkSoundEngine.StopPlayingID(ID); AkSoundEngine.PostEvent("Play_Widowmaker_Scan_End", ((EntityState)this).gameObject); } if (NetworkServer.active) { ((EntityState)this).characterBody.RemoveBuff(Prefabs.visor); } ((EntityState)this).GetModelAnimator().SetBool("visor", false); behaviour.emp = false; ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } internal class Utility : BaseSkillState { private WidowBehaviour behaviour; private EntityStateMachine bodyMachine; public override void OnEnter() { //IL_002c: 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_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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); behaviour = ((EntityState)this).GetComponent<WidowBehaviour>(); bodyMachine = ((EntityState)this).GetComponent<EntityStateMachine>(); if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); ProjectileManager.instance.FireProjectile(Prefabs.hook, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, 0f, 0f, false, (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); } ((EntityState)this).PlayAnimation("Gesture, Override", "Hook_Fire"); AkSoundEngine.PostEvent("Play_Widowmaker_Hook_Fire", ((EntityState)this).gameObject); } public override void FixedUpdate() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= behaviour.hookDuration * 2f) { if (Object.op_Implicit((Object)(object)behaviour.hookProjectile) && Vector3.Distance(((EntityState)this).transform.position, behaviour.hookProjectile.transform.position) <= behaviour.maxHookDistance) { EntityState.Destroy((Object)(object)behaviour.hookProjectile); } if ((((EntityState)this).isAuthority && !Object.op_Implicit((Object)(object)behaviour.hookProjectile)) || ((object)bodyMachine.state).GetType() != typeof(HookState)) { ((EntityState)this).outer.SetNextStateToMain(); } } } public override void OnExit() { if (Object.op_Implicit((Object)(object)behaviour.hookProjectile)) { EntityState.Destroy((Object)(object)behaviour.hookProjectile); } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } internal class Sounds { public static readonly uint Play_Widowmaker_Scan_Loop = 436676373u; public static readonly uint Play_Widowmaker_Reload = 543329008u; public static readonly uint Play_Widowmaker_SMG_Fire = 1157764585u; public static readonly uint Play_Widowmaker_Scan_End = 1916908642u; public static readonly uint Play_Widowmaker_Hook_Fire = 2201021477u; public static readonly uint Play_Widowmaker_Scan_Activate = 2661975476u; public static readonly uint Play_Widowmaker_Sniper_Fire_Strong = 2699845585u; public static readonly uint Play_Widowmaker_Sniper_Fire = 2812470793u; public static readonly uint Play_Widowmaker_Hook_Loop = 3220300955u; public static readonly uint Play_Widowmaker_Hook_Pull = 3561982612u; public static readonly uint Play_Widowmaker_Scope_Charge = 4182114876u; public static readonly uint Play_Widowmaker_Intro = 4227501751u; public static readonly uint Play_Widowmaker_Hook_End = 2640461344u; public static readonly uint Play_Widowmaker_Sniper_Fire_Weak = 2091448908u; public static readonly uint Play_Widowmaker_Sniper_Fire_UI = 22876322u; public static readonly uint Play_Widowmaker_Sniper_Fire_Strong_UI = 601977626u; public static readonly uint Play_Widowmaker_Sniper_Fire_Weak_UI = 312762965u; public static readonly uint Play_Widowmaker_Sniper_Crit = 812149u; public static readonly uint Play_Widowmaker_Sniper_CritEmp = 3695148441u; } 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 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown GameObject val = PrefabAPI.InstantiateClone(model, name, false); Animator componentInChildren = val.GetComponentInChildren<Animator>(); componentInChildren.runtimeAnimatorController = Assets.Load<RuntimeAnimatorController>("displayAnimator"); ChildLocator componentInChildren2 = val.GetComponentInChildren<ChildLocator>(); GameObject gameObject = ((Component)componentInChildren2.FindChild("displayLine")).gameObject; DisplayBehaviour displayBehaviour = ((Component)componentInChildren).gameObject.AddComponent<DisplayBehaviour>(); displayBehaviour.line = gameObject; displayBehaviour.sniperAnimator = ((Component)componentInChildren2.FindChild("sniper")).GetComponent<Animator>(); ((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, params Color[] colors) { //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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) || ((Object)val).name.Contains("eye"); GameObjectActivation item = val2; list.Add(item); } result.GameObjectActivations = list.ToArray(); result.Icon = Skins.CreateSkinIcon(colors[0], colors[1], colors[2], colors[3]); result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0]; result.Name = skinName; result.NameToken = skinName; result.RendererInfos = rendererInfos; result.RootObject = rootObject; result.UnlockableDef = ((objectToEnable == "skin") ? Achievements.masteryUnlock : null); return result; } internal static SkinDefInfo CreateNewSkinDefInfo(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos) { //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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0082: 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_0087: 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) || ((Object)val).name.Contains("eye"); 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 = null; 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 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 = false; val.effectIndex = (EffectIndex)(-1); val.parentToReferencedTransform = parentToReferencedTransform; val.positionAtReferencedTransform = positionAtReferencedTransform; val.soundName = soundName; ContentAddition.AddEffect(effect); return val; } public static Material UpdateMaterial(Material m) { Texture mainTexture = m.mainTexture; Texture texture = m.GetTexture("_BumpMap"); m.shader = Prefabs.Load<Shader>("RoR2/Base/Shaders/HGStandard.shader"); m.SetTexture("_MainTex", mainTexture); m.SetFloat("_NormalStrength", 1f); m.SetTexture("_NormalTex", texture); return m; } public static Material InstantiateMaterial(Material m) { //IL_0022: 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) 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", m.mainTexture); val.SetColor("_EmColor", Color.black); val.SetFloat("_EmPower", 0f); val.SetTexture("_EmTex", (Texture)null); val.SetFloat("_NormalStrength", 1f); val.SetTexture("_NormalTex", m.GetTexture("_BumpMap")); 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; } } internal class WidowSkillDef : SkillDef { private class InstanceData : BaseSkillInstanceData { public WidowBehaviour behaviour; public SkillLocator skillLocator; } public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { behaviour = ((Component)skillSlot).GetComponent<WidowBehaviour>(), skillLocator = ((Component)skillSlot).GetComponent<SkillLocator>() }; } internal static bool IsExecutable([NotNull] GenericSkill skillSlot) { InstanceData instanceData = (InstanceData)(object)skillSlot.skillInstanceData; SkillLocator skillLocator = instanceData.skillLocator; return skillLocator.primary.stock > 0; } public override bool CanExecute([NotNull] GenericSkill skillSlot) { return IsExecutable(skillSlot) && ((SkillDef)this).CanExecute(skillSlot); } public override bool IsReady([NotNull] GenericSkill skillSlot) { return ((SkillDef)this).IsReady(skillSlot) && IsExecutable(skillSlot); } }