载入中...
搜索中...
未找到
eve::rpg::Tracker类 参考

一份任务进度 + 本实例事件队列。 更多...

#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 (脚本兼容门面))。
 
int applyClock (double nowSeconds)
 武装限时截止并失败已过期条目;见 QuestSystem::applyClock。 @cost Low — linear in entry count; prefer second-scale cadence.
 
int refreshByKey (const std::string &refreshKey, const std::string &stamp)
 按 refreshKey + stamp 日刷/赛季刷;见 QuestSystem::refreshByKey。 @cost Low — linear in entry count per stamp change.
 
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.
 
bool isObjectiveOptional (const std::string &id, int index) const
 True when the definition marks this objective optional;未知返回 false。
 
std::string getObjectivePolicy (const std::string &id) const
 定义的 objectivePolicy;未知 id 返回空串。
 
bool isObjectivesSatisfied (const std::string &id) const
 目标是否已按 policy 满足完成条件。
 
std::string dialoguePhase (const std::string &questId) const
 对话相位后缀;见 QuestSystem::dialoguePhase。
 
std::string dialogueConversationId (const std::string &questId, const std::string &dialogueBase) const
 dialogueBase.phase;见 QuestSystem::dialogueConversationId。
 
double getDeadlineAt (const std::string &id) const
 运行时 deadlineAt;0 表示未武装/无限时。
 
std::string getRefreshStamp (const std::string &id) const
 运行时 refreshStamp。
 
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.h 第 26 行定义.

构造及析构函数说明

◆ Tracker()

eve::rpg::Tracker::Tracker ( )

Tracker.

在文件 Tracker.cpp 第 14 行定义.

引用了 eve::rpg::QuestSystem::syncAuto().

◆ ~Tracker()

eve::rpg::Tracker::~Tracker ( )
default

成员函数说明

◆ abandon()

bool eve::rpg::Tracker::abandon ( const std::string &  id)

放弃任务(compatibility facade (脚本兼容门面))。

在文件 Tracker.cpp 第 34 行定义.

引用了 eve::rpg::QuestSystem::abandon().

◆ activate()

bool eve::rpg::Tracker::activate ( const std::string &  id)

激活任务(compatibility facade (脚本兼容门面))。

在文件 Tracker.cpp 第 18 行定义.

引用了 eve::rpg::QuestSystem::activate().

◆ applyClock()

int eve::rpg::Tracker::applyClock ( double  nowSeconds)

武装限时截止并失败已过期条目;见 QuestSystem::applyClock。 @cost Low — linear in entry count; prefer second-scale cadence.

在文件 Tracker.cpp 第 40 行定义.

引用了 eve::rpg::QuestSystem::applyClock().

◆ canActivate()

bool eve::rpg::Tracker::canActivate ( const std::string &  id)

Can activate.

在文件 Tracker.cpp 第 20 行定义.

引用了 eve::rpg::QuestSystem::canActivate().

◆ canActivateReason()

std::string eve::rpg::Tracker::canActivateReason ( const std::string &  id)

Can activate reason.

在文件 Tracker.cpp 第 22 行定义.

引用了 eve::rpg::QuestSystem::canActivateReason().

◆ claim()

bool eve::rpg::Tracker::claim ( const std::string &  id)

完成任务(compatibility facade (脚本兼容门面))。

在文件 Tracker.cpp 第 30 行定义.

引用了 eve::rpg::QuestSystem::claim().

◆ dialogueConversationId()

std::string eve::rpg::Tracker::dialogueConversationId ( const std::string &  questId,
const std::string &  dialogueBase 
) const

dialogueBase.phase;见 QuestSystem::dialogueConversationId。

在文件 Tracker.cpp 第 269 行定义.

引用了 eve::rpg::QuestSystem::dialogueConversationId().

◆ dialoguePhase()

std::string eve::rpg::Tracker::dialoguePhase ( const std::string &  questId) const

对话相位后缀;见 QuestSystem::dialoguePhase。

在文件 Tracker.cpp 第 265 行定义.

引用了 eve::rpg::QuestSystem::dialoguePhase().

◆ fail()

