forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clerk-tools.lic
87 lines (73 loc) · 2.45 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
custom_require.call(%w[drinfomon equipmanager common common-crafting common-items common-travel])
class Clerk
include DRC
include DRCC
include DRCI
include DRCT
def initialize
arg_definitions = [
[
{ name: 'toolset', options: %w[forging outfitting engineering], description: 'What 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
settings = get_settings
hometown = settings.hometown
@bag = settings.crafting_container
crafting_data = get_data('crafting')
if args.toolset == 'engineering'
tools = settings.shaping_tools
area = 'shaping'
@belt = settings.engineering_belt
end
if args.toolset == 'outfitting'
tools = settings.outfitting_tools
area = 'tailoring'
@belt = settings.outfitting_belt
end
if args.toolset == 'forging'
tools = settings.forging_tools
area = 'blacksmithing'
@belt = settings.forging_belt
end
if args.toolset == 'alchemy'
tools = settings.alchemy_tools
area = 'remedies'
@belt = settings.alchemy_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 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'
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|
get_crafting_item(tool, @bag, @belt, @belt)
case 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"
stow_crafting_item(tool, @bag, @belt)
end
end
end
end
Clerk.new