Coments Please!
Como vocês leram no tópic, esse code é para Anti-lure, igual tibia rl, quando um monstro chega a certo lugar onde você irá ajustar no config.lua, ele desaparece automaticamente.
Em Configmanager.cpp Abaixo de:
m_confInteger[OTSERV_DB_ENABLED] = getGlobalNumber(L, "otserv_db_enabled", 0);
Adicione:
#ifdef __BB_ANTI_LURE__ m_confInteger[SQM_LURE] = getGlobalNumber(L, "sqm", 50); #endif
Em Configmanager.h abaixo de:
#ifdef __TR_ANTI_AFK__ KICK_TIME, #endif
Adicione:
#ifdef __BB_ANTI_LURE__ SQM_LURE, #endif
Agora em Game.cpp abaixo de:
if(corpse){ internalAddItem(tile, corpse, INDEX_WHEREEVER, FLAG_NOLIMIT); creature->dropLoot(corpse->getContainer()); startDecay(corpse); } creature->die(); removeCreature(creature, false); }
Adicione:
#ifdef __BB_ANTI_LURE__//anti-lure if(Monster* monster = creature->getMonster()) { if(monster->spawned) { monster->CheckLured(); } } #endif
Agora em Monster.cpp abaixo de:
toLowerCaseString(strDescription);
Adicione:
#ifdef __BB_ANTI_LURE__ spawned = false; #endif
Agora no final de Monster.cpp Adicione:
#ifdef __BB_ANTI_LURE__//anti-lure bool Monster::CheckLured() { int32_t antiLure; Player* player; antiLure = g_config.getNumber(ConfigManager::SQM_LURE); int32_t deltax = std::abs(masterPos.x - getPosition().x); int32_t deltay = std::abs(masterPos.y - getPosition().y); int32_t deltaz = std::abs(masterPos.z - getPosition().z); if(deltax > antiLure || deltay > antiLure || deltaz > 2) {//modify here the monster max distance from spawn (x, y, z) g_game.removeCreature(this); return true; } return false; } #endif
Agora em Monster.h abaixo de:
bool canPushItems() const {return mType->canPushItems;}
Adicione:
#ifdef __BB_ANTI_LURE__//anti-lure bool spawned; bool CheckLured(); #endif
Agora vá para Spawn.cpp abaixo de:
Monster* monster = Monster::createMonster(mType); if(!monster){ return false; }
Adicione:
#ifdef __BB_ANTI_LURE__//anti-lure monster->spawned = true; #endif
Pronto agora basta configurar, (use alt+p) ou vá em: Project->Project Options(Alt+P)->Parameters ->C++ Compiler
Adicione isto:
-D__BB_ANTI_LURE__
Agora para finalizar em Config.lua adicione isto em qualquer lugar:
--SQM spawn from luring a monster sqm = 50
Pronto, agora dê rebuild all (Ctrl+F11).
Créditos: Jackson Zani, betinhobageston