questPortrait callback
This commit is contained in:
parent
cc5fbb0087
commit
e1dea58e80
@ -144,10 +144,7 @@ StringMap<QuestPtr> QuestManager::serverQuests() const {
|
||||
}
|
||||
|
||||
QuestPtr QuestManager::getQuest(String const& questId) const {
|
||||
if (auto quest = m_quests.ptr(questId))
|
||||
return *quest;
|
||||
|
||||
return {};
|
||||
return m_quests.get(questId);
|
||||
}
|
||||
|
||||
bool QuestManager::hasQuest(String const& questId) const {
|
||||
|
@ -478,24 +478,28 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) {
|
||||
});
|
||||
|
||||
callbacks.registerCallback("quest", [player](String const& questId) -> Json {
|
||||
if (auto quest = player->questManager()->getQuest(questId))
|
||||
return quest->diskStore();
|
||||
|
||||
if (!player->questManager()->hasQuest(questId))
|
||||
return {};
|
||||
return player->questManager()->getQuest(questId)->diskStore();
|
||||
});
|
||||
|
||||
callbacks.registerCallback("questState", [player](String const& questId) -> Maybe<String> {
|
||||
if (auto quest = player->questManager()->getQuest(questId))
|
||||
return QuestStateNames.getRight(quest->state());
|
||||
|
||||
callbacks.registerCallback("questPortrait", [player](String const& questId, String const& portraitName) -> Maybe<List<Drawable>> {
|
||||
if (!player->questManager()->hasQuest(questId))
|
||||
return {};
|
||||
return player->questManager()->getQuest(questId)->portrait(portraitName);
|
||||
});
|
||||
|
||||
|
||||
callbacks.registerCallback("questState", [player](String const& questId) -> Maybe<String> {
|
||||
if (!player->questManager()->hasQuest(questId))
|
||||
return {};
|
||||
return QuestStateNames.getRight(player->questManager()->getQuest(questId)->state());
|
||||
});
|
||||
|
||||
callbacks.registerCallback("callQuest", [player](String const& questId, String const& func, LuaVariadic<LuaValue> const& args) -> Maybe<LuaValue> {
|
||||
if (auto quest = player->questManager()->getQuest(questId))
|
||||
return quest->callScript(func, args);
|
||||
|
||||
if (!player->questManager()->hasQuest(questId))
|
||||
return {};
|
||||
return player->questManager()->getQuest(questId)->callScript(func, args);
|
||||
});
|
||||
|
||||
callbacks.registerCallback("hasQuest", [player](String const& questId) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user