Long overdue save command
This commit is contained in:
parent
e866af9ee9
commit
e400325184
|
@ -0,0 +1,15 @@
|
|||
namespace AscNet.GameServer.Commands
|
||||
{
|
||||
[CommandName("save")]
|
||||
internal class SaveCommand : Command
|
||||
{
|
||||
public SaveCommand(Session session, string[] args, bool validate = true) : base(session, args, validate) { }
|
||||
|
||||
public override string Help => "Command to save the current session state to the database";
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
session.Save();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -227,15 +227,21 @@ namespace AscNet.GameServer
|
|||
return;
|
||||
|
||||
// DB save on disconnect
|
||||
log.Info($"Saving session state...");
|
||||
player?.Save();
|
||||
character?.Save();
|
||||
stage?.Save();
|
||||
inventory?.Save();
|
||||
Save();
|
||||
|
||||
log.Warn($"{id} disconnected");
|
||||
client.Close();
|
||||
Server.Instance.Sessions.Remove(id);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
player?.Save();
|
||||
character?.Save();
|
||||
stage?.Save();
|
||||
inventory?.Save();
|
||||
|
||||
log.Info($"Saving session state...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue