O retreat plugin é extremante útil para os usuários do openkore, ele permite fechar ou deslogar todos os bots simultaneamente. Isto é muito interessante para evitar a perda de muitas contas ao ser testado por um GM. Por si só esta ferramenta já faz a desconexão quando um Game Master executa certas ações, como aplicar um banimento. Mas o plugin mostra todo o seu potencial se aliado as macros, pois com elas podemos personalizar para que vários eventos acionem o retreat.
Você já deve ter um conjunto de automacros anti-gm, então tudo o que irá precisar fazer é adicionar o comando retreat a elas. Mas antes vamos proceder a instalação do plugin, crie um arquivo chamado retreat.pl dentro da pasta plugin do seu openkore e copie o código abaixo nele:
# retreat by tiph10/Setzer # # # This source code is licensed under the # GNU General Public License, Version 2. # See http://www.gnu.org/licenses/gpl.html package retreat; use strict; use Plugins; use Commands; use Globals; use Utils; use Misc; use Log qw(message error warning); use Network::Send; Plugins::register("retreat", "warns bots to retreat after a GM action", \&unload); my $pluginHooks = Plugins::addHooks( ['start3', \&on_Start, undef], ['packet_pre/map_change', \&on_Teleport, undef], ['packet_pre/map_changed', \&on_Teleport, undef], ['packet_pre/errors', \&on_Error, undef], ['packet_pre/self_chat', \&on_SelfChat, undef], ['mainLoop_pre', \&on_MainLoop, undef] ); my $pluginCHooks = Commands::register( ['retreat', "retreat plugin", \&on_Command] ); my %pluginConfig = ( retreatPrefix => "[retreat]", retreatFile => "", ); sub on_Start { if( !defined($config{retreatFile}) ){ unload(); } else { $pluginConfig{retreatFile} = $config{retreatFile}; message($pluginConfig{retreatPrefix}."retreat plugin started\n"); message($pluginConfig{retreatPrefix}."retreat file is ".$pluginConfig{retreatFile}."\n"); } } sub on_Teleport { my (undef, $callerArgs) = @_; my ($map) = $callerArgs->{map} =~ /([\s\S]*)\./; # same conditions as in Misc::checkAllowedMap return unless $AI == 2; return unless $config{allowedMaps}; return if existsInList($config{allowedMaps}, $map); return if $config{allowedMaps_reaction} == 0; warning($pluginConfig{retreatPrefix}."teleported to not allowed map, sending retreat order\n"); sendRetreatOrder("reason: teleported (".$chars[$config{slot}]{name}." teleported to ".$map.")"); } sub on_Error { my (undef, $callerArgs) = @_; return if $callerArgs->{type} != 15; warning($pluginConfig{retreatPrefix}."disconnected by GM, sending retreat order\n"); sendRetreatOrder("reason: kicked (".$chars[$config{slot}]{name}." disconnected by GM)"); } sub on_SelfChat { my (undef, $callerArgs) = @_; if( ($callerArgs->{message} =~ /banish/) || ($callerArgs->{message} =~ /banned/) || ($callerArgs->{message} =~ /punish/) || ($callerArgs->{message} =~ /banid/) || ($callerArgs->{message} =~ /punid/) ){ warning($pluginConfig{retreatPrefix}."banned, sending retreat order\n"); sendRetreatOrder("reason: banned (".$chars[$config{slot}]{name}." received message: ".$callerArgs->{message}.")"); } } sub on_MainLoop { my (undef, $callerArgs) = @_; return if !(-e $pluginConfig{retreatFile}); warning($pluginConfig{retreatPrefix}."retreat order received\n"); Commands::run("conf logConsole 1"); if ($config{retreatValid} == 0){ Log::warning "[retreat] retreat executado, sem comandos...\n",'retreat'; } else { my $comando; $comando = $config{retreatCommand}; Log::warning "[retreat] retreat executado, comando $comando\n",'retreat'; Commands::run("$comando"); Commands::run("ai clear"); } Commands::run("conf logConsole 1"); AI::ai_clientSuspend(0, 4); unlink($config{retreatFile}); } sub on_Command { my (undef, $message) = @_; if( !defined($message) ){ $message = "command"; } warning($pluginConfig{retreatPrefix}."retreat command received, sending retreat order\n"); sendRetreatOrder("reason: ".$message); } sub unload { Plugins::delHooks($pluginHooks); Commands::unregister($pluginCHooks); undef $pluginHooks; undef %pluginConfig; } sub sendRetreatOrder { my $order = shift; # Sending retreat alert playSound($config{retreatSound}) if defined($config{retreatSound}); # Creating retreat file my $opened = 1; open(RO,">".$pluginConfig{retreatFile}) || ($opened = 0); if( $opened != 1 ){ warning($pluginConfig{retreatPrefix}."retreat order NOT sent (failed to open ".$pluginConfig{retreatFile}.")\n"); } else { print RO $order; message($pluginConfig{retreatPrefix}."retreat order sent\n"); close(RO); } if ($config{retreatDesconect} == 0){ Log::warning "[retreat] -- sem desconexao...\n",'retreat'; } else { Log::warning "[retreat] -- desconectando...\n",'retreat'; $net->serverDisconnect; } # Waiting for the sound to finish sleep($config{retreatSoundTime}) if $config{retreatSoundTime}; } sub playSound { #my $file = shift; WinUtils::playSound('$config{retreatSound}'); } 1;
Adicione a seguinte configuração ao config.txt de cada um dos seus bots:
retreatFile c:\retreat.txt retreatValid 1 retreatCommand relog 1800 retreatDesconect 0
Isso para relogar depois de 1800 segundos, para sair definitivamente use:
retreatFile c:\retreat.txt retreatValid 1 retreatCommand quit retreatDesconect 0
Vai depender da sua estratégia, eu particularmente prefiro o comando relog com um tempo bem longo. Para testar abra vários bots, devidamente configurados, e digite retreat no console, você vai perceber que a ação irá ocorrer em todas as contas, e não apenas onde você digitou o comando.
Se der erro é provável que o o seu diretório C não tenha permissão para gravar arquivos, isso é muito comum no Windows 7 e 8. Para corrigir configure o C: com permissões de leitura e gravação para todos, ou altere retreatFile c:\retreat.txt para outra pasta, uma que tenha esse privilégio.
Depois você deve adaptar todas a suas macros anti-gm para usarem o retreat, exemplo:
automacro banido { run-once 1 priority 1 console /(temporarily blocking)/i call { do retreat release banido } }
Esta macro é acionada quando aparecer a frase temporarily blocking no console, ou seja, ao ser banido. O segredo é que ela vai chamar o plugin retreat e isso irá deslogar todos os outros robots, o que possivelmente vai salva-los de serem banidos em massa. Todas as suas outras macros podem ser ajustadas para usarem esta mesma estratégia, basta ser criativo. É isso!
Eu estou to com uma duvida, eu tenho que abrir uma pasta com o nome retreat.pl, e depois adicionar dentro um bloco de notas e colar a opção que você falou?
As estratégias dos GMs mudam, portanto as macros anti-gm também. Esse é um caso típico onde se é melhor ensinar a pescar do que entregar o peixe pronto. Analise os logs do seu bot e adapte as técnicas presentes neste artigo.
e para quem esta começando agora a usar bot e ainda não tem um conjunto automacros anti-gm vc poderia postar um decente para ajudar
é amigo, eu andei reforçando meus bots com várias macros…
e agora com esse plugin ficou melhor ainda!