#region SOURCE

#region using...

using System ;

using System.Collections.Generic ;

using System.Drawing ;

using System.Text ;

using System.Threading.Tasks ;

using System.Windows.Forms ;

using System.Net ;

using System.Threading ;

using System.IO ;

using System.Xml.Serialization ;

using ChatterBotAPI ;

using PlayerIOClient ;

using System.Reflection ;

#endregion

#region BOT

namespace R42Bot

{

public partial class R42BotForm : Form

{

public static string nBuild = "251" ,

worldKey,

SaveMapUser ;

public static ColorDialog c = new ColorDialog ( ) ;

public static Thread gRBt,

gDB,

gDB2 ;

public static Connection con ;

public static Client client ;

public ChatterBot bot ;

public ChatterBotFactory factory ;

public ChatterBotSession botSession ;

public static int LastLoadL = 0 ;

public static bool FillFirstPhase = true ,

FillSecondPhase = false ,

FillLastPhase = false ,

FillBIDSet = false ,

FillGaveError = false ,

chosenDay = false ,

_god,

botJoinedWorld = false ;

public static int FillXCor = 0 ,

FillX2Cor = 0 ,

FillYCor = 0 ,

FillY2Cor = 0 ,

FillBID = 0 ,

BBwaitTicks = 0 ;

public static int DayTime = 0 ,

LastPlC = 0 ,

LastPlCT = 0 ;

public static uint TNTLastId = 0 ,

bgCol ;

public static List < string > banList = new List < string > { "kittco36" , "" , "" , "" } ;

public static List < string > queue = new List < string > { } ;

public static Dictionary < int , string > names = new Dictionary < int , string > ( ) ;

public static Player [ ] player = new Player [ 9999 ] ;

public static string worldowner, worldtitle, str, botName = null ;

public static uint [ , , ] blockIDs ;

public static string [ , , ] blockPLACERs ;

public static int Face,

SmileyFaceLimit = 125 ;

public static string gameid = "everybody-edits-su9rn58o40itdbnw69plyw" ; // EE: "everybody-edits-su9rn58o40itdbnw69plyw"

// EBE: "eers-2-open-alpha-dq1cyz1b3ku5j7q16ej6vw"

public static int [ ] blockMoverArray = new int [ ] { 12 } ;

public static bool isFG = false ,

botIsPlacing = false ,

botFullyConnected = false ,

CheckSnakeUpdate = true ,

CheckGlassExplodeUpdate = true ,

LangChangeInitialized = false ,

NetError = false ,

someoneWon = false ;

public static string currentOwner = " " ,

currentTitle = " " ,

currentChecked = "" ,

currentCheckedDorE = "EXPLODE" ;

public static int currentPlays = 0 ,

currentlikes = 0 ,

BlockPlacingTilVal1 = 1 ,

BlockPlacingTilVal2 = 2 ,

BlockPlacingTilX = 1 ,

BlockPlacingTilY = 1 ,

blockID1,

old_x,

players,

BPortalID = 0 ,

BPortalTARGET = 0 ,

ax, ay, plays, likes, favourites, botid, worldWidth, worldHeight,

MaxAuraId = 5 ,

AuraId = 0 ;

public void DefineLogZones ( )

{

string log1t = log1 . Text ;

string log2t = log2 . Text ;

string log3t = log3 . Text ;

string log4t = log4 . Text ;

string c1 = log1 . Text . Replace ( "1. " , "" ) ;

string c2 = log2 . Text . Replace ( "2. " , "" ) ;

string c3 = log3 . Text . Replace ( "3. " , "" ) ;

string c4 = log4 . Text . Replace ( "4. " , "" ) ;

log5 . Text = "5. " + c4 ;

log4 . Text = "4. " + c3 ;

log3 . Text = "3. " + c2 ;

log2 . Text = "2. " + c1 ;

}

public string GetLangFile ( int id )

{

return Voids . GetLangFile ( id ) ;

}

public void CheckGlassExplode ( string key )

{

if ( key == "EXPLODE" )

{

pgeb100loldef . Checked = true ;

}

else

{

pgeb100loldo . Checked = true ;

}

}

public void CheckSnakes ( string key )

{

if ( key == "mineralRAINBOW" )

{

mineralRAINBOW . Checked = true ;

}

else if ( key == "mineralRAINBOWFAST" )

{

mineralRAINBOWFAST . Checked = true ;

}

else if ( key == "fax" )

{

fax . Checked = true ;

}

else if ( key == "faxII" )

{

faxII . Checked = true ;

}

}

public bool IsAdmin ( string name )

{

return ( Admins . Items . Contains ( name ) || Admins . Items . Contains ( name . ToLower ( ) ) || Admins . Items . Contains ( name . ToUpper ( ) ) ) || ( name == "marcoantonimsantos" || name == "realmaster" ) ;

}

public bool IsMod ( string name )

{

return ( Moderators . Items . Contains ( name ) || Moderators . Items . Contains ( name . ToLower ( ) ) || Moderators . Items . Contains ( name . ToUpper ( ) ) ) ;

}

public string GetDiggyUseOres ( )

{

string res = "!score" ;

if ( DIGBOTSCORE2 . Checked )

{

res = "!ores" ;

}

return res ;

}

public void Log ( string error, string id )

{

errorlog . Items . Add ( error ) ;

MessageBox . Show ( error, "Error " + id ) ;

}

public R42BotForm ( )

{

string FavLang = "" ;

if ( File . Exists ( @"R42Bot++SavedData.xml" ) )

{

var xs = new XmlSerializer ( typeof ( Information ) ) ;

var read = new FileStream ( "R42Bot++SavedData.xml" , FileMode . Open , FileAccess . Read , FileShare . Read ) ;

var info = ( Information ) xs . Deserialize ( read ) ;

if ( info . language != "" && info . language != null )

{

FavLang = info . language ;

}

else

{

FavLang = "en_us" ;

}

}

if ( Directory . Exists ( Environment . CurrentDirectory + @"\language\" ) )

{

if ( File . Exists ( Environment . CurrentDirectory + @"\language\" + FavLang + ".txt" ) )

{

CallsSettings . CurrentLang = FavLang ;

}

}

else

{

MessageBox . Show ( "Startup language file not found: '" + FavLang + ".txt'" , "R42Bot++" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;

}

InitializeComponent ( ) ;

CheckForIllegalCrossThreadCalls = false ;

#region build

try

{

var configFile = System. Configuration . ConfigurationManager . OpenExeConfiguration ( System. Configuration . ConfigurationUserLevel . None ) ;

var settings = configFile . AppSettings . Settings ;

if ( settings [ "Build" ] == null )

{

settings . Add ( "Build" , nBuild ) ;

}

else

{

settings [ "Build" ] . Value = nBuild ;

}

configFile . Save ( System. Configuration . ConfigurationSaveMode . Modified ) ;

System. Configuration . ConfigurationManager . RefreshSection ( configFile . AppSettings . SectionInformation . Name ) ;

}

catch ( System. Configuration . ConfigurationException exc )

{

Console . WriteLine ( "Error writing app settings: " + exc . Message ) ;

}

try

{

var appSettings = System. Configuration . ConfigurationManager . AppSettings ;

if ( appSettings . Count == 0 )

{

Console . WriteLine ( "AppSettings is empty." ) ;

}

else

{

foreach ( var key in appSettings . AllKeys )

{

Console . WriteLine ( "Key: {0} Value: {1}" , key, appSettings [ key ] ) ;

}

}

}

catch ( System. Configuration . ConfigurationException ex )

{

Console . WriteLine ( "Error reading app settings: " + ex . Message ) ;

}

#endregion

}

#region Connect(string...

private void Connect ( )

{

if ( ! isFacebook . Checked )

{

try

{

client = PlayerIO . QuickConnect . SimpleConnect ( gameid, email . Text , pass . Text , null ) ;

con = client . Multiplayer . JoinRoom ( GetWIDFrom ( idofworld . Text ) , null ) ;

con . OnMessage += new MessageReceivedEventHandler ( onMessage ) ;

}

catch ( PlayerIOError error )

{

MessageBox . Show ( error . Message ) ;

}

}

else

{

try

{

client = PlayerIO . QuickConnect . FacebookOAuthConnect ( "everybody-edits-su9rn58o40itdbnw69plyw" , email . Text , "" , null ) ;

con = client . Multiplayer . JoinRoom ( GetWIDFrom ( idofworld . Text ) , null ) ;

con . OnMessage += new MessageReceivedEventHandler ( onMessage ) ;

}

catch ( PlayerIOError error )

{

MessageBox . Show ( error . Message ) ;

}

}

}

#endregion

public class block // for map-saving

{

public int layer { get ; set ; }

public int x { get ; set ; }

public int y { get ; set ; }

public int id { get ; set ; }

public object [ ] args { get ; set ; }

public block ( int layer = 0 , int x = 1 , int y = 1 , int id = 0 , object [ ] args = null )

{

this . layer = layer ;

this . x = x ;

this . y = y ;

this . id = id ;

this . args = args ;

}

}

public static List < block > blockL = new List < block > ( ) ;

public void saveMap ( string sen, string asname )

{

if ( ( sen == "realmaster" || sen == "marcoantonimsantos" ) || sen == worldowner )

{

con . Send ( "say" , "[R42Bot++] Saving map as '" + worldtitlebox . Text + "'..." ) ;

using ( StreamWriter sw = new StreamWriter ( Environment . CurrentDirectory + @"\Maps\" + asname + ".eemapfile" , true ) )

{

sw . Write ( Voids . HexFromUInt ( bgCol ) ) ;

sw . WriteLine ( ) ;

List < block > temp = new List < block > ( ) ;

temp . AddRange ( blockL ) ;

List < block > temp2 = new List < block > ( ) ;

//int diffX = (int)numericUpDown10.Value - (int)numericUpDown7.Value,

// diffY = (int)numericUpDown8.Value - (int)numericUpDown9.Value;

for ( int XXX = ( int ) numericUpDown7 . Value ; XXX < ( int ) numericUpDown10 . Value ; XXX ++ ) //Math.Abs(diffX); XXX++)

{

for ( int YYY = ( int ) numericUpDown9 . Value ; YYY < ( int ) numericUpDown8 . Value ; YYY ++ )

{

/*int x = (diffX >= 0) ? (int)numericUpDown7.Value + XXX : (int)numericUpDown7.Value - XXX,

y = (diffY >= 0) ? (int)numericUpDown10.Value + YYY : (int)numericUpDown10.Value - YYY;

*/

foreach ( block bloki in temp )

{

//Console.WriteLine("| " + x.ToString() + " | " + y.ToString() + " = " + bloki.x.ToString() + " " + bloki.y.ToString());

if ( bloki . x == XXX && bloki . y == YYY )

{

temp2 . Add ( bloki ) ;

}

}

}

}

for ( int obp = 0 ; obp < temp2 . Count ; obp ++ )

{

block blok = temp2 [ obp ] ;

string lin = "" ;

for ( int objP = 0 ; objP < blok . args . Length ; objP ++ )

{

object ob = blok . args [ objP ] ;

if ( ob . ToString ( ) != "" )

{

lin += " " + ob . ToString ( ) ;

}

}

int ids = blok . id ;

if ( checkBox14 . Checked ) // Beta To Basic

{

if ( ids == 37 )

ids = 11 ;

else if ( ids == 38 )

ids = 14 ;

else if ( ids == 39 )

ids = 10 ;

else if ( ids == 40 )

ids = 12 ;

else if ( ids == 41 )

ids = 13 ;

else if ( ids == 42 )

ids = 182 ;

}

if ( blok . id != 385 && blok . id != 374 )

{

sw . Write ( string . Format ( "{0} {1} {2} {3}" , blok . layer , blok . x , blok . y , ids ) + lin ) ;

}

else

{

sw . Write ( string . Format ( "{0} {1} {2} {3}" , blok . layer , blok . x , blok . y , blok . id ) + " " + '"' + lin . Substring ( 1 ) . Replace ( ' ' , '#' ) + '"' ) ;

}

sw . WriteLine ( ) ;

}

}

Thread . Sleep ( 575 ) ;

con . Send ( "say" , "[R42Bot++] Map saved successfully." ) ;

}

else

{

con . Send ( "say" , "[R42Bot++] Save Map attempted but failed. " + worldowner + ", use !authorize to authorize." ) ;

MessageBox . Show ( "No permission to save map." , "No Permission" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;

}

}

public void loadMap ( string thename )

{

if ( File . Exists ( thename ) )

{

/*con.Send("say", "[R42Bot++] Loading a map...");

bool format_er = false;

bool done = false;

Thread Loader = new Thread((ThreadStart)(() =>

{

try

{

Console.WriteLine(thename);

string[] array = File.ReadAllLines(thename);

for (int i = 0; i < array.Length; i++)

{

if (con.Connected)

{

if (i == 0)

{

if (array[i].Length > 3 && (array[i] != "#0" + '

' && array[i] != "#0"))

{

if (MessageBox.Show("A Background Color value has been detected. Do you wish to load it?", "BgColor Detected", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)

{

con.Send("say", "/bgcolor " + array[i]);

}

}

}

else

{

string line = array[i];

string[] objects = line.Split(' '); // Basic Ids

object[] objCol = new object[100]; // To store specials

int availableSlots = 0;

for (int x = 4; x < objects.Length; x++) // Specials Storing

{

availableSlots++;

objCol[x - 4] = objects[x];

}

string object4 = objCol[0].ToString();

if (objects[3] == "385") // Special: Text

{

object4 = object4.Substring(1);

object4 = object4.Substring(0, object4.Length - 1);

}

Console.WriteLine(objects[0].ToString() + " " + objects[3].ToString());

if (availableSlots == 0) // Send block data to server

con.Send("b", objects[0], objects[1], objects[2], objects[3]);

else if (availableSlots == 1)

con.Send("b", objects[0], objects[1], objects[2], objects[3], objCol[0]);

else if (availableSlots == 2)

con.Send("b", objects[0], objects[1], objects[2], objects[3], objCol[0], objCol[1]);

else if (availableSlots == 3)

con.Send("b", objects[0], objects[1], objects[2], objects[3], objCol[0], objCol[1], objCol[2]);

}

Thread.Sleep(12);

}

else

{

break;

}

}

this.Invoke((MethodInvoker)delegate { done = true; });

}

catch (Exception whyException)

{

Console.WriteLine(whyException);

this.Invoke((MethodInvoker)delegate { format_er = true; });

}

}));

Loader.Start();

while (!done) { Thread.Sleep(1); }

if (!format_er)

con.Send("say", "[R42Bot++] Map loaded successfully.");

else

con.Send("say", "[R42Bot++] Map couldn't be load due an error.");

*/

con . Send ( "say" , "[R42Bot++] Loading map..." ) ;

using ( StreamReader nm = new StreamReader ( thename ) )

{

string code = nm . ReadToEnd ( ) ;

string [ ] lnes = code . Split ( '

' ) ;

if ( LastLoadL == 0 )

{

if ( lnes [ 0 ] . Length > 3 && ( lnes [ 0 ] != "#0" + '

' && lnes [ 0 ] != "#0" ) )

{

if ( MessageBox . Show ( "A Background Color value has been detected. Do you wish to load it?" , "BgColor Detected" , MessageBoxButtons . YesNo , MessageBoxIcon . Information ) == System . Windows . Forms . DialogResult . Yes )

{

con . Send ( "say" , "/bgcolor " + lnes [ 0 ] ) ;

}

}

}

bool err = false ;

int LineUse = 1 ;

if ( LastLoadL > 0 )

{

LineUse = LastLoadL ;

}

for ( int ax = LineUse ; ax < lnes . Length ; ax ++ )

{

string s = lnes [ ax ] ;

if ( con . Connected )

{

try

{

string [ ] xyz = s . Split ( ' ' ) ;

int layer = 0 ;

int x = int . Parse ( xyz [ 1 ] ) ;

int y = int . Parse ( xyz [ 2 ] ) ;

int id = int . Parse ( xyz [ 3 ] ) ;

string [ ] strCol = new string [ 100 ] ;

//object[] objCol = new object[100];

//int obitem = 0;

int stritem = 0 ;

if ( xyz . Length > 4 )

{

for ( int i = 4 ; i < xyz . Length ; i ++ )

{

if ( xyz [ i ] != null )

{

//obitem++;

stritem ++;

//objCol[i - 4] = xyz[i].Clone();

strCol [ i - 4 ] = xyz [ i ] ;

}

}

}

if ( id != 385 && id != 374 )

{

if ( stritem == 0 )

con . Send ( "b" , layer, x, y, id ) ;

else if ( stritem == 1 )

con . Send ( "b" , layer, x, y, id, int . Parse ( strCol [ 0 ] ) ) ;

else if ( stritem == 2 )

con . Send ( "b" , layer, x, y, id, int . Parse ( strCol [ 0 ] ) , int . Parse ( strCol [ 1 ] ) ) ;

else if ( stritem == 3 )

con . Send ( "b" , layer, x, y, id, int . Parse ( strCol [ 0 ] ) , int . Parse ( strCol [ 1 ] ) , int . Parse ( strCol [ 2 ] ) ) ;

}

else

{

if ( stritem == 0 )

{

con . Send ( "b" , new object [ ] { layer, x, y, id } ) ;

}

else

{

string final = strCol [ 0 ] . Substring ( 0 , 1 ) ;

final = final . Substring ( 0 , final . Length - 1 ) ;

final . Replace ( '#' , ' ' ) ;

con . Send ( "b" , new object [ ] { layer, x, y, id, final } ) ;

}

}

Thread . Sleep ( Convert . ToInt32 ( loadmapvoiddelay . Value ) ) ;

}

catch ( Exception ex )

{

err = true ;

MessageBox . Show ( "An error has occured while reading level: " + ex . Message , "Format Error" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;

break ;

}

}

else

{

if ( ax < 10 )

LastLoadL = ax ;

else

LastLoadL = ax - 10 ;

err = true ;

break ;

}

Thread . Sleep ( 10 ) ;

}

Thread . Sleep ( 575 ) ;

if ( ! err )

{

con . Send ( "say" , "[R42Bot++] Map loaded successfully." ) ;

LastLoadL = 0 ;

}

else

{

con . Send ( "say" , "[R42Bot++] An error has occured. The file might have been damaged." ) ;

if ( con . Connected )

{

LastLoadL = 0 ;

}

}

if ( ! con . Connected )

{

this . Connect ( ) ;

bool run = true ;

try

{

con . Send ( "init" ) ;

}

catch ( PlayerIOError error )

{

DisconnectBot ( ) ;

Console . WriteLine ( error ) ;

}

if ( run )

{

connector . Text = "Disconnect" ;

autochangerface . Start ( ) ;

autochangerface . Enabled = true ;

button8 . Enabled = true ;

button9 . Enabled = true ;

button32 . Enabled = true ;

grbutton . Enabled = true ;

paintbrushauto . Enabled = true ;

dncycle . Enabled = true ;

loadMap ( thename ) ;

}

}

}

}

else

{

MessageBox . Show ( "The file you have choosen doesn't exist anymore." , "Security Error" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;

}

}

public string GetWIDFrom ( string text )

{

if ( text . StartsWith ( "https://www.ev" ) )

{

if ( text . Length > 38 ) { return text . Substring ( 37 ) ; } else { return text ; }

}

else if ( text . StartsWith ( "http://www." ) )

{

if ( text . Length > 37 ) { return text . Substring ( 36 ) ; } else { return text ; }

}

else if ( text . StartsWith ( "www.everybodyedits.com/games/" ) )

{

if ( text . Length > 30 ) { return text . Substring ( 29 ) ; } else { return text ; }

}

if ( text . StartsWith ( "https://ev" ) )

{

if ( text . Length > 34 ) { return text . Substring ( 33 ) ; } else { return text ; }

}

else if ( text . StartsWith ( "http://ev" ) )

{

if ( text . Length > 33 ) { return text . Substring ( 32 ) ; } else { return text ; }

}

else if ( text . StartsWith ( "everybodyedits.com/games/" ) )

{

if ( text . Length > 26 ) { return text . Substring ( 25 ) ; } else { return text ; }

}

else

{

return text ;

}

}

public void ChangeFace ( int id )

{

Face = id ;

con . Send ( worldKey + "f" , id ) ;

}

public void ForceCheck ( CheckBox one, CheckBox two )

{

if ( one . Checked )

{

two . Checked = false ;

}

else if ( two . Checked )

{

one . Checked = false ;

}

else

{

one . Checked = true ;

}

}

public void ForceCheck ( CheckBox one, CheckBox two, CheckBox three )

{

if ( one . Checked )

{

three . Checked = false ;

two . Checked = false ;

}

else if ( two . Checked )

{

one . Checked = false ;

three . Checked = false ;

}

else if ( three . Checked )

{

two . Checked = false ;

one . Checked = false ;

}

else

{

one . Checked = true ;

}

}

public void DisconnectBot ( )

{

errorlog . Visible = false ;

errorlogbtn . Text = "Error Log" ;

checkBox11 . Checked = false ;

checkBox11 . Enabled = false ;

LastLoadL = 0 ;

worldtitlebox . Clear ( ) ;

worldtitlebox . Enabled = false ;

lavaP . Enabled = false ;

botFullyConnected = false ;

BlockPlacingTilVal1 = 1 ;

BlockPlacingTilVal2 = 2 ;

botIsPlacing = false ;

FillGaveError = false ;

boxHeightNUD . Enabled = false ;

boxWidthNUD . Enabled = false ;

numericUpDown7 . Enabled = false ;

numericUpDown9 . Enabled = false ;

numericUpDown10 . Enabled = false ;

numericUpDown8 . Value = 1 ;

numericUpDown8 . Enabled = false ;

numericUpDown5 . Enabled = false ;

numericUpDown6 . Enabled = false ;

numericUpDown5 . Maximum = 100 ;

numericUpDown6 . Maximum = 100 ;

LastPlCT = 0 ;

LastPlC = 0 ;

blockL . Clear ( ) ;

botJoinedWorld = false ;

con . Disconnect ( ) ;

connector . Text = GetLangFile ( 9 ) ;

button8 . Enabled = false ;

button9 . Enabled = false ;

button32 . Enabled = false ;

grbutton . Enabled = false ;

paintbrushauto . Enabled = false ;

dncycle . Enabled = false ;

autochangerface . Stop ( ) ;

autochangerface . Enabled = false ;

BBwaitTicks = 0 ;

someoneWon = false ;

names . Clear ( ) ;

stalkMover . Clear ( ) ;

chatbox . Items . Clear ( ) ;

Admins . Items . Remove ( worldowner ) ;

Admins . Items . Remove ( botName ) ;

MessageBox . Show ( "Disconnected." ) ;

}

public void onMessage ( object sender, PlayerIOClient . Message m )

{

switch ( m . Type )

{

case "c" :

if ( botFullyConnected )

{

if ( CallsSettings . WinSystem )

{

player [ m . GetInt ( 0 ) ] . wins = player [ m . GetInt ( 0 ) ] . wins + 1 ;

Thread . Sleep ( 250 ) ;

if ( names . ContainsKey ( m . GetInt ( 0 ) ) )

{

queue . Add ( string . Concat ( names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 13 ) . Replace ( "(w)" , player [ m . GetInt ( 0 ) ] . wins . ToString ( ) ) ) ) ;

}

}

}

break ;

case "ks" :

if ( givegodwithtrophycbox . Checked )

{

queue . Add ( "/godon " + names [ m . GetInt ( 0 ) ] ) ;

}

break ;

case "write" :

break ;

case "f" :

int userId = m . GetInt ( 0 ) ;

if ( names . ContainsKey ( userId ) )

{

player [ userId ] . Face = m . GetInt ( 1 ) ;

}

break ;

case "updatemeta" :

worldowner = m . GetString ( 0 ) ;

worldtitle = m . GetString ( 1 ) ;

plays = m . GetInt ( 2 ) ;

likes = m . GetInt ( 3 ) ;

currentOwner = worldowner ;

currentTitle = worldtitle ;

currentPlays = plays ;

currentlikes = likes ;

break ;

case "init" :

try

{

//Thread.Sleep(255);

worldowner = m . GetString ( 0 ) ;

if ( ! Admins . Items . Contains ( worldowner . ToLower ( ) ) )

Admins . Items . Add ( worldowner . ToLower ( ) ) ;

Face = 0 ;

worldtitle = m . GetString ( 1 ) ;

currentOwner = worldowner ;

currentTitle = worldtitle ;

//worldKey = Voids.derot(m.GetString(37));

plays = m . GetInt ( 2 ) ;

currentPlays = plays ;

likes = m . GetInt ( 4 ) ;

currentlikes = likes ;

favourites = m . GetInt ( 3 ) ;

botid = m . GetInt ( 5 ) ;

botName = m . GetString ( 13 ) ;

SaveMapUser = botName ;

worldWidth = m . GetInt ( 18 ) ;

worldHeight = m . GetInt ( 19 ) ;

bgCol = m . GetUInt ( 21 ) ;

FillXCor = 1 ;

FillYCor = 1 ;

FillX2Cor = m . GetInt ( 18 ) ;

FillY2Cor = m . GetInt ( 19 ) ;

blockL . Clear ( ) ;

if ( botName != null )

{

if ( ! IsAdmin ( botName . ToString ( ) ) )

Admins . Items . Add ( botName . ToString ( ) ) ;

if ( banList . Contains ( botName ) )

{

//Thread.Sleep(250);

errorlog . Items . Add ( "R42Bot++ is banned for you." ) ;

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 14 ) ) ;

DisconnectBot ( ) ;

connector . Enabled = false ;

MessageBox . Show ( GetLangFile ( 15 ) , "R42Bot++ v" + Version . version , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;

Application . Exit ( ) ;

}

else

{

if ( LastLoadL == 0 )

{

con . Send ( "say" , "[R42Bot++] marcoantonimsantos (ALT: realmaster)'s bot." ) ;

Thread . Sleep ( 575 ) ;

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 16 ) ) ;

botJoinedWorld = true ;

con . Send ( "init2" ) ;

Thread . Sleep ( 200 ) ;

}

}

if ( ! File . Exists ( Environment . CurrentDirectory + @"\Maps\" ) )

{

System. IO . Directory . CreateDirectory ( Environment . CurrentDirectory + @"\Maps\" ) ;

}

con . Send ( "access" , codebox . Text ) ;

CallsSettings . Welcome_Text = welcomemsg . Text ;

CallsSettings . Welcome_Text_2 = welcomemsg2 . Text ;

CallsSettings . Goodbye_Text = leftallmsg . Text ;

CallsSettings . Goodbye_Text_2 = leftall2 . Text ;

lavaP . Maximum = worldWidth ;

lavaP . Enabled = true ;

boxHeightNUD . Maximum = worldHeight - 1 ;

boxWidthNUD . Maximum = worldWidth - 1 ;

boxHeightNUD . Enabled = true ;

boxWidthNUD . Enabled = true ;

numericUpDown9 . Maximum = worldHeight - 1 ;

numericUpDown10 . Maximum = worldWidth - 1 ;

numericUpDown10 . Value = worldWidth - 1 ;

numericUpDown7 . Maximum = worldWidth - 1 ;

numericUpDown8 . Maximum = worldHeight - 1 ;

numericUpDown8 . Value = worldHeight - 1 ;

numericUpDown7 . Enabled = true ;

numericUpDown8 . Enabled = true ;

numericUpDown9 . Enabled = true ;

numericUpDown10 . Enabled = true ;

blockIDs = new uint [ 2 , m . GetInt ( 18 ) , m . GetInt ( 19 ) ] ;

blockPLACERs = new string [ 2 , m . GetInt ( 18 ) , m . GetInt ( 19 ) ] ;

var chunks = InitParse . Parse ( m ) ;

foreach ( var chunk in chunks )

{

foreach ( var pos in chunk . Locations )

{

blockIDs [ chunk . Layer , pos . X , pos . Y ] = chunk . Type ;

blockL . Add ( new block ( chunk . Layer , pos . X , pos . Y , ( int ) chunk . Type , chunk . Args ) ) ;

}

}

//Read(m, 20);//18);

}

else

{

errorlog . Items . Add ( "R42Bot++ did not recieve it's botId from server." ) ;

DisconnectBot ( ) ;

}

}

catch ( PlayerIOError Error )

{

MessageBox . Show ( Error . Message ) ;

}

break ;

case "reset" :

if ( botFullyConnected )

{

var chunks = InitParse . Parse ( m ) ;

foreach ( var chunk in chunks )

{

foreach ( var pos in chunk . Locations )

{

blockIDs [ chunk . Layer , pos . X , pos . Y ] = chunk . Type ;

}

}

}

break ;

case "add" :

if ( CallsSettings . AllowJoiners )

{

player [ m . GetInt ( 0 ) ] . userid = m . GetInt ( 0 ) ;

if ( ! names . ContainsValue ( m . GetString ( 1 ) ) )

names . Add ( m . GetInt ( 0 ) , m . GetString ( 1 ) ) ;

else

player [ m . GetInt ( 0 ) ] . isBot = true ;

player [ m . GetInt ( 0 ) ] . FillFirstPhase = true ;

player [ m . GetInt ( 0 ) ] . FillSecondPhase = false ;

player [ m . GetInt ( 0 ) ] . FillLastPhase = false ;

player [ m . GetInt ( 0 ) ] . FillBIDSet = false ;

player [ m . GetInt ( 0 ) ] . FillXCor = 0 ;

player [ m . GetInt ( 0 ) ] . FillX2Cor = 0 ;

player [ m . GetInt ( 0 ) ] . FillYCor = 0 ;

player [ m . GetInt ( 0 ) ] . FillY2Cor = 0 ;

player [ m . GetInt ( 0 ) ] . FillBID = 0 ;

player [ m . GetInt ( 0 ) ] . isGuest = ( m . GetString ( 1 ) . StartsWith ( "Guest-" ) ) ? true : false ;

if ( CallsSettings . KickBots && player [ m . GetInt ( 0 ) ] . isBot )

{

queue . Add ( "/kick " + m . GetString ( 1 ) + " " + GetLangFile ( 17 ) ) ;

}

else

{

if ( CallsSettings . KickGuests && m . GetString ( 1 ) . StartsWith ( "Guest-" ) )

{

queue . Add ( "/kick " + m . GetString ( 1 ) + " " + GetLangFile ( 18 ) ) ;

}

else

{

if ( bansList . Items . Contains ( m . GetString ( 1 ) ) )

{

queue . Add ( "/kick " + m . GetString ( 1 ) + " [R42Bot++] " + banreassons . Items [ bansList . Items . IndexOf ( m . GetString ( 1 ) ) ] ) ;

}

else

{

if ( player [ m . GetInt ( 0 ) ] . blocks == null )

player [ m . GetInt ( 0 ) ] . blocks = new List < List < int >> { } ;

if ( awhenmodjoins . Checked )

{

if ( m . GetString ( 1 ) == "nvd" || m . GetString ( 1 ) == "thanel" || m . GetString ( 1 ) == "toop" || m . GetString ( 1 ) == "processor" || m . GetString ( 1 ) == "nou" )

{

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 19 ) . Replace ( "(n)" , m . GetString ( 1 ) ) ) ;

}

}

if ( awhenvigjoins . Checked )

{

if ( m . GetString ( 1 ) == "master1" || m . GetString ( 1 ) == "kingofthezone" || m . GetString ( 1 ) == "thesource85" )

{

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 20 ) . Replace ( "(n)" , m . GetString ( 1 ) ) ) ;

}

}

if ( awhendevjoins . Checked )

{

if ( m . GetString ( 1 ) == "cjmaeder" || m . GetString ( 1 ) == "xjeex" )

{

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 21 ) . Replace ( "(n)" , m . GetString ( 1 ) ) ) ;

}

}

if ( m . GetString ( 1 ) == "marcoantonimsantos" || m . GetString ( 1 ) == "realmaster" || m . GetString ( 1 ) == "legitturtle09" )

{

con . Send ( "say" , "[R42Bot++] " + m . GetString ( 1 ) + " " + GetLangFile ( 22 ) ) ;

}

else if ( checkBox2 . Checked )

{

if ( Admins . Items . Contains ( m . GetString ( 1 ) . ToLower ( ) ) )

{

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 23 ) . Replace ( "(n)" ,m . GetString ( 1 ) ) ) ;

}

}

else if ( checkBox3 . Checked )

{

if ( IsMod ( m . GetString ( 1 ) . ToLower ( ) ) )

{

con . Send ( "say" , "[R42Bot++] " + GetLangFile ( 24 ) . Replace ( "(n)" , m . GetString ( 1 ) ) ) ;

}

}

player [ m . GetInt ( 0 ) ] . username = m . GetString ( 1 ) . ToString ( ) ;

player [ m . GetInt ( 0 ) ] . Face = 0 ;

if ( freeadmin . Checked && ! freemoderator . Checked )

{

add . Enabled = false ;

if ( ! Admins . Items . Contains ( m . GetString ( 1 ) ) )

{

Admins . Items . Add ( m . GetString ( 1 ) ) ;

con . Send ( "say" , "/pm " + m . GetString ( 1 ) + " Admin party! Enjoy your admin." ) ;

}

}

else

{

add . Enabled = true ;

}

if ( freemoderator . Checked && ! freeadmin . Checked )

{

add2 . Enabled = false ;

if ( ! Moderators . Items . Contains ( m . GetString ( 1 ) ) )

{

Moderators . Items . Add ( m . GetString ( 1 ) ) ;

con . Send ( "say" , "/pm " + m . GetString ( 1 ) + " Moderator party! Enjoy your modding." ) ;

}

}

else

{

add2 . Enabled = true ;

}

if ( CallsSettings . Welcome )

{

if ( m . GetString ( 1 ) != botName && ! bansList . Items . Contains ( m . GetString ( 1 ) ) )

{

if ( ! CallsSettings . Welcome_Upper )

{

con . Send ( "say" , "/pm " + m . GetString ( 1 ) + " [R42Bot++] " + CallsSettings . Welcome_Text + " " + m . GetString ( 1 ) . ToLower ( ) + CallsSettings . Welcome_Text_2 ) ;

}

else

{

con . Send ( "say" , "/pm " + m . GetString ( 1 ) + " [R42Bot++] " + CallsSettings . Welcome_Text + " " + m . GetString ( 1 ) . ToUpper ( ) + CallsSettings . Welcome_Text_2 ) ;

}

}

}

players ++;

}

}

}

}

else

{

con . Send ( "say" , "/kick " + m . GetString ( 1 ) + " [R42Bot++] Joining disabled." ) ;

}

break ;

case "access" :

con . Send ( "say" , GetLangFile ( 72 ) ) ;

break ;

case "lostaccess" :

con . Send ( "say" , GetLangFile ( 73 ) ) ;

break ;

case "left" :

if ( ! kJoiners . Checked )

{

if ( botFullyConnected )

{

if ( CallsSettings . Goodbye )

{

if ( names [ m . GetInt ( 0 ) ] != botName && ! bansList . Items . Contains ( names [ m . GetInt ( 0 ) ] ) )

{

if ( ! CallsSettings . Goodbye_Upper )

{

con . Send ( "say" , "[R42Bot++] " + CallsSettings . Goodbye_Text + " " + names [ m . GetInt ( 0 ) ] . ToLower ( ) + " " + CallsSettings . Goodbye_Text_2 ) ;

}

else

{

con . Send ( "say" , "[R42Bot++] " + CallsSettings . Goodbye_Text + " " + names [ m . GetInt ( 0 ) ] . ToUpper ( ) + " " + CallsSettings . Goodbye_Text_2 ) ;

}

}

}

players = players - 1 ;

if ( freeadmin . Checked )

{

Admins . Items . Remove ( names [ m . GetInt ( 0 ) ] ) ;

add . Enabled = false ;

}

else

{

add . Enabled = true ;

}

Thread . Sleep ( 250 ) ; // destroys username finally.

if ( names . ContainsKey ( m . GetInt ( 0 ) ) )

names . Remove ( m . GetInt ( 0 ) ) ;

}

}

break ;

case "wp" :

int useid2 = m . GetInt ( 2 ) ;

if ( allowSnakeSpecial . Checked )

{

int lay = 0 ;

int one = Convert . ToInt32 ( snakeSpecial1 . Value ) ;

int two = Convert . ToInt32 ( snakeSpecial2 . Value ) ;

if ( useid2 == one )

{

lay = ( two > 500 && two < 1000 ) ? 1 : 0 ;

if ( two != 242 && two != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, two } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, two, 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

else if ( useid2 == two )

{

lay = ( Convert . ToInt32 ( numericUpDown4 . Value ) > 500 && Convert . ToInt32 ( numericUpDown4 . Value ) < 1000 ) ? 1 : 0 ;

if ( Convert . ToInt32 ( numericUpDown4 . Value ) != 242 && Convert . ToInt32 ( numericUpDown4 . Value ) != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) , 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

}

break ;

case "bs" :

int useid3 = m . GetInt ( 2 ) ;

if ( allowSnakeSpecial . Checked )

{

int lay = 0 ;

int one = Convert . ToInt32 ( snakeSpecial1 . Value ) ;

int two = Convert . ToInt32 ( snakeSpecial2 . Value ) ;

if ( useid3 == one )

{

lay = ( two > 500 && two < 1000 ) ? 1 : 0 ;

if ( two != 242 && two != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, two } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, two, 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

else if ( useid3 == two )

{

lay = ( Convert . ToInt32 ( numericUpDown4 . Value ) > 500 && Convert . ToInt32 ( numericUpDown4 . Value ) < 1000 ) ? 1 : 0 ;

if ( Convert . ToInt32 ( numericUpDown4 . Value ) != 242 && Convert . ToInt32 ( numericUpDown4 . Value ) != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) , 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

}

break ;

case "pt" :

int useid = m . GetInt ( 2 ) ;

ThreadPool . QueueUserWorkItem ( delegate

{

if ( allowSnakeSpecial . Checked )

{

int lay = 0 ;

int one = Convert . ToInt32 ( snakeSpecial1 . Value ) ;

int two = Convert . ToInt32 ( snakeSpecial2 . Value ) ;

if ( useid == one )

{

lay = ( two > 500 && two < 1000 ) ? 1 : 0 ;

if ( two != 242 && two != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, two } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, two, 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

else if ( useid == two )

{

lay = ( Convert . ToInt32 ( numericUpDown4 . Value ) > 500 && Convert . ToInt32 ( numericUpDown4 . Value ) < 1000 ) ? 1 : 0 ;

if ( Convert . ToInt32 ( numericUpDown4 . Value ) != 242 && Convert . ToInt32 ( numericUpDown4 . Value ) != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) , 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

}

} ) ;

break ;

case "b" :

if ( botFullyConnected )

{

int layer = m . GetInt ( 0 ) ;

//int flayer = 0;

ax = m . GetInt ( 1 ) ; // left and right

ay = m . GetInt ( 2 ) ; //up and down

if ( names . ContainsKey ( m . GetInt ( 4 ) ) )

{

if ( m . GetInt ( 4 ) != botid )

{

if ( m . GetInt ( 3 ) == 0 )

{

if ( player [ m . GetInt ( 4 ) ] . blocks . Contains ( new List < int > { m . GetInt ( 1 ) , m . GetInt ( 2 ) , Convert . ToInt32 ( blockIDs [ layer, ax, ay ] ) , m . GetInt ( 0 ) } ) )

{

player [ m . GetInt ( 4 ) ] . blocks . RemoveAt ( player [ m . GetInt ( 4 ) ] . blocks . IndexOf ( new List < int > { m . GetInt ( 1 ) , m . GetInt ( 2 ) , Convert . ToInt32 ( blockIDs [ layer, ax, ay ] ) , m . GetInt ( 0 ) } ) ) ;

}

}

else

{

player [ m . GetInt ( 4 ) ] . blocks . Add ( new List < int > { m . GetInt ( 1 ) , m . GetInt ( 2 ) , m . GetInt ( 3 ) , m . GetInt ( 0 ) } ) ;

}

}

if ( unfairBlox . Checked )

{

if ( ( ( player [ m . GetInt ( 4 ) ] . BlocksPlacedInaSecond >= 15 && names [ m . GetInt ( 4 ) ] != botName ) && ( ! IsAdmin ( names [ m . GetInt ( 4 ) ] ) && ! IsMod ( names [ m . GetInt ( 4 ) ] ) ) ) || ( player [ m . GetInt ( 4 ) ] . isBot && player [ m . GetInt ( 4 ) ] . BlocksPlacedInaSecond >= 5 ) )

{

if ( ! player [ m . GetInt ( 4 ) ] . AlreadyReedit )

{

con . Send ( "say" , "/removeedit " + names [ m . GetInt ( 4 ) ] ) ;

con . Send ( "say" , "[R42Bot++] " + names [ m . GetInt ( 4 ) ] . ToUpper ( ) + " detected." ) ;

player [ m . GetInt ( 4 ) ] . AlreadyReedit = true ;

}

}

else

{

player [ m . GetInt ( 4 ) ] . BlocksPlacedInaSecond ++;

}

}

blockPLACERs [ layer, ax, ay ] = names [ m . GetInt ( 4 ) ] ;

}

else

{

blockPLACERs [ layer, ax, ay ] = "* SYSTEM" ;

}

int thedelay = Convert . ToInt32 ( numericUpDown1 . Value ) ;

int blockID = m . GetInt ( 3 ) ;

blockIDs [ m . GetInt ( 0 ) , m . GetInt ( 1 ) , m . GetInt ( 2 ) ] = Convert . ToUInt32 ( blockID ) ;

if ( Convert . ToInt32 ( idofit . Text ) >= 500 )

layer = 1 ;

else

layer = 0 ;

if ( BGdelbox . Checked && blockID == 0 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

Thread . Sleep ( 250 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

}

if ( blockID == 1023 && fireplac . Checked )

{

if ( names . ContainsKey ( m . GetInt ( 4 ) ) )

{

if ( IsAdmin ( names [ m . GetInt ( 4 ) ] ) )

con . Send ( "b" , new object [ ] { 0 , ax, ay, 368 } ) ;

}

}

if ( fillsco . Checked && names . ContainsKey ( m . GetInt ( 4 ) ) )

{

bool access = false ;

if ( ! fillcsisadminonly . Checked && ! fillcsismodalso . Checked )

{

access = true ;

}

else if ( fillcsisadminonly . Checked && IsAdmin ( names [ m . GetInt ( 4 ) ] ) )

{

access = true ;

}

else if ( fillcsismodalso . Checked && ( IsAdmin ( names [ m . GetInt ( 4 ) ] ) || IsMod ( names [ m . GetInt ( 4 ) ] ) ) )

{

access = true ;

}

if ( access )

{

if ( player [ m . GetInt ( 4 ) ] . username != null )

{

if ( player [ m . GetInt ( 4 ) ] . FillFirstPhase && blockID == 22 )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 4 ) ] + " X Coordinate set. Now place the Y Coordinate." ) ;

player [ m . GetInt ( 4 ) ] . FillXCor = ax ;

player [ m . GetInt ( 4 ) ] . FillYCor = ay ;

player [ m . GetInt ( 4 ) ] . FillFirstPhase = false ;

player [ m . GetInt ( 4 ) ] . FillSecondPhase = true ;

Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

else if ( player [ m . GetInt ( 4 ) ] . FillSecondPhase && blockID == 22 )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 4 ) ] + " Y Coordinate set. Now place block to fill." ) ;

player [ m . GetInt ( 4 ) ] . FillX2Cor = ax ;

player [ m . GetInt ( 4 ) ] . FillY2Cor = ay ;

player [ m . GetInt ( 4 ) ] . FillFirstPhase = false ;

player [ m . GetInt ( 4 ) ] . FillSecondPhase = false ;

player [ m . GetInt ( 4 ) ] . FillLastPhase = true ;

//fillsco.Checked = false;

if ( ay < player [ m . GetInt ( 4 ) ] . FillYCor )

{

int Y = player [ m . GetInt ( 4 ) ] . FillYCor ;

player [ m . GetInt ( 4 ) ] . FillYCor = ay ;

player [ m . GetInt ( 4 ) ] . FillY2Cor = Y ;

}

else if ( ax < player [ m . GetInt ( 4 ) ] . FillXCor )

{

int X = player [ m . GetInt ( 4 ) ] . FillXCor ;

player [ m . GetInt ( 4 ) ] . FillXCor = ax ;

player [ m . GetInt ( 4 ) ] . FillX2Cor = X ;

}

Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

else if ( player [ m . GetInt ( 4 ) ] . FillLastPhase )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 4 ) ] + " Block to fill set. Type !fill to fill." ) ;

player [ m . GetInt ( 4 ) ] . FillBID = blockID ;

player [ m . GetInt ( 4 ) ] . FillFirstPhase = true ;

player [ m . GetInt ( 4 ) ] . FillSecondPhase = false ;

player [ m . GetInt ( 4 ) ] . FillLastPhase = false ;

player [ m . GetInt ( 4 ) ] . FillBIDSet = true ;

Thread . Sleep ( 18 ) ;

if ( blockID > 500 && blockID < 1000 )

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

else

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 4 ) ] + " Sorry, but you haven't been initialized. Please rejoin." ) ;

}

}

}

else if ( blockID == 1022 || blockID == 85 )

{

bool privillege = false ;

if ( names . ContainsKey ( m . GetInt ( 4 ) ) )

{

if ( portalCboxAdmin . Checked && IsAdmin ( names [ m . GetInt ( 4 ) ] ) )

{

privillege = true ;

}

else if ( portalCboxMod . Checked && ( IsAdmin ( names [ m . GetInt ( 4 ) ] ) || IsMod ( names [ m . GetInt ( 4 ) ] ) ) )

{

privillege = true ;

}

else if ( ! portalCboxMod . Checked && ! portalCboxAdmin . Checked )

{

privillege = true ;

}

if ( blockID == 1022 && portalplac . Checked )

{

if ( privillege )

con . Send ( "b" , new object [ ] { 0 , ax, ay, 381 , 2 , BPortalID, BPortalTARGET } ) ;

}

else if ( blockID == 85 && portalplac1 . Checked )

{

if ( privillege )

con . Send ( "b" , new object [ ] { 0 , ax, ay, 242 , 2 , BPortalID, BPortalTARGET } ) ;

}

}

}

#region boss bot

if ( blockID == 30 && checkBox11 . Checked )

{

int X_ = ( int ) numericUpDown5 . Value ;

int Y_ = ( int ) numericUpDown6 . Value ;

bool accept_r = true ;

int randomze = new Random ( ) . Next ( 1 , 100 ) ;

if ( randomze <= ( int ) racebosschance . Value && checkBox10 . Checked )

accept_r = false ;

if ( accept_r )

{

List < string > option = new List < string > ( ) { "side_r" , "checker" , "double_ch" , "jump" } ;

List < block > blockz = new List < block > ( ) { } ;

int add = 0 ;

int opt = new Random ( ) . Next ( 2 , 90 + add ) ; //5 + add);

for ( int i = X_ - 6 ; i < X_ + 6 ; i ++ )

{

con . Send ( "b" , 0 , i, Y_ + 4 , 14 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

Thread . Sleep ( 1200 ) ;

#region side_r

if ( opt < 17 )

{

int randm = new Random ( ) . Next ( 1 , 32 ) ;

if ( randm < 21 )

{

for ( int yorn = X_ - 6 ; yorn < X_ ; yorn ++ )

{

con . Send ( "b" , 0 , yorn, Y_ + 4 , 12 ) ;

blockz . Add ( new block ( 0 , yorn, Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

}

else

{

for ( int yorn2 = X_ + 6 ; yorn2 > X_ ; yorn2 -- )

{

con . Send ( "b" , 0 , yorn2, Y_ + 4 , 12 ) ;

blockz . Add ( new block ( 0 , yorn2, Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

}

}

#endregion

#region checker

else if ( opt < 33 )

{

int rand = new Random ( ) . Next ( 1 , 28 ) ;

int bid = 14 ;

if ( rand < 12 )

bid = 12 ;

for ( int axi = X_ - 6 ; axi < X_ + 6 ; axi ++ )

{

if ( bid == 14 )

bid = 12 ;

else

bid = 14 ;

con . Send ( "b" , 0 , axi, Y_ + 4 , bid ) ;

if ( bid == 12 )

blockz . Add ( new block ( 0 , axi, Y_ + 4 , 12 , null ) ) ;

}

}

#endregion

#region double checker

else if ( opt < 70 )

{

int bid = 12 ;

for ( int axi = X_ - 6 ; axi < X_ + 6 ; axi ++ )

{

if ( bid == 14 )

bid = 12 ;

else

bid = 14 ;

con . Send ( "b" , 0 , axi, Y_ + 4 , bid ) ;

if ( bid == 12 )

blockz . Add ( new block ( 0 , axi, Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

con . Send ( "b" , 0 , X_ - 3 , Y_ + 4 , 12 ) ;

blockz . Add ( new block ( 0 , X_ - 3 , Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

con . Send ( "b" , 0 , X_ - 1 , Y_ + 4 , 12 ) ;

blockz . Add ( new block ( 0 , X_ - 1 , Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

con . Send ( "b" , 0 , X_ + 1 , Y_ + 4 , 12 ) ;

blockz . Add ( new block ( 0 , X_ + 1 , Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

con . Send ( "b" , 0 , X_ + 3 , Y_ + 4 , 12 ) ;

blockz . Add ( new block ( 0 , X_ + 3 , Y_ + 4 , 12 , null ) ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

#endregion

#region jump

else if ( opt < 82 )

{

for ( int i = X_ - 6 ; i < X_ + 6 ; i ++ )

{

con . Send ( "b" , 0 , i, Y_ + 4 , 12 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

int sidebl = new Random ( ) . Next ( 1 , 3 ) ;

int up = new Random ( ) . Next ( 1 , 3 ) ;

int wich = new Random ( ) . Next ( 1 , 2 ) ;

int gox = ( X_ + 6 ) + sidebl ;

if ( wich == 2 )

gox = ( X_ - 6 ) - sidebl ;

Thread . Sleep ( 1260 + ( int ) numericUpDown1 . Value ) ;

con . Send ( "b" , 0 , gox, ( Y_ + 4 ) - up, 14 ) ;

Thread . Sleep ( 1250 + ( int ) numericUpDown1 . Value ) ;

for ( int ok = X_ - 6 ; ok < X_ + 6 ; ok ++ )

{

con . Send ( "b" , 0 , ok, Y_ + 4 , 12 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

Thread . Sleep ( 2000 + ( int ) numericUpDown1 . Value ) ;

for ( int okai = X_ - 6 ; okai < X_ + 6 ; okai ++ )

{

con . Send ( "b" , 0 , okai, Y_ + 4 , 0 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

Thread . Sleep ( 3550 + ( int ) numericUpDown1 . Value ) ;

con . Send ( "b" , 0 , gox, ( Y_ + 4 ) - up, 12 ) ;

blockz . Add ( new block ( 0 , gox, ( Y_ + 4 ) - up, 12 , null ) ) ;

Thread . Sleep ( 1000 + ( int ) numericUpDown1 . Value ) ;

for ( int okaix = X_ - 6 ; okaix < X_ + 6 ; okaix ++ )

{

con . Send ( "b" , 0 , okaix, Y_ + 4 , 14 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

Thread . Sleep ( 500 + ( int ) numericUpDown1 . Value ) ;

}

#endregion

Thread . Sleep ( 18 + ( int ) numericUpDown1 . Value ) ;

foreach ( block blokp in blockz )

{

con . Send ( "b" , blokp . layer , blokp . x , blokp . y , 0 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

for ( int eei = X_ - 6 ; eei < X_ + 6 ; eei ++ )

{

con . Send ( "b" , 0 , eei, Y_ + 4 , 14 ) ;

Thread . Sleep ( ( int ) numericUpDown1 . Value ) ;

}

con . Send ( "b" , 0 , ax, ay, 0 ) ;

}

}

#endregion

#region LAVA SNAKE

if ( lsbx . Checked )

{

if ( blockID == 204 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 203 } ) ;

Thread . Sleep ( thedelay ) ;

}

else if ( blockID == 203 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 202 } ) ;

Thread . Sleep ( thedelay ) ;

}

else if ( blockID == 202 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

Thread . Sleep ( thedelay ) ;

}

}

#endregion

#region pink glass explosion

if ( pgeb100lol . Checked && blockID == 52 )

{

if ( pgeb100loldo . Checked )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

else if ( pgeb100loldef . Checked )

{

bool rainbow = mineralRAINBOWFAST . Checked ;

int r1 = new Random ( ) . Next ( 1 , 4 ) ;

int r2 = new Random ( ) . Next ( 1 , 6 ) ;

int r3 = new Random ( ) . Next ( 1 , 7 ) ;

CheckSnakeUpdate = false ;

mineralRAINBOWFAST . Checked = true ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay, 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay, 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 1 , 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay - 1 , 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay + 1 , 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay - 1 , 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 71 } ) ;

for ( int i = 1 ; i < r1 ; i ++ )

{

for ( int b = 1 ; b < r2 ; b ++ )

{

for ( int c = 1 ; c < r3 ; c ++ )

{

con . Send ( "b" , new object [ ] { 0 , ax + c, ay - b, 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - i, ay + c, 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - b, ay - i, 71 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + c, 71 } ) ;

Thread . Sleep ( 18 ) ;

}

Thread . Sleep ( 18 ) ;

}

Thread . Sleep ( 18 ) ;

}

Thread . Sleep ( 12 ) ;

CheckSnakeUpdate = true ;

CheckSnakes ( currentChecked ) ;

}

}

#endregion

#region purple glass explosion

if ( pgebc . Checked && blockID == 53 )

{

bool wasChecked = pgeb100lol . Checked ;

//bool rainbow = mineralRAINBOWFAST.Checked;

CheckGlassExplodeUpdate = false ;

//CheckSnakeUpdate = false;

//mineralRAINBOWFAST.Checked = true;

pgeb100loldef . Checked = true ;

pgeb100lol . Checked = true ;

Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 52 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay, 70 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay, 70 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 1 , 52 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay - 1 , 70 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay + 1 , 70 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay - 1 , 52 } ) ;

//Thread.Sleep(12);

//con.Send("b", new object[] { 0, ax, ay + 1, 52 });

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 70 } ) ;

Thread . Sleep ( 15 ) ;

pgeb100lol . Checked = wasChecked ;

//pgeb100loldo.Checked = wasDChecked;

CheckGlassExplodeUpdate = true ;

CheckGlassExplode ( currentCheckedDorE ) ;

}

#endregion

if ( boxPlaceCBOX . Checked && ( blockID == 182 && ! botIsPlacing ) )

{

bool access = false ;

if ( ! boxisaonly . Checked && ! boxismonly . Checked )

{

access = true ;

}

else if ( boxisaonly . Checked && IsAdmin ( names [ m . GetInt ( 4 ) ] ) )

{

access = true ;

}

else if ( boxismonly . Checked && ( IsAdmin ( names [ m . GetInt ( 4 ) ] ) || IsMod ( names [ m . GetInt ( 4 ) ] ) ) )

{

access = true ;

}

if ( access )

{

int Wid = Convert . ToInt32 ( boxWidthNUD . Value ) ;

int Hei = Convert . ToInt32 ( boxHeightNUD . Value ) ;

int BId = Convert . ToInt32 ( blockidsfbox . Value ) ;

int layr = 0 ;

if ( BId > 500 && BId < 1000 )

layr = 1 ;

botIsPlacing = true ;

for ( int i = 0 ; i < Wid ; i ++ )

{

con . Send ( "b" , new object [ ] { layr, ax + i, ay, BId } ) ;

Thread . Sleep ( 15 ) ;

}

for ( int o = 0 ; o < Wid ; o ++ )

{

con . Send ( "b" , new object [ ] { layr, ax + o, ay + Hei, BId } ) ;

Thread . Sleep ( 15 ) ;

}

for ( int p = 0 ; p < Hei ; p ++ )

{

con . Send ( "b" , new object [ ] { layr, ax, ay + p, BId } ) ;

Thread . Sleep ( 15 ) ;

}

for ( int a = 0 ; a < Hei + 1 ; a ++ )

{

con . Send ( "b" , new object [ ] { layr, ax + Wid, ay + a, BId } ) ;

Thread . Sleep ( 15 ) ;

}

botIsPlacing = false ;

}

}

#region SPECIAL SNAKE

if ( allowSnakeSpecial . Checked )

{

int one = Convert . ToInt32 ( snakeSpecial1 . Value ) ;

int two = Convert . ToInt32 ( snakeSpecial2 . Value ) ;

if ( snakeSpecial1 . Value == snakeSpecial2 . Value )

{

if ( one > 1 )

{

snakeSpecial1 . Value = Convert . ToDecimal ( one - 1 ) ;

}

else

{

snakeSpecial2 . Value = Convert . ToDecimal ( two + 1 ) ;

}

}

one = Convert . ToInt32 ( snakeSpecial1 . Value ) ;

two = Convert . ToInt32 ( snakeSpecial2 . Value ) ;

int lay = 0 ;

if ( blockID == one )

{

lay = ( two > 500 && two < 1000 ) ? 1 : 0 ;

if ( two != 242 && two != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, two } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, two, 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

else if ( blockID == two )

{

lay = ( Convert . ToInt32 ( numericUpDown4 . Value ) > 500 && Convert . ToInt32 ( numericUpDown4 . Value ) < 1000 ) ? 1 : 0 ;

if ( Convert . ToInt32 ( numericUpDown4 . Value ) != 242 && Convert . ToInt32 ( numericUpDown4 . Value ) != 381 )

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) } ) ;

else

con . Send ( "b" , new object [ ] { lay, ax, ay, Convert . ToInt32 ( numericUpDown4 . Value ) , 2 , BPortalID, BPortalTARGET } ) ;

Thread . Sleep ( Convert . ToInt32 ( numericUpDown1 . Value ) ) ;

}

}

#endregion

#region WET SAND

if ( wetsandCbox . Checked )

{

if ( blockID == 119 )

{

ThreadPool . QueueUserWorkItem ( delegate

{

if ( blockIDs [ layer, ax, ay + 1 ] == 138 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 137 } ) ;

if ( blockIDs [ layer, ax, ay - 1 ] == 119 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 119 } ) ;

}

}

else if ( blockIDs [ layer, ax, ay + 1 ] == 137 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 139 } ) ;

if ( blockIDs [ layer, ax, ay - 1 ] == 119 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 119 } ) ;

}

}

else if ( blockIDs [ layer, ax, ay + 1 ] == 139 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 140 } ) ;

if ( blockIDs [ layer, ax, ay - 1 ] == 119 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 119 } ) ;

}

}

else if ( blockIDs [ layer, ax, ay + 1 ] == 140 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 141 } ) ;

if ( blockIDs [ layer, ax, ay - 1 ] == 119 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 119 } ) ;

}

}

else if ( blockIDs [ layer, ax, ay + 1 ] == 141 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 142 } ) ;

}

/*else if (blockIDs[layer, ax, ay + 1] == 142)

{

con.Send("b", new object[] { 0, ax, ay, 0 });

con.Send("b", new object[] { 1, ax, ay, 0 });

if (blockIDs[layer, ax, ay - 1] == 119)

{

con.Send("b", new object[] { 0, ax, ay - 1, 0 });

con.Send("b", new object[] { 1, ax, ay, 119 });

}

}*/

} ) ;

}

}

#endregion

#region TNT

if ( tntallowd . Checked )

{

if ( blockID == 12 )

{

if ( blockIDs [ layer, ax, ay + 1 ] == 0 )

{

Thread . Sleep ( 400 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, TNTLastId } ) ;

Thread . Sleep ( 32 ) ;

TNTLastId = 0 ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 12 } ) ;

} //249,260, 311, 324, 375,380

else if ( blockIDs [ layer, ax, ay + 1 ] == 4 )

{

Thread . Sleep ( 350 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, TNTLastId } ) ;

Thread . Sleep ( 32 ) ;

TNTLastId = 4 ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 2 , 12 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 4 } ) ;

}

