public static void HandleGameMapMovementMessage(Bot bot, GameMapMovementMessage message) { if (bot.Character.Context == null) { logger.Error("Context is null as processing movement"); return; } var actor = bot.Character.Context.GetContextActor(message.actorId); if (actor == null) logger.Error("Actor {0} not found", message.actorId); // only a log for the moment until context are fully handled else { var path = Path.BuildFromServerCompressedPath(bot.Character.Map, message.keyMovements); if (path.IsEmpty()) { logger.Warn("Try to start moving with an empty path"); return; } var movement = new MovementBehavior(path, actor.GetAdaptedVelocity(path)); movement.Start(DateTime.Now + TimeSpan.FromMilliseconds(EstimatedMovementLag)); actor.NotifyStartMoving(movement); } }
public static void HandleGameMapMovementMessage(Bot bot, GameMapMovementMessage message) { var actor = bot.Character.Map.GetActor(message.actorId); if (actor == null) logger.Error("Actor {0} not found", message.actorId); // only a log for the moment until context are fully handled else actor.NotifyStartMoving(Path.BuildFromServerCompressedPath(bot.Character.Map, message.keyMovements)); }
public static void HandleGameMapMovementMessage(Bot bot, GameMapMovementMessage message) { if (bot.Character == null || bot.Character.Context == null) { logger.Error("Context is null as processing movement"); return; } ContextActor actor = null; bool fightActor = false; if (bot.Character.IsFighting()) actor = bot.Character.Fight.GetActor(message.actorId); if (actor == null) actor = bot.Character.Context.GetActor(message.actorId); else fightActor = true; if (actor == null) { logger.Error("Actor {0} not found (known : {1})", message.actorId, String.Join(",", fightActor ? bot.Character.Fight.Actors : bot.Character.Context.Actors)); // only a log for the moment until context are fully handled return; } // just to update the position. If in fight, better update immediately to be sure that the next action take the mouvement into account if (message.keyMovements.Length == 1) { actor.UpdatePosition(message.keyMovements[0]); } else { Path path = Path.BuildFromServerCompressedPath(bot.Character.Map, message.keyMovements); if (path.IsEmpty()) { logger.Warn("Try to start moving with an empty path"); return; } var movement = new MovementBehavior(path, actor.GetAdaptedVelocity(path)); movement.Start(DateTime.Now + TimeSpan.FromMilliseconds(EstimatedMovementLag)); actor.NotifyStartMoving(movement); } }
public void HandleGameMapMovementMessage(Bot bot, GameMapMovementMessage message) { if (message.actorId == PartyLeaderId && Character.Id != message.actorId) { //foreach (FFight ffight in GetOtherFFights().Where(plug => Party != null && Party.Any(member => member.id == plug.Character.Id))) if (message.keyMovements.Length > 0) { LastLeaderCell = message.keyMovements.Last(); Character.SendInformation("Follow leader in {0}s : {1} => 1 cell from {2}", (500.0m * Id) / 1000.0m, Character.Cell, Character.Map.Cells[message.keyMovements.Last()]); Character.MoveIfNeededThenAction(message.keyMovements.Last(), null, 500 * Id, 1, true); } } }