diff --git a/src/NPCManager.cpp b/src/NPCManager.cpp index 2892020..b1303aa 100644 --- a/src/NPCManager.cpp +++ b/src/NPCManager.cpp @@ -584,18 +584,8 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) { if (Warps.find(warpId) == Warps.end()) return; - MissionManager::failInstancedMissions(sock); // fail any missions that require the player's current instance - uint64_t fromInstance = plrv.plr->instanceID; // saved for post-warp - if (plrv.plr->instanceID == 0) { - // save last uninstanced coords - plrv.plr->lastX = plrv.plr->x; - plrv.plr->lastY = plrv.plr->y; - plrv.plr->lastZ = plrv.plr->z; - plrv.plr->lastAngle = plrv.plr->angle; - } - // std::cerr << "Warped to Map Num:" << Warps[warpId].instanceID << " NPC ID " << Warps[warpId].npcID << std::endl; if (Warps[warpId].isInstance) { uint64_t instanceID = Warps[warpId].instanceID; diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index b43d377..6faaa8b 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -231,6 +231,16 @@ void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I PlayerView& plrv = PlayerManager::players[sock]; Player* plr = plrv.plr; + if (plrv.plr->instanceID == 0) { + // save last uninstanced coords + plrv.plr->lastX = plrv.plr->x; + plrv.plr->lastY = plrv.plr->y; + plrv.plr->lastZ = plrv.plr->z; + plrv.plr->lastAngle = plrv.plr->angle; + } + + MissionManager::failInstancedMissions(sock); // fail any instanced missions + uint64_t fromInstance = plr->instanceID; plr->instanceID = I; @@ -242,7 +252,6 @@ void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I sendPlayerTo(sock, X, Y, Z); } else { // annoying but necessary to set the flag back - MissionManager::failInstancedMissions(sock); // fail any instanced missions INITSTRUCT(sP_FE2CL_REP_PC_WARP_USE_NPC_SUCC, resp); resp.iX = X; resp.iY = Y; @@ -702,7 +711,6 @@ void PlayerManager::gotoPlayer(CNSocket* sock, CNPacketData* data) { std::cout << "\tZ: " << gotoData->iToZ << std::endl; ) - MissionManager::failInstancedMissions(sock); // this ensures warping by command still fails instanced missions sendPlayerTo(sock, gotoData->iToX, gotoData->iToY, gotoData->iToZ, 0); }