bool eve::rpg::Tracker::fail ( const std::string &  id,
const std::string &  reason 
)

失败任务(compatibility facade (脚本兼容门面))。

在文件 Tracker.cpp 第 36 行定义.

引用了 eve::rpg::QuestSystem::fail().

被这些函数引用 restoreSnapshotJson().

◆ getCount()

int eve::rpg::Tracker::getCount ( ) const

在文件 Tracker.cpp 第 195 行定义.

引用了 entries.

◆ getDeadlineAt()

double eve::rpg::Tracker::getDeadlineAt ( const std::string &  id) const

运行时 deadlineAt;0 表示未武装/无限时。

在文件 Tracker.cpp 第 273 行定义.

引用了 entries.

◆ getEventAction()

std::string eve::rpg::Tracker::getEventAction ( int  i) const

Returns the event action.

在文件 Tracker.cpp 第 318 行定义.

引用了 polled.

◆ getEventAmount()

int eve::rpg::Tracker::getEventAmount ( int  i) const

Returns the event amount.

在文件 Tracker.cpp 第 333 行定义.

引用了 polled.

◆ getEventCount()

int eve::rpg::Tracker::getEventCount ( ) const

Returns the event count.

在文件 Tracker.cpp 第 306 行定义.

引用了 polled.

◆ getEventEntryId()

std::string eve::rpg::Tracker::getEventEntryId ( int  i) const

Returns the event entry id.

在文件 Tracker.cpp 第 308 行定义.

引用了 polled.

◆ getEventObjectiveId()

std::string eve::rpg::Tracker::getEventObjectiveId ( int  i) const

Returns the event objective id.

在文件 Tracker.cpp 第 313 行定义.

引用了 polled.

◆ getEventReason()

std::string eve::rpg::Tracker::getEventReason ( int  i) const

Returns the event reason.

在文件 Tracker.cpp 第 338 行定义.

引用了 polled.

◆ getEventTarget()

std::string eve::rpg::Tracker::getEventTarget ( int  i) const

Returns the event target.

在文件 Tracker.cpp 第 328 行定义.

引用了 polled.

◆ getEventTopic()

std::string eve::rpg::Tracker::getEventTopic ( int  i) const

Returns the event topic.

在文件 Tracker.cpp 第 323 行定义.

引用了 polled.

◆ getExtra()

std::string eve::rpg::Tracker::getExtra ( const std::string &  id,
const std::string &  key 
) const

Returns the extra.

在文件 Tracker.cpp 第 212 行定义.

引用了 eve::rpg::QuestRegistry::find(), eve::rpg::QuestDefinition::getExtra() , 以及 key.

◆ getId()

std::string eve::rpg::Tracker::getId ( int  index) const

Returns the id.

在文件 Tracker.cpp 第 197 行定义.

引用了 index , 以及 order.

◆ getObjectiveCount()

int eve::rpg::Tracker::getObjectiveCount ( const std::string &  id) const

Returns the objective count.

在文件 Tracker.cpp 第 217 行定义.

引用了 entries.

◆ getObjectiveCountRequired()

int eve::rpg::Tracker::getObjectiveCountRequired ( const std::string &  id,
int  index 
) const

Returns the objective count required.

在文件 Tracker.cpp 第 236 行定义.

引用了 entries , 以及 index.

◆ getObjectiveCurrent()

int eve::rpg::Tracker::getObjectiveCurrent ( const std::string &  id,
int  index 
) const

Returns the objective current.

在文件 Tracker.cpp 第 229 行定义.

引用了 entries , 以及 index.

◆ getObjectiveId()

std::string eve::rpg::Tracker::getObjectiveId ( const std::string &  id,
int  index 
) const

Returns the objective id.

在文件 Tracker.cpp 第 222 行定义.

引用了 entries , 以及 index.

◆ getObjectivePolicy()

std::string eve::rpg::Tracker::getObjectivePolicy ( const std::string &  id) const

定义的 objectivePolicy;未知 id 返回空串。

在文件 Tracker.cpp 第 256 行定义.

引用了 eve::rpg::QuestRegistry::find() , 以及 eve::rpg::QuestDefinition::objectivePolicy.

◆ getRefreshStamp()