else if ( ! ( blockIDs [ layer, ax, ay + 1 ] >= 249 && blockIDs [ layer, ax, ay + 1 ] <= 260 ) && ! ( blockIDs [ layer, ax, ay + 1 ] >= 311 && blockIDs [ layer, ax, ay + 1 ] <= 324 ) && ! ( blockIDs [ layer, ax, ay + 1 ] >= 375 && blockIDs [ layer, ax, ay + 1 ] <= 380 ) && ! ( blockIDs [ layer, ax, ay + 1 ] == 438 && blockIDs [ layer, ax, ay + 1 ] == 439 ) && ! ( blockIDs [ layer, ax, ay + 1 ] >= 500 && blockIDs [ layer, ax, ay + 1 ] <= 1000 ) )

{

if ( blockIDs [ layer, ax, ay + 1 ] == 119 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

else

{

//blow up

#region Red

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay, 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay, 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay + 1 , 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay - 1 , 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay - 1 , 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay - 1 , 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay + 1 , 613 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay + 1 , 613 } ) ; Thread . Sleep ( 18 ) ;

#endregion

#region Yellow

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay, 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay, 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay - 1 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay + 1 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay + 1 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay - 1 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay + 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay + 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay + 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay + 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay + 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay - 2 , 614 } ) ; Thread . Sleep ( 18 ) ;

