24 lines
843 B
C#
24 lines
843 B
C#
using NeonSprawl.Server.Game.PositionState;
|
|
|
|
namespace NeonSprawl.Server.Game.Mastery;
|
|
|
|
/// <summary>Registers perk state persistence and unlock engine (NEO-47).</summary>
|
|
public static class PerkStateServiceCollectionExtensions
|
|
{
|
|
public static IServiceCollection AddPerkStateStore(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
var cs = configuration.GetConnectionString(PositionStateServiceCollectionExtensions.NeonSprawlConnectionStringName);
|
|
if (!string.IsNullOrWhiteSpace(cs))
|
|
{
|
|
services.AddSingleton<IPlayerPerkStateStore, PostgresPlayerPerkStateStore>();
|
|
}
|
|
else
|
|
{
|
|
services.AddSingleton<IPlayerPerkStateStore, InMemoryPlayerPerkStateStore>();
|
|
}
|
|
|
|
services.AddSingleton<PerkUnlockEngine>();
|
|
return services;
|
|
}
|
|
}
|