refactor(runtime): expose canonical gameplay state
Move character options and movement skills into the Runtime-owned character graph, expose borrowed inventory, character, and social views, and route retained UI state commands through generation-gated typed Runtime contracts. Preserve the existing synchronous wire path while deleting the App-owned option and skill mirrors and extending normalized parity checkpoints. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
9d0d9b07e0
commit
dcb61efb5a
34 changed files with 2076 additions and 103 deletions
|
|
@ -36,6 +36,10 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
Friends = new FriendsState();
|
||||
Squelch = new SquelchState();
|
||||
View = new CommunicationView(Chat);
|
||||
SocialView = new CommunicationSocialView(
|
||||
TurbineChat,
|
||||
Friends,
|
||||
Squelch);
|
||||
}
|
||||
|
||||
public ChatLog Chat { get; }
|
||||
|
|
@ -44,6 +48,7 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
public FriendsState Friends { get; }
|
||||
public SquelchState Squelch { get; }
|
||||
public IRuntimeChatView View { get; }
|
||||
public IRuntimeSocialView SocialView { get; }
|
||||
public IRuntimeCommunicationEventSource Events => _events;
|
||||
|
||||
public bool IsDisposed => _disposed;
|
||||
|
|
@ -79,6 +84,61 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
public long Revision => chat.Revision;
|
||||
public int Count => chat.Count;
|
||||
}
|
||||
|
||||
private sealed class CommunicationSocialView(
|
||||
TurbineChatState turbineChat,
|
||||
FriendsState friends,
|
||||
SquelchState squelch)
|
||||
: IRuntimeSocialView
|
||||
{
|
||||
public RuntimeSocialSnapshot Snapshot
|
||||
{
|
||||
get
|
||||
{
|
||||
SquelchDatabase database = squelch.Snapshot();
|
||||
return new RuntimeSocialSnapshot(
|
||||
friends.Revision,
|
||||
friends.Count,
|
||||
squelch.Revision,
|
||||
database.Accounts.Count,
|
||||
database.Characters.Count,
|
||||
database.Global.MessageTypes.Count,
|
||||
CountRooms(turbineChat));
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetFriend(
|
||||
uint characterId,
|
||||
out RuntimeFriendSnapshot friend)
|
||||
{
|
||||
if (!friends.TryGet(characterId, out FriendEntry? current)
|
||||
|| current is null)
|
||||
{
|
||||
friend = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
friend = new RuntimeFriendSnapshot(
|
||||
current.Id,
|
||||
current.Name,
|
||||
current.Online,
|
||||
current.AppearOffline);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int CountRooms(TurbineChatState state)
|
||||
{
|
||||
int count = 0;
|
||||
if (state.AllegianceRoom != 0u) count++;
|
||||
if (state.GeneralRoom != 0u) count++;
|
||||
if (state.TradeRoom != 0u) count++;
|
||||
if (state.LfgRoom != 0u) count++;
|
||||
if (state.RoleplayRoom != 0u) count++;
|
||||
if (state.SocietyRoom != 0u) count++;
|
||||
if (state.OlthoiRoom != 0u) count++;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class RuntimeCommunicationEventStream
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue