コード例 #1
0
        /// <summary>
        /// This method is important, because players could fall through air
        /// if they are on the top of a keep when it is captured because
        /// the keep size will reset
        /// </summary>
        protected void ResetPlayersOfKeep()
        {
            ushort distance = 0;
            int    id       = 0;

            if (this is GameKeepTower)
            {
                distance = 750;
                id       = 11;
            }
            else
            {
                distance = 1500;
                id       = 10;
            }


            GameKeepComponent component = null;

            foreach (GameKeepComponent c in this.KeepComponents)
            {
                if (c.Skin == id)
                {
                    component = c;
                    break;
                }
            }
            if (component == null)
            {
                return;
            }

            if (!component.HookPoints.TryGetValue(97, out var hookpoint))
            {
                return;
            }

            //predict Z
            DBKeepHookPoint hp = DOLDB <DBKeepHookPoint> .SelectObject(DB.Column("HookPointID").IsEqualTo(97).And(DB.Column("Height").IsEqualTo(Height)));

            if (hp == null)
            {
                return;
            }
            int z = component.Z + hp.Z;

            foreach (GamePlayer player in component.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                int d = hookpoint.GetDistance(player as IPoint2D);
                if (d > distance)
                {
                    continue;
                }

                if (player.Z > z)
                {
                    player.MoveTo(player.CurrentRegionID, player.X, player.Y, z, player.Heading);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// This method is important, because players could fall through air
        /// if they are on the top of a keep when it is captured because
        /// the keep size will reset
        /// </summary>
        protected void ResetPlayersOfKeep()
        {
            ushort distance = 0;
            int    id       = 0;

            if (this is GameKeepTower)
            {
                distance = 750;
                id       = 11;
            }
            else
            {
                distance = 1500;
                id       = 10;
            }


            GameKeepComponent component = null;

            foreach (GameKeepComponent c in this.KeepComponents)
            {
                if (c.Skin == id)
                {
                    component = c;
                    break;
                }
            }
            if (component == null)
            {
                return;
            }

            GameKeepHookPoint hookpoint = component.KeepHookPoints[97] as GameKeepHookPoint;

            if (hookpoint == null)
            {
                return;
            }

            //calculate target height
            int height = GameServer.KeepManager.GetHeightFromLevel(this.Level);

            //predict Z
            DBKeepHookPoint hp = GameServer.Database.SelectObjects <DBKeepHookPoint>("`HookPointID` = @HookPointID AND `Height` = @Height",
                                                                                     new[] { new QueryParameter("@HookPointID", 97), new QueryParameter("@Height", height) }).FirstOrDefault();

            if (hp == null)
            {
                return;
            }
            int z = component.Z + hp.Z;

            foreach (GamePlayer player in component.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                int d = hookpoint.GetDistance(player as IPoint2D);
                if (d > distance)
                {
                    continue;
                }

                if (player.Z > z)
                {
                    player.MoveTo(player.CurrentRegionID, player.X, player.Y, z, player.Heading);
                }
            }
        }