queria que some so o item 7411
a cada 2 horas
tipo um cleanmap
hmmm, vou verificar a função doClean(map)
e ver se nao for me dar muito trabalho posto aqui para você pois estou sem tempo.
eu tenho uma versão da tfs 0.4 próprio e muito diferente de qual quer outra
Qual o link da de download da sua source?
Em 02/03/2019 em 10:35, underewarr disse:hmmm, vou verificar a função doClean(map)
e ver se nao for me dar muito trabalho posto aqui para você pois estou sem tempo.
eu tenho uma versão da tfs 0.4 próprio e muito diferente de qual quer outra
Qual o link da de download da sua source?
https://github.com/luanluciano93/TFS_0.4_3777
game.cpp ( substituía )
void Game::cleanMapEx(uint32_t& count, uint32_t itemid) { uint64_t start = OTSYS_TIME(); uint32_t tiles = 0; count = 0; int32_t marked = -1; if(gameState == GAMESTATE_NORMAL) setGameState(GAMESTATE_MAINTAIN); Tile* tile = NULL; ItemVector::iterator tit; if(g_config.getBool(ConfigManager::STORE_TRASH)) { marked = trash.size(); Trash::iterator it = trash.begin(); if(g_config.getBool(ConfigManager::CLEAN_PROTECTED_ZONES)) { for(; it != trash.end(); ++it) { if(!(tile = getTile(*it))) continue; tile->resetFlag(TILESTATE_TRASHED); if(tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } trash.clear(); } else { for(; it != trash.end(); ++it) { if(!(tile = getTile(*it))) continue; tile->resetFlag(TILESTATE_TRASHED); if(tile->hasFlag(TILESTATE_PROTECTIONZONE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } trash.clear(); } } else if(g_config.getBool(ConfigManager::CLEAN_PROTECTED_ZONES)) { for(uint16_t z = 0; z < (uint16_t)MAP_MAX_LAYERS; z++) { for(uint16_t y = 1; y <= map->mapHeight; y++) { for(uint16_t x = 1; x <= map->mapWidth; x++) { if(!(tile = getTile(x, y, z)) || tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } } } } else { for(uint16_t z = 0; z < (uint16_t)MAP_MAX_LAYERS; z++) { for(uint16_t y = 1; y <= map->mapHeight; y++) { for(uint16_t x = 1; x <= map->mapWidth; x++) { if(!(tile = getTile(x, y, z)) || tile->hasFlag(TILESTATE_PROTECTIONZONE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } } } } if(gameState == GAMESTATE_MAINTAIN) setGameState(GAMESTATE_NORMAL); std::clog << "> CLEAN: Removed " << count << " item" << (count != 1 ? "s" : "") << " from " << tiles << " tile" << (tiles != 1 ? "s" : ""); if(marked >= 0) std::clog << " (" << marked << " were marked)"; std::clog << " in " << (OTSYS_TIME() - start) / (1000.) << " seconds." << std::endl; }
void Game::cleanMap(uint32_t itemid) { uint32_t dummy; cleanMapEx(dummy, itemid); }
game.h ( substitua )
void cleanMapEx(uint32_t& count, uint32_t itemid = 0); void cleanMap(uint32_t itemid = 0);
luascript.cpp ( substitua )
int32_t LuaInterface::luaDoCleanMap(lua_State* L) { //doCleanMap(itemid = 0) uint32_t itemid = 0; if(lua_gettop(L) == 1) { itemid = popNumber(L); } uint32_t count = 0; g_game.cleanMapEx(count, itemid); lua_pushnumber(L, count); return 1; }
9 minutos atrás, Crypter disse:game.cpp ( substituía )
void Game::cleanMapEx(uint32_t& count, uint32_t itemid) { uint64_t start = OTSYS_TIME(); uint32_t tiles = 0; count = 0; int32_t marked = -1; if(gameState == GAMESTATE_NORMAL) setGameState(GAMESTATE_MAINTAIN); Tile* tile = NULL; ItemVector::iterator tit; if(g_config.getBool(ConfigManager::STORE_TRASH)) { marked = trash.size(); Trash::iterator it = trash.begin(); if(g_config.getBool(ConfigManager::CLEAN_PROTECTED_ZONES)) { for(; it != trash.end(); ++it) { if(!(tile = getTile(*it))) continue; tile->resetFlag(TILESTATE_TRASHED); if(tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } trash.clear(); } else { for(; it != trash.end(); ++it) { if(!(tile = getTile(*it))) continue; tile->resetFlag(TILESTATE_TRASHED); if(tile->hasFlag(TILESTATE_PROTECTIONZONE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } trash.clear(); } } else if(g_config.getBool(ConfigManager::CLEAN_PROTECTED_ZONES)) { for(uint16_t z = 0; z < (uint16_t)MAP_MAX_LAYERS; z++) { for(uint16_t y = 1; y <= map->mapHeight; y++) { for(uint16_t x = 1; x <= map->mapWidth; x++) { if(!(tile = getTile(x, y, z)) || tile->hasFlag(TILESTATE_HOUSE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } } } } else { for(uint16_t z = 0; z < (uint16_t)MAP_MAX_LAYERS; z++) { for(uint16_t y = 1; y <= map->mapHeight; y++) { for(uint16_t x = 1; x <= map->mapWidth; x++) { if(!(tile = getTile(x, y, z)) || tile->hasFlag(TILESTATE_PROTECTIONZONE) || !tile->getItemList()) continue; ++tiles; tit = tile->getItemList()->begin(); while(tile->getItemList() && tit != tile->getItemList()->end()) { if((*tit)->isMoveable() && !(*tit)->isLoadedFromMap() && !(*tit)->isScriptProtected() && (itemid == 0 || itemid == *tit->getID())) { internalRemoveItem(NULL, *tit); if(tile->getItemList()) tit = tile->getItemList()->begin(); ++count; } else ++tit; } } } } } if(gameState == GAMESTATE_MAINTAIN) setGameState(GAMESTATE_NORMAL); std::clog << "> CLEAN: Removed " << count << " item" << (count != 1 ? "s" : "") << " from " << tiles << " tile" << (tiles != 1 ? "s" : ""); if(marked >= 0) std::clog << " (" << marked << " were marked)"; std::clog << " in " << (OTSYS_TIME() - start) / (1000.) << " seconds." << std::endl; }
void Game::cleanMap(uint32_t itemid) { uint32_t dummy; cleanMapEx(dummy, itemid); }
game.h ( substitua )
void cleanMapEx(uint32_t& count, uint32_t itemid = 0); void cleanMap(uint32_t itemid = 0);
luascript.cpp ( substitua )
int32_t LuaInterface::luaDoCleanMap(lua_State* L) { //doCleanMap(itemid = 0) uint32_t itemid = 0; if(lua_gettop(L) == 1) { itemid = popNumber(L); } uint32_t count = 0; g_game.cleanMapEx(count, itemid); lua_pushnumber(L, count); return 1; }
opa ai sim vou testar! VALEU =D