43 lines
1.7 KiB
C#
43 lines
1.7 KiB
C#
namespace NeonSprawl.Server.Game.Npc;
|
|
|
|
/// <summary>Maps <c>GET /game/world/npc-behavior-definitions</c> (NEO-90).</summary>
|
|
public static class NpcBehaviorDefinitionsWorldApi
|
|
{
|
|
public static WebApplication MapNpcBehaviorDefinitionsWorldApi(this WebApplication app)
|
|
{
|
|
app.MapGet(
|
|
"/game/world/npc-behavior-definitions",
|
|
(INpcBehaviorDefinitionRegistry registry) =>
|
|
{
|
|
var defs = registry.GetDefinitionsInIdOrder();
|
|
var npcBehaviors = new List<NpcBehaviorDefinitionJson>(defs.Count);
|
|
foreach (var d in defs)
|
|
{
|
|
npcBehaviors.Add(
|
|
new NpcBehaviorDefinitionJson
|
|
{
|
|
Id = d.Id,
|
|
DisplayName = d.DisplayName,
|
|
ArchetypeKind = d.ArchetypeKind,
|
|
MaxHp = d.MaxHp,
|
|
AggroRadius = d.AggroRadius,
|
|
LeashRadius = d.LeashRadius,
|
|
TelegraphWindupSeconds = d.TelegraphWindupSeconds,
|
|
AttackDamage = d.AttackDamage,
|
|
AttackCooldownSeconds = d.AttackCooldownSeconds,
|
|
AttackAbilityId = d.AttackAbilityId,
|
|
});
|
|
}
|
|
|
|
return Results.Json(
|
|
new NpcBehaviorDefinitionsListResponse
|
|
{
|
|
SchemaVersion = NpcBehaviorDefinitionsListResponse.CurrentSchemaVersion,
|
|
NpcBehaviors = npcBehaviors,
|
|
});
|
|
});
|
|
|
|
return app;
|
|
}
|
|
}
|