Monday, November 10, 2014

Plugin Wait4Party

di config.txt master tambahkan: follow_wait 1

catatan: jika sudah menggunakan macro, jangan gunakan ini

package waitParty;


use Plugins;
use Globals;
use Log qw(message error warning debug);


our $findParty;
our $temp;


Plugins::register('waitParty', 'Wait and come back for party', \&unload, \&unload);


my $hooks = Plugins::addHooks(   ['actor_player_add', \&waitForOthers, undef],
            ['actor_player_remove', \&waitForOthers, undef],
            ['party_share', \&waitForOthers, undef],
            ['party_move', \&waitForOthers, undef],
            ['AI_pre', \&waitForOthers, undef],
            ['actor_action_sit', \&waitForOthers, undef],
            ['actor_action_stand', \&waitForOthers, undef]);


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


sub waitForOthers {
   return unless $config{'follow_wait'};
   return unless defined @partyUsersID;


   #return if bot isn't at lockmap
   return if (($config{'follow_wait_inLockOnly'} > 0) && ($field{name} ne $config{lockMap}));


   my $actor;
   foreach (@partyUsersID) {
      next if $_ eq $accountID;
      next if $_ eq "";
      $actor = $playersList->getByID($_);


      if(!$actor && $char->{'party'}{'users'}{$_}{'online'}) {
         my %party;
         $party{x} = $char->{party}{users}{$_}{pos}{x};
         $party{y} = $char->{party}{users}{$_}{pos}{y};
         ($party{map}) = $char->{party}{users}{$_}{map} =~ /([\s\S]*)\.gat/;


         if ($party{map} ne $field{name} || $party{x} == 0 || $party{y} == 0) {
            delete $party{x};
            delete $party{y};
         }


         return unless ($party{map} ne $field{name} || exists $party{x});


         if ((exists $ai_v{party} && AI::distance(\%party, $ai_v{party}) > 15)
            || $party{map} != $ai_v{party}{map}
            || (AI::timeOut($ai_v{party}{time}, 15) && AI::distance(\%party, $char->{pos_to}) > $config{followDistanceMax})) {


            $ai_v{party}{x} = $party{x};
            $ai_v{party}{y} = $party{y};
            $ai_v{party}{map} = $party{map};
            $ai_v{party}{time} = time;


            warning "Party is far way.
", "waitParty";


            if ($ai_v{party}{map} ne $field{name}) {
               message "Searching party: $ai_v{party}{map}
", , "follow";
            } elsif (AI::distance(\%party, $char->{pos_to}) > $config{followDistanceMax} ) {
               message "Searching party: $ai_v{party}{map} ($ai_v{party}{x},$ai_v{party}{y})
", "follow";
            } else {
               return;
            }
            AI::clear("move", "route", "mapRoute");
            AI::ai_route($ai_v{party}{map}, $ai_v{party}{x}, $ai_v{party}{y}, distFromGoal => $config{followDistanceMin});
            my $followIndex = AI::findAction("follow");
            if (defined $followIndex) {
               $ai_seq_args[$followIndex]{ai_follow_lost_end}{timeout} = $timeout{ai_follow_lost_end}{timeout};
            }
         }
         $findParty = 1;
         return;
      } elsif ($findParty && ($actor = $playersList->getByID($_))) {
         warning "Party Found.
", "waitParty";
         $findParty = 0;
      } elsif ($findParty) {
         warning "Party is offline.
", "waitParty";
         $findParty = 0;
         return;
      }
   }
}
1;

macro elven arrow

kondisi:
sesuaikan tulisan elven quiver nya, jgn sampe salah
macro ini menggunakan merchant class, klo lsg pake archer class, yg do cart nya hilangkan
jangan full paste, cek lagi kekuatan char anda, tiap char beda²
pastikan pass kafra udah di set dg benar di config.txt]

automacro quiver {
 inventory "HuntingQuiver" < 170
 location mora
 exclusive 1
 run-once 1
 call {
  do ai manual
  pause 0.5
  do move 100 110
  pause 0.5
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do cart add ElvenQuiver
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do cart add ElvenQuiver
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do cart add ElvenQuiver 80
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 30000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do cart add ElvenQuiver
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 20000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 12000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  pause 1
  do talknpc 100 118 b
  pause 2
  do buy 5 6000
  pause 1
  do talknpc 106 117 c r0 r0 r0 r0 r0
  release quiver


 }
}
automacro storage {
 inventory "ElvenQuiver" > 170
 location mora
 exclusive 1
 run-once 1
 call {
  do ai manual
  pause 0.5
  do move 52 133
  pause 1
  do talknpc 48 128 c r0
  pause 2
  do storage add HuntingQuiver
  pause 0.5
  do cart get HuntingQuiver
  pause 0.5
  do storage add HuntingQuiver
  pause 0.5
  do cart get HuntingQuiver
  pause 0.5
  do storage add HuntingQuiver
  pause 1
  release storage


 }
}

