mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Cleaned up warp code.
This commit is contained in:
parent
512647974d
commit
2b650b0bed
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user