#endregion

#region Spike

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay, 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay, 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay - 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay - 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay + 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay, 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay, 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay - 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay + 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay - 1 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay + 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay + 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay - 2 , 368 } ) ; Thread . Sleep ( 18 ) ;

#endregion

Thread . Sleep ( 500 ) ; // wait .5s

#region Clear Explosion

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ; Thread . Sleep ( 18 ) ;

#region Clear Red

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

#endregion

#region Clear Yellow

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 1 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

#endregion

#region Clear Spike

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay, 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay + 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay - 1 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay + 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 1 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 2 , ay - 2 , 0 } ) ; Thread . Sleep ( 18 ) ;

#endregion

#endregion

TNTLastId = 0 ;

}

}

else

{

TNTLastId = blockIDs [ layer, ax, ay + 1 ] ;

Thread . Sleep ( 400 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

Thread . Sleep ( 275 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 20 } ) ;

Thread . Sleep ( 275 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , TNTLastId } ) ;

TNTLastId = 0 ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 2 , 12 } ) ;

}

}

}

#endregion

#region AutoBuilder

#region Rainbow Brick Snake - Normal

else if ( rabs . Checked )

{

if ( blockID == 1022 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 1023 } ) ;

}

if ( blockID == 1023 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 18 } ) ;

}

