Skip to content

Commit

Permalink
Merge pull request #658 from elanthia-online/staging
Browse files Browse the repository at this point in the history
Merge staging into master Lich 5.10.1 release
  • Loading branch information
mrhoribu authored Sep 1, 2024
2 parents f496c76 + b3098ae commit 6a3f17a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 31 deletions.
4 changes: 2 additions & 2 deletions R4LGTK3.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; to support the Lich scripting environment for Simutronics games

#define MyAppName "Ruby4Lich5"
#define MyAppVersion "5.10.0"
#define MyAppVersion "5.10.1"
#define RubyVersion "3.3.4"
#define MyAppPublisher "Elanthia-Online"
#define MyAppURL "https://github.com/elanthia-online/lich-5/"
Expand All @@ -12,7 +12,7 @@
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId= {{edd9ccd7-33cb-4577-a470-fe8fd087eaec}
AppId= {{edd9ccd7-33cb-4577-a470-fe8fd087eaed}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} Ruby {#RubyVersion} & Lich {#MyAppVersion}
Expand Down
4 changes: 2 additions & 2 deletions lib/games.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ def Game.open(host, port)
end
end

if !@@infomon_loaded && defined?(Infomon) && !XMLData.name.empty?
if !@@infomon_loaded && (defined?(Infomon) || !$DRINFOMON_VERSION.nil?) && !XMLData.name.empty? && !XMLData.dialogs.empty?
ExecScript.start("Infomon.redo!", { :quiet => true, :name => "infomon_reset" }) if XMLData.game !~ /^DR/ && Infomon.db_refresh_needed?
@@infomon_loaded = true
end

if @@autostarted and !@@cli_scripts and defined? XMLData.game
if !@@cli_scripts && @@autostarted && !XMLData.name.empty?
if (arg = ARGV.find { |a| a =~ /^\-\-start\-scripts=/ })
for script_name in arg.sub('--start-scripts=', '').split(',')
Script.start(script_name)
Expand Down
51 changes: 27 additions & 24 deletions lib/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,38 @@ def key_exists?(path)
end
end
elsif defined?(Wine)
## Needs improvement - iteration and such. Quick slam test. Why does Linux != MacOS (ver 9)?
case RUBY_PLATFORM
when /linux/
$sf_fe_loc = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Simutronics\\STORM32\\Directory') || ''
$wiz_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Simutronics\\WIZ32\\Directory')
$sf_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Simutronics\\STORM32\\Directory')
when /darwin/
$sf_fe_loc = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Simutronics\\STORM32\\Directory') || ''
$wiz_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Simutronics\\WIZ32\\Directory')
$sf_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Simutronics\\STORM32\\Directory')
else # prior result - probably no longer valid, but may be needed in break/fix
$sf_fe_loc = Wine.registry_gets('HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Simutronics\\STORM32\\Directory') || ''
$wiz_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Simutronics\\WIZ32\\Directory')
$sf_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Simutronics\\STORM32\\Directory')
## reminder Wine is defined in the file wine.rb by confirming prefix, directory and executable
unless (sf_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Simutronics\\STORM32\\Directory'))
sf_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Simutronics\\STORM32\\Directory')
end

if $wiz_fe_loc_temp
$wiz_fe_loc = $wiz_fe_loc_temp.gsub('\\', '/').gsub('C:', Wine::PREFIX + '/drive_c')
unless (wiz_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Simutronics\\WIZ32\\Directory'))
wiz_fe_loc_temp = Wine.registry_gets('HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Simutronics\\WIZ32\\Directory')
end
if $sf_fe_loc_temp
$sf_fe_loc = $sf_fe_loc_temp.gsub('\\', '/').gsub('C:', Wine::PREFIX + '/drive_c')
## at this point, the temp variables are either FalseClass or have what wine believes is the Directory subkey from registry
## fix it up so we can use it on a *nix based system. If the return is FalseClass, leave it FalseClass
sf_fe_loc_temp ? $sf_fe_loc = sf_fe_loc_temp.gsub('\\', '/').gsub('C:', Wine::PREFIX + '/drive_c') : :noop
wiz_fe_loc_temp ? $wiz_fe_loc = wiz_fe_loc_temp.gsub('\\', '/').gsub('C:', Wine::PREFIX + '/drive_c') : :noop
## if we have a String class (directory) and the directory exists -- no error detectable at this level
## if we have a nil, we have no directory, or if we have a path but cannot find that path (directory) we have an error
if $sf_fe_loc.nil? # no directory
Lich.log("STORM equivalent FE is not installed under WINE.")
else
unless $sf_fe_loc.is_a? String and File.exist?($sf_fe_loc) # cannot confirm directory location
Lich.log("Cannot find STORM equivalent FE to launch under WINE.")
end
end

if !File.exist?($sf_fe_loc)
$sf_fe_loc =~ /SIMU/ ? $sf_fe_loc = $sf_fe_loc.gsub("SIMU", "Simu") : $sf_fe_loc = $sf_fe_loc.gsub("Simu", "SIMU")
Lich.log("Cannot find STORM equivalent FE to launch.") if !File.exist?($sf_fe_loc)
if $wiz_fe_loc.nil? # no directory
Lich.log("WIZARD FE is not installed under WINE.")
else
unless $wiz_fe_loc.is_a? String and File.exist?($wiz_fe_loc) # cannot confirm directory location
Lich.log("Cannot find WIZARD FE to launch under WINE.")
end
end
if $sf_fe_loc.nil? and $wiz_fe_loc.nil? # got nuttin - no FE installed under WINE in registry (or something changed. . . )
Lich.log("This system has WINE installed but does not have a suitable FE from Simu installed under WINE.")
end
## We have either declared an error, or the global variables for Simu FE are populated with a confirmed path
end

## The following should be deprecated with the direct-frontend-launch-method
## TODO: remove as part of chore/Remove unnecessary Win32 calls
## Temporarily reinstatated for DR
Expand Down
15 changes: 13 additions & 2 deletions lib/stash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ def self.add_to_bag(bag, item)
end
end

def self.wear_to_inv(item)
try_or_fail(command: "wear ##{item.id}") do
20.times {
return true if (![GameObj.right_hand, GameObj.left_hand].map(&:id).compact.include?(item.id) and GameObj.inv.to_a.map(&:id).include?(item.id))
return true if item.name =~ /^ethereal \w+$/ && ![GameObj.right_hand, GameObj.left_hand].map(&:id).compact.include?(item.id)
sleep 0.1
}
return false
end
end

def self.sheath_bags
# find ready list settings for sheaths only; regex courtesy Eloot
@sheath = {}
Expand Down Expand Up @@ -129,9 +140,9 @@ def self.stash_hands(right: false, left: false, both: false)
if (left || both) && left_hand.id
waitrt?
if (left_hand.noun =~ /shield|buckler|targe|heater|parma|aegis|scutum|greatshield|mantlet|pavis|arbalest|bow|crossbow|yumi|arbalest/)\
and (wear_result = dothistimeout("wear ##{left_hand.id}", 8, /^You .*#{left_hand.noun}|^With careful precision, you|^You toss the shield|^You can only wear \w+ items in that location\.$|^You can't wear that\.$/)) and (wear_result !~ /^You can only wear \w+ items in that location\.$|^You can't wear that\.$/)
and Lich::Stash::wear_to_inv(left_hand)
actions.unshift proc {
dothistimeout "remove ##{left_hand.id}", 3, /^You (?:remove|sling|unsling)|^With a slight roll of your shoulder, you|^You .*#{left_hand.noun}|^Remove what\?/
fput "remove ##{left_hand.id}"
20.times { break if GameObj.left_hand.id == left_hand.id or GameObj.right_hand.id == left_hand.id; sleep 0.1 }

if GameObj.right_hand.id == left_hand.id
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Lich5 carveout to better manage semver

LICH_VERSION = '5.10.0'
LICH_VERSION = '5.10.1'
REQUIRED_RUBY = '2.6'
RECOMMENDED_RUBY = '3.2'

0 comments on commit 6a3f17a

Please sign in to comment.