• 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!

Solved [TFS 1.0] Clean protection zone

Oh right 1.0 low functionality still, ughm, sorry I can't really help ya with this, I can create script that cleans specific area but don't know more than that for 1.0.
 
I managed to solve, in map.cpp, in Map::clean() replace TILESTATE_PROTECTIONZONE to TILESTATE_HOUSE.
Code:
uint32_t Map::clean()
{
   uint64_t start = OTSYS_TIME();
   uint32_t count = 0, tiles = 0;

   if (g_game.getGameState() == GAME_STATE_NORMAL) {
     g_game.setGameState(GAME_STATE_MAINTAIN);
   }

   for (int32_t z = 0; z < (int32_t)MAP_MAX_LAYERS; z++) {
     for (uint32_t y = 1; y <= mapHeight; y++) {
       for (uint32_t x = 1; x <= mapWidth; x++) {
         Tile* tile = getTile(x, y, z);
         if (!tile || tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) {
           continue;
         }

         ++tiles;
         TileItemVector* itemList = tile->getItemList();
         ItemVector::iterator it = itemList->begin(), end = itemList->end();
         while (it != end) {
           if ((*it)->isCleanable()) {
             g_game.internalRemoveItem(*it, -1);
             it = itemList->begin();
             end = itemList->end();
             ++count;
           } else {
             ++it;
           }
         }
       }
     }
   }

   if (g_game.getGameState() == GAME_STATE_MAINTAIN) {
     g_game.setGameState(GAME_STATE_NORMAL);
   }

   std::cout << "> CLEAN: Removed " << count << " item" << (count != 1 ? "s" : "")
    << " from " << tiles << " tile" << (tiles != 1 ? "s" : "") << " in "
    << (OTSYS_TIME() - start) / (1000.) << " seconds." << std::endl;
   return count;
}
 
Back
Top