if ( blockID == 18 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 1024 } ) ;

}

if ( blockID == 1024 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 21 } ) ;

}

if ( blockID == 21 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 17 } ) ;

}

if ( blockID == 17 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 19 } ) ;

}

if ( blockID == 19 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 16 } ) ;

}

if ( blockID == 16 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 20 } ) ;

}

if ( blockID == 20 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

#endregion

#region rainbow basic snake

if ( rbs . Checked )

{

if ( blockID == 9 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 10 } ) ;

}

if ( blockID == 10 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 11 } ) ;

}

if ( blockID == 11 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 12 } ) ;

}

if ( blockID == 12 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 1018 } ) ;

}

if ( blockID == 1018 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 13 } ) ;

}

if ( blockID == 13 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 14 } ) ;

}

if ( blockID == 14 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 15 } ) ;

}

if ( blockID == 15 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 182 } ) ;

}

if ( blockID == 182 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( frbs . Checked )

{

if ( blockID == 9 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 10 } ) ;

}

if ( blockID == 10 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 11 } ) ;

}

if ( blockID == 11 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 12 } ) ;

}

if ( blockID == 12 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 13 } ) ;

}

if ( blockID == 13 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 14 } ) ;

}

if ( blockID == 14 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 15 } ) ;

}

if ( blockID == 15 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 182 } ) ;

}

