Skip to content

Commit

Permalink
Merge pull request #194 from SpicyDarkFox/dbg
Browse files Browse the repository at this point in the history
правка для лобби ТТС
  • Loading branch information
SpicyDarkFox authored Sep 23, 2024
2 parents 2bce0ac + 127fc24 commit 293fc31
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Corvax/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void OnPlayTTS(PlayTTSEvent ev)
}
else
{
//_audio.PlayGlobal(soundPath, Filter.Local(), false); // поскольку источника нет/не видно, то пусть молчит
_audio.PlayGlobal(soundPath, Filter.Local(), false);
}

_contentRoot.RemoveFile(filePath);
Expand Down
34 changes: 19 additions & 15 deletions Content.Server/Database/ServerDbBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ServerDbBase(ISawmill opsLog)
public async Task<PlayerPreferences?> GetPlayerPreferencesAsync(NetUserId userId)
{
await using var db = await GetDb();

_opsLog.Warning($"Get preferences for profile: {userId}"); //тест БД
var prefs = await db.DbContext
.Preference
.Include(p => p.Profiles).ThenInclude(h => h.Jobs)
Expand Down Expand Up @@ -86,6 +86,8 @@ public async Task SaveCharacterSlotAsync(NetUserId userId, ICharacterProfile? pr
throw new NotImplementedException();
}

_opsLog.Warning($"Saving Character Slot: {userId}/{profile.Name}"); //тест БД

var oldProfile = db.DbContext.Profile
.Include(p => p.Preference)
.Where(p => p.Preference.UserId == userId.UserId)
Expand Down Expand Up @@ -145,7 +147,7 @@ public async Task<PlayerPreferences> InitPrefsAsync(NetUserId userId, ICharacter

await db.DbContext.SaveChangesAsync();

return new PlayerPreferences(new[] {new KeyValuePair<int, ICharacterProfile>(0, defaultProfile)}, 0, Color.FromHex(prefs.AdminOOCColor));
return new PlayerPreferences(new[] { new KeyValuePair<int, ICharacterProfile>(0, defaultProfile) }, 0, Color.FromHex(prefs.AdminOOCColor));
}

public async Task DeleteSlotAndSetSelectedIndex(NetUserId userId, int deleteSlot, int newSlot)
Expand Down Expand Up @@ -184,6 +186,7 @@ private static HumanoidCharacterProfile ConvertProfiles(Profile profile)
var traits = profile.Traits.Select(t => t.TraitName);
var loadouts = profile.Loadouts.Select(t => t.LoadoutName);
#if LPP_Sponsors
Logger.Warning($"Selecting Donates for profile: {profile.Id}/{profile.CharacterName}"); //тест БД
var donates = profile.Donate.Select(t => t.DonateName); // Lost Paradise Donate Preferences
#endif

Expand Down Expand Up @@ -298,22 +301,23 @@ private static Profile ConvertProfiles(HumanoidCharacterProfile humanoid, int sl
profile.Jobs.AddRange(
humanoid.JobPriorities
.Where(j => j.Value != JobPriority.Never)
.Select(j => new Job {JobName = j.Key, Priority = (DbJobPriority) j.Value})
.Select(j => new Job { JobName = j.Key, Priority = (DbJobPriority) j.Value })
);

profile.Antags.Clear();
profile.Antags.AddRange(
humanoid.AntagPreferences
.Select(a => new Antag {AntagName = a})
.Select(a => new Antag { AntagName = a })
);

profile.Traits.Clear();
profile.Traits.AddRange(
humanoid.TraitPreferences
.Select(t => new Trait {TraitName = t})
.Select(t => new Trait { TraitName = t })
);

#if LPP_Sponsors
Logger.Warning($"Converting profile: {profile.Id}/{profile.CharacterName}"); //тест БД
profile.Donate.Clear(); // Lost Paradise Donate Preferences
profile.Donate.AddRange(
humanoid.DonatePreferences
Expand All @@ -324,7 +328,7 @@ private static Profile ConvertProfiles(HumanoidCharacterProfile humanoid, int sl
profile.Loadouts.Clear();
profile.Loadouts.AddRange(
humanoid.LoadoutPreferences
.Select(t => new Loadout {LoadoutName = t})
.Select(t => new Loadout { LoadoutName = t })
);

return profile;
Expand Down Expand Up @@ -1261,7 +1265,7 @@ ban.Unban is null
ban.LastEditedAt,
ban.ExpirationTime,
ban.Hidden,
new [] { ban.RoleId.Replace(BanManager.JobPrefix, null) },
new[] { ban.RoleId.Replace(BanManager.JobPrefix, null) },
MakePlayerRecord(unbanningAdmin),
ban.Unban?.UnbanTime);
}
Expand Down Expand Up @@ -1425,10 +1429,10 @@ public async Task<List<AdminWatchlistRecord>> GetActiveWatchlists(Guid player)
protected async Task<List<AdminWatchlistRecord>> GetActiveWatchlistsImpl(DbGuard db, Guid player)
{
var entities = await (from watchlist in db.DbContext.AdminWatchlists
where watchlist.PlayerUserId == player &&
!watchlist.Deleted &&
(watchlist.ExpirationTime == null || DateTime.UtcNow < watchlist.ExpirationTime)
select watchlist)
where watchlist.PlayerUserId == player &&
!watchlist.Deleted &&
(watchlist.ExpirationTime == null || DateTime.UtcNow < watchlist.ExpirationTime)
select watchlist)
.Include(note => note.Round)
.ThenInclude(r => r!.Server)
.Include(note => note.CreatedBy)
Expand All @@ -1453,9 +1457,9 @@ public async Task<List<AdminMessageRecord>> GetMessages(Guid player)
protected async Task<List<AdminMessageRecord>> GetMessagesImpl(DbGuard db, Guid player)
{
var entities = await (from message in db.DbContext.AdminMessages
where message.PlayerUserId == player && !message.Deleted &&
(message.ExpirationTime == null || DateTime.UtcNow < message.ExpirationTime)
select message).Include(note => note.Round)
where message.PlayerUserId == player && !message.Deleted &&
(message.ExpirationTime == null || DateTime.UtcNow < message.ExpirationTime)
select message).Include(note => note.Round)
.ThenInclude(r => r!.Server)
.Include(note => note.CreatedBy)
.Include(note => note.LastEditedBy)
Expand Down Expand Up @@ -1534,7 +1538,7 @@ protected async Task<List<ServerRoleBanNoteRecord>> GetGroupedServerRoleBansAsNo

// Client side query, as EF can't do groups yet
var bansEnumerable = bansQuery
.GroupBy(ban => new { ban.BanTime, CreatedBy = (Player?)ban.CreatedBy, ban.Reason, Unbanned = ban.Unban == null })
.GroupBy(ban => new { ban.BanTime, CreatedBy = (Player?) ban.CreatedBy, ban.Reason, Unbanned = ban.Unban == null })
.Select(banGroup => banGroup)
.ToArray();

Expand Down

0 comments on commit 293fc31

Please sign in to comment.