Allow GMs to enter private instances

This commit is contained in:
dongresource 2020-12-28 16:12:57 +01:00
parent 26f4767082
commit 868dc8485e

View File

@ -371,12 +371,25 @@ void instanceCommand(std::string full, std::vector<std::string>& args, CNSocket*
// move player to specified instance
// validate instance ID
char* instanceS;
int instance = std::strtol(args[1].c_str(), &instanceS, 10);
uint64_t instance = std::strtoll(args[1].c_str(), &instanceS, 10);
if (*instanceS) {
ChatManager::sendServerMessage(sock, "[INST] Invalid instance ID: " + args[1]);
return;
}
if (args.size() >= 3) {
char* playeridS;
uint64_t playerid = std::strtoll(args[2].c_str(), &playeridS, 10);
if (playerid != 0) {
instance |= playerid << 32ULL;
ChunkManager::createInstance(instance);
// a precaution
plr->recallInstance = 0;
}
}
PlayerManager::sendPlayerTo(sock, plr->x, plr->y, plr->z, instance);
ChatManager::sendServerMessage(sock, "[INST] Switched to instance with ID " + std::to_string(instance));
}