mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Do not auto-register all fast travel destinations for GMs
Instead, players with access level 50 or higher can use /registerall and /unregisterall.
This commit is contained in:
parent
74e06f1084
commit
deca220d43
@ -802,6 +802,40 @@ void warpableCommand(std::string full, std::vector<std::string>& args, CNSocket*
|
||||
plr->unwarpable = false;
|
||||
}
|
||||
|
||||
void registerallCommand(std::string full, std::vector<std::string>& 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<std::string>& 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");
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user