jbrocky

Untitled

Dec 19th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.15 KB | None | 0 0
  1. custom_require.call(%w[common common-travel])
  2.  
  3. class StationaryTraining
  4.   include DRC
  5.  
  6.   def initialize
  7.     @dump_item_count =  get_settings.dump_item_count
  8.     @magics = get_settings.combat_spell_training
  9.     @safe_room = get_settings.safe_room
  10.     @repair_every = get_settings.repair_every
  11.     @mana_threshold = 40 #percentage
  12.     @pow_time     = Time.now - 60
  13.     @perc_timer   = Time.now - 60
  14.     @junk_timer   = Time.now
  15.     @hunt_timer   = Time.now - 1801
  16.     @poison_timer = Time.now - 60
  17.     @hunting_runs = 0
  18.  
  19.     loop do
  20.       #check_for_poison
  21.  
  22.       #train_attunement
  23.       #train_perception
  24.  
  25.       unless train_magics
  26.         #train_mech
  27.         #train_locks
  28.         #train_appr
  29.         #train_outdoors
  30.         #train_athletics
  31.         #train_fa
  32.         #train_weapons
  33.       else
  34.         pause 5
  35.       end
  36.     end
  37.   end
  38.  
  39.   def train_fa
  40.     return unless DRSkill.getxp('First Aid') < 15
  41.  
  42.     wait_for_script_to_complete('first-aid')
  43.   end
  44.  
  45.   def check_for_poison
  46.     return unless (Time.now - @poison_timer) > 60
  47.     fput('health')
  48.  
  49.     cast_spell('FP', '20', 'cast') if reget(15, 'You have a .* poisoned')
  50.      @poison_timer = Time.now
  51.   end
  52.  
  53.   def train_magics
  54.     return false unless mana > @mana_threshold
  55.  
  56.     skills_to_train = %w[Utility Warding Augmentation Sorcery]
  57.     skills_to_train.reject! { |skill| DRSkill.getxp(skill) > 30 }
  58.     return false if skills_to_train.empty?
  59.  
  60.     skills_to_train.sort_by { |skill| DRSkill.getxp(skill) }
  61.                    .each    { |skill| cast_spell( @magics[skill]['abbrev'],
  62.                                                   @magics[skill]['mana'],
  63.                                                   @magics[skill]['cast']) if mana > @mana_threshold }
  64.     true
  65.   end
  66.  
  67.   def cast_spell(abbrev, mana, cast)
  68.     return unless abbrev && mana && cast
  69.  
  70.     bput('release sym', 'You pause for a moment', 'But you haven\'t')
  71.     bput('release spell', 'You let your', 'You aren\'t preparing')
  72.     bput('prep sym', 'You recall the exact', 'But you\'ve already')
  73.     bput("prepare #{abbrev} #{mana}", 'With rigid movements', 'You trace')
  74.     waitfor('You feel fully prepared')
  75.     bput("#{cast}", 'You gesture', 'You don\'t have')
  76.   end
  77.  
  78.   def train_locks
  79.     return unless DRSkill.getxp('Locksmithing') < 25
  80.  
  81.     wait_for_script_to_complete('bitchin-pick', ['pets', '99'])
  82.     wait_for_script_to_complete('bitchin-pick')
  83.   end
  84.  
  85.   def train_athletics
  86.     return unless DRSkill.getxp('Athletics') < 1
  87.  
  88.     wait_for_script_to_complete('athletics')
  89.     DRCT.walk_to(@safe_room)
  90.   end
  91.  
  92.   def train_attunement
  93.     return unless ((Time.now - @pow_time > 60)) && DRSkill.getxp('Attunement') < 30
  94.  
  95.     bput('pow', 'You reach out')
  96.     @pow_time = Time.now
  97.   end
  98.  
  99.   def train_perception
  100.     return unless ((Time.now - @perc_timer) > 60) && DRSkill.getxp('Perception') < 30
  101.  
  102.     bput('hunt', 'You take note of ', 'You find yourself unable to hunt in this area')
  103.     @perc_timer = Time.now
  104.   end
  105.  
  106.   def train_mech
  107.     return unless DRSkill.getxp('Mechanical Lore') < 25
  108.  
  109.     dump_junk
  110.     wait_for_script_to_complete('mech-lore')
  111.   end
  112.  
  113.   def train_appr
  114.     return unless DRSkill.getxp('Appraisal') < 10
  115.  
  116.     %w[first second third fourth].each { |itr|
  117.       bput("get #{itr} pouch in my bag", 'You get')
  118.       bput('appr my pouch', 'The suede')
  119.       waitrt?
  120.       pause 0.25
  121.       bput("put my pouch in my bag", 'You put')
  122.     }
  123.   end
  124.  
  125.   def train_outdoors
  126.     while DRSkill.getxp('Outdoorsmanship') < 25
  127.       DRC.collect('rock')
  128.       waitrt?
  129.       DRC.kick_pile? unless DRC.kick_pile?("rocks")
  130.       dump_junk
  131.     end
  132.   end
  133.  
  134.   def train_weapons
  135.     return unless ((Time.now - @hunt_timer) > 1800) && DRSkill.getxp('Light Thrown') < 5
  136.  
  137.     stop_script('healbot') if Script.running?('healbot')
  138.     stop_script('regen') if Script.running?('regen')
  139.     fput('release cyclic', 'The tingling across', 'You have no cyclic')
  140.  
  141.     wait_for_script_to_complete('hunting-buddy', ['weapons'])
  142.     @hunting_runs += 1
  143.     if @hunting_runs >= @repair_every
  144.       wait_for_script_to_complete('sloot', ['shard'])
  145.       wait_for_script_to_complete('repair', ['shard'])
  146.       @hunting_runs = 0
  147.     end
  148.    
  149.     DRCT.walk_to(@safe_room)
  150.     @hunt_timer = Time.now
  151.     start_script('healbot')
  152.   end
  153.  
  154.   def dump_junk
  155.     #return unless @settings.dump_junk
  156.     return unless (Time.now - @junk_timer) > 300
  157.     return unless DRRoom.room_objs.size > @dump_item_count
  158.  
  159.     bput('dump junk', 'You should just kick', 'You have marked this room', 'You cannot summon', 'The janitor was recently summoned')
  160.     @junk_timer = Time.now
  161.   end
  162. end
  163.  
  164. before_dying do
  165.   stop_script('mech-lore') if Script.running?('mech-lore')
  166.   stop_script('athletics') if Script.running?('athletics')
  167.   stop_script('bitchin-pick') if Script.running?('bitchin-pick')
  168.   stop_script('first-aid') if Script.running?('first-aid')
  169.   2.times { fput('put my massive codex in my pack') }
  170.   fput('stop climb')
  171.   fput('release spell')
  172.   2.times { fput('drop grass') }
  173.   fput('drop rope')
  174.   fput("put my pouch in my bag")
  175.   fput('stow left')
  176.   fput('stow right')
  177.   DRC.kick_pile?("rocks")
  178. end
  179.  
  180. StationaryTraining.new
Advertisement
Add Comment
Please, Sign In to add comment