From 7808df2f633314b1f2bda15d5b5c2d6ce1f2914f Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Tue, 28 Nov 2023 13:52:17 -0500 Subject: [PATCH 1/4] [parser.rb] negative TNL exp value bugfix for negative Experience before leveling up --- lib/infomon/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/infomon/parser.rb b/lib/infomon/parser.rb index 325df2e0..5abb80b0 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -14,7 +14,7 @@ module Pattern AscExp = /^\s+Ascension Exp: (?[\d,]+)\s+Recent Deaths: [\d,]+$/.freeze TotalExp = /^\s+Total Exp: (?[\d,]+)\s+Death's Sting: (?None|Light|Moderate|Sharp|Harsh|Piercing|Crushing)$/.freeze LTE = /^\s+Long-Term Exp: (?[\d,]+)\s+Deeds: (?\d+)$/.freeze - ExprEnd = /^\s+Exp (?:until lvl|to next TP): [\d,]+/.freeze + ExprEnd = /^\s+Exp (?:until lvl|to next TP): [\d,-]+/.freeze SkillStart = /^\s\w+\s\(at level \d+\), your current skill bonuses and ranks/.freeze Skill = /^\s+(?[[a-zA-Z]\s\-']+)\.+\|\s+(?\d+)\s+(?\d+)/.freeze SpellRanks = /^\s+(?[\w\s\-']+)\.+\|\s+(?\d+).*$/.freeze From 5b0e30a101eabbd9211e613a0bd1608b71413b2b Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Tue, 28 Nov 2023 13:53:46 -0500 Subject: [PATCH 2/4] Update infomon.rb output actual KEY in error output for easier tracing of error --- lib/infomon/infomon.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/infomon/infomon.rb b/lib/infomon/infomon.rb index 6cbcadf7..738b6a48 100644 --- a/lib/infomon/infomon.rb +++ b/lib/infomon/infomon.rb @@ -145,8 +145,8 @@ def self.get(key) end end rescue StandardError - respond "--- Lich: error: self.get(key): #{$!}" - Lich.log "error: self.get(key): #{$!}\n\t#{$!.backtrace.join("\n\t")}" + respond "--- Lich: error: self.get(#{key}): #{$!}" + Lich.log "error: self.get(#{key}): #{$!}\n\t#{$!.backtrace.join("\n\t")}" end } return self._value(val) From 764586a332db9523f550cf06c7c4295b4493e00a Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:45:17 -0500 Subject: [PATCH 3/4] regex cleanup --- lib/infomon/parser.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/infomon/parser.rb b/lib/infomon/parser.rb index 5abb80b0..6cd95eb6 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -9,12 +9,12 @@ module Pattern CharGenderAgeExpLevel = /^Gender:\s+(?[A-z]+)\s+Age:\s+(?[,0-9]+)\s+Expr:\s+(?[0-9,]+)\s+Level:\s+(?[0-9]+)/.freeze Stat = /^\s*(?[A-z]+)\s\((?:STR|CON|DEX|AGI|DIS|AUR|LOG|INT|WIS|INF)\):\s+(?[0-9]+)\s\((?-?[0-9]+)\)\s+[.]{3}\s+(?\d+)\s+\((?-?\d+)\)/.freeze StatEnd = /^Mana:\s+-?\d+\s+Silver:\s(?[-\d,]+)$/.freeze - Fame = /^\s+Level: \d+\s+Fame: (?[-\d,]+)$/.freeze # serves as ExprStart + Fame = /^\s+Level: \d+\s+Fame: (?-?[\d,]+)$/.freeze # serves as ExprStart RealExp = %r{^\s+Experience: [\d,]+\s+Field Exp: (?[\d,]+)/(?[\d,]+)$}.freeze AscExp = /^\s+Ascension Exp: (?[\d,]+)\s+Recent Deaths: [\d,]+$/.freeze TotalExp = /^\s+Total Exp: (?[\d,]+)\s+Death's Sting: (?None|Light|Moderate|Sharp|Harsh|Piercing|Crushing)$/.freeze LTE = /^\s+Long-Term Exp: (?[\d,]+)\s+Deeds: (?\d+)$/.freeze - ExprEnd = /^\s+Exp (?:until lvl|to next TP): [\d,-]+/.freeze + ExprEnd = /^\s+Exp (?:until lvl|to next TP): -?[\d,]+/.freeze SkillStart = /^\s\w+\s\(at level \d+\), your current skill bonuses and ranks/.freeze Skill = /^\s+(?[[a-zA-Z]\s\-']+)\.+\|\s+(?\d+)\s+(?\d+)/.freeze SpellRanks = /^\s+(?[\w\s\-']+)\.+\|\s+(?\d+).*$/.freeze From 71837d39de178e6d97d919836b980d2b94d2e921 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:47:13 -0500 Subject: [PATCH 4/4] more regex cleanup --- lib/infomon/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/infomon/parser.rb b/lib/infomon/parser.rb index 6cd95eb6..37f56f2e 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -8,7 +8,7 @@ module Pattern CharRaceProf = /^Name:\s+(?[A-z\s'-]+)\s+Race:\s+(?[A-z]+|[A-z]+(?: |-)[A-z]+)\s+Profession:\s+(?[-A-z]+)/.freeze CharGenderAgeExpLevel = /^Gender:\s+(?[A-z]+)\s+Age:\s+(?[,0-9]+)\s+Expr:\s+(?[0-9,]+)\s+Level:\s+(?[0-9]+)/.freeze Stat = /^\s*(?[A-z]+)\s\((?:STR|CON|DEX|AGI|DIS|AUR|LOG|INT|WIS|INF)\):\s+(?[0-9]+)\s\((?-?[0-9]+)\)\s+[.]{3}\s+(?\d+)\s+\((?-?\d+)\)/.freeze - StatEnd = /^Mana:\s+-?\d+\s+Silver:\s(?[-\d,]+)$/.freeze + StatEnd = /^Mana:\s+-?\d+\s+Silver:\s(?-?[\d,]+)$/.freeze Fame = /^\s+Level: \d+\s+Fame: (?-?[\d,]+)$/.freeze # serves as ExprStart RealExp = %r{^\s+Experience: [\d,]+\s+Field Exp: (?[\d,]+)/(?[\d,]+)$}.freeze AscExp = /^\s+Ascension Exp: (?[\d,]+)\s+Recent Deaths: [\d,]+$/.freeze