예제 #1
0
        public static void HandleCautiousMapMovement(GameCautiousMapMovementRequestMessage message, WorldClient client)
        {
            if (client.Character.IsFighting)
            {
                Logger.Error("Client try a cautious move while fighting, aborting");
                return;
            }
            sbyte direction = PathParser.GetDirection(message.keyMovements.Last());
            short cellid    = PathParser.ReadCell(message.keyMovements.Last());

            if (client.Character.Busy)
            {
                return;
            }
            client.Character.Look.UnsetAura();
            client.Character.RefreshOnMapInstance();
            client.Character.Record.Direction = direction;
            client.Character.MovedCell        = cellid;
            client.Character.SendMap(new GameCautiousMapMovementMessage(message.keyMovements, client.Character.Id));
        }
예제 #2
0
        public static void HandleMapMovement(GameMapMovementRequestMessage message, WorldClient client)
        {
            sbyte direction = PathParser.GetDirection(message.keyMovements.Last());
            short cellid    = PathParser.ReadCell(message.keyMovements.Last());

            if (client.Character.IsFighting)
            {
                client.Character.FighterInstance.Move(message.keyMovements.ToList(), cellid, direction);
            }
            else
            {
                if (client.Character.Busy)
                {
                    return;
                }
                client.Character.Look.UnsetAura();
                client.Character.RefreshOnMapInstance();
                client.Character.Record.Direction = direction;
                client.Character.MovedCell        = cellid;
                client.Character.SendMap(new GameMapMovementMessage(message.keyMovements, client.Character.Id));
            }
        }
예제 #3
0
        public override void Execute(MonsterFighter fighter)
        {
            if (fighter.FighterStats.Stats.MovementPoints <= 0)
            {
                return;
            }

            Fighter lower = fighter.Team.LowerFighter();
            var     path  = new Pathfinder(fighter.Fight.Map, fighter.CellId);

            path.PutEntities(fighter.Fight.GetAllFighters());
            var cells = path.FindPath(lower.CellId);

            if (cells == null || cells.Count() <= 1)
            {
                return;
            }
            cells.Remove(cells.Last());
            cells.Insert(0, fighter.CellId);
            cells = cells.Take(fighter.FighterStats.Stats.MovementPoints + 1).ToList();
            sbyte direction = PathParser.GetDirection(cells.Last());

            fighter.Move(cells, cells.Last(), direction);
        }