示例#1
0
        public static void RequestMove(WorldClient client, string packet)
        {
            if (client.Character.Fighter != null)
            {
                client.Character.Fighter.Team.Fight.PlayerWantMove(client.Character.Fighter, packet);
                return;
            }
            if (!client.Action.IsOverPod)
            {
                client.Action.EndAutoRegen();
                Engines.Pathfinding pathfinding = new Engines.Pathfinding(packet, client.Character.Map,
                                                                          client.Character.CellID, client.Character.Direction);

                int    dTest      = pathfinding.GetDistanceBetween(client.Character.CellID, pathfinding.Destination);
                string remakePath = pathfinding.GetStartPath + pathfinding.RemakePath();
                client.Character.Direction = pathfinding.NewDirection;
                client.Character.NextMove  = pathfinding.Destination;

                client.Character.Map.Engine.Send("GA0;1;" + client.Character.ID + ";" + remakePath);

                client.State = WorldClientState.OnMove;
            }
            else
            {
                client.SendImPacket("112");
                client.Send("GA;0");
            }
        }
示例#2
0
        public void PlayerWantMove(Fighter fighter, string path)
        {
            if (this.State == FightState.Fighting && this.TimeLine.CurrentFighter.ID == fighter.ID)
            {
                Engines.Pathfinding pathfinding = new Engines.Pathfinding(path, this.Map.Map,
                                                                        fighter.CellID, fighter.Dir);

                int distance = pathfinding.GetDistanceBetween(fighter.CellID, pathfinding.Destination);

                if (fighter.CurrentMP >= distance)
                {
                    string remakePath = pathfinding.GetStartPath + pathfinding.RemakePath();

                    if (fighter.ByWearFighter != null)
                    {
                        fighter.UnWear();
                    }

                    fighter.Send("GAS" + fighter.ID);
                    this.Send("GA0;1;" + fighter.ID + ";" + remakePath);

                    /* Remove MP */
                    fighter.CurrentMP -= distance;

                    fighter.NextCell = pathfinding.Destination;
                    fighter.NextDir = pathfinding.NewDirection;
                }
                else
                {
                    fighter.Send("BN");
                }
            }
            else
            {
                fighter.Send("BN");
            }
        }