载入中...
搜索中...
未找到
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 (脚本兼容门面))。
 
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.h 第 26 行定义.

构造及析构函数说明

◆ Tracker()

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

Tracker.

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

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

◆ ~Tracker()

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

成员函数说明

◆ abandon()

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

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

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

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

◆ activate()

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

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

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

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

◆ canActivate()

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

Can activate.

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

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

◆ canActivateReason()

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

Can activate reason.

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

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

◆ claim()

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

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

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

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

◆ 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

Returns the event action.

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

引用了 polled.

◆ getEventAmount()

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

Returns the event amount.

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

引用了 polled.

◆ getEventCount()

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

Returns the event count.

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

引用了 polled.

◆ getEventEntryId()

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

Returns the event entry id.

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

引用了 polled.

◆ getEventObjectiveId()

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

Returns the event objective id.

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

引用了 polled.

◆ getEventReason()

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

Returns the event reason.

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

引用了 polled.

◆ getEventTarget()

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

Returns the event target.

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

引用了 polled.

◆ getEventTopic()

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

Returns the event topic.

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

引用了 polled.

◆ 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

Returns the id.

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

引用了 index , 以及 order.

◆ getObjectiveCount()

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

Returns the objective count.

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

引用了 entries.

◆ getObjectiveCountRequired()

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

Returns the objective count required.

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

引用了 entries , 以及 index.

◆ getObjectiveCurrent()

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

Returns the objective current.

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

引用了 entries , 以及 index.

◆ getObjectiveId()

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

Returns the objective id.

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

引用了 entries , 以及 index.

◆ 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

True when objective done.

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

引用了 entries , 以及 index.

◆ 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 行定义.

引用了 pending , 以及 polled.

◆ reset()

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

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

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

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

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

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

◆ syncAuto()

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

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

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

引用了 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


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