Exemplo n.º 1
0
        private void HandleGameMapMovementMessage(IAccount account, GameMapMovementMessage message)
        {
            lock (CheckLock)
            {
                var clientMovement =
                    MapMovementAdapter.GetClientMovement(message.KeyMovements.Select(s => (uint)s).ToList());

                if (Players.Find(x => x.Id == message.ActorId) != null)
                {
                    Players.Find(x => x.Id == message.ActorId).CellId = clientMovement.CellEnd.CellId;
                }
                if (Entities.Find(x => x.Id == message.ActorId) != null)
                {
                    Entities.Find(x => x.Id == message.ActorId).CellId = clientMovement.CellEnd.CellId;
                }
                if (Monsters.Find(x => x.Id == message.ActorId) != null)
                {
                    Monsters.Find(x => x.Id == message.ActorId).CellId = clientMovement.CellEnd.CellId;
                }

                if (message.ActorId == account.Character.Id)
                {
                    account.Character.CellId = clientMovement.CellEnd.CellId;
                }
            }

            UpdateMapControl();

            OnMapMovement(message);
        }
Exemplo n.º 2
0
Arquivo: Map.cs Projeto: Teles1/Cookie
        private void HandleGameMapMovementMessage(IAccount account, GameMapMovementMessage message)
        {
            // The player has moved.
            Console.WriteLine($"GameMapMovementMessage[{message.ActorId}]CharacterId[{account.Character.Id}]");
            lock (CheckLock)
            {
                var clientMovement = MapMovementAdapter.GetClientMovement(message.KeyMovements.Select(s => (uint)s).ToList());
                if (message.ActorId == account.Character.Id)
                {
                    account.Character.CellId = clientMovement.CellEnd.CellId;
                }
                else if (Players.Find(x => x.Id == message.ActorId) != null)
                {
                    Players.Find(x => x.Id == message.ActorId).CellId = clientMovement.CellEnd.CellId;
                }
                else if (Entities.Find(x => x.Id == message.ActorId) != null)
                {
                    Entities.Find(x => x.Id == message.ActorId).CellId = clientMovement.CellEnd.CellId;
                }
                else if (Monsters.Find(x => x.Id == message.ActorId) != null)
                {
                    Monsters.Find(x => x.Id == message.ActorId).CellId = clientMovement.CellEnd.CellId;
                }
                //else
                //Logger.Default.Log($"ActorId[{message.ActorId}] not found");
                //Monsters.Add(new MonsterGroup(new GroupMonsterStaticInformations(), message.ActorId, clientMovement.CellEnd.CellId));
            }

            UpdateMapControl();

            OnMapMovement(message);
        }
Exemplo n.º 3
0
        public static void GameMapMovementMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameMapMovementMessage msg = (GameMapMovementMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            List <uint> keys = new List <uint>();

            foreach (short s in msg.keyMovements)
            {
                keys.Add((uint)s);
            }
            MovementPath clientMovement = MapMovementAdapter.GetClientMovement(keys);

            BlueSheep.Core.Fight.Entity entity = null;
            foreach (BlueSheep.Core.Fight.Entity en in account.Map.Entities)
            {
                if (en.Id == msg.actorId)
                {
                    entity = en;
                }
            }
            if (entity != null)
            {
                (account.Map.Entities[account.Map.Entities.IndexOf(entity)]).CellId = clientMovement.CellEnd.CellId;
            }

            //GameRolePlayGroupMonsterInformations e = null;
            foreach (MonsterGroup en in account.Map.List)
            {
                if (en.m_contextualId == msg.actorId)
                {
                    en.m_cellId = clientMovement.CellEnd.CellId;
                }
            }
            //if (e != null)
            //{
            //    account.Map.List.RemoveAt(i);
            //    account.Map.List.Add(new GameRolePlayGroupMonsterInformations(msg.actorId, e.look, new EntityDispositionInformations((short)clientMovement.CellEnd.CellId, e.disposition.direction), e.keyRingBonus, e.hasHardcoreDrop, e.hasAVARewardToken, e.staticInfos, e.ageBonus, e.lootShare, e.alignmentSide));
            //}
            //if (msg.actorId == account.Map.Character.Id)
            //{
            //    account.Wait(100, 200);
            //    using (BigEndianWriter writer = new BigEndianWriter())
            //    {
            //        GameMapMovementConfirmMessage newmsg = new GameMapMovementConfirmMessage();
            //        newmsg.Serialize(writer);
            //        MessagePackaging pack = new MessagePackaging(writer);
            //        pack.Pack((int)newmsg.ProtocolID);
            //        account.SocketManager.Send(pack.Writer.Content);
            //    }
            //}
            //    if (account.Fight.flag != 0)
            //    {
            //        account.Fight.LaunchFight(account.Fight.flag);
            //    }
            //}
        }
