mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +02:00
Fixed the crash when class change is to a level 0 class. Now autosets to level 1.
This commit is contained in:
parent
0b13b590a0
commit
880b1f3066
2 changed files with 92 additions and 0 deletions
|
@ -2352,5 +2352,85 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
}
|
||||
|
||||
public static void PlayerCharacterUpdateClassLevel(Player player, byte classId, short level)
|
||||
{
|
||||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
string[] classNames = {
|
||||
"",
|
||||
"",
|
||||
"pug",
|
||||
"gla",
|
||||
"mrd",
|
||||
"",
|
||||
"",
|
||||
"arc",
|
||||
"lnc",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"thm",
|
||||
"cnj",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"crp",
|
||||
"bsm",
|
||||
"arm",
|
||||
"gsm",
|
||||
"ltw",
|
||||
"wvr",
|
||||
"alc",
|
||||
"cul",
|
||||
"",
|
||||
"",
|
||||
"min",
|
||||
"btn",
|
||||
"fsh"
|
||||
};
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
query = String.Format(@"
|
||||
UPDATE characters_class_levels
|
||||
SET
|
||||
{0}=@level
|
||||
WHERE
|
||||
characterId = @characterId", classNames[classId]);
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@level", level);
|
||||
cmd.Parameters.AddWithValue("@characterId", player.actorId);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue