Example #1
0
 private void HandleGameFightTurnEndMessage(Bot bot, GameFightTurnEndMessage message)
 {
     if (bot.Character != null && bot.Character.Id == message.id)
     {
         CloseWindow();
     }
 }
Example #2
0
        public static void GameFightTurnEndMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameFightTurnEndMessage msg = (GameFightTurnEndMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.FightData.TurnEnded(msg.id);
        }
Example #3
0
        private void HandleGameFightTurnEndMessage(IAccount account, GameFightTurnEndMessage message)
        {
            Account.Character.Status = CharacterStatus.Fighting;
            lock (CheckLock)
            {
                if (message.ObjectId == Account.Character.Id)
                {
                    var num4 = 0;
                    var list = new List <int>();
                    IsFighterTurn = false;
                    TotalLaunchBySpell.Clear();
                    TotalLaunchByCellBySpell.Clear();

                    for (var i = 0; i < DurationByEffect.Keys.Count; i++)
                    {
                        var durationPerEffect = DurationByEffect;
                        num4 = DurationByEffect.Keys.ElementAtOrDefault(i);
                        durationPerEffect[num4] = durationPerEffect[num4] - 1;
                        if (DurationByEffect[DurationByEffect.Keys.ElementAtOrDefault(i)] <= 0)
                        {
                            list.Add(DurationByEffect.Keys.ElementAtOrDefault(i));
                        }
                    }
                    while (list.Count > 0)
                    {
                        DurationByEffect.Remove(list[0]);
                        list.RemoveAt(0);
                    }

                    for (var i = 0; i < LastTurnLaunchBySpell.Keys.Count; i++)
                    {
                        var dictionary = LastTurnLaunchBySpell;
                        num4             = LastTurnLaunchBySpell.Keys.ElementAtOrDefault(i);
                        dictionary[num4] = dictionary[num4] - 1;
                        if (LastTurnLaunchBySpell[LastTurnLaunchBySpell.Keys.ElementAtOrDefault(i)] <= 0)
                        {
                            list.Add(LastTurnLaunchBySpell.Keys.ElementAtOrDefault(i));
                        }
                    }
                    while (list.Count > 0)
                    {
                        LastTurnLaunchBySpell.Remove(list[0]);
                        list.RemoveAt(0);
                    }
                }
            }
            var fighter = (Fighter)GetFighter(message.ObjectId);

            if (fighter == null)
            {
                return;
            }
            fighter.ActionPoints   = fighter.Stats.MaxActionPoints;
            fighter.MovementPoints = fighter.Stats.MaxMovementPoints;
        }
Example #4
0
        public static void GameFightTurnEndMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameFightTurnEndMessage msg = (GameFightTurnEndMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (msg.id == account.CharacterBaseInformations.id)
            {
                int        num4 = 0;
                List <int> list = new List <int>();
                account.Fight.IsFighterTurn = false;
                account.Fight.TotalLaunchBySpell.Clear();       //Nettoyage des variables de vérification de lancement d'un sort
                account.Fight.TotalLaunchByCellBySpell.Clear(); //Nettoyage des variables de vérification de lancement d'un sort
                for (int i = 0; i < account.Fight.DurationByEffect.Keys.Count; i++)
                {
                    Dictionary <int, int> durationPerEffect = account.Fight.DurationByEffect;
                    num4 = Enumerable.ElementAtOrDefault <int>(account.Fight.DurationByEffect.Keys, i);
                    durationPerEffect[num4] = (durationPerEffect[num4] - 1);
                    if (account.Fight.DurationByEffect[Enumerable.ElementAtOrDefault <int>(account.Fight.DurationByEffect.Keys, i)] <= 0)
                    {
                        list.Add(Enumerable.ElementAtOrDefault <int>(account.Fight.DurationByEffect.Keys, i));
                    }
                }
                while (list.Count > 0)
                {
                    account.Fight.DurationByEffect.Remove(list[0]);
                    list.RemoveAt(0);
                }
                for (int i = 0; i < account.Fight.LastTurnLaunchBySpell.Keys.Count; i++)
                {
                    Dictionary <int, int> dictionary = account.Fight.LastTurnLaunchBySpell;
                    num4             = Enumerable.ElementAtOrDefault <int>(account.Fight.LastTurnLaunchBySpell.Keys, i);
                    dictionary[num4] = (dictionary[num4] - 1);
                    if (account.Fight.LastTurnLaunchBySpell[Enumerable.ElementAtOrDefault <int>(account.Fight.LastTurnLaunchBySpell.Keys, i)] <= 0)
                    {
                        list.Add(Enumerable.ElementAtOrDefault <int>(account.Fight.LastTurnLaunchBySpell.Keys, i));
                    }
                }
                while (list.Count > 0)
                {
                    account.Fight.LastTurnLaunchBySpell.Remove(list[0]);
                    list.RemoveAt(0);
                }
                account.Log(new BotTextInformation("Fin du tour"), 5);
            }
            BFighter fighter = (BFighter)account.Fight.GetFighter(msg.id);

            if (fighter != null)
            {
                fighter.ActionPoints   = fighter.GameFightMinimalStats.maxActionPoints;
                fighter.MovementPoints = fighter.GameFightMinimalStats.maxMovementPoints;
            }
        }
Example #5
0
 public static void HandleGameFightTurnEndMessage(Bot bot, GameFightTurnEndMessage message)
 {
     if (!bot.Character.IsFighting())
     {
         logger.Error("Received GameFightTurnEndMessage but character is not in fight !");
     }
     else
     {
         bot.Character.Fight.EndTurn();
     }
 }
 public void HandleGameFightTurnEndMessage(Bot bot, GameFightTurnEndMessage 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.EndTurn();
     if (message.id == bot.Character.Fighter.Id)
     {
         bot.Character.SpellsBook.EndTurn();
     }
 }
Example #7
0
        public void Update(GameFightTurnEndMessage message)
        {
            var fighter = GetFighter(message.Id);

            if (fighter == PlayedFighter)
            {
                IsOurTurn = false;
                _totalSpellLaunchs.Clear();
                _totalSpellLaunchsInCells.Clear();

                // Effects
                for (int i = _effectsDurations.Count - 1; i >= 0; i--)
                {
                    int key = _effectsDurations.ElementAt(i).Key;
                    _effectsDurations[key]--;
                    if (_effectsDurations[key] == 0)
                    {
                        _effectsDurations.Remove(key);
                    }
                }

                // Spells
                for (int i = _spellsIntervals.Count - 1; i >= 0; i--)
                {
                    int key = _spellsIntervals.ElementAt(i).Key;
                    _spellsIntervals[key]--;
                    if (_spellsIntervals[key] == 0)
                    {
                        _spellsIntervals.Remove(key);
                    }
                }

                TurnEnded?.Invoke();
            }

            fighter.Update(message);
        }
Example #8
0
 public static Task HandleGameFightTurnEndMessage(Account account, GameFightTurnEndMessage message)
 => Task.Run(() => account.Game.Fight.Update(message));
Example #9
0
 public void Update(GameFightTurnEndMessage message)
 {
     MovementPoints = Stats.MovementPoints;
     ActionPoints   = Stats.ActionPoints;
 }
Example #10
0
 private void GameFightTurnEndMessageHandler(DofusClient client, GameFightTurnEndMessage message)
 {
     client.Logger.Log("Fin du tour.", LogMessageType.FightLog);
 }