public static void Prefix(InventoryGui __instance, int index, bool center)
 {
     RunicPower.ClearCache();
 }
Ejemplo n.º 2
0
        public void Cast()
        {
            // letting everyone knows the caster used the rune power

            RunicPower.AddCooldown(data.name, GetCooldown());

            var cfgMessage = RunicPower.configCastingMessage.Value;
            var message    = data.name + "!";

            if (cfgMessage == RunicPower.CastingMessage.GLOBAL)
            {
                Chat.instance.SendText(Talker.Type.Shout, message);
            }
            if (cfgMessage == RunicPower.CastingMessage.NORMAL)
            {
                Chat.instance.SendText(Talker.Type.Normal, message);
            }
            if (cfgMessage == RunicPower.CastingMessage.SELF)
            {
                Chat.instance.AddInworldText(caster.gameObject, caster.GetPlayerID(), caster.GetHeadPoint(), Talker.Type.Normal, caster.name, message);
            }

            // get the effects
            var custom = data.fxcustom;

            if (data.type == "Buff")
            {
                ExecFX(RuneData.genericVFX);
                ExecFX(RuneData.genericSFX);
            }
            else
            {
                ExecFX(data.vfx);
                ExecFX(data.sfx);
            }

            // casting RECALL

            // getting the archetype skill Id and adding experience to it
            if (data.archetype != "Generic")
            {
                AddExperience(data.rank);
                RunicPower.ClearCache();
            }

            // casting RECALL
            if (custom == "recall")
            {
                var prof     = Game.instance.GetPlayerProfile();
                var location = prof.GetCustomSpawnPoint();
                if (location != null)
                {
                    this.caster.TeleportTo(location, this.caster.gameObject.transform.rotation, true);
                }
                return;
            }

            if (data.effect == null)
            {
                return;
            }

            if (data.effect.target == "projectile")
            {
                var attack = new Attack();
                attack.m_character      = caster;
                attack.m_attackHeight   = 2f;
                attack.m_attackRange    = 1f;
                attack.m_attackHitNoise = 0;
                attack.m_projectileVel  = data.projectile.speed;
                attack.GetProjectileSpawnPoint(out var spawnPoint, out var aimDir);
                aimDir = GameCamera.instance.transform.forward;
                var        hitData    = new HitData();
                var        projPrefab = ZNetScene.instance.GetPrefab(data.projectile.name);
                GameObject projGo     = UnityEngine.Object.Instantiate(projPrefab, spawnPoint, Quaternion.LookRotation(aimDir));
                var        proj       = projGo.GetComponent <IProjectile>() as Projectile;
                proj.m_gravity = 0f;
                proj.m_ttl     = (float)data.projectile.duration;
                proj.SetRune(this);
                proj.Setup(attack.m_character, aimDir * attack.m_projectileVel, attack.m_attackHitNoise, hitData, null);
            }
            else
            {
                // getting the targets
                var semans = GetTargetsAroundCharacter(data.effect.target, this.caster, GetSkilledRange(data.rangeAOE));
                foreach (var seman in semans)
                {
                    ApplyEffectOnSeman(seman);
                }
            }
        }