Skip to content

Commit

Permalink
Merge pull request #1729 from elanthia-online/eherbs-v2.0.17
Browse files Browse the repository at this point in the history
[eherbs.lic] v2.0.17 bugfixs for ANALYZE not being available
  • Loading branch information
Deysh authored Jan 7, 2025
2 parents 41fcccc + 288f2f3 commit 3c2ddc0
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions scripts/eherbs.lic
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
game: Gemstone
tags: healing, herbs
requires: Lich >= 4.6.0
version: 2.0.16
version: 2.0.17
2.0.17 (2025-01-06)
- fix for survival kit to persist thru current session running
- fix for not being able to analyze kit during distill function
2.0.16 (2024-12-06)
- add additional debug messaging
2.0.15 (2024-10-10)
Expand Down Expand Up @@ -67,6 +70,15 @@

module EHerbs
@@data ||= nil
@@survival_kit ||= nil

def self.survival_kit
@@survival_kit
end

def self.survival_kit=(value)
@@survival_kit = value
end

def self.data
@@data
Expand Down Expand Up @@ -189,7 +201,7 @@ module EHerbs
:preposition => nil,
:return_to_stow => false,
:herb_sack => nil,
:survival_kit => nil,
:survival_kit => EHerbs.survival_kit,
:shopping_list => [],
:start_room => Room.current,
:herb_shop_menu => nil,
Expand Down Expand Up @@ -2581,18 +2593,21 @@ module EHerbs
# If it's not a GameObj we won't be stocking it.
unless herb_sack.instance_of?(GameObj)
EHerbs.data[:survival_kit] = false
EHerbs.survival_kit = false
return
end

lines = Utility.get_lines("analyze ##{herb_sack.id}", /You analyze/)

if lines.any? { |l| l =~ /is a Survivalist's Kit, which is a specialized container/ }
EHerbs.data[:survival_kit] = true
EHerbs.survival_kit = true
EHerbs.data[:herb_sack] = herb_sack
tier = Regexp.last_match(1).to_i if lines.any? { |l| l =~ %r{Capacity: (\d+)/5 } }
EHerbs.data[:distiller] = true if lines.grep(/has the Liquid Extractor unlock/).any?
else
EHerbs.data[:survival_kit] = false
EHerbs.survival_kit = false
EHerbs.data[:distiller] = false
end

Expand Down Expand Up @@ -2624,7 +2639,10 @@ module EHerbs

return unless EHerbs.data[:survival_kit]

lines = Utility.get_lines("ANALYZE ##{EHerbs.data[:herb_sack].id}", /You analyze/)
lines = Utility.get_lines("ANALYZE ##{EHerbs.data[:herb_sack].id}", /You analyze|You can't seem to do that\./)

# Can't analyze survival kit, skip distilling
return if lines.grep(/You can't seem to do that\./).any?

# Extractor is running, nothing to do
if lines.grep(/The extractor is currently targeting/).any?
Expand Down

0 comments on commit 3c2ddc0

Please sign in to comment.