muby 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +339 -0
- data/bin/muby +37 -0
- data/contrib/aardmud.org_4000/README.txt +39 -0
- data/contrib/aardmud.org_4000/aard-config.rb +234 -0
- data/contrib/aardmud.org_4000/aard-helpers.rb +464 -0
- data/contrib/aardmud.org_4000/aliases/aard-aliases.rb +205 -0
- data/contrib/aardmud.org_4000/gags/aard-gags.rb +182 -0
- data/contrib/aardmud.org_4000/misc/aard-affects.rb +252 -0
- data/contrib/aardmud.org_4000/misc/aard-know.rb +147 -0
- data/contrib/aardmud.org_4000/misc/aard-poznai_sebia.rb +191 -0
- data/contrib/aardmud.org_4000/misc/aard-prompts.rb +65 -0
- data/contrib/aardmud.org_4000/misc/aard-status_toggling.rb +156 -0
- data/contrib/aardmud.org_4000/misc/aard_consider_substitutions.rb +319 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-hero.rb +86 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-newbie.rb +98 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-noble.rb +170 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-vidblain.rb +88 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas.rb +850 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-clans.rb +43 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw-guilds.rb +13 -0
- data/contrib/aardmud.org_4000/speedwalks/aard-sw.rb +45 -0
- data/contrib/aardmud.org_4000/triggers/aard-triggers-items.rb +254 -0
- data/contrib/aardmud.org_4000/triggers/aard-triggers.rb +227 -0
- data/contrib/sy/cce.rb +120 -0
- data/lib/muby.rb +15 -0
- data/lib/muby/application.rb +66 -0
- data/lib/muby/completer.rb +62 -0
- data/lib/muby/configuration.rb +379 -0
- data/lib/muby/connection.rb +332 -0
- data/lib/muby/displayer.rb +60 -0
- data/lib/muby/help.rb +88 -0
- data/lib/muby/helper_methods.rb +46 -0
- data/lib/muby/inputwindow.rb +173 -0
- data/lib/muby/logger.rb +28 -0
- data/lib/muby/outputwindow.rb +189 -0
- data/lib/muby/style.rb +142 -0
- data/lib/muby/user_methods.rb +463 -0
- metadata +90 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
#
|
2
|
+
# Aliases are "local triggers" which match against what you type at the keyboard.
|
3
|
+
#
|
4
|
+
|
5
|
+
#
|
6
|
+
# These are the ones most likely to annoy users.
|
7
|
+
#
|
8
|
+
# misc.
|
9
|
+
conf.local_triggers[/^donate (.*)$/] = Proc.new do |inwin, outwin, match| write "gdonate #{ensure_s(match[1..-1])}" ; false end
|
10
|
+
# conf.local_triggers[/^newbie (.*)$/] = Proc.new do |inwin, outwin, match| write "snewbie" + ensure_s(match[1..-1]) end
|
11
|
+
conf.local_triggers[/^rep (.*)$/] = Proc.new do |inwin, outwin, match| write "reply #{ensure_s(match[1..-1])}" ; false end
|
12
|
+
conf.local_triggers[/^eval (.*)$/] = Proc.new do |inwin, outwin, match| write "study #{ensure_s(match[1..-1])}" ; false end
|
13
|
+
conf.local_triggers[/^re$/] = Proc.new do write "replay" ; nil end
|
14
|
+
|
15
|
+
|
16
|
+
conf.local_triggers[/^getwear (.*)$/] = Proc.new do |inwin, outwin, match| getwear ensure_s(match[1..-1]) ; false end
|
17
|
+
conf.local_triggers[/^getdual (.*)$/] = Proc.new do |inwin, outwin, match| getdual ensure_s(match[1..-1]) ; false end
|
18
|
+
conf.local_triggers[/^retire (.*)$/] = Proc.new do |inwin, outwin, match| retire ensure_s(match[1..-1]) ; false end
|
19
|
+
|
20
|
+
# little aliases:
|
21
|
+
# So you can copy-and-paste easier:
|
22
|
+
# For when people cut-and-paste from within this scripting.
|
23
|
+
conf.local_triggers[/^write (.*)$/] = Proc.new do |inwin, outwin, match| write match[1..-1] ; false end
|
24
|
+
|
25
|
+
conf.local_triggers[/^openall$/] = Proc.new do open n;open e;open s;open w;open u;open d ; false end
|
26
|
+
conf.local_triggers[/^closeall$/] = Proc.new do close n;close e;close s;close w;close u;close d ; false end
|
27
|
+
conf.local_triggers[/^ca$/] = Proc.new do write "consider all" ; false end
|
28
|
+
# TODO: Allow a specific corpse name to be looted.
|
29
|
+
conf.local_triggers[/^lc$/] = Proc.new do write "get all corpse;sacrifice corpse" ; false end
|
30
|
+
conf.local_triggers[/^recall$/] = Proc.new do recall ; false end
|
31
|
+
conf.local_triggers[/^spring$/] = Proc.new do write "divining" ; false end
|
32
|
+
conf.local_triggers[/^reunite$/] = Proc.new do write "reunion" ; false end
|
33
|
+
# FIXME: / is intercepted by muby.
|
34
|
+
# conf.local_triggers[/^\/$/] = Proc.new do recall ; false end
|
35
|
+
|
36
|
+
conf.local_triggers[/^curep(.*)$/] = Proc.new do |inwin, outwin, match| casting("cure poison", match[1]) ; false end
|
37
|
+
conf.local_triggers[/^cureb(.*)$/] = Proc.new do |inwin, outwin, match| casting("cure blindness", match[1]) ; false end
|
38
|
+
conf.local_triggers[/^prote(.*)$/] = Proc.new do |inwin, outwin, match| casting("protection evil", match[1]) ; false end
|
39
|
+
conf.local_triggers[/^uncurse(.*)$/] = Proc.new do |inwin, outwin, match| casting("remove curse", match[1]) ; false end
|
40
|
+
|
41
|
+
# set up the channels:
|
42
|
+
# because.. who can remember them? =/
|
43
|
+
conf.local_triggers[/^ranger (.*)$/] = Proc.new do |inwin, outwin, match| write "grapevine " + ensure_s(match[1..-1]) ; false end
|
44
|
+
conf.local_triggers[/^warrior (.*)$/] = Proc.new do |inwin, outwin, match| write "wardrums " + ensure_s(match[1..-1]) ; false end
|
45
|
+
conf.local_triggers[/^cleric (.*)$/] = Proc.new do |inwin, outwin, match| write "commune " + ensure_s(match[1..-1]) ; false end
|
46
|
+
conf.local_triggers[/^psi (.*)$/] = Proc.new do |inwin, outwin, match| write "telepathy " + ensure_s(match[1..-1]) ; false end
|
47
|
+
conf.local_triggers[/^psionic (.*)$/] = Proc.new do |inwin, outwin, match| write "telepathy " + ensure_s(match[1..-1]) ; false end
|
48
|
+
conf.local_triggers[/^thief (.*)$/] = Proc.new do |inwin, outwin, match| write "cant " + ensure_s(match[1..-1]) ; false end
|
49
|
+
conf.local_triggers[/^rogue (.*)$/] = Proc.new do |inwin, outwin, match| write "cant " + ensure_s(match[1..-1]) ; false end
|
50
|
+
conf.local_triggers[/^paladin (.*)$/] = Proc.new do |inwin, outwin, match| write "chant " + ensure_s(match[1..-1]) ; false end
|
51
|
+
conf.local_triggers[/^mage (.*)$/] = Proc.new do |inwin, outwin, match| write "inform " + ensure_s(match[1..-1]) ; false end
|
52
|
+
|
53
|
+
def reload ; reload_application! ; false end
|
54
|
+
conf.local_triggers[/^reload$/] = :reload
|
55
|
+
|
56
|
+
# # identification assistance:
|
57
|
+
# conf.local_triggers[/^bid (.*)$|^rbid (.*)$|^id (.*)$|^c id (.*)$|^lore (.*)$/] = Proc.new do
|
58
|
+
# id
|
59
|
+
# afk 0
|
60
|
+
# # Send the original string
|
61
|
+
# true
|
62
|
+
# end
|
63
|
+
|
64
|
+
# Become invisible. Good for speedwalks.
|
65
|
+
# To be customized by the user.
|
66
|
+
conf.local_triggers[/^invis (.*)$/] = Proc.new do |inwin, outwin, match| invis match[1] ; false end
|
67
|
+
def invis(w)
|
68
|
+
w = ensure_w w
|
69
|
+
case w
|
70
|
+
when 0, "0", false, "false", "off", "remove" then invis_off
|
71
|
+
when 1, "1", true, "true", "on", "wear" then invis_on
|
72
|
+
else pprint "ERROR: 'invis' requires valid input. You said: #{w}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
def invis_on ; pprint "become invisible" end
|
76
|
+
def invis_off ; pprint "become visible" end
|
77
|
+
conf.local_triggers[/^vis$/] = Proc.new do vis ; false end
|
78
|
+
def vis ; write "visible" end
|
79
|
+
|
80
|
+
|
81
|
+
# conf.local_triggers[/^bp (\S+)$/] = Proc.new do |inwin, outwin, match| inwin.send("put #{match[1]} in backpack") end
|
82
|
+
|
83
|
+
# Walking through a locked door, then locking it behind you.
|
84
|
+
conf.local_triggers[/^oc (.*)$/] = Proc.new do |inwin, outwin, match| oc match[1] ; false end
|
85
|
+
def oc(c)
|
86
|
+
c = ensure_c c
|
87
|
+
def openclose(c, c2)
|
88
|
+
c = ensure_c c
|
89
|
+
c2 = ensure_c c2
|
90
|
+
# write "open #{c} ; run #{c} ; close #{c2} ; lock #{c2}"
|
91
|
+
open c ; run c ; close c2 ; lock c2
|
92
|
+
end
|
93
|
+
case c
|
94
|
+
when n then openclose(n, s)
|
95
|
+
when e then openclose(e, w)
|
96
|
+
when s then openclose(s, n)
|
97
|
+
when w then openclose(w, e)
|
98
|
+
when u then openclose(u, d)
|
99
|
+
when d then openclose(s, n)
|
100
|
+
else pprint "ERROR: 'oc' requires a valid direction. You said: #{c}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
# A portal helper, to automatically get, use and return a portal from a container.
|
107
|
+
# This can be easily modified to have a default container, or to automatically re-wield or wear+hold.
|
108
|
+
conf.local_triggers[/^portal (.*)$/] = Proc.new do |inwin, outwin, match| portal(match[1], match[2]) ; false end
|
109
|
+
|
110
|
+
# Portal should be updated so that the procedure uses one parameter, and it cuts things apart to get $1 $2 etc, so that my procedures can use 1 or 2 parameters.
|
111
|
+
def portal(*string)
|
112
|
+
gag_all 7
|
113
|
+
# pprint portal + container
|
114
|
+
# Muby::InputWindow.pprint(myportal + container)
|
115
|
+
# I'd like to ensure_s(string[0]) etc, but it generates warnings!
|
116
|
+
myportal = string[0]
|
117
|
+
container = string[1]
|
118
|
+
if myportal == "" then return nil end
|
119
|
+
if container == "" or container == nil then container = $bag end
|
120
|
+
if container == "bag" then container = $bag end
|
121
|
+
asleep 0
|
122
|
+
afk 0
|
123
|
+
if $dual != "" then dual "remove" end
|
124
|
+
getfrom myportal, container
|
125
|
+
hold myportal
|
126
|
+
enter
|
127
|
+
# TODO: if "You can't enter THAT", abort -- bounces.. etc.. ungh.
|
128
|
+
write "remove #{myportal}"
|
129
|
+
putin myportal, container
|
130
|
+
if $dual != "" then dual $dual end
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
conf.local_triggers[/^door (.+)|gate (.+)$/] = Proc.new do |inwin, outwin, match|
|
136
|
+
# TODO: Check class and level, and allow one spell to work like the other.. allow people to use either command..
|
137
|
+
write "cast #{match}"
|
138
|
+
false
|
139
|
+
end
|
140
|
+
|
141
|
+
$questing = false
|
142
|
+
def f5
|
143
|
+
if $questing == false then
|
144
|
+
pprint "Requesting a quest.."
|
145
|
+
afk 0
|
146
|
+
_questor
|
147
|
+
gag_all 2
|
148
|
+
write "quest request;quest info"
|
149
|
+
# TODO: This should be based on a trigger:
|
150
|
+
$questing = true
|
151
|
+
else
|
152
|
+
pprint "Completing this quest.."
|
153
|
+
afk 0
|
154
|
+
_questor
|
155
|
+
gag_all 2
|
156
|
+
write "quest complete"
|
157
|
+
# TODO: This should be based on a trigger:
|
158
|
+
$questing = false
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
# kludge to fix 'p', while afk.
|
164
|
+
conf.local_triggers[/^p$/] = :p
|
165
|
+
def p
|
166
|
+
if $afk == 1 then
|
167
|
+
# TODO: I could gag the two strings:
|
168
|
+
# AFK mode removed. There are no tells waiting for you.
|
169
|
+
# You are now in AFK mode.
|
170
|
+
# but damn that's annoying to do.
|
171
|
+
afk 0
|
172
|
+
afk 1
|
173
|
+
else
|
174
|
+
# I could also write \n
|
175
|
+
# write "\n"
|
176
|
+
write "p"
|
177
|
+
end
|
178
|
+
false
|
179
|
+
end
|
180
|
+
|
181
|
+
# make sure that note reading / writing works correctly:
|
182
|
+
# TODO: Highlight item descriptions.. especially if something is a clanned item:
|
183
|
+
# | Clan Item : From The Hook Clan |
|
184
|
+
conf.local_triggers[/^note(.*)$/] = Proc.new do
|
185
|
+
# Remove all gags and triggers until I get the prompt or afk:
|
186
|
+
disable_gags_and_triggers 1
|
187
|
+
# write out whatever I typed:
|
188
|
+
true
|
189
|
+
end
|
190
|
+
# TODO: Implement an external editor.. or I could even implement an inline Ruby editor which is intelligent about line-wrapping..
|
191
|
+
# nohup kedit [mmucl rc_dir]/_note.temp&
|
192
|
+
# # exec xterm -e nohup kwrite [mmucl rc_dir]/_note.temp\&
|
193
|
+
# }
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
# # Quest request:
|
198
|
+
# You ask Questor for a quest.
|
199
|
+
# Questor tells you 'You're very brave SySy, but let someone else have a chance.'
|
200
|
+
# Questor tells you 'Come back later.'
|
201
|
+
|
202
|
+
# # Quest complete
|
203
|
+
# You inform Questor that you have completed your quest.
|
204
|
+
# Questor tells you 'You're not on a quest right now SySy.'
|
205
|
+
# Questor tells you 'You still have to wait 23 minutes to request one.'
|
@@ -0,0 +1,182 @@
|
|
1
|
+
#
|
2
|
+
# Godlike block-gagging routines!
|
3
|
+
#
|
4
|
+
|
5
|
+
# Note, this stuff will make your ears bleed if you don't have proper $prompt1 and $prompt2 regexes set. See aardwolf_helpers.rb
|
6
|
+
|
7
|
+
# Gag everything from now until the prompt.
|
8
|
+
# Note that triggers are still viable, even if they're gagged from the user's view.
|
9
|
+
# This is automatically undone by the prompt as n elapses.
|
10
|
+
def gag_blocks(n)
|
11
|
+
n = ensure_n(n)
|
12
|
+
# pprint "the next #{n} blocks will be deleted\n"
|
13
|
+
$gag_blocks += n
|
14
|
+
conf.gags << '^(.*)$'
|
15
|
+
conf.anti_gags << $prompt1
|
16
|
+
conf.anti_gags << $prompt2
|
17
|
+
conf.anti_gags << $bprompt1
|
18
|
+
conf.anti_gags << $bprompt2
|
19
|
+
end
|
20
|
+
$gag_blocks = 0
|
21
|
+
def ungag_blocks
|
22
|
+
# Ungagging blocks:
|
23
|
+
# if $gag_block == true then conf.gags.delete('^(.*)$') end
|
24
|
+
if $gag_blocks > 0 then
|
25
|
+
$gag_blocks -= 1
|
26
|
+
# pprint "You have #{$gag_blocks} blocks left\n"
|
27
|
+
if $gag_blocks == 0 then
|
28
|
+
conf.gags.delete '^(.*)$'
|
29
|
+
conf.anti_gags.delete $prompt1
|
30
|
+
conf.anti_gags.delete $prompt2
|
31
|
+
conf.anti_gags.delete $bprompt1
|
32
|
+
conf.anti_gags.delete $bprompt2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Gag n prompts
|
38
|
+
def gag_prompts(n)
|
39
|
+
n = ensure_n(n)
|
40
|
+
# pprint "the next #{n} prompts will be deleted\n"
|
41
|
+
$gag_prompts += n
|
42
|
+
conf.gags << $prompt1
|
43
|
+
conf.gags << $prompt2
|
44
|
+
conf.gags << $bprompt1
|
45
|
+
conf.gags << $bprompt2
|
46
|
+
end
|
47
|
+
$gag_prompts = 0
|
48
|
+
def ungag_prompts
|
49
|
+
if $gag_prompts > 0 then
|
50
|
+
$gag_prompts -= 1
|
51
|
+
# pprint "You have #{$gag_prompts} prompts left\n"
|
52
|
+
if $gag_prompts == 0 then
|
53
|
+
conf.gags.delete $prompt1
|
54
|
+
conf.gags.delete $prompt2
|
55
|
+
conf.gags.delete $bprompt1
|
56
|
+
conf.gags.delete $bprompt2
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Gag absolutely everything, for n prompts.
|
62
|
+
# The n'th prompt will appear.
|
63
|
+
def gag_all(n)
|
64
|
+
n = ensure_n(n)
|
65
|
+
gag_blocks(n)
|
66
|
+
conf.anti_gags.delete $prompt1
|
67
|
+
conf.anti_gags.delete $prompt2
|
68
|
+
conf.anti_gags.delete $bprompt1
|
69
|
+
conf.anti_gags.delete $bprompt2
|
70
|
+
end
|
71
|
+
|
72
|
+
def ungag
|
73
|
+
pprint "ungagging.."
|
74
|
+
$gag_prompts = 0
|
75
|
+
$gag_blocks = 0
|
76
|
+
conf.gags.delete $prompt1
|
77
|
+
conf.gags.delete $prompt2
|
78
|
+
conf.gags.delete $bprompt1
|
79
|
+
conf.gags.delete $bprompt2
|
80
|
+
conf.anti_gags.delete $prompt1
|
81
|
+
conf.anti_gags.delete $prompt2
|
82
|
+
conf.anti_gags.delete $bprompt1
|
83
|
+
conf.anti_gags.delete $bprompt2
|
84
|
+
p
|
85
|
+
end
|
86
|
+
|
87
|
+
# Anti-gagging. Useful for note-related things.
|
88
|
+
$disable_gags = []
|
89
|
+
$disable_gags_blocks = 0
|
90
|
+
def disable_gags_blocks(n)
|
91
|
+
# pprint "disabling gags"
|
92
|
+
$disable_gags = conf.gags
|
93
|
+
conf.gags = []
|
94
|
+
$disable_gags_blocks += n
|
95
|
+
end
|
96
|
+
|
97
|
+
# Note that this will overwrite any gags which were set up in the meantime.
|
98
|
+
def undisable_gags_blocks
|
99
|
+
if $disable_gags_blocks > 0 then
|
100
|
+
$disable_gags_blocks -= 1
|
101
|
+
# pprint "You have #{$disable_gags_blocks} blocks left\n"
|
102
|
+
if $disable_gags_blocks == 0 then
|
103
|
+
if $gags_blocks != []
|
104
|
+
# pprint "restoring gags"
|
105
|
+
conf.gags = $disable_gags
|
106
|
+
$disable_gags = []
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
# Untested:
|
114
|
+
$disable_triggers = {}
|
115
|
+
$disable_triggers_blocks = 0
|
116
|
+
def disable_triggers_blocks(n)
|
117
|
+
# pprint "disabling triggers"
|
118
|
+
$disable_triggers = conf.remote_triggers
|
119
|
+
conf.remote_triggers = {}
|
120
|
+
conf.remote_triggers[$prompt1] = :undisable_triggers_blocks
|
121
|
+
# Another essential:
|
122
|
+
conf.remote_triggers[/You cannot .* while (afk|AFK)\.$/] = Proc.new do $afk = 1 ; afk 0 ; repeat_history end
|
123
|
+
$disable_triggers_blocks += n
|
124
|
+
end
|
125
|
+
|
126
|
+
# Note that this will overwrite any triggers which were set up in the meantime.
|
127
|
+
def undisable_triggers_blocks
|
128
|
+
if $disable_triggers_blocks > 0 then
|
129
|
+
$disable_triggers_blocks -= 1
|
130
|
+
# pprint "You have #{$disable_triggers_blocks} blocks left\n"
|
131
|
+
if $disable_triggers_blocks == 0 then
|
132
|
+
if $disable_triggers != {}
|
133
|
+
# pprint "restoring triggers"
|
134
|
+
conf.remote_triggers = $disable_triggers
|
135
|
+
$disable_triggers = {}
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
def disable_gags_and_triggers(n)
|
143
|
+
disable_gags_blocks n
|
144
|
+
disable_triggers_blocks n
|
145
|
+
conf.remote_triggers[$prompt1] = Proc.new do
|
146
|
+
undisable_gags_blocks
|
147
|
+
undisable_triggers_blocks
|
148
|
+
end
|
149
|
+
conf.remote_triggers[/\*\[AFK\]\*/] = conf.remote_triggers[$prompt1]
|
150
|
+
# Doing this allows the reviving of the trigger which continues to read a note on the next board:
|
151
|
+
conf.remote_triggers[/^Changed to board .* unread note(|s) for you on this board\.$/] = Proc.new do
|
152
|
+
undisable_gags_blocks
|
153
|
+
undisable_triggers_blocks
|
154
|
+
write "note"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
__END__
|
160
|
+
|
161
|
+
Here are some gag examples:
|
162
|
+
|
163
|
+
conf.gags << '^There are few things in this world as breathtaking as the Aylorian skyline at dawn\.$'
|
164
|
+
conf.gags << '^The citizens of the world awaken to a new day\.$'
|
165
|
+
conf.gags << '^\w+ calls the justice of \w+ to strike \w+ foes!$'
|
166
|
+
conf.gags << '^\w+ directs a jet of Marbu poison from (\w|\W)+ sleeves\.$'
|
167
|
+
conf.gags << '^Waves of energy emanate from \w+\.'
|
168
|
+
|
169
|
+
You can delete gags like this:
|
170
|
+
|
171
|
+
conf.gags.delete '^Waves of energy emanate from \w+\.'
|
172
|
+
|
173
|
+
# Imm global-spam:
|
174
|
+
# Dirtworm's globalspam
|
175
|
+
conf.gags << '^\.::\. '
|
176
|
+
|
177
|
+
# Obyron's karaoke
|
178
|
+
conf.gags << '^:::.*(K|k)araoke.*:::$'
|
179
|
+
|
180
|
+
# Poker-spam
|
181
|
+
# I'd love to put "poker" in there, but it seems that this isn't always written..
|
182
|
+
conf.gags << '^\*\* .* \*\*$'
|
@@ -0,0 +1,252 @@
|
|
1
|
+
#
|
2
|
+
# Affects-script
|
3
|
+
#
|
4
|
+
# Intelligently spellup and skillup. Self-only.
|
5
|
+
|
6
|
+
# TODO: Adapt to make it workable on others. Do it the easy way.. and get bunches of "you cannot cast this on another.." (gag that message..)
|
7
|
+
# check out "spells spellup other"
|
8
|
+
# TODO: Provide intelligent exceptions. i.e. if intertial barrier is on, don't try to cast protection good.
|
9
|
+
# This should be easy to implement.
|
10
|
+
|
11
|
+
# To make it efficient, it only works with the names of the spells (and not the number). This works very well when looking at saffects, casting the spell of that name, or removing an existing spell from the array of spell to be cast.
|
12
|
+
|
13
|
+
|
14
|
+
# TODO: Gag saffects to reduce spam?
|
15
|
+
|
16
|
+
# IDEA: I could count the number of spells/skills which need to be used. I could even generate a progress bar on-screen or in the status bar!
|
17
|
+
# Maybe I could make an ETA for the spellup.. that'd be neat.
|
18
|
+
|
19
|
+
def autospellup(b)
|
20
|
+
b = ensure_b(b)
|
21
|
+
if b == true then
|
22
|
+
if $autospellup == false then $autospellup = true ; pprint " # Autospellup is now on" end
|
23
|
+
elsif b == false then
|
24
|
+
if $autospellup == true then $autospellup = false ; pprint " # Autospellup is now off" end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def f11
|
29
|
+
autospellup true
|
30
|
+
end
|
31
|
+
def shift_f11
|
32
|
+
autospellup false
|
33
|
+
end
|
34
|
+
|
35
|
+
def f12 ; _spellup end
|
36
|
+
|
37
|
+
def _affects_cleanup
|
38
|
+
# Automatically re-attempt spells if one of them fails during casting (i.e. "lost concentration")
|
39
|
+
$recasting = false
|
40
|
+
conf.remote_triggers.delete(/^You can already see invisible\.$/)
|
41
|
+
conf.remote_triggers.delete(/^You don't have enough mana to cast .*\.$/)
|
42
|
+
conf.remote_triggers.delete(/^You are not affected by any skills or spells\.$|^You are affected by \d+ skill(|s) and \d+ spell(|s)\.$/)
|
43
|
+
conf.remote_triggers.delete(/^You lost your concentration while trying to cast/)
|
44
|
+
conf.remote_triggers.delete(/^You don't have enough .*\.$|^A powerful force quenches your magic\.|You can\'t concentrate enough\.$/)
|
45
|
+
conf.remote_triggers.delete(/^You are already protected\.$|^You can already /)
|
46
|
+
conf.remote_triggers.delete(/^ \* Recasting\.\.\.$/)
|
47
|
+
conf.gags.delete('^You are affected by the following:$')
|
48
|
+
conf.gags.delete('^You are affected by \d+ skill(s|) and \d+ spell(s|)\.$')
|
49
|
+
conf.gags.delete('^ * Recasting...')
|
50
|
+
conf.gags.delete('^Spell: ')
|
51
|
+
conf.gags.delete('^Skill: ')
|
52
|
+
# All the variables automatically get destroyed when all of this is complete.
|
53
|
+
end
|
54
|
+
# On load, clean things up.. just in case:
|
55
|
+
_affects_cleanup
|
56
|
+
|
57
|
+
|
58
|
+
#Just in case something goes wonky:
|
59
|
+
conf.local_triggers[/^aff$/] = Proc.new do
|
60
|
+
_affects_cleanup
|
61
|
+
write "aff"
|
62
|
+
false
|
63
|
+
end
|
64
|
+
conf.local_triggers[/^saff$/] = Proc.new do
|
65
|
+
_affects_cleanup
|
66
|
+
write "saff"
|
67
|
+
false
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Automatically discover what spellup spells you have access to:
|
72
|
+
# Example: _affects_build_array("spellup") will create the $spells_spellup array.
|
73
|
+
# NOTE: Do not run this multiple times back-to-back!
|
74
|
+
# TODO: Fix this so that the code is more universal (do that '$' + foo + bar trick)
|
75
|
+
def _affects_build_array(type)
|
76
|
+
pprint " # Building an array from spells #{type}"
|
77
|
+
# Gag the output of the list. It's rough, but it works.
|
78
|
+
conf.remote_triggers[/^Level: /] = Proc.new do
|
79
|
+
conf.gags << '.*'
|
80
|
+
# NOTE: There is no safe way to gag the dashed line and extended help.. something has to un-gag everything.
|
81
|
+
end
|
82
|
+
# ACTION
|
83
|
+
conf.remote_triggers[/^(Level:\s+\d+ |\s+)(.*)Mana:.*\d+.*Learned:\s+(\d+)% \(.*\)$/] = Proc.new do |inwin, outwin, match|
|
84
|
+
# IDEA: In theory, I could capture the entire list.. and put it all into a multi-dimensional array.. boy would that be tough.
|
85
|
+
# ([level, spell name, learned], [level, spell name, learned])
|
86
|
+
# Any spellup spells which are learned over 60% will be considered:
|
87
|
+
if match[3].to_i > 60 then
|
88
|
+
# pprint match[2].rstrip.downcase.inspect
|
89
|
+
case type
|
90
|
+
when "spellup" then $spells_spellup << match[2].rstrip.downcase
|
91
|
+
when "healing" then $spells_healing << match[2].rstrip.downcase
|
92
|
+
when "combat" then $spells_combat << match[2].rstrip.downcase
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
# TEARDOWN
|
97
|
+
conf.remote_triggers[/^-----------------------------------------------------------------------$/] = Proc.new do
|
98
|
+
conf.remote_triggers.delete(/^(Level:\s+\d+ |\s+)(.*)Mana:.*\d+.*Learned:\s+(\d+)% \(.*\)$/)
|
99
|
+
conf.remote_triggers.delete(/^-----------------------------------------------------------------------$/)
|
100
|
+
conf.gags.delete('.*')
|
101
|
+
conf.remote_triggers.delete(/^Level: /)
|
102
|
+
case type
|
103
|
+
when "spellup" then
|
104
|
+
$spells_spellup.uniq!
|
105
|
+
if $spells_spellup == nil then pprint "you don't have any spellup spells!" end
|
106
|
+
when "healing" then
|
107
|
+
$spells_healing.uniq!
|
108
|
+
if $spells_healing == nil then pprint "you don't have any healing spells!" end
|
109
|
+
when "combat" then
|
110
|
+
$spells_combat.uniq!
|
111
|
+
if $spells_combat == nil then pprint "you don't have any combat spells!" end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# SETUP
|
116
|
+
case type
|
117
|
+
when "spellup" then $spells_spellup = []
|
118
|
+
when "healing" then $spells_healing = []
|
119
|
+
when "combat" then $spells_combat = []
|
120
|
+
end
|
121
|
+
write "spells #{type}"
|
122
|
+
end # _affects_build_array
|
123
|
+
|
124
|
+
|
125
|
+
# Copy this method to your user scripting, and you can remove or add affects.
|
126
|
+
def _affects_extras
|
127
|
+
# $spells.delete("underwater breathing")
|
128
|
+
# $skills << "clanskill"
|
129
|
+
end
|
130
|
+
|
131
|
+
def _spellup
|
132
|
+
if $spells_spellup == nil then pprint "healing this routine.." ; _affects_build_array("spellup") ; return nil end
|
133
|
+
|
134
|
+
afk 0
|
135
|
+
asleep 0
|
136
|
+
# Prevent multiple simultaneous recasts. $recasting is unset by recast_cleanup
|
137
|
+
# This is to stop dumbasses like me from double-tapping their spellup hotkey.
|
138
|
+
if $recasting == true then pprint "## I'm already recasting!" ; return nil ; end
|
139
|
+
$recasting = true
|
140
|
+
|
141
|
+
# $spells_spellup is automatically populated on startup and levelup.
|
142
|
+
$spells = $spells_spellup.dup
|
143
|
+
$skills = []
|
144
|
+
# User scripting to add/remove spells from $spells and $skills :
|
145
|
+
_affects_extras
|
146
|
+
$spells = $spells.uniq
|
147
|
+
$skills = $skills.uniq
|
148
|
+
# Based on saffects, learn what I'm affected with and remove them from the array of possibilities.
|
149
|
+
_affects_qualify_array
|
150
|
+
|
151
|
+
# SETUP:
|
152
|
+
# Avoid seeing the entire list spammed every time.
|
153
|
+
conf.gags << '^You are affected by the following:$'
|
154
|
+
conf.gags << '^You are affected by \d+ skill(s|) and \d+ spell(s|)\.$'
|
155
|
+
# I don't know why the $ at the end won't work..
|
156
|
+
conf.gags << '^ * Recasting...'
|
157
|
+
conf.gags << '^Spell: '
|
158
|
+
conf.gags << '^Skill: '
|
159
|
+
# Stuff attained from permanent items don't appear in saffects anymore.. =(
|
160
|
+
conf.remote_triggers[/^You can already see invisible\.$/] = Proc.new do $spells.delete("detect invis") end
|
161
|
+
conf.remote_triggers[/^You don't have enough mana to cast .*\.$/] = Proc.new do $spells.clear end
|
162
|
+
# FIXME: Handle all the spells individually, and just remove the spell from the array and continue on with the other spells..
|
163
|
+
# protection good, protection evil, FIXME
|
164
|
+
conf.remote_triggers[/^You are already protected\.$|^You can already /] = Proc.new do $spells.clear end
|
165
|
+
# conf.remote_triggers[/^You can already see magic\.$/] = Proc.new do $spells.delete("detect magic") end
|
166
|
+
conf.remote_triggers[/^You are not affected by any skills or spells\.$|^You are affected by \d+ skill(|s) and \d+ spell(|s)\.$/] = Proc.new do
|
167
|
+
# ACTION:
|
168
|
+
_affects_act_on_array
|
169
|
+
end
|
170
|
+
|
171
|
+
write "saffects"
|
172
|
+
end
|
173
|
+
|
174
|
+
# Catch the output of "saffects", and remove spells from $spells_spellup
|
175
|
+
def _affects_qualify_array
|
176
|
+
# When the saffects list has been displayed, clean up:
|
177
|
+
conf.remote_triggers[/^-----------------------------------------------------------------------$/] = Proc.new do
|
178
|
+
conf.remote_triggers.delete(/^Spell: (.*) \(.*\)$/)
|
179
|
+
conf.remote_triggers.delete(/^Skill: (.*) \(.*\)$/)
|
180
|
+
conf.remote_triggers.delete(/^-----------------------------------------------------------------------$/)
|
181
|
+
end
|
182
|
+
# Spells:
|
183
|
+
conf.remote_triggers[/^Spell: (.*) \(.*\)$/] = Proc.new do |inwin, outwin, match|
|
184
|
+
# pprint "Working with spell: #{match[1]}"
|
185
|
+
$spells.delete(match[1])
|
186
|
+
end
|
187
|
+
# Skills:
|
188
|
+
conf.remote_triggers[/^Skill: (.*) \(.*\)$/] = Proc.new do |inwin, outwin, match|
|
189
|
+
# pprint "Working with skill: #{match[1]}"
|
190
|
+
$skills.delete(match[1])
|
191
|
+
end
|
192
|
+
|
193
|
+
if $spells.include?("protection evil") then $spells_spellup.delete("protection good") end
|
194
|
+
if $spells.include?("protection good") then $spells_spellup.delete("protection evil") end
|
195
|
+
# TODO: That other spell which conflicts with these..
|
196
|
+
|
197
|
+
# anything cast on me has been removed from the arrays
|
198
|
+
# The arrays are now lists of spells which I _don't_ have.
|
199
|
+
end # _affects_qualify_array
|
200
|
+
|
201
|
+
def _affects_act_on_array
|
202
|
+
# Spell failures will get re-inserted back into the spells array.
|
203
|
+
conf.remote_triggers[/^You lost your concentration while trying to cast (.+)\.$/] = Proc.new do |inwin, outwin, match|
|
204
|
+
$spells << match[1].downcase
|
205
|
+
end
|
206
|
+
|
207
|
+
# Prevent infinite recasting loops:
|
208
|
+
conf.remote_triggers[/^You don't have enough .*\.$|^A powerful force quenches your magic\.|You can\'t concentrate enough\.$/] = Proc.new do
|
209
|
+
$spells.clear
|
210
|
+
end
|
211
|
+
|
212
|
+
# Upon completion:
|
213
|
+
conf.remote_triggers[/^ \* Recasting\.\.\.$/] = Proc.new do
|
214
|
+
# pprint $spells.inspect
|
215
|
+
if $spells == [] then
|
216
|
+
write "echo @C * @WRecasting is complete.@w"
|
217
|
+
_affects_cleanup
|
218
|
+
else
|
219
|
+
_affects_cleanup
|
220
|
+
_spellup
|
221
|
+
end
|
222
|
+
end
|
223
|
+
# pprint $spells.inspect
|
224
|
+
$spells.each_index { |i|
|
225
|
+
pprint "Spell: #{$spells[i]}"
|
226
|
+
case $spells[i]
|
227
|
+
# Exceptions:
|
228
|
+
# TODO: Integrate my exceptions list:
|
229
|
+
when "example" then
|
230
|
+
write "echo example"
|
231
|
+
else
|
232
|
+
write "cast '#{$spells[i]}'"
|
233
|
+
$spells.delete $spells[i]
|
234
|
+
end
|
235
|
+
}
|
236
|
+
# pprint $skills.inspect
|
237
|
+
$skills.each_index { |i|
|
238
|
+
pprint "Skill: #{$skills[i]}"
|
239
|
+
case $skills[i]
|
240
|
+
# Exceptions:
|
241
|
+
# TODO: Integrate my exceptions list:
|
242
|
+
when "example" then
|
243
|
+
write "echo example"
|
244
|
+
else
|
245
|
+
write "#{$skills[i]}"
|
246
|
+
$skills.delete $skills[i]
|
247
|
+
end
|
248
|
+
}
|
249
|
+
# Get the server to tell me when I've completed spamming all the skills and spells:
|
250
|
+
# It would be nice if this were avoidable.. but I don't see a way unless I have the scripting understand what spells have what messages, and have it listen for the last message. That'd be annoying to script.
|
251
|
+
write "echo @C * @WRecasting...@w"
|
252
|
+
end ; # _affects_act_on_array
|