Esempio n. 1
0
 public static void SendChatSmileyMessage(IPacketReceiver client, ContextActor entity, short smileyId)
 {
     client.Send(new ChatSmileyMessage(
                     entity.Id,
                     smileyId,
                     0));
 }
        private static void OnStartMoving(ContextActor actor, MovementBehavior movement)
        {
            if (!AllowComparer)
            {
                return;
            }

            var bot = BotManager.Instance.GetCurrentBot();

            Task.Factory.StartNew(
                () =>
            {
                var element = movement.TimedPath.GetCurrentElement();

                bot.Character.HighlightCell(element.CurrentCell, Color.Green);

                while (!movement.IsEnded())
                {
                    var newElement = movement.TimedPath.GetCurrentElement();

                    if (element != newElement)
                    {
                        element = newElement;

                        bot.Character.ResetCellsHighlight();
                        bot.Character.HighlightCell(element.CurrentCell, Color.Green);
                    }

                    Thread.Sleep(30);
                }
            });
        }
Esempio n. 3
0
 void OnPositionChanged(ContextActor actor, ObjectPosition position)
 {
     // compare if the last cell is the same in case the actor moved by itself
     if (!actor.IsMoving() && Owner.Fight.State == FightState.Fighting)
     {
         RegisterEntry(position.Cell);
     }
 }
 public static void SendEmotePlayMessage(IPacketReceiver client, ContextActor actor, EmotesEnum emote)
 {
     client.Send(new EmotePlayMessage(
                     (byte)emote,
                     DateTime.Now.GetUnixTimeStampLong(),
                     actor.Id,
                     0
                     ));
 }
Esempio n. 5
0
        private void OnPositionChanged(ContextActor actor, ObjectPosition position)
        {
            var fighter = actor as FightActor;

            if (!CanTrigger(fighter) && !ContainsCell(actor.Cell))
            {
                Leave(fighter);
            }
        }
Esempio n. 6
0
        void OnStopMoving(ContextActor actor, Path path, bool canceled)
        {
            if (canceled)
            {
                return;
            }

            foreach (var cell in path.GetPath()) // skip the first cell (=start cell)
            {
                RegisterEntry(cell);
            }
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
 private void OnPositionChanged(ContextActor arg1, ObjectPosition arg2)
 {
     ResetMoveZone();
 }
Esempio n. 9
0
 private void StandUp(ContextActor sender, MovementBehavior path)
 {
     m_sit = false;
     Bot.Character.StartMoving -= StandUp;
 }
Esempio n. 10
0
 private void OnStopMoving(ContextActor actor, MovementBehavior movement, bool canceled, bool refused)
 {
     m_lastPath = movement.MovementPath;
 }
Esempio n. 11
0
 public static void SendGameCautiousMapMovementMessage(IPacketReceiver client, IEnumerable <short> movementsKey, ContextActor actor)
 {
     client.Send(new GameCautiousMapMovementMessage(movementsKey, actor.Id));
 }
Esempio n. 12
0
 public static void SendGameContextRefreshEntityLookMessage(IPacketReceiver client, ContextActor actor)
 {
     client.Send(new GameContextRefreshEntityLookMessage(actor.Id, actor.Look.GetEntityLook()));
 }
Esempio n. 13
0
 public static void SendShowCellMessage(IPacketReceiver client, ContextActor source, Cell cell)
 {
     client.Send(new ShowCellMessage(source.Id, cell.Id));
 }
Esempio n. 14
0
 public static void SendGameContextRemoveElementMessage(IPacketReceiver client, ContextActor actor)
 {
     client.Send(new GameContextRemoveElementMessage(actor.Id));
 }
Esempio n. 15
0
 public static void SendGameMapChangeOrientationMessage(IPacketReceiver client, ContextActor actor)
 {
     client.Send(new GameMapChangeOrientationMessage(new ActorOrientation(actor.Id,
                                                                          (sbyte)actor.Position.Direction)));
 }
Esempio n. 16
0
 public static void SendGameMapMovementMessage(IPacketReceiver client, System.Collections.Generic.IEnumerable <short> movementsKey, ContextActor actor)
 {
     client.Send(new GameMapMovementMessage(movementsKey, actor.Id));
 }