Esempio n. 1
0
        /// <summary>
        /// Place the character according to the AI positioning.
        /// </summary>
        public void PlaceCharacter(List<short> PlacementCells)
        {
            m_error = 0;
            m_Account.Log(new BotTextInformation("Placement du personnage."),5);
            try
            {
                PlacementEnum position = m_AI.GetPositioning();
                int distance = -1;
                int cell = -1;
                Dictionary<int, int> cells = new Dictionary<int, int>();
                foreach (short tempCell in PlacementCells)
                {
                    int tempDistance = 0;
                    MapPoint cellPoint = new MapPoint(Convert.ToInt32(tempCell));
                    foreach (BFighter fighter in m_Data.Fighters)
                    {
                        MapPoint fighterPoint = new MapPoint(fighter.CellId);
                        tempDistance += cellPoint.DistanceToCell(fighterPoint);
                    }

                    switch (position)
                    {
                        case PlacementEnum.Eloigné:
                        case PlacementEnum.Far:
                            if (distance < tempDistance || distance == -1)
                            {
                                distance = tempDistance;
                                cell = Convert.ToInt32(tempCell);
                            }
                            break;
                        case PlacementEnum.Near:
                        case PlacementEnum.Rapproché:
                            if (distance > tempDistance || distance == -1 || tempDistance == 1)
                            {
                                distance = tempDistance;
                                cell = Convert.ToInt32(tempCell);
                            }
                            break;
                    }
                }
                if (cell != -1)
                {
                        GameFightPlacementPositionRequestMessage msg = new GameFightPlacementPositionRequestMessage((short)cell);
                        m_Account.SocketManager.Send(msg);
                }
            }
            catch (Exception ex)
            {
                m_Account.Log(new ErrorTextInformation(ex.Message),0);
            }
        }
Esempio n. 2
0
        public void PlaceCharacter()
        {
            m_Account.Log(new BotTextInformation("Placement du personnage"),5);
            try
            {
                int distance = -1;
                int cell = -1;
                Dictionary<int, int> cells = new Dictionary<int, int>();
                foreach (uint tempCell in PlacementCells)
                {
                    int tempDistance = 0;
                    MapPoint cellPoint = new MapPoint(Convert.ToInt32(tempCell));
                    foreach (BFighter fighter in Fighters)
                    {
                        MapPoint fighterPoint = new MapPoint(fighter.CellId);
                        tempDistance += cellPoint.DistanceToCell(fighterPoint);
                    }

                    if (m_Conf.Placement == PlacementEnum.Eloigné)
                    {
                        if (distance < tempDistance || distance == -1)
                        {
                            distance = tempDistance;
                            cell = Convert.ToInt32(tempCell);
                        }
                    }
                    else if (m_Conf.Placement == PlacementEnum.Rapproché)
                    {
                        if (distance > tempDistance || distance == -1 || tempDistance == 1)
                        {
                            distance = tempDistance;
                            cell = Convert.ToInt32(tempCell);
                        }
                    }
                }

                if (cell != -1)
                {
                        GameFightPlacementPositionRequestMessage msg = new GameFightPlacementPositionRequestMessage((short)cell);
                        m_Account.SocketManager.Send(msg);
                }
            }
            catch (Exception ex)
            {
                m_Account.Log(new ErrorTextInformation(ex.Message),0);
            }
        }