-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSafesHelp.xml
More file actions
478 lines (433 loc) · 13.7 KB
/
SafesHelp.xml
File metadata and controls
478 lines (433 loc) · 13.7 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, March 16, 2021, 12:38 PM -->
<!-- MuClient version 5.06 -->
<!-- Plugin "SafesHelp" generated by Plugin Wizard -->
<muclient>
<plugin
name="SafesHelp"
author="Kalu"
id="847136fcdc142894af623298"
language="Lua"
purpose="A couple of aids to cracking safes"
save_state="y"
date_written="2021-03-16 12:37:07"
requires="5.06"
version="1.1"
>
<description trim="y">
<![CDATA[
A couple of aids to cracking safes
1.1 Graphical window instead of text hyperlinks for dial safes.
1.0 Initial build
]]>
</description>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
custom_colour="15"
enabled="y"
group="safes"
match="^You finish your study of the (.*?) and believe you have the skills necessary to crack it open\.$"
regexp="y"
sequence="100"
>
</trigger>
<trigger
enabled="y"
group="safes"
match="^You hear a satisfying \"Clunk\" as you dial the final combination\.$"
regexp="y"
sequence="100"
script="DialsafeUnlocked"
>
</trigger>
<trigger
custom_colour="7"
enabled="y"
group="safes"
match="^You spend ages studying the (.*?) but eventually give up\, not knowing how to proceed\.$"
regexp="y"
sequence="100"
>
</trigger>
<trigger
custom_colour="5"
enabled="y"
group="safes"
match="^You turn the dial (.*?) from (.*?) to (.*?)\.$"
regexp="y"
send_to="12"
sequence="100"
script="GetSafeVariables"
>
</trigger>
<trigger
custom_colour="5"
enabled="y"
group="safes"
match="^The safe has a classic three-wheel tumbler lock with (.*?) dial rotations will unlock the safe\.$"
regexp="y"
send_to="12"
sequence="100"
script="StartDialSafe"
>
</trigger>
<trigger
custom_colour="5"
enabled="y"
group="safes"
match="^You stop attempting to crack the safe\.$"
regexp="y"
send_to="12"
sequence="100"
script="CancelCrack"
>
</trigger>
<trigger
custom_colour="6"
enabled="y"
group="safes"
match="^(\.*?)Click(\.*?)$"
regexp="y"
send_to="12"
sequence="100"
script="ClickFound"
>
</trigger>
</triggers>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="SafesHelp:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
function StartDialSafe ()
Note ("Setting safe dial to zero")
Execute ("dc 99")
Execute ("dc 0")
end -- function StartDialSafe
function CancelCrack ()
ClearTags ()
WindowShow (win, false)
end -- function CancelCrack
function DialsafeUnlocked()
Note ("Success! Cancelling queued commands and raiding the safe.")
DialSafeComplete ()
end -- function DialsafeUnlocked
function GetSafeVariables (name, line, wildcards)
local direction = wildcards[1]
local from = tonumber(wildcards[2])
local to = tonumber(wildcards[3])
UpdateDialSafeWindow (direction, from, to)
end -- function
function UpdateDialSafeWindow (direction, from, to)
SetVariable ("direction", direction)
SetVariable ("from", from)
SetVariable ("to", to)
local backback = to - 10
if (backback < 0) then
backback=backback + 100
end -- if
local forwardforward = to + 10
if (forwardforward > 99) then
forwardforward=forwardforward - 100
end -- if
local back = to -1
if (back < 0) then
back = back + 100
end -- if
local forward = to +1
if (forward > 99) then
forward = forward - 100
end -- if
local back5 = to -5
if (back5 < 0) then
back5 = back5 + 100
end -- if
local forward5 = to +5
if (forward5 > 99) then
forward5 = forward5 - 100
end -- if
WindowCreate (win, 0, 0, 800, 80, miniwin.pos_center_all, 0, ColourNameToRGB("white"))
-- Create Close 'X'
FontColour = ColourNameToRGB("red")
---Set fonr for close X
WindowFont (win, "f", "Trebuchet MS", 12, false, false, false, false) -- define font
---Set font for window
WindowText (win, "f", "X", 10, 10, 0, 0, FontColour, false)
--create close X hotspot
WindowAddHotspot(win, "close",
10, 10, 20, 30,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"Close window", -- hint text if they hover over it
miniwin.cursor_hand, 0)
--Add hyperlinks to window
---font green
FontColour = ColourNameToRGB("green")
--- back 10
WindowText (win, "f", "Back 10 to " .. backback, 10, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 105, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "turn dial clockwise to " .. backback,
10, 30, 105, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"turn dial clockwise to " .. backback, -- hint text if they hover over it
miniwin.cursor_hand, 0)
---back 5
WindowText (win, "f", "Back 5 to " .. back5, 120, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 205, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "turn dial clockwise to " .. back5,
120, 30, 205, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"turn dial clockwise to " .. back5, -- hint text if they hover over it
miniwin.cursor_hand, 0)
---back 1
WindowText (win, "f", "Back 1 to " .. back, 220, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 305, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 205, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "turn dial clockwise to " .. back,
220, 30, 305, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"turn dial clockwise to " .. back, -- hint text if they hover over it
miniwin.cursor_hand, 0)
---zero
WindowText (win, "f", "Zero", 320, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 350, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "dc 0" ,
320, 30, 350, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"dc 0", -- hint text if they hover over it
miniwin.cursor_hand, 0)
---forward 1
WindowText (win, "f", "Forward 1 to " .. forward, 365, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 475, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "turn dial anticlockwise to " .. forward,
360, 30, 480, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"turn dial anticlockwise to " .. forward, -- hint text if they hover over it
miniwin.cursor_hand, 0)
---forward 5
WindowText (win, "f", "Forward 5 to " .. forward5, 490, 30, 0, 0, FontColour, false)
WindowText (win, "f", " | ", 600, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "turn dial anticlockwise to " .. forward5,
490, 30, 600, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"turn dial anticlockwise to " .. forward5, -- hint text if they hover over it
miniwin.cursor_hand, 0)
---forward 10
WindowText (win, "f", "Forward 10 to " .. forwardforward, 620, 30, 0, 0, FontColour, false)
WindowAddHotspot(win, "turn dial anticlockwise to " .. forwardforward,
610, 30, 750, 50,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"turn dial anticlockwise to " .. forwardforward, -- hint text if they hover over it
miniwin.cursor_hand, 0)
-- Tag numbers
FoundNumber = GetVariable ("FoundNumber") or "false"
if (FoundNumber == "true") then
FoundNumber = true
else
FoundNumber = false
end -- if
WindowFont (win, "f", "Trebuchet MS", 12, FoundNumber, false, false, false) -- define font
WindowText (win, "f", "Tag " .. to .. "|", 10, 60, 0, 0, FontColour, false)
WindowAddHotspot(win, "AddTag " .. to,
10, 60, 60, 90,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"AddTag " .. to, -- hint text if they hover over it
miniwin.cursor_hand, 0)
FoundNumber = false
SetVariable ("FoundNumber", "false")
WindowFont (win, "f", "Trebuchet MS", 12, false, false, false, false) -- define font
--- clear last tag
WindowText (win, "f", "Clear Last Tag |", 65, 60, 0, 0, FontColour, false)
WindowAddHotspot(win, "ClearLast",
65, 60, 160, 90,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"Clear last tag", -- hint text if they hover over it
miniwin.cursor_hand, 0)
--- clear tags - perhaps only show if there are tags
WindowText (win, "f", "Clear All Tags |", 180, 60, 0, 0, FontColour, false)
WindowAddHotspot(win, "ClearTags",
165, 60, 280, 90,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"Clear all tags", -- hint text if they hover over it
miniwin.cursor_hand, 0)
--- dtry tags
if (#tags == 3) then
ThreeTagged = true
else
ThreeTagged = false
end -- if
WindowFont (win, "f", "Trebuchet MS", 12, ThreeTagged, false, false, false) -- define font
WindowText (win, "f", "Try Tagged Numbers |", 290, 60, 0, 0, FontColour, false)
WindowAddHotspot(win, "dtry " .. table.concat (tags, ' '),
290, 60, 400, 90,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"MouseDown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
"dtry " .. table.concat (tags, ' '), -- hint text if they hover over it
miniwin.cursor_hand, 0)
--- display tags
---if tags then
----- build TagsString
WindowFont (win, "f", "Trebuchet MS", 12, false, false, false, false) -- define font
TagsString = "dtry " .. table.concat (tags, ' ')
WindowText (win, "f", TagsString, 450, 60, 0, 0, FontColour, false)
WindowFont (win, "f", "Trebuchet MS", 12, false, false, false, false) -- define font
Redraw ()
WindowShow (win, true)
end -- function UpdateDialSafeWindow
function ClickFound ()
FoundNumber = "true"
SetVariable("FoundNumber", "true")
end -- function ClickFound
function MouseDown (name, line, wildcards)
if (line == "close") then
DialSafeComplete ()
elseif (string.match (line,"AddTag")) then
Tag (line)
elseif (string.match (line,"ClearLast")) then
ClearLast ()
elseif (string.match (line,"ClearTags")) then
ClearTags ()
else
Send (line)
end -- if
direction = GetVariable ("direction")
from = GetVariable ("from")
to = GetVariable ("to")
UpdateDialSafeWindow (direction, from, to)
end -- function MouseDown
function ClearLast ()
tags [#tags] = nil
RefreshTags ()
end -- function ClearLast
function ClearTags ()
for k in pairs (tags) do
tags [k] = nil
end -- for
RefreshTags ()
end -- function ClearTags
function RefreshTags ()
TagsString = ""
if (table.getn(tags) > 0) then
TagsString = "dtry " .. table.concat (tags, ' ')
WindowText (win, "f", TagsString, 450, 60, 0, 0, FontColour, false)
WindowShow (win, false)
WindowShow (win, true)
Repaint ()
end -- if
end -- function RefreshTags
function DialSafeComplete()
Execute("stop queue")
Execute("stop queue")
Execute("raidsafe")
ClearTags ()
WindowShow (win, false)
end -- function DialSafeComplete
function Tag (tagline)
tag = string.match (tagline,"%d+")
if (table.getn (tags) < 3) then
unique = true
for k, v in pairs (tags) do
if (tag == v) then
unique = false
end -- if
end -- for
if (unique == true) then
table.insert (tags, tag)
RefreshTags ()
end -- if
end -- if
end -- function Tag
function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
function OnPluginInstall ()
win = "win" .. GetPluginID ()
font_id = "fn"
bold_font_id = "fb"
font_name = "Sylfaen" -- the actual font
font_size = 8
-- make window so I can grab the font info
WindowCreate (win,
0, 0, 0, 0, -- empty window
miniwin.pos_top_left, -- position (irrelevant)
0, -- flags (none)
0) -- background colour (black - irrelevant)
-- add font in normal and bold styles
WindowFont (win, font_id, font_name, font_size,
false, false, false, false, -- normal
miniwin.font_charset_ansi, miniwin.font_family_any)
WindowFont (win, bold_font_id, font_name, font_size,
true, false, false, false, -- bold
miniwin.font_charset_ansi, miniwin.font_family_any)
-- find height of font for future calculations
font_height = WindowFontInfo (win, font_id, 1) -- height
-- Add hotspot for window move
WindowAddHotspot(win, "dragwindow",
0, 0, 20, 20,
"", -- mouseover (do nothing)
"", -- cancelmouseover (do nothing)
"dragmousedown",
"", -- cancelmousedown (do nothing)
"", -- mouseup (do nothing)
hint, -- hint text if they hover over it
miniwin.cursor_hand, 0)
tags ={}
end -- OnPluginInstall
]]>
</script>
</muclient>