added more utilty packges

This commit is contained in:
Sebastian Bularca
2026-03-29 18:59:24 +02:00
parent ee97b2fec3
commit 71b432e253
131 changed files with 7674 additions and 54 deletions

View File

@@ -6,14 +6,14 @@ namespace Nox.Game {
public interface IPerkFactory {
IReadOnlyCollection<PerkDefinition> GetAll();
PerkDefinition GetById(PerksIds perkId);
PerkDefinition GetById(Guid perkId);
IReadOnlyCollection<PerkDefinition> GetPerksFor(CharacterDefinition character);
bool TryAddPerk(CharacterDefinition character, PerksIds perkId);
bool TryAddPerk(CharacterDefinition character, Guid perkId);
}
[Serializable]
public sealed class PerkDefinition {
public PerksIds id;
public Guid id;
public string name;
public ModifiersData modifiers = new ();
}
@@ -24,7 +24,7 @@ namespace Nox.Game {
}
public sealed class PerkFactory : IPerkFactory {
private readonly Dictionary<PerksIds, PerkDefinition> perkPool = new ();
private readonly Dictionary<Guid, PerkDefinition> perkPool = new ();
public PerkFactory(PerksRegistry perksRegistry) {
if(!perksRegistry) {
@@ -40,7 +40,7 @@ namespace Nox.Game {
return perkPool.Values.ToList();
}
public PerkDefinition GetById(PerksIds perkId) {
public PerkDefinition GetById(Guid perkId) {
perkPool.TryGetValue(perkId, out var perk);
return perk;
}
@@ -57,7 +57,7 @@ namespace Nox.Game {
return perkPool.Values.Where(p => !ownedPerkIds.Contains(p.id)).ToList();
}
public bool TryAddPerk(CharacterDefinition character, PerksIds perkId) {
public bool TryAddPerk(CharacterDefinition character, Guid perkId) {
if(character == null) {
return false;
}