载入中...
搜索中...
未找到
InventoryControl.h
浏览该文件的文档.
1#pragma once
2
5#include "inventory/Bag.h"
7
8#include <cstdint>
9#include <string>
10#include <string_view>
11#include <vector>
12
13namespace eve::inventory {
14
48public:
52 ~InventoryControl() override;
53
56
66 [[nodiscard]] Result<void> publish(SubjectRef instance, SubjectRef owner, Bag& bag, EquipmentSet* equipment);
68 [[nodiscard]] Result<void> unpublish(SubjectRef instance);
70 void clear();
72 [[nodiscard]] int count() const;
74 [[nodiscard]] std::vector<SubjectRef> instances() const;
75
78 [[nodiscard]] std::string_view gameplayDomain() const noexcept override;
81 [[nodiscard]] std::vector<SubjectRef> gameplayInstances() const override;
85 SubjectRef instance) const override;
89 const GameplaySession& session, SubjectRef instance, SubjectRef subject) const override;
93 const GameplayCommand& command) override;
97 const SimulationStep& step) override;
100 [[nodiscard]] Result<std::vector<GameplayEvent>> gameplayEvents(const GameplaySession& session, SubjectRef instance,
101 std::uint64_t afterSequence) const override;
102
103private:
105 struct Entry {
106 SubjectRef instance;
107 SubjectRef owner;
108 Bag* bag = nullptr;
109 EquipmentSet* equipment = nullptr;
111 std::uint64_t revision = 0;
112 std::uint64_t nextEventSequence = 1;
113 std::vector<GameplayEvent> events;
114 };
115
123 [[nodiscard]] Entry* find(SubjectRef instance);
125 [[nodiscard]] const Entry* find(SubjectRef instance) const;
127 [[nodiscard]] bool controls(const GameplaySession& session, const Entry& entry) const;
129 [[nodiscard]] Value bagState(const Entry& entry) const;
131 [[nodiscard]] Value equipmentState(const Entry& entry) const;
132
133 std::vector<Entry> entries_;
134};
135
136} // namespace eve::inventory
int subject
Definition AnimSmr.cpp:163
Host-neutral player-equivalent command and observation protocol.
Optional companion surface for gameplay providers that can enumerate instances.
std::uint64_t revision
Battle::Events events
SimulationTick tick
std::optional< InteractionSession > session
Definition Tactics.cpp:39
float step
Definition TreeMesh.cpp:314
Multi-provider gameplay boundary consumed by input, scripts and automation.
Optional read-only discovery surface implemented beside a gameplay provider.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Strong, domain-neutral reference to a runtime subject.
Definition SubjectRef.h:26
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
格子型物品容器(脚本可直接操作)。
Definition Bag.h:21
EVENGINE_API_FOUNDATION public API.
Definition Equipment.h:19
Exposes the module's published player inventories through the shared gameplay command protocol.
Result< GameplayCommandReceipt > submitGameplay(const GameplaySession &session, SubjectRef instance, const GameplayCommand &command) override
Validate authority and atomically submit one domain command.
Result< std::vector< GameplayEvent > > gameplayEvents(const GameplaySession &session, SubjectRef instance, std::uint64_t afterSequence) const override
Return events strictly newer than an instance-local sequence cursor.
Result< GameplayObservation > observeGameplay(const GameplaySession &session, SubjectRef instance) const override
Observe one provider-owned gameplay instance without mutation.
InventoryControl & operator=(const InventoryControl &)=delete
~InventoryControl() override
Unpublish every instance without destroying borrowed authorities.
std::vector< SubjectRef > gameplayInstances() const override
Instances currently served, in publication order.
InventoryControl()
Create an unpublished adapter and register it as the inventory domain.
std::string_view gameplayDomain() const noexcept override
Stable provider domain used for discovery and routing.
int count() const
Number of published instances.
void clear()
Drop every publication without destroying borrowed containers.
Result< std::vector< GameplayActionDescriptor > > availableGameplayActions(const GameplaySession &session, SubjectRef instance, SubjectRef subject) const override
Discover currently legal player-semantic actions for one subject.
Result< GameplayObservation > advanceGameplay(const GameplaySession &session, SubjectRef instance, const SimulationStep &step) override
Advance one provider-owned instance using injected deterministic time.
std::vector< SubjectRef > instances() const
Published instance identities, in publication order.
Result< void > publish(SubjectRef instance, SubjectRef owner, Bag &bag, EquipmentSet *equipment)
Publish one borrowed inventory instance under a stable identity.
Result< void > unpublish(SubjectRef instance)
Drop one publication; NotFound when that instance is not published.
InventoryControl(const InventoryControl &)=delete
EVENGINE_API_FOUNDATION public API.
Definition Json.h:38
运行时容器:固定格数的背包 / 箱子 / 商店栏等。 行为由 InventorySystem 提供;本类暴露便于脚本绑定的薄封装方法。
One discoverable domain action and its owning schema projection.
Owning evidence that a gameplay authority accepted one command.
One player-semantic command submitted to a domain authority.
Owning event projection safe across frames and process boundaries.
Immutable owning observation of one authoritative gameplay instance.
Owning authorization context shared by player, script and automation adapters.
One deterministic fixed-step emitted by SimulationClock.
Definition Time.h:158