Skip to content

Commit e470312

Browse files
committed
Some fixes + auto-leave quest upon reload
1 parent bedbd05 commit e470312

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

RiseQuestLoader/QuestLoader.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ void QuestLoader::render_ui() {
215215
}
216216

217217
if (API::get()->reframework()->is_drawing_ui()) {
218+
ImGui::SetNextWindowPos({100, 40}, ImGuiCond_FirstUseEver);
218219
ImGui::Begin("Quest Loader");
219220

220221
if (ImGui::TreeNode("Quest Exporter")) {
@@ -254,6 +255,10 @@ void QuestLoader::render_ui() {
254255
const auto questdict = *quest_manager->get_field<ManagedObject*>("_QuestDataDictionary");
255256

256257
if (ImGui::Button("Reload Quests")) {
258+
if (utility::call<bool>(quest_manager, "isActiveQuest")) {
259+
utility::call(quest_manager, "questCancel");
260+
}
261+
257262
for (auto& quest : m_custom_quests) {
258263
quest.second.cleanup(questdict);
259264
}
@@ -303,10 +308,10 @@ void QuestLoader::render_ui() {
303308
ImGui::TreePop();
304309
}
305310

306-
if (ImGui::TreeNode("Debug")) {
311+
/*if (ImGui::TreeNode("Debug")) {
307312
ImGui::Checkbox("Skip Hook", &m_skip_hook);
308313
ImGui::TreePop();
309-
}
314+
}*/
310315

311316
ImGui::End();
312317
}
@@ -326,7 +331,7 @@ void QuestLoader::parse_quest(const std::filesystem::path& path) {
326331
}
327332

328333
if (!j.contains("QuestID")) {
329-
return;
334+
throw std::exception("Not a valid Quest File. Quest ID is missing.");
330335
}
331336

332337
const auto quest_id = j["QuestID"].get<int32_t>();

0 commit comments

Comments
 (0)