From 5b4c9b664823c79f40439d605948198d270cc4b1 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Mon, 1 Nov 2021 21:34:55 -0400 Subject: [PATCH] Added TransferToAccount method --- Character.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Character.cs b/Character.cs index 216e61b..0e25851 100644 --- a/Character.cs +++ b/Character.cs @@ -97,15 +97,30 @@ namespace NightmareCoreWeb2 conn.Close(); } - public void SetAtLogin() { + public bool TransferToAccount(int newAccount) + { + MySqlConnection conn = new MySqlConnection(Program.connStr); + conn.Open(); + string sql = "update characters.characters set account=@newAccount where guid=@guid"; + MySqlCommand cmd = new MySqlCommand(sql, conn); + cmd.Parameters.AddWithValue("guid", this.guid); + cmd.Parameters.AddWithValue("newAccount", newAccount); + int status = cmd.ExecuteNonQuery(); + conn.Close(); + return status == 1; + } + + public bool SetAtLogin() + { MySqlConnection conn = new MySqlConnection(Program.connStr); conn.Open(); string sql = "update characters.characters set at_login=@loginOpts where guid=@guid"; MySqlCommand cmd = new MySqlCommand(sql, conn); cmd.Parameters.AddWithValue("guid", this.guid); cmd.Parameters.AddWithValue("loginOpts", (int)this.AtLogin); - cmd.ExecuteNonQuery(); + int status = cmd.ExecuteNonQuery(); conn.Close(); + return status == 1; } } } \ No newline at end of file