载入中...
搜索中...
未找到
ForgeBench.h
浏览该文件的文档.
1#pragma once
2
8#include "common/Result.h"
9#include "common/Time.h"
12#include "rpg/Crafting.h"
14
15#include <cstdint>
16#include <string>
17#include <vector>
18
19#include "common/Export.h"
20
21namespace eve::inventory {
22class Bag;
23class EquipmentSet;
24} // namespace eve::inventory
25
26namespace eve::rpg {
27
28class RPGActor;
29
38public:
39 ForgeBench();
41
42 ForgeBench(const ForgeBench&) = delete;
43 ForgeBench& operator=(const ForgeBench&) = delete;
44 ForgeBench(ForgeBench&&) noexcept;
45 ForgeBench& operator=(ForgeBench&&) noexcept;
46
51 [[nodiscard]] eve::Result<void> bind(inventory::Bag* bag, inventory::EquipmentSet* equipment = nullptr,
52 RPGActor* actor = nullptr);
53
55 void unbind();
56
58 [[nodiscard]] bool isBound() const { return bag_ != nullptr; }
59
61 [[nodiscard]] eve::Result<CraftingReceipt> craft(CraftingRecipe recipe, std::uint32_t batchSize = 1,
62 int priority = 0);
63
68 [[nodiscard]] eve::Result<CraftingReceipt> craftFromJson(const std::string& json, std::uint32_t batchSize = 1,
69 int priority = 0);
70
73 int expectedInstanceId, int priority = 0);
74
79 [[nodiscard]] eve::Result<EquipmentUpgradeReceipt> upgradeFromJson(const std::string& json, int bagSlot,
80 int expectedInstanceId, int priority = 0);
81
84
86 [[nodiscard]] eve::Result<int> settle(std::string_view taskId);
87
92 [[nodiscard]] eve::Result<int> settleReady();
93
95 [[nodiscard]] std::uint64_t queueHandle() const noexcept;
96
98 [[nodiscard]] eve::SimulationTick tick() const noexcept { return tick_; }
99
101 [[nodiscard]] int taskCount() const;
102
104 [[nodiscard]] std::string taskIdAt(int index) const;
105
107 [[nodiscard]] std::string taskStateAt(int index) const;
108
110 [[nodiscard]] std::string taskKindAt(int index) const;
111
113 [[nodiscard]] float taskProgressAt(int index) const;
114
116 [[nodiscard]] float taskDurationAt(int index) const;
117
119 [[nodiscard]] int syncEquipment() const;
120
121private:
122 [[nodiscard]] eve::ResultRef<production::WorkQueue> queue() const;
123
125 inventory::Bag* bag_ = nullptr;
126 inventory::EquipmentSet* equipment_ = nullptr;
127 RPGActor* actor_ = nullptr;
129};
130
131} // namespace eve::rpg
int priority
RPG recipe adapter over the shared production and inventory protocols.
int bagSlot
RPG adapter that pays materials and upgrades one inventory item instance.
#define EVENGINE_API_PLATFORM
Definition Export.h:107
Resource-account and cost adapters backed by Bag item stacks.
double dt
BakeRecipe recipe
std::string taskId
Move-only, checked operation results for the common layer.
SimulationTick tick
Common time values and an injectable deterministic simulation clock.
uint32_t index
Signed, fixed-resolution simulation duration in nanoseconds.
Definition Time.h:43
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
格子型物品容器(脚本可直接操作)。
Definition Bag.h:22
EVENGINE_API_FOUNDATION public API.
Definition Equipment.h:19
Owns a production WorkQueue and borrows bag / optional equipment+actor.
Definition ForgeBench.h:37
ForgeBench & operator=(const ForgeBench &)=delete
ForgeBench(const ForgeBench &)=delete
属性 / 状态 / 技能三表合一的 ECS 实体。
Definition RPGActor.h:34
运行时容器:固定格数的背包 / 箱子 / 商店栏等。 行为由 InventorySystem 提供;本类暴露便于脚本绑定的薄封装方法。
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
Validated recipe projection used by crafting, alchemy, brewing and cooking.
Definition Crafting.h:28
Validated upgrade ladder step for one equipment instance.