Skip to content

Commit

Permalink
[script][burgle] Added portable trashcan functionality
Browse files Browse the repository at this point in the history
Added the ability to use a portable trashcan to dispose of items. To use use `loot: trashcan` within `burgle_settings:`
```
burgle_settings:
  loot: trashcan  # drop | keep | bin | pawn | trashcan   default: keep, trashcan is for using a portable trashcan
```
Requires `worn_trashcan:` and `worn_trashcan_verb:` to also be set. Example settings:
```
worn_trashcan: silversteel bucket
worn_trashcan_verb: tap
```
  • Loading branch information
hat071af authored Aug 4, 2024
1 parent b60b83c commit bda8d86
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions burgle.lic
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Burgle
{ name: 'start', regex: /start/, optional: false, description: 'Required: prevents accidentally running burgle and protects against burgle typo for starting script' },
{ name: 'entry', options: %w[lockpick rope cycle prioritylockpick priorityrope], optional: true, description: 'Override yaml setting for entry_type.' },
{ name: 'roomid', regex: /\d+/, optional: true, description: 'Override yaml setting and go to room id (#) specified. The room should be chosen VERY carefully.' },
{ name: 'loot_type', options: %w[drop keep pawn bin], optional: true, description: 'Override yaml setting for loot. (items on item_whitelist are always kept.)' },
{ name: 'loot_type', options: %w[drop keep pawn bin trashcan], optional: true, description: 'Override yaml setting for loot. (items on item_whitelist are always kept.)' },
{ name: 'hometown', options: $HOMETOWN_LIST, optional: true, description: 'Override yaml hometown settings for bin and pawn. If no bin or pawnshop in that hometown, loot_type will revert to drop.' },
{ name: 'follow', options: %w[follow], optional: true, description: "Follow another player, don't actually burgle. You must group with them first." }
]
Expand Down Expand Up @@ -68,11 +68,23 @@ class Burgle
@max_priority_mindstate = @burgle_settings['max_priority_mindstate'] || 26
@rope_adjective = @burgle_settings['rope_adjective'] || 'heavy'
@loot_room_id = nil
@worn_trashcan = @settings.worn_trashcan
@worn_trashcan_verb = @settings.worn_trashcan_verb


# set yaml settings unless being overridden from the command line arguments
@entry_type = args.entry || @burgle_settings['entry_type']
@burgle_room = args.roomid ? args.roomid.to_i : @burgle_settings['room']
@loot_type = args.loot_type || @burgle_settings['loot']
case @loot_type
when /trashcan/
if @worn_trashcan && @worn_trashcan_verb
@loot_container = @worn_trashcan
else
echo("The `loot_type: trashcan` setting requires the base.yaml`worn_trashcan:` and `worn_trashcan_verb:` settings to be set in your yaml.")
exit
end
end
@hometown = args.hometown || @burgle_settings['hometown'] || @settings.burgle_town || @settings.fang_cove_override_town || @settings.hometown
@burgle_before_scripts = @burgle_settings['before']
@burgle_after_scripts = @burgle_settings['after']
Expand Down Expand Up @@ -479,10 +491,10 @@ class Burgle

# ripped out of steal.lic
def put_item?(item)
case DRC.bput("put my #{item} in my #{@loot_container}", 'What were you', 'You put', "You can't do that", "You can't put that there", 'no matter how you arrange it', 'even after stuffing', 'The .* is *.* too \w+ to fit in', 'There isn\'t any more room', 'perhaps try doing that again', 'That\'s too heavy to go in there', "^Weirdly, you can't manage", "^There's no room")
case DRC.bput("put my #{item} in my #{@loot_container}", 'What were you', 'You put', 'You drop', "You can't do that", "You can't put that there", 'no matter how you arrange it', 'even after stuffing', 'The .* is *.* too \w+ to fit in', 'There isn\'t any more room', 'perhaps try doing that again', 'That\'s too heavy to go in there', "^Weirdly, you can't manage", "^There's no room")
when 'perhaps try doing that again'
return put_item?(item)
when 'You put'
when 'You put', 'You drop'
return true
when 'What were you'
handheld = held_item(item)
Expand Down Expand Up @@ -545,25 +557,30 @@ class Burgle

def process_loot
# return if loot_type isn't one of the supported process kind
return if @loot_type !~ /drop|pawn|bin/
return if @loot_type !~ /drop|pawn|bin|trashcan/
# return if loot_list is empty.
return if @loot_list.empty?

DRCT.walk_to(@loot_room_id) unless @loot_room_id == nil

@loot_list.each do |item|
case DRC.bput("get #{item} from my #{@loot_container}", 'You get', 'What were you referring to?')
when /^You get/
case @loot_type
when 'bin'
DRC.bput("put #{item} in bin", 'nods toward you as your .* falls into the .* bin')
when 'pawn'
pawn_item(item)
when 'drop'
drop_item(item)
if @loot_type['trashcan']
DRC.bput("#{@worn_trashcan_verb} my #{@worn_trashcan}", 'You drum your fingers', 'You pull a lever', 'You poke your finger around', 'I could not find')
DRC.bput("#{@worn_trashcan_verb} my #{@worn_trashcan}", 'You drum your fingers', 'You pull a lever', 'You poke your finger around', 'I could not find')
else
@loot_list.each do |item|
case DRC.bput("get #{item} from my #{@loot_container}", 'You get', 'What were you referring to?')
when /^You get/
case @loot_type
when 'bin'
DRC.bput("put #{item} in bin", 'nods toward you as your .* falls into the .* bin')
when 'pawn'
pawn_item(item)
when 'drop'
drop_item(item)
end
when /^What were you referring to/ # handle items that stack/missing items
next
end
when /^What were you referring to/ # handle items that stack/missing items
next
end
end
end
Expand Down

0 comments on commit bda8d86

Please sign in to comment.