From 67afc64f85915bbd3c552a9d43081abfa303d1d6 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:00:01 -0400 Subject: [PATCH 01/15] add new API calls Add percent_fxp percent_axp percent_exp lumnis? rpa? --- lib/experience.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/experience.rb b/lib/experience.rb index 3293dce7..71e00d1d 100644 --- a/lib/experience.rb +++ b/lib/experience.rb @@ -25,6 +25,18 @@ def self.txp Infomon.get("experience.total_experience") end + def self.percent_fxp + (fxp_current.to_f / fxp_max.to_f) * 100 + end + + def self.percent_axp + (axp.to_f / txp.to_f) * 100 + end + + def self.percent_exp + (exp.to_f / txp.to_f) * 100 + end + def self.lte Infomon.get("experience.long_term_experience") end @@ -36,4 +48,12 @@ def self.deeds def self.deaths_sting Infomon.get("experience.deaths_sting") end + + def self.rpa? + Infomon.get("experience.rpa") + end + + def self.lumnis? + Infomon.get("experience.lumnis") + end end From 157511f618d3b004132d82efc5b650c941d38eb6 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:09:53 -0400 Subject: [PATCH 02/15] add RPA/lumnis parsing --- lib/infomon/parser.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/infomon/parser.rb b/lib/infomon/parser.rb index 4708e896..8249bd5a 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -55,6 +55,9 @@ module Pattern TicketRaikhen = /^\s*Rumor Woods - (?[\d,]+) raikhen\.$/.freeze WealthSilver = /^You have (?no silver|but one|[\d,]+) coins? with you\.$/.freeze WealthSilverContainer = /^You are carrying (?[\d,]+) coins? stored within your /.freeze + RPAActive = /^Your recent adventures echo powerfully in your mind\.$|^You take a deep breath, and look around with renewed vigor\. It is good to be alive, and an adventurer in this land\.$|^With a sudden flash of insight, you realize you now understand more of what you have experienced\.\.\.\.\.$|^An old memory bubbles up from your past, and causes you to reflect a moment\. With a flash of insight, you realize you understand yourself a bit better than you did a moment ago\. The sudden feeling of self-knowledge is a pleasant one\.$/.freeze + LumnisActive = /^A soft feeling of serenity touches your mind, providing you with a clearer understanding of recent events\.$|^You feel a strange sense of serenity, and find you are able to reflect on recent events with uncommon clarity and understanding\.$/.freeze + LumnisDeactive = /^The soft feeling of serenity slowly dissipates from your mind\.$/.freeze # TODO: refactor / streamline? SleepActive = /^Your mind goes completely blank\.$|^You close your eyes and slowly drift off to sleep\.$|^You slump to the ground and immediately fall asleep\. You must have been exhausted!$/.freeze @@ -80,7 +83,7 @@ module Pattern SocietyResign, LearnPSM, UnlearnPSM, LostTechnique, LearnTechnique, UnlearnTechnique, Resource, Suffused, GigasArtifactFragments, RedsteelMarks, TicketGeneral, TicketBlackscrip, TicketBloodscrip, TicketEtherealScrip, TicketSoulShards, TicketRaikhen, - WealthSilver, WealthSilverContainer, GoalsDetected, GoalsEnded) + WealthSilver, WealthSilverContainer, GoalsDetected, GoalsEnded, RPAActive, LumnisActive, LumnisDeactive) end def self.parse(line) @@ -122,7 +125,9 @@ def self.parse(line) @expr_hold = [] Infomon.mutex_lock match = Regexp.last_match - @expr_hold.push(['experience.fame', match[:fame].delete(',').to_i]) + @expr_hold.push(['experience.fame', match[:fame].delete(',').to_i], + ['experience.rpa', false], + ['experience.lumnis', false]) :ok when Pattern::RealExp match = Regexp.last_match @@ -220,6 +225,15 @@ def self.parse(line) ['psm.horlands_holler', 0]]) :ok # end of blob saves + when Pattern::RPAActive + Infomon.set('experience.rpa', true) + :ok + when Pattern::LumnisActive + Infomon.set('experience.lumnis', true) + :ok + when Pattern::LumnisDeactive + Infomon.set('experience.lumnis', false) + :ok when Pattern::Warcries match = Regexp.last_match Infomon.set('psm.%s' % match[:name].split(' ')[1], 1) From 5470a693d559899b85fd543cfaec99dea1de7e79 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:15:26 -0400 Subject: [PATCH 03/15] change rpa? lumnis? to bool get --- lib/experience.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/experience.rb b/lib/experience.rb index 71e00d1d..056080e8 100644 --- a/lib/experience.rb +++ b/lib/experience.rb @@ -50,10 +50,10 @@ def self.deaths_sting end def self.rpa? - Infomon.get("experience.rpa") + Infomon.get_bool("experience.rpa") end def self.lumnis? - Infomon.get("experience.lumnis") + Infomon.get_bool("experience.lumnis") end end From 98ba85fcb0dd682e9eb3d9c54c3bee9de4f440b0 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:19:24 -0400 Subject: [PATCH 04/15] move boolean sets outside of batch set --- lib/infomon/parser.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/infomon/parser.rb b/lib/infomon/parser.rb index 8249bd5a..ff8eaf32 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -125,9 +125,7 @@ def self.parse(line) @expr_hold = [] Infomon.mutex_lock match = Regexp.last_match - @expr_hold.push(['experience.fame', match[:fame].delete(',').to_i], - ['experience.rpa', false], - ['experience.lumnis', false]) + @expr_hold.push(['experience.fame', match[:fame].delete(',').to_i]) :ok when Pattern::RealExp match = Regexp.last_match @@ -151,6 +149,8 @@ def self.parse(line) when Pattern::ExprEnd Infomon.upsert_batch(@expr_hold) Infomon.mutex_unlock + Infomon.set('experience.rpa', false) + Infomon.set('experience.lumnis', false) :ok when Pattern::SkillStart @skills_hold = [] From e9fc0b05c79c98c0e6282bc8261ce62d405f0d81 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:24:26 -0400 Subject: [PATCH 05/15] add rpa and lumnis spec test --- spec/infomon_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index 0eb27d41..eae440f6 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -207,6 +207,8 @@ def each() expect(Infomon.get("experience.long_term_experience")).to eq(26_266) expect(Infomon.get("experience.deeds")).to eq(20) expect(Infomon.get("experience.deaths_sting")).to eq("None") + expect(Infomon.get_bool("experience.rpa")).to eq(false) + expect(Infomon.get_bool("experience.lumnis")).to eq(false) expect(Experience.fame).to eq(4_804_958) expect(Experience.fxp_current).to eq(1_350) @@ -216,6 +218,17 @@ def each() expect(Experience.lte).to eq(26_266) expect(Experience.deeds).to eq(20) expect(Experience.deaths_sting).to eq("None") + expect(Experience.rpa?).to eq(false) + expect(Experience.lumnis?).to eq(false) + + Infomon::Parser.parse %[Your recent adventures echo powerfully in your mind.] + Infomon::Parser.parse %[You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding.] + + expect(Infomon.get_bool("experience.rpa")).to eq(true) + expect(Infomon.get_bool("experience.lumnis")).to eq(false) + expect(Experience.rpa?).to eq(true) + expect(Experience.lumnis?).to eq(true) + end end From 19997f40ff112f922b199568ebc9ce4347f00402 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:25:34 -0400 Subject: [PATCH 06/15] rubocop cleanup --- spec/infomon_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index eae440f6..2603a594 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -228,7 +228,6 @@ def each() expect(Infomon.get_bool("experience.lumnis")).to eq(false) expect(Experience.rpa?).to eq(true) expect(Experience.lumnis?).to eq(true) - end end From ff79acf277b554ca90f57074a7dd7550be6d7974 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:26:42 -0400 Subject: [PATCH 07/15] Update infomon_spec.rb fix for spec on lumnis and rpa --- spec/infomon_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index 2603a594..e9761e6e 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -222,11 +222,11 @@ def each() expect(Experience.lumnis?).to eq(false) Infomon::Parser.parse %[Your recent adventures echo powerfully in your mind.] - Infomon::Parser.parse %[You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding.] - expect(Infomon.get_bool("experience.rpa")).to eq(true) - expect(Infomon.get_bool("experience.lumnis")).to eq(false) expect(Experience.rpa?).to eq(true) + + Infomon::Parser.parse %[You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding.] + expect(Infomon.get_bool("experience.lumnis")).to eq(true) expect(Experience.lumnis?).to eq(true) end end From 80f9481c097e4703c4ed6d20ef346cf515b975cc Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:27:54 -0400 Subject: [PATCH 08/15] rubocop cleanup again --- spec/infomon_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index e9761e6e..2d62a5aa 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -224,7 +224,7 @@ def each() Infomon::Parser.parse %[Your recent adventures echo powerfully in your mind.] expect(Infomon.get_bool("experience.rpa")).to eq(true) expect(Experience.rpa?).to eq(true) - + Infomon::Parser.parse %[You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding.] expect(Infomon.get_bool("experience.lumnis")).to eq(true) expect(Experience.lumnis?).to eq(true) From 7177abaf1ac662c07375ed23dbcd6da977449c81 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:30:32 -0400 Subject: [PATCH 09/15] additional spec changes --- spec/infomon_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index 2d62a5aa..250b7fa6 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -221,11 +221,11 @@ def each() expect(Experience.rpa?).to eq(false) expect(Experience.lumnis?).to eq(false) - Infomon::Parser.parse %[Your recent adventures echo powerfully in your mind.] + Infomon::Parser.parse %[^Your recent adventures echo powerfully in your mind\.$] expect(Infomon.get_bool("experience.rpa")).to eq(true) expect(Experience.rpa?).to eq(true) - Infomon::Parser.parse %[You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding.] + Infomon::Parser.parse %[^You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding\.$] expect(Infomon.get_bool("experience.lumnis")).to eq(true) expect(Experience.lumnis?).to eq(true) end From 3186320b47c57f9917709d6144eaba6249864aee Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:34:37 -0400 Subject: [PATCH 10/15] Update infomon_spec.rb --- spec/infomon_spec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index 250b7fa6..acfd033b 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -207,8 +207,8 @@ def each() expect(Infomon.get("experience.long_term_experience")).to eq(26_266) expect(Infomon.get("experience.deeds")).to eq(20) expect(Infomon.get("experience.deaths_sting")).to eq("None") - expect(Infomon.get_bool("experience.rpa")).to eq(false) - expect(Infomon.get_bool("experience.lumnis")).to eq(false) + expect(Infomon.get_bool("experience.rpa")).to be(false) + expect(Infomon.get_bool("experience.lumnis")).to be(false) expect(Experience.fame).to eq(4_804_958) expect(Experience.fxp_current).to eq(1_350) @@ -218,16 +218,16 @@ def each() expect(Experience.lte).to eq(26_266) expect(Experience.deeds).to eq(20) expect(Experience.deaths_sting).to eq("None") - expect(Experience.rpa?).to eq(false) - expect(Experience.lumnis?).to eq(false) + expect(Experience.rpa?).to be(false) + expect(Experience.lumnis?).to be(false) Infomon::Parser.parse %[^Your recent adventures echo powerfully in your mind\.$] - expect(Infomon.get_bool("experience.rpa")).to eq(true) - expect(Experience.rpa?).to eq(true) + expect(Infomon.get_bool("experience.rpa")).to be(true) + expect(Experience.rpa?).to be(true) Infomon::Parser.parse %[^You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding\.$] - expect(Infomon.get_bool("experience.lumnis")).to eq(true) - expect(Experience.lumnis?).to eq(true) + expect(Infomon.get_bool("experience.lumnis")).to be(true) + expect(Experience.lumnis?).to be(true) end end From 401761cba7494f96bb02a8347be81ada434d0520 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:36:43 -0400 Subject: [PATCH 11/15] Update infomon_spec.rb --- spec/infomon_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/infomon_spec.rb b/spec/infomon_spec.rb index acfd033b..62217fa7 100644 --- a/spec/infomon_spec.rb +++ b/spec/infomon_spec.rb @@ -221,11 +221,11 @@ def each() expect(Experience.rpa?).to be(false) expect(Experience.lumnis?).to be(false) - Infomon::Parser.parse %[^Your recent adventures echo powerfully in your mind\.$] + Infomon::Parser.parse %[Your recent adventures echo powerfully in your mind.] expect(Infomon.get_bool("experience.rpa")).to be(true) expect(Experience.rpa?).to be(true) - Infomon::Parser.parse %[^You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding\.$] + Infomon::Parser.parse %[You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding.] expect(Infomon.get_bool("experience.lumnis")).to be(true) expect(Experience.lumnis?).to be(true) end From 276055730c20252dba468f369dc7308b4d6f2f21 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:50:34 -0400 Subject: [PATCH 12/15] update lumnis active text --- 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 ff8eaf32..27e82990 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -56,7 +56,7 @@ module Pattern WealthSilver = /^You have (?no silver|but one|[\d,]+) coins? with you\.$/.freeze WealthSilverContainer = /^You are carrying (?[\d,]+) coins? stored within your /.freeze RPAActive = /^Your recent adventures echo powerfully in your mind\.$|^You take a deep breath, and look around with renewed vigor\. It is good to be alive, and an adventurer in this land\.$|^With a sudden flash of insight, you realize you now understand more of what you have experienced\.\.\.\.\.$|^An old memory bubbles up from your past, and causes you to reflect a moment\. With a flash of insight, you realize you understand yourself a bit better than you did a moment ago\. The sudden feeling of self-knowledge is a pleasant one\.$/.freeze - LumnisActive = /^A soft feeling of serenity touches your mind, providing you with a clearer understanding of recent events\.$|^You feel a strange sense of serenity, and find you are able to reflect on recent events with uncommon clarity and understanding\.$/.freeze + LumnisActive = /^A soft feeling of serenity touches your mind, providing you with a clearer understanding of recent events\.$|^You feel a strange sense of serenity and find you are able to reflect on recent events with uncommon clarity and understanding\.$/.freeze LumnisDeactive = /^The soft feeling of serenity slowly dissipates from your mind\.$/.freeze # TODO: refactor / streamline? From acc918ca0785ab86c19989064d089cdb5a785552 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:51:58 -0400 Subject: [PATCH 13/15] full correction of lumnis active --- 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 27e82990..8b532f12 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -56,7 +56,7 @@ module Pattern WealthSilver = /^You have (?no silver|but one|[\d,]+) coins? with you\.$/.freeze WealthSilverContainer = /^You are carrying (?[\d,]+) coins? stored within your /.freeze RPAActive = /^Your recent adventures echo powerfully in your mind\.$|^You take a deep breath, and look around with renewed vigor\. It is good to be alive, and an adventurer in this land\.$|^With a sudden flash of insight, you realize you now understand more of what you have experienced\.\.\.\.\.$|^An old memory bubbles up from your past, and causes you to reflect a moment\. With a flash of insight, you realize you understand yourself a bit better than you did a moment ago\. The sudden feeling of self-knowledge is a pleasant one\.$/.freeze - LumnisActive = /^A soft feeling of serenity touches your mind, providing you with a clearer understanding of recent events\.$|^You feel a strange sense of serenity and find you are able to reflect on recent events with uncommon clarity and understanding\.$/.freeze + LumnisActive = /^A soft feeling of serenity touches your mind, providing you with a clearer understanding of recent events\.$|^You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding\.$/.freeze LumnisDeactive = /^The soft feeling of serenity slowly dissipates from your mind\.$/.freeze # TODO: refactor / streamline? From 04c387d5a62930360cf022753d531bc1701bb7c7 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Mon, 18 Sep 2023 13:21:03 -0400 Subject: [PATCH 14/15] update RPA regex for already active RPA Add `[You currently have a role playing award active, and cannot activate another until your current one has expired.]` to the parser --- 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 8b532f12..0c1e904b 100644 --- a/lib/infomon/parser.rb +++ b/lib/infomon/parser.rb @@ -55,7 +55,7 @@ module Pattern TicketRaikhen = /^\s*Rumor Woods - (?[\d,]+) raikhen\.$/.freeze WealthSilver = /^You have (?no silver|but one|[\d,]+) coins? with you\.$/.freeze WealthSilverContainer = /^You are carrying (?[\d,]+) coins? stored within your /.freeze - RPAActive = /^Your recent adventures echo powerfully in your mind\.$|^You take a deep breath, and look around with renewed vigor\. It is good to be alive, and an adventurer in this land\.$|^With a sudden flash of insight, you realize you now understand more of what you have experienced\.\.\.\.\.$|^An old memory bubbles up from your past, and causes you to reflect a moment\. With a flash of insight, you realize you understand yourself a bit better than you did a moment ago\. The sudden feeling of self-knowledge is a pleasant one\.$/.freeze + RPAActive = /^Your recent adventures echo powerfully in your mind\.$|^You take a deep breath, and look around with renewed vigor\. It is good to be alive, and an adventurer in this land\.$|^With a sudden flash of insight, you realize you now understand more of what you have experienced\.\.\.\.\.$|^An old memory bubbles up from your past, and causes you to reflect a moment\. With a flash of insight, you realize you understand yourself a bit better than you did a moment ago\. The sudden feeling of self-knowledge is a pleasant one\.$|^\[You currently have a role playing award active, and cannot activate another until your current one has expired\.\]$/.freeze LumnisActive = /^A soft feeling of serenity touches your mind, providing you with a clearer understanding of recent events\.$|^You feel a strange sense of serenity and find that you are able to reflect on recent events with uncommon clarity and understanding\.$/.freeze LumnisDeactive = /^The soft feeling of serenity slowly dissipates from your mind\.$/.freeze From be93290a6e3dcc7b1002b7f34d811af7b8ffac40 Mon Sep 17 00:00:00 2001 From: "Ryan P. McKinnon" <15917743+mrhoribu@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:02:08 -0500 Subject: [PATCH 15/15] Update experience.rb remove percent experience methods as moved to PR 515 --- lib/experience.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/experience.rb b/lib/experience.rb index 056080e8..4c394000 100644 --- a/lib/experience.rb +++ b/lib/experience.rb @@ -25,18 +25,6 @@ def self.txp Infomon.get("experience.total_experience") end - def self.percent_fxp - (fxp_current.to_f / fxp_max.to_f) * 100 - end - - def self.percent_axp - (axp.to_f / txp.to_f) * 100 - end - - def self.percent_exp - (exp.to_f / txp.to_f) * 100 - end - def self.lte Infomon.get("experience.long_term_experience") end