Exemple #1
0
 private void CMBUpTo_Click(object sender, EventArgs e)
 {
     if (!TravianData.Villages.ContainsKey(SelectVillage))
         return;
     if (m_buildinglist.listViewBuilding.SelectedItems.Count == 0)
         return;
     var CV = TravianData.Villages[SelectVillage];
     if (TravianData.Villages[SelectVillage].isBuildingInitialized == 2)
     {
         for (int i = 0; i < m_buildinglist.listViewBuilding.SelectedItems.Count; i++)
         {
             int temp;
             if (!int.TryParse(m_buildinglist.listViewBuilding.SelectedItems[i].Text, out temp))
                 continue;
             int Bid = Convert.ToInt32(m_buildinglist.listViewBuilding.SelectedItems[i].Text);
             int Gid = CV.Buildings[Bid].Gid;
             int clevel = CV.Buildings[Bid].Level;
             int tlevel = Buildings.BuildingCost[Gid].data.Length - 1;
             if (Gid <= 4)
             {
                 if (!CV.isCapital)
                     tlevel = 10;
             }
             if (clevel >= tlevel)
                 continue;
             BuildToLevel btl = new BuildToLevel()
             {
                 BuildingName = tr.GetGidLang(Gid),
                 DisplayName = dl.GetGidLang(Gid),
                 CurrentLevel = clevel,
                 TargetLevel = tlevel,
                 mui = mui
             };
             if (btl.ShowDialog() == DialogResult.OK)
             {
                 if (btl.Return < 0)
                     continue;
                 var Q = new BuildingQueue()
                 {
                     UpCall = tr,
                     VillageID = SelectVillage,
                     Bid = Bid,
                     Gid = CV.Buildings[Bid].Gid,
                     TargetLevel = btl.Return
                 };
                 CV.Queue.Add(Q);
                 lvi(Q);
                 if (m_buildinglist.listViewBuilding.SelectedItems.Count > i)
                     m_buildinglist.listViewBuilding.SelectedItems[i].SubItems[1].Text += "!";
             }
         }
     }
 }
Exemple #2
0
        private void CMRUpgradeDefTo_Click(object sender, EventArgs e)
        {
            if (!TravianData.Villages.ContainsKey(SelectVillage))
                return;
            var CV = TravianData.Villages[SelectVillage];
            foreach (ListViewItem x in m_researchstatus.listViewUpgrade.SelectedItems)
            {
                if (x.SubItems[3].BackColor != Color.White)
                {
                    int Bid = m_researchstatus.listViewUpgrade.Items.IndexOf(x) + 1;

                    BuildToLevel btl = new BuildToLevel()
                    {
                        BuildingName = tr.GetAidLang(TravianData.Tribe, Bid),
                        DisplayName = dl.GetAidLang(TravianData.Tribe, Bid),
                        CurrentLevel = CV.Upgrades[Bid].DefenceLevel,
                        TargetLevel = CV.ArmouryLevel,
                        mui = mui
                    };
                    if (btl.ShowDialog() == DialogResult.OK)
                    {
                        if (btl.Return < 0)
                            continue;

                        var Q = new ResearchQueue
                        {
                            UpCall = tr,
                            VillageID = SelectVillage,
                            TargetLevel = btl.Return,
                            ResearchType = ResearchQueue.TResearchType.UpDefence,
                            Aid = m_researchstatus.listViewUpgrade.Items.IndexOf(x) + 1
                        };
                        CV.Queue.Add(Q);
                        lvi(Q);
                    }
                }
            }
        }