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

EVENGINE_API_PLATFORM public API. 更多...

#include <QuestSystem.h>

静态 Public 成员函数

static void syncAuto (Tracker *t)
 补建 Registry 里尚不在 Tracker 上的条目,并解开前置已齐的 locked 条目。
 
static bool hasMetRequirements (const Tracker &t, const QuestDefinition &def)
 def 的全部 requires 在本 Tracker 上均已 completed(谓词查询)。
 
static std::string stateForUnlocked (const QuestDefinition &def)
 解锁后的落点:startPolicy==auto → "active",否则 "inactive"。
 
static bool activate (Tracker *t, const std::string &id, std::string *reason=nullptr)
 激活:仅 inactive 且前置已齐时成功;否则 push reject 并返回 false(compatibility facade (脚本兼容门面))。
 
static bool canActivate (Tracker *t, const std::string &id, std::string *reason=nullptr)
 是否可激活(谓词查询,可返回 reason)。
 
static std::string canActivateReason (Tracker *t, const std::string &id)
 不可激活的原因("" 可激活,否则 unknown/locked/alreadyActive/alreadyCompleted/failed/ready)。
 
static void notify (Tracker *t, const std::string &topic, const std::string &target, int amount)
 报告事实 (topic, target, amount);只推进 state==active 的条目。
 
static bool claim (Tracker *t, const std::string &id, std::string *reason=nullptr)
 仅 state==ready 时成功 → completed 并触发解锁;否则 reject(compatibility facade (脚本兼容门面))。
 
static bool reset (Tracker *t, const std::string &id)
 进度清零并按当前 requires 回落 locked/inactive/active;不级联(compatibility facade (脚本兼容门面))。
 
static bool abandon (Tracker *t, const std::string &id)
 abandon/fail → failed;对 completed/failed/locked/未知 id 为 reject(compatibility facade (脚本兼容门面))。
 
static bool fail (Tracker *t, const std::string &id, const std::string &reason)
 Fail.
 
static bool isObjectivesSatisfied (const Tracker &t, const std::string &id)
 按定义的 objectivePolicy / optional 判定条目目标是否已满足完成条件。
 
static std::string dialoguePhase (const Tracker &t, const std::string &questId)
 将 Tracker 状态映射为对话相位后缀:offer|active|turnin|completed|failed。
 
static std::string dialogueConversationId (const Tracker &t, const std::string &questId, const std::string &dialogueBase)
 拼接 dialogueBase + "." + dialoguePhase;相位或 base 为空时返回空串。
 
static int applyClock (Tracker *t, double nowSeconds)
 武装未设 deadline 的限时条目,并 fail 已过期的 active/ready(reason=expired)。
 
static int refreshByKey (Tracker *t, const std::string &refreshKey, const std::string &stamp)
 对 refreshKey 匹配的条目,若 stamp 与 refreshStamp 不同则 reset 并写入新 stamp。
 
static void pollEvents (Tracker *t, std::vector< QuestEvent > &out)
 把 Tracker 的 pending 移动并清空到 out。
 

详细描述

EVENGINE_API_PLATFORM public API.

在文件 QuestSystem.h 第 25 行定义.

成员函数说明

◆ abandon()

bool eve::rpg::QuestSystem::abandon ( Tracker *  t,
const std::string &  id 
)
static

abandon/fail → failed;对 completed/failed/locked/未知 id 为 reject(compatibility facade (脚本兼容门面))。

在文件 Quest.cpp 第 772 行定义.

引用了 t.

被这些函数引用 eve::rpg::Tracker::abandon().

◆ activate()

bool eve::rpg::QuestSystem::activate ( Tracker *  t,
const std::string &  id,
std::string *  reason = nullptr 
)
static

激活:仅 inactive 且前置已齐时成功;否则 push reject 并返回 false(compatibility facade (脚本兼容门面))。

在文件 Quest.cpp 第 653 行定义.

引用了 canActivateReason(), eve::rpg::QuestRegistry::find(), id , 以及 t.

被这些函数引用 eve::rpg::Tracker::activate().

◆ applyClock()

int eve::rpg::QuestSystem::applyClock ( Tracker *  t,
double  nowSeconds 
)
static

武装未设 deadline 的限时条目,并 fail 已过期的 active/ready(reason=expired)。

参数
nowSeconds游戏提供的单调或墙钟秒;与 deadlineAt 同一时间轴。
返回
因过期而失败的条目数。 @cost Low — linear in Tracker entry count; call on a coarse cadence (seconds), not every frame.

在文件 Quest.cpp 第 804 行定义.

引用了 eve::rpg::QuestRuntime::deadlineAt, eve::rpg::QuestRegistry::find(), eve::rpg::QuestRuntime::state, t , 以及 eve::rpg::QuestDefinition::timeLimitSeconds.

被这些函数引用 eve::rpg::Tracker::applyClock().

◆ canActivate()

bool eve::rpg::QuestSystem::canActivate ( Tracker *  t,
const std::string &  id,
std::string *  reason = nullptr 
)
static

是否可激活(谓词查询,可返回 reason)。

在文件 Quest.cpp 第 647 行定义.

引用了 canActivateReason(), r , 以及 t.

