Beispiel #1
0
        internal static void PopulateHenrysAssetsThatNoLongerExist()
        {
            if (!mainAssetBundle)
            {
                Debug.LogError("There is no AssetBundle to load assets from.");
                return;
            }

            // feel free to delete everything in here and load in your own assets instead
            // it should work fine even if left as is- even if the assets aren't in the bundle

            swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit");

            bombExplosionEffect = LoadEffect("BombExplosionEffect", "HenryBombExplosion");

            if (bombExplosionEffect)
            {
                ShakeEmitter shakeEmitter = bombExplosionEffect.AddComponent <ShakeEmitter>();
                shakeEmitter.amplitudeTimeDecay             = true;
                shakeEmitter.duration                       = 0.5f;
                shakeEmitter.radius                         = 200f;
                shakeEmitter.scaleShakeRadiusWithLocalScale = false;

                shakeEmitter.wave = new Wave
                {
                    amplitude   = 1f,
                    frequency   = 40f,
                    cycleOffset = 0f
                };
            }

            swordSwingEffect     = Assets.LoadEffect("HenrySwordSwingEffect", true);
            swordHitImpactEffect = Assets.LoadEffect("ImpactHenrySlash");
        }
 // Token: 0x06002711 RID: 10001 RVA: 0x000A9E38 File Offset: 0x000A8038
 public static void SetNetworkSoundEvents(List <NetworkSoundEventDef> newEntriesList)
 {
     NetworkSoundEventCatalog.eventNameToIndexTable.Clear();
     NetworkSoundEventCatalog.eventIdToIndexTable.Clear();
     NetworkSoundEventCatalog.entries = newEntriesList.ToArray();
     Array.Sort <NetworkSoundEventDef>(NetworkSoundEventCatalog.entries, (NetworkSoundEventDef a, NetworkSoundEventDef b) => StringComparer.OrdinalIgnoreCase.Compare(a.eventName, b.eventName));
     for (int i = 0; i < NetworkSoundEventCatalog.entries.Length; i++)
     {
         NetworkSoundEventDef networkSoundEventDef = NetworkSoundEventCatalog.entries[i];
         networkSoundEventDef.index = (NetworkSoundEventIndex)i;
         networkSoundEventDef.akId  = AkSoundEngine.GetIDFromString(networkSoundEventDef.eventName);
         if (networkSoundEventDef.akId == 0U)
         {
             Debug.LogErrorFormat("Error during network sound registration: Wwise event \"{0}\" does not exist.", new object[]
             {
                 networkSoundEventDef.eventName
             });
         }
     }
     for (int j = 0; j < NetworkSoundEventCatalog.entries.Length; j++)
     {
         NetworkSoundEventDef networkSoundEventDef2 = NetworkSoundEventCatalog.entries[j];
         NetworkSoundEventCatalog.eventNameToIndexTable[networkSoundEventDef2.eventName] = networkSoundEventDef2.index;
         NetworkSoundEventCatalog.eventIdToIndexTable[networkSoundEventDef2.akId]        = networkSoundEventDef2.index;
     }
 }
Beispiel #3
0
        internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
        {
            NetworkSoundEventDef networkSoundEventDef = ScriptableObject.CreateInstance <NetworkSoundEventDef>();

            networkSoundEventDef.akId      = AkSoundEngine.GetIDFromString(eventName);
            networkSoundEventDef.eventName = eventName;
            TTGL_SurvivorPlugin.networkSoundEventDefs.Add(networkSoundEventDef);
            return(networkSoundEventDef);
        }
        // Token: 0x0600271A RID: 10010 RVA: 0x000AA00E File Offset: 0x000A820E
        public static string GetEventNameFromNetworkIndex(NetworkSoundEventIndex networkSoundEventIndex)
        {
            NetworkSoundEventDef safe = HGArrayUtilities.GetSafe <NetworkSoundEventDef>(NetworkSoundEventCatalog.entries, (int)networkSoundEventIndex);

            if (safe == null)
            {
                return(null);
            }
            return(safe.eventName);
        }
Beispiel #5
0
        private static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
        {
            NetworkSoundEventDef networkSoundEventDef = ScriptableObject.CreateInstance <NetworkSoundEventDef>();

            networkSoundEventDef.akId      = AkSoundEngine.GetIDFromString(eventName);
            networkSoundEventDef.eventName = eventName;
            networkSoundEventDef.index     = new NetworkSoundEventIndex();

            return(networkSoundEventDef);
        }
 /// <summary>
 /// Registers a sound def to the network sound event catalog.
 /// </summary>
 /// <param name="NetworkSoundEventDef"></param>
 public static void RegisterSoundDef(NetworkSoundEventDef NetworkSoundEventDef)
 {
     //Check if the SurvivorDef has already been registered.
     if (NetworkSoundEventDefDefinitions.Contains(NetworkSoundEventDef))
     {
         LogCore.LogE(NetworkSoundEventDef + " has already been registered, please do not register the same NetworkSoundEventDef twice.");
         return;
     }
     //If not, add it to our SurvivorDefinitions
     NetworkSoundEventDefDefinitions.Add(NetworkSoundEventDef);
 }
Beispiel #7
0
        internal static void PopulateAssets()
        {
            if (mainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.pleasechangethisnameinyourprojectorelseyouwillcauseconflicts"))
                {
                    mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                    var provider = new AssetBundleResourcesProvider("@Henry", mainAssetBundle);
                    ResourcesAPI.AddProvider(provider);
                }
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("HenryMod.HenryBank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit");
            punchHitSoundEvent = CreateNetworkSoundEventDef("HenryPunchHit");

            dustEffect          = LoadEffect("HenryDustEffect");
            bombExplosionEffect = LoadEffect("BombExplosionEffect");

            ShakeEmitter shakeEmitter = bombExplosionEffect.AddComponent <ShakeEmitter>();

            shakeEmitter.amplitudeTimeDecay             = true;
            shakeEmitter.duration                       = 0.5f;
            shakeEmitter.radius                         = 200f;
            shakeEmitter.scaleShakeRadiusWithLocalScale = false;

            shakeEmitter.wave = new Wave
            {
                amplitude   = 1f,
                frequency   = 40f,
                cycleOffset = 0f
            };

            swordSwingEffect     = Assets.LoadEffect("HenrySwordSwingEffect");
            swordHitImpactEffect = Assets.LoadEffect("ImpactHenrySlash");

            punchSwingEffect = Assets.LoadEffect("HenryFistSwingEffect");
            //punchImpactEffect = Assets.LoadEffect("ImpactHenryPunch");
            // on second thought my effect sucks so imma just clone loader's
            punchImpactEffect = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniImpactVFXLoader"), "ImpactHenryPunch");
            punchImpactEffect.AddComponent <NetworkIdentity>();

            EffectAPI.AddEffect(punchImpactEffect);
        }
Beispiel #8
0
        internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
        {
            NetworkSoundEventDef networkSoundEventDef = ScriptableObject.CreateInstance <NetworkSoundEventDef>();

            networkSoundEventDef.akId      = AkSoundEngine.GetIDFromString(eventName);
            networkSoundEventDef.eventName = eventName;

            NetworkSoundEventCatalog.getSoundEventDefs += delegate(List <NetworkSoundEventDef> list)
            {
                list.Add(networkSoundEventDef);
            };

            return(networkSoundEventDef);
        }
Beispiel #9
0
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_ThoughtProcessor";
            SetItemTierWhenAvailable(ItemTier.Tier3);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Utility
            };
            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Thought Processor/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Thought Processor/Icon.png");
            itemDef.pickupModelPrefab.AddComponent <MysticsItemsThoughtProcessorBladeSpin>();
            Material matThoughtProcessor = itemDef.pickupModelPrefab.transform.Find("Base").gameObject.GetComponent <MeshRenderer>().sharedMaterial;

            HopooShaderToMaterial.Standard.Apply(matThoughtProcessor);
            HopooShaderToMaterial.Standard.Gloss(matThoughtProcessor);
            HopooShaderToMaterial.Standard.Dither(matThoughtProcessor);
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Head", new Vector3(0F, 0.5F, 0.023F), new Vector3(0F, 270F, 180F), new Vector3(0.2F, 0.2F, 0.2F));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.001F, 0.395F, -0.076F), new Vector3(359.536F, 90.36F, 165.383F), new Vector3(0.187F, 0.174F, 0.187F));
                AddDisplayRule("Bandit2Body", "Hat", new Vector3(0.008F, 0.072F, -0.029F), new Vector3(0F, 254.385F, 200.576F), new Vector3(0.137F, 0.137F, 0.137F));
                AddDisplayRule("ToolbotBody", "HandR", new Vector3(0.338F, 1.246F, -0.155F), new Vector3(356.736F, 85.148F, 3.991F), new Vector3(1.5F, 1.613F, 1.5F));
                AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0.001F, 0.3F, 0.022F), new Vector3(359.991F, 272.116F, 173.922F), new Vector3(0.216F, 0.216F, 0.216F));
                AddDisplayRule("EngiTurretBody", "Head", new Vector3(-0.007F, 0.574F, -0.307F), new Vector3(356.042F, 91.028F, 94.927F), new Vector3(0.133F, 0.133F, 0.133F));
                AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(-0.024F, 0.774F, -0.23F), new Vector3(0.234F, 271.606F, 270.571F), new Vector3(0.407F, 0.495F, 0.397F));
                AddDisplayRule("MageBody", "Head", new Vector3(0.003F, 0.232F, -0.181F), new Vector3(1.434F, 264.707F, 230.524F), new Vector3(0.149F, 0.149F, 0.149F));
                AddDisplayRule("MercBody", "Head", new Vector3(0F, 0.315F, 0.116F), new Vector3(1.129F, 273.826F, 158.027F), new Vector3(0.16F, 0.16F, 0.16F));
                AddDisplayRule("TreebotBody", "PlatformBase", new Vector3(0.466F, 0.259F, 0.204F), new Vector3(0F, 143.502F, 0F), new Vector3(0.083F, 0.083F, 0.083F));
                AddDisplayRule("LoaderBody", "Head", new Vector3(0F, 0.291F, 0.019F), new Vector3(0.389F, 270F, 180F), new Vector3(0.171F, 0.171F, 0.171F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(-0.125F, 0.241F, 2.181F), new Vector3(0F, 90F, 290F), new Vector3(1.271F, 0.895F, 1.408F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(0.001F, 0.276F, 0.016F), new Vector3(0.318F, 257.881F, 182.808F), new Vector3(0.158F, 0.158F, 0.158F));
                AddDisplayRule("BrotherBody", "Head", BrotherInfection.red, new Vector3(0.011F, 0.129F, 0.071F), new Vector3(28.594F, 22.166F, 285.147F), new Vector3(0.125F, 0.125F, 0.125F));
                AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(0F, 0.001F, -22.578F), new Vector3(0F, 270F, 90F), new Vector3(1.733F, 1.733F, 1.733F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Head", new Vector3(-0.00267F, 0.1063F, -0.295F), new Vector3(1.93567F, 269.8339F, 255.3638F), new Vector3(0.18268F, 0.12134F, 0.18268F));
                }
                AddDisplayRule("RailgunnerBody", "Head", new Vector3(0F, 0.28127F, 0.00146F), new Vector3(0F, 270F, 172.1766F), new Vector3(0.18744F, 0.15509F, 0.16573F));
                AddDisplayRule("VoidSurvivorBody", "Neck", new Vector3(0.00001F, 0.01907F, -0.00523F), new Vector3(0F, 270F, 0F), new Vector3(0.22184F, 0.15033F, 0.2149F));
            };

            On.RoR2.CharacterBody.OnSkillActivated += CharacterBody_OnSkillActivated;

            sfx           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            sfx.eventName = "MysticsItems_Play_item_proc_blender";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(sfx);
        }
