Esempio n. 1
0
 public NewBuilding(Data TD, int VillageID)
 {
     InitializeComponent();
     this.dl = DisplayLang.Instance;
     for(int i = 5; i <= dl.GidLang.Count; i++)
     {
         if(i >= 31 && i <= 33 || i == 16)
             continue;
         int possible = Travian.testPossibleNewNow(TD.Tribe, TD.Villages, TD.Villages[VillageID], i, 0);
         if(possible > 0)
             comboBox1.Items.Add(i + ". " + dl.GetGidLang(i));
         else if(possible == 0)
             comboBox1.Items.Add(i + ". " + dl.GetGidLang(i) + " <--");
     }
     var Buildings = TD.Villages[VillageID].Buildings;
     for(int i = 19; i < 39; i++)
         if(!Buildings.ContainsKey(i))
             comboBox2.Items.Add(i);
     if(comboBox2.Items.Count != 0)
         comboBox2.SelectedIndex = 0;
     else
         button1.Enabled = false;
 }
Esempio n. 2
0
        public void Login()
        {
            if (tr != null)
                tr = null;
            TravianData = DB.Instance.RestoreData(LoginInfo.GetKey());
            if (TravianData == null)
                TravianData = new Data();
            TravianData.Username = LoginInfo.Username;
            TravianData.Password = LoginInfo.Password;
            TravianData.Tribe = LoginInfo.Tribe;
            TravianData.Server = LoginInfo.Server;
            if (!string.IsNullOrEmpty(LoginInfo.Proxy))
            {
                TravianData.Proxy = new WebProxy(LoginInfo.Proxy);
            }
            //if (MainForm.Options.ContainsKey("proxy"))
            //{
            //    string proxy = MainForm.Options["proxy"];
            //    TravianData.Proxy = new WebProxy(proxy);
            //}
            tr = DB.Instance.RestoreTravian(LoginInfo.Server);
            if (tr == null)
                tr = new Travian(TravianData, MainForm.Options, LoginInfo.ServerLang);
            else
            {
                tr.LoadRegexLang(LoginInfo.ServerLang);
                tr.TD = TravianData;
                tr.LoadOptions(MainForm.Options);
            }
            foreach (var v in TravianData.Villages)
            {
                v.Value.UpCall = tr;
                foreach (var q in v.Value.Queue)
                    q.UpCall = tr;
            }
            dl = new DisplayLang(LoginInfo.Language);
            DisplayLang.Instance = dl;
            tr.StatusUpdate += new EventHandler<Travian.StatusChanged>(tr_StatusUpdate);
            tr.OnError += new EventHandler<LogArgs>(tr_OnError);

            m_villagelist.listViewVillage.Items.Clear();
            m_buildinglist.listViewBuilding.Items.Clear();
            tr.CachedFetchVillages();
            UpTP.Text = string.Format("{0} @ {1}", LoginInfo.Username, LoginInfo.Server.Replace("travian.", ""));
        }
Esempio n. 3
0
        public void Login()
        {
            if (tr != null)
                tr = null;
            TravianData = DB.Instance.RestoreData(LoginInfo.GetKey());
            if (TravianData == null)
                TravianData = new Data();
            TravianData.Username = LoginInfo.Username;
            TravianData.Password = LoginInfo.Password;
            if (TravianData.Tribe == 0)
                TravianData.Tribe = LoginInfo.Tribe;
            TravianData.Server = LoginInfo.Server;
            TravianData.GetOrPostTimesThreshold = LoginInfo.GetOrPostTimesThreshold;
            TravianData.GetOrPostDelaySeconds = LoginInfo.GetOrPostDelaySeconds;
            if (MainForm.Options.ContainsKey("proxy"))
            {
                System.Net.ServicePointManager.Expect100Continue = false;
                string proxy = MainForm.Options["proxy"];
                if (proxy != "IE")
                {
                    TravianData.Proxy = new WebProxy(proxy);
                }
                else
                {
                    TravianData.Proxy = WebProxy.GetDefaultProxy();
                    TravianData.Proxy.UseDefaultCredentials = true;
                }
            }
            tr = DB.Instance.RestoreTravian(LoginInfo.Server);
            if (tr == null)
                tr = new Travian(TravianData, MainForm.Options);
            else
            {
                tr.TD = TravianData;
                tr.LoadOptions(MainForm.Options);
            }
            foreach (var v in TravianData.Villages)
            {
                v.Value.UpCall = tr;
                foreach (var q in v.Value.Queue)
                    q.UpCall = tr;
            }
            dl = new DisplayLang(LoginInfo.Language);
            DisplayLang.Instance = dl;
            tr.StatusUpdate += new EventHandler<Travian.StatusChanged>(tr_StatusUpdate);
            tr.OnError += new EventHandler<LogArgs>(tr_OnError);
            tr.OnOasisFoundLog += new EventHandler<OasisFoundLogArgs>(tr_OnOasisFoundLog);
            tr.OnAnimalsFoundLog += new EventHandler<AnimalsFoundLogArgs>(tr_OnAnimalsFoundLog);
            tr.OnAnimalsInfoUpdate += new EventHandler<AnimalsInfoArgs>(tr_OnAnimalsInfoUpdate);

            m_villagelist.listViewVillage.Items.Clear();
            m_buildinglist.listViewBuilding.Items.Clear();
            tr.CachedFetchVillages();
            UpTP.Text = string.Format("{0} @ {1}", LoginInfo.Username, LoginInfo.Server.Replace("travian.", ""));
        }