Fix: Add QUEST_CANCEL packet to manage state reset upon client quest dialog cancelation

This commit is contained in:
Simone Romano
2025-12-25 21:55:41 +01:00
parent 2663bb4c9c
commit 6ac3d1a00f
6 changed files with 36 additions and 0 deletions

View File

@@ -381,6 +381,23 @@ namespace quest
}
}
void CQuestManager::Cancel(unsigned int pc)
{
PC * pPC = GetPC(pc);
if (pPC && pPC->IsRunning())
{
sys_log(0, "QUEST: Dialog cancelled by player %u, cleaning up quest state (quest: %s)", pc, pPC->GetCurrentQuestName().c_str());
CloseState(*pPC->GetRunningQuestState());
pPC->CancelRunning();
}
else
{
sys_log(0, "QUEST: Cancel requested for player %u but no quest is running", pc);
}
}
///////////////////////////////////////////////////////////////////////////////////////////
//
// Quest Event 관련