public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_ScratchTicket"; SetItemTierWhenAvailable(ItemTier.Tier1); itemDef.tags = new ItemTag[] { ItemTag.Utility }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Scratch Ticket/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Scratch Ticket/Icon.png"); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 1; modelPanelParams.maxDistance = 2; HopooShaderToMaterial.Standard.Gloss(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 0.05f, 20f); itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Head", new Vector3(0.109F, 0.159F, -0.123F), new Vector3(25.857F, 140.857F, 4.186F), new Vector3(0.102F, 0.102F, 0.102F)); AddDisplayRule("HuntressBody", "Head", new Vector3(0.077F, 0.1F, -0.13F), new Vector3(85.128F, 22.234F, 233.333F), new Vector3(0.084F, 0.084F, 0.084F)); AddDisplayRule("Bandit2Body", "Stomach", new Vector3(0.088F, 0.093F, 0.172F), new Vector3(72.061F, 15.327F, 356.324F), new Vector3(0.15F, 0.15F, 0.15F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(1.804F, 1.034F, -1.656F), new Vector3(20.492F, 214.386F, 67.265F), new Vector3(1.043F, 1.043F, 1.043F)); AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0.064F, 0.027F, -0.169F), new Vector3(42.86F, 152.127F, 353.333F), new Vector3(0.175F, 0.175F, 0.175F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.8316F, 0.72181F, -0.23478F), new Vector3(323.0401F, 108.2313F, 5.96822F), new Vector3(0.29536F, 0.29536F, 0.29536F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.47616F, 1.3804F, -0.4785F), new Vector3(74.07391F, 268.1374F, 180F), new Vector3(0.33715F, 0.41012F, 0.3296F)); AddDisplayRule("MageBody", "Head", new Vector3(0.044F, 0.113F, -0.177F), new Vector3(13.198F, 167.753F, 11.941F), new Vector3(0.086F, 0.086F, 0.086F)); AddDisplayRule("MercBody", "Head", new Vector3(0.066F, 0.195F, -0.092F), new Vector3(358.901F, 249.659F, 64.015F), new Vector3(0.093F, 0.093F, 0.093F)); AddDisplayRule("TreebotBody", "PlatformBase", new Vector3(-0.073F, 0.359F, -1.062F), new Vector3(13.168F, 154.79F, 328.62F), new Vector3(0.315F, 0.315F, 0.315F)); AddDisplayRule("LoaderBody", "MechBase", new Vector3(0.162F, 0.046F, -0.123F), new Vector3(13.044F, 208.575F, 57.569F), new Vector3(0.15F, 0.15F, 0.15F)); AddDisplayRule("CrocoBody", "HandR", new Vector3(-1.129F, -1.383F, 0.659F), new Vector3(18.756F, 105.807F, 169.38F), new Vector3(1.162F, 1.162F, 1.162F)); AddDisplayRule("CaptainBody", "Chest", new Vector3(-0.1F, 0.226F, 0.174F), new Vector3(15.849F, 346.474F, 358.999F), new Vector3(0.086F, 0.086F, 0.086F)); AddDisplayRule("BrotherBody", "UpperArmL", BrotherInfection.white, new Vector3(-0.018F, 0.215F, -0.064F), new Vector3(0F, 0F, 131.256F), new Vector3(0.115F, 0.063F, 0.063F)); AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(-3.88535F, -0.90743F, -18.53646F), new Vector3(16.92252F, 288.3049F, 72.11835F), new Vector3(2.62999F, 2.70243F, 2.62999F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.00102F, -0.02749F, -0.23014F), new Vector3(7.74695F, 179.5125F, 359.482F), new Vector3(0.09241F, 0.09241F, 0.09241F)); } AddDisplayRule("RailgunnerBody", "BottomRail", new Vector3(0.00312F, 0.36536F, -0.04365F), new Vector3(357.5628F, 151.3911F, 256.462F), new Vector3(0.15615F, 0.15615F, 0.15615F)); AddDisplayRule("VoidSurvivorBody", "Neck", new Vector3(0.10783F, 0.10931F, -0.151F), new Vector3(65.45281F, 129.4731F, 339.067F), new Vector3(0.1282F, 0.1282F, 0.1282F)); }; On.RoR2.Util.CheckRoll_float_CharacterMaster += Util_CheckRoll_float_CharacterMaster; }
public override void OnLoad() { equipmentDef.name = "MysticsItems_MechanicalArm"; ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Mechanical Arm", 20f); equipmentDef.canDrop = true; ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Mechanical Arm", true); ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Mechanical Arm", false); equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Mechanical Arm/Model.prefab")); equipmentDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Mechanical Arm/Icon.png"); void ApplyToModels(GameObject model) { var mat = model.GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial; HopooShaderToMaterial.Standard.Apply(mat); HopooShaderToMaterial.Standard.Gloss(mat); HopooShaderToMaterial.Standard.Emission(mat, 1.5f, new Color32(191, 15, 3, 255)); } ApplyToModels(equipmentDef.pickupModelPrefab); ModelPanelParameters modelPanelParameters = equipmentDef.pickupModelPrefab.GetComponent <ModelPanelParameters>(); modelPanelParameters.minDistance = 6f; modelPanelParameters.maxDistance = 12f; itemDisplayPrefab = PrepareItemDisplayModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Mechanical Arm/MovingModel.prefab")); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Chest", new Vector3(0.07816F, 0.25502F, -0.15061F), new Vector3(0F, 180F, 0F), new Vector3(0.07862F, 0.07862F, 0.07862F)); AddDisplayRule("HuntressBody", "Chest", new Vector3(0.10676F, 0.14576F, -0.04849F), new Vector3(0F, 180F, 0F), new Vector3(0.03776F, 0.03776F, 0.03776F)); AddDisplayRule("Bandit2Body", "Chest", new Vector3(0.00326F, 0.18527F, -0.12067F), new Vector3(0F, 185.5073F, 0F), new Vector3(0.05941F, 0.05941F, 0.05941F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(2.63852F, 1.90061F, 0.02656F), new Vector3(0F, 180F, 0F), new Vector3(0.56946F, 0.56946F, 0.56946F)); AddDisplayRule("EngiBody", "Chest", new Vector3(0.01994F, 0.13958F, -0.23417F), new Vector3(0F, 180F, 0F), new Vector3(0.06142F, 0.06142F, 0.06142F)); AddDisplayRule("MageBody", "Chest", new Vector3(0.09002F, 0.03363F, -0.2332F), new Vector3(0F, 175.5407F, 0F), new Vector3(0.05358F, 0.05358F, 0.05358F)); AddDisplayRule("MercBody", "Chest", new Vector3(0.00246F, 0.14756F, -0.16344F), new Vector3(0F, 202.2791F, 0F), new Vector3(0.08846F, 0.08846F, 0.08846F)); AddDisplayRule("TreebotBody", "PlatformBase", new Vector3(0.53248F, 0.66126F, 0F), new Vector3(0F, 180F, 0F), new Vector3(0.19873F, 0.19873F, 0.19873F)); AddDisplayRule("LoaderBody", "MechBase", new Vector3(-0.03249F, 0.00003F, -0.06065F), new Vector3(0F, 206.8929F, 0F), new Vector3(0.09891F, 0.09891F, 0.09796F)); AddDisplayRule("CrocoBody", "SpineChest2", new Vector3(0F, -0.86934F, 0.00013F), new Vector3(0F, 0F, 0F), new Vector3(0.83816F, 0.83816F, 0.83816F)); AddDisplayRule("CaptainBody", "Chest", new Vector3(-0.00812F, 0.17595F, -0.14316F), new Vector3(0F, 218.1953F, 0F), new Vector3(0.09604F, 0.09604F, 0.09604F)); AddDisplayRule("ScavBody", "Backpack", new Vector3(6.49963F, 6.38849F, 0.00031F), new Vector3(0F, 180F, 0F), new Vector3(2.02387F, 2.02387F, 2.02387F)); AddDisplayRule("EquipmentDroneBody", "HeadCenter", new Vector3(0.4758F, 0F, -0.48188F), new Vector3(270F, 180F, 0F), new Vector3(0.42601F, 0.42601F, 0.42601F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.1706F, 0.13246F, -0.20744F), new Vector3(0F, 180F, 0F), new Vector3(0.053F, 0.053F, 0.053F)); } AddDisplayRule("RailgunnerBody", "Backpack", new Vector3(0.08517F, 0.21948F, 0.00002F), new Vector3(0F, 180F, 0F), new Vector3(0.09344F, 0.09344F, 0.09344F)); AddDisplayRule("VoidSurvivorBody", "Center", new Vector3(-0.0074F, 0.3145F, -0.08637F), new Vector3(359.7796F, 219.7314F, 0.26983F), new Vector3(0.07043F, 0.07043F, 0.07043F)); }; ChildLocator childLocator = itemDisplayPrefab.AddComponent <ChildLocator>(); NetworkedBodyAttachment networkedBodyAttachment = mechanicalArmControllerPrefab.AddComponent <NetworkedBodyAttachment>(); networkedBodyAttachment.shouldParentToAttachedBody = true; networkedBodyAttachment.forceHostAuthority = true; EntityStateMachine entityStateMachine = mechanicalArmControllerPrefab.AddComponent <EntityStateMachine>(); entityStateMachine.initialStateType = entityStateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(MysticsItemsMechanicalArmState.Idle)); NetworkStateMachine networkStateMachine = mechanicalArmControllerPrefab.AddComponent <NetworkStateMachine>(); networkStateMachine.SetFieldValue("stateMachines", new EntityStateMachine[] { entityStateMachine }); MysticsItemsContent.Resources.entityStateTypes.Add(typeof(MysticsItemsMechanicalArmState)); MysticsItemsContent.Resources.entityStateTypes.Add(typeof(MysticsItemsMechanicalArmState.Idle)); MysticsItemsContent.Resources.entityStateTypes.Add(typeof(MysticsItemsMechanicalArmState.Swing)); ModelLocator modelLocator = mechanicalArmControllerPrefab.AddComponent <ModelLocator>(); modelLocator.dontReleaseModelOnDeath = false; modelLocator.autoUpdateModelTransform = false; modelLocator.dontDetatchFromParent = true; modelLocator.preserveModel = true; PrefabAPI.InstantiateClone( Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Mechanical Arm/MovingModel.prefab") .transform.Find("HitboxGroup").gameObject, "HitboxGroup", false ).transform.SetParent(mechanicalArmControllerPrefab.transform); Object.Destroy(itemDisplayPrefab.transform.Find("HitboxGroup").gameObject); HitBoxGroup hitBoxGroup = mechanicalArmControllerPrefab.transform.Find("HitboxGroup").gameObject.AddComponent <HitBoxGroup>(); hitBoxGroup.groupName = "MysticsItems_MechanicalArmSwing"; hitBoxGroup.hitBoxes = new HitBox[] { mechanicalArmControllerPrefab.transform.Find("HitboxGroup/Hitbox").gameObject.AddComponent <HitBox>() }; hitBoxGroup.gameObject.SetActive(true); AnimationCurve MakeGenericCurve() { return(new AnimationCurve { keys = new Keyframe[] { new Keyframe(0, 1), new Keyframe(1, 1) } }); } Transform armRoot = null; foreach (var child in itemDisplayPrefab.GetComponentsInChildren <Transform>()) { var childName = child.name; if (childName == "arm.1") { armRoot = child; var ntp = new ChildLocator.NameTransformPair { name = "Arm1", transform = child }; HGArrayUtilities.ArrayAppend(ref childLocator.transformPairs, ref ntp); } else { if (childName.StartsWith("arm.", false, System.Globalization.CultureInfo.InvariantCulture)) { var ntp = new ChildLocator.NameTransformPair { name = "Arm" + childName.Remove(0, "arm.".Length), transform = child }; HGArrayUtilities.ArrayAppend(ref childLocator.transformPairs, ref ntp); DynamicBone dynamicBone = child.gameObject.AddComponent <DynamicBone>(); dynamicBone.m_Root = child; dynamicBone.m_UpdateRate = 60; dynamicBone.m_UpdateMode = DynamicBone.UpdateMode.Normal; dynamicBone.m_Damping = 0.8f; dynamicBone.m_DampingDistrib = MakeGenericCurve(); dynamicBone.m_Elasticity = 0.1f; dynamicBone.m_ElasticityDistrib = MakeGenericCurve(); dynamicBone.m_Stiffness = 0.9f; dynamicBone.m_StiffnessDistrib = MakeGenericCurve(); dynamicBone.m_Inert = 0f; dynamicBone.m_InertDistrib = MakeGenericCurve(); dynamicBone.m_Radius = 0f; dynamicBone.m_RadiusDistrib = MakeGenericCurve(); } } } On.RoR2.EquipmentSlot.FixedUpdate += (orig, self) => { orig(self); if (NetworkServer.active) { MysticsItemsMechanicalArmState armController = MysticsItemsMechanicalArmState.FindMechanicalArmController(self.gameObject); bool carryingThisEquipment = self.equipmentIndex == equipmentDef.equipmentIndex; if (carryingThisEquipment != (armController != null)) { if (carryingThisEquipment) { var armControllerInstance = Object.Instantiate <GameObject>(mechanicalArmControllerPrefab); armControllerInstance.GetComponent <NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(self.gameObject); return; } Object.Destroy(armController.gameObject); } } }; var swingEffectPrefab = MysticsItemsMechanicalArmState.Swing.swingEffectPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Mechanical Arm/SwingEffect.prefab"); ScaleParticleSystemDuration scaleParticleSystemDuration = swingEffectPrefab.AddComponent <ScaleParticleSystemDuration>(); scaleParticleSystemDuration.particleSystems = swingEffectPrefab.GetComponentsInChildren <ParticleSystem>(); scaleParticleSystemDuration.initialDuration = 1f; ShakeEmitter shakeEmitter = swingEffectPrefab.AddComponent <ShakeEmitter>(); shakeEmitter.duration = 0.2f; shakeEmitter.radius = 20f; shakeEmitter.wave = new Wave { amplitude = 4f, frequency = 4f }; shakeEmitter.amplitudeTimeDecay = true; shakeEmitter.shakeOnStart = true; shakeEmitter.shakeOnEnable = false; MysticsItemsMechanicalArmState.Swing.hitEffectPrefab = LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ImpactEffects/SawmerangImpact"); var snd = ScriptableObject.CreateInstance <NetworkSoundEventDef>(); snd.eventName = "MysticsItems_Play_mechanicalArm_impact"; MysticsItemsContent.Resources.networkSoundEventDefs.Add(snd); MysticsItemsMechanicalArmState.Swing.impactSound = snd; GenericGameEvents.OnHitEnemy += GenericGameEvents_OnHitEnemy; RecalculateStatsAPI.GetStatCoefficients += RecalculateStatsAPI_GetStatCoefficients; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_TreasureMap"; SetItemTierWhenAvailable(ItemTier.Tier3); itemDef.tags = new ItemTag[] { ItemTag.Utility, ItemTag.AIBlacklist, ItemTag.CannotCopy }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Treasure Map/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Treasure Map/Icon.png"); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 3; modelPanelParams.maxDistance = 6; itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "LowerArmR", new Vector3(-0.084F, 0.183F, -0.006F), new Vector3(83.186F, 36.557F, 131.348F), new Vector3(0.053F, 0.053F, 0.053F)); AddDisplayRule("HuntressBody", "Muzzle", new Vector3(-0.527F, -0.032F, -0.396F), new Vector3(0.509F, 134.442F, 184.268F), new Vector3(0.042F, 0.042F, 0.042F)); AddDisplayRule("Bandit2Body", "MuzzleShotgun", new Vector3(0.014F, -0.07F, -0.668F), new Vector3(0F, 180F, 180F), new Vector3(0.04F, 0.04F, 0.04F)); AddDisplayRule("ToolbotBody", "Head", new Vector3(0.198F, 3.655F, -0.532F), new Vector3(304.724F, 180F, 180F), new Vector3(0.448F, 0.448F, 0.448F)); AddDisplayRule("EngiBody", "WristDisplay", new Vector3(0.01F, -0.001F, 0.007F), new Vector3(86.234F, 155.949F, 155.218F), new Vector3(0.065F, 0.065F, 0.065F)); AddDisplayRule("MageBody", "LowerArmR", new Vector3(0.116F, 0.188F, 0.008F), new Vector3(88.872F, 20.576F, 290.58F), new Vector3(0.074F, 0.074F, 0.074F)); AddDisplayRule("MercBody", "LowerArmR", new Vector3(-0.01F, 0.144F, -0.116F), new Vector3(277.017F, 64.808F, 295.358F), new Vector3(0.072F, 0.072F, 0.072F)); AddDisplayRule("TreebotBody", "HeadBase", new Vector3(-0.013F, 0.253F, -0.813F), new Vector3(1.857F, 5.075F, 0.053F), new Vector3(0.13F, 0.143F, 0.294F)); AddDisplayRule("LoaderBody", "MechLowerArmR", new Vector3(-0.01F, 0.544F, -0.144F), new Vector3(275.35F, 95.995F, 266.284F), new Vector3(0.095F, 0.095F, 0.095F)); AddDisplayRule("CrocoBody", "UpperArmR", new Vector3(1.735F, -0.575F, 0.196F), new Vector3(281.472F, 180.072F, 89.927F), new Vector3(0.868F, 0.868F, 0.868F)); AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.066F, 0.087F, 0.011F), new Vector3(76.759F, 135.292F, 224.52F), new Vector3(0.059F, 0.053F, 0.059F)); AddDisplayRule("BrotherBody", "HandR", BrotherInfection.red, new Vector3(0.051F, -0.072F, 0.004F), new Vector3(44.814F, 122.901F, 267.545F), new Vector3(0.063F, 0.063F, 0.063F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Chest", new Vector3(-0.10307F, 0.44329F, -0.26101F), new Vector3(0F, 0F, 0F), new Vector3(0.05402F, 0.05402F, 0.05402F)); } AddDisplayRule("RailgunnerBody", "GunRoot", new Vector3(0.00726F, -0.15201F, 0.07672F), new Vector3(270F, 180F, 0F), new Vector3(0.05025F, 0.05025F, 0.05025F)); AddDisplayRule("VoidSurvivorBody", "ForeArmL", new Vector3(0.06352F, 0.24419F, 0.00664F), new Vector3(69.26795F, 34.44471F, 302.5876F), new Vector3(0.05926F, 0.05926F, 0.05926F)); }; MysticsRisky2Utils.Utils.CopyChildren(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Treasure Map/TreasureMapZone.prefab"), zonePrefab); HoldoutZoneController holdoutZone = zonePrefab.AddComponent <HoldoutZoneController>(); holdoutZone.baseRadius = radius; holdoutZone.baseChargeDuration = unearthTime; holdoutZone.radiusSmoothTime = 1f; holdoutZone.radiusIndicator = zonePrefab.transform.Find("Visuals/Sphere").gameObject.GetComponent <Renderer>(); holdoutZone.inBoundsObjectiveToken = "OBJECTIVE_MYSTICSITEMS_CHARGE_TREASUREMAPZONE"; holdoutZone.outOfBoundsObjectiveToken = "OBJECTIVE_MYSTICSITEMS_CHARGE_TREASUREMAPZONE_OOB"; holdoutZone.applyHealingNova = true; holdoutZone.applyFocusConvergence = true; holdoutZone.playerCountScaling = 0f; // Charge by 1 second regardless of how many players are charging the zone holdoutZone.dischargeRate = 0f; holdoutZone.enabled = false; MysticsItemsTreasureMapZone captureZone = zonePrefab.AddComponent <MysticsItemsTreasureMapZone>(); captureZone.itemDef = itemDef; captureZone.dropTable = Addressables.LoadAssetAsync <PickupDropTable>("RoR2/Base/GoldChest/dtGoldChest.asset").WaitForCompletion(); captureZone.dropTransform = zonePrefab.transform.Find("DropPivot"); HologramProjector hologramProjector = zonePrefab.AddComponent <HologramProjector>(); hologramProjector.displayDistance = holdoutZone.baseRadius; hologramProjector.hologramPivot = zonePrefab.transform.Find("HologramPivot"); hologramProjector.hologramPivot.transform.localScale *= 2f; hologramProjector.disableHologramRotation = false; captureZone.hologramProjector = hologramProjector; Decal decal = zonePrefab.transform.Find("Decal").gameObject.AddComponent <Decal>(); decal.RenderMode = Decal.DecalRenderMode.Deferred; Material decalMaterial = new Material(LegacyShaderAPI.Find("Decalicious/Deferred Decal")); decal.Material = decalMaterial; decalMaterial.name = "MysticsItems_TreasureMapDecal"; Texture decalTexture = Main.AssetBundle.LoadAsset <Texture>("Assets/Items/Treasure Map/texTreasureMapDecal.png"); decalMaterial.SetTexture("_MainTex", decalTexture); decalMaterial.SetTexture("_MaskTex", decalTexture); decalMaterial.SetFloat("_AngleLimit", 0.6f); decalMaterial.SetFloat("_DecalLayer", 1f); decalMaterial.SetFloat("_DecalBlendMode", 0f); decalMaterial.SetColor("_Color", new Color32(70, 10, 10, 255)); decalMaterial.SetColor("_EmissionColor", Color.black); decal.Fade = 1f; decal.DrawAlbedo = true; decal.UseLightProbes = true; decal.DrawNormalAndGloss = false; decal.HighQualityBlending = false; { decal.GetComponent <MeshFilter>().sharedMesh = LegacyResourcesAPI.Load <Mesh>("DecalCube"); MeshRenderer component = decal.GetComponent <MeshRenderer>(); component.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; component.receiveShadows = false; component.materials = new Material[0]; component.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes; component.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; } decal.gameObject.transform.localScale = Vector3.one * 10f; HG.ArrayUtils.ArrayAppend(ref captureZone.toggleObjects, decal.gameObject); On.RoR2.HoldoutZoneController.ChargeHoldoutZoneObjectiveTracker.ShouldBeFlashing += (orig, self) => { if (self.sourceDescriptor.master) { HoldoutZoneController holdoutZoneController = (HoldoutZoneController)self.sourceDescriptor.source; if (holdoutZoneController && holdoutZoneController.gameObject.GetComponent <MysticsItemsTreasureMapZone>()) { var teleporterInteraction = TeleporterInteraction.instance; if (teleporterInteraction && teleporterInteraction.isCharged) { return(true); } return(false); } } return(orig(self)); }; zoneSpawnCard = ScriptableObject.CreateInstance <SpawnCard>(); zoneSpawnCard.name = "iscMysticsItems_TreasureMapZone"; zoneSpawnCard.prefab = zonePrefab; zoneSpawnCard.directorCreditCost = 0; zoneSpawnCard.sendOverNetwork = true; zoneSpawnCard.hullSize = HullClassification.Human; zoneSpawnCard.nodeGraphType = RoR2.Navigation.MapNodeGroup.GraphType.Ground; zoneSpawnCard.requiredFlags = RoR2.Navigation.NodeFlags.None; zoneSpawnCard.forbiddenFlags = RoR2.Navigation.NodeFlags.None; zoneSpawnCard.occupyPosition = false; GenericGameEvents.OnPopulateScene += (rng) => { DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(zoneSpawnCard, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Random }, rng)); }; ghostMaterial = LegacyResourcesAPI.Load <Material>("Materials/matGhostEffect"); soundEventDef = ScriptableObject.CreateInstance <NetworkSoundEventDef>(); soundEventDef.eventName = "MysticsItems_Play_env_treasuremap"; MysticsItemsContent.Resources.networkSoundEventDefs.Add(soundEventDef); effectPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Treasure Map/UnearthEffect.prefab"); EffectComponent effectComponent = effectPrefab.AddComponent <EffectComponent>(); VFXAttributes vfxAttributes = effectPrefab.AddComponent <VFXAttributes>(); vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium; vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Medium; effectPrefab.AddComponent <DestroyOnTimer>().duration = 1f; ShakeEmitter shakeEmitter = effectPrefab.AddComponent <ShakeEmitter>(); shakeEmitter.shakeOnStart = true; shakeEmitter.shakeOnEnable = false; shakeEmitter.duration = 0.3f; shakeEmitter.radius = 25f; shakeEmitter.scaleShakeRadiusWithLocalScale = false; shakeEmitter.wave = new Wave { amplitude = 3f, frequency = 200f }; shakeEmitter.amplitudeTimeDecay = true; MysticsItemsContent.Resources.effectPrefabs.Add(effectPrefab); TeleporterInteraction.onTeleporterChargedGlobal += TeleporterInteraction_onTeleporterChargedGlobal; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_BackArmor"; SetItemTierWhenAvailable(ItemTier.Tier1); itemDef.tags = new ItemTag[] { ItemTag.Utility }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Spine Implant/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Spine Implant/Icon.png"); HopooShaderToMaterial.Standard.Gloss(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 0.5f, 10f); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 3; modelPanelParams.maxDistance = 6; itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Chest", new Vector3(0.001F, 0.248F, -0.191F), new Vector3(10.681F, 0.007F, 0.071F), new Vector3(0.053F, 0.053F, 0.053F)); AddDisplayRule("CommandoBody", "Chest", new Vector3(0.001F, 0.379F, -0.155F), new Vector3(31.254F, 0.064F, 0.228F), new Vector3(0.053F, 0.053F, 0.053F)); AddDisplayRule("CommandoBody", "Chest", new Vector3(0.001F, 0.13F, -0.214F), new Vector3(355.88F, 0.248F, 359.081F), new Vector3(0.053F, 0.053F, 0.053F)); AddDisplayRule("HuntressBody", "Chest", new Vector3(0.115F, 0.122F, -0.102F), new Vector3(350.768F, 327.948F, 7.106F), new Vector3(0.045F, 0.045F, 0.045F)); AddDisplayRule("HuntressBody", "Chest", new Vector3(0.074F, 0.012F, -0.058F), new Vector3(358.146F, 332.414F, 353.239F), new Vector3(0.045F, 0.045F, 0.045F)); AddDisplayRule("HuntressBody", "Chest", new Vector3(0.117F, 0.229F, -0.108F), new Vector3(9.933F, 316.317F, 358.989F), new Vector3(0.045F, 0.045F, 0.045F)); AddDisplayRule("Bandit2Body", "Chest", new Vector3(0F, 0.279F, -0.168F), new Vector3(27.306F, 0F, 0F), new Vector3(0.058F, 0.058F, 0.058F)); AddDisplayRule("Bandit2Body", "Chest", new Vector3(-0.014F, 0.131F, -0.181F), new Vector3(352.289F, 2.586F, 355.357F), new Vector3(0.058F, 0.058F, 0.058F)); AddDisplayRule("Bandit2Body", "Chest", new Vector3(-0.025F, -0.02F, -0.144F), new Vector3(334.898F, 4.122F, 354.918F), new Vector3(0.058F, 0.058F, 0.058F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(0.057F, 0.562F, -1.819F), new Vector3(0F, 0F, 0F), new Vector3(0.448F, 0.448F, 0.448F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(0.057F + 1.128F, 0.562F, -1.819F), new Vector3(0F, 0F, 0F), new Vector3(0.448F, 0.448F, 0.448F)); AddDisplayRule("ToolbotBody", "Chest", new Vector3(0.057F - 1.128F, 0.562F, -1.819F), new Vector3(0F, 0F, 0F), new Vector3(0.448F, 0.448F, 0.448F)); AddDisplayRule("EngiBody", "Chest", new Vector3(0.001F, 0.332F, -0.212F), new Vector3(355.488F, 0.001F, 359.97F), new Vector3(0.065F, 0.065F, 0.065F)); AddDisplayRule("EngiBody", "Chest", new Vector3(0.002F, -0.039F, -0.244F), new Vector3(8.511F, 0.004F, 0.056F), new Vector3(0.065F, 0.065F, 0.065F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0F, 0.594F, -1.52F), new Vector3(34.7F, 0F, 0F), new Vector3(0.1F, 0.1F, 0.1F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0F - 0.288F, 0.594F - 0.001F, -1.52F + 0.036F), new Vector3(34.7F, 17.268F, 0F), new Vector3(0.1F, 0.1F, 0.1F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0F + 0.288F, 0.594F - 0.001F, -1.52F + 0.036F), new Vector3(34.7F, 17.268F, 0F), new Vector3(0.1F, 0.1F, 0.1F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0F, 0.635F, -1.096F), new Vector3(340.889F, 0F, 0F), new Vector3(0.162F, 0.162F, 0.162F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0F - 0.403F, 0.635F, -1.096F), new Vector3(340.889F, 0F, 0F), new Vector3(0.162F, 0.162F, 0.162F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0F + 0.403F, 0.635F, -1.096F), new Vector3(340.889F, 0F, 0F), new Vector3(0.162F, 0.162F, 0.162F)); AddDisplayRule("MageBody", "Chest", new Vector3(-0.113F, 0.047F, -0.333F), new Vector3(0F, 0F, 0F), new Vector3(0.074F, 0.074F, 0.074F)); AddDisplayRule("MageBody", "Chest", new Vector3(0.111F, 0.047F, -0.335F), new Vector3(0F, 0F, 0F), new Vector3(0.074F, 0.074F, 0.074F)); AddDisplayRule("MercBody", "Chest", new Vector3(0.016F, -0.077F, -0.157F), new Vector3(327.518F, 359.258F, 2.356F), new Vector3(0.044F, 0.044F, 0.044F)); AddDisplayRule("TreebotBody", "HeadBase", new Vector3(0F, 0.303F, 0.623F), new Vector3(326.351F, 0F, 0F), new Vector3(0.13F, 0.13F, 0.13F)); AddDisplayRule("TreebotBody", "HeadBase", new Vector3(0F, 0.556F, 0.381F), new Vector3(300.933F, 0F, 0F), new Vector3(0.13F, 0.13F, 0.13F)); AddDisplayRule("TreebotBody", "HeadBase", new Vector3(0F, 0.677F, 0F), new Vector3(272.761F, 180F, 180F), new Vector3(0.13F, 0.13F, 0.13F)); AddDisplayRule("LoaderBody", "MechBase", new Vector3(0.001F, 0.228F, -0.09F), new Vector3(0F, 0F, 0F), new Vector3(0.055F, 0.055F, 0.055F)); AddDisplayRule("LoaderBody", "MechBase", new Vector3(0F, 0.079F, -0.109F), new Vector3(15.661F, 359.833F, 359.383F), new Vector3(0.055F, 0.055F, 0.055F)); AddDisplayRule("CrocoBody", "SpineChest1", new Vector3(-0.001F, 0.227F, -0.262F), new Vector3(327.293F, 180.671F, 178.301F), new Vector3(0.868F, 0.868F, 0.868F)); AddDisplayRule("CrocoBody", "SpineChest2", new Vector3(-0.007F, 0.238F, -0.127F), new Vector3(279.7F, 179.618F, 180.074F), new Vector3(0.868F, 0.868F, 0.868F)); AddDisplayRule("CrocoBody", "SpineChest3", new Vector3(-0.006F, 0.28F, 0.702F), new Vector3(272.756F, 348.989F, 10.689F), new Vector3(0.868F, 0.868F, 0.868F)); AddDisplayRule("CrocoBody", "SpineStomach2", new Vector3(0F, 0.125F, 0.764F), new Vector3(279.494F, 357.435F, 0.679F), new Vector3(0.868F, 0.868F, 0.868F)); AddDisplayRule("CaptainBody", "Chest", new Vector3(-0.002F, 0.264F, -0.232F), new Vector3(12.656F, 0.806F, 356.471F), new Vector3(0.089F, 0.089F, 0.089F)); AddDisplayRule("CaptainBody", "Chest", new Vector3(-0.003F, 0.007F, -0.229F), new Vector3(352.867F, 2.021F, 350.785F), new Vector3(0.089F, 0.089F, 0.089F)); AddDisplayRule("CaptainBody", "Chest", new Vector3(-0.029F, -0.258F, -0.204F), new Vector3(354.747F, 17.2F, 357.393F), new Vector3(0.089F, 0.089F, 0.089F)); AddDisplayRule("BrotherBody", "chest", BrotherInfection.white, new Vector3(0.007F, 0.271F, -0.109F), new Vector3(338.151F, 273.11F, 349.684F), new Vector3(0.063F, 0.063F, 0.063F)); AddDisplayRule("BrotherBody", "chest", BrotherInfection.white, new Vector3(0.007F, 0.152F, -0.103F), new Vector3(354.823F, 265.92F, 16.498F), new Vector3(0.063F, 0.063F, 0.063F)); AddDisplayRule("BrotherBody", "chest", BrotherInfection.white, new Vector3(0.004F, 0.368F, -0.116F), new Vector3(331.238F, 285.737F, 326.197F), new Vector3(0.063F, 0.063F, 0.063F)); AddDisplayRule("ScavBody", "Backpack", new Vector3(-2.907F, 3.344F, -3.861F), new Vector3(359.95F, 0.351F, 16.311F), new Vector3(1.363F, 1.363F, 1.363F)); AddDisplayRule("ScavBody", "Backpack", new Vector3(1.977F, 6.937F, -3.851F), new Vector3(359.832F, 358.468F, 326.995F), new Vector3(1.363F, 1.363F, 1.363F)); AddDisplayRule("ScavBody", "Backpack", new Vector3(-1.588F, 9.252F, -3.947F), new Vector3(358.543F, 1.155F, 125.647F), new Vector3(1.363F, 1.363F, 1.363F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.001F, 0.27712F, -0.33412F), new Vector3(356.6703F, 359.9898F, 0.06989F), new Vector3(0.06633F, 0.06633F, 0.06633F)); AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.00195F, 0.13704F, -0.27314F), new Vector3(334.2708F, 359.8518F, 0.21636F), new Vector3(0.06109F, 0.06109F, 0.06109F)); AddDisplayRule("SniperClassicBody", "Chest", new Vector3(-0.00074F, 0.02772F, -0.25266F), new Vector3(351.8274F, 0.31362F, 359.074F), new Vector3(0.04578F, 0.04578F, 0.04578F)); } AddDisplayRule("RailgunnerBody", "Chest", new Vector3(0.14927F, -0.02711F, -0.03746F), new Vector3(350.0041F, 286.6287F, 24.46263F), new Vector3(0.04727F, 0.04727F, 0.04727F)); AddDisplayRule("RailgunnerBody", "Chest", new Vector3(0.06252F, -0.16893F, 0.00153F), new Vector3(337.6357F, 295.3051F, 9.23716F), new Vector3(0.07072F, 0.07072F, 0.07072F)); AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.00001F, 0.13311F, -0.21931F), new Vector3(8.98278F, 0F, 0F), new Vector3(0.0644F, 0.0644F, 0.0644F)); AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0F, -0.00936F, -0.1937F), new Vector3(343.3924F, 0F, 0F), new Vector3(0.06248F, 0.06248F, 0.06248F)); AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.00002F, -0.13933F, -0.12991F), new Vector3(331.1053F, 0F, 0F), new Vector3(0.05542F, 0.05542F, 0.05542F)); }; visualEffect = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_BackArmorVFX", false); EffectComponent effectComponent = visualEffect.AddComponent <EffectComponent>(); effectComponent.applyScale = true; effectComponent.parentToReferencedTransform = true; effectComponent.soundName = "MysticsItems_Play_item_proc_spineimplant"; VFXAttributes vfxAttributes = visualEffect.AddComponent <VFXAttributes>(); vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Medium; vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low; visualEffect.AddComponent <DestroyOnTimer>().duration = 1f; MysticsItemsBackArmorVFX component = visualEffect.AddComponent <MysticsItemsBackArmorVFX>(); GameObject particles = PrefabAPI.InstantiateClone(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Spine Implant/ProcParticles.prefab"), "ProcParticles", false); Material material = particles.GetComponent <ParticleSystemRenderer>().sharedMaterial; HopooShaderToMaterial.Standard.Apply(material); HopooShaderToMaterial.Standard.Emission(material, 2.5f, Color.red); particles.transform.SetParent(visualEffect.transform); component.particleSystem = particles.GetComponent <ParticleSystem>(); component.effectComponent = effectComponent; MysticsItemsContent.Resources.effectPrefabs.Add(visualEffect); GenericGameEvents.BeforeTakeDamage += (damageInfo, attackerInfo, victimInfo) => { if (victimInfo.inventory) { int itemCount = victimInfo.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_BackArmor); if (itemCount > 0) { float distance = Vector3.Distance(damageInfo.position, victimInfo.body.corePosition); if (distance >= BackArmor.distance) { if (BackstabManager.IsBackstab(victimInfo.body.corePosition - damageInfo.position, victimInfo.body)) { BackArmorTempArmor tempArmor = victimInfo.gameObject.GetComponent <BackArmorTempArmor>(); if (!tempArmor) { tempArmor = victimInfo.gameObject.AddComponent <BackArmorTempArmor>(); } float tempArmorValue = armorAdd + armorAddPerStack * (float)(itemCount - 1); tempArmor.value += tempArmorValue; victimInfo.body.armor += tempArmorValue; } } } } }; GenericGameEvents.OnTakeDamage += (damageReport) => { BackArmorTempArmor tempArmor = damageReport.victim.GetComponent <BackArmorTempArmor>(); if (tempArmor && damageReport.victimBody) { if (tempArmor.value > 0f) { if (damageReport.damageInfo != null && !damageReport.damageInfo.rejected && damageReport.damageInfo.damage > 0) { EffectData effectData = new EffectData { origin = damageReport.victimBody.corePosition, genericFloat = damageReport.damageInfo.damage / damageReport.victimBody.healthComponent.combinedHealth, scale = 3.5f * damageReport.victimBody.radius }; effectData.SetNetworkedObjectReference(damageReport.victimBody.gameObject); EffectManager.SpawnEffect(visualEffect, effectData, true); } } damageReport.victimBody.armor -= tempArmor.value; tempArmor.value = 0f; } }; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_Moonglasses"; SetItemTierWhenAvailable(ItemTier.Lunar); itemDef.tags = new ItemTag[] { ItemTag.Damage }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Moonglasses/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Moonglasses/Icon.png"); ModelPanelParameters modelPanelParameters = itemDef.pickupModelPrefab.GetComponent <ModelPanelParameters>(); modelPanelParameters.minDistance = 0.1f; modelPanelParameters.maxDistance = 0.2f; HopooShaderToMaterial.Standard.Apply(itemDef.pickupModelPrefab.GetComponentInChildren <MeshRenderer>().sharedMaterial); ColorUtility.TryParseHtmlString("#3D8AFF", out Color color); HopooShaderToMaterial.Standard.Emission(itemDef.pickupModelPrefab.GetComponentInChildren <MeshRenderer>().sharedMaterial, 0.5f, color); itemDisplayPrefab = PrepareItemDisplayModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Moonglasses/FollowerModel.prefab")); HopooShaderToMaterial.Standard.Apply(itemDisplayPrefab.GetComponentInChildren <MeshRenderer>().sharedMaterial); HopooShaderToMaterial.Standard.Emission(itemDisplayPrefab.GetComponentInChildren <MeshRenderer>().sharedMaterial, 0.5f, color); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Head", new Vector3(-0.01762F, 0.24554F, 0.07167F), new Vector3(0F, 180F, 0F), new Vector3(6.15862F, 7.5286F, 7.5286F)); AddDisplayRule("HuntressBody", "Head", new Vector3(0F, 0.21282F, 0.05994F), new Vector3(21.54405F, 180F, 90F), new Vector3(4.43197F, 4.43197F, 4.43197F)); AddDisplayRule("Bandit2Body", "Head", new Vector3(-0.00002F, 0.12569F, 0.06395F), new Vector3(20.98219F, 180F, 0F), new Vector3(4.59836F, 4.59836F, 4.59836F)); AddDisplayRule("ToolbotBody", "Head", new Vector3(0.19809F, 3.45535F, -0.13022F), new Vector3(58.95989F, 0F, 0F), new Vector3(35.90774F, 35.90774F, 35.90774F)); AddDisplayRule("EngiBody", "HeadCenter", new Vector3(-0.01717F, 0.03966F, 0.05917F), new Vector3(350.4524F, 180F, 0F), new Vector3(6.37725F, 6.51145F, 6.68287F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(-0.05338F, 0.72787F, 1.74686F), new Vector3(17.32109F, 180F, 0F), new Vector3(17.95457F, 17.95457F, 17.95457F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(-0.04661F, 0.78199F, 0.79482F), new Vector3(0F, 180F, 0F), new Vector3(15.20336F, 15.20336F, 15.20336F)); AddDisplayRule("MageBody", "Head", new Vector3(-0.00995F, 0.06475F, 0.07292F), new Vector3(0F, 180F, 0F), new Vector3(3.30476F, 3.30476F, 3.30476F)); AddDisplayRule("MercBody", "Head", new Vector3(-0.01789F, 0.16286F, 0.10037F), new Vector3(0F, 180F, 0F), new Vector3(4.21862F, 4.92004F, 4.92004F)); AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(0.22407F, 1.40964F, 0.54203F), new Vector3(0F, 195.014F, 354.3025F), new Vector3(18.07387F, 19.70414F, 19.70414F)); AddDisplayRule("LoaderBody", "Head", new Vector3(-0.01495F, 0.13577F, 0.07205F), new Vector3(0F, 180F, 0F), new Vector3(4.31587F, 5.0651F, 5.0651F)); AddDisplayRule("CrocoBody", "Head", new Vector3(-1.07602F, 2.29072F, 0.17833F), new Vector3(13.06829F, 126.1897F, 98.669F), new Vector3(30.7851F, 30.7851F, 30.7851F)); AddDisplayRule("CrocoBody", "Head", new Vector3(1.07743F, 2.15423F, 0.28268F), new Vector3(12.64774F, 241.14F, 260.3011F), new Vector3(30.7851F, 30.7851F, 30.7851F)); AddDisplayRule("CaptainBody", "Head", new Vector3(-0.01724F, 0.18671F, 0.06974F), new Vector3(21.27818F, 180F, 0F), new Vector3(4.28179F, 5.0806F, 5.0806F)); AddDisplayRule("BrotherBody", "chest", BrotherInfection.blue, new Vector3(-0.05805F, 0.3807F, 0.05423F), new Vector3(322.4044F, 96.87862F, 314.7067F), new Vector3(0.12293F, 0.12293F, 0.12293F)); AddDisplayRule("ScavBody", "Head", new Vector3(-0.78245F, -0.32694F, 0.85024F), new Vector3(66.96695F, 8.55508F, 183.8605F), new Vector3(273.8666F, 291.7011F, 291.7011F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Head", new Vector3(-0.01805F, 0.12711F, -0.12674F), new Vector3(75.45986F, 179.9725F, 0.06272F), new Vector3(4.6839F, 5.28335F, 5.28335F)); } AddDisplayRule("RailgunnerBody", "Head", new Vector3(-0.01121F, 0.06064F, 0.07488F), new Vector3(0F, 180F, 0F), new Vector3(3.19157F, 3.19157F, 3.19157F)); AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(-0.01512F, 0.07926F, 0.08407F), new Vector3(30.07312F, 185.1942F, 0F), new Vector3(6.38275F, 6.38275F, 6.38275F)); }; GenericGameEvents.OnApplyDamageIncreaseModifiers += GenericGameEvents_OnApplyDamageIncreaseModifiers; RecalculateStatsAPI.GetStatCoefficients += RecalculateStatsAPI_GetStatCoefficients; // Apply the crit multiplier after all stats are calculated On.RoR2.CharacterBody.RecalculateStats += (orig, self) => { orig(self); Inventory inventory = self.inventory; if (inventory) { int itemCount = self.inventory.GetItemCount(itemDef); if (itemCount > 0) { self.crit /= Mathf.Pow(2, itemCount); } } }; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_VyraelCommandments"; SetItemTierWhenAvailable(ItemTier.Tier3); itemDef.tags = new ItemTag[] { ItemTag.Utility }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ten Commandments of Vyrael/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Ten Commandments of Vyrael/Icon.png"); Material mat = itemDef.pickupModelPrefab.transform.GetComponentInChildren <Renderer>().sharedMaterial; HopooShaderToMaterial.Standard.Apply(mat); HopooShaderToMaterial.Standard.Gloss(mat, 0.3f, 10f, new Color32(255, 253, 163, 255)); ModelPanelParameters modelPanelParameters = itemDef.pickupModelPrefab.GetComponent <ModelPanelParameters>(); modelPanelParameters.minDistance = 9.5f; modelPanelParameters.maxDistance = 15f; itemDisplayPrefab = PrepareItemDisplayModel(PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ten Commandments of Vyrael/DisplayModel.prefab"))); itemDisplayPrefab.transform.Find("ProcVFXPivot").gameObject.AddComponent <MysticsItemsVyraelCommandmentsEffect>(); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "LowerArmR", new Vector3(-0.04456F, 0.33549F, -0.07683F), new Vector3(0F, 182.0939F, 354.8922F), new Vector3(0.11933F, 0.11933F, 0.11933F)); AddDisplayRule("HuntressBody", "Muzzle", new Vector3(0F, -0.02274F, 0F), new Vector3(90F, 0F, 0F), new Vector3(0.099F, 0.09212F, 0.099F)); AddDisplayRule("Bandit2Body", "MainWeapon", new Vector3(-0.14985F, 0.85556F, -0.00516F), new Vector3(0F, 85.98335F, 0F), new Vector3(0.07573F, 0.07573F, 0.07573F)); AddDisplayRule("ToolbotBody", "HandR", new Vector3(0.191F, 0.73729F, 1.91911F), new Vector3(356.736F, 85.148F, 89.97712F), new Vector3(0.93071F, 1.00082F, 0.93071F)); AddDisplayRule("EngiBody", "HandR", new Vector3(0.09099F, 0.14777F, -0.0519F), new Vector3(24.80013F, 176.6263F, 79.46233F), new Vector3(0.10693F, 0.10693F, 0.10693F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(-0.007F, 0.55275F, 1.25599F), new Vector3(0F, 90F, 90F), new Vector3(0.35706F, 0.35706F, 0.35706F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.0057F, 0.78448F, 0.831F), new Vector3(0.234F, 271.606F, 270.571F), new Vector3(0.31878F, 0.38771F, 0.31095F)); AddDisplayRule("MageBody", "LowerArmR", new Vector3(0.03837F, 0.31418F, 0.07639F), new Vector3(0F, 0F, 0F), new Vector3(0.08926F, 0.08926F, 0.08926F)); AddDisplayRule("MercBody", "HandR", new Vector3(0.12937F, 0.19176F, 0.02447F), new Vector3(0F, 0F, 279.658F), new Vector3(0.1108F, 0.1108F, 0.1108F)); AddDisplayRule("TreebotBody", "MuzzleSyringe", new Vector3(0.00002F, -0.22914F, -0.37278F), new Vector3(90F, 0F, 0F), new Vector3(0.17589F, 0.17589F, 0.17589F)); AddDisplayRule("LoaderBody", "MechHandRight", new Vector3(0.15519F, 0.30881F, -0.01494F), new Vector3(2.73792F, 180.065F, 91.36073F), new Vector3(0.12046F, 0.12046F, 0.12046F)); AddDisplayRule("CrocoBody", "Head", new Vector3(-0.13273F, 2.94508F, -0.52332F), new Vector3(340.0608F, 175.3457F, 271.5903F), new Vector3(1.271F, 1.271F, 1.271F)); AddDisplayRule("CaptainBody", "HandR", new Vector3(0.01675F, 0.15901F, 0.156F), new Vector3(6.32065F, 89.68613F, 87.15139F), new Vector3(0.10349F, 0.10349F, 0.10349F)); AddDisplayRule("BrotherBody", "HandR", BrotherInfection.red, new Vector3(-0.01763F, 0.08509F, 0.0165F), new Vector3(28.59401F, 22.166F, 205.7942F), new Vector3(0.06467F, 0.06467F, 0.06467F)); AddDisplayRule("ScavBody", "HandL", new Vector3(-2.04041F, 3.10486F, -2.06395F), new Vector3(349.0269F, 326.6412F, 73.87372F), new Vector3(1.733F, 1.733F, 1.733F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "Muzzle", new Vector3(-2.02132F, 0.0648F, 0.16052F), new Vector3(10.03741F, 180F, 90F), new Vector3(0.30723F, 0.30723F, 0.30723F)); } AddDisplayRule("RailgunnerBody", "TopRail", new Vector3(0.00006F, 0.68001F, 0.05789F), new Vector3(0F, 0F, 0F), new Vector3(0.06583F, 0.06583F, 0.06583F)); AddDisplayRule("VoidSurvivorBody", "ForeArmL", new Vector3(0.05651F, 0.30521F, 0.01208F), new Vector3(354.2681F, 80.14155F, 0F), new Vector3(0.08341F, 0.08341F, 0.08341F)); }; procVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ten Commandments of Vyrael/ProcVFX.prefab"); EffectComponent effectComponent = procVFX.AddComponent <EffectComponent>(); effectComponent.applyScale = true; effectComponent.soundName = "MysticsItems_Play_item_proc_VyraelCommandments"; VFXAttributes vfxAttributes = procVFX.AddComponent <VFXAttributes>(); vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low; vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Low; procVFX.AddComponent <DestroyOnTimer>().duration = 0.5f; MysticsItemsContent.Resources.effectPrefabs.Add(procVFX); CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; GenericGameEvents.OnHitEnemy += GenericGameEvents_OnHitEnemy; On.RoR2.Util.CheckRoll_float_CharacterMaster += Util_CheckRoll_float_CharacterMaster; }
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); }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_AllyDeathRevenge"; SetItemTierWhenAvailable(ItemTier.Tier2); itemDef.tags = new ItemTag[] { ItemTag.Damage, ItemTag.Utility, ItemTag.AIBlacklist }; MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef()); itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ally Death Revenge/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Ally Death Revenge/Icon.png"); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 0.75f; modelPanelParams.maxDistance = 1.5f; itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "LowerArmR", new Vector3(0.001F, 0.274F, -0.078F), new Vector3(7.29F, 186.203F, 0.157F), new Vector3(0.277F, 0.389F, 0.277F)); AddDisplayRule("HuntressBody", "HandL", new Vector3(-0.014F, 0.004F, 0.035F), new Vector3(6.909F, 1.748F, 74.816F), new Vector3(0.187F, 0.174F, 0.187F)); AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.069F, -0.12F, -0.197F), new Vector3(18.152F, 14.491F, 196.624F), new Vector3(0.348F, 0.348F, 0.348F)); AddDisplayRule("ToolbotBody", "HandR", new Vector3(-0.059F, 0.587F, 1.939F), new Vector3(356.736F, 85.148F, 90.496F), new Vector3(3.014F, 3.241F, 3.014F)); AddDisplayRule("EngiBody", "HandL", new Vector3(0F, 0.104F, 0.042F), new Vector3(3.001F, 0F, 0F), new Vector3(0.259F, 0.259F, 0.259F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.026F, 0.602F, -1.541F), new Vector3(22.044F, 48.281F, 206.737F), new Vector3(0.74F, 0.74F, 0.74F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(-0.248F, 1.434F, -0.84F), new Vector3(300.601F, 223.502F, 297.144F), new Vector3(0.659F, 0.801F, 0.643F)); AddDisplayRule("MageBody", "HandL", new Vector3(-0.011F, 0.074F, 0.104F), new Vector3(0F, 0F, 355.462F), new Vector3(0.22F, 0.22F, 0.22F)); AddDisplayRule("MercBody", "HandR", new Vector3(0F, 0.112F, 0.103F), new Vector3(14.285F, 0F, 0F), new Vector3(0.427F, 0.427F, 0.427F)); AddDisplayRule("TreebotBody", "WeaponPlatform", new Vector3(0F, 0.889F, 0.308F), new Vector3(0F, 0F, 0F), new Vector3(0.846F, 0.846F, 0.846F)); AddDisplayRule("LoaderBody", "MechHandL", new Vector3(-0.073F, 0.379F, 0.15F), new Vector3(5.558F, 330.424F, 0F), new Vector3(0.36F, 0.36F, 0.36F)); AddDisplayRule("CrocoBody", "HandL", new Vector3(-1.286F, 0.394F, 0.102F), new Vector3(56.075F, 280.047F, 0F), new Vector3(3.614F, 2.545F, 4.003F)); AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.086F, 0.125F, 0.016F), new Vector3(14.676F, 274.88F, 359.215F), new Vector3(0.248F, 0.248F, 0.248F)); AddDisplayRule("BrotherBody", "HandL", BrotherInfection.green, new Vector3(0.019F, -0.013F, 0.017F), new Vector3(348.105F, 324.594F, 242.165F), new Vector3(0.061F, 0.019F, 0.061F)); AddDisplayRule("ScavBody", "HandL", new Vector3(-3.491F, 2.547F, -2.4F), new Vector3(354.216F, 329.486F, 87.688F), new Vector3(7.501F, 7.7F, 7.501F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "LowerArmR", new Vector3(-0.00116F, 0.35526F, -0.02252F), new Vector3(12.00797F, 359.9336F, 355.1882F), new Vector3(0.2754F, 0.2754F, 0.2754F)); } AddDisplayRule("RailgunnerBody", "Pelvis", new Vector3(0.1939F, 0.23069F, 0.00249F), new Vector3(5.45999F, 119.7464F, 17.75949F), new Vector3(0.33522F, 0.33522F, 0.33522F)); AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(-0.06693F, -1.12064F, -0.77318F), new Vector3(90F, 0F, 0F), new Vector3(0.5795F, 0.5795F, 0.5795F)); }; itemDef.pickupModelPrefab.transform.Find("mdlAllyDeathRevenge").Rotate(new Vector3(0f, 0f, 160f), Space.Self); itemDef.pickupModelPrefab.transform.Find("mdlAllyDeathRevenge").localScale *= 0.8f; GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; Overlays.CreateOverlay(Main.AssetBundle.LoadAsset <Material>("Assets/Items/Ally Death Revenge/matAllyDeathRevengeOverlay.mat"), delegate(CharacterModel model) { return(model.body ? model.body.HasBuff(MysticsItemsContent.Buffs.MysticsItems_AllyDeathRevenge) : false); }); GameObject burningVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ally Death Revenge/BurningVFX.prefab"); CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = burningVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>(); tempVFX.rotateWithParent = true; tempVFX.enterObjects = new GameObject[] { burningVFX.transform.Find("Origin").gameObject }; Material matBurningVFX = burningVFX.transform.Find("Origin/Left").gameObject.GetComponent <Renderer>().sharedMaterial; HopooShaderToMaterial.CloudRemap.Apply( matBurningVFX, Main.AssetBundle.LoadAsset <Texture>("Assets/Items/Ally Death Revenge/texRampAllyDeathRevengeBurningEyes.png") ); HopooShaderToMaterial.CloudRemap.Boost(matBurningVFX, 3f); burningVFX.transform.Find("Origin").gameObject.AddComponent <RotateObject>().rotationSpeed = new Vector3(0f, 400f, 0f); CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo { prefab = burningVFX, condition = (x) => x.HasBuff(MysticsItemsContent.Buffs.MysticsItems_AllyDeathRevenge), radius = CustomTempVFXManagement.DefaultRadiusCall, child = "Head" }); sfx = ScriptableObject.CreateInstance <NetworkSoundEventDef>(); sfx.eventName = "Play_item_allydeathrevenge_proc"; MysticsItemsContent.Resources.networkSoundEventDefs.Add(sfx); }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_Spotter"; SetItemTierWhenAvailable(ItemTier.Tier2); itemDef.tags = new ItemTag[] { ItemTag.Damage }; MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef()); itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Spotter/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Spotter/Icon.png"); Material mat = itemDef.pickupModelPrefab.transform.Find("mdlSpotterBroken").gameObject.GetComponent <MeshRenderer>().sharedMaterial; HopooShaderToMaterial.Standard.Apply(mat); HopooShaderToMaterial.Standard.Gloss(mat, 0.2f, 1f); HopooShaderToMaterial.Standard.Emission(mat, 1f); itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); MysticsRisky2Utils.Utils.CopyChildren(itemDef.pickupModelPrefab, unlockInteractablePrefab); ModelPanelParameters modelPanelParameters = itemDef.pickupModelPrefab.GetComponent <ModelPanelParameters>(); modelPanelParameters.minDistance = 6f; modelPanelParameters.maxDistance = 12f; itemDisplayPrefab.transform.localScale = Vector3.one * 0.2f; itemDisplayPrefab.transform.localRotation = Quaternion.Euler(new Vector3(0f, -90f, 0f)); Rigidbody rigidbody = enemyFollowerPrefab.AddComponent <Rigidbody>(); rigidbody.useGravity = false; enemyFollowerPrefab.AddComponent <GenericOwnership>(); MysticsItemsSpotterController component = enemyFollowerPrefab.AddComponent <MysticsItemsSpotterController>(); component.follower = PrefabAPI.InstantiateClone(itemDisplayPrefab, "SpotterFollower", false); component.follower.transform.SetParent(enemyFollowerPrefab.transform); SimpleLeash leash = component.leash = enemyFollowerPrefab.AddComponent <SimpleLeash>(); leash.minLeashRadius = 0f; leash.maxLeashRadius = Mathf.Infinity; leash.smoothTime = 0.2f; SimpleRotateToDirection rotateToDirection = component.rotateToDirection = enemyFollowerPrefab.AddComponent <SimpleRotateToDirection>(); rotateToDirection.maxRotationSpeed = 720f; rotateToDirection.smoothTime = 0.1f; unlockInteractablePrefab.transform.localScale *= 0.4f; unlockInteractablePrefab.AddComponent <MysticsItemsSpotterUnlockInteraction>(); GameObject sparks = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/NetworkedObjects/RadarTower").transform.Find("mdlRadar").Find("Sparks").gameObject, "Sparks", false); sparks.transform.localPosition = new Vector3(0f, 1f, 0f); ParticleSystem.MainModule particleSystem = sparks.GetComponentInChildren <ParticleSystem>().main; particleSystem.scalingMode = ParticleSystemScalingMode.Hierarchy; sparks.transform.SetParent(unlockInteractablePrefab.transform); Highlight highlight = unlockInteractablePrefab.AddComponent <Highlight>(); highlight.targetRenderer = unlockInteractablePrefab.GetComponentInChildren <Renderer>(); highlight.highlightColor = Highlight.HighlightColor.interactive; PurchaseInteraction purchaseInteraction = unlockInteractablePrefab.AddComponent <PurchaseInteraction>(); purchaseInteraction.displayNameToken = "MYSTICSITEMS_BROKENSPOTTER_NAME"; purchaseInteraction.contextToken = "MYSTICSITEMS_BROKENSPOTTER_CONTEXT"; purchaseInteraction.costType = CostTypeIndex.VolatileBattery; purchaseInteraction.available = true; purchaseInteraction.cost = 1; purchaseInteraction.automaticallyScaleCostWithDifficulty = false; purchaseInteraction.requiredUnlockable = ""; purchaseInteraction.setUnavailableOnTeleporterActivated = false; GameObject entityLocatorHolder = unlockInteractablePrefab.transform.Find("EntityLocatorHolder").gameObject; entityLocatorHolder.layer = LayerIndex.pickups.intVal; SphereCollider sphereCollider = entityLocatorHolder.AddComponent <SphereCollider>(); sphereCollider.radius = 12f; sphereCollider.isTrigger = true; entityLocatorHolder.AddComponent <EntityLocator>().entity = unlockInteractablePrefab; On.RoR2.SceneDirector.PopulateScene += (orig, self) => { orig(self); if (SceneCatalog.GetSceneDefForCurrentScene().baseSceneName == "rootjungle") { GameObject obj = Object.Instantiate(unlockInteractablePrefab, new Vector3(-139.576f, -0.824233f - 1f, 35.42688f), Quaternion.Euler(new Vector3(-29f, 25f, 348f))); NetworkServer.Spawn(obj); } }; On.RoR2.CharacterBody.Awake += (orig, self) => { orig(self); self.onInventoryChanged += delegate() { if (NetworkServer.active) { self.AddItemBehavior <MysticsItemsSpotterBehaviour>(self.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_Spotter)); } }; }; repairSoundEventDef = ScriptableObject.CreateInstance <NetworkSoundEventDef>(); repairSoundEventDef.eventName = "Play_drone_repair"; MysticsItemsContent.Resources.networkSoundEventDefs.Add(repairSoundEventDef); highlightPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Spotter/SpotterTargetHighlight.prefab"); MysticsItemsSpotterHighlight highlightComponent = highlightPrefab.AddComponent <MysticsItemsSpotterHighlight>(); highlightComponent.insideViewObject = highlightPrefab.transform.Find("Pivot").gameObject; highlightComponent.outsideViewObject = highlightPrefab.transform.Find("PivotOutsideView").gameObject; highlightComponent.textTargetName = highlightPrefab.transform.Find("Pivot/Rectangle/Enemy Name").gameObject.GetComponent <TextMeshProUGUI>(); highlightComponent.textTargetName.gameObject.AddComponent <MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsTextMeshUseLanguageDefaultFont>(); highlightComponent.textTargetHP = highlightPrefab.transform.Find("Pivot/Rectangle/Health").gameObject.GetComponent <TextMeshProUGUI>(); highlightComponent.textTargetHP.gameObject.AddComponent <MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsTextMeshUseLanguageDefaultFont>(); RoR2Application.onLateUpdate += MysticsItemsSpotterHighlight.UpdateAll; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_RiftLens"; SetItemTierWhenAvailable(ItemTier.Lunar); itemDef.tags = new ItemTag[] { ItemTag.Utility, ItemTag.AIBlacklist, ItemTag.CannotCopy, ItemTag.OnStageBeginEffect }; MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef()); itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Rift Lens/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Rift Lens/Icon.png"); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 2; modelPanelParams.maxDistance = 6; itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "Head", new Vector3(0.1f, 0.25f, 0.15f), new Vector3(20f, 210f, 0f), new Vector3(0.06f, 0.06f, 0.06f)); AddDisplayRule("HuntressBody", "Head", new Vector3(-0.0009F, 0.2635F, 0.1117F), new Vector3(0F, 180F, 0F), new Vector3(0.03F, 0.03F, 0.03F)); AddDisplayRule("Bandit2Body", "Head", new Vector3(0F, 0.057F, 0.135F), new Vector3(0F, 180F, 180F), new Vector3(0.028F, 0.028F, 0.028F)); AddDisplayRule("ToolbotBody", "Head", new Vector3(0.409F, 3.049F, -1.067F), new Vector3(60F, 0F, 180F), new Vector3(0.3F, 0.3F, 0.3F)); AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0.098F, 0.019F, 0.127F), new Vector3(1.506F, 213.327F, 354.045F), new Vector3(0.029F, 0.029F, 0.029F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.005F, 0.525F, 2.043F), new Vector3(0F, 180F, 0F), new Vector3(0.108F, 0.083F, 0.083F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.006F, 0.774F, 0.853F), new Vector3(0F, 177.859F, 0F), new Vector3(0.306F, 0.306F, 0.306F)); AddDisplayRule("MageBody", "Head", new Vector3(0.048F, 0.06F, 0.117F), new Vector3(13.941F, 189.822F, 2.364F), new Vector3(0.026F, 0.026F, 0.026F)); AddDisplayRule("MercBody", "Head", new Vector3(0.05F, 0.156F, 0.151F), new Vector3(10.716F, 202.078F, 355.897F), new Vector3(0.053F, 0.053F, 0.053F)); AddDisplayRule("TreebotBody", "HeadCenter", new Vector3(-0.005F, 0.058F, -0.002F), new Vector3(85.226F, 270F, 270F), new Vector3(0.098F, 0.098F, 0.098F)); AddDisplayRule("LoaderBody", "Head", new Vector3(0.051F, 0.125F, 0.134F), new Vector3(10.267F, 205.465F, 354.736F), new Vector3(0.047F, 0.04F, 0.048F)); AddDisplayRule("CrocoBody", "Head", new Vector3(-1.531F, 1.934F, 0.459F), new Vector3(14.526F, 104.513F, 346.531F), new Vector3(0.236F, 0.236F, 0.236F)); AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.085F, 0.108F, 0.013F), new Vector3(69.075F, 70.114F, 350.542F), new Vector3(0.026F, 0.03F, 0.042F)); AddDisplayRule("BrotherBody", "Head", BrotherInfection.blue, new Vector3(0.003F, -0.01F, 0.061F), new Vector3(349.888F, 70.121F, 339.729F), new Vector3(0.133F, 0.133F, 0.133F)); AddDisplayRule("ScavBody", "Head", new Vector3(5.068F, 4.15F, -0.55F), new Vector3(46.576F, 301.45F, 310.155F), new Vector3(1.363F, 1.363F, 1.363F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "GunBarrel", new Vector3(0.00002F, 0.07266F, -0.32569F), new Vector3(0F, 180F, 0F), new Vector3(0.02325F, 0.02325F, 0.02325F)); } AddDisplayRule("RailgunnerBody", "GunScope", new Vector3(-0.07466F, -0.14553F, 0.31781F), new Vector3(0F, 180F, 0F), new Vector3(0.02909F, 0.02909F, 0.02909F)); AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(0.00001F, 0.17385F, 0.09392F), new Vector3(58.31651F, 180F, 180F), new Vector3(0.03831F, 0.03831F, 0.03831F)); }; MysticsItemsRiftChest component = riftChest.AddComponent <MysticsItemsRiftChest>(); SfxLocator sfxLocator = riftChest.AddComponent <SfxLocator>(); sfxLocator.openSound = "Play_env_riftchest_open"; riftChest.AddComponent <GenericDisplayNameProvider>().displayToken = "MYSTICSITEMS_RIFTCHEST_NAME"; PurchaseInteraction purchaseInteraction = riftChest.AddComponent <PurchaseInteraction>(); purchaseInteraction.displayNameToken = "MYSTICSITEMS_RIFTCHEST_NAME"; purchaseInteraction.contextToken = "MYSTICSITEMS_RIFTCHEST_CONTEXT"; ChestBehavior chestBehavior = riftChest.AddComponent <ChestBehavior>(); chestBehavior.dropTable = Addressables.LoadAssetAsync <PickupDropTable>("RoR2/Base/Chest1/dtChest1.asset").WaitForCompletion(); riftChest.transform.Find("InteractionCollider").gameObject.AddComponent <EntityLocator>().entity = riftChest; riftChest.transform.Find("RiftOrigin/Sprite").gameObject.AddComponent <Billboard>(); ObjectScaleCurve objectScaleCurve = riftChest.transform.Find("RiftOrigin").gameObject.AddComponent <ObjectScaleCurve>(); objectScaleCurve.useOverallCurveOnly = true; objectScaleCurve.overallCurve = new AnimationCurve() { keys = new Keyframe[] { new Keyframe(0f, 1f), new Keyframe(1f, 0f) } }; objectScaleCurve.timeMax = 0.5f; objectScaleCurve.enabled = false; //post processing GameObject ppHolder = Object.Instantiate(PrefabAPI.InstantiateClone(new GameObject("RiftLensPostProcessing"), "RiftLensPostProcessing", false), riftChest.transform); ppHolder.layer = LayerIndex.postProcess.intVal; PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>(); pp.isGlobal = false; pp.weight = 1f; pp.priority = 50; pp.blendDistance = 10f; SphereCollider sphereCollider = ppHolder.AddComponent <SphereCollider>(); sphereCollider.radius = 5f; sphereCollider.isTrigger = true; PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>(); ppProfile.name = "ppRiftLens"; LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>(); lensDistortion.SetAllOverridesTo(true); lensDistortion.intensity.value = -30f; lensDistortion.scale.value = 1f; ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>(); colorGrading.colorFilter.value = new Color32(178, 242, 255, 255); colorGrading.colorFilter.overrideState = true; pp.sharedProfile = ppProfile; PostProcessDuration ppDuration = pp.gameObject.AddComponent <PostProcessDuration>(); ppDuration.ppVolume = pp; ppDuration.ppWeightCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 1f, 0f, Mathf.Tan(-45f * Mathf.Deg2Rad)), new Keyframe(1f, 0f, Mathf.Tan(135f * Mathf.Deg2Rad), 0f) }, preWrapMode = WrapMode.Clamp, postWrapMode = WrapMode.Clamp }; ppDuration.maxDuration = 1; ppDuration.destroyOnEnd = true; ppDuration.enabled = false; component.ppDuration = ppDuration; riftChestSpawnCard = ScriptableObject.CreateInstance <InteractableSpawnCard>(); riftChestSpawnCard.name = "iscMysticsItems_UnstableRift"; riftChestSpawnCard.directorCreditCost = 0; riftChestSpawnCard.forbiddenFlags = NodeFlags.NoChestSpawn; riftChestSpawnCard.hullSize = HullClassification.Human; riftChestSpawnCard.nodeGraphType = MapNodeGroup.GraphType.Ground; riftChestSpawnCard.occupyPosition = true; riftChestSpawnCard.orientToFloor = false; riftChestSpawnCard.sendOverNetwork = true; riftChestSpawnCard.prefab = riftChest; GenericGameEvents.OnPopulateScene += (rng) => { int riftsToSpawn = 0; foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList) { if (characterMaster.teamIndex == TeamIndex.Player) { int thisItemCount = characterMaster.inventory.GetItemCount(itemDef); if (thisItemCount > 0) { characterMaster.inventory.RemoveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, characterMaster.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff)); characterMaster.inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, baseRifts + riftsPerStack * (thisItemCount - 1)); riftsToSpawn += baseRifts.Value + riftsPerStack.Value * (thisItemCount - 1); } } } if (riftsToSpawn > 0) { for (int i = 0; i < riftsToSpawn; i++) { GameObject riftChest = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(riftChestSpawnCard, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Random }, rng)); } } MysticsItemsRiftLensBehaviour.CalculateCountdownForAll(); }; On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) => { orig(self); self.AddItemBehavior <MysticsItemsRiftLensBehaviour>(self.inventory.GetItemCount(itemDef)); }; ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources; hudPanelPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/UI/HudModules/HudCountdownPanel"), "RiftLensHUDPanel"); hudPanelPrefab.transform.Find("Juice/Container/CountdownTitleLabel").GetComponent <LanguageTextMeshController>().token = "OBJECTIVE_MYSTICSITEMS_RIFTLENS_FLAVOUR"; var col = new Color32(0, 157, 255, 255); hudPanelPrefab.transform.Find("Juice/Container/Border").GetComponent <Image>().color = col; hudPanelPrefab.transform.Find("Juice/Container/CountdownLabel").GetComponent <HGTextMeshProUGUI>().color = col; PositionIndicator positionIndicator = riftPositionIndicator.AddComponent <PositionIndicator>(); positionIndicator.insideViewObject = riftPositionIndicator.transform.Find("InsideFrame").gameObject; positionIndicator.outsideViewObject = riftPositionIndicator.transform.Find("OutsideFrame").gameObject; positionIndicator.alwaysVisibleObject = riftPositionIndicator.transform.Find("Sprite").gameObject; positionIndicator.shouldRotateOutsideViewObject = true; positionIndicator.outsideViewRotationOffset = 90f; GenericGameEvents.OnPlayerCharacterDeath += GenericGameEvents_OnPlayerCharacterDeath; }