当前位置: 首页>>代码示例>>C#>>正文


C# Entities.Pullback方法代码示例

本文整理汇总了C#中Entities.Pullback方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.Pullback方法的具体用法?C# Entities.Pullback怎么用?C# Entities.Pullback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entities的用法示例。


在下文中一共展示了Entities.Pullback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Handle

        /// <summary>
        /// Handling the Jump action from GeneralDataPacket.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="General">The GeneralDataPacket.</param>
        public static void Handle(Entities.GameClient client, GeneralDataPacket General)
        {
            if (!client.Alive)
                return;
            if (client.ContainsFlag1(Enums.Effect1.IceBlock))
                return;

            if (client.Booth != null)
            {
                client.Booth.CancelBooth();
                client.Pullback();
            }

            client.Action = Enums.ActionType.None;
            client.AttackPacket = null;

            ushort JumpX = General.Data1Low;
            ushort JumpY = General.Data1High;

            if (Core.Screen.GetDistance(client.X, client.Y, JumpX, JumpY) > 28)
            {
                client.Pullback();
                return;
            }

            if (!client.Map.ValidCoord(JumpX, JumpY))
            {
                client.Pullback();
                return;
            }
            /*DateTime time = new ProjectX_V3_Lib.Time.SystemTime(General.Timestamp);
            if (client.LastMovement > time)
            {
                client.Pullback(); // speedhack
                return;
            }*/
            if (!(DateTime.Now >= client.LastMovement.AddMilliseconds(400)) && client.LastMoveJump)
            {
                client.Pullback(); // speedhack
                return;
            }

            if (client.Battle != null)
            {
                if (!client.Battle.EnterArea(client))
                {
                    client.Pullback();
                    return;
                }
                else if (!client.Battle.LeaveArea(client))
                {
                    client.Pullback();
                    return;
                }
            }

            if (Calculations.BasicCalculations.ChanceSuccess(50))
                client.Stamina += 7;

            client.LastMoveJump = true;
            client.LastMovement = DateTime.Now;
            client.LastX = client.X;
            client.LastY = client.Y;
            client.X = JumpX;
            client.Y = JumpY;
            client.SendToScreen(General, true);
            Data.AdvancedSkill.SkillInArea(client, client.X, client.Y);
        }
开发者ID:kenlacoste843,项目名称:ProjectXV3,代码行数:73,代码来源:Jump.cs

示例2: Handle

        /// <summary>
        /// Handles the movement packet.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void Handle(Entities.GameClient client, DataPacket packet)
        {
            if (client.ContainsFlag1(Enums.Effect1.IceBlock))
                return;

            client.Action = Enums.ActionType.None;
            client.AttackPacket = null;
            client.LastMoveJump = false;
            using (var move = new MovementPacket(packet))
            {
                if (move.EntityUID != client.EntityUID)
                    return;

                int NewX = 0, NewY = 0;
                int NewDir = 0;

                switch (move.WalkMode)
                {
                    case Enums.WalkMode.Run:
                    case Enums.WalkMode.Walk:
                        {
                            NewDir = (int)move.Direction % 8;
                            NewX = client.X + DeltaX[NewDir];
                            NewY = client.Y + DeltaY[NewDir];
                            break;
                        }
                    case Enums.WalkMode.Mount:
                        {
                            NewDir = (int)move.Direction % 24;
                            NewX = client.X + DeltaMountX[NewDir];
                            NewY = client.Y + DeltaMountY[NewDir];
                            break;
                        }
                }

                if (client.Map.ValidCoord(NewX, NewY))
                {
                    client.LastX = client.X;
                    client.LastY = client.LastY;

                    client.LastMovement = DateTime.Now;
                    client.X = (ushort)NewX;
                    client.Y = (ushort)NewY;
                    client.Direction = (byte)NewDir;
                    client.SendToScreen(move, true);

                    if (client.Battle != null)
                    {
                        if (!client.Battle.EnterArea(client))
                        {
                            client.X = client.LastX;
                            client.Y = client.LastY;
                            client.Pullback();
                            return;
                        }
                        else if (!client.Battle.LeaveArea(client))
                        {
                            client.X = client.LastX;
                            client.Y = client.LastY;
                            client.Pullback();
                            return;
                        }
                    }

                    Data.AdvancedSkill.SkillInArea(client, client.X, client.Y);
                }
            }
        }
开发者ID:kenlacoste843,项目名称:ProjectXV3,代码行数:73,代码来源:MovementPacket.cs


注:本文中的Entities.Pullback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。