Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gs][experience.rb] add rpa? and lumnis? API calls #483

Draft
wants to merge 22 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/experience.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ def self.deeds
def self.deaths_sting
Infomon.get("experience.deaths_sting")
end

def self.rpa?
Infomon.get_bool("experience.rpa")
end

def self.lumnis?
Infomon.get_bool("experience.lumnis")
end
end
17 changes: 16 additions & 1 deletion lib/infomon/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ module Pattern
TicketRaikhen = /^\s*Rumor Woods - (?<raikhen>[\d,]+) raikhen\.$/.freeze
WealthSilver = /^You have (?<silver>no|[,\d]+|but one) silver with you\./.freeze
WealthSilverContainer = /^You are carrying (?<silver>[\d,]+) silver 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\.$|^\[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

# 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!$|^That is impossible to do while unconscious$/.freeze
Expand All @@ -81,7 +84,8 @@ module Pattern
SocietyResign, LearnPSM, UnlearnPSM, LostTechnique, LearnTechnique, UnlearnTechnique,
Resource, Suffused, GigasArtifactFragments, RedsteelMarks, TicketGeneral, TicketBlackscrip,
TicketBloodscrip, TicketEtherealScrip, TicketSoulShards, TicketRaikhen,
WealthSilver, WealthSilverContainer, GoalsDetected, GoalsEnded, SpellsongRenewed)
WealthSilver, WealthSilverContainer, GoalsDetected, GoalsEnded, SpellsongRenewed,
RPAActive, LumnisActive, LumnisDeactive)
end

def self.parse(line)
Expand Down Expand Up @@ -147,6 +151,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 = []
Expand Down Expand Up @@ -221,6 +227,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)
Expand Down
12 changes: 12 additions & 0 deletions spec/infomon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ def GameObj.npcs
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 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)
Expand All @@ -269,6 +271,16 @@ def GameObj.npcs
expect(Experience.lte).to eq(26_266)
expect(Experience.deeds).to eq(20)
expect(Experience.deaths_sting).to eq("None")
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 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 be(true)
expect(Experience.lumnis?).to be(true)
end
end

Expand Down