Wazzap
Killing Elite
1.Description: After the expiration of the time specified in the config message appears cleanie
3. Code
In game.cpp below
2. Tibia 7.601 minute to clean. Get your things from floor now!
3. Code
In game.cpp below
Add:long Game::cleanMap()
{
OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::cleanMap()");
return map->clean();
}
In game.h below#ifdef _BBK_KIED_CLEAN__
long Game::beforeClean()
{
for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) {
it->second->sendTextMessage(MSG_RED_INFO, "1 minute to clean. Get your things from floor now!");
}
addEvent(makeTask(60000, std::mem_fun(&Game::secondsToClean)));
}
void Game::secondsToClean()
{
autocleanMap(5);
}
void Game::autocleanMap(int seconds)
{
OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::autocleanMap()");
if (seconds == 0)
{
std::cout << ":: auto clean... ";
timer();
long count = cleanMap();
double sec = timer();
std::stringstream msg;
msg << "Clean completed. Collected " << count << (count==1? " item." : " items.") << std::ends;
for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it){
if(dynamic_cast<Player*>(it->second))
(*it).second->sendTextMessage(MSG_RED_INFO, msg.str().c_str());
}
std::cout << "ok (" << timer() << "s)" << std::endl;
addEvent(makeTask((g_config.getGlobalNumber("autoclean", 2))*60000, std::mem_fun(&Game::beforeClean)));
}
else
{
std::stringstream msg;
msg << "TIME " << seconds << std::ends;
AutoList<Player>::listiterator it = Player::listPlayer.list.begin();
while (it != Player::listPlayer.list.end())
{
(*it).second->sendTextMessage(MSG_RED_INFO, msg.str().c_str());
++it;
}
addEvent(makeTask(1000, boost::bind(&Game::autocleanMap, this, seconds - 1)));
}
}
#endif //_BBK_KIED_CLEAN__
Add:long cleanMap();
In otserv.cpp below#ifdef _BBK_KIED_CLEAN__
long beforeClean();
void secondsToClean();
void autocleanMap(int seconds);
#endif //_BBK_KIED_CLEAN__
add:#ifdef YUR_CVS_MODS
double t = timer();
std::cout << "Loaded in " << t << " s" << std::endl;
#endif
Then add to the project:#ifdef _BBK_KIED_CLEAN__
if (g_config.getGlobalNumber("autoclean") > 0)
g_game.addEvent(makeTask((g_config.getGlobalNumber("autoclean", 2))*60000, std::mem_fun(&Game::beforeClean)));
else
std::cout << ":: Auto clean Off" << std::endl;
#endif //_BBK_KIED_CLEAN__
Add to config.lua-D_BBK_KIED_CLEAN__
-- Wazza AutoClean
-- (0 - off, 1 - one minute, 60 - one hour)
autoclean = 1