Пример #1
0
        public override bool OnUse(EquipmentSlot equipmentSlot)
        {
            MysticsRisky2UtilsEquipmentTarget targetInfo = equipmentSlot.GetComponent <MysticsRisky2UtilsEquipmentTarget>();

            if (targetInfo)
            {
                if (targetInfo.obj)
                {
                    PurchaseInteraction purchaseInteraction = targetInfo.obj.GetComponent <MysticsItemsDuplicatorLocator>().purchaseInteraction;
                    purchaseInteraction.SetAvailable(false);
                    purchaseInteraction.lockGameObject = null;
                    ShopTerminalBehavior shopTerminalBehavior = targetInfo.obj.GetComponent <MysticsItemsDuplicatorLocator>().shopTerminalBehavior;
                    EffectManager.SimpleEffect(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniRecycleEffect"), shopTerminalBehavior.pickupDisplay.transform.position, Quaternion.identity, true);
                    shopTerminalBehavior.SetHasBeenPurchased(true);
                    for (var i = 0; i < amount; i++)
                    {
                        PickupDropletController.CreatePickupDroplet(
                            shopTerminalBehavior.pickupIndex,
                            (shopTerminalBehavior.dropTransform ? shopTerminalBehavior.dropTransform : shopTerminalBehavior.transform).position,
                            shopTerminalBehavior.transform.TransformVector(shopTerminalBehavior.dropVelocity)
                            );
                    }
                    shopTerminalBehavior.SetNoPickup();
                    targetInfo.Invalidate();
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public override bool OnUse(EquipmentSlot equipmentSlot)
        {
            MysticsRisky2UtilsEquipmentTarget targetInfo = equipmentSlot.GetComponent <MysticsRisky2UtilsEquipmentTarget>();

            if (targetInfo)
            {
                if (targetInfo.obj)
                {
                    var hackingManager = targetInfo.obj.AddComponent <MysticsItemsOmarHackToolHackingManager>();
                    hackingManager.purchaseInteraction = targetInfo.obj.GetComponent <MysticsItemsChestLocator>().purchaseInteraction;
                    if (equipmentSlot.characterBody)
                    {
                        hackingManager.interactor = equipmentSlot.characterBody.GetComponent <Interactor>();
                    }
                    if (hackingManager.GetComponent <ChestBehavior>())
                    {
                        hackingManager.delay = 0.1f;
                    }
                    else
                    {
                        hackingManager.purchaseInteraction.SetAvailable(false);
                    }

                    EffectManager.SpawnEffect(hackOverlayPrefab, new EffectData
                    {
                        rootObject = hackingManager.gameObject
                    }, true);

                    var component2 = equipmentSlot.GetComponent <MysticsItemsOmarHackToolBehaviour>();
                    if (component2 && component2.usesLeft > 0)
                    {
                        component2.usesLeft--;
                    }

                    targetInfo.Invalidate();

                    equipmentSlot.subcooldownTimer = 0.5f;
                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
        public override void OnLoad()
        {
            equipmentDef.name = "MysticsItems_PrinterHacker";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Wirehack Wrench", 90f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Wirehack Wrench", false);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Wirehack Wrench", false);
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Wirehack Wrench/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Wirehack Wrench/Icon.png");

            HopooShaderToMaterial.Standard.Gloss(equipmentDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 1f, 20f);
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            equipmentDef.pickupModelPrefab.transform.Find("d4b43750924799f8").Rotate(new Vector3(0f, 0f, -30f), Space.Self);
            var modelPanelParams = equipmentDef.pickupModelPrefab.GetComponent <ModelPanelParameters>();

            modelPanelParams.minDistance = 5;
            modelPanelParams.maxDistance = 10;
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.163F, 0.092F, -0.036F), new Vector3(356.022F, 118.071F, 26.4F), new Vector3(0.024F, 0.024F, 0.024F));
                AddDisplayRule("HuntressBody", "Pelvis", new Vector3(-0.088F, -0.085F, 0.059F), new Vector3(0.679F, 36.762F, 196.086F), new Vector3(0.019F, 0.019F, 0.019F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(0.129F, 0.025F, -0.111F), new Vector3(316.052F, 250.792F, 338.145F), new Vector3(0.038F, 0.038F, 0.038F));
                AddDisplayRule("ToolbotBody", "Hip", new Vector3(-1.202F, 0.577F, -0.876F), new Vector3(0F, 180F, 180F), new Vector3(0.349F, 0.349F, 0.349F));
                AddDisplayRule("EngiBody", "Pelvis", new Vector3(-0.178F, 0.078F, 0.157F), new Vector3(11.745F, 186.295F, 185.936F), new Vector3(0.047F, 0.047F, 0.047F));
                AddDisplayRule("MageBody", "Pelvis", new Vector3(-0.172F, -0.067F, -0.078F), new Vector3(7.421F, 5.596F, 187.29F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("MercBody", "Chest", new Vector3(-0.115F, 0.032F, 0.083F), new Vector3(18.292F, 60.198F, 185.734F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(-0.485F, 0.701F, -0.803F), new Vector3(26.173F, 24.306F, 86.838F), new Vector3(0.061F, 0.061F, 0.061F));
                AddDisplayRule("LoaderBody", "Pelvis", new Vector3(-0.216F, -0.016F, -0.022F), new Vector3(342.363F, 183.205F, 159.555F), new Vector3(0.045F, 0.045F, 0.045F));
                AddDisplayRule("CrocoBody", "SpineStomach1", new Vector3(0.845F, 0.495F, 1.289F), new Vector3(74.633F, 327.618F, 247.859F), new Vector3(0.361F, 0.361F, 0.361F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(-0.195F, 0.128F, 0.126F), new Vector3(336.504F, 156.734F, 358.159F), new Vector3(0.041F, 0.041F, 0.041F));
                AddDisplayRule("ScavBody", "Backpack", new Vector3(-5.969F, 10.94F, 0.665F), new Vector3(338.478F, 350.544F, 54.934F), new Vector3(1.363F, 1.363F, 1.363F));
                AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.1F), new Vector3(52.577F, 0F, 0.001F), new Vector3(0.283F, 0.283F, 0.283F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Pelvis", new Vector3(0.24189F, 0.23523F, -0.05035F), new Vector3(309.5458F, 359.9093F, 0.10958F), new Vector3(0.04303F, 0.04303F, 0.04303F));
                }
                AddDisplayRule("RailgunnerBody", "Stomach", new Vector3(0.10961F, -0.09564F, 0.08252F), new Vector3(0F, 0F, 189.4295F), new Vector3(0.04997F, 0.04997F, 0.04997F));
                AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(-0.17006F, 0.12587F, 0.08001F), new Vector3(324.1714F, 170.6519F, 135.1764F), new Vector3(0.04652F, 0.04652F, 0.04652F));
            };

            crosshairPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/WoodSpriteIndicator"), "MysticsItems_PrinterHackerIndicator", false);
            Object.Destroy(crosshairPrefab.GetComponentInChildren <Rewired.ComponentControls.Effects.RotateAroundAxis>());
            crosshairPrefab.GetComponentInChildren <SpriteRenderer>().sprite             = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Wirehack Wrench/Crosshair.png");
            crosshairPrefab.GetComponentInChildren <SpriteRenderer>().color              = new Color32(255, 235, 75, 255);
            crosshairPrefab.GetComponentInChildren <SpriteRenderer>().transform.rotation = Quaternion.identity;
            crosshairPrefab.GetComponentInChildren <TMPro.TextMeshPro>().color           = new Color32(255, 235, 75, 255);
            while (crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.length > 0)
            {
                crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.RemoveKey(0);
            }
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(0f, 2f);
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(0.5f, 1f);
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(1f, 1f);

            UseTargetFinder(TargetFinderType.Custom);

            On.RoR2.PurchaseInteraction.Awake += (orig, self) =>
            {
                orig(self);
                string properName = MysticsRisky2Utils.Utils.TrimCloneFromString(self.name);
                if (properName == "Duplicator" ||
                    properName == "DuplicatorLarge" ||
                    properName == "DuplicatorWild" ||
                    properName == "DuplicatorMilitary")
                {
                    Transform transform = self.transform.Find("mdlDuplicator/DuplicatorMesh");
                    if (transform)
                    {
                        MysticsItemsDuplicatorLocator component = self.gameObject.AddComponent <MysticsItemsDuplicatorLocator>();
                        component.childTransform = transform;
                    }
                }
            };

            On.RoR2.EquipmentSlot.Update += (orig, self) =>
            {
                orig(self);
                if (self.equipmentIndex == equipmentDef.equipmentIndex)
                {
                    MysticsRisky2UtilsEquipmentTarget targetInfo = self.GetComponent <MysticsRisky2UtilsEquipmentTarget>();
                    if (targetInfo)
                    {
                        DuplicatorSearch duplicatorSearch = targetInfo.GetCustomTargetFinder <DuplicatorSearch>();
                        float            num;
                        Ray aimRay = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), self.gameObject, out num);
                        duplicatorSearch.searchOrigin           = aimRay.origin;
                        duplicatorSearch.searchDirection        = aimRay.direction;
                        duplicatorSearch.minAngleFilter         = 0f;
                        duplicatorSearch.maxAngleFilter         = 10f;
                        duplicatorSearch.minDistanceFilter      = 0f;
                        duplicatorSearch.maxDistanceFilter      = 30f + num;
                        duplicatorSearch.filterByDistinctEntity = false;
                        duplicatorSearch.filterByLoS            = true;
                        duplicatorSearch.sortMode = SortMode.DistanceAndAngle;
                        MysticsItemsDuplicatorLocator duplicator = duplicatorSearch.SearchCandidatesForSingleTarget(InstanceTracker.GetInstancesList <MysticsItemsDuplicatorLocator>());
                        if (duplicator)
                        {
                            targetInfo.obj = duplicator.gameObject;
                            targetInfo.indicator.visualizerPrefab = crosshairPrefab;
                            targetInfo.indicator.targetTransform  = duplicator.childTransform;
                        }
                        else
                        {
                            targetInfo.Invalidate();
                        }
                        targetInfo.indicator.active = duplicator;
                    }
                }
            };
        }
Пример #4
0
        public override bool OnUse(EquipmentSlot equipmentSlot)
        {
            CharacterMaster master = equipmentSlot.characterBody.master;

            if (master)
            {
                ArchaicMaskSummonLimit summonLimit = master.GetComponent <ArchaicMaskSummonLimit>();
                if (!summonLimit)
                {
                    summonLimit = master.gameObject.AddComponent <ArchaicMaskSummonLimit>();
                }

                MysticsRisky2UtilsEquipmentTarget targetInfo = equipmentSlot.GetComponent <MysticsRisky2UtilsEquipmentTarget>();
                if (targetInfo && targetInfo.obj)
                {
                    HurtBox targetHB = targetInfo.obj.GetComponent <CharacterBody>().mainHurtBox;
                    if (targetHB)
                    {
                        DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest((SpawnCard)LegacyResourcesAPI.Load <CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscArchWisp"), new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.NearestNode,
                            spawnOnTarget = targetHB.transform
                        }, RoR2Application.rng)
                        {
                            summonerBodyObject = equipmentSlot.characterBody.gameObject
                        };
                        directorSpawnRequest.onSpawnedServer += (spawnResult) =>
                        {
                            GameObject      wispMasterObject = spawnResult.spawnedInstance;
                            CharacterMaster wispMaster       = wispMasterObject.GetComponent <CharacterMaster>();
                            wispMaster.inventory.GiveItem(RoR2Content.Items.HealthDecay, (int)duration.Value);
                            wispMaster.inventory.GiveItem(RoR2Content.Items.BoostDamage, (int)(wispDamage.Value - 100f) / 10);
                            wispMaster.inventory.GiveItem(RoR2Content.Items.BoostHp, (int)(wispHealth.Value - 100f) / 10);
                            wispMaster.inventory.GiveItem(RoR2Content.Items.AlienHead, (int)(wispCDR.Value - 100f) / 10);
                            wispMaster.inventory.GiveItem(RoR2Content.Items.BoostAttackSpeed, (int)(wispAttackSpeed.Value - 100f) / 10);
                            wispMaster.GetComponent <RoR2.CharacterAI.BaseAI>().currentEnemy.gameObject  = targetHB.healthComponent.gameObject;
                            wispMaster.GetComponent <RoR2.CharacterAI.BaseAI>().currentEnemy.bestHurtBox = targetHB;
                            summonLimit.Add(wispMasterObject);
                        };
                        DirectorCore.instance.TrySpawnObject(directorSpawnRequest);

                        targetInfo.Invalidate();
                        return(true);
                    }
                }

                {
                    DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest((SpawnCard)LegacyResourcesAPI.Load <CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscArchWisp"), new DirectorPlacementRule
                    {
                        placementMode = DirectorPlacementRule.PlacementMode.NearestNode,
                        position      = equipmentSlot.GetAimRay().origin
                    }, RoR2Application.rng)
                    {
                        summonerBodyObject = equipmentSlot.characterBody.gameObject
                    };
                    directorSpawnRequest.onSpawnedServer += (spawnResult) =>
                    {
                        GameObject      wispMasterObject = spawnResult.spawnedInstance;
                        CharacterMaster wispMaster       = wispMasterObject.GetComponent <CharacterMaster>();
                        wispMaster.inventory.GiveItem(RoR2Content.Items.HealthDecay, (int)duration.Value);
                        wispMaster.inventory.GiveItem(RoR2Content.Items.BoostDamage, (int)(wispDamage.Value - 100f) / 10);
                        wispMaster.inventory.GiveItem(RoR2Content.Items.BoostHp, (int)(wispHealth.Value - 100f) / 10);
                        wispMaster.inventory.GiveItem(RoR2Content.Items.AlienHead, (int)(wispCDR.Value - 100f) / 10);
                        wispMaster.inventory.GiveItem(RoR2Content.Items.BoostAttackSpeed, (int)(wispAttackSpeed.Value - 100f) / 10);
                        summonLimit.Add(wispMasterObject);
                    };
                    DirectorCore.instance.TrySpawnObject(directorSpawnRequest);
                    return(true);
                }
            }
            return(false);
        }
Пример #5
0
        public override void OnLoad()
        {
            equipmentDef.name = "MysticsItems_OmarHackTool";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: From Omar With Love", 60f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: From Omar With Love", false);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: From Omar With Love", false);
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/From Omar With Love/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/From Omar With Love/Icon.png");

            ModelPanelParameters modelPanelParameters = equipmentDef.pickupModelPrefab.GetComponent <ModelPanelParameters>();

            modelPanelParameters.minDistance = 3f;
            modelPanelParameters.maxDistance = 15f;

            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            var itemDisplayHelper = itemDisplayPrefab.AddComponent <MysticsItemsOmarHackToolItemDisplayHelper>();

            itemDisplayHelper.hologramObject = itemDisplayPrefab.transform.Find("HologramPivot").gameObject;
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(0.07132F, 0.06612F, 0.16335F), new Vector3(356.4405F, 183.4027F, 175.2333F), new Vector3(0.05273F, 0.05273F, 0.05273F));
                AddDisplayRule("HuntressBody", "Pelvis", new Vector3(0.16212F, -0.06929F, -0.04928F), new Vector3(346.9094F, 305.4124F, 344.1372F), new Vector3(0.05129F, 0.05129F, 0.05129F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.08026F, 0.03366F, -0.14135F), new Vector3(25.90035F, 4.31119F, 171.9758F), new Vector3(0.05568F, 0.05568F, 0.05568F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(2.44491F, 1.16734F, 0.31814F), new Vector3(327.4072F, -0.00001F, 88.11515F), new Vector3(0.88852F, 0.88852F, 0.88852F));
                AddDisplayRule("EngiBody", "LowerArmL", new Vector3(0.00352F, 0.24612F, -0.05998F), new Vector3(0.32021F, 358.9018F, 358.6807F), new Vector3(0.05067F, 0.05067F, 0.05067F));
                AddDisplayRule("MageBody", "Pelvis", new Vector3(-0.17887F, -0.07933F, -0.17931F), new Vector3(357.9544F, 233.4202F, 346.881F), new Vector3(0.04982F, 0.04982F, 0.04982F));
                AddDisplayRule("MercBody", "Pelvis", new Vector3(0.1129F, 0.0254F, -0.17644F), new Vector3(13.57408F, 151.9048F, 358.9593F), new Vector3(0.05206F, 0.05206F, 0.05206F));
                AddDisplayRule("TreebotBody", "WeaponPlatformEnd", new Vector3(0.00002F, 0.09097F, 0.24047F), new Vector3(0F, 0F, 0F), new Vector3(0.11139F, 0.11139F, 0.11139F));
                AddDisplayRule("LoaderBody", "MechBase", new Vector3(0.23928F, -0.07178F, 0.33048F), new Vector3(356.9285F, 91.33677F, 183.2036F), new Vector3(0.06152F, 0.06152F, 0.06152F));
                AddDisplayRule("CrocoBody", "LowerArmR", new Vector3(0.59287F, 4.87558F, 0.47809F), new Vector3(359.8608F, 58.79917F, 8.98919F), new Vector3(0.55777F, 0.55777F, 0.55777F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(0.15397F, 0.13966F, 0.16991F), new Vector3(356.0198F, 17.26032F, 189.3092F), new Vector3(0.05578F, 0.05578F, 0.05578F));
                AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(4.83208F, -2.97995F, -10.98303F), new Vector3(0F, 0F, 56.95893F), new Vector3(1.363F, 1.363F, 1.363F));
                AddDisplayRule("EquipmentDroneBody", "HeadCenter", new Vector3(0.92365F, 0F, -0.60534F), new Vector3(270F, 270F, 0F), new Vector3(0.32166F, 0.32166F, 0.32166F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Pelvis", new Vector3(0.15563F, 0.20335F, 0.15945F), new Vector3(358.1388F, 35.73481F, 190.192F), new Vector3(0.053F, 0.053F, 0.053F));
                }
                AddDisplayRule("RailgunnerBody", "Backpack", new Vector3(-0.14103F, -0.39243F, -0.12953F), new Vector3(-0.00001F, 180F, 180F), new Vector3(0.092F, 0.092F, 0.092F));
                AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.37032F, 0.42285F, -0.10184F), new Vector3(62.57283F, 57.94892F, 316.8636F), new Vector3(0.09658F, 0.09658F, 0.09658F));
            };

            crosshairPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/WoodSpriteIndicator"), "MysticsItems_OmarHackToolIndicator", false);
            var spriteTransform  = crosshairPrefab.GetComponentInChildren <SpriteRenderer>().transform;
            var rotateComponent  = crosshairPrefab.GetComponentInChildren <Rewired.ComponentControls.Effects.RotateAroundAxis>();
            var crosshairSprites = Main.AssetBundle.LoadAssetWithSubAssets <Sprite>("Assets/Equipment/From Omar With Love/HoverIndicator.png");

            for (var i = 0; i < crosshairSprites.Length; i++)
            {
                var spriteTransform2 = Object.Instantiate(spriteTransform.gameObject, spriteTransform);
                var spriteRenderer   = spriteTransform2.GetComponent <SpriteRenderer>();
                spriteRenderer.sprite             = crosshairSprites[i];
                spriteRenderer.color              = new Color32(0, 255, 127, 255);
                spriteRenderer.transform.rotation = Quaternion.identity;
                var rotateComponent2 = spriteTransform2.GetComponent <Rewired.ComponentControls.Effects.RotateAroundAxis>();
                rotateComponent2.rotateAroundAxis  = rotateComponent.rotateAroundAxis;
                rotateComponent2.relativeTo        = rotateComponent.relativeTo;
                rotateComponent2.speed             = Rewired.ComponentControls.Effects.RotateAroundAxis.Speed.Slow;
                rotateComponent2.slowRotationSpeed = (i + 1) * 25f;
                rotateComponent2.reverse           = (i % 2) == 0;
                Object.Destroy(spriteTransform2.GetComponent <ObjectScaleCurve>());
            }
            Object.Destroy(spriteTransform.GetComponent <SpriteRenderer>());
            Object.Destroy(rotateComponent);
            crosshairPrefab.GetComponentInChildren <TMPro.TextMeshPro>().color = new Color32(0, 255, 127, 255);
            while (crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.length > 0)
            {
                crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.RemoveKey(0);
            }
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(0f, 0f);
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(0.5f, 1f);
            crosshairPrefab.GetComponentInChildren <ObjectScaleCurve>().overallCurve.AddKey(1f, 1f);

            UseTargetFinder(TargetFinderType.Custom);

            On.RoR2.PurchaseInteraction.Awake += (orig, self) =>
            {
                orig(self);
                var purchaseInteraction = self.GetComponent <PurchaseInteraction>();
                if (purchaseInteraction && purchaseInteraction.costType == CostTypeIndex.Money && (self.displayNameToken.Contains("CHEST") || self.displayNameToken.Contains("SHRINE")))
                {
                    ModelLocator modelLocator = self.GetComponent <ModelLocator>();
                    if (modelLocator && modelLocator.modelTransform)
                    {
                        MysticsItemsChestLocator component = self.gameObject.AddComponent <MysticsItemsChestLocator>();
                        component.childTransform = modelLocator.modelTransform;
                    }
                }
            };

            On.RoR2.EquipmentSlot.Update += (orig, self) =>
            {
                orig(self);
                if (self.equipmentIndex == equipmentDef.equipmentIndex)
                {
                    MysticsRisky2UtilsEquipmentTarget targetInfo = self.GetComponent <MysticsRisky2UtilsEquipmentTarget>();
                    if (targetInfo)
                    {
                        var component = self.GetComponent <MysticsItemsOmarHackToolBehaviour>();
                        if (component && component.usesLeft > 0)
                        {
                            ChestSearch duplicatorSearch = targetInfo.GetCustomTargetFinder <ChestSearch>();
                            float       num;
                            Ray         aimRay = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), self.gameObject, out num);
                            duplicatorSearch.searchOrigin           = aimRay.origin;
                            duplicatorSearch.searchDirection        = aimRay.direction;
                            duplicatorSearch.minAngleFilter         = 0f;
                            duplicatorSearch.maxAngleFilter         = 10f;
                            duplicatorSearch.minDistanceFilter      = 0f;
                            duplicatorSearch.maxDistanceFilter      = 30f + num;
                            duplicatorSearch.filterByDistinctEntity = false;
                            duplicatorSearch.filterByLoS            = true;
                            duplicatorSearch.sortMode = SortMode.DistanceAndAngle;
                            MysticsItemsChestLocator duplicator = duplicatorSearch.SearchCandidatesForSingleTarget(InstanceTracker.GetInstancesList <MysticsItemsChestLocator>());
                            if (duplicator)
                            {
                                targetInfo.obj = duplicator.gameObject;
                                targetInfo.indicator.visualizerPrefab = crosshairPrefab;
                                targetInfo.indicator.targetTransform  = duplicator.childTransform;
                            }
                            else
                            {
                                targetInfo.Invalidate();
                            }
                            targetInfo.indicator.active = duplicator;
                        }
                        else
                        {
                            targetInfo.Invalidate();
                            targetInfo.indicator.active = false;
                        }
                    }
                }
            };

            On.RoR2.EquipmentSlot.Start              += EquipmentSlot_Start;
            On.RoR2.EquipmentSlot.ExecuteIfReady     += EquipmentSlot_ExecuteIfReady;
            On.RoR2.EquipmentSlot.UpdateInventory    += EquipmentSlot_UpdateInventory;
            On.RoR2.CharacterBody.OnInventoryChanged += CharacterBody_OnInventoryChanged;
            Stage.onStageStartGlobal     += Stage_onStageStartGlobal;
            HUD.onHudTargetChangedGlobal += HUD_onHudTargetChangedGlobal;

            On.RoR2.UI.EquipmentIcon.Update += EquipmentIcon_Update;

            hudPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/From Omar With Love/OverEquipmentIcon.prefab");
            var hudComp = hudPrefab.AddComponent <MysticsItemsOmarHackToolHUD>();

            hudComp.usesLeftText      = hudPrefab.transform.Find("UsesText").GetComponent <TextMeshProUGUI>();
            hudComp.usesLeftText.font = HGTextMeshProUGUI.defaultLanguageFont;

            hackVFXPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/From Omar With Love/HackVFX.prefab");
            EffectComponent effectComponent = hackVFXPrefab.AddComponent <EffectComponent>();

            effectComponent.applyScale = true;
            effectComponent.soundName  = "MysticsItems_Play_env_OmarHackTool";
            VFXAttributes vfxAttributes = hackVFXPrefab.AddComponent <VFXAttributes>();

            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Medium;
            hackVFXPrefab.AddComponent <DestroyOnTimer>().duration = 10f;
            MysticsItemsContent.Resources.effectPrefabs.Add(hackVFXPrefab);

            On.RoR2.ChestBehavior.ItemDrop += ChestBehavior_ItemDrop;

            hackOverlayPrefab = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_OmarHackToolHackOverlay", false);
            EntityStateMachine entityStateMachine = hackOverlayPrefab.AddComponent <EntityStateMachine>();

            entityStateMachine.initialStateType = entityStateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(MysticsItemsOmarHackToolOverlay));
            effectComponent = hackOverlayPrefab.AddComponent <EffectComponent>();
            effectComponent.parentToReferencedTransform = true;
            vfxAttributes = hackOverlayPrefab.AddComponent <VFXAttributes>();
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Low;
            MysticsItemsContent.Resources.effectPrefabs.Add(hackOverlayPrefab);
        }