Henrybk

Semântica Macro Actor+Message+Parser

Jul 2nd, 2015
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 18.06 KB | None | 0 0
  1. Index: macro.pl
  2. ===================================================================
  3. --- macro.pl    (revision 168)
  4. +++ macro.pl    (working copy)
  5. @@ -123,11 +123,12 @@
  6.             if (!defined $load{'packet_skilluse'}) {$load{'packet_skilluse'} = 1}
  7.         }
  8.         if (defined $automacro{$a}->{areaSpell} && !defined $load{'packet_areaSpell'}) {$load{'packet_areaSpell'} = 1}
  9. -       if (defined $automacro{$a}->{pm} && !defined $load{'packet_privMsg'}) {$load{'packet_privMsg'} = 1}
  10. -       if (defined $automacro{$a}->{pubm} && !defined $load{'packet_pubMsg'}) {$load{'packet_pubMsg'} = 1}
  11. -       if (defined $automacro{$a}->{system} && !defined $load{'packet_sysMsg'}) {$load{'packet_sysMsg'} = 1;}
  12. -       if (defined $automacro{$a}->{party} && !defined $load{'packet_partyMsg'}) {$load{'packet_partyMsg'} = 1}
  13. -       if (defined $automacro{$a}->{guild} && !defined $load{'packet_guildMsg'}) {$load{'packet_guildMsg'} = 1}
  14. +       if (defined $automacro{$a}->{message} && $automacro{$a}->{message} =~ /^pm/ && !defined $load{'packet_privMsg'}) {$load{'packet_privMsg'} = 1}
  15. +       if (defined $automacro{$a}->{message} && $automacro{$a}->{message} =~ /^pub/ && !defined $load{'packet_pubMsg'}) {$load{'packet_pubMsg'} = 1}  
  16. +       if (defined $automacro{$a}->{message} && $automacro{$a}->{message} =~ /^sys/ && !defined $load{'packet_sysMsg'}) {$load{'packet_sysMsg'} = 1;}
  17. +       if (defined $automacro{$a}->{message} && $automacro{$a}->{message} =~ /^party/ && !defined $load{'packet_partyMsg'}) {$load{'packet_partyMsg'} = 1}
  18. +       if (defined $automacro{$a}->{message} && $automacro{$a}->{message} =~ /^guild/ && !defined $load{'packet_guildMsg'}) {$load{'packet_guildMsg'} = 1}
  19. +       if (defined $automacro{$a}->{message} && $automacro{$a}->{message} =~ /^npc/ && !defined $load{'npc_talk'}) {$load{'npc_talk'} = 1}
  20.         if (defined $automacro{$a}->{mapchange} && !defined $load{'packet_mapChange'}) {$load{'packet_mapChange'} = 1}
  21.         if (defined $automacro{$a}->{hook} && !defined $load{$automacro{$a}->{hook}}) {$load{$automacro{$a}->{hook}} = 1}
  22.         if (defined $automacro{$a}->{console} && !defined $hookToLog) {$hookToLog = 1}
  23. Index: Macro/Automacro.pm
  24. ===================================================================
  25. --- Macro/Automacro.pm  (revision 168)
  26. +++ Macro/Automacro.pm  (working copy)
  27. @@ -7,8 +7,8 @@
  28.  our @ISA = qw(Exporter);
  29.  our @EXPORT_OK = qw(releaseAM lockAM recheckAM automacroCheck consoleCheckWrapper);
  30.  our @EXPORT = qw(checkLocalTime checkVar checkVarVar checkLoc checkPersonGuild checkLevel checkLevel checkClass
  31. -   checkPercent checkStatus checkItem checkPerson checkCond checkCast checkGround checkSpellsID
  32. -   checkEquip checkMsg checkMonster checkAggressives checkConsole checkMapChange);
  33. +   checkPercent checkStatus checkItem checkCond checkCast checkGround checkSpellsID
  34. +   checkEquip checkAggressives checkConsole checkMapChange checkMessage checkActor);
  35.    
  36.  use Misc qw(whenGroundStatus getSpellName getActorName);
  37.  use Utils;
  38. @@ -310,27 +310,6 @@
  39.     return $return;
  40.  }
  41.  
  42. -# checks for near person ##################################
  43. -sub checkPerson {
  44. -   my ($who, $dist) = $_[0] =~ /^(["\/].*?["\/]\w*)\s*,?\s*(.*)/;
  45. -
  46. -   foreach my $player (@{$playersList->getItems()}) {
  47. -       next unless match($player->name, $who);
  48. -       if ($dist > 0 && distance($char->{pos_to}, $player->{pos_to}) >= $dist) {
  49. -           return 0;
  50. -       }
  51. -       my $val = sprintf("%d %d %s", $player->{pos_to}{x}, $player->{pos_to}{y}, $field->baseName);
  52. -       $varStack{".lastPlayerName"} = $player->name;
  53. -       $varStack{".lastPlayerPos"} = $val;
  54. -       $varStack{".lastPlayerLevel"} = $player->{lv};
  55. -       $varStack{".lastPlayerJob"} = $player->job;
  56. -       $varStack{".lastPlayerAccountId"} = $player->{nameID};
  57. -       $varStack{".lastPlayerBinId"} = $player->{binID};
  58. -       return 1
  59. -   }
  60. -   return 0
  61. -}
  62. -
  63.  # checks arg1 for condition in arg3 #######################
  64.  # uses: cmpr (Macro::Utils)
  65.  sub checkCond {
  66. @@ -450,47 +429,6 @@
  67.     else {return 0}
  68.  }
  69.  
  70. -# checks for public, private, party or guild message ######
  71. -# uses calcPosition, distance (Utils?)
  72. -sub checkMsg {
  73. -   my ($var, $tmp, $arg) = @_;
  74. -   my $msg;
  75. -   if ($var eq '.lastpub') {
  76. -       ($msg, my $distance) = $tmp =~ /^([\/"].*?[\/"]\w*)\s*,?\s*(\d*)/;
  77. -       if ($distance ne '') {
  78. -           my $mypos = calcPosition($char);
  79. -           my $pos = calcPosition($::players{$arg->{pubID}});
  80. -           return 0 unless distance($mypos, $pos) <= $distance
  81. -       }
  82. -   } elsif ($var eq '.lastpm') {
  83. -       ($msg, my $allowed) = $tmp =~ /^([\/"].*?[\/"]\w*)\s*,?\s*(.*)/;
  84. -       my $auth;
  85. -       if (!$allowed) {
  86. -           $auth = 1
  87. -       } else {
  88. -           my @tfld = split(/,/, $allowed);
  89. -           for (my $i = 0; $i < @tfld; $i++) {
  90. -               next unless defined $tfld[$i];
  91. -               $tfld[$i] =~ s/(?:^ +| +$)//g;
  92. -               if ($arg->{privMsgUser} eq $tfld[$i]) {$auth = 1; last}
  93. -           }
  94. -       }
  95. -       return 0 unless $auth
  96. -   } elsif ($var eq '.lastsys') {
  97. -       ($msg) = $tmp =~ /^([\/"].*?[\/"]\w*)\s*,?\s*(.*)/;
  98. -       chomp($msg);
  99. -   } else {
  100. -       $msg = $tmp
  101. -   }  
  102. -   $arg->{Msg} =~ s/[\r\n]*$//g;
  103. -   if (match($arg->{Msg},$msg)){
  104. -       $varStack{$var} = $arg->{MsgUser};
  105. -       $varStack{$var."Msg"} = $arg->{Msg};
  106. -       return 1
  107. -   }
  108. -   return 0
  109. -}
  110. -
  111.  # checks for area spell
  112.  sub checkSpellsID {
  113.     my ($line, $args) = @_;
  114. @@ -523,83 +461,6 @@
  115.     return 0
  116.  }
  117.  
  118. -# checks for monster ...
  119. -sub checkMonster {
  120. -   my $line = $_[0];
  121. -   my $not = $_[1];
  122. -   my ($mercenary, $use, $monsterList, $cond);
  123. -   my $mondist = $config{clientSight} || 20;
  124. -
  125. -   if ($line =~ /^\s*(.*),?\s+([<>=!~]+)\s+(\d+|\d+\s*.{2}\s*\d+)\s*$/) {
  126. -       ($monsterList, $cond, $mondist) = ($1, $2, $3)
  127. -   } else {
  128. -       $monsterList = $line;
  129. -       $cond = "<="
  130. -   }
  131. -
  132. -   if (!$not && $monsterList =~ /^(not|mercenary)\s+(.*)\s*$/) {
  133. -       if ($1 eq "not") {$not = 1; $monsterList = $2}
  134. -       else {$mercenary = 1; $use = 1; $monsterList = $2}
  135. -   }
  136. -
  137. -   foreach (@monstersID) {
  138. -       next unless defined $_;
  139. -       if ($mercenary) {
  140. -           #Whose the mercenary's master,
  141. -           #update later ;p
  142. -           my $mypos = calcPosition($char);
  143. -           my $pos = calcPosition($monsters{$_});
  144. -           my $dist = sprintf("%.1f",distance($pos, $mypos));
  145. -           if (existsInList($monsterList, $monsters{$_}->{name}) && $dist < 3) {$use = 0; last}
  146. -       }
  147. -       elsif ($not) {
  148. -           next if existsInList($monsterList, $monsters{$_}->{name});
  149. -           my $mypos = calcPosition($char);
  150. -           my $pos = calcPosition($monsters{$_});
  151. -           my $dist = sprintf("%.1f",distance($pos, $mypos));
  152. -           my $val = sprintf("%d %d %s", $pos->{x}, $pos->{y}, $field->baseName);
  153. -           $varStack{".lastMonster"} = $monsters{$_}->{name};
  154. -           $varStack{".lastMonsterPos"} = $val;
  155. -           $varStack{".lastMonsterDist"} = $dist;
  156. -           $varStack{".lastMonsterID"} = $monsters{$_}->{binID};
  157. -           $varStack{".lastMonsterBinID"} = $monsters{$_}->{binType};
  158. -           return cmpr($dist, $cond, $mondist)
  159. -       } else {
  160. -           if (existsInList($monsterList, $monsters{$_}->{name})) {
  161. -               my $counter;
  162. -               my $mypos = calcPosition($char);
  163. -               my $pos = calcPosition($monsters{$_});
  164. -               my $dist = sprintf("%.1f", distance($mypos, $pos));
  165. -               my $val = sprintf("%d %d %s", $pos->{x}, $pos->{y}, $field->baseName);
  166. -               $varStack{".lastMonster"} = $monsters{$_}->{name};
  167. -               $varStack{".lastMonsterPos"} = $val;
  168. -               $varStack{".lastMonsterDist"} = $dist;
  169. -               $varStack{".lastMonsterID"} = $monsters{$_}->{binID};
  170. -               $varStack{".lastMonsterBinID"} = $monsters{$_}->{binType};
  171. -               for (my $i = 0; $i < @::monstersID; $i++) {
  172. -                   next if $::monstersID[$i] eq "";
  173. -                   my $monster = Actor::get($::monstersID[$i]);
  174. -                   if ($monster->name eq $monsters{$_}->{name}) {
  175. -                       if ($monster->{binID} eq $monsters{$_}->{binID}) {
  176. -                           $counter++;
  177. -                           next
  178. -                       } else {
  179. -                           my $monsToMonDist = sprintf("%.1f",distance($pos, $monster->{pos_to}));
  180. -                           $counter++ if $monsToMonDist < 12;
  181. -                           next
  182. -                       }
  183. -                   }
  184. -                   next
  185. -               }
  186. -               $varStack{".lastMonsterCount"} = $counter;
  187. -               return cmpr($dist, $cond, $mondist)
  188. -           }
  189. -       }
  190. -   }
  191. -   return 1 if ($use);
  192. -   return 0
  193. -}
  194. -
  195.  # checks for aggressives
  196.  sub checkAggressives {
  197.     my ($cond, $amount) = $_[0] =~ /([<>=!]+)\s+(\$[a-zA-Z][a-zA-Z\d]*|\d+|\d+\s*\.{2}\s*\d+)\s*$/;
  198. @@ -772,6 +633,66 @@
  199.     return 0
  200.  }
  201.  
  202. +# checks for near actor ##################################
  203. +sub checkActor {
  204. +   my ($actorType, $not, $who, $distCond, $dist) = $_[0] =~ /^(\w+)\s+(not)?\s*(["\/].*?["\/]\w*)\s*,?\s*([<>=!~]+)?\s*(\d*)/;
  205. +   $distCond = "<=" if (!$distCond);
  206. +   my %actorTypes = (
  207. +           npc => $npcsList->getItems(),
  208. +           player => $playersList->getItems(),
  209. +           monster => $monstersList->getItems(),
  210. +           pet => $petsList->getItems()
  211. +       );
  212. +   return 0 if (!exists($actorTypes{$actorType}));
  213. +   foreach my $actor (@{$actorTypes{$actorType}}) {
  214. +       next unless (match($actor->name, $who) xor $not);
  215. +       if ($dist > 0 && !cmpr(distance($char->{pos_to}, $actor->{pos_to}), $distCond, $dist)) {
  216. +           next;
  217. +       }
  218. +       my $val = sprintf("%d %d %s", $actor->{pos_to}{x}, $actor->{pos_to}{y}, $field->baseName);
  219. +       if ($actorType eq 'npc') {
  220. +           $varStack{".lastNpcName"} = $actor->name;
  221. +           $varStack{".lastNpcPos"} = $val;
  222. +           $varStack{".lastNpcIndex"} = $actor->{binID};
  223. +           $varStack{".lastNPcID"} = $actor->{nameID};
  224. +       } elsif ($actorType eq 'player') {
  225. +           $varStack{".lastPlayerName"} = $actor->name;
  226. +           $varStack{".lastPlayerPos"} = $val;
  227. +           $varStack{".lastPlayerLevel"} = $actor->{lv};
  228. +           $varStack{".lastPlayerJob"} = $actor->job;
  229. +           $varStack{".lastPlayerAccountId"} = $actor->{nameID};
  230. +           $varStack{".lastPlayerBinId"} = $actor->{binID};
  231. +       } elsif ($actorType eq 'monster') {
  232. +           $varStack{".lastMonster"} = $actor->{name};
  233. +           $varStack{".lastMonsterPos"} = $val;
  234. +           $varStack{".lastMonsterDist"} = $dist;
  235. +           $varStack{".lastMonsterID"} = $actor->{binID};
  236. +           $varStack{".lastMonsterBinID"} = $actor->{binType};
  237. +       } elsif ($actorType eq 'pet') {
  238. +           $varStack{".lastPetName"} = $actor->name;
  239. +           $varStack{".lastPetPos"} = $val;
  240. +           $varStack{".lastPetIndex"} = $actor->{binID};
  241. +           $varStack{".lastPetType"} = $actor->{type};
  242. +       }
  243. +       return 1
  244. +   }
  245. +   return 0
  246. +}
  247. +
  248. +#cheks messages
  249. +sub checkMessage {
  250. +   my ($condition, $args) = @_;
  251. +   my ($message, $actorCondition, $actor);
  252. +   my ($sourceType, $condition, $actorCondition) = $condition =~ /^(\w+)\s+([\/"].*?[\/"]\w*)\s*,?\s*([\/"].*?[\/"]\w*)?/;
  253. +   $sourceType =~ s/^(\w+)$/.last$1/;
  254. +   if ($sourceType eq '.lastnpc') { $message = $args->{msg}; } else { $message = $args->{Msg}; }
  255. +   if ($sourceType ne '.lastnpc' && $sourceType ne '.lastsys') { $actor = $args->{MsgUser}; } elsif ($sourceType eq '.lastnpc') { $actor = $args->{name}; }
  256. +   return 0 if (!match($message, $condition) || ($actorCondition && !match($actor, $actorCondition)));
  257. +   $varStack{$sourceType."Msg"} = $message;
  258. +   $varStack{$sourceType} = $actor if ($actor);
  259. +   return 1;
  260. +}
  261. +
  262.  # parses automacros and checks conditions #################
  263.  sub automacroCheck {
  264.     my ($trigger, $args) = @_;
  265. @@ -835,26 +756,16 @@
  266.             if ($trigger =~ /^(?:is_casting|packet_skilluse)$/) {
  267.             next CHKAM unless checkCast($automacro{$am}->{spell}, $args)
  268.             } else {next CHKAM}
  269. -       } elsif (defined $automacro{$am}->{pm}) {
  270. -           if ($trigger eq 'packet_privMsg') {
  271. -           next CHKAM unless checkMsg(".lastpm", $automacro{$am}->{pm}, $args)
  272. +       } elsif (defined $automacro{$am}->{message}) {
  273. +           if (($trigger eq 'npc_talk' && $automacro{$am}->{message} =~ /^npc/) ||
  274. +               ($trigger eq 'packet_privMsg' && $automacro{$am}->{message} =~ /^pm/) ||
  275. +               ($trigger eq 'packet_pubMsg' && $automacro{$am}->{message} =~ /^pub/) ||
  276. +               ($trigger eq 'packet_sysMsg' && $automacro{$am}->{message} =~ /^sys/) ||
  277. +               ($trigger eq 'packet_partyMsg' && $automacro{$am}->{message} =~ /^party/) ||
  278. +               ($trigger eq 'packet_guildMsg' && $automacro{$am}->{message} =~ /^guild/)
  279. +               ){
  280. +                   next CHKAM unless checkMessage($automacro{$am}->{message}, $args)
  281.             } else {next CHKAM}
  282. -       } elsif (defined $automacro{$am}->{pubm}) {
  283. -           if ($trigger eq 'packet_pubMsg') {
  284. -           next CHKAM unless checkMsg(".lastpub", $automacro{$am}->{pubm}, $args)
  285. -           } else {next CHKAM}
  286. -       } elsif (defined $automacro{$am}->{system}) {
  287. -           if ($trigger eq 'packet_sysMsg') {
  288. -           next CHKAM unless checkMsg(".lastsys", $automacro{$am}->{system}, $args)
  289. -           } else {next CHKAM}
  290. -       } elsif (defined $automacro{$am}->{party}) {
  291. -           if ($trigger eq 'packet_partyMsg') {
  292. -           next CHKAM unless checkMsg(".lastparty", $automacro{$am}->{party}, $args)
  293. -           } else {next CHKAM}
  294. -       } elsif (defined $automacro{$am}->{guild}) {
  295. -           if ($trigger eq 'packet_guildMsg') {
  296. -           next CHKAM unless checkMsg(".lastguild", $automacro{$am}->{guild}, $args)
  297. -           } else {next CHKAM}
  298.         } elsif (defined $automacro{$am}->{mapchange}) {
  299.             if ($trigger eq 'packet_mapChange') {
  300.             next CHKAM unless checkMapChange($automacro{$am}->{mapchange})
  301. @@ -872,11 +783,9 @@
  302.         next CHKAM if (defined $automacro{$am}->{map}    && $automacro{$am}->{map} ne $field->baseName);
  303.         next CHKAM if (defined $automacro{$am}->{class}  && !checkClass($automacro{$am}->{class}));
  304.         next CHKAM if (defined $automacro{$am}->{whenGround} && !checkGround($automacro{$am}->{whenGround}));
  305. -       next CHKAM if (defined $automacro{$am}->{notMonster} && !checkMonster($automacro{$am}->{notMonster}, 1));
  306.        
  307.         foreach my $i (@{$automacro{$am}->{eval}})       {next CHKAM unless checkEval($i)}
  308.         foreach my $i (@{$automacro{$am}->{action}})     {next CHKAM unless checkAction($i)}
  309. -       foreach my $i (@{$automacro{$am}->{monster}})    {next CHKAM unless checkMonster($i)}
  310.         foreach my $i (@{$automacro{$am}->{aggressives}}){next CHKAM unless checkAggressives($i)}
  311.         foreach my $i (@{$automacro{$am}->{location}})   {next CHKAM unless checkLoc($i)}
  312.         foreach my $i (@{$automacro{$am}->{localtime}})  {next CHKAM unless checkLocalTime($i, "")}
  313. @@ -894,9 +803,9 @@
  314.         foreach my $i (@{$automacro{$am}->{soldout}})    {next CHKAM unless checkCond(getSoldOut(), $i)}
  315.         foreach my $i (@{$automacro{$am}->{zeny}})       {next CHKAM unless checkCond($char->{zeny}, $i)}
  316.         foreach my $i (@{$automacro{$am}->{cash}})       {next CHKAM unless checkCond($cashShop{points}->{cash}?$cashShop{points}->{cash}:0, $i)}
  317. -       foreach my $i (@{$automacro{$am}->{player}})     {next CHKAM unless checkPerson($i)}
  318.         foreach my $i (@{$automacro{$am}->{equipped}})   {next CHKAM unless checkEquip($i)}
  319.         foreach my $i (@{$automacro{$am}->{status}})     {next CHKAM unless checkStatus($i)}
  320. +       foreach my $i (@{$automacro{$am}->{actor}})      {next CHKAM unless checkActor($i)}
  321.         foreach my $i (@{$automacro{$am}->{inventory}})  {next CHKAM unless checkItem("inv", $i)}
  322.         foreach my $i (@{$automacro{$am}->{storage}})    {next CHKAM unless checkItem("stor", $i)}
  323.         foreach my $i (@{$automacro{$am}->{shop}})       {next CHKAM unless checkItem("shop", $i)}
  324. Index: Macro/Data.pm
  325. ===================================================================
  326. --- Macro/Data.pm   (revision 168)
  327. +++ Macro/Data.pm   (working copy)
  328. @@ -26,12 +26,7 @@
  329.     'disabled' => 1,     # option: automacro disabled
  330.     'call' => 1,         # setting: macro to be called
  331.     'spell' => 1,        # check: cast sensor
  332. -   'notMonster' => 1,   # check: disallow monsters other than ~
  333. -   'pm' => 1,           # check: private message
  334. -   'pubm' => 1,         # check: public chat
  335. -   'system' => 1,       # check: system chat
  336. -   'guild' => 1,        # check: guild chat
  337. -   'party' => 1,        # check: party chat
  338. +   'message' => 1,      # check: all messages
  339.     'console' => 1,      # check: console message
  340.     'overrideAI' => 1,   # option: override AI
  341.     'orphan' => 1,       # option: orphan handling
  342. @@ -50,7 +45,6 @@
  343.     'eval' => 1,         # check : eval
  344.     'set' => 1,          # set: variable
  345.     'save' => 1,         # setting: save hook arguments
  346. -   'monster' => 1,      # check: monster on screen
  347.     'aggressives' => 1,  # check: aggressives
  348.     'location' => 1,     # check: player's location
  349.     'var' => 1,          # check: variable / value
  350. @@ -65,7 +59,6 @@
  351.     'soldout' => 1,      # check: sold out shop slots
  352.     'zeny' => 1,         # check: player's zeny
  353.     'cash' => 1,         # check: player's cash
  354. -   'player' => 1,       # check: player name near
  355.     'equipped' => 1,     # check: equipment
  356.     'status' => 1,       # check: player's status
  357.     'inventory' => 1,    # check: item amount in inventory
  358. @@ -75,6 +68,7 @@
  359.     'localtime' => 1,    # check: localtime
  360.     'config' => 1,       # check: config key
  361.     'quest' => 1,        # check: player quests
  362. +   'actor' => 1,        # check: actor near
  363.     'action' => 1        # check: action
  364.  );
  365.  
  366. Index: Macro/Parser.pm
  367. ===================================================================
  368. --- Macro/Parser.pm (revision 168)
  369. +++ Macro/Parser.pm (working copy)
  370. @@ -122,10 +122,44 @@
  371.                     warning "$file: ignoring '$_' in line $. (munch, munch, not a pair)\n";
  372.                     next
  373.                 }
  374. +               if ($key =~ /(player|monster|notMonster)/) {
  375. +                   $key = 'actor';
  376. +                   if ($1 eq "player") {
  377. +                       $value = "player $value";
  378. +                   } else {
  379. +                       my $not;
  380. +                       if ($value =~ /^not\s+/) {
  381. +                           $value =~ s/^not\s+//;
  382. +                           $not = "not ";
  383. +                       } elsif ($1 eq "notMonster") {
  384. +                           $not = "not ";
  385. +                       }  
  386. +                       my ($monsterList, $cond, $mondist);
  387. +                       if ($value =~ /^\s*(.*),?\s+([<>=!~]+)\s+(\d+|\d+\s*.{2}\s*\d+)\s*$/) {
  388. +                           ($monsterList, $cond, $mondist) = ($1, $2, $3);
  389. +                       } else {
  390. +                           $monsterList = $value;
  391. +                       }
  392. +                       my @monsterList2 = split(/\s*,\s*/,$monsterList);
  393. +                       my $newMonsterList = join ("|",@monsterList2);
  394. +                       if ($cond && $mondist) {
  395. +                           $value = "monster ".$not."/^($newMonsterList)".'$'."/ $cond $mondist";
  396. +                       } elsif ($mondist) {
  397. +                           $value = "monster ".$not."/^($newMonsterList)".'$'."/ $mondist";
  398. +                       } else {
  399. +                           $value = "monster ".$not."/^($newMonsterList)".'$'."/";
  400. +                       }
  401. +                   }
  402. +               } elsif ($key =~ /(pm|pub|party|guild|system)/) {
  403. +                   my $messageType;
  404. +                   if ($1 eq 'system') { $messageType = 'sys'; } else { $messageType = $1; }
  405. +                   $key = 'message';
  406. +                   $value = "$messageType $value";
  407. +               }
  408.                 if ($amSingle{$key}) {
  409. -                   $automacro{$block{name}}->{$key} = $value
  410. +                   $automacro{$block{name}}->{$key} = $value;
  411.                 } elsif ($amMulti{$key}) {
  412. -                   push(@{$automacro{$block{name}}->{$key}}, $value)
  413. +                   push(@{$automacro{$block{name}}->{$key}}, $value);
  414.                 } else {
  415.                     warning "$file: ignoring '$_' in line $. (munch, munch, unknown automacro keyword)\n"
  416.                 }
Advertisement
Add Comment
Please, Sign In to add comment