rpherbig / dr-scripts

A series of Lich 5 (https://github.com/elanthia-online/lich-5) scripts for use with DragonRealms (http://www.play.net/dr/). Donations are welcome (http://www.paypal.me/rcuhljr)!
GNU General Public License v2.0
53 stars 178 forks source link

Add storing of high quality harvested material in combat-trainer for necros #1457

Closed FluxBorn closed 7 years ago

FluxBorn commented 7 years ago

I am new with ruby and lich, but I added some settings to allow people to set the thanatology section to allow storing of higher quality material for later use in self healing.

it requires adding the following settings to the profile yaml,


thanatology: store: (true or false to turn this on or off) harvest_container: (the bag you want to store it in) harvest_count: (the number of pieces of material you want to keep at any given time)

this requires changing the following line in combat-trainer

stating at line 11 from thanatology = settings.thanatology @ritual_type = thanatology['ritual_type'].downcase

@necro_heal = thanatology['heal'] || false
echo("  @necro_heal: #{@necro_heal}") if $debug_mode_ct

to

   @thanatology = settings.thanatology
    @ritual_type = @thanatology['ritual_type'].downcase
    echo("  @ritual_type: #{@ritual_type}") if $debug_mode_ct
    @necro_heal = @thanatology['heal'] || false
    echo("  @necro_heal: #{@necro_heal}") if $debug_mode_ct

and add this line after necro_heal

   @necro_store = @thanatology['store'] || false
    echo("  @necro_store: #{@necro_store}") if $debug_mode_ct

Finally update the do_necro_ritual method with the following.

def do_necro_ritual(mob_noun, ritual, game_state)
    return unless DRStats.necromancer?
    return unless ritual
    return if game_state.construct?(mob_noun)

    echo "Attempting necromancer ritual #{ritual} on #{mob_noun}" if $debug_mode_ct
    do_necro_ritual(mob_noun, 'preserve', game_state) if %w(consume harvest arise).include?(ritual)

    perform_message = "perform #{ritual} on #{mob_noun}"
    result = bput(perform_message, @rituals['preserve'], @rituals['dissect'], @rituals['harvest'], @rituals['consume'], @rituals['construct'], @rituals['failures'])
    echo result if $debug_mode_ct
    case result
    when @rituals['preserve'], @rituals['dissect']
      echo 'Detected preserve or dissect messaging' if $debug_mode_ct
      @last_ritual = ritual
    when @rituals['consume']
      echo 'Detected consume messaging' if $debug_mode_ct
      @last_ritual = ritual
      game_state.prepare_consume = true if @necro_heal
    when @rituals['harvest']
      echo 'Detected harvest messaging' if $debug_mode_ct
      @last_ritual = ritual
      waitrt?
      if !@necro_store
        echo "Thanatology:Store: = false, dropping harvested material" if $debug_mode_ct
        bput('drop material', 'you discard it')
      else
        echo "Thanatology:Store: = true, checking count of stored material" if $debug_mode_ct
        than_count = @thanatology['harvest_count']
        than_container = @thanatology['harvest_container']
        materials = fput("rummage /C material #{than_container}")
        material_count = materials.scan(/(?=a \S+ \S+ of \S+ material)/).count
        if material_count >= than_count
          bput('drop material', 'you discard it')
          echo "Already full on stored material, dropping harvested material." if $debug_mode_ct
        else
          quality = fput('glance left')
          if quality['great'] or quality['excellent'] or quality['perfect']
            bput("put material in my #{than_container}", 'You put')
            echo "Storing high quality material." if $debug_mode_ct
          else
            bput('drop material', 'you discard it')
            echo "dropping low quality material." if $debug_mode_ct
          end
        end
      end
    when @rituals['construct']
      echo 'Detected an attempt to do ritual on a construct' if $debug_mode_ct
      game_state.construct(mob_noun)
    when *@rituals['failures']
      echo 'Failure detected' if $debug_mode_ct
    end
    echo "Last ritual performed: #{@last_ritual}" if $debug_mode_ct
end
skyleronken commented 7 years ago

sounds like you have it figured out! Github has some great tutorials on forking and creating PRs (i.e https://gist.github.com/Chaser324/ce0505fbed06b947d962)

You can also use a github desktop client which follows the same workflow but automates the process.

rpherbig commented 7 years ago

I highly recommend GitKraken for a UI client!

On Mar 10, 2017 2:37 AM, "Skyler Onken" notifications@github.com wrote:

sounds like you have it figured out! Github has some great tutorials on forking and creating PRs (i.e https://gist.github.com/ Chaser324/ce0505fbed06b947d962)

You can also use a github desktop client which follows the same workflow but automates the process.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rpherbig/dr-scripts/issues/1457#issuecomment-285635812, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIHp5k1xdVnZ1jle9JxfnHsLxTOa9Hwks5rkSfrgaJpZM4MY5_l .

FluxBorn commented 7 years ago

Will do. For this change are you going to handle it or should I go figure out the forking now? :D

FluxBorn commented 7 years ago

Think I figured it out.

rpherbig commented 7 years ago

Fixed in b64bf253692ec7502fd7d734e6b51adfb1bacafa