private void btnOk_Click(object sender, EventArgs e) { RaidQueue task = new RaidQueue(); task.Troops = new int[11]; for (int i = 0; i < 11; i++) { Int32.TryParse(this.txtTroops[i].Text, out task.Troops[i]); } task.Targets = new List <TPoint>(); foreach (object village in this.lstTargets.Items) { task.Targets.Add((TPoint)village); } task.RaidType = RaidType.Reinforce + this.SelectedRadioButtonIndex(this.rdbRaidTypes); task.SpyOption = SpyOption.Resource + this.SelectedRadioButtonIndex(this.rdbSpyOptions); task.MaxCount = Convert.ToInt32(this.nudCount.Value); task.MaxSlots = Convert.ToInt32(this.nudMaxSlots.Value); task.MultipeRaids = this.ckbMultipleRaids.Checked; task.Description = tbDesc.Text; this.Return = task; }
public void TestInitialize() { this.travianData = new Data() { Server = "none", Username = "******" }; Dictionary <string, string> Options = new Dictionary <string, string>(); this.travian = new Travian(travianData, Options); this.villageID = 1; this.village = new TVillage(); this.travianData.Villages[villageID] = village; this.village.Name = "Home"; this.village.isTroopInitialized = 2; this.village.Troop = this.troop = new TTroop(); int[] troopsAtHome = new int[11]; troopsAtHome[0] = 8; TTInfo troopAtHome = new TTInfo { Troops = troopsAtHome, Owner = this.village.Name, TroopType = TTroopType.InVillage, VillageName = "Own troops" }; this.troop.Troops.Add(troopAtHome); int[] troopsOnTheRood = new int[11]; troopsOnTheRood[0] = 5; TTInfo troopOnTheRoad = new TTInfo { Troops = troopsAtHome, TroopType = TTroopType.MyReturnWay, FinishTime = DateTime.Now.AddSeconds(100), VillageName = "Raid on abc Village" }; this.troop.Troops.Add(troopOnTheRoad); this.troops = new int[11]; this.troops[0] = 5; this.targets = new List <TPoint>(); this.targets.Add(new TPoint(1, 2)); this.targets.Add(new TPoint(0, 0)); this.target = new RaidQueue() { UpCall = this.travian, VillageID = this.villageID, Troops = this.troops, Targets = this.targets, RaidType = RaidType.AttackRaid, }; this.pageQuerier = new MockPageQuerier(this.villageID); this.travian.pageQuerier = pageQuerier; }