std::string eve::rpg::Tracker::getRefreshStamp ( const std::string &  id) const

运行时 refreshStamp。

在文件 Tracker.cpp 第 278 行定义.

引用了 entries.

◆ getRewardAmount()

double eve::rpg::Tracker::getRewardAmount ( const std::string &  id,
int  i 
) const

Returns the reward amount.

在文件 Tracker.cpp 第 300 行定义.

引用了 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 第 283 行定义.

引用了 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 第 294 行定义.

引用了 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 第 288 行定义.

引用了 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 第 202 行定义.

引用了 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 第 207 行定义.

引用了 eve::rpg::QuestRegistry::find(), eve::rpg::QuestDefinition::hasTag() , 以及 tag.

◆ isObjectiveDone()

bool eve::rpg::Tracker::isObjectiveDone ( const std::string &  id,
int  index 
) const

True when objective done.

在文件 Tracker.cpp 第 243 行定义.

引用了 entries , 以及 index.

◆ isObjectiveOptional()

bool eve::rpg::Tracker::isObjectiveOptional ( const std::string &  id,
int  index 
) const

True when the definition marks this objective optional;未知返回 false。

在文件 Tracker.cpp 第 250 行定义.

引用了 eve::rpg::QuestRegistry::find(), index , 以及 eve::rpg::QuestDefinition::objectives.

◆ isObjectivesSatisfied()

bool eve::rpg::Tracker::isObjectivesSatisfied ( const std::string &  id) const

目标是否已按 policy 满足完成条件。

在文件 Tracker.cpp 第 261 行定义.

引用了 eve::rpg::QuestSystem::isObjectivesSatisfied().

◆ notify()

void eve::rpg::Tracker::notify ( const std::string &  topic,
const std::string &  target,
int  amount 
)

Notify.

在文件 Tracker.cpp 第 26 行定义.

引用了 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 第 46 行定义.

引用了 pending , 以及 polled.

◆ refreshByKey()

int eve::rpg::Tracker::refreshByKey ( const std::string &  refreshKey,
const std::string &  stamp 
)

按 refreshKey + stamp 日刷/赛季刷;见 QuestSystem::refreshByKey。 @cost Low — linear in entry count per stamp change.

在文件 Tracker.cpp 第 42 行定义.

引用了 eve::rpg::QuestSystem::refreshByKey() , 以及 stamp.

◆ reset()

bool eve::rpg::Tracker::reset ( const std::string &  id)

重置进度(compatibility facade (脚本兼容门面))。

在文件 Tracker.cpp 第 32 行定义.

引用了 eve::rpg::QuestSystem::reset().

◆ restoreSnapshotJson()

eve::Result< void > eve::rpg::Tracker::restoreSnapshotJson ( std::string_view  json)

Validate and atomically restore quest progress against the current registry.

参数
jsonUTF-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 第 82 行定义.

引用了 eve::Applied, eve::Value::arraySize(), eve::Value::asDouble(), 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::isNumeric(), eve::Value::isObject(), eve::rpg::QuestSystem::isObjectivesSatisfied(), eve::Value::isString(), message, eve::NotFound, objectives, order, eve::ParseError, path, pending, polled, root, state, eve::Status::success(), eve::Result< T >::success(), eve::UnknownVersion , 以及 version.

被这些函数引用 eve::rpg::RPGSaveSession::prepareRestoreSnapshotJson().

◆ 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-tracker version 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 第 51 行定义.

引用了 entries, eve::Diagnostic::error(), found, eve::InvariantViolation, objectives, order, root , 以及 eve::Value::toJson().

◆ syncAuto()

void eve::rpg::Tracker::syncAuto ( )

补建 Registry 里尚未出现的条目并按前置解锁。

在文件 Tracker.cpp 第 16 行定义.

引用了 eve::rpg::QuestSystem::syncAuto().

类成员变量说明

◆ entries

std::unordered_map<std::string, QuestRuntime> eve::rpg::Tracker::entries

◆ order

std::vector<std::string> eve::rpg::Tracker::order

◆ pending

std::vector<QuestEvent> eve::rpg::Tracker::pending

◆ polled


该类的文档由以下文件生成: