[Feat] Респект и уважуха (#476)

* db

* wd comment

* manager & commands

* system & round end results

* raise ban event

* client manager & cached values

* role pick tweak

* tweak last commit

* more fixes

* weights fix

* Fix for short rounds

* tweak in cached dictionary

* reva pick system

* fix last commit

* cult role pick

* nukeops role picking

* fix cache in async & show command

* ooc msg show value

* move pick method to manager & traitor pick fix
This commit is contained in:
HitPanda
2023-10-08 15:53:28 +03:00
committed by Aviu00
parent a29e004eba
commit 7c9bd1d934
37 changed files with 3752 additions and 25 deletions

View File

@@ -22,6 +22,7 @@ using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server.UtkaIntegration;
using System.Threading.Tasks;
using Content.Server.White.Reputation;
using Content.Server.White.Stalin;
using Content.Shared.Database;
using Content.Shared.White;
@@ -37,6 +38,7 @@ namespace Content.Server.GameTicking
//WD-EDIT
[Dependency] private readonly UtkaTCPWrapper _utkaSocketWrapper = default!;
[Dependency] private readonly StalinManager _stalinManager = default!;
[Dependency] private readonly ReputationSystem _repSys = default!;
//WD-EDIT
private static readonly Counter RoundNumberMetric = Metrics.CreateCounter(
@@ -394,6 +396,17 @@ namespace Content.Server.GameTicking
var roles = _roles.MindGetAllRoles(mindId);
// WD start
var reputation = "";
if (mind.Session != null &&
_repSys.TryModifyReputationOnRoundEnd(mind.Session.Name, out var value, out var delta))
{
var color = value >= 0 ? "green" : "red";
var change = delta >= 0 ? $"+{delta}" : $"{delta}";
reputation = $"[color={color}]{value} ({change})";
}
// WD end
var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo()
{
// Note that contentPlayerData?.Name sticks around after the player is disconnected.
@@ -407,7 +420,8 @@ namespace Content.Server.GameTicking
: roles.FirstOrDefault().Name ?? Loc.GetString("game-ticker-unknown-role"),
Antag = antag,
Observer = observer,
Connected = connected
Connected = connected,
Reputation = reputation
};
listOfPlayerInfo.Add(playerEndRoundInfo);
}

View File

@@ -29,6 +29,9 @@ using Content.Server.Station.Systems;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
using Content.Shared.CCVar;
using Content.Server.Traitor;
using Content.Server.White.Administration;
using Content.Server.White.Reputation;
using Content.Shared.Dataset;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
@@ -86,6 +89,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly WarDeclaratorSystem _warDeclarator = default!;
//WD EDIT
[Dependency] private readonly ReputationManager _reputationManager = default!;
//WD EDIT
[ValidatePrototypeId<CurrencyPrototype>]
@@ -686,7 +692,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
}
else
{
nukeOp = _random.PickAndTake(cmdrPrefList);
//nukeOp = _random.PickAndTake(cmdrPrefList);
nukeOp = _reputationManager.PickPlayerBasedOnReputation(cmdrPrefList); // WD edit
cmdrPrefList.Remove(nukeOp); // WD edit
everyone.Remove(nukeOp);
prefList.Remove(nukeOp);
medPrefList.Remove(nukeOp);
@@ -716,7 +724,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
}
else
{
nukeOp = _random.PickAndTake(medPrefList);
//nukeOp = _random.PickAndTake(medPrefList);
nukeOp = _reputationManager.PickPlayerBasedOnReputation(medPrefList); // WD edit
medPrefList.Remove(nukeOp); // WD edit
everyone.Remove(nukeOp);
prefList.Remove(nukeOp);
Logger.InfoS("preset", "Insufficient preferred nukeop commanders, picking an agent");
@@ -725,7 +735,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
}
else
{
nukeOp = _random.PickAndTake(prefList);
//nukeOp = _random.PickAndTake(prefList);
nukeOp = _reputationManager.PickPlayerBasedOnReputation(prefList); // WD edit
prefList.Remove(nukeOp); // WD edit
everyone.Remove(nukeOp);
Logger.InfoS("preset", "Selected a preferred nukeop commander.");
}

View File

@@ -15,18 +15,15 @@ using Content.Shared.Mind;
using Content.Shared.Mobs.Systems;
using Content.Shared.Objectives.Components;
using Content.Shared.PDA;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Content.Server.Objectives;
using Content.Server.White.Reputation;
using Content.Shared.White.Mood;
namespace Content.Server.GameTicking.Rules;
@@ -49,6 +46,8 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
[Dependency] private readonly ObjectivesSystem _objectives = default!;
[Dependency] private readonly RoleSystem _roles = default!; // WD
private ISawmill _sawmill = default!;
private int PlayersPerTraitor => _cfg.GetCVar(CCVars.TraitorPlayersPerTraitor);
private int MaxTraitors => _cfg.GetCVar(CCVars.TraitorMaxTraitors);