Skip to content

Commit

Permalink
FIX: Auto loot reachable corpses only
Browse files Browse the repository at this point in the history
  • Loading branch information
lezinhu0 committed Mar 19, 2024
1 parent 944c74b commit 1b8be42
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,17 @@ bool Creature::dropCorpse(std::shared_ptr<Creature> lastHitCreature, std::shared
player->sendLootMessage(lootMessage.str());
}

if (player->checkAutoLoot(monster->isRewardBoss()) && corpseContainer && mostDamageCreature->getPlayer()) {
auto &fromPos = player->getPosition();
auto &toPos = corpse->getPosition();
stdext::arraylist<Direction> dirList(128);
FindPathParams fpp;
fpp.minTargetDist = 0;
fpp.maxTargetDist = 1;
fpp.fullPathSearch = true;
fpp.clearSight = true;
fpp.maxSearchDist = 0;

if (player->checkAutoLoot(monster->isRewardBoss()) && corpseContainer && mostDamageCreature->getPlayer() && g_game().map.getPathMatching(fromPos, dirList, FrozenPathingConditionCall(toPos), fpp) ) {
g_dispatcher().addEvent(
std::bind(&Game::playerQuickLootCorpse, &g_game(), player, corpseContainer, corpse->getPosition()),
"Game::playerQuickLootCorpse"
Expand Down

0 comments on commit 1b8be42

Please sign in to comment.