muby 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. data/LICENSE +339 -0
  2. data/bin/muby +37 -0
  3. data/contrib/aardmud.org_4000/README.txt +39 -0
  4. data/contrib/aardmud.org_4000/aard-config.rb +234 -0
  5. data/contrib/aardmud.org_4000/aard-helpers.rb +464 -0
  6. data/contrib/aardmud.org_4000/aliases/aard-aliases.rb +205 -0
  7. data/contrib/aardmud.org_4000/gags/aard-gags.rb +182 -0
  8. data/contrib/aardmud.org_4000/misc/aard-affects.rb +252 -0
  9. data/contrib/aardmud.org_4000/misc/aard-know.rb +147 -0
  10. data/contrib/aardmud.org_4000/misc/aard-poznai_sebia.rb +191 -0
  11. data/contrib/aardmud.org_4000/misc/aard-prompts.rb +65 -0
  12. data/contrib/aardmud.org_4000/misc/aard-status_toggling.rb +156 -0
  13. data/contrib/aardmud.org_4000/misc/aard_consider_substitutions.rb +319 -0
  14. data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-hero.rb +86 -0
  15. data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-newbie.rb +98 -0
  16. data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-noble.rb +170 -0
  17. data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas-vidblain.rb +88 -0
  18. data/contrib/aardmud.org_4000/speedwalks/aard-sw-areas.rb +850 -0
  19. data/contrib/aardmud.org_4000/speedwalks/aard-sw-clans.rb +43 -0
  20. data/contrib/aardmud.org_4000/speedwalks/aard-sw-guilds.rb +13 -0
  21. data/contrib/aardmud.org_4000/speedwalks/aard-sw.rb +45 -0
  22. data/contrib/aardmud.org_4000/triggers/aard-triggers-items.rb +254 -0
  23. data/contrib/aardmud.org_4000/triggers/aard-triggers.rb +227 -0
  24. data/contrib/sy/cce.rb +120 -0
  25. data/lib/muby.rb +15 -0
  26. data/lib/muby/application.rb +66 -0
  27. data/lib/muby/completer.rb +62 -0
  28. data/lib/muby/configuration.rb +379 -0
  29. data/lib/muby/connection.rb +332 -0
  30. data/lib/muby/displayer.rb +60 -0
  31. data/lib/muby/help.rb +88 -0
  32. data/lib/muby/helper_methods.rb +46 -0
  33. data/lib/muby/inputwindow.rb +173 -0
  34. data/lib/muby/logger.rb +28 -0
  35. data/lib/muby/outputwindow.rb +189 -0
  36. data/lib/muby/style.rb +142 -0
  37. data/lib/muby/user_methods.rb +463 -0
  38. metadata +90 -0
