Ejemplo n.º 1
0
 public override void DealEnvironmentalDamage(EnviromentalDamageType dmgType, int amount)
 {
     base.DealEnvironmentalDamage(dmgType, amount);
     if (!IsAlive)
     {
         Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.DeathsFrom, (uint)dmgType, 1);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Is called whenever a Character moves
        /// </summary>
        public override void OnMove()
        {
            base.OnMove();

            if (m_standState != StandState.Stand)
            {
                StandState = StandState.Stand;
            }

            if (m_currentRitual != null)
            {
                m_currentRitual.Remove(this);
            }

            if (IsTrading && !IsInRadius(m_tradeWindow.OtherWindow.Owner, TradeMgr.MaxTradeRadius))
            {
                m_tradeWindow.Cancel(TradeStatus.TooFarAway);
            }

            var now = Environment.TickCount;

            if (m_fallStart > 0 && now - m_fallStart > 3000 && m_position.Z == LastPosition.Z)
            {
                if (IsAlive && Flying == 0 && Hovering == 0 && FeatherFalling == 0 && !IsImmune(DamageSchool.Physical))
                {
                    var fallDamage = FallDamageGenerator.GetFallDmg(this, m_fallStartHeight - m_position.Z);

                    if (fallDamage > 0)
                    {
                        // If the character current health is higher then the fall damage, the player survived the fall.
                        if (fallDamage < Health)
                        {
                            Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.FallWithoutDying, (uint)(m_fallStartHeight - m_position.Z));
                        }
                        //	DoEnvironmentalDamage(EnviromentalDamageType.Fall, fallDamage);
                    }

                    m_fallStart       = 0;
                    m_fallStartHeight = 0;
                }
            }

            // TODO: Change speedhack detection
            // TODO: Check whether the character is really in Taxi
            if (SpeedHackCheck)
            {
                var msg = "You have been identified as a SpeedHacker. - Byebye!";

                // simple SpeedHack protection
                int latency = Client.Latency;
                int delay   = now - m_lastMoveTime + Math.Max(1000, latency);

                float speed       = Flying > 0 ? FlightSpeed : RunSpeed;
                float maxDistance = (speed / 1000f) * delay * SpeedHackToleranceFactor;
                if (!IsInRadius(ref LastPosition, maxDistance))
                {
                    // most certainly a speed hacker
                    log.Warn("WARNING: Possible speedhacker [{0}] moved {1} yards in {2} milliseconds (Latency: {3}, Tolerance: {4})",
                             this, GetDistance(ref LastPosition), delay, latency, SpeedHackToleranceFactor);
                }

                Kick(msg);
            }

            LastPosition = MoveControl.Mover.Position;
        }