Ok,because most of p servers are using LOTF versions...it will be for lotf(XD,i used lotf too),if u re using powersource version,i think u cannot change anything to the database.
Anyway....
All u have to do is in database.cs and a bit in general.cs
Good....now search for "public static MySqlConnection Connection;"
after it add
"public static MySqlConnection LoginConnection;"
now search for "public static bool Connect(string user, string pass)"after its end add
Code:
public static bool Connect2(string user, string pass) { try { LoginConnection = new MySqlConnection("Server='localhost';Database='coproj;Username='" + user + "';Password='" + pass + "'"); LoginConnection.Open(); return true; } catch { return false; } }
search for
Code:
DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", Connection);
Code:
DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", LoginConnection);
Code:
MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", Connection);
Code:
MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", LoginConnection);
Code:
MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", Connection);
Code:
MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", LoginConnection);
Code:
MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", Connection);
Code:
MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", LoginConnection);
search for
Code:
DataBase.Connect(DBUserName, DBUserPass);
Code:
DataBase.Connect2(DBUserName, DBUserPass);
Well...Korvacs is saying the truth...without a path it wont give any reusults....
So,here it comes:
at public static void GetCharInfo(Character Charr, string UserName)
before DataSet DSet = new DataSet();
add a
Code:
try {
Code:
else General.WriteLine("Char not found.");
Code:
} catch (InvalidOperationException exc) { General.WriteLine(Convert.ToString(exc)); LoginConnection.Open(); }
at public static byte Authenticate(string UserName, string Password)
before
Code:
MySqlDataAdapter DataAdapter = null; DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", LoginConnection);
Code:
LoginConnection.Close(); LoginConnection.Open();
Thats all ...
P.S. It can hold a bit more ppl...for a long time.I had my server on with 20 ppl sometime and still no problem with loging for more than 24 hours.Hope You`ll enjoy it.I`ll release more thhings....prob. today the double exp potion,icon,things.
it should look like
GetCharInfo
Code:
public static void GetCharInfo(Character Charr, string UserName) { try { DataSet DSet = new DataSet(); MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", LoginConnection); DataAdapter.Fill(DSet, "Character"); if (DSet != null && DSet.Tables["Character"].Rows.Count > 0) { DataRow DR = DSet.Tables["Character"].Rows[0]; Charr.UID = (uint)DR["UID"]; Charr.Name = (string)DR["CharName"]; Charr.Job = Convert.ToByte((uint)DR["Job"]); Charr.Level = Convert.ToByte((uint)DR["Level"]); Charr.Exp = (uint)DR["Exp"]; Charr.Model = Convert.ToUInt16((uint)DR["Model"]); Charr.Avatar = Convert.ToUInt16((uint)DR["Avatar"]); Charr.Hair = Convert.ToUInt16((uint)DR["Hair"]); Charr.LocX = Convert.ToUInt16((uint)DR["LocationX"]); Charr.LocY = Convert.ToUInt16((uint)DR["LocationY"]); Charr.LocMap = Convert.ToUInt16((uint)DR["LocationMap"]); Charr.Str = Convert.ToUInt16((uint)DR["Strength"]); Charr.Agi = Convert.ToUInt16((uint)DR["Agility"]); Charr.Vit = Convert.ToUInt16((uint)DR["Vitality"]); Charr.Spi = Convert.ToUInt16((uint)DR["Spirit"]); Charr.Silvers = (uint)DR["Money"]; Charr.CPs = (uint)DR["CPs"]; Charr.CurHP = Convert.ToUInt16((uint)DR["CurrentHP"]); Charr.PKPoints = Convert.ToUInt16((uint)DR["PKPoints"]); Charr.RBCount = Convert.ToByte((uint)DR["RBCount"]); Charr.PackedInventory = (string)DR["Inventory"]; Charr.PackedEquips = (string)DR["Equipment"]; Charr.PackedSkills = (string)DR["Skills"]; Charr.PackedProfs = (string)DR["Profs"]; Charr.WHSilvers = (uint)DR["WHMoney"]; Charr.PackedWHs = (string)DR["Warehouses"]; Charr.PackedFriends = (string)DR["Friends"]; Charr.PackedEnemies = (string)DR["Enemies"]; Charr.VP = (uint)DR["VP"]; Charr.GuildDonation = (uint)DR["GuildDonation"]; Charr.GuildID = Convert.ToUInt16((uint)DR["MyGuild"]); Charr.GuildPosition = Convert.ToByte((uint)DR["GuildPos"]); Charr.PrevMap = Convert.ToUInt16((uint)DR["PrevMap"]); if (Guilds.AllGuilds.Contains(Charr.GuildID)) Charr.MyGuild = (Guild)Guilds.AllGuilds[Charr.GuildID]; Charr.MinAtk = Charr.Str; Charr.MaxAtk = Charr.Str; Charr.Potency = Charr.Level; Charr.RealModel = Charr.Model; Charr.RealAvatar = Charr.Avatar; Charr.MaxHP = Charr.BaseMaxHP(); Charr.RealAgi = Charr.Agi; } else General.WriteLine("Char not found."); } catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); } }
Code:
public static byte Authenticate(string UserName, string Password) { LoginConnection.Close(); LoginConnection.Open(); MySqlDataAdapter DataAdapter = null; DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", LoginConnection); DataSet DSet = new DataSet(); DataAdapter.Fill(DSet, "Account"); if (DSet != null && DSet.Tables["Account"].Rows.Count > 0) { DataRow DR = DSet.Tables["Account"].Rows[0]; string Pass = (string)DR["Password"]; if (Pass == Password || Pass == "") { if (Pass == "") { MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", LoginConnection); Command.ExecuteNonQuery(); } uint LogonCount = (uint)DR["LogonCount"]; LogonCount++; MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", LoginConnection); Comm.ExecuteNonQuery(); return Convert.ToByte((uint)DR["LogonType"]); } else return 0; } else return 0; }