Exemplo n.º 4
0
        private void HandleGameMapMovementMessage(IAccount account, GameMapMovementMessage message)
        {
            if (Account.Character.Status != CharacterStatus.Fighting)
            {
                return;
            }
            var clientMovement = MapMovementAdapter.GetClientMovement(message.KeyMovements.Select(k => (uint)k).ToList());
            var fighter        = (Fighter)GetFighter(message.ActorId);

            if (fighter != null)
            {
                fighter.CellId = clientMovement.CellEnd.CellId;
            }
        }
Exemplo n.º 5
0
        public static void GameMapMovementMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameMapMovementMessage msg = (GameMapMovementMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            MovementPath clientMovement = MapMovementAdapter.GetClientMovement(msg.keyMovements.Select <short, uint>(k => (uint)k).ToList());

            if (account.state == Enums.Status.Fighting)
            {
                account.FightData.UpdateFighterCell(msg.actorId, clientMovement.CellEnd.CellId);
            }
        }
Exemplo n.º 6
0
Arquivo: Map.cs Projeto: Bia10/Cookie
 private void HandleGameMapMovementMessage(IAccount account, GameMapMovementMessage message)
 {
     lock (CheckLock)
     {
         var clientMovement =
             MapMovementAdapter.GetClientMovement(message.KeyMovements.Select(s => (uint)s).ToList());
         var entity = Entities.FirstOrDefault(e => e.Id == message.ActorId);
         if (entity != null)
         {
             ((Entity.Entity)Entities[Entities.IndexOf(entity)]).CellId = clientMovement.CellEnd.CellId;
         }
         if (message.ActorId == account.Character.Id)
         {
             account.Character.CellId = clientMovement.CellEnd.CellId;
         }
     }
     OnMapMovement(message);
 }
Exemplo n.º 7
0
        public static void GameMapMovementMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameMapMovementMessage msg = (GameMapMovementMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            MovementPath clientMovement = MapMovementAdapter.GetClientMovement(msg.keyMovements.Select <short, uint>(k => (uint)k).ToList());

            if (account.state == Enums.Status.Fighting)
            {
                BFighter fighter = account.Fight.GetFighter(msg.actorId);
                if (fighter != null)
                {
                    //account.Log(new BotTextInformation("GameMap Ancienne cellid of " + fighter.Id + " = " + fighter.CellId));
                    fighter.CellId = clientMovement.CellEnd.CellId;
                    //account.Log(new BotTextInformation("GameMap Nouvelle cellid of " + fighter.Id + " = " + fighter.CellId));
                }
            }
        }
Exemplo n.º 8
0
        public static void GameMapMovementMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameMapMovementMessage msg = (GameMapMovementMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            List <uint> keys = new List <uint>();

            foreach (short s in msg.keyMovements)
            {
                keys.Add((uint)s);
            }
            MovementPath clientMovement = MapMovementAdapter.GetClientMovement(keys);

            account.MapData.UpdateEntityCell(msg.actorId, clientMovement.CellEnd.CellId);
            if (account.Map.Moving && msg.actorId == account.MapData.Character.contextualId)
            {
                account.Map.ConfirmMove();
            }
        }