плагин telesearch.pl для поиска мобов телепортом
Добавлено: Чт дек 07, 2006 2:47 pm
Ни для кого не секрет, что в самой коре уже есть такая встроенная фича, и включается она так:
В общем, сами плагины найдёте в самом низу сообщения. А отличаются версии 1 и 2 поддержкой разных версий бота. Первая версия требует кору версии 1.6.1 и выше, вторая - 1.9.3.
А чтобы плагин включить, делаем следующее (для обоих версий плагина):
1) Пихаем сам файлик плагина в папку plugins.
2) Пописываем в timeouts.txt строчку ai_teleport_search 5. Ну, число можно подставить любое. Оно означает, сколько секунд бот будет гулять и искать моба до следующего телепорта.
3) Прописываем в config.txt - teleport_search 1.
3а) teleport_search_minSp # - минимальное кол-во сп, нужное для того, чтобы бот телепортился. Работает только если teleportAuto_useSkill имеет значение 1. (Только для v2!)
4) Ставим teleportAuto_search 0
5) route_randomWalk должен иметь значение 1.
Всё. Наслаждаемся работой плагина. Поправьте, если в чём-то ошибся.
---
Первая версия, telesearch.pl:
Вторая версия, tele-search-v2.pl:
Но работает она далеко не идеально. У меня вообще не заработала, если честно. Для этого и был создан плагин неким [• Fenris™ •], а также его модификация, созданная vivi. Оригиналы тем можно посмотреть здесь и здесь.teleportAuto_search 1
В общем, сами плагины найдёте в самом низу сообщения. А отличаются версии 1 и 2 поддержкой разных версий бота. Первая версия требует кору версии 1.6.1 и выше, вторая - 1.9.3.
А чтобы плагин включить, делаем следующее (для обоих версий плагина):
1) Пихаем сам файлик плагина в папку plugins.
2) Пописываем в timeouts.txt строчку ai_teleport_search 5. Ну, число можно подставить любое. Оно означает, сколько секунд бот будет гулять и искать моба до следующего телепорта.
3) Прописываем в config.txt - teleport_search 1.
3а) teleport_search_minSp # - минимальное кол-во сп, нужное для того, чтобы бот телепортился. Работает только если teleportAuto_useSkill имеет значение 1. (Только для v2!)
4) Ставим teleportAuto_search 0
5) route_randomWalk должен иметь значение 1.
Всё. Наслаждаемся работой плагина. Поправьте, если в чём-то ошибся.
---
Первая версия, telesearch.pl:
Код: Выделить всё
#teleserach.pl OpenKore tele-searching plugin
#Plugin by: [? Fenris? ?], Openkore
#Revision 1
#Under Openkore 1.6.1
package telesearch;
use strict;
use Plugins;
use Globals;
use Settings;
use Log qw(message);
use Utils;
our $tele = 0;
our $cancelled = 0;
Plugins::register('telesearch', 'Alternative tele-searching plugin.', \&unload);
my $ai_idle_hook = Plugins::addHook('AI_pre', \&idleCheck);
sub unload {
Plugins::delHook('AI_pre', $ai_idle_hook);
}
sub idleCheck {
if ($ai_seq[0] eq "move" && $ai_seq[1] eq "route" && $ai_seq[2] eq "" && $config{'teleport_search'} && $field{'name'} eq $config{'lockMap'} && $tele == 0) {
$timeout{'ai_teleport_search'}{'time'} = time;
$tele = 1;
$cancelled = 0;
} elsif ($ai_seq[0] eq "move" && $ai_seq[1] eq "route" && $ai_seq[2] eq "" && $config{'teleport_search'} && $field{'name'} eq $config{'lockMap'} && timeOut(\%{$timeout{'ai_teleport_search'}}) && $tele == 1) {
message("Tele-searching...\n","info");
main::useTeleport(1);
$tele = 0;
} elsif (timeOut($timeout{'ai_teleport_search'}) && $cancelled != 1) {
$tele = 0;
$cancelled = 1;
}
}
return 1;
Код: Выделить всё
#########################################################################
# OpenKore - Telesearch Plugin v2
# Copyright (c) 2006 ViVi
#
# This plugin is licensed under Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
#
# You are free:
# * to copy, distribute, display, and perform the work
# * to make derivative works
#
# Under the following conditions:
# * by Attribution: You must attribute the work in the manner specified by the author or licensor.
# * Noncommercial: You may not use this work for commercial purposes.
# * Share Alike: If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
#
# * For any reuse or distribution, you must make clear to others the license terms of this work.
# * Any of these conditions can be waived if you get permission from the copyright holder.
#
# Your fair use and other rights are in no way affected by the above.
#
# This is a human-readable summary of the Legal Code ( Full License: http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode ).
# Disclaimer: http://creativecommons.org/licenses/disclaimer-popup?lang=en
#
#########################################################################
package telesearchV2;
use strict;
use Plugins;
use Settings;
use Log qw(message error);
use Utils;
use AI;
use Globals;
Plugins::register('Tele-Search v2', 'Alternative tele-search v2.', \&unload);
my $hooks = Plugins::addHooks(
['AI_pre',\&search, undef],
['map_loaded', \&MapLoaded, undef],
['packet/sendMapLoaded', \&MapLoaded, undef]
);
my ($maploaded,$allow_tele);
sub unload {
Plugins::delHooks($hooks);
message("Unloaded Teleport search v2.\n","info");
}
sub MapLoaded {
$maploaded = 1;
}
sub checkIdle {
if (AI::action eq "move" && AI::action(1) eq "route" || AI::action eq "route" && !AI::inQueue("attack","skill_use")) {
return 1;
} else {
return 0;
}
}
sub checkSp {
if ($config{'teleportAuto_useSkill'} == 1) {
if ($config{'teleport_search_minSp'} && $config{'teleport_search_minSp'} <= $char->{sp}) {
return 1;
} elsif (!$config{'teleport_search_minSp'} && $char->{sp} >= 10) {
error ("teleport_search_minSp is missing ! Using default value (10 sp)!\n");
$config{'teleport_search_minSp'} = 10;
return 1;
} else {
return 0;
}
} elsif ($config{'teleportAuto_useSkill'} > 1) {
return 1;
}
}
sub search {
if ($config{'teleport_search'} && Misc::inLockMap() && $timeout{'ai_teleport_search'}{'timeout'}) {
message("TS Debug: Config set, we're in lockMap and timeout is set.\n") if $config{'teleport_search_debug'};
if ($maploaded && !$allow_tele) {
message("TS Debug: Map is loaded but we're not allowed to teleport.\n") if $config{'teleport_search_debug'};
$timeout{'ai_teleport_search'}{'time'} = time;
$allow_tele = 1;
# Check if we're allowed to teleport, if map is loaded, timeout has passed and we're just looking for targets.
} elsif ($maploaded && $allow_tele && timeOut($timeout{'ai_teleport_search'}) && checkIdle() && checkSp()) {
message("Attemping to tele-search.\n","info");
$allow_tele = 0;
$maploaded = 0;
# Attempt to teleport, give error and unload plugin if we cant.
if (!Misc::useTeleport(1)) {
error ("Fatal error, we dont have the skill nor items to teleport! - Unloading plugin.\n");
unload();
return;
}
# We're doing something else besides looking for monsters, reset the timeout.
} elsif (!checkIdle()) {
message("TS Debug: We're doing something else besides looking for a target now.\n") if $config{'teleport_search_debug'};
$timeout{'ai_teleport_search'}{'time'} = time;
}
# Oops! timeouts.txt is missing a crucial value, lets use the default value ;)
} elsif (!$timeout{'ai_teleport_search'}{'timeout'}) {
error ("timeouts.txt missing setting! Using default timeout now!\n");
$timeout{'ai_teleport_search'}{'timeout'} = 5;
return;
}
}
return 1;