diff --git a/src/ChatManager.cpp b/src/ChatManager.cpp index 579658d..2501d6a 100644 --- a/src/ChatManager.cpp +++ b/src/ChatManager.cpp @@ -802,6 +802,40 @@ void warpableCommand(std::string full, std::vector& args, CNSocket* plr->unwarpable = false; } +void registerallCommand(std::string full, std::vector& args, CNSocket* sock) { + Player *plr = PlayerManager::getPlayer(sock); + + plr->iWarpLocationFlag = UINT32_MAX; + plr->aSkywayLocationFlag[0] = UINT64_MAX; + plr->aSkywayLocationFlag[1] = UINT64_MAX; + + // update the client + INITSTRUCT(sP_FE2CL_REP_PC_REGIST_TRANSPORTATION_LOCATION_SUCC, resp); + + resp.iWarpLocationFlag = plr->iWarpLocationFlag; + resp.aWyvernLocationFlag[0] = plr->aSkywayLocationFlag[0]; + resp.aWyvernLocationFlag[1] = plr->aSkywayLocationFlag[1]; + + sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_REGIST_TRANSPORTATION_LOCATION_SUCC, sizeof(sP_FE2CL_REP_PC_REGIST_TRANSPORTATION_LOCATION_SUCC)); +} + +void unregisterallCommand(std::string full, std::vector& args, CNSocket* sock) { + Player *plr = PlayerManager::getPlayer(sock); + + plr->iWarpLocationFlag = 0; + plr->aSkywayLocationFlag[0] = 0; + plr->aSkywayLocationFlag[1] = 0; + + // update the client + INITSTRUCT(sP_FE2CL_REP_PC_REGIST_TRANSPORTATION_LOCATION_SUCC, resp); + + resp.iWarpLocationFlag = plr->iWarpLocationFlag; + resp.aWyvernLocationFlag[0] = plr->aSkywayLocationFlag[0]; + resp.aWyvernLocationFlag[1] = plr->aSkywayLocationFlag[1]; + + sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_REGIST_TRANSPORTATION_LOCATION_SUCC, sizeof(sP_FE2CL_REP_PC_REGIST_TRANSPORTATION_LOCATION_SUCC)); +} + void ChatManager::init() { REGISTER_SHARD_PACKET(P_CL2FE_REQ_SEND_FREECHAT_MESSAGE, chatHandler); REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_AVATAR_EMOTES_CHAT, emoteHandler); @@ -836,6 +870,8 @@ void ChatManager::init() { 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("registerall", 50, registerallCommand, "register all SCAMPER and MSS destinations"); + registerCommand("unregisterall", 50, unregisterallCommand, "clear all SCAMPER and MSS destinations"); registerCommand("redeem", 100, redeemCommand, "redeem a code item"); } diff --git a/src/TransportManager.cpp b/src/TransportManager.cpp index 35b544c..dc63869 100644 --- a/src/TransportManager.cpp +++ b/src/TransportManager.cpp @@ -45,7 +45,7 @@ void TransportManager::transportRegisterLocationHandler(CNSocket* sock, CNPacket } // update registration bitfield using bitmask - uint32_t newScamperFlag = plr->iWarpLocationFlag | (plr->accountLevel <= 40 ? INT32_MAX : (1UL << (transport->iLocationID - 1))); + uint32_t newScamperFlag = plr->iWarpLocationFlag | (1UL << (transport->iLocationID - 1)); if (newScamperFlag != plr->iWarpLocationFlag) { plr->iWarpLocationFlag = newScamperFlag; newReg = true; @@ -66,17 +66,11 @@ void TransportManager::transportRegisterLocationHandler(CNSocket* sock, CNPacket /* * assuming the two bitfields are just stuck together to make a longer one, do a similar operation */ - if (plr->accountLevel <= 40) { - plr->aSkywayLocationFlag[0] = INT64_MAX; - plr->aSkywayLocationFlag[1] = INT64_MAX; + int index = transport->iLocationID > 64 ? 1 : 0; + uint64_t newMonkeyFlag = plr->aSkywayLocationFlag[index] | (1ULL << (index ? transport->iLocationID - 65 : transport->iLocationID - 1)); + if (newMonkeyFlag != plr->aSkywayLocationFlag[index]) { + plr->aSkywayLocationFlag[index] = newMonkeyFlag; newReg = true; - } else { - int index = transport->iLocationID > 64 ? 1 : 0; - uint64_t newMonkeyFlag = plr->aSkywayLocationFlag[index] | (1ULL << (index ? transport->iLocationID - 65 : transport->iLocationID - 1)); - if (newMonkeyFlag != plr->aSkywayLocationFlag[index]) { - plr->aSkywayLocationFlag[index] = newMonkeyFlag; - newReg = true; - } } } else { std::cout << "[WARN] Unknown mode of transport; eTT = " << transport->eTT << std::endl;