@@ -0,0 +1,43 @@
1
+ #
2
+ # Clan speedwalks
3
+ #
4
+ # FIXME: Did I miss any clans?
5
+ def _clantouchstone ; _aylor ; run "13s5en2w" end
6
+ def _clanamazon ; _aylor ; run "2sd" end
7
+ def _clanbard ; _aylor ; run "2s4e3sese;echo other stores -- run u2w or usws or us2w" end
8
+ def _clancrusader ; _aylor ; run "sw" end
9
+ def _clandominion ; _aylor ; run "n2w" end
10
+ def _clandaoine ; _aylor ; run "10s4esw2se5sd" end
11
+ def _clanlight ; _aylor ; run "22sd" end
12
+ def _clanpyre ; _aylor ; run "2s4e3s2ed" end
13
+ def _clansoulpyre ; _clanpyre end
14
+ def _clanromani ; _aylor ; run "13s5e2sen" end
15
+ def _clantanelorn ; _aylor ; run "8se" end
16
+ def _clanvanir ; _aylor ; run "ne" end
17
+ def _clanwatchmen ; _aylor ; run "6su" end
18
+ # _south ; run "nu"
19
+ def _clantao ; _south ; run "22su" end
20
+ def _tao ; _clantao end
21
+ def _clanperdition ; _aylor ; run "6sd" end
22
+ def _clanseekers ; _aylor ; run "8su" end
23
+ def _clanimperium ; _aylor ; run "se" end
24
+ def _clancabal ; _aylor ; run "2su" end
25
+ def _clandruid ; _aylor ; run "13s4e5s2u" end
26
+ def _clancrimson ; _aylor ; write "run 13s2w;open south;run 2s" end
27
+ def _clanemerald ; _aylor ; run "5swd" end
28
+ def _clanmasaki ; _aylor ; run "ne" end
29
+ def _clantwinlobe ; _aylor ; run "2neu" end
30
+ def _clanchaos ; _aylor ; run "su" end
31
+ def _clanimperium ; _aylor ; run "se" end
32
+
33
+ def _nopublichall ; pprint "No public hall is listed/known." end
34
+
35
+ def _clandragon ; _nopublichall end
36
+ def _clanbaal ; _nopublichall end
37
+ def _clanxunti ; _nopublichall end
38
+ def _clanrhabdo ; _nopublichall end
39
+ def _clanretri ; _nopublichall end
40
+ def _clanretribution ; _nopublichall end
41
+ def _clanshadokil ; _nopublichall end
42
+ def _clanshadowkill ; _nopublichall end
43
+ def _clanhook ; _nopublichall end
@@ -0,0 +1,13 @@
1
+ #
2
+ # Guild speedwalks
3
+ #
4
+
5
+ def _guildranger ; recall ; run "7s2wu" ; nil end
6
+ def _guildwarrior ; recall ; run "5s2wu" ; nil end
7
+ def _guildcleric ; recall ; run "5sebu" ; nil end
8
+ def _guildthief ; recall ; run "7swsu" ; nil end
9
+ def _guildpaladin ; recall ; run "5s2nu" ; nil end
10
+ def _guildpsionicist ; recall ; run "7s2eu" ; nil end
11
+ def _guildpsi ; _guildpsionicist ; nil end
12
+ def _guildmage ; recall ; run "7sesu" ; nil end
13
+
@@ -0,0 +1,45 @@
1
+ # Getting to the gates in Aylor:
2
+ # The Blessed Aylorian Highway
3
+ # def _north ; _aylor ; write "run 4ne;open north;run 2nw4n" end
4
+ def _north ; _aylor ; write "run 2s8enw" end
5
+ # Eastern High Road
6
+ def _east ; _aylor ; write "run 2s8e" end
7
+ # Western High Road
8
+ def _west ; _aylor ; write "run 2s8w" end
9
+ # Great Andolor Highway
10
+ # def _south ; _aylor ; write "run 23s" end
11
+ def _south ; _aylor ; write "run 2s8esw" end
12
+
13
+
14
+ def _id ; _aylor ; write "run 2s4e2n" end
15
+
16
+ def _unknown
17
+ write "echo this speedwalk is not yet known"
18
+ end
19
+
20
+
21
+
22
+ #
23
+ # Continents
24
+ #
25
+ # While running on the continents, running on roads will generally be faster than running over other land, unless of course you are flying then it makes no difference.
26
+ # Some areas have multiple entrances from the same continent room depending on which direction you enter them.
27
+
28
+ # Gelidus
29
+ def _gelidus ; write "run 4ne;op n;run 2nw3n21n" end
30
+ # Alagh
31
+ def _alagh ; write "run 2s17e2s6en15e" end
32
+ # Abend
33
+ def _abend ; write "run 2s10wn2wn4wn8wn14w" end
34
+ # Southern Ocean
35
+ def _southernocean ; write "run 22s" end
36
+ # Uncharted Ocean
37
+ def _unchartedocean ; write "run 33s31w10s" end
38
+
39
+
40
+
41
+ # Near to Aylor:
42
+ def _angorbridge
43
+ _west
44
+ run "2wn2wn4wn8wn2w"
45
+ end
@@ -0,0 +1,254 @@
1
+ #
2
+ # Helpers for items:
3
+ # bid, rbid, lore, identify and appraise.
4
+ #
5
+
6
+
7
+ # FIXME: When I rbid on something, it outputs the last known variables. It's probably the alias doing it..
8
+ # weight check is getting weird numbers..
9
+
10
+ # TODO: Re-report the cost for the item. Compare the numbers and report the amount of QPs lost/won so far.
11
+ # Save the item into a hash with @item_number as its key, and the value as [@base, @tps]
12
+ # Remort Auction: Bid of (\d+) Qp on .* (Level \d+, Num (\d+)) going (once|twice)\.
13
+ # Remort Auction: .* (Level \d+, Num (\d+)) sold to \w+ for (\d+) Qp\.
14
+
15
+ # /receive "Remort Auction: SySy is selling a level 200 Aardwolf Aura of Sanctuary (Num 3).\n"
16
+ # Remort Auction: Starting bid is 100 Qp\. \(See 'help rbid'\)
17
+ # FIXME: This is busted!
18
+ conf.remote_triggers[/^DISABLED Remort Auction: \w+ is selling a level (\w+) (.*) \(Num (\d+)\)\.$/] = Proc.new do |inwin, outwin, match|
19
+ # FIXME: Bug with this not setting rbid off properly:
20
+ # weight has changed: 10 =>
21
+ # NoMethodError: undefined method `<' for nil:NilClass
22
+
23
+ # @level = match[1]
24
+ @item = match[2]
25
+ @item_number = match[3]
26
+ wasafk = 0
27
+ if $afk == 1 then wasafk == 1 ; afk 0 end
28
+ # Catch all the information:
29
+ id
30
+ # Hijack the next prompt (overwrites what 'id' does)
31
+ conf.remote_triggers[$prompt] = Proc.new do
32
+ rbid_tp_checker
33
+ pprint "A base of #{@base} + #{@tps} TPs = #{@base+(@tps*75)}"
34
+ id_teardown
35
+ end
36
+ # Trigger off the above:
37
+ # write "rbid #{@item_number}"
38
+ # Return me to my afk-ness:
39
+ if wasafk == 1 then afk 1 end
40
+ end
41
+
42
+ # TODO: Item flag changes..
43
+ # TODO: keepflag = 6TPs
44
+ # Catch the difference in hr/dr. Check the level, know the expected hr/dr. When higher, add 1TP cost per point difference.
45
+ # TODO: Work with my level, tiers and the keepflag wish. Note things that are out of my range.
46
+ def rbid_tp_checker
47
+ @tps = 0
48
+ case @item
49
+ when "Axe of Aardwolf" ; @base = 1000 ; original_weight = 20 ; original_type = "axe" ; base_damtype = "cleave" ; base_flag = "vorpal"
50
+ when "Dagger of Aardwolf" ; @base = 1000 ; original_weight = 10 ; original_type = "dagger" ; base_damtype = "pierce" ; base_flag = "sharp"
51
+ when "Flail of Aardwolf" ; @base = 1000 ; original_weight = 25 ; original_type = "flail" ; base_damtype = "beating" ; base_flag = "vampiric"
52
+ when "Halberd of Aardwolf" ; @base = 1000 ; original_weight = 25 ; original_type = "polearm" ; base_damtype = "drain" ; base_flag = "changing"
53
+ when "Mace of Aardwolf" ; @base = 1000 ; original_weight = 20 ; original_type = "mace" ; base_damtype = "pound" ; base_flag = "frost"
54
+ when "Staff of Aardwolf" ; @base = 1000 ; original_weight = 15 ; original_type = "spear" ; base_damtype = "thwack" ; base_flag = "shocking"
55
+ when "Sword of Aardwolf" ; @base = 1000 ; original_weight = 35 ; original_type = "sword" ; base_damtype = "slice" ; base_flag = "flaming"
56
+ when "Whip of Aardwolf" ; @base = 1000 ; original_weight = 15 ; original_type = "whip" ; base_damtype = "shocking bite" ; base_flag = "vampiric"
57
+ when "the Shield of Aardwolf" ; @base = 750 ; original_weight = 25 # I think..
58
+ when "Aardwolf Aura of Sanctuary" ; @base = 2500 ; original_weight = 1
59
+ when "the Amulet of Aardwolf" ; @base = 750 ; original_weight = 4
60
+ when "Aardwolf Bracers of Iron Grip" ; @base = 1750 ; original_weight = 0 # unknown
61
+ when "Aardwolf Gloves of Dexterity" ; @base = 2250 ; original_weight = 10
62
+ when "Aardwolf Boots of Speed" ; @base = 1300 ; original_weight = 2
63
+ when "Wings of Aardwolf" ; @base = 800 ; original_weight = 1
64
+ when "Aardwolf Ring of Invisibility" ; @base = 500 ; original_weight = 1
65
+ when "Aardwolf Ring of Regeneration" ; @base = 1000 ; original_weight = 1
66
+ when "Aardwolf Helm of True Sight" ; @base = 1100 ; original_weight = 5
67
+ when "Aardwolf Breastplate of magic resistance" ; @base = 2000 ; original_weight = 10
68
+ when "Decanter of Endless Water" ; @base = 550 ; original_weight = 0 # unknown
69
+ when "Bag of Aardwolf" ; @base = 1500 ; original_weight = 0 # depends on level.
70
+ end
71
+
72
+ def weight_check(original_weight, current_weight)
73
+ if original_weight != current_weight then pprint "weight has changed: #{original_weight} => #{current_weight}" end
74
+
75
+ # TODO: Make this much more universal.. loop through and figure out how many times I can divide by 2 or multiply by 2..
76
+ if current_weight < original_weight then
77
+ if current_weight <= (original_weight / 2) then pprint "half-weighted (1 time)" ; return 2 end
78
+ if current_weight <= (original_weight / 4) then pprint "half-weighted (2 times)" ; return 4 end
79
+ if current_weight <= (original_weight / 8) then pprint "half-weighted (3 times)" ; return 6 end
80
+ if current_weight <= (original_weight / 16) then pprint "half-weighted (4 times)" ; return 8 end
81
+ if current_weight <= (original_weight / 32) then pprint "half-weighted (5 times)" ; return 10 end
82
+ if current_weight <= (original_weight / 64) then pprint "half-weighted (6 times)" ; return 12 end
83
+ elsif current_weight > original_weight then
84
+ if current_weight >= (original_weight * 64) then pprint "double-weighted (6 times)" ; return 12 end
85
+ if current_weight >= (original_weight * 32) then pprint "double-weighted (5 times)" ; return 10 end
86
+ if current_weight >= (original_weight * 16) then pprint "double-weighted (4 times)" ; return 8 end
87
+ if current_weight >= (original_weight * 8) then pprint "double-weighted (3 times)" ; return 6 end
88
+ if current_weight >= (original_weight * 4) then pprint "double-weighted (2 times)" ; return 4 end
89
+ if current_weight >= (original_weight * 2) then pprint "double-weighted (1 time)" ; return 2 end
90
+ else return 0
91
+ end
92
+ pprint "ERROR: 'weight_check' can't deal with numbers like that.\n current_weight = '#{current_weight}' and original_weight = '#{original_weight}'"
93
+ end
94
+
95
+ # Items which were renamed will bypass the above switch. Catch the proper base value of these items.
96
+ # Check if the damage type, flag or weight has been changed from the default. NOTE: Items which have been renamed will slip through this net.
97
+ case @type
98
+ when "axe"
99
+ base = 1000
100
+ if original_type != "axe" then pprint "weapon type changed" ; @tps += 3 end
101
+ if base_flag != "vorpal" then pprint "weapon flag changed" ; @tps += 2 end
102
+ @tps += weight_check(original_weight, 20)
103
+ when "dagger"
104
+ base = 1000
105
+ if original_type != "dagger" then pprint "weapon type changed" ; @tps += 3 end
106
+ if base_flag != "sharp" then pprint "weapon flag changed" ; @tps += 2 end
107
+ @tps += weight_check(original_weight, 10)
108
+ when "flail"
109
+ base = 1000
110
+ if original_type != "flail" then pprint "weapon type changed" ; @tps += 3 end
111
+ if base_flag != "vampiric" then pprint "weapon flag changed" ; @tps += 2 end
112
+ @tps += weight_check(original_weight, 25)
113
+ when "polearm"
114
+ base = 1000
115
+ if original_type != "polearm" then pprint "weapon type changed" ; @tps += 3 end
116
+ if base_flag != "changing" then pprint "weapon flag changed" ; @tps += 2 end
117
+ @tps += weight_check(original_weight, 25)
118
+ when "mace"
119
+ base = 1000
120
+ if original_type != "mace" then pprint "weapon type changed" ; @tps += 3 end
121
+ if base_flag != "frost" then pprint "weapon flag changed" ; @tps += 2 end
122
+ @tps += weight_check(original_weight, 20)
123
+ when "spear"
124
+ base = 1000
125
+ if original_type != "spear" then pprint "weapon type changed" ; @tps += 3 end
126
+ if base_flag != "shocking" then pprint "weapon flag changed" ; @tps += 2 end
127
+ @tps += weight_check(original_weight, 15)
128
+ when "sword"
129
+ base = 1000
130
+ if original_type != "sword" then pprint "weapon type changed" ; @tps += 3 end
131
+ if base_flag != "flaming" then pprint "weapon flag changed" ; @tps += 2 end
132
+ @tps += weight_check(original_weight, 35)
133
+ when "whip"
134
+ base = 1000
135
+ if original_type != "whip" then pprint "weapon type changed" ; @tps += 3 end
136
+ if base_flag != "vampiric" then pprint "weapon flag changed" ; @tps += 2 end
137
+ @tps += weight_check(original_weight, 15)
138
+ else # non-Aard-weapons
139
+ @tps += weight_check(original_weight, @weight)
140
+ end # case @type
141
+ end # rbid_tp_checker
142
+
143
+
144
+ #
145
+ # Identifying equipment
146
+ #
147
+
148
+ def id
149
+ conf.remote_triggers[/^\| Names : (.+)\|$/] = Proc.new do |inwin, outwin, match| @names = match[1].rstrip end
150
+ conf.remote_triggers[/^\| Desc : (.+)\|$/] = Proc.new do |inwin, outwin, match| @desc = match[1].rstrip end
151
+ conf.remote_triggers[/^\| Type : (.+)Level :\s*(\d+)\s*\|$/] = Proc.new do |inwin, outwin, match| @type = match[1].rstrip ; @level = match[2] end
152
+ conf.remote_triggers[/^\| Worth :\s*(.+)\s*Weight :\s*(\d+)\s*\|$/] = Proc.new do |inwin, outwin, match|
153
+ @worth = match[1].gsub(",", "").rstrip.to_i
154
+ @weight = match[2].to_i
155
+ end
156
+ conf.remote_triggers[/^\| Wearable :\s*(.+)\|$/] = Proc.new do |inwin, outwin, match| @wearable = match[1].rstrip end
157
+ conf.remote_triggers[/^\| Flags :\s*(.+)\|$/] = Proc.new do |inwin, outwin, match| @flags = match[1].rstrip end
158
+ # FIXME: Work with additional rows of flags..
159
+ conf.remote_triggers[/^\| Armor : Pierce :\s*(\d+)\s*Bash :\s*(\d+)\s*\|$/] = Proc.new do |inwin, outwin, match| @pierce = match[1].rstrip ; @bash = match[2] end
160
+ conf.remote_triggers[/^\| Slash :\s*(\d+)\s*Magic :\s*(\d+)\s*\|$/] = Proc.new do |inwin, outwin, match| @slash = match[1].rstrip ; @magic = match[2] end
161
+
162
+ # Hijack the next prompt:
163
+ conf.remote_triggers[$prompt] = Proc.new do
164
+ id_teardown
165
+ end
166
+ # Also write out the string, if this method was called from a local trigger.
167
+ true
168
+ end
169
+
170
+ def id_teardown
171
+ # All of this should fire off on the bottom border. The bottom border is seen once, or twice, depending on the type of item:
172
+ # Not supported: Colour in @names
173
+ pprint @names
174
+ pprint @desc
175
+ pprint @type
176
+ pprint @level
177
+ pprint @worth
178
+ pprint @weight
179
+ pprint @wearable
180
+ pprint @flags
181
+ if @type == "Armor" then
182
+ pprint @pierce
183
+ pprint @bash
184
+ pprint @slash
185
+ pprint @magic
186
+ end
187
+
188
+ conf.remote_triggers.delete(/^\| Names : (.+)\|$/)
189
+ conf.remote_triggers.delete(/^\| Desc : (.+)\|$/)
190
+ conf.remote_triggers.delete(/^\| Type : (.+)Level :\s*(\d+)\s*\|$/)
191
+ conf.remote_triggers.delete(/^\| Worth :\s*(\d+)\s*Weight :\s*(\d+)\s*\|$/)
192
+ conf.remote_triggers.delete(/^\| Wearable :\s*(.+)\|$/)
193
+ conf.remote_triggers.delete(/^\| Flags :\s*(.+)\|$/)
194
+ # FIXME: Work with additional rows of flags..
195
+ conf.remote_triggers.delete(/^\| Armor : Pierce :\s*(\d+)\s*Bash :\s*(\d+)\s*\|$/)
196
+ conf.remote_triggers.delete(/^\| Slash :\s*(\d+)\s*Magic :\s*(\d+)\s*\|$/)
197
+ # Reset all of the prompts:
198
+ prompt_triggers_setup
199
+ end
200
+
201
+
202
+ # This should be user-customized:
203
+ # There doesn't appear to be a simple way to set this. Maybe I need to finger myself? But then I'd have to have a user setting for the name of the character.. so why even bother? I could just make the user set their tier manually..
204
+ $tier = 0
205
+ conf.local_triggers[/^getowned$/] = :getowned
206
+ # This won't work if an item doesn't have a "serial number" - a keyword between brackets.
207
+ def getowned
208
+ gag_all 1
209
+ # Janna's perfect white rose (151412) 1 SySy The Collective Mi
210
+ conf.remote_triggers[/^(.*)\((\w+)\)\s+(\*|)(\d+).*$/] = Proc.new do |inwin, outwin, match|
211
+ # Long names are chopped off by owned.
212
+ name = match[1].rstrip
213
+ # NOTE: This is not always a digit, as the item can be restrung to have an additional keyword in brackets.
214
+ serial_keyword = "(#{match[2]})"
215
+ item_level = match[4].to_i
216
+ # pprint name.inspect
217
+ # pprint serial_keyword.inspect
218
+ # pprint item_level.inspect
219
+ # Check to see if I'm a new remort.
220
+ # if I'm level 1, and the item's level makes it wearable
221
+ if $level == 1 && item_level <= ($level + ($tier * 10)) then
222
+ write "echo #{name} #{serial_keyword}"
223
+ getwear_keep(serial_keyword)
224
+ elsif item_level == (item_level + ($tier * 10)) then
225
+ # If I found something at my current level:
226
+ # Names to ignore:
227
+ case name
228
+ when "A Bag of Aardwolf" ; nil
229
+ when "Decanter of Endless Water" ; nil
230
+ else
231
+ write "echo #{name} #{serial_keyword}"
232
+ end
233
+ getowned_user_exceptions(serial_keyword)
234
+ end
235
+ # Clean up after the end of the owned list.
236
+ conf.remote_triggers[/\[ \d+ \] owned items found\.$/] = Proc.new do
237
+ conf.remote_triggers.delete(/^(.*)\((\w+)\)\s+(\*|)(\d+).*$/)
238
+ conf.remote_triggers.delete(/\[ \d+ \] owned items found\.$/)
239
+ end
240
+ end
241
+ write "owned"
242
+ end
243
+
244
+ # Keywords which are exceptions, e.g. for dualing:
245
+ # TODO: Now the problem here is that it may try to dual the one item before it tries to wield the first.
246
+ def getowned_user_exceptions(serial_keyword)
247
+ case serial_keyword
248
+ when "(example)" ; getdual_keep(serial_keyword) ; pprint "special item exception.."
249
+ else
250
+ getwear_keep(serial_keyword)
251
+ end
252
+ end
253
+
254
+ __END__
@@ -0,0 +1,227 @@
1
+ #
2
+ # Void trigger. The character will never disconnect because of timeouts.
3
+ #
4
+ # NOTE: returning from the void causes your character to stand, and it does not influence your AFK status.
5
+ # However, voiding and coming back doesn't wake one up.
6
+ conf.remote_triggers[/^You disappear into the void\.$/] = Proc.new do |inwin, outwin, match|
7
+ # It's best to turn it off, to avoid unpleasantness.
8
+ afk 0
9
+ # NOTE: Cannot echo while afk.
10
+ if $asleep == 1 then wake end
11
+ write "echo keepalive -- #{Time.new}"
12
+ afk '@YF@Wear @YT@Whe @YV@Woid@Y.@w'
13
+ end
14
+
15
+ conf.remote_triggers[/^QUEST: You may now quest again.$/] = Proc.new do
16
+ p
17
+ # Play music?
18
+ end
19
+ conf.remote_triggers[/^You see no one here but yourself!$/] = Proc.new do write "map" end
20
+
21
+ # Do the obvious thing, when reading notes.
22
+ conf.remote_triggers[/^Changed to board .+ unread note(|s) for you on this board\.$/] = Proc.new do write "note" end
23
+
24
+ # 'this command', 'whatever', 'ftalk', etc... =/
25
+ conf.remote_triggers[/^\*\[AFK\]\* |^You are now in AFK mode\.$/] = Proc.new do $afk = 1 end
26
+ conf.remote_triggers[/You cannot .+ while (afk|AFK)\.$/] = Proc.new do $afk = 1 ; afk 0 ; repeat_history end
27
+
28
+ # When completed a note, get the prompt so that triggers and gags will resume.
29
+ # Note cancelled!
30
+ conf.remote_triggers[/You are back in the game\.$/] = :p
31
+
32
+
33
+ conf.remote_triggers[/^Better stand up first\.$/] = Proc.new do write "stand" ; repeat_history end
34
+ conf.remote_triggers[/^Nah\.\.\. You feel too relaxed\.\.\.$/] = Proc.new do write "stand" ; repeat_history end
35
+ # Push fails for no particular reason. Keep trying:
36
+ conf.remote_triggers[/^You don\'t quite feel up to pushing things around at the moment\.$/] = Proc.new do repeat_history end
37
+
38
+ # Commands while sleeping. Like 'snore' =/
39
+ conf.remote_triggers[/^In your dreams\, or what\?/] = Proc.new do $asleep = 1 ; wake ; repeat_history end
40
+ conf.remote_triggers[/^You dream about being able to/] = Proc.new do $asleep = 1 ; wake ; repeat_history end
41
+
42
+
43
+ # TODO: I don't know if the "intelligence" here actually works yet.
44
+ def repeat_history
45
+ # pprint Muby::InputWindow.get_instance.history[-1]
46
+ # pprint Muby::InputWindow.get_instance.history[-2]
47
+ # If the first character is a slash, then abort!
48
+ if Muby::InputWindow.get_instance.history[-1].split(' ')[0][0..0] == "/" then pprint "not doing #{Muby::InputWindow.get_instance.history[-1].split(' ')[0].inspect}\n" ; return nil end
49
+ # Avoid throwing out something which will send me to recall..
50
+ case Muby::InputWindow.get_instance.history[-1].split(' ')[0]
51
+ # Don't leak a "know" string to the mud!
52
+ when "know" then return nil
53
+ # Let me do /repeat_history manually:
54
+ when "/repeat_history" then
55
+ case Muby::InputWindow.get_instance.history[-2].split(' ')[0]
56
+ when "know" then return nil
57
+ else
58
+ write Muby::InputWindow.get_instance.history[-2]
59
+ end
60
+ else
61
+ write Muby::InputWindow.get_instance.history[-1]
62
+ end
63
+ end
64
+
65
+ # Remember where I am:
66
+ conf.remote_triggers[/^You are in area : (.+)$/] = Proc.new do |inwin, outwin, match| $area = match[1].rstrip end
67
+
68
+ conf.remote_triggers[/^You have been KILLED!!$/] = Proc.new do write "stand" end
69
+ # Untested..
70
+ conf.remote_triggers[/^\*\* For \w+'s interference, you can take revenge on \w+ for \d+ \w+.$/] = Proc.new do write "pkstats" end
71
+
72
+ # Santuary elapse/dispelled -- you could also echo it locally, or just replace the elapse message with something more visible.
73
+ conf.remote_triggers[/^Your brilliant white aura of sanctuary shimmers and is gone\.$/] = Proc.new do write "gtalk @C**@W My sanctuary is gone! @C**@w" end
74
+
75
+
76
+ # Search through triggers.
77
+ def rt_search(s)
78
+ s = ensure_s(s)
79
+ conf.remote_triggers.each { |i|
80
+ if i.inspect =~ /#{s}/ then pprint i.inspect end
81
+ }
82
+ end
83
+ # Use with: /rt_search "string"
84
+
85
+
86
+ # If I try to dual something, then note the dual attempt.
87
+ # NOTE: Variables are not saved between sessions yet.
88
+ # TODO: Do something similar with holding an item.
89
+ conf.local_triggers[/^dual (.+)$/] = Proc.new do |inwin, outwin, match|
90
+ dual match[1]
91
+ false
92
+ end
93
+ def dual(s)
94
+ s = ensure_s(s)
95
+ $dual_attempt = s
96
+ write "dual '#{ensure_s(s)}'"
97
+ end
98
+ # If I successfully dual an item, then note the new dual item.
99
+ conf.remote_triggers[/^You wield .+ in your off-hand\.$/] = :_dual_success
100
+ def _dual_success
101
+ if $dual_attempt == "" then return nil end
102
+ # Intelligently Deal with #.keyword -- 2.axe 20.axe 200.axe etc =)
103
+ # NOTE: This does not deal with the problem of picking up another item with the same keyword, and the resulting stack issues. I miss being able to remove an item and have it be on the top of the inventory stack. =(
104
+ def dual_attempt(n)
105
+ n = ensure_n(n)
106
+ dual_attempt = $dual_attempt[(n+1)..-1]
107
+ # Put the item back on the top of the stack
108
+ write "remove #{dual_attempt}"
109
+ write "give #{$dual_attempt} self"
110
+ # Re-dual the item without the #.keyword:
111
+ dual dual_attempt
112
+ end
113
+ if $dual_attempt[1..1] == "." then dual_attempt(1) end
114
+ if $dual_attempt[2..2] == "." then dual_attempt(2) end
115
+ if $dual_attempt[3..3] == "." then dual_attempt(3) end
116
+ $dual = $dual_attempt.dup
117
+ $dual_attempt = ""
118
+ end
119
+
120
+ # TODO: Don't know how to use..
121
+ # TODO: Barely know how to use..
122
+ conf.remote_triggers[/^You are not carrying that!$|^That really wouldn\'t make a very effective weapon\.$|^You must be level .+ to use .+\.$/] = :_dual_fail
123
+ def _dual_fail
124
+ if $dual_attempt != "" then $dual_attempt = "" end
125
+ end
126
+
127
+ conf.remote_triggers[/^You raise a level!!$/] = :levelup
128
+
129
+ def levelup
130
+ $level += 1
131
+ write "wimpy"
132
+ # TODO: Make this more noticible.
133
+ pprint ">> level #{$level - ($tier * 10)} (#{$level})"
134
+
135
+ # pprint "level #{$level} / 5 = #{$level / 5.0}"
136
+ # pprint " #{$level / 5.0} => #{($level / 5.0) - $level / 5}"
137
+ # Every 5 levels, check my score. This is primarily to get the new $wis_now
138
+ if (($level / 5.0) - $level / 5) == 0.0 then score end
139
+ end
140
+
141
+
142
+ __END__
143
+
144
+ [ 10 minutes of double exp started courtesy of Aardwolf supporters - see 'help donate' ]
145
+
146
+
147
+ --+
148
+
149
+ The Aardwolf gamedriver tells you 'ACK!!! I'm in a loop.
150
+ --- Pfile saved. Qtime reset. Emergency reboot coming up ---
151
+
152
+ --+
153
+
154
+ What be thy name, adventurer?
155
+ <login>
156
+ The game is currently available only to imms.
157
+ This means that either Aardwolf is about to reboot, or, the mud has a
158
+ problem that can only be solved without players online.
159
+
160
+ Please wait a few minutes and try again.
161
+ Thanks for your patience and see you soon! - Immortals of Aardwolf.
162
+
163
+ --+
164
+
165
+ Reboot imminent. Quest time reset and full heal given.
166
+
167
+ -----------------------------------------------------------------------------
168
+ We hope you have enjoyed playing Aardwolf and will return soon. Please check
169
+ out our web site at www.aardwolf.com and maybe even drop in a vote for us
170
+ while you're there.
171
+ -----------------------------------------------------------------------------
172
+
173
+ --+
174
+
175
+ Someone forces you to 'quit quit'.
176
+ Reboot imminent. Quest time reset and full heal given.
177
+
178
+ -----------------------------------------------------------------------------
179
+ We hope you have enjoyed playing Aardwolf and will return soon. Please check
180
+ out our web site at www.aardwolf.com and maybe even drop in a vote for us
181
+ while you're there.
182
+ -----------------------------------------------------------------------------
183
+
184
+ --+
185
+
186
+
187
+
188
+ #
189
+ # Trigger group experimentation (fails)
190
+ #
191
+
192
+ --+ METHOD ONE:
193
+
194
+ groups = []
195
+ conf.remote_triggers[/^\| Names : (.+)\|$/] = Proc.new do |inwin,
196
+ outwin, match|
197
+ @names = match[1].rstrip
198
+ groups << match[0]
199
+ end
200
+
201
+ then I could delete it with:
202
+ group.each { |i|
203
+ conf.remote_triggers.delete(i)
204
+ }
205
+
206
+ However, match[0] is not what I want. Is there a way to easily refer
207
+ to the regex itself?
208
+
209
+ --+ METHOD TWO
210
+
211
+ $trigger_groups = {}
212
+ def group_remote_trigger(group, regex, actions)
213
+ conf.remote_triggers[regex] = Proc.new do |inwin, outwin, match| actions end
214
+ $trigger_groups.merge!({group => regex})
215
+ pprint $trigger_groups.inspect
216
+ end
217
+
218
+ def group_remote_trigger_delete_all(group)
219
+ $trigger_groups[group].each { |i|
220
+ pprint i.inspect
221
+ conf.remote_triggers.delete(i)
222
+ $trigger_groups.delete(group)
223
+ }
224
+ end
225
+
226
+ # /group_remote_trigger("test", '^test$', {pprint match[0]})
227
+ # /group_remote_trigger_delete_all("test")