diff --git a/truffenyi-commune-quest.lic b/truffenyi-commune-quest.lic index c9a14a4751..b0f0f0caad 100644 --- a/truffenyi-commune-quest.lic +++ b/truffenyi-commune-quest.lic @@ -1,75 +1,454 @@ =begin Documentation: https://elanthipedia.play.net/Lich_script_repository#truffenyi-commune-quest =end +custom_require.call(%w[common common-items equipmanager]) -custom_require.call(%w[common equipmanager]) +class TruffenyiCommuneQuest + def initialize + arg_definitions = [ + [ + { name: 'step', options: %w[altar vial shrine], optional: false, description: 'Which step to do?' } + ] + ] + args = parse_args(arg_definitions) -start = Time.now -echo 'This script does the actions for the truffenyi commune Cleric quest. It should be started after drinking the vial two times.' -EquipmentManager.new.empty_hands + @weasel_no_jump_pattens = [ + /The weasel chitters with joy at your vain attempts to reach him, scooting out a little farther on the branch to dangle the stick closer to you/, + /The weasel chitters with joy at your vain attempts to reach him, scooting out even farther along the branch to dangle the stick closer to you/, + /Still having a bit of room to spare the weasel continues to creep out, moving even farther along the branch to dangle the stick closer to you/, + /Still having a bit of room to spare the weasel continues to creep out, scooting a bit farther along the branch to dangle the stick very close to you/, + /You jump back from/ + ] + @weasel_jump_pattens = [ + /Your fingertips brush the bottom edge of the stick at the highest point of your jump. You can almost see the weasel smiling at you as it sits down and continues to swing the stick from side to side/ + ] -while (line = get) - waitrt? - if line =~ /^Your vision fades and you suddenly see yourself working in front of a glowing forge/ - DRC.bput('pray Divyaush', 'In your') + if args.step == 'altar' + do_altar + elsif args.step == 'shrine' + do_shrine + else + do_vial + end end - if line =~ /^Your vision fades and you see yourself toiling in a dusty field/ - DRC.bput('pray Berengaria', 'In your') - end - if line =~ /^Your vision fades and you see yourself huddled in front of a fire in an icy cavern/ - DRC.bput('pray Kuniyo', 'In your') - end - if line =~ /^Your vision fades and you see yourself surrounded by occupied cots/ - DRC.bput("pray Peri'el", 'In your') - end - if line =~ /^Your vision fades and you see yourself alone on a raft/ - DRC.bput('pray Lemicus', 'In your') - end - if line =~ /^Your vision fades and you see yourself as a young child sitting in the corner/ - DRC.bput('pray Albreda', 'In your') - end - if line =~ /^Your vision fades and you find yourself travelling the desert/ - DRC.bput('pray Murrula', 'In your') - end - if line =~ /^Your vision fades and you see yourself tired and sore after a long day of harvesting crops/ - DRC.bput('pray Rutilor', 'In your') - end - if line =~ /^Your vision fades and you see yourself sitting on a bar stool/ - DRC.bput('pray Saemaus', 'In your') - end - if line =~ /^Your vision fades and you see yourself walking through one of your grain fields/ - DRC.bput('pray Asketi', 'In your') - end - if line =~ /^Your vision fades and you see yourself sitting amongst a group gathered at an outdoor wedding/ - DRC.bput("pray Be'ort", 'In your') - end - if line =~ /^Your vision fades and you see yourself sitting on a grassy hilltop/ - DRC.bput('pray Dergati', 'In your') - end - if line =~ /^In your vision the waters pull away from the shore/ - DRC.bput('pray Drogor', 'In your') - end - if line =~ /^Your vision fades and you see yourself facing a crackling fire next to the shore/ - DRC.bput('pray Drogor', 'In your') + + def do_altar + # Validate hometown set to crossing + if get_settings.hometown != 'Crossing' + DRC.message("*****\n*****\nDue to needing different favor orbs from any of the 39 aspects, your hometown should be set to Crossing before running this step.\n*****\n*****") + pause 10 + exit + end + + # Check for altar existance + if !DRCI.exists?('miniature altar') + echo "Could not find the miniature altar needed to start the quest. Are you sure you're on it?" + exit + end + + # get the altar hints, and split into two strings to cover possibilities of overlap of messaging + altar_look = DRC.bput('look my miniature altar', /A carving along the front of the miniature altar depicts.*/) + altar_look_first, altar_look_second = altar_look.split('. On the back, another ') + + # get the immortal aspects from the messaging + neutral_aspect_immortal = case altar_look_first + when /raven/i + 'kertigen' + when /unicorn/i + 'hodierna' + when /wolf/i + 'meraud' + when /panther/i + 'damaris' + when /boar/i + 'everild' + when /ox/i + 'truffenyi' + when /cobra/i + "Hav'roth" + when /dolphin/i + 'eluned' + when /ram/i + 'glythtide' + when /cat/i + 'tamsine' + when /wren/i + 'faenella' + when /lion/i + 'chadatru' + when /scorpion/i + "urrem'tier" + else + nil + end + + light_aspect_immortal = case altar_look_first + when /wrapped gift/i + 'divyaush' + when /sheath of grain/i + 'berengaria' + when /black staff/i + 'firulf' + when /batch of feathers/i + 'phelim' + when /a bundle of pelts/i + 'kuniyo' + when /toy bridge/i + 'alamhif' + when /Seashell/i + "peri'el" + when /lodestone/i + 'lemicus' + when /wedding ring/i + 'saemaus' + when /olive laurel/i + 'albreda' + when /silver flute/i + 'murrula' + when /intricate sword/i + 'rutilor' + when /scythe/i + 'eylhaar' + else + nil + end + + dark_aspect_immortal = case altar_look_second + when /an overloaded wagon travelling toward a wooden bridge. The supports look rotten and cracked/i + 'zachriedek' + when /a long row of dismembered bodies leading toward a broken altar/i + 'asketi' + when /a disheveled man weeping behind two women who are locked in combat/i + 'kerenhappuch' + when /a small desert village ravaged by a sand storm, the well in the center almost completely covered over/i + 'dergati' + when /a riotous party. Wine sloshes out of full cups held by people around the table, while other figures are slumped over in their chairs, dark pools around their feet/i + 'trothfang' + when /a tithe box sitting outside of a small chapel, the tail of a snake disappearing into the slot/i + 'huldah' + when /a scene of wilted crops interspersed with livestock lying supine a rough texture to the carving is noticeable above each animal/i + 'ushnish' + when /a simply dressed mage sleeping underneath an elm tree during a downpour. A spellbook sits open on a nearby picnic table/i + 'drogor' + when /a haggard looking Gnome lying on his side and clutching his knees in his arms. A crooked smile stretches across his face as he stares at a roach crawling in front of him/i + "be'ort" + when /the outskirts of a small village the trees skirting the border are fully engulfed in flames/i + 'harawep' + when /young woman walking away from an orphanage/i + 'idon' + when /a man walking down the aisle of a courtroom. On either side of the man, a group of figures raise their fists toward him, while a woman sits near the front of the group weeping/i + 'botolf' + when /a long beach after a horrific battle. A few figures seem to be crawling away from the tide/i + 'aldauth' + else + nil + end + + # validate that you have a immortal for each aspect + if neutral_aspect_immortal.nil? || light_aspect_immortal.nil? || dark_aspect_immortal.nil? + echo "Could not determine neutral aspect!" if neutral_aspect_immortal.nil? + echo "Could not determine light aspect!" if light_aspect_immortal.nil? + echo "Could not determine dark aspect!" if dark_aspect_immortal.nil? + echo "Bailing out!" + exit + else + echo "Neutral Aspect: #{neutral_aspect_immortal}" + echo "Light Aspect: #{light_aspect_immortal}" + echo "Dark Aspect: #{dark_aspect_immortal}" + end + + # fetch favor orbs and fill the altar + [neutral_aspect_immortal, light_aspect_immortal, dark_aspect_immortal].each do |immortal| + DRC.wait_for_script_to_complete('favor', [immortal]) + if !DRCI.get_item?("#{immortal} orb") + echo "Failed to get orb for aspect - #{immortal}." + echo "Bailing out!" + exit + end + DRC.bput("put my #{immortal} orb in my miniature altar", /You put your orb in the miniature altar/) + end + + if !DRCI.get_item?("miniature altar") + echo "Somehow you lost your altar!" + echo "Bailing out!" + exit + end + + DRC.bput('close my miniature altar', /You close/) + # TODO: Get strings for 'oops wrong immortal orbs' + Lich::Util.issue_command('pray my miniature altar', /You kneel down and pray to a miniature altar/, /The flames surrounding the object diminish slightly allowing you to/, usexml: false, timeout: 90) + + DRC.bput('stow murky vial', /You pick up/) + echo "Vial acquired - getting healed." + DRC.wait_for_script_to_complete('safe-room') end - if line =~ /^Your vision fades and you see yourself seated in the front row of a concert hall/ - DRC.bput('pray Idon', 'In your') + + def do_vial + EquipmentManager.new.empty_hands + + if DRCI.exists?('murky vial') + DRC.message("This next step will take many hours (approx 3+) to complete.\nYou should not be doing anything else except this during this time or you risk death and failure of the quest.") + pause 5 + DRC.message("If you are sure you wish to proceed, simply let the script continue, otherwise kill the script.") + pause 15 + DRC.message("Beginning quest process in 15 seconds. Hope you are in a safe area.") + pause 15 + if !DRCI.get_item?('murky vial') + echo "Somehow you lost your vial!" + echo "Bailing out!" + exit + end + if /You tilt the vial back, but the liquid doesn't pour out/ !~ DRC.bput('drink my murky vial', /You tilt the vial back, but the liquid doesn't pour out/) + echo "Somehow you have the wrong vial!" + echo "Bailing out!" + exit + end + if /You tilt the vial back and drink deeply from it/ !~ DRC.bput('drink my murky vial', /You tilt the vial back and drink deeply from it/) + echo "Somehow you have the wrong vial!" + echo "Bailing out!" + exit + end + else + DRC.message("Assuming you already drank the vial. If not, kill this script and figure out what happened to your vial.") + end + + start = Time.now + DRC.message("Vial step started at #{start}.") + while (line = get) + waitrt? + # rubocop:disable Layout/IndentationConsistency + # rubocop:disable Layout/CommentIndentation + # This is to enable better code collapse in IDEs given the size of these + # code blocks + # Light Aspects + if line =~ /^Your vision fades and you suddenly see yourself working in front of a glowing forge/ + DRC.bput('pray Divyaush', 'In your') + end + if line =~ /^Your vision fades and you see yourself toiling in a dusty field/ + DRC.bput('pray Berengaria', 'In your') + end + if line =~ /^Your vision fades and you see yourself huddled in front of a fire in an icy cavern/ + DRC.bput('pray Kuniyo', 'In your') + end + if line =~ /^Your vision fades and you see yourself surrounded by occupied cots/ + DRC.bput("pray Peri'el", 'In your') + end + if line =~ /^Your vision fades and you see yourself alone on a raft/ + DRC.bput('pray Lemicus', 'In your') + end + if line =~ /^Your vision fades and you see yourself as a young child sitting in the corner/ + DRC.bput('pray Albreda', 'In your') + end + if line =~ /^Your vision fades and you find yourself travelling the desert/ + DRC.bput('pray Murrula', 'In your') + end + if line =~ /^Your vision fades and you see yourself tired and sore after a long day of harvesting crops/ + DRC.bput('pray Rutilor', 'In your') + end + if line =~ /^Your vision fades and you see yourself sitting on a bar stool/ + DRC.bput('pray Saemaus', 'In your') + end + # Dark Aspects + if line =~ /^Your vision fades and you see yourself walking through one of your grain fields/ + DRC.bput('pray Asketi', 'In your') + end + if line =~ /^Your vision fades and you see yourself sitting amongst a group gathered at an outdoor wedding/ + DRC.bput("pray Be'ort", 'In your') + end + if line =~ /^Your vision fades and you see yourself sitting on a grassy hilltop/ + DRC.bput('pray Dergati', 'In your') + end + if line =~ /^In your vision the waters pull away from the shore/ + DRC.bput('pray Drogor', 'In your') + end + if line =~ /^Your vision fades and you see yourself facing a crackling fire next to the shore/ + DRC.bput('pray Drogor', 'In your') + end + if line =~ /Your vision fades and you see yourself seated in a small chapel/ + DRC.bput('pray Huldah', 'In your') + end + if line =~ /^Your vision fades and you see yourself seated in the front row of a concert hall/ + DRC.bput('pray Idon', 'In your') + end + if line =~ /^Your vision fades and you see yourself entertaining a neighboring farmer at your house/ + DRC.bput('pray Kerenhappuch', 'In your') + end + if line =~ /^Your vision fades and you see yourself battling a small peccary/ + DRC.bput('pray Trothfang', 'In your') + end + if line =~ /^Your vision fades and you see yourself standing in the snow peering into the window of a rival/ + DRC.bput('pray Zachriedek', 'In your') + end + # Neutral Aspects: TBD? + # rubocop:enable Layout/CommentIndentation + # rubocop:enable Layout/IndentationConsistency + + if line =~ /^Your stomach grumbles and you realize that you're holding a/ + fput("drop #{checkright || checkleft}") if DRC.left_hand || DRC.right_hand + end + next unless line =~ /you have my attention, though really you are never far from my sight/ + + finish = Time.now + DRC.message("Vial step finished at #{finish}! This part of the quest took #{((finish - start) / 60.0).round} minutes to complete.") + exit + end end - if line =~ /^Your vision fades and you see yourself entertaining a neighboring farmer at your house/ - DRC.bput('pray Kerenhappuch', 'In your') + + def do_shrine + if XMLData.room_title !~ /Therenborough, Small Shrine|Deep Forest, Clearing|Deep Forest, Shaded Path|Deep Forest, Open Clearing|Deep Forest, Inside the Pit/ + echo "You can only start this part once you've found the shrine." + echo "Bailing out!" + exit + end + + if XMLData.room_title =~ /Therenborough, Small Shrine|Deep Forest, Clearing/ + do_shrine_enter_clearing + do_shrine_follow_magpie + do_shrine_catch_weasel + do_shrine_free_ox + elsif XMLData.room_title =~ /Deep Forest, Shaded Path/ + do_shrine_follow_magpie + do_shrine_catch_weasel + do_shrine_free_ox + elsif XMLData.room_title =~ /Deep Forest, Open Clearing/ + do_shrine_catch_weasel + do_shrine_free_ox + elsif XMLData.room_title =~ /Deep Forest, Inside the Pit/ + do_shrine_free_ox + end end - if line =~ /^Your vision fades and you see yourself battling a small peccary/ - DRC.bput('pray Trothfang', 'In your') + + def do_shrine_enter_clearing + EquipmentManager.new.empty_hands + + if XMLData.room_title =~ /Therenborough, Small Shrine/ + DRC.bput('KNEEL', /You kneel down upon/, /You rise to a kneeling/) + DRC.bput('PRAY TRUFFENYI', /You close your eyes and welcome/) + waitfor 'Hoof prints speckle this grassy clearing' + end + DRC.fix_standing + move 'go gap' end - if line =~ /^Your vision fades and you see yourself standing in the snow peering into the window of a rival/ - DRC.bput('pray Zachriedek', 'In your') + + def do_shrine_follow_magpie + EquipmentManager.new.empty_hands + + if XMLData.room_title =~ /Deep Forest, Shaded Path/ + move 'east' + end end - if line =~ /^Your stomach grumbles and you realize that you're holding a/ - fput("drop #{checkright || checkleft}") if DRC.left_hand || DRC.right_hand + + def do_shrine_catch_weasel + EquipmentManager.new.empty_hands + + if XMLData.room_title =~ /Deep Forest, Open Clearing/ + + while !DRRoom.npcs.include?("magpie") + pause 1 + end + + while (XMLData.room_description !~ /The freshly-dug pit is clearly/) + if DRStats.fatigue > 50 + DRC.fix_standing + jump_result = DRC.bput('jump weasel', *@weasel_no_jump_pattens, *@weasel_jump_pattens) + case jump_result + when *@weasel_no_jump_pattens + pause 1 + next + when *@weasel_jump_pattens + whistle_result = DRC.bput('whistle magpie', /The brown magpie ignores you/, /the scruffy weasel focusing its attention on clinging to the bobbing branch rather than taunting you with the stick/) + if whistle_result =~ /the scruffy weasel focusing its attention on clinging to the bobbing branch rather than taunting you with the stick/ + if /You manage to grab hold of the stick while the weasel/ =~ DRC.bput('jump weasel', /You manage to grab hold of the stick while the weasel/, /You start to make an effort to jump up/) + waitfor 'The freshly-dug pit is clearly' + return + end + end + end + else + DRC.bput('lie', 'You lie down') + while DRStats.fatigue < 95 + pause 2 + end + DRC.fix_standing + end + end + + end end - next unless line =~ /you have my attention, though really you are never far from my sight/ - finish = ((Time.now - start) / 60.0).round - echo("All done! This part of the quest took #{finish} minutes to complete.") - exit + def do_shrine_free_ox + if XMLData.room_title =~ /Deep Forest, Inside the Pit/ + + if DRC.right_hand == 'knobby stick' && DRC.left_hand != 'flat rock' && !DRRoom.room_objs.include?('notched flat rock') && DRC.left_hand != 'burlap twine' && !DRRoom.room_objs.include?('length of burlap twine') + while (!DRRoom.room_objs.include?('notched flat rock')) + if DRStats.fatigue > 50 + DRC.fix_standing + DRC.bput('pull ox', 'Roundtime') + else + DRC.bput('lie', 'You lie down') + while DRStats.fatigue < 95 + pause 2 + end + end + end + end + + DRC.fix_standing + + if DRC.right_hand == 'knobby stick' && DRC.left_hand != 'flat rock' && DRRoom.room_objs.include?('notched flat rock') && DRC.left_hand != 'burlap twine' && !DRRoom.room_objs.include?('length of burlap twine') + DRC.bput('get rock', 'You pick up a notched') + # check if you've already tied the twine and we're in recovery + if /A sturdy length of burlap twine has been tied to the end of the knobby/ =~ DRC.bput('l my stick', /A sturdy length of burlap twine has been tied to the end of the knobby/, /The stick appears sturdy enough/) + DRC.bput('tie rock to stick', /You carefully tie your knobby stick/) + end + end + + if DRC.right_hand == 'knobby stick' && DRC.left_hand == 'flat rock' && !DRRoom.room_objs.include?('length of burlap twine') + while !DRRoom.room_objs.include?('length of burlap twine',) + pause 2 + end + end + + if DRC.right_hand == 'knobby stick' && DRC.left_hand == 'flat rock' && DRRoom.room_objs.include?('length of burlap twine') + DRC.bput('drop rock', /You drop a notched flat/) + DRC.bput('get twine', /You pick up a length of/) + end + + if DRC.right_hand == 'knobby stick' && DRC.left_hand == 'burlap twine' && DRRoom.room_objs.include?('notched flat rock') + DRC.bput('tie twine to stick', /You carefully tie the twine around the end of your stick, leaving a free end to dangle in the wind/) + end + + if DRC.right_hand == 'knobby stick' && DRC.left_hand != 'burlap twine' && DRRoom.room_objs.include?('notched flat rock') + DRC.bput('get rock', 'You pick up a notched') + DRC.bput('tie rock to stick', /You carefully tie your knobby stick/) + end + + if DRC.right_hand == 'crude shovel' && !DRRoom.room_objs.include?('finished earthen ramp') + while (!DRRoom.room_objs.include?('finished earthen ramp')) + if DRStats.fatigue > 40 + DRC.fix_standing + DRC.bput('dig', 'Roundtime') + else + DRC.bput('lie', 'You lie down') + while DRStats.fatigue < 95 + pause 2 + end + end + end + end + + if DRRoom.room_objs.include?('finished earthen ramp') && DRRoom.npcs.include?('ox') + DRC.bput('push ox', 'You situate yourself behind the long') + end + + if DRRoom.room_objs.include?('finished earthen ramp') && !DRRoom.npcs.include?('ox') + move 'go ramp' + end + + DRC.message("Hooray! You finished. Now just listen to the ox's spiel.") + + end + end end + +TruffenyiCommuneQuest.new