forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpouch.lic
75 lines (59 loc) · 2.03 KB
/
gpouch.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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#gpouch
=end
custom_require.call(%w[common common-items equipmanager events])
class GivePouches
include DRC
include DRCI
def initialize
arg_definitions = [
[
{ name: 'container', regex: /\w+/i, variable: true, description: 'Name of the container to get pouches from' },
{ name: 'player', regex: /\w+/i, variable: true, description: 'Name of the player to give pouches to' },
{ name: 'sell', regex: /sell/i, variable: true, optional: true, description: 'Sell the pouches to the trader instead' }
]
]
args = parse_args(arg_definitions)
@sell = args.sell
Flags.add('give-accepted', '.* has accepted your offer and is now holding .*')
Flags.add('give-declined', '.* has declined the offer')
Flags.add('give-expired', 'Your offer to .* has expired')
Flags.add('pouch-sold', '.* offers you a tip')
EquipmentManager.new.empty_hands
loop do
case bput("get pouch from #{args.container}", 'You get', 'What were you referring to')
when 'You get'
hand_over(args.player)
when 'What were you referring to'
break
end
end
end
def hand_over(person)
Flags.reset('give-accepted')
Flags.reset('give-expired')
Flags.reset('give-declined')
Flags.reset('pouch-sold')
bput("give pouch to #{person}", '^You offer your .* to')
pause 0.5 until Flags['give-accepted'] || Flags['give-expired'] || Flags['give-declined']
if Flags['give-expired'] || Flags['give-declined']
bput('stow right', 'You put')
exit
end
pause 0.5 until Flags['pouch-sold']
pause 1
bput('accept tip', '^You accept .* tip')
return if @sell
case bput('accept', '^You accept .* offer', 'You have no offers to accept')
when '^You accept .* offer'
dispose_trash('pouch')
end
end
end
before_dying do
Flags.delete('give-accepted')
Flags.delete('give-expired')
Flags.delete('give-declined')
Flags.delete('pouch-sold')
end
GivePouches.new