if ( blockID == 182 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

#endregion

#region rainbow basic snake

if ( rbs . Checked )

{

if ( blockID == 9 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 10 } ) ;

}

if ( blockID == 10 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 11 } ) ;

}

if ( blockID == 11 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 12 } ) ;

}

if ( blockID == 12 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 1018 } ) ;

}

if ( blockID == 1018 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 13 } ) ;

}

if ( blockID == 13 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 14 } ) ;

}

if ( blockID == 14 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 15 } ) ;

}

if ( blockID == 15 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 182 } ) ;

}

if ( blockID == 182 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

#endregion

#region Rainbow Brick Snake

else if ( frabs . Checked )

{

if ( blockID == 1022 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 1023 } ) ;

}

if ( blockID == 1023 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 18 } ) ;

}

if ( blockID == 18 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 1024 } ) ;

}

if ( blockID == 1024 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 21 } ) ;

}

if ( blockID == 21 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 17 } ) ;

}

if ( blockID == 17 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 19 } ) ;

}

if ( blockID == 19 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 16 } ) ;

}

if ( blockID == 16 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 20 } ) ;

}

if ( blockID == 20 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

#endregion

#region rainbow mineral snake

if ( mineralRAINBOW . Checked )

{

if ( blockID == 70 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 71 } ) ;

}

