changeset 223:6c436d33b53f misc

Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 13 Aug 2011 20:36:16 +0300
parents 1c0b3b4cef40
children a5dbc08a1ae8
files log2template.pl
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/log2template.pl	Mon Aug 08 14:12:22 2011 +0300
+++ b/log2template.pl	Sat Aug 13 20:36:16 2011 +0300
@@ -15,7 +15,7 @@
 # 5) Fight and kill monster.
 # 6) run log2npctemplate.pl < logfile.log > output.txt
 #
-# 7) command id say -ID-;weigh $*;say -#-;look at $*;say -!-;cast identify at $*
+# 7) command id say say -ID-;blook at $*;say -%-;weigh $*;say -#-;look at $*;say -!-;cast identify at $*
 #
 # Notes
 # =====
@@ -69,6 +69,7 @@
 "weaves a mystic matrix with glowing red lines in arcane ways and chants",
 "mutters the holy words",
 "mutters the magic words",
+"makes shooing gestures with his hands and whispers",
 #"",
 );
 
@@ -359,21 +360,30 @@
   my ($s) = @_;
   
   if ($state == 10) {
-    if ($s =~ /^You $sayregex '-#-\.'$/o) {
+    if ($s =~ /^You $sayregex '-%-\.'$/o) {
+      set_state(11, $s);
+    } elsif (!defined($$id{"full"})) {
+      $$id{"full"} = $s;
+    } else {
       set_state(11, $s);
     }
-    elsif ($s =~ /^:\s*(\d+\.\d+)\s+(.+)$/) {
+  }
+  elsif ($state == 11) {
+    if ($s =~ /^:\s*(\d+\.\d+)\s+(.+)$/) {
       # Weigh in kgs, and sdesc. Will have to match these later.
       $$id{"kg"}{$2} = $1;
       $$id{"full"} = $2;
     }
+    elsif ($s =~ /^You $sayregex '-#-\.'$/o) {
+      set_state(12, $s);
+    }
   }
-  elsif ($state == 11) {
+  elsif ($state == 12) {
     if ($s =~ /^It is surrounded by .+? glow\.$|^It is labeled as|^This item is a present from santa to /) {
       # Just skip these
     }
     elsif ($s =~ /You $sayregex '-!-\.'$/o) {
-      set_state(12, $s);
+      set_state(13, $s);
     }
     elsif ($s =~ /^It contains a tale;$/) {
       $id_tale = 1;
@@ -402,13 +412,13 @@
       }
     }
   }
-  elsif ($state == 12) {
+  elsif ($state == 13) {
     if ($s =~ /^The following messages seem to vibrate from (.+?):$/o) {
       $$id{"sdesc"} = $1;
-      set_state(13, $s);
+      set_state(14, $s);
     }
   }
-  elsif ($state == 13) {
+  elsif ($state == 14) {
     if ($s =~ /^It is called (.+)\.$/) {
       $$id{"handles"} = $1;
       $id_tale2 = 0;