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

Help with clean map system!

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,619
Solutions
6
Reaction score
539
Location
Brazil - Rio de Janeiro
GitHub
Nottinghster
Hello everyone!

I'd like a help, is the following:

I wish the command /clean remove only the items and corpses in game and not those loaded on the map

The following are the codes

tile.cpp:
Code:
uint32_t Tile::cleanTile()
{
    uint32_t itemsCleaned = 0;

    if(hasFlag(TILESTATE_HOUSE))
		return itemsCleaned;
	
	if(hasFlag(TILESTATE_PROTECTIONZONE) && !g_config.getBool(ConfigManager::CLEAN_PZ)){
        if(g_game.getGameState() != GAME_STATE_CLOSED || !g_config.getBool(ConfigManager::CLEAN_PZ_SAVE))
            return itemsCleaned;
    }
	
	ItemVector toRemove;
	toRemove.clear();
	
	ItemVector::iterator it = downItems.begin();
	while(it != downItems.end())
	{
        if((*it)->isCleanable())
		{
            toRemove.push_back((*it));
		}
		++it;
	}
	
	it = toRemove.begin();
	while(it != toRemove.end())
	{
		g_game.internalRemoveItem((*it), (*it)->getItemCount());
		++itemsCleaned;
		++it;
	}
	
	return itemsCleaned;
}

item.cpp:
Code:
bool Item::isCleanable() const
{
    if(loadedOnMap)
        return false;
    if(getUniqueId() != 0 || getActionId() != 0)
        return false;
    if(!isPickupable() && g_config.getBool(ConfigManager::CLEAN_CORPSES))
    {
        if(g_game.getGameState() != GAME_STATE_CLOSED || !g_config.getBool(ConfigManager::CLEAN_CORPSES_SAVE))
            return false;
    }
    if(!canRemove())
        return false;
         
    return true;
}
 
Back
Top