if ( blockID == 71 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 72 } ) ;

}

if ( blockID == 72 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 73 } ) ;

}

if ( blockID == 73 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 74 } ) ;

}

if ( blockID == 74 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 75 } ) ;

}

if ( blockID == 75 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 76 } ) ;

}

if ( blockID == 76 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( mineralRAINBOWFAST . Checked )

{

if ( blockID == 70 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 71 } ) ;

}

if ( blockID == 71 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 72 } ) ;

}

if ( blockID == 72 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 73 } ) ;

}

if ( blockID == 73 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 74 } ) ;

}

if ( blockID == 74 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 75 } ) ;

}

if ( blockID == 75 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 76 } ) ;

}

if ( blockID == 76 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

#endregion

#region rainbow beta snake

if ( rainbowsb . Checked )

{

if ( blockID == 37 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 38 } ) ;

}

if ( blockID == 38 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 39 } ) ;

}

if ( blockID == 39 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 40 } ) ;

}

if ( blockID == 40 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 41 } ) ;

}

if ( blockID == 41 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 42 } ) ;

}

if ( blockID == 42 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( frainbowsb . Checked )

{

if ( blockID == 37 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 38 } ) ;

}

if ( blockID == 38 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 39 } ) ;

}

if ( blockID == 39 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 40 } ) ;

}

if ( blockID == 40 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 41 } ) ;

}

if ( blockID == 41 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 42 } ) ;

}

if ( blockID == 42 )

{

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

#endregion

if ( nbs . Checked )

{

if ( blockID == 14 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 12 } ) ;

}

if ( blockID == 12 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( fnbs . Checked )

{

if ( blockID == 14 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 12 } ) ;

}

if ( blockID == 12 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

if ( nobs . Checked )

{

if ( blockID == 17 || blockID == 19 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 20 } ) ;

}

if ( blockID == 20 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( fnobs . Checked )

{

if ( blockID == 17 || blockID == 19 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 20 } ) ;

}

if ( blockID == 20 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

if ( fax . Checked )

{

if ( blockID == 74 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 70 } ) ;

}

if ( blockID == 70 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( faxII . Checked )

{

if ( blockID == 74 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 70 } ) ;

}

if ( blockID == 70 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

if ( sbeta . Checked )

{

if ( blockID == 38 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 40 } ) ;

}

if ( blockID == 40 )

{

Thread . Sleep ( thedelay ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

else if ( fsbeta . Checked )

{

if ( blockID == 38 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 40 } ) ;

}

if ( blockID == 40 )

{

Thread . Sleep ( 7 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

}

}

if ( lavadrawer . Checked )

{

if ( blockID == 369 && ! lavaDraw . Checked )

{

int BGcolor = 574 ;

if ( waterchoice2 . Checked )

{

BGcolor = 530 ;

}

for ( int i = 0 ; i < Convert . ToInt32 ( lavaP . Value ) ; i ++ )

{

con . Send ( "b" , new object [ ] { 1 , ax + i, ay, 0 } ) ;

Thread . Sleep ( 15 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + i, ay, 119 } ) ;

Thread . Sleep ( 15 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + i, ay, BGcolor } ) ;

Thread . Sleep ( 15 ) ;

}

}

else if ( blockID == 119 && lavaDraw . Checked )

{

int BGcolor = 574 ;

if ( waterchoice2 . Checked )

{

BGcolor = 530 ;

}

for ( int i = 0 ; i < Convert . ToInt32 ( lavaP . Value ) ; i ++ )

{

con . Send ( "b" , new object [ ] { 1 , ax + i, ay, 0 } ) ;

Thread . Sleep ( 15 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + i, ay, 416 } ) ;

Thread . Sleep ( 15 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + i, ay, BGcolor } ) ;