Macro Jamur Monk

kondisi:
Buat char Aco dan quest Monk sampai mau cari jamur aja, abis itu stop
tulisan merah bisa di sesuaikan dg simpos anda
kadang suka stuk pas mau hit jamur nya, ini bisa sekali2 bot nya di relog

automacro payon {
 location payon
 run-once 1
 call warp
 timeout 100
}


macro warp {
 pause 0.2
 do sit
 pause 1
 do ai manual
 pause 0.1
 do move 95 59
 pause 0.5
 do sl 27 94 60
 pause 3
 do warp 2
 pause 2
 do move 94 60
 pause 8
 do ai auto
 release payon
}


automacro monk {
 location prt_monk
 run-once 1
 call jamur
 timeout 100
}


macro jamur {
 pause 0.2
 do ai manual
 pause 1
 do move 192 172
 pause 6
 do move 332 59
 pause 2
 do move 341 68
 pause 2
 do move 339 51
 pause 1
 do move 332 59
 pause 2
 do talk 0
 pause 2
 do talk resp 0
 pause 8
 do stand
 do ai auto
 release monk
}

Macro Rebirth Yuno

Kondisi:
- char tsb ada di posisi yuno_in02
- char tsb ada zeny 1.285.000
- Char tsb sudah di naikin full skill nya/tidak ada sisa skill
- Char tsb berat nya 0
- Char tsb tidak menggunakan peco2 job knight/crusader,cart job mercen class,falcon char hunter

automacro yunoin {
 exclusive 1
 run-once 1
 location yuno_in02
 call {
  do ai manual
  pause 0.5
  do sit
  pause 0.5
  do move 90 166
  pause 1
  do talknpc 88 164 c r0
  pause 2
  do move 93 202
  pause 3
  do talk 0
  pause 3
  do move yuno_in05
  pause 0.5
  do sit
  pause 0.5
  do ai auto
  release yunoin
 }
}
automacro yunoin5 {
 exclusive 1
 timeout 25
 location yuno_in05
 call {
  do ai manual
  pause 0.5
  do sit
  pause 0.5
  do move 45 54
  pause 1
  do talk 0
  pause 4
  do sit
  pause 0.5
  do ai auto
  release yunoin5
 }
}
automacro val {
 exclusive 1
 run-once 1
 location valkyrie
 call {
  do ai manual
  pause 0.5
  do sit
  pause 0.5
  do move 50 75
  pause 3
  do talk 0
  pause 10
  do ai manual
  release val
 }
}

Plugin HideConsole

1. di config.txt tambahkan: HideConsole 1
2. jika mau melihat bot: matikan bot dari task manager, nyalakan lagi

# =======================
# hideConsole v1.0
# =======================
# by hakore (hakore@users.sourceforge.net)
# see documentation at: http://forums.openkore.com/viewtopic.php?p=103437


package hideConsole;
use Globals qw(%config $interface);
use Log qw(message error);


Plugins::register('hideConsole', 'hide your console', \&onUnload);
my $hooks = Plugins::addHooks(
['initialized', \&autoHideConsole, undef],
['Command_post', \&cmdhideConsole, undef]
);


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


sub autoHideConsole {
if ($config{hideConsole} > 0) {
hideConsole();
}
}


