Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Maple2.Database/Storage/Game/GameStorage.User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public bool UpdateMachineId(long accountId, Guid machineId) {
return (model, characters);
}

public void SetAllCharacterToOffline() {
Context.Database.ExecuteSqlRaw("UPDATE `character` SET Channel = -1");
}

// If accountId is specified, only characters for the account will be returned.
public Character? GetCharacter(long characterId, long accountId = -1) {
if (accountId < 0) {
Expand Down
7 changes: 7 additions & 0 deletions Maple2.Server.World/WorldServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public WorldServer(GameStorage gameStorage, ChannelClientLookup channelClients,
scheduler.Start();
memoryStringBoards = [];

SetAllCharacterToOffline();

StartDailyReset();
StartWorldEvents();
ScheduleGameEvents();
Expand All @@ -55,6 +57,11 @@ public WorldServer(GameStorage gameStorage, ChannelClientLookup channelClients,
heartbeatThread.Start();
}

private void SetAllCharacterToOffline() {
using GameStorage.Request db = gameStorage.Context();
db.SetAllCharacterToOffline();
}

private void Heartbeat() {
while (!tokenSource.Token.IsCancellationRequested) {
try {
Expand Down