diff --git a/src/Database.cpp b/src/Database.cpp index c02048a..6c7f277 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -472,7 +472,7 @@ Database::DbPlayer Database::playerToDb(Player *player) { result.slot = player->slot; result.Taros = player->money; result.TutorialFlag = player->PCStyle2.iTutorialFlag; - if (player->instanceID == 0) { // only save coords if player isn't instanced + if (player->instanceID == 0 && !player->onMonkey) { // only save coords if player isn't instanced result.x_coordinates = player->x; result.y_coordinates = player->y; result.z_coordinates = player->z; diff --git a/src/Player.hpp b/src/Player.hpp index 1e4dd21..de5c417 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -50,6 +50,7 @@ struct Player { bool isTradeConfirm; bool inCombat; + bool onMonkey; bool passiveNanoOut; int healCooldown; diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index dc0cbc4..1023bd6 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -118,6 +118,7 @@ void PlayerManager::updatePlayerPosition(CNSocket* sock, int X, int Y, int Z, ui void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I) { Player* plr = getPlayer(sock); + plr->onMonkey = false; if (plr->instanceID == INSTANCE_OVERWORLD) { // save last uninstanced coords diff --git a/src/TransportManager.cpp b/src/TransportManager.cpp index 0949da3..2bf39f2 100644 --- a/src/TransportManager.cpp +++ b/src/TransportManager.cpp @@ -146,15 +146,20 @@ void TransportManager::transportWarpHandler(CNSocket* sock, CNPacketData* data) PlayerManager::updatePlayerPosition(sock, target.x, target.y, target.z, INSTANCE_OVERWORLD, plr->angle); break; case 2: // Monkey Skyway + // set last safe coords + plr->lastX = plr->x; + plr->lastY = plr->y; + plr->lastZ = plr->z; if (SkywayPaths.find(route.mssRouteNum) != SkywayPaths.end()) { // check if route exists NanoManager::summonNano(sock, -1); // make sure that no nano is active during the ride SkywayQueues[sock] = SkywayPaths[route.mssRouteNum]; // set socket point queue to route + plr->onMonkey = true; break; } else if (TableData::RunningSkywayRoutes.find(route.mssRouteNum) != TableData::RunningSkywayRoutes.end()) { std::vector* _route = &TableData::RunningSkywayRoutes[route.mssRouteNum]; - NanoManager::summonNano(sock, -1); testMssRoute(sock, _route); + plr->onMonkey = true; break; } @@ -235,6 +240,7 @@ void TransportManager::stepSkywaySystem() { // send packet to players in view PlayerManager::sendToViewable(it->first, (void*)&rideBroadcast, P_FE2CL_PC_RIDING, sizeof(sP_FE2CL_PC_RIDING)); it = SkywayQueues.erase(it); // remove player from tracking map + update iterator + plr->onMonkey = false; } else { WarpLocation point = queue->front(); // get point queue->pop(); // remove point from front of queue