Beispiel #10
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.tracker = base.GetComponent <HenryTracker>();
            this.target  = this.tracker.GetTrackingTarget();

            if (base.characterBody)
            {
                base.characterBody.bodyFlags |= CharacterBody.BodyFlags.IgnoreFallDamage;
            }
            if (base.isGrounded)
            {
                base.SmallHop(base.characterMotor, 10f);
            }

            if (this.target && this.target.healthComponent && this.target.healthComponent.alive)
            {
                this.targetIsValid = true;
            }

            HitBoxGroup hitBoxGroup    = null;
            Transform   modelTransform = base.GetModelTransform();

            if (modelTransform)
            {
                hitBoxGroup = Array.Find <HitBoxGroup>(modelTransform.GetComponents <HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Punch");
            }

            this.attack                 = new OverlapAttack();
            this.attack.damageType      = DamageType.Generic;
            this.attack.attacker        = base.gameObject;
            this.attack.inflictor       = base.gameObject;
            this.attack.teamIndex       = base.GetTeam();
            this.attack.damage          = DashPunch.damageCoefficient * this.damageStat;
            this.attack.procCoefficient = DashPunch.procCoefficient;
            this.attack.hitEffectPrefab = DashPunch.hitEffectPrefab;
            this.attack.hitBoxGroup     = hitBoxGroup;
            this.attack.isCrit          = base.RollCrit();
            this.attack.impactSound     = DashPunch.impactSound.index;
            this.attack.pushAwayForce   = DashPunch.pushForce * 0.2f;

            Util.PlaySound("HenryStinger", base.gameObject);
            base.PlayAnimation("FullBody, Override", "DashPunch");

            if (base.isGrounded)
            {
                EffectManager.SimpleEffect(Modules.Assets.dustEffect, base.characterBody.footPosition, base.transform.rotation, false);
            }
        }
Beispiel #11
0
        private static void PopulateAss()
        {
            JoePortrait = mainAssetBundle.LoadAsset <Sprite>("joe_icon").texture;
            Skill1Icon  = mainAssetBundle.LoadAsset <Sprite>("skill1_icon");
            Skill2Icon  = mainAssetBundle.LoadAsset <Sprite>("skill2_icon");

            JoeFireball = mainAssetBundle.LoadAsset <GameObject>("JoeFireballBasic");

            JoeImpactEffect = LoadEffect("JoeImpactEffectBasic");
            //JoeImpactEffect = mainAssetBundle.LoadAsset<GameObject>("JoeImpactEffectBasic");

            TestlaCoil = mainAssetBundle.LoadAsset <GameObject>("TeslaCoil");

            swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit");
        }
Beispiel #12
0
        /// <summary>
        /// Adds a NetworkSoundEventDef to your Mod's ContentPack
        /// <para>Requires that the event's name is not null, empty or whitespace</para>
        /// </summary>
        /// <param name="networkSoundEventDef">The NetworkSoundEventDef to Add</param>
        /// <returns>true if valid and added, false if one of the requirements is not met</returns>
        public static bool AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
        {
            var asm = Assembly.GetCallingAssembly();

            if (CatalogBlockers.GetAvailability <NetworkSoundEventDef>())
            {
                if (string.IsNullOrEmpty(networkSoundEventDef.eventName) || string.IsNullOrWhiteSpace(networkSoundEventDef.eventName))
                {
                    RejectContent(networkSoundEventDef, asm, "NetworkSoundEventDef", $"but it's eventName is Null, Empty or Whitespace!");
                    return(false);
                }
                R2APIContentManager.HandleContentAddition(asm, networkSoundEventDef);
                return(true);
            }
            RejectContent(networkSoundEventDef, asm, "NetworkSoundEventDef", "but the NetworkSoundEventCatalog has already initialized!");
            return(false);
        }
Beispiel #13
0
        protected override void OnEnable()
        {
            base.OnEnable();
            eliteDef             = TargetType.eliteDef;
            networkSoundEventDef = TargetType.startSfx;
            prefix = Settings.GetPrefix1stUpperRestLower();
            prefixUsesTokenPrefix = true;

            OnVisualTreeCopy += () =>
            {
                header        = Find <VisualElement>("Header");
                inspectorData = Find <VisualElement>("InspectorData");
                messages      = Find <VisualElement>("Messages");
                buffColor     = Find <ColorField>(inspectorData, "buffColor");
                Find <Button>(buffColor, "colorSetter").clicked += () => TargetType.buffColor = eliteDef.color;
            };
        }
