Skip to content

Commit

Permalink
Merge branch 'rpherbig:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
desertkaz authored Mar 29, 2024
2 parents 3fa7d8f + a6550ec commit bc2e69b
Show file tree
Hide file tree
Showing 47 changed files with 809 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v41
with:
files: |
*.lic
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby_syntax_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v41
with:
files: |
*.lic
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v41
with:
files: |
data/*.yaml
Expand Down
89 changes: 47 additions & 42 deletions accept-sell.lic
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,65 @@

custom_require.call(%w[common common-money])

if DRC.right_hand || DRC.left_hand
echo('Empty your hands!')
exit
end
loop do
if DRC.right_hand || DRC.left_hand
echo('Empty your hands!')
exit
end

arg_definitions = [
[
{ name: 'skip', regex: /skip/i, optional: true, description: 'Don\'t appraise, just sell and hand off' },
{ name: 'buy', regex: /buy/i, optional: true, description: 'Pay for the pouch out of your own money' },
{ name: 'dump', regex: /dump/i, optional: true, description: 'dump item after sale' }
arg_definitions = [
[
{ name: 'skip', regex: /skip/i, optional: true, description: 'Don\'t appraise, just sell and hand off' },
{ name: 'buy', regex: /buy/i, optional: true, description: 'Pay for the pouch out of your own money' },
{ name: 'dump', regex: /dump/i, optional: true, description: 'dump item after sale' }
]
]
]

args = parse_args(arg_definitions)
args = parse_args(arg_definitions)

case DRC.bput('accept', 'You have no offers to accept', "You accept \\w+'s offer and are now holding")
when /You accept (\w+)/
item_type = GameObj.right_hand.noun
giver = Regexp.last_match(1)
unless args.skip
until /(\d+) (\w+)/ =~ DRC.bput("app my #{DRC.right_hand}", 'total of about \d+ \w+\.', 'to examine its contents')
case DRC.bput('accept', 'You have no offers to accept', "You accept \\w+'s offer and are now holding")
when /You accept (\w+)/
item_type = GameObj.right_hand.noun
giver = Regexp.last_match(1)
unless args.skip
until /(\d+) (\w+)/ =~ DRC.bput("app my #{DRC.right_hand}", 'total of about \d+ \w+\.', 'to examine its contents')
pause
waitrt?
fput('tie my pouch')
end
app = Regexp.last_match(1).to_i
currency = Regexp.last_match(2)
pause
waitrt?
fput('tie my pouch')
end
app = Regexp.last_match(1).to_i
currency = Regexp.last_match(2)
pause
waitrt?
end

if args.buy
price = (app * 1.5).to_i
fput("stow #{DRC.right_hand}")
fput("tip #{giver} #{price} #{currency}")
else
/(\d+) (\w+)/ =~ DRC.bput("sell my #{DRC.right_hand}", 'then hands you \d+ \w+')
sell = Regexp.last_match(1).to_i
currency ||= Regexp.last_match(2)
if args.buy
price = (app * 1.5).to_i
fput("stow #{DRC.right_hand}")
fput("tip #{giver} #{price} #{currency}")
else
/(\d+) (\w+)/ =~ DRC.bput("sell my #{DRC.right_hand}", 'then hands you \d+ \w+')
sell = Regexp.last_match(1).to_i
currency ||= Regexp.last_match(2)

unless args.skip
profit = DRCM.minimize_coins(sell - app)
percentage = ((sell.to_f / app - 1).round(2) * 100).to_i
fput("whisper #{giver} This #{item_type} sold for #{percentage}% above appraisal, a profit of #{profit[0..1].join(' and ')} #{currency}")
end
unless args.skip
profit = DRCM.minimize_coins(sell - app)
percentage = ((sell.to_f / app - 1).round(2) * 100).to_i
fput("whisper #{giver} This #{item_type} sold for #{percentage}% above appraisal, a profit of #{profit[0..1].join(' and ')} #{currency}")
end

fput("tip #{giver} #{sell} #{currency}")
if args.dump
fput("put #{DRC.right_hand} in bucket")
else
case DRC.bput("give #{DRC.right_hand} to #{giver}", 'has declined the offer', 'has accepted your offer')
when 'has declined the offer'
fput("tip #{giver} #{sell} #{currency}")
if args.dump
fput("put #{DRC.right_hand} in bucket")
else
case DRC.bput("give #{DRC.right_hand} to #{giver}", 'has declined the offer', 'has accepted your offer')
when 'has declined the offer'
fput("put #{DRC.right_hand} in bucket")
end
end
end
else
# No offers currently available, pause and wait for an offer
pause 2
end
end
24 changes: 23 additions & 1 deletion almanac.lic
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ class Almanac

startup_delay = settings.almanac_startup_delay

# check to ensure almanac is defined in gear, and warn user if not
if settings.gear.find { |item| @almanac =~ /#{item[:adjective]}\s*#{item[:name]}/i }.nil?
message = "To minimize the possibility that items that you hold in your hands could be lost they should be listed in your `gear:`. Your almanac is not listed in your `gear:` settings:"
message += "\n - #{@almanac}"
message += "\nIf you need assistance with this, please ask in the lich discord (listed in #{$clean_lich_char}links) for help."
message += "\n\n---This check is *advisory* for now, but will become mandatory in the near future.---"
DRC.message(message)
pause 10
end

pause startup_delay
passive_loop
end
Expand All @@ -33,9 +43,21 @@ class Almanac
.min_by { |skill| [DRSkill.getxp(skill), DRSkill.getrank(skill)] }
end

def skill_with_lowest_mindstate
list = []
DRSkill.list
.map { |skill| [skill.name, skill.exp, skill.rank] }
.select { |element| element[1] }
.reject { |_skill, _exp, rank| (rank.to_i == 1750 || rank.to_i == 0) }
.reject { |skill, _exp| skill == "Mechanical Lore" }
.select { |skill, exp| list.append [skill, exp] }
skill = list.sort_by(&:last).first[0].sub(/(Lunar|Life|Arcane|Holy|Elemental)\s/, '')
return skill
end

def use_almanac
unless @almanac_skills.empty?
training_skill = almanac_sort_by_rate_then_rank(@priority_skills) || almanac_sort_by_rate_then_rank(@almanac_skills)
training_skill = almanac_sort_by_rate_then_rank(@priority_skills) || almanac_sort_by_rate_then_rank(@almanac_skills) || skill_with_lowest_mindstate
echo("training skill is #{training_skill}")
return unless training_skill
end
Expand Down
2 changes: 1 addition & 1 deletion astrology.lic
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Astrology
def check_attunement
return if DRSkill.getxp('Attunement') > 30

['', 'mana', 'moons', 'planets'].each do |target|
['', 'mana', 'moons', 'planets', 'psychic', 'transduction', 'perception', 'moonlight'].each do |target|
DRC.bput("perceive #{target}", 'roundtime')
waitrt?
end
Expand Down
24 changes: 12 additions & 12 deletions athletics.lic
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Athletics
start = Time.now
DRCT.walk_to(@outdoorsmanship_rooms.sample) unless @outdoorsmanship_rooms.empty?
stow_athletics_items
DRC.wait_for_script_to_complete('outdoorsmanship', [number, "room=#{Room.current.id}", 'collect', 'rock'])
DRC.wait_for_script_to_complete('outdoorsmanship', [number, "room=#{Room.current.id}", 'rock'])
remaining_pause = ((number * 15) - (Time.now - start))
pause remaining_pause if remaining_pause > 0
get_athletics_items
Expand Down Expand Up @@ -210,9 +210,9 @@ class Athletics
end

def crossing_athletics
if UserVars.athletics <= 50
if UserVars.athletics.to_i <= 50
swim_loop(get_data('athletics').swimming_options['arthe_dale']['rooms'])
elsif UserVars.athletics < 290
elsif UserVars.athletics.to_i < 290
waitrt?
pause @performance_pause # to give performance time to complete before_dying if stopped from the previous script
start_script('performance') unless Script.running?('performance')
Expand All @@ -223,28 +223,28 @@ class Athletics
break unless climb?(data['room'], data['targets'])
end
end
elsif UserVars.athletics < 450
elsif UserVars.athletics.to_i < 450
override_location_and_practice('segoltha_bank')
else
DRC.message("The xalas argument will train faster at 650+ athletics. Be aware that it's potentially dangerous.") if UserVars.athletics > 650
DRC.message("The xalas argument will train faster at 650+ athletics. Be aware that it's potentially dangerous.") if UserVars.athletics.to_i > 650
override_location_and_practice('arthelun_rocks')
DRC.message("The xalas argument will train faster at 650+ athletics. Be aware that it's potentially dangerous.") if UserVars.athletics > 650
DRC.message("The xalas argument will train faster at 650+ athletics. Be aware that it's potentially dangerous.") if UserVars.athletics.to_i > 650
end
end

def shard_athletics
until done_training?
if UserVars.athletics < 240
if UserVars.athletics.to_i < 240
until done_training?
@athletics_options['shard']
.reject { |data| @settings.avoid_athletics_in_justice && data['justice'] }
.each do |data|
break unless climb?(data['room'], data['targets'])
end
end
elsif UserVars.athletics < 540
elsif UserVars.athletics.to_i < 540
climb_cliffs
elsif UserVars.athletics < 850
elsif UserVars.athletics.to_i < 850
climb_branch
elsif UserVars.athletics
climb_wyvern
Expand Down Expand Up @@ -342,10 +342,10 @@ class Athletics
end

def climb_branch
if UserVars.athletics < 540
if UserVars.athletics.to_i < 540
override_location_and_practice('undergondola_branch')
else
DRC.message("Warning: Using the undergondola arg with more than 850 athletics is not best use and you may consider the wyvern option instead.") if UserVars.athletics > 850
DRC.message("Warning: Using the undergondola arg with more than 850 athletics is not best use and you may consider the wyvern option instead.") if UserVars.athletics.to_i > 850
DRCT.walk_to(9607)
DRCT.walk_to(9515)
until done_training?
Expand Down Expand Up @@ -375,7 +375,7 @@ class Athletics
def climb_wyvern
DRCT.walk_to(19_464)
until done_training?
DRCT.walk_to(2245) if UserVars.athletics > 540
DRCT.walk_to(2245) if UserVars.athletics.to_i > 540
DRCT.walk_to(9607)
DRCT.walk_to(11_126)
DRCT.walk_to(19_464)
Expand Down
2 changes: 1 addition & 1 deletion carve.lic
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Carve
case DRC.bput("get my #{@material} #{@type}", '^You get', '^You are already', '^What do you', '^What were you', 'You pick up', "can't quite lift it")
when 'What do you', 'What were you'
DRC.beep
echo("You seem to be missing: #{name}")
echo("You seem to be missing: #{@material} #{@type}")
exit
when /can\'t quite lift it/
@my = ''
Expand Down
24 changes: 17 additions & 7 deletions combat-trainer.lic
Original file line number Diff line number Diff line change
Expand Up @@ -2911,19 +2911,29 @@ class TrainerProcess
def almanac_sort_by_rate_then_rank(skills)
skills
.select { |skill| DRSkill.getxp(skill) < 18 }
.sort_by { |skill| [DRSkill.getxp(skill), DRSkill.getrank(skill)] }.first
.min_by { |skill| [DRSkill.getxp(skill), DRSkill.getrank(skill)] }
end

def skill_with_lowest_mindstate
list = []
DRSkill.list
.map { |skill| [skill.name, skill.exp, skill.rank] }
.select { |element| element[1] }
.reject { |_skill, _exp, rank| (rank.to_i == 1750 || rank.to_i == 0) }
.reject { |skill, _exp| skill == "Mechanical Lore" }
.select { |skill, exp| list.append [skill, exp] }
skill = list.sort_by(&:last).first[0].sub(/(Lunar|Life|Arcane|Holy|Elemental)\s/, '')
return skill
end

def use_almanac(game_state)
return unless @almanac
return unless Time.now - UserVars.almanac_last_use >= 600
return if DRC.left_hand && !game_state.currently_whirlwinding

unless @almanac_skills.empty?
unless almanac_sort_by_rate_then_rank(@almanac_priority_skills)
training_skill = almanac_sort_by_rate_then_rank(@almanac_skills)
else
training_skill = almanac_sort_by_rate_then_rank(@almanac_priority_skills)
end
training_skill = almanac_sort_by_rate_then_rank(@almanac_priority_skills) || almanac_sort_by_rate_then_rank(@almanac_skills) || skill_with_lowest_mindstate
echo("training skill is #{training_skill}") if $debug_mode_ct
return unless training_skill
end

Expand Down Expand Up @@ -3296,7 +3306,7 @@ class AttackProcess
# Tests: https://regex101.com/r/HkIa8j/1
# IMPORTANT: 'stone shard' must be listed before 'shard' and 'stone' in the pattern else won't match 'senci stone shard' correctly.
ammo_pattern = "(?<ammo>arrow|bolt|stone shard|shard|rock|sphere|clump|coral|fist|holder|lump|patella|pellet|pulzone|quadrello|quarrel|quill|stone|stopper|verretto|blowgun dart|crumb|spine|mantrap spike|tiny dragon|icicle|fang|scale|grey-black spike|bacon strip|page|naga|thorn|fragment|talon|cork|button|core|pebble|geode|stub|pit|thimble|doorknob|cone|bell|hunk|piece|present|sleighbell|sprig|star|toy|spiral)s?"
Flags.add('ct-ranged-ammo', "(you (?<action>fire|poach|snipe) an?|your) (?<prefix>[^\.!]*? )?#{ammo_pattern}(?<suffix> [^\.!]*?)?? (at|passes through)")
Flags.add('ct-ranged-ammo', "(you (?<action>fire|poach|snipe) an?|your) (?<prefix>[^\.!]*? )?#{ammo_pattern}(?<altered_poststring>.*)?(?<suffix> [^\.!]*?)?? (at|passes through)")
Flags.add('ct-powershot-ammo', "With a loud twang, you let fly your #{ammo_pattern}!")
Flags.add('ct-ranged-loaded', 'You reach into', 'You load', 'You carefully load', 'already loaded', 'in your hand')
Flags.add('ct-using-repeating-crossbow', /Your repeating crossbow/i, /Your repeating arbalest/i, /Your marksman's arbalest/i, /Your assassin's crossbow/i, /Your riot crossbow/i, /You .* ammunition (chamber|store)/, /already loaded with as much ammunition as it can hold/, /You realize readying more than one/)
Expand Down
6 changes: 3 additions & 3 deletions common-arcana.lic
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ module DRCA
discern_data['cambrinth'] = nil
else
discern =~ /minimum (\d+) mana streams and you think you can reinforce it with (\d+) more/i
calculate_mana(Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, discern_data, data['cyclic'], settings)
calculate_mana(Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, discern_data, data['cyclic'] || data['ritual'], settings)
end
end
pause 1
Expand All @@ -734,7 +734,7 @@ module DRCA
data
end

def calculate_mana(min, more, discern_data, cyclic, settings)
def calculate_mana(min, more, discern_data, cyclic_or_ritual, settings)
total = min + more
total = (total * settings.prep_scaling_factor).floor
discern_data['mana'] = [(total / 5.0).ceil, min].max
Expand All @@ -759,7 +759,7 @@ module DRCA
discern_data['mana'] = discern_data['mana'] + (remaining - total_cambrinth_cap)
remaining = total - discern_data['mana']
end
if cyclic || total_cambrinth_charges == 0
if cyclic_or_ritual || total_cambrinth_charges == 0
discern_data['cambrinth'] = nil
discern_data['mana'] = discern_data['mana'] + remaining
elsif remaining > 0
Expand Down
Loading

0 comments on commit bc2e69b

Please sign in to comment.