Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using PlayerIOClient;
- using System.Text.RegularExpressions;
- using System.Threading;
- using System.Threading.Tasks;
- namespace Mightiness
- {
- public partial class Form1 : Form
- {
- List<Connection> ConnectionList = new List<Connection>();
- List<Client> ClaList = new List<Client>();
- Dictionary<int, string> Players = new Dictionary<int, string>();
- string[] Usernames = new string[] { "sc0pefurth3r@gmail.com", "sharpner67@yahoo.com", "lazyme@yahoo.com", "ham@yahoo.com", "team@yahoo.com", "plasma@yahoo.com", "jose67@yahoo.com", "tartop@yahoo.com", "star45@yahoo.com", "ray8@yahoo.com", "horsey@yahoo.com", "heray@yahoo.com", "yasin@yahoo.com", "hey124@gmail.com", "hey125@gmail.com", "hey112@gmail.com", "nis2@gmail.com", "fry3@gmail.com", "fredre@gmail.com", "pythonpython@gmail.com", "boilingbunny@gmail.com" };
- string[] Passwords = new string[] { "ExploitMe", "sharpner1234", "lazychair", "hamandcheese", "myteam", "plasma54", "jose67", "tart", "start", "road", "horsy34", "herayme", "yasona", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "123456789", "kaka", "godis", "hastighet", "kaka", "123456789", "123456789", "123456789", "bajskorv", "negerhand" };
- string[] Task = new string[200];
- bool Busy = false;
- int BlockID = 12;
- int x = 1;
- string WorldKey;
- int[,] mapdata;
- int w, h;
- static uint loc4;
- static uint loc5;
- bool inited = false;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- richtxt("[Mightiness BOT]~ Welcome, please connect all bots to the lobby", Color.DarkBlue);
- for (int i = 0; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- ConnectionList.Add(null);
- Task[i] = "READY";
- }
- }
- private void Connect2Lobby_Click(object sender, EventArgs e)
- {
- Connect2EE();
- }
- private void Connect2EE()
- {
- PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", Usernames[x], Passwords[x], LoginSuccess, LoginFail);
- }
- private string detectRoom(string room)
- {
- if (room.StartsWith("http://") || room.StartsWith("www."))
- {
- Match m0 = Regex.Match(room, @"/games/(PW|BW)+[A-f0-9_-]{3,13}", RegexOptions.IgnoreCase);
- if (m0.Success)
- {
- return Convert.ToString(m0).Substring(7);
- }
- else
- {
- Match m00 = Regex.Match(room, @"/games/OW+[A-z0-9]{1,4}-.*", RegexOptions.IgnoreCase);
- if (m00.Success)
- {
- return Convert.ToString(m00).Substring(7).Replace("-", " ");
- }
- }
- return null;
- }
- else
- {
- Match m1 = Regex.Match(room, "(PW|BW)+[A-f0-9_-]{3,13}", RegexOptions.IgnoreCase);
- if (m1.Success)
- {
- return room;
- }
- else
- {
- Match m2 = Regex.Match(room, "OW+[A-z0-9]{1,4}-.*", RegexOptions.IgnoreCase);
- if (m2.Success)
- {
- return Convert.ToString(room).Replace("-", " ");
- }
- }
- return null;
- }
- }
- private string derot(string arg1)
- {
- int num = 0;
- string str = "";
- for (int i = 0; i < arg1.Length; i++)
- {
- num = arg1[i];
- if ((num >= 0x61) && (num <= 0x7a))
- {
- if (num > 0x6d) num -= 13;
- else num += 13;
- }
- else if ((num >= 0x41) && (num <= 90))
- {
- if (num > 0x4d) num -= 13;
- else num += 13;
- }
- str = str + ((char)num);
- }
- return str;
- }
- private void LoginFail(PlayerIOClient.PlayerIOError error)
- {
- richtxt("[Mightiness BOT]~ Login Failed [" + Usernames[x] + ", " + Passwords[x] + "]: " + error.ToString(), Color.DarkRed);
- x++;
- if (x < Math.Min(Usernames.Length, Passwords.Length))
- {
- Connect2EE();
- }
- else
- {
- x = 0;
- Connect2EE();
- }
- }
- private void LoginSuccess(PlayerIOClient.Client cla)
- {
- switch (x)
- {
- case 0:
- ClaList.Insert(0, cla);
- richtxt("[Mightiness BOT]~ Sc0pefurth3r joined the lobby [MAJOR BOT]", Color.DarkGreen);
- richtxt("[Mightiness BOT]~ All bots joined the lobby, please fill in a room ID", Color.DarkGreen);
- this.Invoke(new Action(() =>
- {
- WorldID.Enabled = true;
- Connect.Enabled = true;
- }));
- break;
- default:
- richtxt("[Mightiness BOT]~ " + x + "th (" + Usernames[x] + ") bot joined the lobby [PRIVATE BOT]", Color.Green);
- ClaList.Add(cla);
- x++;
- if (x < Math.Min(Usernames.Length, Passwords.Length))
- {
- Connect2EE();
- }
- else
- {
- x = 0;
- Connect2EE();
- }
- break;
- }
- }
- delegate void Richtxt(string text, Color richtxtColor);
- private void richtxt(string text, Color richtxtColor)
- {
- if (this.richTextBox1.InvokeRequired)
- {
- Richtxt a = new Richtxt(richtxt);
- this.Invoke(a, new object[] { text, richtxtColor });
- }
- else
- {
- this.richTextBox1.SelectionColor = richtxtColor;
- this.richTextBox1.AppendText(text + Environment.NewLine);
- }
- }
- private void Connect_Click(object sender, EventArgs e)
- {
- this.Invoke(new Action(() =>
- {
- this.Size = new Size(600, 596);
- Connect2Lobby.Visible = false;
- label1.Visible = false;
- label2.Visible = false;
- WorldID.Visible = false;
- Connect.Visible = false;
- label3.Visible = true;
- OnlinePlayerList.Visible = true;
- AdminName.Visible = true;
- AddAdmin.Visible = true;
- RemoveAdmin.Visible = true;
- OnlineAdminList.Visible = true;
- AddSelectedPlayer.Visible = true;
- RemoveSelectedPlayer.Visible = true;
- SelectedPlayerList.Visible = true;
- Disconnect.Visible = true;
- groupBox1.Visible = true;
- groupBox2.Visible = true;
- groupBox3.Visible = true;
- label9.Visible = true;
- }));
- ConnectMAJOR();
- }
- private void ConnectMAJOR()
- {
- try
- {
- var Room = detectRoom(WorldID.Text);
- ConnectionList[0] = ClaList[0].Multiplayer.JoinRoom(Room, new Dictionary<string, string>());
- ConnectionList[0].Send("init");
- ConnectionList[0].Send("init2");
- ConnectionList[0].OnMessage += delegate(object sender, PlayerIOClient.Message m)
- {
- switch (m.Type)
- {
- case "init":
- WorldKey = derot(m.GetString(5));
- this.Invoke(new Action(() => label3.Text = "Players in " + m.GetString(1) + ":"));
- //richtxt("[Mightiness BOT]~ " + m.GetString(9) + " connected to room ID: " + m.GetString(1), Color.Green);
- ConnectionList[0].Send("say", "[Mightiness BOT]~ Connected to " + m.GetString(1));
- mapdata = new int[m.GetInt(12) + 1, m.GetInt(13) + 1];
- try
- {
- loc4 = 18;
- loc5 = m.Count;
- byte[] bt1 = m.GetByteArray(loc4 + 2);
- byte[] bt2 = m.GetByteArray(loc4 + 3);
- int btl1 = bt1.Length;
- int bid = m.GetInt(loc4);
- while (loc4 < loc5)
- {
- if (m[loc4].ToString() == "we")
- {
- break;
- }
- else
- {
- bid = m.GetInt(loc4);
- bt1 = m.GetByteArray(loc4 + 2);
- bt2 = m.GetByteArray(loc4 + 3);
- btl1 = bt1.Length;
- for (int n = 0; n < btl1; n += 2)
- {
- try
- {
- int x = m.GetByteArray(loc4 + 2)[n] << 8 | m.GetByteArray(loc4 + 2)[n + 1];
- int y = m.GetByteArray(loc4 + 3)[n] << 8 | m.GetByteArray(loc4 + 3)[n + 1];
- if (m.GetInt(loc4 + 1) == 0)
- {
- mapdata[x, y] = bid;
- }
- }
- catch (Exception ee)
- {
- //n = btl1;
- }
- }
- if (bid == 43 || bid == 77 || bid == 83 || bid == 1000 || bid == 165 || bid == 361 || bid >= 374 && bid <= 380 || bid == 385) { loc4 += 5; }
- else if (bid == 242 || bid == 381) { loc4 += 7; }
- else { loc4 += 4; }
- }
- }
- }
- catch { }
- inited = true;
- break;
- case "add":
- Players[m.GetInt(0)] = m.GetString(1);
- this.Invoke(new Action(() => OnlinePlayerList.Items.Add(Players[m.GetInt(0)].ToUpper())));
- this.Invoke(new Action(() => OnlinePlayerList.Refresh()));
- break;
- case "left":
- if(Players.ContainsKey(m.GetInt(0)))
- {
- this.Invoke(new Action(() => OnlinePlayerList.Items.Remove(Players[m.GetInt(0)].ToUpper())));
- this.Invoke(new Action(() => OnlinePlayerList.Refresh()));
- Players.Remove(m.GetInt(0));
- }
- break;
- case "info":
- richtxt("[Mightiness BOT]~ INFO: " + m.GetString(1), Color.DarkOrange);
- break;
- case "say":
- try
- {
- string Player = Players[m.GetInt(0)].ToUpper();
- string Message = m.GetString(1);
- if (Message.StartsWith("*"))
- {
- if (OnlineAdminList.Items.Contains(Player))
- {
- ConnectionList[0].Send("say", "[Mightiness BOT]~ " + Player + " you are an admin");
- }
- else
- {
- ConnectionList[0].Send("say", "[Mightiness BOT]~ " + Player + " you are not an admin");
- }
- }
- }
- catch { }
- break;
- case "b":
- if (inited == true && FlyBox.Checked == false)
- {
- int x = m.GetInt(1);
- int y = m.GetInt(2);
- int @int = m.GetInt(3);
- mapdata[x, y] = @int;
- }
- try
- {
- if (Reset.Checked == true && SelectedPlayerList.Items.Contains(Players[m.GetInt(4)].ToUpper()) == true)
- {
- ConnectionList[0].Send(WorldKey, m.GetInt(0), m.GetInt(1), m.GetInt(2), mapdata[m.GetInt(1), m.GetInt(2)]);
- }
- else if (FlyBox.Checked == true && m.GetInt(3) == 4 && Players[m.GetInt(4)].ToUpper() == Astronaut.Text)
- {
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2), 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2) - 1, 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 1, m.GetInt(2), 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2) + 1, 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 1, m.GetInt(2), 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2) - 2, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 1, m.GetInt(2) - 1, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 2, m.GetInt(2), 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 1, m.GetInt(2) + 1, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2) + 2, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 1, m.GetInt(2) + 1, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 2, m.GetInt(2), 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 1, m.GetInt(2) - 1, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2) - 3, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 1, m.GetInt(2) - 2, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 2, m.GetInt(2) - 1, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 3, m.GetInt(2), 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 2, m.GetInt(2) + 1, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) + 1, m.GetInt(2) + 2, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1), m.GetInt(2) + 3, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 1, m.GetInt(2) + 2, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 2, m.GetInt(2) + 1, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 3, m.GetInt(2), 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 2, m.GetInt(2) - 1, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[0].Send(WorldKey, 0, m.GetInt(1) - 1, m.GetInt(2) - 2, 1);
- }
- }
- catch(Exception ex) { MessageBox.Show(ex.ToString()); }
- break;
- }
- };
- ConnectionList[0].OnDisconnect += delegate(object sender, string error)
- {
- ConnectionList[0].Send("say", "[Mightiness BOT]~ Disconnected");
- richtxt("[Mightiness BOT]~ Sc0pefurth3r disconnected [MAJOR BOT]", Color.DarkRed);
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] != "READY")
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- richtxt("[Mightiness BOT]~ " + i + "th bot disconnected [PRIVATE BOT]", Color.Red);
- }
- }
- this.Invoke(new Action(() =>
- {
- this.Size = new Size(600, 223);
- Connect2Lobby.Visible = true;
- label1.Visible = true;
- label2.Visible = true;
- WorldID.Visible = true;
- WorldID.Text = "";
- Connect.Visible = true;
- label3.Visible = false;
- OnlinePlayerList.Visible = false;
- AdminName.Visible = false;
- AddAdmin.Visible = false;
- RemoveAdmin.Visible = false;
- OnlineAdminList.Visible = false;
- AddSelectedPlayer.Visible = false;
- RemoveSelectedPlayer.Visible = false;
- SelectedPlayerList.Visible = false;
- Disconnect.Visible = false;
- groupBox1.Visible = false;
- groupBox2.Visible = false;
- groupBox3.Visible = false;
- label9.Visible = false;
- }));
- x = 1;
- inited = false;
- ClaList.Clear();
- ConnectionList.Clear();
- richtxt(Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine, Color.Black);
- richtxt("[Mightiness BOT]~ Welcome, please connect all bots to the lobby", Color.DarkBlue);
- for (int i = 0; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- ConnectionList.Add(null);
- }
- };
- }
- catch (Exception ex) { MessageBox.Show(ex.ToString()); }
- }
- private void ConnectPRIVATE(int i)
- {
- try
- {
- var Room = detectRoom(WorldID.Text);
- ConnectionList[i] = ClaList[i].Multiplayer.JoinRoom(Room, new Dictionary<string, string>());
- ConnectionList[i].Send("init");
- ConnectionList[i].Send("init2");
- ConnectionList[i].OnMessage += delegate(object sender, PlayerIOClient.Message m)
- {
- switch (m.Type)
- {
- case "m":
- if (Task[i].Contains("TakeDown") == true)
- {
- try
- {
- if (Task[i].Contains(SelectedPlayerList.Items.IndexOf(Players[m.GetInt(0)].ToUpper()).ToString()) && Busy == false)
- {
- Busy = true;
- int cordX = (int)Math.Round(m.GetDouble(1) / 16);
- int cordY = (int)Math.Round(m.GetDouble(2) / 16);
- int speedX = (int)m.GetDouble(3);
- int speedY = (int)m.GetDouble(4);
- int modifierX = m.GetInt(5);
- int modifierY = m.GetInt(6);
- int Horizontal = m.GetInt(7);
- int Vertical = m.GetInt(8);
- bool Levitation = m.GetBoolean(11);
- richtxt("[CORD(" + cordX + ", " + cordY + "), SPEED(" + speedX + ", " + speedY + "), MODIFIER(" + modifierX + ", " + modifierY + ")] Horizontal: " + Horizontal + " - Vertical: " + Vertical + " - Levitation: " + Levitation, Color.Black);
- if ((int)m.GetDouble(4) < 0 && m.GetBoolean(11) == true)
- {
- if (m.GetInt(7) == -1)
- cordX -= 5;
- if (m.GetInt(7) == 1)
- cordX += 5;
- for (int y = cordY - 4; y <= 198; y++)
- {
- if (mapdata[cordX, y] != BlockID)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX, y, BlockID);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- else if ((int)m.GetDouble(4) == 0 && m.GetInt(5) == 0 && m.GetInt(6) == 2 && m.GetInt(7) == 0 && m.GetInt(8) == 0 && m.GetBoolean(11) == false)
- {
- for (int y = cordY; y <= 198; y++)
- {
- if (mapdata[cordX, y] != BlockID)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX, y, BlockID);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- Busy = false;
- }
- }
- catch (Exception ex) { MessageBox.Show(ex.ToString()); }
- }
- else if (Task[i].Contains("Shuttle") == true && Players[m.GetInt(0)].ToUpper() == Astronaut.Text)
- {
- int cordX = (int)Math.Round(m.GetDouble(1) / 16);
- int cordY = (int)Math.Round(m.GetDouble(2) / 16);
- cordY -= 1;
- if (Task[i].Split('_')[1] == "0")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY + 1, 2);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY -3, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY - 2, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY - 1, 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY, 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY + 1, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY - 2, 4);
- }
- }
- else if (Task[i].Split('_')[1] == "1")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX - 1, cordY - 1, 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 1, cordY - 1, 4);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 1, cordY - 2, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 1, cordY - 2, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 2, cordY - 1, 14);
- }
- }
- else if (Task[i].Split('_')[1] == "2")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX + 2, cordY - 1, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 1, cordY, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 1, cordY, 14);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY - 4, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 1, cordY - 3, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 2, cordY - 2, 3);
- }
- }
- else if (Task[i].Split('_')[1] == "3")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX + 3, cordY - 1, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 2, cordY, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 1, cordY + 1, 3);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 2, cordY + 1, mapdata[cordX + 2, cordY + 1]);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX + 1, cordY + 2, mapdata[cordX + 1, cordY + 2]);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX, cordY + 2, 1);
- }
- }
- else if (Task[i].Split('_')[1] == "4")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- ConnectionList[i].Send(WorldKey, 0, cordX - 1, cordY + 2, mapdata[cordX - 1, cordY + 2]);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 1, cordY + 1, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 2, cordY + 1, mapdata[cordX - 2, cordY + 1]);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 2, cordY, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 3, cordY - 1, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 2, cordY - 2, 1);
- System.Threading.Thread.Sleep(10);
- ConnectionList[i].Send(WorldKey, 0, cordX - 1, cordY - 3, 1);
- }
- }
- else if (Task[i].Split('_')[1] == "5")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- }
- }
- else if (Task[i].Split('_')[1] == "6")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- }
- }
- else if (Task[i].Split('_')[1] == "7")
- {
- if (m.GetInt(6) == -1 && m.GetInt(8) == -1)
- {
- }
- }
- }
- break;
- case "b":
- try
- {
- if (Task[i] == "GoDown0")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox1.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int x = m.GetInt(1);
- for (int y = m.GetInt(2); y <= 198; y++)
- {
- if (mapdata[x, y] != 0)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 0);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- else if (Task[i] == "GoDown1")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox1.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int x = m.GetInt(1);
- for (int y = 198; y > m.GetInt(2); y--)
- {
- if (mapdata[x, y] != 0)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 0);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- if (Task[i] == "GoUpDel0")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox2.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int x = m.GetInt(1);
- for (int y = 5; y < m.GetInt(2); y++)
- {
- if (mapdata[x, y] != 0)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 0);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- else if (Task[i] == "GoUpDel1")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox2.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int x = m.GetInt(1);
- for (int y = m.GetInt(2) - 1; y >= 5; y--)
- {
- if (mapdata[x, y] != 0)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 0);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- if (Task[i] == "GoUp0")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox3.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int x = m.GetInt(1);
- for (int y = 5; y < m.GetInt(2); y++)
- {
- if (mapdata[x, y] != 2)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 2);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- else if (Task[i] == "GoUp1")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox3.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int x = m.GetInt(1);
- for (int y = m.GetInt(2) - 2; y >= 5; y--)
- {
- if (mapdata[x, y] != 2)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 2);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- if (Task[i] == "GoLeft0")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox4.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int y = m.GetInt(2);
- for (int x = 2; x < m.GetInt(1); x++)
- {
- if (mapdata[x, y] != 1)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 1);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- else if (Task[i] == "GoLeft1")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox4.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int y = m.GetInt(2);
- for (int x = m.GetInt(1) - 1; x >= 2; x--)
- {
- if (mapdata[x, y] != 1)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 1);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- if (Task[i] == "GoRight0")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox5.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int y = m.GetInt(2);
- for (int x = 197; x > m.GetInt(1); x--)
- {
- if (mapdata[x, y] != 3)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 3);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- else if (Task[i] == "GoRight1")
- {
- int BlockID = 12;
- this.Invoke(new Action(() =>
- {
- BlockID = Convert.ToInt32(comboBox5.Text.Split(' ')[1]);
- }));
- if (OnlineAdminList.Items.Contains(Players[m.GetInt(4)].ToUpper()) && m.GetInt(3) == BlockID)
- {
- int y = m.GetInt(2);
- for (int x = m.GetInt(1) + 1; x <= 197; x++)
- {
- if (mapdata[x, y] != 3)
- {
- ConnectionList[i].Send(WorldKey, 0, x, y, 3);
- System.Threading.Thread.Sleep(10);
- }
- }
- }
- }
- }
- catch { }
- break;
- }
- };
- }
- catch (Exception ex) { MessageBox.Show(ex.ToString()); }
- }
- private void Disconnect_Click(object sender, EventArgs e)
- {
- ConnectionList[0].Disconnect();
- }
- private void AddAdmin_Click(object sender, EventArgs e)
- {
- if (AdminName.Text != "" && AdminName.Text.ToUpper() != "ADD ADMIN MANUALLY")
- {
- OnlineAdminList.Items.Add(AdminName.Text);
- AdminName.Text = "Add admin manually";
- }
- else if (OnlinePlayerList.SelectedIndex != -1 && (AdminName.Text == "" || AdminName.Text.ToUpper() == "ADD ADMIN MANUALLY"))
- {
- OnlineAdminList.Items.Add(OnlinePlayerList.SelectedItem.ToString());
- }
- else
- {
- MessageBox.Show("Make sure an item is selected and the Admin field is not empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- private void RemoveAdmin_Click(object sender, EventArgs e)
- {
- if (OnlineAdminList.SelectedIndex != -1)
- OnlineAdminList.Items.Remove(OnlineAdminList.SelectedItem.ToString());
- }
- private void GoDown_CheckedChanged(object sender, EventArgs e)
- {
- if (GoDown.Checked)
- {
- Thread Thread1, Thread2;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoDown0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x+1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoDown1";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "GoDown0" || Task[i] == "GoDown1")
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void GoUpDel_CheckedChanged(object sender, EventArgs e)
- {
- if (GoUpDel.Checked)
- {
- Thread Thread1, Thread2;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoUpDel0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoUpDel1";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "GoUpDel0" || Task[i] == "GoUpDel1")
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void GoUp_CheckedChanged(object sender, EventArgs e)
- {
- if (GoUp.Checked)
- {
- Thread Thread1, Thread2;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoUp0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoUp1";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "GoUp0" || Task[i] == "GoUp1")
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void GoLeft_CheckedChanged(object sender, EventArgs e)
- {
- if (GoLeft.Checked)
- {
- Thread Thread1, Thread2;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoLeft0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoLeft1";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "GoLeft0" || Task[i] == "GoLeft1")
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void GoRight_CheckedChanged(object sender, EventArgs e)
- {
- if (GoRight.Checked)
- {
- Thread Thread1, Thread2;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoRight0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "GoRight1";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "GoRight0" || Task[i] == "GoRight1")
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void AddSelectedPlayer_Click(object sender, EventArgs e)
- {
- if (AdminName.Text != "" && AdminName.Text.ToUpper() != "ADD ADMIN MANUALLY")
- {
- OnlineAdminList.Items.Add(AdminName.Text);
- AdminName.Text = "Add admin manually";
- }
- else if (OnlinePlayerList.SelectedIndex != -1 && (AdminName.Text == "" || AdminName.Text.ToUpper() == "ADD ADMIN MANUALLY"))
- {
- SelectedPlayerList.Items.Add(OnlinePlayerList.SelectedItem.ToString());
- }
- else
- {
- MessageBox.Show("Make sure an item is selected and the Admin/SelectedPlayer field is not empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- private void RemoveSelectedPlayer_Click(object sender, EventArgs e)
- {
- if (SelectedPlayerList.SelectedIndex != -1)
- SelectedPlayerList.Items.Remove(SelectedPlayerList.SelectedItem.ToString());
- }
- private void TakeDown_CheckedChanged(object sender, EventArgs e)
- {
- if (TakeDown.Checked)
- {
- Thread Thread1, Thread2, Thread3, Thread4, Thread5, Thread6;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "TakeDown0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "TakeDown1";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- Thread3 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "TakeDown2";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread3.IsBackground = true;
- Thread3.Start();
- Thread4 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "TakeDown3";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread4.IsBackground = true;
- Thread4.Start();
- Thread5 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "TakeDown4";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread5.IsBackground = true;
- Thread5.Start();
- Thread6 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "TakeDown5";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread6.IsBackground = true;
- Thread6.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i].Contains("TakeDown"))
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
- {
- BlockID = Convert.ToInt32(comboBox6.Text.Split(' ')[1]);
- }
- private void FlyBox_CheckedChanged(object sender, EventArgs e)
- {
- if (FlyBox.Checked)
- {
- Thread Thread1, Thread2, Thread3, Thread4, Thread5, Thread6, Thread7, Thread8;
- Thread1 = new Thread((() =>
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_0";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread1.IsBackground = true;
- Thread1.Start();
- Thread2 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_1";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread2.IsBackground = true;
- Thread2.Start();
- Thread3 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_2";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread3.IsBackground = true;
- Thread3.Start();
- Thread4 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_3";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread4.IsBackground = true;
- Thread4.Start();
- Thread5 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_4";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread5.IsBackground = true;
- Thread5.Start();
- Thread6 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_5";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread6.IsBackground = true;
- Thread6.Start();
- Thread7 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_6";
- ConnectPRIVATE(i);
- x = i;
- break;
- }
- }
- }));
- Thread7.IsBackground = true;
- Thread7.Start();
- Thread8 = new Thread((() =>
- {
- for (int i = x + 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i] == "READY")
- {
- Task[i] = "Shuttle_7";
- ConnectPRIVATE(i);
- break;
- }
- }
- }));
- Thread8.IsBackground = true;
- Thread8.Start();
- }
- else
- {
- for (int i = 1; i < Math.Min(Usernames.Length, Passwords.Length); i++)
- {
- if (Task[i].Contains("TakeDown"))
- {
- ConnectionList[i].Disconnect();
- Task[i] = "READY";
- }
- }
- }
- }
- private void OnlinePlayerList_SelectedIndexChanged(object sender, EventArgs e)
- {
- Astronaut.Text = OnlinePlayerList.SelectedItem.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement