From ab4bd66a743fabf2bf8c39ac69f05226e10caec4 Mon Sep 17 00:00:00 2001 From: Leandro Araujo Date: Tue, 19 Mar 2024 19:44:20 -0300 Subject: [PATCH] FIX: Auto loot reachable corpses only --- src/creatures/creature.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index d17ee454402..d6000a04867 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -813,7 +813,17 @@ bool Creature::dropCorpse(std::shared_ptr lastHitCreature, std::shared player->sendLootMessage(lootMessage.str()); } - if (player->checkAutoLoot(monster->isRewardBoss()) && corpseContainer && mostDamageCreature->getPlayer()) { + stdext::arraylist dirList(128); + FindPathParams fpp; + fpp.minTargetDist = 0; + fpp.maxTargetDist = 1; + fpp.fullPathSearch = true; + fpp.clearSight = true; + fpp.maxSearchDist = 0; + + auto isReachable = g_game().map.getPathMatching(player->getPosition(), dirList, FrozenPathingConditionCall(corpse->getPosition()), fpp); + + if (player->checkAutoLoot(monster->isRewardBoss()) && corpseContainer && mostDamageCreature->getPlayer() && isReachable ) { g_dispatcher().addEvent( std::bind(&Game::playerQuickLootCorpse, &g_game(), player, corpseContainer, corpse->getPosition()), "Game::playerQuickLootCorpse"