From 9db189dd52fa94e77975a9ff87cec32768b2c099 Mon Sep 17 00:00:00 2001 From: Derek Hoffmann Date: Sat, 28 Dec 2024 10:10:22 -0500 Subject: [PATCH 1/3] [script] [learn-fou] New script, Adding new script to make it easier to learn FOU --- learn-fou.lic | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 learn-fou.lic diff --git a/learn-fou.lic b/learn-fou.lic new file mode 100644 index 0000000000..5d40414ea8 --- /dev/null +++ b/learn-fou.lic @@ -0,0 +1,124 @@ +custom_require.call(%w[common common-items common-travel]) + +class LearnFOU + def initialize + + arg_definitions = [ + [ + {name: 'crevasse', options: 'crevasse', optional: true, description: 'Skip the cone and start with the lava crevasse'} + ] + ] + + args = parse_args(arg_definitions) + check_blood + study_cone() unless args.crevasse + study_crevasse() + end + + def check_blood + mobar_blood = [Lich::Util.issue_command('inv search mobar blood', /^You rummage about your person/, /^Roundtime:|^You can't seem to find anything/, include_end: false, timeout: 15, usexml: false).count - 2, 0].max + if mobar_blood >= 5 + return + elsif mobar_blood >= 1 + DRC.message("You can can try to learn FOU, but you might run out of mobar blood unless you're lucky.") + pause 5 + DRC.message("If you are sure you wish to proceed, simply let the script continue, otherwise kill the script, and get more blood.") + pause 15 + return + elsif mobar_blood < 1 + DRC.message("No mobar blood - need to have at least one, but recomended at *least* 5.") + exit + end + end + + def study_cone + DRCT.walk_to(13641) + fput('study cone') + end + + def study_crevasse + # Get to the fangs of ushnish area + unless XMLData.room_title.include?('The Fangs of Ushnish') + DRCT.walk_to(13643) + move('climb cliff') + end + + # check for blood before wandering + if !DRCI.get_item('mobar blood',nil) + DRC.message("Ran out of Mobar Blood! Headding to your saferoom!") + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','exit']) + DRC.wait_for_script_to_complete('gosafe') + exit + end + + # setup flags for managing state + Flags.add('viper-present','Very slowly, a .* viper rises out of the crevasse') + Flags.add('crevasse-closed','A rolling quake brings the edges of the crevasse together, sealing') + + study_count = 0 + loop do + # reset the flags each loop + Flags.reset('viper-present') + Flags.reset('crevasse-closed') + + # find the crevasse + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','fou']) + + # put the blood in the crevasse + DRC.bput( 'put my blood in crevasse', + 'Holding out your hand high above the boiling surface') + + # retreat while not a safe room (magma viper not present) + until Flags['viper-present'] + fput('retreat') + pause 1 + end + + study_count += 1 + # study the crevasse, break out of loop if you are successful + break if "The image of a red-hot cone momentarily sears your mind's eye" == DRC.bput( 'study crevasse', + "The image of a red-hot cone momentarily sears your mind's eye", + 'You think you see some meaning within the flow of lava') + + # if not successful get new blood (so you don't wait if you're out) + if !DRCI.get_item('mobar blood',nil) + DRC.message("Ran out of Mobar Blood! Headding to your saferoom!") + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','exit']) + DRC.wait_for_script_to_complete('gosafe') + exit + end + + echo "waiting for crevasse to close, this can take a while." + # wait for the crevasse to close + until Flags['crevasse-closed'] + pause 5 + end + end + + echo "Succesful after using #{study_count} mobar blood/studies" + + # leave the fangs of ushnish area, headed for the temple + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','temple']) + + # get to the cone and learn the spell + DRCT.walk_to(13641) + echo "This part has long RT. Good luck!" + fput('kneel') + fput('pray ushnish') + waitfor('The Fire of Ushnish spell pattern becomes consummated in your head') + waitrt? + DRC.fix_standing + + # go home! + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','exit']) + DRC.wait_for_script_to_complete('gosafe') + end + +end + +before_dying do + Flags.delete('viper-present') + Flags.delete('crevasse-closed') +end + +LearnFOU.new From 01349effb2a3b7ae48bd323de093e2201d404780 Mon Sep 17 00:00:00 2001 From: Derek Hoffmann Date: Sat, 28 Dec 2024 10:25:16 -0500 Subject: [PATCH 2/3] rubocop --- learn-fou.lic | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/learn-fou.lic b/learn-fou.lic index 5d40414ea8..d2b022e476 100644 --- a/learn-fou.lic +++ b/learn-fou.lic @@ -1,3 +1,4 @@ + custom_require.call(%w[common common-items common-travel]) class LearnFOU @@ -5,7 +6,7 @@ class LearnFOU arg_definitions = [ [ - {name: 'crevasse', options: 'crevasse', optional: true, description: 'Skip the cone and start with the lava crevasse'} + { name: 'crevasse', options: 'crevasse', optional: true, description: 'Skip the cone and start with the lava crevasse' } ] ] @@ -19,7 +20,7 @@ class LearnFOU mobar_blood = [Lich::Util.issue_command('inv search mobar blood', /^You rummage about your person/, /^Roundtime:|^You can't seem to find anything/, include_end: false, timeout: 15, usexml: false).count - 2, 0].max if mobar_blood >= 5 return - elsif mobar_blood >= 1 + elsif mobar_blood >= 1 DRC.message("You can can try to learn FOU, but you might run out of mobar blood unless you're lucky.") pause 5 DRC.message("If you are sure you wish to proceed, simply let the script continue, otherwise kill the script, and get more blood.") @@ -44,16 +45,16 @@ class LearnFOU end # check for blood before wandering - if !DRCI.get_item('mobar blood',nil) + if !DRCI.get_item('mobar blood', nil) DRC.message("Ran out of Mobar Blood! Headding to your saferoom!") - DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','exit']) + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls', 'exit']) DRC.wait_for_script_to_complete('gosafe') exit end # setup flags for managing state - Flags.add('viper-present','Very slowly, a .* viper rises out of the crevasse') - Flags.add('crevasse-closed','A rolling quake brings the edges of the crevasse together, sealing') + Flags.add('viper-present', 'Very slowly, a .* viper rises out of the crevasse') + Flags.add('crevasse-closed', 'A rolling quake brings the edges of the crevasse together, sealing') study_count = 0 loop do @@ -62,28 +63,25 @@ class LearnFOU Flags.reset('crevasse-closed') # find the crevasse - DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','fou']) + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls', 'fou']) # put the blood in the crevasse - DRC.bput( 'put my blood in crevasse', - 'Holding out your hand high above the boiling surface') + DRC.bput('put my blood in crevasse', 'Holding out your hand high above the boiling surface') # retreat while not a safe room (magma viper not present) until Flags['viper-present'] - fput('retreat') + fput('retreat') pause 1 end study_count += 1 # study the crevasse, break out of loop if you are successful - break if "The image of a red-hot cone momentarily sears your mind's eye" == DRC.bput( 'study crevasse', - "The image of a red-hot cone momentarily sears your mind's eye", - 'You think you see some meaning within the flow of lava') + break if "The image of a red-hot cone momentarily sears your mind's eye" == DRC.bput( 'study crevasse', "The image of a red-hot cone momentarily sears your mind's eye", 'You think you see some meaning within the flow of lava') # if not successful get new blood (so you don't wait if you're out) if !DRCI.get_item('mobar blood',nil) DRC.message("Ran out of Mobar Blood! Headding to your saferoom!") - DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','exit']) + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls', 'exit']) DRC.wait_for_script_to_complete('gosafe') exit end @@ -98,7 +96,7 @@ class LearnFOU echo "Succesful after using #{study_count} mobar blood/studies" # leave the fangs of ushnish area, headed for the temple - DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','temple']) + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls', 'temple']) # get to the cone and learn the spell DRCT.walk_to(13641) @@ -110,10 +108,9 @@ class LearnFOU DRC.fix_standing # go home! - DRC.wait_for_script_to_complete('bescort', ['gate_of_souls','exit']) + DRC.wait_for_script_to_complete('bescort', ['gate_of_souls', 'exit']) DRC.wait_for_script_to_complete('gosafe') end - end before_dying do From 35d468911c23d5e9e40c9b5c4e0ed9f4a8d7a295 Mon Sep 17 00:00:00 2001 From: Derek Hoffmann Date: Sat, 28 Dec 2024 10:28:37 -0500 Subject: [PATCH 3/3] rubocob2 --- learn-fou.lic | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/learn-fou.lic b/learn-fou.lic index d2b022e476..86ac07a235 100644 --- a/learn-fou.lic +++ b/learn-fou.lic @@ -1,9 +1,7 @@ - custom_require.call(%w[common common-items common-travel]) class LearnFOU def initialize - arg_definitions = [ [ { name: 'crevasse', options: 'crevasse', optional: true, description: 'Skip the cone and start with the lava crevasse' } @@ -73,13 +71,13 @@ class LearnFOU fput('retreat') pause 1 end - + study_count += 1 # study the crevasse, break out of loop if you are successful - break if "The image of a red-hot cone momentarily sears your mind's eye" == DRC.bput( 'study crevasse', "The image of a red-hot cone momentarily sears your mind's eye", 'You think you see some meaning within the flow of lava') + break if "The image of a red-hot cone momentarily sears your mind's eye" == DRC.bput('study crevasse', "The image of a red-hot cone momentarily sears your mind's eye", 'You think you see some meaning within the flow of lava') # if not successful get new blood (so you don't wait if you're out) - if !DRCI.get_item('mobar blood',nil) + if !DRCI.get_item('mobar blood', nil) DRC.message("Ran out of Mobar Blood! Headding to your saferoom!") DRC.wait_for_script_to_complete('bescort', ['gate_of_souls', 'exit']) DRC.wait_for_script_to_complete('gosafe')