Establish the J1 presentation-independent contract with instance-scoped clocks and generations, immutable borrowed views, typed generation-gated commands, normalized ordered diagnostics, and teardown acknowledgements. Route graphical startup plus press-time selection, movement, and combat through focused App adapters over the exact existing owners without adding a queue or mirrored world. Validated by the Release solution build, 13 Runtime tests, 3,838 App tests with three existing skips, and the complete 8,424-test Release suite with five existing skips. Co-authored-by: Codex <codex@openai.com>
151 lines
2.9 KiB
C#
151 lines
2.9 KiB
C#
namespace AcDream.Runtime;
|
|
|
|
public enum RuntimeCommandStatus
|
|
{
|
|
Accepted,
|
|
Inactive,
|
|
StaleGeneration,
|
|
Unsupported,
|
|
Rejected,
|
|
}
|
|
|
|
public readonly record struct RuntimeCommandResult(
|
|
RuntimeCommandStatus Status,
|
|
RuntimeGenerationToken Generation,
|
|
uint ResultObjectId = 0u)
|
|
{
|
|
public bool Accepted => Status == RuntimeCommandStatus.Accepted;
|
|
}
|
|
|
|
public enum RuntimeSessionStartStatus
|
|
{
|
|
Disabled,
|
|
MissingCredentials,
|
|
NoCharacters,
|
|
Connected,
|
|
Deferred,
|
|
Failed,
|
|
Inactive,
|
|
StaleGeneration,
|
|
}
|
|
|
|
public readonly record struct RuntimeSessionStartResult(
|
|
RuntimeSessionStartStatus Status,
|
|
RuntimeGenerationToken Generation,
|
|
uint CharacterId = 0u,
|
|
string CharacterName = "",
|
|
Exception? Error = null);
|
|
|
|
public enum RuntimeSelectionCommand
|
|
{
|
|
SelectClosestHostile,
|
|
SelectPrevious,
|
|
ExamineSelected,
|
|
UseSelected,
|
|
PickUpSelected,
|
|
}
|
|
|
|
public enum RuntimeCombatCommand
|
|
{
|
|
ToggleMode,
|
|
}
|
|
|
|
public enum RuntimeMovementCommand
|
|
{
|
|
ToggleRunLock,
|
|
Stop,
|
|
Ready,
|
|
Sit,
|
|
Crouch,
|
|
Sleep,
|
|
}
|
|
|
|
public enum RuntimeChatChannel
|
|
{
|
|
Say,
|
|
Tell,
|
|
Fellowship,
|
|
Allegiance,
|
|
Vassals,
|
|
Patron,
|
|
Monarch,
|
|
CoVassals,
|
|
General,
|
|
Trade,
|
|
LookingForGroup,
|
|
Roleplay,
|
|
Society,
|
|
Olthoi,
|
|
}
|
|
|
|
public readonly record struct RuntimeChatCommand(
|
|
RuntimeChatChannel Channel,
|
|
string Text,
|
|
string? TargetName = null);
|
|
|
|
public enum RuntimePortalCommand
|
|
{
|
|
RecallLifestone,
|
|
RecallMarketplace,
|
|
RecallHouse,
|
|
RecallMansion,
|
|
}
|
|
|
|
public interface IRuntimeSessionCommands
|
|
{
|
|
RuntimeSessionStartResult Start(RuntimeGenerationToken expectedGeneration);
|
|
|
|
RuntimeSessionStartResult Reconnect(RuntimeGenerationToken expectedGeneration);
|
|
|
|
RuntimeTeardownAcknowledgement Stop(RuntimeGenerationToken expectedGeneration);
|
|
}
|
|
|
|
public interface IRuntimeSelectionCommands
|
|
{
|
|
RuntimeCommandResult Execute(
|
|
RuntimeGenerationToken expectedGeneration,
|
|
RuntimeSelectionCommand command);
|
|
}
|
|
|
|
public interface IRuntimeCombatCommands
|
|
{
|
|
RuntimeCommandResult Execute(
|
|
RuntimeGenerationToken expectedGeneration,
|
|
RuntimeCombatCommand command);
|
|
}
|
|
|
|
public interface IRuntimeMovementCommands
|
|
{
|
|
RuntimeCommandResult Execute(
|
|
RuntimeGenerationToken expectedGeneration,
|
|
RuntimeMovementCommand command);
|
|
}
|
|
|
|
public interface IRuntimeChatCommands
|
|
{
|
|
RuntimeCommandResult Execute(
|
|
RuntimeGenerationToken expectedGeneration,
|
|
in RuntimeChatCommand command);
|
|
}
|
|
|
|
public interface IRuntimePortalCommands
|
|
{
|
|
RuntimeCommandResult Execute(
|
|
RuntimeGenerationToken expectedGeneration,
|
|
RuntimePortalCommand command);
|
|
}
|
|
|
|
public interface IGameRuntimeCommands
|
|
{
|
|
IRuntimeSessionCommands Session { get; }
|
|
|
|
IRuntimeSelectionCommands Selection { get; }
|
|
|
|
IRuntimeCombatCommands Combat { get; }
|
|
|
|
IRuntimeMovementCommands Movement { get; }
|
|
|
|
IRuntimeChatCommands Chat { get; }
|
|
|
|
IRuntimePortalCommands Portal { get; }
|
|
}
|