SHARE
TWEET

Untitled

a guest Nov 19th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Item::checkAutoLoot(std::set<uint32_t> lootList) {
  2.     Container* container = item->getContainer();
  3.     if (container && !container->empty()) {
  4.         for (Item* item : container->getItemList()) {
  5.             item:checkAutoLoot(lootList);
  6.         }
  7.     } else if (lootList.find(item->getID()) != lootList.end()) {
  8.         std::ostringstream msgAutoLoot;
  9.         msgAutoLoot << "You looted a " << item->getItemCount() << "x " << item->getName() << ".";
  10.         g_game.internalMoveItem(container, player, CONST_SLOT_WHEREEVER, item, item->getItemCount(), nullptr);
  11.         player->sendTextMessage(MESSAGE_INFO_DESCR, msgAutoLoot.str());
  12.     }
  13. }
  14.  
  15.  
  16. if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) {
  17.     return RETURNVALUE_YOUARENOTTHEOWNER;
  18. } else {
  19.     if (player->canOpenCorpse(corpseOwner) && player->autoLootList.size() != 0) {
  20.         if (player->getCapacity() > 100 * 100) { //Minimum of Capacity for autoloot works. (100 CAP)
  21.             for (Item* item : container->getItemList()) {
  22.                 std::set<uint32_t> lootList = player->autoLootList;
  23.                 item->checkAutoLoot(lootList);
  24.             }
  25.         } else {
  26.             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)");
  27.         }
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top