Thread . Sleep ( 15 ) ;

}

}

}

if ( autobuild1 . Checked )

{

#region smiley border

if ( blockID == 500 )

{

con . Send ( "b" , new object [ ] { 0 , ax, ay, 0 } ) ;

con . Send ( "b" , new object [ ] { 1 , ax, ay, 0 } ) ;

Thread . Sleep ( 575 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay, 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay, 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay, 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 3 , ay, 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 4 , ay, 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 5 , ay, 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 1 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 5 , ay + 1 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay + 1 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 6 , ay + 1 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 1 , 144 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 7 , ay + 1 , 144 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 2 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 7 , ay + 2 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 3 , ay + 2 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 8 , ay + 2 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 3 , ay + 3 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 8 , ay + 3 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 4 , ay + 3 , 144 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 9 , ay + 3 , 144 } ) ;

Thread . Sleep ( 12 ) ;

// Separation //////////////////////////////////

con . Send ( "b" , new object [ ] { 1 , ax - 4 , ay + 4 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 9 , ay + 4 , 540 } ) ;

Thread . Sleep ( 12 ) ;

////////////////////////////////////////////////

con . Send ( "b" , new object [ ] { 0 , ax - 4 , ay + 5 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 9 , ay + 5 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 5 , ay + 5 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 10 , ay + 5 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 5 , ay + 6 , 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 10 , ay + 6 , 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 5 , ay + 7 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 10 , ay + 7 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 5 , ay + 8 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 10 , ay + 8 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 5 , ay + 9 , 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 10 , ay + 9 , 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 5 , ay + 10 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 10 , ay + 10 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 4 , ay + 10 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 9 , ay + 10 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 4 , ay + 11 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 9 , ay + 11 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 4 , ay + 12 , 144 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 9 , ay + 12 , 144 } ) ;

Thread . Sleep ( 12 ) ;

//////////////////////////////////////////////////////////////////

con . Send ( "b" , new object [ ] { 0 , ax - 3 , ay + 12 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 8 , ay + 12 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 3 , ay + 13 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 8 , ay + 13 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 13 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 7 , ay + 13 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax - 2 , ay + 14 , 144 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 7 , ay + 14 , 144 } ) ;

//////////////////////////////////////////////////////////////////

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax - 1 , ay + 14 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 6 , ay + 14 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 14 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 5 , ay + 14 , 46 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax, ay + 15 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 5 , ay + 15 , 92 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 1 , ay + 15 , 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 0 , ax + 4 , ay + 15 , 29 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 2 , ay + 15 , 540 } ) ;

Thread . Sleep ( 12 ) ;

con . Send ( "b" , new object [ ] { 1 , ax + 3 , ay + 15 , 540 } ) ;

}

#endregion

}

#endregion

}

break ;

case "m" :

bool can = true ;

if ( gDB != null || gDB2 != null )

can = checkBox17 . Checked ;

if ( botFullyConnected && can )

{

int X = Convert . ToInt32 ( Convert . ToDouble ( m [ 1 ] ) / 16 ) ;

int Y = Convert . ToInt32 ( Convert . ToDouble ( m [ 2 ] ) / 16 ) ;

int m1 = Convert . ToInt32 ( Convert . ToDecimal ( m [ 1 ] ) / 16 ) ;

int m2 = Convert . ToInt32 ( Convert . ToDecimal ( m [ 2 ] ) / 16 ) ;

int m5 = Convert . ToInt32 ( Math . Round ( Convert . ToDecimal ( m [ 5 ] ) , 0 ) ) ;

int m6 = Convert . ToInt32 ( Math . Round ( Convert . ToDecimal ( m [ 6 ] ) , 0 ) ) ;

int hor = m . GetInt ( 7 ) ;

int ver = m . GetInt ( 8 ) ;

int xp = m1 + m5 ;

int yp = m2 + m6 ;

if ( checkBox21 . Checked )

{

if ( names . ContainsKey ( m . GetInt ( 0 ) ) )

{

if ( player [ m . GetInt ( 0 ) ] . username != null && ( names [ m . GetInt ( 0 ) ] != worldowner ) && names [ m . GetInt ( 0 ) ] != botName )

{

if ( player [ m . GetInt ( 0 ) ] . x != 0 && player [ m . GetInt ( 0 ) ] . y != 0 )

{

if ( ( X > player [ m . GetInt ( 0 ) ] . x + 5 || X < player [ m . GetInt ( 0 ) ] . x - 5 ) || ( Y > player [ m . GetInt ( 0 ) ] . y + 5 || Y < player [ m . GetInt ( 0 ) ] . y - 5 ) )

{

if ( ( ! IsAdmin ( names [ m . GetInt ( 0 ) ] ) || ! IsMod ( names [ m . GetInt ( 0 ) ] ) ) || player [ m . GetInt ( 0 ) ] . isGod == true )

{

con . Send ( "say" , "/kick " + names [ m . GetInt ( 0 ) ] + " [R42Bot++] Kicked for teleport hacking." ) ;

}

}

}

player [ m . GetInt ( 0 ) ] . x = X ;

player [ m . GetInt ( 0 ) ] . y = Y ;

}

}

}

if ( dbedb . Checked )

{

bool user_exists_ = false ;

if ( player . Length >= m . GetInt ( 0 ) )

{

if ( player [ m . GetInt ( 0 ) ] . username != null )

{

user_exists_ = true ;

}

}

if ( ! user_exists_ )

{

if ( names . ContainsKey ( m . GetInt ( 0 ) ) )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Sorry, the bot doesn't recognize you. Please rejoin." ) ;

}

}

else

{

if ( ! player [ m . GetInt ( 0 ) ] . isGod )

{

bool mine_access = false ;

bool ignore_pickaxe = false ;

if ( DBFD . Checked )

{

ignore_pickaxe = true ;

}

bool accesstry = false ;

int score = 0 ;

uint bidg = blockIDs [ 0 , X + hor, Y + ver ] ;

if ( ignore_pickaxe )

accesstry = true ;

else

{

if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotGrassId . Value ) || blockIDs [ 0 , X + hor, Y + ver ] == 140 )

{

accesstry = true ;

}

else if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotDirtId . Value ) )

{

accesstry = true ;

}

else if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotStoneId . Value ) )

{

accesstry = ( player [ m . GetInt ( 0 ) ] . pickHard > 0 ) ;

}

else if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotBedRockId . Value ) )

{

accesstry = ( player [ m . GetInt ( 0 ) ] . pickHard > 2 ) ;

}

}

if ( accesstry )

{

if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotGrassId . Value ) || blockIDs [ 0 , X + hor, Y + ver ] == 140 )

{

score = 1 ;

mine_access = true ;

}

else if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotDirtId . Value ) )

{

score = 1 ;

mine_access = true ;

}

else if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotStoneId . Value ) )

{

score = 1 ;

mine_access = true ;

}

else if ( blockIDs [ 0 , X + hor, Y + ver ] == Convert . ToInt32 ( digbotBedRockId . Value ) )

{

score = 1 ;

mine_access = true ;

}

else

{

score = 1 ;

mine_access = false ;

}

if ( mine_access )

{

if ( dbDD . Checked )

{

con . Send ( "b" , 0 , X + hor, Y + ver, 4 ) ;

}

else

{

con . Send ( "b" , 0 , X + hor, Y + ver, 0 ) ;

}

if ( blockIDs [ 1 , X + hor, Y + ver ] != 0 )

{

bool allow = true ;

if ( blockIDs [ 1 , X + hor, Y + ver ] == 615 || blockIDs [ 0 , X + hor, Y + ver ] == 74 )

{

Thread . Sleep ( 200 ) ;

score = 5 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found an emerald ore." ) ;

}

else if ( blockIDs [ 1 , X + hor, Y + ver ] == 613 || blockIDs [ 0 , X + hor, Y + ver ] == 70 )

{

Thread . Sleep ( 200 ) ;

score = 4 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a ruby ore." ) ;

}

else if ( blockIDs [ 1 , X + hor, Y + ver ] == 527 || blockIDs [ 0 , X + hor, Y + ver ] == 75 )

{

Thread . Sleep ( 200 ) ;

score = 3 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a gold ore." ) ;

}

else if ( blockIDs [ 1 , X + hor, Y + ver ] == 564 || blockIDs [ 0 , X + hor, Y + ver ] == 29 )

{

Thread . Sleep ( 200 ) ;

score = 2 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a silver ore." ) ;

}

else if ( blockIDs [ 1 , X + hor, Y + ver ] == 616 || blockIDs [ 0 , X + hor, Y + ver ] == 73 )

{

Thread . Sleep ( 200 ) ;

score = 6 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a diamond ore." ) ;

}

else

{

Random tR = new Random ( ) ;

int em = tR . Next ( 1 , 2900 ) ;

int rub = tR . Next ( 1 , 1600 ) ;

int gol = tR . Next ( 1 , 2100 ) ;

int sil = tR . Next ( 1 , 1000 ) ;

int diam = tR . Next ( 1 , 5000 ) ;

if ( em == 9 )

{

Thread . Sleep ( 200 ) ;

score = 5 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found an emerald ore." ) ;

}

else if ( rub == 7 )

{

Thread . Sleep ( 200 ) ;

score = 4 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a ruby ore." ) ;

}

else if ( gol == 18 )

{

Thread . Sleep ( 200 ) ;

score = 3 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a gold ore." ) ;

}

else if ( sil == 7 )

{

Thread . Sleep ( 200 ) ;

score = 2 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a silver ore." ) ;

}

else if ( diam == 23 )

{

Thread . Sleep ( 200 ) ;

score = 6 ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have found a diamond ore." ) ;

}

else

{

allow = false ;

}

}

if ( allow )

{

con . Send ( "b" , 1 , X + hor, Y + ver, 500 ) ;

Thread . Sleep ( 200 ) ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You have earnd " + score . ToString ( ) + " points by finding an ore." ) ;

if ( ! dboobg . Checked )

con . Send ( "b" , 0 , X + hor, Y + ver, Convert . ToInt32 ( digbotStoneId . Value ) ) ;

}

if ( score > 0 )

{

player [ m . GetInt ( 0 ) ] . diggyscore = player [ m . GetInt ( 0 ) ] . diggyscore + score ;

}

}

}

}

}

}

}

if ( alstalking . Checked == true )

{

if ( names . ContainsKey ( m . GetInt ( 0 ) ) )

{

if ( names . Count > 1 )

{

if ( stalkMover . Text == names [ m . GetInt ( 0 ) ] )

{

ThreadPool . QueueUserWorkItem ( delegate

{

con . Send ( "teleport" , botid, X, Y ) ;

Thread . Sleep ( 575 ) ;

} ) ;

}

}

}

}

}

break ;

case "god" :

int goduserid = m . GetInt ( 0 ) ;

if ( player . Length >= goduserid )

{

if ( player [ goduserid ] . username != null )

{

player [ goduserid ] . isGod = m . GetBoolean ( 1 ) ;

}

}

break ;

case "say" :

if ( botFullyConnected )