Beispiel #14
0
        internal static void PopulateAssets()
        {
            if (mainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RegigigasMod.regigigas"))
                {
                    mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                }
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("RegigigasMod.RegigigasBank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            drainPunchChargeEffect = LoadEffect("DrainPunchChargeEffect", true);

            punchSoundDef = CreateNetworkSoundEventDef("RegigigasPunchImpact");
        }
 public override void OnEnter()
 {
     base.OnEnter();
     this.duration = this.CalcDuration();
     if (this.duration <= Time.fixedDeltaTime * 2f)
     {
         this.forceFire = true;
     }
     base.StartAimMode(2f, false);
     Util.PlaySound(this.beginStateSoundString, base.gameObject);
     this.animator = base.GetModelAnimator();
     if (base.isAuthority)
     {
         this.isCritAuthority = base.RollCrit();
         this.hitBoxGroup     = base.FindHitBoxGroup(this.GetHitBoxGroupName());
         if (this.hitBoxGroup)
         {
             OverlapAttack overlapAttack = new OverlapAttack();
             overlapAttack.attacker         = base.gameObject;
             overlapAttack.damage           = this.damageCoefficient * this.damageStat;
             overlapAttack.damageColorIndex = DamageColorIndex.Default;
             overlapAttack.damageType       = DamageType.Generic;
             overlapAttack.forceVector      = this.forceVector;
             overlapAttack.hitBoxGroup      = this.hitBoxGroup;
             overlapAttack.hitEffectPrefab  = this.hitEffectPrefab;
             NetworkSoundEventDef networkSoundEventDef = this.impactSound;
             overlapAttack.impactSound     = ((networkSoundEventDef != null) ? networkSoundEventDef.index : NetworkSoundEventIndex.Invalid);
             overlapAttack.inflictor       = base.gameObject;
             overlapAttack.isCrit          = this.isCritAuthority;
             overlapAttack.procChainMask   = default;
             overlapAttack.pushAwayForce   = this.pushAwayForce;
             overlapAttack.procCoefficient = this.procCoefficient;
             overlapAttack.teamIndex       = base.GetTeam();
             this.overlapAttack            = overlapAttack;
         }
     }
     this.PlayAnimation();
 }
Beispiel #16
0
        public override void OnLoad()
        {
            base.OnLoad();
            equipmentDef.name = "MysticsItems_FragileMask";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Fragile Mask", 0f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Fragile Mask", false);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Fragile Mask", false);
            equipmentDef.isLunar           = true;
            equipmentDef.colorIndex        = ColorCatalog.ColorIndex.LunarItem;
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Fragile Mask/Model.prefab"));
            var mat = equipmentDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial;

            HopooShaderToMaterial.Standard.Apply(mat);
            HopooShaderToMaterial.Standard.Emission(mat, 3f, new Color32(43, 255, 251, 255));
            equipmentDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Fragile Mask/Icon2.png");

            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Head", new Vector3(-0.00016F, 0.16862F, 0.22667F), new Vector3(0F, 0F, 0F), new Vector3(0.147F, 0.147F, 0.147F));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.01269F, 0.19186F, 0.14171F), new Vector3(342.3076F, 0F, 0F), new Vector3(0.119F, 0.119F, 0.121F));
                AddDisplayRule("Bandit2Body", "Head", new Vector3(-0.00647F, 0.00004F, 0.15421F), new Vector3(0F, 0F, 0F), new Vector3(0.097F, 0.097F, 0.097F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(0.17721F, 3.27152F, -1.81851F), new Vector3(306.0066F, 180F, 0F), new Vector3(1.24747F, 1.24747F, 1.24747F));
                AddDisplayRule("EngiBody", "HeadCenter", new Vector3(-0.00145F, -0.04144F, 0.22149F), new Vector3(0F, 0F, 0F), new Vector3(0.15596F, 0.15596F, 0.15596F));
                AddDisplayRule("MageBody", "Head", new Vector3(0F, 0.03035F, 0.14915F), new Vector3(0F, 0F, 0F), new Vector3(0.10014F, 0.10014F, 0.10014F));
                AddDisplayRule("MercBody", "Head", new Vector3(-0.01324F, 0.07837F, 0.20433F), new Vector3(0F, 0F, 0F), new Vector3(0.123F, 0.123F, 0.123F));
                AddDisplayRule("TreebotBody", "PlatformBase", new Vector3(0.01191F, 0.29394F, 0.88825F), new Vector3(21.4706F, 359.7744F, 16.32179F), new Vector3(0.3626F, 0.3626F, 0.3626F));
                AddDisplayRule("LoaderBody", "Head", new Vector3(-0.01458F, 0.04875F, 0.16764F), new Vector3(0F, 0F, 0F), new Vector3(0.14481F, 0.14481F, 0.14481F));
                AddDisplayRule("CrocoBody", "MouthMuzzle", new Vector3(-0.16546F, -0.03058F, 3.43643F), new Vector3(67.59733F, 0.04097F, 359.0291F), new Vector3(1.49662F, 1.49662F, 1.49662F));
                AddDisplayRule("CaptainBody", "Head", new Vector3(-0.01887F, 0.03281F, 0.24355F), new Vector3(1.79143F, 0F, 0F), new Vector3(0.1343F, 0.13818F, 0.15238F));
                AddDisplayRule("ScavBody", "Chest", new Vector3(-1.90286F, 4.41959F, -7.60945F), new Vector3(319.543F, 180F, 18.09413F), new Vector3(2.08147F, 2.08147F, 2.08147F));
                AddDisplayRule("EquipmentDroneBody", "HeadCenter", new Vector3(-0.06693F, -1.12064F, -0.77318F), new Vector3(90F, 0F, 0F), new Vector3(0.5795F, 0.5795F, 0.5795F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Head", new Vector3(-0.01493F, 0.22875F, -0.04979F), new Vector3(270F, 0F, 0F), new Vector3(0.12327F, 0.11932F, 0.11932F));
                }
                AddDisplayRule("RailgunnerBody", "Head", new Vector3(0F, -0.00018F, 0.13138F), new Vector3(8.64072F, 0F, 0F), new Vector3(0.11091F, 0.11091F, 0.11091F));
                AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(0.00002F, 0.0516F, 0.20447F), new Vector3(337.5584F, 0F, 0F), new Vector3(0.17494F, 0.13959F, 0.13131F));
            };

            On.RoR2.CharacterBody.OnInventoryChanged += CharacterBody_OnInventoryChanged;
            RecalculateStatsAPI.GetStatCoefficients  += RecalculateStatsAPI_GetStatCoefficients;
            On.RoR2.CharacterBody.RecalculateStats   += CharacterBody_RecalculateStats;
            GenericGameEvents.OnTakeDamage           += GenericGameEvents_OnTakeDamage;

            On.RoR2.Language.GetLocalizedStringByToken += Language_GetLocalizedStringByToken;

            var materials = LegacyResourcesAPI.Load <GameObject>("Prefabs/CharacterBodies/BrotherGlassBody").GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterials;

            overrideMaterial = materials[1];
            CharacterModelMaterialOverrides.AddOverride("FragileMask", BrittleMaterialOverride);
            Overlays.CreateOverlay(materials[0], (characterModel) =>
            {
                if (characterModel.body)
                {
                    var component = characterModel.body.GetComponent <MysticsItemsFragileMaskBehaviour>();
                    if (component && component.maskActive)
                    {
                        return(true);
                    }
                }
                return(false);
            });

            sfxEnable           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            sfxEnable.eventName = "MysticsItems_Play_item_use_fragileMask_on";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(sfxEnable);

            sfxDisable           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            sfxDisable.eventName = "MysticsItems_Play_item_use_fragileMask_off";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(sfxDisable);
        }
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_MysticSword";
            SetItemTierWhenAvailable(ItemTier.Tier2);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Damage,
                ItemTag.OnKillEffect,
                ItemTag.AIBlacklist
            };

            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Mystic Sword/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Mystic Sword/Icon.png");
            var mat = itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial;

            HopooShaderToMaterial.Standard.Apply(mat);
            HopooShaderToMaterial.Standard.Emission(mat, 1f, new Color32(0, 250, 255, 255));
            itemDef.pickupModelPrefab.transform.Find("GameObject").localScale *= 0.1f;

            var swordFollowerPrefab = PrefabAPI.InstantiateClone(PrepareItemDisplayModel(PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Mystic Sword/DisplayModel.prefab"))), "MysticsItems_MysticSwordItemFollowerPrefab", false);

            swordFollowerPrefab.transform.Find("TranslatePivot").transform.localScale *= 0.02f;
            ObjectTransformCurve objectTransformCurve = swordFollowerPrefab.transform.Find("TranslatePivot").gameObject.AddComponent <ObjectTransformCurve>();

            objectTransformCurve.translationCurveX = AnimationCurve.Constant(0f, 1f, 0f);
            var floatY = 0.1f;

            objectTransformCurve.translationCurveY = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0.25f, floatY),
                    new Keyframe(0.75f, -floatY)
                },
                preWrapMode  = WrapMode.PingPong,
                postWrapMode = WrapMode.PingPong
            };
            objectTransformCurve.translationCurveZ    = AnimationCurve.Constant(0f, 1f, 0f);
            objectTransformCurve.useTranslationCurves = true;
            objectTransformCurve.timeMax                     = 10f;
            objectTransformCurve.rotationCurveX              = AnimationCurve.Constant(0f, 1f, 0f);
            objectTransformCurve.rotationCurveY              = AnimationCurve.Linear(0f, 0f, 1f, 360f);
            objectTransformCurve.rotationCurveY.preWrapMode  = WrapMode.Loop;
            objectTransformCurve.rotationCurveY.postWrapMode = WrapMode.Loop;
            objectTransformCurve.rotationCurveZ              = AnimationCurve.Constant(0f, 1f, 0f);
            objectTransformCurve.useRotationCurves           = true;
            objectTransformCurve.gameObject.AddComponent <MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsObjectTransformCurveLoop>();

            itemDisplayPrefab = PrefabAPI.InstantiateClone(new GameObject("MysticsItems_MysticSwordFollower"), "MysticsItems_MysticSwordFollower", false);
            itemDisplayPrefab.AddComponent <ItemDisplay>();
            ItemFollower itemFollower = itemDisplayPrefab.AddComponent <ItemFollower>();

            itemFollower.followerPrefab   = swordFollowerPrefab;
            itemFollower.distanceDampTime = 0.1f;
            itemFollower.distanceMaxSpeed = 20f;
            itemFollower.targetObject     = itemDisplayPrefab;
            var itemDisplayHelper = itemDisplayPrefab.AddComponent <MysticsItemsMysticSwordItemDisplayHelper>();

            itemDisplayHelper.itemFollower = itemFollower;

            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Base", new Vector3(0.17794F, -0.28733F, -0.73752F), new Vector3(3.15473F, 89.99998F, 270.0002F), Vector3.one);
                AddDisplayRule("HuntressBody", "Base", new Vector3(0.17816F, -0.23663F, -0.52846F), new Vector3(2.42504F, 269.9999F, 90.0001F), Vector3.one);
                AddDisplayRule("Bandit2Body", "Base", new Vector3(0.4537F, 0.29041F, -0.57258F), new Vector3(270F, 0F, 0F), Vector3.one);
                AddDisplayRule("ToolbotBody", "Base", new Vector3(-1.04879F, -4.19278F, 5.42458F), new Vector3(0F, 90F, 90F), Vector3.one);
                AddDisplayRule("EngiBody", "Base", new Vector3(0.0113F, -0.52335F, -0.69199F), new Vector3(270F, 0F, 0F), Vector3.one);
                AddDisplayRule("EngiTurretBody", "Base", new Vector3(1.03266F, 3.98892F, -2.18302F), new Vector3(0F, 90F, 0F), Vector3.one);
                AddDisplayRule("EngiWalkerTurretBody", "Base", new Vector3(1.53037F, 3.79942F, -2.10391F), new Vector3(0F, 90F, 0F), Vector3.one);
                AddDisplayRule("MageBody", "Base", new Vector3(0.38669F, -0.43447F, -0.48611F), new Vector3(270F, 0F, 0F), Vector3.one);
                AddDisplayRule("MercBody", "Base", new Vector3(0.38005F, -0.35752F, -0.53391F), new Vector3(270F, 0F, 0F), Vector3.one);
                AddDisplayRule("TreebotBody", "Base", new Vector3(0.69145F, -1.39195F, -1.94014F), new Vector3(270F, 0F, 0F), Vector3.one * 1f);
                AddDisplayRule("LoaderBody", "Base", new Vector3(0.26563F, -0.57799F, -0.60309F), new Vector3(270F, 0F, 0F), Vector3.one);
                AddDisplayRule("CrocoBody", "Base", new Vector3(2.43278F, 4.85691F, 4.92643F), new Vector3(90F, 0F, 0F), Vector3.one * 1f);
                AddDisplayRule("CaptainBody", "Base", new Vector3(0.52281F, -0.26508F, -0.8575F), new Vector3(270F, 0F, 0F), Vector3.one);
                AddDisplayRule("BrotherBody", "HandR", BrotherInfection.green, new Vector3(-0.00915F, 0.08592F, 0.02786F), new Vector3(77.05167F, 128.9087F, 289.6218F), new Vector3(0.06672F, 0.02927F, 0.06676F));
                AddDisplayRule("ScavBody", "Base", new Vector3(4.53188F, 14.35975F, 10.88982F), new Vector3(90F, 0F, 0F), Vector3.one * 2f);
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Base", new Vector3(-0.74382F, 1.77236F, -0.52436F), new Vector3(0F, 0F, 0F), new Vector3(1F, 1F, 1F));
                }
                AddDisplayRule("RailgunnerBody", "Base", new Vector3(0.25904F, -0.39171F, -0.30991F), new Vector3(270F, 0F, 0F), new Vector3(1F, 1F, 1F));
                AddDisplayRule("VoidSurvivorBody", "Base", new Vector3(0.4739F, 0.74488F, 0.37712F), new Vector3(68.90421F, 0F, 0F), new Vector3(1F, 1F, 1F) * 0.8f);
            };

            {
                onKillVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Mystic Sword/SwordPowerUpKillEffect.prefab");
                EffectComponent effectComponent = onKillVFX.AddComponent <EffectComponent>();
                effectComponent.applyScale = true;
                VFXAttributes vfxAttributes = onKillVFX.AddComponent <VFXAttributes>();
                vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Medium;
                vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium;
                onKillVFX.AddComponent <DestroyOnTimer>().duration = 1f;
                MysticsItemsContent.Resources.effectPrefabs.Add(onKillVFX);
            }

            {
                onKillOrbEffect = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Mystic Sword/SwordPowerUpOrbEffect.prefab");
                EffectComponent effectComponent = onKillOrbEffect.AddComponent <EffectComponent>();
                effectComponent.positionAtReferencedTransform = false;
                effectComponent.parentToReferencedTransform   = false;
                effectComponent.applyScale = true;
                VFXAttributes vfxAttributes = onKillOrbEffect.AddComponent <VFXAttributes>();
                vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
                vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium;
                OrbEffect orbEffect = onKillOrbEffect.AddComponent <OrbEffect>();
                orbEffect.startVelocity1 = new Vector3(-25f, 5f, -25f);
                orbEffect.startVelocity2 = new Vector3(25f, 50f, 25f);
                orbEffect.endVelocity1   = new Vector3(0f, 0f, 0f);
                orbEffect.endVelocity2   = new Vector3(0f, 0f, 0f);
                var curveHolder = onKillVFX.transform.Find("Origin/Particle System").GetComponent <ParticleSystem>().sizeOverLifetime;
                orbEffect.movementCurve             = curveHolder.size.curve;
                orbEffect.faceMovement              = true;
                orbEffect.callArrivalIfTargetIsGone = false;
                DestroyOnTimer destroyOnTimer = onKillOrbEffect.transform.Find("Origin/Unparent").gameObject.AddComponent <DestroyOnTimer>();
                destroyOnTimer.duration = 0.5f;
                destroyOnTimer.enabled  = false;
                MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsOrbEffectOnArrivalDefaults onArrivalDefaults = onKillOrbEffect.AddComponent <MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsOrbEffectOnArrivalDefaults>();
                onArrivalDefaults.orbEffect = orbEffect;
                onArrivalDefaults.transformsToUnparentChildren = new Transform[] {
                    onKillOrbEffect.transform.Find("Origin/Unparent")
                };
                onArrivalDefaults.componentsToEnable = new MonoBehaviour[]
                {
                    destroyOnTimer
                };
                MysticsItemsContent.Resources.effectPrefabs.Add(onKillOrbEffect);
            }

            onKillSFX           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            onKillSFX.eventName = "MysticsItems_Play_item_proc_MysticSword";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(onKillSFX);

            CharacterMaster.onStartGlobal             += CharacterMaster_onStartGlobal;
            GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
            RecalculateStatsAPI.GetStatCoefficients   += RecalculateStatsAPI_GetStatCoefficients;

            if (!SoftDependencies.SoftDependenciesCore.itemStatsEnabled)
            {
                On.RoR2.UI.ItemIcon.SetItemIndex += ItemIcon_SetItemIndex;
            }

            GenericGameEvents.BeforeTakeDamage += GenericGameEvents_BeforeTakeDamage;

            MysticsItemsMysticSwordItemDisplayHelper.materialFlash = LegacyResourcesAPI.Load <Material>("Materials/matHuntressFlashBright");
            MysticsItemsMysticSwordItemDisplayHelper.blinkEffect   = Addressables.LoadAssetAsync <GameObject>("RoR2/Base/Huntress/HuntressBlinkEffect.prefab").WaitForCompletion();
        }
