-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRareloot_v1.02.xml
965 lines (872 loc) · 29.2 KB
/
Rareloot_v1.02.xml
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
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, April 26, 2019, 8:54 AM -->
<!-- MuClient version 5.05 -->
<!-- Plugin "Rareloot" generated by Plugin Wizard -->
<muclient>
<plugin
name="Rareloot"
author="Kloke & Charon"
id="95cbfe2b1aa26d9a225dca1f"
language="Lua"
purpose="To keep track of stock for rare item delivery."
date_written="2019-04-26 08:51:38"
requires="4.00"
version="1.02"
save_state="y"
sequence="1"
>
<description trim="y">
<![CDATA[
Usage:
rareloot help - this information
rareloot update - update tables of current rare item delivery stock
rareloot shoppinglist - show items out of stock
rareloot movinglist - show items that can be moved into another room
rareloot find <string> - show the count of the rare delivery item in stock
rareloot max <number> - set the maximum number of an item to keep
rareloot min <number> - set the minimum number of an item to keep
rareloot togglensl - toggles whether the nickname for shopping list is created
rareloot togglenml - toggles whether the nickname for moving list is created
rareloot getmoving - creates an alias to get up to 10 rare items for moving to other storage.
rareloot commands - shows all rareloot commands
rareloot all - show all items in stock
Version History:
0.1
- 1 First Alpha release.
0.2
- 2 Minor typo fixes.
- 3 Ability to seach partial name
- 4 Escape characters such as '-'
- 5 Create disc-side nickname for shopping list
- 6 Create disc-side nickname for moving list
0.3
- 7 Fixed another duplicate
- 8 Save tables across reloads
- 9 Completed "More work needed on '-'"
- 10 Ability to set own Min and Max stock levels
- 11 Identify when reading a rare item delivery writ and auto-lookup the item - not in place
0.4
- 12 Add stock count and colours for shopping and move lists
0.5
- 13 Fixed moving list nickname
- 14 Fixed leading 0 on nicknames
- 15 Update nickname if toggled to on.
0.6
- 16 Fixed extra space in plain white thobe
- 17 Create 'rareloot getmoving' to create an alias to get up to 10 rare items for moving to other storage.
0.7
- 18 Movinglist colours should now work properly e.g. 3 of them
- 19 Fixed movinglist nickname creation
0.8
- 20 Fixed saving and loading settings
- 21 Toggling Nickname Shoppinglist on recreated the shoppinglist nickname - useful for updating alts
0.9
- 22 Colour highlight on shopping list items - mostly :0S
0.10
- 29 Trap reading of a writ for delivery and rareloot find, and minimap location.
- 28 Highlight all rareloot subtly
- 26 Improve: colour highlighting
0.11
- 27 Fix: rareloot getmax/rareloot getmin: nil for both.
- 30 Read a writ when it's given by Werks
- 31 Add rareloot commands to list possible commands
- 32 Change colour highlighting 0: red, 1: orange: 2: yellow 3: purple 4: 5+: aquamarine
0.12
- 23 Add the ability to list all stock
- 24 Make hyperlinks of help output
1.00 General beta release
1.01
- Match on rareitems without a, an a pair of etc.
TODO:
]]>
</description>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
custom_colour="2"
enabled="n"
match="^(?P<rareItem>.+?)$"
name="RareItemTrigger"
omit_from_output="y"
regexp="y"
send_to="12"
sequence="100"
script="AddRareItem"
>
</trigger>
<trigger
custom_colour="6"
enabled="n"
match="^(.*?)rareloot gather complete(.*?)$"
name="EnableGatherRareLootTrigger"
omit_from_output="y"
regexp="y"
send_to="12"
sequence="100"
script="DisableTriggers"
>
</trigger>
<trigger
custom_colour="6"
enabled="y"
match="^Mr Werks hands you an official employment writ\.$"
name="writgiven"
omit_from_output="n"
regexp="y"
send_to="12"
sequence="100"
script="writgiven"
>
</trigger>
-- Change colour highlighting 0: red, 1: orange: 2: yellow 3: purple 4: 5+: aquamarine
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(@!HighlightZeroStock)"
name="colourtriggerzerostock"
expand_variables="y"
regexp="y"
repeat="y"
sequence="94"
other_text_colour="red"
>
</trigger>
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(@!HighlightOneStock)"
name="colourtriggeronestock"
expand_variables="y"
regexp="y"
repeat="y"
sequence="95"
other_text_colour="orange"
>
</trigger>
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(@!HighlightTwoStock)"
name="colourtriggertwostock"
expand_variables="y"
regexp="y"
repeat="y"
sequence="96"
other_text_colour="yellow"
>
</trigger>
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(@!HighlightThreeStock)"
name="colourtriggerthreestock"
expand_variables="y"
regexp="y"
repeat="y"
sequence="97"
other_text_colour="purple"
>
</trigger>
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(@!HighlightFourStock)"
name="colourtriggerfourstock"
expand_variables="y"
regexp="y"
repeat="y"
sequence="98"
other_text_colour="aquamarine"
>
</trigger>
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="(@!HighlightFiveStock)"
name="colourtriggerfivestock"
expand_variables="y"
regexp="y"
repeat="y"
sequence="99"
other_text_colour="lightpink"
>
</trigger>
-- end Change colour highlighting 0: red, 1: orange: 2: yellow 3: purple 4: aquamarine 5+: lightpink
<trigger
custom_colour="1"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^You are required to deliver (?P<rareItem>.*?) to (?P<recipient>.*?) at (?P<place>.*?)(\.| on (?P<street>.*?)\.)$"
regexp="y"
repeat="y"
send_to="10"
sequence="100"
script="SendToMUD"
>
</trigger>
<trigger
custom_colour="1"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^\[ \] (?P<rareItem>.*?) to (?P<recipient>.*?) at (?P<place>.*?) (in|on) (?P<street>.*?)\.$"
regexp="y"
repeat="y"
send_to="10"
sequence="100"
script="MultiDelivery"
>
</trigger>
</triggers>
<variables>
<variable name="MinStock">2</variable>
<variable name="MaxStock">5</variable>
</variables>
<!-- Plugin help -->
<aliases>
<alias
script="ShowCommands"
match="rareloot help"
enabled="y"
>
</alias>
<alias
script="ShowCommands"
match="rareloot commands"
enabled="y"
>
</alias>
<alias
script="UpdateStock"
match="rareloot update"
enabled="y"
>
</alias>
<alias
script="ShowShoppingList"
match="rareloot shoppinglist"
enabled="y"
>
</alias>
<alias
script="ShowMovingList"
match="rareloot movinglist"
enabled="y"
>
</alias>
<alias
script="ToggleNicknameShoppingList"
match="rareloot togglensl"
enabled="y"
>
</alias>
<alias
script="ToggleNicknameMovingList"
match="rareloot togglenml"
enabled="y"
>
</alias>
<alias
script="GetMaxStock"
match="rareloot getmax"
enabled="y"
>
</alias>
<alias
script="GetMinStock"
match="rareloot getmin"
enabled="y"
>
</alias>
<alias
script="CreateGetMoving"
match="rareloot getmoving"
enabled="y"
>
</alias>
<alias
script="ShowHighlighted"
match="rareloot highlight"
enabled="y"
>
</alias>
<alias
script="ShowAll"
match="rareloot all"
enabled="y"
>
</alias>
<alias
script="FindItemCount"
match="rareloot find (?P<rareItem>.*)"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
<alias
script="SetMinStock"
match="rareloot min (?P<minStock>.*)"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
<alias
script="SetMaxStock"
match="rareloot max (?P<maxStock>.*)"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
</alias>
</aliases>
<script>
<![CDATA[
require "serialize"
require "tprint"
Perams = {}
function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end -- function OnHelp
function UpdateStock ()
-- set all stock to 0
ZeroStockMap ()
-- send alias gtiff glance things in furniture;frimble rareloot gather complete;unalias gtiff
Send ("alias gtiff glance things in furniture;frimble rareloot gather complete;unalias gtiff")
-- send gtiff
Send ("gtiff")
-- enable gather stock trigger
world.EnableTrigger("RareItemTrigger",true)
end -- function UpdateStock
function ZeroStockMap ()
RareItemsMap = {
--["hot fudge sundae"]=0, --perishable
--["lamb chop"]=0, --perishable
--["ptourist pturban"]=0, -- perishable
--["red and green spotted mushroom"]=0, -- perishable
["abacus"]=0,
["aikuchi dagger"]=0,
["amcw badge"]=0,
["amulet of confession"]=0,
["beaded belly chain"]=0,
["begging tin"]=0,
["black bandana"]=0,
["black cotton dress"]=0,
["black lace shawl"]=0,
["black silk zubon"]=0,
["black sowrong"]=0,
["blue kerchief"]=0,
["blue obi"]=0,
["boxing ring"]=0,
["bright copper armband"]=0,
["bright copper necklet"]=0,
["brown felt hat"]=0,
["clump of golden chains"]=0,
["cotton socks"]=0,
["crescent moon shield"]=0,
["curved sword"]=0,
["dark blue tricorn"]=0,
["dark green obi"]=0,
["dark skirt"]=0,
["deluxe lockpick"]=0,
["dentist's trousers"]=0,
["dirty grey robe"]=0,
["dusty blue himation"]=0,
["fancy thobe"]=0,
["filigree hairpin"]=0,
["fouled nightshirt"]=0,
["frayed trousers"]=0,
["freshwater pearl bracelet"]=0,
["gold-trimmed obi"]=0,
["greasy white apron"]=0,
["green linen gown"]=0,
["green smock"]=0,
["green trousers"]=0,
["green wool shirt"]=0,
["grey pleated skirt"]=0,
["grey woollen gown"]=0,
["hessian robe"]=0,
["horsehair-crested bronze helm"]=0,
["huge fruit covered hat"]=0,
["jiann"]=0,
["kogake tabi"]=0,
["laced sandals"]=0,
["lacy bloomers"]=0,
["leaf-bladed dagger"]=0,
["leather protective"]=0,
["leather shield strap"]=0,
["lobster cracker"]=0,
["maze toe ring"]=0,
["newt bangle"]=0,
["okobo"]=0,
["old green cloak"]=0,
["old shirt"]=0,
["old trousers"]=0,
["old worn cane"]=0,
["oyster knife"]=0,
["palm frond hat"]=0,
["peach pumps"]=0,
["pirate's shirt"]=0,
["plain linen kilt"]=0,
["plain white cotton blouse"]=0,
["plain white thobe"]=0,
["purple-black trousers"]=0,
["push-up breastplate"]=0,
["ripped shirt"]=0,
["rough hessian trousers"]=0,
["rubber apron"]=0,
["rubber chicken"]=0,
["sexy white linen loincloth"]=0,
["shimmering fish scale bodysuit"]=0,
["shiny blue ribbon"]=0,
["short-sleeved white cotton shirt"]=0,
["sickly yellow robe"]=0,
["small badge"]=0,
["small ruby ring"]=0,
["startling green dress"]=0,
["stout vest"]=0,
["tacticus academy tie"]=0,
["torn trousers"]=0,
["white Djelian loincloth"]=0,
["white boxer shorts with red polka-dots"]=0,
["white cotton bodice"]=0,
["white smock"]=0,
["wolf pelt"]=0,
["yellow braces"]=0,
["yellow ribbon"]=0,
["yellow smock"]=0,
}
end -- function ZeroStockMap
function AddRareItem (name, line, wildcards)
--Note (wildcards.rareItem)
for k, v in pairs (RareItemsMap) do
-- find match
if (string.match(Simplify(wildcards.rareItem),Simplify(k))) then
--Note (wildcards.rareItem)
--Note (v)
RareItemsMap [k] = v+1
end -- if match
--print (k, v)
end -- for
-- enable end gather stock trigger
world.EnableTrigger("EnableGatherRareLootTrigger",true)
end -- function AddRareItem
function DisableTriggers ()
world.EnableTrigger("EnableGatherRareLootTrigger",false)
world.EnableTrigger("RareItemTrigger",false)
-- Note ("Triggers Off")
CreateShoppingList ()
CreateMovingList ()
CreateMovingListNickname ()
CreateShoppingListNickname ()
end -- function DisableTriggers
function CreateShoppingList ()
if (RareItemsMap == null) then
Note ("Debug: Uh oh, RareItemsMap is empty!")
else
ShoppingList = {}
local HighlightZeroStock = "" -- red
local HighlightOneStock = "" -- orange
local HighlightTwoStock = "" -- yellow
local HighlightThreeStock = "" -- purple
local HighlightFourStock = "" -- aquamarine
local HighlightFiveStock = "" -- lightpink
for k, v in pairs (RareItemsMap) do
if (v <= Perams.MinStock) then
ShoppingList[k] = v
end -- if out of stock
-- Change colour highlighting 0: red, 1: orange: 2: yellow 3: purple 4: 5+: aquamarine
--Note ("Debug: v: " .. v)
if (v == 0) then
if (HighlightZeroStock == "") then
Perams.HighlightZeroStock = HighlightZeroStock .. k
else
HighlightZeroStock = HighlightZeroStock .. "|" .. k
end -- if
end -- if
if (v == 1) then
if (HighlightOneStock == "") then
HighlightOneStock = HighlightOneStock .. k
else
HighlightOneStock = HighlightOneStock .. "|" .. k
end -- if
end -- if
if (v == 2) then
if (HighlightTwoStock == "") then
HighlightTwoStock = HighlightTwoStock .. k
else
HighlightTwoStock = HighlightTwoStock .. "|" .. k
end -- if
end -- if
if (v == 3) then
if (HighlightThreeStock == "") then
HighlightThreeStock = HighlightThreeStock .. k
else
HighlightThreeStock = HighlightThreeStock .. "|" .. k
end -- if
end -- if
if (v == 4) then
if (HighlightFourStock == "") then
HighlightFourStock = HighlightFourStock .. k
else
HighlightFourStock = HighlightFourStock .. "|" .. k
end -- if
end -- if
if (v >= 5) then
if (HighlightFiveStock == "") then
HighlightFiveStock = HighlightFiveStock .. k
else
HighlightFiveStock = HighlightFiveStock .. "|" .. k
end -- if
end -- if
end -- for
SetVariable ("HighlightZeroStock", HighlightZeroStock)
SetVariable ("HighlightOneStock", HighlightOneStock)
SetVariable ("HighlightTwoStock", HighlightTwoStock)
SetVariable ("HighlightThreeStock", HighlightThreeStock)
SetVariable ("HighlightFourStock", HighlightFourStock)
SetVariable ("HighlightFiveStock", HighlightFiveStock)
Hyperlink ("rareloot shoppinglist", "rareloot shoppinglist", "", "", 0)
Note (" - show items out of stock")
--ShowShoppingList ()
--Note ("Debug: HighlightZeroStock: " .. HighlightZeroStock)
--Note ("Debug: HighlightOneStock: " .. HighlightOneStock)
--Note ("Debug: HighlightTwoStock: " .. HighlightTwoStock)
--Note ("Debug: HighlightThreeStock: " .. HighlightThreeStock)
--Note ("Debug: HighlightFourStock: " .. HighlightFourStock)
--Note ("Debug: HighlightFiveStock: " .. HighlightFiveStock)
end -- if RareItemsMap empty
end -- function CreateShoppingList
function CreateMovingList ()
if (RareItemsMap == null) then
else
MovingList = {}
for k, v in pairs (RareItemsMap) do
if (v > Perams.MaxStock) then
MovingList[k] = v
end -- if too many in stock
end -- for
Hyperlink ("rareloot movinglist", "rareloot movinglist", "", "", 0)
Note (" - show items that can be moved into another room")
--ShowMovingList ()
end -- if RareItemsMap empty
end -- function CreateMovingList
function ShowShoppingList ()
if (ShoppingList == null) then
UpdateNeeded ()
else
Note ("Shopping List")
ShoppingListItemCount = 0
--table.sort(ShoppingList)
--tprint (ShoppingList)
for k, v in pairs (ShoppingList) do
if (v == 0) then
ColourNote("red", "black", "" .. k .. " : " .. v .. "")
elseif (v == 1) then
world.ColourNote ("orange", "black", k .. " : " .. v)
elseif (v == 2) then
world.ColourNote ("purple", "black", k .. " : " .. v)
else
Note (k .. " : " .. v)
end -- if
ShoppingListItemCount = ShoppingListItemCount + 1
end -- for
Note ("Total types of item to acquire: " .. ShoppingListItemCount)
end -- if
end -- function ShowShoppingList
function ShowMovingList ()
if (MovingList == null) then
UpdateNeeded ()
else
MovingListItemCount = 0
Note ("Moving List")
--tprint (MovingList)
for k, v in pairs (MovingList) do
if (v >= Perams.MaxStock + 3) then
world.ColourNote ("red", "black", k .. " : " .. v)
elseif (v == Perams.MaxStock + 2) then
world.ColourNote ("orange", "black", k .. " : " .. v)
else
world.ColourNote ("purple", "black", k .. " : " .. v)
end -- if
MovingListItemCount = MovingListItemCount + 1
end -- for
Note ("Total types of item to move: " .. MovingListItemCount)
end -- if
end -- function ShowMovingList
function FindItemCount (name, line, wildcards)
if RareItemsMap == null then
UpdateNeeded ()
else
Note ("Searching for " .. wildcards.rareItem)
Count = 0
Stock = 0
Found = false
for k, v in pairs (RareItemsMap) do
-- find match
if (string.match(Simplify(k),Simplify(wildcards.rareItem,"-",""))) then
Count = Count +1
Stock = Stock + v
if (v == 0) then NoteColour = "red" end -- if
if (v == 1) then NoteColour = "orange" end -- if
if (v == 2) then NoteColour = "purple" end -- if
if (v >= 3) then NoteColour = "green" end -- if
world.ColourNote (NoteColour, "black", v .. " of " .. k)
Found = true
end -- if match
end -- for
if (Found == false) then
finditem = string.gsub(wildcards.rareItem, "^a ","")
finditem = string.gsub(finditem, "^an ","")
finditem = "minimap item " .. finditem
Execute (finditem)
else
Note ("Total types found: " .. Count)
Note ("Total stock items: " .. Stock)
end -- if
end -- if RareItemsMap is empty
end -- function FindItemCount
function CreateShoppingListNickname ()
CreateShoppingList ()
if (Perams.NicknameShoppingListEnabled == true) then
NicknameShoppingList = ""
for k, v in pairs (ShoppingList) do
if (NicknameShoppingList) == "" then
NicknameShoppingList = k
else
NicknameShoppingList = NicknameShoppingList .. "&" .. k
end -- if NicknameShoppingList empty
end -- for
--Note ("Shopping List: " .. NicknameShoppingList)
if (NicknameShoppingList ~= "") then
Send ("nickname " .. NicknameShoppingList .. " as shoppinglist")
end -- if
end -- if NicknameShoppingListEnabled
end -- function CreateShoppingListNickname
function CreateMovingListNickname ()
if (Perams.NicknameMovingListEnabled == true) then
-- Note ("Debug: Moving list nickname being created.")
NicknameMovingList = ""
for k, v in pairs (MovingList) do
if (NicknameMovingList == "") then
NicknameMovingList = k
else
NicknameMovingList = NicknameMovingList .. "&" .. k
end -- if NicknameMovingList empty
end -- for
-- Note ("Debug: Moving List: " .. NicknameMovingList)
if (NicknameMovingList == "") then
NicknameMovingList = "Nothing"
end -- if
Send ("nickname " .. NicknameMovingList .. " as movinglist")
end -- if NicknameShoppingListEnabled
CreateGetMoving ()
end -- function CreateMovingListNickname
function OnPluginInstall ()
LoadPerams ()
end -- function OnPluginInstall
function LoadPerams ()
-- Note ("Debug: Loading perameters ...")
assert (loadstring (GetVariable ("Perams") or "")) ()
assert (loadstring (GetVariable ("RareItemsMap") or "")) ()
assert (loadstring (GetVariable ("ShoppingList") or "")) ()
assert (loadstring (GetVariable ("MovingList") or "")) ()
if (Perams.MaxStock == nil) then
-- Note ("Debug: Not loaded. Creating Perams:")
Perams = {
MaxStock = 5,
MinStock = 2,
NicknameMovingListEnabled = true,
NicknameShoppingListEnabled = true,
}
end -- if
Perams.AllRareLoot = "zxcvbnm|abacus|aikuchi dagger|AMCW badge|amulet of confession|beaded belly chain|begging tin|black bandana|black cotton dress|black lace shawl|black silk zubon|black sowrong|blue kerchief|blue obi|boxing ring|bright copper armband|bright copper necklet|brown felt hat|clump of golden chains|cotton socks|crescent moon shield|curved sword|dark blue tricorn|dark green obi|dark skirt|deluxe lockpick|dirty grey robe|dusty blue himation|fancy thobe|filigree hairpin|fouled nightshirt|frayed trousers|freshwater pearl bracelet|gold-trimmed obi|greasy white apron|green linen gown|green smock|green trousers|green wool shirt|grey pleated skirt|grey woollen gown|hessian robe|horsehair-crested bronze helm|hot fudge sundae|huge fruit covered hat|kogake tabi|lacy bloomers|lamb chop|leaf-bladed dagger|leather protective|leather shield strap|lobster cracker|maze toe ring|newt bangle|okobo|old green cloak|old shirt|old worn cane|oyster knife|pair of cotton socks|pair of dentist's trousers|pair of frayed trousers|pair of green trousers|jiann|pair of kogake tabi|pair of laced sandals|pair of old trousers|pair of peach pumps|pair of purple-black trousers|pair of torn trousers|pair of white boxer shorts with red polka-dots|pair of yellow braces|palm frond hat|pirate's shirt|plain linen kilt|plain white cotton blouse|plain white thobe|ptourist pturban|push-up breastplate|red and green spotted mushroom|ripped shirt|rough hessian trousers|rubber apron|rubber chicken|sexy white linen loincloth|shimmering fish scale bodysuit|shiny blue ribbon|short-sleeved white cotton shirt|sickly yellow robe|small badge|small ruby ring|startling green dress|Tacticus Academy tie|torn trousers|wolf pelt|yellow ribbon|yellow smock|white cotton bodice|white smock|mnbvcxz"
--tprint (Perams)
end -- function LoadPerams
function OnPluginSaveState ()
--Note ("Saving Rareloot Perameters...")
SetVariable ("Perams", "Perams = " .. serialize.save_simple (Perams))
SetVariable ("RareItemsMap", "RareItemsMap = " .. serialize.save_simple (RareItemsMap))
SetVariable ("ShoppingList", "ShoppingList = " .. serialize.save_simple (ShoppingList))
SetVariable ("MovingList", "MovingList = " .. serialize.save_simple (MovingList))
end -- function OnPluginSaveState
function SetMaxStock (name,line,wildcards)
-- tprint (wildcards)
Perams.MaxStock = tonumber (wildcards[1])
Note ("Maximum stock set to: " .. Perams.MaxStock)
SetChanged (true)
tprint (Perams)
CreateMovingList ()
OnPluginSaveState ()
GetMaxStock ()
end -- function SetMaxStock
function SetMinStock (name,line,wildcards)
Perams.MinStock = tonumber (wildcards[1])
Note ("Minimum stock set to: " .. Perams.MinStock)
SetChanged (true)
tprint (Perams)
CreateShoppingList ()
OnPluginSaveState ()
GetMinStock ()
end -- function SetMinStock
function GetMinStock ()
Note ("Minimum: " .. Perams.MinStock)
end -- function GetMinStock
function GetMaxStock ()
Note ("Maximum: " .. Perams.MaxStock)
end -- function GetMaxStock
function ToggleNicknameMovingList ()
if (Perams.NicknameMovingListEnabled == true) then
Perams.NicknameMovingListEnabled = false
Note ("Moving List nickname creation is set to off")
else
Perams.NicknameMovingListEnabled = true
Note ("Moving List nickname creation is set to on")
CreateMovingListNickname ()
end -- if NicknameMovingListEnabled
SetChanged (true)
OnPluginSaveState ()
end -- function ToggleNicknameMovingList
function ToggleNicknameShoppingList ()
if (Perams.NicknameShoppingListEnabled == true) then
Perams.NicknameShoppingListEnabled = false
Note ("Shopping List nickname creation is set to off")
CreateShoppingListNickname ()
else
Perams.NicknameShoppingListEnabled = true
Note ("Shopping List nickname creation is set to on")
end -- if NicknameShoppingListEnabled
SetChanged (true)
OnPluginSaveState ()
CreateShoppingListNickname ()
end -- function ToggleNicknameShoppingList
function Simplify (stringToSimplify)
return string.gsub(string.gsub(string.lower(stringToSimplify),"-",""),"'","")
end -- function Simplify
function UpdateNeeded ()
ColourTell ("red","blue","You need to go into a room where furniture holds rare delivery items and ")
Hyperlink ("!!95cbfe2b1aa26d9a225dca1f:UpdateStock()", "rareloot update", "", "red", "blue", 0)
Note ("")
end -- function UpdateNeeded
function CreateGetMoving ()
if (MovingList == nil) then
UpdateNeeded ()
return
end -- if
--Note ("Debug: Starting to create the getmoving alias.")
getMovingAlias = "alias getmoving "
getMovingItems = 0
for k, v in pairs (MovingList) do
if (getMovingItems > 10) then
else
getMovingAmount = (v - Perams.MaxStock)
if (getMovingItems + getMovingAmount >= 10 ) then
getMovingAmount = (10 - getMovingItems)
end -- if
for i = 1, getMovingAmount do
getMovingAlias = getMovingAlias .. "get at most 1 " .. k .. " from furniture;"
getMovingItems = getMovingItems + 1
end -- for
end -- if
end -- for
getMovingAlias = getMovingAlias .. ";unalias getmoving"
if (getMovingItems > 0 ) then
--Note ("Debug: " .. getMovingItems)
--Note ("Debug: getmoving alias creation done '" .. getMovingAlias .. "'")
Send (getMovingAlias)
Hyperlink ("getmoving", "getmoving", "", "", 0)
Note (" alias added.")
--Note ("Debug: Alias 'getmoving' created.")
else
--Note ("Alias not created - apparently, there are no items to move. The cake is a lie!")
end -- if
end -- function CreateGetMoving
function writgiven ()
-- Execute ("read writ")
DoAfter (1, "read writ")
end -- function writgiven
function ShowHighlighted ()
Perams.HighlightList = Perams.HighlightList or ""
if (Perams.HighlightList == "") then
CreateShoppingList ()
end -- if
--Note ("Debug: Perams.HighlightList: " .. Perams.HighlightList)
end -- function ShowHighlighted
--LoadPerams ()
function ShowAll()
Execute ("rareloot find ")
end -- function ShowAll
function SendToMUD (name, line, wildcards)
--match="^You are required to deliver (?P<rareItem>.*?) to (?P<recipient>.*?) at(?P<place>.*?)(\.| on (?P<street>.*?)\.)$"
--Note ("Debug: 1: " .. wildcards.rareItem)
--Note ("Debug: 2: " .. wildcards.recipient)
--Note ("Debug: 3: " .. wildcards.place)
--Note ("Debug: 4: " .. wildcards.street)
SetClipboard (wildcards.rareItem)
Note ("\'" .. wildcards.rareItem .. "\' added to clipboard.")
deliverline = string.gsub (wildcards.place,"^a ","", 1)
deliverline = string.gsub (deliverline,"^an ","", 1)
deliverline = string.gsub (deliverline,"^the ","", 1)
deliverline = "minimap " .. deliverline
findline = string.gsub (wildcards.rareItem,"^a ","", 1 )
findline = string.gsub (findline,"^an ","", 1 )
findline = string.gsub (findline,"^pair of ","", 1 )
findline = "rareloot find " .. findline
--Note ("Debug: " .. findline)
Execute (findline)
Execute (deliverline)
--Note ("Debug: " .. deliverline)
Execute ("alias deliver deliver " .. wildcards.rareItem .. " to " .. wildcards.recipient .. ";eat writ except scrolls;unalias deliver")
end -- function SendToMUD
function MultiDelivery (name,line,wildcards)
end -- function MultiDelivery
function ShowCommands ()
Hyperlink ("rareloot help", "rareloot help", "", "", 0)
Note (" - this information")
Hyperlink ("rareloot update", "rareloot update", "", "", 0)
Note (" - update tables of current rare item delivery stock")
Hyperlink ("rareloot shoppinglist", "rareloot shoppinglist", "", "", 0)
Note (" - show items out of stock")
Hyperlink ("rareloot movinglist", "rareloot movinglist", "", "", 0)
Note (" - show items that can be moved into another room")
Hyperlink ("rareloot find ", "rareloot find", "", "", 0)
Note (" - show the count of the rare delivery item in stock, or add a space to list all items")
Note ("rareloot max <number> - set the maximum number of an item to keep")
Note ("rareloot min <number> - set the minimum number of an item to keep")
Hyperlink ("rareloot getmax", "rareloot getmax", "", "", 0)
Note (" - show the maximum number of an item to keep")
Hyperlink ("rareloot getmin", "rareloot getmin", "", "", 0)
Note (" - show the minimum number of an item to keep")
Hyperlink ("rareloot togglensl", "rareloot togglensl", "", "", 0)
Note (" - toggles whether the nickname for shopping list is created")
Hyperlink ("rareloot togglenml", "rareloot togglenml", "", "", 0)
Note (" - toggles whether the nickname for moving list is created")
Hyperlink ("rareloot getmoving", "rareloot getmoving", "", "", 0)
Note (" - creates an alias to get up to 10 rare items for moving to other storage.")
Hyperlink ("rareloot commands", "rareloot commands", "", "", 0)
Note (" - shows all rareloot commands")
Hyperlink ("rareloot all", "rareloot all", "", "", 0)
Note (" - show all items in stock")
end -- function ShowCommands
]]>
</script>
</muclient>