Fix freefalling after MSS DC

This commit is contained in:
Gent S 2020-11-26 10:01:48 -05:00
parent fa7b6e6145
commit faf2a0ee7d
4 changed files with 10 additions and 2 deletions

View File

@ -472,7 +472,7 @@ Database::DbPlayer Database::playerToDb(Player *player) {
result.slot = player->slot; result.slot = player->slot;
result.Taros = player->money; result.Taros = player->money;
result.TutorialFlag = player->PCStyle2.iTutorialFlag; 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.x_coordinates = player->x;
result.y_coordinates = player->y; result.y_coordinates = player->y;
result.z_coordinates = player->z; result.z_coordinates = player->z;

View File

@ -50,6 +50,7 @@ struct Player {
bool isTradeConfirm; bool isTradeConfirm;
bool inCombat; bool inCombat;
bool onMonkey;
bool passiveNanoOut; bool passiveNanoOut;
int healCooldown; int healCooldown;

View File

@ -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) { void PlayerManager::sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t I) {
Player* plr = getPlayer(sock); Player* plr = getPlayer(sock);
plr->onMonkey = false;
if (plr->instanceID == INSTANCE_OVERWORLD) { if (plr->instanceID == INSTANCE_OVERWORLD) {
// save last uninstanced coords // save last uninstanced coords

View File

@ -146,15 +146,20 @@ void TransportManager::transportWarpHandler(CNSocket* sock, CNPacketData* data)
PlayerManager::updatePlayerPosition(sock, target.x, target.y, target.z, INSTANCE_OVERWORLD, plr->angle); PlayerManager::updatePlayerPosition(sock, target.x, target.y, target.z, INSTANCE_OVERWORLD, plr->angle);
break; break;
case 2: // Monkey Skyway 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 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 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 SkywayQueues[sock] = SkywayPaths[route.mssRouteNum]; // set socket point queue to route
plr->onMonkey = true;
break; break;
} else if (TableData::RunningSkywayRoutes.find(route.mssRouteNum) != TableData::RunningSkywayRoutes.end()) { } else if (TableData::RunningSkywayRoutes.find(route.mssRouteNum) != TableData::RunningSkywayRoutes.end()) {
std::vector<WarpLocation>* _route = &TableData::RunningSkywayRoutes[route.mssRouteNum]; std::vector<WarpLocation>* _route = &TableData::RunningSkywayRoutes[route.mssRouteNum];
NanoManager::summonNano(sock, -1); NanoManager::summonNano(sock, -1);
testMssRoute(sock, _route); testMssRoute(sock, _route);
plr->onMonkey = true;
break; break;
} }
@ -235,6 +240,7 @@ void TransportManager::stepSkywaySystem() {
// send packet to players in view // send packet to players in view
PlayerManager::sendToViewable(it->first, (void*)&rideBroadcast, P_FE2CL_PC_RIDING, sizeof(sP_FE2CL_PC_RIDING)); 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 it = SkywayQueues.erase(it); // remove player from tracking map + update iterator
plr->onMonkey = false;
} else { } else {
WarpLocation point = queue->front(); // get point WarpLocation point = queue->front(); // get point
queue->pop(); // remove point from front of queue queue->pop(); // remove point from front of queue