Beispiel #18
0
        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 OnEnter()
                {
                    base.OnEnter();

                    attackSpeedStat = (body ? body.attackSpeed : 1f) * baseAttackSpeedMultiplier;

                    duration = baseDuration / attackSpeedStat;
                    if (armAnimator)
                    {
                        PlayAnimationOnAnimator(armAnimator, "Additive", "Swing", "Swing.playbackRate", duration);
                    }
                    soundID = Util.PlayAttackSpeedSound(initialSoundString, gameObject, attackSpeedStat);

                    meleeAttackDelay   = baseMeleeAttackDelay / attackSpeedStat;
                    attackFireDuration = baseAttackFireDuration / attackSpeedStat;

                    UpdateTransform();

                    if (isAuthority)
                    {
                        //crit = body && bodyMaster && Util.CheckRoll(body.crit, bodyMaster);

                        hitBoxGroup = gameObject.GetComponentInChildren <HitBoxGroup>();

                        if (hitBoxGroup)
                        {
                            OverlapAttack overlapAttack = new OverlapAttack();
                            overlapAttack.attacker         = body ? body.gameObject : gameObject;
                            overlapAttack.damage           = (body ? body.damage : 1f) * (damageCoefficient + damageCoefficientPerCharge * (body ? (float)body.GetBuffCount(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge) : 0f));
                            overlapAttack.damageColorIndex = DamageColorIndex.Default;
                            overlapAttack.damageType       = DamageType.Generic;
                            overlapAttack.forceVector      = forceVector;
                            overlapAttack.hitBoxGroup      = hitBoxGroup;
                            overlapAttack.hitEffectPrefab  = hitEffectPrefab;
                            NetworkSoundEventDef networkSoundEventDef = impactSound;
                            overlapAttack.impactSound     = (networkSoundEventDef != null) ? networkSoundEventDef.index : NetworkSoundEventIndex.Invalid;
                            overlapAttack.inflictor       = gameObject;
                            overlapAttack.isCrit          = crit;
                            overlapAttack.procChainMask   = default(ProcChainMask);
                            overlapAttack.pushAwayForce   = pushAwayForce;
                            overlapAttack.procCoefficient = procCoefficient;
                            overlapAttack.teamIndex       = TeamComponent.GetObjectTeam(body ? body.gameObject : gameObject);
                            this.overlapAttack            = overlapAttack;

                            if (NetworkServer.active)
                            {
                                if (body)
                                {
                                    var whiletries = 1000;
                                    while (body.HasBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge) && whiletries-- > 0)
                                    {
                                        body.RemoveBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge);
                                    }
                                }

                                /*
                                 * while (body && body.HasBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge))
                                 *  body.RemoveBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge);
                                 */
                            }
                        }
                    }

                    if (armChildLocator)
                    {
                        for (var i = 1; i <= 6; i++)
                        {
                            var armBone = armChildLocator.FindChild("Arm" + i);
                            if (armBone)
                            {
                                DynamicBone dynamicBone = armBone.GetComponent <DynamicBone>();
                                if (dynamicBone)
                                {
                                    dynamicBone.enabled = false;
                                }
                            }
                        }
                    }
                }
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_KeepShopTerminalOpen";
            SetItemTierWhenAvailable(ItemTier.Tier2);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Utility,
                ItemTag.AIBlacklist,
                ItemTag.CannotCopy
            };
            MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef());
            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Platinum Card/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Platinum Card/Icon.png");
            HopooShaderToMaterial.Standard.Apply(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial);
            HopooShaderToMaterial.Standard.DisableEverything(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial);
            HopooShaderToMaterial.Standard.Gloss(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 0.1f, 3f);
            itemDisplayPrefab = PrepareItemDisplayModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Platinum Card/FollowerModel.prefab"));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "GunMeshL", new Vector3(-0.14803F, 0.02213F, 0.12401F), new Vector3(71.07552F, 0F, 0F), new Vector3(0.042F, 0.042F, 0.042F));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.08864F, 0.2563F, -0.11958F), new Vector3(343.8997F, 75.59196F, 43.60138F), new Vector3(0.042F, 0.042F, 0.042F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.16663F, 0.07171F, -0.03448F), new Vector3(340.1071F, 88.24358F, 257.9142F), new Vector3(0.037F, 0.037F, 0.037F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(-1.20046F, 2.3477F, 0.38287F), new Vector3(7.40534F, 171.1227F, 354.4013F), new Vector3(0.489F, 0.489F, 0.489F));
                AddDisplayRule("EngiBody", "Chest", new Vector3(-0.1787F, 0.14487F, 0.22069F), new Vector3(328.6561F, 145.9245F, 8.96297F), new Vector3(0.04921F, 0.04921F, 0.04921F));
                AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.4724F, 0.67251F, 0.05926F), new Vector3(31.60266F, 67.34644F, 23.17469F), new Vector3(0.168F, 0.168F, 0.168F));
                AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0F, 1.40432F, -0.53826F), new Vector3(72.01626F, 0F, 0F), new Vector3(0.134F, 0.163F, 0.131F));
                AddDisplayRule("MageBody", "Head", new Vector3(-0.08953F, 0.11065F, -0.10433F), new Vector3(357.7894F, 103.1625F, 271.0524F), new Vector3(0.044F, 0.044F, 0.044F));
                AddDisplayRule("MercBody", "Pelvis", new Vector3(-0.10721F, 0.03029F, 0.08815F), new Vector3(13.93437F, 164.9596F, 180F), new Vector3(0.034F, 0.034F, 0.034F));
                AddDisplayRule("TreebotBody", "WeaponPlatform", new Vector3(0.12857F, 0.44352F, 0.29435F), new Vector3(339.8401F, 258.922F, 32.09783F), new Vector3(0.107F, 0.107F, 0.107F));
                AddDisplayRule("LoaderBody", "MechBase", new Vector3(0.12546F, 0.07357F, -0.12968F), new Vector3(7.50558F, 26.88992F, 245.9819F), new Vector3(0.05961F, 0.05961F, 0.05961F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(1.227F, 2.85624F, -0.59417F), new Vector3(341.2246F, 0F, 0F), new Vector3(0.50349F, 0.50349F, 0.50349F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(0.10938F, 0.16565F, 0.15251F), new Vector3(351.8886F, 224.6353F, 241.3711F), new Vector3(0.053F, 0.048F, 0.053F));
                AddDisplayRule("BrotherBody", "Stomach", BrotherInfection.green, new Vector3(0.1446F, 0.10245F, 0.12114F), new Vector3(296.6585F, 215.6237F, 260.6332F), new Vector3(0.063F, 0.063F, 0.06164F));
                AddDisplayRule("ScavBody", "Backpack", new Vector3(-5.27366F, 11.30539F, 2.34812F), new Vector3(26.35906F, 351.5907F, 98.18745F), new Vector3(1.31515F, 1.35137F, 1.31515F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.10082F, 0.38579F, -0.25451F), new Vector3(0F, 90F, 270F), new Vector3(0.05257F, 0.05257F, 0.05257F));
                }
                AddDisplayRule("RailgunnerBody", "Backpack", new Vector3(0.11811F, 0.41013F, -0.08114F), new Vector3(0F, 90F, 270F), new Vector3(0.04824F, 0.04824F, 0.04824F));
                AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.03282F, -0.13304F, -0.12525F), new Vector3(354.9498F, 87.16938F, 256.3283F), new Vector3(0.04222F, 0.04222F, 0.04222F));
            };

            /*
             * On.RoR2.MultiShopController.Start += (orig, self) =>
             * {
             *  orig(self);
             *  self.gameObject.AddComponent<MysticsItemsKeepShopTerminalOpenBehaviour>();
             * };
             */

            On.RoR2.Stage.BeginServer += (orig, self) =>
            {
                orig(self);
                foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList)
                {
                    Inventory inventory = characterMaster.inventory;
                    if (inventory)
                    {
                        int count = inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_KeepShopTerminalOpenConsumed);
                        inventory.RemoveItem(MysticsItemsContent.Items.MysticsItems_KeepShopTerminalOpenConsumed, count);
                        inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_KeepShopTerminalOpen, count);
                    }
                }
            };

            sfx           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            sfx.eventName = "MysticsItems_Play_item_proc_creditcard";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(sfx);

            On.RoR2.Items.MultiShopCardUtils.OnPurchase += MultiShopCardUtils_OnPurchase;
        }
