• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Auto-Loot g_game.internalMoveItem specific container

luanmaximus123

New Member
Joined
Oct 28, 2010
Messages
11
Reaction score
1
Hi everyone, I'm currently using @login12's auto-loot and I would like to know if it's possible for the items to go to a specific container instead of any backpack/container. Additionally, if it's possible to check beforehand if the player has that specific item/container and if there's enough space in that container for the items.

Modification made in actions.cpp for autoloot:
Lua:
if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) {
    return RETURNVALUE_YOUARENOTTHEOWNER;
} else {
    if (player->canOpenCorpse(corpseOwner) && player->autoLootList.size() != 0) {
        if (player->getCapacity() > 100 * 100) { //Minimum of Capacity for autoloot works. (100 CAP)
            for (Item* item : container->getItemList()) {
                if (player->getItemFromAutoLoot(item->getID())) {
                    std::ostringstream msgAutoLoot;
                    msgAutoLoot << "You looted a " << item->getItemCount() << "x " << item->getName() << ".";
                    g_game.internalMoveItem(container, player, CONST_SLOT_WHEREEVER, item, item->getItemCount(), nullptr);
                    player->sendTextMessage(MESSAGE_INFO_DESCR, msgAutoLoot.str());
                }
            }
        } else {
            player->sendTextMessage(MESSAGE_INFO_DESCR, "Sorry, you don't have enough capacity to use auto loot, so it has been disabled. (100+ capacity is required)");
        }
    }
}

I believe it's here:
Code:
 g_game.internalMoveItem(container, player, CONST_SLOT_WHEREEVER, item, item->getItemCount(), nullptr);
 
Back
Top