Holy crap auth works (#2099)
* Holy crap auth works * Fix some usages of UserID instead of UserName * Refactor preferences. They be non-async now. Also faster. * Rename DbContext. * Guest username assignment. * Fix saving of profiles. * Don't store data for guests. * Fix generating invalid random colors. * Don't allow dumb garbage for char preferences. * Bans. * Lol forgot to fill out the command description. * Connection log. * Rename all the tables and columns to be snake_case. * Re-do migrations. * Fixing tests and warnings. * Update submodule
This commit is contained in:
committed by
GitHub
parent
8a33e0a9bd
commit
66c8a68891
@@ -29,12 +29,12 @@ namespace Content.Server.Mobs
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (mgr.TryGetPlayerData(new NetSessionId(args[0]), out var data))
|
||||
if (mgr.TryGetSessionByUsername(args[0], out var data))
|
||||
{
|
||||
var mind = data.ContentData().Mind;
|
||||
|
||||
var builder = new StringBuilder();
|
||||
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.SessionId, mind.OwnedMob?.Owner?.Uid);
|
||||
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedMob?.Owner?.Uid);
|
||||
foreach (var role in mind.AllRoles)
|
||||
{
|
||||
builder.AppendFormat("{0} ", role.Name);
|
||||
@@ -68,7 +68,7 @@ namespace Content.Server.Mobs
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (mgr.TryGetPlayerData(new NetSessionId(args[0]), out var data))
|
||||
if (mgr.TryGetPlayerDataByUsername(args[0], out var data))
|
||||
{
|
||||
var mind = data.ContentData().Mind;
|
||||
var role = new Job(mind, _prototypeManager.Index<JobPrototype>(args[1]));
|
||||
@@ -100,7 +100,7 @@ namespace Content.Server.Mobs
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IPlayerManager>();
|
||||
if (mgr.TryGetPlayerData(new NetSessionId(args[0]), out var data))
|
||||
if (mgr.TryGetPlayerDataByUsername(args[0], out var data))
|
||||
{
|
||||
var mind = data.ContentData().Mind;
|
||||
var role = new Job(mind, _prototypeManager.Index<JobPrototype>(args[1]));
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace Content.Server.Mobs
|
||||
/// <summary>
|
||||
/// Creates the new mind attached to a specific player session.
|
||||
/// </summary>
|
||||
/// <param name="sessionId">The session ID of the owning player.</param>
|
||||
public Mind(NetSessionId sessionId)
|
||||
/// <param name="userId">The session ID of the owning player.</param>
|
||||
public Mind(NetUserId userId)
|
||||
{
|
||||
SessionId = sessionId;
|
||||
UserId = userId;
|
||||
}
|
||||
|
||||
// TODO: This session should be able to be changed, probably.
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.Mobs
|
||||
/// The session ID of the player owning this mind.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public NetSessionId? SessionId { get; private set; }
|
||||
public NetUserId? UserId { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public bool IsVisitingEntity => VisitingEntity != null;
|
||||
@@ -83,12 +83,12 @@ namespace Content.Server.Mobs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!SessionId.HasValue)
|
||||
if (!UserId.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
playerMgr.TryGetSessionById(SessionId.Value, out var ret);
|
||||
playerMgr.TryGetSessionById(UserId.Value, out var ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ namespace Content.Server.Mobs
|
||||
VisitingEntity = null;
|
||||
}
|
||||
|
||||
public void ChangeOwningPlayer(NetSessionId? newOwner)
|
||||
public void ChangeOwningPlayer(NetUserId? newOwner)
|
||||
{
|
||||
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
PlayerData newOwnerData = null;
|
||||
@@ -216,12 +216,12 @@ namespace Content.Server.Mobs
|
||||
var oldSession = Session;
|
||||
oldSession?.AttachToEntity(null);
|
||||
|
||||
if (SessionId.HasValue)
|
||||
if (UserId.HasValue)
|
||||
{
|
||||
playerMgr.GetPlayerData(SessionId.Value).ContentData().Mind = null;
|
||||
playerMgr.GetPlayerData(UserId.Value).ContentData().Mind = null;
|
||||
}
|
||||
|
||||
SessionId = newOwner;
|
||||
UserId = newOwner;
|
||||
if (!newOwner.HasValue)
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user