예제 #1
0
        /// <summary>
        /// Apply the effect.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (!(target is GamePlayer player))
            {
                return;
            }

            if (player.InCombat || GameRelic.IsPlayerCarryingRelic(player))
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GamePlayer.UseSlot.CantUseInCombat"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return;
            }

            SendEffectAnimation(player, 0, false, 1);

            UniPortalEffect effect = new UniPortalEffect(this, 1000);

            effect.Start(player);

            player.LeaveHouse();
            player.MoveTo((ushort)m_destination.RegionID, m_destination.X, m_destination.Y, m_destination.Z, (ushort)m_destination.Heading);
        }
예제 #2
0
        /// <summary>
        /// Apply the effect.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="effectiveness"></param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            GamePlayer player = Caster as GamePlayer;

            if (player == null)
            {
                return;
            }

            if (player.InCombat || GameRelic.IsPlayerCarryingRelic(player) || player.IsMoving)
            {
                return;
            }

            SendEffectAnimation(player, 0, false, 1);

            UniPortalEffect effect = new UniPortalEffect(this, 1000);

            effect.Start(player);

            DOLCharacters character = player.DBCharacter;

            player.MoveTo((ushort)character.BindRegion, character.BindXpos, character.BindYpos, character.BindZpos, (ushort)character.BindHeading);
        }
예제 #3
0
 /// <summary>
 /// Constructs a new KeepEventArgs
 /// </summary>
 public RelicPadEventArgs(GamePlayer player, GameRelic relic)
 {
     m_player = player;
     m_relic  = relic;
 }
