From fc45775666291201d10f9accf27d52486b603ac5 Mon Sep 17 00:00:00 2001 From: dongresource Date: Mon, 28 Dec 2020 16:24:24 +0100 Subject: [PATCH] Add /unwarpable command GMs should use this before going to weird places where their non-GM buddies might warp to them and get stuck. --- src/BuddyManager.cpp | 4 ++++ src/ChatManager.cpp | 12 ++++++++++++ src/Player.hpp | 1 + 3 files changed, 17 insertions(+) diff --git a/src/BuddyManager.cpp b/src/BuddyManager.cpp index 9c2d929..7967247 100644 --- a/src/BuddyManager.cpp +++ b/src/BuddyManager.cpp @@ -528,6 +528,10 @@ void BuddyManager::reqBuddyWarp(CNSocket* sock, CNPacketData* data) { if (otherPlr->onMonkey) goto fail; + // does the player disallow warping? + if (otherPlr->unwarpable) + goto fail; + // otherPlr->instanceID should always be INSTANCE_OVERWORLD at this point PlayerManager::sendPlayerTo(sock, otherPlr->x, otherPlr->y, otherPlr->z, otherPlr->instanceID); return; diff --git a/src/ChatManager.cpp b/src/ChatManager.cpp index 8bb0094..e7a7d9c 100644 --- a/src/ChatManager.cpp +++ b/src/ChatManager.cpp @@ -792,6 +792,16 @@ void redeemCommand(std::string full, std::vector& args, CNSocket* s ChatManager::sendServerMessage(sock, msg); } +void unwarpableCommand(std::string full, std::vector& args, CNSocket* sock) { + Player *plr = PlayerManager::getPlayer(sock); + plr->unwarpable = true; +} + +void warpableCommand(std::string full, std::vector& args, CNSocket* sock) { + Player *plr = PlayerManager::getPlayer(sock); + plr->unwarpable = false; +} + void ChatManager::init() { REGISTER_SHARD_PACKET(P_CL2FE_REQ_SEND_FREECHAT_MESSAGE, chatHandler); REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_AVATAR_EMOTES_CHAT, emoteHandler); @@ -824,6 +834,8 @@ void ChatManager::init() { registerCommand("lair", 50, lairUnlockCommand, "get the required mission for the nearest fusion lair"); registerCommand("hide", 100, hideCommand, "hide yourself from the global player map"); registerCommand("unhide", 100, unhideCommand, "un-hide yourself from the global player map"); + registerCommand("unwarpable", 100, unwarpableCommand, "prevent buddies from warping to you"); + registerCommand("warpable", 100, warpableCommand, "re-allow buddies to warp to you"); registerCommand("redeem", 100, redeemCommand, "redeem a code item"); } diff --git a/src/Player.hpp b/src/Player.hpp index 6c4007b..c4dc729 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -74,6 +74,7 @@ struct Player { bool notify; bool hidden; + bool unwarpable; bool buddiesSynced; int64_t buddyIDs[50];