forked from brycole/gemstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeprecated_code.lic
More file actions
118 lines (104 loc) · 5.8 KB
/
deprecated_code.lic
File metadata and controls
118 lines (104 loc) · 5.8 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
def vaalin_lockpick()
vaalin_error = false
if !GameObj.inv.find {|i| i.name =~ /twisted-wire vaalin bracelet/}.nil?
hand_location = 'none'
hand_location = 'left' if lefthand.nil?
hand_location = 'right' if righthand.nil?
bput 'rub my vaalin bracelet', 'Your vaalin bracelet begins'
vaalin_error = 'get_error' if (hand_location == 'right' and GameObj.right_hand.name != 'vaalin lockpick') or (hand_location == 'left' and GameObj.left_hand.name != 'vaalin lockpick')
elsif GameObj.right_hand.name == 'vaalin lockpick' or GameObj.left_hand.name == 'vaalin lockpick'
bput 'pull my vaalin lockpick', 'As you pull on your vaalin'
vaalin_error = 'wear_error' if GameObj.inv.find {|i| i.name =~ /twisted-wire vaalin bracelet/}.nil?
else
vaalin_error = 'get_error'
end
if vaalin_error == 'get_error'
echo "Error in vaalin lockpick script 'get'. Pausing until user can intervene."
echo "There is no lockpicks in your hands. right: #{righthand} left: #{lefthand}"
elsif vaalin_error == 'wear_error'
echo "The vaalin bracelet is not located in the inventory. Something is wrong. Pausing until user can interview."
end
pause_script 'tpick' if vaalin_error
end
module_function :vaalin_lockpick
def vaalin_lockpick(swap_pick)
vaalin_error = false
if swap_pick == 'recover'
if GameObj.inv.find {|i| i.name =~ /twisted-wire vaalin bracelet/}.nil?
bput 'get my vaalin lockpick', "^You (get|reach|grab|already)|^Get what"
abort if GameObj.right_hand.name == 'vaalin lockpick' or GameObj.left_hand.name == 'vaalin lockpick' and @old_swap == 'get'
bput 'get my vaalin bracelet', "^You (get|reach|grab|already)|^Get what"
if GameObj.right_hand.name == 'vaalin bracelet' or GameObj.left_hand.name == 'vaalin bracelet'
bput 'wear my vaalin bracelet', "^You (attach|are)"
if GameObj.inv.find {|i| i.name =~ /twisted-wire vaalin bracelet/}
vaalin_lockpick(@old_swap)
else
vaalin_error = true
end
end
end
end
if swap_pick == 'get' and GameObj.right_hand.name != 'vaalin lockpick' and GameObj.left_hand.name != 'vaalin lockpick'
if GameObj.inv.find {|i| i.name =~ /twisted-wire vaalin bracelet/}
bput 'rub my vaalin bracelet', 'Your vaalin bracelet begins'
else
@old_swap = 'get'
vaalin_lockpick('recover')
end
end
if swap_pick == 'stow' and GameObj.inv.find {|i| i.name =~ /twisted-wire vaalin bracelet/}.nil?
if GameObj.right_hand.name == 'vaalin lockpick' or GameObj.left_hand.name == 'vaalin lockpick'
bput 'pull my vaalin lockpick', 'As you pull on your vaalin'
else
@old_swap ='stow'
vaalin_lockpick('recover')
end
end
if vaalin_error and old_swap = 'get'
echo "Error in vaalin lockpick script 'get'. Pausing until user can intervene."
echo "There is no lockpicks in your hands. right: #{righthand} left: #{lefthand}"
elsif vaalin_error and old_swap = 'stow'
echo "The vaalin bracelet is not located in the inventory. Something is wrong. Pausing until user can interview."
end
pause_script 'tpick' if vaalin_error
end
module_function :vaalin_lockpick
#GameObj.inv.find {|i| @remove_item = i if i.name =~ /coral and emerald crown/}; (put "_drag ##{@remove_item.id} ##{GameObj[/satchel/].id}"; waitrt?; @remove_item = nil) if !@remove_item.id.nil?
#GameObj.inv.find {|i| @remove_item = i if i.name =~ /plain star ruby bracelet/}; (put "_drag ##{@remove_item.id} ##{GameObj[/satchel/].id}"; waitrt? @remove_item = nil) if !@remove_item.id.nil?
#GameObj.inv.find {|i| @remove_item = i if i.name =~ /twisted-wire vaalin bracelet/}; (put "_drag ##{@remove_item.id} ##{GameObj[/harness/].id}"; waitrt?) if !@remove_item.id.nil?
#GameObj[i.id].contents.find{|z| @wear_items << z.id if z.name =~ /plain star ruby bracelet/ }
#GameObj[i.id].contents.find{|z| @wear_items << z.id if z.name =~ /tooled sterling silver pin/ }
#GameObj[i.id].contents.find{|z| @wear_items << z.id if z.name =~ /copper and smoky topaz buckle/ }
#GameObj[i.id].contents.find{|z| @wear_items << z.id if z.name =~ /ivory and pink sapphire pin/ }
#GameObj[i.id].contents.find{|z| @wear_items << z.id if z.name =~ /flame-cut red dreamstone clasp/ }
#GameObj[containers.id].contents.find{|contents| @wear_items << contents.id if contents.name =~ /full plate/}
get_all_containers.each{|containers|
fput "look in #{containers}"
## Enhancive start
if !running? 'treasure_hunt'
$combat_enhancives.each {|enhancive|
GameObj[containers.id].contents.find{|contents|
@wear_items << contents if contents.name =~ /#{enhancive}/
}
}
end
## Armor start
GameObj[containers.id].contents.find{|contents| @wear_items << contents if contents.name =~ /full plate/}
GameObj[containers.id].contents.find{|contents| @wear_items << contents if contents.name =~ /greathelm/} if !running? 'treasure_hunt'
}
def get_all_containers
containers=nil
action = proc { |server_string|
if server_string =~ /^You are wearing/
containers = server_string.scan(/<a exist="([^"]+)"/).flatten
DownstreamHook.remove("get_all_containers")
nil
else
server_string
end
}
DownstreamHook.add("get_all_containers", action)
$_SERVER_.puts "#{$cmd_prefix}inventory containers\n"
wait_until { containers }
containers.collect!{|id| GameObj[id]}
end