Monday, April 13, 2009

Buff For Guild

automacro buffAndWarp {
pubm /(ald|alde|sq|pron|prt|HL|pay|asum|heal|santuary|sant|ab|buff|agi|bless)/i
sp >= 70
priority 0
class high priest
exclusive 1
call checkMsg
}
macro checkMsg {
$i = @player ($.lastpub)
$g = @eval (exists $::players{$::playersID[$i]}->{guild} ? $::players{$::playersID[$i]}->{guild}{name} : 'null')
if ($g == Gothic) goto accessGranted
if ($g == V a l k y r i e) goto accessGranted
goto end
:accessGranted
$msg = $.lastpubMsg
$posx = @rand (4, 5, 6, 7)
$posy = @rand (4, 5, 6, 7)
$cellIsFull = 0
do eval $::Macro::Data::varStack{cellIsFull} = 0;foreach (@{$::playersList->getItems()}) { next if (($_->{pos_to}{x} != $posx) || ($_->{pos_to}{y} != $posy));$::Macro::Data::varStack{cellIsFull} = 1; last;}
if ($cellIsFull == 1) goto accessGranted 
$x = @arg ("$.pos", 1)
$y = @arg ("$.pos", 2)
$evalx = @eval ($x + $posx)
$evaly = @eval ($y + $posy)
if ($msg == ALD) goto warpAld
if ($msg == ald) goto warpAld
if ($msg == alde) goto warpAld
if ($msg == ALDE) goto warpAld
if ($msg == SQ) goto warpSq
if ($msg == sq) goto warpSq
if ($msg == GEF) goto warpGef
if ($msg == gef) goto warpGef
if ($msg == HL) goto warpHl
if ($msg == hl) goto warpHl
if ($msg == pay) goto warpHl
if ($msg == asum) goto asum
if ($msg == ASUM) goto asum
if ($msg == agi) goto agi
if ($msg == AGI) goto agi
if ($msg == bless) goto bless
if ($msg == BLESS) goto bless
if ($msg == ab) goto agiBless
if ($msg == AB) goto agiBless
if ($msg == buff) goto agiBless
if ($msg == heal) goto heal
if ($msg == HEAL) goto heal
if ($msg == sant) goto santuary
if ($msg == santuary) goto santuary
if ($msg == SANT) goto santuary
if ($msg == SANTUARY) goto santuary
goto end
:warpAld
do sl 27 $evalx $evaley
pause 1
do warp alde_gld
stop
:warpSq
do sl 27 $evalx $evaly
pause 1
do warp prt_gld
stop
:warpGef
do sl 27 $evalx $evaly
pause 1
do warp gef_fild13
stop
:warpHl
do sl 27 $evalx $evaly
pause 1
do warp pay_gld
stop
:asum
do sp 361 $i 5
stop
:agi
do sp 29 $i 10
stop
:bless
do sp 34 $i 10
stop
:agiBless
do sp 34 $i 10
pause 1
do sp 29 $i 10
stop
:heal
do sp 28 $i 10
pause 0.5
do sp 28 $i 10
pause 0.5
do sp 28 $i 10
pause 0.5
do sp 28 $i 10
stop
:santuary
do sp 70 $i 7
stop
:end
log $msg
stop
}


Untuk yang lain harap anda mengedit nya sendiri.

Setting For Auto-Trade

Most people use Auto-Trade to buy some items they need or want in short time..

1. Make a notepad named autotrade.pl and copy paste this and then put it in plugins folder :

  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::parseDataFile_lc);
  my $cfID = Settings::addControlFile($file, loader => [\&FileParsers::parseDataFile_lc, \%trade_lut]);
  #Settings::load($cfID);
  undef $file;

  sub Unload {
  Plugins::delHook('AI_pre', $hook1);
  Plugins::delHook('parseMsg/pre', $hook2);
  Settings::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 = 20;
  # 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 {
  my $hookName = shift;
  my $args = shift;
  my $switch = $args->{switch};
  my $msg = $args->{msg};

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

  sub call {
  AUTOTRADE: {
  if (AI::is("","tradeAuto", "deal") && $config{tradeAuto} && $char->{skills}{NV_BASIC}{lv} > 4) {
  if (AI::action ne "tradeAuto" && AI::action ne "deal" && $::currentChatRoom ne "") {
  message "Begin auto-trade mode.\n", "autoTrade";
  if ($config{dealAuto}) {
  $config{dealAuto} = 0;
  Misc::configModify("dealAuto", $config{dealAuto});
  }
  AI::queue("tradeAuto");
  }

  last AUTOTRADE if !AI::is("tradeAuto","deal");

  if (Utils::timeOut($itemAddTimeout,$dealAcceptTime) && $::incomingDeal{name} && !$::currentDeal{name}) {
  $messageSender->sendDealAccept();
  undef $dealFinalize;
  undef $dealTrade;
  $itemAddTimeout = time;
  message "Sent deal accept, begin trading\n", "autoTrade";
  }
  last AUTOTRADE if (!$::currentDeal{name});
  if (!Utils::timeOut($itemAddTimeout,$itemWaitTime) && $tradeDealAddItem) {
  $itemAddTimeout = time;
  undef $tradeDealAddItem;
  }
  if (($::currentDeal{other_finalize} && Utils::timeOut($itemAddTimeout,$zenyAddDelay)) || Utils::timeOut($itemAddTimeout,$itemWaitTime)) {
  if ($::currentDeal{other} eq ()) {
  message "Other person didn’t add any items, cancelling…\n", "autoTrade";
  $messageSender->sendCurrentDealCancel();
  $itemAddTimeout = time;
  } elsif (!$dealFinalize) {
  my $sumvalue;

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

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

  return 1;

2.  open your config.txt and put tradeAuto to 1 and deal auto to 0, so it'll looked like :

dealAuto 0
tradeAuto 1
dealAuto_names
partyAuto 1
partyAutoShare 1
guildAutoDeny 1

3. create another notepad in your controls folder named autotrade.txt , for example :

# [item name] [price]

Crunch Toast 2500000

2. Open your control folder and Put These into your macros.txt :

automacro openchatroom {
map payon
run-once 1
delay 10
call openchat
}

macro openchat {
do chat create "B: Crunch Toast 2,5 million" 2 0 1111
}

Note : its work properly and very well.. i tried it already in OK 2.0.6 , oh yeah almost forgot. . make sure all your notepads save as all files...