Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: macro.pl
- ===================================================================
- --- macro.pl (revision 8901)
- +++ macro.pl (working copy)
- @@ -103,6 +103,16 @@
- my $file = shift;
- if (parseMacroFile($file, 0)) {
- Plugins::callHook ('macro/parseAndHook');
- + if ($macro{'__init__'}) {
- + message "[macro] calling __init__\n";
- + $queue = new Macro::Script('__init__');
- + if (defined $queue) {
- + $queue->interruptible(0);
- + callMacro
- + } else {
- + error "unable to create macro queue.\n"
- + }
- + }
- &hookOnDemand; return 1
- }
- error "error loading $file.\n";
- Index: Macro/Automacro.pm
- ===================================================================
- --- Macro/Automacro.pm (revision 8901)
- +++ Macro/Automacro.pm (working copy)
- @@ -20,6 +20,7 @@
- use Macro::Utilities qw(between cmpr match getArgs refreshGlobal
- getPlayerID getSoldOut getInventoryAmount getCartAmount getShopAmount
- getStorageAmount callMacro sameParty);
- +use Macro::Parser qw(subvars);
- our ($rev) = q$Revision: 6760 $ =~ /(\d+)/;
- @@ -277,18 +278,6 @@
- return 0
- }
- my ($item, $cond, $amount) = getArgs($check);
- - if ($item =~ /^\$/) {
- - my ($var) = $item =~ /^\$([a-zA-Z][a-zA-Z\d]*)\s*/;
- - return 0 unless defined $var;
- - if (exists $varStack{$var}) {$item = $varStack{$var}}
- - else {return 0}
- - }
- - if ($amount =~ /^\$/) {
- - my ($var1) = $amount =~ /^\$([a-zA-Z][a-zA-Z\d]*)\s*/;
- - return 0 unless defined $var1;
- - if (exists $varStack{$var1}) {$amount = $varStack{$var1}}
- - else {return 0}
- - }
- my $what;
- if ($where eq 'inv') {$what = getInventoryAmount($item)}
- if ($where eq 'cart') {$what = getCartAmount($item)}
- @@ -765,29 +754,30 @@
- next CHKAM if (defined $automacro{$am}->{whenGround} && !checkGround($automacro{$am}->{whenGround}));
- next CHKAM if (defined $automacro{$am}->{notMonster} && !checkMonster($automacro{$am}->{notMonster}, 1));
- - foreach my $i (@{$automacro{$am}->{monster}}) {next CHKAM unless checkMonster($i)}
- - foreach my $i (@{$automacro{$am}->{aggressives}}){next CHKAM unless checkAggressives($i)}
- - foreach my $i (@{$automacro{$am}->{location}}) {next CHKAM unless checkLoc($i)}
- - foreach my $i (@{$automacro{$am}->{localtime}}) {next CHKAM unless checkLocalTime($i, "")}
- +
- + foreach my $i (@{$automacro{$am}->{monster}}) {next CHKAM unless checkMonster(subvars($i))}
- + foreach my $i (@{$automacro{$am}->{aggressives}}){next CHKAM unless checkAggressives(subvars($i))}
- + foreach my $i (@{$automacro{$am}->{location}}) {next CHKAM unless checkLoc(subvars($i))}
- + foreach my $i (@{$automacro{$am}->{localtime}}) {next CHKAM unless checkLocalTime(subvars($i), "")}
- foreach my $i (@{$automacro{$am}->{var}}) {next CHKAM unless checkVar($i, "")}
- foreach my $i (@{$automacro{$am}->{varvar}}) {next CHKAM unless checkVar($i, "varvar")}
- - foreach my $i (@{$automacro{$am}->{base}}) {next CHKAM unless checkLevel($i, "lv")}
- - foreach my $i (@{$automacro{$am}->{job}}) {next CHKAM unless checkLevel($i, "lv_job")}
- - foreach my $i (@{$automacro{$am}->{hp}}) {next CHKAM unless checkPercent($i, "hp")}
- - foreach my $i (@{$automacro{$am}->{sp}}) {next CHKAM unless checkPercent($i, "sp")}
- - foreach my $i (@{$automacro{$am}->{spirit}}) {next CHKAM unless checkCond($char->{spirits} || 0, $i)}
- - foreach my $i (@{$automacro{$am}->{weight}}) {next CHKAM unless checkPercent($i, "weight")}
- - foreach my $i (@{$automacro{$am}->{cartweight}}) {next CHKAM unless checkPercent($i, "cweight")}
- - foreach my $i (@{$automacro{$am}->{soldout}}) {next CHKAM unless checkCond(getSoldOut(), $i)}
- - foreach my $i (@{$automacro{$am}->{zeny}}) {next CHKAM unless checkCond($char->{zeny}, $i)}
- - foreach my $i (@{$automacro{$am}->{cash}}) {next CHKAM unless checkCond($cashShop{points}->{cash}?$cashShop{points}->{cash}:0, $i)}
- - foreach my $i (@{$automacro{$am}->{player}}) {next CHKAM unless checkPerson($i)}
- - foreach my $i (@{$automacro{$am}->{equipped}}) {next CHKAM unless checkEquip($i)}
- - foreach my $i (@{$automacro{$am}->{status}}) {next CHKAM unless checkStatus($i)}
- - foreach my $i (@{$automacro{$am}->{inventory}}) {next CHKAM unless checkItem("inv", $i)}
- - foreach my $i (@{$automacro{$am}->{storage}}) {next CHKAM unless checkItem("stor", $i)}
- - foreach my $i (@{$automacro{$am}->{shop}}) {next CHKAM unless checkItem("shop", $i)}
- - foreach my $i (@{$automacro{$am}->{cart}}) {next CHKAM unless checkItem("cart", $i)}
- + foreach my $i (@{$automacro{$am}->{base}}) {next CHKAM unless checkLevel(subvars($i), "lv")}
- + foreach my $i (@{$automacro{$am}->{job}}) {next CHKAM unless checkLevel(subvars($i), "lv_job")}
- + foreach my $i (@{$automacro{$am}->{hp}}) {next CHKAM unless checkPercent(subvars($i), "hp")}
- + foreach my $i (@{$automacro{$am}->{sp}}) {next CHKAM unless checkPercent(subvars($i), "sp")}
- + foreach my $i (@{$automacro{$am}->{spirit}}) {next CHKAM unless checkCond($char->{spirits} || 0, subvars($i))}
- + foreach my $i (@{$automacro{$am}->{weight}}) {next CHKAM unless checkPercent(subvars($i), "weight")}
- + foreach my $i (@{$automacro{$am}->{cartweight}}) {next CHKAM unless checkPercent(subvars($i), "cweight")}
- + foreach my $i (@{$automacro{$am}->{soldout}}) {next CHKAM unless checkCond(getSoldOut(), subvars($i))}
- + foreach my $i (@{$automacro{$am}->{zeny}}) {next CHKAM unless checkCond($char->{zeny}, subvars($i))}
- + foreach my $i (@{$automacro{$am}->{cash}}) {next CHKAM unless checkCond($cashShop{points}->{cash}?$cashShop{points}->{cash}:0, subvars($i))}
- + foreach my $i (@{$automacro{$am}->{player}}) {next CHKAM unless checkPerson(subvars($i))}
- + foreach my $i (@{$automacro{$am}->{equipped}}) {next CHKAM unless checkEquip(subvars($i))}
- + foreach my $i (@{$automacro{$am}->{status}}) {next CHKAM unless checkStatus(subvars($i))}
- + foreach my $i (@{$automacro{$am}->{inventory}}) {next CHKAM unless checkItem("inv", subvars($i))}
- + foreach my $i (@{$automacro{$am}->{storage}}) {next CHKAM unless checkItem("stor", subvars($i))}
- + foreach my $i (@{$automacro{$am}->{shop}}) {next CHKAM unless checkItem("shop", subvars($i))}
- + foreach my $i (@{$automacro{$am}->{cart}}) {next CHKAM unless checkItem("cart", subvars($i))}
- message "[macro] automacro $am triggered.\n", "macro";
- Index: Macro/Parser.pm
- ===================================================================
- --- Macro/Parser.pm (revision 8901)
- +++ Macro/Parser.pm (working copy)
- @@ -6,8 +6,8 @@
- require Exporter;
- our @ISA = qw(Exporter);
- -our @EXPORT = qw(parseMacroFile parseCmd isNewCommandBlock);
- -our @EKSPORT_OK = qw(parseCmd isNewCommandBlock);
- +our @EXPORT = qw(subvars parseMacroFile parseCmd isNewCommandBlock);
- +our @EKSPORT_OK = qw(subvars parseCmd isNewCommandBlock);
- use Globals;
- use Utils qw/existsInList/;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement