Example #1
0
        public void Update(GameFightPlacementPossiblePositionsMessage message)
        {
            PositionsForChallengers = message.PositionsForChallengers.Select(c => (short)c).ToList();
            PositionsForDefenders   = message.PositionsForDefenders.Select(c => (short)c).ToList();

            PossiblePositionsReceived?.Invoke();
        }
Example #2
0
        public static void GameFightPlacementPossiblePositionsMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameFightPlacementPossiblePositionsMessage msg = (GameFightPlacementPossiblePositionsMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.SetStatus(Status.Fighting);
            if (account.Fight != null)
            {
                account.Fight.PlacementCells = msg.positionsForChallengers.ToList();
                account.Fight.TurnId         = 0;
                if (account.Fight.m_Conf.Tactic != BlueSheep.Core.Fight.TacticEnum.Immobile)
                {
                    account.Fight.PlaceCharacter();
                }
            }
            //account.Fight.PerformAutoTimeoutFight(3000);
            //if (account.IsMITM)
            // account.Fight.PerformAutoTimeoutFight(3000);
            if (account.WithItemSetBox.Checked == true)
            {
                sbyte id = (sbyte)account.PresetStartUpD.Value;
                InventoryPresetUseMessage msg2 = new InventoryPresetUseMessage((sbyte)(id - 1));
                account.SocketManager.Send(msg2);
                account.Log(new ActionTextInformation("Equipement rapide numero " + Convert.ToString(id)), 5);
                account.Fight.PerformAutoTimeoutFight(500);
            }
            //LaunchWatch()
            GameFightReadyMessage nmsg = new GameFightReadyMessage(true);

            account.SocketManager.Send(nmsg);
            account.Log(new BotTextInformation("Send Ready !"), 5);
        }
Example #3
0
        public static void GameFightPlacementPossiblePositionsMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameFightPlacementPossiblePositionsMessage msg = (GameFightPlacementPossiblePositionsMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.SetStatus(Status.Fighting);
            account.FightData.UpdateTurn(0);
            if (account.Fight != null)
            {
                account.Fight.PlaceCharacter(msg.positionsForChallengers.ToList());
            }
            if (account.WithItemSetBox.Checked == true)
            {
                sbyte id = (sbyte)account.PresetStartUpD.Value;
                InventoryPresetUseMessage msg2 = new InventoryPresetUseMessage((sbyte)(id - 1));
                account.SocketManager.Send(msg2);
                account.Log(new ActionTextInformation("Equipement rapide numero " + Convert.ToString(id)), 5);
            }
            GameFightReadyMessage nmsg = new GameFightReadyMessage(true);

            account.SocketManager.Send(nmsg);
            account.Log(new BotTextInformation("Send Ready !"), 5);
        }
 public void HandleGameFightPlacementPossiblePositionsMessage(Bot bot, GameFightPlacementPossiblePositionsMessage message)
 {
     if (bot == null || bot.Character == null)
     {
         logger.Error("Character is not properly initialized.");
         return; // Can't handle the message
     }
     bot.Character.Update(message);
 }
 public void Update(GameFightPlacementPossiblePositionsMessage msg)
 {
     if (msg == null)
     {
         throw new ArgumentException("msg");
     }
     Fighter.SetTeam(Fight.GetTeam((FightTeamColor)msg.teamNumber));
     Fight.Update(msg);
 }
Example #6
0
        public void Update(GameFightPlacementPossiblePositionsMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentException("msg");
            }

            RedTeam.Update(msg);
            BlueTeam.Update(msg);
        }
Example #7
0
        public void Update(GameFightPlacementPossiblePositionsMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentException("msg");
            }

            m_placementCells = (Id == FightTeamColor.Red ? msg.positionsForChallengers : msg.positionsForDefenders).
                               Select(entry => Fight.Map.Cells[entry]).ToArray();
        }
Example #8
0
 public static void HandleGameFightPlacementPossiblePositionsMessage(Bot bot, GameFightPlacementPossiblePositionsMessage message)
 {
     if (!bot.Character.IsFighting())
     {
         logger.Error("Received GameFightPlacementPossiblePositionsMessage but character is not in fight !");
     }
     else
     {
         bot.Character.Update(message);
     }
 }
        public void Update(GameFightPlacementPossiblePositionsMessage msg)
        {
            if (msg == null)
            {
                throw new ArgumentException("msg");
            }

            if (Fighter.Team == null)
            {
                // it's a bit tricky ...
                Fighter.SetTeam(Fight.GetTeam((FightTeamColor)msg.teamNumber));
                Fight.AddActor(Fighter);
            }

            Fight.Update(msg);
        }
Example #10
0
 public static Task HandleGameFightPlacementPossiblePositionsMessage(Account account, GameFightPlacementPossiblePositionsMessage message)
 => Task.Factory.StartNew(async() =>
 {
     account.Game.Fight.Update(message);
     await account.Extensions.Fights.Update(message);
 }, TaskCreationOptions.LongRunning);
Example #11
0
 public void Update(GameFightPlacementPossiblePositionsMessage msg)
 {
     Placements = msg;
     playedFighter.PlayerFightInformations.TeamSide = (TeamEnum)msg.teamNumber;
 }
Example #12
0
 private void HandleMapComplementaryInformationsDataMessage(GameFightPlacementPossiblePositionsMessage message, ConnectedHost source)
 {
     fight.Phase = FightPhase.Placement;
     fight.Update(message);
     IA.Placement.Place();
 }
Example #13
0
 private void GameFightPlacementPossiblePositionsMessageHandler(DofusClient client,
                                                                GameFightPlacementPossiblePositionsMessage message)
 {
     //
 }
Example #14
0
        public async Task Update(GameFightPlacementPossiblePositionsMessage message)
        {
            // TODO: Find a better way
            // Wait a little to make sure all the ennemis are in the fight
            await Task.Delay(1000);

            // Check if we should lock the fight
            if (Configuration.LockFight)
            {
                await _account.Game.Fight.ToggleOption(FightOptionsEnum.FIGHT_OPTION_SET_CLOSED);
            }

            await Task.Delay(300);

            // Check if we should block spectator mode
            if (Configuration.BlockSpectatorScenario == BlockSpectatorScenarios.ALWAYS)
            {
                await _account.Game.Fight.ToggleOption(FightOptionsEnum.FIGHT_OPTION_SET_SECRET);
            }

            await Task.Delay(300);

            var possiblePositions = _account.Game.Fight.PlayedFighter.Team == TeamEnum.TEAM_CHALLENGER ?
                                    message.PositionsForChallengers.Except(_account.Game.Fight.Allies.Select(a => (uint)a.CellId)).ToList() :
                                    message.PositionsForDefenders.Except(_account.Game.Fight.Allies.Select(a => (uint)a.CellId)).ToList();

            Console.WriteLine("{0} - {1} possible positions.", _account.AccountConfig.Username, possiblePositions.Count);

            // Approach a monster
            if (!(await TryApproachingMonster(possiblePositions)))
            {
                // Approach to cast a spell
                if (!(await TryApproachingForSpell(possiblePositions)))
                {
                    // Placements
                    if (Configuration.FightStartPlacement != FightStartPlacements.STAY_STILL)
                    {
                        short cellId = _utility.GetNearestOrFarthestCell(Configuration.FightStartPlacement == FightStartPlacements.CLOSE_TO_ENNEMIS,
                                                                         possiblePositions.Select(f => (short)f));

                        // If we're not already close
                        if (cellId != _account.Game.Fight.PlayedFighter.CellId)
                        {
                            _account.Logger.LogDebug(LanguageManager.Translate("472"), LanguageManager.Translate("58", cellId));
                            await _account.Network.SendMessageAsync(new GameFightPlacementPositionRequestMessage((uint)cellId));
                        }
                        else
                        {
                            Console.WriteLine("{0} SAME CELL", _account.AccountConfig.Username);
                        }
                    }
                }
            }

            // If this account is a group chief, wait for the group members to join (or for the fight to start :/)
            if (_account.HasGroup && _account.IsGroupChief)
            {
                await _account.Group.WaitForMembersToJoinFight();

                // Group special case: If one of the members didin't join, and the fight started, there is no need to send Ready message
                if (_account.Game.Fight.IsFightStarted)
                {
                    return;
                }
            }

            await Task.Delay(300);

            await _account.Network.SendMessageAsync(new GameFightReadyMessage(true));
        }