Beispiel #21
0
        public static void PopulateAssets()
        {
            if (mainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DiggerUnearthed.miner"))
                {
                    mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                }
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("DiggerUnearthed.DiggerBank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("DiggerUnearthed.MinerV2.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            blacksmithHammer = mainAssetBundle.LoadAsset <GameObject>("BlacksmithHammer");
            blacksmithHammer.AddComponent <BlacksmithHammerComponent>();
            blacksmithHammer.GetComponentInChildren <MeshRenderer>().material.shader = Resources.Load <Shader>("Shaders/Deferred/hgstandard");

            blacksmithAnvil = mainAssetBundle.LoadAsset <GameObject>("BlacksmithAnvil");
            blacksmithAnvil.GetComponentInChildren <MeshRenderer>().material.shader = Resources.Load <Shader>("Shaders/Deferred/hgstandard");
            blacksmithAnvil.gameObject.layer = LayerIndex.world.intVal;

            charPortrait = mainAssetBundle.LoadAsset <Texture>("texMinerIcon");

            iconP  = mainAssetBundle.LoadAsset <Sprite>("GoldRushIcon");
            icon1  = mainAssetBundle.LoadAsset <Sprite>("GougeIcon");
            icon1B = mainAssetBundle.LoadAsset <Sprite>("CrushIcon");
            icon2  = mainAssetBundle.LoadAsset <Sprite>("DrillChargeIcon");
            icon2B = mainAssetBundle.LoadAsset <Sprite>("DrillBreakIcon");
            icon3  = mainAssetBundle.LoadAsset <Sprite>("BackblastIcon");
            icon3B = mainAssetBundle.LoadAsset <Sprite>("CaveInIcon");
            icon4  = mainAssetBundle.LoadAsset <Sprite>("ToTheStarsIcon");
            icon4S = mainAssetBundle.LoadAsset <Sprite>("ToTheStarsScepterIcon");
            icon4B = mainAssetBundle.LoadAsset <Sprite>("TimedExplosiveIcon");

            c4Model = mainAssetBundle.LoadAsset <GameObject>("MinerC4");

            tundraMesh       = mainAssetBundle.LoadAsset <Mesh>("TundraMesh");
            blacksmithMesh   = mainAssetBundle.LoadAsset <Mesh>("BlacksmithMesh");
            grandMasteryMesh = mainAssetBundle.LoadAsset <Mesh>("meshMinerGM");
            dripMesh         = mainAssetBundle.LoadAsset <Mesh>("DripMesh");
            steveMesh        = mainAssetBundle.LoadAsset <Mesh>("SteveMesh");

            swingFX          = LoadEffect("MinerSwing", "", mainAssetBundle);
            crushSwingFX     = LoadEffect("MinerSwingAltAlt", "", mainAssetBundle, true);
            empoweredSwingFX = LoadEffect("MinerSwingEmpowered", "", mainAssetBundle);
            hitFX            = LoadEffect("ImpactMinerSwing", "", mainAssetBundle);
            slashFX          = LoadEffect("ImpactMinerSlash", "", mainAssetBundle);
            heavyHitFX       = LoadEffect("ImpactMinerHeavy", "", mainAssetBundle);

            pickHitEventDef = CreateNetworkSoundEventDef(Sounds.Hit);
        }
Beispiel #22
0
        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;
        }
Beispiel #23
0
        internal static void PopulateAssets()
        {
            if (!mainAssetBundle)
            {
                Debug.LogError("There is no AssetBundle to load assets from.");
                return;
            }

            swordHitSoundEvent    = CreateNetworkSoundEventDef("HenrySwordHit");
            punchHitSoundEvent    = CreateNetworkSoundEventDef("HenryPunchHit");
            nemSwordHitSoundEvent = CreateNetworkSoundEventDef("NemrySwordHit");

            dustEffect             = LoadEffect("HenryDustEffect");
            bombExplosionEffect    = LoadEffect("BombExplosionEffect", "HenryBombExplosion");
            bazookaExplosionEffect = LoadEffect("HenryBazookaExplosionEffect", "HenryBazookaExplosion");
            bazookaMuzzleFlash     = LoadEffect("HenryBazookaMuzzleFlash");

            muzzleFlashEnergy = LoadEffect("NemryMuzzleFlashEnergy", true);
            minibossEffect    = mainAssetBundle.LoadAsset <GameObject>("NemryMinibossIndicator");

            swordChargeFinishEffect = LoadEffect("SwordChargeFinishEffect");
            swordChargeEffect       = mainAssetBundle.LoadAsset <GameObject>("SwordChargeEffect");

            if (swordChargeEffect)
            {
                swordChargeEffect.AddComponent <ScaleParticleSystemDuration>().particleSystems = swordChargeEffect.GetComponentsInChildren <ParticleSystem>();
                swordChargeEffect.GetComponent <ScaleParticleSystemDuration>().initialDuration = 1.5f;
            }

            if (bombExplosionEffect)
            {
                ShakeEmitter shakeEmitter = bombExplosionEffect.AddComponent <ShakeEmitter>();
                shakeEmitter.amplitudeTimeDecay             = true;
                shakeEmitter.duration                       = 0.5f;
                shakeEmitter.radius                         = 200f;
                shakeEmitter.scaleShakeRadiusWithLocalScale = false;

                shakeEmitter.wave = new Wave
                {
                    amplitude   = 1f,
                    frequency   = 40f,
                    cycleOffset = 0f
                };

                shakeEmitter = bazookaExplosionEffect.AddComponent <ShakeEmitter>();
                shakeEmitter.amplitudeTimeDecay             = true;
                shakeEmitter.duration                       = 0.4f;
                shakeEmitter.radius                         = 100f;
                shakeEmitter.scaleShakeRadiusWithLocalScale = false;

                shakeEmitter.wave = new Wave
                {
                    amplitude   = 1f,
                    frequency   = 30f,
                    cycleOffset = 0f
                };
            }

            swordSwingEffect     = Assets.LoadEffect("HenrySwordSwingEffect", true);
            swordHitImpactEffect = Assets.LoadEffect("ImpactHenrySlash");

            punchSwingEffect  = Assets.LoadEffect("HenryFistSwingEffect", true);
            punchImpactEffect = Assets.LoadEffect("ImpactHenryPunch");

            fistBarrageEffect = Assets.LoadEffect("FistBarrageEffect", true);
            if (fistBarrageEffect)
            {
                fistBarrageEffect.GetComponent <ParticleSystemRenderer>().material.shader = hotpoo;
            }

            bazookaCrosshair = PrefabAPI.InstantiateClone(LoadCrosshair("ToolbotGrenadeLauncher"), "HenryBazookaCrosshair", false);
            CrosshairController crosshair = bazookaCrosshair.GetComponent <CrosshairController>();

            crosshair.skillStockSpriteDisplays = new CrosshairController.SkillStockSpriteDisplay[0];
            bazookaCrosshair.transform.Find("StockCountHolder").gameObject.SetActive(false);
            bazookaCrosshair.transform.Find("Image, Arrow (1)").gameObject.SetActive(true);
            crosshair.spriteSpreadPositions[0].zeroPosition = new Vector3(32f, 34f, 0f);
            crosshair.spriteSpreadPositions[2].zeroPosition = new Vector3(-32f, 34f, 0f);
            bazookaCrosshair.transform.GetChild(1).gameObject.SetActive(false);

            trackerPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/HuntressTrackingIndicator"), "HenryTrackerPrefab", false);
            trackerPrefab.transform.Find("Core Pip").gameObject.GetComponent <SpriteRenderer>().color = Color.white;
            trackerPrefab.transform.Find("Core Pip").localScale = new Vector3(0.15f, 0.15f, 0.15f);

            trackerPrefab.transform.Find("Core, Dark").gameObject.GetComponent <SpriteRenderer>().color = Color.black;
            trackerPrefab.transform.Find("Core, Dark").localScale = new Vector3(0.1f, 0.1f, 0.1f);

            foreach (SpriteRenderer i in trackerPrefab.transform.Find("Holder").gameObject.GetComponentsInChildren <SpriteRenderer>())
            {
                if (i)
                {
                    i.gameObject.transform.localScale = new Vector3(0.2f, 0.2f, 1f);
                    i.color = Color.white;
                }
            }

            shotgunTracer = Resources.Load <GameObject>("Prefabs/Effects/Tracers/TracerCommandoShotgun").InstantiateClone("HenryBulletTracer", true);

            if (!shotgunTracer.GetComponent <EffectComponent>())
            {
                shotgunTracer.AddComponent <EffectComponent>();
            }
            if (!shotgunTracer.GetComponent <VFXAttributes>())
            {
                shotgunTracer.AddComponent <VFXAttributes>();
            }
            if (!shotgunTracer.GetComponent <NetworkIdentity>())
            {
                shotgunTracer.AddComponent <NetworkIdentity>();
            }

            foreach (LineRenderer i in shotgunTracer.GetComponentsInChildren <LineRenderer>())
            {
                if (i)
                {
                    Material bulletMat = UnityEngine.Object.Instantiate <Material>(i.material);
                    bulletMat.SetColor("_TintColor", new Color(0.68f, 0.58f, 0.05f));
                    i.material   = bulletMat;
                    i.startColor = new Color(0.68f, 0.58f, 0.05f);
                    i.endColor   = new Color(0.68f, 0.58f, 0.05f);
                }
            }

            AddNewEffectDef(shotgunTracer);

            spearSwingEffect = Assets.LoadEffect("NemrySpearSwingEffect");

            nemSwordSwingEffect      = Assets.LoadEffect("NemrySwordSwingEffect", true);
            nemSwordStabSwingEffect  = Assets.LoadEffect("NemrySwordStabSwingEffect", true);
            nemSwordHeavySwingEffect = Assets.LoadEffect("NemryHeavySwordSwingEffect", true);
            nemSwordHitImpactEffect  = Assets.LoadEffect("ImpactNemrySlash");

            energyBurstEffect      = LoadEffect("EnergyBurstEffect");
            smallEnergyBurstEffect = LoadEffect("EnergySmallBurstEffect");

            energyTracer = CreateTracer("TracerHuntressSnipe", "NemryEnergyTracer");

            LineRenderer line      = energyTracer.transform.Find("TracerHead").GetComponent <LineRenderer>();
            Material     tracerMat = UnityEngine.Object.Instantiate <Material>(line.material);

            line.startWidth *= 0.25f;
            line.endWidth   *= 0.25f;
            // this did not work.
            //tracerMat.SetColor("_TintColor", new Color(78f / 255f, 80f / 255f, 111f / 255f));
            line.material = tracerMat;
        }
Beispiel #24
0
        public static void PopulateAssets()
        {
            if (mainAssetBundle == null)
            {
                using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PaladinMod.paladin"))
                {
                    mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
                }
            }

            using (Stream manifestResourceStream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("PaladinMod.PaladinBank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream2.Length];
                manifestResourceStream2.Read(array, 0, array.Length);
                SoundAPI.SoundBanks.Add(array);
            }

            GatherMaterials();

            #region Icons
            charPortrait = mainAssetBundle.LoadAsset <Sprite>("texPaladinIcon").texture;

            iconP   = mainAssetBundle.LoadAsset <Sprite>("PassiveIcon");
            icon1   = mainAssetBundle.LoadAsset <Sprite>("SlashIcon");
            icon2   = mainAssetBundle.LoadAsset <Sprite>("SpinSlashIcon");
            icon2b  = mainAssetBundle.LoadAsset <Sprite>("LightningSpearIcon");
            icon2c  = mainAssetBundle.LoadAsset <Sprite>("LunarShardIcon");
            icon3   = mainAssetBundle.LoadAsset <Sprite>("DashIcon");
            icon3b  = mainAssetBundle.LoadAsset <Sprite>("HealIcon");
            icon4   = mainAssetBundle.LoadAsset <Sprite>("HealZoneIcon");
            icon4b  = mainAssetBundle.LoadAsset <Sprite>("TorporIcon");
            icon4c  = mainAssetBundle.LoadAsset <Sprite>("WarcryIcon");
            icon4S  = mainAssetBundle.LoadAsset <Sprite>("ScepterHealZoneIcon");
            icon4bS = mainAssetBundle.LoadAsset <Sprite>("ScepterTorporIcon");
            icon4cS = mainAssetBundle.LoadAsset <Sprite>("ScepterWarcryIcon");
            icon4d  = mainAssetBundle.LoadAsset <Sprite>("CruelSunIcon");
            icon4dS = mainAssetBundle.LoadAsset <Sprite>("ScepterCruelSunIcon");
            #endregion

            #region ProjectileGhosts
            lightningSpear = mainAssetBundle.LoadAsset <GameObject>("LightningSpear");
            swordBeam      = mainAssetBundle.LoadAsset <GameObject>("SwordBeam");
            swordBeamGhost = mainAssetBundle.LoadAsset <GameObject>("SwordBeamGhost");
            swordBeamGhost.AddComponent <ProjectileGhostController>();
            tornadoEffect = mainAssetBundle.LoadAsset <GameObject>("PaladinTornadoEffect");
            tornadoEffect.AddComponent <ProjectileGhostController>();
            #endregion

            #region SpellEffects
            healEffectPrefab     = mainAssetBundle.LoadAsset <GameObject>("HealEffect");
            healZoneEffectPrefab = mainAssetBundle.LoadAsset <GameObject>("HealZoneEffect");
            torporEffectPrefab   = mainAssetBundle.LoadAsset <GameObject>("TorporEffect");
            warcryEffectPrefab   = mainAssetBundle.LoadAsset <GameObject>("HealZoneEffect").InstantiateClone("WarcryEffect", false);

            GameObject engiShieldObj = Resources.Load <GameObject>("Prefabs/Projectiles/EngiBubbleShield");

            Material shieldFillMat  = UnityEngine.Object.Instantiate <Material>(engiShieldObj.transform.Find("Collision").Find("ActiveVisual").GetComponent <MeshRenderer>().material);
            Material shieldOuterMat = UnityEngine.Object.Instantiate <Material>(engiShieldObj.transform.Find("Collision").Find("ActiveVisual").Find("Edge").GetComponent <MeshRenderer>().material);

            GameObject voidExplosionObj = Resources.Load <GameObject>("Prefabs/Effects/NullifierDeathExplosion");//DeathExplosion
            Material   voidMat          = voidExplosionObj.transform.Find("AreaIndicator (1)").GetComponent <ParticleSystemRenderer>().material;
            torporMat = voidMat;

            GameObject healNovaObj = Resources.Load <GameObject>("Prefabs/Effects/TPHealNovaEffect");
            Material   healMat     = healNovaObj.transform.Find("AreaIndicator").GetComponent <ParticleSystemRenderer>().material;

            healEffectPrefab.GetComponentInChildren <ParticleSystemRenderer>().material = healMat;

            healZoneEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material             = shieldOuterMat;
            healZoneEffectPrefab.transform.GetChild(0).GetChild(0).GetComponent <ParticleSystemRenderer>().material = healMat;

            torporEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = voidMat;

            warcryEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material = shieldOuterMat;
            warcryEffectPrefab.transform.GetChild(0).GetComponent <ParticleSystemRenderer>().material.SetColor("_TintColor", Color.red);
            warcryEffectPrefab.transform.GetChild(0).GetChild(0).GetComponent <ParticleSystemRenderer>().material = Resources.Load <Material>("materials/matFullCrit");
            //
            //GameObject warbannerEffect = Resources.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard").InstantiateClone("x", true);
            #endregion

            #region SwordEffects
            swordSwing = Assets.LoadEffect("PaladinSwing", "");
            swordSwing.transform.Find("SwingTrail").Find("SwingTrail2").GetComponent <ParticleSystemRenderer>().material = matDistortion;

            spinningSlashFX          = Assets.LoadEffect("SpinSlashEffect", "");
            spinningSlashEmpoweredFX = Assets.LoadEffect("EmpSpinSlashEffect", "");
            spinningSlashEmpoweredFX.transform.Find("pog").GetComponent <ParticleSystemRenderer>().material = matJellyfishLightning;
            spinningSlashEmpoweredFX.transform.Find("pog").Find("champ").GetComponent <ParticleSystemRenderer>().material      = matJellyfishLightning;
            spinningSlashEmpoweredFX.transform.Find("pog").Find("Distortion").GetComponent <ParticleSystemRenderer>().material = matDistortion;

            hitFX = Assets.LoadEffect("ImpactPaladinSwing", "");

            swordSwingGreen               = Assets.LoadEffect("PaladinSwingGreen", "");
            spinningSlashFXGreen          = Assets.LoadEffect("SpinSlashEffectGreen", "");
            spinningSlashEmpoweredFXGreen = Assets.LoadEffect("EmpSpinSlashEffectGreen", "");
            hitFXGreen = Assets.LoadEffect("ImpactPaladinSwingGreen", "");

            swordSwingYellow               = Assets.LoadEffect("PaladinSwingYellow", "");
            spinningSlashFXYellow          = Assets.LoadEffect("SpinSlashEffectYellow", "");
            spinningSlashEmpoweredFXYellow = Assets.LoadEffect("EmpSpinSlashEffectYellow", "");
            hitFXYellow = Assets.LoadEffect("ImpactPaladinSwingYellow", "");

            swordSwingWhite = Assets.LoadEffect("PaladinSwingWhite", "");
            hitFXBlunt      = Assets.LoadEffect("ImpactPaladinSwingBlunt", "");

            swordSwingBat = Assets.LoadEffect("PaladinSwingBat", "");

            swordSwingRed               = Assets.LoadEffect("PaladinSwingRed", "");
            spinningSlashFXRed          = Assets.LoadEffect("SpinSlashEffectRed", "");
            spinningSlashEmpoweredFXRed = Assets.LoadEffect("EmpSpinSlashEffectRed", "");
            hitFXRed = Assets.LoadEffect("ImpactPaladinSwingRed", "");

            swordSwingClay               = Assets.LoadEffect("PaladinSwingClay", "");
            spinningSlashFXClay          = Assets.LoadEffect("SpinSlashEffectClay", "");
            spinningSlashEmpoweredFXClay = Assets.LoadEffect("EmpSpinSlashEffectClay", "");
            hitFXClay = Assets.LoadEffect("ImpactPaladinSwingClay", "");

            swordSwingPurple               = Assets.LoadEffect("PaladinSwingPurple", "");
            spinningSlashFXPurple          = Assets.LoadEffect("SpinSlashEffectPurple", "");
            spinningSlashEmpoweredFXPurple = Assets.LoadEffect("EmpSpinSlashEffectPurple", "");
            hitFXPurple = Assets.LoadEffect("ImpactPaladinSwingPurple", "");

            swordSwingFlame               = Assets.LoadEffect("PaladinSwingFlame", "");
            spinningSlashFXFlame          = Assets.LoadEffect("SpinSlashEffectFlame", "");
            spinningSlashEmpoweredFXFlame = Assets.LoadEffect("EmpSpinSlashEffectFlame", "");

            swordSwingBlack               = Assets.LoadEffect("PaladinSwingBlack", "");
            spinningSlashFXBlack          = Assets.LoadEffect("SpinSlashEffectBlack", "");
            spinningSlashEmpoweredFXBlack = Assets.LoadEffect("EmpSpinSlashEffectBlack", "");
            hitFXBlack = Assets.LoadEffect("ImpactPaladinSwingBlack", "");
            #endregion

            #region MiscEffects
            lightningHitFX    = Assets.LoadEffect("LightningHitFX", "");
            lightningImpactFX = Assets.LoadEffect("LightningImpact", "Play_mage_R_lightningBlast");
            torporVoidFX      = Assets.LoadEffect("TorporVoidFX", "RoR2_nullifier_attack1_explode_02");
            #endregion

            #region Meshes
            defaultMesh          = mainAssetBundle.LoadAsset <Mesh>("meshPaladin");
            defaultSwordMesh     = mainAssetBundle.LoadAsset <Mesh>("meshSword");
            defaultCapeMesh      = mainAssetBundle.LoadAsset <Mesh>("meshCape");
            lunarMesh            = mainAssetBundle.LoadAsset <Mesh>("meshPaladinLunar");
            lunarSwordMesh       = mainAssetBundle.LoadAsset <Mesh>("meshSwordLunar");
            lunarKnightMesh      = mainAssetBundle.LoadAsset <Mesh>("meshPaladinLunarKnight");
            lunarKnightSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshLunarKnightMace");
            gmMesh                = mainAssetBundle.LoadAsset <Mesh>("meshPaladinGM");
            gmSwordMesh           = mainAssetBundle.LoadAsset <Mesh>("meshSwordGM");
            gmLegacyMesh          = mainAssetBundle.LoadAsset <Mesh>("meshPaladinGMOld");
            gmLegacySwordMesh     = mainAssetBundle.LoadAsset <Mesh>("meshSwordGMOld");
            gmCapeMesh            = mainAssetBundle.LoadAsset <Mesh>("meshCapeGM");
            poisonMesh            = mainAssetBundle.LoadAsset <Mesh>("meshPaladinNkuhana");
            poisonSwordMesh       = mainAssetBundle.LoadAsset <Mesh>("meshSwordNkuhana");
            poisonLegacyMesh      = mainAssetBundle.LoadAsset <Mesh>("meshPaladinNkuhanaLegacy");
            poisonLegacySwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshSwordNkuhanaLegacy");
            specterMesh           = mainAssetBundle.LoadAsset <Mesh>("meshPaladinSpecter");
            specterSwordMesh      = mainAssetBundle.LoadAsset <Mesh>("meshSwordSpecter");
            //hunterMesh = mainAssetBundle.LoadAsset<Mesh>("HunterMesh");
            dripMesh           = mainAssetBundle.LoadAsset <Mesh>("meshPaladinDrip");
            batMesh            = mainAssetBundle.LoadAsset <Mesh>("meshBat");
            clayMesh           = mainAssetBundle.LoadAsset <Mesh>("meshPaladinClay");
            claySwordMesh      = mainAssetBundle.LoadAsset <Mesh>("meshSwordClay");
            minecraftMesh      = mainAssetBundle.LoadAsset <Mesh>("meshPaladinMinecraft");
            minecraftSwordMesh = mainAssetBundle.LoadAsset <Mesh>("meshSwordMinecraft");
            #endregion

            //capeMat = Skins.CreateMaterial("matPaladinGMOld", 1, Color.white);
            //was this being used anywhere?

            altLightningImpactFX = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/LightningStrikeImpact"), "PaladinLightningStrikeImpact", true);
            PaladinPlugin.Destroy(altLightningImpactFX.transform.Find("LightningRibbon").gameObject);
            PaladinPlugin.Destroy(altLightningImpactFX.transform.Find("Ring").gameObject);
            altLightningImpactFX.transform.Find("PostProcess").GetComponent <PostProcessVolume>().sharedProfile = grandParentPP;
            altLightningImpactFX.transform.Find("Sphere").GetComponent <ParticleSystemRenderer>().material      = matLoaderLightningSphere;
            Light light = altLightningImpactFX.GetComponentInChildren <Light>();
            light.intensity = 80f;
            light.color     = Color.yellow;

            altLightningImpactFX.AddComponent <NetworkIdentity>();

            AddEffect(altLightningImpactFX, altLightningImpactFX.GetComponent <EffectComponent>().soundName);

            //clone mithrix's dash effect and resize it for my dash
            dashFX = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Effects/BrotherDashEffect"), "PaladinDashEffect", true);
            dashFX.AddComponent <NetworkIdentity>();
            dashFX.GetComponent <EffectComponent>().applyScale = true;
            dashFX.transform.localScale *= 0.5f;

            AddEffect(dashFX);

            //InitCustomItems();

            swordHitSoundEventS = CreateNetworkSoundEventDef(Modules.Sounds.HitS);
            swordHitSoundEventM = CreateNetworkSoundEventDef(Modules.Sounds.HitM);
            swordHitSoundEventL = CreateNetworkSoundEventDef(Modules.Sounds.HitL);

            batHitSoundEventS = CreateNetworkSoundEventDef(Modules.Sounds.HitBluntS);
            batHitSoundEventM = CreateNetworkSoundEventDef(Modules.Sounds.HitBluntM);
            batHitSoundEventL = CreateNetworkSoundEventDef(Modules.Sounds.HitBluntL);
        }
Beispiel #25
0
        internal static void PopulateAssets()
        {
            //if (mainAssetBundle == null)
            //{
            //using (var assetStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TTGL_Survivor.ttglsurvivorbundle"))
            //{
            //mainAssetBundle = AssetBundle.LoadFromStream(assetStream);
            //}
            //}

            var test = System.IO.Path.Combine(ResourcesPath, "catalog_2022.04.20.04.13.04.json");

            Addressables.LoadContentCatalogAsync(test, true, "ror2_ttgl_mod").WaitForCompletion();


            using (Stream manifestResourceStream3 = Assembly.GetExecutingAssembly().GetManifestResourceStream("TTGL_Survivor.TTGLSoundbank.bnk"))
            {
                byte[] array = new byte[manifestResourceStream3.Length];
                manifestResourceStream3.Read(array, 0, array.Length);
                soundBankId = SoundAPI.SoundBanks.Add(array);
                //MusicTrackOverride
            }

            fullBuffPlaySoundEvent     = CreateNetworkSoundEventDef("TTGLFullBuffPlay");
            genericHitSoundEvent       = CreateNetworkSoundEventDef("TTGLGenericHit");
            lagannImpactFireSoundEvent = CreateNetworkSoundEventDef("TTGLLagannImpactFire");
            drillRushHitSoundEvent     = CreateNetworkSoundEventDef("TTGLDrillRushHit");
            fullBuffResumeSoundEvent   = CreateNetworkSoundEventDef("TTGLFullBuffResume");
            fullBuffPauseSoundEvent    = CreateNetworkSoundEventDef("TTGLFullBuffPause");
            fullBuffStopSoundEvent     = CreateNetworkSoundEventDef("TTGLFullBuffStop");
            tokoRifleFireSoundEvent    = CreateNetworkSoundEventDef("TTGLTokoRifleFire");
            tokoRifleCritSoundEvent    = CreateNetworkSoundEventDef("TTGLTokoRifleCrit");
            gigaDrillBreakSoundEvent   = CreateNetworkSoundEventDef("TTGLGigaDrillBreak");

            var omniImpactVFXLoader = LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/OmniEffect/OmniImpactVFXLoader");

            if (omniImpactVFXLoader == null)
            {
                TTGL_SurvivorPlugin.instance.Logger.LogError("Could not load Prefabs/Effects/OmniEffect/OmniImpactVFXLoader");
            }
            punchImpactEffect = PrefabAPI.InstantiateClone(omniImpactVFXLoader, "TTGLImpactPunch");
            punchImpactEffect.AddComponent <NetworkIdentity>();

            TTGL_SurvivorPlugin.effectDefs.Add(new EffectDef()
            {
                prefab = punchImpactEffect,
                prefabEffectComponent = punchImpactEffect.GetComponent <EffectComponent>(),
                prefabVfxAttributes   = punchImpactEffect.GetComponent <VFXAttributes>(),
                prefabName            = punchImpactEffect.name,
                spawnSoundEventName   = punchImpactEffect.GetComponent <EffectComponent>().soundName
            });
            var tracerHuntressSnipe = LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/Tracers/TracerHuntressSnipe");

            if (tracerHuntressSnipe == null)
            {
                TTGL_SurvivorPlugin.instance.Logger.LogError("Could not load Prefabs/Effects/Tracers/TracerHuntressSnipe");
            }
            yokoRifleBeamEffect = PrefabAPI.InstantiateClone(tracerHuntressSnipe, "TTGLYokoRifleBeamEffect");
            yokoRifleBeamEffect.AddComponent <NetworkIdentity>();
            yokoRifleBeamEffect.AddComponent <VFXAttributes>().vfxPriority = VFXAttributes.VFXPriority.Always;
            TTGL_SurvivorPlugin.effectDefs.Add(new EffectDef()
            {
                prefab = yokoRifleBeamEffect,
                prefabEffectComponent = yokoRifleBeamEffect.GetComponent <EffectComponent>(),
                prefabVfxAttributes   = yokoRifleBeamEffect.GetComponent <VFXAttributes>(),
                prefabName            = yokoRifleBeamEffect.name,
                spawnSoundEventName   = yokoRifleBeamEffect.GetComponent <EffectComponent>().soundName
            });

            yokoRifleHitSmallEffect          = Assets.LoadEffect("YokoRifleHitSmallEffect", 1.0f);
            yokoRifleMuzzleBigEffect         = Assets.LoadEffect("YokoRifleMuzzleBigEffect", 1.0f);
            yokoRifleMuzzleSmallEffect       = Assets.LoadEffect("YokoRifleMuzzleSmallEffect", 1.0f);
            yokoRifleExplosiveRoundExplosion = Assets.LoadEffect("YokoRifleExplosiveRoundExplosion", 1.0f);
            gurrenBrokenBoulderEffect        = Assets.LoadEffect("BigBoulderBrokenPrefab", 5.0f);
            specialExplosion = Assets.LoadEffect("SpecialExplosion", 5.0f);
            drillPopEffect   = Assets.LoadEffect("DrillPopEffect", 2.0f, true);
            earthMoundEffect = Assets.LoadEffect("EarthMoundEffect", 2.0f);
        }
Beispiel #26
0
        public override void OnLoad()
        {
            equipmentDef.name = "MysticsItems_Microphone";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Vintage Microphone", 60f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Vintage Microphone", true);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Vintage Microphone", false);
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Microphone/Icon.png");

            var modelPanelParams = equipmentDef.pickupModelPrefab.GetComponent <ModelPanelParameters>();

            modelPanelParams.minDistance = 5;
            modelPanelParams.maxDistance = 15;
            HopooShaderToMaterial.Standard.Gloss(equipmentDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 1f, 15f);
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.131F, 0.101F, -0.106F), new Vector3(353.789F, 220.459F, 176.094F), new Vector3(0.024F, 0.024F, 0.024F));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.065F, 0.139F, 0.087F), new Vector3(57.427F, 169.25F, 159.351F), new Vector3(0.011F, 0.011F, 0.012F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.097F, 0.048F, -0.129F), new Vector3(4.954F, 282.723F, 159.07F), new Vector3(0.029F, 0.029F, 0.029F));
                AddDisplayRule("ToolbotBody", "HandR", new Vector3(-0.01F, 0.981F, -0.167F), new Vector3(58.56F, 268.579F, 264.86F), new Vector3(0.378F, 0.378F, 0.378F));
                AddDisplayRule("EngiBody", "HandL", new Vector3(0.015F, 0.18F, -0.04F), new Vector3(70.126F, 294.778F, 9.124F), new Vector3(0.047F, 0.047F, 0.047F));
                AddDisplayRule("MageBody", "Head", new Vector3(-0.095F, 0.108F, -0.047F), new Vector3(358.993F, 354.776F, 177.852F), new Vector3(0.016F, 0.016F, 0.016F));
                AddDisplayRule("MercBody", "HandL", new Vector3(0.021F, 0.127F, 0.013F), new Vector3(356.714F, 344.677F, 266.091F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("TreebotBody", "WeaponPlatformEnd", new Vector3(-0.044F, -0.068F, 0.154F), new Vector3(339.636F, 327.135F, 61.693F), new Vector3(0.05F, 0.05F, 0.05F));
                AddDisplayRule("LoaderBody", "MechHandL", new Vector3(0.052F, 0.271F, 0.005F), new Vector3(0.351F, 159.123F, 281.328F), new Vector3(0.052F, 0.05F, 0.052F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(-0.543F, 4.565F, -0.104F), new Vector3(284.494F, 3.244F, 267.429F), new Vector3(0.333F, 0.333F, 0.333F));
                AddDisplayRule("CaptainBody", "HandR", new Vector3(0.002F, 0.155F, -0.014F), new Vector3(53.771F, 271.897F, 272.032F), new Vector3(0.041F, 0.041F, 0.041F));
                AddDisplayRule("ScavBody", "HandL", new Vector3(0.469F, 2.35F, -0.273F), new Vector3(305.162F, 137.483F, 278.565F), new Vector3(0.883F, 0.883F, 0.883F));
                AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.453F), new Vector3(0F, 90F, 0F), new Vector3(0.265F, 0.265F, 0.265F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Head", new Vector3(-0.12632F, 0.03962F, -0.03585F), new Vector3(339.427F, 188.6309F, 0F), new Vector3(0.03139F, 0.03139F, 0.03139F));
                }
                AddDisplayRule("RailgunnerBody", "GunScope", new Vector3(0F, 0.18265F, 0.3376F), new Vector3(0F, 270F, 243.3805F), new Vector3(0.02478F, 0.02478F, 0.02478F));
                AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.11444F, 0.29135F, 0.09171F), new Vector3(30.82122F, 341.6345F, 328.628F), new Vector3(0.03418F, 0.03418F, 0.03418F));
            };

            wavePrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/MicrophoneSoundwaveGhost.prefab");
            wavePrefab.AddComponent <ProjectileGhostController>();

            MysticsRisky2Utils.Utils.CopyChildren(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/MicrophoneSoundwave.prefab"), waveProjectile);
            MicrophoneSoundwaveProjectile msp = waveProjectile.AddComponent <MicrophoneSoundwaveProjectile>();

            msp.colorCurve = new AnimationCurve[]
            {
                new AnimationCurve {
                    keys = new Keyframe[] { new Keyframe(0f, 255f) }
                },
                new AnimationCurve {
                    keys = new Keyframe[] { new Keyframe(0f, 195f) }
                },
                new AnimationCurve {
                    keys = new Keyframe[] { new Keyframe(0f, 112f) }
                },
                new AnimationCurve {
                    keys = new Keyframe[] {
                        new Keyframe(0f, 0f),
                        new Keyframe(0.5f, 255f),
                        new Keyframe(1f, 0f)
                    }
                }
            };
            ProjectileController projectileController = waveProjectile.AddComponent <ProjectileController>();

            projectileController.ghostPrefab     = wavePrefab;
            projectileController.allowPrediction = true;
            waveProjectile.AddComponent <ProjectileNetworkTransform>();
            waveProjectile.AddComponent <TeamFilter>();
            ProjectileDamage projectileDamage = waveProjectile.AddComponent <ProjectileDamage>();

            projectileDamage.damageType = DamageType.Stun1s;
            HitBoxGroup hitBoxGroup = waveProjectile.AddComponent <HitBoxGroup>();

            hitBoxGroup.groupName = "MicrophoneSoundwave";
            hitBoxGroup.hitBoxes  = new HitBox[]
            {
                waveProjectile.transform.Find("Hitbox").gameObject.AddComponent <HitBox>()
            };
            ProjectileOverlapAttack projectileOverlapAttack = waveProjectile.AddComponent <ProjectileOverlapAttack>();

            projectileOverlapAttack.damageCoefficient      = 0f;
            projectileOverlapAttack.overlapProcCoefficient = 0f;
            ProjectileInflictTimedBuff projectileInflictTimedBuff = waveProjectile.AddComponent <ProjectileInflictTimedBuff>();

            projectileInflictTimedBuff.duration = duration.Value;

            MysticsItemsContent.Resources.projectilePrefabs.Add(waveProjectile);

            for (int i = 0; i < shotsPerCast; i++)
            {
                GameObject waveProjectileScaled = PrefabAPI.InstantiateClone(waveProjectile, waveProjectile.name + "Scaled" + i);
                waveProjectileScaled.transform.localScale = Vector3.one * 30f * ((i + 1f) / (float)shotsPerCast);
                if (i > 0)
                {
                    waveProjectileScaled.GetComponent <MicrophoneSoundwaveProjectile>().colorCurve[3].AddKey(new Keyframe(0.5f * (i / (float)shotsPerCast), 0f));
                }
                waveProjectilesScaled.Add(waveProjectileScaled);
                MysticsItemsContent.Resources.projectilePrefabs.Add(waveProjectileScaled);
            }

            sound           = ScriptableObject.CreateInstance <NetworkSoundEventDef>();
            sound.eventName = "MysticsItems_Play_item_use_microphone";
            MysticsItemsContent.Resources.networkSoundEventDefs.Add(sound);
        }
Beispiel #27
0
        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;
        }
Beispiel #28
0
        public static void Initialize()
        {
            hitNetworkSoundEventDef = CreateNetworkSoundEventDef(Core.Assets.HitSound);

            UrsaPlugin.networkSoundEventDefs.Add(hitNetworkSoundEventDef);
        }