Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Item::checkAutoLoot(std::set<uint32_t> lootList) {
- Container* container = item->getContainer();
- if (container && !container->empty()) {
- for (Item* item : container->getItemList()) {
- item:checkAutoLoot(lootList);
- }
- } else if (lootList.find(item->getID()) != lootList.end()) {
- 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());
- }
- }
- 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()) {
- std::set<uint32_t> lootList = player->autoLootList;
- item->checkAutoLoot(lootList);
- }
- } 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)");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement