mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Make instance missions reset upon warping out
This commit is contained in:
parent
d4aed0abf4
commit
b87f20e2dc
@ -2,6 +2,7 @@
|
||||
#include "ItemManager.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "MobManager.hpp"
|
||||
#include "MissionManager.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
@ -588,6 +589,21 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
|
||||
if (Warps.find(warpId) == Warps.end())
|
||||
return;
|
||||
|
||||
// loop through all tasks; if the required instance is being left, "fail" the task
|
||||
for (int taskNum : plrv.plr->tasks) {
|
||||
if (MissionManager::Tasks.find(taskNum) == MissionManager::Tasks.end())
|
||||
continue; // sanity check
|
||||
|
||||
TaskData* task = MissionManager::Tasks[taskNum];
|
||||
if ((plrv.plr->instanceID & 0xffffffff) == (int)(task->task["m_iRequireInstanceID"])) { // instance ID matches
|
||||
int failTaskID = task->task["m_iFOutgoingTask"];
|
||||
if (failTaskID != 0) {
|
||||
MissionManager::quitTask(sock, taskNum);
|
||||
// TODO: start fail task
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// std::cerr << "Warped to Map Num:" << Warps[warpId].instanceID << " NPC ID " << Warps[warpId].npcID << std::endl;
|
||||
if (Warps[warpId].isInstance)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user