一份任务进度 + 本实例事件队列。 更多...
#include <Tracker.h>
Public 成员函数 | |
| Tracker () | |
| Tracker. | |
| ~Tracker ()=default | |
| Tracker. | |
| void | syncAuto () |
| 补建 Registry 里尚未出现的条目并按前置解锁。 | |
| bool | activate (const std::string &id) |
| 激活任务(compatibility facade (脚本兼容门面))。 | |
| bool | canActivate (const std::string &id) |
| Can activate. | |
| std::string | canActivateReason (const std::string &id) |
| Can activate reason. | |
| void | notify (const std::string &topic, const std::string &target, int amount) |
| Notify. | |
| bool | claim (const std::string &id) |
| 完成任务(compatibility facade (脚本兼容门面))。 | |
| bool | reset (const std::string &id) |
| 重置进度(compatibility facade (脚本兼容门面))。 | |
| bool | abandon (const std::string &id) |
| 放弃任务(compatibility facade (脚本兼容门面))。 | |
| bool | fail (const std::string &id, const std::string &reason) |
| 失败任务(compatibility facade (脚本兼容门面))。 | |
| void | pollEvents () |
| 把 pending 移到 polled 并清空 pending;随后 getEvent* 读 polled。 | |
| eve::Result< std::string > | snapshotJson () const |
| Serialize persistent quest progress as deterministic versioned JSON. | |
| eve::Result< void > | restoreSnapshotJson (std::string_view json) |
| Validate and atomically restore quest progress against the current registry. | |
| int | getCount () const |
| std::string | getId (int index) const |
| Returns the id. | |
| std::string | getState (const std::string &id) const |
| Returns the state. | |
| bool | hasTag (const std::string &id, const std::string &tag) const |
| True when tag. | |
| std::string | getExtra (const std::string &id, const std::string &key) const |
| Returns the extra. | |
| int | getObjectiveCount (const std::string &id) const |
| Returns the objective count. | |
| std::string | getObjectiveId (const std::string &id, int index) const |
| Returns the objective id. | |
| int | getObjectiveCurrent (const std::string &id, int index) const |
| Returns the objective current. | |
| int | getObjectiveCountRequired (const std::string &id, int index) const |
| Returns the objective count required. | |
| bool | isObjectiveDone (const std::string &id, int index) const |
| True when objective done. | |
| int | getRewardCount (const std::string &id) const |
| Returns the reward count. | |
| std::string | getRewardType (const std::string &id, int i) const |
| Returns the reward type. | |
| std::string | getRewardId (const std::string &id, int i) const |
| Returns the reward id. | |
| double | getRewardAmount (const std::string &id, int i) const |
| Returns the reward amount. | |
| int | getEventCount () const |
| Returns the event count. | |
| std::string | getEventEntryId (int i) const |
| Returns the event entry id. | |
| std::string | getEventObjectiveId (int i) const |
| Returns the event objective id. | |
| std::string | getEventAction (int i) const |
| Returns the event action. | |
| std::string | getEventTopic (int i) const |
| Returns the event topic. | |
| std::string | getEventTarget (int i) const |
| Returns the event target. | |
| int | getEventAmount (int i) const |
| Returns the event amount. | |
| std::string | getEventReason (int i) const |
| Returns the event reason. | |
Public 属性 | |
| std::unordered_map< std::string, QuestRuntime > | entries |
| 运行时条目(QuestSystem 读写;公开以便测试与脚本查询)。 | |
| std::vector< std::string > | order |
| std::vector< QuestEvent > | pending |
| std::vector< QuestEvent > | polled |
详细描述
构造及析构函数说明
◆ Tracker()
| eve::rpg::Tracker::Tracker | ( | ) |
◆ ~Tracker()
|
default |
成员函数说明
◆ abandon()
| bool eve::rpg::Tracker::abandon | ( | const std::string & | id | ) |
放弃任务(compatibility facade (脚本兼容门面))。
在文件 Tracker.cpp 第 33 行定义.
◆ activate()
| bool eve::rpg::Tracker::activate | ( | const std::string & | id | ) |
激活任务(compatibility facade (脚本兼容门面))。
在文件 Tracker.cpp 第 17 行定义.
◆ canActivate()
| bool eve::rpg::Tracker::canActivate | ( | const std::string & | id | ) |
◆ canActivateReason()
| std::string eve::rpg::Tracker::canActivateReason | ( | const std::string & | id | ) |
◆ claim()
| bool eve::rpg::Tracker::claim | ( | const std::string & | id | ) |
◆ fail()
| bool eve::rpg::Tracker::fail | ( | const std::string & | id, |
| const std::string & | reason | ||
| ) |
失败任务(compatibility facade (脚本兼容门面))。
在文件 Tracker.cpp 第 35 行定义.
引用了 eve::rpg::QuestSystem::fail().
被这些函数引用 restoreSnapshotJson().
◆ getCount()
| int eve::rpg::Tracker::getCount | ( | ) | const |
在文件 Tracker.cpp 第 165 行定义.
引用了 entries.
◆ getEventAction()
| std::string eve::rpg::Tracker::getEventAction | ( | int | i | ) | const |
◆ getEventAmount()
| int eve::rpg::Tracker::getEventAmount | ( | int | i | ) | const |
◆ getEventCount()
| int eve::rpg::Tracker::getEventCount | ( | ) | const |
◆ getEventEntryId()
| std::string eve::rpg::Tracker::getEventEntryId | ( | int | i | ) | const |
◆ getEventObjectiveId()
| std::string eve::rpg::Tracker::getEventObjectiveId | ( | int | i | ) | const |
◆ getEventReason()
| std::string eve::rpg::Tracker::getEventReason | ( | int | i | ) | const |
◆ getEventTarget()
| std::string eve::rpg::Tracker::getEventTarget | ( | int | i | ) | const |
◆ getEventTopic()
| std::string eve::rpg::Tracker::getEventTopic | ( | int | i | ) | const |
◆ getExtra()
| std::string eve::rpg::Tracker::getExtra | ( | const std::string & | id, |
| const std::string & | key | ||
| ) | const |
Returns the extra.
在文件 Tracker.cpp 第 182 行定义.
引用了 eve::rpg::QuestRegistry::find(), eve::rpg::QuestDefinition::getExtra() , 以及 key.
◆ getId()
| std::string eve::rpg::Tracker::getId | ( | int | index | ) | const |
◆ getObjectiveCount()
| int eve::rpg::Tracker::getObjectiveCount | ( | const std::string & | id | ) | const |
◆ getObjectiveCountRequired()
| int eve::rpg::Tracker::getObjectiveCountRequired | ( | const std::string & | id, |
| int | index | ||
| ) | const |
◆ getObjectiveCurrent()
| int eve::rpg::Tracker::getObjectiveCurrent | ( | const std::string & | id, |
| int | index | ||
| ) | const |
◆ getObjectiveId()
| std::string eve::rpg::Tracker::getObjectiveId | ( | const std::string & | id, |
| int | index | ||
| ) | const |
◆ getRewardAmount()
| double eve::rpg::Tracker::getRewardAmount | ( | const std::string & | id, |
| int | i | ||
| ) | const |
Returns the reward amount.
在文件 Tracker.cpp 第 237 行定义.
引用了 eve::rpg::QuestRegistry::find() , 以及 eve::rpg::QuestDefinition::rewards.
◆ getRewardCount()
| int eve::rpg::Tracker::getRewardCount | ( | const std::string & | id | ) | const |
Returns the reward count.
在文件 Tracker.cpp 第 220 行定义.
引用了 eve::rpg::QuestRegistry::find() , 以及 eve::rpg::QuestDefinition::rewards.
◆ getRewardId()
| std::string eve::rpg::Tracker::getRewardId | ( | const std::string & | id, |
| int | i | ||
| ) | const |
Returns the reward id.
在文件 Tracker.cpp 第 231 行定义.
引用了 eve::rpg::QuestRegistry::find() , 以及 eve::rpg::QuestDefinition::rewards.
◆ getRewardType()
| std::string eve::rpg::Tracker::getRewardType | ( | const std::string & | id, |
| int | i | ||
| ) | const |
Returns the reward type.
在文件 Tracker.cpp 第 225 行定义.
引用了 eve::rpg::QuestRegistry::find() , 以及 eve::rpg::QuestDefinition::rewards.
◆ getState()
| std::string eve::rpg::Tracker::getState | ( | const std::string & | id | ) | const |
Returns the state.
在文件 Tracker.cpp 第 172 行定义.
引用了 entries.
被这些函数引用 eve::rpg::QuestReward::claim(), eve::rpg::WorldInteraction::collectLoot() , 以及 eve::rpg::BattleVictory::settle().
◆ hasTag()
| bool eve::rpg::Tracker::hasTag | ( | const std::string & | id, |
| const std::string & | tag | ||
| ) | const |
True when tag.
在文件 Tracker.cpp 第 177 行定义.
引用了 eve::rpg::QuestRegistry::find(), eve::rpg::QuestDefinition::hasTag() , 以及 tag.
◆ isObjectiveDone()
| bool eve::rpg::Tracker::isObjectiveDone | ( | const std::string & | id, |
| int | index | ||
| ) | const |
◆ notify()
| void eve::rpg::Tracker::notify | ( | const std::string & | topic, |
| const std::string & | target, | ||
| int | amount | ||
| ) |
Notify.
在文件 Tracker.cpp 第 25 行定义.
引用了 eve::rpg::QuestSystem::notify() , 以及 target.
被这些函数引用 eve::rpg::WorldInteraction::collectLoot() , 以及 eve::rpg::BattleVictory::settle().
◆ pollEvents()
| void eve::rpg::Tracker::pollEvents | ( | ) |
把 pending 移到 polled 并清空 pending;随后 getEvent* 读 polled。
在文件 Tracker.cpp 第 39 行定义.
◆ reset()
| bool eve::rpg::Tracker::reset | ( | const std::string & | id | ) |
◆ restoreSnapshotJson()
| eve::Result< void > eve::rpg::Tracker::restoreSnapshotJson | ( | std::string_view | json | ) |
Validate and atomically restore quest progress against the current registry.
- 参数
-
json UTF-8 JSON produced by snapshotJson().
- 返回
- Success after one commit, or a structured parse/schema/content failure.
- 备注
- Unknown fields are ignored for version 1. Missing, removed, duplicated, or reordered quest/objective ids are rejected so content migration cannot silently lose progress. A failure leaves entries, ordering, and both event queues unchanged. @thread Call on the owning simulation thread. @reentrancy No callbacks are invoked.
在文件 Tracker.cpp 第 73 行定义.
引用了 eve::Applied, eve::Value::arraySize(), eve::Value::asInt(), eve::Value::asString(), eve::Value::at(), code, eve::Conflict, current, entries, eve::Diagnostic::error(), fail(), eve::Result< T >::failure(), eve::Value::find(), eve::Value::fromJson(), id, index, eve::InvalidArgument, eve::InvariantViolation, eve::Value::isArray(), eve::Value::isInt64(), eve::Value::isObject(), eve::Value::isString(), message, eve::NotFound, objectives, order, eve::ParseError, path, pending, polled, root, state, eve::Status::success(), eve::Result< T >::success() , 以及 eve::UnknownVersion.
◆ snapshotJson()
| eve::Result< std::string > eve::rpg::Tracker::snapshotJson | ( | ) | const |
Serialize persistent quest progress as deterministic versioned JSON.
- 返回
- Owning JSON using schema
eve.rpg.quest-trackerversion 1, or a structured failure.
- 备注
- Runtime event queues are transient and are intentionally excluded. The snapshot is bound to the currently registered quest and objective ids. @thread Call on the owning simulation thread; no internal synchronization is performed. @reentrancy No callbacks are invoked.
在文件 Tracker.cpp 第 44 行定义.
引用了 entries, eve::Diagnostic::error(), found, eve::InvariantViolation, objectives, order, root , 以及 eve::Value::toJson().
◆ syncAuto()
| void eve::rpg::Tracker::syncAuto | ( | ) |
类成员变量说明
◆ entries
| std::unordered_map<std::string, QuestRuntime> eve::rpg::Tracker::entries |
运行时条目(QuestSystem 读写;公开以便测试与脚本查询)。
被这些函数引用 eve::rpg::QuestReward::claim(), eve::rpg::WorldInteraction::collectLoot(), getCount(), getObjectiveCount(), getObjectiveCountRequired(), getObjectiveCurrent(), getObjectiveId(), getState(), isObjectiveDone(), restoreSnapshotJson(), eve::rpg::BattleVictory::settle() , 以及 snapshotJson().
◆ order
| std::vector<std::string> eve::rpg::Tracker::order |
◆ pending
| std::vector<QuestEvent> eve::rpg::Tracker::pending |
◆ polled
| std::vector<QuestEvent> eve::rpg::Tracker::polled |
被这些函数引用 eve::rpg::QuestReward::claim(), eve::rpg::WorldInteraction::collectLoot(), getEventAction(), getEventAmount(), getEventCount(), getEventEntryId(), getEventObjectiveId(), getEventReason(), getEventTarget(), getEventTopic(), pollEvents(), restoreSnapshotJson() , 以及 eve::rpg::BattleVictory::settle().
该类的文档由以下文件生成:
- src/modules/rpg/Tracker.h
- src/modules/rpg/Tracker.cpp