void LoadJobData()
{
//Wrap our function inside a catcher
try
{
//Get jobtype information from database
int jobtype = MsSQL.GetDataInt("SELECT * FROM users WHERE id='" + Player.AccountName + "'", "jobtype");
//If we have a job so not 0 value
if (jobtype > 0)
{
//Create our query to get all job information
MsSQL ms = new MsSQL("SELECT * FROM character_jobs WHERE character_name='" + Character.Information.Name + "'");
//Open new sql data reader
using (SqlDataReader reader = ms.Read())
{
//While sql data reader is reading
while (reader.Read())
{
//Set global job name
Character.Job.Jobname = reader.GetString(2);
//Set global job type
Character.Job.type = reader.GetByte(3);
//Set global job exp
Character.Job.exp = reader.GetInt32(4);
//Set global job rank
Character.Job.rank = reader.GetByte(5);
//Set global job state
Character.Job.state = reader.GetInt32(6);
//Set global job level
Character.Job.level = reader.GetByte(7);
}
}
//Close our sql data reader.
ms.Close();
}
}
catch (Exception ex)
{
Console.WriteLine("Job load error {0}", ex);
Systems.Debugger.Write(ex);
}
}