· 6 years ago · Jun 10, 2019, 10:54 PM
1<?xml version="1.0" encoding="iso-8859-1"?>
2<!DOCTYPE muclient>
3<!-- Original by Garrion -->
4<!-- Version 3.1 by Ilde, built upon version 2.1 -->
5<!-- MuClient version 4.40 -->
6<!--
7
8This plugin keeps track of how much Major Shield you have. "help majortimer" will display a helpfile with available commands. It's fine to make your own version of this plugin or use parts of it.
9
10-->
11
12<muclient>
13<plugin
14 name="MajorTimer"
15 author="Ilde"
16 id="f6685da86910795e76a1884c"
17 language="Lua"
18 purpose="Shows time remaining on Major shield"
19 save_state="y"
20 date_written="2013-04-28 10:45:35"
21 requires="4.40"
22 version="3.1"
23 >
24<description trim="y">
25<![CDATA[
26Shows the time remaining on your major shield.
27]]>
28</description>
29</plugin>
30
31
32
33<!-- Triggers -->
34<triggers>
35 <trigger
36 enabled="y"
37 match="^You are ((barely |really |perfectly )?protected by the power of|shielded by the protective armour of) (.*)\.$"
38 name="major_up"
39 script="Add_Timer"
40 regexp="y"
41 send_to="12"
42 sequence="100"
43 >
44 </trigger>
45
46 <trigger
47 enabled="y"
48 ignore_case="y"
49 match="^your (divine protection|protective aura) has been (strengthened|extended|weakened)\.$"
50 name="major_extend"
51 script="Add_Timer"
52 regexp="y"
53 sequence="100"
54 >
55 </trigger>
56
57 <!-- These next two signal that you failed the ritual, OR the ritual was on someone else. In either case the ritual modifiers become irrelevant. -->
58 <trigger
59 enabled="y"
60 ignore_case="y"
61 match="^((.*) loses interest in your ritual\.|You sense (.*)'s attention is elsewhere.).$"
62 name="major_fail"
63 script="Canceled"
64 regexp="y"
65 sequence="100"
66 >
67 </trigger>
68
69 <trigger
70 enabled="y"
71 ignore_case="y"
72 match="^((.*) is (protected|really protected) by the power of (.*)|(Its|His|Her) divine protection has been (extended|strengthened|weakened)\.)$"
73 name="major_on_another"
74 script="Canceled"
75 regexp="y"
76 sequence="100"
77 >
78 </trigger>
79
80 <trigger
81 enabled="y"
82 ignore_case="y"
83 match="^ ?\* You are ((barely |really |perfectly )?protected by the power of|shielded by the protective armour of) (.*)\. You will be protected for (.*)\.$"
84 name="shield_check"
85 script="Adjust_Timer"
86 regexp="y"
87 sequence="100"
88 >
89 </trigger>
90
91 <trigger
92 enabled="y"
93 match="Your divine protection expires."
94 name="major_down"
95 script="Clear_Timer"
96 sequence="100"
97 >
98 </trigger>
99
100
101 <trigger
102 enabled="y"
103 match="Your divine protection is weakening."
104 name="major_warning"
105 script="Warning"
106 sequence="100"
107 >
108 </trigger>
109
110
111 <trigger
112 enabled="y"
113 match="You do not have any arcane protection."
114 name="no_major"
115 script="Clear_Timer"
116 sequence="100"
117 >
118 </trigger>
119
120 <!-- Message for the various ritual bonuses and penalties. -->
121 <trigger
122 enabled="y"
123 ignore_case="y"
124 match="^(It seems|You are finding it|You find it) (.*) to perform major shield because (.*)\.$"
125 name="modifier_check"
126 script="adjust_bonus"
127 regexp="y"
128 sequence="100"
129 >
130 </trigger>
131
132
133 <!-- Message when you've just logged in.-->
134 <trigger
135 enabled="y"
136 ignore_case="y"
137 match="You last logged in from * and are currently logged in from *."
138 name="logged_on"
139 script="Unpause_Timer"
140 sequence="100"
141 >
142 </trigger>
143
144 <!-- Message for logging in after disconnecting but not quitting or idling out -->
145 <trigger
146 enabled="y"
147 ignore_case="y"
148 match="You are already playing."
149 name="logged_on_already_playing"
150 script="Already_Playing"
151 sequence="100"
152 >
153 </trigger>
154
155 <!-- Message indicating the next thing you enter will be your character name.-->
156 <trigger
157 enabled="y"
158 ignore_case="y"
159 match="Or, enter your current character's name"
160 name="about_to_log_in"
161 script="Enter_Name"
162 sequence="100"
163 >
164 </trigger>
165
166 <!-- Message indicating the next thing you enter will be your password. Makes the alias to capture stuff turn OFF.-->
167 <trigger
168 enabled="y"
169 ignore_case="y"
170 match=" Where all your dreams can't come true."
171 name="about_to_enter_pass"
172 script="Enter_Password"
173 sequence="100"
174 >
175 </trigger>
176
177
178 <!-- shouldn't need this anymore -->
179 <trigger
180 enabled="n"
181 ignore_case="y"
182 match="^You are (Miss |Mr |Mrs |Ms |Mx |Lonely |Mournful |Scary |Spooky |Wandering |Cheating |Cowardly |Brother |Sister |Mostly Reverend |Reverend |Blessed |Blessed father |Blessed mother |Blessed brother |Blessed sister |Venerable |Venerable brother |Venerable sister |Venerable father |Venerable mother |Holy |Holy brother |Holy sister |Beatus |Saint |Butterfingers |Crafty |Crooked |Dastardly |Dishonest |Dodgy |Elusive |Evasive |Fingers |Furtive |Greased |Honest |Latent |Light-fingered |Quick-fingered |Quiet |Shady |Shifty |Silent |Slick |Sly |Tricky |Aunty |Biddy |Black |Gammer |Goodie |Goody |Gramma |Granny |Mama |Mistress |Mother |Mss |Nanna |Nanny |Old |Sister |Wee |Wicked |Young |Fat |Stuffed |Over-fed |Gimlet-eyed |Robust |Bearded |Burly |Plump |Rotund |Thin |Tiny |Mystic |Obscure |Complex |Learned |Potent |Wise |Grumpy |Cryptic |Dark |Scholarly |Grey-haired |Greybeard |Master |Mistress |Adroit |Dire |Maven |Quantum |Savant |Unseen |Archmaster |mistress |Archmage |Dame |Sir |the Amazing |the Civic-Minded |the Elegant |the Eloquent |the Helpful |the Helpful Citizen |the Stylish |the Upstanding Citizen |the Utterly Fluffy |the Wonderful |appallingly filthy |corpse looter |dull |feebleminded |i got punished |i got punished and all i got was this lousy title |i promise i won't do it again |insignificant |lying |malingering |naughty spawn |necrokleptomaniac |offensive |pillock |pointless |repentant |reprobate |shopkeeper murderer |silly spammy git |sitting in the corner |smelly |tantrum thrower |too stupid to live |vagrant |very sorry |very very sorry |waste of space |whinging |Sultan |Sultana |Shai |Sitt al-khasa |Shai |Sitt al-ri'asa |Shai |Sitt ishquaraya |Shai |Sitt a'daha |Nawab |Qasar |Mazrat |Effendi |Ya'uq |Mutasharid |Ishqaraya |Naughty Spawn |Kill Stealer |Feebleminded |Idiotic |Offensive |Corpse Looter |Cat Hating |Heathen |Foreign Dog |Infidel |Shopkeeper Murderer |Destitute |Parasitic |Hated |Cowardly |Criminal |Felon |M |Mlle |Mme |Contender |Venomous |Ancient |Exterminator |Rouge |Axe-master |Champion |Centurion |Flatulent |Competent |Cultured |Healer |Cutthroat |Knifey |Archaic |Lethal |Elementalist |Energetic |Festive |Gifted |Chef |Impaler |Templar |Paranoid |Saintly |Crusher |Mysterious |Arcana |Duelist |Perverse |Masterful |Fingers |Medical |Destined |Unburiable |Nasty |Nimble |Nurse |Murse |Obsolete |Old Woman |Old Man |Old |Crimewave |Antiquated |Fossilized |Mythical |Unlucky |Pious |Staffmistress |Staffmaster |Prehistoric |Rock-hard |Bruiser |Pulveriser |Literate |Wealthy |Senile |Shieldmistress |Shieldmaster |Filthy |Erratic Mechanic |Legendary |Swordmistress |Swordmaster |Terrible |Ruinous |Decrepit |Player Of Games |Headmistress |Headmaster |Multilingual |Golden |Unexpected |Unstoppable |Versatile |Virtuoso |Venerable |Opulent )?([a-z]+) ([a-z]+ )?the (.*)\.$"
183 name="whoami"
184 script="Set_Character_From_Whoami"
185 regexp="y"
186 sequence="100"
187 >
188 </trigger>
189
190
191 <!-- Messages you get when you quit, shout 8, or idle out.-->
192 <trigger
193 enabled="y"
194 ignore_case="y"
195 match="^(Do come again!|Thanks for playing. See you next time.|You idled out, sorry.)$"
196 name="logged_off"
197 script="Pause_Timer"
198 regexp="y"
199 sequence="100"
200 >
201 </trigger>
202
203 <!-- Skills output. Used to set bonus.-->
204 <trigger
205 enabled="n"
206 ignore_case="y"
207 match="faith.rituals.defensive.self * *"
208 name="skills"
209 script="Set_Bonus_From_Skills"
210 sequence="100"
211 >
212 </trigger>
213
214
215</triggers>
216
217<!-- Aliases -->
218<aliases>
219 <alias
220 match="mtreset"
221 enabled="y"
222 send_to="12"
223 script="Force_Reset_Timer"
224 name="force_reset"
225 sequence="100"
226 >
227 </alias>
228
229 <alias
230 match="mtset *"
231 enabled="y"
232 send_to="12"
233 script="set_bonus"
234 name="set_length"
235 sequence="100"
236 >
237 </alias>
238
239 <alias
240 match="mtadd *"
241 enabled="y"
242 send_to="12"
243 script="Man_Add_Timer"
244 name="force_add"
245 sequence="100"
246 >
247 </alias>
248
249 <alias
250 match="mtminus *"
251 enabled="y"
252 send_to="12"
253 script="Man_Minus_Timer"
254 name="force_minus"
255 sequence="100"
256 >
257 </alias>
258
259 <alias
260 match="mtchar *"
261 enabled="y"
262 send_to="12"
263 script="Man_Set_Character"
264 name="set_char"
265 sequence="100"
266 >
267 </alias>
268
269 <alias
270 enabled="y"
271 ignore_case="y"
272 match="help majortimer"
273 name="helpmajor"
274 send_to="12"
275 sequence="100">
276 <send>print_help()</send>
277 </alias>
278
279
280 <alias
281 match="su *"
282 enabled="y"
283 send_to="12"
284 script="Switch_User"
285 name="su"
286 sequence="100"
287 >
288 </alias>
289
290 <!-- Commands to, respectively, turn the whoami alias on and off. -->
291 <alias
292 match="mtwhoami on"
293 enabled="y"
294 send_to="12"
295 script="Whoami_On"
296 name="whoamion"
297 sequence="100"
298 >
299 </alias>
300
301 <alias
302 match="mtwhoami off"
303 enabled="y"
304 send_to="12"
305 script="Whoami_Off"
306 name="whoamioff"
307 sequence="100"
308 >
309 </alias>
310
311 <!-- Commands to, respectively, turn the skills alias on and off. -->
312 <alias
313 match="mtskills on"
314 enabled="y"
315 send_to="12"
316 script="Skills_On"
317 name="skillson"
318 sequence="100"
319 >
320 </alias>
321
322 <alias
323 match="mtskills off"
324 enabled="y"
325 send_to="12"
326 script="Skills_Off"
327 name="skillsoff"
328 sequence="100"
329 >
330 </alias>
331
332 <!-- Commands to, respectively, turn verbose mode on and off. -->
333 <alias
334 match="mtverbose on"
335 enabled="y"
336 send_to="12"
337 script="Verbose_On"
338 name="verboseon"
339 sequence="100"
340 >
341 </alias>
342
343 <alias
344 match="mtverbose off"
345 enabled="y"
346 send_to="12"
347 script="Verbose_Off"
348 name="verboseoff"
349 sequence="100"
350 >
351 </alias>
352
353 <alias
354 match="mtverbose debug"
355 enabled="y"
356 send_to="12"
357 script="Verbose_Debug"
358 name="verbosedebug"
359 sequence="100"
360 >
361 </alias>
362
363 <!-- Command to add one performance's worth of shielding to the timer. -->
364 <alias
365 match="mtaddone"
366 enabled="y"
367 send_to="12"
368 script="Add_Timer"
369 name="mtaddone"
370 sequence="100"
371 >
372 </alias>
373
374 <!-- Command to reset the timer to zero. -->
375 <alias
376 match="mtclear"
377 enabled="y"
378 send_to="12"
379 script="Clear_Timer"
380 name="mtclear"
381 sequence="100"
382 >
383 </alias>
384
385 <!-- This is ONLY turned on when it sees the text indicating the next thing you enter will be your username. -->
386 <alias
387 match="*"
388 enabled="n"
389 send_to="12"
390 script="Login"
391 name="login_name"
392 sequence="100"
393 >
394 </alias>
395</aliases>
396
397<!-- Timers -->
398<timers>
399 <timer
400 script="show_time"
401 enabled="y"
402 second="1.00"
403 >
404 </timer>
405</timers>
406
407<!-- Script -->
408<script>
409<![CDATA[
410
411require "serialize"
412
413active = ""
414
415
416--function to set your bonus manually, triggered by the mtset alias
417function set_bonus (name, line, wildcards)
418 bonus = wildcards[1]
419 Save_Setting ("bonus", bonus)
420 if verbose == "on" or verbose == "debug" then
421 Note("Bonus set to ", bonus, ", which gives you a base duration of ", bonus_to_duration(bonus), " seconds.")
422 end --if
423 --SetChanged (true) -- world has changed... this doesn't seem necessary after all?
424end -- set_bonus
425
426--function to set your bonus from skills output
427function Set_Bonus_From_Skills (name, line, wildcards)
428 bonus = wildcards[2]
429 Save_Setting ("bonus", bonus)
430 if verbose == "on" or verbose == "debug" then
431 Note("Bonus set from skills output to ", bonus, ", which gives you a base duration of ", bonus_to_duration(bonus), ".")
432 end --if
433end --Set_Bonus_From_Skills
434
435--function to calculate the duration (seconds) to add from the bonus specified
436function bonus_to_duration (current_bonus)
437 return 2 * math.floor(((400 * (math.log(current_bonus + 75)) - 2082.5) / 2) + .5)
438end -- bonus_to_duration
439
440
441--function to add more time to the timer when it sees the extended/protected messages
442function Add_Timer ()
443 active = "yes"
444 Save_Setting("active", active)
445
446 --These next two: need to make sure that when it tries to do math on effective bonus, it actually EXISTS. If not, set both to the default.
447 if bonus then
448 --do nothing
449 else
450 bonus = 307
451 end --if
452 if effective_bonus then
453 --do nothing
454 else
455 effective_bonus = bonus
456 end --if
457
458
459 --calculate actual seconds to be added
460 time_to_add = bonus_to_duration(effective_bonus)
461
462 --if the finish time already exists we can just add the time to it. Otherwise, create it as the os time plus the time to add.
463 if finish_time and finish_time ~= "" then
464 finish_time = finish_time + time_to_add
465 else
466 finish_time = os.time () + time_to_add
467 end -- if
468
469 if verbose == "debug" then
470 Note(time_to_add, " seconds added.")
471 end --if
472
473 --finally, save the finish time for pause/unpause purposes, reset the effective bonus to the base, and do the window
474 Save_Setting ("finish_time", finish_time)
475 effective_bonus = bonus
476 show_time ()
477end -- Add_Timer
478
479
480--function to reset the timer to one performance's worth
481function Force_Reset_Timer ()
482 finish_time = os.time ()
483 Add_Timer ()
484end -- Force_Reset_Timer
485
486
487--function to manually add a specified number of minutes, triggered by the mtadd alias
488function Man_Add_Timer (name, line, wildcards)
489 if finish_time and finish_time ~= "" then
490 finish_time = finish_time + (wildcards[1]*60)
491 show_time ()
492 else
493 active = "yes"
494 Save_Setting ("active", active)
495 finish_time = os.time () + (wildcards[1]*60)
496 show_time ()
497 end -- if
498 Note(wildcards[1] .. "mins added to your timer.")
499 Save_Setting ("finish_time", finish_time)
500end -- Man_Add_Timer
501
502
503--function to manually subtract a specified number of minutes, triggered by the mtminus alias
504function Man_Minus_Timer (name, line, wildcards)
505 if finish_time and finish_time ~= "" then
506 finish_time = finish_time - (wildcards[1]*60)
507 show_time ()
508 else
509 active = ""
510 Save_Setting ("active", active)
511 finish_time = ""
512 show_time ()
513 end -- if
514 Note(wildcards[1] .. "mins removed from your timer.")
515 Save_Setting ("finish_time", finish_time)
516end -- Man_Minus_Timer
517
518
519--function to reset the duration, triggered by failure message, stopping the ritual, performing on someone ELSE, or target leaving.
520function Canceled ()
521 --reset the effective bonus because any ritual modifier message you may have gotten is now irrelevant
522 effective_bonus = bonus
523end -- Canceled
524
525
526--a function to check what visible ritual modifiers you have and adjust the duration accordingly.
527function adjust_bonus (name, line, wildcards)
528 effective_bonus = bonus
529 modifiers = wildcards[3]
530 text_difficulty = wildcards[2]
531 ritual_bonuses = 0
532 ritual_penalties = 0
533 bonuses_text = "Ritual bonuses detected: "
534 penalties_text = "Ritual penalties detected: "
535
536--messages common to all
537 --prayed recently
538 if string.find(modifiers, "you have been actively worshipping") then
539 effective_bonus = effective_bonus + 7
540 ritual_bonuses = ritual_bonuses + 7
541 bonuses_text = bonuses_text .. "prayed or ritburied, "
542 end -- if
543 --deity pool settings
544 if string.find(modifiers, "the hand of") then
545 --It's 3 points for 1%. This is very rarely used, however, because it drains the pool so quickly, and so it will probably be at 1% if it's on at all. The highest setting, "10%", actually drains 1 dp per gp spent, so even the "1%" setting probably actually drains 10% of gp spent. Really can't see anybody ever setting it higher.
546 effective_bonus = effective_bonus + 3
547 ritual_bonuses = ritual_bonuses + 3
548 bonuses_text = bonuses_text .. "deity pool settings (presumed 1%), "
549 end -- if
550 --other high altar OR high altar... the "other high altar" message is confusable with the "at high altar" message, so do this.
551 if string.find(modifiers, "you are in an area consecrated to another God") then
552 effective_bonus = effective_bonus - 45
553 ritual_penalties = ritual_penalties - 45
554 penalties_text = penalties_text .. "at wrong high altar, "
555 elseif string.find(modifiers, "you are in a") then
556 effective_bonus = effective_bonus + 12
557 ritual_bonuses = ritual_bonuses + 12
558 bonuses_text = bonuses_text .. "at high altar, "
559 end -- if
560 --near high altar, this varies
561 if string.find(modifiers, "you are near") then
562 --This bonus actually ranges from +3 (just barely inside the zone where you get a bonus at all) to +9(right outside an altar). I've arbitrarily put it at +6 since most of the time when you're getting this, you'll be in the same city as an altar but probably not right outside. So, a middling value seems appropriate.
563 effective_bonus = effective_bonus + 6
564 ritual_bonuses = ritual_bonuses + 6
565 bonuses_text = bonuses_text .. "near high altar, "
566 end -- if
567 --witch/wizard property
568 if string.find(modifiers, "you sense that the gods have averted their eyes from this place") then
569 effective_bonus = effective_bonus - 45
570 ritual_penalties = ritual_penalties - 45
571 penalties_text = penalties_text .. "on witch or wizard property, "
572 end -- if
573 --minions
574 if string.find(modifiers, "you are concentrating on") then
575 penalties_text = penalties_text .. "minions ("
576 num_minions = 0
577
578 --it's POSSIBLE that there could be multiple of the same type of whirlwind ("controlling two gigantic whirlwinds of dust") or spectre. Also, in darkness, there can be "controlling two things". Look for number words and count them.
579 if string.find(modifiers, " two ") then
580 modifiers, num_identicals = string.gsub(modifiers, " two ", "")
581 num_minions = num_minions + (num_identicals * 2)
582 penalties_text = penalties_text .. num_identicals .. " set(s) of two identical-looking minions. "
583 end --if
584 if string.find(modifiers, " three ") then
585 modifiers, num_identicals = string.gsub(modifiers, " three ", "")
586 num_minions = num_minions + (num_identicals * 3)
587 penalties_text = penalties_text .. num_identicals .. " set(s) of three identical-looking minions, "
588 end --if
589 if string.find(modifiers, " four ") then
590 modifiers, num_identicals = string.gsub(modifiers, " four ", "")
591 num_minions = num_minions + (num_identicals * 4)
592 penalties_text = penalties_text .. num_identicals .. " set(s) of four identical-looking minions. "
593 end --if
594 if string.find(modifiers, " five ") then
595 modifiers, num_identicals = string.gsub(modifiers, " five ", "")
596 num_minions = num_minions + (num_identicals * 5)
597 penalties_text = penalties_text .. num_identicals .. " set(s) of five identical-looking minions. "
598 end --if
599 if string.find(modifiers, " six ") then
600 modifiers, num_identicals = string.gsub(modifiers, " six ", "")
601 num_minions = num_minions + (num_identicals * 6)
602 penalties_text = penalties_text .. num_identicals .. " set(s) of six identical-looking minions. "
603 end --if
604 if string.find(modifiers, " seven ") then
605 modifiers, num_identicals = string.gsub(modifiers, " seven ", "")
606 num_minions = num_minions + (num_identicals * 7)
607 penalties_text = penalties_text .. num_identicals .. " set(s) of seven identical-looking minions. "
608 end --if
609 if string.find(modifiers, " eight ") then
610 modifiers, num_identicals = string.gsub(modifiers, " eight ", "")
611 num_minions = num_minions + (num_identicals * 8)
612 penalties_text = penalties_text .. num_identicals .. " set(s) of eight identical-looking minions. "
613 end --if
614 if string.find(modifiers, " nine ") then
615 modifiers, num_identicals = string.gsub(modifiers, " nine ", "")
616 num_minions = num_minions + (num_identicals * 9)
617 penalties_text = penalties_text .. num_identicals .. " set(s) of nine identical-looking minions. "
618 end --if
619 if string.find(modifiers, " ten ") then
620 modifiers, num_identicals = string.gsub(modifiers, " ten ", "")
621 num_minions = num_minions + (num_identicals * 10)
622 penalties_text = penalties_text .. num_identicals .. " set(s) of ten identical-looking minions. "
623 end --if
624
625 --count any unique devils
626 if string.find(modifiers, " whirlwind of ") then
627 modifiers, num_devils = string.gsub(modifiers, " whirlwind of ", "")
628 num_minions = num_minions + num_devils
629 penalties_text = penalties_text .. num_devils .. " unique dust devils. "
630 end --if
631
632 --unidentified minion in the dark (multiples will be "[number] things" and thus counted above)
633 if string.find(modifiers, " something") then
634 num_minions = num_minions + 1
635 penalties_text = penalties_text .. "Unidentified minion in the dark (something). "
636 end --if
637
638 --unidentified minion in the dark
639 if string.find(modifiers, " someone") then
640 modifiers, num_others = string.gsub(modifiers, " someone", "")
641 num_minions = num_minions + num_others
642 penalties_text = penalties_text .. "Unidentified minion in the dark (someone)."
643 end --if
644
645 --then see if there's a totem
646 if string.find(modifiers, "misty woman") or string.find(modifiers, "dust bunny") or string.find(modifiers, "tall robed man") or string.find(modifiers, "rocky creature") or string.find(modifiers, "lung fish") or string.find(modifiers, "large vulture") or string.find(modifiers, "large salamander") then
647 num_minions = num_minions + 1
648 penalties_text = penalties_text .. "Totem. "
649 end --if
650
651
652 --then see if there's a creeping doom
653 if string.find(modifiers, " black cloud") then
654 num_minions = num_minions + 1
655 penalties_text = penalties_text .. "Doom. "
656 end --if
657
658 --then see if there are unique spectres (but only ONE since multiple ones will be counted above)
659 if string.find(modifiers, "spectre ") or string.find(modifiers, "spectre\.") or string.find(modifiers, "spectre\, ") then
660 modifiers, _ = string.gsub(modifiers, "spectres", "")
661 modifiers, num_spectres = string.gsub(modifiers, " spectre", "")
662 num_minions = num_minions + num_spectres
663 penalties_text = penalties_text .. num_spectres .. " unique spectres."
664 end --if
665
666 effective_bonus = effective_bonus - (num_minions * 4)
667 ritual_penalties = ritual_penalties - (num_minions * 4)
668 if num_minions > 2 then
669 effective_bonus = effective_bonus - 1
670 ritual_penalties = ritual_penalties - 1
671 end --if
672
673 penalties_text = penalties_text .. num_minions .. " minion(s) total.), "
674 end -- if
675 --alignment
676 if string.find(modifiers, "you can barely feel the presence of") then
677 effective_bonus = effective_bonus - 5
678 ritual_penalties = ritual_penalties - 5
679 penalties_text = penalties_text .. "getting out of align, "
680 end -- if
681 --far from a high altar
682 if string.find(modifiers, "you are far from") then
683 --This penalty actually ranges from -2 (just barely in the zone where you get the penalty) to -8 (as far as you can even get from an altar--although you actually get this a lot sooner). I've set it at -8 since that's what you get in Genua (if not a Gappic or Hattite) or the Ramtops (if not Pishite, Sekkite, or Gufnorkian). I think most of the time, if you're getting this one at all, you're probably getting the maximum penalty. There's a bigger "zone" that's at -8 than for anything else, I think.
684 effective_bonus = effective_bonus - 8
685 ritual_penalties = ritual_penalties - 8
686 penalties_text = penalties_text .. "far from an altar, "
687 end -- if
688 --drunk
689 if string.find(modifiers, "Hat approves of your inebriated state") then
690 --no modifier because they cancel out
691 penalties_text = penalties_text .. "drunk (but Hat likes drunkenness, so no overall penalty), "
692 elseif string.find(modifiers, "you are drunk") then
693 effective_bonus = effective_bonus - 33
694 ritual_penalties = ritual_penalties - 33
695 penalties_text = penalties_text .. "drunk, "
696 end -- if
697 --poisoned
698 if string.find(modifiers, "poisoned") then
699 effective_bonus = effective_bonus - 33
700 ritual_penalties = ritual_penalties - 33
701 penalties_text = penalties_text .. "poisoned, "
702 end -- if
703 --using baton. This doesn't work properly, because the actual penalty varies, but it needed to be set to SOMEthing.
704 if string.find(modifiers, "as an external focus") then
705 effective_bonus = effective_bonus - 56
706 ritual_penalties = ritual_penalties - 56
707 penalties_text = penalties_text .. "using a baton, "
708 end -- if
709 --not a regular shield, not sure if this even exists anymore
710 if string.find(modifiers, "???") then
711 bonuses_text = bonuses_text .. "using a fake shield, "
712 end -- if
713
714
715--Pishite rain/snow/sleet bonus
716 if string.find(modifiers, "you feel uplifted by the ") then
717 effective_bonus = effective_bonus + 7
718 ritual_bonuses = ritual_bonuses + 7
719 bonuses_text = bonuses_text .. "rain, snow, or sleet, "
720 end -- if
721
722--Gufnorkian
723 if string.find(modifiers, "you are uplifted by the fluff you carry") then
724 effective_bonus = effective_bonus + 7
725 ritual_bonuses = ritual_bonuses + 7
726 bonuses_text = bonuses_text .. "fluff in inventory, "
727 end -- if
728
729 if string.find(modifiers, "you feel at home in the fluffy surroundings") then
730 effective_bonus = effective_bonus + 3
731 ritual_bonuses = ritual_bonuses + 3
732 bonuses_text = bonuses_text .. "somewhere fluffy, "
733 end -- if
734
735--Gappic
736 if string.find(modifiers, "you feel comfortable in your stylish clothes") then
737 effective_bonus = effective_bonus + 4
738 ritual_bonuses = ritual_bonuses + 4
739 bonuses_text = bonuses_text .. "stylish clothes, "
740 end -- if
741
742 if string.find(modifiers, "you feel comfortable in your stylish surroundings") then
743 effective_bonus = effective_bonus + 3
744 ritual_bonuses = ritual_bonuses + 3
745 bonuses_text = bonuses_text .. "stylish place, "
746 end -- if
747
748--Sandelfonian
749 if string.find(modifiers, "you feel more comfortable praying indoors") then
750 effective_bonus = effective_bonus + 7
751 ritual_bonuses = ritual_bonuses + 7
752 bonuses_text = bonuses_text .. "indoors, "
753 end -- if
754
755--Fishite
756 if string.find(modifiers, "you are underwater") then
757 effective_bonus = effective_bonus + 14
758 ritual_bonuses = ritual_bonuses + 14
759 bonuses_text = bonuses_text .. "underwater, "
760 end -- if
761
762 if string.find(modifiers, "you are floating in the water") then
763 effective_bonus = effective_bonus + 7
764 ritual_bonuses = ritual_bonuses + 7
765 bonuses_text = bonuses_text .. "water surface, "
766 end -- if
767
768
769--Hattite
770 if string.find(modifiers, "Hat approves of your trespass onto the holy ground") then
771 effective_bonus = effective_bonus + 9
772 ritual_bonuses = ritual_bonuses + 9
773 bonuses_text = bonuses_text .. "trespasser"
774 end -- if
775
776 if string.find(modifiers, "Hat approves of your company") then
777 effective_bonus = effective_bonus + 16
778 ritual_bonuses = ritual_bonuses + 16
779 bonuses_text = bonuses_text .. "with other priests, "
780 end -- if
781
782--Sekkite
783 if string.find(modifiers, "you feel more confident as you battle your foes") then
784 effective_bonus = effective_bonus + 5
785 ritual_bonuses = ritual_bonuses + 5
786 bonuses_text = bonuses_text .. "in combat, "
787 end -- if
788
789 --do some stuff here to make sure the numeric modifiers are within the ranges indicated by various difficulty messages (much harder, much easier, etc.)
790
791
792 if ritual_bonuses == 0 then
793 bonuses_text = "No ritual bonuses."
794 else
795 bonuses_text = bonuses_text .. "for a total of +" .. ritual_bonuses .. " to your bonus."
796 end --if
797 if ritual_penalties == 0 then
798 penalties_text = "No ritual penalties."
799 else
800 penalties_text = penalties_text .. "for a total of " .. ritual_penalties .. " to your bonus."
801 end --if
802
803 if verbose == "on" or verbose == "debug" then
804 Note(bonuses_text, " ", penalties_text, " Your bonus is ", bonus, " and your effective bonus is ", effective_bonus, ".")
805 end -- if
806
807end -- adjust_bonus
808
809
810
811function Parse_Numbers (duration_part)
812 num_days = 0 --start it at 0
813 text_days = string.sub(duration_part, 11, -6) --will look like "more than three days" so everything after "more than " up until " days"
814 --if it's over a hundred
815 if string.find(text_days, "hundred") then
816 hundred_start, hundred_end, _ = string.find(text_days, " hundred") --find where "hundred" starts
817 num_hundreds_end = hundred_start - 1
818 num_hundreds = string.sub (text_days, 1, num_hundreds_end) --grab the thing right before "hundred"
819 num_days = num_days + (Parse_One_Through_Nineteen(num_hundreds) * 100)
820
821 remaining_text_start = hundred_end + 2
822 text_days = string.sub(text_days, remaining_text_start) --we've added the n hundred days in, so now take that bit out of the text
823 --if it was evenly divisible by a hundred there should be no "and ", but if it wasn't, we want to get rid of the "and "
824 if string.sub(text_days, 1, 4) == "and " then
825 text_days = string.sub(text_days, 5)
826 end -- if
827 end -- if
828 --next, find any parts that indicate twenty, thirty, etc.
829 if string.find(text_days, "ty") then
830 _, tens_end, _ = string.find(text_days, "ty")
831 num_tens = string.sub(text_days, 1, tens_end) --grab the thing that ends in "ty"
832 num_tens = Parse_Tens(num_tens) --and figure out which one it is, then add it in
833 num_days = num_days + num_tens
834 remaining_text_start = tens_end + 2
835 text_days = string.sub(text_days, remaining_text_start) --we've added the n ten days in, so now take that bit out of the text
836
837 --it doesn't actually matter whether there's a dash ("forty eight" vs "forty-eight") because we're skipping that character either way.
838
839 end -- if
840 --after all this the only thing even POSSIBLY left should be one, two ... nineteen.
841 if text_days == "" then
842 return num_days
843 else
844 num_days = num_days + Parse_One_Through_Nineteen(text_days)
845 end -- if
846
847
848 return num_days
849end -- Parse_Numbers
850
851function Parse_One_Through_Nineteen (text_number)
852 if text_number == "one" then
853 return 1
854 elseif text_number == "two" then
855 return 2
856 elseif text_number == "three" then
857 return 3
858 elseif text_number == "four" then
859 return 4
860 elseif text_number == "five" then
861 return 5
862 elseif text_number == "six" then
863 return 6
864 elseif text_number == "seven" then
865 return 7
866 elseif text_number == "eight" then
867 return 8
868 elseif text_number == "nine" then
869 return 9
870 elseif text_number == "ten" then
871 return 10
872 elseif text_number == "eleven" then
873 return 11
874 elseif text_number == "twelve" then
875 return 12
876 elseif text_number == "thirteen" then
877 return 13
878 elseif text_number == "fourteen" then
879 return 14
880 elseif text_number == "fifteen" then
881 return 15
882 elseif text_number == "sixteen" then
883 return 16
884 elseif text_number == "seventeen" then
885 return 17
886 elseif text_number == "eighteen" then
887 return 18
888 elseif text_number == "nineteen" then
889 return 19
890
891 else --this should NOT happen, however, if it does...
892 return 0
893 end --if
894end --Parse_One_Through_Nineteen
895
896
897function Parse_Tens (text_number)
898 if text_number == "twenty" then
899 return 20
900 elseif text_number == "thirty" then
901 return 30
902 elseif text_number == "forty" then
903 return 40
904 elseif text_number == "fifty" then
905 return 50
906 elseif text_number == "sixty" then
907 return 60
908 elseif text_number == "seventy" then
909 return 70
910 elseif text_number == "eighty" then
911 return 80
912 elseif text_number == "ninety" then
913 return 90
914 else --this should NOT happen, however, if it does...
915 return 0
916 end --if
917end --Parse_Tens
918
919
920function Adjust_Timer (name, line, wildcards)
921 duration_part = wildcards[4] -- grab the part of the line that is the textual duration and translate into seconds
922
923 if duration_part == "less than five minutes" then
924 min_duration = 1
925 max_duration = 299
926 elseif duration_part == "at least five minutes" then
927 min_duration = 300
928 max_duration = 899
929 elseif duration_part == "at least a quarter of an hour" then
930 min_duration = 900
931 max_duration = 1799
932 elseif duration_part == "at least half an hour" then
933 min_duration = 1800
934 max_duration = 3599
935 elseif duration_part == "at least an hour" then
936 min_duration = 3600
937 max_duration = 7199
938 elseif duration_part == "at least a couple of hours" then
939 min_duration = 7200
940 max_duration = 21599
941 elseif duration_part == "more than a quarter of a day" then
942 min_duration = 21600
943 max_duration = 43199
944 elseif duration_part == "more than half a day" then
945 min_duration = 43200
946 max_duration = 86399
947 elseif duration_part == "more than a day" then
948 min_duration = 86400
949 max_duration = 172799
950 else --for values over a day, they should all follow the "more than n days" pattern, parse this
951 num_days = Parse_Numbers (duration_part)
952 --convert days to seconds
953 min_duration = num_days * 24 * 60 * 60
954 max_duration = ((num_days + 1) * 24 * 60 * 60) - 1
955 end -- if
956
957
958 if finish_time and finish_time ~= "" then -- figure out time the plugin thinks is left
959 time_left = finish_time - os.time ()
960 else
961 time_left = 0
962 end -- if
963
964 if time_left < min_duration then -- see if the alleged time left is within what shields says
965 time_left = min_duration
966 elseif time_left > max_duration then
967 time_left = max_duration
968 else
969 -- do nothing
970 end -- if
971
972 active = "yes" -- set things up for the show_time function
973 Save_Setting ("active", active)
974 finish_time = os.time () + time_left
975 Save_Setting ("finish_time", finish_time)
976 show_time ()
977end -- Adjust_Timer
978
979
980function Clear_Timer (name, line, wildcards)
981 time_left = 0
982 active = ""
983 finish_time = ""
984 previous_time_left = ""
985 Save_Setting ("finish_time", finish_time)
986 Save_Setting ("active", active)
987 Save_Setting ("previous_time_left", previous_time_left)
988
989end -- Clear_Timer
990
991
992 --function to reset the time left to 20 seconds, triggered by the "weakening" message
993function Warning (name, line, wildcards)
994 active = "yes"
995 Save_Setting ("active", active)
996 time_left = 20
997 finish_time = os.time () + 20
998 show_time ()
999 Save_Setting ("finish_time", finish_time)
1000end -- Man_Add_Timer
1001
1002
1003--Called when you log out etc. Saves the remaining time on the timer for this character.
1004function Pause_Timer (name, line, wildcards)
1005 if active == "yes" then
1006 previous_time_left = finish_time - os.time ()
1007 Note ("Paused major timer.")
1008 end -- if
1009 Save_Saveable_Variables ()
1010end -- pause_timer
1011
1012
1013function Already_Playing ()
1014 already_playing = true
1015end -- Already_Playing
1016
1017
1018--Called when you login etc. Grabs the remaining time for that character, if any, and starts the timer up where it left off from last time.
1019function Unpause_Timer ()
1020 active = Retrieve_Setting("active")
1021 bonus = Retrieve_Setting("bonus")
1022 if bonus == "" then
1023 bonus = 307
1024 end -- if
1025 effective_bonus = bonus
1026 previous_time_left = Retrieve_Setting("previous_time_left")
1027 if already_playing then
1028 finish_time = Retrieve_Setting("finish_time")
1029 already_playing = nil
1030 elseif previous_time_left ~= "" then
1031 finish_time = os.time () + previous_time_left
1032 active = "yes"
1033 Note ("Unpaused major timer.")
1034 Save_Setting ("finish_time", finish_time)
1035 end -- if
1036end -- unpause_timer
1037
1038
1039function Switch_User (name, line, wildcards)
1040--send whatever you entered, unaltered, on to the MUD
1041 Send(line)
1042--save whichever character you su'ed from
1043 Save_Saveable_Variables ()
1044 previous_character = current_character
1045--grab the name of the character you're suing to
1046 current_character = wildcards[1]
1047end -- Switch_User
1048
1049
1050--turns the whoami alias on. Triggered by mtwhoami on
1051function Whoami_On ()
1052 world.EnableTrigger("whoami", true)
1053 SetVariable("whoami", "on")
1054end --Whoami_On
1055
1056--turns the whoami alias off. Triggered by mtwhoami off
1057function Whoami_Off ()
1058 world.EnableTrigger("whoami", false)
1059 SetVariable("whoami", "")
1060end --Whoami_Off
1061
1062
1063--turns the skills alias on. Triggered by mtskills on
1064function Skills_On ()
1065 world.EnableTrigger("skills", true)
1066 SetVariable("skills", "on")
1067end --Skills_On
1068
1069--turns the skills alias off. Triggered by mtskills off
1070function Skills_Off ()
1071 world.EnableTrigger("skills", false)
1072 SetVariable("skills", "")
1073end --Skills_Off
1074
1075
1076--turns verbose mode on. Triggered by mtverbose on. This is global, not per character. Verbose mode causes extra messages in some places. (Extra messages: saying how your bonus is affected by whatever ritual modifiers it sees; saying what bonus you've set it (manually or via skills output) to and what base duration that gives you; telling you when it detects which character you're using.)
1077function Verbose_On ()
1078 verbose = "on"
1079 SetVariable("verbose", "on")
1080end --Verbose_On
1081
1082--debug mode, even more messages. (Tells you when it saves a character-specific setting, tells you how much time has been added.)
1083function Verbose_Debug ()
1084 verbose = "debug"
1085 SetVariable("verbose", "debug")
1086end --Verbose_Debug
1087
1088--turns verbose mode off.
1089function Verbose_Off ()
1090 verbose = ""
1091 SetVariable("verbose", "")
1092end --Verbose_Off
1093
1094
1095--Triggered by the text, "Or, enter your current character's name". When that shows up the next thing entered might be your login, so enable the alias to grab whatever you enter.
1096function Enter_Name ()
1097 world.EnableAlias("login_name", true)
1098end -- Enter_Name
1099
1100--Triggered by the text, " Where all your dreams can't come true.", which is part of the thing you get AFTER you enter your name. Hopefully this will stop it grabbing your password if you enter your name too quickly.
1101function Enter_Password ()
1102 world.EnableAlias("login_name", false)
1103end -- Enter_Password
1104
1105function Login (name, line, wildcards)
1106--send whatever you entered, unaltered, on to the MUD
1107 Send(line)
1108--save whatever you entered as your current character
1109 --but make sure it's not a *command* instead of a character name. Not that it hurts per se, but it can clutter up the save file.
1110 if line ~= "q" and line ~= "m" and line ~= "d" and line ~= "r" and line ~= "u" and line ~= "l" and line ~= "p" and line ~= "f" and line ~= "n" and line ~= "g" then
1111 current_character = line
1112 if verbose == "on" or verbose == "debug" then
1113 Note("[Major Timer] Character detected: ", current_character)
1114 end -- if
1115 end -- if
1116--turn the alias off again.
1117 world.EnableAlias("login_name", false)
1118end -- Login
1119
1120
1121function Set_Character_From_Whoami (name, line, wildcards)
1122 potential_character = wildcards[2]
1123 if potential_character == "not" or potential_character == "already" or potential_character == "remembering" or potential_character == "keeping" or potential_character == "unsure" or potential_character == "crouching" or potential_character == "kneeling" or potential_character == "lying" or potential_character == "lounging" or potential_character == "meditating" or potential_character == "sitting" or potential_character == "squatting" or potential_character == "standing" then
1124 --do nothing, this stops it from setting itself from "you are not holding", "you are already wearing the", position stuff, etc.
1125 else
1126 current_character = potential_character
1127 if verbose == "on" or verbose == "debug" then
1128 Note("[Major Timer] Character detected: ", current_character)
1129 end -- if
1130 end -- if
1131end -- Set_Character_From_Whoami
1132
1133
1134--manually set the character with mtchar
1135function Man_Set_Character (name, line, wildcards)
1136 current_character = wildcards[1]
1137 if verbose == "on" or verbose == "debug" then
1138 Note("Character set: ", current_character)
1139 end -- if
1140 Unpause_Timer ()
1141end -- Man_Set_Character
1142
1143
1144--actually makes the window showing the remaining time.
1145function show_time (name, line, wildcards)
1146 if active == "yes" and finish_time ~= "" then
1147 time_left = finish_time - os.time ()
1148
1149 if time_left <= 0 then
1150 --These next two lines are so that there will not be a finish_time that's in the past. Otherwise, if it thought it should have dropped five minutes ago and you added four minutes of shielding, it would think it should have dropped one minute ago, when it should actually think it's now due to drop in four minutes.
1151 time_left = 0
1152 finish_time = os.time ()
1153 text = "Shield due to drop!"
1154 elseif time_left < 60 then
1155 text = string.format ("Major shield expires in: " .. time_left .. " seconds.")
1156 elseif time_left >= 60 and time_left < 3600 then
1157 mins_left = string.format ("%3.1f", (time_left / 60))
1158 text = string.format ("Major shield expires in: " .. mins_left .. " minutes.")
1159 elseif time_left >= 3600 and time_left < 86400 then
1160 hrs_left = string.format ("%3.1f", ((time_left / 60)/60))
1161 text = string.format ("Major shield expires in: " .. hrs_left .. " hours.")
1162 elseif time_left >= 86400 then
1163 days_left = string.format ("%i", (((time_left / 60)/60))/24)
1164 hrs_left = string.format ("%3.1f", (((time_left - (days_left*60*60*24))/60)/60))
1165 text = string.format ("Major shield expires in: " .. days_left .. " days and " .. hrs_left .. " hours.")
1166 end -- if
1167
1168 max_width = (WindowTextWidth (win, "fn", text)) + 10
1169
1170 if time_left < 60 then
1171 TEXT_COLOUR = ColourNameToRGB ("red")
1172 else
1173 TEXT_COLOUR = ColourNameToRGB ("black")
1174 end -- if
1175
1176 -- recreate the window the correct size
1177 WindowCreate (win,
1178 0, 0, -- left, top (auto-positions)
1179 max_width, -- width
1180 font_height + 10, -- height
1181 5, -- auto-position: top middle
1182 0, -- flags
1183 ColourNameToRGB ("lightgoldenrodyellow"))
1184
1185 WindowText (win, "fn",
1186 text, -- text
1187 5, 5, 0, 0, -- rectangle
1188 TEXT_COLOUR, -- colour
1189 false) -- not Unicode
1190 WindowShow (win, true)
1191 else
1192 WindowShow (win, false)
1193 end -- if active
1194end -- show_time
1195
1196
1197function OnPluginInstall ()
1198 win = GetPluginID ()
1199 font_id = "fn"
1200 font_name = "Comic Sans MS" -- the actual font
1201
1202 -- make win so I can grab the font info
1203 WindowCreate (win,
1204 0, 0, 1, 1, -- 1 x 1 pixel
1205 1, -- position - irrelevant
1206 0, -- flags
1207 0) -- background colour
1208
1209 check (WindowFont (win, font_id, font_name, 8)) -- normal
1210 font_height = WindowFontInfo (win, font_id, 1) -- height
1211
1212 --load settings for this character
1213 current_character = GetVariable("current_character") or "default"
1214
1215 active = Retrieve_Setting("active") or ""
1216 finish_time = Retrieve_Setting("finish_time") or ""
1217 previous_time_left = Retrieve_Setting("previous_time_left") or ""
1218 --if we have no bonus set for this character, use this arbitrary default bonus (guildmax and all 13s)
1219 bonus = Retrieve_Setting("bonus") or 307
1220
1221 --and get these global settings
1222 verbose = GetVariable("verbose") or ""
1223 whoami = GetVariable("whoami") or ""
1224 skills = GetVariable("skills") or ""
1225 if whoami == "on" then
1226 world.EnableTrigger("whoami", true)
1227 else
1228 world.EnableTrigger("whoami", false)
1229 end -- if
1230 if skills == "on" then
1231 world.EnableTrigger("skills", true)
1232 else
1233 world.EnableTrigger("skills", false)
1234 end -- if
1235
1236end -- OnPluginInstall
1237
1238function OnPluginDisable ()
1239 WindowShow (win, false)
1240end -- OnPluginDisable
1241
1242
1243
1244-------------------------------------------------------------------------------------------
1245-- on saving state, convert Lua table back into string variable save_simple is for simple
1246-- tables that do not have cycles (self-reference) or refer to other tables
1247-------------------------------------------------------------------------------------------
1248-------------------------------------------------------------------------------------------
1249-- Before, it was using serialize.save_simple. However, that seemed to be adding a bunch
1250-- of backslashes and quotes to the file every time, so that the variables it saved got
1251-- increasingly longer. THIS seems to work fine, though.
1252-------------------------------------------------------------------------------------------
1253
1254--use this by feeding them a setting NAME, as TEXT, and then the setting itself; e.g. Save_Setting("bonus", bonus)
1255function Save_Setting (setting_name, setting)
1256 variable_name = string.format (current_character .. "_" .. setting_name)
1257 if setting then
1258 SetVariable (variable_name, setting)
1259 if verbose == "debug" then
1260 Note("Saved: ", variable_name, " as ", setting)
1261 end--if
1262 else --but, it should not be nil. This is just in case.
1263 SetVariable (variable_name, "")
1264 if verbose == "debug" then
1265 Note("Saved: ", variable_name, " as empty string")
1266 end --if
1267 end -- if
1268end -- Save_Setting
1269
1270--This one however only needs the name (again, as TEXT); it will return the value to set as the setting itself. E.g. bonus = Retrieve_Setting ("bonus")
1271function Retrieve_Setting (setting_name)
1272 variable_name = string.format (current_character .. "_" .. setting_name)
1273 setting = GetVariable(variable_name) or ""
1274 return setting
1275end -- Retrieve_Setting
1276
1277
1278function Save_Saveable_Variables ()
1279 SetVariable ("current_character", current_character)
1280 if active == "yes" and finish_time ~= "" then
1281 Save_Setting ("finish_time", finish_time)
1282 previous_time_left = finish_time - os.time ()
1283 Save_Setting ("previous_time_left", previous_time_left)
1284 Save_Setting ("active", "yes")
1285 else
1286 Save_Setting ("finish_time", "")
1287 Save_Setting ("previous_time_left", "")
1288 Save_Setting ("active", "")
1289 end -- if
1290 if bonus then
1291 Save_Setting ("bonus", bonus)
1292 end -- if
1293end -- function Save_Saveable_Variables
1294
1295function OnPluginSaveState ()
1296 Save_Saveable_Variables ()
1297end -- function OnPluginSaveState
1298
1299function OnWorldSave ()
1300 Save_Saveable_Variables ()
1301end -- function
1302
1303function print_help()
1304 Note([[Plugin Help:Major Timer
1305
1306This plugin produces a small window showing the time remaining on your faith shield. This currently only works for Major Shield. Minor Shield, although it stacks with Major Shield, has a different duration formula. It does, however, have exactly the same success message, so using Minor Shield will confuse the plugin. It also doesn't work well for having other people perform Major Shield on you: it will use *your* bonus to determine the duration.
1307
1308It can set itself either from actually performing Major Shield (if you've used mtset to set your bonus), or (roughly) from the output of the "shields" command.
1309
1310It can remember bonus information and time remaining on a shield on a per-character basis. Therefore, you can log off with a shield running without it counting the time spent logged off. It should detect which character you're logging in as when you log in or su (although if you have an alias for su that's something other than "su", this part will not work).
1311
1312It can detect ritual bonuses and penalties (for example, being at a high altar) and will adjust your effective bonus--and therefore duration--accordingly. As the bonuses and penalties for being near or far from a high altar vary somewhat depending on exact distance, it may still be off by a few seconds.
1313
1314The following commands are recognized:
1315
1316 * help majortimer Displays this help file.
1317
1318 * mtset <number> Set your fa.ri.de.se bonus, from which durations
1319 are derived.
1320 Eg. A 300 bonus should be entered as 'mtset 300'.
1321 * mtadd <number> Manually add time in minutes to your shield timer.
1322 Eg. 'mtadd 2' will add 2 minutes to the timer.
1323 * mtminus <number> Manually minus time in minutes from your shield timer.
1324 Eg. 'mtminus 2' will take 2 minutes from the timer.
1325 * mtreset Sets the timer back to 1 shield's duration in length.
1326 * mtaddone Manually adds one performance's worth of shielding,
1327 using the most recent value for effective bonus.
1328 * mtclear Clears the timer.
1329 * mtchar <name> Manually sets the current character and loads any
1330 previous settings for that character.
1331 * mtwhoami [on|off] Turns the trigger for whoami output on or off. "On"
1332 lets the plugin detect the output of the MUD's
1333 "whoami" command, and set your current character
1334 accordingly. "Off" is the default, as the trigger
1335 can easily be triggered incorrectly (for example by
1336 whoami output in finger info, or by unrelated
1337 messages with a similar format).
1338 * mtskills [on|off] Turns the trigger for skills output on or off. When
1339 on, it can detect the line for f.r.d.s, but only if
1340 the output is in list format. Off by default.
1341 * mtverbose [on|off] Turns verbose mode on or off. In verbose mode: extra
1342 messages are displayed when: you set your bonus (or
1343 it's set from skills output), you perform MS with
1344 ritual modifiers, and when you set your character
1345 (manually or through whoami). Off by default.
1346]])
1347end
1348
1349]]></script>
1350</muclient>