mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 22:44:36 +02:00
added status effect saving
- added some of the packets to add/remove effects (todo: battle packet too)
This commit is contained in:
parent
d9d185d7e6
commit
53207a9ff0
7 changed files with 132 additions and 56 deletions
|
@ -1799,6 +1799,36 @@ namespace FFXIVClassic_Map_Server
|
|||
}
|
||||
return effects;
|
||||
}
|
||||
|
||||
public static void SavePlayerStatusEffects(Player player)
|
||||
{
|
||||
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();
|
||||
|
||||
// we'll run them all at once instead of one at a time
|
||||
string queries = "";
|
||||
foreach (var effect in player.statusEffects.GetStatusEffects())
|
||||
{
|
||||
var duration = effect.GetDurationMs() + effect.GetStartTime().Millisecond - Program.Tick.Millisecond;
|
||||
|
||||
queries += Environment.NewLine + $"REPLACE INTO characters_statuseffect(characterId, statusId, magnitude, duration, tick, tier, extra) VALUES ({player.actorId}, {effect.GetEffectId()}, {effect.GetMagnitude()}, {duration}, {effect.GetTickMs()}, {effect.GetTier()}, {effect.GetExtra()});";
|
||||
}
|
||||
MySqlCommand cmd = new MySqlCommand(queries, conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue