Skip to content

Commit

Permalink
Merge pull request #7078 from MahtraDR/lich_clash_prep
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtraDR authored Feb 2, 2025
2 parents 0f535b4 + 0df7e64 commit 5b81f96
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
7 changes: 4 additions & 3 deletions afk.lic
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def exit_game(message)
fput('exit')
end

def idle?(line)
def afk?(line)
return true if line =~ /you have been idle too long/i

if $_IDLETIMESTAMP_ && $_SCRIPTIDLETIMESTAMP_
Expand Down Expand Up @@ -47,7 +47,7 @@ loop do
line = script.gets?
pause 0.05 unless line

fput(%w[tdp time age].sample) if idle?(line)
fput(%w[tdp time age].sample) if afk?(line)

justice_message_count += 1 if line =~ /^"Burn .+! Burn .+!" .* giving you a wide berth/
justice_message_count += 1 if line =~ /authorities will try to bring you in for endangering the public/
Expand All @@ -56,6 +56,7 @@ loop do
DRSpells.active_spells.each { |x, _y| fput("release #{get_data("spells")["spell_data"][x]["abbrev"]} spell") if get_data("spells")["spell_data"][x]["triggers_justice"] }
spell_check_count = justice_message_count
end

if justice_message_count > justice_threshold
exit_game("It looks like you've run into trouble with the law too many times")
end
Expand All @@ -74,7 +75,7 @@ loop do
stop_script('go2') if Script.running?('go2')
end

if line =~ /^You notice .* at your feet, and do not wish to leave it behind/ || line =~ /You find yourself unable to sneak with items at your feet/
if line =~ /^You notice .* at your feet, and do not wish to leave it behind/ || line =~ /You find yourself unable to sneak with items at your feet/
DRCI.stow_hand('left') unless !DRC.right_hand || !DRC.left_hand
while DRC.bput('stow feet', /You pick up/, /Stow what/) =~ /You pick up/
end
Expand Down
12 changes: 6 additions & 6 deletions bootstrap.lic
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Documentation: https://elanthipedia.play.net/Lich_script_development#bootstrap
=end

$BOOTSTRAP_VERSION = '1.0.3'
DRINFOMON_IN_CORE_LICH ||= false
DRINFOMON_CORE_LICH_DEFINES ||= []
$BOOTSTRAP_VERSION = '1.0.4'
DRINFOMON_IN_CORE_LICH ||= DRInfomon::DRINFOMON_IN_CORE_LICH ||= false
DRINFOMON_CORE_LICH_DEFINES ||= DRInfomon::DRINFOMON_CORE_LICH_DEFINES ||= []

class_defs = {
'drinfomon' => :DRINFOMON,
Expand Down Expand Up @@ -55,16 +55,16 @@ $MODERN_LICH = lich_version >= if Regexp.last_match(1)
Gem::Version.new('4.6.49')
end

if args.wipe_constants && !DRINFOMON_IN_CORE_LICH
if args.wipe_constants && !DRInfomon::DRINFOMON_IN_CORE_LICH
class_defs.each_value { |symb| remove_constant(symb) if constant_defined?(symb) }
exit
end

scripts_to_run = args.flex || []
echo scripts_to_run.to_s if UserVars.bootstrap_debug

if (scripts_to_run & DRINFOMON_CORE_LICH_DEFINES).any?
scripts_to_run -= DRINFOMON_CORE_LICH_DEFINES
if (scripts_to_run & DRInfomon::DRINFOMON_CORE_LICH_DEFINES).any?
scripts_to_run -= DRInfomon::DRINFOMON_CORE_LICH_DEFINES
echo("Removing core lich defines from scripts_to_run") if UserVars.bootstrap_debug
end

Expand Down
16 changes: 8 additions & 8 deletions dependency.lic
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ require 'ostruct'
require 'digest/sha1'
require 'monitor'

$DEPENDENCY_VERSION = '2.0.5'
$DEPENDENCY_VERSION = '2.0.6'
$MIN_RUBY_VERSION = '3.2.2'
DRINFOMON_IN_CORE_LICH ||= false
DRINFOMON_CORE_LICH_DEFINES ||= Array.new
DRInfomon::DRINFOMON_IN_CORE_LICH ||= false
DRInfomon::DRINFOMON_CORE_LICH_DEFINES ||= Array.new

no_pause_all
no_kill_all
Expand Down Expand Up @@ -1582,9 +1582,9 @@ def custom_require
lambda do |script_names|
script_names = [script_names] unless script_names.is_a?(Array)
respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug
if DRINFOMON_IN_CORE_LICH
if DRInfomon::DRINFOMON_IN_CORE_LICH
echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons") if UserVars.bootstrap_debug
script_names -= DRINFOMON_CORE_LICH_DEFINES
script_names -= DRInfomon::DRINFOMON_CORE_LICH_DEFINES
end
bootstrapper = force_start_script('bootstrap', script_names)
pause 0.05
Expand Down Expand Up @@ -1749,7 +1749,7 @@ end

def update_d
echo('Restarting Dependency in 2 seconds...')
force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH
force_start_script('bootstrap', ['wipe_constants']) unless DRInfomon::DRINFOMON_IN_CORE_LICH
before_dying do
sleep 2
force_start_script('dependency')
Expand Down Expand Up @@ -1799,12 +1799,12 @@ end

full_install if install

force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH
force_start_script('bootstrap', ['wipe_constants']) unless DRInfomon::DRINFOMON_IN_CORE_LICH

# Proactively starting DRinfomon as script zero to prevent
# race conditions involving this script which so many other
# scripts depend on, and which is slow to start on its own
unless DRINFOMON_IN_CORE_LICH
unless DRInfomon::DRINFOMON_IN_CORE_LICH
echo("Starting DRinfomon, this will take a few seconds.")

custom_require.call('drinfomon')
Expand Down
6 changes: 3 additions & 3 deletions spellmonitor.lic
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Documentation: https://elanthipedia.play.net/Lich_script_development#spellmonitor
=end

$SPELLMONITOR_VERSION = '2.0.1'
DRINFOMON_IN_CORE_LICH ||= false
$SPELLMONITOR_VERSION = '2.0.2'
DRInfomon::DRINFOMON_IN_CORE_LICH ||= false

if DRINFOMON_IN_CORE_LICH
if DRInfomon::DRINFOMON_IN_CORE_LICH
DRC.message("DRInfomon in core lich includes spellmonitor. Exiting.")
exit
end
Expand Down

0 comments on commit 5b81f96

Please sign in to comment.