sub cmdhideConsole {
my (undef, $args) = @_;
my ($cmd) = split(' ', $args->{input}, 2);
if ($cmd eq "hideconsole") {
message("Console hidden
");


hideConsole();
$args->{return} = 1;
}
}


sub hideConsole {
eval 'use Win32::Console;Win32::Console->new(STD_OUTPUT_HANDLE)->Free();';
}


return 1;

Plugin autotrade.pl

1. di config.txt tambahkan
tradeAuto 1
2. ubah di config.txt
dealAuto 0
3. buka notepad baru simpan, dengan nama autotrade.txt di folder control, isi:
# [item name] [price]
Gladius [3] 1000000

-----------------plugin-----------------------
package autoTrade;
#ported from messykorexp by Joseph
#original code by systeman
use strict;
use Plugins;
use Globals;
use Log qw(message warning error debug);
use AI;
use Misc;
use Network::Send;
use Utils;


Plugins::register('autoTrade', 'automated chat room dealing', \&Unload);
my $hook1 = Plugins::addHook('AI_pre', \&call);
my $hook2 = Plugins::addHook('parseMsg/pre', \&packet);


# load table file
our %trade_lut;
my $file = "autotrade.txt";
#my $cfID = Settings::addConfigFile($file, \%trade_lut, \&FileParsers:arseDataFile_lc);
my $cfID = Settings::addControlFile($file, loader => [\&FileParsers:arseDataFile_lc, \%trade_lut]);
#Settings::load($cfID);
undef $file;


sub Unload {
\tPlugins::delHook('AI_pre', $hook1);
\tPlugins::delHook('parseMsg/pre', $hook2);
\tSettings::removeFile($cfID);
}


my $dealTrade;
my $dealFinalize;
my $tradeDealAddItem;
my $itemAddTimeout;


# TIMEOUTS: you can change these if you want
# time to wait for them to add items before cancelling?
my $itemWaitTime = 12;
# time to wait before accepting deal request?
my $dealAcceptTime = 2;
# time to wait before adding zeny once they finalize their item choices?
my $zenyAddDelay = 3;


sub packet {
\tmy $hookName = shift;
\tmy $args = shift;
\tmy $switch = $args->{switch};
\tmy $msg = $args->{msg};


\tif ($switch eq "00E9") {
\t\tmy $amount = unpack("L1", substr($msg, 2,4));
\t\tmy $ID = unpack("S1", substr($msg, 6,2));
\t\tif ($ID > 0) {
\t\t\t# they added an item, so reset the timeout
\t\t\t$tradeDealAddItem = 1;
\t\t}
\t}
\tif ($switch eq "01F4") {
\t\t#deal request, wait before accepting
\t\t$itemAddTimeout = time;
\t}
\tif ($switch eq "00E5" || $switch eq "01F4") {
\t\t#deal request, wait before accepting
\t\t$itemAddTimeout = time;
\t}
\tif ($switch eq "00EC") {
\t\tmy $type = unpack("C1", substr($msg, 2, 1));
\t\tif ($type == 1) {
\t\t\t#they finalize their item selections
\t\t\t$itemAddTimeout = time;
\t\t}
\t}
}


sub call {
\tAUTOTRADE: {
\t\tif (AI::is("","tradeAuto", "deal") && $config{tradeAuto} && $char->{skills}{NV_BASIC}{lv} > 4) {
\t\t\tif (AI::action ne "tradeAuto" && AI::action ne "deal" && $::currentChatRoom ne "") {
\t\t\t\tmessage "Begin auto-trade mode.
", "autoTrade";
\t\t\t\tif ($config{dealAuto}) {
\t\t\t\t\t$config{dealAuto} = 0;
\t\t\t\t\tMisc::configModify("dealAuto", $config{dealAuto});
\t\t\t\t}
\t\t\t\tAI::queue("tradeAuto");
\t\t\t}


\t\t\tlast AUTOTRADE if !AI::is("tradeAuto","deal");


\t\t\tif (Utils::timeOut($itemAddTimeout,$dealAcceptTime) && $::incomingDeal{name} && !$::currentDeal{name}) {
\t\t\t\t$messageSender->sendDealAccept();
\t\t\t\tundef $dealFinalize;
\t\t\t\tundef $dealTrade;
\t\t\t\t$itemAddTimeout = time;
\t\t\t\tmessage "Sent deal accept, begin trading
", "autoTrade";
\t\t\t}
\t\t\tlast AUTOTRADE if (!$::currentDeal{name});
\t\t\tif (!Utils::timeOut($itemAddTimeout,$itemWaitTime) && $tradeDealAddItem) {
\t\t\t\t$itemAddTimeout = time;
\t\t\t\tundef $tradeDealAddItem;
\t\t\t}
\t\t\tif (($::currentDeal{other_finalize} && Utils::timeOut($itemAddTimeout,$zenyAddDelay)) || Utils::timeOut($itemAddTimeout,$itemWaitTime)) {
\t\t\t\tif ($::currentDeal{other} eq ()) {
\t\t\t\t\tmessage "Other person didn't add any items, cancelling...
", "autoTrade";
\t\t\t\t\t$messageSender->sendCurrentDealCancel();
\t\t\t\t\t$itemAddTimeout = time;
\t\t\t\t} elsif (!$dealFinalize) {
\t\t\t\t\tmy $sumvalue;


\t\t\t\t\tmy @currentDealOther;
\t\t\t\t\tforeach (keys %{$::currentDeal{other}}) {
\t\t\t\t\t\tpush @currentDealOther, $_;
\t\t\t\t\t}
\t\t\t\t\tmy $max = @currentDealOther;
\t\t\t\t\tfor (my $i = 0;$i < $max;$i++) {
\t\t\t\t\t\tmy $found = 0;
\t\t\t\t\t\tmy $ID = $currentDealOther[$i];
\t\t\t\t\t\tmy $name = lc main::itemName($::currentDeal{other}{$ID});
\t\t\t\t\t\tif (defined $trade_lut{$name}) {
\t\t\t\t\t\t\tmessage "Add ".$trade_lut{$name}."z x $::currentDeal{other}{$ID}{amount} to deal
", "autoTrade";
\t\t\t\t\t\t\t$sumvalue += ($::currentDeal{other}{$ID}{amount} * $trade_lut{$name});
\t\t\t\t\t\t} else {
\t\t\t\t\t\t\tmessage "Other person added item which is not in buy list, cancelling...
", "autoTrade";
\t\t\t\t\t\t\t$messageSender->sendCurrentDealCancel();
\t\t\t\t\t\t\tlast AUTOTRADE;
\t\t\t\t\t\t}
\t\t\t\t\t}
\t\t\t\t\tmessage "Trading $sumvalue zeny and confirming
", "autoTrade";
\t\t\t\t\t$messageSender->sendDealAddItem(0, $sumvalue);
\t\t\t\t\tsleep(0.5);
\t\t\t\t\t$messageSender->sendDealFinalize();
\t\t\t\t\t$dealFinalize = 1;
\t\t\t\t\t$itemAddTimeout = time;
\t\t\t\t}


\t\t\t}
\t\t\tif ($::currentDeal{you_finalize} && Utils::timeOut($itemAddTimeout,$itemWaitTime)) {
\t\t\t\tmessage "Other person didn't accept the final trade, cancelling...
", "autoTrade";
\t\t\t\t$messageSender->sendCurrentDealCancel();
\t\t\t\t$itemAddTimeout = time;
\t\t\t}
\t\t\tif (!$dealTrade && $::currentDeal{you_finalize} && $::currentDeal{other_finalize}) {
\t\t\t\tmessage "Accepting final trade
", "autoTrade";
\t\t\t\t$messageSender->sendDealTrade();
\t\t\t\t$dealTrade = 1;
\t\t\t}
\t\t}
\t}
}


return 1;

Macro auto balik tempat hunt pakai warp setelah storage

1. tambahkan di config.txt (x dan y sesuaikan seleramu)
autoMoveOnDeath 1
autoMoveOnDeath_x 29
autoMoveOnDeath_y 226
autoMoveOnDeath_map prontera
2. yang dimerahin = sesuaikan seleramu
3. yang dibiruin = tergantung pakai OK bahasa inggris / indonesia
automacro warp {
map payon
console /Storage closed/
inventory "Blue Gemstone" > 1
run-once 1
call {
do sl 27 100 100
#ganti dengan koordinat di sekitar karaktermu saat storage
pause 1.5
do warp 1
pause 1
do move 100 100
#ganti dengan kode warp tempat huntmu yang sudah dimemo
release warp
}
}

Macro auto balik simpos jika kena warp

#1. macro ini bila bot di magmaring (ve_fild03) dan harus ada butwing di inventory
#2. bila bot di map lain, misal di hode (moc_fild17) maka map (ve_fild03, veins, ve_fild04, ve_fild05, ve_fild06) diganti dengan: moc_fild17, morocc, moc_fild12, moc_fild18, moc_fild11
#3. yang dimerahin = sesuaikan seleramu

automacro warp {

\texclusive 1

\tlocation not ve_fild03

\tlocation not veins

\tlocation not ve_fild04

\tlocation not ve_fild05

\tlocation not ve_fild06\t

\tcall {

\t\tdo is Butterfly Wing

\t\tpause 1

\t\trelease warp

\t}

}

Macro Antri Strip Weapon

automacro relog {

hp > 70%

status Strip Weapon

run-once 1

call {

do relog 1

}

}