被这些函数引用 eve::rpg::Tracker::canActivate().

◆ canActivateReason()

std::string eve::rpg::QuestSystem::canActivateReason ( Tracker *  t,
const std::string &  id 
)
static

不可激活的原因("" 可激活,否则 unknown/locked/alreadyActive/alreadyCompleted/failed/ready)。

在文件 Quest.cpp 第 631 行定义.

引用了 eve::rpg::QuestRegistry::find(), hasMetRequirements(), state , 以及 t.

被这些函数引用 activate(), canActivate() , 以及 eve::rpg::Tracker::canActivateReason().

◆ claim()

bool eve::rpg::QuestSystem::claim ( Tracker *  t,
const std::string &  id,
std::string *  reason = nullptr 
)
static

仅 state==ready 时成功 → completed 并触发解锁;否则 reject(compatibility facade (脚本兼容门面))。

在文件 Quest.cpp 第 706 行定义.

引用了 id, syncAuto() , 以及 t.

被这些函数引用 eve::rpg::Tracker::claim() , 以及 eve::rpg::QuestReward::claim().

◆ dialogueConversationId()

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

拼接 dialogueBase + "." + dialoguePhase;相位或 base 为空时返回空串。

在文件 Quest.cpp 第 796 行定义.

引用了 dialoguePhase(), phase , 以及 t.

被这些函数引用 eve::rpg::Tracker::dialogueConversationId().

◆ dialoguePhase()

std::string eve::rpg::QuestSystem::dialoguePhase ( const Tracker &  t,
const std::string &  questId 
)
static

将 Tracker 状态映射为对话相位后缀:offer|active|turnin|completed|failed。

备注
locked/inactive → offer;active → active;ready → turnin;其余原样。 未知 id 返回空串。与 rpg-classic quest_npc 的 dialogueBase.phase 约定一致。

在文件 Quest.cpp 第 782 行定义.

引用了 state , 以及 t.

被这些函数引用 dialogueConversationId() , 以及 eve::rpg::Tracker::dialoguePhase().

◆ fail()

bool eve::rpg::QuestSystem::fail ( Tracker *  t,
const std::string &  id,
const std::string &  reason 
)
static

Fail.

在文件 Quest.cpp 第 774 行定义.

引用了 t.

被这些函数引用 eve::rpg::Tracker::fail().

◆ hasMetRequirements()

bool eve::rpg::QuestSystem::hasMetRequirements ( const Tracker &  t,
const QuestDefinition &  def 
)
static

def 的全部 requires 在本 Tracker 上均已 completed(谓词查询)。

在文件 Quest.cpp 第 576 行定义.

引用了 eve::rpg::QuestDefinition::requiresIds , 以及 t.

被这些函数引用 canActivateReason(), reset() , 以及 syncAuto().

◆ isObjectivesSatisfied()

bool eve::rpg::QuestSystem::isObjectivesSatisfied ( const Tracker &  t,
const std::string &  id 
)
static

按定义的 objectivePolicy / optional 判定条目目标是否已满足完成条件。

备注
空目标列表视为已满足。unknown id / 无定义时回退为「全部 ObjectiveRuntime.done」。

在文件 Quest.cpp 第 776 行定义.

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

被这些函数引用 eve::rpg::Tracker::isObjectivesSatisfied() , 以及 eve::rpg::Tracker::restoreSnapshotJson().

◆ notify()

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

报告事实 (topic, target, amount);只推进 state==active 的条目。

在文件 Quest.cpp 第 678 行定义.

引用了 eve::rpg::QuestRegistry::find(), id, n, eve::rpg::QuestDefinition::objectives, t , 以及 target.

被这些函数引用 eve::rpg::Tracker::notify().

◆ pollEvents()

void eve::rpg::QuestSystem::pollEvents ( Tracker *  t,
std::vector< QuestEvent > &  out 
)
static

把 Tracker 的 pending 移动并清空到 out。

在文件 Quest.cpp 第 842 行定义.

引用了 out , 以及 t.

◆ refreshByKey()

int eve::rpg::QuestSystem::refreshByKey ( Tracker *  t,
const std::string &  refreshKey,
const std::string &  stamp 
)
static

对 refreshKey 匹配的条目,若 stamp 与 refreshStamp 不同则 reset 并写入新 stamp。

返回
实际 reset 的条目数。 @cost Low — linear in Tracker entry count per calendar-key change.

在文件 Quest.cpp 第 822 行定义.

引用了 eve::rpg::QuestRegistry::find(), ids, eve::rpg::QuestDefinition::refreshKey, reset(), stamp , 以及 t.

被这些函数引用 eve::rpg::Tracker::refreshByKey().

◆ reset()

bool eve::rpg::QuestSystem::reset ( Tracker *  t,
const std::string &  id 
)
static

◆ stateForUnlocked()

std::string eve::rpg::QuestSystem::stateForUnlocked ( const QuestDefinition &  def)
static

解锁后的落点:startPolicy==auto → "active",否则 "inactive"。

在文件 Quest.cpp 第 585 行定义.

引用了 eve::rpg::QuestDefinition::startPolicy.

被这些函数引用 reset() , 以及 syncAuto().

◆ syncAuto()


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