コード例 #1
0
        public void UpdateTroopTab()
        {
            var acc  = getSelectedAcc();
            var vill = getSelectedVillage(acc);

            if (acc.AccInfo.Tribe != null)
            {
                if (vill.Troops.TroopToTrain != null)
                {
                    labelTroopsToTrain.Text = $"Selected: {VillageHelper.EnumStrToString(vill.Troops.TroopToTrain.ToString() ?? "")}";
                }
                else
                {
                    labelTroopsToTrain.Text = "Selected:";
                }

                comboBoxTroopsToTrain.Items.Clear();
                int troopsEnum = ((int)acc.AccInfo.Tribe - 1) * 10;
                for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
                {
                    Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
                    comboBoxTroopsToTrain.Items.Add(VillageHelper.EnumStrToString(troop.ToString()));
                }
                if (comboBoxTroopsToTrain.Items.Count > 0)
                {
                    comboBoxTroopsToTrain.SelectedIndex = 0;
                }
            }
            else
            {
                labelTroopsToTrain.Text = "Selected:";
                comboBoxTroopsToTrain.Items.Clear();
            }
        }
コード例 #2
0
        private void button10_Click(object sender, EventArgs e) //select troop to train
        {
            var acc           = getSelectedAcc();
            var vill          = getSelectedVillage();
            int troopsEnum    = ((int)acc.AccInfo.Tribe - 1) * 10;
            var troopSelected = troopsEnum + comboBoxTroopsToTrain.SelectedIndex + 1;

            vill.Troops.TroopToTrain = (Classificator.TroopsEnum)troopSelected;
            labelTroopsToTrain.Text  = $"Selected: {VillageHelper.EnumStrToString(vill.Troops.TroopToTrain.ToString() ?? "")}";
        }
コード例 #3
0
 private string[] GetPossibleTroops(Classificator.BuildingEnum building)
 {
     List<string> ret = new List<string>();
     ret.Add("None");
     var acc = getSelectedAcc();
     if (acc.Villages.Count == 0) return ret.ToArray(); //Acc has now been initialised
     int troopsEnum = ((int)acc.AccInfo.Tribe - 1) * 10;
     for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
     {
         Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
         if (TroopsHelper.GetTroopBuilding(troop, false) == building)
         {
             ret.Add(VillageHelper.EnumStrToString(troop.ToString()));
         }
     }
     return ret.ToArray();
 }
コード例 #4
0
        private string[] GetPossibleTroops(Classificator.BuildingEnum building)
        {
            List <string> ret = new List <string>();

            ret.Add("None");
            var acc = GetSelectedAcc();

            if (acc.Villages.Count == 0)
            {
                return(ret.ToArray());                         //Acc has now been initialised
            }
            var tribes = new List <Classificator.TribeEnum>(5);

            if (NYS.Checked)
            {
                tribes.Add(Classificator.TribeEnum.Egyptians);
                tribes.Add(Classificator.TribeEnum.Gauls);
                tribes.Add(Classificator.TribeEnum.Huns);
                tribes.Add(Classificator.TribeEnum.Romans);
                tribes.Add(Classificator.TribeEnum.Teutons);
            }
            else
            {
                tribes.Add(acc.AccInfo.Tribe ?? Classificator.TribeEnum.Any);
            }

            foreach (var tribe in tribes)
            {
                int troopsEnum = ((int)tribe - 1) * 10;
                for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
                {
                    Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
                    if (TroopsHelper.GetTroopBuilding(troop, false) == building)
                    {
                        ret.Add(VillageHelper.EnumStrToString(troop.ToString()));
                    }
                }
            }
            return(ret.ToArray());
        }
コード例 #5
0
ファイル: TroopsUc.cs プロジェクト: s3111/TravianBotSharp
        public void UpdateUc()
        {
            var acc  = GetSelectedAcc();
            var vill = GetSelectedVillage(acc);

            if (acc.AccInfo.Tribe != null)
            {
                if (vill.Troops.TroopToTrain != null)
                {
                    labelTroopsToTrain.Text = $"Selected: {VillageHelper.EnumStrToString(vill.Troops.TroopToTrain.ToString() ?? "")}";
                }
                else
                {
                    labelTroopsToTrain.Text = "Selected:";
                }

                comboBoxTroopsToTrain.Items.Clear();
                int troopsEnum = ((int)acc.AccInfo.Tribe - 1) * 10;
                for (var i = troopsEnum + 1; i < troopsEnum + 11; i++)
                {
                    Classificator.TroopsEnum troop = (Classificator.TroopsEnum)i;
                    comboBoxTroopsToTrain.Items.Add(VillageHelper.EnumStrToString(troop.ToString()));
                }
                if (comboBoxTroopsToTrain.Items.Count > 0)
                {
                    comboBoxTroopsToTrain.SelectedIndex = 0;
                }
            }
            else
            {
                labelTroopsToTrain.Text = "Selected:";
                comboBoxTroopsToTrain.Items.Clear();
            }

            // Village troops info
            string infoText = "-- Troops already researched:\n";

            infoText += string.Join(", ", vill.Troops.Researched) + "\n";
            infoText += "-- Troops to be researched:\n";
            infoText += string.Join(", ", vill.Troops.ToResearch) + "\n";
            infoText += "-- Troop smithy levels:\n";

            List <string> levels = new List <string>();

            foreach (var level in vill.Troops.Levels)
            {
                levels.Add(level.Troop + ": " + level.Level);
            }
            infoText += string.Join(", ", levels) + "\n";

            infoText += "-- Troop to be improved:\n";
            infoText += string.Join(", ", vill.Troops.ToImprove) + "\n";
            infoText += $"-- Settlers already trained: {vill.Troops.Settlers}";

            //List<string> ctStr = new List<string>();
            //foreach(var ct in vill.Troops.CurrentlyTraining.)
            //{
            //    ctStr.Add(ct.)
            //}

            troopsInfo.Text = infoText;
        }