
EDIT
I cleaned the code a bit, and deleted a looper.
should still work x] Also notice some errors which have been fixed.
I was bored.. and i remembered how dirty mango's learn code was.
So i decided to re-code it!
Open up VirtualUser.cs
First, ctrl + f private Thread workoutDosLooper;
add this under
PHP Code:
private Thread learnLooper;
Second, ctrl + f workout
add this code under the workout command
PHP Code:
#region :learn
case "learn":
{
int ifLearning;
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
ifLearning = dbClient.getInt("SELECT learning FROM users WHERE name = '" + _Username + "'");
}
if (ifLearning == 0 && learningLooper == null)
{
if (_roomID == 201)
{
if ((roomUser.Y == 6 && roomUser.X == 4) || (roomUser.Y == 6 && roomUser.X == 6) || (roomUser.Y == 6 && roomUser.X == 8) || (roomUser.Y == 6 && roomUser.X == 10) || (roomUser.Y == 9 && roomUser.X == 4) || (roomUser.Y == 9 && roomUser.X == 6) || (roomUser.Y == 9 && roomUser.X == 8) || (roomUser.Y == 9 && roomUser.X == 10) || (roomUser.Y == 12 && roomUser.X == 4) || (roomUser.Y == 12 && roomUser.X == 6) || (roomUser.Y == 12 && roomUser.X == 8) || (roomUser.Y == 12 && roomUser.X == 10))
{
Room.sendSaying(roomUser, "*Starts to learn*");
ThreadStart learnStarter = new ThreadStart(learn);
learnLooper = new Thread(learnStarter);
learnLooper.Priority = ThreadPriority.Lowest;
learnLooper.Start();
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.runQuery("UPDATE users SET learning = '1' WHERE name = '" + _Username + "'");
}
}
}
}
break;
}
#endregion
Third, now ctrl + f private void workOutDos()
Now add this private void under it
PHP Code:
private void learn()
{
int iCount = 0;
try
{
while (true)
{
int learning;
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
learning = dbClient.getInt("SELECT learning FROM users WHERE name = '" + _Username + "'");
if (learning == 0)
{
sendData("BK" + "You must wait 1 minute before learning again.");
learnLooper = null;
learnLooper.Abort();
}
if (_roomID == 177 && (roomUser.Y == 12 && roomUser.X == 5) || (roomUser.Y == 12 && roomUser.X == 7) || (roomUser.Y == 12 && roomUser.X == 9) || (roomUser.Y == 12 && roomUser.X == 11) || (roomUser.Y == 9 && roomUser.X == 5) || (roomUser.Y == 9 && roomUser.X == 9) || (roomUser.Y == 9 && roomUser.X == 7) || (roomUser.Y == 9 && roomUser.X == 5))
{
int myIntel;
int myTime;
//refreshAppearance(false, false, true);
myIntel = dbClient.getInt("SELECT intel FROM users WHERE name = '" + _Username + "'");
if (myIntel > 14)
{
sendData("BK" + "Sorry, your intelligence level cannot pass 15.");
learnLooper = null;
learnLooper.Abort();
}
int schoolTime = myIntel * 10;
myTime = dbClient.getInt("SELECT time_learn FROM users WHERE name = '" + _Username + "'");
iCount = myTime;
Room.sendWhisper(roomUser, _Username, "(Learning: " + iCount + "/" + schoolTime + " Minutes)");
iCount++;
dbClient.runQuery("UPDATE users SET time_learn = '" + iCount + "' WHERE name = '" + _Username + "'");
if (iCount > schoolTime)
{
Room.sendSaying(roomUser, "*feels smarter*");
dbClient.runQuery("UPDATE users SET time_learn = '0', intel = intel + '1' WHERE name = '" + _Username + "'");
iCount = 0;
}
}
else
{
dbClient.runQuery("UPDATE users SET learning = '0' WHERE name = '" + _Username + "'");
Room.sendSaying(roomUser, "*stops learning*");
learnLooper = null;
learnLooper.Abort();
}
Thread.Sleep(60000);
}
}
}
catch
{
Thread.CurrentThread.Abort();
learnLooper = null;
}
}
Now here is the part im bad at.
You have to Add 3 Columns to the User Table.
PHP Code:
learning (INT) = 11
PHP Code:
time_learn (INT) = 11
Sorry about the SQL part 
But it would be nice if you thanked Meh <3
Bai!
P.S If there is a error in my coding, please notify me!
Edit
I Implemented a JailBreak Void.
If you Intelligence is at level 14, You can Instantly JailBreak.
And the cops arent notified.
PHP Code:
private void jailBreak()
{
int iCount = 0;
try
{
while (true)
{
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
int Intel;
Intel = dbClient.getInt("SELECT intel FROM users WHERE name = '" + _Username + "'");
{
if (Intel == 14)
{
Room.sendSaying(roomUser, "*successfully breaks down the jail wall freeing everyone inside*");
dbClient.runQuery("UPDATE users SET time_jail = '0', arrested = '0'");
jailBreakLooper = null;
jailBreakLooper.Abort();
}
else
{
if (_roomID != 150 || roomUser.Y != 11 || roomUser.X != 4)
{
Room.sendSaying(roomUser, "*stops breaking down the wall*");
jailBreakLooper = null;
jailBreakLooper.Abort();
}
if (iCount == 60)
{
Room.sendSaying(roomUser, "*needs three more minutes to succesfully knock down this wall*");
}
if (iCount == 120)
{
Room.sendSaying(roomUser, "*needs two more minutes to succesfully knock down this wall*");
}
if (iCount == 180)
{
Room.sendSaying(roomUser, "*needs one more minute to succesfully knock down this wall*");
}
iCount++;
if (iCount > 180)
{
Room.sendSaying(roomUser, "*successfully breaks down the jail wall freeing everyone inside*");
dbClient.runQuery("UPDATE users SET time_jail = '0', arrested = '0'");
jailBreakLooper = null;
jailBreakLooper.Abort();
}
Thread.Sleep(1000);
}
}
}
}
}
catch
{
Thread.CurrentThread.Abort();
jailBreakLooper = null;
}
}
Pressing thanks would be nice!