Fix a few GM issues

* Invert access check when kicking players
* Add validation to ensure only GMs can PVP
* Account for instance in /teleport2me
This commit is contained in:
dongresource 2021-01-01 21:38:03 +01:00
parent 954cfabde5
commit 4516227a7b
2 changed files with 6 additions and 2 deletions

View File

@ -1048,6 +1048,10 @@ void MobManager::pcAttackChars(CNSocket *sock, CNPacketData *data) {
sP_CL2FE_REQ_PC_ATTACK_CHARs* pkt = (sP_CL2FE_REQ_PC_ATTACK_CHARs*)data->buf;
Player *plr = PlayerManager::getPlayer(sock);
// only GMs can use this this variant
if (plr->accountLevel > 30)
return;
// Unlike the attack mob packet, attacking players packet has an 8-byte trail (Instead of 4 bytes).
if (!validInVarPacket(sizeof(sP_CL2FE_REQ_PC_ATTACK_CHARs), pkt->iTargetCnt, sizeof(int32_t) * 2, data->size)) {
std::cout << "[WARN] bad sP_CL2FE_REQ_PC_ATTACK_CHARs packet size\n";

View File

@ -1067,7 +1067,7 @@ void PlayerManager::kickPlayer(CNSocket *sock, CNPacketData *data) {
Player *otherPlr = getPlayer(otherSock);
if (otherPlr->accountLevel > plr->accountLevel) {
if (plr->accountLevel > otherPlr->accountLevel) {
ChatManager::sendServerMessage(sock, "player has higher access level");
return;
}
@ -1131,7 +1131,7 @@ void PlayerManager::teleportPlayer(CNSocket *sock, CNPacketData *data) {
switch (req->eTeleportType) {
case eCN_GM_TeleportMapType__MyLocation:
sendPlayerTo(targetSock, plr->x, plr->y, plr->z);
sendPlayerTo(targetSock, plr->x, plr->y, plr->z, instance);
break;
case eCN_GM_TeleportMapType__MapXYZ:
instance = req->iToMap;