예제 #4
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living.IsMezzed || living.IsStunned)
            {
                return(0);
            }

            double speed = living.BuffBonusMultCategory1.Get((int)property);

            if (living is GamePlayer player)
            {
                // Since Dark Age of Camelot's launch, we have heard continuous feedback from our community about the movement speed in our game. The concerns over how slow
                //              our movement is has continued to grow as we have added more and more areas in which to travel. Because we believe these concerns are valid, we have decided
                //              to make a long requested change to the game, enhancing the movement speed of all players who are out of combat. This new run state allows the player to move
                //              faster than normal run speed, provided that the player is not in any form of combat. Along with this change, we have slightly increased the speed of all
                //              secondary speed buffs (see below for details). Both of these changes are noticeable but will not impinge upon the supremacy of the primary speed buffs available
                //              to the Bard, Skald and Minstrel.
                //              - The new run speed does not work if the player is in any form of combat. All combat timers must also be expired.
                //              - The new run speed will not stack with any other run speed spell or ability, except for Sprint.
                //              - Pets that are not in combat have also received the new run speed, only when they are following, to allow them to keep up with their owners.
                double horseSpeed = player.IsOnHorse ? player.ActiveHorse.Speed * 0.01 : 1.0;
                if (speed > horseSpeed)
                {
                    horseSpeed = 1.0;
                }

                if (ServerProperties.Properties.ENABLE_PVE_SPEED)
                {
                    if (speed == 1 && !player.InCombat && !player.IsStealthed && !player.CurrentRegion.IsRvR)
                    {
                        speed *= 1.25; // new run speed is 125% when no buff
                    }
                }

                if (player.IsOverencumbered && player.Client.Account.PrivLevel < 2 && ServerProperties.Properties.ENABLE_ENCUMBERANCE_SPEED_LOSS)
                {
                    double enc = player.Encumberance; // calculating player.Encumberance is a bit slow with all those locks, don't call it much
                    if (enc > player.MaxEncumberance)
                    {
                        speed *= (((player.MaxSpeedBase * 1.0 / GamePlayer.PLAYER_BASE_SPEED) * -enc) / (player.MaxEncumberance * 0.35f)) + (player.MaxSpeedBase / GamePlayer.PLAYER_BASE_SPEED) + ((player.MaxSpeedBase / GamePlayer.PLAYER_BASE_SPEED) * player.MaxEncumberance / (player.MaxEncumberance * 0.35));
                        if (speed <= 0)
                        {
                            speed = 0;
                            player.Out.SendMessage("You are encumbered and cannot move.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                        }
                    }
                    else
                    {
                        player.IsOverencumbered = false;
                    }
                }

                if (player.IsStealthed)
                {
                    MasteryOfStealthAbility mos       = player.GetAbility <MasteryOfStealthAbility>();
                    GameSpellEffect         bloodrage = SpellHandler.FindEffectOnTarget(player, "BloodRage");
                    VanishEffect            vanish    = player.EffectList.GetOfType <VanishEffect>();

                    double stealthSpec = player.GetModifiedSpecLevel(Specs.Stealth);
                    if (stealthSpec > player.Level)
                    {
                        stealthSpec = player.Level;
                    }

                    speed *= 0.3 + (stealthSpec + 10) * 0.3 / (player.Level + 10);
                    if (vanish != null)
                    {
                        speed *= vanish.SpeedBonus;
                    }

                    if (mos != null)
                    {
                        speed *= 1 + MasteryOfStealthAbility.GetSpeedBonusForLevel(mos.Level);
                    }

                    if (bloodrage != null)
                    {
                        speed *= 1 + (bloodrage.Spell.Value * 0.01); // 25 * 0.01 = 0.25 (a.k 25%) value should be 25.
                    }
                }

                if (GameRelic.IsPlayerCarryingRelic(player))
                {
                    if (speed > 1.0)
                    {
                        speed = 1.0;
                    }

                    horseSpeed = 1.0;
                }

                if (player.IsSprinting)
                {
                    speed *= 1.3;
                }

                speed *= horseSpeed;
            }
            else if (living is GameNPC)
            {
                if (!living.InCombat)
                {
                    if (((GameNPC)living).Brain is IControlledBrain brain)
                    {
                        GameLiving owner = brain.GetLivingOwner();
                        if (owner != null)
                        {
                            if (owner == brain.Body.CurrentFollowTarget)
                            {
                                speed *= 1.25;

                                double ownerSpeedAdjust = owner.MaxSpeed / (double)GamePlayer.PLAYER_BASE_SPEED;

                                if (ownerSpeedAdjust > 1.0)
                                {
                                    speed *= ownerSpeedAdjust;
                                }

                                if (owner is GamePlayer && (owner as GamePlayer).IsOnHorse)
                                {
                                    speed *= 1.45;
                                }
                            }
                        }
                    }
                }

                double healthPercent = living.Health / (double)living.MaxHealth;
                if (healthPercent < 0.33)
                {
                    speed *= 0.2 + healthPercent * (0.8 / 0.33); // 33%hp=full speed 0%hp=20%speed
                }
            }

            speed = living.MaxSpeedBase * speed + 0.5; // 0.5 is to fix the rounding error when converting to int so root results in speed 2 (191*0.01=1.91+0.5=2.41)

            GameSpellEffect iConvokerEffect = SpellHandler.FindEffectOnTarget(living, "SpeedWrap");

            if (iConvokerEffect != null && living.EffectList.GetOfType <ChargeEffect>() == null)
            {
                if (living.EffectList.GetOfType <SprintEffect>() != null && speed > 248)
                {
                    return(248);
                }

                if (speed > 191)
                {
                    return(191);
                }
            }

            if (speed < 0)
            {
                return(0);
            }

            return((int)speed);
        }
        public void HandlePacket(GameClient client, GSPacketIn packet)
        {
            int code     = packet.ReadByte();
            int RealmMap = packet.ReadByte();
            int keepId   = packet.ReadByte();

            if (client == null || client.Player == null)
            {
                return;
            }

            //hack fix new keep ids
            else if ((int)client.Version >= (int)GameClient.eClientVersion.Version190 && (int)client.Version < (int)GameClient.eClientVersion.Version1115)
            {
                if (keepId >= 82)
                {
                    keepId -= 7;
                }
                else if (keepId >= 62)
                {
                    keepId -= 12;
                }
            }

            switch (code)
            {
            //warmap open
            //warmap update
            case 0:
            {
                client.Player.WarMapPage = (byte)RealmMap;
                break;
            }

            case 1:
            {
                client.Out.SendWarmapUpdate(GameServer.KeepManager.GetKeepsByRealmMap(client.Player.WarMapPage));
                WarMapMgr.SendFightInfo(client);
                break;
            }

            //teleport
            case 2:
            {
                client.Out.SendWarmapUpdate(GameServer.KeepManager.GetKeepsByRealmMap(client.Player.WarMapPage));
                WarMapMgr.SendFightInfo(client);

                if (client.Account.PrivLevel == (int)ePrivLevel.Player &&
                    (client.Player.InCombat || client.Player.CurrentRegionID != 163 || GameRelic.IsPlayerCarryingRelic(client.Player)))
                {
                    return;
                }

                AbstractGameKeep keep = null;

                if (keepId > 6)
                {
                    keep = GameServer.KeepManager.GetKeepByID(keepId);
                }

                if (keep == null && keepId > 6)
                {
                    return;
                }

                if (client.Account.PrivLevel == (int)ePrivLevel.Player)
                {
                    bool found = false;

                    if (keep != null)
                    {
                        // if we are requesting to teleport to a keep we need to check that keeps requirements first

                        if (keep.Realm != client.Player.Realm)
                        {
                            return;
                        }

                        if (keep is GameKeep && ((keep as GameKeep).OwnsAllTowers == false || keep.InCombat))
                        {
                            return;
                        }

                        // Missing: Supply line check
                    }

                    if (client.Player.CurrentRegionID == 163)
                    {
                        // We are in the frontiers and all keep requirements are met or we are not near a keep
                        // this may be a portal stone in the RvR village, for example

                        foreach (GameStaticItem item in client.Player.GetItemsInRadius(WorldMgr.INTERACT_DISTANCE))
                        {
                            if (item is FrontiersPortalStone)
                            {
                                found = true;
                                break;
                            }
                        }
                    }

                    if (!found)
                    {
                        client.Player.Out.SendMessage("You cannot teleport unless you are near a valid portal stone.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                        return;
                    }
                }

                int    x       = 0;
                int    y       = 0;
                int    z       = 0;
                ushort heading = 0;
                switch (keepId)
                {
                //sauvage
                case 1:
                //snowdonia
                case 2:
                //svas
                case 3:
                //vind
                case 4:
                //ligen
                case 5:
                //cain
                case 6:
                {
                    GameServer.KeepManager.GetBorderKeepLocation(keepId, out x, out y, out z, out heading);
                    break;
                }

                default:
                {
                    if (keep != null && keep is GameKeep)
                    {
                        FrontiersPortalStone stone = keep.TeleportStone;
                        if (stone != null)
                        {
                            heading = stone.Heading;
                            z       = stone.Z;
                            stone.GetTeleportLocation(out x, out y);
                        }
                        else
                        {
                            x       = keep.X;
                            y       = keep.Y;
                            z       = keep.Z + 150;
                            heading = keep.Heading;
                        }
                    }
                    break;
                }
                }

                if (x != 0)
                {
                    client.Player.MoveTo(163, x, y, z, heading);
                }

                break;
            }
            }
        }