Fix inventory system crash

Forgot to assign position value
This commit is contained in:
Mikhail
2024-07-12 16:22:01 -04:00
parent 9356d347bd
commit 20213153ab
7 changed files with 113 additions and 9 deletions

View File

@@ -137,7 +137,7 @@ namespace nksrv.Utils
}
public class CoreInfo
{
public int DbVersion = 0;
public int DbVersion = 2;
public List<User> Users = [];
public List<AccessToken> LauncherAccessTokens = [];
@@ -187,6 +187,20 @@ namespace nksrv.Utils
}
Console.WriteLine("Database update completed");
}
else if (Instance.DbVersion == 1)
{
Console.WriteLine("Starting database update...");
// there was a bug where equipment position was not saved, so remove all items from each characters
Instance.DbVersion = 2;
foreach (var user in Instance.Users)
{
foreach (var f in user.Items.ToList())
{
f.Csn = 0;
}
}
Console.WriteLine("Database update completed");
}
Save();
}
else