diff --git a/src/Combat.cpp b/src/Combat.cpp index 87c10a7..37565ee 100644 --- a/src/Combat.cpp +++ b/src/Combat.cpp @@ -365,7 +365,7 @@ static std::pair getDamage(int attackPower, int defensePower, bool shou return ret; } -static bool checkRapidFire(CNSocket *sock, int targetCount) { +static bool checkRapidFire(CNSocket *sock, int targetCount, bool allowManyTargets) { Player *plr = PlayerManager::getPlayer(sock); time_t currTime = getTime(); @@ -377,7 +377,7 @@ static bool checkRapidFire(CNSocket *sock, int targetCount) { plr->lastShot = currTime; // 3+ targets should never be possible - if (targetCount > 3) + if (!allowManyTargets && targetCount > 3) plr->suspicionRating += 10001; // kill the socket when the player is too suspicious @@ -396,7 +396,7 @@ static void pcAttackNpcs(CNSocket *sock, CNPacketData *data) { auto targets = (int32_t*)data->trailers; // kick the player if firing too rapidly - if (settings::ANTICHEAT && checkRapidFire(sock, pkt->iNPCCnt)) + if (settings::ANTICHEAT && checkRapidFire(sock, pkt->iNPCCnt, false)) return; /* @@ -837,6 +837,10 @@ static void projectileHit(CNSocket* sock, CNPacketData* data) { return; } + // kick the player if firing too rapidly + if (settings::ANTICHEAT && checkRapidFire(sock, pkt->iTargetCnt, true)) + return; + /* * initialize response struct * rocket style hit doesn't work properly, so we're always sending this one