forked from Roll20/roll20-api-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdown.js
2259 lines (2230 loc) · 128 KB
/
down.js
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
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//A System for tracking Downtime Activities
//Made by Julexar (https://app.roll20.net/users/9989180/julexar)
//API Commands:
/* !down - will give you the menu
--Options--
--sel - use the selected character token
--name - use the character name
--charid - use the character id
*/
var Downtime = Downtime || (function(){
'use strict';
var version='0.9d',
setDefaults = function() {
state.down = {
now: {
time: 0,
type: "Week",
substr: "s",
dc: 0,
crimeval: 0,
train: "",
potion: "",
item: "",
minprice: 10,
maxprice: 1000,
}
};
},
setItemList = function() {
state.List = {
common: {
weapon: [
//Common Weapons
{
description: "An Armblade is a magic weapon that attaches to your arm, becoming inseperable from you as long as you\'re attuned to it. To attune to this item, you must hold it against your forearm for the entire attunement period.<br><br>As a bonus action, you can retract the armblade into your forearm or extend it from there. While it is extended, you can use the weapon as if you were holding it, and you can\'t use that hand for other purposes.",
attunement: true,
attune_requirement: "Warforged",
name: "Armblade",
specifics: "one-handed melee",
magicbonus: 0,
modifiers: "Item Type: Melee Weapon",
properties: "One-Handed"
},
{
description: "In darkness, the unsheathed blade of this sword sheds moonlight, creating bright light in a 15-foot radius and dim light for an additional 15 feet.",
attunement: false,
specifics: "sword",
name: "Moon-Touched Sword",
magicbonus: 0,
modifiers: "Item Type: Melee Weapon",
properties: ""
},
{
description: "This arrow can\'t be broken, except when it is within an Antimagic Field.",
attunement: false,
specifics: "arrow",
name: "Unbreakable Arrow",
magicbonus: 0,
modifiers: "Item Type: Ammunition",
properties: ""
},
{
description: "This ammunition packs a wallop. A creature hit by the ammunition must succeed on a DC 10 Strength saving throw or be knocked prone.",
attunement: false,
specifics: "ammunition",
name: "Walloping Ammunition",
magicbonus: 0,
modifiers: "Item Type: Ammunition",
properties: ""
}
],
armor: [
//Common Armor
{
description: "This armor never gets dirty.",
attunement: false,
specifics: "medium or heavy",
name: "Armor of Gleaming",
modifiers: "Item Type: Armor",
properties: ""
},
{
description: "You can doff this armor as an action",
attunement: false,
specifics: "any armor",
name: "Cast-Off Armor",
modifiers: "Item Type: Armor",
properties: ""
},
{
description: "The front of this shield is shaped in the likeness of a face. While bearing the shield, you can use a bonus action to alter the face\'s expression.",
attunement: false,
specifics: "shield",
name: "Shield of Expression",
modifiers: "Item Type: Shield, AC: 2",
properties: ""
},
{
description: "Wisps of harmless, odorless smoke rise from this armor while it is worn.",
attunement: false,
specifics: "any armor",
name: "Smoldering Armor",
modifiers: "Item Type: Armor",
properties: ""
}
],
accessoires: [
//Common Accessoires (Rings, Rods, Staffs, Wearables)
],
scroll: [
//Common Scrolls
],
misc: [
//Common misc Items (edibles & other things that don't belong in previous categories)
]
},
uncommon: {
weapon: [
//Uncommon Weapons
],
armor: [
//Uncommon Armor
],
accessoires: [
//Uncommon Accessoires (Rings, Rods, Staffs, Wearables)
],
scroll: [
//Uncommon Scrolls
],
misc: [
//Uncommon misc Items (edibles & other things that don't belong in previous categories)
]
},
rare: {
weapon: [
//Rare Weapons
],
armor: [
//Rare Armor
],
accessoires: [
//Rare Accessoires (Rings, Rods, Staffs, Wearables)
],
scroll: [
//Rare Scrolls
],
misc: [
//Rare misc Items (edibles & other things that don't belong in previous categories)
]
},
very_rare: {
weapon: [
//Very Rare Weapons
],
armor: [
//Very Rare Armor
],
accessoires: [
//Very Rare Accessoires (Rings, Rods, Staffs, Wearables)
],
scroll: [
//Very Rare Scrolls
],
misc: [
//Very Rare misc Items (edibles & other things that don't belong in previous categories)
]
},
legendary: {
weapon: [
//Legendary Weapons
],
armor: [
//Legendary Armor
],
accessoires: [
//Legendary Accessoires (Rings, Rods, Staffs, Wearables)
],
scroll: [
//Legendary Scrolls
],
misc: [
//Legendary misc Items (edibles & other things that don't belong in previous categories)
]
}
};
},
handleInput = function(msg) {
var args=msg.content.split(/\s+--/);
if (msg.type!=="api") {
return;
}
if (playerIsGM(msg.playerid)) {
switch (args[0]) {
case '!setdown':
setdown(args[1],args[2],args[3],msg);
downmenu(args[1],msg);
return;
case '!setminbet':
let min=Number(String(args[1]).replace("amount ",""));
state.down.now.minprice=min;
downmenu(undefined,msg);
return;
case '!setmaxbet':
let max=Number(String(args[1]).replace("amount ",""));
state.down.now.maxprice=max;
downmenu(undefined,msg);
return;
}
}
switch (args[0]) {
case '!down':
downmenu(args[1],msg);
return;
case '!brewmenu':
brewmenu(args[1],args[2],args[3],msg);
return;
case '!brew':
brew(args[1],args[2],args[3],msg);
case '!craftmenu':
craftmenu(args[1],args[2],args[3],args[4],args[5],msg);
return;
case '!craft':
craft(args[1],args[2],args[3],args[4],msg);
return;
case '!trainmenu':
trainmenu(args[1],args[2],msg);
return;
case '!train':
train(args[1],args[2],args[3],msg);
return;
case '!crimemenu':
crimemenu(args[1],args[2],msg);
return;
case '!commit':
crime(args[1],args[2],msg);
return;
case '!setitem':
state.down.now.item=args[1];
craftmenu(args[2],args[3],args[4],args[5],msg);
return;
case '!researchmenu':
researchmenu(args[1],msg);
return;
case '!research':
research(args[1],args[2],msg);
return;
case '!gamblemenu':
gamblemenu(args[1],args[2],msg);
return;
case '!gamble':
gamble(args[1],args[2],msg);
return;
case '!work':
work(args[1],args[2],args[3],msg);
return;
case '!settrain':
state.down.now.train=args[3];
trainmenu(args[1],args[2],msg);
return;
}
},
downmenu = function(option,msg) {
var divstyle = 'style="width: 220px; border: 1px solid black; background-color: #ffffff; padding: 5px;"';
var astyle1 = 'style="text-align:center; border: 1px solid black; margin: 1px; background-color: #7E2D40; border-radius: 4px; box-shadow: 1px 1px 1px #707070; width: 100px;';
var astyle2 = 'style="text-align:center; border: 1px solid black; margin: 1px; background-color: #7E2D40; border-radius: 4px; box-shadow: 1px 1px 1px #707070; width: 150px;';
var tablestyle = 'style="text-align:center;"';
var arrowstyle = 'style="border: none; border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 195px solid rgb(126, 45, 64); margin-bottom: 2px; margin-top: 2px;"';
var headstyle = 'style="color: rgb(126, 45, 64); font-size: 18px; text-align: left; font-variant: small-caps; font-family: Times, serif;"';
var substyle = 'style="font-size: 11px; line-height: 13px; margin-top: -3px; font-style: italic;"';
let speakingName = msg.who;
let char;
if (option) {
if (option.includes('sel')) {
option.replace("sel","");
option=msg.selected;
let charid=getIDsFromTokens(option)[0];
char=findObjs({
_type: 'character',
_id: charid
})[0];
if (char) {
if (playerIsGM(msg.playerid)) {
let name=char.get('name');
char.get('gmnotes',function(gmnotes) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type ?{Player?|All|' + name + '} --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + gmnotes + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
});
} else {
char.get("gmnotes",function(gmnotes) {
if (gmnotes="") {
sendChat("Downtime","/w "+msg.who+" You do not have available Downtime!");
} else {
sendChat("Downtime","/w " + speakingName + " <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'Downtime: ' + gmnotes + //--
'</table>' + //--
'<br>' + //--
'<div style="text-align:center;">Available Downtime Activities</div>' + //--
'<br>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!brewmenu --charid ' + charid + ' --rarity ?{Type?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Brew Potion</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!craftmenu --charid ' + charid + ' --type ?{Type?|Weapon|Armor|Accessoires|Scroll|Misc} --rarity ?{Rarity?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Craft Items</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!work --charid ' + charid + ' --skill ?{Skill?|Acrobatics|Animal Handling|Arcana|Athletics|Deception|History|Insight|Intimidation|Investigation|Medicine|Nature|Perception|Performance|Persuasion|Religion|Sleight of Hand|Stealth|Survival} --time ?{Time?|1}">Work</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!trainmenu --charid ' + charid + ' --type ?{Type?|Tool|Language}">Train</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!crimemenu --charid ' + charid + ' --type ?{Type?|Stealth|Thieves\' Tools|Investigation|Perception|Deception}">Commit Crime</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!researchmenu --charid ' + charid + ' --price 50">Research</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!gamblemenu --charid ' + charid + ' --amount ?{Amount?|10}">Gamble</a></div>' + //--
'</div>'
);
}
});
}
} else {
sendChat("Downtime","/w " + msg.who + " The selected character doesn\'t exist!");
}
} else if (option.includes('name')) {
option.replace("name ","");
char=findObjs({
_type: 'character',
name: option
}, {caseInsensitive: true});
if (char && char.length>1) {
sendChar("Downtime","/w "+msg.who+" Multiple Characters with the same name exist, please select the token and use >>!down --sel<< instead");
} else if (char[0]) {
char=char[0];
if (playerIsGM(msg.playerid)) {
let name = char.get('name');
char.get('gmnotes',function(gmnotes) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type ?{Player?|All|' + name + '} --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + gmnotes + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
});
} else {
let charid=char.get('_id');
char.get("gmnotes",function(gmnotes) {
let time=String(gmnotes);
if (time=="") {
sendChat("Downtime","/w "+msg.who+" You do not have available Downtime!");
} else {
sendChat("Downtime","/w " + speakingName + " <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'Downtime: ' + time + //--
'</table>' + //--
'<br>' + //--
'<div style="text-align:center;">Available Downtime Activities</div>' + //--
'<br>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!brewmenu --charid ' + charid + ' --rarity ?{Type?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Brew Potion</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!craftmenu --charid ' + charid + ' --type ?{Type?|Weapon|Armor|Accessoires|Scroll|Misc} --rarity ?{Rarity?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Craft Items</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!work --charid ' + charid + ' --skill ?{Skill?|Acrobatics|Animal Handling|Arcana|Athletics|Deception|History|Insight|Intimidation|Investigation|Medicine|Nature|Perception|Performance|Persuasion|Religion|Sleight of Hand|Stealth|Survival} --time ?{Time?|1}">Work</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!trainmenu --charid ' + charid + ' --type ?{Type?|Tool|Language}">Train</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!crimemenu --charid ' + charid + ' --type ?{Type?|Stealth|Thieves\' Tools|Investigation|Perception|Deception}">Commit Crime</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!researchmenu --charid ' + charid + ' --price 50">Research</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!gamblemenu --charid ' + charid + ' --amount ?{Amount?|10}">Gamble</a></div>' + //--
'</div>'
);
}
});
}
}
} else if (option.includes('charid')) {
option.replace("charid ","");
char=findObjs({
_type: 'character',
_id: option
}, {caseInsensitive: true})[0];
if (char) {
if (playerIsGM(msg.playerid)) {
let name = char.get('name');
char.get('gmnotes',function(gmnotes) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type ?{Player?|All|' + name + '} --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + gmnotes + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
});
} else {
let charid=char.get('_id');
char.get("gmnotes",function(gmnotes) {
let time=String(gmnotes);
if (time=="") {
sendChat("Downtime","/w "+msg.who+" You do not have available Downtime!");
} else {
sendChat("Downtime","/w " + speakingName + " <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'Downtime: ' + time + //--
'</table>' + //--
'<br>' + //--
'<div style="text-align:center;">Available Downtime Activities</div>' + //--
'<br>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!brewmenu --charid ' + charid + ' --rarity ?{Type?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Brew Potion</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!craftmenu --charid ' + charid + ' --type ?{Type?|Weapon|Armor|Accessoires|Scroll|Misc} --rarity ?{Rarity?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Craft Items</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!work --charid ' + charid + ' --skill ?{Skill?|Acrobatics|Animal Handling|Arcana|Athletics|Deception|History|Insight|Intimidation|Investigation|Medicine|Nature|Perception|Performance|Persuasion|Religion|Sleight of Hand|Stealth|Survival} --time ?{Time?|1}">Work</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!trainmenu --charid ' + charid + ' --type ?{Type?|Tool|Language}">Train</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!crimemenu --charid ' + charid + ' --type ?{Type?|Stealth|Thieves\' Tools|Investigation|Perception|Deception}">Commit Crime</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!researchmenu --charid ' + charid + ' --price 50">Research</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!gamblemenu --charid ' + charid + ' --amount ?{Amount?|10}">Gamble</a></div>' + //--
'</div>'
);
}
});
}
} else {
sendChat("Downtime","/w "+msg.who+" No Characters with the given ID exist!");
}
} else if (option.includes("type")) {
option=option.replace("type ","");
if (option=="All") {
if (state.down.now.time>1) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type All --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + state.down.now.time + " " + state.down.now.type + state.down.now.substr + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
} else {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type All --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + state.down.now.time + " " + state.down.now.type + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
}
} else if (option!=="All") {
option=option.replace("type ","");
let char=findObjs({
_type: 'character',
name: option
}, {caseInsensitive: true})[0];
if (char) {
if (playerIsGM(msg.playerid)) {
let name=option;
char.get('gmnotes',function(gmnotes) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type ?{Player?|All|' + name + '} --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + gmnotes + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
});
}
} else {
if (state.down.now.time>1) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type All --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + state.down.now.time + " " + state.down.now.type + state.down.now.substr + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
} else {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type All --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + state.down.now.time + " " + state.down.now.type + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
}
}
}
}
} else {
if (playerIsGM(msg.playerid)) {
let char=findObjs({
_type: 'character',
name: msg.who
}, {caseInsensitive: true})[0];
if (char) {
let name = char.get('name');
char.get('gmnotes',function(gmnotes) {
let time=gmnotes;
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type ?{Player?|All|' + name + '} --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + time + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
});
} else {
if (state.down.now.time>1) {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type All --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + state.down.now.time + " " + state.down.now.type + state.down.now.substr + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
} else {
sendChat("Downtime","/w gm <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Downtime: </td><td><a ' + astyle1 + '" href="!setdown --type All --amount ?{Amount?|1} --timetype ?{Type?|Day|Week|Month|Year}">' + state.down.now.time + " " + state.down.now.type + '</a></td></tr>' + //--
'<tr><td>Min Bet: </td><td><a ' + astyle1 + '" href="!setminbet --amount ?{Amount?|10}">' + state.down.now.minprice + ' GP</a></td></tr>' + //--
'<tr><td>Max Bet: </td><td><a ' + astyle1 + '" href="!setmaxbet --amount ?{Amount?|1000}">' + state.down.now.maxprice + ' GP</a></td></tr>' + //--
'</table>' + //--
'</div>'
);
}
}
} else {
let char = findObjs({
_type: 'character',
name: msg.who
}, {caseInsensitive: true})[0];
if (char) {
let charid=char.get('_id');
char.get("gmnotes",function(gmnotes) {
let time=String(gmnotes);
if (time=="") {
sendChat("Downtime","/w "+msg.who+" You do not have available Downtime!");
} else {
sendChat("Downtime","/w " + speakingName + " <div "+ divstyle + ">" + //--
'<div ' + headstyle + '>Downtime</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'Downtime: ' + time + //--
'</table>' + //--
'<br>' + //--
'<div style="text-align:center;">Available Downtime Activities</div>' + //--
'<br>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!brewmenu --charid ' + charid + ' --rarity ?{Type?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Brew Potion</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!craftmenu --charid ' + charid + ' --type ?{Type?|Weapon|Armor|Accessoires|Scroll|Misc} --rarity ?{Rarity?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ?{Amount?|1}">Craft Items</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!work --charid ' + charid + ' --skill ?{Skill?|Acrobatics|Animal Handling|Arcana|Athletics|Deception|History|Insight|Intimidation|Investigation|Medicine|Nature|Perception|Performance|Persuasion|Religion|Sleight of Hand|Stealth|Survival} --time ?{Time?|1}">Work</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!trainmenu --charid ' + charid + ' --type ?{Type?|Tool|Language}">Train</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!crimemenu --charid ' + charid + ' --type ?{Type?|Stealth|Thieves\' Tools|Investigation|Perception|Deception}">Commit Crime</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!research --charid ' + charid + ' --price 50">Research</a></div>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!gamblemenu --charid ' + charid + ' --amount ?{Amount?|10}">Gamble</a></div>' + //--
'</div>'
);
}
});
} else {
sendChat("Downtime","/w "+msg.who+" Please select a character either as the one you're speaking as or by using one of these Options:<br>--sel (select the character token)<br>--name {Character Name}<br>--charid {Character ID}");
}
}
}
},
createHandout = function(charid,msg) {
let char=findObjs({
_type: 'character',
_id: charid
}, {caseInsensitive: true})[0];
if (char) {
let playerid = char.get('controlledby');
let existing=findObjs({
_type: 'handout',
});
let count=0;
let multiple=false;
let handid;
_.each(existing,function(handout) {
let name=handout.get('name');
if (name.includes("Downtime Activities") && name.includes(char.get('name'))) {
count=Number(name.replace("Downtime Activities of "+char.get('name')+" #",""));
if (name.includes(String(count))) {
handid=handout.get('_id');
}
}
})
if (count==0) {
count=1;
} else {
count+=1;
}
char.get('gmnotes',function(gmnotes) {
let notes=gmnotes;
let handout=createObj('handout',{
name: 'Downtime Activities of '+char.get('name')+" #"+count,
inplayerjournals: playerid,
controlledby: msg.playerid,
});
handout.set('notes',"Total Downtime: "+notes);
});
}
},
setHandoutDesc = function(playerid,num,description) {
num=Number(num);
let handout=findObjs({
_type: 'handout',
});
let id;
_.each(handout,function(object) {
let name=object.get('name');
let injournal=object.get('inplayerjournals');
if (name.includes("Downtime Activities")) {
if (name.includes(String(num))) {
if (injournal.includes(playerid)) {
id=object.get('_id');
}
} else {
sendChat("Downtime","/w gm A Handout with that Number does not exist!");
}
}
});
handout=findObjs({
_type: 'handout',
_id: id
})[0];
handout.get("notes",function(notes) {
let nnotes=String(notes)+description;
let newHand=createObj('handout',{
name: handout.get('name'),
inplayerjournals: handout.get('inplayerjournals'),
controlledby: handout.get("controlledby")
});
newHand.set("notes",nnotes);
});
handout.remove();
},
getHandoutNum = function(playerid,charid) {
let handout=findObjs({
_type: 'handout',
});
let char=findObjs({
_type: 'character',
_id: charid
})[0];
let num;
_.each(handout,function(object) {
let name=object.get('name');
let injournal=object.get('inplayerjournals');
if ((name.includes("Downtime Activities") && name.includes(char.get('name')))&&String(injournal).includes(playerid)) {
num=Number(name.replace("Downtime Activities of "+char.get('name')+" #",""));
}
});
log(num);
return num;
},
getIDsFromTokens = function (selected) {
return (selected || []).map(obj => getObj("graphic", obj._id))
.filter(x => !!x)
.map(token => token.get("represents"))
.filter(id => getObj("character", id || ""));
},
setdown = function(player,amount,type,msg) {
amount=Number(amount.replace("amount ",""));
type=type.replace("timetype ","");
player=player.replace("type ","");
if (player=="All") {
state.down.now.time=amount;
state.down.now.type=type;
let characters=findObjs({
_type: 'character'
});
var realamount=0;
switch (type) {
case 'Week':
realamount+=amount*7;
break;
case 'Month':
realamount+=amount*30;
break;
case 'Year':
realamount+=amount*360;
break;
case 'Day':
realamount=amount;
break;
}
_.each(characters,function(attr) {
if (attr.get('inplayerjournals')!=="") {
if (realamount>1) {
attr.set('gmnotes',realamount+" Days");
} else if (realamount==1) {
attr.set('gmnotes',realamount+" Day");
} else {
attr.set('gmnotes',"");
}
let id=attr.get('_id');
createHandout(id,msg);
}
});
} else {
let char=findObjs({
_type: 'character',
name: player
}, {caseInsensitive: true})[0];
let id=char.get('_id');
var realamount=0;
switch (type) {
case 'Week':
realamount+=amount*7;
break;
case 'Month':
realamount+=amount*30;
break;
case 'Year':
realamount+=amount*360;
break;
case 'Day':
realamount=amount;
break;
}
if (realamount>1) {
char.set('gmnotes',realamount+" Days");
} else if (realamount==1) {
char.set('gmnotes',realamount+" Day");
} else {
char.set('gmnotes',"");
}
createHandout(id,msg);
}
},
brewmenu = function(charid,type,amount,msg) {
var divstyle = 'style="width: 220px; border: 1px solid black; background-color: #ffffff; padding: 5px;"';
var astyle1 = 'style="text-align:center; border: 1px solid black; margin: 1px; background-color: #7E2D40; border-radius: 4px; box-shadow: 1px 1px 1px #707070; width: 100px;';
var astyle2 = 'style="text-align:center; border: 1px solid black; margin: 1px; background-color: #7E2D40; border-radius: 4px; box-shadow: 1px 1px 1px #707070; width: 150px;';
var tablestyle = 'style="text-align:center;"';
var arrowstyle = 'style="border: none; border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 195px solid rgb(126, 45, 64); margin-bottom: 2px; margin-top: 2px;"';
var headstyle = 'style="color: rgb(126, 45, 64); font-size: 18px; text-align: left; font-variant: small-caps; font-family: Times, serif;"';
var substyle = 'style="font-size: 11px; line-height: 13px; margin-top: -3px; font-style: italic;"';
let potionlist;
let price;
let time;
type=type.replace("rarity ","");
charid=charid.replace("charid ","");
amount=Number(amount.replace("amount ",""));
switch (type) {
case 'Common':
potionlist="Potion of Climbing,Potion of Healing";
time=1;
price=25;
break;
case 'Uncommon':
potionlist="Oil of Slipperiness,Philter of Love,Potion of Advantage,Potion of Animal Friendship,Potion of Fire Breath,Potion of Hill Giant Strength,Potion of Growth,Potion of Healing (Greater),Potion of Poison,Potion of Resistance,Potion of Water Breathing";
time=5;
price=100;
break;
case 'Rare':
potionlist="Elixir of Health,Oil of Etherealness,Potion of Aqueous Form,Potion of Clairvoyance,Potion of Diminution,Potion of Gaseous Form,Potion of Frost Giant Strength,Potion of Stone Giant Strength,Potion of Fire Giant Strength,Potion of Cloud Giant Strength,Potion of Healing (Superior),Potion of Heroism,Potion of Invulnerability,Potion of Maximum Power,Potion of Mind Control (Beast),Potion of Mind Control (Humanoid),Potion of Mind Reading";
time=25;
price=1000;
break;
case 'Very Rare':
potionlist="Oil of Sharpness,Potion of Flying,Potion of Healing (Supreme),Potion of Invisibility,Potion of Longevity,Potion of Mind Control (Monster),Potion of Possibility,Potion of Speed,Potion of Vitality";
time=60;
price=10000;
break;
case 'Legendary':
potionlist="Potion of Dragon\'s Majesty,Potion of Storm Giant Strength";
time=125;
price=50000;
break;
}
let list;
for (let i=0;i<15;i++) {
list=potionlist.replace(',','|');
}
time*=amount;
price*=amount;
let char=findObjs({
_type: 'character',
_id: charid
}, {caseInsensitive: true})[0];
char.get("gmnotes",function(gmnotes){
let ntime=gmnotes.replace(" Days","");
if (Number(ntime)<time) {
sendChat("Downtime","/w "+msg.who+" You do not have enough time to do that!");
} else {
let gold=findObjs({
_type: 'attribute',
_characterid: charid,
_name: "gp"
}, {caseInsensitive: true})[0];
let cur=gold.get('current');
if (Number(cur)<price) {
sendChat("Downtime","/w "+msg.who+" You do not have enough money to do that!");
} else {
sendChat("Downtime","/w "+msg.who+" <div " + divstyle + ">" + //--
'<div ' + headstyle + '>Brewing</div>' + //--
'<div ' + substyle + '>Menu</div>' + //--
'<div ' + arrowstyle + '></div>' + //--
'<table>' + //--
'<tr><td>Rarity: </td><td><a ' + astyle1 + '" href="!brewmenu --rarity ?{Rarity?|Common|Uncommon|Rare|Very Rare|Legendary} --amount ' + amount + '">' + type + '</a></td></tr>' + //--
'<tr><td>Potion: </td><td><a ' + astyle1 + '" href="!setpotion --potion ?{Potion?|' + list + '} --type ' + type + ' --amount ' + amount + '">' + state.down.now.potion + '</a></td></tr>' + //--
'<tr><td>Amount: </td><td><a ' + astyle1 + '" href="!brewmenu --rarity ' + type + ' --amount ?{Amount?|1}">' + amount + '</a></td></tr>' + //--
'</table>' + //--
'<br>Price: ' + price + ' GP<br>' + //--
'Time needed: ' + time + ' Days<br>' + //--
'<div style="text-align:center;"><a ' + astyle2 + '" href="!brew --potion ' + state.down.now.potion + ' --amount ' + amount + '">Brew Potion</a></div>' + //--
'</div>'
);
}
}
})
},
brew = function(charid,potion,amount,msg) {
charid=charid.replace("charid ","");
let char=findObjs({
_type: 'character',
_id: charid
}, {caseInsensitive: true})[0];
let gold=findObjs({
_type: 'attribute',
_characterid: charid,
_name: "gp"
}, {caseInsensitive: true})[0];
let description;
let modifiers="Item Type: Potion";
let price;
let neededtime;
switch (potion) {
case 'Potion of Climbing':
description="When you drink this potion, you gain a climbing speed equal to your walking speed for 1 hour. During this time, you have advantage on Strength (Athletics) checks you make to climb. The potion is separated into brown, silver, and gray layers resembling bands of stone. Shaking the bottle fails to mix the colors.";
price=25;
time=2;
break;
case 'Potion of Healing':
description="When you drink this potion, you regain 2d4 + 2 Hit Points.";
modifiers+=", Damage: 2d4+2,Damage Type: Healing";
price=25;
time=2;
break;
case 'Oil of Slipperiness':
description="This sticky black unguent is thick and heavy in the container, but it flows quickly when poured. The oil can cover a Medium or smaller creature, along with the equipment it's wearing and carrying (one additional vial is required for each size category above Medium). Applying the oil takes 10 minutes. The affected creature then gains the effect of a Freedom of Movement spell for 8 hours.\nAlternatively, the oil can be poured on the ground as an action, where it covers a 10-foot square, duplicating the effect of the Grease spell in that area for 8 hours.";
price=100;
time=5;
break;
case 'Philter of Love':
description="The next time you see a creature within 10 minutes after drinking this philter, you become charmed by that creature for 1 hour. If the creature is of a species and gender you are normally attracted to, you regard it as your true love while you are charmed. This potion's rose-hued, effervescent liquid contains one easy-to-miss bubble shaped like a heart.";
price=100;
time=5;
break;
case 'Potion of Advantage':
description="When you drink this potion, you gain advantage on one ability check, attack roll, or saving throw of your choice that you make within the next hour.<br> This potion takes the form of a sparkling, golden mist that moves and pours like water";
price=100;
time=5;
break;
case 'Potion of Animal Friendship':
description="When you drink this potion, you can cast the Animal Friendship spell (save DC 13) for 1 hour at will. Agitating this muddy liquid brings little bits into view: a fish scale, a hummingbird tongue, a cat claw, or a squirrel hair.";
price=100;
time=5;
break;
case 'Potion of Fire Breath':
description="After drinking this potion, you can use a bonus action to exhale fire at a target within 30 feet of you. The target must make a DC 13 Dexterity saving throw, taking 4d6 fire damage on a failed save, or half as much damage on a successful one. The effect ends after you exhale the fire three times or when 1 hour has passed.<br>This potion\'s orange liquid flickers, and smoke fills the top of the container and wafts out whenever it is opened.";
price=100;
time=5;
break;
case 'Potion of Hill Giant Strength':
description="When you drink this potion, your Strength score changes to 21 for 1 hour. This potion has no effect on you if your Strength is equal to or greater than that score.<br><br> This potion\'s transparent liquid has floating in it a sliver of fingernail from a giant of the appropriate type. The potion of frost giant strength and the potion of stone giant strength have the same effect.";
price=100;
time=5;
break;
case 'Potion of Growth':
description="When you drink this potion, you gain the enlarge effect of the Enlarge/Reduce spell for 1d4 hours (no concentration required). The red in the potion's liquid continuously expands from a tiny beat to color the clear liquid around it and then contracts. Shaking the bottle fails to interrupt this process.";
price=100;
time=5;
break;
case 'Potion of Healing (Greater)':
potion="Potion of Greater Healing";
modifiers+=", Damage: 4d4+4,Damage Type: Healing";
description="You regain 4d4 + 4 hit points when you drink this potion.";
price=100;
time=5;
break;
case 'Potion of Poison':
description="This concoction looks, smells, and tastes like a Potion of Healing or other beneficial potion. However, it is actually poison masked by illusion magic. An Identify spell reveals its true nature.<br><br> If you drink it, you take 3d6 poison damage, and you must succeed on a DC 13 Constitution saving throw or be poisoned. At the start of each of your turns while you are poisoned in this way, you take 3d6 poison damage. At the end of each of your turns, you can repeat the saving throw. On a successful save, the poison damage you take on your subsequent turns decreases by 1d6. The poison ends when the damage decreases to 0.";
modifiers+=", Damage: 3d6, Damage Type: Poison";
price=100;
time=5;
break;
case 'Potion of Resistance':
description="When you drink this potion, you gain resistance to one type of damage for 1 hour. The DM chooses the type or determines it randomly.";
price=100;
time=5;
break;
case 'Potion of Water Breathing':
description="You can breathe underwater for 1 hour after drinking this potion. Its cloudy green fluid smells of the sea and has a jellyfish-like bubble floating in it.";
price=100;
time=5;
break;
case 'Elixir of Health':
description="When you drink this potion, it cures any disease afflicting you, and it removes the blinded, deafened, paralyzed, and poisoned conditions. The clear red liquid has tiny bubbles of light in it.";
price=1000;
time=25;
break;
case 'Oil of Etherealness':
description="Beads of this cloudy gray oil form on the outside of its container and quickly evaporate. The oil can cover a Medium or smaller creature, along with the equipment it's wearing and carrying (one additional vial is required for each size category above Medium). Applying the oil takes 10 minutes. The affected creature then gains the effect of the Etherealness spell for 1 hour.";
price=1000;
time=25;
break;
case 'Potion of Aqueous Form':
description="When you drink this potion, you transform into a pool of water. You return to your true form after 10 minutes or if you are incapacitated or die. You\'re under the following effects while in this form:<br><br> Liquid Movement. You have a swimming speed of 30 feet. You can move over or through other liquids. You can enter and occupy the space of another creature. You can rise up to your normal height, and you can pass through even Tiny openings. You extinguish nonmagical flames in any space you enter.<br><br> Watery Resilience. You have resistance to nonmagical damage. You also have advantage on Strength, Dexterity, and Constitution saving throws.<br><br> Limitations. You can\'t talk, attack, cast spells, or activate magic items. Any objects you were carrying or wearing meld into your new form and are inaccessible, though you continue to be affected by anything you\'re wearing, such as armor.";
price=1000;
time=25;
break;
case 'Potion of Clairvoyance':
description="When you drink this potion, you gain the effect of the Clairvoyance spell. An eyeball bobs in this yellowish liquid but vanishes when the potion is opened.";
break;
case 'Potion of Diminution':
description="When you drink this potion, you gain the reduce effect of the Enlarge/Reduce spell for 1d4 hours (no concentration required). The red in the potion\'s liquid continuously contracts to a tiny bead and then expands to color the clear liquid around it. Shaking the bottle fails to interrupt this process";
break;
case 'Potion of Gaseous Form':
description="When you drink this potion, you gain the effect of the Gaseous Form spell for 1 hour (no concentration required) or until you end the effect as a bonus action. This potion's container seems to hold fog that moves and pours like water";
price=1000;
time=25;
break;
case 'Potion of Frost Giant Strength':
description="When you drink this potion, your Strength score changes to 23 for 1 hour. This potion has no effect on you if your Strength is equal to or greater than that score.<br><br> This potion\'s transparent liquid has floating in it a sliver of fingernail from a giant of the appropriate type. The potion of frost giant strength and the potion of stone giant strength have the same effect.";
price=1000;
time=25;
break;
case 'Potion of Stone Giant Strength':
description="When you drink this potion, your Strength score changes to 23 for 1 hour. This potion has no effect on you if your Strength is equal to or greater than that score.<br><br> This potion\'s transparent liquid has floating in it a sliver of fingernail from a giant of the appropriate type. The potion of frost giant strength and the potion of stone giant strength have the same effect.";
price=1000;
time=25;
break;
case 'Potion of Fire Giant Strength':
description="When you drink this potion, your Strength score changes to 25 for 1 hour. This potion has no effect on you if your Strength is equal to or greater than that score.<br><br> This potion\'s transparent liquid has floating in it a sliver of fingernail from a giant of the appropriate type. The potion of frost giant strength and the potion of stone giant strength have the same effect.";
price=1000;
time=25;
break;
case 'Potion of Cloud Giant Strength':
description="When you drink this potion, your Strength score changes to 27 for 1 hour. This potion has no effect on you if your Strength is equal to or greater than that score.<br><br> This potion\'s transparent liquid has floating in it a sliver of fingernail from a giant of the appropriate type. The potion of frost giant strength and the potion of stone giant strength have the same effect.";
price=1000;
time=25;
break;
case 'Potion of Healing (Superior)':
potion="Potion of Superior Healing";
modifiers+=", Damage: 8d4+8,Damage Type: Healing";