ชุมชนคนรักบอท
Would you like to react to this message? Create an account in a few clicks or log in to continue.


พูดคุยแลกเปลี่ยน config macro plugins สอบถามเรื่องบอท THAI_KORE DARK_KORE OPEN_KORE SIRENS ONLINE IP_BONUS
 
บ้านLatest imagesค้นหาสมัครสมาชิก(Register)เข้าสู่ระบบ(Log in)

 

 Plugin ตี บวก

Go down 
ผู้ตั้งข้อความ
Admin
Admin



จำนวนข้อความ : 17
Join date : 07/10/2011

Plugin ตี บวก Empty
ตั้งหัวข้อเรื่อง: Plugin ตี บวก   Plugin ตี บวก I_icon_minitimeFri Oct 07, 2011 1:22 pm

Plugin ตี บวก


เอาด้านล่างนี้ไปเพิ่มใน config

autoRefine {
refineStone
refineNpc
npcSequence
zenny
maxRefine
}


autoRefine Shoes [1] { <<< ชื่อไปเทมที่จะตี
refineStone Elunium <<< แร่ที่ใช้ตี
refineNpc prt_in 63 60 <<< แมพและพิกัด NPC ตี+
npcSequence c r5 c r0 c w1 c w1 r0 w1 c c n <<< สเต็ปกาีรคุย
zenny 3000 <<< จำนวนเงิน
maxRefine 9 <<< ตีไปจนถึง + 9
disabled 0
}


ส่วนนี้เอาไปเซฟ เป็นไฟล์ autoRefine.PL

package autoRefine;

use strict;
use Plugins;
use Settings;
use Log qw(message error);
use Utils;
use Globals;
use Task;
use Task::MapRoute;
use Task::TalkNPC;

Plugins::register('Auto-Refine', 'What do you think?', \&unload);
my $hooks = Plugins::addHooks(
['AI_pre',\&main, undef],
['map_loaded', \&MapLoaded, undef],
['packet/sendMapLoaded', \&MapLoaded, undef],
['parseMsg/pre', \&itemEquiped, undef],
);

my ($item,$metal,$maploaded,$routeCallback,$talkCallback,%npc,$startRefine,$talking);

# Set $maploaded to 1, this incase we reload the plugin for whatever reason...
if ($net && $net->getState() == Network::IN_GAME) {
$maploaded = 1;
}

sub unload {
Plugins::delHooks($hooks);
}

$timeout{'refine'}{'timeout'} = 2; # No need to go any faster than 1 iteration per second
$timeout{'refine'}{'time'} = time;

sub main {
return if (!$maploaded || !$config{"autoRefine_0"} || !timeOut($timeout{'refine'} || ($item && !$item->{equipped})));
selectItem() if (!$item);

return if (!$item || !$metal || $metal->{amount} < 1);

my ($upgrade,$plus) = $item->name =~ /(.){2}/;
$item->{upgrade} = $upgrade if ($plus eq "+");

if (!$startRefine) {
route($npc{map},$npc{x},$npc{y});
} elsif ($startRefine && $item->{equipped} && $item->{upgrade} < $config{"autoRefine_0_maxRefine"}) { # Item exists, we have metals are near the refiner and equiped the item... it is also below the + treshhold we want
talkNPC($npc{x},$npc{y},$npc{sequence});
} elsif ($startRefine && !$item->{equipped}) { # Item exists in inventory but is not equiped, equip it
$item->equip();
} elsif ($startRefine && $item->{equipped} && $item->{upgrade} => $config{"autoRefine_0_maxRefine"}) { # Max refined reached, unequip it
$item->unequip();
undef $item;
undef $metal;
} else {
$startRefine = 0;
message("We have run out of items to refine or metals to refine them with!\n","info");
}
$timeout{'refine'}{'time'} = time;
}

sub selectItem {
if ($config{"autoRefine_0"} && !$config{"autoRefine_0_disabled"} && $config{"autoRefine_0_refineStone"} &&
$config{"autoRefine_0_refineNpc"} && $config{"autoRefine_0_npcSequence"} && $config{"autoRefine_0_zenny"} < $char->{zenny}) {

$item = $char->inventory->getByName($config{"autoRefine_0"});
$metal = $char->inventory->getByName($config{"autoRefine_0_refineStone"});
($npc{map},$npc{x},$npc{y}) = $config{"autoRefine_0_refineNpc"} =~ /^(.*) (.*) (.*)$/ if ($item && $metal);
$npc{sequence} = $config{"autoRefine_0_npcSequence"};
if (!$item || !$metal) {
undef $item;
undef $metal;
}
}
return 0;
}

sub route {
return if ($taskManager->countTasksByName("MapRoute") > 0 || $startRefine);

my $map = shift;
my $x = shift;
my $y = shift;
my $routeTask = Task::MapRoute->new(map => $map, x => $x, y => $y, distFromGoal => 10, notifyUponArrival => 1);
$taskManager->add($routeTask);
$routeCallback = $taskManager->onTaskFinished->add(undef,\&toggleRefine);
}

sub toggleRefine {
$taskManager->onTaskFinished->remove($routeCallback);
$startRefine = 1;
}

sub talkNPC {
return if ($taskManager->countTasksByName("TalkNPC") > 0 || $talking);
my $x = shift;
my $y = shift;
my $sequence = shift;
my $talkTask = Task::TalkNPC->new(x => $x, y => $y, sequence => $sequence);
$taskManager->add($talkTask);
$talking = 1;
$talkCallback = $taskManager->onTaskFinished->add(undef,\&checkItem);
}

sub checkItem {
$talking = 0;
$item = $char->inventory->getByServerIndex($item->{index});
$taskManager->onTaskFinished->remove($talkCallback);
if (!$item) {
$startRefine = 0;
message("Item broke \n","info");
} else {
message("Upgraded ".$item->{name}."\n","info");
}
}

sub itemEquiped {
my ($self, $args) = @_;
return if ($args->{switch} ne "00AA" || $args->{switch} ne "00AC"); # 00AA = Item is Equiped packet, 00AC = unequipped
$item->{equipped} = ($args->{switch} eq "00AA") ? 1 : 0; # If 00AA then 1, else 0
}

sub MapLoaded {
$maploaded = 1;
}

return 1;
ขึ้นไปข้างบน Go down
https://tro-bot-kore.forumth.com
 
Plugin ตี บวก
ขึ้นไปข้างบน 
หน้า 1 จาก 1

Permissions in this forum:คุณไม่สามารถพิมพ์ตอบ
ชุมชนคนรักบอท :: OPEN-KORE :: ขอ+Plugin+Setting-
ไปที่: