Limit group member drops based on proximity

This commit is contained in:
dongresource 2020-12-27 20:52:37 +01:00
parent bdf283ae4f
commit ee978e8bc9

View File

@ -395,6 +395,16 @@ void MobManager::killMob(CNSocket *sock, Mob *mob) {
for (int i = 0; i < otherPlayer->groupCnt; i++) { for (int i = 0; i < otherPlayer->groupCnt; i++) {
CNSocket* sockTo = PlayerManager::getSockFromID(otherPlayer->groupIDs[i]); CNSocket* sockTo = PlayerManager::getSockFromID(otherPlayer->groupIDs[i]);
if (sockTo == nullptr)
continue;
Player *otherPlr = PlayerManager::getPlayer(sockTo);
// only contribute to group members' kills if they're close enough
int dist = std::hypot(plr->x - otherPlr->x + 1, plr->y - otherPlr->y + 1);
if (dist > 5000)
continue;
giveReward(sockTo, mob); giveReward(sockTo, mob);
MissionManager::mobKilled(sockTo, mob->appearanceData.iNPCType); MissionManager::mobKilled(sockTo, mob->appearanceData.iNPCType);
} }