Skip to content

Commit

Permalink
Fix Auto Bank not removing coins from monster corpse (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
omeranha authored Mar 12, 2022
1 parent e6abcc8 commit 0059314
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,14 +731,16 @@ bool Creature::dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreatur
if (mostDamageCreature && mostDamageCreature->getPlayer() && !corpses) {
Player* player = mostDamageCreature->getPlayer();
if (g_configManager().getBoolean(AUTOBANK)) {
int32_t money = 0;
if (!corpse->getContainer()) {
return true;
}

int32_t money = 0;
for (Item* item : corpse->getContainer()->getItems()) {
money += item->getWorth();
g_game.internalRemoveItem(item, money);
if (uint32_t worth = item->getWorth(); worth > 0) {
money += worth;
g_game.internalRemoveItem(item);
}
}

if (money > 0) {
Expand Down

0 comments on commit 0059314

Please sign in to comment.