Add per-skill HUD duration overrides

Introduce optional `HudDuration` and `DescriptionHudDuration` fields in skill config metadata and propagate them through all skill config constructors and `skillsInfo.json`.
This commit is contained in:
Juzlus 2026-07-13 21:38:23 +02:00
parent 03bbe6ca98
commit b4e70ea0a1
135 changed files with 416 additions and 147 deletions

View file

@ -1,7 +1,5 @@
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using static src.jRandomSkills;
namespace src.utils

View file

@ -107,7 +107,10 @@ namespace src.utils
};
if (value == null) return default!;
return (T)Convert.ChangeType(value, typeof(T));
Type targetType = typeof(T);
Type? underlyingType = Nullable.GetUnderlyingType(targetType);
return (T)Convert.ChangeType(value, underlyingType ?? targetType);
}
private static void EnsureIndex()
@ -144,7 +147,7 @@ namespace src.utils
}
}
public class DefaultSkillInfo(Skills skill, bool active = true, string color = "#ffffff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common)
public class DefaultSkillInfo(Skills skill, bool active = true, string color = "#ffffff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float? hudDuration = null, float? descriptionHudDuration = null, int maxPerServer = -1, Rarity rarity = Rarity.Common)
{
public bool NeedsTeammates { get; set; } = needsTeammates;
public bool DisableOnFreezeTime { get; set; } = disableOnFreezeTime;
@ -152,6 +155,8 @@ namespace src.utils
public string Color { get; set; } = color;
public bool Active { get; set; } = active;
public string Name { get; set; } = skill.ToString();
public float? HudDuration { get; set; } = hudDuration;
public float? DescriptionHudDuration { get; set; } = descriptionHudDuration;
public string RequiredPermission { get; set; } = requiredPermission;
public int MaxPerServer { get; set; } = maxPerServer;
public string Rarity { get; set; } = rarity.ToString();