@ -63,7 +63,7 @@ public class Account
@@ -63,7 +63,7 @@ public class Account
}
}
rdr.Close();
sql="select username,name,level,race,class from characters.characters join auth.account on characters.characters.account = auth.account.id where characters.characters.account=@id";
sql="select guid,username,name,level,race,class from characters.characters join auth.account on characters.characters.account = auth.account.id where characters.characters.account=@id";
cmd=newMySqlCommand(sql,conn);
cmd.Parameters.AddWithValue("id",this.Id);
rdr=cmd.ExecuteReader();
@ -73,11 +73,12 @@ public class Account
@@ -73,11 +73,12 @@ public class Account
//select username,name,level,race,class from characters.characters join auth.account on characters.characters.account = auth.account.id where characters.characters.online = 1;
publicstringUsername{get;set;}
publicstringName{get;set;}
publicintLevel{get;set;}
publicintRace{get;set;}
publicintClass{get;set;}
publicstring[]classes={
publicclassCharacter
{
//select username,name,level,race,class from characters.characters join auth.account on characters.characters.account = auth.account.id where characters.characters.online = 1;
publicintguid{get;set;}
publicstringUsername{get;set;}
publicstringName{get;set;}
publicintLevel{get;set;}
publicintRace{get;set;}
publicintClass{get;set;}
publicAtLoginOptionsAtLogin{get;set;}
publicstring[]classes={
"Null",
"Warrior",
"Paladin",
@ -22,7 +30,7 @@ public class Character
@@ -22,7 +30,7 @@ public class Character
"Druid",
"Demon Hunter"
};
publicstring[]races={
publicstring[]races={
"Null",
"Human",
"Orc",
@ -36,12 +44,65 @@ public class Character
@@ -36,12 +44,65 @@ public class Character
"Blood Elf",
"Draenei"
};
publicstringGetClass()
{
returnclasses[this.Class];
}
publicstringGetRace()
{
returnraces[this.Race];
[Flags]
publicenumAtLoginOptions
{
AT_LOGIN_RENAME=1,
AT_LOGIN_RESET_SPELLS=2,
AT_LOGIN_RESET_TALENTS=4,
AT_LOGIN_CUSTOMIZE=8,
AT_LOGIN_RESET_PET_TALENTS=16,
AT_LOGIN_FIRST=32,
AT_LOGIN_CHANGE_FACTION=64,
AT_LOGIN_CHANGE_RACE=128
}
publicstringGetClass()
{
returnclasses[this.Class];
}
publicstringGetRace()
{
returnraces[this.Race];
}
publicCharacter(){}
publicCharacter(intguid,MySqlConnectionconn)
{
conn.Open();
stringsql="select username,name,level,race,class,at_login from characters.characters join auth.account on characters.characters.account = auth.account.id where characters.characters.guid=@id";
MySqlCommandcmd=newMySqlCommand(sql,conn);
cmd.Parameters.AddWithValue("id",guid);
MySqlDataReaderrdr=cmd.ExecuteReader();
while(rdr.Read())
{
try
{
this.guid=guid;
this.Username=rdr.GetString(0);
this.Name=rdr.GetString(1);
this.Level=rdr.GetByte(2);
this.Race=rdr.GetByte(3);
this.Class=rdr.GetByte(4);
this.AtLogin=(AtLoginOptions)rdr.GetUInt16(5);
}
catch(Exceptione)
{
Console.WriteLine(e);
}
}
rdr.Close();
conn.Close();
}
publicvoidSetAtLogin(MySqlConnectionconn){
conn.Open();
stringsql="update characters.characters set at_login=@loginOpts where guid=@guid";