Implement instance copying

and make respawn points match the player instance
This commit is contained in:
Gent
2020-10-12 23:42:47 -04:00
parent b87f20e2dc
commit 85530ef57f
5 changed files with 58 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
#include "settings.hpp"
#include "MobManager.hpp"
#include "MissionManager.hpp"
#include "ChunkManager.hpp"
#include <cmath>
#include <algorithm>
@@ -608,8 +609,9 @@ void NPCManager::handleWarp(CNSocket* sock, int32_t warpId) {
if (Warps[warpId].isInstance)
{
uint64_t instanceID = Warps[warpId].instanceID;
if (false) { // TODO check if instance is unique and make a copy
if (Warps[warpId].limitTaskID != 0) { // if warp requires you to be on a mission, it's gotta be a unique instance
instanceID += ((uint64_t)plrv.plr->iIDGroup << 32); // upper 32 bits are leader ID
ChunkManager::createInstance(instanceID);
}
PlayerManager::sendPlayerTo(sock, Warps[warpId].x, Warps[warpId].y, Warps[warpId].z, instanceID);