-
Notifications
You must be signed in to change notification settings - Fork 177
/
clerk-tools.lic
95 lines (84 loc) · 3.15 KB
/
clerk-tools.lic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
custom_require.call(%w[common common-crafting common-travel])
class Clerk
def initialize
arg_definitions = [
[
{ name: 'toolset', regex: /forging|outfitting|engineering|alchemy|enchanting|custom=\w+/i, description: 'What set <forging outfitting engineering alchemy enchanting custom={set}> of tools to use.' },
{ name: 'action', options: %w[get store], description: 'Whether to get tools, or store them with the clerk' }
]
]
args = parse_args(arg_definitions)
action = args.action
if args.toolset.include?('=')
custom_toolset = args.toolset.split('=')[1].to_s
else
custom_toolset = nil
end
settings = get_settings
hometown = settings.force_crafting_town || settings.hometown
@bag = settings.crafting_container
@bag_items = settings.crafting_items_in_container
crafting_data = get_data('crafting')
if !custom_toolset.nil?
if !settings.custom_clerk_tools.include?(custom_toolset)
echo "Could not find custom toolset labeled #{custom_toolset}"
exit
end
tools = settings.custom_clerk_tools[custom_toolset][:tool_list]
area = settings.custom_clerk_tools[custom_toolset][:area]
@belt = nil
elsif args.toolset == 'engineering'
tools = settings.shaping_tools
area = 'shaping'
@belt = settings.engineering_belt
elsif args.toolset == 'outfitting'
tools = settings.outfitting_tools
area = 'tailoring'
@belt = settings.outfitting_belt
elsif args.toolset == 'forging'
tools = settings.forging_tools
area = 'blacksmithing'
@belt = settings.forging_belt
elsif args.toolset == 'alchemy'
tools = settings.alchemy_tools
area = 'remedies'
@belt = settings.alchemy_belt
elsif args.toolset == 'enchanting'
tools = settings.enchanting_tools
area = 'artificing'
@belt = settings.enchanting_belt
end
roomnumber = crafting_data[area][hometown]['repair-room']
repairnpc = crafting_data[area][hometown]['repair-npc']
if action == 'store'
store_tools(tools, roomnumber)
elsif action == 'get'
get_tools(tools, roomnumber, repairnpc)
else
echo 'Unknown action'
end
end
def get_tools(tools, roomnumber, repairnpc)
DRCT.walk_to(roomnumber)
tools.each do |tool|
case DRC.bput("ask #{repairnpc} for #{tool}", 'Ah, yes, we have one of your tools like that', 'Ah, yes, we have several of your tools like that', "It doesn't look like we have anything like that")
when 'Ah, yes, we have one of your tools like that'
DRCC.stow_crafting_item(tool, @bag, @belt)
when 'Ah, yes, we have several of your tools like that'
# #Sack
end
end
end
def store_tools(tools, roomnumber)
echo roomnumber
DRCT.walk_to(roomnumber)
tools.each do |tool|
DRCC.get_crafting_item(tool, @bag, @bag_items, @belt)
case DRC.bput("put #{tool} on counter", 'Feel free to come back for your item any time', "You don't have enough space in your storage")
when "You don't have enough space in your storage"
DRCC.stow_crafting_item(tool, @bag, @belt)
end
end
end
end
Clerk.new