mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-20 11:49:14 +12:00
update
This commit is contained in:
parent
6267910923
commit
7c987d8d35
8 changed files with 242 additions and 29 deletions
|
@ -23,7 +23,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
string UserTable = "CREATE TABLE IF NOT EXISTS Users(Id INT, Username TEXT(16), PassHash TEXT(128), Salt TEXT(128), Gender TEXT(16), Admin TEXT(3), Moderator TEXT(3))";
|
||||
string ExtTable = "CREATE TABLE IF NOT EXISTS UserExt(Id INT, X INT, Y INT, LastLogin INT, Money INT, QuestPoints INT, BankBalance DOUBLE, BankInterest DOUBLE, ProfilePage Text(4000),IpAddress TEXT(1028),PrivateNotes Text(65535), CharId INT, ChatViolations INT,Subscriber TEXT(3), SubscribedUntil INT, Experience INT, Tiredness INT, Hunger INT, Thirst INT, FreeMinutes INT)";
|
||||
string ExtTable = "CREATE TABLE IF NOT EXISTS UserExt(Id INT, X INT, Y INT, LastLogin INT, Money INT, QuestPoints INT, BankBalance DOUBLE, BankInterest DOUBLE, ProfilePage Text(4000),IpAddress TEXT(1028),PrivateNotes Text(65535), CharId INT, ChatViolations INT,Subscriber TEXT(3), SubscribedUntil INT, Experience INT, Tiredness INT, Hunger INT, Thirst INT, FreeMinutes INT, TotalLogins INT)";
|
||||
string MailTable = "CREATE TABLE IF NOT EXISTS Mailbox(RandomId INT, IdTo INT, IdFrom INT, Subject TEXT(100), Message Text(65535), TimeSent INT, BeenRead TEXT(3))";
|
||||
string BuddyTable = "CREATE TABLE IF NOT EXISTS BuddyList(Id INT, IdFriend INT)";
|
||||
string MessageQueue = "CREATE TABLE IF NOT EXISTS MessageQueue(Id INT, Message TEXT(1028))";
|
||||
|
@ -3792,6 +3792,37 @@ namespace HISP.Server
|
|||
return gender;
|
||||
}
|
||||
}
|
||||
public static int GetLoginCount(int playerId)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
|
||||
sqlCommand.CommandText = "SELECT TotalLogins FROM UserExt WHERE Id=@playerId";
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
int count = Convert.ToInt32(sqlCommand.ExecuteScalar());
|
||||
sqlCommand.Dispose();
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
public static void SetLoginCount(int playerId, int count)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
|
||||
sqlCommand.CommandText = "UPDATE UserExt SET TotalLogins=@count WHERE Id=@playerId";
|
||||
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
|
||||
sqlCommand.Parameters.AddWithValue("@count", count);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlCommand.Dispose();
|
||||
}
|
||||
}
|
||||
public static int GetExperience(int playerId)
|
||||
{
|
||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||
|
|
|
@ -256,6 +256,7 @@ namespace HISP.Server
|
|||
LoggedIn = true;
|
||||
|
||||
Database.SetIpAddress(id, RemoteIp);
|
||||
Database.SetLoginCount(id, Database.GetLoginCount(id) + 1);
|
||||
|
||||
inactivityTimer = new Timer(new TimerCallback(keepAliveTimerTick), null, keepAliveInterval, keepAliveInterval);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue