Exemplo n.º 1
0
 public void Update(GameFightSynchronizeMessage msg)
 {
     if (msg == null)
     {
         throw new ArgumentNullException("msg");
     }
     RefreshTimeLine(msg.fighters.Select(x => x.contextualId));
 }
Exemplo n.º 2
0
 public void HandleGameFightSynchronizeMessage(Bot bot, GameFightSynchronizeMessage message)
 {
     if (bot == null || bot.Character == null || bot.Character.Fight == null)
     {
         logger.Error("Fight is not properly initialized.");
         return; // Can't handle the message
     }
     bot.Character.Fight.Update(bot, message);
 }
Exemplo n.º 3
0
        public void Update(GameFightSynchronizeMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }
            var timeLine = msg.fighters.Select(entry => Fight.GetFighter(entry.contextualId));

            m_fighters.Clear();
            m_fighters.AddRange(timeLine);
        }
Exemplo n.º 4
0
 public static void HandleGameFightSynchronizeMessage(Bot bot, GameFightSynchronizeMessage message)
 {
     if (!bot.Character.IsFighting())
     {
         logger.Error("Received GameFightSynchronizeMessage but character is not in fight !");
     }
     else
     {
         bot.Character.Fight.Update(message);
     }
 }
 private void HandleCharacterSelectedSuccessMessages(GameFightSynchronizeMessage message, ConnectedHost source)
 {
     foreach (GameFightFighterInformations infos in message.fighters)
     {
         if (infos.contextualId == source.Bot.Game.Player.PlayerBaseInformations.Id)
         {
             Stats = infos.stats;
         }
     }
     OnUpdated();
 }
Exemplo n.º 6
0
 private void HandleGameFightSynchronizeMessage(IAccount account, GameFightSynchronizeMessage message)
 {
     lock (CheckLock)
     {
         Fighters.Clear();
         Monsters.Clear();
         Companions.Clear();
         foreach (var fighter in message.Fighters)
         {
             AddFighter(fighter);
         }
     }
     Account.Character.Status = CharacterStatus.Fighting;
 }
Exemplo n.º 7
0
        public static void GameFightSynchronizeMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameFightSynchronizeMessage msg = (GameFightSynchronizeMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.FightData.ClearFighters();
            foreach (GameFightFighterInformations i in msg.fighters)
            {
                account.FightData.AddFighter(i);
            }
        }
Exemplo n.º 8
0
        public static void GameFightSynchronizeMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameFightSynchronizeMessage msg = (GameFightSynchronizeMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (account.Fight != null)
            {
                account.Fight.Fighters.Clear();
                account.Fight.Fighters.AddRange(
                    msg.fighters.Select(f => new BFighter(f.contextualId, f.disposition.cellId, f.stats.actionPoints, f.stats, f.alive, f.stats.lifePoints, f.stats.maxLifePoints, f.stats.movementPoints, (uint)f.teamId, 0)));
            }
        }
Exemplo n.º 9
0
        public void Update(GameFightSynchronizeMessage message)
        {
            foreach (GameFightFighterInformations infos in message.fighters)
            {
                foreach (FighterModel fighter in Defenders)
                {
                    if (fighter.ContextualId == infos.contextualId)
                    {
                        fighter.Team   = (TeamEnum)infos.teamId;
                        fighter.Alive  = infos.alive;
                        fighter.CellId = infos.disposition.cellId;
                        if (fighter.Team == TeamEnum.TEAM_CHALLENGER && !Challengers.Contains(fighter))
                        {
                            Challengers.Add(fighter);
                            Defenders.Remove(fighter);
                        }
                        return;
                    }
                }
                foreach (FighterModel fighter in Challengers)
                {
                    if (fighter.ContextualId == infos.contextualId)
                    {
                        fighter.Team   = (TeamEnum)infos.teamId;
                        fighter.Alive  = infos.alive;
                        fighter.CellId = infos.disposition.cellId;

                        if (fighter.Team == TeamEnum.TEAM_CHALLENGER && !Defenders.Contains(fighter))
                        {
                            Defenders.Add(fighter);
                        }
                        Challengers.Remove(fighter);
                        return;
                    }
                }
                FighterModel ft = new FighterModel(infos.contextualId, infos.disposition.cellId, (TeamEnum)infos.teamId, this);
                if (ft.Team == TeamEnum.TEAM_DEFENDER)
                {
                    Defenders.Add(ft);
                }
                else if (ft.Team == TeamEnum.TEAM_CHALLENGER)
                {
                    Challengers.Add(ft);
                }
            }
        }
Exemplo n.º 10
0
        public void Update(GameFightSynchronizeMessage message)
        {
            message.Fighters.ForEach(f =>
            {
                var fighter = GetFighter(f.ContextualId);

                if (fighter == null)
                {
                    AddFighter(f);
                    SortFighters();
                }
                else
                {
                    fighter.Update(f);
                }
            });

            FightersUpdated?.Invoke();
        }
Exemplo n.º 11
0
        public void Update(GameFightSynchronizeMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }

            TimeLine.Update(msg);

            foreach (var info in msg.fighters)
            {
                var fighter = GetFighter(info.contextualId);

                if (fighter == null)
                {
                    logger.Error("(GameFightSynchronizeMessage) Fighter {0} not found", info.contextualId);
                }
                else
                {
                    fighter.Update(info);
                }
            }
        }
Exemplo n.º 12
0
 public static Task HandleGameFightSynchronizeMessage(Account account, GameFightSynchronizeMessage message)
 => Task.Run(() => account.Game.Fight.Update(message));
Exemplo n.º 13
0
 private void HandleMapComplementaryInformationsDataMessage(GameFightSynchronizeMessage message, ConnectedHost source)
 {
     fight.Update(message);
 }
Exemplo n.º 14
0
 private void GameFightSynchronizeMessageHandler(DofusClient client, GameFightSynchronizeMessage message)
 {
     //
 }