mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
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:
parent
954cfabde5
commit
4516227a7b
@ -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;
|
sP_CL2FE_REQ_PC_ATTACK_CHARs* pkt = (sP_CL2FE_REQ_PC_ATTACK_CHARs*)data->buf;
|
||||||
Player *plr = PlayerManager::getPlayer(sock);
|
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).
|
// 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)) {
|
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";
|
std::cout << "[WARN] bad sP_CL2FE_REQ_PC_ATTACK_CHARs packet size\n";
|
||||||
|
@ -1067,7 +1067,7 @@ void PlayerManager::kickPlayer(CNSocket *sock, CNPacketData *data) {
|
|||||||
|
|
||||||
Player *otherPlr = getPlayer(otherSock);
|
Player *otherPlr = getPlayer(otherSock);
|
||||||
|
|
||||||
if (otherPlr->accountLevel > plr->accountLevel) {
|
if (plr->accountLevel > otherPlr->accountLevel) {
|
||||||
ChatManager::sendServerMessage(sock, "player has higher access level");
|
ChatManager::sendServerMessage(sock, "player has higher access level");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1131,7 +1131,7 @@ void PlayerManager::teleportPlayer(CNSocket *sock, CNPacketData *data) {
|
|||||||
|
|
||||||
switch (req->eTeleportType) {
|
switch (req->eTeleportType) {
|
||||||
case eCN_GM_TeleportMapType__MyLocation:
|
case eCN_GM_TeleportMapType__MyLocation:
|
||||||
sendPlayerTo(targetSock, plr->x, plr->y, plr->z);
|
sendPlayerTo(targetSock, plr->x, plr->y, plr->z, instance);
|
||||||
break;
|
break;
|
||||||
case eCN_GM_TeleportMapType__MapXYZ:
|
case eCN_GM_TeleportMapType__MapXYZ:
|
||||||
instance = req->iToMap;
|
instance = req->iToMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user