mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-06-09 10:06:46 +02:00
Add sponsors color (#551)
This commit is contained in:
@@ -54,7 +54,7 @@ namespace Content.Client.Lobby
|
|||||||
|
|
||||||
public void SelectCharacter(int slot)
|
public void SelectCharacter(int slot)
|
||||||
{
|
{
|
||||||
Preferences = new PlayerPreferences(Preferences.Characters, slot, Preferences.AdminOOCColor, Preferences.ConstructionFavorites);
|
Preferences = new PlayerPreferences(Preferences.Characters, slot, Preferences.AdminOOCColor, Preferences.ConstructionFavorites/*WL-Changes: Sponsor*/, Preferences.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
var msg = new MsgSelectCharacter
|
var msg = new MsgSelectCharacter
|
||||||
{
|
{
|
||||||
SelectedCharacterIndex = slot
|
SelectedCharacterIndex = slot
|
||||||
@@ -70,7 +70,7 @@ namespace Content.Client.Lobby
|
|||||||
profile.EnsureValid(_playerManager.LocalSession!, collection, sponsorPrototypes);
|
profile.EnsureValid(_playerManager.LocalSession!, collection, sponsorPrototypes);
|
||||||
// Corvax-Sponsors-End
|
// Corvax-Sponsors-End
|
||||||
var characters = new Dictionary<int, HumanoidCharacterProfile>(Preferences.Characters) {[slot] = profile};
|
var characters = new Dictionary<int, HumanoidCharacterProfile>(Preferences.Characters) {[slot] = profile};
|
||||||
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, Preferences.ConstructionFavorites);
|
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, Preferences.ConstructionFavorites/*WL-Changes: Sponsor*/, Preferences.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
var msg = new MsgUpdateCharacter
|
var msg = new MsgUpdateCharacter
|
||||||
{
|
{
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
@@ -93,7 +93,7 @@ namespace Content.Client.Lobby
|
|||||||
|
|
||||||
var l = lowest.Value;
|
var l = lowest.Value;
|
||||||
characters.Add(l, profile);
|
characters.Add(l, profile);
|
||||||
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, Preferences.ConstructionFavorites);
|
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, Preferences.ConstructionFavorites/*WL-Changes: Sponsor*/, Preferences.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
|
|
||||||
UpdateCharacter(profile, l);
|
UpdateCharacter(profile, l);
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ namespace Content.Client.Lobby
|
|||||||
public void DeleteCharacter(int slot)
|
public void DeleteCharacter(int slot)
|
||||||
{
|
{
|
||||||
var characters = Preferences.Characters.Where(p => p.Key != slot);
|
var characters = Preferences.Characters.Where(p => p.Key != slot);
|
||||||
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, Preferences.ConstructionFavorites);
|
Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, Preferences.ConstructionFavorites/*WL-Changes: Sponsor*/, Preferences.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
var msg = new MsgDeleteCharacter
|
var msg = new MsgDeleteCharacter
|
||||||
{
|
{
|
||||||
Slot = slot
|
Slot = slot
|
||||||
@@ -116,7 +116,7 @@ namespace Content.Client.Lobby
|
|||||||
|
|
||||||
public void UpdateConstructionFavorites(List<ProtoId<ConstructionPrototype>> favorites)
|
public void UpdateConstructionFavorites(List<ProtoId<ConstructionPrototype>> favorites)
|
||||||
{
|
{
|
||||||
Preferences = new PlayerPreferences(Preferences.Characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, favorites);
|
Preferences = new PlayerPreferences(Preferences.Characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor, favorites/*WL-Changes: Sponsor*/, Preferences.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
var msg = new MsgUpdateConstructionFavorites
|
var msg = new MsgUpdateConstructionFavorites
|
||||||
{
|
{
|
||||||
Favorites = favorites
|
Favorites = favorites
|
||||||
|
|||||||
+2350
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Content.Server.Database.Migrations.Postgres
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class SponsorColor : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "sponsor_color",
|
||||||
|
table: "preference",
|
||||||
|
type: "text",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "sponsor_color",
|
||||||
|
table: "preference");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1113,6 +1113,11 @@ namespace Content.Server.Database.Migrations.Postgres
|
|||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("selected_character_slot");
|
.HasColumnName("selected_character_slot");
|
||||||
|
|
||||||
|
b.Property<string>("SponsorColor")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("sponsor_color");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasColumnName("user_id");
|
.HasColumnName("user_id");
|
||||||
|
|||||||
+2261
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Content.Server.Database.Migrations.Sqlite
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class SponsorColor : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "sponsor_color",
|
||||||
|
table: "preference",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "sponsor_color",
|
||||||
|
table: "preference");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1046,6 +1046,11 @@ namespace Content.Server.Database.Migrations.Sqlite
|
|||||||
.HasColumnType("INTEGER")
|
.HasColumnType("INTEGER")
|
||||||
.HasColumnName("selected_character_slot");
|
.HasColumnName("selected_character_slot");
|
||||||
|
|
||||||
|
b.Property<string>("SponsorColor")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("sponsor_color");
|
||||||
|
|
||||||
b.Property<Guid>("UserId")
|
b.Property<Guid>("UserId")
|
||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT")
|
||||||
.HasColumnName("user_id");
|
.HasColumnName("user_id");
|
||||||
|
|||||||
@@ -377,6 +377,9 @@ namespace Content.Server.Database
|
|||||||
public string AdminOOCColor { get; set; } = null!;
|
public string AdminOOCColor { get; set; } = null!;
|
||||||
public List<string> ConstructionFavorites { get; set; } = new();
|
public List<string> ConstructionFavorites { get; set; } = new();
|
||||||
public List<Profile> Profiles { get; } = new();
|
public List<Profile> Profiles { get; } = new();
|
||||||
|
// WL-Changes: Sponsor start
|
||||||
|
public string SponsorColor { get; set; } = null!;
|
||||||
|
// WL-Changes: Sponsor end
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Profile
|
public class Profile
|
||||||
|
|||||||
@@ -292,9 +292,9 @@ internal sealed partial class ChatManager : IChatManager
|
|||||||
|
|
||||||
Color? colorOverride = null;
|
Color? colorOverride = null;
|
||||||
var wrappedMessage = Loc.GetString("chat-manager-send-ooc-wrap-message", ("playerName",player.Name), ("message", FormattedMessage.EscapeText(message)));
|
var wrappedMessage = Loc.GetString("chat-manager-send-ooc-wrap-message", ("playerName",player.Name), ("message", FormattedMessage.EscapeText(message)));
|
||||||
|
var prefs = _preferencesManager.GetPreferences(player.UserId);
|
||||||
if (_adminManager.HasAdminFlag(player, AdminFlags.NameColor))
|
if (_adminManager.HasAdminFlag(player, AdminFlags.NameColor))
|
||||||
{
|
{
|
||||||
var prefs = _preferencesManager.GetPreferences(player.UserId);
|
|
||||||
colorOverride = prefs.AdminOOCColor;
|
colorOverride = prefs.AdminOOCColor;
|
||||||
}
|
}
|
||||||
if ( _netConfigManager.GetClientCVar(player.Channel, CCVars.ShowOocPatronColor) && player.Channel.UserData.PatronTier is { } patron && PatronOocColors.TryGetValue(patron, out var patronColor))
|
if ( _netConfigManager.GetClientCVar(player.Channel, CCVars.ShowOocPatronColor) && player.Channel.UserData.PatronTier is { } patron && PatronOocColors.TryGetValue(patron, out var patronColor))
|
||||||
@@ -309,6 +309,13 @@ internal sealed partial class ChatManager : IChatManager
|
|||||||
}
|
}
|
||||||
// Corvax-Sponsors-End
|
// Corvax-Sponsors-End
|
||||||
|
|
||||||
|
// WL-Chages: Sponsor start
|
||||||
|
if (prefs.SponsorColor != Color.Red)
|
||||||
|
{
|
||||||
|
wrappedMessage = Loc.GetString("chat-manager-send-ooc-patron-wrap-message", ("patronColor", prefs.SponsorColor),("playerName", player.Name), ("message", FormattedMessage.EscapeText(message)));
|
||||||
|
}
|
||||||
|
// WL-Chages: Sponsor end
|
||||||
|
|
||||||
//TODO: player.Name color, this will need to change the structure of the MsgChatMessage
|
//TODO: player.Name color, this will need to change the structure of the MsgChatMessage
|
||||||
ChatMessageToAll(ChatChannel.OOC, message, wrappedMessage, EntityUid.Invalid, hideChat: false, recordReplay: true, colorOverride: colorOverride, author: player.UserId);
|
ChatMessageToAll(ChatChannel.OOC, message, wrappedMessage, EntityUid.Invalid, hideChat: false, recordReplay: true, colorOverride: colorOverride, author: player.UserId);
|
||||||
_discordLink.SendMessage(message, player.Name, ChatChannel.OOC);
|
_discordLink.SendMessage(message, player.Name, ChatChannel.OOC);
|
||||||
|
|||||||
@@ -217,6 +217,9 @@ namespace Content.Server.Database
|
|||||||
SelectedCharacterSlot = 0,
|
SelectedCharacterSlot = 0,
|
||||||
AdminOOCColor = Color.Red.ToHex(),
|
AdminOOCColor = Color.Red.ToHex(),
|
||||||
ConstructionFavorites = [],
|
ConstructionFavorites = [],
|
||||||
|
//WL-Changes: Sponsor start
|
||||||
|
SponsorColor = Color.Red.ToHex(),
|
||||||
|
//WL-Changes: Sponsor end
|
||||||
};
|
};
|
||||||
|
|
||||||
prefs.Profiles.Add(profile);
|
prefs.Profiles.Add(profile);
|
||||||
@@ -238,6 +241,20 @@ namespace Content.Server.Database
|
|||||||
await db.DbContext.SaveChangesAsync();
|
await db.DbContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//WL-Changes: Sponsor start
|
||||||
|
public async Task SaveSponsorColorAsync(NetUserId userId, Color color)
|
||||||
|
{
|
||||||
|
await using var db = await GetDb();
|
||||||
|
var prefs = await db.DbContext
|
||||||
|
.Preference
|
||||||
|
.Include(p => p.Profiles)
|
||||||
|
.SingleAsync(p => p.UserId == userId.UserId);
|
||||||
|
prefs.SponsorColor = color.ToHex();
|
||||||
|
|
||||||
|
await db.DbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
//WL-Changes: Sponsor start
|
||||||
|
|
||||||
public async Task SaveAdminOOCColorAsync(NetUserId userId, Color color)
|
public async Task SaveAdminOOCColorAsync(NetUserId userId, Color color)
|
||||||
{
|
{
|
||||||
await using var db = await GetDb();
|
await using var db = await GetDb();
|
||||||
@@ -248,7 +265,6 @@ namespace Content.Server.Database
|
|||||||
prefs.AdminOOCColor = color.ToHex();
|
prefs.AdminOOCColor = color.ToHex();
|
||||||
|
|
||||||
await db.DbContext.SaveChangesAsync();
|
await db.DbContext.SaveChangesAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveConstructionFavoritesAsync(NetUserId userId, List<ProtoId<ConstructionPrototype>> constructionFavorites)
|
public async Task SaveConstructionFavoritesAsync(NetUserId userId, List<ProtoId<ConstructionPrototype>> constructionFavorites)
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ namespace Content.Server.Database
|
|||||||
|
|
||||||
Task SaveAdminOOCColorAsync(NetUserId userId, Color color);
|
Task SaveAdminOOCColorAsync(NetUserId userId, Color color);
|
||||||
|
|
||||||
|
// WL-Changes: Sponsor start
|
||||||
|
Task SaveSponsorColorAsync(NetUserId userId, Color color);
|
||||||
|
// WL-Changes: Sponsor end
|
||||||
|
|
||||||
Task SaveConstructionFavoritesAsync(NetUserId userId, List<ProtoId<ConstructionPrototype>> constructionFavorites);
|
Task SaveConstructionFavoritesAsync(NetUserId userId, List<ProtoId<ConstructionPrototype>> constructionFavorites);
|
||||||
|
|
||||||
// Single method for two operations for transaction.
|
// Single method for two operations for transaction.
|
||||||
@@ -496,6 +500,14 @@ namespace Content.Server.Database
|
|||||||
return RunDbCommand(() => _db.DeleteSlotAndSetSelectedIndex(userId, deleteSlot, newSlot));
|
return RunDbCommand(() => _db.DeleteSlotAndSetSelectedIndex(userId, deleteSlot, newSlot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//WL-Changes: Sponsor start
|
||||||
|
public Task SaveSponsorColorAsync(NetUserId userId, Color color)
|
||||||
|
{
|
||||||
|
DbWriteOpsMetric.Inc();
|
||||||
|
return RunDbCommand(() => _db.SaveSponsorColorAsync(userId, color));
|
||||||
|
}
|
||||||
|
//WL-Changes: Sponsor end
|
||||||
|
|
||||||
public Task SaveAdminOOCColorAsync(NetUserId userId, Color color)
|
public Task SaveAdminOOCColorAsync(NetUserId userId, Color color)
|
||||||
{
|
{
|
||||||
DbWriteOpsMetric.Inc();
|
DbWriteOpsMetric.Inc();
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
foreach (var favorite in prefs.ConstructionFavorites)
|
foreach (var favorite in prefs.ConstructionFavorites)
|
||||||
constructionFavorites.Add(new ProtoId<ConstructionPrototype>(favorite));
|
constructionFavorites.Add(new ProtoId<ConstructionPrototype>(favorite));
|
||||||
|
|
||||||
return new PlayerPreferences(profiles, prefs.SelectedCharacterSlot, Color.FromHex(prefs.AdminOOCColor), constructionFavorites);
|
return new PlayerPreferences(profiles, prefs.SelectedCharacterSlot, Color.FromHex(prefs.AdminOOCColor), constructionFavorites/*WL-Changes: Sponsor*/, Color.FromHex(prefs.SponsorColor)/*WL-Changes: Sponsor*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal HumanoidCharacterProfile ConvertProfiles(Profile profile)
|
internal HumanoidCharacterProfile ConvertProfiles(Profile profile)
|
||||||
@@ -239,7 +239,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prefsData.Prefs = new PlayerPreferences(curPrefs.Characters, index, curPrefs.AdminOOCColor, curPrefs.ConstructionFavorites);
|
prefsData.Prefs = new PlayerPreferences(curPrefs.Characters, index, curPrefs.AdminOOCColor, curPrefs.ConstructionFavorites/*WL-Changes: Sponsor*/, curPrefs.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
|
|
||||||
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
||||||
{
|
{
|
||||||
@@ -284,7 +284,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
[slot] = profile
|
[slot] = profile
|
||||||
};
|
};
|
||||||
|
|
||||||
prefsData.Prefs = new PlayerPreferences(profiles, slot, curPrefs.AdminOOCColor, curPrefs.ConstructionFavorites);
|
prefsData.Prefs = new PlayerPreferences(profiles, slot, curPrefs.AdminOOCColor, curPrefs.ConstructionFavorites/*WL-Changes: Sponsor*/, curPrefs.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
|
|
||||||
if (ShouldStorePrefs(session.Channel.AuthType))
|
if (ShouldStorePrefs(session.Channel.AuthType))
|
||||||
await _db.SaveCharacterSlotAsync(userId, profile, slot);
|
await _db.SaveCharacterSlotAsync(userId, profile, slot);
|
||||||
@@ -299,7 +299,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var curPrefs = prefsData.Prefs!;
|
var curPrefs = prefsData.Prefs!;
|
||||||
prefsData.Prefs = new PlayerPreferences(curPrefs.Characters, curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor, favorites);
|
prefsData.Prefs = new PlayerPreferences(curPrefs.Characters, curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor, favorites/*WL-Changes: Sponsor*/, curPrefs.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
|
|
||||||
var session = _playerManager.GetSessionById(userId);
|
var session = _playerManager.GetSessionById(userId);
|
||||||
if (ShouldStorePrefs(session.Channel.AuthType))
|
if (ShouldStorePrefs(session.Channel.AuthType))
|
||||||
@@ -343,7 +343,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
var arr = new Dictionary<int, HumanoidCharacterProfile>(curPrefs.Characters);
|
var arr = new Dictionary<int, HumanoidCharacterProfile>(curPrefs.Characters);
|
||||||
arr.Remove(slot);
|
arr.Remove(slot);
|
||||||
|
|
||||||
prefsData.Prefs = new PlayerPreferences(arr, nextSlot ?? curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor, curPrefs.ConstructionFavorites);
|
prefsData.Prefs = new PlayerPreferences(arr, nextSlot ?? curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor, curPrefs.ConstructionFavorites/*WL-Changes: Sponsor*/, curPrefs.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
|
|
||||||
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
||||||
{
|
{
|
||||||
@@ -384,7 +384,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var curPrefs = prefsData.Prefs!;
|
var curPrefs = prefsData.Prefs!;
|
||||||
prefsData.Prefs = new PlayerPreferences(curPrefs.Characters, curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor, validatedList);
|
prefsData.Prefs = new PlayerPreferences(curPrefs.Characters, curPrefs.SelectedCharacterIndex, curPrefs.AdminOOCColor, validatedList/*WL-Changes: Sponsor*/, curPrefs.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
|
|
||||||
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
if (ShouldStorePrefs(message.MsgChannel.AuthType))
|
||||||
{
|
{
|
||||||
@@ -403,7 +403,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
PrefsLoaded = true,
|
PrefsLoaded = true,
|
||||||
Prefs = new PlayerPreferences(
|
Prefs = new PlayerPreferences(
|
||||||
new[] { new KeyValuePair<int, HumanoidCharacterProfile>(0, HumanoidCharacterProfile.Random()) },
|
new[] { new KeyValuePair<int, HumanoidCharacterProfile>(0, HumanoidCharacterProfile.Random()) },
|
||||||
0, Color.Transparent, [])
|
0, Color.Transparent, []/*WL-Changes: Sponsor*/, Color.Transparent/*WL-Changes: Sponsor*/)
|
||||||
};
|
};
|
||||||
|
|
||||||
_cachedPlayerPrefs[session.UserId] = prefsData;
|
_cachedPlayerPrefs[session.UserId] = prefsData;
|
||||||
@@ -542,7 +542,7 @@ namespace Content.Server.Preferences.Managers
|
|||||||
return new PlayerPreferences(prefs.Characters.Select(p =>
|
return new PlayerPreferences(prefs.Characters.Select(p =>
|
||||||
{
|
{
|
||||||
return new KeyValuePair<int, HumanoidCharacterProfile>(p.Key, p.Value.Validated(session, collection, sponsorPrototypes));// Corvax-Sponsors
|
return new KeyValuePair<int, HumanoidCharacterProfile>(p.Key, p.Value.Validated(session, collection, sponsorPrototypes));// Corvax-Sponsors
|
||||||
}), prefs.SelectedCharacterIndex, prefs.AdminOOCColor, prefs.ConstructionFavorites);
|
}), prefs.SelectedCharacterIndex, prefs.AdminOOCColor, prefs.ConstructionFavorites/*WL-Changes: Sponsor*/, prefs.SponsorColor/*WL-Changes: Sponsor*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<KeyValuePair<NetUserId, HumanoidCharacterProfile>> GetSelectedProfilesForPlayers(
|
public IEnumerable<KeyValuePair<NetUserId, HumanoidCharacterProfile>> GetSelectedProfilesForPlayers(
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using Content.Server.Administration;
|
||||||
|
using Content.Server.Database;
|
||||||
|
using Content.Server.Preferences.Managers;
|
||||||
|
using Content.Shared.Administration;
|
||||||
|
using Content.Shared.Players;
|
||||||
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Console;
|
||||||
|
|
||||||
|
namespace Content.Server._WL.Administration.Commands
|
||||||
|
{
|
||||||
|
[AdminCommand(AdminFlags.NameColor)]
|
||||||
|
internal sealed class SetSponsorColor: LocalizedCommands
|
||||||
|
{
|
||||||
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
[Dependency] private readonly IServerDbManager _dbManager = default!;
|
||||||
|
[Dependency] private readonly IServerPreferencesManager _preferenceManager = default!;
|
||||||
|
|
||||||
|
public override string Command => "setsponsorcolor";
|
||||||
|
|
||||||
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (args.Length < 2)
|
||||||
|
{
|
||||||
|
shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_playerManager.TryGetSessionByUsername(args[0], out var session))
|
||||||
|
{
|
||||||
|
shell.WriteLine(Loc.GetString("shell-target-player-does-not-exist"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var color = Color.TryFromHex(args[1]);
|
||||||
|
if (!color.HasValue)
|
||||||
|
{
|
||||||
|
shell.WriteError(Loc.GetString("shell-invalid-color-hex"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the DB
|
||||||
|
_dbManager.SaveSponsorColorAsync(session.UserId, color.Value);
|
||||||
|
// Update the cached preference
|
||||||
|
var prefs = _preferenceManager.GetPreferences(session.UserId);
|
||||||
|
prefs.SponsorColor = color.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,12 +15,15 @@ namespace Content.Shared.Preferences
|
|||||||
{
|
{
|
||||||
private Dictionary<int, HumanoidCharacterProfile> _characters;
|
private Dictionary<int, HumanoidCharacterProfile> _characters;
|
||||||
|
|
||||||
public PlayerPreferences(IEnumerable<KeyValuePair<int, HumanoidCharacterProfile>> characters, int selectedCharacterIndex, Color adminOOCColor, List<ProtoId<ConstructionPrototype>> constructionFavorites)
|
public PlayerPreferences(IEnumerable<KeyValuePair<int, HumanoidCharacterProfile>> characters, int selectedCharacterIndex, Color adminOOCColor, List<ProtoId<ConstructionPrototype>> constructionFavorites, /*WL-Changes: Sponsor*/Color sponsorColor/*WL-Changes: Sponsor*/)
|
||||||
{
|
{
|
||||||
_characters = new Dictionary<int, HumanoidCharacterProfile>(characters);
|
_characters = new Dictionary<int, HumanoidCharacterProfile>(characters);
|
||||||
SelectedCharacterIndex = selectedCharacterIndex;
|
SelectedCharacterIndex = selectedCharacterIndex;
|
||||||
AdminOOCColor = adminOOCColor;
|
AdminOOCColor = adminOOCColor;
|
||||||
ConstructionFavorites = constructionFavorites;
|
ConstructionFavorites = constructionFavorites;
|
||||||
|
//WL-Changes: Sponsor start
|
||||||
|
SponsorColor = sponsorColor;
|
||||||
|
//WL-Changes: Sponsor end
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -45,6 +48,10 @@ namespace Content.Shared.Preferences
|
|||||||
|
|
||||||
public Color AdminOOCColor { get; set; }
|
public Color AdminOOCColor { get; set; }
|
||||||
|
|
||||||
|
//WL-Changes: Sponsor start
|
||||||
|
public Color SponsorColor { get; set; }
|
||||||
|
//WL-Changes: Sponsor end
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of favorite items in the construction menu.
|
/// List of favorite items in the construction menu.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cmd-setsponsorcolor-desc = Устанавливает спонсорский цвет ника игрока. Цвет должен быть в шестнадцатеричном (HEX) формате, пример: setsponsorcolor tau #c43b23
|
||||||
|
cmd-setsponsorcolor-help = Использование: setsponsorcolor <ckey> <color>
|
||||||
Reference in New Issue
Block a user