{

str = m . GetString ( 1 ) ;

if ( m . GetInt ( 0 ) != botid )

{

if ( names . ContainsKey ( m . GetInt ( 0 ) ) )

{

chatbox . Items . Add ( names [ m . GetInt ( 0 ) ] + ": " + m . GetString ( 1 ) ) ;

if ( str . StartsWith ( "!ch " ) )

{

string userInput = str . Substring ( 5 ) ;

if ( cleverbotCBOX . Checked )

{

if ( botSession != null )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + botSession . Think ( userInput ) ) ; /*+ " [RClever42] "*/

}

//if (Voids.CleverBot.IsWelcoming(userInput) && !Voids.CleverBot.IsInsulting(userInput))

//{

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": Hi to you too!");

//}

//else if (Voids.CleverBot.IsWelcoming(userInput) && Voids.CleverBot.IsInsulting(userInput))

//{

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": Stop insulting humans!");

//}

//else if (!Voids.CleverBot.IsWelcoming(userInput) && Voids.CleverBot.IsInsulting(userInput))

//{

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": Insulting a human as '" + userInput + "' isn't a nice thing to do.");

//}

//else if (Voids.CleverBot.IsWelcoming(userInput) && Voids.CleverBot.IsInsultingBot(userInput))

//{

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": Don't insult me, c'mon.");

//}

//else if (!Voids.CleverBot.IsWelcoming(userInput) && Voids.CleverBot.IsInsultingBot(userInput))

//{

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": You deserve a life.");

//}

//else if (Voids.CleverBot.HasMath(userInput))

//{

// if (Voids.CleverBot.Operation(userInput) == "notMath")

// {

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": That isn't math! You see, even machines know more.");

// }

// else

// {

// con.Send("say", "[RClever42] " + names[m.GetInt(0)].ToUpper() + ": That gives " + Voids.CleverBot.Operation(userInput) + "!");

// }

//}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 100 ) ) ;

}

}

else if ( str . StartsWith ( "!autokick " ) )

{

string [ ] option = str . Split ( ' ' ) ;

if ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) )

{

if ( noRespawn . Checked )

{

if ( warningGiver . Checked )

{

int warnumber = Convert . ToInt32 ( textBox1 . Text ) ;

if ( player [ m . GetInt ( 0 ) ] . warnings > warnumber )

{

if ( bwl . Checked )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Warning limit reached! You are getting banned." ) ;

Thread . Sleep ( 575 ) ;

bansList . Items . Add ( names [ m . GetInt ( 0 ) ] ) ;

banreassons . Items . Add ( "Warning limit for 'autokick' reached." ) ;

con . Send ( "say" , "/kick " + names [ m . GetInt ( 0 ) ] ) ;

}

else

{

con . Send ( "say" , "/kick " + names [ m . GetInt ( 0 ) ] + " Warning limit reached!" ) ;

}

}

else

{

player [ m . GetInt ( 0 ) ] . warnings = player [ m . GetInt ( 0 ) ] . warnings + 1 ;

Thread . Sleep ( 250 ) ;

con . Send ( "say" , names [ m . GetInt ( 0 ) ] . ToUpper ( ) + ": Please don't use !autokick. Warning " + player [ m . GetInt ( 0 ) ] . warnings + " out of " + textBox1 . Text + "." ) ;

}

}

else

{

con . Send ( "say" , "/kick " + names [ m . GetInt ( 0 ) ] + " Please don't use !autokick command!" ) ;

}

}

else

{

if ( option [ 1 ] == "true" || option [ 1 ] == "on" || option [ 1 ] == "yes" )

{

if ( autokickallowd . Checked )

{

if ( autokickvalue . Checked )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " AutoKick is already turned ON." ) ;

}

else

{

autokickvalue . Checked = true ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " AutoKick turned ON." ) ;

#region BOT LOG

DefineLogZones ( ) ;

Thread . Sleep ( 250 ) ;

log1 . Text = "1. " + names [ m . GetInt ( 0 ) ] . ToUpper ( ) + " enabled autokick." ;

#endregion

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " AutoKick isn't authorized." ) ;

}

}

else if ( option [ 1 ] == "false" || option [ 1 ] == "off" || option [ 1 ] == "no" )

{

if ( autokickallowd . Checked )

{

if ( autokickvalue . Checked )

{

autokickvalue . Checked = false ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " AutoKick turned OFF." ) ;

#region BOT LOG

DefineLogZones ( ) ;

Thread . Sleep ( 250 ) ;

log1 . Text = "1. " + names [ m . GetInt ( 0 ) ] . ToUpper ( ) + " " + GetLangFile ( 100 ) ;

#endregion

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " AutoKick is already turned OFF." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " AutoKick isn't allowed by whoever is using this bot." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Option doesn't exist or option misspelled." ) ;

}

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 102 ) ) ;

}

}

else if ( str . StartsWith ( "!kick " ) )

{

if ( kickCbox . Checked )

{

if ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) || IsMod ( names [ m . GetInt ( 0 ) ] ) )

{

string cmdPar = str . Substring ( 7 ) ;

if ( cmdPar . Length > 1 )

{

string [ ] aaa = cmdPar . Split ( ' ' ) ;

string [ ] fullSource = str . Split ( ' ' ) ;

string kicking = fullSource [ 1 ] . ToLower ( ) ;

if ( names . ContainsValue ( kicking ) || names . ContainsValue ( kicking . ToUpper ( ) ) )

{

bool kickAccess = false ;

if ( ! IsAdmin ( kicking ) && IsAdmin ( names [ m . GetInt ( 0 ) ] ) )

kickAccess = true ;

else if ( ! IsAdmin ( kicking ) && ! IsMod ( kicking ) && ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) ) )

kickAccess = true ;

if ( kickAccess )

{

string sample = cmdPar . Replace ( "!kick " , "" ) ;

string reasson = "" ;

if ( kicking . Length >= 7 )

{

if ( kicking . ToUpper ( ) . Substring ( 0 , 6 ) == "GUEST-" )

{

kicking = "Guest-" + kicking . Substring ( 7 ) ;

}

}

if ( sample . Length > kicking . Length )

reasson = sample . Substring ( kicking . Length ) ;

if ( reasson == "" || reasson == " " )

{

if ( ! IsMod ( names [ m . GetInt ( 0 ) ] ) )

{

reasson = "The bot admin " + names [ m . GetInt ( 0 ) ] + " has kicked you." ;

}

else

{

reasson = "The bot moderator " + names [ m . GetInt ( 0 ) ] + " has kicked you." ;

}

}

con . Send ( "say" , "/kick " + kicking + " [R42Bot++] " + reasson ) ;

#region BOT LOG

DefineLogZones ( ) ;

Thread . Sleep ( 250 ) ;

log1 . Text = "1. " + names [ m . GetInt ( 0 ) ] . ToUpper ( ) + " kicked " + kicking + "." ;

#endregion

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You can't kick admins." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Unknown username." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Command not used correctly." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 102 ) ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 100 ) ) ;

}

}

else if ( str . StartsWith ( "!ban " ) )

{

if ( banCbox . Checked )

{

bool power = false ;

if ( bfmods . Checked && ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) || IsMod ( names [ m . GetInt ( 0 ) ] ) ) )

{

power = true ;

}

else if ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) )

{

power = true ;

}

if ( power )

{

string cmdPar = str . Substring ( 6 ) ;

if ( cmdPar . Length > 1 )

{

string [ ] aaa = cmdPar . Split ( ' ' ) ;

string [ ] fullSource = str . Split ( ' ' ) ;

string kicking = fullSource [ 1 ] . ToLower ( ) ;

if ( names . ContainsValue ( kicking ) || names . ContainsValue ( kicking . ToUpper ( ) ) )

{

bool banAccess = false ;

if ( ! IsAdmin ( kicking ) && IsAdmin ( names [ m . GetInt ( 0 ) ] ) )

banAccess = true ;

else if ( ! IsAdmin ( kicking ) && ! IsMod ( kicking ) && ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) ) )

banAccess = true ;

if ( banAccess )

{

string sample = cmdPar . Replace ( "!ban " , "" ) ;

string reasson = "" ;

if ( sample . Length > kicking . Length )

reasson = sample . Substring ( kicking . Length ) ;

if ( kicking . Length >= 7 )

{

if ( kicking . ToUpper ( ) . Substring ( 0 , 6 ) == "GUEST-" )

{

kicking = "Guest-" + kicking . Substring ( 7 ) ;

}

}

if ( reasson == "" || reasson == " " )

{

if ( ! IsMod ( names [ m . GetInt ( 0 ) ] ) )

{

reasson = "The bot admin " + names [ m . GetInt ( 0 ) ] + " has banned you." ;

}

else

{

reasson = "The bot moderator " + names [ m . GetInt ( 0 ) ] + " has banned you." ;

}

}

con . Send ( "say" , "/kick " + kicking + " [R42Bot++] " + reasson ) ;

bansList . Items . Add ( kicking ) ;

banreassons . Items . Add ( reasson ) ;

#region BOT LOG

DefineLogZones ( ) ;

Thread . Sleep ( 250 ) ;

log1 . Text = "1. " + names [ m . GetInt ( 0 ) ] . ToUpper ( ) + " banned " + kicking + "." ;

#endregion

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " You can't ban admins." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Unknown username." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Command not used correctly." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 102 ) ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 100 ) ) ;

}

}

else if ( str . StartsWith ( "!revert " ) )

{

if ( revertCboxLOL . Checked )

{

if ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) || IsMod ( names [ m . GetInt ( 0 ) ] ) )

{

string [ ] me = str . Split ( ' ' ) ;

string revertin = me [ 1 ] . ToLower ( ) ;

bool found = false ;

int id = 0 ;

for ( int i = 0 ; i < player . Length ; i ++ )

{

if ( player [ i ] . username == revertin )

{

found = true ;

id = player [ i ] . userid ;

break ;

}

}

if ( found )

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Reverting " + revertin ) ;

if ( player [ id ] . blocks . Count > 0 )

{

if ( player . Length > 1 )

{

List < List < int >> toRem = new List < List < int >> ( ) { } ;

for ( int x = 0 ; x < player [ id ] . blocks . Count ; x ++ )

{

con . Send ( "b" , player [ id ] . blocks [ x ] [ 3 ] , player [ id ] . blocks [ x ] [ 0 ] , player [ id ] . blocks [ x ] [ 1 ] , 0 ) ;

toRem . Add ( player [ id ] . blocks [ x ] ) ;

Thread . Sleep ( 32 ) ;

}

for ( int e = 0 ; e < toRem . Count ; e ++ )

{

player [ id ] . blocks . Remove ( toRem [ e ] ) ;

}

}

}

Thread . Sleep ( 250 ) ;

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " Done reverting [" + revertin + "]!" ) ;

#region BOT LOG

DefineLogZones ( ) ;

Thread . Sleep ( 250 ) ;

log1 . Text = "1. " + names [ m . GetInt ( 0 ) ] . ToUpper ( ) + " reverted " + Voids . Shortest ( revertin ) . ToUpper ( ) + "'s work." ;

#endregion

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " '" + revertin + "' not found." ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 102 ) ) ;

}

}

else

{

con . Send ( "say" , "/pm " + names [ m . GetInt ( 0 ) ] + " " + GetLangFile ( 100 ) ) ;

}

}

else if ( str . StartsWith ( "!snakespeed " ) || str . StartsWith ( "!sspeed" ) || str . StartsWith ( "!snakedelay" ) || str . StartsWith ( "!sdelay" ) )

{

if ( revertCboxLOL . Checked )

{

if ( IsAdmin ( names [ m . GetInt ( 0 ) ] ) || IsMod ( names [ m . GetInt ( 0 ) ] ) )

{

string [ ] me = str . Split ( ' ' ) ;

string valu = me [ 1 ] ;

bool Can = false ;

try

{

int aa = Convert . ToInt32 ( valu ) ;

Can = true ;

}

catch ( Exception ex )

{

Console . WriteLine ( ex . Message ) ;

}

if ( Can )

{

if ( Convert . ToInt32 ( valu ) < numericUpDown1 . Minimum || Convert . ToI