示例#1
0
        private void SaveData()
        {
            string data = "#VILKEN BRA FIL" + Environment.NewLine;

            data += "servers:" + Environment.NewLine;
            foreach (var o in cbServer.Items)
            {
                data += o.ToString() + Environment.NewLine;
            }

            data += "accounts:" + Environment.NewLine;
            foreach (var o in cbEmail.Items)
            {
                data += o.ToString() + "\t";
                if (passwordList.ContainsKey(o.ToString()))
                {
                    data += BotUtility.rot13(passwordList[o.ToString()]);
                }

                data += Environment.NewLine;
            }

            data += "worlds:" + Environment.NewLine;
            foreach (var o in cbWorldId.Items)
            {
                data += o.ToString() + Environment.NewLine;
            }

            StreamWriter writer;

            if (File.Exists("roomData.1337"))
            {
                writer = new StreamWriter("roomData.1337");
            }
            else
            {
                writer = new StreamWriter(File.Create("roomData.1337"));
            }
            writer.Write(data);
            writer.Close();
        }
示例#2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Invoke(new Action(() =>
            {
                List <SubBots.TaskData> deadTasks = bot.subBotHandler.Update((int)nudTaskTimeLimit.Value);

                foreach (var o in deadTasks)
                {
                    if (o.stopwatch.ElapsedMilliseconds / 1000 > nudTaskAbortLimit.Value)
                    {
                        if (BotUtility.isTaskRunning(o.task))//(o.task.IsCompleted == false || o.task.Status == TaskStatus.Running || o.task.Status == TaskStatus.WaitingToRun || o.task.Status == TaskStatus.WaitingForActivation)
                        {
                            o.task.Dispose();
                        }
                    }
                }

                {
                    foreach (var o in deadTasks)
                    {
                        lbTasks.Items.Add(o);
                    }
                }

                for (int i = 0; i < lbTasks.Items.Count; i++)
                {
                    SubBots.TaskData t = (SubBots.TaskData)lbTasks.Items[0];
                    lbTasks.Items.RemoveAt(0);


                    if ((t.task.IsCompleted == false || t.task.Status == TaskStatus.Running || t.task.Status == TaskStatus.WaitingToRun || t.task.Status == TaskStatus.WaitingForActivation))
                    {
                        lbTasks.Items.Add(t);
                    }
                }
            }));
        }
示例#3
0
 private static int getXpRequired(int level)
 {
     return(BotUtility.Fibonacci(level + 2) * 8);
 }
示例#4
0
        private void LoadData()
        {
            if (!File.Exists("roomData.1337"))
            {
                return;
            }

            StreamReader reader = new StreamReader("roomData.1337");
            string       type   = "boring";

            while (!reader.EndOfStream)//foreach (string s in data)
            {
                string s = reader.ReadLine();

                if (s == "servers:" || s == "accounts:" || s == "worlds:")
                {
                    type = s;
                }
                else
                {
                    switch (type)
                    {
                    case "servers:":
                        cbServer.Items.Add(s);
                        break;

                    case "accounts:":
                    {
                        string[] pair     = s.Split('\t');
                        string   username = pair[0];
                        string   password;
                        if (pair.Count() >= 2)
                        {
                            password = BotUtility.rot13(pair[1]);
                        }
                        else
                        {
                            password = "";
                        }

                        passwordList.Add(username, password);
                        cbEmail.Items.Add(username);
                    }
                    break;

                    case "worlds:":
                        cbWorldId.Items.Add(s);
                        break;
                    }
                }
            }

            reader.Close();

            if (cbServer.Items.Count >= 1)
            {
                cbServer.Text = cbServer.Items[0].ToString();
            }
            else
            {
                cbServer.Text = "everybody-edits-su9rn58o40itdbnw69plyw";
                cbServer.Items.Add("everybody-edits-su9rn58o40itdbnw69plyw");
            }

            if (cbEmail.Items.Count >= 1)
            {
                cbEmail.Text = cbEmail.Items[0].ToString();
                if (passwordList.ContainsKey(cbEmail.Items[0].ToString()))
                {
                    tbPassword.Text = passwordList[cbEmail.Items[0].ToString()];
                }
            }
            else
            {
                cbEmail.Text    = "";
                tbPassword.Text = "";
            }
            if (cbWorldId.Items.Count >= 1)
            {
                cbWorldId.Text = cbWorldId.Items[0].ToString();
            }
            else
            {
                cbWorldId.Text = "";
            }
        }